<?php
if($_GET['m'] && $_GET['c']){
    if($_SERVER['SERVER_NAME']=="www.zhiqq.com"&&($_GET['m']!="content" || $_GET['c']!="index")){header("location: /404.html");die; }//屏蔽执行其他php入口

	define('PHPCMS_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
//禁止写入执行文件
	if(strstr($_SERVER['REQUEST_URI'],"file_put_content") || strstr($_SERVER['REQUEST_URI'],"@eval(")){
		echo "非法参数";die;
	}
//关闭member用户功能
	if($_GET['m']=="member"){echo "member功能已关闭,请联系管理员";die; }
	include PHPCMS_PATH.'/phpcms/base.php';
//纯下载站的入口文件增加代码，禁止外人POST数据和上传文件
	if(file_get_contents("php://input") || (isset($_POST) && count($_POST)>0) ||  (isset($_FILES) && count($_FILES)>0)){
//		if ($_SERVER['SERVER_NAME'] != substr($_SERVER['HTTP_REFERER'], 7, strlen($_SERVER['SERVER_NAME'])) && $_SERVER['SERVER_NAME'] != substr($_SERVER['HTTP_REFERER'], 8, strlen($_SERVER['SERVER_NAME']))) exit('no upload');
	}
	pc_base::creat_app();
}else{
require __DIR__.'/../vendor/autoload.php';

require __DIR__.'/../Yii.php';

// Config
require __DIR__.'/../common/config/bootstrap.php';
require __DIR__.'/../frontend/config/bootstrap.php';

//
if (!checkInstalled()) {
    header("Location:install.php");
    die;
}

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__.'/../common/config/main.php'),
    require(__DIR__.'/../common/config/main-local.php'),
    require(__DIR__.'/../frontend/config/main.php'),
    require(__DIR__.'/../frontend/config/main-local.php')
);
(new yii\web\Application($config))->run();
}

