template.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. define('CURSCRIPT', 'template');
  4. require_once dirname(__FILE__) . '/global.php';
  5. require_once MYMPS_INC . '/db.class.php';
  6. $part = $part ? $part : 'list';
  7. if ($admin_cityid) {
  8. write_msg('您没有权限访问该页!');
  9. }
  10. (!defined('IN_ADMIN') || !defined('IN_MYMPS')) && exit('Access Denied');
  11. chk_admin_purview('purview_模板管理');
  12. $defaultset['portal'] = array('banmian' => 'portal', 'indextopinfo' => '12', 'newinfo' => '0', 'announce' => '8', 'faq' => '0', 'news' => '7', 'foreachinfo' => '0', 'telephone' => '16', 'lifebox' => '16', 'goods' => '8');
  13. $defaultset['classic'] = array('banmian' => 'classic', 'indextopinfo' => '12', 'newinfo' => '0', 'announce' => '8', 'faq' => '0', 'news' => '7', 'foreachinfo' => '6', 'telephone' => '12', 'lifebox' => '24', 'goods' => '8');
  14. $defaultset['simple'] = array('banmian' => 'simple', 'indextopinfo' => '20', 'newinfo' => '0', 'announce' => '0', 'faq' => '0', 'news' => '0', 'foreachinfo' => '0', 'telephone' => '16', 'lifebox' => '13', 'goods' => '8');
  15. $defaultset['gezi'] = array('banmian' => 'gezi', 'indextopinfo' => '12', 'newinfo' => '30', 'announce' => '8', 'faq' => '0', 'news' => '0', 'foreachinfo' => '0', 'telephone' => '16', 'lifebox' => '16', 'goods' => '8');
  16. if (!submit_check(CURSCRIPT . '_submit')) {
  17. require_once MYMPS_DATA . '/template.inc.php';
  18. $here = '模板管理';
  19. $tpl_index = $db->getOne('SELECT value FROM `' . $db_mymps . 'config` WHERE type=\'tpl\' AND description = \'tpl_set\'');
  20. $tpl_index = $tpl_index ? $charset == 'utf-8' ? utf8_unserialize($tpl_index) : unserialize($tpl_index) : $defaultset['classic'];
  21. $tpl_index[smp_cats][first] = is_array($tpl_index[smp_cats][first]) ? $tpl_index[smp_cats][first] : array();
  22. $tpl_index[smp_cats][second] = is_array($tpl_index[smp_cats][second]) ? $tpl_index[smp_cats][second] : array();
  23. $tpl_index[smp_cats][third] = is_array($tpl_index[smp_cats][third]) ? $tpl_index[smp_cats][third] : array();
  24. $tpl_index[smp_cats][fourth] = is_array($tpl_index[smp_cats][fourth]) ? $tpl_index[smp_cats][fourth] : array();
  25. $cat = $db->getAll('SELECT * FROM `' . $db_mymps . 'category` WHERE parentid = \'0\' ORDER BY catorder ASC');
  26. if (empty($mymps_global['head_style'])) {
  27. $mymps_global['head_style'] = 'nomal';
  28. }
  29. include mymps_tpl(CURSCRIPT);
  30. } else {
  31. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'cfg_tpl_dir\' AND type = \'config\'');
  32. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'bodybg\' AND type = \'config\'');
  33. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'screen_index\' AND type = \'config\'');
  34. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'screen_cat\' AND type = \'config\'');
  35. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'screen_info\' AND type = \'config\'');
  36. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'screen_search\' AND type = \'config\'');
  37. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'head_style\' AND type = \'config\'');
  38. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'cfg_tpl_dir\',\'' . $cfg_tpl_dir . '\',\'config\')');
  39. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'bodybg\',\'' . $bodybg . '\',\'config\')');
  40. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'screen_index\',\'' . $screen_index . '\',\'config\')');
  41. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'screen_cat\',\'' . $screen_cat . '\',\'config\')');
  42. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'screen_info\',\'' . $screen_info . '\',\'config\')');
  43. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'screen_search\',\'' . $screen_search . '\',\'config\')');
  44. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'head_style\',\'' . $head_style . '\',\'config\')');
  45. update_config_cache();
  46. $db->query('DELETE FROM `' . $db_mymps . 'config` WHERE description = \'tpl_set\' AND type = \'tpl\'');
  47. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value,type) values (\'tpl_set\',\'' . serialize($tpl_index) . '\',\'tpl\')');
  48. clear_cache_files('tpl_index');
  49. clear_cache_files('telephone');
  50. clear_cache_files('lifebox');
  51. clear_cache_files('friendlink');
  52. clear_cache_files('faq');
  53. write_msg('模板设置更新成功!', $return_url, 'write_record');
  54. }
  55. is_object($db) && $db->Close();
  56. $mymps_global = $db = $db_mymps = $part = NULL;