@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 205 | 205 | { |
| 206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 207 | 207 | |
| 208 | 208 | // If content is not XML JSON, unset |
| 209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 210 | 210 | { |
| 211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $this->_setUploadedArgument(); |
| 229 | 229 | |
| 230 | 230 | $this->loadDBInfo(); |
| 231 | - if($this->db_info->use_sitelock == 'Y') |
|
| 231 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 234 | 234 | |
| 235 | - if(!IpFilter::filter($whitelist)) |
|
| 235 | + if (!IpFilter::filter($whitelist)) |
|
| 236 | 236 | { |
| 237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
| 242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 243 | 243 | |
| 244 | 244 | header("HTTP/1.1 403 Forbidden"); |
| 245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
| 246 | 246 | { |
| 247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
| 247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
| 251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
| 252 | 252 | } |
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // If XE is installed, get virtual site information |
| 258 | - if(self::isInstalled()) |
|
| 258 | + if (self::isInstalled()) |
|
| 259 | 259 | { |
| 260 | 260 | $oModuleModel = getModel('module'); |
| 261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 262 | 262 | |
| 263 | - if(!isset($site_module_info)) |
|
| 263 | + if (!isset($site_module_info)) |
|
| 264 | 264 | { |
| 265 | 265 | $site_module_info = new stdClass(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 270 | 270 | { |
| 271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->set('site_module_info', $site_module_info); |
| 275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 276 | 276 | { |
| 277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if(!isset($this->db_info)) |
|
| 280 | + if (!isset($this->db_info)) |
|
| 281 | 281 | { |
| 282 | 282 | $this->db_info = new stdClass(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
| 286 | - if(!$this->db_info->lang_type) |
|
| 286 | + if (!$this->db_info->lang_type) |
|
| 287 | 287 | { |
| 288 | 288 | $this->db_info->lang_type = 'en'; |
| 289 | 289 | } |
| 290 | - if(!$this->db_info->use_db_session) |
|
| 290 | + if (!$this->db_info->use_db_session) |
|
| 291 | 291 | { |
| 292 | 292 | $this->db_info->use_db_session = 'N'; |
| 293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | $lang_supported = $this->loadLangSelected(); |
| 298 | 298 | |
| 299 | 299 | // Retrieve language type set in user's cookie |
| 300 | - if($this->lang_type = $this->get('l')) |
|
| 300 | + if ($this->lang_type = $this->get('l')) |
|
| 301 | 301 | { |
| 302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 303 | 303 | { |
| 304 | 304 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + elseif ($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // If it's not exists, follow default language type set in db_info |
| 313 | - if(!$this->lang_type) |
|
| 313 | + if (!$this->lang_type) |
|
| 314 | 314 | { |
| 315 | 315 | $this->lang_type = $this->db_info->lang_type; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
| 319 | - if(!$this->lang_type) |
|
| 319 | + if (!$this->lang_type) |
|
| 320 | 320 | { |
| 321 | 321 | $this->lang_type = 'en'; |
| 322 | 322 | } |
| 323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 324 | 324 | { |
| 325 | 325 | $this->lang_type = 'en'; |
| 326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | $this->setLangType($this->lang_type); |
| 330 | 330 | |
| 331 | 331 | // load module module's language file according to language setting |
| 332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
| 332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
| 333 | 333 | |
| 334 | 334 | // set session handler |
| 335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 336 | 336 | { |
| 337 | 337 | $oSessionModel = getModel('session'); |
| 338 | 338 | $oSessionController = getController('session'); |
@@ -341,11 +341,11 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | 345 | session_start(); |
| 346 | 346 | |
| 347 | 347 | // set authentication information in Context and session |
| 348 | - if(self::isInstalled()) |
|
| 348 | + if (self::isInstalled()) |
|
| 349 | 349 | { |
| 350 | 350 | $oModuleModel = getModel('module'); |
| 351 | 351 | $oModuleModel->loadModuleExtends(); |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | $oMemberModel = getModel('member'); |
| 354 | 354 | $oMemberController = getController('member'); |
| 355 | 355 | |
| 356 | - if($oMemberController && $oMemberModel) |
|
| 356 | + if ($oMemberController && $oMemberModel) |
|
| 357 | 357 | { |
| 358 | 358 | // if signed in, validate it. |
| 359 | - if($oMemberModel->isLogged()) |
|
| 359 | + if ($oMemberModel->isLogged()) |
|
| 360 | 360 | { |
| 361 | 361 | $oMemberController->setSessionInfo(); |
| 362 | 362 | } |
| 363 | 363 | // check auto sign-in |
| 364 | - elseif($_COOKIE['xeak']) |
|
| 364 | + elseif ($_COOKIE['xeak']) |
|
| 365 | 365 | { |
| 366 | 366 | $oMemberController->doAutologin(); |
| 367 | 367 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | // load common language file |
| 375 | 375 | $this->lang = &$GLOBALS['lang']; |
| 376 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
| 376 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
| 377 | 377 | |
| 378 | 378 | // check if using rewrite module |
| 379 | 379 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -381,28 +381,28 @@ discard block |
||
| 381 | 381 | // set locations for javascript use |
| 382 | 382 | $url = array(); |
| 383 | 383 | $current_url = self::getRequestUri(); |
| 384 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 384 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 385 | 385 | { |
| 386 | - if($this->get_vars) |
|
| 386 | + if ($this->get_vars) |
|
| 387 | 387 | { |
| 388 | 388 | $url = array(); |
| 389 | - foreach($this->get_vars as $key => $val) |
|
| 389 | + foreach ($this->get_vars as $key => $val) |
|
| 390 | 390 | { |
| 391 | - if(is_array($val) && count($val) > 0) |
|
| 391 | + if (is_array($val) && count($val) > 0) |
|
| 392 | 392 | { |
| 393 | - foreach($val as $k => $v) |
|
| 393 | + foreach ($val as $k => $v) |
|
| 394 | 394 | { |
| 395 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 395 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | - elseif($val) |
|
| 398 | + elseif ($val) |
|
| 399 | 399 | { |
| 400 | - $url[] = $key . '=' . urlencode($val); |
|
| 400 | + $url[] = $key.'='.urlencode($val); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 405 | + if ($url) $current_url .= '?'.join('&', $url); |
|
| 406 | 406 | } |
| 407 | 407 | else |
| 408 | 408 | { |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | $this->set('current_url', $current_url); |
| 418 | 418 | $this->set('request_uri', self::getRequestUri()); |
| 419 | 419 | |
| 420 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 420 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 421 | 421 | { |
| 422 | 422 | $this->set('current_url', self::decodeIdna($current_url)); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 425 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 426 | 426 | { |
| 427 | 427 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 428 | 428 | } |
@@ -447,19 +447,19 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | $self = self::getInstance(); |
| 449 | 449 | |
| 450 | - if(!$self->isInstalled()) |
|
| 450 | + if (!$self->isInstalled()) |
|
| 451 | 451 | { |
| 452 | 452 | return; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $config_file = $self->getConfigFile(); |
| 456 | - if(is_readable($config_file)) |
|
| 456 | + if (is_readable($config_file)) |
|
| 457 | 457 | { |
| 458 | 458 | include($config_file); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // If master_db information does not exist, the config file needs to be updated |
| 462 | - if(!isset($db_info->master_db)) |
|
| 462 | + if (!isset($db_info->master_db)) |
|
| 463 | 463 | { |
| 464 | 464 | $db_info->master_db = array(); |
| 465 | 465 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 478 | 478 | unset($db_info->db_table_prefix); |
| 479 | 479 | |
| 480 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 480 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 481 | 481 | { |
| 482 | 482 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 483 | 483 | } |
@@ -489,33 +489,33 @@ discard block |
||
| 489 | 489 | $oInstallController->makeConfigFile(); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(!$db_info->use_prepared_statements) |
|
| 492 | + if (!$db_info->use_prepared_statements) |
|
| 493 | 493 | { |
| 494 | 494 | $db_info->use_prepared_statements = 'Y'; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - if(!$db_info->time_zone) |
|
| 497 | + if (!$db_info->time_zone) |
|
| 498 | 498 | $db_info->time_zone = date('O'); |
| 499 | 499 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 500 | 500 | |
| 501 | - if($db_info->qmail_compatibility != 'Y') |
|
| 501 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 502 | 502 | $db_info->qmail_compatibility = 'N'; |
| 503 | 503 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 504 | 504 | |
| 505 | - if(!$db_info->use_db_session) |
|
| 505 | + if (!$db_info->use_db_session) |
|
| 506 | 506 | $db_info->use_db_session = 'N'; |
| 507 | - if(!$db_info->use_ssl) |
|
| 507 | + if (!$db_info->use_ssl) |
|
| 508 | 508 | $db_info->use_ssl = 'none'; |
| 509 | 509 | $this->set('_use_ssl', $db_info->use_ssl); |
| 510 | 510 | |
| 511 | 511 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 512 | 512 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 513 | 513 | |
| 514 | - if(!$db_info->sitelock_whitelist) { |
|
| 514 | + if (!$db_info->sitelock_whitelist) { |
|
| 515 | 515 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 518 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 519 | 519 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 520 | 520 | } |
| 521 | 521 | |
@@ -586,10 +586,10 @@ discard block |
||
| 586 | 586 | function loadLangSupported() |
| 587 | 587 | { |
| 588 | 588 | static $lang_supported = null; |
| 589 | - if(!$lang_supported) |
|
| 589 | + if (!$lang_supported) |
|
| 590 | 590 | { |
| 591 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 592 | - foreach($langs as $val) |
|
| 591 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 592 | + foreach ($langs as $val) |
|
| 593 | 593 | { |
| 594 | 594 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 595 | 595 | $lang_text = trim($lang_text); |
@@ -607,17 +607,17 @@ discard block |
||
| 607 | 607 | function loadLangSelected() |
| 608 | 608 | { |
| 609 | 609 | static $lang_selected = null; |
| 610 | - if(!$lang_selected) |
|
| 610 | + if (!$lang_selected) |
|
| 611 | 611 | { |
| 612 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 613 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 614 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 612 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 613 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 614 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 615 | 615 | { |
| 616 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 616 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 617 | 617 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 620 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 621 | 621 | { |
| 622 | 622 | $buff = FileHandler::readFile($orig_lang_file); |
| 623 | 623 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | else |
| 627 | 627 | { |
| 628 | 628 | $langs = file($selected_lang_file); |
| 629 | - foreach($langs as $val) |
|
| 629 | + foreach ($langs as $val) |
|
| 630 | 630 | { |
| 631 | 631 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 632 | 632 | $lang_text = trim($lang_text); |
@@ -645,44 +645,44 @@ discard block |
||
| 645 | 645 | function checkSSO() |
| 646 | 646 | { |
| 647 | 647 | // pass if it's not GET request or XE is not yet installed |
| 648 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 648 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 649 | 649 | { |
| 650 | 650 | return TRUE; |
| 651 | 651 | } |
| 652 | 652 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 653 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 653 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 654 | 654 | { |
| 655 | 655 | return TRUE; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // pass if default URL is not set |
| 659 | 659 | $default_url = trim($this->db_info->default_url); |
| 660 | - if(!$default_url) |
|
| 660 | + if (!$default_url) |
|
| 661 | 661 | { |
| 662 | 662 | return TRUE; |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 665 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 666 | 666 | { |
| 667 | 667 | $default_url .= '/'; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | // for sites recieving SSO valdiation |
| 671 | - if($default_url == self::getRequestUri()) |
|
| 671 | + if ($default_url == self::getRequestUri()) |
|
| 672 | 672 | { |
| 673 | - if(self::get('url')) |
|
| 673 | + if (self::get('url')) |
|
| 674 | 674 | { |
| 675 | 675 | $url = base64_decode(self::get('url')); |
| 676 | 676 | $url_info = parse_url($url); |
| 677 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 677 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 678 | 678 | { |
| 679 | 679 | echo self::get('lang')->msg_invalid_request; |
| 680 | 680 | return false; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 684 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 685 | - header('location:' . $redirect_url); |
|
| 683 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 684 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 685 | + header('location:'.$redirect_url); |
|
| 686 | 686 | |
| 687 | 687 | return FALSE; |
| 688 | 688 | } |
@@ -691,9 +691,9 @@ discard block |
||
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | 693 | // result handling : set session_name() |
| 694 | - if($session_name = self::get('SSOID')) |
|
| 694 | + if ($session_name = self::get('SSOID')) |
|
| 695 | 695 | { |
| 696 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 696 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 697 | 697 | { |
| 698 | 698 | echo self::get('lang')->msg_invalid_request; |
| 699 | 699 | return false; |
@@ -702,17 +702,17 @@ discard block |
||
| 702 | 702 | setcookie(session_name(), $session_name); |
| 703 | 703 | |
| 704 | 704 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 705 | - header('location:' . $url); |
|
| 705 | + header('location:'.$url); |
|
| 706 | 706 | return FALSE; |
| 707 | 707 | // send SSO request |
| 708 | 708 | } |
| 709 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 709 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 710 | 710 | { |
| 711 | 711 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 712 | 712 | $origin_url = self::getRequestUrl(); |
| 713 | 713 | $origin_sig = Password::createSignature($origin_url); |
| 714 | 714 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 715 | - header('location:' . $url); |
|
| 715 | + header('location:'.$url); |
|
| 716 | 716 | return FALSE; |
| 717 | 717 | } |
| 718 | 718 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | { |
| 740 | 740 | $self = self::getInstance(); |
| 741 | 741 | |
| 742 | - if(!$self->isFTPRegisted()) |
|
| 742 | + if (!$self->isFTPRegisted()) |
|
| 743 | 743 | { |
| 744 | 744 | return null; |
| 745 | 745 | } |
@@ -757,15 +757,15 @@ discard block |
||
| 757 | 757 | */ |
| 758 | 758 | function addBrowserTitle($site_title) |
| 759 | 759 | { |
| 760 | - if(!$site_title) |
|
| 760 | + if (!$site_title) |
|
| 761 | 761 | { |
| 762 | 762 | return; |
| 763 | 763 | } |
| 764 | 764 | $self = self::getInstance(); |
| 765 | 765 | |
| 766 | - if($self->site_title) |
|
| 766 | + if ($self->site_title) |
|
| 767 | 767 | { |
| 768 | - $self->site_title .= ' - ' . $site_title; |
|
| 768 | + $self->site_title .= ' - '.$site_title; |
|
| 769 | 769 | } |
| 770 | 770 | else |
| 771 | 771 | { |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function setBrowserTitle($site_title) |
| 783 | 783 | { |
| 784 | - if(!$site_title) |
|
| 784 | + if (!$site_title) |
|
| 785 | 785 | { |
| 786 | 786 | return; |
| 787 | 787 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | $oModuleModel = getModel('module'); |
| 814 | 814 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 815 | 815 | |
| 816 | - if(isset($moduleConfig->siteTitle)) |
|
| 816 | + if (isset($moduleConfig->siteTitle)) |
|
| 817 | 817 | { |
| 818 | 818 | return $moduleConfig->siteTitle; |
| 819 | 819 | } |
@@ -840,30 +840,30 @@ discard block |
||
| 840 | 840 | global $lang; |
| 841 | 841 | |
| 842 | 842 | $self = self::getInstance(); |
| 843 | - if(!$self->lang_type) |
|
| 843 | + if (!$self->lang_type) |
|
| 844 | 844 | { |
| 845 | 845 | return; |
| 846 | 846 | } |
| 847 | - if(!is_object($lang)) |
|
| 847 | + if (!is_object($lang)) |
|
| 848 | 848 | { |
| 849 | 849 | $lang = new stdClass; |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 852 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 853 | 853 | { |
| 854 | 854 | $filename = $self->_loadPhpLang($path); |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - if(!is_array($self->loaded_lang_files)) |
|
| 857 | + if (!is_array($self->loaded_lang_files)) |
|
| 858 | 858 | { |
| 859 | 859 | $self->loaded_lang_files = array(); |
| 860 | 860 | } |
| 861 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 861 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 862 | 862 | { |
| 863 | 863 | return; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | - if($filename && is_readable($filename)) |
|
| 866 | + if ($filename && is_readable($filename)) |
|
| 867 | 867 | { |
| 868 | 868 | $self->loaded_lang_files[] = $filename; |
| 869 | 869 | include($filename); |
@@ -884,24 +884,24 @@ discard block |
||
| 884 | 884 | { |
| 885 | 885 | global $lang; |
| 886 | 886 | |
| 887 | - if(!$path) return; |
|
| 887 | + if (!$path) return; |
|
| 888 | 888 | |
| 889 | - $_path = 'eval://' . $path; |
|
| 889 | + $_path = 'eval://'.$path; |
|
| 890 | 890 | |
| 891 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 891 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 892 | 892 | { |
| 893 | 893 | return; |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 896 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 897 | 897 | { |
| 898 | 898 | $path .= '/'; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 901 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 902 | 902 | $content = $oXmlLangParser->getCompileContent(); |
| 903 | 903 | |
| 904 | - if($content) |
|
| 904 | + if ($content) |
|
| 905 | 905 | { |
| 906 | 906 | $this->loaded_lang_files[] = $_path; |
| 907 | 907 | eval($content); |
@@ -916,9 +916,9 @@ discard block |
||
| 916 | 916 | */ |
| 917 | 917 | function _loadXmlLang($path) |
| 918 | 918 | { |
| 919 | - if(!$path) return; |
|
| 919 | + if (!$path) return; |
|
| 920 | 920 | |
| 921 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 921 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 922 | 922 | return $oXmlLangParser->compile(); |
| 923 | 923 | } |
| 924 | 924 | |
@@ -930,22 +930,22 @@ discard block |
||
| 930 | 930 | */ |
| 931 | 931 | function _loadPhpLang($path) |
| 932 | 932 | { |
| 933 | - if(!$path) return; |
|
| 933 | + if (!$path) return; |
|
| 934 | 934 | |
| 935 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 935 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 936 | 936 | { |
| 937 | 937 | $path .= '/'; |
| 938 | 938 | } |
| 939 | - $path_tpl = $path . '%s.lang.php'; |
|
| 939 | + $path_tpl = $path.'%s.lang.php'; |
|
| 940 | 940 | $file = sprintf($path_tpl, $this->lang_type); |
| 941 | 941 | |
| 942 | 942 | $langs = array('ko', 'en'); // this will be configurable. |
| 943 | - while(!is_readable($file) && $langs[0]) |
|
| 943 | + while (!is_readable($file) && $langs[0]) |
|
| 944 | 944 | { |
| 945 | 945 | $file = sprintf($path_tpl, array_shift($langs)); |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - if(!is_readable($file)) |
|
| 948 | + if (!is_readable($file)) |
|
| 949 | 949 | { |
| 950 | 950 | return FALSE; |
| 951 | 951 | } |
@@ -987,11 +987,11 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | function getLang($code) |
| 989 | 989 | { |
| 990 | - if(!$code) |
|
| 990 | + if (!$code) |
|
| 991 | 991 | { |
| 992 | 992 | return; |
| 993 | 993 | } |
| 994 | - if($GLOBALS['lang']->{$code}) |
|
| 994 | + if ($GLOBALS['lang']->{$code}) |
|
| 995 | 995 | { |
| 996 | 996 | return $GLOBALS['lang']->{$code}; |
| 997 | 997 | } |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | */ |
| 1008 | 1008 | function setLang($code, $val) |
| 1009 | 1009 | { |
| 1010 | - if(!isset($GLOBALS['lang'])) |
|
| 1010 | + if (!isset($GLOBALS['lang'])) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $GLOBALS['lang'] = new stdClass(); |
| 1013 | 1013 | } |
@@ -1035,17 +1035,17 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | $obj = clone $source_obj; |
| 1037 | 1037 | |
| 1038 | - foreach($charset_list as $charset) |
|
| 1038 | + foreach ($charset_list as $charset) |
|
| 1039 | 1039 | { |
| 1040 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1040 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1041 | 1041 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1042 | - if($flag) |
|
| 1042 | + if ($flag) |
|
| 1043 | 1043 | { |
| 1044 | - if($charset == 'UTF-8') |
|
| 1044 | + if ($charset == 'UTF-8') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | return $obj; |
| 1047 | 1047 | } |
| 1048 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1048 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1049 | 1049 | return $obj; |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
@@ -1064,11 +1064,11 @@ discard block |
||
| 1064 | 1064 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1065 | 1065 | { |
| 1066 | 1066 | static $flag = TRUE; |
| 1067 | - if($charset) |
|
| 1067 | + if ($charset) |
|
| 1068 | 1068 | { |
| 1069 | - if(is_array($val)) |
|
| 1070 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1071 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1069 | + if (is_array($val)) |
|
| 1070 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1071 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1072 | 1072 | else $flag = FALSE; |
| 1073 | 1073 | } |
| 1074 | 1074 | else |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | { |
| 1093 | 1093 | if (is_array($val)) |
| 1094 | 1094 | { |
| 1095 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1095 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1096 | 1096 | } |
| 1097 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1097 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | /** |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | function convertEncodingStr($str) |
| 1107 | 1107 | { |
| 1108 | - if(!$str) return null; |
|
| 1108 | + if (!$str) return null; |
|
| 1109 | 1109 | $obj = new stdClass(); |
| 1110 | 1110 | $obj->str = $str; |
| 1111 | 1111 | $obj = self::convertEncoding($obj); |
@@ -1114,9 +1114,9 @@ discard block |
||
| 1114 | 1114 | |
| 1115 | 1115 | function decodeIdna($domain) |
| 1116 | 1116 | { |
| 1117 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1117 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1118 | 1118 | { |
| 1119 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1119 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1120 | 1120 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1121 | 1121 | $domain = $IDN->decode($domain); |
| 1122 | 1122 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | { |
| 1148 | 1148 | $self = self::getInstance(); |
| 1149 | 1149 | |
| 1150 | - if($self->response_method) |
|
| 1150 | + if ($self->response_method) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | return $self->response_method; |
| 1153 | 1153 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1188 | 1188 | |
| 1189 | 1189 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1190 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1190 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1191 | 1191 | { |
| 1192 | 1192 | $this->isSuccessInit = FALSE; |
| 1193 | 1193 | } |
@@ -1200,30 +1200,30 @@ discard block |
||
| 1200 | 1200 | */ |
| 1201 | 1201 | function _setRequestArgument() |
| 1202 | 1202 | { |
| 1203 | - if(!count($_REQUEST)) |
|
| 1203 | + if (!count($_REQUEST)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | return; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | $requestMethod = $this->getRequestMethod(); |
| 1209 | - foreach($_REQUEST as $key => $val) |
|
| 1209 | + foreach ($_REQUEST as $key => $val) |
|
| 1210 | 1210 | { |
| 1211 | - if($val === '' || self::get($key)) |
|
| 1211 | + if ($val === '' || self::get($key)) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | continue; |
| 1214 | 1214 | } |
| 1215 | 1215 | $key = htmlentities($key); |
| 1216 | 1216 | $val = $this->_filterRequestVar($key, $val); |
| 1217 | 1217 | |
| 1218 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1218 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | $set_to_vars = TRUE; |
| 1221 | 1221 | } |
| 1222 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1222 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1223 | 1223 | { |
| 1224 | 1224 | $set_to_vars = TRUE; |
| 1225 | 1225 | } |
| 1226 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1226 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | $set_to_vars = TRUE; |
| 1229 | 1229 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | $set_to_vars = FALSE; |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | - if($set_to_vars) |
|
| 1235 | + if ($set_to_vars) |
|
| 1236 | 1236 | { |
| 1237 | 1237 | $this->_recursiveCheckVar($val); |
| 1238 | 1238 | } |
@@ -1243,20 +1243,20 @@ discard block |
||
| 1243 | 1243 | |
| 1244 | 1244 | function _recursiveCheckVar($val) |
| 1245 | 1245 | { |
| 1246 | - if(is_string($val)) |
|
| 1246 | + if (is_string($val)) |
|
| 1247 | 1247 | { |
| 1248 | - foreach($this->patterns as $pattern) |
|
| 1248 | + foreach ($this->patterns as $pattern) |
|
| 1249 | 1249 | { |
| 1250 | - if(preg_match($pattern, $val)) |
|
| 1250 | + if (preg_match($pattern, $val)) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | $this->isSuccessInit = FALSE; |
| 1253 | 1253 | return; |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
| 1256 | 1256 | } |
| 1257 | - else if(is_array($val)) |
|
| 1257 | + else if (is_array($val)) |
|
| 1258 | 1258 | { |
| 1259 | - foreach($val as $val2) |
|
| 1259 | + foreach ($val as $val2) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | $this->_recursiveCheckVar($val2); |
| 1262 | 1262 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | */ |
| 1271 | 1271 | function _setJSONRequestArgument() |
| 1272 | 1272 | { |
| 1273 | - if($this->getRequestMethod() != 'JSON') |
|
| 1273 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1274 | 1274 | { |
| 1275 | 1275 | return; |
| 1276 | 1276 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | $params = array(); |
| 1279 | 1279 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1280 | 1280 | |
| 1281 | - foreach($params as $key => $val) |
|
| 1281 | + foreach ($params as $key => $val) |
|
| 1282 | 1282 | { |
| 1283 | 1283 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
| 1284 | 1284 | } |
@@ -1291,13 +1291,13 @@ discard block |
||
| 1291 | 1291 | */ |
| 1292 | 1292 | function _setXmlRpcArgument() |
| 1293 | 1293 | { |
| 1294 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1294 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1295 | 1295 | { |
| 1296 | 1296 | return; |
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1300 | - if(Security::detectingXEE($xml)) |
|
| 1300 | + if (Security::detectingXEE($xml)) |
|
| 1301 | 1301 | { |
| 1302 | 1302 | header("HTTP/1.0 400 Bad Request"); |
| 1303 | 1303 | exit; |
@@ -1309,12 +1309,12 @@ discard block |
||
| 1309 | 1309 | $params = $xml_obj->methodcall->params; |
| 1310 | 1310 | unset($params->node_name, $params->attrs, $params->body); |
| 1311 | 1311 | |
| 1312 | - if(!count(get_object_vars($params))) |
|
| 1312 | + if (!count(get_object_vars($params))) |
|
| 1313 | 1313 | { |
| 1314 | 1314 | return; |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | - foreach($params as $key => $val) |
|
| 1317 | + foreach ($params as $key => $val) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1320 | 1320 | } |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | */ |
| 1330 | 1330 | function _filterXmlVars($key, $val) |
| 1331 | 1331 | { |
| 1332 | - if(is_array($val)) |
|
| 1332 | + if (is_array($val)) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | $stack = array(); |
| 1335 | - foreach($val as $k => $v) |
|
| 1335 | + foreach ($val as $k => $v) |
|
| 1336 | 1336 | { |
| 1337 | 1337 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1338 | 1338 | } |
@@ -1342,20 +1342,20 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $body = $val->body; |
| 1344 | 1344 | unset($val->node_name, $val->attrs, $val->body); |
| 1345 | - if(!count(get_object_vars($val))) |
|
| 1345 | + if (!count(get_object_vars($val))) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | return $this->_filterRequestVar($key, $body, 0); |
| 1348 | 1348 | } |
| 1349 | 1349 | |
| 1350 | 1350 | $stack = new stdClass(); |
| 1351 | - foreach($val as $k => $v) |
|
| 1351 | + foreach ($val as $k => $v) |
|
| 1352 | 1352 | { |
| 1353 | 1353 | $output = $this->_filterXmlVars($k, $v); |
| 1354 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1354 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1355 | 1355 | { |
| 1356 | 1356 | $output = array($output); |
| 1357 | 1357 | } |
| 1358 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1358 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1359 | 1359 | { |
| 1360 | 1360 | return $output; |
| 1361 | 1361 | } |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | $stack->{$k} = $output; |
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | - if(!count(get_object_vars($stack))) |
|
| 1366 | + if (!count(get_object_vars($stack))) |
|
| 1367 | 1367 | { |
| 1368 | 1368 | return NULL; |
| 1369 | 1369 | } |
@@ -1382,32 +1382,32 @@ discard block |
||
| 1382 | 1382 | */ |
| 1383 | 1383 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
| 1384 | 1384 | { |
| 1385 | - if(!($isArray = is_array($val))) |
|
| 1385 | + if (!($isArray = is_array($val))) |
|
| 1386 | 1386 | { |
| 1387 | 1387 | $val = array($val); |
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | $result = array(); |
| 1391 | - foreach($val as $k => $v) |
|
| 1391 | + foreach ($val as $k => $v) |
|
| 1392 | 1392 | { |
| 1393 | 1393 | $k = htmlentities($k); |
| 1394 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1394 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1395 | 1395 | { |
| 1396 | 1396 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1397 | 1397 | } |
| 1398 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1398 | + elseif ($key === 'mid' || $key === 'search_keyword') |
|
| 1399 | 1399 | { |
| 1400 | 1400 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1401 | 1401 | } |
| 1402 | - elseif($key === 'vid') |
|
| 1402 | + elseif ($key === 'vid') |
|
| 1403 | 1403 | { |
| 1404 | 1404 | $result[$k] = urlencode($v); |
| 1405 | 1405 | } |
| 1406 | - elseif($key === 'xe_validator_id') |
|
| 1406 | + elseif ($key === 'xe_validator_id') |
|
| 1407 | 1407 | { |
| 1408 | 1408 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1409 | 1409 | } |
| 1410 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1410 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | unset($result[$k]); |
| 1413 | 1413 | } |
@@ -1415,12 +1415,12 @@ discard block |
||
| 1415 | 1415 | { |
| 1416 | 1416 | $result[$k] = $v; |
| 1417 | 1417 | |
| 1418 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1418 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1419 | 1419 | { |
| 1420 | 1420 | $result[$k] = stripslashes($result[$k]); |
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | - if(!is_array($result[$k])) |
|
| 1423 | + if (!is_array($result[$k])) |
|
| 1424 | 1424 | { |
| 1425 | 1425 | $result[$k] = trim($result[$k]); |
| 1426 | 1426 | } |
@@ -1448,17 +1448,17 @@ discard block |
||
| 1448 | 1448 | */ |
| 1449 | 1449 | function _setUploadedArgument() |
| 1450 | 1450 | { |
| 1451 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1451 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1452 | 1452 | { |
| 1453 | 1453 | return; |
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | - foreach($_FILES as $key => $val) |
|
| 1456 | + foreach ($_FILES as $key => $val) |
|
| 1457 | 1457 | { |
| 1458 | 1458 | $tmp_name = $val['tmp_name']; |
| 1459 | - if(!is_array($tmp_name)) |
|
| 1459 | + if (!is_array($tmp_name)) |
|
| 1460 | 1460 | { |
| 1461 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1461 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1462 | 1462 | { |
| 1463 | 1463 | continue; |
| 1464 | 1464 | } |
@@ -1468,9 +1468,9 @@ discard block |
||
| 1468 | 1468 | } |
| 1469 | 1469 | else |
| 1470 | 1470 | { |
| 1471 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1471 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1472 | 1472 | { |
| 1473 | - if($val['size'][$i] > 0) |
|
| 1473 | + if ($val['size'][$i] > 0) |
|
| 1474 | 1474 | { |
| 1475 | 1475 | $file['name'] = $val['name'][$i]; |
| 1476 | 1476 | $file['type'] = $val['type'][$i]; |
@@ -1502,16 +1502,16 @@ discard block |
||
| 1502 | 1502 | function getRequestUrl() |
| 1503 | 1503 | { |
| 1504 | 1504 | static $url = null; |
| 1505 | - if(is_null($url)) |
|
| 1505 | + if (is_null($url)) |
|
| 1506 | 1506 | { |
| 1507 | 1507 | $url = self::getRequestUri(); |
| 1508 | - if(count($_GET) > 0) |
|
| 1508 | + if (count($_GET) > 0) |
|
| 1509 | 1509 | { |
| 1510 | - foreach($_GET as $key => $val) |
|
| 1510 | + foreach ($_GET as $key => $val) |
|
| 1511 | 1511 | { |
| 1512 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1512 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1513 | 1513 | } |
| 1514 | - $url .= '?' . join('&', $vars); |
|
| 1514 | + $url .= '?'.join('&', $vars); |
|
| 1515 | 1515 | } |
| 1516 | 1516 | } |
| 1517 | 1517 | return $url; |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | $self = self::getInstance(); |
| 1527 | 1527 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1528 | 1528 | |
| 1529 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1529 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1530 | 1530 | { |
| 1531 | 1531 | unset($js_callback_func); |
| 1532 | 1532 | unset($_GET['xe_js_callback']); |
@@ -1554,22 +1554,22 @@ discard block |
||
| 1554 | 1554 | $self = self::getInstance(); |
| 1555 | 1555 | |
| 1556 | 1556 | // retrieve virtual site information |
| 1557 | - if(is_null($site_module_info)) |
|
| 1557 | + if (is_null($site_module_info)) |
|
| 1558 | 1558 | { |
| 1559 | 1559 | $site_module_info = self::get('site_module_info'); |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1563 | - if($domain && isSiteID($domain)) |
|
| 1563 | + if ($domain && isSiteID($domain)) |
|
| 1564 | 1564 | { |
| 1565 | 1565 | $vid = $domain; |
| 1566 | 1566 | $domain = ''; |
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | 1569 | // If $domain, $vid are not set, use current site information |
| 1570 | - if(!$domain && !$vid) |
|
| 1570 | + if (!$domain && !$vid) |
|
| 1571 | 1571 | { |
| 1572 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1572 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1573 | 1573 | { |
| 1574 | 1574 | $vid = $site_module_info->domain; |
| 1575 | 1575 | } |
@@ -1580,21 +1580,21 @@ discard block |
||
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1583 | - if($domain) |
|
| 1583 | + if ($domain) |
|
| 1584 | 1584 | { |
| 1585 | 1585 | $domain_info = parse_url($domain); |
| 1586 | - if(is_null($current_info)) |
|
| 1586 | + if (is_null($current_info)) |
|
| 1587 | 1587 | { |
| 1588 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1588 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1589 | 1589 | } |
| 1590 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1590 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1591 | 1591 | { |
| 1592 | 1592 | unset($domain); |
| 1593 | 1593 | } |
| 1594 | 1594 | else |
| 1595 | 1595 | { |
| 1596 | 1596 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1597 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1597 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1598 | 1598 | { |
| 1599 | 1599 | $domain .= '/'; |
| 1600 | 1600 | } |
@@ -1604,10 +1604,10 @@ discard block |
||
| 1604 | 1604 | $get_vars = array(); |
| 1605 | 1605 | |
| 1606 | 1606 | // If there is no GET variables or first argument is '' to reset variables |
| 1607 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1607 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1608 | 1608 | { |
| 1609 | 1609 | // rearrange args_list |
| 1610 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1610 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1611 | 1611 | { |
| 1612 | 1612 | array_shift($args_list); |
| 1613 | 1613 | } |
@@ -1619,13 +1619,13 @@ discard block |
||
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | // arrange args_list |
| 1622 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1622 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1623 | 1623 | { |
| 1624 | 1624 | $key = $args_list[$i]; |
| 1625 | 1625 | $val = trim($args_list[$i + 1]); |
| 1626 | 1626 | |
| 1627 | 1627 | // If value is not set, remove the key |
| 1628 | - if(!isset($val) || !strlen($val)) |
|
| 1628 | + if (!isset($val) || !strlen($val)) |
|
| 1629 | 1629 | { |
| 1630 | 1630 | unset($get_vars[$key]); |
| 1631 | 1631 | continue; |
@@ -1636,7 +1636,7 @@ discard block |
||
| 1636 | 1636 | |
| 1637 | 1637 | // remove vid, rnd |
| 1638 | 1638 | unset($get_vars['rnd']); |
| 1639 | - if($vid) |
|
| 1639 | + if ($vid) |
|
| 1640 | 1640 | { |
| 1641 | 1641 | $get_vars['vid'] = $vid; |
| 1642 | 1642 | } |
@@ -1653,17 +1653,17 @@ discard block |
||
| 1653 | 1653 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1654 | 1654 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1655 | 1655 | ); |
| 1656 | - if($act_alias[$act]) |
|
| 1656 | + if ($act_alias[$act]) |
|
| 1657 | 1657 | { |
| 1658 | 1658 | $get_vars['act'] = $act_alias[$act]; |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | // organize URL |
| 1662 | 1662 | $query = ''; |
| 1663 | - if(count($get_vars) > 0) |
|
| 1663 | + if (count($get_vars) > 0) |
|
| 1664 | 1664 | { |
| 1665 | 1665 | // if using rewrite mod |
| 1666 | - if($self->allow_rewrite) |
|
| 1666 | + if ($self->allow_rewrite) |
|
| 1667 | 1667 | { |
| 1668 | 1668 | $var_keys = array_keys($get_vars); |
| 1669 | 1669 | sort($var_keys); |
@@ -1683,8 +1683,8 @@ discard block |
||
| 1683 | 1683 | 'vid' => $vid, |
| 1684 | 1684 | 'mid' => $mid, |
| 1685 | 1685 | 'mid.vid' => "$vid/$mid", |
| 1686 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1687 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1686 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1687 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1688 | 1688 | 'document_srl' => $srl, |
| 1689 | 1689 | 'document_srl.mid' => "$mid/$srl", |
| 1690 | 1690 | 'document_srl.vid' => "$vid/$srl", |
@@ -1701,66 +1701,66 @@ discard block |
||
| 1701 | 1701 | $query = $target_map[$target]; |
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | - if(!$query) |
|
| 1704 | + if (!$query) |
|
| 1705 | 1705 | { |
| 1706 | 1706 | $queries = array(); |
| 1707 | - foreach($get_vars as $key => $val) |
|
| 1707 | + foreach ($get_vars as $key => $val) |
|
| 1708 | 1708 | { |
| 1709 | - if(is_array($val) && count($val) > 0) |
|
| 1709 | + if (is_array($val) && count($val) > 0) |
|
| 1710 | 1710 | { |
| 1711 | - foreach($val as $k => $v) |
|
| 1711 | + foreach ($val as $k => $v) |
|
| 1712 | 1712 | { |
| 1713 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1713 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1714 | 1714 | } |
| 1715 | 1715 | } |
| 1716 | - elseif(!is_array($val)) |
|
| 1716 | + elseif (!is_array($val)) |
|
| 1717 | 1717 | { |
| 1718 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1718 | + $queries[] = $key.'='.urlencode($val); |
|
| 1719 | 1719 | } |
| 1720 | 1720 | } |
| 1721 | - if(count($queries) > 0) |
|
| 1721 | + if (count($queries) > 0) |
|
| 1722 | 1722 | { |
| 1723 | - $query = 'index.php?' . join('&', $queries); |
|
| 1723 | + $query = 'index.php?'.join('&', $queries); |
|
| 1724 | 1724 | } |
| 1725 | 1725 | } |
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | 1728 | // If using SSL always |
| 1729 | 1729 | $_use_ssl = $self->get('_use_ssl'); |
| 1730 | - if($_use_ssl == 'always') |
|
| 1730 | + if ($_use_ssl == 'always') |
|
| 1731 | 1731 | { |
| 1732 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1732 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1733 | 1733 | // optional SSL use |
| 1734 | 1734 | } |
| 1735 | - elseif($_use_ssl == 'optional') |
|
| 1735 | + elseif ($_use_ssl == 'optional') |
|
| 1736 | 1736 | { |
| 1737 | 1737 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1738 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1738 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1739 | 1739 | // no SSL |
| 1740 | 1740 | } |
| 1741 | 1741 | else |
| 1742 | 1742 | { |
| 1743 | 1743 | // currently on SSL but target is not based on SSL |
| 1744 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1744 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1745 | 1745 | { |
| 1746 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1746 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1747 | 1747 | } |
| 1748 | - else if($domain) // if $domain is set |
|
| 1748 | + else if ($domain) // if $domain is set |
|
| 1749 | 1749 | { |
| 1750 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1750 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1751 | 1751 | } |
| 1752 | 1752 | else |
| 1753 | 1753 | { |
| 1754 | - $query = getScriptPath() . $query; |
|
| 1754 | + $query = getScriptPath().$query; |
|
| 1755 | 1755 | } |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | - if(!$encode) |
|
| 1758 | + if (!$encode) |
|
| 1759 | 1759 | { |
| 1760 | 1760 | return $query; |
| 1761 | 1761 | } |
| 1762 | 1762 | |
| 1763 | - if(!$autoEncode) |
|
| 1763 | + if (!$autoEncode) |
|
| 1764 | 1764 | { |
| 1765 | 1765 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1766 | 1766 | } |
@@ -1769,16 +1769,16 @@ discard block |
||
| 1769 | 1769 | $encode_queries = array(); |
| 1770 | 1770 | $parsedUrl = parse_url($query); |
| 1771 | 1771 | parse_str($parsedUrl['query'], $output); |
| 1772 | - foreach($output as $key => $value) |
|
| 1772 | + foreach ($output as $key => $value) |
|
| 1773 | 1773 | { |
| 1774 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1774 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1775 | 1775 | { |
| 1776 | 1776 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1777 | 1777 | } |
| 1778 | - $encode_queries[] = $key . '=' . $value; |
|
| 1778 | + $encode_queries[] = $key.'='.$value; |
|
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1781 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | /** |
@@ -1793,17 +1793,17 @@ discard block |
||
| 1793 | 1793 | static $url = array(); |
| 1794 | 1794 | |
| 1795 | 1795 | // Check HTTP Request |
| 1796 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1796 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1797 | 1797 | { |
| 1798 | 1798 | return; |
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | - if(self::get('_use_ssl') == 'always') |
|
| 1801 | + if (self::get('_use_ssl') == 'always') |
|
| 1802 | 1802 | { |
| 1803 | 1803 | $ssl_mode = ENFORCE_SSL; |
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | - if($domain) |
|
| 1806 | + if ($domain) |
|
| 1807 | 1807 | { |
| 1808 | 1808 | $domain_key = md5($domain); |
| 1809 | 1809 | } |
@@ -1812,14 +1812,14 @@ discard block |
||
| 1812 | 1812 | $domain_key = 'default'; |
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1815 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1816 | 1816 | { |
| 1817 | 1817 | return $url[$ssl_mode][$domain_key]; |
| 1818 | 1818 | } |
| 1819 | 1819 | |
| 1820 | 1820 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1821 | 1821 | |
| 1822 | - switch($ssl_mode) |
|
| 1822 | + switch ($ssl_mode) |
|
| 1823 | 1823 | { |
| 1824 | 1824 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1825 | 1825 | break; |
@@ -1829,34 +1829,34 @@ discard block |
||
| 1829 | 1829 | break; |
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | - if($domain) |
|
| 1832 | + if ($domain) |
|
| 1833 | 1833 | { |
| 1834 | 1834 | $target_url = trim($domain); |
| 1835 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1835 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1836 | 1836 | { |
| 1837 | - $target_url.= '/'; |
|
| 1837 | + $target_url .= '/'; |
|
| 1838 | 1838 | } |
| 1839 | 1839 | } |
| 1840 | 1840 | else |
| 1841 | 1841 | { |
| 1842 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1842 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | - $url_info = parse_url('http://' . $target_url); |
|
| 1845 | + $url_info = parse_url('http://'.$target_url); |
|
| 1846 | 1846 | |
| 1847 | - if($current_use_ssl != $use_ssl) |
|
| 1847 | + if ($current_use_ssl != $use_ssl) |
|
| 1848 | 1848 | { |
| 1849 | 1849 | unset($url_info['port']); |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | - if($use_ssl) |
|
| 1852 | + if ($use_ssl) |
|
| 1853 | 1853 | { |
| 1854 | 1854 | $port = self::get('_https_port'); |
| 1855 | - if($port && $port != 443) |
|
| 1855 | + if ($port && $port != 443) |
|
| 1856 | 1856 | { |
| 1857 | 1857 | $url_info['port'] = $port; |
| 1858 | 1858 | } |
| 1859 | - elseif($url_info['port'] == 443) |
|
| 1859 | + elseif ($url_info['port'] == 443) |
|
| 1860 | 1860 | { |
| 1861 | 1861 | unset($url_info['port']); |
| 1862 | 1862 | } |
@@ -1864,17 +1864,17 @@ discard block |
||
| 1864 | 1864 | else |
| 1865 | 1865 | { |
| 1866 | 1866 | $port = self::get('_http_port'); |
| 1867 | - if($port && $port != 80) |
|
| 1867 | + if ($port && $port != 80) |
|
| 1868 | 1868 | { |
| 1869 | 1869 | $url_info['port'] = $port; |
| 1870 | 1870 | } |
| 1871 | - elseif($url_info['port'] == 80) |
|
| 1871 | + elseif ($url_info['port'] == 80) |
|
| 1872 | 1872 | { |
| 1873 | 1873 | unset($url_info['port']); |
| 1874 | 1874 | } |
| 1875 | 1875 | } |
| 1876 | 1876 | |
| 1877 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
| 1877 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
| 1878 | 1878 | |
| 1879 | 1879 | return $url[$ssl_mode][$domain_key]; |
| 1880 | 1880 | } |
@@ -1891,16 +1891,16 @@ discard block |
||
| 1891 | 1891 | { |
| 1892 | 1892 | $self = self::getInstance(); |
| 1893 | 1893 | $self->context->{$key} = $val; |
| 1894 | - if($set_to_get_vars === FALSE) |
|
| 1894 | + if ($set_to_get_vars === FALSE) |
|
| 1895 | 1895 | { |
| 1896 | 1896 | return; |
| 1897 | 1897 | } |
| 1898 | - if($val === NULL || $val === '') |
|
| 1898 | + if ($val === NULL || $val === '') |
|
| 1899 | 1899 | { |
| 1900 | 1900 | unset($self->get_vars->{$key}); |
| 1901 | 1901 | return; |
| 1902 | 1902 | } |
| 1903 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1903 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1904 | 1904 | { |
| 1905 | 1905 | $self->get_vars->{$key} = $val; |
| 1906 | 1906 | } |
@@ -1916,7 +1916,7 @@ discard block |
||
| 1916 | 1916 | { |
| 1917 | 1917 | $self = self::getInstance(); |
| 1918 | 1918 | |
| 1919 | - if(!isset($self->context->{$key})) |
|
| 1919 | + if (!isset($self->context->{$key})) |
|
| 1920 | 1920 | { |
| 1921 | 1921 | return null; |
| 1922 | 1922 | } |
@@ -1931,7 +1931,7 @@ discard block |
||
| 1931 | 1931 | function gets() |
| 1932 | 1932 | { |
| 1933 | 1933 | $num_args = func_num_args(); |
| 1934 | - if($num_args < 1) |
|
| 1934 | + if ($num_args < 1) |
|
| 1935 | 1935 | { |
| 1936 | 1936 | return; |
| 1937 | 1937 | } |
@@ -1939,7 +1939,7 @@ discard block |
||
| 1939 | 1939 | |
| 1940 | 1940 | $args_list = func_get_args(); |
| 1941 | 1941 | $output = new stdClass(); |
| 1942 | - foreach($args_list as $v) |
|
| 1942 | + foreach ($args_list as $v) |
|
| 1943 | 1943 | { |
| 1944 | 1944 | $output->{$v} = $self->get($v); |
| 1945 | 1945 | } |
@@ -1965,7 +1965,7 @@ discard block |
||
| 1965 | 1965 | function getRequestVars() |
| 1966 | 1966 | { |
| 1967 | 1967 | $self = self::getInstance(); |
| 1968 | - if($self->get_vars) |
|
| 1968 | + if ($self->get_vars) |
|
| 1969 | 1969 | { |
| 1970 | 1970 | return clone($self->get_vars); |
| 1971 | 1971 | } |
@@ -1982,13 +1982,13 @@ discard block |
||
| 1982 | 1982 | { |
| 1983 | 1983 | $self = self::getInstance(); |
| 1984 | 1984 | |
| 1985 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 1985 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 1986 | 1986 | { |
| 1987 | 1987 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 1988 | 1988 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 1989 | 1989 | } |
| 1990 | 1990 | |
| 1991 | - if(!isset($self->ssl_actions[$action])) |
|
| 1991 | + if (!isset($self->ssl_actions[$action])) |
|
| 1992 | 1992 | { |
| 1993 | 1993 | $self->ssl_actions[$action] = 1; |
| 1994 | 1994 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2006,16 +2006,16 @@ discard block |
||
| 2006 | 2006 | { |
| 2007 | 2007 | $self = self::getInstance(); |
| 2008 | 2008 | |
| 2009 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2009 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2010 | 2010 | { |
| 2011 | 2011 | unset($self->ssl_actions); |
| 2012 | 2012 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2013 | 2013 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2014 | 2014 | } |
| 2015 | 2015 | |
| 2016 | - foreach($action_array as $action) |
|
| 2016 | + foreach ($action_array as $action) |
|
| 2017 | 2017 | { |
| 2018 | - if(!isset($self->ssl_actions[$action])) |
|
| 2018 | + if (!isset($self->ssl_actions[$action])) |
|
| 2019 | 2019 | { |
| 2020 | 2020 | $self->ssl_actions[$action] = 1; |
| 2021 | 2021 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2034,7 +2034,7 @@ discard block |
||
| 2034 | 2034 | { |
| 2035 | 2035 | $self = self::getInstance(); |
| 2036 | 2036 | |
| 2037 | - if($self->isExistsSSLAction($action)) |
|
| 2037 | + if ($self->isExistsSSLAction($action)) |
|
| 2038 | 2038 | { |
| 2039 | 2039 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2040 | 2040 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2051,7 +2051,7 @@ discard block |
||
| 2051 | 2051 | function getSSLActions() |
| 2052 | 2052 | { |
| 2053 | 2053 | $self = self::getInstance(); |
| 2054 | - if($self->getSslStatus() == 'optional') |
|
| 2054 | + if ($self->getSslStatus() == 'optional') |
|
| 2055 | 2055 | { |
| 2056 | 2056 | return $self->ssl_actions; |
| 2057 | 2057 | } |
@@ -2078,12 +2078,12 @@ discard block |
||
| 2078 | 2078 | */ |
| 2079 | 2079 | function normalizeFilePath($file) |
| 2080 | 2080 | { |
| 2081 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2081 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2082 | 2082 | { |
| 2083 | - $file = './' . $file; |
|
| 2083 | + $file = './'.$file; |
|
| 2084 | 2084 | } |
| 2085 | 2085 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2086 | - while(strpos($file, '/../') !== FALSE) |
|
| 2086 | + while (strpos($file, '/../') !== FALSE) |
|
| 2087 | 2087 | { |
| 2088 | 2088 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2089 | 2089 | } |
@@ -2102,13 +2102,13 @@ discard block |
||
| 2102 | 2102 | { |
| 2103 | 2103 | $file = self::normalizeFilePath($file); |
| 2104 | 2104 | $script_path = getScriptPath(); |
| 2105 | - if(strpos($file, './') === 0) |
|
| 2105 | + if (strpos($file, './') === 0) |
|
| 2106 | 2106 | { |
| 2107 | - $file = $script_path . substr($file, 2); |
|
| 2107 | + $file = $script_path.substr($file, 2); |
|
| 2108 | 2108 | } |
| 2109 | - elseif(strpos($file, '../') === 0) |
|
| 2109 | + elseif (strpos($file, '../') === 0) |
|
| 2110 | 2110 | { |
| 2111 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2111 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2112 | 2112 | } |
| 2113 | 2113 | |
| 2114 | 2114 | return $file; |
@@ -2178,12 +2178,12 @@ discard block |
||
| 2178 | 2178 | */ |
| 2179 | 2179 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2180 | 2180 | { |
| 2181 | - if($isRuleset) |
|
| 2181 | + if ($isRuleset) |
|
| 2182 | 2182 | { |
| 2183 | - if(strpos($file, '#') !== FALSE) |
|
| 2183 | + if (strpos($file, '#') !== FALSE) |
|
| 2184 | 2184 | { |
| 2185 | 2185 | $file = str_replace('#', '', $file); |
| 2186 | - if(!is_readable($file)) |
|
| 2186 | + if (!is_readable($file)) |
|
| 2187 | 2187 | { |
| 2188 | 2188 | $file = $autoPath; |
| 2189 | 2189 | } |
@@ -2248,9 +2248,9 @@ discard block |
||
| 2248 | 2248 | ksort($files); |
| 2249 | 2249 | $files = array_values($files); |
| 2250 | 2250 | $filenames = array(); |
| 2251 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2251 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2252 | 2252 | { |
| 2253 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2253 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2254 | 2254 | { |
| 2255 | 2255 | unset($files[$i]); |
| 2256 | 2256 | } |
@@ -2335,14 +2335,14 @@ discard block |
||
| 2335 | 2335 | */ |
| 2336 | 2336 | function getJavascriptPluginInfo($pluginName) |
| 2337 | 2337 | { |
| 2338 | - if($plugin_name == 'ui.datepicker') |
|
| 2338 | + if ($plugin_name == 'ui.datepicker') |
|
| 2339 | 2339 | { |
| 2340 | 2340 | $plugin_name = 'ui'; |
| 2341 | 2341 | } |
| 2342 | 2342 | |
| 2343 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2344 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2345 | - if(!is_readable($info_file)) |
|
| 2343 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2344 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2345 | + if (!is_readable($info_file)) |
|
| 2346 | 2346 | { |
| 2347 | 2347 | return; |
| 2348 | 2348 | } |
@@ -2352,32 +2352,32 @@ discard block |
||
| 2352 | 2352 | $result->jsList = array(); |
| 2353 | 2353 | $result->cssList = array(); |
| 2354 | 2354 | |
| 2355 | - foreach($list as $filename) |
|
| 2355 | + foreach ($list as $filename) |
|
| 2356 | 2356 | { |
| 2357 | 2357 | $filename = trim($filename); |
| 2358 | - if(!$filename) |
|
| 2358 | + if (!$filename) |
|
| 2359 | 2359 | { |
| 2360 | 2360 | continue; |
| 2361 | 2361 | } |
| 2362 | 2362 | |
| 2363 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2363 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2364 | 2364 | { |
| 2365 | 2365 | $filename = substr($filename, 2); |
| 2366 | 2366 | } |
| 2367 | 2367 | |
| 2368 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2368 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2369 | 2369 | { |
| 2370 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2370 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2371 | 2371 | } |
| 2372 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2372 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2373 | 2373 | { |
| 2374 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2374 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2375 | 2375 | } |
| 2376 | 2376 | } |
| 2377 | 2377 | |
| 2378 | - if(is_dir($plugin_path . 'lang')) |
|
| 2378 | + if (is_dir($plugin_path.'lang')) |
|
| 2379 | 2379 | { |
| 2380 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2380 | + $result->langPath = $plugin_path.'lang'; |
|
| 2381 | 2381 | } |
| 2382 | 2382 | |
| 2383 | 2383 | return $result; |
@@ -2393,50 +2393,50 @@ discard block |
||
| 2393 | 2393 | static $loaded_plugins = array(); |
| 2394 | 2394 | |
| 2395 | 2395 | $self = self::getInstance(); |
| 2396 | - if($plugin_name == 'ui.datepicker') |
|
| 2396 | + if ($plugin_name == 'ui.datepicker') |
|
| 2397 | 2397 | { |
| 2398 | 2398 | $plugin_name = 'ui'; |
| 2399 | 2399 | } |
| 2400 | 2400 | |
| 2401 | - if($loaded_plugins[$plugin_name]) |
|
| 2401 | + if ($loaded_plugins[$plugin_name]) |
|
| 2402 | 2402 | { |
| 2403 | 2403 | return; |
| 2404 | 2404 | } |
| 2405 | 2405 | $loaded_plugins[$plugin_name] = TRUE; |
| 2406 | 2406 | |
| 2407 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2408 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2409 | - if(!is_readable($info_file)) |
|
| 2407 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2408 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2409 | + if (!is_readable($info_file)) |
|
| 2410 | 2410 | { |
| 2411 | 2411 | return; |
| 2412 | 2412 | } |
| 2413 | 2413 | |
| 2414 | 2414 | $list = file($info_file); |
| 2415 | - foreach($list as $filename) |
|
| 2415 | + foreach ($list as $filename) |
|
| 2416 | 2416 | { |
| 2417 | 2417 | $filename = trim($filename); |
| 2418 | - if(!$filename) |
|
| 2418 | + if (!$filename) |
|
| 2419 | 2419 | { |
| 2420 | 2420 | continue; |
| 2421 | 2421 | } |
| 2422 | 2422 | |
| 2423 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2423 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2424 | 2424 | { |
| 2425 | 2425 | $filename = substr($filename, 2); |
| 2426 | 2426 | } |
| 2427 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2427 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2428 | 2428 | { |
| 2429 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2429 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2430 | 2430 | } |
| 2431 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2431 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2432 | 2432 | { |
| 2433 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2433 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2434 | 2434 | } |
| 2435 | 2435 | } |
| 2436 | 2436 | |
| 2437 | - if(is_dir($plugin_path . 'lang')) |
|
| 2437 | + if (is_dir($plugin_path.'lang')) |
|
| 2438 | 2438 | { |
| 2439 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2439 | + $self->loadLang($plugin_path.'lang'); |
|
| 2440 | 2440 | } |
| 2441 | 2441 | } |
| 2442 | 2442 | |
@@ -2449,7 +2449,7 @@ discard block |
||
| 2449 | 2449 | function addHtmlHeader($header) |
| 2450 | 2450 | { |
| 2451 | 2451 | $self = self::getInstance(); |
| 2452 | - $self->html_header .= "\n" . $header; |
|
| 2452 | + $self->html_header .= "\n".$header; |
|
| 2453 | 2453 | } |
| 2454 | 2454 | |
| 2455 | 2455 | function clearHtmlHeader() |
@@ -2501,7 +2501,7 @@ discard block |
||
| 2501 | 2501 | function addBodyHeader($header) |
| 2502 | 2502 | { |
| 2503 | 2503 | $self = self::getInstance(); |
| 2504 | - $self->body_header .= "\n" . $header; |
|
| 2504 | + $self->body_header .= "\n".$header; |
|
| 2505 | 2505 | } |
| 2506 | 2506 | |
| 2507 | 2507 | /** |
@@ -2523,7 +2523,7 @@ discard block |
||
| 2523 | 2523 | function addHtmlFooter($footer) |
| 2524 | 2524 | { |
| 2525 | 2525 | $self = self::getInstance(); |
| 2526 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2526 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2527 | 2527 | } |
| 2528 | 2528 | |
| 2529 | 2529 | /** |
@@ -2544,7 +2544,7 @@ discard block |
||
| 2544 | 2544 | */ |
| 2545 | 2545 | function getConfigFile() |
| 2546 | 2546 | { |
| 2547 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2547 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2548 | 2548 | } |
| 2549 | 2549 | |
| 2550 | 2550 | /** |
@@ -2554,7 +2554,7 @@ discard block |
||
| 2554 | 2554 | */ |
| 2555 | 2555 | function getFTPConfigFile() |
| 2556 | 2556 | { |
| 2557 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2557 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | /** |
@@ -2606,14 +2606,14 @@ discard block |
||
| 2606 | 2606 | $_path = explode('/', $path); |
| 2607 | 2607 | $_base = explode('/', $base_url); |
| 2608 | 2608 | |
| 2609 | - if(!$_base[count($_base) - 1]) |
|
| 2609 | + if (!$_base[count($_base) - 1]) |
|
| 2610 | 2610 | { |
| 2611 | 2611 | array_pop($_base); |
| 2612 | 2612 | } |
| 2613 | 2613 | |
| 2614 | - foreach($_xe as $idx => $dir) |
|
| 2614 | + foreach ($_xe as $idx => $dir) |
|
| 2615 | 2615 | { |
| 2616 | - if($_path[0] != $dir) |
|
| 2616 | + if ($_path[0] != $dir) |
|
| 2617 | 2617 | { |
| 2618 | 2618 | break; |
| 2619 | 2619 | } |
@@ -2621,9 +2621,9 @@ discard block |
||
| 2621 | 2621 | } |
| 2622 | 2622 | |
| 2623 | 2623 | $idx = count($_xe) - $idx - 1; |
| 2624 | - while($idx--) |
|
| 2624 | + while ($idx--) |
|
| 2625 | 2625 | { |
| 2626 | - if(count($_base) > 0) |
|
| 2626 | + if (count($_base) > 0) |
|
| 2627 | 2627 | { |
| 2628 | 2628 | array_shift($_base); |
| 2629 | 2629 | } |
@@ -2633,13 +2633,13 @@ discard block |
||
| 2633 | 2633 | } |
| 2634 | 2634 | } |
| 2635 | 2635 | |
| 2636 | - if(count($_base) > 0) |
|
| 2636 | + if (count($_base) > 0) |
|
| 2637 | 2637 | { |
| 2638 | 2638 | array_unshift($_path, join('/', $_base)); |
| 2639 | 2639 | } |
| 2640 | 2640 | |
| 2641 | - $path = '/' . join('/', $_path); |
|
| 2642 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2641 | + $path = '/'.join('/', $_path); |
|
| 2642 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2643 | 2643 | { |
| 2644 | 2644 | $path .= '/'; |
| 2645 | 2645 | } |
@@ -2654,13 +2654,13 @@ discard block |
||
| 2654 | 2654 | { |
| 2655 | 2655 | $self = self::getInstance(); |
| 2656 | 2656 | |
| 2657 | - if(!is_array($self->meta_tags)) |
|
| 2657 | + if (!is_array($self->meta_tags)) |
|
| 2658 | 2658 | { |
| 2659 | 2659 | $self->meta_tags = array(); |
| 2660 | 2660 | } |
| 2661 | 2661 | |
| 2662 | 2662 | $ret = array(); |
| 2663 | - foreach($self->meta_tags as $key => $val) |
|
| 2663 | + foreach ($self->meta_tags as $key => $val) |
|
| 2664 | 2664 | { |
| 2665 | 2665 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2666 | 2666 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2680,7 +2680,7 @@ discard block |
||
| 2680 | 2680 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2681 | 2681 | { |
| 2682 | 2682 | $self = self::getInstance(); |
| 2683 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2683 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2684 | 2684 | } |
| 2685 | 2685 | |
| 2686 | 2686 | } |
@@ -230,7 +230,9 @@ discard block |
||
| 230 | 230 | $this->loadDBInfo(); |
| 231 | 231 | if($this->db_info->use_sitelock == 'Y') |
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if(is_array($this->db_info->sitelock_whitelist)) { |
|
| 234 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
| 235 | + } |
|
| 234 | 236 | |
| 235 | 237 | if(!IpFilter::filter($whitelist)) |
| 236 | 238 | { |
@@ -245,8 +247,7 @@ discard block |
||
| 245 | 247 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
| 246 | 248 | { |
| 247 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 248 | - } |
|
| 249 | - else |
|
| 250 | + } else |
|
| 250 | 251 | { |
| 251 | 252 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
| 252 | 253 | } |
@@ -303,8 +304,7 @@ discard block |
||
| 303 | 304 | { |
| 304 | 305 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 305 | 306 | } |
| 306 | - } |
|
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + } elseif($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
@@ -341,7 +341,9 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if($sess = $_POST[session_name()]) { |
|
| 345 | + session_id($sess); |
|
| 346 | + } |
|
| 345 | 347 | session_start(); |
| 346 | 348 | |
| 347 | 349 | // set authentication information in Context and session |
@@ -394,22 +396,21 @@ discard block |
||
| 394 | 396 | { |
| 395 | 397 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 396 | 398 | } |
| 397 | - } |
|
| 398 | - elseif($val) |
|
| 399 | + } elseif($val) |
|
| 399 | 400 | { |
| 400 | 401 | $url[] = $key . '=' . urlencode($val); |
| 401 | 402 | } |
| 402 | 403 | } |
| 403 | 404 | |
| 404 | 405 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 406 | - } |
|
| 407 | - else |
|
| 406 | + if($url) { |
|
| 407 | + $current_url .= '?' . join('&', $url); |
|
| 408 | + } |
|
| 409 | + } else |
|
| 408 | 410 | { |
| 409 | 411 | $current_url = $this->getUrl(); |
| 410 | 412 | } |
| 411 | - } |
|
| 412 | - else |
|
| 413 | + } else |
|
| 413 | 414 | { |
| 414 | 415 | $current_url = self::getRequestUri(); |
| 415 | 416 | } |
@@ -494,18 +495,22 @@ discard block |
||
| 494 | 495 | $db_info->use_prepared_statements = 'Y'; |
| 495 | 496 | } |
| 496 | 497 | |
| 497 | - if(!$db_info->time_zone) |
|
| 498 | - $db_info->time_zone = date('O'); |
|
| 498 | + if(!$db_info->time_zone) { |
|
| 499 | + $db_info->time_zone = date('O'); |
|
| 500 | + } |
|
| 499 | 501 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 500 | 502 | |
| 501 | - if($db_info->qmail_compatibility != 'Y') |
|
| 502 | - $db_info->qmail_compatibility = 'N'; |
|
| 503 | + if($db_info->qmail_compatibility != 'Y') { |
|
| 504 | + $db_info->qmail_compatibility = 'N'; |
|
| 505 | + } |
|
| 503 | 506 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 504 | 507 | |
| 505 | - if(!$db_info->use_db_session) |
|
| 506 | - $db_info->use_db_session = 'N'; |
|
| 507 | - if(!$db_info->use_ssl) |
|
| 508 | - $db_info->use_ssl = 'none'; |
|
| 508 | + if(!$db_info->use_db_session) { |
|
| 509 | + $db_info->use_db_session = 'N'; |
|
| 510 | + } |
|
| 511 | + if(!$db_info->use_ssl) { |
|
| 512 | + $db_info->use_ssl = 'none'; |
|
| 513 | + } |
|
| 509 | 514 | $this->set('_use_ssl', $db_info->use_ssl); |
| 510 | 515 | |
| 511 | 516 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -622,8 +627,7 @@ discard block |
||
| 622 | 627 | $buff = FileHandler::readFile($orig_lang_file); |
| 623 | 628 | FileHandler::writeFile($selected_lang_file, $buff); |
| 624 | 629 | $lang_selected = self::loadLangSupported(); |
| 625 | - } |
|
| 626 | - else |
|
| 630 | + } else |
|
| 627 | 631 | { |
| 628 | 632 | $langs = file($selected_lang_file); |
| 629 | 633 | foreach($langs as $val) |
@@ -687,8 +691,7 @@ discard block |
||
| 687 | 691 | return FALSE; |
| 688 | 692 | } |
| 689 | 693 | // for sites requesting SSO validation |
| 690 | - } |
|
| 691 | - else |
|
| 694 | + } else |
|
| 692 | 695 | { |
| 693 | 696 | // result handling : set session_name() |
| 694 | 697 | if($session_name = self::get('SSOID')) |
@@ -705,8 +708,7 @@ discard block |
||
| 705 | 708 | header('location:' . $url); |
| 706 | 709 | return FALSE; |
| 707 | 710 | // send SSO request |
| 708 | - } |
|
| 709 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 711 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 710 | 712 | { |
| 711 | 713 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 712 | 714 | $origin_url = self::getRequestUrl(); |
@@ -766,8 +768,7 @@ discard block |
||
| 766 | 768 | if($self->site_title) |
| 767 | 769 | { |
| 768 | 770 | $self->site_title .= ' - ' . $site_title; |
| 769 | - } |
|
| 770 | - else |
|
| 771 | + } else |
|
| 771 | 772 | { |
| 772 | 773 | $self->site_title = $site_title; |
| 773 | 774 | } |
@@ -867,8 +868,7 @@ discard block |
||
| 867 | 868 | { |
| 868 | 869 | $self->loaded_lang_files[] = $filename; |
| 869 | 870 | include($filename); |
| 870 | - } |
|
| 871 | - else |
|
| 871 | + } else |
|
| 872 | 872 | { |
| 873 | 873 | $self->_evalxmlLang($path); |
| 874 | 874 | } |
@@ -884,7 +884,9 @@ discard block |
||
| 884 | 884 | { |
| 885 | 885 | global $lang; |
| 886 | 886 | |
| 887 | - if(!$path) return; |
|
| 887 | + if(!$path) { |
|
| 888 | + return; |
|
| 889 | + } |
|
| 888 | 890 | |
| 889 | 891 | $_path = 'eval://' . $path; |
| 890 | 892 | |
@@ -916,7 +918,9 @@ discard block |
||
| 916 | 918 | */ |
| 917 | 919 | function _loadXmlLang($path) |
| 918 | 920 | { |
| 919 | - if(!$path) return; |
|
| 921 | + if(!$path) { |
|
| 922 | + return; |
|
| 923 | + } |
|
| 920 | 924 | |
| 921 | 925 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 922 | 926 | return $oXmlLangParser->compile(); |
@@ -930,7 +934,9 @@ discard block |
||
| 930 | 934 | */ |
| 931 | 935 | function _loadPhpLang($path) |
| 932 | 936 | { |
| 933 | - if(!$path) return; |
|
| 937 | + if(!$path) { |
|
| 938 | + return; |
|
| 939 | + } |
|
| 934 | 940 | |
| 935 | 941 | if(substr_compare($path, '/', -1) !== 0) |
| 936 | 942 | { |
@@ -1066,12 +1072,14 @@ discard block |
||
| 1066 | 1072 | static $flag = TRUE; |
| 1067 | 1073 | if($charset) |
| 1068 | 1074 | { |
| 1069 | - if(is_array($val)) |
|
| 1070 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1071 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1072 | - else $flag = FALSE; |
|
| 1073 | - } |
|
| 1074 | - else |
|
| 1075 | + if(is_array($val)) { |
|
| 1076 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1077 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
| 1078 | + $flag = FALSE; |
|
| 1079 | + } else { |
|
| 1080 | + $flag = FALSE; |
|
| 1081 | + } |
|
| 1082 | + } else |
|
| 1075 | 1083 | { |
| 1076 | 1084 | $return = $flag; |
| 1077 | 1085 | $flag = TRUE; |
@@ -1093,8 +1101,9 @@ discard block |
||
| 1093 | 1101 | if (is_array($val)) |
| 1094 | 1102 | { |
| 1095 | 1103 | array_walk($val,'Context::doConvertEncoding',$charset); |
| 1104 | + } else { |
|
| 1105 | + $val = iconv($charset,'UTF-8',$val); |
|
| 1096 | 1106 | } |
| 1097 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1098 | 1107 | } |
| 1099 | 1108 | |
| 1100 | 1109 | /** |
@@ -1105,7 +1114,9 @@ discard block |
||
| 1105 | 1114 | */ |
| 1106 | 1115 | function convertEncodingStr($str) |
| 1107 | 1116 | { |
| 1108 | - if(!$str) return null; |
|
| 1117 | + if(!$str) { |
|
| 1118 | + return null; |
|
| 1119 | + } |
|
| 1109 | 1120 | $obj = new stdClass(); |
| 1110 | 1121 | $obj->str = $str; |
| 1111 | 1122 | $obj = self::convertEncoding($obj); |
@@ -1218,16 +1229,13 @@ discard block |
||
| 1218 | 1229 | if($requestMethod == 'GET' && isset($_GET[$key])) |
| 1219 | 1230 | { |
| 1220 | 1231 | $set_to_vars = TRUE; |
| 1221 | - } |
|
| 1222 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1232 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1223 | 1233 | { |
| 1224 | 1234 | $set_to_vars = TRUE; |
| 1225 | - } |
|
| 1226 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1235 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1227 | 1236 | { |
| 1228 | 1237 | $set_to_vars = TRUE; |
| 1229 | - } |
|
| 1230 | - else |
|
| 1238 | + } else |
|
| 1231 | 1239 | { |
| 1232 | 1240 | $set_to_vars = FALSE; |
| 1233 | 1241 | } |
@@ -1253,8 +1261,7 @@ discard block |
||
| 1253 | 1261 | return; |
| 1254 | 1262 | } |
| 1255 | 1263 | } |
| 1256 | - } |
|
| 1257 | - else if(is_array($val)) |
|
| 1264 | + } else if(is_array($val)) |
|
| 1258 | 1265 | { |
| 1259 | 1266 | foreach($val as $val2) |
| 1260 | 1267 | { |
@@ -1394,24 +1401,19 @@ discard block |
||
| 1394 | 1401 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
| 1395 | 1402 | { |
| 1396 | 1403 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1397 | - } |
|
| 1398 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1404 | + } elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1399 | 1405 | { |
| 1400 | 1406 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1401 | - } |
|
| 1402 | - elseif($key === 'vid') |
|
| 1407 | + } elseif($key === 'vid') |
|
| 1403 | 1408 | { |
| 1404 | 1409 | $result[$k] = urlencode($v); |
| 1405 | - } |
|
| 1406 | - elseif($key === 'xe_validator_id') |
|
| 1410 | + } elseif($key === 'xe_validator_id') |
|
| 1407 | 1411 | { |
| 1408 | 1412 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1409 | - } |
|
| 1410 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1413 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1411 | 1414 | { |
| 1412 | 1415 | unset($result[$k]); |
| 1413 | - } |
|
| 1414 | - else |
|
| 1416 | + } else |
|
| 1415 | 1417 | { |
| 1416 | 1418 | $result[$k] = $v; |
| 1417 | 1419 | |
@@ -1465,8 +1467,7 @@ discard block |
||
| 1465 | 1467 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1466 | 1468 | $this->set($key, $val, TRUE); |
| 1467 | 1469 | $this->is_uploaded = TRUE; |
| 1468 | - } |
|
| 1469 | - else |
|
| 1470 | + } else |
|
| 1470 | 1471 | { |
| 1471 | 1472 | for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
| 1472 | 1473 | { |
@@ -1572,8 +1573,7 @@ discard block |
||
| 1572 | 1573 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
| 1573 | 1574 | { |
| 1574 | 1575 | $vid = $site_module_info->domain; |
| 1575 | - } |
|
| 1576 | - else |
|
| 1576 | + } else |
|
| 1577 | 1577 | { |
| 1578 | 1578 | $domain = $site_module_info->domain; |
| 1579 | 1579 | } |
@@ -1590,8 +1590,7 @@ discard block |
||
| 1590 | 1590 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
| 1591 | 1591 | { |
| 1592 | 1592 | unset($domain); |
| 1593 | - } |
|
| 1594 | - else |
|
| 1593 | + } else |
|
| 1595 | 1594 | { |
| 1596 | 1595 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1597 | 1596 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1611,8 +1610,7 @@ discard block |
||
| 1611 | 1610 | { |
| 1612 | 1611 | array_shift($args_list); |
| 1613 | 1612 | } |
| 1614 | - } |
|
| 1615 | - else |
|
| 1613 | + } else |
|
| 1616 | 1614 | { |
| 1617 | 1615 | // Otherwise, make GET variables into array |
| 1618 | 1616 | $get_vars = get_object_vars($self->get_vars); |
@@ -1639,8 +1637,7 @@ discard block |
||
| 1639 | 1637 | if($vid) |
| 1640 | 1638 | { |
| 1641 | 1639 | $get_vars['vid'] = $vid; |
| 1642 | - } |
|
| 1643 | - else |
|
| 1640 | + } else |
|
| 1644 | 1641 | { |
| 1645 | 1642 | unset($get_vars['vid']); |
| 1646 | 1643 | } |
@@ -1712,8 +1709,7 @@ discard block |
||
| 1712 | 1709 | { |
| 1713 | 1710 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1714 | 1711 | } |
| 1715 | - } |
|
| 1716 | - elseif(!is_array($val)) |
|
| 1712 | + } elseif(!is_array($val)) |
|
| 1717 | 1713 | { |
| 1718 | 1714 | $queries[] = $key . '=' . urlencode($val); |
| 1719 | 1715 | } |
@@ -1731,25 +1727,23 @@ discard block |
||
| 1731 | 1727 | { |
| 1732 | 1728 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1733 | 1729 | // optional SSL use |
| 1734 | - } |
|
| 1735 | - elseif($_use_ssl == 'optional') |
|
| 1730 | + } elseif($_use_ssl == 'optional') |
|
| 1736 | 1731 | { |
| 1737 | 1732 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1738 | 1733 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
| 1739 | 1734 | // no SSL |
| 1740 | - } |
|
| 1741 | - else |
|
| 1735 | + } else |
|
| 1742 | 1736 | { |
| 1743 | 1737 | // currently on SSL but target is not based on SSL |
| 1744 | 1738 | if($_SERVER['HTTPS'] == 'on') |
| 1745 | 1739 | { |
| 1746 | 1740 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1747 | - } |
|
| 1748 | - else if($domain) // if $domain is set |
|
| 1741 | + } else if($domain) { |
|
| 1742 | + // if $domain is set |
|
| 1749 | 1743 | { |
| 1750 | 1744 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1751 | 1745 | } |
| 1752 | - else |
|
| 1746 | + } else |
|
| 1753 | 1747 | { |
| 1754 | 1748 | $query = getScriptPath() . $query; |
| 1755 | 1749 | } |
@@ -1806,8 +1800,7 @@ discard block |
||
| 1806 | 1800 | if($domain) |
| 1807 | 1801 | { |
| 1808 | 1802 | $domain_key = md5($domain); |
| 1809 | - } |
|
| 1810 | - else |
|
| 1803 | + } else |
|
| 1811 | 1804 | { |
| 1812 | 1805 | $domain_key = 'default'; |
| 1813 | 1806 | } |
@@ -1836,8 +1829,7 @@ discard block |
||
| 1836 | 1829 | { |
| 1837 | 1830 | $target_url.= '/'; |
| 1838 | 1831 | } |
| 1839 | - } |
|
| 1840 | - else |
|
| 1832 | + } else |
|
| 1841 | 1833 | { |
| 1842 | 1834 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
| 1843 | 1835 | } |
@@ -1855,20 +1847,17 @@ discard block |
||
| 1855 | 1847 | if($port && $port != 443) |
| 1856 | 1848 | { |
| 1857 | 1849 | $url_info['port'] = $port; |
| 1858 | - } |
|
| 1859 | - elseif($url_info['port'] == 443) |
|
| 1850 | + } elseif($url_info['port'] == 443) |
|
| 1860 | 1851 | { |
| 1861 | 1852 | unset($url_info['port']); |
| 1862 | 1853 | } |
| 1863 | - } |
|
| 1864 | - else |
|
| 1854 | + } else |
|
| 1865 | 1855 | { |
| 1866 | 1856 | $port = self::get('_http_port'); |
| 1867 | 1857 | if($port && $port != 80) |
| 1868 | 1858 | { |
| 1869 | 1859 | $url_info['port'] = $port; |
| 1870 | - } |
|
| 1871 | - elseif($url_info['port'] == 80) |
|
| 1860 | + } elseif($url_info['port'] == 80) |
|
| 1872 | 1861 | { |
| 1873 | 1862 | unset($url_info['port']); |
| 1874 | 1863 | } |
@@ -2105,8 +2094,7 @@ discard block |
||
| 2105 | 2094 | if(strpos($file, './') === 0) |
| 2106 | 2095 | { |
| 2107 | 2096 | $file = $script_path . substr($file, 2); |
| 2108 | - } |
|
| 2109 | - elseif(strpos($file, '../') === 0) |
|
| 2097 | + } elseif(strpos($file, '../') === 0) |
|
| 2110 | 2098 | { |
| 2111 | 2099 | $file = self::normalizeFilePath($script_path . $file); |
| 2112 | 2100 | } |
@@ -2368,8 +2356,7 @@ discard block |
||
| 2368 | 2356 | if(substr_compare($filename, '.js', -3) === 0) |
| 2369 | 2357 | { |
| 2370 | 2358 | $result->jsList[] = $plugin_path . $filename; |
| 2371 | - } |
|
| 2372 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2359 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2373 | 2360 | { |
| 2374 | 2361 | $result->cssList[] = $plugin_path . $filename; |
| 2375 | 2362 | } |
@@ -2626,8 +2613,7 @@ discard block |
||
| 2626 | 2613 | if(count($_base) > 0) |
| 2627 | 2614 | { |
| 2628 | 2615 | array_shift($_base); |
| 2629 | - } |
|
| 2630 | - else |
|
| 2616 | + } else |
|
| 2631 | 2617 | { |
| 2632 | 2618 | array_unshift($_base, '..'); |
| 2633 | 2619 | } |