国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

112 wiersze
3.7KB

  1. <?php
  2. /**
  3. * 编辑一个模板
  4. *
  5. * @version $Id: templets_one_edit.php 1 23:07 2010年7月20日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require(dirname(__FILE__)."/config.php");
  12. CheckPurview('temp_One');
  13. if (empty($dopost)) $dopost = "";
  14. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  15. if ($dopost == "saveedit") {
  16. include_once(DEDEINC."/archive/sgpage.class.php");
  17. $uptime = time();
  18. $body = str_replace('&quot;', '\\"', $body);
  19. $filename = preg_replace("#^\/#", "", $nfilename);
  20. if (DEDEBIZ_SAFE_MODE) $ismake = 0; //安全模式不允许编译
  21. if (!preg_match('#\.htm$#i', trim($template))) {
  22. ShowMsg("您指定的文件名被系统禁止", "javascript:;");
  23. exit();
  24. }
  25. //如果修改了文件名,删除旧文件
  26. if ($oldfilename != $filename) {
  27. $oldfilename = $cfg_basedir.$cfg_cmspath."/".$oldfilename;
  28. if (is_file($oldfilename)) {
  29. unlink($oldfilename);
  30. }
  31. }
  32. if ($likeidsel != $oldlikeid) {
  33. $likeid = $likeidsel;
  34. }
  35. $inQuery = "
  36. UPDATE `#@__sgpage` SET
  37. title='$title',
  38. keywords='$keywords',
  39. description='$description',
  40. likeid='$likeid',
  41. ismake='$ismake',
  42. filename='$filename',
  43. template='$template',
  44. uptime='$uptime',
  45. body='$body'
  46. WHERE aid='$aid'; ";
  47. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  48. ShowMsg("更新页面数据时失败,请检查长相是否有问题", "-1");
  49. exit();
  50. }
  51. $sg = new sgpage($aid);
  52. $sg->SaveToHtml();
  53. ShowMsg("成功修改一个页面", "templets_one.php");
  54. exit();
  55. } else if ($dopost == "delete") {
  56. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  57. $filename = preg_replace("#\/{1,}#", "/", $cfg_basedir.$cfg_cmspath."/".$row['filename']);
  58. $dsql->ExecuteNoneQuery(" DELETE FROM `#@__sgpage` WHERE aid='$aid' ");
  59. if (is_file($filename)) {
  60. unlink($filename);
  61. }
  62. ShowMsg("成功删除一个页面", "templets_one.php");
  63. exit();
  64. } else if ($dopost == "make") {
  65. include_once(DEDEINC."/archive/sgpage.class.php");
  66. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  67. $fileurl = $cfg_cmsurl.'/'.preg_replace("#\/{1,}#", "/", $row['filename']);
  68. $sg = new sgpage($aid);
  69. $sg->SaveToHtml();
  70. ShowMsg("成功更新一个页面", $fileurl);
  71. exit();
  72. } else if ($dopost == "mkall") {
  73. include_once(DEDEINC."/archive/sgpage.class.php");
  74. $dsql->Execute("ex", "SELECT aid FROM `#@__sgpage` ");
  75. $i = 0;
  76. while ($row = $dsql->GetArray("ex")) {
  77. $sg = new sgpage($row['aid']);
  78. $sg->SaveToHtml();
  79. $i++;
  80. }
  81. ShowMsg("成功更新 $i 个页面", '-1');
  82. exit();
  83. } else if ($dopost == "mksel") {
  84. if (empty($ids)) {
  85. $ids = '';
  86. }
  87. include_once(DEDEINC."/archive/sgpage.class.php");
  88. $i = 0;
  89. if ($ids == 0) {
  90. ShowMsg('您没有选择需要更新的文档', '-1');
  91. exit();
  92. } else if (is_array($ids)) {
  93. foreach ($ids as $aid) {
  94. $sg = new sgpage($aid);
  95. $sg->SaveToHtml();
  96. $i++;
  97. }
  98. ShowMsg("成功更新 $i 个页面", '-1');
  99. exit();
  100. }
  101. } else if ($dopost == "view") {
  102. if (empty($aid)) {
  103. ShowMsg('错误的ID', 'javascript:;');
  104. exit();
  105. }
  106. include_once(DEDEINC."/archive/sgpage.class.php");
  107. $sg = new sgpage($aid);
  108. $sg->display();
  109. exit();
  110. }
  111. $row = $dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' ");
  112. include(DEDEADMIN."/templets/templets_one_edit.htm");