@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @file config/config.inc.php |
8 | 8 | * @author NAVER ([email protected]) |
9 | 9 | */ |
10 | -if(version_compare(PHP_VERSION, '5.4.0', '<')) |
|
10 | +if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
11 | 11 | { |
12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING); |
13 | 13 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT); |
17 | 17 | } |
18 | 18 | |
19 | -if(!defined('__XE__')) |
|
19 | +if (!defined('__XE__')) |
|
20 | 20 | { |
21 | 21 | exit(); |
22 | 22 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | ini_set('session.use_only_cookies', 0); |
54 | 54 | |
55 | 55 | |
56 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php')) |
|
56 | +if (file_exists(_XE_PATH_.'config/package.inc.php')) |
|
57 | 57 | { |
58 | - require _XE_PATH_ . 'config/package.inc.php'; |
|
58 | + require _XE_PATH_.'config/package.inc.php'; |
|
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | * define('__ENABLE_PHPUNIT_TEST__', 0); |
98 | 98 | * define('__PROXY_SERVER__', 'http://domain:port/path'); |
99 | 99 | */ |
100 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php')) |
|
100 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php')) |
|
101 | 101 | { |
102 | - require _XE_PATH_ . 'config/config.user.inc.php'; |
|
102 | + require _XE_PATH_.'config/config.user.inc.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | -if(!defined('__DEBUG__')) |
|
105 | +if (!defined('__DEBUG__')) |
|
106 | 106 | { |
107 | 107 | /** |
108 | 108 | * output debug message(bit value) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | define('__DEBUG__', 0); |
118 | 118 | } |
119 | 119 | |
120 | -if(!defined('__DEBUG_OUTPUT__')) |
|
120 | +if (!defined('__DEBUG_OUTPUT__')) |
|
121 | 121 | { |
122 | 122 | /** |
123 | 123 | * output location of debug message |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | define('__DEBUG_OUTPUT__', 0); |
132 | 132 | } |
133 | 133 | |
134 | -if(!defined('__DEBUG_PROTECT__')) |
|
134 | +if (!defined('__DEBUG_PROTECT__')) |
|
135 | 135 | { |
136 | 136 | /** |
137 | 137 | * output comments of the firePHP console and browser |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | define('__DEBUG_PROTECT__', 1); |
145 | 145 | } |
146 | 146 | |
147 | -if(!defined('__DEBUG_PROTECT_IP__')) |
|
147 | +if (!defined('__DEBUG_PROTECT_IP__')) |
|
148 | 148 | { |
149 | 149 | /** |
150 | 150 | * Set a ip address to allow debug |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | define('__DEBUG_PROTECT_IP__', '127.0.0.1'); |
153 | 153 | } |
154 | 154 | |
155 | -if(!defined('__DEBUG_DB_OUTPUT__')) |
|
155 | +if (!defined('__DEBUG_DB_OUTPUT__')) |
|
156 | 156 | { |
157 | 157 | /** |
158 | 158 | * DB error message definition |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | define('__DEBUG_DB_OUTPUT__', 0); |
166 | 166 | } |
167 | 167 | |
168 | -if(!defined('__LOG_SLOW_QUERY__')) |
|
168 | +if (!defined('__LOG_SLOW_QUERY__')) |
|
169 | 169 | { |
170 | 170 | /** |
171 | 171 | * Query log for only timeout query among DB queries |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | define('__LOG_SLOW_QUERY__', 0); |
180 | 180 | } |
181 | 181 | |
182 | -if(!defined('__LOG_SLOW_TRIGGER__')) |
|
182 | +if (!defined('__LOG_SLOW_TRIGGER__')) |
|
183 | 183 | { |
184 | 184 | /** |
185 | 185 | * Trigger excute time log |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | define('__LOG_SLOW_TRIGGER__', 0); |
194 | 194 | } |
195 | 195 | |
196 | -if(!defined('__LOG_SLOW_ADDON__')) |
|
196 | +if (!defined('__LOG_SLOW_ADDON__')) |
|
197 | 197 | { |
198 | 198 | /** |
199 | 199 | * Addon excute time log |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | define('__LOG_SLOW_ADDON__', 0); |
208 | 208 | } |
209 | 209 | |
210 | -if(!defined('__LOG_SLOW_WIDGET__')) |
|
210 | +if (!defined('__LOG_SLOW_WIDGET__')) |
|
211 | 211 | { |
212 | 212 | /** |
213 | 213 | * Widget excute time log |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | define('__LOG_SLOW_WIDGET__', 0); |
222 | 222 | } |
223 | 223 | |
224 | -if(!defined('__DEBUG_QUERY__')) |
|
224 | +if (!defined('__DEBUG_QUERY__')) |
|
225 | 225 | { |
226 | 226 | /** |
227 | 227 | * Leave DB query information |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | define('__DEBUG_QUERY__', 0); |
235 | 235 | } |
236 | 236 | |
237 | -if(!defined('__OB_GZHANDLER_ENABLE__')) |
|
237 | +if (!defined('__OB_GZHANDLER_ENABLE__')) |
|
238 | 238 | { |
239 | 239 | /** |
240 | 240 | * option to enable/disable a compression feature using ob_gzhandler |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | define('__OB_GZHANDLER_ENABLE__', 1); |
249 | 249 | } |
250 | 250 | |
251 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) |
|
251 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) |
|
252 | 252 | { |
253 | 253 | /** |
254 | 254 | * decide to use/not use the php unit test (Path/tests/index.php) |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | define('__ENABLE_PHPUNIT_TEST__', 0); |
262 | 262 | } |
263 | 263 | |
264 | -if(!defined('__PROXY_SERVER__')) |
|
264 | +if (!defined('__PROXY_SERVER__')) |
|
265 | 265 | { |
266 | 266 | /** |
267 | 267 | * __PROXY_SERVER__ has server information to request to the external through the target server |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | define('__PROXY_SERVER__', NULL); |
271 | 271 | } |
272 | 272 | |
273 | -if(!defined('__ERROR_LOG__')) |
|
273 | +if (!defined('__ERROR_LOG__')) |
|
274 | 274 | { |
275 | 275 | /** |
276 | 276 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다. |
@@ -282,25 +282,25 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | // Require specific files when using Firebug console output |
285 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
285 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
286 | 286 | { |
287 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php'; |
|
287 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php'; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Set Timezone as server time |
291 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
291 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
292 | 292 | { |
293 | 293 | date_default_timezone_set(@date_default_timezone_get()); |
294 | 294 | } |
295 | 295 | |
296 | 296 | // Require a function-defined-file for simple use |
297 | -require(_XE_PATH_ . 'config/func.inc.php'); |
|
297 | +require(_XE_PATH_.'config/func.inc.php'); |
|
298 | 298 | |
299 | -if(__DEBUG__) { |
|
299 | +if (__DEBUG__) { |
|
300 | 300 | define('__StartTime__', getMicroTime()); |
301 | 301 | } |
302 | 302 | |
303 | -if(__DEBUG__) { |
|
303 | +if (__DEBUG__) { |
|
304 | 304 | $GLOBALS['__elapsed_class_load__'] = 0; |
305 | 305 | } |
306 | 306 | |
@@ -402,38 +402,38 @@ discard block |
||
402 | 402 | |
403 | 403 | function __xe_autoload($class_name) |
404 | 404 | { |
405 | - if(__DEBUG__) { |
|
405 | + if (__DEBUG__) { |
|
406 | 406 | $time_at = getMicroTime(); |
407 | 407 | } |
408 | 408 | |
409 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
409 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
410 | 410 | { |
411 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
411 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
412 | 412 | } |
413 | - elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
413 | + elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
414 | 414 | { |
415 | 415 | $candidate_filename = array(); |
416 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1]; |
|
417 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
416 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1]; |
|
417 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
418 | 418 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class'; |
419 | 419 | $candidate_filename[] = 'php'; |
420 | 420 | |
421 | 421 | $candidate_filename = implode('.', $candidate_filename); |
422 | 422 | |
423 | - if(file_exists(_XE_PATH_ . $candidate_filename)) |
|
423 | + if (file_exists(_XE_PATH_.$candidate_filename)) |
|
424 | 424 | { |
425 | - require _XE_PATH_ . $candidate_filename; |
|
425 | + require _XE_PATH_.$candidate_filename; |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
429 | - if(__DEBUG__) { |
|
429 | + if (__DEBUG__) { |
|
430 | 430 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at; |
431 | 431 | } |
432 | 432 | } |
433 | 433 | spl_autoload_register('__xe_autoload'); |
434 | 434 | |
435 | -if(file_exists(_XE_PATH_ . '/vendor/autoload.php')) { |
|
436 | - require _XE_PATH_ . '/vendor/autoload.php'; |
|
435 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { |
|
436 | + require _XE_PATH_.'/vendor/autoload.php'; |
|
437 | 437 | } |
438 | 438 | /* End of file config.inc.php */ |
439 | 439 | /* Location: ./config/config.inc.php */ |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
36 | 36 | { |
37 | 37 | // If XE has not installed yet, set module as install |
38 | - if(!Context::isInstalled()) |
|
38 | + if (!Context::isInstalled()) |
|
39 | 39 | { |
40 | 40 | $this->module = 'install'; |
41 | 41 | $this->act = Context::get('act'); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | $oContext = Context::getInstance(); |
46 | - if($oContext->isSuccessInit == FALSE) |
|
46 | + if ($oContext->isSuccessInit == FALSE) |
|
47 | 47 | { |
48 | 48 | $logged_info = Context::get('logged_info'); |
49 | - if($logged_info->is_admin != "Y") |
|
49 | + if ($logged_info->is_admin != "Y") |
|
50 | 50 | { |
51 | 51 | $this->error = 'msg_invalid_request'; |
52 | 52 | return; |
@@ -59,26 +59,26 @@ discard block |
||
59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
62 | - if($entry = Context::get('entry')) |
|
62 | + if ($entry = Context::get('entry')) |
|
63 | 63 | { |
64 | 64 | $this->entry = Context::convertEncodingStr($entry); |
65 | 65 | } |
66 | 66 | |
67 | 67 | // Validate variables to prevent XSS |
68 | 68 | $isInvalid = NULL; |
69 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
69 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
70 | 70 | { |
71 | 71 | $isInvalid = TRUE; |
72 | 72 | } |
73 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
73 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
74 | 74 | { |
75 | 75 | $isInvalid = TRUE; |
76 | 76 | } |
77 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
77 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
78 | 78 | { |
79 | 79 | $isInvalid = TRUE; |
80 | 80 | } |
81 | - if($isInvalid) |
|
81 | + if ($isInvalid) |
|
82 | 82 | { |
83 | 83 | htmlHeader(); |
84 | 84 | echo Context::getLang("msg_invalid_request"); |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | exit; |
88 | 88 | } |
89 | 89 | |
90 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
90 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
91 | 91 | { |
92 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
92 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
93 | 93 | { |
94 | - if(Context::get('_https_port')!=null) { |
|
95 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
94 | + if (Context::get('_https_port') != null) { |
|
95 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
96 | 96 | } else { |
97 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
97 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
98 | 98 | } |
99 | 99 | return; |
100 | 100 | } |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | |
103 | 103 | // call a trigger before moduleHandler init |
104 | 104 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
105 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
105 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
106 | 106 | { |
107 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
107 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
108 | 108 | { |
109 | 109 | set_error_handler(array($this, 'xeErrorLog'), 3); |
110 | - if(3 & E_ERROR) |
|
110 | + if (3 & E_ERROR) |
|
111 | 111 | { |
112 | 112 | register_shutdown_function(array($this, 'shutdownHandler')); |
113 | 113 | } |
114 | 114 | } |
115 | - else if(__DEBUG_PROTECT__ === 0) |
|
115 | + else if (__DEBUG_PROTECT__ === 0) |
|
116 | 116 | { |
117 | 117 | set_error_handler(array($this, 'xeErrorLog'), 3); |
118 | - if(3 & E_ERROR) |
|
118 | + if (3 & E_ERROR) |
|
119 | 119 | { |
120 | 120 | register_shutdown_function(array($this, 'shutdownHandler')); |
121 | 121 | } |
@@ -126,23 +126,23 @@ discard block |
||
126 | 126 | $called_position = 'before_module_init'; |
127 | 127 | $oAddonController = getController('addon'); |
128 | 128 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
129 | - if(file_exists($addon_file)) include($addon_file); |
|
129 | + if (file_exists($addon_file)) include($addon_file); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
133 | 133 | { |
134 | 134 | |
135 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
135 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
136 | 136 | { |
137 | 137 | return false; |
138 | 138 | } |
139 | - $errorname = self::getErrorType($errnumber);; |
|
139 | + $errorname = self::getErrorType($errnumber); ; |
|
140 | 140 | |
141 | 141 | set_error_handler(array($this, 'dummyHandler'), ~0); |
142 | - $buff = "\n" . $errorname . " : "; |
|
143 | - $buff .= $errormassage . "\n"; |
|
144 | - $buff .= "file : " . $errorfile . " line : "; |
|
145 | - $buff .= $errorline . "\n"; |
|
142 | + $buff = "\n".$errorname." : "; |
|
143 | + $buff .= $errormassage."\n"; |
|
144 | + $buff .= "file : ".$errorfile." line : "; |
|
145 | + $buff .= $errorline."\n"; |
|
146 | 146 | debugPrint($buff); |
147 | 147 | restore_error_handler(); |
148 | 148 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | { |
157 | 157 | return false; |
158 | 158 | } |
159 | - $errorname = self::getErrorType($errinfo['type']);; |
|
159 | + $errorname = self::getErrorType($errinfo['type']); ; |
|
160 | 160 | |
161 | 161 | set_error_handler(array($this, 'dummyHandler'), ~0); |
162 | - $buff = "\n" . $errorname . " : "; |
|
163 | - $buff .= $errinfo['message'] . "\n"; |
|
164 | - $buff .= "file : " . $errinfo['file'] . " line : "; |
|
165 | - $buff .= $errinfo['line'] . "\n"; |
|
162 | + $buff = "\n".$errorname." : "; |
|
163 | + $buff .= $errinfo['message']."\n"; |
|
164 | + $buff .= "file : ".$errinfo['file']." line : "; |
|
165 | + $buff .= $errinfo['line']."\n"; |
|
166 | 166 | debugPrint($buff); |
167 | 167 | set_error_handler(array($this, 'dummyHandler'), ~0); |
168 | 168 | } |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | |
211 | 211 | // if success_return_url and error_return_url is incorrect |
212 | 212 | $urls = array(Context::get('success_return_url'), Context::get('error_return_url')); |
213 | - foreach($urls as $url) |
|
213 | + foreach ($urls as $url) |
|
214 | 214 | { |
215 | - if(empty($url)) |
|
215 | + if (empty($url)) |
|
216 | 216 | { |
217 | 217 | continue; |
218 | 218 | } |
@@ -224,29 +224,29 @@ discard block |
||
224 | 224 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
225 | 225 | $defaultHost = $defaultUrlInfo['host']; |
226 | 226 | |
227 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
227 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
228 | 228 | { |
229 | 229 | throw new Exception('msg_default_url_is_null'); |
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
233 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
234 | 234 | { |
235 | 235 | $oDocumentModel = getModel('document'); |
236 | 236 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
237 | - if($this->document_srl) |
|
237 | + if ($this->document_srl) |
|
238 | 238 | { |
239 | 239 | Context::set('document_srl', $this->document_srl); |
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | 243 | // Get module's information based on document_srl, if it's specified |
244 | - if($this->document_srl) |
|
244 | + if ($this->document_srl) |
|
245 | 245 | { |
246 | 246 | |
247 | 247 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
248 | 248 | // If the document does not exist, remove document_srl |
249 | - if(!$module_info) |
|
249 | + if (!$module_info) |
|
250 | 250 | { |
251 | 251 | unset($this->document_srl); |
252 | 252 | } |
@@ -254,13 +254,13 @@ discard block |
||
254 | 254 | { |
255 | 255 | // If it exists, compare mid based on the module information |
256 | 256 | // if mids are not matching, set it as the document's mid |
257 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
257 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
258 | 258 | { |
259 | 259 | |
260 | - if(Context::getRequestMethod() == 'GET') |
|
260 | + if (Context::getRequestMethod() == 'GET') |
|
261 | 261 | { |
262 | 262 | $this->mid = $module_info->mid; |
263 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
263 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
264 | 264 | return FALSE; |
265 | 265 | } |
266 | 266 | else |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | } |
273 | 273 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
274 | - if($this->module && $module_info->module != $this->module) |
|
274 | + if ($this->module && $module_info->module != $this->module) |
|
275 | 275 | { |
276 | 276 | unset($module_info); |
277 | 277 | } |
@@ -280,36 +280,36 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
283 | - if(!$module_info && $this->mid) |
|
283 | + if (!$module_info && $this->mid) |
|
284 | 284 | { |
285 | 285 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
286 | 286 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
287 | 287 | } |
288 | 288 | |
289 | 289 | // redirect, if module_site_srl and site_srl are different |
290 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
290 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
291 | 291 | { |
292 | 292 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
293 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
293 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
294 | 294 | return FALSE; |
295 | 295 | } |
296 | 296 | |
297 | 297 | // If module_info is not set still, and $module does not exist, find the default module |
298 | - if(!$module_info && !$this->module && !$this->mid) |
|
298 | + if (!$module_info && !$this->module && !$this->mid) |
|
299 | 299 | { |
300 | 300 | $module_info = $site_module_info; |
301 | 301 | } |
302 | 302 | |
303 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
303 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
304 | 304 | { |
305 | 305 | $module_info = $site_module_info; |
306 | 306 | } |
307 | 307 | |
308 | 308 | // redirect, if site_srl of module_info is different from one of site's module_info |
309 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
309 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
310 | 310 | { |
311 | 311 | // If the module is of virtual site |
312 | - if($module_info->site_srl) |
|
312 | + if ($module_info->site_srl) |
|
313 | 313 | { |
314 | 314 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
315 | 315 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | else |
319 | 319 | { |
320 | 320 | $db_info = Context::getDBInfo(); |
321 | - if(!$db_info->default_url) |
|
321 | + if (!$db_info->default_url) |
|
322 | 322 | { |
323 | 323 | return Context::getLang('msg_default_url_is_not_defined'); |
324 | 324 | } |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
328 | 328 | } |
329 | 329 | } |
330 | - header("location:" . $redirect_url); |
|
330 | + header("location:".$redirect_url); |
|
331 | 331 | return FALSE; |
332 | 332 | } |
333 | 333 | |
334 | 334 | // If module info was set, retrieve variables from the module information |
335 | - if($module_info) |
|
335 | + if ($module_info) |
|
336 | 336 | { |
337 | 337 | $this->module = $module_info->module; |
338 | 338 | $this->mid = $module_info->mid; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
344 | 344 | |
345 | 345 | // use the site default layout. |
346 | - if($module_info->{$targetSrl} == -1) |
|
346 | + if ($module_info->{$targetSrl} == -1) |
|
347 | 347 | { |
348 | 348 | $oLayoutAdminModel = getAdminModel('layout'); |
349 | 349 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | // Set module and mid into module_info |
364 | - if(!isset($this->module_info)) |
|
364 | + if (!isset($this->module_info)) |
|
365 | 365 | { |
366 | 366 | $this->module_info = new stdClass(); |
367 | 367 | } |
@@ -372,21 +372,21 @@ discard block |
||
372 | 372 | $this->module_info->site_srl = $site_module_info->site_srl; |
373 | 373 | |
374 | 374 | // Still no module? it's an error |
375 | - if(!$this->module) |
|
375 | + if (!$this->module) |
|
376 | 376 | { |
377 | 377 | $this->error = 'msg_module_is_not_exists'; |
378 | 378 | $this->httpStatusCode = '404'; |
379 | 379 | } |
380 | 380 | |
381 | 381 | // If mid exists, set mid into context |
382 | - if($this->mid) |
|
382 | + if ($this->mid) |
|
383 | 383 | { |
384 | 384 | Context::set('mid', $this->mid, TRUE); |
385 | 385 | } |
386 | 386 | |
387 | 387 | // Call a trigger after moduleHandler init |
388 | 388 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
389 | - if(!$output->toBool()) |
|
389 | + if (!$output->toBool()) |
|
390 | 390 | { |
391 | 391 | $this->error = $output->getMessage(); |
392 | 392 | return TRUE; |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
409 | 409 | |
410 | 410 | // If error occurred while preparation, return a message instance |
411 | - if($this->error) |
|
411 | + if ($this->error) |
|
412 | 412 | { |
413 | 413 | $this->_setInputErrorToContext(); |
414 | 414 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
415 | 415 | $oMessageObject->setError(-1); |
416 | 416 | $oMessageObject->setMessage($this->error); |
417 | 417 | $oMessageObject->dispMessage(); |
418 | - if($this->httpStatusCode) |
|
418 | + if ($this->httpStatusCode) |
|
419 | 419 | { |
420 | 420 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
421 | 421 | } |
@@ -426,22 +426,22 @@ discard block |
||
426 | 426 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
427 | 427 | |
428 | 428 | // If not installed yet, modify act |
429 | - if($this->module == "install") |
|
429 | + if ($this->module == "install") |
|
430 | 430 | { |
431 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
431 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
432 | 432 | { |
433 | 433 | $this->act = $xml_info->default_index_act; |
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | 437 | // if act exists, find type of the action, if not use default index act |
438 | - if(!$this->act) |
|
438 | + if (!$this->act) |
|
439 | 439 | { |
440 | 440 | $this->act = $xml_info->default_index_act; |
441 | 441 | } |
442 | 442 | |
443 | 443 | // still no act means error |
444 | - if(!$this->act) |
|
444 | + if (!$this->act) |
|
445 | 445 | { |
446 | 446 | $this->error = 'msg_module_is_not_exists'; |
447 | 447 | $this->httpStatusCode = '404'; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | $oMessageObject->setError(-1); |
452 | 452 | $oMessageObject->setMessage($this->error); |
453 | 453 | $oMessageObject->dispMessage(); |
454 | - if($this->httpStatusCode) |
|
454 | + if ($this->httpStatusCode) |
|
455 | 455 | { |
456 | 456 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
457 | 457 | } |
@@ -462,17 +462,17 @@ discard block |
||
462 | 462 | $type = $xml_info->action->{$this->act}->type; |
463 | 463 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
464 | 464 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
465 | - if(!$kind && $this->module == 'admin') |
|
465 | + if (!$kind && $this->module == 'admin') |
|
466 | 466 | { |
467 | 467 | $kind = 'admin'; |
468 | 468 | } |
469 | 469 | |
470 | 470 | // check REQUEST_METHOD in controller |
471 | - if($type == 'controller') |
|
471 | + if ($type == 'controller') |
|
472 | 472 | { |
473 | 473 | $allowedMethod = $xml_info->action->{$this->act}->method; |
474 | 474 | |
475 | - if(!$allowedMethod) |
|
475 | + if (!$allowedMethod) |
|
476 | 476 | { |
477 | 477 | $allowedMethodList[0] = 'POST'; |
478 | 478 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
482 | 482 | } |
483 | 483 | |
484 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
484 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
485 | 485 | { |
486 | 486 | $this->error = "msg_invalid_request"; |
487 | 487 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
495 | - if($this->module_info->use_mobile != "Y") |
|
495 | + if ($this->module_info->use_mobile != "Y") |
|
496 | 496 | { |
497 | 497 | Mobile::setMobile(FALSE); |
498 | 498 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $logged_info = Context::get('logged_info'); |
501 | 501 | |
502 | 502 | // check CSRF for POST actions |
503 | - if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
503 | + if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
504 | 504 | $this->error = 'msg_invalid_request'; |
505 | 505 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
506 | 506 | $oMessageObject->setError(-1); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | } |
511 | 511 | |
512 | 512 | // Admin ip |
513 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
513 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
514 | 514 | { |
515 | 515 | $this->_setInputErrorToContext(); |
516 | 516 | $this->error = "msg_not_permitted_act"; |
@@ -522,13 +522,13 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | // if(type == view, and case for using mobilephone) |
525 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
525 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
526 | 526 | { |
527 | 527 | $orig_type = "view"; |
528 | 528 | $type = "mobile"; |
529 | 529 | // create a module instance |
530 | 530 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
531 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
531 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
532 | 532 | { |
533 | 533 | $type = $orig_type; |
534 | 534 | Mobile::setMobile(FALSE); |
@@ -541,14 +541,14 @@ discard block |
||
541 | 541 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
542 | 542 | } |
543 | 543 | |
544 | - if(!is_object($oModule)) |
|
544 | + if (!is_object($oModule)) |
|
545 | 545 | { |
546 | 546 | $this->_setInputErrorToContext(); |
547 | 547 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
548 | 548 | $oMessageObject->setError(-1); |
549 | 549 | $oMessageObject->setMessage($this->error); |
550 | 550 | $oMessageObject->dispMessage(); |
551 | - if($this->httpStatusCode) |
|
551 | + if ($this->httpStatusCode) |
|
552 | 552 | { |
553 | 553 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
554 | 554 | } |
@@ -556,10 +556,10 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | // If there is no such action in the module object |
559 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
559 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
560 | 560 | { |
561 | 561 | |
562 | - if(!Context::isInstalled()) |
|
562 | + if (!Context::isInstalled()) |
|
563 | 563 | { |
564 | 564 | $this->_setInputErrorToContext(); |
565 | 565 | $this->error = 'msg_invalid_request'; |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $oMessageObject->setError(-1); |
568 | 568 | $oMessageObject->setMessage($this->error); |
569 | 569 | $oMessageObject->dispMessage(); |
570 | - if($this->httpStatusCode) |
|
570 | + if ($this->httpStatusCode) |
|
571 | 571 | { |
572 | 572 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
573 | 573 | } |
@@ -576,12 +576,12 @@ discard block |
||
576 | 576 | |
577 | 577 | $forward = NULL; |
578 | 578 | // 1. Look for the module with action name |
579 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
579 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
580 | 580 | { |
581 | - $module = strtolower($matches[2] . $matches[3]); |
|
581 | + $module = strtolower($matches[2].$matches[3]); |
|
582 | 582 | $xml_info = $oModuleModel->getModuleActionXml($module); |
583 | 583 | |
584 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
584 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
585 | 585 | { |
586 | 586 | $forward = new stdClass(); |
587 | 587 | $forward->module = $module; |
@@ -601,12 +601,12 @@ discard block |
||
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
604 | - if(!$forward) |
|
604 | + if (!$forward) |
|
605 | 605 | { |
606 | 606 | $forward = $oModuleModel->getActionForward($this->act); |
607 | 607 | } |
608 | 608 | |
609 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
609 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
610 | 610 | { |
611 | 611 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
612 | 612 | $type = $forward->type; |
@@ -618,11 +618,11 @@ discard block |
||
618 | 618 | |
619 | 619 | // SECISSUE also check foward act method |
620 | 620 | // check REQUEST_METHOD in controller |
621 | - if($type == 'controller') |
|
621 | + if ($type == 'controller') |
|
622 | 622 | { |
623 | 623 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
624 | 624 | |
625 | - if(!$allowedMethod) |
|
625 | + if (!$allowedMethod) |
|
626 | 626 | { |
627 | 627 | $allowedMethodList[0] = 'POST'; |
628 | 628 | } |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
632 | 632 | } |
633 | 633 | |
634 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
634 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
635 | 635 | { |
636 | 636 | $this->error = "msg_invalid_request"; |
637 | 637 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -642,13 +642,13 @@ discard block |
||
642 | 642 | } |
643 | 643 | } |
644 | 644 | |
645 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
645 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
646 | 646 | { |
647 | 647 | $orig_type = "view"; |
648 | 648 | $type = "mobile"; |
649 | 649 | // create a module instance |
650 | 650 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
651 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
651 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
652 | 652 | { |
653 | 653 | $type = $orig_type; |
654 | 654 | Mobile::setMobile(FALSE); |
@@ -660,25 +660,25 @@ discard block |
||
660 | 660 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
661 | 661 | } |
662 | 662 | |
663 | - if(!is_object($oModule)) |
|
663 | + if (!is_object($oModule)) |
|
664 | 664 | { |
665 | 665 | $this->_setInputErrorToContext(); |
666 | 666 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
667 | 667 | $oMessageObject->setError(-1); |
668 | 668 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
669 | 669 | $oMessageObject->dispMessage(); |
670 | - if($this->httpStatusCode) |
|
670 | + if ($this->httpStatusCode) |
|
671 | 671 | { |
672 | 672 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
673 | 673 | } |
674 | 674 | return $oMessageObject; |
675 | 675 | } |
676 | 676 | |
677 | - if($this->module == "admin" && $type == "view") |
|
677 | + if ($this->module == "admin" && $type == "view") |
|
678 | 678 | { |
679 | - if($logged_info->is_admin == 'Y') |
|
679 | + if ($logged_info->is_admin == 'Y') |
|
680 | 680 | { |
681 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
681 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
682 | 682 | { |
683 | 683 | $oAdminView = getAdminView('admin'); |
684 | 684 | $oAdminView->makeGnbUrl($forward->module); |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | return $oMessageObject; |
699 | 699 | } |
700 | 700 | } |
701 | - if($kind == 'admin') |
|
701 | + if ($kind == 'admin') |
|
702 | 702 | { |
703 | 703 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
704 | - if(!$grant->manager) |
|
704 | + if (!$grant->manager) |
|
705 | 705 | { |
706 | 706 | $this->_setInputErrorToContext(); |
707 | 707 | $this->error = 'msg_is_not_manager'; |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | } |
714 | 714 | else |
715 | 715 | { |
716 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
716 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
717 | 717 | { |
718 | 718 | $this->_setInputErrorToContext(); |
719 | 719 | $this->error = 'msg_is_not_administrator'; |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | } |
727 | 727 | } |
728 | 728 | } |
729 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
729 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
730 | 730 | { |
731 | 731 | $this->act = $xml_info->default_index_act; |
732 | 732 | } |
@@ -740,16 +740,16 @@ discard block |
||
740 | 740 | } |
741 | 741 | |
742 | 742 | // ruleset check... |
743 | - if(!empty($ruleset)) |
|
743 | + if (!empty($ruleset)) |
|
744 | 744 | { |
745 | 745 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
746 | 746 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
747 | - if(!empty($rulesetFile)) |
|
747 | + if (!empty($rulesetFile)) |
|
748 | 748 | { |
749 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
749 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
750 | 750 | { |
751 | 751 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
752 | - foreach($errorLang as $key => $val) |
|
752 | + foreach ($errorLang as $key => $val) |
|
753 | 753 | { |
754 | 754 | Context::setLang($key, $val); |
755 | 755 | } |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | |
759 | 759 | $Validator = new Validator($rulesetFile); |
760 | 760 | $result = $Validator->validate(); |
761 | - if(!$result) |
|
761 | + if (!$result) |
|
762 | 762 | { |
763 | 763 | $lastError = $Validator->getLastError(); |
764 | 764 | $returnUrl = Context::get('error_return_url'); |
@@ -790,26 +790,26 @@ discard block |
||
790 | 790 | 'dispLayoutPreviewWithModule' => 1 |
791 | 791 | ); |
792 | 792 | $db_use_mobile = Mobile::isMobileEnabled(); |
793 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
793 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
794 | 794 | { |
795 | 795 | global $lang; |
796 | 796 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
797 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
797 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
798 | 798 | Context::addHtmlHeader($header); |
799 | 799 | Context::addHtmlFooter($footer); |
800 | 800 | } |
801 | 801 | |
802 | - if($type == "view" && $kind != 'admin') |
|
802 | + if ($type == "view" && $kind != 'admin') |
|
803 | 803 | { |
804 | 804 | $module_config = $oModuleModel->getModuleConfig('module'); |
805 | - if($module_config->htmlFooter) |
|
805 | + if ($module_config->htmlFooter) |
|
806 | 806 | { |
807 | 807 | Context::addHtmlFooter($module_config->htmlFooter); |
808 | 808 | } |
809 | - if($module_config->siteTitle) |
|
809 | + if ($module_config->siteTitle) |
|
810 | 810 | { |
811 | 811 | $siteTitle = Context::getBrowserTitle(); |
812 | - if(!$siteTitle) |
|
812 | + if (!$siteTitle) |
|
813 | 813 | { |
814 | 814 | Context::setBrowserTitle($module_config->siteTitle); |
815 | 815 | } |
@@ -822,18 +822,18 @@ discard block |
||
822 | 822 | $procResult = $oModule->proc(); |
823 | 823 | |
824 | 824 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
825 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
825 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
826 | 826 | { |
827 | 827 | $error = $oModule->getError(); |
828 | 828 | $message = $oModule->getMessage(); |
829 | 829 | $messageType = $oModule->getMessageType(); |
830 | 830 | $redirectUrl = $oModule->getRedirectUrl(); |
831 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
831 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
832 | 832 | |
833 | - if(!$procResult) |
|
833 | + if (!$procResult) |
|
834 | 834 | { |
835 | 835 | $this->error = $message; |
836 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
836 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
837 | 837 | { |
838 | 838 | $redirectUrl = Context::get('error_return_url'); |
839 | 839 | } |
@@ -846,13 +846,13 @@ discard block |
||
846 | 846 | |
847 | 847 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
848 | 848 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
849 | - if($message != 'success') |
|
849 | + if ($message != 'success') |
|
850 | 850 | { |
851 | 851 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
852 | 852 | } |
853 | 853 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
854 | 854 | |
855 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
855 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
856 | 856 | { |
857 | 857 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
858 | 858 | } |
@@ -868,27 +868,27 @@ discard block |
||
868 | 868 | * */ |
869 | 869 | function _setInputErrorToContext() |
870 | 870 | { |
871 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
871 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
872 | 872 | { |
873 | 873 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
874 | 874 | } |
875 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
875 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
876 | 876 | { |
877 | 877 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
878 | 878 | } |
879 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
879 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
880 | 880 | { |
881 | 881 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
882 | 882 | } |
883 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
883 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
884 | 884 | { |
885 | 885 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
886 | 886 | } |
887 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
887 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
888 | 888 | { |
889 | 889 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
890 | 890 | } |
891 | - if(count($_SESSION['INPUT_ERROR'])) |
|
891 | + if (count($_SESSION['INPUT_ERROR'])) |
|
892 | 892 | { |
893 | 893 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
894 | 894 | } |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | { |
919 | 919 | $requestVars = Context::getRequestVars(); |
920 | 920 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
921 | - foreach($requestVars AS $key => $value) |
|
921 | + foreach ($requestVars AS $key => $value) |
|
922 | 922 | { |
923 | 923 | $_SESSION['INPUT_ERROR'][$key] = $value; |
924 | 924 | } |
@@ -932,41 +932,41 @@ discard block |
||
932 | 932 | function displayContent($oModule = NULL) |
933 | 933 | { |
934 | 934 | // If the module is not set or not an object, set error |
935 | - if(!$oModule || !is_object($oModule)) |
|
935 | + if (!$oModule || !is_object($oModule)) |
|
936 | 936 | { |
937 | 937 | $this->error = 'msg_module_is_not_exists'; |
938 | 938 | $this->httpStatusCode = '404'; |
939 | 939 | } |
940 | 940 | |
941 | 941 | // If connection to DB has a problem even though it's not install module, set error |
942 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
942 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
943 | 943 | { |
944 | 944 | $this->error = 'msg_dbconnect_failed'; |
945 | 945 | } |
946 | 946 | |
947 | 947 | // Call trigger after moduleHandler proc |
948 | 948 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
949 | - if(!$output->toBool()) |
|
949 | + if (!$output->toBool()) |
|
950 | 950 | { |
951 | 951 | $this->error = $output->getMessage(); |
952 | 952 | } |
953 | 953 | |
954 | 954 | // Use message view object, if HTML call |
955 | 955 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
956 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
956 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
957 | 957 | { |
958 | 958 | |
959 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
959 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
960 | 960 | { |
961 | 961 | $display_handler = new DisplayHandler(); |
962 | 962 | $display_handler->_debugOutput(); |
963 | 963 | |
964 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
964 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
965 | 965 | return; |
966 | 966 | } |
967 | 967 | |
968 | 968 | // If error occurred, handle it |
969 | - if($this->error) |
|
969 | + if ($this->error) |
|
970 | 970 | { |
971 | 971 | // display content with message module instance |
972 | 972 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | $oMessageObject->setMessage($this->error); |
976 | 976 | $oMessageObject->dispMessage(); |
977 | 977 | |
978 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
978 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
979 | 979 | { |
980 | 980 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
981 | 981 | $oMessageObject->setTemplateFile('http_status_code'); |
982 | 982 | } |
983 | 983 | |
984 | 984 | // If module was called normally, change the templates of the module into ones of the message view module |
985 | - if($oModule) |
|
985 | + if ($oModule) |
|
986 | 986 | { |
987 | 987 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
988 | 988 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | } |
998 | 998 | |
999 | 999 | // Check if layout_srl exists for the module |
1000 | - if(Mobile::isFromMobilePhone()) |
|
1000 | + if (Mobile::isFromMobilePhone()) |
|
1001 | 1001 | { |
1002 | 1002 | $layout_srl = $oModule->module_info->mlayout_srl; |
1003 | 1003 | } |
@@ -1007,58 +1007,58 @@ discard block |
||
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | // if layout_srl is rollback by module, set default layout |
1010 | - if($layout_srl == -1) |
|
1010 | + if ($layout_srl == -1) |
|
1011 | 1011 | { |
1012 | 1012 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
1013 | 1013 | $oLayoutAdminModel = getAdminModel('layout'); |
1014 | 1014 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
1015 | 1015 | } |
1016 | 1016 | |
1017 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
1017 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
1018 | 1018 | { |
1019 | 1019 | |
1020 | 1020 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
1021 | 1021 | $oLayoutModel = getModel('layout'); |
1022 | 1022 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
1023 | - if($layout_info) |
|
1023 | + if ($layout_info) |
|
1024 | 1024 | { |
1025 | 1025 | |
1026 | 1026 | // Input extra_vars into $layout_info |
1027 | - if($layout_info->extra_var_count) |
|
1027 | + if ($layout_info->extra_var_count) |
|
1028 | 1028 | { |
1029 | 1029 | |
1030 | - foreach($layout_info->extra_var as $var_id => $val) |
|
1030 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
1031 | 1031 | { |
1032 | - if($val->type == 'image') |
|
1032 | + if ($val->type == 'image') |
|
1033 | 1033 | { |
1034 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1034 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1035 | 1035 | { |
1036 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
1036 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
1037 | 1037 | } |
1038 | 1038 | } |
1039 | 1039 | $layout_info->{$var_id} = $val->value; |
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | // Set menus into context |
1043 | - if($layout_info->menu_count) |
|
1043 | + if ($layout_info->menu_count) |
|
1044 | 1044 | { |
1045 | - foreach($layout_info->menu as $menu_id => $menu) |
|
1045 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
1046 | 1046 | { |
1047 | 1047 | // set default menu set(included home menu) |
1048 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
1048 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
1049 | 1049 | { |
1050 | 1050 | $oMenuAdminController = getAdminController('menu'); |
1051 | 1051 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
1052 | 1052 | |
1053 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
1053 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
1054 | 1054 | { |
1055 | 1055 | include($homeMenuCacheFile); |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - if(!$menu->menu_srl) |
|
1058 | + if (!$menu->menu_srl) |
|
1059 | 1059 | { |
1060 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
1061 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
1060 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
1061 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
1062 | 1062 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
1063 | 1063 | } |
1064 | 1064 | else |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | $php_file = FileHandler::exists($menu->php_file); |
1072 | - if($php_file) |
|
1072 | + if ($php_file) |
|
1073 | 1073 | { |
1074 | 1074 | include($php_file); |
1075 | 1075 | } |
@@ -1085,17 +1085,17 @@ discard block |
||
1085 | 1085 | |
1086 | 1086 | // If layout was modified, use the modified version |
1087 | 1087 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
1088 | - if(file_exists($edited_layout)) |
|
1088 | + if (file_exists($edited_layout)) |
|
1089 | 1089 | { |
1090 | 1090 | $oModule->setEditedLayoutFile($edited_layout); |
1091 | 1091 | } |
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | $isLayoutDrop = Context::get('isLayoutDrop'); |
1095 | - if($isLayoutDrop) |
|
1095 | + if ($isLayoutDrop) |
|
1096 | 1096 | { |
1097 | 1097 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
1098 | - if($kind == 'admin') |
|
1098 | + if ($kind == 'admin') |
|
1099 | 1099 | { |
1100 | 1100 | $oModule->setLayoutFile('popup_layout'); |
1101 | 1101 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | function &getModuleInstance($module, $type = 'view', $kind = '') |
1134 | 1134 | { |
1135 | 1135 | |
1136 | - if(__DEBUG__ == 3) |
|
1136 | + if (__DEBUG__ == 3) |
|
1137 | 1137 | { |
1138 | 1138 | $start_time = getMicroTime(); |
1139 | 1139 | } |
@@ -1143,51 +1143,51 @@ discard block |
||
1143 | 1143 | $type = strtolower($type); |
1144 | 1144 | |
1145 | 1145 | $kinds = array('svc' => 1, 'admin' => 1); |
1146 | - if(!isset($kinds[$kind])) |
|
1146 | + if (!isset($kinds[$kind])) |
|
1147 | 1147 | { |
1148 | 1148 | $kind = 'svc'; |
1149 | 1149 | } |
1150 | 1150 | |
1151 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
1151 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
1152 | 1152 | |
1153 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1153 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1154 | 1154 | { |
1155 | 1155 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | // if there is no instance of the module in global variable, create a new one |
1159 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1159 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1160 | 1160 | { |
1161 | 1161 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1162 | 1162 | |
1163 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1163 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1164 | 1164 | { |
1165 | 1165 | $module = $parent_module; |
1166 | 1166 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | // Check if the base class and instance class exist |
1170 | - if(!class_exists($module, true)) |
|
1170 | + if (!class_exists($module, true)) |
|
1171 | 1171 | { |
1172 | 1172 | return NULL; |
1173 | 1173 | } |
1174 | - if(!class_exists($instance_name, true)) |
|
1174 | + if (!class_exists($instance_name, true)) |
|
1175 | 1175 | { |
1176 | 1176 | return NULL; |
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | // Create an instance |
1180 | 1180 | $oModule = new $instance_name(); |
1181 | - if(!is_object($oModule)) |
|
1181 | + if (!is_object($oModule)) |
|
1182 | 1182 | { |
1183 | 1183 | return NULL; |
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | // Load language files for the class |
1187 | - Context::loadLang($class_path . 'lang'); |
|
1188 | - if($extend_module) |
|
1187 | + Context::loadLang($class_path.'lang'); |
|
1188 | + if ($extend_module) |
|
1189 | 1189 | { |
1190 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
1190 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | // Set variables to the instance |
@@ -1195,10 +1195,10 @@ discard block |
||
1195 | 1195 | $oModule->setModulePath($class_path); |
1196 | 1196 | |
1197 | 1197 | // If the module has a constructor, run it. |
1198 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1198 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1199 | 1199 | { |
1200 | 1200 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
1201 | - if(@method_exists($oModule, $instance_name)) |
|
1201 | + if (@method_exists($oModule, $instance_name)) |
|
1202 | 1202 | { |
1203 | 1203 | $oModule->{$instance_name}(); |
1204 | 1204 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
1209 | 1209 | } |
1210 | 1210 | |
1211 | - if(__DEBUG__ == 3) |
|
1211 | + if (__DEBUG__ == 3) |
|
1212 | 1212 | { |
1213 | 1213 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
1214 | 1214 | } |
@@ -1224,17 +1224,17 @@ discard block |
||
1224 | 1224 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
1225 | 1225 | $highClassFile = FileHandler::getRealPath($highClassFile); |
1226 | 1226 | |
1227 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
1228 | - if(!in_array($type, $types)) |
|
1227 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
1228 | + if (!in_array($type, $types)) |
|
1229 | 1229 | { |
1230 | 1230 | $type = $types[0]; |
1231 | 1231 | } |
1232 | - if($type == 'class') |
|
1232 | + if ($type == 'class') |
|
1233 | 1233 | { |
1234 | 1234 | $instanceName = '%s'; |
1235 | 1235 | $classFile = '%s%s.%s.php'; |
1236 | 1236 | } |
1237 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1237 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
1238 | 1238 | { |
1239 | 1239 | $instanceName = '%sAdmin%s'; |
1240 | 1240 | $classFile = '%s%s.admin.%s.php'; |
@@ -1259,26 +1259,26 @@ discard block |
||
1259 | 1259 | function triggerCall($trigger_name, $called_position, &$obj) |
1260 | 1260 | { |
1261 | 1261 | // skip if not installed |
1262 | - if(!Context::isInstalled()) |
|
1262 | + if (!Context::isInstalled()) |
|
1263 | 1263 | { |
1264 | 1264 | return new Object(); |
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | $oModuleModel = getModel('module'); |
1268 | 1268 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
1269 | - if(!$triggers || count($triggers) < 1) |
|
1269 | + if (!$triggers || count($triggers) < 1) |
|
1270 | 1270 | { |
1271 | 1271 | return new Object(); |
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | //store before trigger call time |
1275 | 1275 | $before_trigger_time = NULL; |
1276 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
1276 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
1277 | 1277 | { |
1278 | 1278 | $before_trigger_time = microtime(true); |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - foreach($triggers as $item) |
|
1281 | + foreach ($triggers as $item) |
|
1282 | 1282 | { |
1283 | 1283 | $module = $item->module; |
1284 | 1284 | $type = $item->type; |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | |
1287 | 1287 | // todo why don't we call a normal class object ? |
1288 | 1288 | $oModule = getModule($module, $type); |
1289 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
1289 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
1290 | 1290 | { |
1291 | 1291 | continue; |
1292 | 1292 | } |
@@ -1299,12 +1299,12 @@ discard block |
||
1299 | 1299 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
1300 | 1300 | |
1301 | 1301 | $slowlog = new stdClass; |
1302 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
1303 | - $slowlog->called = $module . '.' . $called_method; |
|
1302 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
1303 | + $slowlog->called = $module.'.'.$called_method; |
|
1304 | 1304 | $slowlog->called_extension = $module; |
1305 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1305 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1306 | 1306 | |
1307 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1307 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1308 | 1308 | { |
1309 | 1309 | return $output; |
1310 | 1310 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | '505' => 'HTTP Version Not Supported', |
1365 | 1365 | ); |
1366 | 1366 | $statusMessage = $statusMessageList[$code]; |
1367 | - if(!$statusMessage) |
|
1367 | + if (!$statusMessage) |
|
1368 | 1368 | { |
1369 | 1369 | $statusMessage = 'OK'; |
1370 | 1370 | } |
@@ -111,8 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | register_shutdown_function(array($this, 'shutdownHandler')); |
113 | 113 | } |
114 | - } |
|
115 | - else if(__DEBUG_PROTECT__ === 0) |
|
114 | + } else if(__DEBUG_PROTECT__ === 0) |
|
116 | 115 | { |
117 | 116 | set_error_handler(array($this, 'xeErrorLog'), 3); |
118 | 117 | if(3 & E_ERROR) |
@@ -126,7 +125,9 @@ discard block |
||
126 | 125 | $called_position = 'before_module_init'; |
127 | 126 | $oAddonController = getController('addon'); |
128 | 127 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
129 | - if(file_exists($addon_file)) include($addon_file); |
|
128 | + if(file_exists($addon_file)) { |
|
129 | + include($addon_file); |
|
130 | + } |
|
130 | 131 | } |
131 | 132 | |
132 | 133 | function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
@@ -249,8 +250,7 @@ discard block |
||
249 | 250 | if(!$module_info) |
250 | 251 | { |
251 | 252 | unset($this->document_srl); |
252 | - } |
|
253 | - else |
|
253 | + } else |
|
254 | 254 | { |
255 | 255 | // If it exists, compare mid based on the module information |
256 | 256 | // if mids are not matching, set it as the document's mid |
@@ -262,8 +262,7 @@ discard block |
||
262 | 262 | $this->mid = $module_info->mid; |
263 | 263 | header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
264 | 264 | return FALSE; |
265 | - } |
|
266 | - else |
|
265 | + } else |
|
267 | 266 | { |
268 | 267 | $this->mid = $module_info->mid; |
269 | 268 | Context::set('mid', $this->mid); |
@@ -314,15 +313,13 @@ discard block |
||
314 | 313 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
315 | 314 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
316 | 315 | // If it's called from a virtual site, though it's not a module of the virtual site |
317 | - } |
|
318 | - else |
|
316 | + } else |
|
319 | 317 | { |
320 | 318 | $db_info = Context::getDBInfo(); |
321 | 319 | if(!$db_info->default_url) |
322 | 320 | { |
323 | 321 | return Context::getLang('msg_default_url_is_not_defined'); |
324 | - } |
|
325 | - else |
|
322 | + } else |
|
326 | 323 | { |
327 | 324 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
328 | 325 | } |
@@ -347,8 +344,7 @@ discard block |
||
347 | 344 | { |
348 | 345 | $oLayoutAdminModel = getAdminModel('layout'); |
349 | 346 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
350 | - } |
|
351 | - else |
|
347 | + } else |
|
352 | 348 | { |
353 | 349 | $layoutSrl = $module_info->{$targetSrl}; |
354 | 350 | } |
@@ -475,8 +471,7 @@ discard block |
||
475 | 471 | if(!$allowedMethod) |
476 | 472 | { |
477 | 473 | $allowedMethodList[0] = 'POST'; |
478 | - } |
|
479 | - else |
|
474 | + } else |
|
480 | 475 | { |
481 | 476 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
482 | 477 | } |
@@ -534,8 +529,7 @@ discard block |
||
534 | 529 | Mobile::setMobile(FALSE); |
535 | 530 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
536 | 531 | } |
537 | - } |
|
538 | - else |
|
532 | + } else |
|
539 | 533 | { |
540 | 534 | // create a module instance |
541 | 535 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
@@ -588,8 +582,7 @@ discard block |
||
588 | 582 | $forward->type = $xml_info->action->{$this->act}->type; |
589 | 583 | $forward->ruleset = $xml_info->action->{$this->act}->ruleset; |
590 | 584 | $forward->act = $this->act; |
591 | - } |
|
592 | - else |
|
585 | + } else |
|
593 | 586 | { |
594 | 587 | $this->error = 'msg_invalid_request'; |
595 | 588 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -625,8 +618,7 @@ discard block |
||
625 | 618 | if(!$allowedMethod) |
626 | 619 | { |
627 | 620 | $allowedMethodList[0] = 'POST'; |
628 | - } |
|
629 | - else |
|
621 | + } else |
|
630 | 622 | { |
631 | 623 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
632 | 624 | } |
@@ -654,8 +646,7 @@ discard block |
||
654 | 646 | Mobile::setMobile(FALSE); |
655 | 647 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
656 | 648 | } |
657 | - } |
|
658 | - else |
|
649 | + } else |
|
659 | 650 | { |
660 | 651 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
661 | 652 | } |
@@ -685,8 +676,7 @@ discard block |
||
685 | 676 | $oModule->setLayoutPath("./modules/admin/tpl"); |
686 | 677 | $oModule->setLayoutFile("layout.html"); |
687 | 678 | } |
688 | - } |
|
689 | - else |
|
679 | + } else |
|
690 | 680 | { |
691 | 681 | $this->_setInputErrorToContext(); |
692 | 682 | |
@@ -710,8 +700,7 @@ discard block |
||
710 | 700 | $oMessageObject->setMessage($this->error); |
711 | 701 | $oMessageObject->dispMessage(); |
712 | 702 | return $oMessageObject; |
713 | - } |
|
714 | - else |
|
703 | + } else |
|
715 | 704 | { |
716 | 705 | if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
717 | 706 | { |
@@ -725,12 +714,10 @@ discard block |
||
725 | 714 | } |
726 | 715 | } |
727 | 716 | } |
728 | - } |
|
729 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
717 | + } else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
730 | 718 | { |
731 | 719 | $this->act = $xml_info->default_index_act; |
732 | - } |
|
733 | - else |
|
720 | + } else |
|
734 | 721 | { |
735 | 722 | $this->error = 'msg_invalid_request'; |
736 | 723 | $oModule->setError(-1); |
@@ -828,7 +815,9 @@ discard block |
||
828 | 815 | $message = $oModule->getMessage(); |
829 | 816 | $messageType = $oModule->getMessageType(); |
830 | 817 | $redirectUrl = $oModule->getRedirectUrl(); |
831 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
818 | + if($messageType == 'error') { |
|
819 | + debugPrint($message, 'ERROR'); |
|
820 | + } |
|
832 | 821 | |
833 | 822 | if(!$procResult) |
834 | 823 | { |
@@ -838,8 +827,7 @@ discard block |
||
838 | 827 | $redirectUrl = Context::get('error_return_url'); |
839 | 828 | } |
840 | 829 | $this->_setInputValueToSession(); |
841 | - } |
|
842 | - else |
|
830 | + } else |
|
843 | 831 | { |
844 | 832 | |
845 | 833 | } |
@@ -987,8 +975,7 @@ discard block |
||
987 | 975 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
988 | 976 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
989 | 977 | // Otherwise, set message instance as the target module |
990 | - } |
|
991 | - else |
|
978 | + } else |
|
992 | 979 | { |
993 | 980 | $oModule = $oMessageObject; |
994 | 981 | } |
@@ -1000,8 +987,7 @@ discard block |
||
1000 | 987 | if(Mobile::isFromMobilePhone()) |
1001 | 988 | { |
1002 | 989 | $layout_srl = $oModule->module_info->mlayout_srl; |
1003 | - } |
|
1004 | - else |
|
990 | + } else |
|
1005 | 991 | { |
1006 | 992 | $layout_srl = $oModule->module_info->layout_srl; |
1007 | 993 | } |
@@ -1060,8 +1046,7 @@ discard block |
||
1060 | 1046 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
1061 | 1047 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
1062 | 1048 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
1063 | - } |
|
1064 | - else |
|
1049 | + } else |
|
1065 | 1050 | { |
1066 | 1051 | $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file); |
1067 | 1052 | $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file); |
@@ -1098,8 +1083,7 @@ discard block |
||
1098 | 1083 | if($kind == 'admin') |
1099 | 1084 | { |
1100 | 1085 | $oModule->setLayoutFile('popup_layout'); |
1101 | - } |
|
1102 | - else |
|
1086 | + } else |
|
1103 | 1087 | { |
1104 | 1088 | $oModule->setLayoutPath('common/tpl'); |
1105 | 1089 | $oModule->setLayoutFile('default_layout'); |
@@ -1233,13 +1217,11 @@ discard block |
||
1233 | 1217 | { |
1234 | 1218 | $instanceName = '%s'; |
1235 | 1219 | $classFile = '%s%s.%s.php'; |
1236 | - } |
|
1237 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1220 | + } elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1238 | 1221 | { |
1239 | 1222 | $instanceName = '%sAdmin%s'; |
1240 | 1223 | $classFile = '%s%s.admin.%s.php'; |
1241 | - } |
|
1242 | - else |
|
1224 | + } else |
|
1243 | 1225 | { |
1244 | 1226 | $instanceName = '%s%s'; |
1245 | 1227 | $classFile = '%s%s.%s.php'; |
@@ -1302,7 +1284,9 @@ discard block |
||
1302 | 1284 | $slowlog->caller = $trigger_name . '.' . $called_position; |
1303 | 1285 | $slowlog->called = $module . '.' . $called_method; |
1304 | 1286 | $slowlog->called_extension = $module; |
1305 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1287 | + if($trigger_name != 'XE.writeSlowlog') { |
|
1288 | + writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1289 | + } |
|
1306 | 1290 | |
1307 | 1291 | if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
1308 | 1292 | { |