-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
55 lines (44 loc) · 1.51 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/*
* This file is part of the Geek-Zoo Projects.
*
* @copyright (c) 2010 Geek-Zoo Projects More info http://www.geek-zoo.com
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License
* @author xuanyan <[email protected]>
*
*/
define('ROOT_PATH', dirname(__FILE__));
define('SITE_URL', 'http://'.$_SERVER['HTTP_HOST']);
require_once ROOT_PATH.'/Library/__init__.php';
require_once ROOT_PATH.'/config.php';
// Cookie::setDomain('.xxxx.com');
Database::$instance = Database::connect(Config::get('db'));
Database::$instance->initialization = array(
'SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary',
"SET sql_mode=''"
);
Model::$dir = ROOT_PATH.'/Models/admin';
Model::$dbPrefix = array('admin_'=>'*');
require_once ROOT_PATH.'/sys/sys.php';
if (!defined('SYS_IS_LOAD')) {
die('系统文件损坏');
}
Smarty3::instance()->setTemplateDir(ROOT_PATH.'/Templates');
Smarty3::instance()->compile_dir = ROOT_PATH.'/tmp/compile';
Smarty3::instance()->error_reporting = E_ALL ^ E_NOTICE;
//Smarty3::instance()->allow_php_tag = true;
try {
$result = Controller::dispatch(@$_SERVER['REDIRECT_URL'], ROOT_PATH.'/Controllers');
} catch (Exception $e) {
// out put 404 page
if ($e->getCode() == 404) {
header("HTTP/1.0 404 Not Found");
msg('页面不存在!');
}
die($e);
}
if ($result && Controller::$format == 'json') {
echo json_encode($result);
}
$_SESSION['LAST_URL'] = SITE_URL.$_SERVER['REQUEST_URI'];
?>