@@ -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 */ |
@@ -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 | { |
@@ -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,14 +102,14 @@ 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 | 110 | register_shutdown_function(array($this, 'shutdownHandler')); |
| 111 | 111 | } |
| 112 | - else if(__DEBUG_PROTECT__ === 0) |
|
| 112 | + else if (__DEBUG_PROTECT__ === 0) |
|
| 113 | 113 | { |
| 114 | 114 | set_error_handler(array($this, 'xeErrorLog'), 3); |
| 115 | 115 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -120,42 +120,42 @@ discard block |
||
| 120 | 120 | $called_position = 'before_module_init'; |
| 121 | 121 | $oAddonController = getController('addon'); |
| 122 | 122 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 123 | - if(file_exists($addon_file)) include($addon_file); |
|
| 123 | + if (file_exists($addon_file)) include($addon_file); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
| 127 | 127 | { |
| 128 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 128 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 129 | 129 | { |
| 130 | 130 | return false; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 134 | 134 | |
| 135 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 135 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 136 | 136 | $debug_file_exist = file_exists($debug_file); |
| 137 | - if(!$debug_file_exist) |
|
| 137 | + if (!$debug_file_exist) |
|
| 138 | 138 | { |
| 139 | 139 | $print[] = '<?php exit() ?>'; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $errorname = self::getErrorType($errnumber); |
| 143 | 143 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 144 | - $print[] = $errorname . ' : ' . $errormassage; |
|
| 144 | + $print[] = $errorname.' : '.$errormassage; |
|
| 145 | 145 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 146 | 146 | $backtrace = debug_backtrace($backtrace_args); |
| 147 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 147 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 148 | 148 | { |
| 149 | 149 | array_shift($backtrace); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - foreach($backtrace as $key => $value) |
|
| 152 | + foreach ($backtrace as $key => $value) |
|
| 153 | 153 | { |
| 154 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 154 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 155 | 155 | $print[] = $message; |
| 156 | 156 | } |
| 157 | 157 | $print[] = PHP_EOL; |
| 158 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 158 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 159 | 159 | restore_error_handler(); |
| 160 | 160 | |
| 161 | 161 | return true; |
@@ -171,22 +171,22 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 173 | 173 | |
| 174 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 174 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 175 | 175 | $debug_file_exist = file_exists($debug_file); |
| 176 | - if(!$debug_file_exist) |
|
| 176 | + if (!$debug_file_exist) |
|
| 177 | 177 | { |
| 178 | 178 | $print[] = '<?php exit() ?>'; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $errorname = self::getErrorType($errinfo['type']); |
| 182 | 182 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 183 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 183 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 184 | 184 | |
| 185 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 185 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 186 | 186 | $print[] = $message; |
| 187 | 187 | |
| 188 | 188 | $print[] = PHP_EOL; |
| 189 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 189 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 190 | 190 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // if success_return_url and error_return_url is incorrect |
| 233 | 233 | $urls = array(Context::get('success_return_url'), Context::get('error_return_url')); |
| 234 | - foreach($urls as $url) |
|
| 234 | + foreach ($urls as $url) |
|
| 235 | 235 | { |
| 236 | - if(empty($url)) |
|
| 236 | + if (empty($url)) |
|
| 237 | 237 | { |
| 238 | 238 | continue; |
| 239 | 239 | } |
@@ -245,29 +245,29 @@ discard block |
||
| 245 | 245 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
| 246 | 246 | $defaultHost = $defaultUrlInfo['host']; |
| 247 | 247 | |
| 248 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 248 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 249 | 249 | { |
| 250 | 250 | throw new Exception('msg_default_url_is_null'); |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 254 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 255 | 255 | { |
| 256 | 256 | $oDocumentModel = getModel('document'); |
| 257 | 257 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 258 | - if($this->document_srl) |
|
| 258 | + if ($this->document_srl) |
|
| 259 | 259 | { |
| 260 | 260 | Context::set('document_srl', $this->document_srl); |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // Get module's information based on document_srl, if it's specified |
| 265 | - if($this->document_srl) |
|
| 265 | + if ($this->document_srl) |
|
| 266 | 266 | { |
| 267 | 267 | |
| 268 | 268 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 269 | 269 | // If the document does not exist, remove document_srl |
| 270 | - if(!$module_info) |
|
| 270 | + if (!$module_info) |
|
| 271 | 271 | { |
| 272 | 272 | unset($this->document_srl); |
| 273 | 273 | } |
@@ -275,13 +275,13 @@ discard block |
||
| 275 | 275 | { |
| 276 | 276 | // If it exists, compare mid based on the module information |
| 277 | 277 | // if mids are not matching, set it as the document's mid |
| 278 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 278 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 279 | 279 | { |
| 280 | 280 | |
| 281 | - if(Context::getRequestMethod() == 'GET') |
|
| 281 | + if (Context::getRequestMethod() == 'GET') |
|
| 282 | 282 | { |
| 283 | 283 | $this->mid = $module_info->mid; |
| 284 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 284 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 285 | 285 | return FALSE; |
| 286 | 286 | } |
| 287 | 287 | else |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | } |
| 294 | 294 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 295 | - if($this->module && $module_info->module != $this->module) |
|
| 295 | + if ($this->module && $module_info->module != $this->module) |
|
| 296 | 296 | { |
| 297 | 297 | unset($module_info); |
| 298 | 298 | } |
@@ -301,36 +301,36 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 304 | - if(!$module_info && $this->mid) |
|
| 304 | + if (!$module_info && $this->mid) |
|
| 305 | 305 | { |
| 306 | 306 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 307 | 307 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // redirect, if module_site_srl and site_srl are different |
| 311 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 311 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 312 | 312 | { |
| 313 | 313 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 314 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 314 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 315 | 315 | return FALSE; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // If module_info is not set still, and $module does not exist, find the default module |
| 319 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 319 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 320 | 320 | { |
| 321 | 321 | $module_info = $site_module_info; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 324 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 325 | 325 | { |
| 326 | 326 | $module_info = $site_module_info; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 330 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 330 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 331 | 331 | { |
| 332 | 332 | // If the module is of virtual site |
| 333 | - if($module_info->site_srl) |
|
| 333 | + if ($module_info->site_srl) |
|
| 334 | 334 | { |
| 335 | 335 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 336 | 336 | $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')); |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | else |
| 340 | 340 | { |
| 341 | 341 | $db_info = Context::getDBInfo(); |
| 342 | - if(!$db_info->default_url) |
|
| 342 | + if (!$db_info->default_url) |
|
| 343 | 343 | { |
| 344 | 344 | return Context::getLang('msg_default_url_is_not_defined'); |
| 345 | 345 | } |
@@ -348,12 +348,12 @@ discard block |
||
| 348 | 348 | $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')); |
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | - header("location:" . $redirect_url); |
|
| 351 | + header("location:".$redirect_url); |
|
| 352 | 352 | return FALSE; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // If module info was set, retrieve variables from the module information |
| 356 | - if($module_info) |
|
| 356 | + if ($module_info) |
|
| 357 | 357 | { |
| 358 | 358 | $this->module = $module_info->module; |
| 359 | 359 | $this->mid = $module_info->mid; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 365 | 365 | |
| 366 | 366 | // use the site default layout. |
| 367 | - if($module_info->{$targetSrl} == -1) |
|
| 367 | + if ($module_info->{$targetSrl} == -1) |
|
| 368 | 368 | { |
| 369 | 369 | $oLayoutAdminModel = getAdminModel('layout'); |
| 370 | 370 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | // Set module and mid into module_info |
| 385 | - if(!isset($this->module_info)) |
|
| 385 | + if (!isset($this->module_info)) |
|
| 386 | 386 | { |
| 387 | 387 | $this->module_info = new stdClass(); |
| 388 | 388 | } |
@@ -393,21 +393,21 @@ discard block |
||
| 393 | 393 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 394 | 394 | |
| 395 | 395 | // Still no module? it's an error |
| 396 | - if(!$this->module) |
|
| 396 | + if (!$this->module) |
|
| 397 | 397 | { |
| 398 | 398 | $this->error = 'msg_module_is_not_exists'; |
| 399 | 399 | $this->httpStatusCode = '404'; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // If mid exists, set mid into context |
| 403 | - if($this->mid) |
|
| 403 | + if ($this->mid) |
|
| 404 | 404 | { |
| 405 | 405 | Context::set('mid', $this->mid, TRUE); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // Call a trigger after moduleHandler init |
| 409 | 409 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 410 | - if(!$output->toBool()) |
|
| 410 | + if (!$output->toBool()) |
|
| 411 | 411 | { |
| 412 | 412 | $this->error = $output->getMessage(); |
| 413 | 413 | return TRUE; |
@@ -429,14 +429,14 @@ discard block |
||
| 429 | 429 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 430 | 430 | |
| 431 | 431 | // If error occurred while preparation, return a message instance |
| 432 | - if($this->error) |
|
| 432 | + if ($this->error) |
|
| 433 | 433 | { |
| 434 | 434 | $this->_setInputErrorToContext(); |
| 435 | 435 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 436 | 436 | $oMessageObject->setError(-1); |
| 437 | 437 | $oMessageObject->setMessage($this->error); |
| 438 | 438 | $oMessageObject->dispMessage(); |
| 439 | - if($this->httpStatusCode) |
|
| 439 | + if ($this->httpStatusCode) |
|
| 440 | 440 | { |
| 441 | 441 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 442 | 442 | } |
@@ -447,22 +447,22 @@ discard block |
||
| 447 | 447 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 448 | 448 | |
| 449 | 449 | // If not installed yet, modify act |
| 450 | - if($this->module == "install") |
|
| 450 | + if ($this->module == "install") |
|
| 451 | 451 | { |
| 452 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 452 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 453 | 453 | { |
| 454 | 454 | $this->act = $xml_info->default_index_act; |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | // if act exists, find type of the action, if not use default index act |
| 459 | - if(!$this->act) |
|
| 459 | + if (!$this->act) |
|
| 460 | 460 | { |
| 461 | 461 | $this->act = $xml_info->default_index_act; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | // still no act means error |
| 465 | - if(!$this->act) |
|
| 465 | + if (!$this->act) |
|
| 466 | 466 | { |
| 467 | 467 | $this->error = 'msg_module_is_not_exists'; |
| 468 | 468 | $this->httpStatusCode = '404'; |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $oMessageObject->setError(-1); |
| 473 | 473 | $oMessageObject->setMessage($this->error); |
| 474 | 474 | $oMessageObject->dispMessage(); |
| 475 | - if($this->httpStatusCode) |
|
| 475 | + if ($this->httpStatusCode) |
|
| 476 | 476 | { |
| 477 | 477 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 478 | 478 | } |
@@ -483,17 +483,17 @@ discard block |
||
| 483 | 483 | $type = $xml_info->action->{$this->act}->type; |
| 484 | 484 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
| 485 | 485 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 486 | - if(!$kind && $this->module == 'admin') |
|
| 486 | + if (!$kind && $this->module == 'admin') |
|
| 487 | 487 | { |
| 488 | 488 | $kind = 'admin'; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // check REQUEST_METHOD in controller |
| 492 | - if($type == 'controller') |
|
| 492 | + if ($type == 'controller') |
|
| 493 | 493 | { |
| 494 | 494 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 495 | 495 | |
| 496 | - if(!$allowedMethod) |
|
| 496 | + if (!$allowedMethod) |
|
| 497 | 497 | { |
| 498 | 498 | $allowedMethodList[0] = 'POST'; |
| 499 | 499 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 505 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 506 | 506 | { |
| 507 | 507 | $this->error = "msg_invalid_request"; |
| 508 | 508 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if($this->module_info->use_mobile != "Y") |
|
| 516 | + if ($this->module_info->use_mobile != "Y") |
|
| 517 | 517 | { |
| 518 | 518 | Mobile::setMobile(FALSE); |
| 519 | 519 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | $logged_info = Context::get('logged_info'); |
| 522 | 522 | |
| 523 | 523 | // check CSRF for POST actions |
| 524 | - if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
| 524 | + if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
| 525 | 525 | $this->error = 'msg_invalid_request'; |
| 526 | 526 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 527 | 527 | $oMessageObject->setError(-1); |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | // Admin ip |
| 534 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 534 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 535 | 535 | { |
| 536 | 536 | $this->_setInputErrorToContext(); |
| 537 | 537 | $this->error = "msg_not_permitted_act"; |
@@ -543,13 +543,13 @@ discard block |
||
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | // if(type == view, and case for using mobilephone) |
| 546 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 546 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 547 | 547 | { |
| 548 | 548 | $orig_type = "view"; |
| 549 | 549 | $type = "mobile"; |
| 550 | 550 | // create a module instance |
| 551 | 551 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 552 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 552 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 553 | 553 | { |
| 554 | 554 | $type = $orig_type; |
| 555 | 555 | Mobile::setMobile(FALSE); |
@@ -562,14 +562,14 @@ discard block |
||
| 562 | 562 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - if(!is_object($oModule)) |
|
| 565 | + if (!is_object($oModule)) |
|
| 566 | 566 | { |
| 567 | 567 | $this->_setInputErrorToContext(); |
| 568 | 568 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 569 | 569 | $oMessageObject->setError(-1); |
| 570 | 570 | $oMessageObject->setMessage($this->error); |
| 571 | 571 | $oMessageObject->dispMessage(); |
| 572 | - if($this->httpStatusCode) |
|
| 572 | + if ($this->httpStatusCode) |
|
| 573 | 573 | { |
| 574 | 574 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 575 | 575 | } |
@@ -577,10 +577,10 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | // If there is no such action in the module object |
| 580 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 580 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 581 | 581 | { |
| 582 | 582 | |
| 583 | - if(!Context::isInstalled()) |
|
| 583 | + if (!Context::isInstalled()) |
|
| 584 | 584 | { |
| 585 | 585 | $this->_setInputErrorToContext(); |
| 586 | 586 | $this->error = 'msg_invalid_request'; |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | $oMessageObject->setError(-1); |
| 589 | 589 | $oMessageObject->setMessage($this->error); |
| 590 | 590 | $oMessageObject->dispMessage(); |
| 591 | - if($this->httpStatusCode) |
|
| 591 | + if ($this->httpStatusCode) |
|
| 592 | 592 | { |
| 593 | 593 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 594 | 594 | } |
@@ -597,12 +597,12 @@ discard block |
||
| 597 | 597 | |
| 598 | 598 | $forward = NULL; |
| 599 | 599 | // 1. Look for the module with action name |
| 600 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 600 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 601 | 601 | { |
| 602 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 602 | + $module = strtolower($matches[2].$matches[3]); |
|
| 603 | 603 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 604 | 604 | |
| 605 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 605 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 606 | 606 | { |
| 607 | 607 | $forward = new stdClass(); |
| 608 | 608 | $forward->module = $module; |
@@ -622,12 +622,12 @@ discard block |
||
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | - if(!$forward) |
|
| 625 | + if (!$forward) |
|
| 626 | 626 | { |
| 627 | 627 | $forward = $oModuleModel->getActionForward($this->act); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 630 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 631 | 631 | { |
| 632 | 632 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 633 | 633 | $type = $forward->type; |
@@ -639,11 +639,11 @@ discard block |
||
| 639 | 639 | |
| 640 | 640 | // SECISSUE also check foward act method |
| 641 | 641 | // check REQUEST_METHOD in controller |
| 642 | - if($type == 'controller') |
|
| 642 | + if ($type == 'controller') |
|
| 643 | 643 | { |
| 644 | 644 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 645 | 645 | |
| 646 | - if(!$allowedMethod) |
|
| 646 | + if (!$allowedMethod) |
|
| 647 | 647 | { |
| 648 | 648 | $allowedMethodList[0] = 'POST'; |
| 649 | 649 | } |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 655 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 656 | 656 | { |
| 657 | 657 | $this->error = "msg_invalid_request"; |
| 658 | 658 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -663,13 +663,13 @@ discard block |
||
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 666 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 667 | 667 | { |
| 668 | 668 | $orig_type = "view"; |
| 669 | 669 | $type = "mobile"; |
| 670 | 670 | // create a module instance |
| 671 | 671 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 672 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 672 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 673 | 673 | { |
| 674 | 674 | $type = $orig_type; |
| 675 | 675 | Mobile::setMobile(FALSE); |
@@ -681,25 +681,25 @@ discard block |
||
| 681 | 681 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | - if(!is_object($oModule)) |
|
| 684 | + if (!is_object($oModule)) |
|
| 685 | 685 | { |
| 686 | 686 | $this->_setInputErrorToContext(); |
| 687 | 687 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 688 | 688 | $oMessageObject->setError(-1); |
| 689 | 689 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 690 | 690 | $oMessageObject->dispMessage(); |
| 691 | - if($this->httpStatusCode) |
|
| 691 | + if ($this->httpStatusCode) |
|
| 692 | 692 | { |
| 693 | 693 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 694 | 694 | } |
| 695 | 695 | return $oMessageObject; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - if($this->module == "admin" && $type == "view") |
|
| 698 | + if ($this->module == "admin" && $type == "view") |
|
| 699 | 699 | { |
| 700 | - if($logged_info->is_admin == 'Y') |
|
| 700 | + if ($logged_info->is_admin == 'Y') |
|
| 701 | 701 | { |
| 702 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 702 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 703 | 703 | { |
| 704 | 704 | $oAdminView = getAdminView('admin'); |
| 705 | 705 | $oAdminView->makeGnbUrl($forward->module); |
@@ -719,10 +719,10 @@ discard block |
||
| 719 | 719 | return $oMessageObject; |
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | - if($kind == 'admin') |
|
| 722 | + if ($kind == 'admin') |
|
| 723 | 723 | { |
| 724 | 724 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 725 | - if(!$grant->manager) |
|
| 725 | + if (!$grant->manager) |
|
| 726 | 726 | { |
| 727 | 727 | $this->_setInputErrorToContext(); |
| 728 | 728 | $this->error = 'msg_is_not_manager'; |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | } |
| 735 | 735 | else |
| 736 | 736 | { |
| 737 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 737 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 738 | 738 | { |
| 739 | 739 | $this->_setInputErrorToContext(); |
| 740 | 740 | $this->error = 'msg_is_not_administrator'; |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 750 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 751 | 751 | { |
| 752 | 752 | $this->act = $xml_info->default_index_act; |
| 753 | 753 | } |
@@ -761,16 +761,16 @@ discard block |
||
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // ruleset check... |
| 764 | - if(!empty($ruleset)) |
|
| 764 | + if (!empty($ruleset)) |
|
| 765 | 765 | { |
| 766 | 766 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 767 | 767 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 768 | - if(!empty($rulesetFile)) |
|
| 768 | + if (!empty($rulesetFile)) |
|
| 769 | 769 | { |
| 770 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 770 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 771 | 771 | { |
| 772 | 772 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 773 | - foreach($errorLang as $key => $val) |
|
| 773 | + foreach ($errorLang as $key => $val) |
|
| 774 | 774 | { |
| 775 | 775 | Context::setLang($key, $val); |
| 776 | 776 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | $Validator = new Validator($rulesetFile); |
| 781 | 781 | $result = $Validator->validate(); |
| 782 | - if(!$result) |
|
| 782 | + if (!$result) |
|
| 783 | 783 | { |
| 784 | 784 | $lastError = $Validator->getLastError(); |
| 785 | 785 | $returnUrl = Context::get('error_return_url'); |
@@ -811,26 +811,26 @@ discard block |
||
| 811 | 811 | 'dispLayoutPreviewWithModule' => 1 |
| 812 | 812 | ); |
| 813 | 813 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 814 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 814 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 815 | 815 | { |
| 816 | 816 | global $lang; |
| 817 | 817 | $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>'; |
| 818 | - $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>'; |
|
| 818 | + $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 | 819 | Context::addHtmlHeader($header); |
| 820 | 820 | Context::addHtmlFooter($footer); |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | - if($type == "view" && $kind != 'admin') |
|
| 823 | + if ($type == "view" && $kind != 'admin') |
|
| 824 | 824 | { |
| 825 | 825 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 826 | - if($module_config->htmlFooter) |
|
| 826 | + if ($module_config->htmlFooter) |
|
| 827 | 827 | { |
| 828 | 828 | Context::addHtmlFooter($module_config->htmlFooter); |
| 829 | 829 | } |
| 830 | - if($module_config->siteTitle) |
|
| 830 | + if ($module_config->siteTitle) |
|
| 831 | 831 | { |
| 832 | 832 | $siteTitle = Context::getBrowserTitle(); |
| 833 | - if(!$siteTitle) |
|
| 833 | + if (!$siteTitle) |
|
| 834 | 834 | { |
| 835 | 835 | Context::setBrowserTitle($module_config->siteTitle); |
| 836 | 836 | } |
@@ -843,18 +843,18 @@ discard block |
||
| 843 | 843 | $procResult = $oModule->proc(); |
| 844 | 844 | |
| 845 | 845 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 846 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 846 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 847 | 847 | { |
| 848 | 848 | $error = $oModule->getError(); |
| 849 | 849 | $message = $oModule->getMessage(); |
| 850 | 850 | $messageType = $oModule->getMessageType(); |
| 851 | 851 | $redirectUrl = $oModule->getRedirectUrl(); |
| 852 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 852 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 853 | 853 | |
| 854 | - if(!$procResult) |
|
| 854 | + if (!$procResult) |
|
| 855 | 855 | { |
| 856 | 856 | $this->error = $message; |
| 857 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 857 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 858 | 858 | { |
| 859 | 859 | $redirectUrl = Context::get('error_return_url'); |
| 860 | 860 | } |
@@ -867,13 +867,13 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 869 | 869 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 870 | - if($message != 'success') |
|
| 870 | + if ($message != 'success') |
|
| 871 | 871 | { |
| 872 | 872 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 873 | 873 | } |
| 874 | 874 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 875 | 875 | |
| 876 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 876 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 877 | 877 | { |
| 878 | 878 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 879 | 879 | } |
@@ -889,27 +889,27 @@ discard block |
||
| 889 | 889 | * */ |
| 890 | 890 | function _setInputErrorToContext() |
| 891 | 891 | { |
| 892 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 892 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 893 | 893 | { |
| 894 | 894 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 895 | 895 | } |
| 896 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 896 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 897 | 897 | { |
| 898 | 898 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 899 | 899 | } |
| 900 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 900 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 901 | 901 | { |
| 902 | 902 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 903 | 903 | } |
| 904 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 904 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 905 | 905 | { |
| 906 | 906 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 907 | 907 | } |
| 908 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 908 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 909 | 909 | { |
| 910 | 910 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 911 | 911 | } |
| 912 | - if(count($_SESSION['INPUT_ERROR'])) |
|
| 912 | + if (count($_SESSION['INPUT_ERROR'])) |
|
| 913 | 913 | { |
| 914 | 914 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 915 | 915 | } |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | { |
| 940 | 940 | $requestVars = Context::getRequestVars(); |
| 941 | 941 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 942 | - foreach($requestVars AS $key => $value) |
|
| 942 | + foreach ($requestVars AS $key => $value) |
|
| 943 | 943 | { |
| 944 | 944 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 945 | 945 | } |
@@ -953,41 +953,41 @@ discard block |
||
| 953 | 953 | function displayContent($oModule = NULL) |
| 954 | 954 | { |
| 955 | 955 | // If the module is not set or not an object, set error |
| 956 | - if(!$oModule || !is_object($oModule)) |
|
| 956 | + if (!$oModule || !is_object($oModule)) |
|
| 957 | 957 | { |
| 958 | 958 | $this->error = 'msg_module_is_not_exists'; |
| 959 | 959 | $this->httpStatusCode = '404'; |
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | // If connection to DB has a problem even though it's not install module, set error |
| 963 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 963 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 964 | 964 | { |
| 965 | 965 | $this->error = 'msg_dbconnect_failed'; |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | // Call trigger after moduleHandler proc |
| 969 | 969 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 970 | - if(!$output->toBool()) |
|
| 970 | + if (!$output->toBool()) |
|
| 971 | 971 | { |
| 972 | 972 | $this->error = $output->getMessage(); |
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | // Use message view object, if HTML call |
| 976 | 976 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 977 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 977 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 978 | 978 | { |
| 979 | 979 | |
| 980 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 980 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 981 | 981 | { |
| 982 | 982 | $display_handler = new DisplayHandler(); |
| 983 | 983 | $display_handler->_debugOutput(); |
| 984 | 984 | |
| 985 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 985 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 986 | 986 | return; |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | // If error occurred, handle it |
| 990 | - if($this->error) |
|
| 990 | + if ($this->error) |
|
| 991 | 991 | { |
| 992 | 992 | // display content with message module instance |
| 993 | 993 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -996,14 +996,14 @@ discard block |
||
| 996 | 996 | $oMessageObject->setMessage($this->error); |
| 997 | 997 | $oMessageObject->dispMessage(); |
| 998 | 998 | |
| 999 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 999 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1000 | 1000 | { |
| 1001 | 1001 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 1002 | 1002 | $oMessageObject->setTemplateFile('http_status_code'); |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | // If module was called normally, change the templates of the module into ones of the message view module |
| 1006 | - if($oModule) |
|
| 1006 | + if ($oModule) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1009 | 1009 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | // Check if layout_srl exists for the module |
| 1021 | - if(Mobile::isFromMobilePhone()) |
|
| 1021 | + if (Mobile::isFromMobilePhone()) |
|
| 1022 | 1022 | { |
| 1023 | 1023 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1024 | 1024 | } |
@@ -1028,58 +1028,58 @@ discard block |
||
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | // if layout_srl is rollback by module, set default layout |
| 1031 | - if($layout_srl == -1) |
|
| 1031 | + if ($layout_srl == -1) |
|
| 1032 | 1032 | { |
| 1033 | 1033 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1034 | 1034 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1035 | 1035 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1038 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1039 | 1039 | { |
| 1040 | 1040 | |
| 1041 | 1041 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1042 | 1042 | $oLayoutModel = getModel('layout'); |
| 1043 | 1043 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1044 | - if($layout_info) |
|
| 1044 | + if ($layout_info) |
|
| 1045 | 1045 | { |
| 1046 | 1046 | |
| 1047 | 1047 | // Input extra_vars into $layout_info |
| 1048 | - if($layout_info->extra_var_count) |
|
| 1048 | + if ($layout_info->extra_var_count) |
|
| 1049 | 1049 | { |
| 1050 | 1050 | |
| 1051 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1051 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1052 | 1052 | { |
| 1053 | - if($val->type == 'image') |
|
| 1053 | + if ($val->type == 'image') |
|
| 1054 | 1054 | { |
| 1055 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1055 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1056 | 1056 | { |
| 1057 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1057 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1058 | 1058 | } |
| 1059 | 1059 | } |
| 1060 | 1060 | $layout_info->{$var_id} = $val->value; |
| 1061 | 1061 | } |
| 1062 | 1062 | } |
| 1063 | 1063 | // Set menus into context |
| 1064 | - if($layout_info->menu_count) |
|
| 1064 | + if ($layout_info->menu_count) |
|
| 1065 | 1065 | { |
| 1066 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1066 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1067 | 1067 | { |
| 1068 | 1068 | // set default menu set(included home menu) |
| 1069 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1069 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1070 | 1070 | { |
| 1071 | 1071 | $oMenuAdminController = getAdminController('menu'); |
| 1072 | 1072 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1073 | 1073 | |
| 1074 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1074 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1075 | 1075 | { |
| 1076 | 1076 | include($homeMenuCacheFile); |
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | - if(!$menu->menu_srl) |
|
| 1079 | + if (!$menu->menu_srl) |
|
| 1080 | 1080 | { |
| 1081 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1082 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1081 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1082 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1083 | 1083 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1084 | 1084 | } |
| 1085 | 1085 | else |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | $php_file = FileHandler::exists($menu->php_file); |
| 1093 | - if($php_file) |
|
| 1093 | + if ($php_file) |
|
| 1094 | 1094 | { |
| 1095 | 1095 | include($php_file); |
| 1096 | 1096 | } |
@@ -1106,17 +1106,17 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | // If layout was modified, use the modified version |
| 1108 | 1108 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1109 | - if(file_exists($edited_layout)) |
|
| 1109 | + if (file_exists($edited_layout)) |
|
| 1110 | 1110 | { |
| 1111 | 1111 | $oModule->setEditedLayoutFile($edited_layout); |
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1116 | - if($isLayoutDrop) |
|
| 1116 | + if ($isLayoutDrop) |
|
| 1117 | 1117 | { |
| 1118 | 1118 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1119 | - if($kind == 'admin') |
|
| 1119 | + if ($kind == 'admin') |
|
| 1120 | 1120 | { |
| 1121 | 1121 | $oModule->setLayoutFile('popup_layout'); |
| 1122 | 1122 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1155 | 1155 | { |
| 1156 | 1156 | |
| 1157 | - if(__DEBUG__ == 3) |
|
| 1157 | + if (__DEBUG__ == 3) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | $start_time = getMicroTime(); |
| 1160 | 1160 | } |
@@ -1164,51 +1164,51 @@ discard block |
||
| 1164 | 1164 | $type = strtolower($type); |
| 1165 | 1165 | |
| 1166 | 1166 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1167 | - if(!isset($kinds[$kind])) |
|
| 1167 | + if (!isset($kinds[$kind])) |
|
| 1168 | 1168 | { |
| 1169 | 1169 | $kind = 'svc'; |
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1172 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1173 | 1173 | |
| 1174 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1174 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1175 | 1175 | { |
| 1176 | 1176 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | // if there is no instance of the module in global variable, create a new one |
| 1180 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1180 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1181 | 1181 | { |
| 1182 | 1182 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1183 | 1183 | |
| 1184 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1184 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | $module = $parent_module; |
| 1187 | 1187 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | // Check if the base class and instance class exist |
| 1191 | - if(!class_exists($module, true)) |
|
| 1191 | + if (!class_exists($module, true)) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | return NULL; |
| 1194 | 1194 | } |
| 1195 | - if(!class_exists($instance_name, true)) |
|
| 1195 | + if (!class_exists($instance_name, true)) |
|
| 1196 | 1196 | { |
| 1197 | 1197 | return NULL; |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | // Create an instance |
| 1201 | 1201 | $oModule = new $instance_name(); |
| 1202 | - if(!is_object($oModule)) |
|
| 1202 | + if (!is_object($oModule)) |
|
| 1203 | 1203 | { |
| 1204 | 1204 | return NULL; |
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | 1207 | // Load language files for the class |
| 1208 | - Context::loadLang($class_path . 'lang'); |
|
| 1209 | - if($extend_module) |
|
| 1208 | + Context::loadLang($class_path.'lang'); |
|
| 1209 | + if ($extend_module) |
|
| 1210 | 1210 | { |
| 1211 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1211 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | // Set variables to the instance |
@@ -1216,10 +1216,10 @@ discard block |
||
| 1216 | 1216 | $oModule->setModulePath($class_path); |
| 1217 | 1217 | |
| 1218 | 1218 | // If the module has a constructor, run it. |
| 1219 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1219 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1220 | 1220 | { |
| 1221 | 1221 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1222 | - if(@method_exists($oModule, $instance_name)) |
|
| 1222 | + if (@method_exists($oModule, $instance_name)) |
|
| 1223 | 1223 | { |
| 1224 | 1224 | $oModule->{$instance_name}(); |
| 1225 | 1225 | } |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | - if(__DEBUG__ == 3) |
|
| 1232 | + if (__DEBUG__ == 3) |
|
| 1233 | 1233 | { |
| 1234 | 1234 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1235 | 1235 | } |
@@ -1245,17 +1245,17 @@ discard block |
||
| 1245 | 1245 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1246 | 1246 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1247 | 1247 | |
| 1248 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1249 | - if(!in_array($type, $types)) |
|
| 1248 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1249 | + if (!in_array($type, $types)) |
|
| 1250 | 1250 | { |
| 1251 | 1251 | $type = $types[0]; |
| 1252 | 1252 | } |
| 1253 | - if($type == 'class') |
|
| 1253 | + if ($type == 'class') |
|
| 1254 | 1254 | { |
| 1255 | 1255 | $instanceName = '%s'; |
| 1256 | 1256 | $classFile = '%s%s.%s.php'; |
| 1257 | 1257 | } |
| 1258 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1258 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1259 | 1259 | { |
| 1260 | 1260 | $instanceName = '%sAdmin%s'; |
| 1261 | 1261 | $classFile = '%s%s.admin.%s.php'; |
@@ -1280,26 +1280,26 @@ discard block |
||
| 1280 | 1280 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1281 | 1281 | { |
| 1282 | 1282 | // skip if not installed |
| 1283 | - if(!Context::isInstalled()) |
|
| 1283 | + if (!Context::isInstalled()) |
|
| 1284 | 1284 | { |
| 1285 | 1285 | return new Object(); |
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | $oModuleModel = getModel('module'); |
| 1289 | 1289 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1290 | - if(!$triggers || count($triggers) < 1) |
|
| 1290 | + if (!$triggers || count($triggers) < 1) |
|
| 1291 | 1291 | { |
| 1292 | 1292 | return new Object(); |
| 1293 | 1293 | } |
| 1294 | 1294 | |
| 1295 | 1295 | //store before trigger call time |
| 1296 | 1296 | $before_trigger_time = NULL; |
| 1297 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1297 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1298 | 1298 | { |
| 1299 | 1299 | $before_trigger_time = microtime(true); |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | - foreach($triggers as $item) |
|
| 1302 | + foreach ($triggers as $item) |
|
| 1303 | 1303 | { |
| 1304 | 1304 | $module = $item->module; |
| 1305 | 1305 | $type = $item->type; |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | // todo why don't we call a normal class object ? |
| 1309 | 1309 | $oModule = getModule($module, $type); |
| 1310 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1310 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1311 | 1311 | { |
| 1312 | 1312 | continue; |
| 1313 | 1313 | } |
@@ -1320,12 +1320,12 @@ discard block |
||
| 1320 | 1320 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1321 | 1321 | |
| 1322 | 1322 | $slowlog = new stdClass; |
| 1323 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1324 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1323 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1324 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1325 | 1325 | $slowlog->called_extension = $module; |
| 1326 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1326 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1327 | 1327 | |
| 1328 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1328 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1329 | 1329 | { |
| 1330 | 1330 | return $output; |
| 1331 | 1331 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | '505' => 'HTTP Version Not Supported', |
| 1386 | 1386 | ); |
| 1387 | 1387 | $statusMessage = $statusMessageList[$code]; |
| 1388 | - if(!$statusMessage) |
|
| 1388 | + if (!$statusMessage) |
|
| 1389 | 1389 | { |
| 1390 | 1390 | $statusMessage = 'OK'; |
| 1391 | 1391 | } |