default-entry.ctrl.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. $dos = array('display');
  9. $do = in_array($do, $dos) ? $do : 'display';
  10. $module_name = trim($_GPC['m']);
  11. $modulelist = uni_modules();
  12. $module = $_W['current_module'] = $modulelist[$module_name];
  13. define('IN_MODULE', $module_name);
  14. if(empty($module)) {
  15. itoast('抱歉,你操作的模块不能被访问!');
  16. }
  17. if(!permission_check_account_user_module()) {
  18. itoast('您没有权限进行该操作');
  19. }
  20. if ($do == 'display') {
  21. $menu_entries = module_entries($module_name, array('menu'));
  22. $menu_entries = $menu_entries['menu'];
  23. $default_entry_id = !empty($module['config']) ? intval($module['config']['default_entry']) : 0;
  24. if (checksubmit()) {
  25. $default_entry = intval($_GPC['default_entry_id']);
  26. $data = !empty($module['config']) ? $module['config'] : array();
  27. if (empty($default_entry)) {
  28. unset($data['default_entry']);
  29. } else {
  30. $data['default_entry'] = $default_entry;
  31. }
  32. $insert_data['settings'] = iserializer($data);
  33. $insert_data['uniacid'] = $_W['uniacid'];
  34. $insert_data['module'] = $module_name;
  35. $setting = table('uni_account_modules')->isSettingExists($module_name);
  36. if (!$setting) {
  37. $insert_data['enabled'] = 1;
  38. pdo_insert('uni_account_modules', $insert_data);
  39. } else {
  40. pdo_update('uni_account_modules', array('settings' => iserializer($data)), array('uniacid' => $_W['uniacid'], 'module' => $module_name));
  41. }
  42. cache_build_module_info($module_name);
  43. itoast('保存成功!', '', 'success');
  44. }
  45. template('module/default-entry');
  46. }