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

105 lines
5.0KB

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