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