Exemple #1
0
 * @package     chanzhiEPS
 * @version     $Id$
 * @link        http://www.chanzhi.org
 */
/* Turn off error reporting first. */
error_reporting(0);
/* Start output buffer. */
ob_start();
/* Define the run mode as admin. */
define('RUN_MODE', 'admin');
/* Load the framework.*/
include 'loader.php';
/* Check admin entry. */
checkAdminEntry();
/* Instance the app. */
$app = router::createApp('chanzhi', $systemRoot);
$config = $app->config;
/* Check the reqeust is getconfig or not. Check installed or not. */
if (isset($_GET['mode']) and $_GET['mode'] == 'getconfig') {
    die($app->exportConfig());
}
if (!isset($config->installed) or !$config->installed) {
    die(header('location: install.php'));
}
/* Change the request settings. */
$config->frontRequestType = $config->requestType;
$config->requestType = 'GET';
$config->default->module = 'admin';
$config->default->method = 'index';
/* Run it. */
$common = $app->loadCommon();
Exemple #2
0
<?php

/* Set error reporting level. */
error_reporting(E_ALL ^ E_STRICT);
/* Save current working directory and then change the directory of init.php. */
$cwd = getcwd();
chdir(dirname(__FILE__));
/* Load the framework. */
include '../framework/router.class.php';
include '../framework/control.class.php';
include '../framework/model.class.php';
include '../framework/helper.class.php';
/* Create the app. */
$app = router::createApp('pms', dirname(dirname(__FILE__)));
/* Reconnect to the test database. */
include '../config/test.php';
$app->connectDB();
/* Load the common module. */
$common = $app->loadCommon();
/* Change directory back again. */
chdir($cwd);
Exemple #3
0
/**
 * The router file of zentaophp.
 *
 * All request should be routed by this router.
 *
 * The author disclaims copyright to this source code.  In place of
 * a legal notice, here is a blessing:
 * 
 *  May you do good and not evil.
 *  May you find forgiveness for yourself and forgive others.
 *  May you share freely, never taking more than you give.
 */
/* Set the error reporting. */
error_reporting(0);
/* Start output buffer. */
ob_start();
/* Load the framework. */
include './framework/router.class.php';
include './framework/control.class.php';
include './framework/model.class.php';
include './framework/helper.class.php';
/* Instance the app. */
$startTime = getTime();
$app = router::createApp('demo');
/* Run the app. */
$common = $app->loadCommon();
$app->parseRequest();
$app->loadModule();
/* Flush the buffer. */
echo helper::removeUTF8Bom(ob_get_clean());
Exemple #4
0
 * @copyright   Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Chunsheng Wang <*****@*****.**>
 * @package     RanZhi
 * @version     $Id: install.php 3138 2015-11-09 07:32:18Z chujilu $
 * @link        http://www.ranzhico.com
 */
error_reporting(E_ALL);
session_start();
define('RUN_MODE', 'install');
/* Load the framework. */
include '../../framework/router.class.php';
include '../../framework/control.class.php';
include '../../framework/model.class.php';
include '../../framework/helper.class.php';
/* Instance the app. */
$app = router::createApp('sys');
/* Check installed or not. */
if (!isset($_SESSION['installing']) and isset($config->installed) and $config->installed) {
    die(header('location: index.php'));
}
/* Reset the config params to make sure the install program will be lauched. */
$config->set('requestType', 'GET');
$config->set('default.module', 'install');
$app->setDebug();
/* During the installation, if the database params is setted, auto connect the db. */
if (isset($config->installed) and $config->installed) {
    $app->connectDB();
}
$app->parseRequest();
$app->loadModule();
Exemple #5
0
 * @package     chanzhiEPS
 * @version     $Id$
 * @link        http://www.chanzhi.org
 */
/* Turn off error reporting first. */
error_reporting(0);
/* Start output buffer. */
ob_start();
/* Define the run mode as admin. */
define('RUN_MODE', 'admin');
/* Load the framework.*/
include 'loader.php';
/* Check admin entry. */
checkAdminEntry();
/* Instance the app. */
$app = router::createApp('meizai', $systemRoot);
$config = $app->config;
/* Check the reqeust is getconfig or not. Check installed or not. */
if (isset($_GET['mode']) and $_GET['mode'] == 'getconfig') {
    die($app->exportConfig());
}
if (!isset($config->installed) or !$config->installed) {
    die(header('location: install.php'));
}
/* Change the request settings. */
$config->frontRequestType = $config->requestType;
$config->requestType = 'GET';
$config->default->module = 'admin';
$config->default->method = 'index';
/* Run it. */
$common = $app->loadCommon();
Exemple #6
0
 * @link        http://www.ranzhico.com
 */
/* Set the error reporting. */
error_reporting(E_ALL);
/* Start output buffer. */
ob_start();
/* Define the run mode as front. */
define('RUN_MODE', 'front');
/* Load the framework. */
$frameworkRoot = dirname(__FILE__);
include "{$frameworkRoot}/router.class.php";
include "{$frameworkRoot}/control.class.php";
include "{$frameworkRoot}/model.class.php";
include "{$frameworkRoot}/helper.class.php";
/* Log the time and define the run mode. */
$startTime = getTime();
/* Run the app. */
$app = router::createApp($appName);
$common = $app->loadCommon();
/* Check for need upgrade. */
if (RUN_MODE != 'upgrade') {
    $config->installedVersion = $common->loadModel('setting')->getVersion();
    if (!(!is_numeric($config->version[0]) and $config->version[0] != $config->installedVersion[0]) and version_compare($config->version, $config->installedVersion, '>')) {
        die(header('location: upgrade.php'));
    }
}
$app->parseRequest();
$common->checkPriv();
$app->loadModule();
/* Flush the buffer. */
echo helper::removeUTF8Bom(ob_get_clean());
#!/usr/bin/env php
<?php 
include '../../../tests/init.php';
// Include the init file of testing framework.
include '../../router.class.php';
// Include router class.
include '../../helper.class.php';
// Include helper class.
title("testing the logic for site code.");
$router = router::createApp('test', '../../../');
run(helper::getSiteCode('www.xirang.com')) && expect('xirang');
run(helper::getSiteCode('xirang.com')) && expect('xirang');
run(helper::getSiteCode('xirang.com.cn')) && expect('xirang');
run(helper::getSiteCode('www.xirang.cn')) && expect('xirang');
run(helper::getSiteCode('xirang')) && expect('xirang');
run(helper::getSiteCode('192.168.1.1')) && expect('192.168.1.1');
run(helper::getSiteCode('www.xirang.com.cn')) && expect('xirang');
run(appendChanzhiDomain());
run(helper::getSiteCode('xirang.n1.chanzhi.net')) && expect('xirang');
function appendChanzhiDomain()
{
    global $router;
    $router->config->domainPostfix .= '|n1.chanzhi.net|';
}