* @package ZenTaoPMS * @version $Id: index.php 5036 2013-07-06 05:26:44Z wyd621@gmail.com $ * @link http://www.zentao.net */ /* Set the error reporting. */ error_reporting(E_ALL); define('IN_USE', true); /* Start output buffer. */ ob_start(); /* Set cookie_httponly. */ ini_set("session.cookie_httponly", 1); /* Load the framework. */ include '../framework/router.class.php'; include '../framework/control.class.php'; include '../framework/model.class.php'; include '../framework/helper.class.php'; /* Log the time and define the run mode. */ $startTime = getTime(); /* Instance the app. */ $app = router::createApp('pms', dirname(dirname(__FILE__)), 'router'); /* installed or not. */ if(!isset($config->installed) or !$config->installed) die(header('location: install.php')); /* Check for need upgrade. */ $config->installedVersion = $app->getInstalledVersion(); if($config->version != $config->installedVersion) die(header('location: upgrade.php')); /* Run the app. */ $common = $app->loadCommon(); /* Check the request is getconfig or not. */ if(isset($_GET['mode']) and $_GET['mode'] == 'getconfig') die(helper::removeUTF8Bom($app->exportConfig())); /* Remove install.php and upgrade.php. */ if(file_exists('install.php') or file_exists('upgrade.php')) { $undeletedFiles = array(); if(file_exists('install.php')) $undeletedFiles[] = 'install.php'; if(file_exists('upgrade.php')) $undeletedFiles[] = 'upgrade.php'; $wwwDir = dirname(__FILE__); if($undeletedFiles) { echo "
"; echo "
安全起见,请删除 {$wwwDir} 目录下的 " . join(' 和 ', $undeletedFiles) . " 文件。
"; echo "
Please remove " . join(' and ', $undeletedFiles) . " under $wwwDir dir for security reason.
"; die("
"); } } /* If client device is mobile and version is pro, set the default view as mthml. */ if($app->clientDevice == 'mobile' and (strpos($config->version, 'pro') === 0 or strpos($config->version, 'biz') === 0 or strpos($config->version, 'max') === 0) and $config->default->view == 'html') $config->default->view = 'mhtml'; if(!empty($_GET['display']) && $_GET['display'] == 'card') $config->default->view = 'xhtml'; $app->parseRequest(); if(!$app->setParams()) return; $common->checkPriv(); $common->checkIframe(); $app->loadModule(); /* Flush the buffer. */ echo helper::removeUTF8Bom(ob_get_clean());