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

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