人人商城

oauth.ctrl.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. load()->model('setting');
  8. load()->model('user');
  9. $dos = array('display', 'save_oauth');
  10. $do = in_array($_GPC['do'], $dos)? $do : 'display';
  11. $_W['page']['title'] = '站点管理 - oauth全局设置 - oauth全局设置';
  12. $oauth = setting_load('global_oauth');
  13. $oauth = !empty($oauth['global_oauth']) ? $oauth['global_oauth'] : array();
  14. if ($do == 'display') {
  15. $user_have_accounts = user_borrow_oauth_account_list();
  16. $oauth_accounts = $user_have_accounts['oauth_accounts'];
  17. }
  18. if ($do == 'save_oauth') {
  19. if (!$_W['isajax'] || !$_W['ispost']) {
  20. iajax(-1, '添加失败');
  21. }
  22. $oauth['oauth']['account'] = intval($_GPC['account']);
  23. $oauth['oauth']['host'] = safe_gpc_url(rtrim($_GPC['host'],'/'), false);
  24. if (!empty($_GPC['host']) && empty($oauth['oauth']['host'])) {
  25. iajax(-1, '域名不合法');
  26. }
  27. $result = setting_save($oauth, 'global_oauth');
  28. if (is_error($result)) {
  29. iajax(-1, '添加失败');
  30. }
  31. iajax(0, '添加成功', url('system/oauth'));
  32. }
  33. template('system/oauth');