国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.7KB

  1. <?php
  2. /**
  3. * 修改模板
  4. *
  5. * @version $id:templets_one_edit.php 23:07 2010年7月20日 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 = "UPDATE `#@__sgpage` SETtitle='$title',keywords='$keywords',description='$description',likeid='$likeid',ismake='$ismake',filename='$filename',template='$template',uptime='$uptime',body='$body' WHERE aid='$aid'; ";
  36. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  37. ShowMsg("更新页面数据时失败,请检查长相是否有问题", "-1");
  38. exit();
  39. }
  40. $sg = new sgpage($aid);
  41. $sg->SaveToHtml();
  42. ShowMsg("成功修改一个页面", "templets_one.php");
  43. exit();
  44. } else if ($dopost == "delete") {
  45. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  46. $filename = preg_replace("#\/{1,}#", "/", $cfg_basedir.$cfg_cmspath."/".$row['filename']);
  47. $dsql->ExecuteNoneQuery(" DELETE FROM `#@__sgpage` WHERE aid='$aid' ");
  48. if (is_file($filename)) {
  49. unlink($filename);
  50. }
  51. ShowMsg("成功删除一个页面", "templets_one.php");
  52. exit();
  53. } else if ($dopost == "make") {
  54. include_once(DEDEINC."/archive/sgpage.class.php");
  55. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  56. $fileurl = $cfg_cmsurl.'/'.preg_replace("#\/{1,}#", "/", $row['filename']);
  57. $sg = new sgpage($aid);
  58. $sg->SaveToHtml();
  59. ShowMsg("成功更新一个页面", $fileurl);
  60. exit();
  61. } else if ($dopost == "mkall") {
  62. include_once(DEDEINC."/archive/sgpage.class.php");
  63. $dsql->Execute("ex", "SELECT aid FROM `#@__sgpage`");
  64. $i = 0;
  65. while ($row = $dsql->GetArray("ex")) {
  66. $sg = new sgpage($row['aid']);
  67. $sg->SaveToHtml();
  68. $i++;
  69. }
  70. ShowMsg("成功更新<span class='text-primary'>$i</span>个页面", '-1');
  71. exit();
  72. } else if ($dopost == "mksel") {
  73. if (empty($ids)) {
  74. $ids = '';
  75. }
  76. include_once(DEDEINC."/archive/sgpage.class.php");
  77. $i = 0;
  78. if ($ids == 0) {
  79. ShowMsg('您没有选择需要更新的文档', '-1');
  80. exit();
  81. } else if (is_array($ids)) {
  82. foreach ($ids as $aid) {
  83. $sg = new sgpage($aid);
  84. $sg->SaveToHtml();
  85. $i++;
  86. }
  87. ShowMsg("成功更新<span class='text-primary'>$i</span>个页面", '-1');
  88. exit();
  89. }
  90. } else if ($dopost == "view") {
  91. if (empty($aid)) {
  92. ShowMsg('错误的id', 'javascript:;');
  93. exit();
  94. }
  95. include_once(DEDEINC."/archive/sgpage.class.php");
  96. $sg = new sgpage($aid);
  97. $sg->display();
  98. exit();
  99. }
  100. $row = $dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' ");
  101. include(DEDEADMIN."/templets/templets_one_edit.htm");
  102. ?>