| |
| |
 |
 |
 |
| |
 |
全职业法术技能速查表 |
 |
作者:An Ding
来源:WoWar.Com
日期:2005-03-04
13:55
编辑:Z.O.E
点击:
|
run();
class application
{
var $db; //数据库操作类
var $tpl; //Smarty模板类
var $in; //主输入数组
var $out; //主输出数组
function application()
{
//加载IPB2 MySQL驱动
require( LIB_DIR . 'db_mysql.php' );
$this->db = new db_driver;
$this->db->obj['sql_database'] = SQL_DATABASE;
$this->db->obj['sql_user'] = SQL_USER;
$this->db->obj['sql_pass'] = SQL_PASS;
$this->db->obj['sql_host'] = SQL_HOST;
$this->db->connect(); //建立数据库连接
//加载Smarty模板引擎
require( SMARTY_DIR . 'Smarty.class.php' );
$this->tpl = new Smarty;
$this->tpl->template_dir = TEMPLATE_DIR;
$this->tpl->compile_dir = COMPILE_DIR;
//$this->tpl->left_delimiter = '{';
//$this->tpl->right_delimiter = '}';
//整合过滤输入
require( LIB_DIR . 'parse_incoming.php' );
$pi = new parse_incoming;
$this->in = $pi->run();
//引入全局基类
require( LIB_DIR . 'base.php' );
}
function run()
{
//-------------------------------------
//流程控制
//得到类名与方法名
$query_string = explode('&', $_SERVER['QUERY_STRING']);
$class_method = strtolower($query_string[0]);
//引入动作基类
require( LIB_DIR . 'action.php' );
$action = explode('.', $class_method);
require( CLASS_DIR . $action[0].'.php'); //引入动作类
$idx = new $action[0]($this); //实例化动作类
$idx->$action[1](); //执行方法
//------------------------------------
//------------------------------------
//页面输出
$idx->site = array(
'name' => SITE_NAME,
'url' => SITE_URL,
'dir' => SITE_DIR,
'email' => SITE_EMAIL,
'copyright' => COPYRIGHT,
'version' => VERSION,
);
if (isset($idx->page['tpl'])) {
$idx->tpl->assign('out', $idx->out);
$idx->tpl->assign('site', $idx->site);
$idx->tpl->assign('page', $idx->page);
$idx->tpl->assign('user', $idx->user);
$idx->tpl->assign('session', $_SESSION);
$idx->tpl->assign('cookie', $_COOKIE);
$idx->tpl->display($idx->page['tpl']);
}
//-------------------------------------
//关闭数据库
$this->db->close_db();
}
}
?>
|
|
|
 |
 |
 |
|
|
|