entry.ctrl.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. if ($entry['module'] == 'store') {
  29. $store_data = array('name' => 'store', 'type' => 'business', 'title' => '站内商城', 'title_initial' => 'Z', 'version' => '1.0', 'ability' => '站内商城', 'description' => '站内商城', 'author' => 'we7team', 'issystem' => 1, 'account_support' => 2);
  30. $result = table('modules')->fill($store_data)->save();
  31. if ($result) {
  32. itoast('', referer());
  33. }
  34. }
  35. itoast("访问非法, 没有操作权限. (module: {$entry['module']})", '', '');
  36. }
  37. if (!$entry['direct']) {
  38. checklogin();
  39. $referer = (url_params(referer()));
  40. if (empty($_W['isajax']) && empty($_W['ispost']) && empty($_GPC['version_id']) && intval($referer['version_id']) > 0 &&
  41. ($referer['c'] == 'wxapp' ||
  42. $referer['c'] == 'site' && in_array($referer['a'], array('entry', 'nav')) ||
  43. $referer['c'] == 'home' && $referer['a'] == 'welcome' ||
  44. $referer['c'] == 'module' && in_array($referer['a'], array('manage-account', 'permission')))) {
  45. itoast('', $_W['siteurl'] . '&version_id=' . $referer['version_id']);
  46. }
  47. if (empty($_W['uniacid']) && $entry['entry'] != 'system_welcome' && $_GPC['module_type'] != 'system_welcome') {
  48. if (!empty($_GPC['version_id'])) {
  49. itoast('', url('account/display', array('type' => WXAPP_TYPE_SIGN)));
  50. } else {
  51. itoast('', url('account/display'));
  52. }
  53. }
  54. if ($entry['entry'] == 'menu') {
  55. $permission = permission_check_account_user_module($entry['module'] . '_menu_' . $entry['do'], $entry['module']);
  56. } else {
  57. $permission = permission_check_account_user_module($entry['module'] . '_rule', $entry['module']);
  58. }
  59. if (!$permission) {
  60. itoast('您没有权限进行该操作', '', '');
  61. }
  62. define('CRUMBS_NAV', 1);
  63. $_W['page']['title'] = $entry['title'];
  64. define('ACTIVE_FRAME_URL', url('site/entry/', array('eid' => $entry['eid'], 'version_id' => $_GPC['version_id'])));
  65. }
  66. if (!empty($entry['module']) && !empty($_W['founder'])) {
  67. if (ext_module_checkupdate($entry['module'])) {
  68. itoast('系统检测到该模块有更新,请点击“<a href="' . url('extension/module/upgrade', array('m' => $entry['module'])) . '">更新模块</a>”后继续使用!', '', 'error');
  69. }
  70. }
  71. $_GPC['__entry'] = $entry['title'];
  72. $_GPC['__state'] = $entry['state'];
  73. $_GPC['state'] = $entry['state'];
  74. $_GPC['m'] = $entry['module'];
  75. $_GPC['do'] = $entry['do'];
  76. $_W['current_module'] = $module;
  77. if ($entry['entry'] == 'system_welcome' || $_GPC['module_type'] == 'system_welcome') {
  78. $_GPC['module_type'] = 'system_welcome';
  79. define('SYSTEM_WELCOME_MODULE', true);
  80. $site = WeUtility::createModuleSystemWelcome($entry['module']);
  81. } else {
  82. $site = WeUtility::createModuleSite($entry['module']);
  83. }
  84. define('IN_MODULE', $entry['module']);
  85. if (!is_error($site)) {
  86. if ($_W['role'] == ACCOUNT_MANAGE_NAME_OWNER) {
  87. $_W['role'] = ACCOUNT_MANAGE_NAME_MANAGER;
  88. }
  89. $sysmodule = module_system();
  90. if (in_array($m, $sysmodule)) {
  91. $site_urls = $site->getTabUrls();
  92. }
  93. $do_function = defined('SYSTEM_WELCOME_MODULE') ? 'doPage' : 'doWeb';
  94. $method = $do_function . ucfirst($entry['do']);
  95. exit($site->$method());
  96. }
  97. itoast("访问的方法 {$method} 不存在.", referer(), 'error');