<?php
set_time_limit(0);
ini_set('display_errors',1);
//difine frame root dir
define('ROOT_DIR',dirname(__FILE__));
define('SITE_DIR',dirname(ROOT_DIR));
//echo SITE_DIR;die();

if (!$app_dir) {
	$app_dir = '/www';
}

define('APP_DIR', ROOT_DIR.$app_dir);
//define views dir and actions
define('TPLS_DIR', APP_DIR.'/tpls');
define('ACTIONS', 'actions');

header('Content-type: text/html; charset=gbk');

if ($_REQUEST['ctrl']){
    define('FRAME_CONTROLLER', $_REQUEST['ctrl']);
}
if ($_REQUEST['method']){
    define('FRAME_METHOD', $_REQUEST['method']);
}

//load functions
require_once(ROOT_DIR.'/system/functions.php');
//site domain
$host = url::host();

//router
if (!$_router) {
	$_router = 'router';
}
$router = new $_router();

//get controller and method
$_controller = ACTIONS.'_'.$router->controller;
$_method = $router->method;

//run user's request
$controller = new $_controller();
$controller->$_method();
$controller->show_tpls();
?>