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

133 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) 2007 - 2020, DesDev, Inc.
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license http://help.dedecms.com/usersguide/license.html
  10. * @link http://www.dedecms.com
  11. */
  12. require(dirname(__FILE__)."/config.php");
  13. CheckPurview('temp_One');
  14. if(empty($dopost)) $dopost = "";
  15. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  16. if($dopost=="saveedit")
  17. {
  18. include_once(DEDEINC."/arc.sgpage.class.php");
  19. $uptime = time();
  20. $body = str_replace('&quot;', '\\"', $body);
  21. $filename = preg_replace("#^\/#", "", $nfilename);
  22. //如果更改了文件名,删除旧文件
  23. if($oldfilename!=$filename)
  24. {
  25. $oldfilename = $cfg_basedir.$cfg_cmspath."/".$oldfilename;
  26. if(is_file($oldfilename))
  27. {
  28. unlink($oldfilename);
  29. }
  30. }
  31. if($likeidsel!=$oldlikeid )
  32. {
  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. {
  49. ShowMsg("更新页面数据时失败,请检查长相是否有问题!","-1");
  50. exit();
  51. }
  52. $sg = new sgpage($aid);
  53. $sg->SaveToHtml();
  54. ShowMsg("成功修改一个页面!", "templets_one.php");
  55. exit();
  56. }
  57. else if($dopost=="delete")
  58. {
  59. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  60. $filename = preg_replace("#\/{1,}#", "/", $cfg_basedir.$cfg_cmspath."/".$row['filename']);
  61. $dsql->ExecuteNoneQuery(" DELETE FROM `#@__sgpage` WHERE aid='$aid' ");
  62. if(is_file($filename))
  63. {
  64. unlink($filename);
  65. }
  66. ShowMsg("成功删除一个页面!", "templets_one.php");
  67. exit();
  68. }
  69. else if($dopost=="make")
  70. {
  71. include_once(DEDEINC."/arc.sgpage.class.php");
  72. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'");
  73. $fileurl = $cfg_cmsurl.'/'.preg_replace("#\/{1,}#", "/", $row['filename']);
  74. $sg = new sgpage($aid);
  75. $sg->SaveToHtml();
  76. ShowMsg("成功更新一个页面!", $fileurl);
  77. exit();
  78. }
  79. else if($dopost=="mkall")
  80. {
  81. include_once(DEDEINC."/arc.sgpage.class.php");
  82. $dsql->Execute("ex","SELECT aid FROM `#@__sgpage` ");
  83. $i = 0;
  84. while($row = $dsql->GetArray("ex"))
  85. {
  86. $sg = new sgpage($row['aid']);
  87. $sg->SaveToHtml();
  88. $i++;
  89. }
  90. ShowMsg("成功更新 $i 个页面!", '-1');
  91. exit();
  92. }
  93. else if($dopost=="mksel")
  94. {
  95. if(empty($ids))
  96. {
  97. $ids = '';
  98. }
  99. include_once(DEDEINC."/arc.sgpage.class.php");
  100. $i = 0;
  101. if($ids == 0)
  102. {
  103. ShowMsg('您没有选择需要更新的文档!','-1');
  104. exit();
  105. }
  106. else if(is_array($ids))
  107. {
  108. foreach($ids as $aid)
  109. {
  110. $sg = new sgpage($aid);
  111. $sg->SaveToHtml();
  112. $i++;
  113. }
  114. ShowMsg("成功更新 $i 个页面!",'-1');
  115. exit();
  116. }
  117. }
  118. else if($dopost=="view")
  119. {
  120. if(empty($aid))
  121. {
  122. ShowMsg('错误的ID!','javascript:;');
  123. exit();
  124. }
  125. include_once(DEDEINC."/arc.sgpage.class.php");
  126. $sg = new sgpage($aid);
  127. $sg->display();
  128. exit();
  129. }
  130. $row = $dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' ");
  131. include(DEDEADMIN."/templets/templets_one_edit.htm");