@@ -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'); |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
345 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
345 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
346 | 346 | session_start(); |
347 | 347 | |
348 | 348 | // set authentication information in Context and session |
349 | - if(self::isInstalled()) |
|
349 | + if (self::isInstalled()) |
|
350 | 350 | { |
351 | 351 | $oModuleModel = getModel('module'); |
352 | 352 | $oModuleModel->loadModuleExtends(); |
@@ -354,15 +354,15 @@ discard block |
||
354 | 354 | $oMemberModel = getModel('member'); |
355 | 355 | $oMemberController = getController('member'); |
356 | 356 | |
357 | - if($oMemberController && $oMemberModel) |
|
357 | + if ($oMemberController && $oMemberModel) |
|
358 | 358 | { |
359 | 359 | // if signed in, validate it. |
360 | - if($oMemberModel->isLogged()) |
|
360 | + if ($oMemberModel->isLogged()) |
|
361 | 361 | { |
362 | 362 | $oMemberController->setSessionInfo(); |
363 | 363 | } |
364 | 364 | // check auto sign-in |
365 | - elseif($_COOKIE['xeak']) |
|
365 | + elseif ($_COOKIE['xeak']) |
|
366 | 366 | { |
367 | 367 | $oMemberController->doAutologin(); |
368 | 368 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | // load common language file |
376 | 376 | $this->lang = &$GLOBALS['lang']; |
377 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
377 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
378 | 378 | |
379 | 379 | // check if using rewrite module |
380 | 380 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -382,28 +382,28 @@ discard block |
||
382 | 382 | // set locations for javascript use |
383 | 383 | $url = array(); |
384 | 384 | $current_url = self::getRequestUri(); |
385 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
385 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
386 | 386 | { |
387 | - if($this->get_vars) |
|
387 | + if ($this->get_vars) |
|
388 | 388 | { |
389 | 389 | $url = array(); |
390 | - foreach($this->get_vars as $key => $val) |
|
390 | + foreach ($this->get_vars as $key => $val) |
|
391 | 391 | { |
392 | - if(is_array($val) && count($val) > 0) |
|
392 | + if (is_array($val) && count($val) > 0) |
|
393 | 393 | { |
394 | - foreach($val as $k => $v) |
|
394 | + foreach ($val as $k => $v) |
|
395 | 395 | { |
396 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
396 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
397 | 397 | } |
398 | 398 | } |
399 | - elseif($val) |
|
399 | + elseif ($val) |
|
400 | 400 | { |
401 | - $url[] = $key . '=' . urlencode($val); |
|
401 | + $url[] = $key.'='.urlencode($val); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | 405 | $current_url = self::getRequestUri(); |
406 | - if($url) $current_url .= '?' . join('&', $url); |
|
406 | + if ($url) $current_url .= '?'.join('&', $url); |
|
407 | 407 | } |
408 | 408 | else |
409 | 409 | { |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | $this->set('current_url', $current_url); |
419 | 419 | $this->set('request_uri', self::getRequestUri()); |
420 | 420 | |
421 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
421 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
422 | 422 | { |
423 | 423 | $this->set('current_url', self::decodeIdna($current_url)); |
424 | 424 | } |
425 | 425 | |
426 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
426 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
427 | 427 | { |
428 | 428 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
429 | 429 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | { |
449 | 449 | $self = self::getInstance(); |
450 | 450 | |
451 | - if(!$self->isInstalled()) |
|
451 | + if (!$self->isInstalled()) |
|
452 | 452 | { |
453 | 453 | return; |
454 | 454 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | ob_end_clean(); |
459 | 459 | |
460 | 460 | // If master_db information does not exist, the config file needs to be updated |
461 | - if(!isset($db_info->master_db)) |
|
461 | + if (!isset($db_info->master_db)) |
|
462 | 462 | { |
463 | 463 | $db_info->master_db = array(); |
464 | 464 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
477 | 477 | unset($db_info->db_table_prefix); |
478 | 478 | |
479 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
479 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
480 | 480 | { |
481 | 481 | $db_info->master_db["db_table_prefix"] .= '_'; |
482 | 482 | } |
@@ -488,42 +488,42 @@ discard block |
||
488 | 488 | $oInstallController->makeConfigFile(); |
489 | 489 | } |
490 | 490 | |
491 | - if(version_compare(PHP_VERSION, '7.0', '>=')) |
|
491 | + if (version_compare(PHP_VERSION, '7.0', '>=')) |
|
492 | 492 | { |
493 | 493 | $db_info->master_db["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $db_info->master_db["db_type"]); |
494 | - foreach($db_info->slave_db as &$slave_db_info) |
|
494 | + foreach ($db_info->slave_db as &$slave_db_info) |
|
495 | 495 | { |
496 | 496 | $slave_db_info["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $slave_db_info["db_type"]); |
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | - if(!$db_info->use_prepared_statements) |
|
500 | + if (!$db_info->use_prepared_statements) |
|
501 | 501 | { |
502 | 502 | $db_info->use_prepared_statements = 'Y'; |
503 | 503 | } |
504 | 504 | |
505 | - if(!$db_info->time_zone) |
|
505 | + if (!$db_info->time_zone) |
|
506 | 506 | $db_info->time_zone = date('O'); |
507 | 507 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
508 | 508 | |
509 | - if($db_info->qmail_compatibility != 'Y') |
|
509 | + if ($db_info->qmail_compatibility != 'Y') |
|
510 | 510 | $db_info->qmail_compatibility = 'N'; |
511 | 511 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
512 | 512 | |
513 | - if(!$db_info->use_db_session) |
|
513 | + if (!$db_info->use_db_session) |
|
514 | 514 | $db_info->use_db_session = 'N'; |
515 | - if(!$db_info->use_ssl) |
|
515 | + if (!$db_info->use_ssl) |
|
516 | 516 | $db_info->use_ssl = 'none'; |
517 | 517 | $this->set('_use_ssl', $db_info->use_ssl); |
518 | 518 | |
519 | 519 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
520 | 520 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
521 | 521 | |
522 | - if(!$db_info->sitelock_whitelist) { |
|
522 | + if (!$db_info->sitelock_whitelist) { |
|
523 | 523 | $db_info->sitelock_whitelist = '127.0.0.1'; |
524 | 524 | } |
525 | 525 | |
526 | - if(is_string($db_info->sitelock_whitelist)) { |
|
526 | + if (is_string($db_info->sitelock_whitelist)) { |
|
527 | 527 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
528 | 528 | } |
529 | 529 | |
@@ -594,10 +594,10 @@ discard block |
||
594 | 594 | function loadLangSupported() |
595 | 595 | { |
596 | 596 | static $lang_supported = null; |
597 | - if(!$lang_supported) |
|
597 | + if (!$lang_supported) |
|
598 | 598 | { |
599 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
600 | - foreach($langs as $val) |
|
599 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
600 | + foreach ($langs as $val) |
|
601 | 601 | { |
602 | 602 | list($lang_prefix, $lang_text) = explode(',', $val); |
603 | 603 | $lang_text = trim($lang_text); |
@@ -615,17 +615,17 @@ discard block |
||
615 | 615 | function loadLangSelected() |
616 | 616 | { |
617 | 617 | static $lang_selected = null; |
618 | - if(!$lang_selected) |
|
618 | + if (!$lang_selected) |
|
619 | 619 | { |
620 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
621 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
622 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
620 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
621 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
622 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
623 | 623 | { |
624 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
624 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
625 | 625 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
626 | 626 | } |
627 | 627 | |
628 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
628 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
629 | 629 | { |
630 | 630 | $buff = FileHandler::readFile($orig_lang_file); |
631 | 631 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | else |
635 | 635 | { |
636 | 636 | $langs = file($selected_lang_file); |
637 | - foreach($langs as $val) |
|
637 | + foreach ($langs as $val) |
|
638 | 638 | { |
639 | 639 | list($lang_prefix, $lang_text) = explode(',', $val); |
640 | 640 | $lang_text = trim($lang_text); |
@@ -653,56 +653,56 @@ discard block |
||
653 | 653 | function checkSSO() |
654 | 654 | { |
655 | 655 | // pass if it's not GET request or XE is not yet installed |
656 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
656 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
657 | 657 | { |
658 | 658 | return TRUE; |
659 | 659 | } |
660 | 660 | $checkActList = array('rss' => 1, 'atom' => 1); |
661 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
661 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
662 | 662 | { |
663 | 663 | return TRUE; |
664 | 664 | } |
665 | 665 | |
666 | 666 | // pass if default URL is not set |
667 | 667 | $default_url = trim($this->db_info->default_url); |
668 | - if(!$default_url) |
|
668 | + if (!$default_url) |
|
669 | 669 | { |
670 | 670 | return TRUE; |
671 | 671 | } |
672 | 672 | |
673 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
673 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
674 | 674 | { |
675 | 675 | $default_url .= '/'; |
676 | 676 | } |
677 | 677 | |
678 | 678 | // for sites recieving SSO valdiation |
679 | - if($default_url == self::getRequestUri()) |
|
679 | + if ($default_url == self::getRequestUri()) |
|
680 | 680 | { |
681 | - if(self::get('url')) |
|
681 | + if (self::get('url')) |
|
682 | 682 | { |
683 | 683 | $url = base64_decode(self::get('url')); |
684 | 684 | $url_info = parse_url($url); |
685 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
685 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
686 | 686 | { |
687 | 687 | echo self::get('lang')->msg_invalid_request; |
688 | 688 | return false; |
689 | 689 | } |
690 | 690 | |
691 | 691 | $oModuleModel = getModel('module'); |
692 | - $domain = $url_info['host'] . $url_info['path']; |
|
693 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
692 | + $domain = $url_info['host'].$url_info['path']; |
|
693 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
694 | 694 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
695 | 695 | |
696 | - if($site_info->site_srl) |
|
696 | + if ($site_info->site_srl) |
|
697 | 697 | { |
698 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
699 | - $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']); |
|
698 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
699 | + $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']); |
|
700 | 700 | } |
701 | 701 | else |
702 | 702 | { |
703 | 703 | $redirect_url = $url; |
704 | 704 | } |
705 | - header('location:' . $redirect_url); |
|
705 | + header('location:'.$redirect_url); |
|
706 | 706 | |
707 | 707 | return FALSE; |
708 | 708 | } |
@@ -711,9 +711,9 @@ discard block |
||
711 | 711 | else |
712 | 712 | { |
713 | 713 | // result handling : set session_name() |
714 | - if($session_name = self::get('SSOID')) |
|
714 | + if ($session_name = self::get('SSOID')) |
|
715 | 715 | { |
716 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
716 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
717 | 717 | { |
718 | 718 | echo self::get('lang')->msg_invalid_request; |
719 | 719 | return false; |
@@ -722,17 +722,17 @@ discard block |
||
722 | 722 | setcookie(session_name(), $session_name); |
723 | 723 | |
724 | 724 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
725 | - header('location:' . $url); |
|
725 | + header('location:'.$url); |
|
726 | 726 | return FALSE; |
727 | 727 | // send SSO request |
728 | 728 | } |
729 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
729 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
730 | 730 | { |
731 | 731 | setcookie('sso', md5(self::getRequestUri())); |
732 | 732 | $origin_url = self::getRequestUrl(); |
733 | 733 | $origin_sig = Password::createSignature($origin_url); |
734 | 734 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
735 | - header('location:' . $url); |
|
735 | + header('location:'.$url); |
|
736 | 736 | return FALSE; |
737 | 737 | } |
738 | 738 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | { |
760 | 760 | $self = self::getInstance(); |
761 | 761 | |
762 | - if(!$self->isFTPRegisted()) |
|
762 | + if (!$self->isFTPRegisted()) |
|
763 | 763 | { |
764 | 764 | return null; |
765 | 765 | } |
@@ -777,15 +777,15 @@ discard block |
||
777 | 777 | */ |
778 | 778 | function addBrowserTitle($site_title) |
779 | 779 | { |
780 | - if(!$site_title) |
|
780 | + if (!$site_title) |
|
781 | 781 | { |
782 | 782 | return; |
783 | 783 | } |
784 | 784 | $self = self::getInstance(); |
785 | 785 | |
786 | - if($self->site_title) |
|
786 | + if ($self->site_title) |
|
787 | 787 | { |
788 | - $self->site_title .= ' - ' . $site_title; |
|
788 | + $self->site_title .= ' - '.$site_title; |
|
789 | 789 | } |
790 | 790 | else |
791 | 791 | { |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | */ |
802 | 802 | function setBrowserTitle($site_title) |
803 | 803 | { |
804 | - if(!$site_title) |
|
804 | + if (!$site_title) |
|
805 | 805 | { |
806 | 806 | return; |
807 | 807 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | $oModuleModel = getModel('module'); |
834 | 834 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
835 | 835 | |
836 | - if(isset($moduleConfig->siteTitle)) |
|
836 | + if (isset($moduleConfig->siteTitle)) |
|
837 | 837 | { |
838 | 838 | return $moduleConfig->siteTitle; |
839 | 839 | } |
@@ -860,30 +860,30 @@ discard block |
||
860 | 860 | global $lang; |
861 | 861 | |
862 | 862 | $self = self::getInstance(); |
863 | - if(!$self->lang_type) |
|
863 | + if (!$self->lang_type) |
|
864 | 864 | { |
865 | 865 | return; |
866 | 866 | } |
867 | - if(!is_object($lang)) |
|
867 | + if (!is_object($lang)) |
|
868 | 868 | { |
869 | 869 | $lang = new stdClass; |
870 | 870 | } |
871 | 871 | |
872 | - if(!($filename = $self->_loadXmlLang($path))) |
|
872 | + if (!($filename = $self->_loadXmlLang($path))) |
|
873 | 873 | { |
874 | 874 | $filename = $self->_loadPhpLang($path); |
875 | 875 | } |
876 | 876 | |
877 | - if(!is_array($self->loaded_lang_files)) |
|
877 | + if (!is_array($self->loaded_lang_files)) |
|
878 | 878 | { |
879 | 879 | $self->loaded_lang_files = array(); |
880 | 880 | } |
881 | - if(in_array($filename, $self->loaded_lang_files)) |
|
881 | + if (in_array($filename, $self->loaded_lang_files)) |
|
882 | 882 | { |
883 | 883 | return; |
884 | 884 | } |
885 | 885 | |
886 | - if($filename && is_readable($filename)) |
|
886 | + if ($filename && is_readable($filename)) |
|
887 | 887 | { |
888 | 888 | $self->loaded_lang_files[] = $filename; |
889 | 889 | include($filename); |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | { |
905 | 905 | global $lang; |
906 | 906 | |
907 | - if(!$path) return; |
|
907 | + if (!$path) return; |
|
908 | 908 | |
909 | - $_path = 'eval://' . $path; |
|
909 | + $_path = 'eval://'.$path; |
|
910 | 910 | |
911 | - if(in_array($_path, $this->loaded_lang_files)) |
|
911 | + if (in_array($_path, $this->loaded_lang_files)) |
|
912 | 912 | { |
913 | 913 | return; |
914 | 914 | } |
915 | 915 | |
916 | - if(substr_compare($path, '/', -1) !== 0) |
|
916 | + if (substr_compare($path, '/', -1) !== 0) |
|
917 | 917 | { |
918 | 918 | $path .= '/'; |
919 | 919 | } |
920 | 920 | |
921 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
921 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
922 | 922 | $content = $oXmlLangParser->getCompileContent(); |
923 | 923 | |
924 | - if($content) |
|
924 | + if ($content) |
|
925 | 925 | { |
926 | 926 | $this->loaded_lang_files[] = $_path; |
927 | 927 | eval($content); |
@@ -936,9 +936,9 @@ discard block |
||
936 | 936 | */ |
937 | 937 | function _loadXmlLang($path) |
938 | 938 | { |
939 | - if(!$path) return; |
|
939 | + if (!$path) return; |
|
940 | 940 | |
941 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
941 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
942 | 942 | return $oXmlLangParser->compile(); |
943 | 943 | } |
944 | 944 | |
@@ -950,22 +950,22 @@ discard block |
||
950 | 950 | */ |
951 | 951 | function _loadPhpLang($path) |
952 | 952 | { |
953 | - if(!$path) return; |
|
953 | + if (!$path) return; |
|
954 | 954 | |
955 | - if(substr_compare($path, '/', -1) !== 0) |
|
955 | + if (substr_compare($path, '/', -1) !== 0) |
|
956 | 956 | { |
957 | 957 | $path .= '/'; |
958 | 958 | } |
959 | - $path_tpl = $path . '%s.lang.php'; |
|
959 | + $path_tpl = $path.'%s.lang.php'; |
|
960 | 960 | $file = sprintf($path_tpl, $this->lang_type); |
961 | 961 | |
962 | 962 | $langs = array('ko', 'en'); // this will be configurable. |
963 | - while(!is_readable($file) && $langs[0]) |
|
963 | + while (!is_readable($file) && $langs[0]) |
|
964 | 964 | { |
965 | 965 | $file = sprintf($path_tpl, array_shift($langs)); |
966 | 966 | } |
967 | 967 | |
968 | - if(!is_readable($file)) |
|
968 | + if (!is_readable($file)) |
|
969 | 969 | { |
970 | 970 | return FALSE; |
971 | 971 | } |
@@ -1007,11 +1007,11 @@ discard block |
||
1007 | 1007 | */ |
1008 | 1008 | function getLang($code) |
1009 | 1009 | { |
1010 | - if(!$code) |
|
1010 | + if (!$code) |
|
1011 | 1011 | { |
1012 | 1012 | return; |
1013 | 1013 | } |
1014 | - if($GLOBALS['lang']->{$code}) |
|
1014 | + if ($GLOBALS['lang']->{$code}) |
|
1015 | 1015 | { |
1016 | 1016 | return $GLOBALS['lang']->{$code}; |
1017 | 1017 | } |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | */ |
1028 | 1028 | function setLang($code, $val) |
1029 | 1029 | { |
1030 | - if(!isset($GLOBALS['lang'])) |
|
1030 | + if (!isset($GLOBALS['lang'])) |
|
1031 | 1031 | { |
1032 | 1032 | $GLOBALS['lang'] = new stdClass(); |
1033 | 1033 | } |
@@ -1052,17 +1052,17 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | $obj = clone $source_obj; |
1054 | 1054 | |
1055 | - foreach($charset_list as $charset) |
|
1055 | + foreach ($charset_list as $charset) |
|
1056 | 1056 | { |
1057 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
1057 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
1058 | 1058 | $flag = self::checkConvertFlag($flag = TRUE); |
1059 | - if($flag) |
|
1059 | + if ($flag) |
|
1060 | 1060 | { |
1061 | - if($charset == 'UTF-8') |
|
1061 | + if ($charset == 'UTF-8') |
|
1062 | 1062 | { |
1063 | 1063 | return $obj; |
1064 | 1064 | } |
1065 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
1065 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
1066 | 1066 | return $obj; |
1067 | 1067 | } |
1068 | 1068 | } |
@@ -1081,11 +1081,11 @@ discard block |
||
1081 | 1081 | function checkConvertFlag(&$val, $key = null, $charset = null) |
1082 | 1082 | { |
1083 | 1083 | static $flag = TRUE; |
1084 | - if($charset) |
|
1084 | + if ($charset) |
|
1085 | 1085 | { |
1086 | - if(is_array($val)) |
|
1087 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
1088 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
1086 | + if (is_array($val)) |
|
1087 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
1088 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
1089 | 1089 | else $flag = FALSE; |
1090 | 1090 | } |
1091 | 1091 | else |
@@ -1109,9 +1109,9 @@ discard block |
||
1109 | 1109 | { |
1110 | 1110 | if (is_array($val)) |
1111 | 1111 | { |
1112 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
1112 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
1113 | 1113 | } |
1114 | - else $val = iconv($charset,'UTF-8',$val); |
|
1114 | + else $val = iconv($charset, 'UTF-8', $val); |
|
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | /** |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | */ |
1123 | 1123 | function convertEncodingStr($str) |
1124 | 1124 | { |
1125 | - if(!$str) return null; |
|
1125 | + if (!$str) return null; |
|
1126 | 1126 | $obj = new stdClass(); |
1127 | 1127 | $obj->str = $str; |
1128 | 1128 | $obj = self::convertEncoding($obj); |
@@ -1131,9 +1131,9 @@ discard block |
||
1131 | 1131 | |
1132 | 1132 | function decodeIdna($domain) |
1133 | 1133 | { |
1134 | - if(strpos($domain, 'xn--') !== FALSE) |
|
1134 | + if (strpos($domain, 'xn--') !== FALSE) |
|
1135 | 1135 | { |
1136 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1136 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1137 | 1137 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1138 | 1138 | $domain = $IDN->decode($domain); |
1139 | 1139 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | { |
1165 | 1165 | $self = self::getInstance(); |
1166 | 1166 | |
1167 | - if($self->response_method) |
|
1167 | + if ($self->response_method) |
|
1168 | 1168 | { |
1169 | 1169 | return $self->response_method; |
1170 | 1170 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
1205 | 1205 | |
1206 | 1206 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
1207 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
1207 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
1208 | 1208 | { |
1209 | 1209 | $this->isSuccessInit = FALSE; |
1210 | 1210 | } |
@@ -1217,30 +1217,30 @@ discard block |
||
1217 | 1217 | */ |
1218 | 1218 | function _setRequestArgument() |
1219 | 1219 | { |
1220 | - if(!count($_REQUEST)) |
|
1220 | + if (!count($_REQUEST)) |
|
1221 | 1221 | { |
1222 | 1222 | return; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | $requestMethod = $this->getRequestMethod(); |
1226 | - foreach($_REQUEST as $key => $val) |
|
1226 | + foreach ($_REQUEST as $key => $val) |
|
1227 | 1227 | { |
1228 | - if($val === '' || self::get($key)) |
|
1228 | + if ($val === '' || self::get($key)) |
|
1229 | 1229 | { |
1230 | 1230 | continue; |
1231 | 1231 | } |
1232 | 1232 | $key = htmlentities($key); |
1233 | 1233 | $val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET')); |
1234 | 1234 | |
1235 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
1235 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
1236 | 1236 | { |
1237 | 1237 | $set_to_vars = TRUE; |
1238 | 1238 | } |
1239 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
1239 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
1240 | 1240 | { |
1241 | 1241 | $set_to_vars = TRUE; |
1242 | 1242 | } |
1243 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1243 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1244 | 1244 | { |
1245 | 1245 | $set_to_vars = TRUE; |
1246 | 1246 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $set_to_vars = FALSE; |
1250 | 1250 | } |
1251 | 1251 | |
1252 | - if($set_to_vars) |
|
1252 | + if ($set_to_vars) |
|
1253 | 1253 | { |
1254 | 1254 | $this->_recursiveCheckVar($val); |
1255 | 1255 | } |
@@ -1260,20 +1260,20 @@ discard block |
||
1260 | 1260 | |
1261 | 1261 | function _recursiveCheckVar($val) |
1262 | 1262 | { |
1263 | - if(is_string($val)) |
|
1263 | + if (is_string($val)) |
|
1264 | 1264 | { |
1265 | - foreach($this->patterns as $pattern) |
|
1265 | + foreach ($this->patterns as $pattern) |
|
1266 | 1266 | { |
1267 | - if(preg_match($pattern, $val)) |
|
1267 | + if (preg_match($pattern, $val)) |
|
1268 | 1268 | { |
1269 | 1269 | $this->isSuccessInit = FALSE; |
1270 | 1270 | return; |
1271 | 1271 | } |
1272 | 1272 | } |
1273 | 1273 | } |
1274 | - else if(is_array($val)) |
|
1274 | + else if (is_array($val)) |
|
1275 | 1275 | { |
1276 | - foreach($val as $val2) |
|
1276 | + foreach ($val as $val2) |
|
1277 | 1277 | { |
1278 | 1278 | $this->_recursiveCheckVar($val2); |
1279 | 1279 | } |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | */ |
1288 | 1288 | function _setJSONRequestArgument() |
1289 | 1289 | { |
1290 | - if($this->getRequestMethod() != 'JSON') |
|
1290 | + if ($this->getRequestMethod() != 'JSON') |
|
1291 | 1291 | { |
1292 | 1292 | return; |
1293 | 1293 | } |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $params = array(); |
1296 | 1296 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
1297 | 1297 | |
1298 | - foreach($params as $key => $val) |
|
1298 | + foreach ($params as $key => $val) |
|
1299 | 1299 | { |
1300 | 1300 | $key = htmlentities($key); |
1301 | 1301 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
@@ -1309,13 +1309,13 @@ discard block |
||
1309 | 1309 | */ |
1310 | 1310 | function _setXmlRpcArgument() |
1311 | 1311 | { |
1312 | - if($this->getRequestMethod() != 'XMLRPC') |
|
1312 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
1313 | 1313 | { |
1314 | 1314 | return; |
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
1318 | - if(Security::detectingXEE($xml)) |
|
1318 | + if (Security::detectingXEE($xml)) |
|
1319 | 1319 | { |
1320 | 1320 | header("HTTP/1.0 400 Bad Request"); |
1321 | 1321 | exit; |
@@ -1327,12 +1327,12 @@ discard block |
||
1327 | 1327 | $params = $xml_obj->methodcall->params; |
1328 | 1328 | unset($params->node_name, $params->attrs, $params->body); |
1329 | 1329 | |
1330 | - if(!count(get_object_vars($params))) |
|
1330 | + if (!count(get_object_vars($params))) |
|
1331 | 1331 | { |
1332 | 1332 | return; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - foreach($params as $key => $val) |
|
1335 | + foreach ($params as $key => $val) |
|
1336 | 1336 | { |
1337 | 1337 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
1338 | 1338 | } |
@@ -1347,10 +1347,10 @@ discard block |
||
1347 | 1347 | */ |
1348 | 1348 | function _filterXmlVars($key, $val) |
1349 | 1349 | { |
1350 | - if(is_array($val)) |
|
1350 | + if (is_array($val)) |
|
1351 | 1351 | { |
1352 | 1352 | $stack = array(); |
1353 | - foreach($val as $k => $v) |
|
1353 | + foreach ($val as $k => $v) |
|
1354 | 1354 | { |
1355 | 1355 | $stack[$k] = $this->_filterXmlVars($k, $v); |
1356 | 1356 | } |
@@ -1360,20 +1360,20 @@ discard block |
||
1360 | 1360 | |
1361 | 1361 | $body = $val->body; |
1362 | 1362 | unset($val->node_name, $val->attrs, $val->body); |
1363 | - if(!count(get_object_vars($val))) |
|
1363 | + if (!count(get_object_vars($val))) |
|
1364 | 1364 | { |
1365 | 1365 | return $this->_filterRequestVar($key, $body, 0); |
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | $stack = new stdClass(); |
1369 | - foreach($val as $k => $v) |
|
1369 | + foreach ($val as $k => $v) |
|
1370 | 1370 | { |
1371 | 1371 | $output = $this->_filterXmlVars($k, $v); |
1372 | - if(is_object($v) && $v->attrs->type == 'array') |
|
1372 | + if (is_object($v) && $v->attrs->type == 'array') |
|
1373 | 1373 | { |
1374 | 1374 | $output = array($output); |
1375 | 1375 | } |
1376 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
1376 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
1377 | 1377 | { |
1378 | 1378 | return $output; |
1379 | 1379 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | $stack->{$k} = $output; |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - if(!count(get_object_vars($stack))) |
|
1384 | + if (!count(get_object_vars($stack))) |
|
1385 | 1385 | { |
1386 | 1386 | return NULL; |
1387 | 1387 | } |
@@ -1400,36 +1400,36 @@ discard block |
||
1400 | 1400 | */ |
1401 | 1401 | function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false) |
1402 | 1402 | { |
1403 | - if(!($isArray = is_array($val))) |
|
1403 | + if (!($isArray = is_array($val))) |
|
1404 | 1404 | { |
1405 | 1405 | $val = array($val); |
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | $result = array(); |
1409 | - foreach($val as $k => $v) |
|
1409 | + foreach ($val as $k => $v) |
|
1410 | 1410 | { |
1411 | 1411 | $k = escape($k); |
1412 | 1412 | |
1413 | - if($remove_hack && !is_array($v)) { |
|
1414 | - if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
1413 | + if ($remove_hack && !is_array($v)) { |
|
1414 | + if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
1415 | 1415 | { |
1416 | 1416 | $result[$k] = escape($v); |
1417 | 1417 | continue; |
1418 | 1418 | } |
1419 | 1419 | } |
1420 | 1420 | |
1421 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
1421 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
1422 | 1422 | { |
1423 | 1423 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
1424 | 1424 | } |
1425 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
1425 | + elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) { |
|
1426 | 1426 | $result[$k] = escape($v, false); |
1427 | 1427 | } |
1428 | - elseif($key === 'vid') |
|
1428 | + elseif ($key === 'vid') |
|
1429 | 1429 | { |
1430 | 1430 | $result[$k] = urlencode($v); |
1431 | 1431 | } |
1432 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1432 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1433 | 1433 | { |
1434 | 1434 | unset($result[$k]); |
1435 | 1435 | } |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | { |
1438 | 1438 | $result[$k] = $v; |
1439 | 1439 | |
1440 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
1440 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
1441 | 1441 | { |
1442 | 1442 | if (is_array($result[$k])) |
1443 | 1443 | { |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | } |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - if(is_array($result[$k])) |
|
1452 | + if (is_array($result[$k])) |
|
1453 | 1453 | { |
1454 | 1454 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
1455 | 1455 | } |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | $result[$k] = trim($result[$k]); |
1459 | 1459 | } |
1460 | 1460 | |
1461 | - if($remove_hack) |
|
1461 | + if ($remove_hack) |
|
1462 | 1462 | { |
1463 | 1463 | $result[$k] = escape($result[$k], false); |
1464 | 1464 | } |
@@ -1486,18 +1486,18 @@ discard block |
||
1486 | 1486 | */ |
1487 | 1487 | function _setUploadedArgument() |
1488 | 1488 | { |
1489 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1489 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1490 | 1490 | { |
1491 | 1491 | return; |
1492 | 1492 | } |
1493 | 1493 | |
1494 | - foreach($_FILES as $key => $val) |
|
1494 | + foreach ($_FILES as $key => $val) |
|
1495 | 1495 | { |
1496 | 1496 | $tmp_name = $val['tmp_name']; |
1497 | 1497 | |
1498 | - if(!is_array($tmp_name)) |
|
1498 | + if (!is_array($tmp_name)) |
|
1499 | 1499 | { |
1500 | - if(!UploadFileFilter::check($tmp_name, $val['name'])) |
|
1500 | + if (!UploadFileFilter::check($tmp_name, $val['name'])) |
|
1501 | 1501 | { |
1502 | 1502 | unset($_FILES[$key]); |
1503 | 1503 | continue; |
@@ -1511,7 +1511,7 @@ discard block |
||
1511 | 1511 | $files = array(); |
1512 | 1512 | foreach ($tmp_name as $i => $j) |
1513 | 1513 | { |
1514 | - if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
1514 | + if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
1515 | 1515 | { |
1516 | 1516 | $files = array(); |
1517 | 1517 | unset($_FILES[$key]); |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | $file['size'] = $val['size'][$i]; |
1526 | 1526 | $files[] = $file; |
1527 | 1527 | } |
1528 | - if(count($files)) |
|
1528 | + if (count($files)) |
|
1529 | 1529 | { |
1530 | 1530 | self::set($key, $files, true); |
1531 | 1531 | } |
@@ -1550,16 +1550,16 @@ discard block |
||
1550 | 1550 | function getRequestUrl() |
1551 | 1551 | { |
1552 | 1552 | static $url = null; |
1553 | - if(is_null($url)) |
|
1553 | + if (is_null($url)) |
|
1554 | 1554 | { |
1555 | 1555 | $url = self::getRequestUri(); |
1556 | - if(count($_GET) > 0) |
|
1556 | + if (count($_GET) > 0) |
|
1557 | 1557 | { |
1558 | - foreach($_GET as $key => $val) |
|
1558 | + foreach ($_GET as $key => $val) |
|
1559 | 1559 | { |
1560 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1560 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1561 | 1561 | } |
1562 | - $url .= '?' . join('&', $vars); |
|
1562 | + $url .= '?'.join('&', $vars); |
|
1563 | 1563 | } |
1564 | 1564 | } |
1565 | 1565 | return $url; |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | $self = self::getInstance(); |
1575 | 1575 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
1576 | 1576 | |
1577 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1577 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1578 | 1578 | { |
1579 | 1579 | unset($js_callback_func); |
1580 | 1580 | unset($_GET['xe_js_callback']); |
@@ -1602,22 +1602,22 @@ discard block |
||
1602 | 1602 | $self = self::getInstance(); |
1603 | 1603 | |
1604 | 1604 | // retrieve virtual site information |
1605 | - if(is_null($site_module_info)) |
|
1605 | + if (is_null($site_module_info)) |
|
1606 | 1606 | { |
1607 | 1607 | $site_module_info = self::get('site_module_info'); |
1608 | 1608 | } |
1609 | 1609 | |
1610 | 1610 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
1611 | - if($domain && isSiteID($domain)) |
|
1611 | + if ($domain && isSiteID($domain)) |
|
1612 | 1612 | { |
1613 | 1613 | $vid = $domain; |
1614 | 1614 | $domain = ''; |
1615 | 1615 | } |
1616 | 1616 | |
1617 | 1617 | // If $domain, $vid are not set, use current site information |
1618 | - if(!$domain && !$vid) |
|
1618 | + if (!$domain && !$vid) |
|
1619 | 1619 | { |
1620 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1620 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1621 | 1621 | { |
1622 | 1622 | $vid = $site_module_info->domain; |
1623 | 1623 | } |
@@ -1628,21 +1628,21 @@ discard block |
||
1628 | 1628 | } |
1629 | 1629 | |
1630 | 1630 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
1631 | - if($domain) |
|
1631 | + if ($domain) |
|
1632 | 1632 | { |
1633 | 1633 | $domain_info = parse_url($domain); |
1634 | - if(is_null($current_info)) |
|
1634 | + if (is_null($current_info)) |
|
1635 | 1635 | { |
1636 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
1636 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
1637 | 1637 | } |
1638 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
1638 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
1639 | 1639 | { |
1640 | 1640 | unset($domain); |
1641 | 1641 | } |
1642 | 1642 | else |
1643 | 1643 | { |
1644 | 1644 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
1645 | - if(substr_compare($domain, '/', -1) !== 0) |
|
1645 | + if (substr_compare($domain, '/', -1) !== 0) |
|
1646 | 1646 | { |
1647 | 1647 | $domain .= '/'; |
1648 | 1648 | } |
@@ -1652,41 +1652,41 @@ discard block |
||
1652 | 1652 | $get_vars = array(); |
1653 | 1653 | |
1654 | 1654 | // If there is no GET variables or first argument is '' to reset variables |
1655 | - if(!$self->get_vars || $args_list[0] == '') |
|
1655 | + if (!$self->get_vars || $args_list[0] == '') |
|
1656 | 1656 | { |
1657 | 1657 | // rearrange args_list |
1658 | - if(is_array($args_list) && $args_list[0] == '') |
|
1658 | + if (is_array($args_list) && $args_list[0] == '') |
|
1659 | 1659 | { |
1660 | 1660 | array_shift($args_list); |
1661 | 1661 | } |
1662 | 1662 | } |
1663 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
1663 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
1664 | 1664 | { |
1665 | 1665 | // Otherwise, make GET variables into array |
1666 | 1666 | $get_vars = get_object_vars($self->get_vars); |
1667 | 1667 | } |
1668 | 1668 | else |
1669 | 1669 | { |
1670 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
1671 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
1672 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
1673 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
1674 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
1675 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
1676 | - if($get_vars['act'] == 'IS') |
|
1670 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
1671 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
1672 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
1673 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
1674 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
1675 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
1676 | + if ($get_vars['act'] == 'IS') |
|
1677 | 1677 | { |
1678 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
1678 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
1679 | 1679 | } |
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | // arrange args_list |
1683 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1683 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1684 | 1684 | { |
1685 | 1685 | $key = $args_list[$i]; |
1686 | 1686 | $val = trim($args_list[$i + 1]); |
1687 | 1687 | |
1688 | 1688 | // If value is not set, remove the key |
1689 | - if(!isset($val) || !strlen($val)) |
|
1689 | + if (!isset($val) || !strlen($val)) |
|
1690 | 1690 | { |
1691 | 1691 | unset($get_vars[$key]); |
1692 | 1692 | continue; |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | |
1698 | 1698 | // remove vid, rnd |
1699 | 1699 | unset($get_vars['rnd']); |
1700 | - if($vid) |
|
1700 | + if ($vid) |
|
1701 | 1701 | { |
1702 | 1702 | $get_vars['vid'] = $vid; |
1703 | 1703 | } |
@@ -1714,17 +1714,17 @@ discard block |
||
1714 | 1714 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
1715 | 1715 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
1716 | 1716 | ); |
1717 | - if($act_alias[$act]) |
|
1717 | + if ($act_alias[$act]) |
|
1718 | 1718 | { |
1719 | 1719 | $get_vars['act'] = $act_alias[$act]; |
1720 | 1720 | } |
1721 | 1721 | |
1722 | 1722 | // organize URL |
1723 | 1723 | $query = ''; |
1724 | - if(count($get_vars) > 0) |
|
1724 | + if (count($get_vars) > 0) |
|
1725 | 1725 | { |
1726 | 1726 | // if using rewrite mod |
1727 | - if($self->allow_rewrite) |
|
1727 | + if ($self->allow_rewrite) |
|
1728 | 1728 | { |
1729 | 1729 | $var_keys = array_keys($get_vars); |
1730 | 1730 | sort($var_keys); |
@@ -1744,8 +1744,8 @@ discard block |
||
1744 | 1744 | 'vid' => $vid, |
1745 | 1745 | 'mid' => $mid, |
1746 | 1746 | 'mid.vid' => "$vid/$mid", |
1747 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
1748 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
1747 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
1748 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
1749 | 1749 | 'document_srl' => $srl, |
1750 | 1750 | 'document_srl.mid' => "$mid/$srl", |
1751 | 1751 | 'document_srl.vid' => "$vid/$srl", |
@@ -1762,66 +1762,66 @@ discard block |
||
1762 | 1762 | $query = $target_map[$target]; |
1763 | 1763 | } |
1764 | 1764 | |
1765 | - if(!$query) |
|
1765 | + if (!$query) |
|
1766 | 1766 | { |
1767 | 1767 | $queries = array(); |
1768 | - foreach($get_vars as $key => $val) |
|
1768 | + foreach ($get_vars as $key => $val) |
|
1769 | 1769 | { |
1770 | - if(is_array($val) && count($val) > 0) |
|
1770 | + if (is_array($val) && count($val) > 0) |
|
1771 | 1771 | { |
1772 | - foreach($val as $k => $v) |
|
1772 | + foreach ($val as $k => $v) |
|
1773 | 1773 | { |
1774 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
1774 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
1775 | 1775 | } |
1776 | 1776 | } |
1777 | - elseif(!is_array($val)) |
|
1777 | + elseif (!is_array($val)) |
|
1778 | 1778 | { |
1779 | - $queries[] = $key . '=' . urlencode($val); |
|
1779 | + $queries[] = $key.'='.urlencode($val); |
|
1780 | 1780 | } |
1781 | 1781 | } |
1782 | - if(count($queries) > 0) |
|
1782 | + if (count($queries) > 0) |
|
1783 | 1783 | { |
1784 | - $query = 'index.php?' . join('&', $queries); |
|
1784 | + $query = 'index.php?'.join('&', $queries); |
|
1785 | 1785 | } |
1786 | 1786 | } |
1787 | 1787 | } |
1788 | 1788 | |
1789 | 1789 | // If using SSL always |
1790 | 1790 | $_use_ssl = $self->get('_use_ssl'); |
1791 | - if($_use_ssl == 'always') |
|
1791 | + if ($_use_ssl == 'always') |
|
1792 | 1792 | { |
1793 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1793 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1794 | 1794 | // optional SSL use |
1795 | 1795 | } |
1796 | - elseif($_use_ssl == 'optional') |
|
1796 | + elseif ($_use_ssl == 'optional') |
|
1797 | 1797 | { |
1798 | 1798 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
1799 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
1799 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
1800 | 1800 | // no SSL |
1801 | 1801 | } |
1802 | 1802 | else |
1803 | 1803 | { |
1804 | 1804 | // currently on SSL but target is not based on SSL |
1805 | - if($_SERVER['HTTPS'] == 'on') |
|
1805 | + if ($_SERVER['HTTPS'] == 'on') |
|
1806 | 1806 | { |
1807 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1807 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1808 | 1808 | } |
1809 | - else if($domain) // if $domain is set |
|
1809 | + else if ($domain) // if $domain is set |
|
1810 | 1810 | { |
1811 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
1811 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
1812 | 1812 | } |
1813 | 1813 | else |
1814 | 1814 | { |
1815 | - $query = getScriptPath() . $query; |
|
1815 | + $query = getScriptPath().$query; |
|
1816 | 1816 | } |
1817 | 1817 | } |
1818 | 1818 | |
1819 | - if(!$encode) |
|
1819 | + if (!$encode) |
|
1820 | 1820 | { |
1821 | 1821 | return $query; |
1822 | 1822 | } |
1823 | 1823 | |
1824 | - if(!$autoEncode) |
|
1824 | + if (!$autoEncode) |
|
1825 | 1825 | { |
1826 | 1826 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1827 | 1827 | } |
@@ -1830,16 +1830,16 @@ discard block |
||
1830 | 1830 | $encode_queries = array(); |
1831 | 1831 | $parsedUrl = parse_url($query); |
1832 | 1832 | parse_str($parsedUrl['query'], $output); |
1833 | - foreach($output as $key => $value) |
|
1833 | + foreach ($output as $key => $value) |
|
1834 | 1834 | { |
1835 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1835 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1836 | 1836 | { |
1837 | 1837 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
1838 | 1838 | } |
1839 | - $encode_queries[] = $key . '=' . $value; |
|
1839 | + $encode_queries[] = $key.'='.$value; |
|
1840 | 1840 | } |
1841 | 1841 | |
1842 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1842 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1843 | 1843 | } |
1844 | 1844 | |
1845 | 1845 | /** |
@@ -1854,17 +1854,17 @@ discard block |
||
1854 | 1854 | static $url = array(); |
1855 | 1855 | |
1856 | 1856 | // Check HTTP Request |
1857 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1857 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1858 | 1858 | { |
1859 | 1859 | return; |
1860 | 1860 | } |
1861 | 1861 | |
1862 | - if(self::get('_use_ssl') == 'always') |
|
1862 | + if (self::get('_use_ssl') == 'always') |
|
1863 | 1863 | { |
1864 | 1864 | $ssl_mode = ENFORCE_SSL; |
1865 | 1865 | } |
1866 | 1866 | |
1867 | - if($domain) |
|
1867 | + if ($domain) |
|
1868 | 1868 | { |
1869 | 1869 | $domain_key = md5($domain); |
1870 | 1870 | } |
@@ -1873,14 +1873,14 @@ discard block |
||
1873 | 1873 | $domain_key = 'default'; |
1874 | 1874 | } |
1875 | 1875 | |
1876 | - if(isset($url[$ssl_mode][$domain_key])) |
|
1876 | + if (isset($url[$ssl_mode][$domain_key])) |
|
1877 | 1877 | { |
1878 | 1878 | return $url[$ssl_mode][$domain_key]; |
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
1882 | 1882 | |
1883 | - switch($ssl_mode) |
|
1883 | + switch ($ssl_mode) |
|
1884 | 1884 | { |
1885 | 1885 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
1886 | 1886 | break; |
@@ -1890,34 +1890,34 @@ discard block |
||
1890 | 1890 | break; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | - if($domain) |
|
1893 | + if ($domain) |
|
1894 | 1894 | { |
1895 | 1895 | $target_url = trim($domain); |
1896 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
1896 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
1897 | 1897 | { |
1898 | - $target_url.= '/'; |
|
1898 | + $target_url .= '/'; |
|
1899 | 1899 | } |
1900 | 1900 | } |
1901 | 1901 | else |
1902 | 1902 | { |
1903 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
1903 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
1904 | 1904 | } |
1905 | 1905 | |
1906 | - $url_info = parse_url('http://' . $target_url); |
|
1906 | + $url_info = parse_url('http://'.$target_url); |
|
1907 | 1907 | |
1908 | - if($current_use_ssl != $use_ssl) |
|
1908 | + if ($current_use_ssl != $use_ssl) |
|
1909 | 1909 | { |
1910 | 1910 | unset($url_info['port']); |
1911 | 1911 | } |
1912 | 1912 | |
1913 | - if($use_ssl) |
|
1913 | + if ($use_ssl) |
|
1914 | 1914 | { |
1915 | 1915 | $port = self::get('_https_port'); |
1916 | - if($port && $port != 443) |
|
1916 | + if ($port && $port != 443) |
|
1917 | 1917 | { |
1918 | 1918 | $url_info['port'] = $port; |
1919 | 1919 | } |
1920 | - elseif($url_info['port'] == 443) |
|
1920 | + elseif ($url_info['port'] == 443) |
|
1921 | 1921 | { |
1922 | 1922 | unset($url_info['port']); |
1923 | 1923 | } |
@@ -1925,17 +1925,17 @@ discard block |
||
1925 | 1925 | else |
1926 | 1926 | { |
1927 | 1927 | $port = self::get('_http_port'); |
1928 | - if($port && $port != 80) |
|
1928 | + if ($port && $port != 80) |
|
1929 | 1929 | { |
1930 | 1930 | $url_info['port'] = $port; |
1931 | 1931 | } |
1932 | - elseif($url_info['port'] == 80) |
|
1932 | + elseif ($url_info['port'] == 80) |
|
1933 | 1933 | { |
1934 | 1934 | unset($url_info['port']); |
1935 | 1935 | } |
1936 | 1936 | } |
1937 | 1937 | |
1938 | - $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']); |
|
1938 | + $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']); |
|
1939 | 1939 | |
1940 | 1940 | return $url[$ssl_mode][$domain_key]; |
1941 | 1941 | } |
@@ -1952,16 +1952,16 @@ discard block |
||
1952 | 1952 | { |
1953 | 1953 | $self = self::getInstance(); |
1954 | 1954 | $self->context->{$key} = $val; |
1955 | - if($set_to_get_vars === FALSE) |
|
1955 | + if ($set_to_get_vars === FALSE) |
|
1956 | 1956 | { |
1957 | 1957 | return; |
1958 | 1958 | } |
1959 | - if($val === NULL || $val === '') |
|
1959 | + if ($val === NULL || $val === '') |
|
1960 | 1960 | { |
1961 | 1961 | unset($self->get_vars->{$key}); |
1962 | 1962 | return; |
1963 | 1963 | } |
1964 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
1964 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
1965 | 1965 | { |
1966 | 1966 | $self->get_vars->{$key} = $val; |
1967 | 1967 | } |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | { |
1978 | 1978 | $self = self::getInstance(); |
1979 | 1979 | |
1980 | - if(!isset($self->context->{$key})) |
|
1980 | + if (!isset($self->context->{$key})) |
|
1981 | 1981 | { |
1982 | 1982 | return null; |
1983 | 1983 | } |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | function gets() |
1993 | 1993 | { |
1994 | 1994 | $num_args = func_num_args(); |
1995 | - if($num_args < 1) |
|
1995 | + if ($num_args < 1) |
|
1996 | 1996 | { |
1997 | 1997 | return; |
1998 | 1998 | } |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | |
2001 | 2001 | $args_list = func_get_args(); |
2002 | 2002 | $output = new stdClass(); |
2003 | - foreach($args_list as $v) |
|
2003 | + foreach ($args_list as $v) |
|
2004 | 2004 | { |
2005 | 2005 | $output->{$v} = $self->get($v); |
2006 | 2006 | } |
@@ -2026,7 +2026,7 @@ discard block |
||
2026 | 2026 | function getRequestVars() |
2027 | 2027 | { |
2028 | 2028 | $self = self::getInstance(); |
2029 | - if($self->get_vars) |
|
2029 | + if ($self->get_vars) |
|
2030 | 2030 | { |
2031 | 2031 | return clone($self->get_vars); |
2032 | 2032 | } |
@@ -2043,13 +2043,13 @@ discard block |
||
2043 | 2043 | { |
2044 | 2044 | $self = self::getInstance(); |
2045 | 2045 | |
2046 | - if(!is_readable($self->sslActionCacheFile)) |
|
2046 | + if (!is_readable($self->sslActionCacheFile)) |
|
2047 | 2047 | { |
2048 | 2048 | $buff = '<?php if(!defined("__XE__"))exit;'; |
2049 | 2049 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
2050 | 2050 | } |
2051 | 2051 | |
2052 | - if(!isset($self->ssl_actions[$action])) |
|
2052 | + if (!isset($self->ssl_actions[$action])) |
|
2053 | 2053 | { |
2054 | 2054 | $self->ssl_actions[$action] = 1; |
2055 | 2055 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2067,16 +2067,16 @@ discard block |
||
2067 | 2067 | { |
2068 | 2068 | $self = self::getInstance(); |
2069 | 2069 | |
2070 | - if(!is_readable($self->sslActionCacheFile)) |
|
2070 | + if (!is_readable($self->sslActionCacheFile)) |
|
2071 | 2071 | { |
2072 | 2072 | unset($self->ssl_actions); |
2073 | 2073 | $buff = '<?php if(!defined("__XE__"))exit;'; |
2074 | 2074 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
2075 | 2075 | } |
2076 | 2076 | |
2077 | - foreach($action_array as $action) |
|
2077 | + foreach ($action_array as $action) |
|
2078 | 2078 | { |
2079 | - if(!isset($self->ssl_actions[$action])) |
|
2079 | + if (!isset($self->ssl_actions[$action])) |
|
2080 | 2080 | { |
2081 | 2081 | $self->ssl_actions[$action] = 1; |
2082 | 2082 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | { |
2096 | 2096 | $self = self::getInstance(); |
2097 | 2097 | |
2098 | - if($self->isExistsSSLAction($action)) |
|
2098 | + if ($self->isExistsSSLAction($action)) |
|
2099 | 2099 | { |
2100 | 2100 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
2101 | 2101 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | function getSSLActions() |
2113 | 2113 | { |
2114 | 2114 | $self = self::getInstance(); |
2115 | - if($self->getSslStatus() == 'optional') |
|
2115 | + if ($self->getSslStatus() == 'optional') |
|
2116 | 2116 | { |
2117 | 2117 | return $self->ssl_actions; |
2118 | 2118 | } |
@@ -2139,12 +2139,12 @@ discard block |
||
2139 | 2139 | */ |
2140 | 2140 | function normalizeFilePath($file) |
2141 | 2141 | { |
2142 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2142 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2143 | 2143 | { |
2144 | - $file = './' . $file; |
|
2144 | + $file = './'.$file; |
|
2145 | 2145 | } |
2146 | 2146 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
2147 | - while(strpos($file, '/../') !== FALSE) |
|
2147 | + while (strpos($file, '/../') !== FALSE) |
|
2148 | 2148 | { |
2149 | 2149 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
2150 | 2150 | } |
@@ -2163,13 +2163,13 @@ discard block |
||
2163 | 2163 | { |
2164 | 2164 | $file = self::normalizeFilePath($file); |
2165 | 2165 | $script_path = getScriptPath(); |
2166 | - if(strpos($file, './') === 0) |
|
2166 | + if (strpos($file, './') === 0) |
|
2167 | 2167 | { |
2168 | - $file = $script_path . substr($file, 2); |
|
2168 | + $file = $script_path.substr($file, 2); |
|
2169 | 2169 | } |
2170 | - elseif(strpos($file, '../') === 0) |
|
2170 | + elseif (strpos($file, '../') === 0) |
|
2171 | 2171 | { |
2172 | - $file = self::normalizeFilePath($script_path . $file); |
|
2172 | + $file = self::normalizeFilePath($script_path.$file); |
|
2173 | 2173 | } |
2174 | 2174 | |
2175 | 2175 | return $file; |
@@ -2239,12 +2239,12 @@ discard block |
||
2239 | 2239 | */ |
2240 | 2240 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
2241 | 2241 | { |
2242 | - if($isRuleset) |
|
2242 | + if ($isRuleset) |
|
2243 | 2243 | { |
2244 | - if(strpos($file, '#') !== FALSE) |
|
2244 | + if (strpos($file, '#') !== FALSE) |
|
2245 | 2245 | { |
2246 | 2246 | $file = str_replace('#', '', $file); |
2247 | - if(!is_readable($file)) |
|
2247 | + if (!is_readable($file)) |
|
2248 | 2248 | { |
2249 | 2249 | $file = $autoPath; |
2250 | 2250 | } |
@@ -2309,9 +2309,9 @@ discard block |
||
2309 | 2309 | ksort($files); |
2310 | 2310 | $files = array_values($files); |
2311 | 2311 | $filenames = array(); |
2312 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
2312 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
2313 | 2313 | { |
2314 | - if(in_array($files[$i]['file'], $filenames)) |
|
2314 | + if (in_array($files[$i]['file'], $filenames)) |
|
2315 | 2315 | { |
2316 | 2316 | unset($files[$i]); |
2317 | 2317 | } |
@@ -2396,14 +2396,14 @@ discard block |
||
2396 | 2396 | */ |
2397 | 2397 | function getJavascriptPluginInfo($pluginName) |
2398 | 2398 | { |
2399 | - if($plugin_name == 'ui.datepicker') |
|
2399 | + if ($plugin_name == 'ui.datepicker') |
|
2400 | 2400 | { |
2401 | 2401 | $plugin_name = 'ui'; |
2402 | 2402 | } |
2403 | 2403 | |
2404 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
2405 | - $info_file = $plugin_path . 'plugin.load'; |
|
2406 | - if(!is_readable($info_file)) |
|
2404 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
2405 | + $info_file = $plugin_path.'plugin.load'; |
|
2406 | + if (!is_readable($info_file)) |
|
2407 | 2407 | { |
2408 | 2408 | return; |
2409 | 2409 | } |
@@ -2413,32 +2413,32 @@ discard block |
||
2413 | 2413 | $result->jsList = array(); |
2414 | 2414 | $result->cssList = array(); |
2415 | 2415 | |
2416 | - foreach($list as $filename) |
|
2416 | + foreach ($list as $filename) |
|
2417 | 2417 | { |
2418 | 2418 | $filename = trim($filename); |
2419 | - if(!$filename) |
|
2419 | + if (!$filename) |
|
2420 | 2420 | { |
2421 | 2421 | continue; |
2422 | 2422 | } |
2423 | 2423 | |
2424 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2424 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2425 | 2425 | { |
2426 | 2426 | $filename = substr($filename, 2); |
2427 | 2427 | } |
2428 | 2428 | |
2429 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2429 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2430 | 2430 | { |
2431 | - $result->jsList[] = $plugin_path . $filename; |
|
2431 | + $result->jsList[] = $plugin_path.$filename; |
|
2432 | 2432 | } |
2433 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
2433 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
2434 | 2434 | { |
2435 | - $result->cssList[] = $plugin_path . $filename; |
|
2435 | + $result->cssList[] = $plugin_path.$filename; |
|
2436 | 2436 | } |
2437 | 2437 | } |
2438 | 2438 | |
2439 | - if(is_dir($plugin_path . 'lang')) |
|
2439 | + if (is_dir($plugin_path.'lang')) |
|
2440 | 2440 | { |
2441 | - $result->langPath = $plugin_path . 'lang'; |
|
2441 | + $result->langPath = $plugin_path.'lang'; |
|
2442 | 2442 | } |
2443 | 2443 | |
2444 | 2444 | return $result; |
@@ -2454,50 +2454,50 @@ discard block |
||
2454 | 2454 | static $loaded_plugins = array(); |
2455 | 2455 | |
2456 | 2456 | $self = self::getInstance(); |
2457 | - if($plugin_name == 'ui.datepicker') |
|
2457 | + if ($plugin_name == 'ui.datepicker') |
|
2458 | 2458 | { |
2459 | 2459 | $plugin_name = 'ui'; |
2460 | 2460 | } |
2461 | 2461 | |
2462 | - if($loaded_plugins[$plugin_name]) |
|
2462 | + if ($loaded_plugins[$plugin_name]) |
|
2463 | 2463 | { |
2464 | 2464 | return; |
2465 | 2465 | } |
2466 | 2466 | $loaded_plugins[$plugin_name] = TRUE; |
2467 | 2467 | |
2468 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
2469 | - $info_file = $plugin_path . 'plugin.load'; |
|
2470 | - if(!is_readable($info_file)) |
|
2468 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
2469 | + $info_file = $plugin_path.'plugin.load'; |
|
2470 | + if (!is_readable($info_file)) |
|
2471 | 2471 | { |
2472 | 2472 | return; |
2473 | 2473 | } |
2474 | 2474 | |
2475 | 2475 | $list = file($info_file); |
2476 | - foreach($list as $filename) |
|
2476 | + foreach ($list as $filename) |
|
2477 | 2477 | { |
2478 | 2478 | $filename = trim($filename); |
2479 | - if(!$filename) |
|
2479 | + if (!$filename) |
|
2480 | 2480 | { |
2481 | 2481 | continue; |
2482 | 2482 | } |
2483 | 2483 | |
2484 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2484 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2485 | 2485 | { |
2486 | 2486 | $filename = substr($filename, 2); |
2487 | 2487 | } |
2488 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2488 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2489 | 2489 | { |
2490 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
2490 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
2491 | 2491 | } |
2492 | - if(substr_compare($filename, '.css', -4) === 0) |
|
2492 | + if (substr_compare($filename, '.css', -4) === 0) |
|
2493 | 2493 | { |
2494 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
2494 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
2495 | 2495 | } |
2496 | 2496 | } |
2497 | 2497 | |
2498 | - if(is_dir($plugin_path . 'lang')) |
|
2498 | + if (is_dir($plugin_path.'lang')) |
|
2499 | 2499 | { |
2500 | - $self->loadLang($plugin_path . 'lang'); |
|
2500 | + $self->loadLang($plugin_path.'lang'); |
|
2501 | 2501 | } |
2502 | 2502 | } |
2503 | 2503 | |
@@ -2510,7 +2510,7 @@ discard block |
||
2510 | 2510 | function addHtmlHeader($header) |
2511 | 2511 | { |
2512 | 2512 | $self = self::getInstance(); |
2513 | - $self->html_header .= "\n" . $header; |
|
2513 | + $self->html_header .= "\n".$header; |
|
2514 | 2514 | } |
2515 | 2515 | |
2516 | 2516 | function clearHtmlHeader() |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | function addBodyHeader($header) |
2563 | 2563 | { |
2564 | 2564 | $self = self::getInstance(); |
2565 | - $self->body_header .= "\n" . $header; |
|
2565 | + $self->body_header .= "\n".$header; |
|
2566 | 2566 | } |
2567 | 2567 | |
2568 | 2568 | /** |
@@ -2584,7 +2584,7 @@ discard block |
||
2584 | 2584 | function addHtmlFooter($footer) |
2585 | 2585 | { |
2586 | 2586 | $self = self::getInstance(); |
2587 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
2587 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
2588 | 2588 | } |
2589 | 2589 | |
2590 | 2590 | /** |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | */ |
2606 | 2606 | function getConfigFile() |
2607 | 2607 | { |
2608 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
2608 | + return _XE_PATH_.'files/config/db.config.php'; |
|
2609 | 2609 | } |
2610 | 2610 | |
2611 | 2611 | /** |
@@ -2615,7 +2615,7 @@ discard block |
||
2615 | 2615 | */ |
2616 | 2616 | function getFTPConfigFile() |
2617 | 2617 | { |
2618 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
2618 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
2619 | 2619 | } |
2620 | 2620 | |
2621 | 2621 | /** |
@@ -2667,14 +2667,14 @@ discard block |
||
2667 | 2667 | $_path = explode('/', $path); |
2668 | 2668 | $_base = explode('/', $base_url); |
2669 | 2669 | |
2670 | - if(!$_base[count($_base) - 1]) |
|
2670 | + if (!$_base[count($_base) - 1]) |
|
2671 | 2671 | { |
2672 | 2672 | array_pop($_base); |
2673 | 2673 | } |
2674 | 2674 | |
2675 | - foreach($_xe as $idx => $dir) |
|
2675 | + foreach ($_xe as $idx => $dir) |
|
2676 | 2676 | { |
2677 | - if($_path[0] != $dir) |
|
2677 | + if ($_path[0] != $dir) |
|
2678 | 2678 | { |
2679 | 2679 | break; |
2680 | 2680 | } |
@@ -2682,9 +2682,9 @@ discard block |
||
2682 | 2682 | } |
2683 | 2683 | |
2684 | 2684 | $idx = count($_xe) - $idx - 1; |
2685 | - while($idx--) |
|
2685 | + while ($idx--) |
|
2686 | 2686 | { |
2687 | - if(count($_base) > 0) |
|
2687 | + if (count($_base) > 0) |
|
2688 | 2688 | { |
2689 | 2689 | array_shift($_base); |
2690 | 2690 | } |
@@ -2694,13 +2694,13 @@ discard block |
||
2694 | 2694 | } |
2695 | 2695 | } |
2696 | 2696 | |
2697 | - if(count($_base) > 0) |
|
2697 | + if (count($_base) > 0) |
|
2698 | 2698 | { |
2699 | 2699 | array_unshift($_path, join('/', $_base)); |
2700 | 2700 | } |
2701 | 2701 | |
2702 | - $path = '/' . join('/', $_path); |
|
2703 | - if(substr_compare($path, '/', -1) !== 0) |
|
2702 | + $path = '/'.join('/', $_path); |
|
2703 | + if (substr_compare($path, '/', -1) !== 0) |
|
2704 | 2704 | { |
2705 | 2705 | $path .= '/'; |
2706 | 2706 | } |
@@ -2715,13 +2715,13 @@ discard block |
||
2715 | 2715 | { |
2716 | 2716 | $self = self::getInstance(); |
2717 | 2717 | |
2718 | - if(!is_array($self->meta_tags)) |
|
2718 | + if (!is_array($self->meta_tags)) |
|
2719 | 2719 | { |
2720 | 2720 | $self->meta_tags = array(); |
2721 | 2721 | } |
2722 | 2722 | |
2723 | 2723 | $ret = array(); |
2724 | - foreach($self->meta_tags as $key => $val) |
|
2724 | + foreach ($self->meta_tags as $key => $val) |
|
2725 | 2725 | { |
2726 | 2726 | list($name, $is_http_equiv) = explode("\t", $key); |
2727 | 2727 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2741,7 +2741,7 @@ discard block |
||
2741 | 2741 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
2742 | 2742 | { |
2743 | 2743 | $self = self::getInstance(); |
2744 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
2744 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
2745 | 2745 | } |
2746 | 2746 | |
2747 | 2747 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function __construct($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,7 +43,7 @@ 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 | // @see https://github.com/xpressengine/xe-core/issues/2304 |
49 | 49 | $this->error = 'msg_invalid_request'; |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | $this->mid = $mid ? $mid : Context::get('mid'); |
57 | 57 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
58 | 58 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
59 | - if($entry = Context::get('entry')) |
|
59 | + if ($entry = Context::get('entry')) |
|
60 | 60 | { |
61 | 61 | $this->entry = Context::convertEncodingStr($entry); |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Validate variables to prevent XSS |
65 | 65 | $isInvalid = NULL; |
66 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
66 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
67 | 67 | { |
68 | 68 | $isInvalid = TRUE; |
69 | 69 | } |
70 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
70 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
71 | 71 | { |
72 | 72 | $isInvalid = TRUE; |
73 | 73 | } |
74 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
74 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
75 | 75 | { |
76 | 76 | $isInvalid = TRUE; |
77 | 77 | } |
78 | - if($isInvalid) |
|
78 | + if ($isInvalid) |
|
79 | 79 | { |
80 | 80 | htmlHeader(); |
81 | 81 | echo Context::getLang("msg_invalid_request"); |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | exit; |
85 | 85 | } |
86 | 86 | |
87 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
87 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
88 | 88 | { |
89 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
89 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
90 | 90 | { |
91 | - if(Context::get('_https_port')!=null) { |
|
92 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
91 | + if (Context::get('_https_port') != null) { |
|
92 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
93 | 93 | } else { |
94 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
94 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
95 | 95 | } |
96 | 96 | return; |
97 | 97 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | // call a trigger before moduleHandler init |
101 | 101 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
102 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
102 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
103 | 103 | { |
104 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
104 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
105 | 105 | { |
106 | 106 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
107 | 107 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -112,40 +112,40 @@ discard block |
||
112 | 112 | $called_position = 'before_module_init'; |
113 | 113 | $oAddonController = getController('addon'); |
114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
115 | - if(file_exists($addon_file)) include($addon_file); |
|
115 | + if (file_exists($addon_file)) include($addon_file); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
119 | 119 | { |
120 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
120 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
121 | 121 | { |
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
125 | 125 | set_error_handler(function() { }, ~0); |
126 | 126 | |
127 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
128 | - if(!file_exists($debug_file)) |
|
127 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
128 | + if (!file_exists($debug_file)) |
|
129 | 129 | { |
130 | 130 | $print[] = '<?php exit() ?>'; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $errorname = self::getErrorType($errnumber); |
134 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
134 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
135 | 135 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
136 | 136 | $backtrace = debug_backtrace($backtrace_args); |
137 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
137 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
138 | 138 | { |
139 | 139 | array_shift($backtrace); |
140 | 140 | } |
141 | 141 | |
142 | - foreach($backtrace as $key => $value) |
|
142 | + foreach ($backtrace as $key => $value) |
|
143 | 143 | { |
144 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
144 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
145 | 145 | $print[] = $message; |
146 | 146 | } |
147 | 147 | $print[] = PHP_EOL; |
148 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
148 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
149 | 149 | restore_error_handler(); |
150 | 150 | |
151 | 151 | return true; |
@@ -161,21 +161,21 @@ discard block |
||
161 | 161 | |
162 | 162 | set_error_handler(function() { }, ~0); |
163 | 163 | |
164 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
165 | - if(!file_exists($debug_file)) |
|
164 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
165 | + if (!file_exists($debug_file)) |
|
166 | 166 | { |
167 | 167 | $print[] = '<?php exit() ?>'; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $errorname = self::getErrorType($errinfo['type']); |
171 | 171 | $print[] = '['.date('Y-m-d H:i:s').']'; |
172 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
172 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
173 | 173 | |
174 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
174 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
175 | 175 | $print[] = $message; |
176 | 176 | |
177 | 177 | $print[] = PHP_EOL; |
178 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
178 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
179 | 179 | set_error_handler(array($this, 'dummyHandler'), ~0); |
180 | 180 | |
181 | 181 | return true; |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
220 | 220 | $defaultHost = $defaultUrlInfo['host']; |
221 | 221 | |
222 | - foreach($urls as $url) |
|
222 | + foreach ($urls as $url) |
|
223 | 223 | { |
224 | - if(empty($url)) |
|
224 | + if (empty($url)) |
|
225 | 225 | { |
226 | 226 | continue; |
227 | 227 | } |
@@ -229,34 +229,34 @@ discard block |
||
229 | 229 | $urlInfo = parse_url(urldecode($url)); |
230 | 230 | $host = $urlInfo['host']; |
231 | 231 | |
232 | - if((!$urlInfo || !$host) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", $uri) === 0) |
|
232 | + if ((!$urlInfo || !$host) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", $uri) === 0) |
|
233 | 233 | { |
234 | 234 | throw new Exception('msg_invalid_request'); |
235 | 235 | } |
236 | 236 | |
237 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
237 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
238 | 238 | { |
239 | 239 | throw new Exception('msg_default_url_is_null'); |
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
243 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
244 | 244 | { |
245 | 245 | $oDocumentModel = getModel('document'); |
246 | 246 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
247 | - if($this->document_srl) |
|
247 | + if ($this->document_srl) |
|
248 | 248 | { |
249 | 249 | Context::set('document_srl', $this->document_srl); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | 253 | // Get module's information based on document_srl, if it's specified |
254 | - if($this->document_srl) |
|
254 | + if ($this->document_srl) |
|
255 | 255 | { |
256 | 256 | |
257 | 257 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
258 | 258 | // If the document does not exist, remove document_srl |
259 | - if(!$module_info) |
|
259 | + if (!$module_info) |
|
260 | 260 | { |
261 | 261 | unset($this->document_srl); |
262 | 262 | } |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | { |
265 | 265 | // If it exists, compare mid based on the module information |
266 | 266 | // if mids are not matching, set it as the document's mid |
267 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
267 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
268 | 268 | { |
269 | 269 | |
270 | - if(Context::getRequestMethod() == 'GET') |
|
270 | + if (Context::getRequestMethod() == 'GET') |
|
271 | 271 | { |
272 | 272 | $this->mid = $module_info->mid; |
273 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
273 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
274 | 274 | return FALSE; |
275 | 275 | } |
276 | 276 | else |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | } |
283 | 283 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
284 | - if($this->module && $module_info->module != $this->module) |
|
284 | + if ($this->module && $module_info->module != $this->module) |
|
285 | 285 | { |
286 | 286 | unset($module_info); |
287 | 287 | } |
@@ -290,36 +290,36 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
293 | - if(!$module_info && $this->mid) |
|
293 | + if (!$module_info && $this->mid) |
|
294 | 294 | { |
295 | 295 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
296 | 296 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
297 | 297 | } |
298 | 298 | |
299 | 299 | // redirect, if module_site_srl and site_srl are different |
300 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
300 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
301 | 301 | { |
302 | 302 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
303 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
303 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
304 | 304 | return FALSE; |
305 | 305 | } |
306 | 306 | |
307 | 307 | // If module_info is not set still, and $module does not exist, find the default module |
308 | - if(!$module_info && !$this->module && !$this->mid) |
|
308 | + if (!$module_info && !$this->module && !$this->mid) |
|
309 | 309 | { |
310 | 310 | $module_info = $site_module_info; |
311 | 311 | } |
312 | 312 | |
313 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
313 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
314 | 314 | { |
315 | 315 | $module_info = $site_module_info; |
316 | 316 | } |
317 | 317 | |
318 | 318 | // redirect, if site_srl of module_info is different from one of site's module_info |
319 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
319 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
320 | 320 | { |
321 | 321 | // If the module is of virtual site |
322 | - if($module_info->site_srl) |
|
322 | + if ($module_info->site_srl) |
|
323 | 323 | { |
324 | 324 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
325 | 325 | $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')); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | else |
329 | 329 | { |
330 | 330 | $db_info = Context::getDBInfo(); |
331 | - if(!$db_info->default_url) |
|
331 | + if (!$db_info->default_url) |
|
332 | 332 | { |
333 | 333 | return Context::getLang('msg_default_url_is_not_defined'); |
334 | 334 | } |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | $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')); |
338 | 338 | } |
339 | 339 | } |
340 | - header("location:" . $redirect_url); |
|
340 | + header("location:".$redirect_url); |
|
341 | 341 | return FALSE; |
342 | 342 | } |
343 | 343 | |
344 | 344 | // If module info was set, retrieve variables from the module information |
345 | - if($module_info) |
|
345 | + if ($module_info) |
|
346 | 346 | { |
347 | 347 | $this->module = $module_info->module; |
348 | 348 | $this->mid = $module_info->mid; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
354 | 354 | |
355 | 355 | // use the site default layout. |
356 | - if($module_info->{$targetSrl} == -1) |
|
356 | + if ($module_info->{$targetSrl} == -1) |
|
357 | 357 | { |
358 | 358 | $oLayoutAdminModel = getAdminModel('layout'); |
359 | 359 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | // Set module and mid into module_info |
374 | - if(!isset($this->module_info)) |
|
374 | + if (!isset($this->module_info)) |
|
375 | 375 | { |
376 | 376 | $this->module_info = new stdClass(); |
377 | 377 | } |
@@ -382,21 +382,21 @@ discard block |
||
382 | 382 | $this->module_info->site_srl = $site_module_info->site_srl; |
383 | 383 | |
384 | 384 | // Still no module? it's an error |
385 | - if(!$this->module) |
|
385 | + if (!$this->module) |
|
386 | 386 | { |
387 | 387 | $this->error = 'msg_module_is_not_exists'; |
388 | 388 | $this->httpStatusCode = '404'; |
389 | 389 | } |
390 | 390 | |
391 | 391 | // If mid exists, set mid into context |
392 | - if($this->mid) |
|
392 | + if ($this->mid) |
|
393 | 393 | { |
394 | 394 | Context::set('mid', $this->mid, TRUE); |
395 | 395 | } |
396 | 396 | |
397 | 397 | // Call a trigger after moduleHandler init |
398 | 398 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
399 | - if(!$output->toBool()) |
|
399 | + if (!$output->toBool()) |
|
400 | 400 | { |
401 | 401 | $this->error = $output->getMessage(); |
402 | 402 | return TRUE; |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
419 | 419 | |
420 | 420 | // If error occurred while preparation, return a message instance |
421 | - if($this->error) |
|
421 | + if ($this->error) |
|
422 | 422 | { |
423 | 423 | $this->_setInputErrorToContext(); |
424 | 424 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
425 | 425 | $oMessageObject->setError(-1); |
426 | 426 | $oMessageObject->setMessage($this->error); |
427 | 427 | $oMessageObject->dispMessage(); |
428 | - if($this->httpStatusCode) |
|
428 | + if ($this->httpStatusCode) |
|
429 | 429 | { |
430 | 430 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
431 | 431 | } |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
437 | 437 | |
438 | 438 | // If not installed yet, modify act |
439 | - if($this->module == "install") |
|
439 | + if ($this->module == "install") |
|
440 | 440 | { |
441 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
441 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
442 | 442 | { |
443 | 443 | $this->act = $xml_info->default_index_act; |
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | 447 | // if act exists, find type of the action, if not use default index act |
448 | - if(!$this->act) |
|
448 | + if (!$this->act) |
|
449 | 449 | { |
450 | 450 | $this->act = $xml_info->default_index_act; |
451 | 451 | } |
452 | 452 | |
453 | 453 | // still no act means error |
454 | - if(!$this->act) |
|
454 | + if (!$this->act) |
|
455 | 455 | { |
456 | 456 | $this->error = 'msg_module_is_not_exists'; |
457 | 457 | $this->httpStatusCode = '404'; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $oMessageObject->setError(-1); |
462 | 462 | $oMessageObject->setMessage($this->error); |
463 | 463 | $oMessageObject->dispMessage(); |
464 | - if($this->httpStatusCode) |
|
464 | + if ($this->httpStatusCode) |
|
465 | 465 | { |
466 | 466 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
467 | 467 | } |
@@ -479,17 +479,17 @@ discard block |
||
479 | 479 | Context::addMetaTag('robots', 'noindex'); |
480 | 480 | } |
481 | 481 | |
482 | - if(!$kind && $this->module == 'admin') |
|
482 | + if (!$kind && $this->module == 'admin') |
|
483 | 483 | { |
484 | 484 | $kind = 'admin'; |
485 | 485 | } |
486 | 486 | |
487 | 487 | // check REQUEST_METHOD in controller |
488 | - if($type == 'controller') |
|
488 | + if ($type == 'controller') |
|
489 | 489 | { |
490 | 490 | $allowedMethod = $xml_info->action->{$this->act}->method; |
491 | 491 | |
492 | - if(!$allowedMethod) |
|
492 | + if (!$allowedMethod) |
|
493 | 493 | { |
494 | 494 | $allowedMethodList[0] = 'POST'; |
495 | 495 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
499 | 499 | } |
500 | 500 | |
501 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
501 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
502 | 502 | { |
503 | 503 | $this->error = "msg_invalid_request"; |
504 | 504 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | - if($this->module_info->use_mobile != "Y") |
|
512 | + if ($this->module_info->use_mobile != "Y") |
|
513 | 513 | { |
514 | 514 | Mobile::setMobile(FALSE); |
515 | 515 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | // check CSRF for non-GET actions |
520 | 520 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
521 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
521 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
522 | 522 | { |
523 | 523 | $this->error = 'msg_invalid_request'; |
524 | 524 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | } |
530 | 530 | |
531 | 531 | // Admin ip |
532 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
532 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
533 | 533 | { |
534 | 534 | $this->_setInputErrorToContext(); |
535 | 535 | $this->error = "msg_not_permitted_act"; |
@@ -541,13 +541,13 @@ discard block |
||
541 | 541 | } |
542 | 542 | |
543 | 543 | // if(type == view, and case for using mobilephone) |
544 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
544 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
545 | 545 | { |
546 | 546 | $orig_type = "view"; |
547 | 547 | $type = "mobile"; |
548 | 548 | // create a module instance |
549 | 549 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
550 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
550 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
551 | 551 | { |
552 | 552 | $type = $orig_type; |
553 | 553 | Mobile::setMobile(FALSE); |
@@ -560,14 +560,14 @@ discard block |
||
560 | 560 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
561 | 561 | } |
562 | 562 | |
563 | - if(!is_object($oModule)) |
|
563 | + if (!is_object($oModule)) |
|
564 | 564 | { |
565 | 565 | $this->_setInputErrorToContext(); |
566 | 566 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
567 | 567 | $oMessageObject->setError(-1); |
568 | 568 | $oMessageObject->setMessage($this->error); |
569 | 569 | $oMessageObject->dispMessage(); |
570 | - if($this->httpStatusCode) |
|
570 | + if ($this->httpStatusCode) |
|
571 | 571 | { |
572 | 572 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
573 | 573 | } |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | } |
576 | 576 | |
577 | 577 | // If there is no such action in the module object |
578 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
578 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
579 | 579 | { |
580 | 580 | |
581 | - if(!Context::isInstalled()) |
|
581 | + if (!Context::isInstalled()) |
|
582 | 582 | { |
583 | 583 | $this->_setInputErrorToContext(); |
584 | 584 | $this->error = 'msg_invalid_request'; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $oMessageObject->setError(-1); |
587 | 587 | $oMessageObject->setMessage($this->error); |
588 | 588 | $oMessageObject->dispMessage(); |
589 | - if($this->httpStatusCode) |
|
589 | + if ($this->httpStatusCode) |
|
590 | 590 | { |
591 | 591 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
592 | 592 | } |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | |
596 | 596 | $forward = NULL; |
597 | 597 | // 1. Look for the module with action name |
598 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
598 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
599 | 599 | { |
600 | - $module = strtolower($matches[2] . $matches[3]); |
|
600 | + $module = strtolower($matches[2].$matches[3]); |
|
601 | 601 | $xml_info = $oModuleModel->getModuleActionXml($module); |
602 | 602 | |
603 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
603 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
604 | 604 | { |
605 | 605 | $forward = new stdClass(); |
606 | 606 | $forward->module = $module; |
@@ -621,12 +621,12 @@ discard block |
||
621 | 621 | } |
622 | 622 | } |
623 | 623 | |
624 | - if(!$forward) |
|
624 | + if (!$forward) |
|
625 | 625 | { |
626 | 626 | $forward = $oModuleModel->getActionForward($this->act); |
627 | 627 | } |
628 | 628 | |
629 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
629 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
630 | 630 | { |
631 | 631 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
632 | 632 | $type = $forward->type; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $tpl_path = $oModule->getTemplatePath(); |
635 | 635 | $orig_module = $oModule; |
636 | 636 | |
637 | - if($forward->meta_noindex === 'true') { |
|
637 | + if ($forward->meta_noindex === 'true') { |
|
638 | 638 | Context::addMetaTag('robots', 'noindex'); |
639 | 639 | } |
640 | 640 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | // check CSRF for non-GET actions |
644 | 644 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
645 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
645 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
646 | 646 | { |
647 | 647 | $this->error = 'msg_invalid_request'; |
648 | 648 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -654,11 +654,11 @@ discard block |
||
654 | 654 | |
655 | 655 | // SECISSUE also check foward act method |
656 | 656 | // check REQUEST_METHOD in controller |
657 | - if($type == 'controller') |
|
657 | + if ($type == 'controller') |
|
658 | 658 | { |
659 | 659 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
660 | 660 | |
661 | - if(!$allowedMethod) |
|
661 | + if (!$allowedMethod) |
|
662 | 662 | { |
663 | 663 | $allowedMethodList[0] = 'POST'; |
664 | 664 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
668 | 668 | } |
669 | 669 | |
670 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
670 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
671 | 671 | { |
672 | 672 | $this->error = "msg_invalid_request"; |
673 | 673 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -678,13 +678,13 @@ discard block |
||
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
681 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
681 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
682 | 682 | { |
683 | 683 | $orig_type = "view"; |
684 | 684 | $type = "mobile"; |
685 | 685 | // create a module instance |
686 | 686 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
687 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
687 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
688 | 688 | { |
689 | 689 | $type = $orig_type; |
690 | 690 | Mobile::setMobile(FALSE); |
@@ -696,25 +696,25 @@ discard block |
||
696 | 696 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
697 | 697 | } |
698 | 698 | |
699 | - if(!is_object($oModule)) |
|
699 | + if (!is_object($oModule)) |
|
700 | 700 | { |
701 | 701 | $this->_setInputErrorToContext(); |
702 | 702 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
703 | 703 | $oMessageObject->setError(-1); |
704 | 704 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
705 | 705 | $oMessageObject->dispMessage(); |
706 | - if($this->httpStatusCode) |
|
706 | + if ($this->httpStatusCode) |
|
707 | 707 | { |
708 | 708 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
709 | 709 | } |
710 | 710 | return $oMessageObject; |
711 | 711 | } |
712 | 712 | |
713 | - if($this->module == "admin" && $type == "view") |
|
713 | + if ($this->module == "admin" && $type == "view") |
|
714 | 714 | { |
715 | - if($logged_info->is_admin == 'Y') |
|
715 | + if ($logged_info->is_admin == 'Y') |
|
716 | 716 | { |
717 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
717 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
718 | 718 | { |
719 | 719 | $oAdminView = getAdminView('admin'); |
720 | 720 | $oAdminView->makeGnbUrl($forward->module); |
@@ -734,10 +734,10 @@ discard block |
||
734 | 734 | return $oMessageObject; |
735 | 735 | } |
736 | 736 | } |
737 | - if($kind == 'admin') |
|
737 | + if ($kind == 'admin') |
|
738 | 738 | { |
739 | 739 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
740 | - if(!$grant->manager) |
|
740 | + if (!$grant->manager) |
|
741 | 741 | { |
742 | 742 | $this->_setInputErrorToContext(); |
743 | 743 | $this->error = 'msg_is_not_manager'; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | } |
750 | 750 | else |
751 | 751 | { |
752 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
752 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
753 | 753 | { |
754 | 754 | $this->_setInputErrorToContext(); |
755 | 755 | $this->error = 'msg_is_not_administrator'; |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | } |
763 | 763 | } |
764 | 764 | } |
765 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
765 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
766 | 766 | { |
767 | 767 | $this->act = $xml_info->default_index_act; |
768 | 768 | } |
@@ -776,16 +776,16 @@ discard block |
||
776 | 776 | } |
777 | 777 | |
778 | 778 | // ruleset check... |
779 | - if(!empty($ruleset)) |
|
779 | + if (!empty($ruleset)) |
|
780 | 780 | { |
781 | 781 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
782 | 782 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
783 | - if(!empty($rulesetFile)) |
|
783 | + if (!empty($rulesetFile)) |
|
784 | 784 | { |
785 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
785 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
786 | 786 | { |
787 | 787 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
788 | - foreach($errorLang as $key => $val) |
|
788 | + foreach ($errorLang as $key => $val) |
|
789 | 789 | { |
790 | 790 | Context::setLang($key, $val); |
791 | 791 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | |
795 | 795 | $Validator = new Validator($rulesetFile); |
796 | 796 | $result = $Validator->validate(); |
797 | - if(!$result) |
|
797 | + if (!$result) |
|
798 | 798 | { |
799 | 799 | $lastError = $Validator->getLastError(); |
800 | 800 | $returnUrl = Context::get('error_return_url'); |
@@ -826,26 +826,26 @@ discard block |
||
826 | 826 | 'dispLayoutPreviewWithModule' => 1 |
827 | 827 | ); |
828 | 828 | $db_use_mobile = Mobile::isMobileEnabled(); |
829 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
829 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
830 | 830 | { |
831 | 831 | global $lang; |
832 | 832 | $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>'; |
833 | - $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>'; |
|
833 | + $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>'; |
|
834 | 834 | Context::addHtmlHeader($header); |
835 | 835 | Context::addHtmlFooter($footer); |
836 | 836 | } |
837 | 837 | |
838 | - if(($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
838 | + if (($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
839 | 839 | { |
840 | 840 | $module_config = $oModuleModel->getModuleConfig('module'); |
841 | - if($module_config->htmlFooter) |
|
841 | + if ($module_config->htmlFooter) |
|
842 | 842 | { |
843 | 843 | Context::addHtmlFooter($module_config->htmlFooter); |
844 | 844 | } |
845 | - if($module_config->siteTitle) |
|
845 | + if ($module_config->siteTitle) |
|
846 | 846 | { |
847 | 847 | $siteTitle = Context::getBrowserTitle(); |
848 | - if(!$siteTitle) |
|
848 | + if (!$siteTitle) |
|
849 | 849 | { |
850 | 850 | Context::setBrowserTitle($module_config->siteTitle); |
851 | 851 | } |
@@ -862,18 +862,18 @@ discard block |
||
862 | 862 | $procResult = $oModule->proc(); |
863 | 863 | |
864 | 864 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
865 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
865 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
866 | 866 | { |
867 | 867 | $error = $oModule->getError(); |
868 | 868 | $message = $oModule->getMessage(); |
869 | 869 | $messageType = $oModule->getMessageType(); |
870 | 870 | $redirectUrl = $oModule->getRedirectUrl(); |
871 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
871 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
872 | 872 | |
873 | - if(!$procResult) |
|
873 | + if (!$procResult) |
|
874 | 874 | { |
875 | 875 | $this->error = $message; |
876 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
876 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
877 | 877 | { |
878 | 878 | $redirectUrl = Context::get('error_return_url'); |
879 | 879 | } |
@@ -886,13 +886,13 @@ discard block |
||
886 | 886 | |
887 | 887 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
888 | 888 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
889 | - if($message != 'success') |
|
889 | + if ($message != 'success') |
|
890 | 890 | { |
891 | 891 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
892 | 892 | } |
893 | 893 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
894 | 894 | |
895 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
895 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
896 | 896 | { |
897 | 897 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
898 | 898 | } |
@@ -908,27 +908,27 @@ discard block |
||
908 | 908 | * */ |
909 | 909 | function _setInputErrorToContext() |
910 | 910 | { |
911 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
911 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
912 | 912 | { |
913 | 913 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
914 | 914 | } |
915 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
915 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
916 | 916 | { |
917 | 917 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
918 | 918 | } |
919 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
919 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
920 | 920 | { |
921 | 921 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
922 | 922 | } |
923 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
923 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
924 | 924 | { |
925 | 925 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
926 | 926 | } |
927 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
927 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
928 | 928 | { |
929 | 929 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
930 | 930 | } |
931 | - if(count($_SESSION['INPUT_ERROR'])) |
|
931 | + if (count($_SESSION['INPUT_ERROR'])) |
|
932 | 932 | { |
933 | 933 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
934 | 934 | } |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | { |
959 | 959 | $requestVars = Context::getRequestVars(); |
960 | 960 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
961 | - foreach($requestVars AS $key => $value) |
|
961 | + foreach ($requestVars AS $key => $value) |
|
962 | 962 | { |
963 | 963 | $_SESSION['INPUT_ERROR'][$key] = $value; |
964 | 964 | } |
@@ -972,41 +972,41 @@ discard block |
||
972 | 972 | function displayContent($oModule = NULL) |
973 | 973 | { |
974 | 974 | // If the module is not set or not an object, set error |
975 | - if(!$oModule || !is_object($oModule)) |
|
975 | + if (!$oModule || !is_object($oModule)) |
|
976 | 976 | { |
977 | 977 | $this->error = 'msg_module_is_not_exists'; |
978 | 978 | $this->httpStatusCode = '404'; |
979 | 979 | } |
980 | 980 | |
981 | 981 | // If connection to DB has a problem even though it's not install module, set error |
982 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
982 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
983 | 983 | { |
984 | 984 | $this->error = 'msg_dbconnect_failed'; |
985 | 985 | } |
986 | 986 | |
987 | 987 | // Call trigger after moduleHandler proc |
988 | 988 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
989 | - if(!$output->toBool()) |
|
989 | + if (!$output->toBool()) |
|
990 | 990 | { |
991 | 991 | $this->error = $output->getMessage(); |
992 | 992 | } |
993 | 993 | |
994 | 994 | // Use message view object, if HTML call |
995 | 995 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
996 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
996 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
997 | 997 | { |
998 | 998 | |
999 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
999 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
1000 | 1000 | { |
1001 | 1001 | $display_handler = new DisplayHandler(); |
1002 | 1002 | $display_handler->_debugOutput(); |
1003 | 1003 | |
1004 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
1004 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
1005 | 1005 | return; |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | // If error occurred, handle it |
1009 | - if($this->error) |
|
1009 | + if ($this->error) |
|
1010 | 1010 | { |
1011 | 1011 | // display content with message module instance |
1012 | 1012 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -1015,14 +1015,14 @@ discard block |
||
1015 | 1015 | $oMessageObject->setMessage($this->error); |
1016 | 1016 | $oMessageObject->dispMessage(); |
1017 | 1017 | |
1018 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1018 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1019 | 1019 | { |
1020 | 1020 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
1021 | 1021 | $oMessageObject->setTemplateFile('http_status_code'); |
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | // If module was called normally, change the templates of the module into ones of the message view module |
1025 | - if($oModule) |
|
1025 | + if ($oModule) |
|
1026 | 1026 | { |
1027 | 1027 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
1028 | 1028 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | // Check if layout_srl exists for the module |
1040 | - if(Mobile::isFromMobilePhone()) |
|
1040 | + if (Mobile::isFromMobilePhone()) |
|
1041 | 1041 | { |
1042 | 1042 | $layout_srl = $oModule->module_info->mlayout_srl; |
1043 | 1043 | } |
@@ -1047,58 +1047,58 @@ discard block |
||
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | // if layout_srl is rollback by module, set default layout |
1050 | - if($layout_srl == -1) |
|
1050 | + if ($layout_srl == -1) |
|
1051 | 1051 | { |
1052 | 1052 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
1053 | 1053 | $oLayoutAdminModel = getAdminModel('layout'); |
1054 | 1054 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
1055 | 1055 | } |
1056 | 1056 | |
1057 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
1057 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
1058 | 1058 | { |
1059 | 1059 | |
1060 | 1060 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
1061 | 1061 | $oLayoutModel = getModel('layout'); |
1062 | 1062 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
1063 | - if($layout_info) |
|
1063 | + if ($layout_info) |
|
1064 | 1064 | { |
1065 | 1065 | |
1066 | 1066 | // Input extra_vars into $layout_info |
1067 | - if($layout_info->extra_var_count) |
|
1067 | + if ($layout_info->extra_var_count) |
|
1068 | 1068 | { |
1069 | 1069 | |
1070 | - foreach($layout_info->extra_var as $var_id => $val) |
|
1070 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
1071 | 1071 | { |
1072 | - if($val->type == 'image') |
|
1072 | + if ($val->type == 'image') |
|
1073 | 1073 | { |
1074 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1074 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1075 | 1075 | { |
1076 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
1076 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
1077 | 1077 | } |
1078 | 1078 | } |
1079 | 1079 | $layout_info->{$var_id} = $val->value; |
1080 | 1080 | } |
1081 | 1081 | } |
1082 | 1082 | // Set menus into context |
1083 | - if($layout_info->menu_count) |
|
1083 | + if ($layout_info->menu_count) |
|
1084 | 1084 | { |
1085 | - foreach($layout_info->menu as $menu_id => $menu) |
|
1085 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
1086 | 1086 | { |
1087 | 1087 | // set default menu set(included home menu) |
1088 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
1088 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
1089 | 1089 | { |
1090 | 1090 | $oMenuAdminController = getAdminController('menu'); |
1091 | 1091 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
1092 | 1092 | |
1093 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
1093 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
1094 | 1094 | { |
1095 | 1095 | include($homeMenuCacheFile); |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - if(!$menu->menu_srl) |
|
1098 | + if (!$menu->menu_srl) |
|
1099 | 1099 | { |
1100 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
1101 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
1100 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
1101 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
1102 | 1102 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
1103 | 1103 | } |
1104 | 1104 | else |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | $php_file = FileHandler::exists($menu->php_file); |
1112 | - if($php_file) |
|
1112 | + if ($php_file) |
|
1113 | 1113 | { |
1114 | 1114 | include($php_file); |
1115 | 1115 | } |
@@ -1125,17 +1125,17 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | // If layout was modified, use the modified version |
1127 | 1127 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
1128 | - if(file_exists($edited_layout)) |
|
1128 | + if (file_exists($edited_layout)) |
|
1129 | 1129 | { |
1130 | 1130 | $oModule->setEditedLayoutFile($edited_layout); |
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | $isLayoutDrop = Context::get('isLayoutDrop'); |
1135 | - if($isLayoutDrop) |
|
1135 | + if ($isLayoutDrop) |
|
1136 | 1136 | { |
1137 | 1137 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
1138 | - if($kind == 'admin') |
|
1138 | + if ($kind == 'admin') |
|
1139 | 1139 | { |
1140 | 1140 | $oModule->setLayoutFile('popup_layout'); |
1141 | 1141 | } |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | function &getModuleInstance($module, $type = 'view', $kind = '') |
1174 | 1174 | { |
1175 | 1175 | |
1176 | - if(__DEBUG__ == 3) |
|
1176 | + if (__DEBUG__ == 3) |
|
1177 | 1177 | { |
1178 | 1178 | $start_time = getMicroTime(); |
1179 | 1179 | } |
@@ -1183,51 +1183,51 @@ discard block |
||
1183 | 1183 | $type = strtolower($type); |
1184 | 1184 | |
1185 | 1185 | $kinds = array('svc' => 1, 'admin' => 1); |
1186 | - if(!isset($kinds[$kind])) |
|
1186 | + if (!isset($kinds[$kind])) |
|
1187 | 1187 | { |
1188 | 1188 | $kind = 'svc'; |
1189 | 1189 | } |
1190 | 1190 | |
1191 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
1191 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
1192 | 1192 | |
1193 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1193 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1194 | 1194 | { |
1195 | 1195 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | // if there is no instance of the module in global variable, create a new one |
1199 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1199 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1200 | 1200 | { |
1201 | 1201 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1202 | 1202 | |
1203 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1203 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1204 | 1204 | { |
1205 | 1205 | $module = $parent_module; |
1206 | 1206 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | // Check if the base class and instance class exist |
1210 | - if(!class_exists($module, true)) |
|
1210 | + if (!class_exists($module, true)) |
|
1211 | 1211 | { |
1212 | 1212 | return NULL; |
1213 | 1213 | } |
1214 | - if(!class_exists($instance_name, true)) |
|
1214 | + if (!class_exists($instance_name, true)) |
|
1215 | 1215 | { |
1216 | 1216 | return NULL; |
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | // Create an instance |
1220 | 1220 | $oModule = new $instance_name(); |
1221 | - if(!is_object($oModule)) |
|
1221 | + if (!is_object($oModule)) |
|
1222 | 1222 | { |
1223 | 1223 | return NULL; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | // Load language files for the class |
1227 | - Context::loadLang($class_path . 'lang'); |
|
1228 | - if($extend_module) |
|
1227 | + Context::loadLang($class_path.'lang'); |
|
1228 | + if ($extend_module) |
|
1229 | 1229 | { |
1230 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
1230 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | // Set variables to the instance |
@@ -1235,10 +1235,10 @@ discard block |
||
1235 | 1235 | $oModule->setModulePath($class_path); |
1236 | 1236 | |
1237 | 1237 | // If the module has a constructor, run it. |
1238 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1238 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1239 | 1239 | { |
1240 | 1240 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
1241 | - if(@method_exists($oModule, $instance_name)) |
|
1241 | + if (@method_exists($oModule, $instance_name)) |
|
1242 | 1242 | { |
1243 | 1243 | $oModule->{$instance_name}(); |
1244 | 1244 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
1249 | 1249 | } |
1250 | 1250 | |
1251 | - if(__DEBUG__ == 3) |
|
1251 | + if (__DEBUG__ == 3) |
|
1252 | 1252 | { |
1253 | 1253 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
1254 | 1254 | } |
@@ -1264,17 +1264,17 @@ discard block |
||
1264 | 1264 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
1265 | 1265 | $highClassFile = FileHandler::getRealPath($highClassFile); |
1266 | 1266 | |
1267 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
1268 | - if(!in_array($type, $types)) |
|
1267 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
1268 | + if (!in_array($type, $types)) |
|
1269 | 1269 | { |
1270 | 1270 | $type = $types[0]; |
1271 | 1271 | } |
1272 | - if($type == 'class') |
|
1272 | + if ($type == 'class') |
|
1273 | 1273 | { |
1274 | 1274 | $instanceName = '%s'; |
1275 | 1275 | $classFile = '%s%s.%s.php'; |
1276 | 1276 | } |
1277 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1277 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
1278 | 1278 | { |
1279 | 1279 | $instanceName = '%sAdmin%s'; |
1280 | 1280 | $classFile = '%s%s.admin.%s.php'; |
@@ -1299,26 +1299,26 @@ discard block |
||
1299 | 1299 | function triggerCall($trigger_name, $called_position, &$obj) |
1300 | 1300 | { |
1301 | 1301 | // skip if not installed |
1302 | - if(!Context::isInstalled()) |
|
1302 | + if (!Context::isInstalled()) |
|
1303 | 1303 | { |
1304 | 1304 | return new BaseObject(); |
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | $oModuleModel = getModel('module'); |
1308 | 1308 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
1309 | - if(!$triggers || count($triggers) < 1) |
|
1309 | + if (!$triggers || count($triggers) < 1) |
|
1310 | 1310 | { |
1311 | 1311 | return new BaseObject(); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | //store before trigger call time |
1315 | 1315 | $before_trigger_time = NULL; |
1316 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
1316 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
1317 | 1317 | { |
1318 | 1318 | $before_trigger_time = microtime(true); |
1319 | 1319 | } |
1320 | 1320 | |
1321 | - foreach($triggers as $item) |
|
1321 | + foreach ($triggers as $item) |
|
1322 | 1322 | { |
1323 | 1323 | $module = $item->module; |
1324 | 1324 | $type = $item->type; |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | |
1327 | 1327 | // todo why don't we call a normal class object ? |
1328 | 1328 | $oModule = getModule($module, $type); |
1329 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
1329 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
1330 | 1330 | { |
1331 | 1331 | continue; |
1332 | 1332 | } |
@@ -1339,12 +1339,12 @@ discard block |
||
1339 | 1339 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
1340 | 1340 | |
1341 | 1341 | $slowlog = new stdClass; |
1342 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
1343 | - $slowlog->called = $module . '.' . $called_method; |
|
1342 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
1343 | + $slowlog->called = $module.'.'.$called_method; |
|
1344 | 1344 | $slowlog->called_extension = $module; |
1345 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1345 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1346 | 1346 | |
1347 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1347 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1348 | 1348 | { |
1349 | 1349 | return $output; |
1350 | 1350 | } |
@@ -1429,9 +1429,9 @@ discard block |
||
1429 | 1429 | '511' => 'Network Authentication Required', |
1430 | 1430 | ); |
1431 | 1431 | $statusMessage = $statusMessageList[$code]; |
1432 | - if(!$statusMessage) |
|
1432 | + if (!$statusMessage) |
|
1433 | 1433 | { |
1434 | - $statusMessage = 'HTTP ' . $code; |
|
1434 | + $statusMessage = 'HTTP '.$code; |
|
1435 | 1435 | } |
1436 | 1436 | |
1437 | 1437 | Context::set('http_status_code', $code); |