bootstrap.sys.inc.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. load()->model('switch');
  18. $_W['token'] = token();
  19. $session = json_decode(authcode($_GPC['__session']), true);
  20. if (is_array($session)) {
  21. $user = user_single(array('uid'=>$session['uid']));
  22. if (is_array($user) && $session['hash'] === $user['hash']) {
  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. } else {
  32. isetcookie('__session', false, -100);
  33. }
  34. unset($user);
  35. }
  36. unset($session);
  37. $_W['uniacid'] = igetcookie('__uniacid');
  38. if (empty($_W['uniacid'])) {
  39. $_W['uniacid'] = switch_get_account_display();
  40. }
  41. $_W['uniacid'] = intval($_W['uniacid']);
  42. if (!empty($_W['uid'])) {
  43. $_W['highest_role'] = permission_account_user_role($_W['uid']);
  44. $_W['role'] = permission_account_user_role($_W['uid'], $_W['uniacid']);
  45. }
  46. $_W['template'] = '2.0';
  47. $_W['template'] = !empty($_W['setting']['basic']['template']) ? $_W['setting']['basic']['template'] : '2.0';
  48. $_W['attachurl'] = attachment_set_attach_url();