@@ -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,7 +447,7 @@ 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 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | include($self::getConfigFile()); |
456 | 456 | |
457 | 457 | // If master_db information does not exist, the config file needs to be updated |
458 | - if(!isset($db_info->master_db)) |
|
458 | + if (!isset($db_info->master_db)) |
|
459 | 459 | { |
460 | 460 | $db_info->master_db = array(); |
461 | 461 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
474 | 474 | unset($db_info->db_table_prefix); |
475 | 475 | |
476 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
476 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
477 | 477 | { |
478 | 478 | $db_info->master_db["db_table_prefix"] .= '_'; |
479 | 479 | } |
@@ -485,33 +485,33 @@ discard block |
||
485 | 485 | $oInstallController->makeConfigFile(); |
486 | 486 | } |
487 | 487 | |
488 | - if(!$db_info->use_prepared_statements) |
|
488 | + if (!$db_info->use_prepared_statements) |
|
489 | 489 | { |
490 | 490 | $db_info->use_prepared_statements = 'Y'; |
491 | 491 | } |
492 | 492 | |
493 | - if(!$db_info->time_zone) |
|
493 | + if (!$db_info->time_zone) |
|
494 | 494 | $db_info->time_zone = date('O'); |
495 | 495 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
496 | 496 | |
497 | - if($db_info->qmail_compatibility != 'Y') |
|
497 | + if ($db_info->qmail_compatibility != 'Y') |
|
498 | 498 | $db_info->qmail_compatibility = 'N'; |
499 | 499 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
500 | 500 | |
501 | - if(!$db_info->use_db_session) |
|
501 | + if (!$db_info->use_db_session) |
|
502 | 502 | $db_info->use_db_session = 'N'; |
503 | - if(!$db_info->use_ssl) |
|
503 | + if (!$db_info->use_ssl) |
|
504 | 504 | $db_info->use_ssl = 'none'; |
505 | 505 | $this->set('_use_ssl', $db_info->use_ssl); |
506 | 506 | |
507 | 507 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
508 | 508 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
509 | 509 | |
510 | - if(!$db_info->sitelock_whitelist) { |
|
510 | + if (!$db_info->sitelock_whitelist) { |
|
511 | 511 | $db_info->sitelock_whitelist = '127.0.0.1'; |
512 | 512 | } |
513 | 513 | |
514 | - if(is_string($db_info->sitelock_whitelist)) { |
|
514 | + if (is_string($db_info->sitelock_whitelist)) { |
|
515 | 515 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
516 | 516 | } |
517 | 517 | |
@@ -582,10 +582,10 @@ discard block |
||
582 | 582 | function loadLangSupported() |
583 | 583 | { |
584 | 584 | static $lang_supported = null; |
585 | - if(!$lang_supported) |
|
585 | + if (!$lang_supported) |
|
586 | 586 | { |
587 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
588 | - foreach($langs as $val) |
|
587 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
588 | + foreach ($langs as $val) |
|
589 | 589 | { |
590 | 590 | list($lang_prefix, $lang_text) = explode(',', $val); |
591 | 591 | $lang_text = trim($lang_text); |
@@ -603,17 +603,17 @@ discard block |
||
603 | 603 | function loadLangSelected() |
604 | 604 | { |
605 | 605 | static $lang_selected = null; |
606 | - if(!$lang_selected) |
|
606 | + if (!$lang_selected) |
|
607 | 607 | { |
608 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
609 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
610 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
608 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
609 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
610 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
611 | 611 | { |
612 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
612 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
613 | 613 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
614 | 614 | } |
615 | 615 | |
616 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
616 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
617 | 617 | { |
618 | 618 | $buff = FileHandler::readFile($orig_lang_file); |
619 | 619 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | else |
623 | 623 | { |
624 | 624 | $langs = file($selected_lang_file); |
625 | - foreach($langs as $val) |
|
625 | + foreach ($langs as $val) |
|
626 | 626 | { |
627 | 627 | list($lang_prefix, $lang_text) = explode(',', $val); |
628 | 628 | $lang_text = trim($lang_text); |
@@ -641,44 +641,44 @@ discard block |
||
641 | 641 | function checkSSO() |
642 | 642 | { |
643 | 643 | // pass if it's not GET request or XE is not yet installed |
644 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
644 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
645 | 645 | { |
646 | 646 | return TRUE; |
647 | 647 | } |
648 | 648 | $checkActList = array('rss' => 1, 'atom' => 1); |
649 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
649 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
650 | 650 | { |
651 | 651 | return TRUE; |
652 | 652 | } |
653 | 653 | |
654 | 654 | // pass if default URL is not set |
655 | 655 | $default_url = trim($this->db_info->default_url); |
656 | - if(!$default_url) |
|
656 | + if (!$default_url) |
|
657 | 657 | { |
658 | 658 | return TRUE; |
659 | 659 | } |
660 | 660 | |
661 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
661 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
662 | 662 | { |
663 | 663 | $default_url .= '/'; |
664 | 664 | } |
665 | 665 | |
666 | 666 | // for sites recieving SSO valdiation |
667 | - if($default_url == self::getRequestUri()) |
|
667 | + if ($default_url == self::getRequestUri()) |
|
668 | 668 | { |
669 | - if(self::get('url')) |
|
669 | + if (self::get('url')) |
|
670 | 670 | { |
671 | 671 | $url = base64_decode(self::get('url')); |
672 | 672 | $url_info = parse_url($url); |
673 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
673 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
674 | 674 | { |
675 | 675 | echo self::get('lang')->msg_invalid_request; |
676 | 676 | return false; |
677 | 677 | } |
678 | 678 | |
679 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
680 | - $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']); |
|
681 | - header('location:' . $redirect_url); |
|
679 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
680 | + $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']); |
|
681 | + header('location:'.$redirect_url); |
|
682 | 682 | |
683 | 683 | return FALSE; |
684 | 684 | } |
@@ -687,9 +687,9 @@ discard block |
||
687 | 687 | else |
688 | 688 | { |
689 | 689 | // result handling : set session_name() |
690 | - if($session_name = self::get('SSOID')) |
|
690 | + if ($session_name = self::get('SSOID')) |
|
691 | 691 | { |
692 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
692 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
693 | 693 | { |
694 | 694 | echo self::get('lang')->msg_invalid_request; |
695 | 695 | return false; |
@@ -698,17 +698,17 @@ discard block |
||
698 | 698 | setcookie(session_name(), $session_name); |
699 | 699 | |
700 | 700 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
701 | - header('location:' . $url); |
|
701 | + header('location:'.$url); |
|
702 | 702 | return FALSE; |
703 | 703 | // send SSO request |
704 | 704 | } |
705 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
705 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
706 | 706 | { |
707 | 707 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
708 | 708 | $origin_url = self::getRequestUrl(); |
709 | 709 | $origin_sig = Password::createSignature($origin_url); |
710 | 710 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
711 | - header('location:' . $url); |
|
711 | + header('location:'.$url); |
|
712 | 712 | return FALSE; |
713 | 713 | } |
714 | 714 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | { |
736 | 736 | $self = self::getInstance(); |
737 | 737 | |
738 | - if(!$self->isFTPRegisted()) |
|
738 | + if (!$self->isFTPRegisted()) |
|
739 | 739 | { |
740 | 740 | return null; |
741 | 741 | } |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | */ |
754 | 754 | function addBrowserTitle($site_title) |
755 | 755 | { |
756 | - if(!$site_title) |
|
756 | + if (!$site_title) |
|
757 | 757 | { |
758 | 758 | return; |
759 | 759 | } |
760 | 760 | $self = self::getInstance(); |
761 | 761 | |
762 | - if($self->site_title) |
|
762 | + if ($self->site_title) |
|
763 | 763 | { |
764 | - $self->site_title .= ' - ' . $site_title; |
|
764 | + $self->site_title .= ' - '.$site_title; |
|
765 | 765 | } |
766 | 766 | else |
767 | 767 | { |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | */ |
778 | 778 | function setBrowserTitle($site_title) |
779 | 779 | { |
780 | - if(!$site_title) |
|
780 | + if (!$site_title) |
|
781 | 781 | { |
782 | 782 | return; |
783 | 783 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $oModuleModel = getModel('module'); |
810 | 810 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
811 | 811 | |
812 | - if(isset($moduleConfig->siteTitle)) |
|
812 | + if (isset($moduleConfig->siteTitle)) |
|
813 | 813 | { |
814 | 814 | return $moduleConfig->siteTitle; |
815 | 815 | } |
@@ -836,30 +836,30 @@ discard block |
||
836 | 836 | global $lang; |
837 | 837 | |
838 | 838 | $self = self::getInstance(); |
839 | - if(!$self->lang_type) |
|
839 | + if (!$self->lang_type) |
|
840 | 840 | { |
841 | 841 | return; |
842 | 842 | } |
843 | - if(!is_object($lang)) |
|
843 | + if (!is_object($lang)) |
|
844 | 844 | { |
845 | 845 | $lang = new stdClass; |
846 | 846 | } |
847 | 847 | |
848 | - if(!($filename = $self->_loadXmlLang($path))) |
|
848 | + if (!($filename = $self->_loadXmlLang($path))) |
|
849 | 849 | { |
850 | 850 | $filename = $self->_loadPhpLang($path); |
851 | 851 | } |
852 | 852 | |
853 | - if(!is_array($self->loaded_lang_files)) |
|
853 | + if (!is_array($self->loaded_lang_files)) |
|
854 | 854 | { |
855 | 855 | $self->loaded_lang_files = array(); |
856 | 856 | } |
857 | - if(in_array($filename, $self->loaded_lang_files)) |
|
857 | + if (in_array($filename, $self->loaded_lang_files)) |
|
858 | 858 | { |
859 | 859 | return; |
860 | 860 | } |
861 | 861 | |
862 | - if($filename && is_readable($filename)) |
|
862 | + if ($filename && is_readable($filename)) |
|
863 | 863 | { |
864 | 864 | $self->loaded_lang_files[] = $filename; |
865 | 865 | include($filename); |
@@ -880,24 +880,24 @@ discard block |
||
880 | 880 | { |
881 | 881 | global $lang; |
882 | 882 | |
883 | - if(!$path) return; |
|
883 | + if (!$path) return; |
|
884 | 884 | |
885 | - $_path = 'eval://' . $path; |
|
885 | + $_path = 'eval://'.$path; |
|
886 | 886 | |
887 | - if(in_array($_path, $this->loaded_lang_files)) |
|
887 | + if (in_array($_path, $this->loaded_lang_files)) |
|
888 | 888 | { |
889 | 889 | return; |
890 | 890 | } |
891 | 891 | |
892 | - if(substr_compare($path, '/', -1) !== 0) |
|
892 | + if (substr_compare($path, '/', -1) !== 0) |
|
893 | 893 | { |
894 | 894 | $path .= '/'; |
895 | 895 | } |
896 | 896 | |
897 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
897 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
898 | 898 | $content = $oXmlLangParser->getCompileContent(); |
899 | 899 | |
900 | - if($content) |
|
900 | + if ($content) |
|
901 | 901 | { |
902 | 902 | $this->loaded_lang_files[] = $_path; |
903 | 903 | eval($content); |
@@ -912,9 +912,9 @@ discard block |
||
912 | 912 | */ |
913 | 913 | function _loadXmlLang($path) |
914 | 914 | { |
915 | - if(!$path) return; |
|
915 | + if (!$path) return; |
|
916 | 916 | |
917 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
917 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
918 | 918 | return $oXmlLangParser->compile(); |
919 | 919 | } |
920 | 920 | |
@@ -926,22 +926,22 @@ discard block |
||
926 | 926 | */ |
927 | 927 | function _loadPhpLang($path) |
928 | 928 | { |
929 | - if(!$path) return; |
|
929 | + if (!$path) return; |
|
930 | 930 | |
931 | - if(substr_compare($path, '/', -1) !== 0) |
|
931 | + if (substr_compare($path, '/', -1) !== 0) |
|
932 | 932 | { |
933 | 933 | $path .= '/'; |
934 | 934 | } |
935 | - $path_tpl = $path . '%s.lang.php'; |
|
935 | + $path_tpl = $path.'%s.lang.php'; |
|
936 | 936 | $file = sprintf($path_tpl, $this->lang_type); |
937 | 937 | |
938 | 938 | $langs = array('ko', 'en'); // this will be configurable. |
939 | - while(!is_readable($file) && $langs[0]) |
|
939 | + while (!is_readable($file) && $langs[0]) |
|
940 | 940 | { |
941 | 941 | $file = sprintf($path_tpl, array_shift($langs)); |
942 | 942 | } |
943 | 943 | |
944 | - if(!is_readable($file)) |
|
944 | + if (!is_readable($file)) |
|
945 | 945 | { |
946 | 946 | return FALSE; |
947 | 947 | } |
@@ -983,11 +983,11 @@ discard block |
||
983 | 983 | */ |
984 | 984 | function getLang($code) |
985 | 985 | { |
986 | - if(!$code) |
|
986 | + if (!$code) |
|
987 | 987 | { |
988 | 988 | return; |
989 | 989 | } |
990 | - if($GLOBALS['lang']->{$code}) |
|
990 | + if ($GLOBALS['lang']->{$code}) |
|
991 | 991 | { |
992 | 992 | return $GLOBALS['lang']->{$code}; |
993 | 993 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | */ |
1004 | 1004 | function setLang($code, $val) |
1005 | 1005 | { |
1006 | - if(!isset($GLOBALS['lang'])) |
|
1006 | + if (!isset($GLOBALS['lang'])) |
|
1007 | 1007 | { |
1008 | 1008 | $GLOBALS['lang'] = new stdClass(); |
1009 | 1009 | } |
@@ -1031,17 +1031,17 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | $obj = clone $source_obj; |
1033 | 1033 | |
1034 | - foreach($charset_list as $charset) |
|
1034 | + foreach ($charset_list as $charset) |
|
1035 | 1035 | { |
1036 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
1036 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
1037 | 1037 | $flag = self::checkConvertFlag($flag = TRUE); |
1038 | - if($flag) |
|
1038 | + if ($flag) |
|
1039 | 1039 | { |
1040 | - if($charset == 'UTF-8') |
|
1040 | + if ($charset == 'UTF-8') |
|
1041 | 1041 | { |
1042 | 1042 | return $obj; |
1043 | 1043 | } |
1044 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
1044 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
1045 | 1045 | return $obj; |
1046 | 1046 | } |
1047 | 1047 | } |
@@ -1060,11 +1060,11 @@ discard block |
||
1060 | 1060 | function checkConvertFlag(&$val, $key = null, $charset = null) |
1061 | 1061 | { |
1062 | 1062 | static $flag = TRUE; |
1063 | - if($charset) |
|
1063 | + if ($charset) |
|
1064 | 1064 | { |
1065 | - if(is_array($val)) |
|
1066 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
1067 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
1065 | + if (is_array($val)) |
|
1066 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
1067 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
1068 | 1068 | else $flag = FALSE; |
1069 | 1069 | } |
1070 | 1070 | else |
@@ -1088,9 +1088,9 @@ discard block |
||
1088 | 1088 | { |
1089 | 1089 | if (is_array($val)) |
1090 | 1090 | { |
1091 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
1091 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
1092 | 1092 | } |
1093 | - else $val = iconv($charset,'UTF-8',$val); |
|
1093 | + else $val = iconv($charset, 'UTF-8', $val); |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | /** |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | */ |
1102 | 1102 | function convertEncodingStr($str) |
1103 | 1103 | { |
1104 | - if(!$str) return null; |
|
1104 | + if (!$str) return null; |
|
1105 | 1105 | $obj = new stdClass(); |
1106 | 1106 | $obj->str = $str; |
1107 | 1107 | $obj = self::convertEncoding($obj); |
@@ -1110,9 +1110,9 @@ discard block |
||
1110 | 1110 | |
1111 | 1111 | function decodeIdna($domain) |
1112 | 1112 | { |
1113 | - if(strpos($domain, 'xn--') !== FALSE) |
|
1113 | + if (strpos($domain, 'xn--') !== FALSE) |
|
1114 | 1114 | { |
1115 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1115 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1116 | 1116 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1117 | 1117 | $domain = $IDN->decode($domain); |
1118 | 1118 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | { |
1144 | 1144 | $self = self::getInstance(); |
1145 | 1145 | |
1146 | - if($self->response_method) |
|
1146 | + if ($self->response_method) |
|
1147 | 1147 | { |
1148 | 1148 | return $self->response_method; |
1149 | 1149 | } |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
1184 | 1184 | |
1185 | 1185 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
1186 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
1186 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
1187 | 1187 | { |
1188 | 1188 | $this->isSuccessInit = FALSE; |
1189 | 1189 | } |
@@ -1196,30 +1196,30 @@ discard block |
||
1196 | 1196 | */ |
1197 | 1197 | function _setRequestArgument() |
1198 | 1198 | { |
1199 | - if(!count($_REQUEST)) |
|
1199 | + if (!count($_REQUEST)) |
|
1200 | 1200 | { |
1201 | 1201 | return; |
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | $requestMethod = $this->getRequestMethod(); |
1205 | - foreach($_REQUEST as $key => $val) |
|
1205 | + foreach ($_REQUEST as $key => $val) |
|
1206 | 1206 | { |
1207 | - if($val === '' || self::get($key)) |
|
1207 | + if ($val === '' || self::get($key)) |
|
1208 | 1208 | { |
1209 | 1209 | continue; |
1210 | 1210 | } |
1211 | 1211 | $key = htmlentities($key); |
1212 | 1212 | $val = $this->_filterRequestVar($key, $val); |
1213 | 1213 | |
1214 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
1214 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
1215 | 1215 | { |
1216 | 1216 | $set_to_vars = TRUE; |
1217 | 1217 | } |
1218 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
1218 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
1219 | 1219 | { |
1220 | 1220 | $set_to_vars = TRUE; |
1221 | 1221 | } |
1222 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1222 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
1223 | 1223 | { |
1224 | 1224 | $set_to_vars = TRUE; |
1225 | 1225 | } |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | $set_to_vars = FALSE; |
1229 | 1229 | } |
1230 | 1230 | |
1231 | - if($set_to_vars) |
|
1231 | + if ($set_to_vars) |
|
1232 | 1232 | { |
1233 | 1233 | $this->_recursiveCheckVar($val); |
1234 | 1234 | } |
@@ -1239,20 +1239,20 @@ discard block |
||
1239 | 1239 | |
1240 | 1240 | function _recursiveCheckVar($val) |
1241 | 1241 | { |
1242 | - if(is_string($val)) |
|
1242 | + if (is_string($val)) |
|
1243 | 1243 | { |
1244 | - foreach($this->patterns as $pattern) |
|
1244 | + foreach ($this->patterns as $pattern) |
|
1245 | 1245 | { |
1246 | - if(preg_match($pattern, $val)) |
|
1246 | + if (preg_match($pattern, $val)) |
|
1247 | 1247 | { |
1248 | 1248 | $this->isSuccessInit = FALSE; |
1249 | 1249 | return; |
1250 | 1250 | } |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | - else if(is_array($val)) |
|
1253 | + else if (is_array($val)) |
|
1254 | 1254 | { |
1255 | - foreach($val as $val2) |
|
1255 | + foreach ($val as $val2) |
|
1256 | 1256 | { |
1257 | 1257 | $this->_recursiveCheckVar($val2); |
1258 | 1258 | } |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | */ |
1267 | 1267 | function _setJSONRequestArgument() |
1268 | 1268 | { |
1269 | - if($this->getRequestMethod() != 'JSON') |
|
1269 | + if ($this->getRequestMethod() != 'JSON') |
|
1270 | 1270 | { |
1271 | 1271 | return; |
1272 | 1272 | } |
@@ -1274,7 +1274,7 @@ discard block |
||
1274 | 1274 | $params = array(); |
1275 | 1275 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
1276 | 1276 | |
1277 | - foreach($params as $key => $val) |
|
1277 | + foreach ($params as $key => $val) |
|
1278 | 1278 | { |
1279 | 1279 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
1280 | 1280 | } |
@@ -1287,13 +1287,13 @@ discard block |
||
1287 | 1287 | */ |
1288 | 1288 | function _setXmlRpcArgument() |
1289 | 1289 | { |
1290 | - if($this->getRequestMethod() != 'XMLRPC') |
|
1290 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
1291 | 1291 | { |
1292 | 1292 | return; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
1296 | - if(Security::detectingXEE($xml)) |
|
1296 | + if (Security::detectingXEE($xml)) |
|
1297 | 1297 | { |
1298 | 1298 | header("HTTP/1.0 400 Bad Request"); |
1299 | 1299 | exit; |
@@ -1305,12 +1305,12 @@ discard block |
||
1305 | 1305 | $params = $xml_obj->methodcall->params; |
1306 | 1306 | unset($params->node_name, $params->attrs, $params->body); |
1307 | 1307 | |
1308 | - if(!count(get_object_vars($params))) |
|
1308 | + if (!count(get_object_vars($params))) |
|
1309 | 1309 | { |
1310 | 1310 | return; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - foreach($params as $key => $val) |
|
1313 | + foreach ($params as $key => $val) |
|
1314 | 1314 | { |
1315 | 1315 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
1316 | 1316 | } |
@@ -1325,10 +1325,10 @@ discard block |
||
1325 | 1325 | */ |
1326 | 1326 | function _filterXmlVars($key, $val) |
1327 | 1327 | { |
1328 | - if(is_array($val)) |
|
1328 | + if (is_array($val)) |
|
1329 | 1329 | { |
1330 | 1330 | $stack = array(); |
1331 | - foreach($val as $k => $v) |
|
1331 | + foreach ($val as $k => $v) |
|
1332 | 1332 | { |
1333 | 1333 | $stack[$k] = $this->_filterXmlVars($k, $v); |
1334 | 1334 | } |
@@ -1338,20 +1338,20 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | $body = $val->body; |
1340 | 1340 | unset($val->node_name, $val->attrs, $val->body); |
1341 | - if(!count(get_object_vars($val))) |
|
1341 | + if (!count(get_object_vars($val))) |
|
1342 | 1342 | { |
1343 | 1343 | return $this->_filterRequestVar($key, $body, 0); |
1344 | 1344 | } |
1345 | 1345 | |
1346 | 1346 | $stack = new stdClass(); |
1347 | - foreach($val as $k => $v) |
|
1347 | + foreach ($val as $k => $v) |
|
1348 | 1348 | { |
1349 | 1349 | $output = $this->_filterXmlVars($k, $v); |
1350 | - if(is_object($v) && $v->attrs->type == 'array') |
|
1350 | + if (is_object($v) && $v->attrs->type == 'array') |
|
1351 | 1351 | { |
1352 | 1352 | $output = array($output); |
1353 | 1353 | } |
1354 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
1354 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
1355 | 1355 | { |
1356 | 1356 | return $output; |
1357 | 1357 | } |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | $stack->{$k} = $output; |
1360 | 1360 | } |
1361 | 1361 | |
1362 | - if(!count(get_object_vars($stack))) |
|
1362 | + if (!count(get_object_vars($stack))) |
|
1363 | 1363 | { |
1364 | 1364 | return NULL; |
1365 | 1365 | } |
@@ -1378,32 +1378,32 @@ discard block |
||
1378 | 1378 | */ |
1379 | 1379 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
1380 | 1380 | { |
1381 | - if(!($isArray = is_array($val))) |
|
1381 | + if (!($isArray = is_array($val))) |
|
1382 | 1382 | { |
1383 | 1383 | $val = array($val); |
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | $result = array(); |
1387 | - foreach($val as $k => $v) |
|
1387 | + foreach ($val as $k => $v) |
|
1388 | 1388 | { |
1389 | 1389 | $k = htmlentities($k); |
1390 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
1390 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
1391 | 1391 | { |
1392 | 1392 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
1393 | 1393 | } |
1394 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
1394 | + elseif ($key === 'mid' || $key === 'search_keyword') |
|
1395 | 1395 | { |
1396 | 1396 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1397 | 1397 | } |
1398 | - elseif($key === 'vid') |
|
1398 | + elseif ($key === 'vid') |
|
1399 | 1399 | { |
1400 | 1400 | $result[$k] = urlencode($v); |
1401 | 1401 | } |
1402 | - elseif($key === 'xe_validator_id') |
|
1402 | + elseif ($key === 'xe_validator_id') |
|
1403 | 1403 | { |
1404 | 1404 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1405 | 1405 | } |
1406 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1406 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
1407 | 1407 | { |
1408 | 1408 | unset($result[$k]); |
1409 | 1409 | } |
@@ -1411,12 +1411,12 @@ discard block |
||
1411 | 1411 | { |
1412 | 1412 | $result[$k] = $v; |
1413 | 1413 | |
1414 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
1414 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
1415 | 1415 | { |
1416 | 1416 | $result[$k] = stripslashes($result[$k]); |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - if(!is_array($result[$k])) |
|
1419 | + if (!is_array($result[$k])) |
|
1420 | 1420 | { |
1421 | 1421 | $result[$k] = trim($result[$k]); |
1422 | 1422 | } |
@@ -1444,17 +1444,17 @@ discard block |
||
1444 | 1444 | */ |
1445 | 1445 | function _setUploadedArgument() |
1446 | 1446 | { |
1447 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1447 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1448 | 1448 | { |
1449 | 1449 | return; |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - foreach($_FILES as $key => $val) |
|
1452 | + foreach ($_FILES as $key => $val) |
|
1453 | 1453 | { |
1454 | 1454 | $tmp_name = $val['tmp_name']; |
1455 | - if(!is_array($tmp_name)) |
|
1455 | + if (!is_array($tmp_name)) |
|
1456 | 1456 | { |
1457 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
1457 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
1458 | 1458 | { |
1459 | 1459 | continue; |
1460 | 1460 | } |
@@ -1464,9 +1464,9 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | else |
1466 | 1466 | { |
1467 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
1467 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
1468 | 1468 | { |
1469 | - if($val['size'][$i] > 0) |
|
1469 | + if ($val['size'][$i] > 0) |
|
1470 | 1470 | { |
1471 | 1471 | $file['name'] = $val['name'][$i]; |
1472 | 1472 | $file['type'] = $val['type'][$i]; |
@@ -1498,16 +1498,16 @@ discard block |
||
1498 | 1498 | function getRequestUrl() |
1499 | 1499 | { |
1500 | 1500 | static $url = null; |
1501 | - if(is_null($url)) |
|
1501 | + if (is_null($url)) |
|
1502 | 1502 | { |
1503 | 1503 | $url = self::getRequestUri(); |
1504 | - if(count($_GET) > 0) |
|
1504 | + if (count($_GET) > 0) |
|
1505 | 1505 | { |
1506 | - foreach($_GET as $key => $val) |
|
1506 | + foreach ($_GET as $key => $val) |
|
1507 | 1507 | { |
1508 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1508 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1509 | 1509 | } |
1510 | - $url .= '?' . join('&', $vars); |
|
1510 | + $url .= '?'.join('&', $vars); |
|
1511 | 1511 | } |
1512 | 1512 | } |
1513 | 1513 | return $url; |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | $self = self::getInstance(); |
1523 | 1523 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
1524 | 1524 | |
1525 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1525 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1526 | 1526 | { |
1527 | 1527 | unset($js_callback_func); |
1528 | 1528 | unset($_GET['xe_js_callback']); |
@@ -1550,22 +1550,22 @@ discard block |
||
1550 | 1550 | $self = self::getInstance(); |
1551 | 1551 | |
1552 | 1552 | // retrieve virtual site information |
1553 | - if(is_null($site_module_info)) |
|
1553 | + if (is_null($site_module_info)) |
|
1554 | 1554 | { |
1555 | 1555 | $site_module_info = self::get('site_module_info'); |
1556 | 1556 | } |
1557 | 1557 | |
1558 | 1558 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
1559 | - if($domain && isSiteID($domain)) |
|
1559 | + if ($domain && isSiteID($domain)) |
|
1560 | 1560 | { |
1561 | 1561 | $vid = $domain; |
1562 | 1562 | $domain = ''; |
1563 | 1563 | } |
1564 | 1564 | |
1565 | 1565 | // If $domain, $vid are not set, use current site information |
1566 | - if(!$domain && !$vid) |
|
1566 | + if (!$domain && !$vid) |
|
1567 | 1567 | { |
1568 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1568 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1569 | 1569 | { |
1570 | 1570 | $vid = $site_module_info->domain; |
1571 | 1571 | } |
@@ -1576,21 +1576,21 @@ discard block |
||
1576 | 1576 | } |
1577 | 1577 | |
1578 | 1578 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
1579 | - if($domain) |
|
1579 | + if ($domain) |
|
1580 | 1580 | { |
1581 | 1581 | $domain_info = parse_url($domain); |
1582 | - if(is_null($current_info)) |
|
1582 | + if (is_null($current_info)) |
|
1583 | 1583 | { |
1584 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
1584 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
1585 | 1585 | } |
1586 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
1586 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
1587 | 1587 | { |
1588 | 1588 | unset($domain); |
1589 | 1589 | } |
1590 | 1590 | else |
1591 | 1591 | { |
1592 | 1592 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
1593 | - if(substr_compare($domain, '/', -1) !== 0) |
|
1593 | + if (substr_compare($domain, '/', -1) !== 0) |
|
1594 | 1594 | { |
1595 | 1595 | $domain .= '/'; |
1596 | 1596 | } |
@@ -1600,10 +1600,10 @@ discard block |
||
1600 | 1600 | $get_vars = array(); |
1601 | 1601 | |
1602 | 1602 | // If there is no GET variables or first argument is '' to reset variables |
1603 | - if(!$self->get_vars || $args_list[0] == '') |
|
1603 | + if (!$self->get_vars || $args_list[0] == '') |
|
1604 | 1604 | { |
1605 | 1605 | // rearrange args_list |
1606 | - if(is_array($args_list) && $args_list[0] == '') |
|
1606 | + if (is_array($args_list) && $args_list[0] == '') |
|
1607 | 1607 | { |
1608 | 1608 | array_shift($args_list); |
1609 | 1609 | } |
@@ -1615,13 +1615,13 @@ discard block |
||
1615 | 1615 | } |
1616 | 1616 | |
1617 | 1617 | // arrange args_list |
1618 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1618 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1619 | 1619 | { |
1620 | 1620 | $key = $args_list[$i]; |
1621 | 1621 | $val = trim($args_list[$i + 1]); |
1622 | 1622 | |
1623 | 1623 | // If value is not set, remove the key |
1624 | - if(!isset($val) || !strlen($val)) |
|
1624 | + if (!isset($val) || !strlen($val)) |
|
1625 | 1625 | { |
1626 | 1626 | unset($get_vars[$key]); |
1627 | 1627 | continue; |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | |
1633 | 1633 | // remove vid, rnd |
1634 | 1634 | unset($get_vars['rnd']); |
1635 | - if($vid) |
|
1635 | + if ($vid) |
|
1636 | 1636 | { |
1637 | 1637 | $get_vars['vid'] = $vid; |
1638 | 1638 | } |
@@ -1649,17 +1649,17 @@ discard block |
||
1649 | 1649 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
1650 | 1650 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
1651 | 1651 | ); |
1652 | - if($act_alias[$act]) |
|
1652 | + if ($act_alias[$act]) |
|
1653 | 1653 | { |
1654 | 1654 | $get_vars['act'] = $act_alias[$act]; |
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | // organize URL |
1658 | 1658 | $query = ''; |
1659 | - if(count($get_vars) > 0) |
|
1659 | + if (count($get_vars) > 0) |
|
1660 | 1660 | { |
1661 | 1661 | // if using rewrite mod |
1662 | - if($self->allow_rewrite) |
|
1662 | + if ($self->allow_rewrite) |
|
1663 | 1663 | { |
1664 | 1664 | $var_keys = array_keys($get_vars); |
1665 | 1665 | sort($var_keys); |
@@ -1679,8 +1679,8 @@ discard block |
||
1679 | 1679 | 'vid' => $vid, |
1680 | 1680 | 'mid' => $mid, |
1681 | 1681 | 'mid.vid' => "$vid/$mid", |
1682 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
1683 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
1682 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
1683 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
1684 | 1684 | 'document_srl' => $srl, |
1685 | 1685 | 'document_srl.mid' => "$mid/$srl", |
1686 | 1686 | 'document_srl.vid' => "$vid/$srl", |
@@ -1697,66 +1697,66 @@ discard block |
||
1697 | 1697 | $query = $target_map[$target]; |
1698 | 1698 | } |
1699 | 1699 | |
1700 | - if(!$query) |
|
1700 | + if (!$query) |
|
1701 | 1701 | { |
1702 | 1702 | $queries = array(); |
1703 | - foreach($get_vars as $key => $val) |
|
1703 | + foreach ($get_vars as $key => $val) |
|
1704 | 1704 | { |
1705 | - if(is_array($val) && count($val) > 0) |
|
1705 | + if (is_array($val) && count($val) > 0) |
|
1706 | 1706 | { |
1707 | - foreach($val as $k => $v) |
|
1707 | + foreach ($val as $k => $v) |
|
1708 | 1708 | { |
1709 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
1709 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
1710 | 1710 | } |
1711 | 1711 | } |
1712 | - elseif(!is_array($val)) |
|
1712 | + elseif (!is_array($val)) |
|
1713 | 1713 | { |
1714 | - $queries[] = $key . '=' . urlencode($val); |
|
1714 | + $queries[] = $key.'='.urlencode($val); |
|
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - if(count($queries) > 0) |
|
1717 | + if (count($queries) > 0) |
|
1718 | 1718 | { |
1719 | - $query = 'index.php?' . join('&', $queries); |
|
1719 | + $query = 'index.php?'.join('&', $queries); |
|
1720 | 1720 | } |
1721 | 1721 | } |
1722 | 1722 | } |
1723 | 1723 | |
1724 | 1724 | // If using SSL always |
1725 | 1725 | $_use_ssl = $self->get('_use_ssl'); |
1726 | - if($_use_ssl == 'always') |
|
1726 | + if ($_use_ssl == 'always') |
|
1727 | 1727 | { |
1728 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1728 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1729 | 1729 | // optional SSL use |
1730 | 1730 | } |
1731 | - elseif($_use_ssl == 'optional') |
|
1731 | + elseif ($_use_ssl == 'optional') |
|
1732 | 1732 | { |
1733 | 1733 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
1734 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
1734 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
1735 | 1735 | // no SSL |
1736 | 1736 | } |
1737 | 1737 | else |
1738 | 1738 | { |
1739 | 1739 | // currently on SSL but target is not based on SSL |
1740 | - if($_SERVER['HTTPS'] == 'on') |
|
1740 | + if ($_SERVER['HTTPS'] == 'on') |
|
1741 | 1741 | { |
1742 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1742 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1743 | 1743 | } |
1744 | - else if($domain) // if $domain is set |
|
1744 | + else if ($domain) // if $domain is set |
|
1745 | 1745 | { |
1746 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
1746 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
1747 | 1747 | } |
1748 | 1748 | else |
1749 | 1749 | { |
1750 | - $query = getScriptPath() . $query; |
|
1750 | + $query = getScriptPath().$query; |
|
1751 | 1751 | } |
1752 | 1752 | } |
1753 | 1753 | |
1754 | - if(!$encode) |
|
1754 | + if (!$encode) |
|
1755 | 1755 | { |
1756 | 1756 | return $query; |
1757 | 1757 | } |
1758 | 1758 | |
1759 | - if(!$autoEncode) |
|
1759 | + if (!$autoEncode) |
|
1760 | 1760 | { |
1761 | 1761 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1762 | 1762 | } |
@@ -1765,16 +1765,16 @@ discard block |
||
1765 | 1765 | $encode_queries = array(); |
1766 | 1766 | $parsedUrl = parse_url($query); |
1767 | 1767 | parse_str($parsedUrl['query'], $output); |
1768 | - foreach($output as $key => $value) |
|
1768 | + foreach ($output as $key => $value) |
|
1769 | 1769 | { |
1770 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1770 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1771 | 1771 | { |
1772 | 1772 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
1773 | 1773 | } |
1774 | - $encode_queries[] = $key . '=' . $value; |
|
1774 | + $encode_queries[] = $key.'='.$value; |
|
1775 | 1775 | } |
1776 | 1776 | |
1777 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1777 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1778 | 1778 | } |
1779 | 1779 | |
1780 | 1780 | /** |
@@ -1789,17 +1789,17 @@ discard block |
||
1789 | 1789 | static $url = array(); |
1790 | 1790 | |
1791 | 1791 | // Check HTTP Request |
1792 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1792 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1793 | 1793 | { |
1794 | 1794 | return; |
1795 | 1795 | } |
1796 | 1796 | |
1797 | - if(self::get('_use_ssl') == 'always') |
|
1797 | + if (self::get('_use_ssl') == 'always') |
|
1798 | 1798 | { |
1799 | 1799 | $ssl_mode = ENFORCE_SSL; |
1800 | 1800 | } |
1801 | 1801 | |
1802 | - if($domain) |
|
1802 | + if ($domain) |
|
1803 | 1803 | { |
1804 | 1804 | $domain_key = md5($domain); |
1805 | 1805 | } |
@@ -1808,14 +1808,14 @@ discard block |
||
1808 | 1808 | $domain_key = 'default'; |
1809 | 1809 | } |
1810 | 1810 | |
1811 | - if(isset($url[$ssl_mode][$domain_key])) |
|
1811 | + if (isset($url[$ssl_mode][$domain_key])) |
|
1812 | 1812 | { |
1813 | 1813 | return $url[$ssl_mode][$domain_key]; |
1814 | 1814 | } |
1815 | 1815 | |
1816 | 1816 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
1817 | 1817 | |
1818 | - switch($ssl_mode) |
|
1818 | + switch ($ssl_mode) |
|
1819 | 1819 | { |
1820 | 1820 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
1821 | 1821 | break; |
@@ -1825,34 +1825,34 @@ discard block |
||
1825 | 1825 | break; |
1826 | 1826 | } |
1827 | 1827 | |
1828 | - if($domain) |
|
1828 | + if ($domain) |
|
1829 | 1829 | { |
1830 | 1830 | $target_url = trim($domain); |
1831 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
1831 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
1832 | 1832 | { |
1833 | - $target_url.= '/'; |
|
1833 | + $target_url .= '/'; |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | else |
1837 | 1837 | { |
1838 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
1838 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
1839 | 1839 | } |
1840 | 1840 | |
1841 | - $url_info = parse_url('http://' . $target_url); |
|
1841 | + $url_info = parse_url('http://'.$target_url); |
|
1842 | 1842 | |
1843 | - if($current_use_ssl != $use_ssl) |
|
1843 | + if ($current_use_ssl != $use_ssl) |
|
1844 | 1844 | { |
1845 | 1845 | unset($url_info['port']); |
1846 | 1846 | } |
1847 | 1847 | |
1848 | - if($use_ssl) |
|
1848 | + if ($use_ssl) |
|
1849 | 1849 | { |
1850 | 1850 | $port = self::get('_https_port'); |
1851 | - if($port && $port != 443) |
|
1851 | + if ($port && $port != 443) |
|
1852 | 1852 | { |
1853 | 1853 | $url_info['port'] = $port; |
1854 | 1854 | } |
1855 | - elseif($url_info['port'] == 443) |
|
1855 | + elseif ($url_info['port'] == 443) |
|
1856 | 1856 | { |
1857 | 1857 | unset($url_info['port']); |
1858 | 1858 | } |
@@ -1860,17 +1860,17 @@ discard block |
||
1860 | 1860 | else |
1861 | 1861 | { |
1862 | 1862 | $port = self::get('_http_port'); |
1863 | - if($port && $port != 80) |
|
1863 | + if ($port && $port != 80) |
|
1864 | 1864 | { |
1865 | 1865 | $url_info['port'] = $port; |
1866 | 1866 | } |
1867 | - elseif($url_info['port'] == 80) |
|
1867 | + elseif ($url_info['port'] == 80) |
|
1868 | 1868 | { |
1869 | 1869 | unset($url_info['port']); |
1870 | 1870 | } |
1871 | 1871 | } |
1872 | 1872 | |
1873 | - $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']); |
|
1873 | + $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']); |
|
1874 | 1874 | |
1875 | 1875 | return $url[$ssl_mode][$domain_key]; |
1876 | 1876 | } |
@@ -1887,16 +1887,16 @@ discard block |
||
1887 | 1887 | { |
1888 | 1888 | $self = self::getInstance(); |
1889 | 1889 | $self->context->{$key} = $val; |
1890 | - if($set_to_get_vars === FALSE) |
|
1890 | + if ($set_to_get_vars === FALSE) |
|
1891 | 1891 | { |
1892 | 1892 | return; |
1893 | 1893 | } |
1894 | - if($val === NULL || $val === '') |
|
1894 | + if ($val === NULL || $val === '') |
|
1895 | 1895 | { |
1896 | 1896 | unset($self->get_vars->{$key}); |
1897 | 1897 | return; |
1898 | 1898 | } |
1899 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
1899 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
1900 | 1900 | { |
1901 | 1901 | $self->get_vars->{$key} = $val; |
1902 | 1902 | } |
@@ -1912,7 +1912,7 @@ discard block |
||
1912 | 1912 | { |
1913 | 1913 | $self = self::getInstance(); |
1914 | 1914 | |
1915 | - if(!isset($self->context->{$key})) |
|
1915 | + if (!isset($self->context->{$key})) |
|
1916 | 1916 | { |
1917 | 1917 | return null; |
1918 | 1918 | } |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | function gets() |
1928 | 1928 | { |
1929 | 1929 | $num_args = func_num_args(); |
1930 | - if($num_args < 1) |
|
1930 | + if ($num_args < 1) |
|
1931 | 1931 | { |
1932 | 1932 | return; |
1933 | 1933 | } |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | |
1936 | 1936 | $args_list = func_get_args(); |
1937 | 1937 | $output = new stdClass(); |
1938 | - foreach($args_list as $v) |
|
1938 | + foreach ($args_list as $v) |
|
1939 | 1939 | { |
1940 | 1940 | $output->{$v} = $self->get($v); |
1941 | 1941 | } |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | function getRequestVars() |
1962 | 1962 | { |
1963 | 1963 | $self = self::getInstance(); |
1964 | - if($self->get_vars) |
|
1964 | + if ($self->get_vars) |
|
1965 | 1965 | { |
1966 | 1966 | return clone($self->get_vars); |
1967 | 1967 | } |
@@ -1978,13 +1978,13 @@ discard block |
||
1978 | 1978 | { |
1979 | 1979 | $self = self::getInstance(); |
1980 | 1980 | |
1981 | - if(!is_readable($self->sslActionCacheFile)) |
|
1981 | + if (!is_readable($self->sslActionCacheFile)) |
|
1982 | 1982 | { |
1983 | 1983 | $buff = '<?php if(!defined("__XE__"))exit;'; |
1984 | 1984 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
1985 | 1985 | } |
1986 | 1986 | |
1987 | - if(!isset($self->ssl_actions[$action])) |
|
1987 | + if (!isset($self->ssl_actions[$action])) |
|
1988 | 1988 | { |
1989 | 1989 | $self->ssl_actions[$action] = 1; |
1990 | 1990 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2002,16 +2002,16 @@ discard block |
||
2002 | 2002 | { |
2003 | 2003 | $self = self::getInstance(); |
2004 | 2004 | |
2005 | - if(!is_readable($self->sslActionCacheFile)) |
|
2005 | + if (!is_readable($self->sslActionCacheFile)) |
|
2006 | 2006 | { |
2007 | 2007 | unset($self->ssl_actions); |
2008 | 2008 | $buff = '<?php if(!defined("__XE__"))exit;'; |
2009 | 2009 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
2010 | 2010 | } |
2011 | 2011 | |
2012 | - foreach($action_array as $action) |
|
2012 | + foreach ($action_array as $action) |
|
2013 | 2013 | { |
2014 | - if(!isset($self->ssl_actions[$action])) |
|
2014 | + if (!isset($self->ssl_actions[$action])) |
|
2015 | 2015 | { |
2016 | 2016 | $self->ssl_actions[$action] = 1; |
2017 | 2017 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | { |
2031 | 2031 | $self = self::getInstance(); |
2032 | 2032 | |
2033 | - if($self->isExistsSSLAction($action)) |
|
2033 | + if ($self->isExistsSSLAction($action)) |
|
2034 | 2034 | { |
2035 | 2035 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
2036 | 2036 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | function getSSLActions() |
2048 | 2048 | { |
2049 | 2049 | $self = self::getInstance(); |
2050 | - if($self->getSslStatus() == 'optional') |
|
2050 | + if ($self->getSslStatus() == 'optional') |
|
2051 | 2051 | { |
2052 | 2052 | return $self->ssl_actions; |
2053 | 2053 | } |
@@ -2074,12 +2074,12 @@ discard block |
||
2074 | 2074 | */ |
2075 | 2075 | function normalizeFilePath($file) |
2076 | 2076 | { |
2077 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2077 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2078 | 2078 | { |
2079 | - $file = './' . $file; |
|
2079 | + $file = './'.$file; |
|
2080 | 2080 | } |
2081 | 2081 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
2082 | - while(strpos($file, '/../') !== FALSE) |
|
2082 | + while (strpos($file, '/../') !== FALSE) |
|
2083 | 2083 | { |
2084 | 2084 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
2085 | 2085 | } |
@@ -2098,13 +2098,13 @@ discard block |
||
2098 | 2098 | { |
2099 | 2099 | $file = self::normalizeFilePath($file); |
2100 | 2100 | $script_path = getScriptPath(); |
2101 | - if(strpos($file, './') === 0) |
|
2101 | + if (strpos($file, './') === 0) |
|
2102 | 2102 | { |
2103 | - $file = $script_path . substr($file, 2); |
|
2103 | + $file = $script_path.substr($file, 2); |
|
2104 | 2104 | } |
2105 | - elseif(strpos($file, '../') === 0) |
|
2105 | + elseif (strpos($file, '../') === 0) |
|
2106 | 2106 | { |
2107 | - $file = self::normalizeFilePath($script_path . $file); |
|
2107 | + $file = self::normalizeFilePath($script_path.$file); |
|
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | return $file; |
@@ -2174,12 +2174,12 @@ discard block |
||
2174 | 2174 | */ |
2175 | 2175 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
2176 | 2176 | { |
2177 | - if($isRuleset) |
|
2177 | + if ($isRuleset) |
|
2178 | 2178 | { |
2179 | - if(strpos($file, '#') !== FALSE) |
|
2179 | + if (strpos($file, '#') !== FALSE) |
|
2180 | 2180 | { |
2181 | 2181 | $file = str_replace('#', '', $file); |
2182 | - if(!is_readable($file)) |
|
2182 | + if (!is_readable($file)) |
|
2183 | 2183 | { |
2184 | 2184 | $file = $autoPath; |
2185 | 2185 | } |
@@ -2244,9 +2244,9 @@ discard block |
||
2244 | 2244 | ksort($files); |
2245 | 2245 | $files = array_values($files); |
2246 | 2246 | $filenames = array(); |
2247 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
2247 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
2248 | 2248 | { |
2249 | - if(in_array($files[$i]['file'], $filenames)) |
|
2249 | + if (in_array($files[$i]['file'], $filenames)) |
|
2250 | 2250 | { |
2251 | 2251 | unset($files[$i]); |
2252 | 2252 | } |
@@ -2331,14 +2331,14 @@ discard block |
||
2331 | 2331 | */ |
2332 | 2332 | function getJavascriptPluginInfo($pluginName) |
2333 | 2333 | { |
2334 | - if($plugin_name == 'ui.datepicker') |
|
2334 | + if ($plugin_name == 'ui.datepicker') |
|
2335 | 2335 | { |
2336 | 2336 | $plugin_name = 'ui'; |
2337 | 2337 | } |
2338 | 2338 | |
2339 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
2340 | - $info_file = $plugin_path . 'plugin.load'; |
|
2341 | - if(!is_readable($info_file)) |
|
2339 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
2340 | + $info_file = $plugin_path.'plugin.load'; |
|
2341 | + if (!is_readable($info_file)) |
|
2342 | 2342 | { |
2343 | 2343 | return; |
2344 | 2344 | } |
@@ -2348,32 +2348,32 @@ discard block |
||
2348 | 2348 | $result->jsList = array(); |
2349 | 2349 | $result->cssList = array(); |
2350 | 2350 | |
2351 | - foreach($list as $filename) |
|
2351 | + foreach ($list as $filename) |
|
2352 | 2352 | { |
2353 | 2353 | $filename = trim($filename); |
2354 | - if(!$filename) |
|
2354 | + if (!$filename) |
|
2355 | 2355 | { |
2356 | 2356 | continue; |
2357 | 2357 | } |
2358 | 2358 | |
2359 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2359 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2360 | 2360 | { |
2361 | 2361 | $filename = substr($filename, 2); |
2362 | 2362 | } |
2363 | 2363 | |
2364 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2364 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2365 | 2365 | { |
2366 | - $result->jsList[] = $plugin_path . $filename; |
|
2366 | + $result->jsList[] = $plugin_path.$filename; |
|
2367 | 2367 | } |
2368 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
2368 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
2369 | 2369 | { |
2370 | - $result->cssList[] = $plugin_path . $filename; |
|
2370 | + $result->cssList[] = $plugin_path.$filename; |
|
2371 | 2371 | } |
2372 | 2372 | } |
2373 | 2373 | |
2374 | - if(is_dir($plugin_path . 'lang')) |
|
2374 | + if (is_dir($plugin_path.'lang')) |
|
2375 | 2375 | { |
2376 | - $result->langPath = $plugin_path . 'lang'; |
|
2376 | + $result->langPath = $plugin_path.'lang'; |
|
2377 | 2377 | } |
2378 | 2378 | |
2379 | 2379 | return $result; |
@@ -2389,50 +2389,50 @@ discard block |
||
2389 | 2389 | static $loaded_plugins = array(); |
2390 | 2390 | |
2391 | 2391 | $self = self::getInstance(); |
2392 | - if($plugin_name == 'ui.datepicker') |
|
2392 | + if ($plugin_name == 'ui.datepicker') |
|
2393 | 2393 | { |
2394 | 2394 | $plugin_name = 'ui'; |
2395 | 2395 | } |
2396 | 2396 | |
2397 | - if($loaded_plugins[$plugin_name]) |
|
2397 | + if ($loaded_plugins[$plugin_name]) |
|
2398 | 2398 | { |
2399 | 2399 | return; |
2400 | 2400 | } |
2401 | 2401 | $loaded_plugins[$plugin_name] = TRUE; |
2402 | 2402 | |
2403 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
2404 | - $info_file = $plugin_path . 'plugin.load'; |
|
2405 | - if(!is_readable($info_file)) |
|
2403 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
2404 | + $info_file = $plugin_path.'plugin.load'; |
|
2405 | + if (!is_readable($info_file)) |
|
2406 | 2406 | { |
2407 | 2407 | return; |
2408 | 2408 | } |
2409 | 2409 | |
2410 | 2410 | $list = file($info_file); |
2411 | - foreach($list as $filename) |
|
2411 | + foreach ($list as $filename) |
|
2412 | 2412 | { |
2413 | 2413 | $filename = trim($filename); |
2414 | - if(!$filename) |
|
2414 | + if (!$filename) |
|
2415 | 2415 | { |
2416 | 2416 | continue; |
2417 | 2417 | } |
2418 | 2418 | |
2419 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2419 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2420 | 2420 | { |
2421 | 2421 | $filename = substr($filename, 2); |
2422 | 2422 | } |
2423 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2423 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2424 | 2424 | { |
2425 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
2425 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
2426 | 2426 | } |
2427 | - if(substr_compare($filename, '.css', -4) === 0) |
|
2427 | + if (substr_compare($filename, '.css', -4) === 0) |
|
2428 | 2428 | { |
2429 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
2429 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
2430 | 2430 | } |
2431 | 2431 | } |
2432 | 2432 | |
2433 | - if(is_dir($plugin_path . 'lang')) |
|
2433 | + if (is_dir($plugin_path.'lang')) |
|
2434 | 2434 | { |
2435 | - $self->loadLang($plugin_path . 'lang'); |
|
2435 | + $self->loadLang($plugin_path.'lang'); |
|
2436 | 2436 | } |
2437 | 2437 | } |
2438 | 2438 | |
@@ -2445,7 +2445,7 @@ discard block |
||
2445 | 2445 | function addHtmlHeader($header) |
2446 | 2446 | { |
2447 | 2447 | $self = self::getInstance(); |
2448 | - $self->html_header .= "\n" . $header; |
|
2448 | + $self->html_header .= "\n".$header; |
|
2449 | 2449 | } |
2450 | 2450 | |
2451 | 2451 | function clearHtmlHeader() |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | function addBodyHeader($header) |
2498 | 2498 | { |
2499 | 2499 | $self = self::getInstance(); |
2500 | - $self->body_header .= "\n" . $header; |
|
2500 | + $self->body_header .= "\n".$header; |
|
2501 | 2501 | } |
2502 | 2502 | |
2503 | 2503 | /** |
@@ -2519,7 +2519,7 @@ discard block |
||
2519 | 2519 | function addHtmlFooter($footer) |
2520 | 2520 | { |
2521 | 2521 | $self = self::getInstance(); |
2522 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
2522 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
2523 | 2523 | } |
2524 | 2524 | |
2525 | 2525 | /** |
@@ -2540,7 +2540,7 @@ discard block |
||
2540 | 2540 | */ |
2541 | 2541 | function getConfigFile() |
2542 | 2542 | { |
2543 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
2543 | + return _XE_PATH_.'files/config/db.config.php'; |
|
2544 | 2544 | } |
2545 | 2545 | |
2546 | 2546 | /** |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | */ |
2551 | 2551 | function getFTPConfigFile() |
2552 | 2552 | { |
2553 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
2553 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
2554 | 2554 | } |
2555 | 2555 | |
2556 | 2556 | /** |
@@ -2602,14 +2602,14 @@ discard block |
||
2602 | 2602 | $_path = explode('/', $path); |
2603 | 2603 | $_base = explode('/', $base_url); |
2604 | 2604 | |
2605 | - if(!$_base[count($_base) - 1]) |
|
2605 | + if (!$_base[count($_base) - 1]) |
|
2606 | 2606 | { |
2607 | 2607 | array_pop($_base); |
2608 | 2608 | } |
2609 | 2609 | |
2610 | - foreach($_xe as $idx => $dir) |
|
2610 | + foreach ($_xe as $idx => $dir) |
|
2611 | 2611 | { |
2612 | - if($_path[0] != $dir) |
|
2612 | + if ($_path[0] != $dir) |
|
2613 | 2613 | { |
2614 | 2614 | break; |
2615 | 2615 | } |
@@ -2617,9 +2617,9 @@ discard block |
||
2617 | 2617 | } |
2618 | 2618 | |
2619 | 2619 | $idx = count($_xe) - $idx - 1; |
2620 | - while($idx--) |
|
2620 | + while ($idx--) |
|
2621 | 2621 | { |
2622 | - if(count($_base) > 0) |
|
2622 | + if (count($_base) > 0) |
|
2623 | 2623 | { |
2624 | 2624 | array_shift($_base); |
2625 | 2625 | } |
@@ -2629,13 +2629,13 @@ discard block |
||
2629 | 2629 | } |
2630 | 2630 | } |
2631 | 2631 | |
2632 | - if(count($_base) > 0) |
|
2632 | + if (count($_base) > 0) |
|
2633 | 2633 | { |
2634 | 2634 | array_unshift($_path, join('/', $_base)); |
2635 | 2635 | } |
2636 | 2636 | |
2637 | - $path = '/' . join('/', $_path); |
|
2638 | - if(substr_compare($path, '/', -1) !== 0) |
|
2637 | + $path = '/'.join('/', $_path); |
|
2638 | + if (substr_compare($path, '/', -1) !== 0) |
|
2639 | 2639 | { |
2640 | 2640 | $path .= '/'; |
2641 | 2641 | } |
@@ -2650,13 +2650,13 @@ discard block |
||
2650 | 2650 | { |
2651 | 2651 | $self = self::getInstance(); |
2652 | 2652 | |
2653 | - if(!is_array($self->meta_tags)) |
|
2653 | + if (!is_array($self->meta_tags)) |
|
2654 | 2654 | { |
2655 | 2655 | $self->meta_tags = array(); |
2656 | 2656 | } |
2657 | 2657 | |
2658 | 2658 | $ret = array(); |
2659 | - foreach($self->meta_tags as $key => $val) |
|
2659 | + foreach ($self->meta_tags as $key => $val) |
|
2660 | 2660 | { |
2661 | 2661 | list($name, $is_http_equiv) = explode("\t", $key); |
2662 | 2662 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2676,7 +2676,7 @@ discard block |
||
2676 | 2676 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
2677 | 2677 | { |
2678 | 2678 | $self = self::getInstance(); |
2679 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
2679 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
2680 | 2680 | } |
2681 | 2681 | |
2682 | 2682 | } |