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

107 lines
5.1KB

  1. <?php
  2. /**
  3. * 更新首页
  4. *
  5. * @version $id:makehtml_homepage.php 2 9:30 2010-11-11 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_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('sys_MakeHtml');
  13. require_once(DEDEINC."/archive/partview.class.php");
  14. if (empty($dopost)) $dopost = '';
  15. if ($dopost == "view") {
  16. $pv = new PartView();
  17. $templet = str_replace("{style}", $cfg_df_style, $templet);
  18. $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
  19. $pv->Display();
  20. exit();
  21. } else if ($dopost == "make") {
  22. if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) {
  23. $client = new DedeBizClient();
  24. $data = $client->AdminPWDExists();
  25. $data = json_decode($data->data);
  26. if ($data) {
  27. $rs = (array)($data->result);
  28. if ($rs["admin_pwd_exists"] == "false") {
  29. //设定dedebiz admin密码
  30. if ($dedebiz_admin == "" || $dedebiz_admin !== $re_dedebiz_admin) {
  31. echo "<link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/bootstrap.min.css\"><style>.modal {position: static;}</style>";
  32. echo "<div class=\"alert alert-danger\">DedeBIZ操作密码为空或两次指定的密码不符</div><br>";
  33. $client->Close();
  34. exit;
  35. }
  36. $data = $client->AdminPWDCreate($dedebiz_admin);
  37. if ($data->data != "ok") {
  38. echo "<link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/bootstrap.min.css\"><style>.modal {position: static;}</style>";
  39. echo "<div class=\"alert alert-danger\">DedeBIZ设定操作密码失败:${$data}</div><br>";
  40. $client->Close();
  41. exit;
  42. }
  43. } else {
  44. if ($dedebiz_admin == "") {
  45. echo "<link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/bootstrap.min.css\"><style>.modal {position: static;}</style>";
  46. echo "<div class=\"alert alert-danger\">DedeBIZ操作密码为空</div><br>";
  47. $client->Close();
  48. exit;
  49. }
  50. $data = $client->AdminSetIndexLockState($dedebiz_admin, $lockindex);
  51. if ($data->data != "ok") {
  52. echo "<link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/bootstrap.min.css\"><style>.modal {position: static;}</style>";
  53. echo "<div class=\"alert alert-danger\">DedeBIZ操作密码失败,填写正确的操作密码</div><br>";
  54. $client->Close();
  55. exit;
  56. }
  57. }
  58. }
  59. $client->Close();
  60. }
  61. $remotepos = empty($remotepos) ? '/index.html' : $remotepos;
  62. $serviterm = empty($serviterm) ? "" : $serviterm;
  63. if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($position))) {
  64. ShowMsg("指定的文件名已被系统禁止", "javascript:;");
  65. exit();
  66. }
  67. $homeFile = DEDEADMIN."/".$position;
  68. $homeFile = str_replace("\\", "/", $homeFile);
  69. $homeFile = str_replace("//", "/", $homeFile);
  70. $fp = fopen($homeFile, "w") or die("您指定的文件名有问题,无法创建文件");
  71. fclose($fp);
  72. if ($saveset == 1) {
  73. $iquery = "UPDATE `#@__homepageset` SET templet='$templet',position='$position' ";
  74. $dsql->ExecuteNoneQuery($iquery);
  75. }
  76. //判断首页生成模式
  77. if ($showmod == 1) {
  78. //需要生成静态
  79. $templet = str_replace("{style}", $cfg_df_style, $templet);
  80. $pv = new PartView();
  81. $GLOBALS['_arclistEnv'] = 'index';
  82. $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
  83. $pv->SaveToHtml($homeFile);
  84. echo "<link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/bootstrap.min.css\"><link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/admin.css\">";
  85. echo "<div class=\"alert alert-success\">更新首页模式:".$position." <a href=\"{$position}\" target=\"_blank\" class=\"btn btn-success btn-sm\">浏览</a></div>";
  86. } else {
  87. //动态浏览
  88. if (file_exists($homeFile)) @unlink($homeFile);
  89. echo "<link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/bootstrap.min.css\"><link rel=\"stylesheet\" href=\"{$cfg_cmsurl}/static/web/css/admin.css\">";
  90. echo "<div class=\"alert alert-success\">动态浏览模式:<a href=\"../index.php\" target=\"_blank\" class=\"btn btn-success btn-sm\">浏览</a></div>";
  91. }
  92. $iquery = "UPDATE `#@__homepageset` SET showmod='$showmod'";
  93. $dsql->ExecuteNoneQuery($iquery);
  94. if ($serviterm == "") {
  95. $config = array();
  96. } else {
  97. list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
  98. $config = array(
  99. 'hostname' => $servurl, 'username' => $servuser,
  100. 'password' => $servpwd, 'debug' => 'TRUE'
  101. );
  102. }
  103. exit();
  104. }
  105. $row = $dsql->GetOne("SELECT * FROM `#@__homepageset`");
  106. include DedeInclude('templets/makehtml_homepage.htm');
  107. ?>