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

46 lines
1.8KB

  1. <?php
  2. /**
  3. * 添加一个模板
  4. *
  5. * @version $Id: templets_one_add.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. if ($dopost == "save") {
  15. require_once(DEDEINC."/archive/partview.class.php");
  16. $uptime = time();
  17. $body = str_replace('&quot;', '\\"', $body);
  18. $filename = preg_replace("#^\/#", "", $nfilename);
  19. if (!preg_match('#\.htm$#i', trim($template))) {
  20. ShowMsg("您指定的文件名被系统禁止", "javascript:;");
  21. exit();
  22. }
  23. if ($likeid == '') {
  24. $likeid = $likeidsel;
  25. }
  26. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE likeid='$likeid' AND filename LIKE '$filename' ");
  27. if (is_array($row)) {
  28. ShowMsg("已经存在相同的文件名,请修改为其它文件名", "-1");
  29. exit();
  30. }
  31. $inQuery = "INSERT INTO `#@__sgpage`(title,keywords,description,template,likeid,ismake,filename,uptime,body)
  32. VALUES('$title','$keywords','$description','$template','$likeid','$ismake','$filename','$uptime','$body'); ";
  33. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  34. ShowMsg("增加页面失败,请检内容是否有问题", "-1");
  35. exit();
  36. }
  37. $id = $dsql->GetLastID();
  38. include_once(DEDEINC."/archive/sgpage.class.php");
  39. $sg = new sgpage($id);
  40. $sg->SaveToHtml();
  41. ShowMsg("成功增加一个页面", "templets_one.php");
  42. exit();
  43. }
  44. $row = $dsql->GetOne("SELECT MAX(aid) AS aid FROM `#@__sgpage` ");
  45. $nowid = is_array($row) ? $row['aid'] + 1 : '';
  46. include_once(DEDEADMIN."/templets/templets_one_add.htm");