-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjiwai.inc.php.dist
executable file
·180 lines (148 loc) · 3.59 KB
/
jiwai.inc.php.dist
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
/**
* Common header of JiWai.de classes
* Note: should be included at the very beginning of each application.
*
* @package JiWai.de
* @copyright AKA Inc.
* @author zixia@zixia.net
* @version $Id$
*/
/**
* Path of JiWai.de
*
*/
define('JW_ROOT', dirname(__FILE__) . '/');
/**
* Hostname of JiWai.de
*
*/
define('JW_HOSTNAME', 'jiwai.de');
define('JW_SRVNAME', 'http://'.JW_HOSTNAME);
/**
* Path of configuration
*
*/
define('CONFIG_ROOT', JW_ROOT . 'config/');
/**
* Path of web modules
*
*/
define('CLASS_ROOT', JW_ROOT . 'class/');
/**
* Path of web modules
*
*/
define('LIB_ROOT', JW_ROOT . 'lib/');
/**
* Path of Locale
*/
define('LOCALE_ROOT', JW_ROOT . 'locale/');
/**
* Path of cache
*
*/
define('CACHE_ROOT', '/var/cache/tmpfs/jiwai/');
/**
* Path of Fragment
*/
define('FRAGMENT_ROOT', '/opt/fragment/');
/**
* Filter Dict File && Hard/Soft Length
* difine for db and other device
*/
define('JW_HARDLEN_DB', 420);
define('FILTER_DICT', CONFIG_ROOT . 'dictionary/filterdict.txt');
/**
* Mms Storage
*/
define('MMS_STORAGE_ROOT', '/opt/storage_MMS');
/**
* Template Path
*/
if(!defined('TPL_COMPILED_DIR'))
define('TPL_COMPILED_DIR', dirname(__FILE__).'/compiled' );
if(!defined('TPL_TEMPLATE_DIR'))
define('TPL_TEMPLATE_DIR', dirname(__FILE__).'/template' );
/**
* Path of config cache
*
*/
// XXX by zixia 2006-06-15 临时测试
//define('CONFIG_CACHE', "/tmp/alpha.xml.php");
define('CONFIG_CACHE', CACHE_ROOT . 'config/config.xml.php');
/**
* Path of err log
*
*/
define('ERROR_LOGFILE', CACHE_ROOT . 'err/ERR_{Date}_{Type}_{Code}.log');
define('EXCEPTION_LOG', true);
define('EXCEPTION_DISPLAY', false);
define('ERROR_LOG', true);
define('ERROR_DISPLAY', false);
if (!defined('CONSOLE'))
define('CONSOLE', !isset($_SERVER['REQUEST_URI']));
define('DEBUG', true);
define('DEBUG_LOGFILE', CACHE_ROOT . '/debug/DBG_{Date:YmdH}.log');
//define('DEBUG_DISPLAY_MODE', 'JSLOG');
define('DEBUG_LOG', true);
if (file_exists(CONFIG_CACHE)){
require_once CONFIG_CACHE;
}else{
JWConfig::Instance();
$config_data=JWConfig::dump();
$str=<<<STR
<?php
define('JW_CONFIG_DATA','$config_data');
?>
STR;
file_put_contents(CONFIG_CACHE,$str);
}
/**
* Autoload Class File
*
* @param string $class_name
*/
function __autoload($class_name) {
if (0===strpos($class_name,'JW'))
$file = CLASS_ROOT;
else
$file = LIB_ROOT;
$file .= $class_name . '.class.php';
$file = str_replace('_','/',$file);
require_once $file;
if (!class_exists($class_name) && !interface_exists($class_name) ) {
throw new JWException($class_name.' not found.');
}
}
//require_once 'JWDebug.class.php';
//require_once 'class/JWException.class.php';
if (!defined('NO_SESSION')) JWSession::Instance();
// use for strftime
setlocale(LC_ALL, 'zh_CN.UTF-8');
mb_internal_encoding("UTF-8");
// use for I18n
// JWI18n::Instance()->SetAppLocale();
function _e($str) { echo _($str); }
//for Lighty
if (empty($_SERVER['SCRIPT_URI']) && !empty($_SERVER['REQUEST_URI'])) {
$_SERVER['SCRIPT_URI'] = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
if( substr(@$_SERVER['SERVER_NAME'],0,5) == 'jiwai' && JWRequest::IsWapBrowser() ) {
Header('Location: http://m.jiwai.de/');
exit;
}
//XiaoI P4
if (JWRequest::IsWindowsLiveBrowser()) {
header('p3p: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
}
function debug($v, $e=false) {
$uid = JWLogin::GetCurrentUserId();
$debug_uid = array(1,89,3449);
if ( in_array($uid, $debug_uid) ) {
var_dump($v);
if ($e) exit(0);
}
}
if(false==CONSOLE) {ob_start();ob_start('ob_gzhandler');}
?>