人人商城

bootstrap.sys.inc.php 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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()->web('common');
  8. load()->web('template');
  9. load()->func('file');
  10. load()->func('tpl');
  11. load()->model('account');
  12. load()->model('setting');
  13. load()->model('user');
  14. load()->model('permission');
  15. load()->model('attachment');
  16. load()->classs('oauth2/oauth2client');
  17. $_W['token'] = token();
  18. $session = json_decode(authcode($_GPC['__session']), true);
  19. if (is_array($session)) {
  20. $user = user_single(array('uid'=>$session['uid']));
  21. if (is_array($user) && ($session['hash'] === md5($user['password'] . $user['salt']) || $session['hash'] == $user['hash'])) {
  22. unset($user['password'], $user['salt']);
  23. $_W['uid'] = $user['uid'];
  24. $_W['username'] = $user['username'];
  25. $user['currentvisit'] = $user['lastvisit'];
  26. $user['currentip'] = $user['lastip'];
  27. $user['lastvisit'] = $session['lastvisit'];
  28. $user['lastip'] = $session['lastip'];
  29. $_W['user'] = $user;
  30. $_W['isfounder'] = user_is_founder($_W['uid']);
  31. unset($founders);
  32. } else {
  33. isetcookie('__session', false, -100);
  34. }
  35. unset($user);
  36. }
  37. unset($session);
  38. if (!empty($_GPC['__uniacid'])) {
  39. $_W['uniacid'] = intval($_GPC['__uniacid']);
  40. } else {
  41. $_W['uniacid'] = uni_account_last_switch();
  42. }
  43. if (!empty($_W['uid'])) {
  44. $_W['highest_role'] = permission_account_user_role($_W['uid']);
  45. $_W['role'] = permission_account_user_role($_W['uid'], $_W['uniacid']);
  46. $_W['role'] = !empty($_W['role']) ? $_W['role'] : $_W['highest_role'];
  47. }
  48. $_W['template'] = !empty($_W['setting']['basic']['template']) ? $_W['setting']['basic']['template'] : 'default';
  49. $_W['attachurl'] = attachment_set_attach_url();
  50. load()->func('compat.biz');