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

47 lines
1.8KB

  1. <?php
  2. /**
  3. * 添加一个模板
  4. *
  5. * @version $id:templets_one_add.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. 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 (DEDEBIZ_SAFE_MODE) $ismake = 0; //安全模式不允许编译
  20. if (!preg_match('#\.htm$#i', trim($template))) {
  21. ShowMsg("指定的文件名已被系统禁止", "javascript:;");
  22. exit();
  23. }
  24. if ($likeid == '') {
  25. $likeid = $likeidsel;
  26. }
  27. $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE likeid='$likeid' AND filename LIKE '$filename' ");
  28. if (is_array($row)) {
  29. ShowMsg("已经存在相同的文件名,请修改为其它文件名", "-1");
  30. exit();
  31. }
  32. $inQuery = "INSERT INTO `#@__sgpage`(title,keywords,description,template,likeid,ismake,filename,uptime,body) 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");
  47. ?>