@@ -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,7 +1411,7 @@ 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 | if (is_array($result[$k])) |
1417 | 1417 | { |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | } |
1424 | 1424 | } |
1425 | 1425 | |
1426 | - if(is_array($result[$k])) |
|
1426 | + if (is_array($result[$k])) |
|
1427 | 1427 | { |
1428 | 1428 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
1429 | 1429 | } |
@@ -1455,17 +1455,17 @@ discard block |
||
1455 | 1455 | */ |
1456 | 1456 | function _setUploadedArgument() |
1457 | 1457 | { |
1458 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1458 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
1459 | 1459 | { |
1460 | 1460 | return; |
1461 | 1461 | } |
1462 | 1462 | |
1463 | - foreach($_FILES as $key => $val) |
|
1463 | + foreach ($_FILES as $key => $val) |
|
1464 | 1464 | { |
1465 | 1465 | $tmp_name = $val['tmp_name']; |
1466 | - if(!is_array($tmp_name)) |
|
1466 | + if (!is_array($tmp_name)) |
|
1467 | 1467 | { |
1468 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
1468 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
1469 | 1469 | { |
1470 | 1470 | continue; |
1471 | 1471 | } |
@@ -1475,9 +1475,9 @@ discard block |
||
1475 | 1475 | } |
1476 | 1476 | else |
1477 | 1477 | { |
1478 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
1478 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
1479 | 1479 | { |
1480 | - if($val['size'][$i] > 0) |
|
1480 | + if ($val['size'][$i] > 0) |
|
1481 | 1481 | { |
1482 | 1482 | $file['name'] = $val['name'][$i]; |
1483 | 1483 | $file['type'] = $val['type'][$i]; |
@@ -1509,16 +1509,16 @@ discard block |
||
1509 | 1509 | function getRequestUrl() |
1510 | 1510 | { |
1511 | 1511 | static $url = null; |
1512 | - if(is_null($url)) |
|
1512 | + if (is_null($url)) |
|
1513 | 1513 | { |
1514 | 1514 | $url = self::getRequestUri(); |
1515 | - if(count($_GET) > 0) |
|
1515 | + if (count($_GET) > 0) |
|
1516 | 1516 | { |
1517 | - foreach($_GET as $key => $val) |
|
1517 | + foreach ($_GET as $key => $val) |
|
1518 | 1518 | { |
1519 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1519 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
1520 | 1520 | } |
1521 | - $url .= '?' . join('&', $vars); |
|
1521 | + $url .= '?'.join('&', $vars); |
|
1522 | 1522 | } |
1523 | 1523 | } |
1524 | 1524 | return $url; |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | $self = self::getInstance(); |
1534 | 1534 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
1535 | 1535 | |
1536 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1536 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
1537 | 1537 | { |
1538 | 1538 | unset($js_callback_func); |
1539 | 1539 | unset($_GET['xe_js_callback']); |
@@ -1561,22 +1561,22 @@ discard block |
||
1561 | 1561 | $self = self::getInstance(); |
1562 | 1562 | |
1563 | 1563 | // retrieve virtual site information |
1564 | - if(is_null($site_module_info)) |
|
1564 | + if (is_null($site_module_info)) |
|
1565 | 1565 | { |
1566 | 1566 | $site_module_info = self::get('site_module_info'); |
1567 | 1567 | } |
1568 | 1568 | |
1569 | 1569 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
1570 | - if($domain && isSiteID($domain)) |
|
1570 | + if ($domain && isSiteID($domain)) |
|
1571 | 1571 | { |
1572 | 1572 | $vid = $domain; |
1573 | 1573 | $domain = ''; |
1574 | 1574 | } |
1575 | 1575 | |
1576 | 1576 | // If $domain, $vid are not set, use current site information |
1577 | - if(!$domain && !$vid) |
|
1577 | + if (!$domain && !$vid) |
|
1578 | 1578 | { |
1579 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1579 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
1580 | 1580 | { |
1581 | 1581 | $vid = $site_module_info->domain; |
1582 | 1582 | } |
@@ -1587,21 +1587,21 @@ discard block |
||
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
1590 | - if($domain) |
|
1590 | + if ($domain) |
|
1591 | 1591 | { |
1592 | 1592 | $domain_info = parse_url($domain); |
1593 | - if(is_null($current_info)) |
|
1593 | + if (is_null($current_info)) |
|
1594 | 1594 | { |
1595 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
1595 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
1596 | 1596 | } |
1597 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
1597 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
1598 | 1598 | { |
1599 | 1599 | unset($domain); |
1600 | 1600 | } |
1601 | 1601 | else |
1602 | 1602 | { |
1603 | 1603 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
1604 | - if(substr_compare($domain, '/', -1) !== 0) |
|
1604 | + if (substr_compare($domain, '/', -1) !== 0) |
|
1605 | 1605 | { |
1606 | 1606 | $domain .= '/'; |
1607 | 1607 | } |
@@ -1611,10 +1611,10 @@ discard block |
||
1611 | 1611 | $get_vars = array(); |
1612 | 1612 | |
1613 | 1613 | // If there is no GET variables or first argument is '' to reset variables |
1614 | - if(!$self->get_vars || $args_list[0] == '') |
|
1614 | + if (!$self->get_vars || $args_list[0] == '') |
|
1615 | 1615 | { |
1616 | 1616 | // rearrange args_list |
1617 | - if(is_array($args_list) && $args_list[0] == '') |
|
1617 | + if (is_array($args_list) && $args_list[0] == '') |
|
1618 | 1618 | { |
1619 | 1619 | array_shift($args_list); |
1620 | 1620 | } |
@@ -1626,13 +1626,13 @@ discard block |
||
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | // arrange args_list |
1629 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1629 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
1630 | 1630 | { |
1631 | 1631 | $key = $args_list[$i]; |
1632 | 1632 | $val = trim($args_list[$i + 1]); |
1633 | 1633 | |
1634 | 1634 | // If value is not set, remove the key |
1635 | - if(!isset($val) || !strlen($val)) |
|
1635 | + if (!isset($val) || !strlen($val)) |
|
1636 | 1636 | { |
1637 | 1637 | unset($get_vars[$key]); |
1638 | 1638 | continue; |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | |
1644 | 1644 | // remove vid, rnd |
1645 | 1645 | unset($get_vars['rnd']); |
1646 | - if($vid) |
|
1646 | + if ($vid) |
|
1647 | 1647 | { |
1648 | 1648 | $get_vars['vid'] = $vid; |
1649 | 1649 | } |
@@ -1660,17 +1660,17 @@ discard block |
||
1660 | 1660 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
1661 | 1661 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
1662 | 1662 | ); |
1663 | - if($act_alias[$act]) |
|
1663 | + if ($act_alias[$act]) |
|
1664 | 1664 | { |
1665 | 1665 | $get_vars['act'] = $act_alias[$act]; |
1666 | 1666 | } |
1667 | 1667 | |
1668 | 1668 | // organize URL |
1669 | 1669 | $query = ''; |
1670 | - if(count($get_vars) > 0) |
|
1670 | + if (count($get_vars) > 0) |
|
1671 | 1671 | { |
1672 | 1672 | // if using rewrite mod |
1673 | - if($self->allow_rewrite) |
|
1673 | + if ($self->allow_rewrite) |
|
1674 | 1674 | { |
1675 | 1675 | $var_keys = array_keys($get_vars); |
1676 | 1676 | sort($var_keys); |
@@ -1690,8 +1690,8 @@ discard block |
||
1690 | 1690 | 'vid' => $vid, |
1691 | 1691 | 'mid' => $mid, |
1692 | 1692 | 'mid.vid' => "$vid/$mid", |
1693 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
1694 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
1693 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
1694 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
1695 | 1695 | 'document_srl' => $srl, |
1696 | 1696 | 'document_srl.mid' => "$mid/$srl", |
1697 | 1697 | 'document_srl.vid' => "$vid/$srl", |
@@ -1708,66 +1708,66 @@ discard block |
||
1708 | 1708 | $query = $target_map[$target]; |
1709 | 1709 | } |
1710 | 1710 | |
1711 | - if(!$query) |
|
1711 | + if (!$query) |
|
1712 | 1712 | { |
1713 | 1713 | $queries = array(); |
1714 | - foreach($get_vars as $key => $val) |
|
1714 | + foreach ($get_vars as $key => $val) |
|
1715 | 1715 | { |
1716 | - if(is_array($val) && count($val) > 0) |
|
1716 | + if (is_array($val) && count($val) > 0) |
|
1717 | 1717 | { |
1718 | - foreach($val as $k => $v) |
|
1718 | + foreach ($val as $k => $v) |
|
1719 | 1719 | { |
1720 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
1720 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
1721 | 1721 | } |
1722 | 1722 | } |
1723 | - elseif(!is_array($val)) |
|
1723 | + elseif (!is_array($val)) |
|
1724 | 1724 | { |
1725 | - $queries[] = $key . '=' . urlencode($val); |
|
1725 | + $queries[] = $key.'='.urlencode($val); |
|
1726 | 1726 | } |
1727 | 1727 | } |
1728 | - if(count($queries) > 0) |
|
1728 | + if (count($queries) > 0) |
|
1729 | 1729 | { |
1730 | - $query = 'index.php?' . join('&', $queries); |
|
1730 | + $query = 'index.php?'.join('&', $queries); |
|
1731 | 1731 | } |
1732 | 1732 | } |
1733 | 1733 | } |
1734 | 1734 | |
1735 | 1735 | // If using SSL always |
1736 | 1736 | $_use_ssl = $self->get('_use_ssl'); |
1737 | - if($_use_ssl == 'always') |
|
1737 | + if ($_use_ssl == 'always') |
|
1738 | 1738 | { |
1739 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1739 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1740 | 1740 | // optional SSL use |
1741 | 1741 | } |
1742 | - elseif($_use_ssl == 'optional') |
|
1742 | + elseif ($_use_ssl == 'optional') |
|
1743 | 1743 | { |
1744 | 1744 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
1745 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
1745 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
1746 | 1746 | // no SSL |
1747 | 1747 | } |
1748 | 1748 | else |
1749 | 1749 | { |
1750 | 1750 | // currently on SSL but target is not based on SSL |
1751 | - if($_SERVER['HTTPS'] == 'on') |
|
1751 | + if ($_SERVER['HTTPS'] == 'on') |
|
1752 | 1752 | { |
1753 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
1753 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
1754 | 1754 | } |
1755 | - else if($domain) // if $domain is set |
|
1755 | + else if ($domain) // if $domain is set |
|
1756 | 1756 | { |
1757 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
1757 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
1758 | 1758 | } |
1759 | 1759 | else |
1760 | 1760 | { |
1761 | - $query = getScriptPath() . $query; |
|
1761 | + $query = getScriptPath().$query; |
|
1762 | 1762 | } |
1763 | 1763 | } |
1764 | 1764 | |
1765 | - if(!$encode) |
|
1765 | + if (!$encode) |
|
1766 | 1766 | { |
1767 | 1767 | return $query; |
1768 | 1768 | } |
1769 | 1769 | |
1770 | - if(!$autoEncode) |
|
1770 | + if (!$autoEncode) |
|
1771 | 1771 | { |
1772 | 1772 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
1773 | 1773 | } |
@@ -1776,16 +1776,16 @@ discard block |
||
1776 | 1776 | $encode_queries = array(); |
1777 | 1777 | $parsedUrl = parse_url($query); |
1778 | 1778 | parse_str($parsedUrl['query'], $output); |
1779 | - foreach($output as $key => $value) |
|
1779 | + foreach ($output as $key => $value) |
|
1780 | 1780 | { |
1781 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1781 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
1782 | 1782 | { |
1783 | 1783 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
1784 | 1784 | } |
1785 | - $encode_queries[] = $key . '=' . $value; |
|
1785 | + $encode_queries[] = $key.'='.$value; |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1788 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | /** |
@@ -1800,17 +1800,17 @@ discard block |
||
1800 | 1800 | static $url = array(); |
1801 | 1801 | |
1802 | 1802 | // Check HTTP Request |
1803 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1803 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
1804 | 1804 | { |
1805 | 1805 | return; |
1806 | 1806 | } |
1807 | 1807 | |
1808 | - if(self::get('_use_ssl') == 'always') |
|
1808 | + if (self::get('_use_ssl') == 'always') |
|
1809 | 1809 | { |
1810 | 1810 | $ssl_mode = ENFORCE_SSL; |
1811 | 1811 | } |
1812 | 1812 | |
1813 | - if($domain) |
|
1813 | + if ($domain) |
|
1814 | 1814 | { |
1815 | 1815 | $domain_key = md5($domain); |
1816 | 1816 | } |
@@ -1819,14 +1819,14 @@ discard block |
||
1819 | 1819 | $domain_key = 'default'; |
1820 | 1820 | } |
1821 | 1821 | |
1822 | - if(isset($url[$ssl_mode][$domain_key])) |
|
1822 | + if (isset($url[$ssl_mode][$domain_key])) |
|
1823 | 1823 | { |
1824 | 1824 | return $url[$ssl_mode][$domain_key]; |
1825 | 1825 | } |
1826 | 1826 | |
1827 | 1827 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
1828 | 1828 | |
1829 | - switch($ssl_mode) |
|
1829 | + switch ($ssl_mode) |
|
1830 | 1830 | { |
1831 | 1831 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
1832 | 1832 | break; |
@@ -1836,34 +1836,34 @@ discard block |
||
1836 | 1836 | break; |
1837 | 1837 | } |
1838 | 1838 | |
1839 | - if($domain) |
|
1839 | + if ($domain) |
|
1840 | 1840 | { |
1841 | 1841 | $target_url = trim($domain); |
1842 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
1842 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
1843 | 1843 | { |
1844 | - $target_url.= '/'; |
|
1844 | + $target_url .= '/'; |
|
1845 | 1845 | } |
1846 | 1846 | } |
1847 | 1847 | else |
1848 | 1848 | { |
1849 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
1849 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
1850 | 1850 | } |
1851 | 1851 | |
1852 | - $url_info = parse_url('http://' . $target_url); |
|
1852 | + $url_info = parse_url('http://'.$target_url); |
|
1853 | 1853 | |
1854 | - if($current_use_ssl != $use_ssl) |
|
1854 | + if ($current_use_ssl != $use_ssl) |
|
1855 | 1855 | { |
1856 | 1856 | unset($url_info['port']); |
1857 | 1857 | } |
1858 | 1858 | |
1859 | - if($use_ssl) |
|
1859 | + if ($use_ssl) |
|
1860 | 1860 | { |
1861 | 1861 | $port = self::get('_https_port'); |
1862 | - if($port && $port != 443) |
|
1862 | + if ($port && $port != 443) |
|
1863 | 1863 | { |
1864 | 1864 | $url_info['port'] = $port; |
1865 | 1865 | } |
1866 | - elseif($url_info['port'] == 443) |
|
1866 | + elseif ($url_info['port'] == 443) |
|
1867 | 1867 | { |
1868 | 1868 | unset($url_info['port']); |
1869 | 1869 | } |
@@ -1871,17 +1871,17 @@ discard block |
||
1871 | 1871 | else |
1872 | 1872 | { |
1873 | 1873 | $port = self::get('_http_port'); |
1874 | - if($port && $port != 80) |
|
1874 | + if ($port && $port != 80) |
|
1875 | 1875 | { |
1876 | 1876 | $url_info['port'] = $port; |
1877 | 1877 | } |
1878 | - elseif($url_info['port'] == 80) |
|
1878 | + elseif ($url_info['port'] == 80) |
|
1879 | 1879 | { |
1880 | 1880 | unset($url_info['port']); |
1881 | 1881 | } |
1882 | 1882 | } |
1883 | 1883 | |
1884 | - $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']); |
|
1884 | + $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']); |
|
1885 | 1885 | |
1886 | 1886 | return $url[$ssl_mode][$domain_key]; |
1887 | 1887 | } |
@@ -1898,16 +1898,16 @@ discard block |
||
1898 | 1898 | { |
1899 | 1899 | $self = self::getInstance(); |
1900 | 1900 | $self->context->{$key} = $val; |
1901 | - if($set_to_get_vars === FALSE) |
|
1901 | + if ($set_to_get_vars === FALSE) |
|
1902 | 1902 | { |
1903 | 1903 | return; |
1904 | 1904 | } |
1905 | - if($val === NULL || $val === '') |
|
1905 | + if ($val === NULL || $val === '') |
|
1906 | 1906 | { |
1907 | 1907 | unset($self->get_vars->{$key}); |
1908 | 1908 | return; |
1909 | 1909 | } |
1910 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
1910 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
1911 | 1911 | { |
1912 | 1912 | $self->get_vars->{$key} = $val; |
1913 | 1913 | } |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | { |
1924 | 1924 | $self = self::getInstance(); |
1925 | 1925 | |
1926 | - if(!isset($self->context->{$key})) |
|
1926 | + if (!isset($self->context->{$key})) |
|
1927 | 1927 | { |
1928 | 1928 | return null; |
1929 | 1929 | } |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | function gets() |
1939 | 1939 | { |
1940 | 1940 | $num_args = func_num_args(); |
1941 | - if($num_args < 1) |
|
1941 | + if ($num_args < 1) |
|
1942 | 1942 | { |
1943 | 1943 | return; |
1944 | 1944 | } |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | |
1947 | 1947 | $args_list = func_get_args(); |
1948 | 1948 | $output = new stdClass(); |
1949 | - foreach($args_list as $v) |
|
1949 | + foreach ($args_list as $v) |
|
1950 | 1950 | { |
1951 | 1951 | $output->{$v} = $self->get($v); |
1952 | 1952 | } |
@@ -1972,7 +1972,7 @@ discard block |
||
1972 | 1972 | function getRequestVars() |
1973 | 1973 | { |
1974 | 1974 | $self = self::getInstance(); |
1975 | - if($self->get_vars) |
|
1975 | + if ($self->get_vars) |
|
1976 | 1976 | { |
1977 | 1977 | return clone($self->get_vars); |
1978 | 1978 | } |
@@ -1989,13 +1989,13 @@ discard block |
||
1989 | 1989 | { |
1990 | 1990 | $self = self::getInstance(); |
1991 | 1991 | |
1992 | - if(!is_readable($self->sslActionCacheFile)) |
|
1992 | + if (!is_readable($self->sslActionCacheFile)) |
|
1993 | 1993 | { |
1994 | 1994 | $buff = '<?php if(!defined("__XE__"))exit;'; |
1995 | 1995 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
1996 | 1996 | } |
1997 | 1997 | |
1998 | - if(!isset($self->ssl_actions[$action])) |
|
1998 | + if (!isset($self->ssl_actions[$action])) |
|
1999 | 1999 | { |
2000 | 2000 | $self->ssl_actions[$action] = 1; |
2001 | 2001 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2013,16 +2013,16 @@ discard block |
||
2013 | 2013 | { |
2014 | 2014 | $self = self::getInstance(); |
2015 | 2015 | |
2016 | - if(!is_readable($self->sslActionCacheFile)) |
|
2016 | + if (!is_readable($self->sslActionCacheFile)) |
|
2017 | 2017 | { |
2018 | 2018 | unset($self->ssl_actions); |
2019 | 2019 | $buff = '<?php if(!defined("__XE__"))exit;'; |
2020 | 2020 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
2021 | 2021 | } |
2022 | 2022 | |
2023 | - foreach($action_array as $action) |
|
2023 | + foreach ($action_array as $action) |
|
2024 | 2024 | { |
2025 | - if(!isset($self->ssl_actions[$action])) |
|
2025 | + if (!isset($self->ssl_actions[$action])) |
|
2026 | 2026 | { |
2027 | 2027 | $self->ssl_actions[$action] = 1; |
2028 | 2028 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | { |
2042 | 2042 | $self = self::getInstance(); |
2043 | 2043 | |
2044 | - if($self->isExistsSSLAction($action)) |
|
2044 | + if ($self->isExistsSSLAction($action)) |
|
2045 | 2045 | { |
2046 | 2046 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
2047 | 2047 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | function getSSLActions() |
2059 | 2059 | { |
2060 | 2060 | $self = self::getInstance(); |
2061 | - if($self->getSslStatus() == 'optional') |
|
2061 | + if ($self->getSslStatus() == 'optional') |
|
2062 | 2062 | { |
2063 | 2063 | return $self->ssl_actions; |
2064 | 2064 | } |
@@ -2085,12 +2085,12 @@ discard block |
||
2085 | 2085 | */ |
2086 | 2086 | function normalizeFilePath($file) |
2087 | 2087 | { |
2088 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2088 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
2089 | 2089 | { |
2090 | - $file = './' . $file; |
|
2090 | + $file = './'.$file; |
|
2091 | 2091 | } |
2092 | 2092 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
2093 | - while(strpos($file, '/../') !== FALSE) |
|
2093 | + while (strpos($file, '/../') !== FALSE) |
|
2094 | 2094 | { |
2095 | 2095 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
2096 | 2096 | } |
@@ -2109,13 +2109,13 @@ discard block |
||
2109 | 2109 | { |
2110 | 2110 | $file = self::normalizeFilePath($file); |
2111 | 2111 | $script_path = getScriptPath(); |
2112 | - if(strpos($file, './') === 0) |
|
2112 | + if (strpos($file, './') === 0) |
|
2113 | 2113 | { |
2114 | - $file = $script_path . substr($file, 2); |
|
2114 | + $file = $script_path.substr($file, 2); |
|
2115 | 2115 | } |
2116 | - elseif(strpos($file, '../') === 0) |
|
2116 | + elseif (strpos($file, '../') === 0) |
|
2117 | 2117 | { |
2118 | - $file = self::normalizeFilePath($script_path . $file); |
|
2118 | + $file = self::normalizeFilePath($script_path.$file); |
|
2119 | 2119 | } |
2120 | 2120 | |
2121 | 2121 | return $file; |
@@ -2185,12 +2185,12 @@ discard block |
||
2185 | 2185 | */ |
2186 | 2186 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
2187 | 2187 | { |
2188 | - if($isRuleset) |
|
2188 | + if ($isRuleset) |
|
2189 | 2189 | { |
2190 | - if(strpos($file, '#') !== FALSE) |
|
2190 | + if (strpos($file, '#') !== FALSE) |
|
2191 | 2191 | { |
2192 | 2192 | $file = str_replace('#', '', $file); |
2193 | - if(!is_readable($file)) |
|
2193 | + if (!is_readable($file)) |
|
2194 | 2194 | { |
2195 | 2195 | $file = $autoPath; |
2196 | 2196 | } |
@@ -2255,9 +2255,9 @@ discard block |
||
2255 | 2255 | ksort($files); |
2256 | 2256 | $files = array_values($files); |
2257 | 2257 | $filenames = array(); |
2258 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
2258 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
2259 | 2259 | { |
2260 | - if(in_array($files[$i]['file'], $filenames)) |
|
2260 | + if (in_array($files[$i]['file'], $filenames)) |
|
2261 | 2261 | { |
2262 | 2262 | unset($files[$i]); |
2263 | 2263 | } |
@@ -2342,14 +2342,14 @@ discard block |
||
2342 | 2342 | */ |
2343 | 2343 | function getJavascriptPluginInfo($pluginName) |
2344 | 2344 | { |
2345 | - if($plugin_name == 'ui.datepicker') |
|
2345 | + if ($plugin_name == 'ui.datepicker') |
|
2346 | 2346 | { |
2347 | 2347 | $plugin_name = 'ui'; |
2348 | 2348 | } |
2349 | 2349 | |
2350 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
2351 | - $info_file = $plugin_path . 'plugin.load'; |
|
2352 | - if(!is_readable($info_file)) |
|
2350 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
2351 | + $info_file = $plugin_path.'plugin.load'; |
|
2352 | + if (!is_readable($info_file)) |
|
2353 | 2353 | { |
2354 | 2354 | return; |
2355 | 2355 | } |
@@ -2359,32 +2359,32 @@ discard block |
||
2359 | 2359 | $result->jsList = array(); |
2360 | 2360 | $result->cssList = array(); |
2361 | 2361 | |
2362 | - foreach($list as $filename) |
|
2362 | + foreach ($list as $filename) |
|
2363 | 2363 | { |
2364 | 2364 | $filename = trim($filename); |
2365 | - if(!$filename) |
|
2365 | + if (!$filename) |
|
2366 | 2366 | { |
2367 | 2367 | continue; |
2368 | 2368 | } |
2369 | 2369 | |
2370 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2370 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2371 | 2371 | { |
2372 | 2372 | $filename = substr($filename, 2); |
2373 | 2373 | } |
2374 | 2374 | |
2375 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2375 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2376 | 2376 | { |
2377 | - $result->jsList[] = $plugin_path . $filename; |
|
2377 | + $result->jsList[] = $plugin_path.$filename; |
|
2378 | 2378 | } |
2379 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
2379 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
2380 | 2380 | { |
2381 | - $result->cssList[] = $plugin_path . $filename; |
|
2381 | + $result->cssList[] = $plugin_path.$filename; |
|
2382 | 2382 | } |
2383 | 2383 | } |
2384 | 2384 | |
2385 | - if(is_dir($plugin_path . 'lang')) |
|
2385 | + if (is_dir($plugin_path.'lang')) |
|
2386 | 2386 | { |
2387 | - $result->langPath = $plugin_path . 'lang'; |
|
2387 | + $result->langPath = $plugin_path.'lang'; |
|
2388 | 2388 | } |
2389 | 2389 | |
2390 | 2390 | return $result; |
@@ -2400,50 +2400,50 @@ discard block |
||
2400 | 2400 | static $loaded_plugins = array(); |
2401 | 2401 | |
2402 | 2402 | $self = self::getInstance(); |
2403 | - if($plugin_name == 'ui.datepicker') |
|
2403 | + if ($plugin_name == 'ui.datepicker') |
|
2404 | 2404 | { |
2405 | 2405 | $plugin_name = 'ui'; |
2406 | 2406 | } |
2407 | 2407 | |
2408 | - if($loaded_plugins[$plugin_name]) |
|
2408 | + if ($loaded_plugins[$plugin_name]) |
|
2409 | 2409 | { |
2410 | 2410 | return; |
2411 | 2411 | } |
2412 | 2412 | $loaded_plugins[$plugin_name] = TRUE; |
2413 | 2413 | |
2414 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
2415 | - $info_file = $plugin_path . 'plugin.load'; |
|
2416 | - if(!is_readable($info_file)) |
|
2414 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
2415 | + $info_file = $plugin_path.'plugin.load'; |
|
2416 | + if (!is_readable($info_file)) |
|
2417 | 2417 | { |
2418 | 2418 | return; |
2419 | 2419 | } |
2420 | 2420 | |
2421 | 2421 | $list = file($info_file); |
2422 | - foreach($list as $filename) |
|
2422 | + foreach ($list as $filename) |
|
2423 | 2423 | { |
2424 | 2424 | $filename = trim($filename); |
2425 | - if(!$filename) |
|
2425 | + if (!$filename) |
|
2426 | 2426 | { |
2427 | 2427 | continue; |
2428 | 2428 | } |
2429 | 2429 | |
2430 | - if(strncasecmp('./', $filename, 2) === 0) |
|
2430 | + if (strncasecmp('./', $filename, 2) === 0) |
|
2431 | 2431 | { |
2432 | 2432 | $filename = substr($filename, 2); |
2433 | 2433 | } |
2434 | - if(substr_compare($filename, '.js', -3) === 0) |
|
2434 | + if (substr_compare($filename, '.js', -3) === 0) |
|
2435 | 2435 | { |
2436 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
2436 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
2437 | 2437 | } |
2438 | - if(substr_compare($filename, '.css', -4) === 0) |
|
2438 | + if (substr_compare($filename, '.css', -4) === 0) |
|
2439 | 2439 | { |
2440 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
2440 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
2441 | 2441 | } |
2442 | 2442 | } |
2443 | 2443 | |
2444 | - if(is_dir($plugin_path . 'lang')) |
|
2444 | + if (is_dir($plugin_path.'lang')) |
|
2445 | 2445 | { |
2446 | - $self->loadLang($plugin_path . 'lang'); |
|
2446 | + $self->loadLang($plugin_path.'lang'); |
|
2447 | 2447 | } |
2448 | 2448 | } |
2449 | 2449 | |
@@ -2456,7 +2456,7 @@ discard block |
||
2456 | 2456 | function addHtmlHeader($header) |
2457 | 2457 | { |
2458 | 2458 | $self = self::getInstance(); |
2459 | - $self->html_header .= "\n" . $header; |
|
2459 | + $self->html_header .= "\n".$header; |
|
2460 | 2460 | } |
2461 | 2461 | |
2462 | 2462 | function clearHtmlHeader() |
@@ -2508,7 +2508,7 @@ discard block |
||
2508 | 2508 | function addBodyHeader($header) |
2509 | 2509 | { |
2510 | 2510 | $self = self::getInstance(); |
2511 | - $self->body_header .= "\n" . $header; |
|
2511 | + $self->body_header .= "\n".$header; |
|
2512 | 2512 | } |
2513 | 2513 | |
2514 | 2514 | /** |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | function addHtmlFooter($footer) |
2531 | 2531 | { |
2532 | 2532 | $self = self::getInstance(); |
2533 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
2533 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
2534 | 2534 | } |
2535 | 2535 | |
2536 | 2536 | /** |
@@ -2551,7 +2551,7 @@ discard block |
||
2551 | 2551 | */ |
2552 | 2552 | function getConfigFile() |
2553 | 2553 | { |
2554 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
2554 | + return _XE_PATH_.'files/config/db.config.php'; |
|
2555 | 2555 | } |
2556 | 2556 | |
2557 | 2557 | /** |
@@ -2561,7 +2561,7 @@ discard block |
||
2561 | 2561 | */ |
2562 | 2562 | function getFTPConfigFile() |
2563 | 2563 | { |
2564 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
2564 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
2565 | 2565 | } |
2566 | 2566 | |
2567 | 2567 | /** |
@@ -2613,14 +2613,14 @@ discard block |
||
2613 | 2613 | $_path = explode('/', $path); |
2614 | 2614 | $_base = explode('/', $base_url); |
2615 | 2615 | |
2616 | - if(!$_base[count($_base) - 1]) |
|
2616 | + if (!$_base[count($_base) - 1]) |
|
2617 | 2617 | { |
2618 | 2618 | array_pop($_base); |
2619 | 2619 | } |
2620 | 2620 | |
2621 | - foreach($_xe as $idx => $dir) |
|
2621 | + foreach ($_xe as $idx => $dir) |
|
2622 | 2622 | { |
2623 | - if($_path[0] != $dir) |
|
2623 | + if ($_path[0] != $dir) |
|
2624 | 2624 | { |
2625 | 2625 | break; |
2626 | 2626 | } |
@@ -2628,9 +2628,9 @@ discard block |
||
2628 | 2628 | } |
2629 | 2629 | |
2630 | 2630 | $idx = count($_xe) - $idx - 1; |
2631 | - while($idx--) |
|
2631 | + while ($idx--) |
|
2632 | 2632 | { |
2633 | - if(count($_base) > 0) |
|
2633 | + if (count($_base) > 0) |
|
2634 | 2634 | { |
2635 | 2635 | array_shift($_base); |
2636 | 2636 | } |
@@ -2640,13 +2640,13 @@ discard block |
||
2640 | 2640 | } |
2641 | 2641 | } |
2642 | 2642 | |
2643 | - if(count($_base) > 0) |
|
2643 | + if (count($_base) > 0) |
|
2644 | 2644 | { |
2645 | 2645 | array_unshift($_path, join('/', $_base)); |
2646 | 2646 | } |
2647 | 2647 | |
2648 | - $path = '/' . join('/', $_path); |
|
2649 | - if(substr_compare($path, '/', -1) !== 0) |
|
2648 | + $path = '/'.join('/', $_path); |
|
2649 | + if (substr_compare($path, '/', -1) !== 0) |
|
2650 | 2650 | { |
2651 | 2651 | $path .= '/'; |
2652 | 2652 | } |
@@ -2661,13 +2661,13 @@ discard block |
||
2661 | 2661 | { |
2662 | 2662 | $self = self::getInstance(); |
2663 | 2663 | |
2664 | - if(!is_array($self->meta_tags)) |
|
2664 | + if (!is_array($self->meta_tags)) |
|
2665 | 2665 | { |
2666 | 2666 | $self->meta_tags = array(); |
2667 | 2667 | } |
2668 | 2668 | |
2669 | 2669 | $ret = array(); |
2670 | - foreach($self->meta_tags as $key => $val) |
|
2670 | + foreach ($self->meta_tags as $key => $val) |
|
2671 | 2671 | { |
2672 | 2672 | list($name, $is_http_equiv) = explode("\t", $key); |
2673 | 2673 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2687,7 +2687,7 @@ discard block |
||
2687 | 2687 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
2688 | 2688 | { |
2689 | 2689 | $self = self::getInstance(); |
2690 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
2690 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
2691 | 2691 | } |
2692 | 2692 | |
2693 | 2693 | } |