人人商城

passport.ctrl.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. $dos = array('oauth', 'save_oauth', 'uc_setting', 'upload_file');
  8. $do = in_array($do, $dos) ? $do : 'oauth';
  9. $_W['page']['title'] = '公众平台oAuth选项 - 会员中心';
  10. load()->model('user');
  11. if ($do == 'save_oauth') {
  12. $type = $_GPC['type'];
  13. $account = trim($_GPC['account']);
  14. if ($type == 'oauth') {
  15. $host = safe_gpc_url(rtrim($_GPC['host'],'/'), false);
  16. if (!empty($_GPC['host']) && empty($host)) {
  17. iajax(-1, '域名不合法');
  18. }
  19. $data = array(
  20. 'host' => $host,
  21. 'account' => $account,
  22. );
  23. pdo_update('uni_settings', array('oauth' => iserializer($data)), array('uniacid' => $_W['uniacid']));
  24. cache_delete(cache_system_key('unisetting', array('uniacid' => $_W['uniacid'])));
  25. }
  26. if ($type == 'jsoauth') {
  27. pdo_update('uni_settings', array('jsauth_acid' => $account), array('uniacid' => $_W['uniacid']));
  28. cache_delete(cache_system_key('unisetting', array('uniacid' => $_W['uniacid'])));
  29. }
  30. iajax(0, '');
  31. }
  32. if ($do == 'oauth') {
  33. $oauthInfo = table('unisetting')->getOauthByUniacid($_W['uniacid']);
  34. $oauth = iunserializer($oauthInfo['oauth']) ? iunserializer($oauthInfo['oauth']) : array();
  35. $jsoauth = $oauthInfo['jsauth_acid'];
  36. $user_have_accounts = user_borrow_oauth_account_list();
  37. $oauth_accounts = $user_have_accounts['oauth_accounts'];
  38. $jsoauth_accounts = $user_have_accounts['jsoauth_accounts'];
  39. }
  40. template('profile/passport');