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

48 lines
1.5KB

  1. <?php
  2. if(!file_exists(dirname(__FILE__).'/../data/common.inc.php'))
  3. {
  4. header('Location:install/index.php');
  5. exit();
  6. }
  7. if ( preg_match("#PHP (.*) Development Server#",$_SERVER['SERVER_SOFTWARE']) )
  8. {
  9. if ( $_SERVER['REQUEST_URI'] == dirname($_SERVER['SCRIPT_NAME']) )
  10. {
  11. header('HTTP/1.1 301 Moved Permanently');
  12. header('Location:'.$_SERVER['REQUEST_URI'].'/');
  13. }
  14. }
  15. //自动生成HTML版
  16. if(isset($_GET['upcache']) || !file_exists('index.html'))
  17. {
  18. require_once (dirname(__FILE__) . "/../include/common.inc.php");
  19. require_once DEDEINC."/arc.partview.class.php";
  20. $GLOBALS['_arclistEnv'] = 'index';
  21. $row = $dsql->GetOne("Select * From `#@__homepageset`");
  22. $row['templet'] = MfTemplet($row['templet']);
  23. $pv = new PartView();
  24. $row['templet'] =str_replace('.htm','_m.htm',$row['templet']);
  25. if ( !file_exists($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']) )
  26. {
  27. echo "模板文件不存在,无法解析文档!";
  28. exit();
  29. }
  30. $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
  31. $row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;
  32. if ($row['showmod'] == 1)
  33. {
  34. $pv->SaveToHtml(dirname(__FILE__).'/index.html');
  35. include(dirname(__FILE__).'/index.html');
  36. exit();
  37. } else {
  38. $pv->Display();
  39. exit();
  40. }
  41. }
  42. else
  43. {
  44. header('HTTP/1.1 301 Moved Permanently');
  45. header('Location:index.html');
  46. }
  47. ?>