@@ -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,9 +102,9 @@ 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__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
107 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
108 | 108 | { |
109 | 109 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
110 | 110 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -115,40 +115,40 @@ discard block |
||
115 | 115 | $called_position = 'before_module_init'; |
116 | 116 | $oAddonController = getController('addon'); |
117 | 117 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
118 | - if(file_exists($addon_file)) include($addon_file); |
|
118 | + if (file_exists($addon_file)) include($addon_file); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
122 | 122 | { |
123 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
123 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
124 | 124 | { |
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | 128 | set_error_handler(function() { }, ~0); |
129 | 129 | |
130 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
131 | - if(!file_exists($debug_file)) |
|
130 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
131 | + if (!file_exists($debug_file)) |
|
132 | 132 | { |
133 | 133 | $print[] = '<?php exit() ?>'; |
134 | 134 | } |
135 | 135 | |
136 | 136 | $errorname = self::getErrorType($errnumber); |
137 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
137 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
138 | 138 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
139 | 139 | $backtrace = debug_backtrace($backtrace_args); |
140 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
140 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
141 | 141 | { |
142 | 142 | array_shift($backtrace); |
143 | 143 | } |
144 | 144 | |
145 | - foreach($backtrace as $key => $value) |
|
145 | + foreach ($backtrace as $key => $value) |
|
146 | 146 | { |
147 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
147 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
148 | 148 | $print[] = $message; |
149 | 149 | } |
150 | 150 | $print[] = PHP_EOL; |
151 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
151 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
152 | 152 | restore_error_handler(); |
153 | 153 | |
154 | 154 | return true; |
@@ -164,21 +164,21 @@ discard block |
||
164 | 164 | |
165 | 165 | set_error_handler(function() { }, ~0); |
166 | 166 | |
167 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
168 | - if(!file_exists($debug_file)) |
|
167 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
168 | + if (!file_exists($debug_file)) |
|
169 | 169 | { |
170 | 170 | $print[] = '<?php exit() ?>'; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $errorname = self::getErrorType($errinfo['type']); |
174 | 174 | $print[] = '['.date('Y-m-d H:i:s').']'; |
175 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
175 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
176 | 176 | |
177 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
177 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
178 | 178 | $print[] = $message; |
179 | 179 | |
180 | 180 | $print[] = PHP_EOL; |
181 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
181 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
182 | 182 | set_error_handler(array($this, 'dummyHandler'), ~0); |
183 | 183 | |
184 | 184 | return true; |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
223 | 223 | $defaultHost = $defaultUrlInfo['host']; |
224 | 224 | |
225 | - foreach($urls as $url) |
|
225 | + foreach ($urls as $url) |
|
226 | 226 | { |
227 | - if(empty($url)) |
|
227 | + if (empty($url)) |
|
228 | 228 | { |
229 | 229 | continue; |
230 | 230 | } |
@@ -232,29 +232,29 @@ discard block |
||
232 | 232 | $urlInfo = parse_url($url); |
233 | 233 | $host = $urlInfo['host']; |
234 | 234 | |
235 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
235 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
236 | 236 | { |
237 | 237 | throw new Exception('msg_default_url_is_null'); |
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
241 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
241 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
242 | 242 | { |
243 | 243 | $oDocumentModel = getModel('document'); |
244 | 244 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
245 | - if($this->document_srl) |
|
245 | + if ($this->document_srl) |
|
246 | 246 | { |
247 | 247 | Context::set('document_srl', $this->document_srl); |
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | 251 | // Get module's information based on document_srl, if it's specified |
252 | - if($this->document_srl) |
|
252 | + if ($this->document_srl) |
|
253 | 253 | { |
254 | 254 | |
255 | 255 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
256 | 256 | // If the document does not exist, remove document_srl |
257 | - if(!$module_info) |
|
257 | + if (!$module_info) |
|
258 | 258 | { |
259 | 259 | unset($this->document_srl); |
260 | 260 | } |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | { |
263 | 263 | // If it exists, compare mid based on the module information |
264 | 264 | // if mids are not matching, set it as the document's mid |
265 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
265 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
266 | 266 | { |
267 | 267 | |
268 | - if(Context::getRequestMethod() == 'GET') |
|
268 | + if (Context::getRequestMethod() == 'GET') |
|
269 | 269 | { |
270 | 270 | $this->mid = $module_info->mid; |
271 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
271 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
272 | 272 | return FALSE; |
273 | 273 | } |
274 | 274 | else |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | } |
281 | 281 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
282 | - if($this->module && $module_info->module != $this->module) |
|
282 | + if ($this->module && $module_info->module != $this->module) |
|
283 | 283 | { |
284 | 284 | unset($module_info); |
285 | 285 | } |
@@ -288,36 +288,36 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
291 | - if(!$module_info && $this->mid) |
|
291 | + if (!$module_info && $this->mid) |
|
292 | 292 | { |
293 | 293 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
294 | 294 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
295 | 295 | } |
296 | 296 | |
297 | 297 | // redirect, if module_site_srl and site_srl are different |
298 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
298 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
299 | 299 | { |
300 | 300 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
301 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
301 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
302 | 302 | return FALSE; |
303 | 303 | } |
304 | 304 | |
305 | 305 | // If module_info is not set still, and $module does not exist, find the default module |
306 | - if(!$module_info && !$this->module && !$this->mid) |
|
306 | + if (!$module_info && !$this->module && !$this->mid) |
|
307 | 307 | { |
308 | 308 | $module_info = $site_module_info; |
309 | 309 | } |
310 | 310 | |
311 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
311 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
312 | 312 | { |
313 | 313 | $module_info = $site_module_info; |
314 | 314 | } |
315 | 315 | |
316 | 316 | // redirect, if site_srl of module_info is different from one of site's module_info |
317 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
317 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
318 | 318 | { |
319 | 319 | // If the module is of virtual site |
320 | - if($module_info->site_srl) |
|
320 | + if ($module_info->site_srl) |
|
321 | 321 | { |
322 | 322 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
323 | 323 | $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')); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | else |
327 | 327 | { |
328 | 328 | $db_info = Context::getDBInfo(); |
329 | - if(!$db_info->default_url) |
|
329 | + if (!$db_info->default_url) |
|
330 | 330 | { |
331 | 331 | return Context::getLang('msg_default_url_is_not_defined'); |
332 | 332 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | $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')); |
336 | 336 | } |
337 | 337 | } |
338 | - header("location:" . $redirect_url); |
|
338 | + header("location:".$redirect_url); |
|
339 | 339 | return FALSE; |
340 | 340 | } |
341 | 341 | |
342 | 342 | // If module info was set, retrieve variables from the module information |
343 | - if($module_info) |
|
343 | + if ($module_info) |
|
344 | 344 | { |
345 | 345 | $this->module = $module_info->module; |
346 | 346 | $this->mid = $module_info->mid; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
352 | 352 | |
353 | 353 | // use the site default layout. |
354 | - if($module_info->{$targetSrl} == -1) |
|
354 | + if ($module_info->{$targetSrl} == -1) |
|
355 | 355 | { |
356 | 356 | $oLayoutAdminModel = getAdminModel('layout'); |
357 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | // Set module and mid into module_info |
372 | - if(!isset($this->module_info)) |
|
372 | + if (!isset($this->module_info)) |
|
373 | 373 | { |
374 | 374 | $this->module_info = new stdClass(); |
375 | 375 | } |
@@ -380,21 +380,21 @@ discard block |
||
380 | 380 | $this->module_info->site_srl = $site_module_info->site_srl; |
381 | 381 | |
382 | 382 | // Still no module? it's an error |
383 | - if(!$this->module) |
|
383 | + if (!$this->module) |
|
384 | 384 | { |
385 | 385 | $this->error = 'msg_module_is_not_exists'; |
386 | 386 | $this->httpStatusCode = '404'; |
387 | 387 | } |
388 | 388 | |
389 | 389 | // If mid exists, set mid into context |
390 | - if($this->mid) |
|
390 | + if ($this->mid) |
|
391 | 391 | { |
392 | 392 | Context::set('mid', $this->mid, TRUE); |
393 | 393 | } |
394 | 394 | |
395 | 395 | // Call a trigger after moduleHandler init |
396 | 396 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
397 | - if(!$output->toBool()) |
|
397 | + if (!$output->toBool()) |
|
398 | 398 | { |
399 | 399 | $this->error = $output->getMessage(); |
400 | 400 | return TRUE; |
@@ -416,14 +416,14 @@ discard block |
||
416 | 416 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
417 | 417 | |
418 | 418 | // If error occurred while preparation, return a message instance |
419 | - if($this->error) |
|
419 | + if ($this->error) |
|
420 | 420 | { |
421 | 421 | $this->_setInputErrorToContext(); |
422 | 422 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
423 | 423 | $oMessageObject->setError(-1); |
424 | 424 | $oMessageObject->setMessage($this->error); |
425 | 425 | $oMessageObject->dispMessage(); |
426 | - if($this->httpStatusCode) |
|
426 | + if ($this->httpStatusCode) |
|
427 | 427 | { |
428 | 428 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
429 | 429 | } |
@@ -434,22 +434,22 @@ discard block |
||
434 | 434 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
435 | 435 | |
436 | 436 | // If not installed yet, modify act |
437 | - if($this->module == "install") |
|
437 | + if ($this->module == "install") |
|
438 | 438 | { |
439 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
439 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
440 | 440 | { |
441 | 441 | $this->act = $xml_info->default_index_act; |
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | 445 | // if act exists, find type of the action, if not use default index act |
446 | - if(!$this->act) |
|
446 | + if (!$this->act) |
|
447 | 447 | { |
448 | 448 | $this->act = $xml_info->default_index_act; |
449 | 449 | } |
450 | 450 | |
451 | 451 | // still no act means error |
452 | - if(!$this->act) |
|
452 | + if (!$this->act) |
|
453 | 453 | { |
454 | 454 | $this->error = 'msg_module_is_not_exists'; |
455 | 455 | $this->httpStatusCode = '404'; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | $oMessageObject->setError(-1); |
460 | 460 | $oMessageObject->setMessage($this->error); |
461 | 461 | $oMessageObject->dispMessage(); |
462 | - if($this->httpStatusCode) |
|
462 | + if ($this->httpStatusCode) |
|
463 | 463 | { |
464 | 464 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
465 | 465 | } |
@@ -470,17 +470,17 @@ discard block |
||
470 | 470 | $type = $xml_info->action->{$this->act}->type; |
471 | 471 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
472 | 472 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
473 | - if(!$kind && $this->module == 'admin') |
|
473 | + if (!$kind && $this->module == 'admin') |
|
474 | 474 | { |
475 | 475 | $kind = 'admin'; |
476 | 476 | } |
477 | 477 | |
478 | 478 | // check REQUEST_METHOD in controller |
479 | - if($type == 'controller') |
|
479 | + if ($type == 'controller') |
|
480 | 480 | { |
481 | 481 | $allowedMethod = $xml_info->action->{$this->act}->method; |
482 | 482 | |
483 | - if(!$allowedMethod) |
|
483 | + if (!$allowedMethod) |
|
484 | 484 | { |
485 | 485 | $allowedMethodList[0] = 'POST'; |
486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
490 | 490 | } |
491 | 491 | |
492 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
492 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
493 | 493 | { |
494 | 494 | $this->error = "msg_invalid_request"; |
495 | 495 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | - if($this->module_info->use_mobile != "Y") |
|
503 | + if ($this->module_info->use_mobile != "Y") |
|
504 | 504 | { |
505 | 505 | Mobile::setMobile(FALSE); |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | |
510 | 510 | // check CSRF for non-GET actions |
511 | 511 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
512 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
512 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
513 | 513 | { |
514 | 514 | $this->error = 'msg_invalid_request'; |
515 | 515 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | // Admin ip |
523 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
523 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
524 | 524 | { |
525 | 525 | $this->_setInputErrorToContext(); |
526 | 526 | $this->error = "msg_not_permitted_act"; |
@@ -532,13 +532,13 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | // if(type == view, and case for using mobilephone) |
535 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
535 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
536 | 536 | { |
537 | 537 | $orig_type = "view"; |
538 | 538 | $type = "mobile"; |
539 | 539 | // create a module instance |
540 | 540 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
541 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
541 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
542 | 542 | { |
543 | 543 | $type = $orig_type; |
544 | 544 | Mobile::setMobile(FALSE); |
@@ -551,14 +551,14 @@ discard block |
||
551 | 551 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
552 | 552 | } |
553 | 553 | |
554 | - if(!is_object($oModule)) |
|
554 | + if (!is_object($oModule)) |
|
555 | 555 | { |
556 | 556 | $this->_setInputErrorToContext(); |
557 | 557 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
558 | 558 | $oMessageObject->setError(-1); |
559 | 559 | $oMessageObject->setMessage($this->error); |
560 | 560 | $oMessageObject->dispMessage(); |
561 | - if($this->httpStatusCode) |
|
561 | + if ($this->httpStatusCode) |
|
562 | 562 | { |
563 | 563 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
564 | 564 | } |
@@ -566,10 +566,10 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | // If there is no such action in the module object |
569 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
569 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
570 | 570 | { |
571 | 571 | |
572 | - if(!Context::isInstalled()) |
|
572 | + if (!Context::isInstalled()) |
|
573 | 573 | { |
574 | 574 | $this->_setInputErrorToContext(); |
575 | 575 | $this->error = 'msg_invalid_request'; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $oMessageObject->setError(-1); |
578 | 578 | $oMessageObject->setMessage($this->error); |
579 | 579 | $oMessageObject->dispMessage(); |
580 | - if($this->httpStatusCode) |
|
580 | + if ($this->httpStatusCode) |
|
581 | 581 | { |
582 | 582 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
583 | 583 | } |
@@ -586,12 +586,12 @@ discard block |
||
586 | 586 | |
587 | 587 | $forward = NULL; |
588 | 588 | // 1. Look for the module with action name |
589 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
589 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
590 | 590 | { |
591 | - $module = strtolower($matches[2] . $matches[3]); |
|
591 | + $module = strtolower($matches[2].$matches[3]); |
|
592 | 592 | $xml_info = $oModuleModel->getModuleActionXml($module); |
593 | 593 | |
594 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
594 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
595 | 595 | { |
596 | 596 | $forward = new stdClass(); |
597 | 597 | $forward->module = $module; |
@@ -611,12 +611,12 @@ discard block |
||
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | - if(!$forward) |
|
614 | + if (!$forward) |
|
615 | 615 | { |
616 | 616 | $forward = $oModuleModel->getActionForward($this->act); |
617 | 617 | } |
618 | 618 | |
619 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
619 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
620 | 620 | { |
621 | 621 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
622 | 622 | $type = $forward->type; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | // check CSRF for non-GET actions |
630 | 630 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
631 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
631 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
632 | 632 | { |
633 | 633 | $this->error = 'msg_invalid_request'; |
634 | 634 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -640,11 +640,11 @@ discard block |
||
640 | 640 | |
641 | 641 | // SECISSUE also check foward act method |
642 | 642 | // check REQUEST_METHOD in controller |
643 | - if($type == 'controller') |
|
643 | + if ($type == 'controller') |
|
644 | 644 | { |
645 | 645 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
646 | 646 | |
647 | - if(!$allowedMethod) |
|
647 | + if (!$allowedMethod) |
|
648 | 648 | { |
649 | 649 | $allowedMethodList[0] = 'POST'; |
650 | 650 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
654 | 654 | } |
655 | 655 | |
656 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
656 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
657 | 657 | { |
658 | 658 | $this->error = "msg_invalid_request"; |
659 | 659 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
667 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
668 | 668 | { |
669 | 669 | $orig_type = "view"; |
670 | 670 | $type = "mobile"; |
671 | 671 | // create a module instance |
672 | 672 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
673 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
673 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
674 | 674 | { |
675 | 675 | $type = $orig_type; |
676 | 676 | Mobile::setMobile(FALSE); |
@@ -682,25 +682,25 @@ discard block |
||
682 | 682 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
683 | 683 | } |
684 | 684 | |
685 | - if(!is_object($oModule)) |
|
685 | + if (!is_object($oModule)) |
|
686 | 686 | { |
687 | 687 | $this->_setInputErrorToContext(); |
688 | 688 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
689 | 689 | $oMessageObject->setError(-1); |
690 | 690 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
691 | 691 | $oMessageObject->dispMessage(); |
692 | - if($this->httpStatusCode) |
|
692 | + if ($this->httpStatusCode) |
|
693 | 693 | { |
694 | 694 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
695 | 695 | } |
696 | 696 | return $oMessageObject; |
697 | 697 | } |
698 | 698 | |
699 | - if($this->module == "admin" && $type == "view") |
|
699 | + if ($this->module == "admin" && $type == "view") |
|
700 | 700 | { |
701 | - if($logged_info->is_admin == 'Y') |
|
701 | + if ($logged_info->is_admin == 'Y') |
|
702 | 702 | { |
703 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
703 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
704 | 704 | { |
705 | 705 | $oAdminView = getAdminView('admin'); |
706 | 706 | $oAdminView->makeGnbUrl($forward->module); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | return $oMessageObject; |
721 | 721 | } |
722 | 722 | } |
723 | - if($kind == 'admin') |
|
723 | + if ($kind == 'admin') |
|
724 | 724 | { |
725 | 725 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
726 | - if(!$grant->manager) |
|
726 | + if (!$grant->manager) |
|
727 | 727 | { |
728 | 728 | $this->_setInputErrorToContext(); |
729 | 729 | $this->error = 'msg_is_not_manager'; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | } |
736 | 736 | else |
737 | 737 | { |
738 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
738 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
739 | 739 | { |
740 | 740 | $this->_setInputErrorToContext(); |
741 | 741 | $this->error = 'msg_is_not_administrator'; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } |
749 | 749 | } |
750 | 750 | } |
751 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
751 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
752 | 752 | { |
753 | 753 | $this->act = $xml_info->default_index_act; |
754 | 754 | } |
@@ -762,16 +762,16 @@ discard block |
||
762 | 762 | } |
763 | 763 | |
764 | 764 | // ruleset check... |
765 | - if(!empty($ruleset)) |
|
765 | + if (!empty($ruleset)) |
|
766 | 766 | { |
767 | 767 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
768 | 768 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
769 | - if(!empty($rulesetFile)) |
|
769 | + if (!empty($rulesetFile)) |
|
770 | 770 | { |
771 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
771 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
772 | 772 | { |
773 | 773 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
774 | - foreach($errorLang as $key => $val) |
|
774 | + foreach ($errorLang as $key => $val) |
|
775 | 775 | { |
776 | 776 | Context::setLang($key, $val); |
777 | 777 | } |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | |
781 | 781 | $Validator = new Validator($rulesetFile); |
782 | 782 | $result = $Validator->validate(); |
783 | - if(!$result) |
|
783 | + if (!$result) |
|
784 | 784 | { |
785 | 785 | $lastError = $Validator->getLastError(); |
786 | 786 | $returnUrl = Context::get('error_return_url'); |
@@ -812,26 +812,26 @@ discard block |
||
812 | 812 | 'dispLayoutPreviewWithModule' => 1 |
813 | 813 | ); |
814 | 814 | $db_use_mobile = Mobile::isMobileEnabled(); |
815 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
815 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
816 | 816 | { |
817 | 817 | global $lang; |
818 | 818 | $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>'; |
819 | - $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>'; |
|
819 | + $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>'; |
|
820 | 820 | Context::addHtmlHeader($header); |
821 | 821 | Context::addHtmlFooter($footer); |
822 | 822 | } |
823 | 823 | |
824 | - if(($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
824 | + if (($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
825 | 825 | { |
826 | 826 | $module_config = $oModuleModel->getModuleConfig('module'); |
827 | - if($module_config->htmlFooter) |
|
827 | + if ($module_config->htmlFooter) |
|
828 | 828 | { |
829 | 829 | Context::addHtmlFooter($module_config->htmlFooter); |
830 | 830 | } |
831 | - if($module_config->siteTitle) |
|
831 | + if ($module_config->siteTitle) |
|
832 | 832 | { |
833 | 833 | $siteTitle = Context::getBrowserTitle(); |
834 | - if(!$siteTitle) |
|
834 | + if (!$siteTitle) |
|
835 | 835 | { |
836 | 836 | Context::setBrowserTitle($module_config->siteTitle); |
837 | 837 | } |
@@ -844,18 +844,18 @@ discard block |
||
844 | 844 | $procResult = $oModule->proc(); |
845 | 845 | |
846 | 846 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
847 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
847 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
848 | 848 | { |
849 | 849 | $error = $oModule->getError(); |
850 | 850 | $message = $oModule->getMessage(); |
851 | 851 | $messageType = $oModule->getMessageType(); |
852 | 852 | $redirectUrl = $oModule->getRedirectUrl(); |
853 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
853 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
854 | 854 | |
855 | - if(!$procResult) |
|
855 | + if (!$procResult) |
|
856 | 856 | { |
857 | 857 | $this->error = $message; |
858 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
858 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
859 | 859 | { |
860 | 860 | $redirectUrl = Context::get('error_return_url'); |
861 | 861 | } |
@@ -868,13 +868,13 @@ discard block |
||
868 | 868 | |
869 | 869 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
870 | 870 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
871 | - if($message != 'success') |
|
871 | + if ($message != 'success') |
|
872 | 872 | { |
873 | 873 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
874 | 874 | } |
875 | 875 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
876 | 876 | |
877 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
877 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
878 | 878 | { |
879 | 879 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
880 | 880 | } |
@@ -890,27 +890,27 @@ discard block |
||
890 | 890 | * */ |
891 | 891 | function _setInputErrorToContext() |
892 | 892 | { |
893 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
893 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
894 | 894 | { |
895 | 895 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
896 | 896 | } |
897 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
897 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
898 | 898 | { |
899 | 899 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
900 | 900 | } |
901 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
901 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
902 | 902 | { |
903 | 903 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
904 | 904 | } |
905 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
905 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
906 | 906 | { |
907 | 907 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
908 | 908 | } |
909 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
909 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
910 | 910 | { |
911 | 911 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
912 | 912 | } |
913 | - if(count($_SESSION['INPUT_ERROR'])) |
|
913 | + if (count($_SESSION['INPUT_ERROR'])) |
|
914 | 914 | { |
915 | 915 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
916 | 916 | } |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | { |
941 | 941 | $requestVars = Context::getRequestVars(); |
942 | 942 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
943 | - foreach($requestVars AS $key => $value) |
|
943 | + foreach ($requestVars AS $key => $value) |
|
944 | 944 | { |
945 | 945 | $_SESSION['INPUT_ERROR'][$key] = $value; |
946 | 946 | } |
@@ -954,41 +954,41 @@ discard block |
||
954 | 954 | function displayContent($oModule = NULL) |
955 | 955 | { |
956 | 956 | // If the module is not set or not an object, set error |
957 | - if(!$oModule || !is_object($oModule)) |
|
957 | + if (!$oModule || !is_object($oModule)) |
|
958 | 958 | { |
959 | 959 | $this->error = 'msg_module_is_not_exists'; |
960 | 960 | $this->httpStatusCode = '404'; |
961 | 961 | } |
962 | 962 | |
963 | 963 | // If connection to DB has a problem even though it's not install module, set error |
964 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
964 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
965 | 965 | { |
966 | 966 | $this->error = 'msg_dbconnect_failed'; |
967 | 967 | } |
968 | 968 | |
969 | 969 | // Call trigger after moduleHandler proc |
970 | 970 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
971 | - if(!$output->toBool()) |
|
971 | + if (!$output->toBool()) |
|
972 | 972 | { |
973 | 973 | $this->error = $output->getMessage(); |
974 | 974 | } |
975 | 975 | |
976 | 976 | // Use message view object, if HTML call |
977 | 977 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
978 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
978 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
979 | 979 | { |
980 | 980 | |
981 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
981 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
982 | 982 | { |
983 | 983 | $display_handler = new DisplayHandler(); |
984 | 984 | $display_handler->_debugOutput(); |
985 | 985 | |
986 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
986 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
987 | 987 | return; |
988 | 988 | } |
989 | 989 | |
990 | 990 | // If error occurred, handle it |
991 | - if($this->error) |
|
991 | + if ($this->error) |
|
992 | 992 | { |
993 | 993 | // display content with message module instance |
994 | 994 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $oMessageObject->setMessage($this->error); |
998 | 998 | $oMessageObject->dispMessage(); |
999 | 999 | |
1000 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1000 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1001 | 1001 | { |
1002 | 1002 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
1003 | 1003 | $oMessageObject->setTemplateFile('http_status_code'); |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // If module was called normally, change the templates of the module into ones of the message view module |
1007 | - if($oModule) |
|
1007 | + if ($oModule) |
|
1008 | 1008 | { |
1009 | 1009 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
1010 | 1010 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | // Check if layout_srl exists for the module |
1022 | - if(Mobile::isFromMobilePhone()) |
|
1022 | + if (Mobile::isFromMobilePhone()) |
|
1023 | 1023 | { |
1024 | 1024 | $layout_srl = $oModule->module_info->mlayout_srl; |
1025 | 1025 | } |
@@ -1029,58 +1029,58 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | // if layout_srl is rollback by module, set default layout |
1032 | - if($layout_srl == -1) |
|
1032 | + if ($layout_srl == -1) |
|
1033 | 1033 | { |
1034 | 1034 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
1035 | 1035 | $oLayoutAdminModel = getAdminModel('layout'); |
1036 | 1036 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
1039 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
1040 | 1040 | { |
1041 | 1041 | |
1042 | 1042 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
1043 | 1043 | $oLayoutModel = getModel('layout'); |
1044 | 1044 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
1045 | - if($layout_info) |
|
1045 | + if ($layout_info) |
|
1046 | 1046 | { |
1047 | 1047 | |
1048 | 1048 | // Input extra_vars into $layout_info |
1049 | - if($layout_info->extra_var_count) |
|
1049 | + if ($layout_info->extra_var_count) |
|
1050 | 1050 | { |
1051 | 1051 | |
1052 | - foreach($layout_info->extra_var as $var_id => $val) |
|
1052 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
1053 | 1053 | { |
1054 | - if($val->type == 'image') |
|
1054 | + if ($val->type == 'image') |
|
1055 | 1055 | { |
1056 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1056 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1057 | 1057 | { |
1058 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
1058 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | $layout_info->{$var_id} = $val->value; |
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | // Set menus into context |
1065 | - if($layout_info->menu_count) |
|
1065 | + if ($layout_info->menu_count) |
|
1066 | 1066 | { |
1067 | - foreach($layout_info->menu as $menu_id => $menu) |
|
1067 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
1068 | 1068 | { |
1069 | 1069 | // set default menu set(included home menu) |
1070 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
1070 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
1071 | 1071 | { |
1072 | 1072 | $oMenuAdminController = getAdminController('menu'); |
1073 | 1073 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
1074 | 1074 | |
1075 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
1075 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
1076 | 1076 | { |
1077 | 1077 | include($homeMenuCacheFile); |
1078 | 1078 | } |
1079 | 1079 | |
1080 | - if(!$menu->menu_srl) |
|
1080 | + if (!$menu->menu_srl) |
|
1081 | 1081 | { |
1082 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
1083 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
1082 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
1083 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
1084 | 1084 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
1085 | 1085 | } |
1086 | 1086 | else |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | $php_file = FileHandler::exists($menu->php_file); |
1094 | - if($php_file) |
|
1094 | + if ($php_file) |
|
1095 | 1095 | { |
1096 | 1096 | include($php_file); |
1097 | 1097 | } |
@@ -1107,17 +1107,17 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | // If layout was modified, use the modified version |
1109 | 1109 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
1110 | - if(file_exists($edited_layout)) |
|
1110 | + if (file_exists($edited_layout)) |
|
1111 | 1111 | { |
1112 | 1112 | $oModule->setEditedLayoutFile($edited_layout); |
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | $isLayoutDrop = Context::get('isLayoutDrop'); |
1117 | - if($isLayoutDrop) |
|
1117 | + if ($isLayoutDrop) |
|
1118 | 1118 | { |
1119 | 1119 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
1120 | - if($kind == 'admin') |
|
1120 | + if ($kind == 'admin') |
|
1121 | 1121 | { |
1122 | 1122 | $oModule->setLayoutFile('popup_layout'); |
1123 | 1123 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | function &getModuleInstance($module, $type = 'view', $kind = '') |
1156 | 1156 | { |
1157 | 1157 | |
1158 | - if(__DEBUG__ == 3) |
|
1158 | + if (__DEBUG__ == 3) |
|
1159 | 1159 | { |
1160 | 1160 | $start_time = getMicroTime(); |
1161 | 1161 | } |
@@ -1165,51 +1165,51 @@ discard block |
||
1165 | 1165 | $type = strtolower($type); |
1166 | 1166 | |
1167 | 1167 | $kinds = array('svc' => 1, 'admin' => 1); |
1168 | - if(!isset($kinds[$kind])) |
|
1168 | + if (!isset($kinds[$kind])) |
|
1169 | 1169 | { |
1170 | 1170 | $kind = 'svc'; |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
1173 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
1174 | 1174 | |
1175 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1175 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1176 | 1176 | { |
1177 | 1177 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | // if there is no instance of the module in global variable, create a new one |
1181 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1181 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1182 | 1182 | { |
1183 | 1183 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1184 | 1184 | |
1185 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1185 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1186 | 1186 | { |
1187 | 1187 | $module = $parent_module; |
1188 | 1188 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Check if the base class and instance class exist |
1192 | - if(!class_exists($module, true)) |
|
1192 | + if (!class_exists($module, true)) |
|
1193 | 1193 | { |
1194 | 1194 | return NULL; |
1195 | 1195 | } |
1196 | - if(!class_exists($instance_name, true)) |
|
1196 | + if (!class_exists($instance_name, true)) |
|
1197 | 1197 | { |
1198 | 1198 | return NULL; |
1199 | 1199 | } |
1200 | 1200 | |
1201 | 1201 | // Create an instance |
1202 | 1202 | $oModule = new $instance_name(); |
1203 | - if(!is_object($oModule)) |
|
1203 | + if (!is_object($oModule)) |
|
1204 | 1204 | { |
1205 | 1205 | return NULL; |
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | // Load language files for the class |
1209 | - Context::loadLang($class_path . 'lang'); |
|
1210 | - if($extend_module) |
|
1209 | + Context::loadLang($class_path.'lang'); |
|
1210 | + if ($extend_module) |
|
1211 | 1211 | { |
1212 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
1212 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | // Set variables to the instance |
@@ -1217,10 +1217,10 @@ discard block |
||
1217 | 1217 | $oModule->setModulePath($class_path); |
1218 | 1218 | |
1219 | 1219 | // If the module has a constructor, run it. |
1220 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1220 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1221 | 1221 | { |
1222 | 1222 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
1223 | - if(@method_exists($oModule, $instance_name)) |
|
1223 | + if (@method_exists($oModule, $instance_name)) |
|
1224 | 1224 | { |
1225 | 1225 | $oModule->{$instance_name}(); |
1226 | 1226 | } |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - if(__DEBUG__ == 3) |
|
1233 | + if (__DEBUG__ == 3) |
|
1234 | 1234 | { |
1235 | 1235 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
1236 | 1236 | } |
@@ -1246,17 +1246,17 @@ discard block |
||
1246 | 1246 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
1247 | 1247 | $highClassFile = FileHandler::getRealPath($highClassFile); |
1248 | 1248 | |
1249 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
1250 | - if(!in_array($type, $types)) |
|
1249 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
1250 | + if (!in_array($type, $types)) |
|
1251 | 1251 | { |
1252 | 1252 | $type = $types[0]; |
1253 | 1253 | } |
1254 | - if($type == 'class') |
|
1254 | + if ($type == 'class') |
|
1255 | 1255 | { |
1256 | 1256 | $instanceName = '%s'; |
1257 | 1257 | $classFile = '%s%s.%s.php'; |
1258 | 1258 | } |
1259 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1259 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
1260 | 1260 | { |
1261 | 1261 | $instanceName = '%sAdmin%s'; |
1262 | 1262 | $classFile = '%s%s.admin.%s.php'; |
@@ -1281,26 +1281,26 @@ discard block |
||
1281 | 1281 | function triggerCall($trigger_name, $called_position, &$obj) |
1282 | 1282 | { |
1283 | 1283 | // skip if not installed |
1284 | - if(!Context::isInstalled()) |
|
1284 | + if (!Context::isInstalled()) |
|
1285 | 1285 | { |
1286 | 1286 | return new BaseObject(); |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | $oModuleModel = getModel('module'); |
1290 | 1290 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
1291 | - if(!$triggers || count($triggers) < 1) |
|
1291 | + if (!$triggers || count($triggers) < 1) |
|
1292 | 1292 | { |
1293 | 1293 | return new BaseObject(); |
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | //store before trigger call time |
1297 | 1297 | $before_trigger_time = NULL; |
1298 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
1298 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
1299 | 1299 | { |
1300 | 1300 | $before_trigger_time = microtime(true); |
1301 | 1301 | } |
1302 | 1302 | |
1303 | - foreach($triggers as $item) |
|
1303 | + foreach ($triggers as $item) |
|
1304 | 1304 | { |
1305 | 1305 | $module = $item->module; |
1306 | 1306 | $type = $item->type; |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | |
1309 | 1309 | // todo why don't we call a normal class object ? |
1310 | 1310 | $oModule = getModule($module, $type); |
1311 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
1311 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
1312 | 1312 | { |
1313 | 1313 | continue; |
1314 | 1314 | } |
@@ -1321,12 +1321,12 @@ discard block |
||
1321 | 1321 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
1322 | 1322 | |
1323 | 1323 | $slowlog = new stdClass; |
1324 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
1325 | - $slowlog->called = $module . '.' . $called_method; |
|
1324 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
1325 | + $slowlog->called = $module.'.'.$called_method; |
|
1326 | 1326 | $slowlog->called_extension = $module; |
1327 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1327 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1328 | 1328 | |
1329 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1329 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1330 | 1330 | { |
1331 | 1331 | return $output; |
1332 | 1332 | } |
@@ -1411,9 +1411,9 @@ discard block |
||
1411 | 1411 | '511' => 'Network Authentication Required', |
1412 | 1412 | ); |
1413 | 1413 | $statusMessage = $statusMessageList[$code]; |
1414 | - if(!$statusMessage) |
|
1414 | + if (!$statusMessage) |
|
1415 | 1415 | { |
1416 | - $statusMessage = 'HTTP ' . $code; |
|
1416 | + $statusMessage = 'HTTP '.$code; |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | Context::set('http_status_code', $code); |
@@ -955,10 +955,10 @@ |
||
955 | 955 | |
956 | 956 | $file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
957 | 957 | if(!$file_exsit && $default === true) |
958 | - { |
|
959 | - $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
960 | - } |
|
961 | - elseif($file_exsit) |
|
958 | + { |
|
959 | + $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
960 | + } |
|
961 | + elseif($file_exsit) |
|
962 | 962 | { |
963 | 963 | $default_url = Context::GetUrl(); |
964 | 964 | if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | { |
31 | 31 | $ftp_info = Context::getRequestVars(); |
32 | 32 | |
33 | - if(!$ftp_info->ftp_host) |
|
33 | + if (!$ftp_info->ftp_host) |
|
34 | 34 | { |
35 | 35 | $ftp_info->ftp_host = "127.0.0.1"; |
36 | 36 | } |
37 | 37 | |
38 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
38 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
39 | 39 | { |
40 | 40 | $ftp_info->ftp_port = '22'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
44 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
44 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
45 | 45 | { |
46 | 46 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
47 | 47 | } |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | $path_candidate = array(); |
59 | 59 | |
60 | 60 | $temp = ''; |
61 | - foreach($path_info as $path) |
|
61 | + foreach ($path_info as $path) |
|
62 | 62 | { |
63 | - $temp = '/' . $path . $temp; |
|
63 | + $temp = '/'.$path.$temp; |
|
64 | 64 | $path_candidate[] = $temp; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // try |
68 | - foreach($path_candidate as $path) |
|
68 | + foreach ($path_candidate as $path) |
|
69 | 69 | { |
70 | 70 | // upload check file |
71 | - if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html')) |
|
71 | + if (!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path.'ftp_check.html')) |
|
72 | 72 | { |
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // get check file |
77 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
77 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
78 | 78 | |
79 | 79 | // delete temp check file |
80 | - @ssh2_sftp_unlink($sftp, $path . 'ftp_check.html'); |
|
80 | + @ssh2_sftp_unlink($sftp, $path.'ftp_check.html'); |
|
81 | 81 | |
82 | 82 | // found |
83 | - if($result == $pin) |
|
83 | + if ($result == $pin) |
|
84 | 84 | { |
85 | 85 | $found_path = $path; |
86 | 86 | break; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
91 | 91 | |
92 | - if($found_path) |
|
92 | + if ($found_path) |
|
93 | 93 | { |
94 | 94 | $this->add('found_path', $found_path); |
95 | 95 | } |
@@ -99,24 +99,24 @@ discard block |
||
99 | 99 | { |
100 | 100 | $ftp_info = Context::getRequestVars(); |
101 | 101 | |
102 | - if(!$ftp_info->ftp_host) |
|
102 | + if (!$ftp_info->ftp_host) |
|
103 | 103 | { |
104 | 104 | $ftp_info->ftp_host = "127.0.0.1"; |
105 | 105 | } |
106 | 106 | |
107 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
107 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
108 | 108 | { |
109 | 109 | $ftp_info->ftp_port = '22'; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
113 | - if(!$connection) |
|
113 | + if (!$connection) |
|
114 | 114 | { |
115 | 115 | return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
116 | 116 | } |
117 | 117 | |
118 | 118 | $login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password); |
119 | - if(!$login_result) |
|
119 | + if (!$login_result) |
|
120 | 120 | { |
121 | 121 | ftp_close($connection); |
122 | 122 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
@@ -133,29 +133,29 @@ discard block |
||
133 | 133 | $path_candidate = array(); |
134 | 134 | |
135 | 135 | $temp = ''; |
136 | - foreach($path_info as $path) |
|
136 | + foreach ($path_info as $path) |
|
137 | 137 | { |
138 | - $temp = '/' . $path . $temp; |
|
138 | + $temp = '/'.$path.$temp; |
|
139 | 139 | $path_candidate[] = $temp; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // try |
143 | - foreach($path_candidate as $path) |
|
143 | + foreach ($path_candidate as $path) |
|
144 | 144 | { |
145 | 145 | // upload check file |
146 | - if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
146 | + if (!ftp_put($connection, $path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
147 | 147 | { |
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // get check file |
152 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
152 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
153 | 153 | |
154 | 154 | // delete temp check file |
155 | - ftp_delete($connection, $path . 'ftp_check.html'); |
|
155 | + ftp_delete($connection, $path.'ftp_check.html'); |
|
156 | 156 | |
157 | 157 | // found |
158 | - if($result == $pin) |
|
158 | + if ($result == $pin) |
|
159 | 159 | { |
160 | 160 | $found_path = $path; |
161 | 161 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
166 | 166 | |
167 | - if($found_path) |
|
167 | + if ($found_path) |
|
168 | 168 | { |
169 | 169 | $this->add('found_path', $found_path); |
170 | 170 | } |
@@ -175,39 +175,39 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function getAdminFTPPath() |
177 | 177 | { |
178 | - Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
178 | + Context::loadLang(_XE_PATH_.'modules/autoinstall/lang'); |
|
179 | 179 | @set_time_limit(5); |
180 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
180 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
181 | 181 | |
182 | 182 | $ftp_info = Context::getRequestVars(); |
183 | 183 | |
184 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
184 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
185 | 185 | { |
186 | 186 | return new BaseObject(1, 'msg_ftp_invalid_auth_info'); |
187 | 187 | } |
188 | 188 | |
189 | - if(!$ftp_info->ftp_host) |
|
189 | + if (!$ftp_info->ftp_host) |
|
190 | 190 | { |
191 | 191 | $ftp_info->ftp_host = '127.0.0.1'; |
192 | 192 | } |
193 | 193 | |
194 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
194 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
195 | 195 | { |
196 | 196 | $ftp_info->ftp_port = '21'; |
197 | 197 | } |
198 | 198 | |
199 | - if($ftp_info->sftp == 'Y') |
|
199 | + if ($ftp_info->sftp == 'Y') |
|
200 | 200 | { |
201 | - if(!function_exists('ssh2_sftp')) |
|
201 | + if (!function_exists('ssh2_sftp')) |
|
202 | 202 | { |
203 | 203 | return new BaseObject(-1, 'disable_sftp_support'); |
204 | 204 | } |
205 | 205 | return $this->getSFTPPath(); |
206 | 206 | } |
207 | 207 | |
208 | - if($ftp_info->ftp_pasv == 'N') |
|
208 | + if ($ftp_info->ftp_pasv == 'N') |
|
209 | 209 | { |
210 | - if(function_exists('ftp_connect')) |
|
210 | + if (function_exists('ftp_connect')) |
|
211 | 211 | { |
212 | 212 | return $this->getFTPPath(); |
213 | 213 | } |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | $oFTP = new ftp(); |
218 | - if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
218 | + if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
219 | 219 | { |
220 | 220 | return new BaseObject(1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
221 | 221 | } |
222 | 222 | |
223 | - if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
223 | + if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
224 | 224 | { |
225 | 225 | return new BaseObject(1, 'msg_ftp_invalid_auth_info'); |
226 | 226 | } |
@@ -236,29 +236,29 @@ discard block |
||
236 | 236 | $path_candidate = array(); |
237 | 237 | |
238 | 238 | $temp = ''; |
239 | - foreach($path_info as $path) |
|
239 | + foreach ($path_info as $path) |
|
240 | 240 | { |
241 | - $temp = '/' . $path . $temp; |
|
241 | + $temp = '/'.$path.$temp; |
|
242 | 242 | $path_candidate[] = $temp; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // try |
246 | - foreach($path_candidate as $path) |
|
246 | + foreach ($path_candidate as $path) |
|
247 | 247 | { |
248 | 248 | // upload check file |
249 | - if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
249 | + if (!$oFTP->ftp_put($path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
250 | 250 | { |
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // get check file |
255 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
255 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
256 | 256 | |
257 | 257 | // delete temp check file |
258 | - $oFTP->ftp_delete($path . 'ftp_check.html'); |
|
258 | + $oFTP->ftp_delete($path.'ftp_check.html'); |
|
259 | 259 | |
260 | 260 | // found |
261 | - if($result == $pin) |
|
261 | + if ($result == $pin) |
|
262 | 262 | { |
263 | 263 | $found_path = $path; |
264 | 264 | break; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
269 | 269 | |
270 | - if($found_path) |
|
270 | + if ($found_path) |
|
271 | 271 | { |
272 | 272 | $this->add('found_path', $found_path); |
273 | 273 | } |
@@ -280,27 +280,27 @@ discard block |
||
280 | 280 | function getSFTPList() |
281 | 281 | { |
282 | 282 | $ftp_info = Context::getRequestVars(); |
283 | - if(!$ftp_info->ftp_host) |
|
283 | + if (!$ftp_info->ftp_host) |
|
284 | 284 | { |
285 | 285 | $ftp_info->ftp_host = "127.0.0.1"; |
286 | 286 | } |
287 | 287 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
288 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
288 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
289 | 289 | { |
290 | 290 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
291 | 291 | } |
292 | 292 | |
293 | 293 | $sftp = ssh2_sftp($connection); |
294 | - $curpwd = "ssh2.sftp://$sftp" . $this->pwd; |
|
294 | + $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
|
295 | 295 | $dh = @opendir($curpwd); |
296 | - if(!$dh) |
|
296 | + if (!$dh) |
|
297 | 297 | { |
298 | 298 | return new BaseObject(-1, 'msg_ftp_invalid_path'); |
299 | 299 | } |
300 | 300 | $list = array(); |
301 | - while(($file = readdir($dh)) !== FALSE) |
|
301 | + while (($file = readdir($dh)) !== FALSE) |
|
302 | 302 | { |
303 | - if(is_dir($curpwd . $file)) |
|
303 | + if (is_dir($curpwd.$file)) |
|
304 | 304 | { |
305 | 305 | $file .= "/"; |
306 | 306 | } |
@@ -320,32 +320,32 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function getAdminFTPList() |
322 | 322 | { |
323 | - Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
323 | + Context::loadLang(_XE_PATH_.'modules/autoinstall/lang'); |
|
324 | 324 | @set_time_limit(5); |
325 | 325 | |
326 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
326 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
327 | 327 | |
328 | 328 | $ftp_info = Context::getRequestVars(); |
329 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
329 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
330 | 330 | { |
331 | 331 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
332 | 332 | } |
333 | 333 | |
334 | 334 | $this->pwd = $ftp_info->ftp_root_path; |
335 | 335 | |
336 | - if(!$ftp_info->ftp_host) |
|
336 | + if (!$ftp_info->ftp_host) |
|
337 | 337 | { |
338 | 338 | $ftp_info->ftp_host = "127.0.0.1"; |
339 | 339 | } |
340 | 340 | |
341 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
341 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
342 | 342 | { |
343 | 343 | $ftp_info->ftp_port = "21"; |
344 | 344 | } |
345 | 345 | |
346 | - if($ftp_info->sftp == 'Y') |
|
346 | + if ($ftp_info->sftp == 'Y') |
|
347 | 347 | { |
348 | - if(!function_exists('ssh2_sftp')) |
|
348 | + if (!function_exists('ssh2_sftp')) |
|
349 | 349 | { |
350 | 350 | return new BaseObject(-1, 'disable_sftp_support'); |
351 | 351 | } |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | $oFtp = new ftp(); |
356 | - if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
356 | + if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
357 | 357 | { |
358 | - if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
358 | + if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
359 | 359 | { |
360 | 360 | $_list = $oFtp->ftp_rawlist($this->pwd); |
361 | 361 | $oFtp->ftp_quit(); |
@@ -367,17 +367,17 @@ discard block |
||
367 | 367 | } |
368 | 368 | $list = array(); |
369 | 369 | |
370 | - if($_list) |
|
370 | + if ($_list) |
|
371 | 371 | { |
372 | - foreach($_list as $k => $v) |
|
372 | + foreach ($_list as $k => $v) |
|
373 | 373 | { |
374 | 374 | $src = new stdClass(); |
375 | 375 | $src->data = $v; |
376 | 376 | $res = Context::convertEncoding($src); |
377 | 377 | $v = $res->data; |
378 | - if(strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
378 | + if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
379 | 379 | { |
380 | - $list[] = substr(strrchr($v, ' '), 1) . '/'; |
|
380 | + $list[] = substr(strrchr($v, ' '), 1).'/'; |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | , 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget') |
401 | 401 | , 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image') |
402 | 402 | , 'layout' => array('default') |
403 | - , 'widget' => array('content', 'language_select', 'login_info','mcontent') |
|
403 | + , 'widget' => array('content', 'language_select', 'login_info', 'mcontent') |
|
404 | 404 | , 'widgetstyle' => array(), |
405 | 405 | ); |
406 | 406 | $info = array(); |
@@ -420,86 +420,86 @@ discard block |
||
420 | 420 | $info['use_ssl'] = $db_info->use_ssl; |
421 | 421 | |
422 | 422 | $info['phpext'] = ''; |
423 | - foreach(get_loaded_extensions() as $ext) |
|
423 | + foreach (get_loaded_extensions() as $ext) |
|
424 | 424 | { |
425 | 425 | $ext = strtolower($ext); |
426 | - if(in_array($ext, $skip['ext'])) |
|
426 | + if (in_array($ext, $skip['ext'])) |
|
427 | 427 | { |
428 | 428 | continue; |
429 | 429 | } |
430 | - $info['phpext'] .= '|' . $ext; |
|
430 | + $info['phpext'] .= '|'.$ext; |
|
431 | 431 | } |
432 | 432 | $info['phpext'] = substr($info['phpext'], 1); |
433 | 433 | |
434 | 434 | $info['module'] = ''; |
435 | 435 | $oModuleModel = getModel('module'); |
436 | 436 | $module_list = $oModuleModel->getModuleList(); |
437 | - if($module_list) foreach($module_list as $module) |
|
437 | + if ($module_list) foreach ($module_list as $module) |
|
438 | 438 | { |
439 | - if(in_array($module->module, $skip['module'])) |
|
439 | + if (in_array($module->module, $skip['module'])) |
|
440 | 440 | { |
441 | 441 | continue; |
442 | 442 | } |
443 | - $info['module'] .= '|' . $module->module; |
|
443 | + $info['module'] .= '|'.$module->module; |
|
444 | 444 | } |
445 | 445 | $info['module'] = substr($info['module'], 1); |
446 | 446 | |
447 | 447 | $info['addon'] = ''; |
448 | 448 | $oAddonAdminModel = getAdminModel('addon'); |
449 | 449 | $addon_list = $oAddonAdminModel->getAddonList(); |
450 | - if($addon_list) foreach($addon_list as $addon) |
|
450 | + if ($addon_list) foreach ($addon_list as $addon) |
|
451 | 451 | { |
452 | - if(in_array($addon->addon, $skip['addon'])) |
|
452 | + if (in_array($addon->addon, $skip['addon'])) |
|
453 | 453 | { |
454 | 454 | continue; |
455 | 455 | } |
456 | - $info['addon'] .= '|' . $addon->addon; |
|
456 | + $info['addon'] .= '|'.$addon->addon; |
|
457 | 457 | } |
458 | 458 | $info['addon'] = substr($info['addon'], 1); |
459 | 459 | |
460 | 460 | $info['layout'] = ""; |
461 | 461 | $oLayoutModel = getModel('layout'); |
462 | 462 | $layout_list = $oLayoutModel->getDownloadedLayoutList(); |
463 | - if($layout_list) foreach($layout_list as $layout) |
|
463 | + if ($layout_list) foreach ($layout_list as $layout) |
|
464 | 464 | { |
465 | - if(in_array($layout->layout, $skip['layout'])) |
|
465 | + if (in_array($layout->layout, $skip['layout'])) |
|
466 | 466 | { |
467 | 467 | continue; |
468 | 468 | } |
469 | - $info['layout'] .= '|' . $layout->layout; |
|
469 | + $info['layout'] .= '|'.$layout->layout; |
|
470 | 470 | } |
471 | 471 | $info['layout'] = substr($info['layout'], 1); |
472 | 472 | |
473 | 473 | $info['widget'] = ""; |
474 | 474 | $oWidgetModel = getModel('widget'); |
475 | 475 | $widget_list = $oWidgetModel->getDownloadedWidgetList(); |
476 | - if($widget_list) foreach($widget_list as $widget) |
|
476 | + if ($widget_list) foreach ($widget_list as $widget) |
|
477 | 477 | { |
478 | - if(in_array($widget->widget, $skip['widget'])) |
|
478 | + if (in_array($widget->widget, $skip['widget'])) |
|
479 | 479 | { |
480 | 480 | continue; |
481 | 481 | } |
482 | - $info['widget'] .= '|' . $widget->widget; |
|
482 | + $info['widget'] .= '|'.$widget->widget; |
|
483 | 483 | } |
484 | 484 | $info['widget'] = substr($info['widget'], 1); |
485 | 485 | |
486 | 486 | $info['widgetstyle'] = ""; |
487 | 487 | $oWidgetModel = getModel('widget'); |
488 | 488 | $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); |
489 | - if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle) |
|
489 | + if ($widgetstyle_list) foreach ($widgetstyle_list as $widgetstyle) |
|
490 | 490 | { |
491 | - if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
491 | + if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
492 | 492 | { |
493 | 493 | continue; |
494 | 494 | } |
495 | - $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; |
|
495 | + $info['widgetstyle'] .= '|'.$widgetstyle->widgetStyle; |
|
496 | 496 | } |
497 | 497 | $info['widgetstyle'] = substr($info['widgetstyle'], 1); |
498 | 498 | |
499 | 499 | $param = ''; |
500 | - foreach($info as $k => $v) |
|
500 | + foreach ($info as $k => $v) |
|
501 | 501 | { |
502 | - if($v) |
|
502 | + if ($v) |
|
503 | 503 | { |
504 | 504 | $param .= sprintf('&%s=%s', $k, urlencode($v)); |
505 | 505 | } |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function getThemeList() |
517 | 517 | { |
518 | - $path = _XE_PATH_ . 'themes'; |
|
518 | + $path = _XE_PATH_.'themes'; |
|
519 | 519 | $list = FileHandler::readDir($path); |
520 | 520 | |
521 | 521 | $theme_info = array(); |
522 | - if(count($list) > 0) |
|
522 | + if (count($list) > 0) |
|
523 | 523 | { |
524 | - foreach($list as $val) |
|
524 | + foreach ($list as $val) |
|
525 | 525 | { |
526 | 526 | $theme_info[$val] = $this->getThemeInfo($val); |
527 | 527 | } |
@@ -538,20 +538,20 @@ discard block |
||
538 | 538 | */ |
539 | 539 | function getThemeInfo($theme_name, $layout_list = NULL) |
540 | 540 | { |
541 | - if($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
541 | + if ($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
542 | 542 | { |
543 | 543 | return $GLOBALS['__ThemeInfo__'][$theme_name]; |
544 | 544 | } |
545 | 545 | |
546 | - $info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml'; |
|
547 | - if(!file_exists($info_file)) |
|
546 | + $info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml'; |
|
547 | + if (!file_exists($info_file)) |
|
548 | 548 | { |
549 | 549 | return; |
550 | 550 | } |
551 | 551 | |
552 | 552 | $oXmlParser = new XmlParser(); |
553 | 553 | $_xml_obj = $oXmlParser->loadXmlFile($info_file); |
554 | - if(!$_xml_obj->theme) |
|
554 | + if (!$_xml_obj->theme) |
|
555 | 555 | { |
556 | 556 | return; |
557 | 557 | } |
@@ -562,16 +562,16 @@ discard block |
||
562 | 562 | $theme_info = new stdClass(); |
563 | 563 | $theme_info->name = $theme_name; |
564 | 564 | $theme_info->title = $xml_obj->title->body; |
565 | - $thumbnail = './themes/' . $theme_name . '/thumbnail.png'; |
|
565 | + $thumbnail = './themes/'.$theme_name.'/thumbnail.png'; |
|
566 | 566 | $theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL; |
567 | 567 | $theme_info->version = $xml_obj->version->body; |
568 | 568 | $date_obj = new stdClass(); |
569 | 569 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
570 | 570 | $theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
571 | 571 | $theme_info->description = $xml_obj->description->body; |
572 | - $theme_info->path = './themes/' . $theme_name . '/'; |
|
572 | + $theme_info->path = './themes/'.$theme_name.'/'; |
|
573 | 573 | |
574 | - if(!is_array($xml_obj->publisher)) |
|
574 | + if (!is_array($xml_obj->publisher)) |
|
575 | 575 | { |
576 | 576 | $publisher_list = array(); |
577 | 577 | $publisher_list[] = $xml_obj->publisher; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | $theme_info->publisher = array(); |
585 | - foreach($publisher_list as $publisher) |
|
585 | + foreach ($publisher_list as $publisher) |
|
586 | 586 | { |
587 | 587 | $publisher_obj = new stdClass(); |
588 | 588 | $publisher_obj->name = $publisher->name->body; |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $layout_path = $layout->directory->attrs->path; |
596 | 596 | $layout_parse = explode('/', $layout_path); |
597 | 597 | $layout_info = new stdClass(); |
598 | - switch($layout_parse[1]) |
|
598 | + switch ($layout_parse[1]) |
|
599 | 599 | { |
600 | 600 | case 'themes' : |
601 | - $layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1]; |
|
601 | + $layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse) - 1]; |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'layouts' : |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | $oLayoutModel = getModel('layout'); |
616 | 616 | $layout_info_list = array(); |
617 | 617 | $layout_list = $oLayoutModel->getLayoutList($site_info->site_srl); |
618 | - if($layout_list) |
|
618 | + if ($layout_list) |
|
619 | 619 | { |
620 | - foreach($layout_list as $val) |
|
620 | + foreach ($layout_list as $val) |
|
621 | 621 | { |
622 | - if($val->layout == $layout_info->name) |
|
622 | + if ($val->layout == $layout_info->name) |
|
623 | 623 | { |
624 | 624 | $is_new_layout = FALSE; |
625 | 625 | $layout_info->layout_srl = $val->layout_srl; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
631 | - if($is_new_layout) |
|
631 | + if ($is_new_layout) |
|
632 | 632 | { |
633 | 633 | $site_module_info = Context::get('site_module_info'); |
634 | 634 | $args = new stdClass(); |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $theme_info->layout_info = $layout_info; |
647 | 647 | |
648 | 648 | $skin_infos = $xml_obj->skininfos; |
649 | - if(is_array($skin_infos->skininfo)) |
|
649 | + if (is_array($skin_infos->skininfo)) |
|
650 | 650 | { |
651 | 651 | $skin_list = $skin_infos->skininfo; |
652 | 652 | } |
@@ -657,17 +657,17 @@ discard block |
||
657 | 657 | |
658 | 658 | $oModuleModel = getModel('module'); |
659 | 659 | $skins = array(); |
660 | - foreach($skin_list as $val) |
|
660 | + foreach ($skin_list as $val) |
|
661 | 661 | { |
662 | 662 | $skin_info = new stdClass(); |
663 | 663 | unset($skin_parse); |
664 | 664 | $skin_parse = explode('/', $val->directory->attrs->path); |
665 | - switch($skin_parse[1]) |
|
665 | + switch ($skin_parse[1]) |
|
666 | 666 | { |
667 | 667 | case 'themes' : |
668 | 668 | $is_theme = TRUE; |
669 | 669 | $module_name = $skin_parse[count($skin_parse) - 1]; |
670 | - $skin_info->name = $theme_name . '|@|' . $module_name; |
|
670 | + $skin_info->name = $theme_name.'|@|'.$module_name; |
|
671 | 671 | break; |
672 | 672 | |
673 | 673 | case 'modules' : |
@@ -681,9 +681,9 @@ discard block |
||
681 | 681 | $skin_info->is_theme = $is_theme; |
682 | 682 | $skins[$module_name] = $skin_info; |
683 | 683 | |
684 | - if($is_theme) |
|
684 | + if ($is_theme) |
|
685 | 685 | { |
686 | - if(!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
686 | + if (!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
687 | 687 | { |
688 | 688 | $GLOBALS['__ThemeModuleSkin__'][$module_name] = array(); |
689 | 689 | $GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array(); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | */ |
706 | 706 | function getModulesSkinList() |
707 | 707 | { |
708 | - if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
708 | + if ($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
709 | 709 | { |
710 | 710 | return $GLOBALS['__ThemeModuleSkin__']; |
711 | 711 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | sort($searched_list); |
714 | 714 | |
715 | 715 | $searched_count = count($searched_list); |
716 | - if(!$searched_count) |
|
716 | + if (!$searched_count) |
|
717 | 717 | { |
718 | 718 | return; |
719 | 719 | } |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | $exceptionModule = array('editor', 'poll', 'homepage', 'textyle'); |
722 | 722 | |
723 | 723 | $oModuleModel = getModel('module'); |
724 | - foreach($searched_list as $val) |
|
724 | + foreach ($searched_list as $val) |
|
725 | 725 | { |
726 | - $skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val); |
|
726 | + $skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$val); |
|
727 | 727 | |
728 | - if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
728 | + if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
729 | 729 | { |
730 | - if(!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
730 | + if (!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
731 | 731 | { |
732 | 732 | $GLOBALS['__ThemeModuleSkin__'][$val] = array(); |
733 | 733 | $moduleInfo = $oModuleModel->getModuleInfoXml($val); |
@@ -751,23 +751,23 @@ discard block |
||
751 | 751 | static $lang = false; |
752 | 752 | |
753 | 753 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
754 | - if($lang === false && $oCacheHandler->isSupport()) |
|
754 | + if ($lang === false && $oCacheHandler->isSupport()) |
|
755 | 755 | { |
756 | - $cache_key = 'admin_menu_langs:' . Context::getLangType(); |
|
756 | + $cache_key = 'admin_menu_langs:'.Context::getLangType(); |
|
757 | 757 | $lang = $oCacheHandler->get($cache_key); |
758 | 758 | |
759 | - if($lang === false) |
|
759 | + if ($lang === false) |
|
760 | 760 | { |
761 | 761 | $lang = array(); |
762 | 762 | $oModuleModel = getModel('module'); |
763 | 763 | $installed_module_list = $oModuleModel->getModulesXmlInfo(); |
764 | 764 | |
765 | - foreach($installed_module_list as $key => $value) |
|
765 | + foreach ($installed_module_list as $key => $value) |
|
766 | 766 | { |
767 | 767 | $moduleActionInfo = $oModuleModel->getModuleActionXml($value->module); |
768 | - if(is_object($moduleActionInfo->menu)) |
|
768 | + if (is_object($moduleActionInfo->menu)) |
|
769 | 769 | { |
770 | - foreach($moduleActionInfo->menu as $key2 => $value2) |
|
770 | + foreach ($moduleActionInfo->menu as $key2 => $value2) |
|
771 | 771 | { |
772 | 772 | $lang[$key2] = $value2->title; |
773 | 773 | } |
@@ -792,19 +792,19 @@ discard block |
||
792 | 792 | $args = new stdClass(); |
793 | 793 | $args->site_srl = $siteSrl; |
794 | 794 | $output = executeQueryArray('admin.getFavoriteList', $args); |
795 | - if(!$output->toBool()) |
|
795 | + if (!$output->toBool()) |
|
796 | 796 | { |
797 | 797 | return $output; |
798 | 798 | } |
799 | - if(!$output->data) |
|
799 | + if (!$output->data) |
|
800 | 800 | { |
801 | 801 | return new BaseObject(); |
802 | 802 | } |
803 | 803 | |
804 | - if($isGetModuleInfo && is_array($output->data)) |
|
804 | + if ($isGetModuleInfo && is_array($output->data)) |
|
805 | 805 | { |
806 | 806 | $oModuleModel = getModel('module'); |
807 | - foreach($output->data AS $key => $value) |
|
807 | + foreach ($output->data AS $key => $value) |
|
808 | 808 | { |
809 | 809 | $moduleInfo = $oModuleModel->getModuleInfoXml($value->module); |
810 | 810 | $output->data[$key]->admin_index_act = $moduleInfo->admin_index_act; |
@@ -829,13 +829,13 @@ discard block |
||
829 | 829 | $args->site_srl = $siteSrl; |
830 | 830 | $args->module = $module; |
831 | 831 | $output = executeQuery('admin.getFavorite', $args); |
832 | - if(!$output->toBool()) |
|
832 | + if (!$output->toBool()) |
|
833 | 833 | { |
834 | 834 | return $output; |
835 | 835 | } |
836 | 836 | |
837 | 837 | $returnObject = new BaseObject(); |
838 | - if($output->data) |
|
838 | + if ($output->data) |
|
839 | 839 | { |
840 | 840 | $returnObject->add('result', TRUE); |
841 | 841 | $returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | */ |
855 | 855 | function getSiteAllList() |
856 | 856 | { |
857 | - if(Context::get('domain')) |
|
857 | + if (Context::get('domain')) |
|
858 | 858 | { |
859 | 859 | $domain = Context::get('domain'); |
860 | 860 | } |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | function getAllSitesThatHaveModules($domain = NULL) |
872 | 872 | { |
873 | 873 | $args = new stdClass(); |
874 | - if($domain) |
|
874 | + if ($domain) |
|
875 | 875 | { |
876 | 876 | $args->domain = $domain; |
877 | 877 | } |
@@ -879,31 +879,31 @@ discard block |
||
879 | 879 | |
880 | 880 | $siteList = array(); |
881 | 881 | $output = executeQueryArray('admin.getSiteAllList', $args, $columnList); |
882 | - if($output->toBool()) |
|
882 | + if ($output->toBool()) |
|
883 | 883 | { |
884 | 884 | $siteList = $output->data; |
885 | 885 | } |
886 | 886 | |
887 | 887 | $oModuleModel = getModel('module'); |
888 | - foreach($siteList as $key => $value) |
|
888 | + foreach ($siteList as $key => $value) |
|
889 | 889 | { |
890 | 890 | $args->site_srl = $value->site_srl; |
891 | 891 | $list = $oModuleModel->getModuleSrlList($args); |
892 | 892 | |
893 | - if(!is_array($list)) |
|
893 | + if (!is_array($list)) |
|
894 | 894 | { |
895 | 895 | $list = array($list); |
896 | 896 | } |
897 | 897 | |
898 | - foreach($list as $k => $v) |
|
898 | + foreach ($list as $k => $v) |
|
899 | 899 | { |
900 | - if(!is_dir(_XE_PATH_ . 'modules/' . $v->module)) |
|
900 | + if (!is_dir(_XE_PATH_.'modules/'.$v->module)) |
|
901 | 901 | { |
902 | 902 | unset($list[$k]); |
903 | 903 | } |
904 | 904 | } |
905 | 905 | |
906 | - if(!count($list)) |
|
906 | + if (!count($list)) |
|
907 | 907 | { |
908 | 908 | unset($siteList[$key]); |
909 | 909 | } |
@@ -920,13 +920,13 @@ discard block |
||
920 | 920 | { |
921 | 921 | $args = new stdClass(); |
922 | 922 | |
923 | - if($date) |
|
923 | + if ($date) |
|
924 | 924 | { |
925 | 925 | $args->regDate = date('Ymd', strtotime($date)); |
926 | 926 | } |
927 | 927 | |
928 | 928 | $output = executeQuery('admin.getSiteCountByDate', $args); |
929 | - if(!$output->toBool()) |
|
929 | + if (!$output->toBool()) |
|
930 | 930 | { |
931 | 931 | return 0; |
932 | 932 | } |
@@ -948,21 +948,21 @@ discard block |
||
948 | 948 | { |
949 | 949 | $site_info = Context::get('site_module_info'); |
950 | 950 | $virtual_site = ''; |
951 | - if($site_info->site_srl) |
|
951 | + if ($site_info->site_srl) |
|
952 | 952 | { |
953 | - $virtual_site = $site_info->site_srl . '/'; |
|
953 | + $virtual_site = $site_info->site_srl.'/'; |
|
954 | 954 | } |
955 | 955 | |
956 | - $file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
957 | - if(!$file_exsit && $default === true) |
|
956 | + $file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
957 | + if (!$file_exsit && $default === true) |
|
958 | 958 | { |
959 | - $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
959 | + $icon_url = './modules/admin/tpl/img/'.$default_icon_name; |
|
960 | 960 | } |
961 | - elseif($file_exsit) |
|
961 | + elseif ($file_exsit) |
|
962 | 962 | { |
963 | 963 | $default_url = Context::GetUrl(); |
964 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
965 | - $icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname; |
|
964 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
965 | + $icon_url = $default_url.'/files/attach/xeicon/'.$virtual_site.$iconname; |
|
966 | 966 | } |
967 | 967 | return $icon_url; |
968 | 968 | } |
@@ -303,8 +303,7 @@ discard block |
||
303 | 303 | if(is_dir($curpwd . $file)) |
304 | 304 | { |
305 | 305 | $file .= "/"; |
306 | - } |
|
307 | - else |
|
306 | + } else |
|
308 | 307 | { |
309 | 308 | continue; |
310 | 309 | } |
@@ -359,8 +358,7 @@ discard block |
||
359 | 358 | { |
360 | 359 | $_list = $oFtp->ftp_rawlist($this->pwd); |
361 | 360 | $oFtp->ftp_quit(); |
362 | - } |
|
363 | - else |
|
361 | + } else |
|
364 | 362 | { |
365 | 363 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
366 | 364 | } |
@@ -380,8 +378,7 @@ discard block |
||
380 | 378 | $list[] = substr(strrchr($v, ' '), 1) . '/'; |
381 | 379 | } |
382 | 380 | } |
383 | - } |
|
384 | - else |
|
381 | + } else |
|
385 | 382 | { |
386 | 383 | return new BaseObject(-1, 'msg_ftp_no_directory'); |
387 | 384 | } |
@@ -434,11 +431,13 @@ discard block |
||
434 | 431 | $info['module'] = ''; |
435 | 432 | $oModuleModel = getModel('module'); |
436 | 433 | $module_list = $oModuleModel->getModuleList(); |
437 | - if($module_list) foreach($module_list as $module) |
|
434 | + if($module_list) { |
|
435 | + foreach($module_list as $module) |
|
438 | 436 | { |
439 | 437 | if(in_array($module->module, $skip['module'])) |
440 | 438 | { |
441 | 439 | continue; |
440 | + } |
|
442 | 441 | } |
443 | 442 | $info['module'] .= '|' . $module->module; |
444 | 443 | } |
@@ -447,11 +446,13 @@ discard block |
||
447 | 446 | $info['addon'] = ''; |
448 | 447 | $oAddonAdminModel = getAdminModel('addon'); |
449 | 448 | $addon_list = $oAddonAdminModel->getAddonList(); |
450 | - if($addon_list) foreach($addon_list as $addon) |
|
449 | + if($addon_list) { |
|
450 | + foreach($addon_list as $addon) |
|
451 | 451 | { |
452 | 452 | if(in_array($addon->addon, $skip['addon'])) |
453 | 453 | { |
454 | 454 | continue; |
455 | + } |
|
455 | 456 | } |
456 | 457 | $info['addon'] .= '|' . $addon->addon; |
457 | 458 | } |
@@ -460,11 +461,13 @@ discard block |
||
460 | 461 | $info['layout'] = ""; |
461 | 462 | $oLayoutModel = getModel('layout'); |
462 | 463 | $layout_list = $oLayoutModel->getDownloadedLayoutList(); |
463 | - if($layout_list) foreach($layout_list as $layout) |
|
464 | + if($layout_list) { |
|
465 | + foreach($layout_list as $layout) |
|
464 | 466 | { |
465 | 467 | if(in_array($layout->layout, $skip['layout'])) |
466 | 468 | { |
467 | 469 | continue; |
470 | + } |
|
468 | 471 | } |
469 | 472 | $info['layout'] .= '|' . $layout->layout; |
470 | 473 | } |
@@ -473,11 +476,13 @@ discard block |
||
473 | 476 | $info['widget'] = ""; |
474 | 477 | $oWidgetModel = getModel('widget'); |
475 | 478 | $widget_list = $oWidgetModel->getDownloadedWidgetList(); |
476 | - if($widget_list) foreach($widget_list as $widget) |
|
479 | + if($widget_list) { |
|
480 | + foreach($widget_list as $widget) |
|
477 | 481 | { |
478 | 482 | if(in_array($widget->widget, $skip['widget'])) |
479 | 483 | { |
480 | 484 | continue; |
485 | + } |
|
481 | 486 | } |
482 | 487 | $info['widget'] .= '|' . $widget->widget; |
483 | 488 | } |
@@ -486,11 +491,13 @@ discard block |
||
486 | 491 | $info['widgetstyle'] = ""; |
487 | 492 | $oWidgetModel = getModel('widget'); |
488 | 493 | $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); |
489 | - if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle) |
|
494 | + if($widgetstyle_list) { |
|
495 | + foreach($widgetstyle_list as $widgetstyle) |
|
490 | 496 | { |
491 | 497 | if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
492 | 498 | { |
493 | 499 | continue; |
500 | + } |
|
494 | 501 | } |
495 | 502 | $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; |
496 | 503 | } |
@@ -575,8 +582,7 @@ discard block |
||
575 | 582 | { |
576 | 583 | $publisher_list = array(); |
577 | 584 | $publisher_list[] = $xml_obj->publisher; |
578 | - } |
|
579 | - else |
|
585 | + } else |
|
580 | 586 | { |
581 | 587 | $publisher_list = $xml_obj->publisher; |
582 | 588 | } |
@@ -649,8 +655,7 @@ discard block |
||
649 | 655 | if(is_array($skin_infos->skininfo)) |
650 | 656 | { |
651 | 657 | $skin_list = $skin_infos->skininfo; |
652 | - } |
|
653 | - else |
|
658 | + } else |
|
654 | 659 | { |
655 | 660 | $skin_list = array($skin_infos->skininfo); |
656 | 661 | } |
@@ -839,8 +844,7 @@ discard block |
||
839 | 844 | { |
840 | 845 | $returnObject->add('result', TRUE); |
841 | 846 | $returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); |
842 | - } |
|
843 | - else |
|
847 | + } else |
|
844 | 848 | { |
845 | 849 | $returnObject->add('result', FALSE); |
846 | 850 | } |
@@ -957,11 +961,12 @@ discard block |
||
957 | 961 | if(!$file_exsit && $default === true) |
958 | 962 | { |
959 | 963 | $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
960 | - } |
|
961 | - elseif($file_exsit) |
|
964 | + } elseif($file_exsit) |
|
962 | 965 | { |
963 | 966 | $default_url = Context::GetUrl(); |
964 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
967 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
968 | + $default_url = substr($default_url, 0, -1); |
|
969 | + } |
|
965 | 970 | $icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname; |
966 | 971 | } |
967 | 972 | return $icon_url; |