forked from chrisguo/worktime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
40 lines (31 loc) · 1.07 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
<?php
date_default_timezone_set('Asia/Chongqing');
define('RUNTIME', $_SERVER['REQUEST_TIME']);
define('TODAY', date('Ymd', RUNTIME));
define('ROOT_DIR', dirname(__FILE__) . '/');
define('IS_AJAX', Lib_Req::any('ajax'));
if (isset($argv[0])) {
define('FROM_SHELL', true);
$_GET['ctl'] = $argv[1];
$_GET['act'] = $argv[2];
} else {
define('FROM_SHELL', false);
}
function __autoload($class) {
$class_exploded = explode('_', $class);
$class_exploded[count($class_exploded) - 1] = $class;
include ROOT_DIR . implode('/', $class_exploded) . '.php';
}
error_reporting(E_ALL);
session_start();
@set_magic_quotes_runtime(0);
unset($GLOBALS, $_ENV, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_ENV_VARS);
$params = array('ctl'=>'Index', 'act'=>'index');
foreach ($params as $param => $param_val_default) {
$param_val = Lib_Req::any($param);
$param_val = empty($param_val) ? $param_val_default : $param_val;
define(strtoupper($param), $param_val);
}
$class = 'Ctl_' . CTL;
$controller = new $class();
$controller->{ACT}();