国内流行的内容管理系统(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.

111 lines
3.6KB

  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) 2020, 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 . "/arc.sgpage.class.php");
  17. $uptime = time();
  18. $body = str_replace('&quot;', '\\"', $body);
  19. $filename = preg_replace("#^\/#", "", $nfilename);
  20. //如果更改了文件名,删除旧文件
  21. if ($oldfilename != $filename) {
  22. $oldfilename = $cfg_basedir . $cfg_cmspath . "/" . $oldfilename;
  23. if (is_file($oldfilename)) {
  24. unlink($oldfilename);
  25. }
  26. }
  27. if ($likeidsel != $oldlikeid) {
  28. $likeid = $likeidsel;
  29. }
  30. $inQuery = "
  31. UPDATE `#@__sgpage` SET
  32. title='$title',
  33. keywords='$keywords',
  34. description='$description',
  35. likeid='$likeid',
  36. ismake='$ismake',
  37. filename='$filename',
  38. template='$template',
  39. uptime='$uptime',
  40. body='$body'
  41. WHERE aid='$aid'; ";
  42. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  43. ShowMsg("更新页面数据时失败,请检查长相是否有问题!", "-1");
  44. exit();
  45. }
  46. $sg = new sgpage($aid);
  47. $sg->SaveToHtml();
  48. ShowMsg("成功修改一个页面!", "templets_one.php");
  49. exit();
  50. } else if ($dopost == "delete") {
  51. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  52. $filename = preg_replace("#\/{1,}#", "/", $cfg_basedir . $cfg_cmspath . "/" . $row['filename']);
  53. $dsql->ExecuteNoneQuery(" DELETE FROM `#@__sgpage` WHERE aid='$aid' ");
  54. if (is_file($filename)) {
  55. unlink($filename);
  56. }
  57. ShowMsg("成功删除一个页面!", "templets_one.php");
  58. exit();
  59. } else if ($dopost == "make") {
  60. include_once(DEDEINC . "/arc.sgpage.class.php");
  61. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  62. $fileurl = $cfg_cmsurl . '/' . preg_replace("#\/{1,}#", "/", $row['filename']);
  63. $sg = new sgpage($aid);
  64. $sg->SaveToHtml();
  65. ShowMsg("成功更新一个页面!", $fileurl);
  66. exit();
  67. } else if ($dopost == "mkall") {
  68. include_once(DEDEINC . "/arc.sgpage.class.php");
  69. $dsql->Execute("ex", "SELECT aid FROM `#@__sgpage` ");
  70. $i = 0;
  71. while ($row = $dsql->GetArray("ex")) {
  72. $sg = new sgpage($row['aid']);
  73. $sg->SaveToHtml();
  74. $i++;
  75. }
  76. ShowMsg("成功更新 $i 个页面!", '-1');
  77. exit();
  78. } else if ($dopost == "mksel") {
  79. if (empty($ids)) {
  80. $ids = '';
  81. }
  82. include_once(DEDEINC . "/arc.sgpage.class.php");
  83. $i = 0;
  84. if ($ids == 0) {
  85. ShowMsg('您没有选择需要更新的文档!', '-1');
  86. exit();
  87. } else if (is_array($ids)) {
  88. foreach ($ids as $aid) {
  89. $sg = new sgpage($aid);
  90. $sg->SaveToHtml();
  91. $i++;
  92. }
  93. ShowMsg("成功更新 $i 个页面!", '-1');
  94. exit();
  95. }
  96. } else if ($dopost == "view") {
  97. if (empty($aid)) {
  98. ShowMsg('错误的ID!', 'javascript:;');
  99. exit();
  100. }
  101. include_once(DEDEINC . "/arc.sgpage.class.php");
  102. $sg = new sgpage($aid);
  103. $sg->display();
  104. exit();
  105. }
  106. $row = $dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' ");
  107. include(DEDEADMIN . "/templets/templets_one_edit.htm");