#!/usr/bin/env php
<?php
/**
 * The command router file of zentaopms.
 *
 * ZenTaoPMS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * ZenTaoPMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with ZenTaoPMS.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @copyright   Copyright: 2009-2010 Chunsheng Wang
 * @author      Chunsheng Wang <wwccss@263.net>
 * @package     ZenTaoPMS
 * @version     $Id$
 * @link        http://www.zentao.cn
 */
define('IN_SHELL', true);

/* ȡ */
if($argc != 2)
{
    die('Usage: ' . basename(__FILE__) . " <request>\n");
}

/* ļ*/
chdir(dirname(__FILE__));
include '../../../framework/router.class.php';
include '../../../framework/control.class.php';
include '../../../framework/model.class.php';
include '../../../framework/helper.class.php';

/* ʵ·ɶ󣬲ãӵݿ⡣*/
$app    = router::createApp('pms');
$config = $app->loadConfig('common');
$dbh    = $app->connectDB();

/* ʱ*/
$app->setTimezone();

/* նʹõԣعõģ顣*/
$app->setClientLang('zh-cn');
$lang   = $app->loadLang('common');
$common = $app->loadCommon();

/* Ӧlibļóȫֱá*/
$app->loadClass('front',  $static = true);
$app->loadClass('filter', $static = true);
$app->setSuperVars();

/* PATH_INFO*/
putenv('PATH_INFO=' . trim($argv[1]));
$config->requestType = 'PATH_INFO';
$config->pathType    = 'clean';
$config->requestFix  = '-';

/* 󣬼ģ顣*/
$app->parseRequest();
$app->loadModule();
