人人商城

entry.ctrl.php 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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('module');
  8. load()->model('extension');
  9. $eid = intval($_GPC['eid']);
  10. if (!empty($eid)) {
  11. $entry = module_entry($eid);
  12. } else {
  13. $entry = pdo_get('modules_bindings', array('module' => trim($_GPC['m']), 'do' => trim($_GPC['do'])));
  14. if (empty($entry)) {
  15. $entry = array(
  16. 'module' => $_GPC['m'],
  17. 'do' => $_GPC['do'],
  18. 'state' => $_GPC['state'],
  19. 'direct' => $_GPC['direct']
  20. );
  21. }
  22. }
  23. if (empty($entry) || empty($entry['do'])) {
  24. itoast('非法访问.', '', '');
  25. }
  26. $module = module_fetch($entry['module']);
  27. if (empty($module)) {
  28. itoast("访问非法, 没有操作权限. (module: {$entry['module']})", '', '');
  29. }
  30. if (!$entry['direct']) {
  31. checklogin();
  32. $referer = (url_params(referer()));
  33. if (empty($_W['isajax']) && empty($_W['ispost']) && empty($_GPC['version_id']) && intval($referer['version_id']) > 0 &&
  34. ($referer['c'] == 'wxapp' ||
  35. $referer['c'] == 'site' && in_array($referer['a'], array('entry', 'nav')) ||
  36. $referer['c'] == 'home' && $referer['a'] == 'welcome' ||
  37. $referer['c'] == 'module' && in_array($referer['a'], array('manage-account', 'permission')))) {
  38. itoast('', $_W['siteurl'] . '&version_id=' . $referer['version_id']);
  39. }
  40. if (empty($_W['uniacid']) && $entry['entry'] != 'system_welcome' && $_GPC['module_type'] != 'system_welcome') {
  41. if (!empty($_GPC['version_id'])) {
  42. itoast('', url('account/display', array('type' => WXAPP_TYPE_SIGN)));
  43. } else {
  44. itoast('', url('account/display'));
  45. }
  46. }
  47. if ($entry['entry'] == 'menu') {
  48. $permission = permission_check_account_user_module($entry['module'] . '_menu_' . $entry['do'], $entry['module']);
  49. } else {
  50. $permission = permission_check_account_user_module($entry['module'] . '_rule', $entry['module']);
  51. }
  52. if (!$permission) {
  53. itoast('您没有权限进行该操作', '', '');
  54. }
  55. define('CRUMBS_NAV', 1);
  56. $_W['page']['title'] = $entry['title'];
  57. define('ACTIVE_FRAME_URL', url('site/entry/', array('eid' => $entry['eid'], 'version_id' => $_GPC['version_id'])));
  58. }
  59. if (!empty($entry['module']) && !empty($_W['founder'])) {
  60. if (ext_module_checkupdate($entry['module'])) {
  61. itoast('系统检测到该模块有更新,请点击“<a href="' . url('extension/module/upgrade', array('m' => $entry['module'])) . '">更新模块</a>”后继续使用!', '', 'error');
  62. }
  63. }
  64. $_GPC['__entry'] = $entry['title'];
  65. $_GPC['__state'] = $entry['state'];
  66. $_GPC['state'] = $entry['state'];
  67. $_GPC['m'] = $entry['module'];
  68. $_GPC['do'] = $entry['do'];
  69. $_W['current_module'] = $module;
  70. if ($entry['entry'] == 'system_welcome' || $_GPC['module_type'] == 'system_welcome') {
  71. $_GPC['module_type'] = 'system_welcome';
  72. define('SYSTEM_WELCOME_MODULE', true);
  73. $site = WeUtility::createModuleSystemWelcome($entry['module']);
  74. } else {
  75. $site = WeUtility::createModuleSite($entry['module']);
  76. }
  77. define('IN_MODULE', $entry['module']);
  78. if (!is_error($site)) {
  79. if ($_W['role'] == ACCOUNT_MANAGE_NAME_OWNER) {
  80. $_W['role'] = ACCOUNT_MANAGE_NAME_MANAGER;
  81. }
  82. $sysmodule = module_system();
  83. if (in_array($m, $sysmodule)) {
  84. $site_urls = $site->getTabUrls();
  85. }
  86. $do_function = defined('SYSTEM_WELCOME_MODULE') ? 'doPage' : 'doWeb';
  87. $method = $do_function . ucfirst($entry['do']);
  88. exit($site->$method());
  89. }
  90. itoast("访问的方法 {$method} 不存在.", referer(), 'error');