site_about.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. define('CURSCRIPT', 'site_about');
  4. require_once dirname(__FILE__) . '/global.php';
  5. require_once MYMPS_INC . '/db.class.php';
  6. !in_array($part, array('list', 'edit')) && ($part = 'list');
  7. if (!submit_check(CURSCRIPT . '_submit')) {
  8. chk_admin_purview('purview_栏目设置');
  9. require_once MYMPS_DATA . '/html_type.inc.php';
  10. if ($id) {
  11. $about = $db->getRow('SELECT * FROM ' . $db_mymps . 'about WHERE id = \'' . $id . '\'');
  12. }
  13. $acontent = $id ? get_editor('content', 'Default', $about['content']) : get_editor('content', 'Default', '');
  14. $about['displayorder'] = $id ? $about[displayorder] : $db->getOne('SELECT max(displayorder) FROM `' . $db_mymps . 'about` ') + 1;
  15. $about_type = $db->getAll('SELECT * FROM ' . $db_mymps . 'about ORDER BY displayorder ASC');
  16. $here = '关于我们设置';
  17. include mymps_tpl('site_about');
  18. } else {
  19. if ($part == 'list') {
  20. if (is_array($delids)) {
  21. $delids = implode(',', $delids);
  22. mymps_delete('about', 'WHERE id IN(' . $delids . ')');
  23. }
  24. if (is_array($displayorder)) {
  25. foreach ($displayorder as $key => $value) {
  26. $db->query('UPDATE `' . $db_mymps . 'about` SET displayorder = \'' . $value . '\' WHERE id = ' . $key);
  27. }
  28. }
  29. } else {
  30. if ($part == 'edit') {
  31. require_once dirname(__FILE__) . '/include/pinyin.inc.php';
  32. $pubdate = $time;
  33. $content = trim($content);
  34. if (!$id) {
  35. if (empty($typename)) {
  36. write_msg('栏目名称不能为空');
  37. }
  38. if (empty($content)) {
  39. write_msg('栏目内容不能为空');
  40. }
  41. $db->query('INSERT INTO ' . $db_mymps . 'about (typename,dir_type,content,pubdate,displayorder) VALUES (\'' . $typename . '\',\'' . $dir_type . '\',\'' . $content . '\',\'' . $pubdate . '\',\'' . $displayorder . '\')');
  42. $id = $db->insert_id();
  43. $dir_typename = get_htmlpath_type($dir_type, $typename, $id, $mydir);
  44. $db->query('UPDATE `' . $db_mymps . 'about` SET dir_typename = \'' . $dir_typename . '\' WHERE id = \'' . $id . '\'');
  45. } else {
  46. $dir_typename = get_htmlpath_type($dir_type, $typename, $id, $mydir);
  47. $db->query('UPDATE ' . $db_mymps . 'about SET typename = \'' . $typename . '\', content=\'' . $content . '\',pubdate=\'' . $pubdate . '\', dir_type = \'' . $dir_type . '\' , dir_typename = \'' . $dir_typename . '\',displayorder = \'' . $displayorder . '\' WHERE id = \'' . $id . '\'');
  48. $forward_url = '?part=edit&id=' . $id;
  49. }
  50. $seo = get_seoset();
  51. if ($seo['seo_force_about'] == 'html') {
  52. require_once MYMPS_SMARTY . '/include.php';
  53. include MYMPS_ASS . '/aboutus.php';
  54. $filepath = $seo['seo_htmldir'] . '/aboutus/' . $dir_typename . $seo['seo_htmlext'];
  55. $html_c = $smarty->fetch(mymps_tpl('aboutus', 'smarty'));
  56. $html_m = $smarty->MakeHtmlFile(MYMPS_ROOT . $filepath, $html_c);
  57. }
  58. }
  59. }
  60. write_msg('关于我们栏目更新或删除成功', $forward_url ? $forward_url : '?part=list', 'write_sys_record');
  61. }
  62. is_object($db) && $db->Close();
  63. $mymps_global = $db = $db_mymps = $part = NULL;