@@ -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'), E_WARNING); |
| 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'), E_WARNING); |
| 115 | 115 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -120,41 +120,41 @@ 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 | public static 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(function() { }, ~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 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
| 143 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
| 144 | 144 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 145 | 145 | $backtrace = debug_backtrace($backtrace_args); |
| 146 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 146 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 147 | 147 | { |
| 148 | 148 | array_shift($backtrace); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - foreach($backtrace as $key => $value) |
|
| 151 | + foreach ($backtrace as $key => $value) |
|
| 152 | 152 | { |
| 153 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 153 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 154 | 154 | $print[] = $message; |
| 155 | 155 | } |
| 156 | 156 | $print[] = PHP_EOL; |
| 157 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 157 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 158 | 158 | restore_error_handler(); |
| 159 | 159 | |
| 160 | 160 | return true; |
@@ -170,22 +170,22 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | set_error_handler(function() { }, ~0); |
| 172 | 172 | |
| 173 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 173 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 174 | 174 | $debug_file_exist = file_exists($debug_file); |
| 175 | - if(!$debug_file_exist) |
|
| 175 | + if (!$debug_file_exist) |
|
| 176 | 176 | { |
| 177 | 177 | $print[] = '<?php exit() ?>'; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $errorname = self::getErrorType($errinfo['type']); |
| 181 | 181 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 182 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 182 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 183 | 183 | |
| 184 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 184 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 185 | 185 | $print[] = $message; |
| 186 | 186 | |
| 187 | 187 | $print[] = PHP_EOL; |
| 188 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 188 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 189 | 189 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | // if success_return_url and error_return_url is incorrect |
| 225 | 225 | $urls = array(Context::get('success_return_url'), Context::get('error_return_url')); |
| 226 | - foreach($urls as $url) |
|
| 226 | + foreach ($urls as $url) |
|
| 227 | 227 | { |
| 228 | - if(empty($url)) |
|
| 228 | + if (empty($url)) |
|
| 229 | 229 | { |
| 230 | 230 | continue; |
| 231 | 231 | } |
@@ -237,29 +237,29 @@ discard block |
||
| 237 | 237 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
| 238 | 238 | $defaultHost = $defaultUrlInfo['host']; |
| 239 | 239 | |
| 240 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 240 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 241 | 241 | { |
| 242 | 242 | throw new Exception('msg_default_url_is_null'); |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 246 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 247 | 247 | { |
| 248 | 248 | $oDocumentModel = getModel('document'); |
| 249 | 249 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 250 | - if($this->document_srl) |
|
| 250 | + if ($this->document_srl) |
|
| 251 | 251 | { |
| 252 | 252 | Context::set('document_srl', $this->document_srl); |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Get module's information based on document_srl, if it's specified |
| 257 | - if($this->document_srl) |
|
| 257 | + if ($this->document_srl) |
|
| 258 | 258 | { |
| 259 | 259 | |
| 260 | 260 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 261 | 261 | // If the document does not exist, remove document_srl |
| 262 | - if(!$module_info) |
|
| 262 | + if (!$module_info) |
|
| 263 | 263 | { |
| 264 | 264 | unset($this->document_srl); |
| 265 | 265 | } |
@@ -267,13 +267,13 @@ discard block |
||
| 267 | 267 | { |
| 268 | 268 | // If it exists, compare mid based on the module information |
| 269 | 269 | // if mids are not matching, set it as the document's mid |
| 270 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 270 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 271 | 271 | { |
| 272 | 272 | |
| 273 | - if(Context::getRequestMethod() == 'GET') |
|
| 273 | + if (Context::getRequestMethod() == 'GET') |
|
| 274 | 274 | { |
| 275 | 275 | $this->mid = $module_info->mid; |
| 276 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 276 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 277 | 277 | return FALSE; |
| 278 | 278 | } |
| 279 | 279 | else |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | } |
| 286 | 286 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 287 | - if($this->module && $module_info->module != $this->module) |
|
| 287 | + if ($this->module && $module_info->module != $this->module) |
|
| 288 | 288 | { |
| 289 | 289 | unset($module_info); |
| 290 | 290 | } |
@@ -293,36 +293,36 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 296 | - if(!$module_info && $this->mid) |
|
| 296 | + if (!$module_info && $this->mid) |
|
| 297 | 297 | { |
| 298 | 298 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 299 | 299 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // redirect, if module_site_srl and site_srl are different |
| 303 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 303 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 304 | 304 | { |
| 305 | 305 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 306 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 306 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 307 | 307 | return FALSE; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // If module_info is not set still, and $module does not exist, find the default module |
| 311 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 311 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 312 | 312 | { |
| 313 | 313 | $module_info = $site_module_info; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 316 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 317 | 317 | { |
| 318 | 318 | $module_info = $site_module_info; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 322 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 322 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 323 | 323 | { |
| 324 | 324 | // If the module is of virtual site |
| 325 | - if($module_info->site_srl) |
|
| 325 | + if ($module_info->site_srl) |
|
| 326 | 326 | { |
| 327 | 327 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 328 | 328 | $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')); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | else |
| 332 | 332 | { |
| 333 | 333 | $db_info = Context::getDBInfo(); |
| 334 | - if(!$db_info->default_url) |
|
| 334 | + if (!$db_info->default_url) |
|
| 335 | 335 | { |
| 336 | 336 | return Context::getLang('msg_default_url_is_not_defined'); |
| 337 | 337 | } |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | $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')); |
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | - header("location:" . $redirect_url); |
|
| 343 | + header("location:".$redirect_url); |
|
| 344 | 344 | return FALSE; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // If module info was set, retrieve variables from the module information |
| 348 | - if($module_info) |
|
| 348 | + if ($module_info) |
|
| 349 | 349 | { |
| 350 | 350 | $this->module = $module_info->module; |
| 351 | 351 | $this->mid = $module_info->mid; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 357 | 357 | |
| 358 | 358 | // use the site default layout. |
| 359 | - if($module_info->{$targetSrl} == -1) |
|
| 359 | + if ($module_info->{$targetSrl} == -1) |
|
| 360 | 360 | { |
| 361 | 361 | $oLayoutAdminModel = getAdminModel('layout'); |
| 362 | 362 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | // Set module and mid into module_info |
| 377 | - if(!isset($this->module_info)) |
|
| 377 | + if (!isset($this->module_info)) |
|
| 378 | 378 | { |
| 379 | 379 | $this->module_info = new stdClass(); |
| 380 | 380 | } |
@@ -385,21 +385,21 @@ discard block |
||
| 385 | 385 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 386 | 386 | |
| 387 | 387 | // Still no module? it's an error |
| 388 | - if(!$this->module) |
|
| 388 | + if (!$this->module) |
|
| 389 | 389 | { |
| 390 | 390 | $this->error = 'msg_module_is_not_exists'; |
| 391 | 391 | $this->httpStatusCode = '404'; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | // If mid exists, set mid into context |
| 395 | - if($this->mid) |
|
| 395 | + if ($this->mid) |
|
| 396 | 396 | { |
| 397 | 397 | Context::set('mid', $this->mid, TRUE); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // Call a trigger after moduleHandler init |
| 401 | 401 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 402 | - if(!$output->toBool()) |
|
| 402 | + if (!$output->toBool()) |
|
| 403 | 403 | { |
| 404 | 404 | $this->error = $output->getMessage(); |
| 405 | 405 | return TRUE; |
@@ -421,14 +421,14 @@ discard block |
||
| 421 | 421 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 422 | 422 | |
| 423 | 423 | // If error occurred while preparation, return a message instance |
| 424 | - if($this->error) |
|
| 424 | + if ($this->error) |
|
| 425 | 425 | { |
| 426 | 426 | $this->_setInputErrorToContext(); |
| 427 | 427 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 428 | 428 | $oMessageObject->setError(-1); |
| 429 | 429 | $oMessageObject->setMessage($this->error); |
| 430 | 430 | $oMessageObject->dispMessage(); |
| 431 | - if($this->httpStatusCode) |
|
| 431 | + if ($this->httpStatusCode) |
|
| 432 | 432 | { |
| 433 | 433 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 434 | 434 | } |
@@ -439,22 +439,22 @@ discard block |
||
| 439 | 439 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 440 | 440 | |
| 441 | 441 | // If not installed yet, modify act |
| 442 | - if($this->module == "install") |
|
| 442 | + if ($this->module == "install") |
|
| 443 | 443 | { |
| 444 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 444 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 445 | 445 | { |
| 446 | 446 | $this->act = $xml_info->default_index_act; |
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | // if act exists, find type of the action, if not use default index act |
| 451 | - if(!$this->act) |
|
| 451 | + if (!$this->act) |
|
| 452 | 452 | { |
| 453 | 453 | $this->act = $xml_info->default_index_act; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | // still no act means error |
| 457 | - if(!$this->act) |
|
| 457 | + if (!$this->act) |
|
| 458 | 458 | { |
| 459 | 459 | $this->error = 'msg_module_is_not_exists'; |
| 460 | 460 | $this->httpStatusCode = '404'; |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | $oMessageObject->setError(-1); |
| 465 | 465 | $oMessageObject->setMessage($this->error); |
| 466 | 466 | $oMessageObject->dispMessage(); |
| 467 | - if($this->httpStatusCode) |
|
| 467 | + if ($this->httpStatusCode) |
|
| 468 | 468 | { |
| 469 | 469 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 470 | 470 | } |
@@ -475,17 +475,17 @@ discard block |
||
| 475 | 475 | $type = $xml_info->action->{$this->act}->type; |
| 476 | 476 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
| 477 | 477 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 478 | - if(!$kind && $this->module == 'admin') |
|
| 478 | + if (!$kind && $this->module == 'admin') |
|
| 479 | 479 | { |
| 480 | 480 | $kind = 'admin'; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | // check REQUEST_METHOD in controller |
| 484 | - if($type == 'controller') |
|
| 484 | + if ($type == 'controller') |
|
| 485 | 485 | { |
| 486 | 486 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 487 | 487 | |
| 488 | - if(!$allowedMethod) |
|
| 488 | + if (!$allowedMethod) |
|
| 489 | 489 | { |
| 490 | 490 | $allowedMethodList[0] = 'POST'; |
| 491 | 491 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 497 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 498 | 498 | { |
| 499 | 499 | $this->error = "msg_invalid_request"; |
| 500 | 500 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - if($this->module_info->use_mobile != "Y") |
|
| 508 | + if ($this->module_info->use_mobile != "Y") |
|
| 509 | 509 | { |
| 510 | 510 | Mobile::setMobile(FALSE); |
| 511 | 511 | } |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $logged_info = Context::get('logged_info'); |
| 514 | 514 | |
| 515 | 515 | // check CSRF for POST actions |
| 516 | - if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
| 516 | + if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
| 517 | 517 | $this->error = 'msg_invalid_request'; |
| 518 | 518 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 519 | 519 | $oMessageObject->setError(-1); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | // Admin ip |
| 526 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 526 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 527 | 527 | { |
| 528 | 528 | $this->_setInputErrorToContext(); |
| 529 | 529 | $this->error = "msg_not_permitted_act"; |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | // if(type == view, and case for using mobilephone) |
| 538 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 538 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 539 | 539 | { |
| 540 | 540 | $orig_type = "view"; |
| 541 | 541 | $type = "mobile"; |
| 542 | 542 | // create a module instance |
| 543 | 543 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 544 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 544 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 545 | 545 | { |
| 546 | 546 | $type = $orig_type; |
| 547 | 547 | Mobile::setMobile(FALSE); |
@@ -554,14 +554,14 @@ discard block |
||
| 554 | 554 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - if(!is_object($oModule)) |
|
| 557 | + if (!is_object($oModule)) |
|
| 558 | 558 | { |
| 559 | 559 | $this->_setInputErrorToContext(); |
| 560 | 560 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 561 | 561 | $oMessageObject->setError(-1); |
| 562 | 562 | $oMessageObject->setMessage($this->error); |
| 563 | 563 | $oMessageObject->dispMessage(); |
| 564 | - if($this->httpStatusCode) |
|
| 564 | + if ($this->httpStatusCode) |
|
| 565 | 565 | { |
| 566 | 566 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 567 | 567 | } |
@@ -569,10 +569,10 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | // If there is no such action in the module object |
| 572 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 572 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 573 | 573 | { |
| 574 | 574 | |
| 575 | - if(!Context::isInstalled()) |
|
| 575 | + if (!Context::isInstalled()) |
|
| 576 | 576 | { |
| 577 | 577 | $this->_setInputErrorToContext(); |
| 578 | 578 | $this->error = 'msg_invalid_request'; |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $oMessageObject->setError(-1); |
| 581 | 581 | $oMessageObject->setMessage($this->error); |
| 582 | 582 | $oMessageObject->dispMessage(); |
| 583 | - if($this->httpStatusCode) |
|
| 583 | + if ($this->httpStatusCode) |
|
| 584 | 584 | { |
| 585 | 585 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 586 | 586 | } |
@@ -589,12 +589,12 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | $forward = NULL; |
| 591 | 591 | // 1. Look for the module with action name |
| 592 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 592 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 593 | 593 | { |
| 594 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 594 | + $module = strtolower($matches[2].$matches[3]); |
|
| 595 | 595 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 596 | 596 | |
| 597 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 597 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 598 | 598 | { |
| 599 | 599 | $forward = new stdClass(); |
| 600 | 600 | $forward->module = $module; |
@@ -614,12 +614,12 @@ discard block |
||
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - if(!$forward) |
|
| 617 | + if (!$forward) |
|
| 618 | 618 | { |
| 619 | 619 | $forward = $oModuleModel->getActionForward($this->act); |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 622 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 623 | 623 | { |
| 624 | 624 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 625 | 625 | $type = $forward->type; |
@@ -631,11 +631,11 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | // SECISSUE also check foward act method |
| 633 | 633 | // check REQUEST_METHOD in controller |
| 634 | - if($type == 'controller') |
|
| 634 | + if ($type == 'controller') |
|
| 635 | 635 | { |
| 636 | 636 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 637 | 637 | |
| 638 | - if(!$allowedMethod) |
|
| 638 | + if (!$allowedMethod) |
|
| 639 | 639 | { |
| 640 | 640 | $allowedMethodList[0] = 'POST'; |
| 641 | 641 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 647 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 648 | 648 | { |
| 649 | 649 | $this->error = "msg_invalid_request"; |
| 650 | 650 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -655,13 +655,13 @@ discard block |
||
| 655 | 655 | } |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 658 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 659 | 659 | { |
| 660 | 660 | $orig_type = "view"; |
| 661 | 661 | $type = "mobile"; |
| 662 | 662 | // create a module instance |
| 663 | 663 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 664 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 664 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 665 | 665 | { |
| 666 | 666 | $type = $orig_type; |
| 667 | 667 | Mobile::setMobile(FALSE); |
@@ -673,25 +673,25 @@ discard block |
||
| 673 | 673 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | - if(!is_object($oModule)) |
|
| 676 | + if (!is_object($oModule)) |
|
| 677 | 677 | { |
| 678 | 678 | $this->_setInputErrorToContext(); |
| 679 | 679 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 680 | 680 | $oMessageObject->setError(-1); |
| 681 | 681 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 682 | 682 | $oMessageObject->dispMessage(); |
| 683 | - if($this->httpStatusCode) |
|
| 683 | + if ($this->httpStatusCode) |
|
| 684 | 684 | { |
| 685 | 685 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 686 | 686 | } |
| 687 | 687 | return $oMessageObject; |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - if($this->module == "admin" && $type == "view") |
|
| 690 | + if ($this->module == "admin" && $type == "view") |
|
| 691 | 691 | { |
| 692 | - if($logged_info->is_admin == 'Y') |
|
| 692 | + if ($logged_info->is_admin == 'Y') |
|
| 693 | 693 | { |
| 694 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 694 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 695 | 695 | { |
| 696 | 696 | $oAdminView = getAdminView('admin'); |
| 697 | 697 | $oAdminView->makeGnbUrl($forward->module); |
@@ -711,10 +711,10 @@ discard block |
||
| 711 | 711 | return $oMessageObject; |
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | - if($kind == 'admin') |
|
| 714 | + if ($kind == 'admin') |
|
| 715 | 715 | { |
| 716 | 716 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 717 | - if(!$grant->manager) |
|
| 717 | + if (!$grant->manager) |
|
| 718 | 718 | { |
| 719 | 719 | $this->_setInputErrorToContext(); |
| 720 | 720 | $this->error = 'msg_is_not_manager'; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | else |
| 728 | 728 | { |
| 729 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 729 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 730 | 730 | { |
| 731 | 731 | $this->_setInputErrorToContext(); |
| 732 | 732 | $this->error = 'msg_is_not_administrator'; |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | } |
| 742 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 742 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 743 | 743 | { |
| 744 | 744 | $this->act = $xml_info->default_index_act; |
| 745 | 745 | } |
@@ -753,16 +753,16 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | // ruleset check... |
| 756 | - if(!empty($ruleset)) |
|
| 756 | + if (!empty($ruleset)) |
|
| 757 | 757 | { |
| 758 | 758 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 759 | 759 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 760 | - if(!empty($rulesetFile)) |
|
| 760 | + if (!empty($rulesetFile)) |
|
| 761 | 761 | { |
| 762 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 762 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 763 | 763 | { |
| 764 | 764 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 765 | - foreach($errorLang as $key => $val) |
|
| 765 | + foreach ($errorLang as $key => $val) |
|
| 766 | 766 | { |
| 767 | 767 | Context::setLang($key, $val); |
| 768 | 768 | } |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | $Validator = new Validator($rulesetFile); |
| 773 | 773 | $result = $Validator->validate(); |
| 774 | - if(!$result) |
|
| 774 | + if (!$result) |
|
| 775 | 775 | { |
| 776 | 776 | $lastError = $Validator->getLastError(); |
| 777 | 777 | $returnUrl = Context::get('error_return_url'); |
@@ -803,26 +803,26 @@ discard block |
||
| 803 | 803 | 'dispLayoutPreviewWithModule' => 1 |
| 804 | 804 | ); |
| 805 | 805 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 806 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 806 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 807 | 807 | { |
| 808 | 808 | global $lang; |
| 809 | 809 | $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>'; |
| 810 | - $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>'; |
|
| 810 | + $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>'; |
|
| 811 | 811 | Context::addHtmlHeader($header); |
| 812 | 812 | Context::addHtmlFooter($footer); |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - if($type == "view" && $kind != 'admin') |
|
| 815 | + if ($type == "view" && $kind != 'admin') |
|
| 816 | 816 | { |
| 817 | 817 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 818 | - if($module_config->htmlFooter) |
|
| 818 | + if ($module_config->htmlFooter) |
|
| 819 | 819 | { |
| 820 | 820 | Context::addHtmlFooter($module_config->htmlFooter); |
| 821 | 821 | } |
| 822 | - if($module_config->siteTitle) |
|
| 822 | + if ($module_config->siteTitle) |
|
| 823 | 823 | { |
| 824 | 824 | $siteTitle = Context::getBrowserTitle(); |
| 825 | - if(!$siteTitle) |
|
| 825 | + if (!$siteTitle) |
|
| 826 | 826 | { |
| 827 | 827 | Context::setBrowserTitle($module_config->siteTitle); |
| 828 | 828 | } |
@@ -835,18 +835,18 @@ discard block |
||
| 835 | 835 | $procResult = $oModule->proc(); |
| 836 | 836 | |
| 837 | 837 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 838 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 838 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 839 | 839 | { |
| 840 | 840 | $error = $oModule->getError(); |
| 841 | 841 | $message = $oModule->getMessage(); |
| 842 | 842 | $messageType = $oModule->getMessageType(); |
| 843 | 843 | $redirectUrl = $oModule->getRedirectUrl(); |
| 844 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 844 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 845 | 845 | |
| 846 | - if(!$procResult) |
|
| 846 | + if (!$procResult) |
|
| 847 | 847 | { |
| 848 | 848 | $this->error = $message; |
| 849 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 849 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 850 | 850 | { |
| 851 | 851 | $redirectUrl = Context::get('error_return_url'); |
| 852 | 852 | } |
@@ -859,13 +859,13 @@ discard block |
||
| 859 | 859 | |
| 860 | 860 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 861 | 861 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 862 | - if($message != 'success') |
|
| 862 | + if ($message != 'success') |
|
| 863 | 863 | { |
| 864 | 864 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 865 | 865 | } |
| 866 | 866 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 867 | 867 | |
| 868 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 868 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 869 | 869 | { |
| 870 | 870 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 871 | 871 | } |
@@ -881,27 +881,27 @@ discard block |
||
| 881 | 881 | * */ |
| 882 | 882 | function _setInputErrorToContext() |
| 883 | 883 | { |
| 884 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 884 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 885 | 885 | { |
| 886 | 886 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 887 | 887 | } |
| 888 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 888 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 889 | 889 | { |
| 890 | 890 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 891 | 891 | } |
| 892 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 892 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 893 | 893 | { |
| 894 | 894 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 895 | 895 | } |
| 896 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 896 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 897 | 897 | { |
| 898 | 898 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 899 | 899 | } |
| 900 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 900 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 901 | 901 | { |
| 902 | 902 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 903 | 903 | } |
| 904 | - if(count($_SESSION['INPUT_ERROR'])) |
|
| 904 | + if (count($_SESSION['INPUT_ERROR'])) |
|
| 905 | 905 | { |
| 906 | 906 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 907 | 907 | } |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | { |
| 932 | 932 | $requestVars = Context::getRequestVars(); |
| 933 | 933 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 934 | - foreach($requestVars AS $key => $value) |
|
| 934 | + foreach ($requestVars AS $key => $value) |
|
| 935 | 935 | { |
| 936 | 936 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 937 | 937 | } |
@@ -945,41 +945,41 @@ discard block |
||
| 945 | 945 | function displayContent($oModule = NULL) |
| 946 | 946 | { |
| 947 | 947 | // If the module is not set or not an object, set error |
| 948 | - if(!$oModule || !is_object($oModule)) |
|
| 948 | + if (!$oModule || !is_object($oModule)) |
|
| 949 | 949 | { |
| 950 | 950 | $this->error = 'msg_module_is_not_exists'; |
| 951 | 951 | $this->httpStatusCode = '404'; |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // If connection to DB has a problem even though it's not install module, set error |
| 955 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 955 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 956 | 956 | { |
| 957 | 957 | $this->error = 'msg_dbconnect_failed'; |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | // Call trigger after moduleHandler proc |
| 961 | 961 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 962 | - if(!$output->toBool()) |
|
| 962 | + if (!$output->toBool()) |
|
| 963 | 963 | { |
| 964 | 964 | $this->error = $output->getMessage(); |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | // Use message view object, if HTML call |
| 968 | 968 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 969 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 969 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 970 | 970 | { |
| 971 | 971 | |
| 972 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 972 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 973 | 973 | { |
| 974 | 974 | $display_handler = new DisplayHandler(); |
| 975 | 975 | $display_handler->_debugOutput(); |
| 976 | 976 | |
| 977 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 977 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 978 | 978 | return; |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | // If error occurred, handle it |
| 982 | - if($this->error) |
|
| 982 | + if ($this->error) |
|
| 983 | 983 | { |
| 984 | 984 | // display content with message module instance |
| 985 | 985 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -988,14 +988,14 @@ discard block |
||
| 988 | 988 | $oMessageObject->setMessage($this->error); |
| 989 | 989 | $oMessageObject->dispMessage(); |
| 990 | 990 | |
| 991 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 991 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 992 | 992 | { |
| 993 | 993 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 994 | 994 | $oMessageObject->setTemplateFile('http_status_code'); |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | // If module was called normally, change the templates of the module into ones of the message view module |
| 998 | - if($oModule) |
|
| 998 | + if ($oModule) |
|
| 999 | 999 | { |
| 1000 | 1000 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1001 | 1001 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | // Check if layout_srl exists for the module |
| 1013 | - if(Mobile::isFromMobilePhone()) |
|
| 1013 | + if (Mobile::isFromMobilePhone()) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1016 | 1016 | } |
@@ -1020,58 +1020,58 @@ discard block |
||
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | // if layout_srl is rollback by module, set default layout |
| 1023 | - if($layout_srl == -1) |
|
| 1023 | + if ($layout_srl == -1) |
|
| 1024 | 1024 | { |
| 1025 | 1025 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1026 | 1026 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1027 | 1027 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1030 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1031 | 1031 | { |
| 1032 | 1032 | |
| 1033 | 1033 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1034 | 1034 | $oLayoutModel = getModel('layout'); |
| 1035 | 1035 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1036 | - if($layout_info) |
|
| 1036 | + if ($layout_info) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | |
| 1039 | 1039 | // Input extra_vars into $layout_info |
| 1040 | - if($layout_info->extra_var_count) |
|
| 1040 | + if ($layout_info->extra_var_count) |
|
| 1041 | 1041 | { |
| 1042 | 1042 | |
| 1043 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1043 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1044 | 1044 | { |
| 1045 | - if($val->type == 'image') |
|
| 1045 | + if ($val->type == 'image') |
|
| 1046 | 1046 | { |
| 1047 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1047 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1048 | 1048 | { |
| 1049 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1049 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | $layout_info->{$var_id} = $val->value; |
| 1053 | 1053 | } |
| 1054 | 1054 | } |
| 1055 | 1055 | // Set menus into context |
| 1056 | - if($layout_info->menu_count) |
|
| 1056 | + if ($layout_info->menu_count) |
|
| 1057 | 1057 | { |
| 1058 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1058 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | // set default menu set(included home menu) |
| 1061 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1061 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1062 | 1062 | { |
| 1063 | 1063 | $oMenuAdminController = getAdminController('menu'); |
| 1064 | 1064 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1065 | 1065 | |
| 1066 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1066 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1067 | 1067 | { |
| 1068 | 1068 | include($homeMenuCacheFile); |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | - if(!$menu->menu_srl) |
|
| 1071 | + if (!$menu->menu_srl) |
|
| 1072 | 1072 | { |
| 1073 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1074 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1073 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1074 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1075 | 1075 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1076 | 1076 | } |
| 1077 | 1077 | else |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | $php_file = FileHandler::exists($menu->php_file); |
| 1085 | - if($php_file) |
|
| 1085 | + if ($php_file) |
|
| 1086 | 1086 | { |
| 1087 | 1087 | include($php_file); |
| 1088 | 1088 | } |
@@ -1098,17 +1098,17 @@ discard block |
||
| 1098 | 1098 | |
| 1099 | 1099 | // If layout was modified, use the modified version |
| 1100 | 1100 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1101 | - if(file_exists($edited_layout)) |
|
| 1101 | + if (file_exists($edited_layout)) |
|
| 1102 | 1102 | { |
| 1103 | 1103 | $oModule->setEditedLayoutFile($edited_layout); |
| 1104 | 1104 | } |
| 1105 | 1105 | } |
| 1106 | 1106 | } |
| 1107 | 1107 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1108 | - if($isLayoutDrop) |
|
| 1108 | + if ($isLayoutDrop) |
|
| 1109 | 1109 | { |
| 1110 | 1110 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1111 | - if($kind == 'admin') |
|
| 1111 | + if ($kind == 'admin') |
|
| 1112 | 1112 | { |
| 1113 | 1113 | $oModule->setLayoutFile('popup_layout'); |
| 1114 | 1114 | } |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1147 | 1147 | { |
| 1148 | 1148 | |
| 1149 | - if(__DEBUG__ == 3) |
|
| 1149 | + if (__DEBUG__ == 3) |
|
| 1150 | 1150 | { |
| 1151 | 1151 | $start_time = getMicroTime(); |
| 1152 | 1152 | } |
@@ -1156,51 +1156,51 @@ discard block |
||
| 1156 | 1156 | $type = strtolower($type); |
| 1157 | 1157 | |
| 1158 | 1158 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1159 | - if(!isset($kinds[$kind])) |
|
| 1159 | + if (!isset($kinds[$kind])) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | $kind = 'svc'; |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1164 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1165 | 1165 | |
| 1166 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1166 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1167 | 1167 | { |
| 1168 | 1168 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | // if there is no instance of the module in global variable, create a new one |
| 1172 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1172 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1173 | 1173 | { |
| 1174 | 1174 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1175 | 1175 | |
| 1176 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1176 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1177 | 1177 | { |
| 1178 | 1178 | $module = $parent_module; |
| 1179 | 1179 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | 1182 | // Check if the base class and instance class exist |
| 1183 | - if(!class_exists($module, true)) |
|
| 1183 | + if (!class_exists($module, true)) |
|
| 1184 | 1184 | { |
| 1185 | 1185 | return NULL; |
| 1186 | 1186 | } |
| 1187 | - if(!class_exists($instance_name, true)) |
|
| 1187 | + if (!class_exists($instance_name, true)) |
|
| 1188 | 1188 | { |
| 1189 | 1189 | return NULL; |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | // Create an instance |
| 1193 | 1193 | $oModule = new $instance_name(); |
| 1194 | - if(!is_object($oModule)) |
|
| 1194 | + if (!is_object($oModule)) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | return NULL; |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | // Load language files for the class |
| 1200 | - Context::loadLang($class_path . 'lang'); |
|
| 1201 | - if($extend_module) |
|
| 1200 | + Context::loadLang($class_path.'lang'); |
|
| 1201 | + if ($extend_module) |
|
| 1202 | 1202 | { |
| 1203 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1203 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | // Set variables to the instance |
@@ -1208,10 +1208,10 @@ discard block |
||
| 1208 | 1208 | $oModule->setModulePath($class_path); |
| 1209 | 1209 | |
| 1210 | 1210 | // If the module has a constructor, run it. |
| 1211 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1211 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1214 | - if(@method_exists($oModule, $instance_name)) |
|
| 1214 | + if (@method_exists($oModule, $instance_name)) |
|
| 1215 | 1215 | { |
| 1216 | 1216 | $oModule->{$instance_name}(); |
| 1217 | 1217 | } |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - if(__DEBUG__ == 3) |
|
| 1224 | + if (__DEBUG__ == 3) |
|
| 1225 | 1225 | { |
| 1226 | 1226 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1227 | 1227 | } |
@@ -1237,17 +1237,17 @@ discard block |
||
| 1237 | 1237 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1238 | 1238 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1239 | 1239 | |
| 1240 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1241 | - if(!in_array($type, $types)) |
|
| 1240 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1241 | + if (!in_array($type, $types)) |
|
| 1242 | 1242 | { |
| 1243 | 1243 | $type = $types[0]; |
| 1244 | 1244 | } |
| 1245 | - if($type == 'class') |
|
| 1245 | + if ($type == 'class') |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $instanceName = '%s'; |
| 1248 | 1248 | $classFile = '%s%s.%s.php'; |
| 1249 | 1249 | } |
| 1250 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1250 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | $instanceName = '%sAdmin%s'; |
| 1253 | 1253 | $classFile = '%s%s.admin.%s.php'; |
@@ -1272,26 +1272,26 @@ discard block |
||
| 1272 | 1272 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1273 | 1273 | { |
| 1274 | 1274 | // skip if not installed |
| 1275 | - if(!Context::isInstalled()) |
|
| 1275 | + if (!Context::isInstalled()) |
|
| 1276 | 1276 | { |
| 1277 | 1277 | return new Object(); |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | $oModuleModel = getModel('module'); |
| 1281 | 1281 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1282 | - if(!$triggers || count($triggers) < 1) |
|
| 1282 | + if (!$triggers || count($triggers) < 1) |
|
| 1283 | 1283 | { |
| 1284 | 1284 | return new Object(); |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | //store before trigger call time |
| 1288 | 1288 | $before_trigger_time = NULL; |
| 1289 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1289 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1290 | 1290 | { |
| 1291 | 1291 | $before_trigger_time = microtime(true); |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | - foreach($triggers as $item) |
|
| 1294 | + foreach ($triggers as $item) |
|
| 1295 | 1295 | { |
| 1296 | 1296 | $module = $item->module; |
| 1297 | 1297 | $type = $item->type; |
@@ -1299,7 +1299,7 @@ discard block |
||
| 1299 | 1299 | |
| 1300 | 1300 | // todo why don't we call a normal class object ? |
| 1301 | 1301 | $oModule = getModule($module, $type); |
| 1302 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1302 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1303 | 1303 | { |
| 1304 | 1304 | continue; |
| 1305 | 1305 | } |
@@ -1312,12 +1312,12 @@ discard block |
||
| 1312 | 1312 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1313 | 1313 | |
| 1314 | 1314 | $slowlog = new stdClass; |
| 1315 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1316 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1315 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1316 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1317 | 1317 | $slowlog->called_extension = $module; |
| 1318 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1318 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1319 | 1319 | |
| 1320 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1320 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1321 | 1321 | { |
| 1322 | 1322 | return $output; |
| 1323 | 1323 | } |
@@ -1402,9 +1402,9 @@ discard block |
||
| 1402 | 1402 | '511' => 'Network Authentication Required', |
| 1403 | 1403 | ); |
| 1404 | 1404 | $statusMessage = $statusMessageList[$code]; |
| 1405 | - if(!$statusMessage) |
|
| 1405 | + if (!$statusMessage) |
|
| 1406 | 1406 | { |
| 1407 | - $statusMessage = 'HTTP ' . $code; |
|
| 1407 | + $statusMessage = 'HTTP '.$code; |
|
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | Context::set('http_status_code', $code); |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | * @author NAVER ([email protected]) |
| 8 | 8 | */ |
| 9 | -if(!defined('__XE__')) |
|
| 9 | +if (!defined('__XE__')) |
|
| 10 | 10 | { |
| 11 | 11 | exit(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
| 15 | -if(!function_exists('iconv')) |
|
| 15 | +if (!function_exists('iconv')) |
|
| 16 | 16 | { |
| 17 | 17 | eval(' |
| 18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $oDB = DB::getInstance(); |
| 222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
| 223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
| 223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
| 224 | 224 | { |
| 225 | 225 | $output->data = array($output->data); |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | function setUserSequence($seq) |
| 251 | 251 | { |
| 252 | 252 | $arr_seq = array(); |
| 253 | - if(isset($_SESSION['seq'])) |
|
| 253 | + if (isset($_SESSION['seq'])) |
|
| 254 | 254 | { |
| 255 | 255 | $arr_seq = $_SESSION['seq']; |
| 256 | 256 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function checkUserSequence($seq) |
| 268 | 268 | { |
| 269 | - if(!isset($_SESSION['seq'])) |
|
| 269 | + if (!isset($_SESSION['seq'])) |
|
| 270 | 270 | { |
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | - if(!in_array($seq, $_SESSION['seq'])) |
|
| 273 | + if (!in_array($seq, $_SESSION['seq'])) |
|
| 274 | 274 | { |
| 275 | 275 | return false; |
| 276 | 276 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $num_args = func_num_args(); |
| 297 | 297 | $args_list = func_get_args(); |
| 298 | 298 | |
| 299 | - if($num_args) |
|
| 299 | + if ($num_args) |
|
| 300 | 300 | $url = Context::getUrl($num_args, $args_list); |
| 301 | 301 | else |
| 302 | 302 | $url = Context::getRequestUri(); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $num_args = func_num_args(); |
| 316 | 316 | $args_list = func_get_args(); |
| 317 | 317 | |
| 318 | - if($num_args) |
|
| 318 | + if ($num_args) |
|
| 319 | 319 | { |
| 320 | 320 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 321 | 321 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $num_args = func_num_args(); |
| 339 | 339 | $args_list = func_get_args(); |
| 340 | 340 | |
| 341 | - if($num_args) |
|
| 341 | + if ($num_args) |
|
| 342 | 342 | { |
| 343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
| 344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | $num_args = func_num_args(); |
| 361 | 361 | $args_list = func_get_args(); |
| 362 | 362 | $request_uri = Context::getRequestUri(); |
| 363 | - if(!$num_args) |
|
| 363 | + if (!$num_args) |
|
| 364 | 364 | { |
| 365 | 365 | return $request_uri; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $url = Context::getUrl($num_args, $args_list); |
| 369 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 369 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 370 | 370 | { |
| 371 | 371 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 372 | - return substr($match[0], 0, -1) . $url; |
|
| 372 | + return substr($match[0], 0, -1).$url; |
|
| 373 | 373 | } |
| 374 | 374 | return $url; |
| 375 | 375 | } |
@@ -384,17 +384,17 @@ discard block |
||
| 384 | 384 | $num_args = func_num_args(); |
| 385 | 385 | $args_list = func_get_args(); |
| 386 | 386 | $request_uri = Context::getRequestUri(); |
| 387 | - if(!$num_args) |
|
| 387 | + if (!$num_args) |
|
| 388 | 388 | { |
| 389 | 389 | return $request_uri; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 393 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 393 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 394 | 394 | { |
| 395 | 395 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 396 | 396 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 397 | - return substr($match[0], 0, -1) . $url; |
|
| 397 | + return substr($match[0], 0, -1).$url; |
|
| 398 | 398 | } |
| 399 | 399 | return $url; |
| 400 | 400 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $num_args = func_num_args(); |
| 411 | 411 | $args_list = func_get_args(); |
| 412 | 412 | |
| 413 | - if(!$num_args) |
|
| 413 | + if (!$num_args) |
|
| 414 | 414 | { |
| 415 | 415 | return Context::getRequestUri(); |
| 416 | 416 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $num_args = func_num_args(); |
| 433 | 433 | $args_list = func_get_args(); |
| 434 | 434 | |
| 435 | - if(!$num_args) |
|
| 435 | + if (!$num_args) |
|
| 436 | 436 | { |
| 437 | 437 | return Context::getRequestUri(); |
| 438 | 438 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $args_list = func_get_args(); |
| 455 | 455 | |
| 456 | 456 | $request_uri = Context::getRequestUri(); |
| 457 | - if(!$num_args) |
|
| 457 | + if (!$num_args) |
|
| 458 | 458 | { |
| 459 | 459 | return $request_uri; |
| 460 | 460 | } |
@@ -463,10 +463,10 @@ discard block |
||
| 463 | 463 | $num_args = count($args_list); |
| 464 | 464 | |
| 465 | 465 | $url = Context::getUrl($num_args, $args_list, $domain); |
| 466 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 466 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 467 | 467 | { |
| 468 | 468 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 469 | - return substr($match[0], 0, -1) . $url; |
|
| 469 | + return substr($match[0], 0, -1).$url; |
|
| 470 | 470 | } |
| 471 | 471 | return $url; |
| 472 | 472 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | function getCurrentPageUrl() |
| 480 | 480 | { |
| 481 | 481 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
| 482 | - $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 482 | + $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 483 | 483 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
| 484 | 484 | } |
| 485 | 485 | |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | function cut_str($string, $cut_size = 0, $tail = '...') |
| 506 | 506 | { |
| 507 | - if($cut_size < 1 || !$string) |
|
| 507 | + if ($cut_size < 1 || !$string) |
|
| 508 | 508 | { |
| 509 | 509 | return $string; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 512 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 513 | 513 | { |
| 514 | 514 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
| 515 | 515 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | $char_count = 0; |
| 524 | 524 | |
| 525 | 525 | $idx = 0; |
| 526 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 526 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 527 | 527 | { |
| 528 | 528 | $c = ord(substr($string, $idx, 1)); |
| 529 | 529 | $char_count++; |
| 530 | - if($c < 128) |
|
| 530 | + if ($c < 128) |
|
| 531 | 531 | { |
| 532 | 532 | $char_width += (int) $chars[$c - 32]; |
| 533 | 533 | $idx++; |
| 534 | 534 | } |
| 535 | - else if(191 < $c && $c < 224) |
|
| 535 | + else if (191 < $c && $c < 224) |
|
| 536 | 536 | { |
| 537 | 537 | $char_width += $chars[4]; |
| 538 | 538 | $idx += 2; |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | $output = substr($string, 0, $idx); |
| 548 | - if(strlen($output) < $string_length) |
|
| 548 | + if (strlen($output) < $string_length) |
|
| 549 | 549 | { |
| 550 | 550 | $output .= $tail; |
| 551 | 551 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | function zgap() |
| 562 | 562 | { |
| 563 | 563 | $time_zone = $GLOBALS['_time_zone']; |
| 564 | - if($time_zone < 0) |
|
| 564 | + if ($time_zone < 0) |
|
| 565 | 565 | { |
| 566 | 566 | $to = -1; |
| 567 | 567 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $t_min = substr($time_zone, 3, 2) * $to; |
| 575 | 575 | |
| 576 | 576 | $server_time_zone = date("O"); |
| 577 | - if($server_time_zone < 0) |
|
| 577 | + if ($server_time_zone < 0) |
|
| 578 | 578 | { |
| 579 | 579 | $so = -1; |
| 580 | 580 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | function ztime($str) |
| 603 | 603 | { |
| 604 | - if(!$str) |
|
| 604 | + if (!$str) |
|
| 605 | 605 | { |
| 606 | 606 | return; |
| 607 | 607 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $year = (int) substr($str, 0, 4); |
| 613 | 613 | $month = (int) substr($str, 4, 2); |
| 614 | 614 | $day = (int) substr($str, 6, 2); |
| 615 | - if(strlen($str) <= 8) |
|
| 615 | + if (strlen($str) <= 8) |
|
| 616 | 616 | { |
| 617 | 617 | $gap = 0; |
| 618 | 618 | } |
@@ -636,19 +636,19 @@ discard block |
||
| 636 | 636 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
| 637 | 637 | |
| 638 | 638 | $lang_time_gap = Context::getLang('time_gap'); |
| 639 | - if($gap < 60) |
|
| 639 | + if ($gap < 60) |
|
| 640 | 640 | { |
| 641 | 641 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
| 642 | 642 | } |
| 643 | - elseif($gap < 60 * 60) |
|
| 643 | + elseif ($gap < 60 * 60) |
|
| 644 | 644 | { |
| 645 | 645 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
| 646 | 646 | } |
| 647 | - elseif($gap < 60 * 60 * 2) |
|
| 647 | + elseif ($gap < 60 * 60 * 2) |
|
| 648 | 648 | { |
| 649 | 649 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
| 650 | 650 | } |
| 651 | - elseif($gap < 60 * 60 * 24) |
|
| 651 | + elseif ($gap < 60 * 60 * 24) |
|
| 652 | 652 | { |
| 653 | 653 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
| 654 | 654 | } |
@@ -685,40 +685,40 @@ discard block |
||
| 685 | 685 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
| 686 | 686 | { |
| 687 | 687 | // return null if no target time is specified |
| 688 | - if(!$str) |
|
| 688 | + if (!$str) |
|
| 689 | 689 | { |
| 690 | 690 | return; |
| 691 | 691 | } |
| 692 | 692 | // convert the date format according to the language |
| 693 | - if($conversion == TRUE) |
|
| 693 | + if ($conversion == TRUE) |
|
| 694 | 694 | { |
| 695 | - switch(Context::getLangType()) |
|
| 695 | + switch (Context::getLangType()) |
|
| 696 | 696 | { |
| 697 | 697 | case 'en' : |
| 698 | 698 | case 'es' : |
| 699 | - if($format == 'Y-m-d') |
|
| 699 | + if ($format == 'Y-m-d') |
|
| 700 | 700 | { |
| 701 | 701 | $format = 'M d, Y'; |
| 702 | 702 | } |
| 703 | - elseif($format == 'Y-m-d H:i:s') |
|
| 703 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 704 | 704 | { |
| 705 | 705 | $format = 'M d, Y H:i:s'; |
| 706 | 706 | } |
| 707 | - elseif($format == 'Y-m-d H:i') |
|
| 707 | + elseif ($format == 'Y-m-d H:i') |
|
| 708 | 708 | { |
| 709 | 709 | $format = 'M d, Y H:i'; |
| 710 | 710 | } |
| 711 | 711 | break; |
| 712 | 712 | case 'vi' : |
| 713 | - if($format == 'Y-m-d') |
|
| 713 | + if ($format == 'Y-m-d') |
|
| 714 | 714 | { |
| 715 | 715 | $format = 'd-m-Y'; |
| 716 | 716 | } |
| 717 | - elseif($format == 'Y-m-d H:i:s') |
|
| 717 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 718 | 718 | { |
| 719 | 719 | $format = 'H:i:s d-m-Y'; |
| 720 | 720 | } |
| 721 | - elseif($format == 'Y-m-d H:i') |
|
| 721 | + elseif ($format == 'Y-m-d H:i') |
|
| 722 | 722 | { |
| 723 | 723 | $format = 'H:i d-m-Y'; |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // If year value is less than 1970, handle it separately. |
| 730 | - if((int) substr($str, 0, 4) < 1970) |
|
| 730 | + if ((int) substr($str, 0, 4) < 1970) |
|
| 731 | 731 | { |
| 732 | 732 | $hour = (int) substr($str, 8, 2); |
| 733 | 733 | $min = (int) substr($str, 10, 2); |
@@ -777,9 +777,9 @@ discard block |
||
| 777 | 777 | function getEncodeEmailAddress($email) |
| 778 | 778 | { |
| 779 | 779 | $return = ''; |
| 780 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 780 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 781 | 781 | { |
| 782 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
| 782 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
| 783 | 783 | } |
| 784 | 784 | return $return; |
| 785 | 785 | } |
@@ -799,25 +799,25 @@ discard block |
||
| 799 | 799 | { |
| 800 | 800 | static $debug_file; |
| 801 | 801 | |
| 802 | - if(!(__DEBUG__ & 1)) |
|
| 802 | + if (!(__DEBUG__ & 1)) |
|
| 803 | 803 | { |
| 804 | 804 | return; |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | static $firephp; |
| 808 | 808 | $bt = debug_backtrace(); |
| 809 | - if(is_array($bt)) |
|
| 809 | + if (is_array($bt)) |
|
| 810 | 810 | { |
| 811 | 811 | $bt_debug_print = array_shift($bt); |
| 812 | 812 | $bt_called_function = array_shift($bt); |
| 813 | 813 | } |
| 814 | 814 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
| 815 | 815 | $line_num = $bt_debug_print['line']; |
| 816 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
| 816 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
| 817 | 817 | |
| 818 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 818 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 819 | 819 | { |
| 820 | - if(!isset($firephp)) |
|
| 820 | + if (!isset($firephp)) |
|
| 821 | 821 | { |
| 822 | 822 | $firephp = FirePHP::getInstance(TRUE); |
| 823 | 823 | } |
@@ -826,16 +826,16 @@ discard block |
||
| 826 | 826 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
| 827 | 827 | |
| 828 | 828 | // Check a FirePHP option |
| 829 | - if($display_option === 'TABLE') |
|
| 829 | + if ($display_option === 'TABLE') |
|
| 830 | 830 | { |
| 831 | 831 | $label = $display_option; |
| 832 | 832 | } |
| 833 | - if($display_option === 'ERROR') |
|
| 833 | + if ($display_option === 'ERROR') |
|
| 834 | 834 | { |
| 835 | 835 | $type = $display_option; |
| 836 | 836 | } |
| 837 | 837 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
| 838 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 838 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 839 | 839 | { |
| 840 | 840 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
| 841 | 841 | $label = NULL; |
@@ -845,43 +845,43 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | else |
| 847 | 847 | { |
| 848 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 848 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 849 | 849 | { |
| 850 | 850 | return; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | $print = array(); |
| 854 | - if(!$debug_file) $debug_file = _XE_PATH_ . 'files/' . $file; |
|
| 854 | + if (!$debug_file) $debug_file = _XE_PATH_.'files/'.$file; |
|
| 855 | 855 | $debug_file_exist = file_exists($debug_file); |
| 856 | - if(!$debug_file_exist) $print[] = '<?php exit() ?>'; |
|
| 856 | + if (!$debug_file_exist) $print[] = '<?php exit() ?>'; |
|
| 857 | 857 | |
| 858 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
| 858 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
| 859 | 859 | { |
| 860 | 860 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 861 | 861 | $print[] = str_repeat('=', 80); |
| 862 | 862 | } |
| 863 | 863 | $type = gettype($debug_output); |
| 864 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
| 864 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
| 865 | 865 | { |
| 866 | - $print[] = 'DEBUG : ' . var_export($debug_output, TRUE); |
|
| 866 | + $print[] = 'DEBUG : '.var_export($debug_output, TRUE); |
|
| 867 | 867 | } |
| 868 | 868 | else |
| 869 | 869 | { |
| 870 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
| 870 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
| 871 | 871 | } |
| 872 | 872 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 873 | 873 | $backtrace = debug_backtrace($backtrace_args); |
| 874 | 874 | |
| 875 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
| 875 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
| 876 | 876 | { |
| 877 | 877 | array_shift($backtrace); |
| 878 | 878 | } |
| 879 | - foreach($backtrace as $val) |
|
| 879 | + foreach ($backtrace as $val) |
|
| 880 | 880 | { |
| 881 | - $print[] = ' - ' . $val['file'] . ' line ' . $val['line']; |
|
| 881 | + $print[] = ' - '.$val['file'].' line '.$val['line']; |
|
| 882 | 882 | } |
| 883 | 883 | $print[] = PHP_EOL; |
| 884 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 884 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | */ |
| 893 | 893 | function writeSlowlog($type, $elapsed_time, $obj) |
| 894 | 894 | { |
| 895 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 895 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 896 | 896 | |
| 897 | 897 | static $log_filename = array( |
| 898 | 898 | 'query' => 'files/_slowlog_query.php', |
@@ -902,47 +902,47 @@ discard block |
||
| 902 | 902 | ); |
| 903 | 903 | $write_file = true; |
| 904 | 904 | |
| 905 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
| 905 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
| 906 | 906 | |
| 907 | 907 | $buff = array(); |
| 908 | 908 | $buff[] = '<?php exit(); ?>'; |
| 909 | 909 | $buff[] = date('c'); |
| 910 | 910 | |
| 911 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 911 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 912 | 912 | { |
| 913 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 914 | - $buff[] = "\tCalled : " . $obj->called; |
|
| 913 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 914 | + $buff[] = "\tCalled : ".$obj->called; |
|
| 915 | 915 | } |
| 916 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 916 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 917 | 917 | { |
| 918 | - $buff[] = "\tAddon : " . $obj->called; |
|
| 919 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
| 918 | + $buff[] = "\tAddon : ".$obj->called; |
|
| 919 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
| 920 | 920 | } |
| 921 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 921 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 922 | 922 | { |
| 923 | - $buff[] = "\tWidget : " . $obj->called; |
|
| 923 | + $buff[] = "\tWidget : ".$obj->called; |
|
| 924 | 924 | } |
| 925 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 925 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 926 | 926 | { |
| 927 | 927 | |
| 928 | 928 | $buff[] = $obj->query; |
| 929 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
| 930 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 931 | - $buff[] = "\tConnection : " . $obj->connection; |
|
| 929 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
| 930 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 931 | + $buff[] = "\tConnection : ".$obj->connection; |
|
| 932 | 932 | } |
| 933 | 933 | else |
| 934 | 934 | { |
| 935 | 935 | $write_file = false; |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | - if($write_file) |
|
| 938 | + if ($write_file) |
|
| 939 | 939 | { |
| 940 | 940 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
| 941 | - $buff[] = PHP_EOL . PHP_EOL; |
|
| 941 | + $buff[] = PHP_EOL.PHP_EOL; |
|
| 942 | 942 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | - if($type != 'query') |
|
| 945 | + if ($type != 'query') |
|
| 946 | 946 | { |
| 947 | 947 | $trigger_args = $obj; |
| 948 | 948 | $trigger_args->_log_type = $type; |
@@ -982,11 +982,11 @@ discard block |
||
| 982 | 982 | */ |
| 983 | 983 | function delObjectVars($target_obj, $del_obj) |
| 984 | 984 | { |
| 985 | - if(!is_object($target_obj)) |
|
| 985 | + if (!is_object($target_obj)) |
|
| 986 | 986 | { |
| 987 | 987 | return; |
| 988 | 988 | } |
| 989 | - if(!is_object($del_obj)) |
|
| 989 | + if (!is_object($del_obj)) |
|
| 990 | 990 | { |
| 991 | 991 | return; |
| 992 | 992 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | |
| 997 | 997 | $target = array_keys($target_vars); |
| 998 | 998 | $del = array_keys($del_vars); |
| 999 | - if(!count($target) || !count($del)) |
|
| 999 | + if (!count($target) || !count($del)) |
|
| 1000 | 1000 | { |
| 1001 | 1001 | return $target_obj; |
| 1002 | 1002 | } |
@@ -1004,10 +1004,10 @@ discard block |
||
| 1004 | 1004 | $return_obj = new stdClass(); |
| 1005 | 1005 | |
| 1006 | 1006 | $target_count = count($target); |
| 1007 | - for($i = 0; $i < $target_count; $i++) |
|
| 1007 | + for ($i = 0; $i < $target_count; $i++) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | $target_key = $target[$i]; |
| 1010 | - if(!in_array($target_key, $del)) |
|
| 1010 | + if (!in_array($target_key, $del)) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
| 1013 | 1013 | } |
@@ -1020,10 +1020,10 @@ discard block |
||
| 1020 | 1020 | { |
| 1021 | 1021 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
| 1022 | 1022 | |
| 1023 | - foreach($del_vars as $var) |
|
| 1023 | + foreach ($del_vars as $var) |
|
| 1024 | 1024 | { |
| 1025 | - if(is_array($vars)) unset($vars[$var]); |
|
| 1026 | - else if(is_object($vars)) unset($vars->$var); |
|
| 1025 | + if (is_array($vars)) unset($vars[$var]); |
|
| 1026 | + else if (is_object($vars)) unset($vars->$var); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | return $vars; |
@@ -1040,12 +1040,12 @@ discard block |
||
| 1040 | 1040 | */ |
| 1041 | 1041 | function handleError($errno, $errstr, $file, $line) |
| 1042 | 1042 | { |
| 1043 | - if(!__DEBUG__) |
|
| 1043 | + if (!__DEBUG__) |
|
| 1044 | 1044 | { |
| 1045 | 1045 | return; |
| 1046 | 1046 | } |
| 1047 | 1047 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
| 1048 | - if(!in_array($errno, $errors)) |
|
| 1048 | + if (!in_array($errno, $errors)) |
|
| 1049 | 1049 | { |
| 1050 | 1050 | return; |
| 1051 | 1051 | } |
@@ -1065,8 +1065,8 @@ discard block |
||
| 1065 | 1065 | function getNumberingPath($no, $size = 3) |
| 1066 | 1066 | { |
| 1067 | 1067 | $mod = pow(10, $size); |
| 1068 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
| 1069 | - if($no >= $mod) |
|
| 1068 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
| 1069 | + if ($no >= $mod) |
|
| 1070 | 1070 | { |
| 1071 | 1071 | $output .= getNumberingPath((int) $no / $mod, $size); |
| 1072 | 1072 | } |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | |
| 1087 | 1087 | function purifierHtml(&$content) |
| 1088 | 1088 | { |
| 1089 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
| 1089 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
| 1090 | 1090 | $oPurifier = Purifier::getInstance(); |
| 1091 | 1091 | $oPurifier->purify($content); |
| 1092 | 1092 | } |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | */ |
| 1100 | 1100 | function removeHackTag($content) |
| 1101 | 1101 | { |
| 1102 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
| 1102 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
| 1103 | 1103 | $oEmbedFilter = EmbedFilter::getInstance(); |
| 1104 | 1104 | $oEmbedFilter->check($content); |
| 1105 | 1105 | |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | */ |
| 1142 | 1142 | function checkUploadedFile($file) |
| 1143 | 1143 | { |
| 1144 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
| 1144 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
| 1145 | 1145 | return UploadFileFilter::check($file); |
| 1146 | 1146 | } |
| 1147 | 1147 | |
@@ -1155,13 +1155,13 @@ discard block |
||
| 1155 | 1155 | { |
| 1156 | 1156 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
| 1157 | 1157 | |
| 1158 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1158 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1159 | 1159 | { |
| 1160 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1160 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1161 | 1161 | { |
| 1162 | 1162 | $content .= '</xmp>'; |
| 1163 | 1163 | } |
| 1164 | - else if($close_xmp < $start_xmp) |
|
| 1164 | + else if ($close_xmp < $start_xmp) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $content .= '</xmp>'; |
| 1167 | 1167 | } |
@@ -1181,33 +1181,33 @@ discard block |
||
| 1181 | 1181 | $tag = strtolower($match[2]); |
| 1182 | 1182 | |
| 1183 | 1183 | // xmp tag ?뺣━ |
| 1184 | - if($tag == 'xmp') |
|
| 1184 | + if ($tag == 'xmp') |
|
| 1185 | 1185 | { |
| 1186 | 1186 | return "<{$match[1]}xmp>"; |
| 1187 | 1187 | } |
| 1188 | - if($match[1]) |
|
| 1188 | + if ($match[1]) |
|
| 1189 | 1189 | { |
| 1190 | 1190 | return $match[0]; |
| 1191 | 1191 | } |
| 1192 | - if($match[4]) |
|
| 1192 | + if ($match[4]) |
|
| 1193 | 1193 | { |
| 1194 | - $match[4] = ' ' . $match[4]; |
|
| 1194 | + $match[4] = ' '.$match[4]; |
|
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | $attrs = array(); |
| 1198 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1198 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1199 | 1199 | { |
| 1200 | - foreach($m[1] as $idx => $name) |
|
| 1200 | + foreach ($m[1] as $idx => $name) |
|
| 1201 | 1201 | { |
| 1202 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1202 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1203 | 1203 | { |
| 1204 | 1204 | continue; |
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
| 1207 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
| 1208 | 1208 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
| 1209 | 1209 | |
| 1210 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
| 1210 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
| 1211 | 1211 | { |
| 1212 | 1212 | continue; |
| 1213 | 1213 | } |
@@ -1218,60 +1218,60 @@ discard block |
||
| 1218 | 1218 | |
| 1219 | 1219 | $filter_arrts = array('style', 'src', 'href'); |
| 1220 | 1220 | |
| 1221 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1222 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1221 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1222 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1223 | 1223 | |
| 1224 | - foreach($filter_arrts as $attr) |
|
| 1224 | + foreach ($filter_arrts as $attr) |
|
| 1225 | 1225 | { |
| 1226 | - if(!isset($attrs[$attr])) continue; |
|
| 1226 | + if (!isset($attrs[$attr])) continue; |
|
| 1227 | 1227 | |
| 1228 | 1228 | $attr_value = rawurldecode($attrs[$attr]); |
| 1229 | 1229 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
| 1230 | 1230 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
| 1231 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1231 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1232 | 1232 | { |
| 1233 | 1233 | unset($attrs[$attr]); |
| 1234 | 1234 | } |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1237 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1238 | 1238 | { |
| 1239 | 1239 | unset($attrs['style']); |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | $attr = array(); |
| 1243 | - foreach($attrs as $name => $val) |
|
| 1243 | + foreach ($attrs as $name => $val) |
|
| 1244 | 1244 | { |
| 1245 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1245 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $attribute = strtolower(trim($name)); |
| 1248 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1248 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1249 | 1249 | { |
| 1250 | - if(stripos($val, 'data:') === 0) |
|
| 1250 | + if (stripos($val, 'data:') === 0) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | continue; |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | - if($tag == 'img') |
|
| 1257 | + if ($tag == 'img') |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $attribute = strtolower(trim($name)); |
| 1260 | - if(stripos($val, 'data:') === 0) |
|
| 1260 | + if (stripos($val, 'data:') === 0) |
|
| 1261 | 1261 | { |
| 1262 | 1262 | continue; |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | $val = str_replace('"', '"', $val); |
| 1266 | - $attr[] = $name . "=\"{$val}\""; |
|
| 1266 | + $attr[] = $name."=\"{$val}\""; |
|
| 1267 | 1267 | } |
| 1268 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
| 1268 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
| 1269 | 1269 | |
| 1270 | 1270 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | // convert hexa value to RGB |
| 1274 | -if(!function_exists('hexrgb')) |
|
| 1274 | +if (!function_exists('hexrgb')) |
|
| 1275 | 1275 | { |
| 1276 | 1276 | |
| 1277 | 1277 | /** |
@@ -1307,9 +1307,9 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | settype($password, "string"); |
| 1309 | 1309 | |
| 1310 | - for($i = 0; $i < strlen($password); $i++) |
|
| 1310 | + for ($i = 0; $i < strlen($password); $i++) |
|
| 1311 | 1311 | { |
| 1312 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1312 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1313 | 1313 | { |
| 1314 | 1314 | continue; |
| 1315 | 1315 | } |
@@ -1321,11 +1321,11 @@ discard block |
||
| 1321 | 1321 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
| 1322 | 1322 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
| 1323 | 1323 | |
| 1324 | - if($result1 == '80000000') |
|
| 1324 | + if ($result1 == '80000000') |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $nr += 0x80000000; |
| 1327 | 1327 | } |
| 1328 | - if($result2 == '80000000') |
|
| 1328 | + if ($result2 == '80000000') |
|
| 1329 | 1329 | { |
| 1330 | 1330 | $nr2 += 0x80000000; |
| 1331 | 1331 | } |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | function getScriptPath() |
| 1342 | 1342 | { |
| 1343 | 1343 | static $url = NULL; |
| 1344 | - if($url == NULL) |
|
| 1344 | + if ($url == NULL) |
|
| 1345 | 1345 | { |
| 1346 | 1346 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php$/i', '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
| 1347 | 1347 | } |
@@ -1371,14 +1371,14 @@ discard block |
||
| 1371 | 1371 | $decodedStr = ''; |
| 1372 | 1372 | $pos = 0; |
| 1373 | 1373 | $len = strlen($source); |
| 1374 | - while($pos < $len) |
|
| 1374 | + while ($pos < $len) |
|
| 1375 | 1375 | { |
| 1376 | 1376 | $charAt = substr($source, $pos, 1); |
| 1377 | - if($charAt == '%') |
|
| 1377 | + if ($charAt == '%') |
|
| 1378 | 1378 | { |
| 1379 | 1379 | $pos++; |
| 1380 | 1380 | $charAt = substr($source, $pos, 1); |
| 1381 | - if($charAt == 'u') |
|
| 1381 | + if ($charAt == 'u') |
|
| 1382 | 1382 | { |
| 1383 | 1383 | // we got a unicode character |
| 1384 | 1384 | $pos++; |
@@ -1412,21 +1412,21 @@ discard block |
||
| 1412 | 1412 | */ |
| 1413 | 1413 | function _code2utf($num) |
| 1414 | 1414 | { |
| 1415 | - if($num < 128) |
|
| 1415 | + if ($num < 128) |
|
| 1416 | 1416 | { |
| 1417 | 1417 | return chr($num); |
| 1418 | 1418 | } |
| 1419 | - if($num < 2048) |
|
| 1419 | + if ($num < 2048) |
|
| 1420 | 1420 | { |
| 1421 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 1421 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 1422 | 1422 | } |
| 1423 | - if($num < 65536) |
|
| 1423 | + if ($num < 65536) |
|
| 1424 | 1424 | { |
| 1425 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1425 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1426 | 1426 | } |
| 1427 | - if($num < 2097152) |
|
| 1427 | + if ($num < 2097152) |
|
| 1428 | 1428 | { |
| 1429 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1429 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1430 | 1430 | } |
| 1431 | 1431 | return ''; |
| 1432 | 1432 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | */ |
| 1442 | 1442 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
| 1443 | 1443 | { |
| 1444 | - if($urldecode) |
|
| 1444 | + if ($urldecode) |
|
| 1445 | 1445 | { |
| 1446 | 1446 | $string = urldecode($string); |
| 1447 | 1447 | } |
@@ -1449,12 +1449,12 @@ discard block |
||
| 1449 | 1449 | $sample = iconv('utf-8', 'utf-8', $string); |
| 1450 | 1450 | $is_utf8 = (md5($sample) === md5($string)); |
| 1451 | 1451 | |
| 1452 | - if(!$urldecode) |
|
| 1452 | + if (!$urldecode) |
|
| 1453 | 1453 | { |
| 1454 | 1454 | $string = urldecode($string); |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | - if($return_convert) |
|
| 1457 | + if ($return_convert) |
|
| 1458 | 1458 | { |
| 1459 | 1459 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
| 1460 | 1460 | } |
@@ -1470,7 +1470,7 @@ discard block |
||
| 1470 | 1470 | */ |
| 1471 | 1471 | function json_encode2($data) |
| 1472 | 1472 | { |
| 1473 | - switch(gettype($data)) |
|
| 1473 | + switch (gettype($data)) |
|
| 1474 | 1474 | { |
| 1475 | 1475 | case 'boolean': |
| 1476 | 1476 | return $data ? 'true' : 'false'; |
@@ -1478,15 +1478,15 @@ discard block |
||
| 1478 | 1478 | case 'double': |
| 1479 | 1479 | return $data; |
| 1480 | 1480 | case 'string': |
| 1481 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
| 1481 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
| 1482 | 1482 | case 'object': |
| 1483 | 1483 | $data = get_object_vars($data); |
| 1484 | 1484 | case 'array': |
| 1485 | 1485 | $rel = FALSE; // relative array? |
| 1486 | 1486 | $key = array_keys($data); |
| 1487 | - foreach($key as $v) |
|
| 1487 | + foreach ($key as $v) |
|
| 1488 | 1488 | { |
| 1489 | - if(!is_int($v)) |
|
| 1489 | + if (!is_int($v)) |
|
| 1490 | 1490 | { |
| 1491 | 1491 | $rel = TRUE; |
| 1492 | 1492 | break; |
@@ -1494,12 +1494,12 @@ discard block |
||
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | $arr = array(); |
| 1497 | - foreach($data as $k => $v) |
|
| 1497 | + foreach ($data as $k => $v) |
|
| 1498 | 1498 | { |
| 1499 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
| 1499 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
| 1502 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
| 1503 | 1503 | default: |
| 1504 | 1504 | return '""'; |
| 1505 | 1505 | } |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | */ |
| 1514 | 1514 | function isCrawler($agent = NULL) |
| 1515 | 1515 | { |
| 1516 | - if(!$agent) |
|
| 1516 | + if (!$agent) |
|
| 1517 | 1517 | { |
| 1518 | 1518 | $agent = $_SERVER['HTTP_USER_AGENT']; |
| 1519 | 1519 | } |
@@ -1523,9 +1523,9 @@ discard block |
||
| 1523 | 1523 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
| 1524 | 1524 | ); |
| 1525 | 1525 | |
| 1526 | - foreach($check_agent as $str) |
|
| 1526 | + foreach ($check_agent as $str) |
|
| 1527 | 1527 | { |
| 1528 | - if(stristr($agent, $str) != FALSE) |
|
| 1528 | + if (stristr($agent, $str) != FALSE) |
|
| 1529 | 1529 | { |
| 1530 | 1530 | return TRUE; |
| 1531 | 1531 | } |
@@ -1543,7 +1543,7 @@ discard block |
||
| 1543 | 1543 | */ |
| 1544 | 1544 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
| 1545 | 1545 | { |
| 1546 | - if(!Context::get('is_logged')) |
|
| 1546 | + if (!Context::get('is_logged')) |
|
| 1547 | 1547 | { |
| 1548 | 1548 | return; |
| 1549 | 1549 | } |
@@ -1551,18 +1551,18 @@ discard block |
||
| 1551 | 1551 | $oModuleModel = getModel('module'); |
| 1552 | 1552 | $logged_info = Context::get('logged_info'); |
| 1553 | 1553 | |
| 1554 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1554 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1555 | 1555 | { |
| 1556 | - if($writer_member_srl) |
|
| 1556 | + if ($writer_member_srl) |
|
| 1557 | 1557 | { |
| 1558 | 1558 | $oMemberModel = getModel('member'); |
| 1559 | 1559 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
| 1560 | - if($member_info->is_admin == "Y") |
|
| 1560 | + if ($member_info->is_admin == "Y") |
|
| 1561 | 1561 | { |
| 1562 | 1562 | return; |
| 1563 | 1563 | } |
| 1564 | 1564 | } |
| 1565 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
| 1565 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
| 1566 | 1566 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
| 1567 | 1567 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
| 1568 | 1568 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1579,18 +1579,18 @@ discard block |
||
| 1579 | 1579 | function requirePear() |
| 1580 | 1580 | { |
| 1581 | 1581 | static $required = false; |
| 1582 | - if($required) |
|
| 1582 | + if ($required) |
|
| 1583 | 1583 | { |
| 1584 | 1584 | return; |
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1587 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1588 | 1588 | { |
| 1589 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
| 1589 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
| 1590 | 1590 | } |
| 1591 | 1591 | else |
| 1592 | 1592 | { |
| 1593 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
| 1593 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | $required = true; |
@@ -1598,7 +1598,7 @@ discard block |
||
| 1598 | 1598 | |
| 1599 | 1599 | function checkCSRF() |
| 1600 | 1600 | { |
| 1601 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1601 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1602 | 1602 | { |
| 1603 | 1603 | return FALSE; |
| 1604 | 1604 | } |
@@ -1606,9 +1606,9 @@ discard block |
||
| 1606 | 1606 | $default_url = Context::getDefaultUrl(); |
| 1607 | 1607 | $referer = $_SERVER["HTTP_REFERER"]; |
| 1608 | 1608 | |
| 1609 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1609 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1610 | 1610 | { |
| 1611 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1611 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1612 | 1612 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1613 | 1613 | $referer = $IDN->encode($referer); |
| 1614 | 1614 | } |
@@ -1619,9 +1619,9 @@ discard block |
||
| 1619 | 1619 | $oModuleModel = getModel('module'); |
| 1620 | 1620 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
| 1621 | 1621 | |
| 1622 | - if($siteModuleInfo->site_srl == 0) |
|
| 1622 | + if ($siteModuleInfo->site_srl == 0) |
|
| 1623 | 1623 | { |
| 1624 | - if($default_url['host'] !== $referer['host']) |
|
| 1624 | + if ($default_url['host'] !== $referer['host']) |
|
| 1625 | 1625 | { |
| 1626 | 1626 | return FALSE; |
| 1627 | 1627 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | else |
| 1630 | 1630 | { |
| 1631 | 1631 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
| 1632 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1632 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1633 | 1633 | { |
| 1634 | 1634 | return FALSE; |
| 1635 | 1635 | } |
@@ -1645,15 +1645,15 @@ discard block |
||
| 1645 | 1645 | */ |
| 1646 | 1646 | function recurciveExposureCheck(&$menu) |
| 1647 | 1647 | { |
| 1648 | - if(is_array($menu)) |
|
| 1648 | + if (is_array($menu)) |
|
| 1649 | 1649 | { |
| 1650 | - foreach($menu AS $key=>$value) |
|
| 1650 | + foreach ($menu AS $key=>$value) |
|
| 1651 | 1651 | { |
| 1652 | - if(!$value['isShow']) |
|
| 1652 | + if (!$value['isShow']) |
|
| 1653 | 1653 | { |
| 1654 | 1654 | unset($menu[$key]); |
| 1655 | 1655 | } |
| 1656 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
| 1656 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
| 1657 | 1657 | { |
| 1658 | 1658 | recurciveExposureCheck($menu[$key]['list']); |
| 1659 | 1659 | } |
@@ -1663,14 +1663,14 @@ discard block |
||
| 1663 | 1663 | |
| 1664 | 1664 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
| 1665 | 1665 | { |
| 1666 | - if($requestKey != $dbKey) |
|
| 1666 | + if ($requestKey != $dbKey) |
|
| 1667 | 1667 | { |
| 1668 | 1668 | $arrayUrl = parse_url(Context::get('success_return_url')); |
| 1669 | - if($arrayUrl['query']) |
|
| 1669 | + if ($arrayUrl['query']) |
|
| 1670 | 1670 | { |
| 1671 | 1671 | parse_str($arrayUrl['query'], $parsedStr); |
| 1672 | 1672 | |
| 1673 | - if(isset($parsedStr[$key])) |
|
| 1673 | + if (isset($parsedStr[$key])) |
|
| 1674 | 1674 | { |
| 1675 | 1675 | $parsedStr[$key] = $requestKey; |
| 1676 | 1676 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1713,14 +1713,14 @@ discard block |
||
| 1713 | 1713 | */ |
| 1714 | 1714 | function alertScript($msg) |
| 1715 | 1715 | { |
| 1716 | - if(!$msg) |
|
| 1716 | + if (!$msg) |
|
| 1717 | 1717 | { |
| 1718 | 1718 | return; |
| 1719 | 1719 | } |
| 1720 | 1720 | |
| 1721 | 1721 | echo '<script type="text/javascript"> |
| 1722 | 1722 | //<![CDATA[ |
| 1723 | -alert("' . $msg . '"); |
|
| 1723 | +alert("' . $msg.'"); |
|
| 1724 | 1724 | //]]> |
| 1725 | 1725 | </script>'; |
| 1726 | 1726 | } |
@@ -1751,7 +1751,7 @@ discard block |
||
| 1751 | 1751 | |
| 1752 | 1752 | echo '<script type="text/javascript"> |
| 1753 | 1753 | //<![CDATA[ |
| 1754 | -' . $reloadScript . ' |
|
| 1754 | +' . $reloadScript.' |
|
| 1755 | 1755 | //]]> |
| 1756 | 1756 | </script>'; |
| 1757 | 1757 | } |
@@ -296,10 +296,11 @@ discard block |
||
| 296 | 296 | $num_args = func_num_args(); |
| 297 | 297 | $args_list = func_get_args(); |
| 298 | 298 | |
| 299 | - if($num_args) |
|
| 300 | - $url = Context::getUrl($num_args, $args_list); |
|
| 301 | - else |
|
| 302 | - $url = Context::getRequestUri(); |
|
| 299 | + if($num_args) { |
|
| 300 | + $url = Context::getUrl($num_args, $args_list); |
|
| 301 | + } else { |
|
| 302 | + $url = Context::getRequestUri(); |
|
| 303 | + } |
|
| 303 | 304 | |
| 304 | 305 | return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url); |
| 305 | 306 | } |
@@ -318,8 +319,7 @@ discard block |
||
| 318 | 319 | if($num_args) |
| 319 | 320 | { |
| 320 | 321 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 321 | - } |
|
| 322 | - else |
|
| 322 | + } else |
|
| 323 | 323 | { |
| 324 | 324 | $url = Context::getRequestUri(); |
| 325 | 325 | } |
@@ -341,8 +341,7 @@ discard block |
||
| 341 | 341 | if($num_args) |
| 342 | 342 | { |
| 343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
| 344 | - } |
|
| 345 | - else |
|
| 344 | + } else |
|
| 346 | 345 | { |
| 347 | 346 | $url = Context::getRequestUri(); |
| 348 | 347 | } |
@@ -531,13 +530,11 @@ discard block |
||
| 531 | 530 | { |
| 532 | 531 | $char_width += (int) $chars[$c - 32]; |
| 533 | 532 | $idx++; |
| 534 | - } |
|
| 535 | - else if(191 < $c && $c < 224) |
|
| 533 | + } else if(191 < $c && $c < 224) |
|
| 536 | 534 | { |
| 537 | 535 | $char_width += $chars[4]; |
| 538 | 536 | $idx += 2; |
| 539 | - } |
|
| 540 | - else |
|
| 537 | + } else |
|
| 541 | 538 | { |
| 542 | 539 | $char_width += $chars[0]; |
| 543 | 540 | $idx += 3; |
@@ -564,8 +561,7 @@ discard block |
||
| 564 | 561 | if($time_zone < 0) |
| 565 | 562 | { |
| 566 | 563 | $to = -1; |
| 567 | - } |
|
| 568 | - else |
|
| 564 | + } else |
|
| 569 | 565 | { |
| 570 | 566 | $to = 1; |
| 571 | 567 | } |
@@ -577,8 +573,7 @@ discard block |
||
| 577 | 573 | if($server_time_zone < 0) |
| 578 | 574 | { |
| 579 | 575 | $so = -1; |
| 580 | - } |
|
| 581 | - else |
|
| 576 | + } else |
|
| 582 | 577 | { |
| 583 | 578 | $so = 1; |
| 584 | 579 | } |
@@ -615,8 +610,7 @@ discard block |
||
| 615 | 610 | if(strlen($str) <= 8) |
| 616 | 611 | { |
| 617 | 612 | $gap = 0; |
| 618 | - } |
|
| 619 | - else |
|
| 613 | + } else |
|
| 620 | 614 | { |
| 621 | 615 | $gap = zgap(); |
| 622 | 616 | } |
@@ -639,20 +633,16 @@ discard block |
||
| 639 | 633 | if($gap < 60) |
| 640 | 634 | { |
| 641 | 635 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
| 642 | - } |
|
| 643 | - elseif($gap < 60 * 60) |
|
| 636 | + } elseif($gap < 60 * 60) |
|
| 644 | 637 | { |
| 645 | 638 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
| 646 | - } |
|
| 647 | - elseif($gap < 60 * 60 * 2) |
|
| 639 | + } elseif($gap < 60 * 60 * 2) |
|
| 648 | 640 | { |
| 649 | 641 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
| 650 | - } |
|
| 651 | - elseif($gap < 60 * 60 * 24) |
|
| 642 | + } elseif($gap < 60 * 60 * 24) |
|
| 652 | 643 | { |
| 653 | 644 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
| 654 | - } |
|
| 655 | - else |
|
| 645 | + } else |
|
| 656 | 646 | { |
| 657 | 647 | $buff = zdate($date, $format); |
| 658 | 648 | } |
@@ -699,12 +689,10 @@ discard block |
||
| 699 | 689 | if($format == 'Y-m-d') |
| 700 | 690 | { |
| 701 | 691 | $format = 'M d, Y'; |
| 702 | - } |
|
| 703 | - elseif($format == 'Y-m-d H:i:s') |
|
| 692 | + } elseif($format == 'Y-m-d H:i:s') |
|
| 704 | 693 | { |
| 705 | 694 | $format = 'M d, Y H:i:s'; |
| 706 | - } |
|
| 707 | - elseif($format == 'Y-m-d H:i') |
|
| 695 | + } elseif($format == 'Y-m-d H:i') |
|
| 708 | 696 | { |
| 709 | 697 | $format = 'M d, Y H:i'; |
| 710 | 698 | } |
@@ -713,12 +701,10 @@ discard block |
||
| 713 | 701 | if($format == 'Y-m-d') |
| 714 | 702 | { |
| 715 | 703 | $format = 'd-m-Y'; |
| 716 | - } |
|
| 717 | - elseif($format == 'Y-m-d H:i:s') |
|
| 704 | + } elseif($format == 'Y-m-d H:i:s') |
|
| 718 | 705 | { |
| 719 | 706 | $format = 'H:i:s d-m-Y'; |
| 720 | - } |
|
| 721 | - elseif($format == 'Y-m-d H:i') |
|
| 707 | + } elseif($format == 'Y-m-d H:i') |
|
| 722 | 708 | { |
| 723 | 709 | $format = 'H:i d-m-Y'; |
| 724 | 710 | } |
@@ -754,8 +740,7 @@ discard block |
||
| 754 | 740 | ); |
| 755 | 741 | |
| 756 | 742 | $string = strtr($format, $trans); |
| 757 | - } |
|
| 758 | - else |
|
| 743 | + } else |
|
| 759 | 744 | { |
| 760 | 745 | // if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. |
| 761 | 746 | $string = date($format, ztime($str)); |
@@ -842,8 +827,7 @@ discard block |
||
| 842 | 827 | } |
| 843 | 828 | |
| 844 | 829 | $firephp->fb($debug_output, $label, $type); |
| 845 | - } |
|
| 846 | - else |
|
| 830 | + } else |
|
| 847 | 831 | { |
| 848 | 832 | if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
| 849 | 833 | { |
@@ -851,9 +835,13 @@ discard block |
||
| 851 | 835 | } |
| 852 | 836 | |
| 853 | 837 | $print = array(); |
| 854 | - if(!$debug_file) $debug_file = _XE_PATH_ . 'files/' . $file; |
|
| 838 | + if(!$debug_file) { |
|
| 839 | + $debug_file = _XE_PATH_ . 'files/' . $file; |
|
| 840 | + } |
|
| 855 | 841 | $debug_file_exist = file_exists($debug_file); |
| 856 | - if(!$debug_file_exist) $print[] = '<?php exit() ?>'; |
|
| 842 | + if(!$debug_file_exist) { |
|
| 843 | + $print[] = '<?php exit() ?>'; |
|
| 844 | + } |
|
| 857 | 845 | |
| 858 | 846 | if($display_option === TRUE || $display_option === 'ERROR') |
| 859 | 847 | { |
@@ -864,8 +852,7 @@ discard block |
||
| 864 | 852 | if(!in_array($type, array('array', 'object', 'resource'))) |
| 865 | 853 | { |
| 866 | 854 | $print[] = 'DEBUG : ' . var_export($debug_output, TRUE); |
| 867 | - } |
|
| 868 | - else |
|
| 855 | + } else |
|
| 869 | 856 | { |
| 870 | 857 | $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
| 871 | 858 | } |
@@ -892,7 +879,9 @@ discard block |
||
| 892 | 879 | */ |
| 893 | 880 | function writeSlowlog($type, $elapsed_time, $obj) |
| 894 | 881 | { |
| 895 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 882 | + if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) { |
|
| 883 | + return; |
|
| 884 | + } |
|
| 896 | 885 | |
| 897 | 886 | static $log_filename = array( |
| 898 | 887 | 'query' => 'files/_slowlog_query.php', |
@@ -912,25 +901,21 @@ discard block |
||
| 912 | 901 | { |
| 913 | 902 | $buff[] = "\tCaller : " . $obj->caller; |
| 914 | 903 | $buff[] = "\tCalled : " . $obj->called; |
| 915 | - } |
|
| 916 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 904 | + } else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 917 | 905 | { |
| 918 | 906 | $buff[] = "\tAddon : " . $obj->called; |
| 919 | 907 | $buff[] = "\tCalled position : " . $obj->caller; |
| 920 | - } |
|
| 921 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 908 | + } else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 922 | 909 | { |
| 923 | 910 | $buff[] = "\tWidget : " . $obj->called; |
| 924 | - } |
|
| 925 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 911 | + } else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 926 | 912 | { |
| 927 | 913 | |
| 928 | 914 | $buff[] = $obj->query; |
| 929 | 915 | $buff[] = "\tQuery ID : " . $obj->query_id; |
| 930 | 916 | $buff[] = "\tCaller : " . $obj->caller; |
| 931 | 917 | $buff[] = "\tConnection : " . $obj->connection; |
| 932 | - } |
|
| 933 | - else |
|
| 918 | + } else |
|
| 934 | 919 | { |
| 935 | 920 | $write_file = false; |
| 936 | 921 | } |
@@ -1022,8 +1007,11 @@ discard block |
||
| 1022 | 1007 | |
| 1023 | 1008 | foreach($del_vars as $var) |
| 1024 | 1009 | { |
| 1025 | - if(is_array($vars)) unset($vars[$var]); |
|
| 1026 | - else if(is_object($vars)) unset($vars->$var); |
|
| 1010 | + if(is_array($vars)) { |
|
| 1011 | + unset($vars[$var]); |
|
| 1012 | + } else if(is_object($vars)) { |
|
| 1013 | + unset($vars->$var); |
|
| 1014 | + } |
|
| 1027 | 1015 | } |
| 1028 | 1016 | |
| 1029 | 1017 | return $vars; |
@@ -1160,8 +1148,7 @@ discard block |
||
| 1160 | 1148 | if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
| 1161 | 1149 | { |
| 1162 | 1150 | $content .= '</xmp>'; |
| 1163 | - } |
|
| 1164 | - else if($close_xmp < $start_xmp) |
|
| 1151 | + } else if($close_xmp < $start_xmp) |
|
| 1165 | 1152 | { |
| 1166 | 1153 | $content .= '</xmp>'; |
| 1167 | 1154 | } |
@@ -1218,12 +1205,18 @@ discard block |
||
| 1218 | 1205 | |
| 1219 | 1206 | $filter_arrts = array('style', 'src', 'href'); |
| 1220 | 1207 | |
| 1221 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1222 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1208 | + if($tag === 'object') { |
|
| 1209 | + array_push($filter_arrts, 'data'); |
|
| 1210 | + } |
|
| 1211 | + if($tag === 'param') { |
|
| 1212 | + array_push($filter_arrts, 'value'); |
|
| 1213 | + } |
|
| 1223 | 1214 | |
| 1224 | 1215 | foreach($filter_arrts as $attr) |
| 1225 | 1216 | { |
| 1226 | - if(!isset($attrs[$attr])) continue; |
|
| 1217 | + if(!isset($attrs[$attr])) { |
|
| 1218 | + continue; |
|
| 1219 | + } |
|
| 1227 | 1220 | |
| 1228 | 1221 | $attr_value = rawurldecode($attrs[$attr]); |
| 1229 | 1222 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
@@ -1386,16 +1379,14 @@ discard block |
||
| 1386 | 1379 | $unicode = hexdec($unicodeHexVal); |
| 1387 | 1380 | $decodedStr .= _code2utf($unicode); |
| 1388 | 1381 | $pos += 4; |
| 1389 | - } |
|
| 1390 | - else |
|
| 1382 | + } else |
|
| 1391 | 1383 | { |
| 1392 | 1384 | // we have an escaped ascii character |
| 1393 | 1385 | $hexVal = substr($source, $pos, 2); |
| 1394 | 1386 | $decodedStr .= chr(hexdec($hexVal)); |
| 1395 | 1387 | $pos += 2; |
| 1396 | 1388 | } |
| 1397 | - } |
|
| 1398 | - else |
|
| 1389 | + } else |
|
| 1399 | 1390 | { |
| 1400 | 1391 | $decodedStr .= $charAt; |
| 1401 | 1392 | $pos++; |
@@ -1587,8 +1578,7 @@ discard block |
||
| 1587 | 1578 | if(version_compare(PHP_VERSION, "5.3.0") < 0) |
| 1588 | 1579 | { |
| 1589 | 1580 | set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
| 1590 | - } |
|
| 1591 | - else |
|
| 1581 | + } else |
|
| 1592 | 1582 | { |
| 1593 | 1583 | set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
| 1594 | 1584 | } |
@@ -1625,8 +1615,7 @@ discard block |
||
| 1625 | 1615 | { |
| 1626 | 1616 | return FALSE; |
| 1627 | 1617 | } |
| 1628 | - } |
|
| 1629 | - else |
|
| 1618 | + } else |
|
| 1630 | 1619 | { |
| 1631 | 1620 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
| 1632 | 1621 | if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |