GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2358)
by
unknown
05:41
created
classes/context/Context.class.php 1 patch
Spacing   +313 added lines, -313 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 			);
343 343
 		}
344 344
 
345
-		if($sess = $_POST[session_name()]) session_id($sess);
345
+		if ($sess = $_POST[session_name()]) session_id($sess);
346 346
 		session_start();
347 347
 
348 348
 		// set authentication information in Context and session
349
-		if(self::isInstalled())
349
+		if (self::isInstalled())
350 350
 		{
351 351
 			$oModuleModel = getModel('module');
352 352
 			$oModuleModel->loadModuleExtends();
@@ -354,15 +354,15 @@  discard block
 block discarded – undo
354 354
 			$oMemberModel = getModel('member');
355 355
 			$oMemberController = getController('member');
356 356
 
357
-			if($oMemberController && $oMemberModel)
357
+			if ($oMemberController && $oMemberModel)
358 358
 			{
359 359
 				// if signed in, validate it.
360
-				if($oMemberModel->isLogged())
360
+				if ($oMemberModel->isLogged())
361 361
 				{
362 362
 					$oMemberController->setSessionInfo();
363 363
 				}
364 364
 				// check auto sign-in
365
-				elseif($_COOKIE['xeak'])
365
+				elseif ($_COOKIE['xeak'])
366 366
 				{
367 367
 					$oMemberController->doAutologin();
368 368
 				}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
 		// load common language file
376 376
 		$this->lang = &$GLOBALS['lang'];
377
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
377
+		$this->loadLang(_XE_PATH_.'common/lang/');
378 378
 
379 379
 		// check if using rewrite module
380 380
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -382,28 +382,28 @@  discard block
 block discarded – undo
382 382
 		// set locations for javascript use
383 383
 		$url = array();
384 384
 		$current_url = self::getRequestUri();
385
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
385
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
386 386
 		{
387
-			if($this->get_vars)
387
+			if ($this->get_vars)
388 388
 			{
389 389
 				$url = array();
390
-				foreach($this->get_vars as $key => $val)
390
+				foreach ($this->get_vars as $key => $val)
391 391
 				{
392
-					if(is_array($val) && count($val) > 0)
392
+					if (is_array($val) && count($val) > 0)
393 393
 					{
394
-						foreach($val as $k => $v)
394
+						foreach ($val as $k => $v)
395 395
 						{
396
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396
+							$url[] = $key.'['.$k.']='.urlencode($v);
397 397
 						}
398 398
 					}
399
-					elseif($val)
399
+					elseif ($val)
400 400
 					{
401
-						$url[] = $key . '=' . urlencode($val);
401
+						$url[] = $key.'='.urlencode($val);
402 402
 					}
403 403
 				}
404 404
 
405 405
 				$current_url = self::getRequestUri();
406
-				if($url) $current_url .= '?' . join('&', $url);
406
+				if ($url) $current_url .= '?'.join('&', $url);
407 407
 			}
408 408
 			else
409 409
 			{
@@ -418,12 +418,12 @@  discard block
 block discarded – undo
418 418
 		$this->set('current_url', $current_url);
419 419
 		$this->set('request_uri', self::getRequestUri());
420 420
 
421
-		if(strpos($current_url, 'xn--') !== FALSE)
421
+		if (strpos($current_url, 'xn--') !== FALSE)
422 422
 		{
423 423
 			$this->set('current_url', self::decodeIdna($current_url));
424 424
 		}
425 425
 
426
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
426
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
427 427
 		{
428 428
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
429 429
 		}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	{
449 449
 		$self = self::getInstance();
450 450
 
451
-		if(!$self->isInstalled())
451
+		if (!$self->isInstalled())
452 452
 		{
453 453
 			return;
454 454
 		}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		ob_end_clean();
459 459
 
460 460
 		// If master_db information does not exist, the config file needs to be updated
461
-		if(!isset($db_info->master_db))
461
+		if (!isset($db_info->master_db))
462 462
 		{
463 463
 			$db_info->master_db = array();
464 464
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
477 477
 			unset($db_info->db_table_prefix);
478 478
 
479
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
479
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
480 480
 			{
481 481
 				$db_info->master_db["db_table_prefix"] .= '_';
482 482
 			}
@@ -488,42 +488,42 @@  discard block
 block discarded – undo
488 488
 			$oInstallController->makeConfigFile();
489 489
 		}
490 490
 
491
-		if(version_compare(PHP_VERSION, '7.0', '>='))
491
+		if (version_compare(PHP_VERSION, '7.0', '>='))
492 492
 		{
493 493
 			$db_info->master_db["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $db_info->master_db["db_type"]);
494
-			foreach($db_info->slave_db as &$slave_db_info)
494
+			foreach ($db_info->slave_db as &$slave_db_info)
495 495
 			{
496 496
 				$slave_db_info["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $slave_db_info["db_type"]);
497 497
 			}
498 498
 		}
499 499
 
500
-		if(!$db_info->use_prepared_statements)
500
+		if (!$db_info->use_prepared_statements)
501 501
 		{
502 502
 			$db_info->use_prepared_statements = 'Y';
503 503
 		}
504 504
 
505
-		if(!$db_info->time_zone)
505
+		if (!$db_info->time_zone)
506 506
 			$db_info->time_zone = date('O');
507 507
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
508 508
 
509
-		if($db_info->qmail_compatibility != 'Y')
509
+		if ($db_info->qmail_compatibility != 'Y')
510 510
 			$db_info->qmail_compatibility = 'N';
511 511
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
512 512
 
513
-		if(!$db_info->use_db_session)
513
+		if (!$db_info->use_db_session)
514 514
 			$db_info->use_db_session = 'N';
515
-		if(!$db_info->use_ssl)
515
+		if (!$db_info->use_ssl)
516 516
 			$db_info->use_ssl = 'none';
517 517
 		$this->set('_use_ssl', $db_info->use_ssl);
518 518
 
519 519
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
520 520
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
521 521
 
522
-		if(!$db_info->sitelock_whitelist) {
522
+		if (!$db_info->sitelock_whitelist) {
523 523
 			$db_info->sitelock_whitelist = '127.0.0.1';
524 524
 		}
525 525
 
526
-		if(is_string($db_info->sitelock_whitelist)) {
526
+		if (is_string($db_info->sitelock_whitelist)) {
527 527
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
528 528
 		}
529 529
 
@@ -594,10 +594,10 @@  discard block
 block discarded – undo
594 594
 	function loadLangSupported()
595 595
 	{
596 596
 		static $lang_supported = null;
597
-		if(!$lang_supported)
597
+		if (!$lang_supported)
598 598
 		{
599
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
600
-			foreach($langs as $val)
599
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
600
+			foreach ($langs as $val)
601 601
 			{
602 602
 				list($lang_prefix, $lang_text) = explode(',', $val);
603 603
 				$lang_text = trim($lang_text);
@@ -615,17 +615,17 @@  discard block
 block discarded – undo
615 615
 	function loadLangSelected()
616 616
 	{
617 617
 		static $lang_selected = null;
618
-		if(!$lang_selected)
618
+		if (!$lang_selected)
619 619
 		{
620
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
621
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
622
-			if(!FileHandler::hasContent($selected_lang_file))
620
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
621
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
622
+			if (!FileHandler::hasContent($selected_lang_file))
623 623
 			{
624
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
624
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
625 625
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
626 626
 			}
627 627
 
628
-			if(!FileHandler::hasContent($selected_lang_file))
628
+			if (!FileHandler::hasContent($selected_lang_file))
629 629
 			{
630 630
 				$buff = FileHandler::readFile($orig_lang_file);
631 631
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 			else
635 635
 			{
636 636
 				$langs = file($selected_lang_file);
637
-				foreach($langs as $val)
637
+				foreach ($langs as $val)
638 638
 				{
639 639
 					list($lang_prefix, $lang_text) = explode(',', $val);
640 640
 					$lang_text = trim($lang_text);
@@ -653,56 +653,56 @@  discard block
 block discarded – undo
653 653
 	function checkSSO()
654 654
 	{
655 655
 		// pass if it's not GET request or XE is not yet installed
656
-		if($this->db_info->use_sso != 'Y' || isCrawler())
656
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
657 657
 		{
658 658
 			return TRUE;
659 659
 		}
660 660
 		$checkActList = array('rss' => 1, 'atom' => 1);
661
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
661
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
662 662
 		{
663 663
 			return TRUE;
664 664
 		}
665 665
 
666 666
 		// pass if default URL is not set
667 667
 		$default_url = trim($this->db_info->default_url);
668
-		if(!$default_url)
668
+		if (!$default_url)
669 669
 		{
670 670
 			return TRUE;
671 671
 		}
672 672
 
673
-		if(substr_compare($default_url, '/', -1) !== 0)
673
+		if (substr_compare($default_url, '/', -1) !== 0)
674 674
 		{
675 675
 			$default_url .= '/';
676 676
 		}
677 677
 
678 678
 		// for sites recieving SSO valdiation
679
-		if($default_url == self::getRequestUri())
679
+		if ($default_url == self::getRequestUri())
680 680
 		{
681
-			if(self::get('url'))
681
+			if (self::get('url'))
682 682
 			{
683 683
 				$url = base64_decode(self::get('url'));
684 684
 				$url_info = parse_url($url);
685
-				if(!Password::checkSignature($url, self::get('sig')))
685
+				if (!Password::checkSignature($url, self::get('sig')))
686 686
 				{
687 687
 					echo self::get('lang')->msg_invalid_request;
688 688
 					return false;
689 689
 				}
690 690
 
691 691
 				$oModuleModel = getModel('module');
692
-				$domain = $url_info['host'] . $url_info['path'];
693
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
692
+				$domain = $url_info['host'].$url_info['path'];
693
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
694 694
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
695 695
 
696
-				if($site_info->site_srl)
696
+				if ($site_info->site_srl)
697 697
 				{
698
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
699
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
698
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
699
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
700 700
 				}
701 701
 				else
702 702
 				{
703 703
 					$redirect_url = $url;
704 704
 				}
705
-				header('location:' . $redirect_url);
705
+				header('location:'.$redirect_url);
706 706
 
707 707
 				return FALSE;
708 708
 			}
@@ -711,9 +711,9 @@  discard block
 block discarded – undo
711 711
 		else
712 712
 		{
713 713
 			// result handling : set session_name()
714
-			if($session_name = self::get('SSOID'))
714
+			if ($session_name = self::get('SSOID'))
715 715
 			{
716
-				if(!Password::checkSignature($session_name, self::get('sig')))
716
+				if (!Password::checkSignature($session_name, self::get('sig')))
717 717
 				{
718 718
 					echo self::get('lang')->msg_invalid_request;
719 719
 					return false;
@@ -722,17 +722,17 @@  discard block
 block discarded – undo
722 722
 				setcookie(session_name(), $session_name);
723 723
 
724 724
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
725
-				header('location:' . $url);
725
+				header('location:'.$url);
726 726
 				return FALSE;
727 727
 				// send SSO request
728 728
 			}
729
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
729
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
730 730
 			{
731 731
 				setcookie('sso', md5(self::getRequestUri()));
732 732
 				$origin_url = self::getRequestUrl();
733 733
 				$origin_sig = Password::createSignature($origin_url);
734 734
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
735
-				header('location:' . $url);
735
+				header('location:'.$url);
736 736
 				return FALSE;
737 737
 			}
738 738
 		}
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	{
760 760
 		$self = self::getInstance();
761 761
 
762
-		if(!$self->isFTPRegisted())
762
+		if (!$self->isFTPRegisted())
763 763
 		{
764 764
 			return null;
765 765
 		}
@@ -777,15 +777,15 @@  discard block
 block discarded – undo
777 777
 	 */
778 778
 	function addBrowserTitle($site_title)
779 779
 	{
780
-		if(!$site_title)
780
+		if (!$site_title)
781 781
 		{
782 782
 			return;
783 783
 		}
784 784
 		$self = self::getInstance();
785 785
 
786
-		if($self->site_title)
786
+		if ($self->site_title)
787 787
 		{
788
-			$self->site_title .= ' - ' . $site_title;
788
+			$self->site_title .= ' - '.$site_title;
789 789
 		}
790 790
 		else
791 791
 		{
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 */
802 802
 	function setBrowserTitle($site_title)
803 803
 	{
804
-		if(!$site_title)
804
+		if (!$site_title)
805 805
 		{
806 806
 			return;
807 807
 		}
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		$oModuleModel = getModel('module');
834 834
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
835 835
 
836
-		if(isset($moduleConfig->siteTitle))
836
+		if (isset($moduleConfig->siteTitle))
837 837
 		{
838 838
 			return $moduleConfig->siteTitle;
839 839
 		}
@@ -860,30 +860,30 @@  discard block
 block discarded – undo
860 860
 		global $lang;
861 861
 
862 862
 		$self = self::getInstance();
863
-		if(!$self->lang_type)
863
+		if (!$self->lang_type)
864 864
 		{
865 865
 			return;
866 866
 		}
867
-		if(!is_object($lang))
867
+		if (!is_object($lang))
868 868
 		{
869 869
 			$lang = new stdClass;
870 870
 		}
871 871
 
872
-		if(!($filename = $self->_loadXmlLang($path)))
872
+		if (!($filename = $self->_loadXmlLang($path)))
873 873
 		{
874 874
 			$filename = $self->_loadPhpLang($path);
875 875
 		}
876 876
 
877
-		if(!is_array($self->loaded_lang_files))
877
+		if (!is_array($self->loaded_lang_files))
878 878
 		{
879 879
 			$self->loaded_lang_files = array();
880 880
 		}
881
-		if(in_array($filename, $self->loaded_lang_files))
881
+		if (in_array($filename, $self->loaded_lang_files))
882 882
 		{
883 883
 			return;
884 884
 		}
885 885
 
886
-		if($filename && is_readable($filename))
886
+		if ($filename && is_readable($filename))
887 887
 		{
888 888
 			$self->loaded_lang_files[] = $filename;
889 889
 			include($filename);
@@ -904,24 +904,24 @@  discard block
 block discarded – undo
904 904
 	{
905 905
 		global $lang;
906 906
 
907
-		if(!$path) return;
907
+		if (!$path) return;
908 908
 
909
-		$_path = 'eval://' . $path;
909
+		$_path = 'eval://'.$path;
910 910
 
911
-		if(in_array($_path, $this->loaded_lang_files))
911
+		if (in_array($_path, $this->loaded_lang_files))
912 912
 		{
913 913
 			return;
914 914
 		}
915 915
 
916
-		if(substr_compare($path, '/', -1) !== 0)
916
+		if (substr_compare($path, '/', -1) !== 0)
917 917
 		{
918 918
 			$path .= '/';
919 919
 		}
920 920
 
921
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
921
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
922 922
 		$content = $oXmlLangParser->getCompileContent();
923 923
 
924
-		if($content)
924
+		if ($content)
925 925
 		{
926 926
 			$this->loaded_lang_files[] = $_path;
927 927
 			eval($content);
@@ -936,9 +936,9 @@  discard block
 block discarded – undo
936 936
 	 */
937 937
 	function _loadXmlLang($path)
938 938
 	{
939
-		if(!$path) return;
939
+		if (!$path) return;
940 940
 
941
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
941
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
942 942
 		return $oXmlLangParser->compile();
943 943
 	}
944 944
 
@@ -950,22 +950,22 @@  discard block
 block discarded – undo
950 950
 	 */
951 951
 	function _loadPhpLang($path)
952 952
 	{
953
-		if(!$path) return;
953
+		if (!$path) return;
954 954
 
955
-		if(substr_compare($path, '/', -1) !== 0)
955
+		if (substr_compare($path, '/', -1) !== 0)
956 956
 		{
957 957
 			$path .= '/';
958 958
 		}
959
-		$path_tpl = $path . '%s.lang.php';
959
+		$path_tpl = $path.'%s.lang.php';
960 960
 		$file = sprintf($path_tpl, $this->lang_type);
961 961
 
962 962
 		$langs = array('ko', 'en'); // this will be configurable.
963
-		while(!is_readable($file) && $langs[0])
963
+		while (!is_readable($file) && $langs[0])
964 964
 		{
965 965
 			$file = sprintf($path_tpl, array_shift($langs));
966 966
 		}
967 967
 
968
-		if(!is_readable($file))
968
+		if (!is_readable($file))
969 969
 		{
970 970
 			return FALSE;
971 971
 		}
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
 	 */
1008 1008
 	function getLang($code)
1009 1009
 	{
1010
-		if(!$code)
1010
+		if (!$code)
1011 1011
 		{
1012 1012
 			return;
1013 1013
 		}
1014
-		if($GLOBALS['lang']->{$code})
1014
+		if ($GLOBALS['lang']->{$code})
1015 1015
 		{
1016 1016
 			return $GLOBALS['lang']->{$code};
1017 1017
 		}
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	 */
1028 1028
 	function setLang($code, $val)
1029 1029
 	{
1030
-		if(!isset($GLOBALS['lang']))
1030
+		if (!isset($GLOBALS['lang']))
1031 1031
 		{
1032 1032
 			$GLOBALS['lang'] = new stdClass();
1033 1033
 		}
@@ -1052,17 +1052,17 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 		$obj = clone $source_obj;
1054 1054
 
1055
-		foreach($charset_list as $charset)
1055
+		foreach ($charset_list as $charset)
1056 1056
 		{
1057
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1057
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1058 1058
 			$flag = self::checkConvertFlag($flag = TRUE);
1059
-			if($flag)
1059
+			if ($flag)
1060 1060
 			{
1061
-				if($charset == 'UTF-8')
1061
+				if ($charset == 'UTF-8')
1062 1062
 				{
1063 1063
 					return $obj;
1064 1064
 				}
1065
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1065
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1066 1066
 				return $obj;
1067 1067
 			}
1068 1068
 		}
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1082 1082
 	{
1083 1083
 		static $flag = TRUE;
1084
-		if($charset)
1084
+		if ($charset)
1085 1085
 		{
1086
-			if(is_array($val))
1087
-				array_walk($val,'Context::checkConvertFlag',$charset);
1088
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1086
+			if (is_array($val))
1087
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1088
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1089 1089
 			else $flag = FALSE;
1090 1090
 		}
1091 1091
 		else
@@ -1109,9 +1109,9 @@  discard block
 block discarded – undo
1109 1109
 	{
1110 1110
 		if (is_array($val))
1111 1111
 		{
1112
-			array_walk($val,'Context::doConvertEncoding',$charset);
1112
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1113 1113
 		}
1114
-		else $val = iconv($charset,'UTF-8',$val);
1114
+		else $val = iconv($charset, 'UTF-8', $val);
1115 1115
 	}
1116 1116
 
1117 1117
 	/**
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	 */
1123 1123
 	function convertEncodingStr($str)
1124 1124
 	{
1125
-        if(!$str) return null;
1125
+        if (!$str) return null;
1126 1126
 		$obj = new stdClass();
1127 1127
 		$obj->str = $str;
1128 1128
 		$obj = self::convertEncoding($obj);
@@ -1131,9 +1131,9 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
 	function decodeIdna($domain)
1133 1133
 	{
1134
-		if(strpos($domain, 'xn--') !== FALSE)
1134
+		if (strpos($domain, 'xn--') !== FALSE)
1135 1135
 		{
1136
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1136
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1137 1137
 			$IDN = new idna_convert(array('idn_version' => 2008));
1138 1138
 			$domain = $IDN->decode($domain);
1139 1139
 		}
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 	{
1165 1165
 		$self = self::getInstance();
1166 1166
 
1167
-		if($self->response_method)
1167
+		if ($self->response_method)
1168 1168
 		{
1169 1169
 			return $self->response_method;
1170 1170
 		}
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1205 1205
 
1206 1206
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1207
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1207
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1208 1208
 		{
1209 1209
 			$this->isSuccessInit = FALSE;
1210 1210
 		}
@@ -1217,30 +1217,30 @@  discard block
 block discarded – undo
1217 1217
 	 */
1218 1218
 	function _setRequestArgument()
1219 1219
 	{
1220
-		if(!count($_REQUEST))
1220
+		if (!count($_REQUEST))
1221 1221
 		{
1222 1222
 			return;
1223 1223
 		}
1224 1224
 
1225 1225
 		$requestMethod = $this->getRequestMethod();
1226
-		foreach($_REQUEST as $key => $val)
1226
+		foreach ($_REQUEST as $key => $val)
1227 1227
 		{
1228
-			if($val === '' || self::get($key))
1228
+			if ($val === '' || self::get($key))
1229 1229
 			{
1230 1230
 				continue;
1231 1231
 			}
1232 1232
 			$key = htmlentities($key);
1233 1233
 			$val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET'));
1234 1234
 
1235
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1235
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1236 1236
 			{
1237 1237
 				$set_to_vars = TRUE;
1238 1238
 			}
1239
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1239
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1240 1240
 			{
1241 1241
 				$set_to_vars = TRUE;
1242 1242
 			}
1243
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1243
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244 1244
 			{
1245 1245
 				$set_to_vars = TRUE;
1246 1246
 			}
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 				$set_to_vars = FALSE;
1250 1250
 			}
1251 1251
 
1252
-			if($set_to_vars)
1252
+			if ($set_to_vars)
1253 1253
 			{
1254 1254
 				$this->_recursiveCheckVar($val);
1255 1255
 			}
@@ -1260,20 +1260,20 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
 	function _recursiveCheckVar($val)
1262 1262
 	{
1263
-		if(is_string($val))
1263
+		if (is_string($val))
1264 1264
 		{
1265
-			foreach($this->patterns as $pattern)
1265
+			foreach ($this->patterns as $pattern)
1266 1266
 			{
1267
-				if(preg_match($pattern, $val))
1267
+				if (preg_match($pattern, $val))
1268 1268
 				{
1269 1269
 					$this->isSuccessInit = FALSE;
1270 1270
 					return;
1271 1271
 				}
1272 1272
 			}
1273 1273
 		}
1274
-		else if(is_array($val))
1274
+		else if (is_array($val))
1275 1275
 		{
1276
-			foreach($val as $val2)
1276
+			foreach ($val as $val2)
1277 1277
 			{
1278 1278
 				$this->_recursiveCheckVar($val2);
1279 1279
 			}
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 	 */
1288 1288
 	function _setJSONRequestArgument()
1289 1289
 	{
1290
-		if($this->getRequestMethod() != 'JSON')
1290
+		if ($this->getRequestMethod() != 'JSON')
1291 1291
 		{
1292 1292
 			return;
1293 1293
 		}
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 		$params = array();
1296 1296
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1297 1297
 
1298
-		foreach($params as $key => $val)
1298
+		foreach ($params as $key => $val)
1299 1299
 		{
1300 1300
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1301 1301
 		}
@@ -1308,13 +1308,13 @@  discard block
 block discarded – undo
1308 1308
 	 */
1309 1309
 	function _setXmlRpcArgument()
1310 1310
 	{
1311
-		if($this->getRequestMethod() != 'XMLRPC')
1311
+		if ($this->getRequestMethod() != 'XMLRPC')
1312 1312
 		{
1313 1313
 			return;
1314 1314
 		}
1315 1315
 
1316 1316
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1317
-		if(Security::detectingXEE($xml))
1317
+		if (Security::detectingXEE($xml))
1318 1318
 		{
1319 1319
 			header("HTTP/1.0 400 Bad Request");
1320 1320
 			exit;
@@ -1326,12 +1326,12 @@  discard block
 block discarded – undo
1326 1326
 		$params = $xml_obj->methodcall->params;
1327 1327
 		unset($params->node_name, $params->attrs, $params->body);
1328 1328
 
1329
-		if(!count(get_object_vars($params)))
1329
+		if (!count(get_object_vars($params)))
1330 1330
 		{
1331 1331
 			return;
1332 1332
 		}
1333 1333
 
1334
-		foreach($params as $key => $val)
1334
+		foreach ($params as $key => $val)
1335 1335
 		{
1336 1336
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1337 1337
 		}
@@ -1346,10 +1346,10 @@  discard block
 block discarded – undo
1346 1346
 	 */
1347 1347
 	function _filterXmlVars($key, $val)
1348 1348
 	{
1349
-		if(is_array($val))
1349
+		if (is_array($val))
1350 1350
 		{
1351 1351
 			$stack = array();
1352
-			foreach($val as $k => $v)
1352
+			foreach ($val as $k => $v)
1353 1353
 			{
1354 1354
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1355 1355
 			}
@@ -1359,20 +1359,20 @@  discard block
 block discarded – undo
1359 1359
 
1360 1360
 		$body = $val->body;
1361 1361
 		unset($val->node_name, $val->attrs, $val->body);
1362
-		if(!count(get_object_vars($val)))
1362
+		if (!count(get_object_vars($val)))
1363 1363
 		{
1364 1364
 			return $this->_filterRequestVar($key, $body, 0);
1365 1365
 		}
1366 1366
 
1367 1367
 		$stack = new stdClass();
1368
-		foreach($val as $k => $v)
1368
+		foreach ($val as $k => $v)
1369 1369
 		{
1370 1370
 			$output = $this->_filterXmlVars($k, $v);
1371
-			if(is_object($v) && $v->attrs->type == 'array')
1371
+			if (is_object($v) && $v->attrs->type == 'array')
1372 1372
 			{
1373 1373
 				$output = array($output);
1374 1374
 			}
1375
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1375
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1376 1376
 			{
1377 1377
 				return $output;
1378 1378
 			}
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 			$stack->{$k} = $output;
1381 1381
 		}
1382 1382
 
1383
-		if(!count(get_object_vars($stack)))
1383
+		if (!count(get_object_vars($stack)))
1384 1384
 		{
1385 1385
 			return NULL;
1386 1386
 		}
@@ -1399,16 +1399,16 @@  discard block
 block discarded – undo
1399 1399
 	 */
1400 1400
 	function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false)
1401 1401
 	{
1402
-		if(!($isArray = is_array($val)))
1402
+		if (!($isArray = is_array($val)))
1403 1403
 		{
1404 1404
 			$val = array($val);
1405 1405
 		}
1406 1406
 
1407 1407
 		$result = array();
1408
-		foreach($val as $k => $v)
1408
+		foreach ($val as $k => $v)
1409 1409
 		{
1410
-			if($remove_hack && !is_array($v)) {
1411
-				if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1410
+			if ($remove_hack && !is_array($v)) {
1411
+				if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1412 1412
 				{
1413 1413
 					$result[$k] = escape($v);
1414 1414
 					continue;
@@ -1416,18 +1416,18 @@  discard block
 block discarded – undo
1416 1416
 			}
1417 1417
 
1418 1418
 			$k = htmlentities($k);
1419
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1419
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1420 1420
 			{
1421 1421
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1422 1422
 			}
1423
-			elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1423
+			elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) {
1424 1424
 				$result[$k] = escape($v, false);
1425 1425
 			}
1426
-			elseif($key === 'vid')
1426
+			elseif ($key === 'vid')
1427 1427
 			{
1428 1428
 				$result[$k] = urlencode($v);
1429 1429
 			}
1430
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1430
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1431 1431
 			{
1432 1432
 				unset($result[$k]);
1433 1433
 			}
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 			{
1436 1436
 				$result[$k] = $v;
1437 1437
 
1438
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1438
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1439 1439
 				{
1440 1440
 					if (is_array($result[$k]))
1441 1441
 					{
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 					}
1448 1448
 				}
1449 1449
 
1450
-				if(is_array($result[$k]))
1450
+				if (is_array($result[$k]))
1451 1451
 				{
1452 1452
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1453 1453
 				}
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 					$result[$k] = trim($result[$k]);
1457 1457
 				}
1458 1458
 
1459
-				if($remove_hack)
1459
+				if ($remove_hack)
1460 1460
 				{
1461 1461
 					$result[$k] = escape($result[$k], false);
1462 1462
 				}
@@ -1484,17 +1484,17 @@  discard block
 block discarded – undo
1484 1484
 	 */
1485 1485
 	function _setUploadedArgument()
1486 1486
 	{
1487
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1487
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1488 1488
 		{
1489 1489
 			return;
1490 1490
 		}
1491 1491
 
1492
-		foreach($_FILES as $key => $val)
1492
+		foreach ($_FILES as $key => $val)
1493 1493
 		{
1494 1494
 			$tmp_name = $val['tmp_name'];
1495
-			if(!is_array($tmp_name))
1495
+			if (!is_array($tmp_name))
1496 1496
 			{
1497
-				if(!UploadFileFilter::check($tmp_name, $val['name']))
1497
+				if (!UploadFileFilter::check($tmp_name, $val['name']))
1498 1498
 				{
1499 1499
 					continue;
1500 1500
 				}
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 				$files = array();
1508 1508
 				foreach ($tmp_name as $i => $j)
1509 1509
 				{
1510
-					if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i]))
1510
+					if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i]))
1511 1511
 					{
1512 1512
 						$files = array();
1513 1513
 						unset($_FILES[$key]);
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 					$file['size'] = $val['size'][$i];
1522 1522
 					$files[] = $file;
1523 1523
 				}
1524
-				if(count($files))
1524
+				if (count($files))
1525 1525
 				{
1526 1526
 					self::set($key, $files, true);
1527 1527
 				}
@@ -1546,16 +1546,16 @@  discard block
 block discarded – undo
1546 1546
 	function getRequestUrl()
1547 1547
 	{
1548 1548
 		static $url = null;
1549
-		if(is_null($url))
1549
+		if (is_null($url))
1550 1550
 		{
1551 1551
 			$url = self::getRequestUri();
1552
-			if(count($_GET) > 0)
1552
+			if (count($_GET) > 0)
1553 1553
 			{
1554
-				foreach($_GET as $key => $val)
1554
+				foreach ($_GET as $key => $val)
1555 1555
 				{
1556
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1556
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1557 1557
 				}
1558
-				$url .= '?' . join('&', $vars);
1558
+				$url .= '?'.join('&', $vars);
1559 1559
 			}
1560 1560
 		}
1561 1561
 		return $url;
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 		$self = self::getInstance();
1571 1571
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1572 1572
 
1573
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1573
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1574 1574
 		{
1575 1575
 			unset($js_callback_func);
1576 1576
 			unset($_GET['xe_js_callback']);
@@ -1598,22 +1598,22 @@  discard block
 block discarded – undo
1598 1598
 		$self = self::getInstance();
1599 1599
 
1600 1600
 		// retrieve virtual site information
1601
-		if(is_null($site_module_info))
1601
+		if (is_null($site_module_info))
1602 1602
 		{
1603 1603
 			$site_module_info = self::get('site_module_info');
1604 1604
 		}
1605 1605
 
1606 1606
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1607
-		if($domain && isSiteID($domain))
1607
+		if ($domain && isSiteID($domain))
1608 1608
 		{
1609 1609
 			$vid = $domain;
1610 1610
 			$domain = '';
1611 1611
 		}
1612 1612
 
1613 1613
 		// If $domain, $vid are not set, use current site information
1614
-		if(!$domain && !$vid)
1614
+		if (!$domain && !$vid)
1615 1615
 		{
1616
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1616
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1617 1617
 			{
1618 1618
 				$vid = $site_module_info->domain;
1619 1619
 			}
@@ -1624,21 +1624,21 @@  discard block
 block discarded – undo
1624 1624
 		}
1625 1625
 
1626 1626
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1627
-		if($domain)
1627
+		if ($domain)
1628 1628
 		{
1629 1629
 			$domain_info = parse_url($domain);
1630
-			if(is_null($current_info))
1630
+			if (is_null($current_info))
1631 1631
 			{
1632
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1632
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1633 1633
 			}
1634
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1634
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1635 1635
 			{
1636 1636
 				unset($domain);
1637 1637
 			}
1638 1638
 			else
1639 1639
 			{
1640 1640
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1641
-				if(substr_compare($domain, '/', -1) !== 0)
1641
+				if (substr_compare($domain, '/', -1) !== 0)
1642 1642
 				{
1643 1643
 					$domain .= '/';
1644 1644
 				}
@@ -1648,41 +1648,41 @@  discard block
 block discarded – undo
1648 1648
 		$get_vars = array();
1649 1649
 
1650 1650
 		// If there is no GET variables or first argument is '' to reset variables
1651
-		if(!$self->get_vars || $args_list[0] == '')
1651
+		if (!$self->get_vars || $args_list[0] == '')
1652 1652
 		{
1653 1653
 			// rearrange args_list
1654
-			if(is_array($args_list) && $args_list[0] == '')
1654
+			if (is_array($args_list) && $args_list[0] == '')
1655 1655
 			{
1656 1656
 				array_shift($args_list);
1657 1657
 			}
1658 1658
 		}
1659
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1659
+		elseif ($_SERVER['REQUEST_METHOD'] == 'GET')
1660 1660
 		{
1661 1661
 			// Otherwise, make GET variables into array
1662 1662
 			$get_vars = get_object_vars($self->get_vars);
1663 1663
 		}
1664 1664
 		else
1665 1665
 		{
1666
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1667
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1668
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1669
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1670
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1671
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1672
-			if($get_vars['act'] == 'IS')
1666
+			if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1667
+			if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1668
+			if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1669
+			if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1670
+			if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1671
+			if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1672
+			if ($get_vars['act'] == 'IS')
1673 1673
 			{
1674
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1674
+				if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1675 1675
 			}
1676 1676
 		}
1677 1677
 
1678 1678
 		// arrange args_list
1679
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1679
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1680 1680
 		{
1681 1681
 			$key = $args_list[$i];
1682 1682
 			$val = trim($args_list[$i + 1]);
1683 1683
 
1684 1684
 			// If value is not set, remove the key
1685
-			if(!isset($val) || !strlen($val))
1685
+			if (!isset($val) || !strlen($val))
1686 1686
 			{
1687 1687
 				unset($get_vars[$key]);
1688 1688
 				continue;
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 
1694 1694
 		// remove vid, rnd
1695 1695
 		unset($get_vars['rnd']);
1696
-		if($vid)
1696
+		if ($vid)
1697 1697
 		{
1698 1698
 			$get_vars['vid'] = $vid;
1699 1699
 		}
@@ -1710,17 +1710,17 @@  discard block
 block discarded – undo
1710 1710
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1711 1711
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1712 1712
 		);
1713
-		if($act_alias[$act])
1713
+		if ($act_alias[$act])
1714 1714
 		{
1715 1715
 			$get_vars['act'] = $act_alias[$act];
1716 1716
 		}
1717 1717
 
1718 1718
 		// organize URL
1719 1719
 		$query = '';
1720
-		if(count($get_vars) > 0)
1720
+		if (count($get_vars) > 0)
1721 1721
 		{
1722 1722
 			// if using rewrite mod
1723
-			if($self->allow_rewrite)
1723
+			if ($self->allow_rewrite)
1724 1724
 			{
1725 1725
 				$var_keys = array_keys($get_vars);
1726 1726
 				sort($var_keys);
@@ -1740,8 +1740,8 @@  discard block
 block discarded – undo
1740 1740
 					'vid' => $vid,
1741 1741
 					'mid' => $mid,
1742 1742
 					'mid.vid' => "$vid/$mid",
1743
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1744
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1743
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1744
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1745 1745
 					'document_srl' => $srl,
1746 1746
 					'document_srl.mid' => "$mid/$srl",
1747 1747
 					'document_srl.vid' => "$vid/$srl",
@@ -1758,66 +1758,66 @@  discard block
 block discarded – undo
1758 1758
 				$query = $target_map[$target];
1759 1759
 			}
1760 1760
 
1761
-			if(!$query)
1761
+			if (!$query)
1762 1762
 			{
1763 1763
 				$queries = array();
1764
-				foreach($get_vars as $key => $val)
1764
+				foreach ($get_vars as $key => $val)
1765 1765
 				{
1766
-					if(is_array($val) && count($val) > 0)
1766
+					if (is_array($val) && count($val) > 0)
1767 1767
 					{
1768
-						foreach($val as $k => $v)
1768
+						foreach ($val as $k => $v)
1769 1769
 						{
1770
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1770
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1771 1771
 						}
1772 1772
 					}
1773
-					elseif(!is_array($val))
1773
+					elseif (!is_array($val))
1774 1774
 					{
1775
-						$queries[] = $key . '=' . urlencode($val);
1775
+						$queries[] = $key.'='.urlencode($val);
1776 1776
 					}
1777 1777
 				}
1778
-				if(count($queries) > 0)
1778
+				if (count($queries) > 0)
1779 1779
 				{
1780
-					$query = 'index.php?' . join('&', $queries);
1780
+					$query = 'index.php?'.join('&', $queries);
1781 1781
 				}
1782 1782
 			}
1783 1783
 		}
1784 1784
 
1785 1785
 		// If using SSL always
1786 1786
 		$_use_ssl = $self->get('_use_ssl');
1787
-		if($_use_ssl == 'always')
1787
+		if ($_use_ssl == 'always')
1788 1788
 		{
1789
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1789
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1790 1790
 			// optional SSL use
1791 1791
 		}
1792
-		elseif($_use_ssl == 'optional')
1792
+		elseif ($_use_ssl == 'optional')
1793 1793
 		{
1794 1794
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1795
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1795
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1796 1796
 			// no SSL
1797 1797
 		}
1798 1798
 		else
1799 1799
 		{
1800 1800
 			// currently on SSL but target is not based on SSL
1801
-			if($_SERVER['HTTPS'] == 'on')
1801
+			if ($_SERVER['HTTPS'] == 'on')
1802 1802
 			{
1803
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1803
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1804 1804
 			}
1805
-			else if($domain) // if $domain is set
1805
+			else if ($domain) // if $domain is set
1806 1806
 			{
1807
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1807
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1808 1808
 			}
1809 1809
 			else
1810 1810
 			{
1811
-				$query = getScriptPath() . $query;
1811
+				$query = getScriptPath().$query;
1812 1812
 			}
1813 1813
 		}
1814 1814
 
1815
-		if(!$encode)
1815
+		if (!$encode)
1816 1816
 		{
1817 1817
 			return $query;
1818 1818
 		}
1819 1819
 
1820
-		if(!$autoEncode)
1820
+		if (!$autoEncode)
1821 1821
 		{
1822 1822
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1823 1823
 		}
@@ -1826,16 +1826,16 @@  discard block
 block discarded – undo
1826 1826
 		$encode_queries = array();
1827 1827
 		$parsedUrl = parse_url($query);
1828 1828
 		parse_str($parsedUrl['query'], $output);
1829
-		foreach($output as $key => $value)
1829
+		foreach ($output as $key => $value)
1830 1830
 		{
1831
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1831
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1832 1832
 			{
1833 1833
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1834 1834
 			}
1835
-			$encode_queries[] = $key . '=' . $value;
1835
+			$encode_queries[] = $key.'='.$value;
1836 1836
 		}
1837 1837
 
1838
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1838
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1839 1839
 	}
1840 1840
 
1841 1841
 	/**
@@ -1850,17 +1850,17 @@  discard block
 block discarded – undo
1850 1850
 		static $url = array();
1851 1851
 
1852 1852
 		// Check HTTP Request
1853
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1853
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1854 1854
 		{
1855 1855
 			return;
1856 1856
 		}
1857 1857
 
1858
-		if(self::get('_use_ssl') == 'always')
1858
+		if (self::get('_use_ssl') == 'always')
1859 1859
 		{
1860 1860
 			$ssl_mode = ENFORCE_SSL;
1861 1861
 		}
1862 1862
 
1863
-		if($domain)
1863
+		if ($domain)
1864 1864
 		{
1865 1865
 			$domain_key = md5($domain);
1866 1866
 		}
@@ -1869,14 +1869,14 @@  discard block
 block discarded – undo
1869 1869
 			$domain_key = 'default';
1870 1870
 		}
1871 1871
 
1872
-		if(isset($url[$ssl_mode][$domain_key]))
1872
+		if (isset($url[$ssl_mode][$domain_key]))
1873 1873
 		{
1874 1874
 			return $url[$ssl_mode][$domain_key];
1875 1875
 		}
1876 1876
 
1877 1877
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1878 1878
 
1879
-		switch($ssl_mode)
1879
+		switch ($ssl_mode)
1880 1880
 		{
1881 1881
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1882 1882
 				break;
@@ -1886,34 +1886,34 @@  discard block
 block discarded – undo
1886 1886
 				break;
1887 1887
 		}
1888 1888
 
1889
-		if($domain)
1889
+		if ($domain)
1890 1890
 		{
1891 1891
 			$target_url = trim($domain);
1892
-			if(substr_compare($target_url, '/', -1) !== 0)
1892
+			if (substr_compare($target_url, '/', -1) !== 0)
1893 1893
 			{
1894
-				$target_url.= '/';
1894
+				$target_url .= '/';
1895 1895
 			}
1896 1896
 		}
1897 1897
 		else
1898 1898
 		{
1899
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1899
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1900 1900
 		}
1901 1901
 
1902
-		$url_info = parse_url('http://' . $target_url);
1902
+		$url_info = parse_url('http://'.$target_url);
1903 1903
 
1904
-		if($current_use_ssl != $use_ssl)
1904
+		if ($current_use_ssl != $use_ssl)
1905 1905
 		{
1906 1906
 			unset($url_info['port']);
1907 1907
 		}
1908 1908
 
1909
-		if($use_ssl)
1909
+		if ($use_ssl)
1910 1910
 		{
1911 1911
 			$port = self::get('_https_port');
1912
-			if($port && $port != 443)
1912
+			if ($port && $port != 443)
1913 1913
 			{
1914 1914
 				$url_info['port'] = $port;
1915 1915
 			}
1916
-			elseif($url_info['port'] == 443)
1916
+			elseif ($url_info['port'] == 443)
1917 1917
 			{
1918 1918
 				unset($url_info['port']);
1919 1919
 			}
@@ -1921,17 +1921,17 @@  discard block
 block discarded – undo
1921 1921
 		else
1922 1922
 		{
1923 1923
 			$port = self::get('_http_port');
1924
-			if($port && $port != 80)
1924
+			if ($port && $port != 80)
1925 1925
 			{
1926 1926
 				$url_info['port'] = $port;
1927 1927
 			}
1928
-			elseif($url_info['port'] == 80)
1928
+			elseif ($url_info['port'] == 80)
1929 1929
 			{
1930 1930
 				unset($url_info['port']);
1931 1931
 			}
1932 1932
 		}
1933 1933
 
1934
-		$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']);
1934
+		$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']);
1935 1935
 
1936 1936
 		return $url[$ssl_mode][$domain_key];
1937 1937
 	}
@@ -1948,16 +1948,16 @@  discard block
 block discarded – undo
1948 1948
 	{
1949 1949
 		$self = self::getInstance();
1950 1950
 		$self->context->{$key} = $val;
1951
-		if($set_to_get_vars === FALSE)
1951
+		if ($set_to_get_vars === FALSE)
1952 1952
 		{
1953 1953
 			return;
1954 1954
 		}
1955
-		if($val === NULL || $val === '')
1955
+		if ($val === NULL || $val === '')
1956 1956
 		{
1957 1957
 			unset($self->get_vars->{$key});
1958 1958
 			return;
1959 1959
 		}
1960
-		if($set_to_get_vars || $self->get_vars->{$key})
1960
+		if ($set_to_get_vars || $self->get_vars->{$key})
1961 1961
 		{
1962 1962
 			$self->get_vars->{$key} = $val;
1963 1963
 		}
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
 	{
1974 1974
 		$self = self::getInstance();
1975 1975
 
1976
-		if(!isset($self->context->{$key}))
1976
+		if (!isset($self->context->{$key}))
1977 1977
 		{
1978 1978
 			return null;
1979 1979
 		}
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 	function gets()
1989 1989
 	{
1990 1990
 		$num_args = func_num_args();
1991
-		if($num_args < 1)
1991
+		if ($num_args < 1)
1992 1992
 		{
1993 1993
 			return;
1994 1994
 		}
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 
1997 1997
 		$args_list = func_get_args();
1998 1998
 		$output = new stdClass();
1999
-		foreach($args_list as $v)
1999
+		foreach ($args_list as $v)
2000 2000
 		{
2001 2001
 			$output->{$v} = $self->get($v);
2002 2002
 		}
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
 	function getRequestVars()
2023 2023
 	{
2024 2024
 		$self = self::getInstance();
2025
-		if($self->get_vars)
2025
+		if ($self->get_vars)
2026 2026
 		{
2027 2027
 			return clone($self->get_vars);
2028 2028
 		}
@@ -2039,13 +2039,13 @@  discard block
 block discarded – undo
2039 2039
 	{
2040 2040
 		$self = self::getInstance();
2041 2041
 
2042
-		if(!is_readable($self->sslActionCacheFile))
2042
+		if (!is_readable($self->sslActionCacheFile))
2043 2043
 		{
2044 2044
 			$buff = '<?php if(!defined("__XE__"))exit;';
2045 2045
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2046 2046
 		}
2047 2047
 
2048
-		if(!isset($self->ssl_actions[$action]))
2048
+		if (!isset($self->ssl_actions[$action]))
2049 2049
 		{
2050 2050
 			$self->ssl_actions[$action] = 1;
2051 2051
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2063,16 +2063,16 @@  discard block
 block discarded – undo
2063 2063
 	{
2064 2064
 		$self = self::getInstance();
2065 2065
 
2066
-		if(!is_readable($self->sslActionCacheFile))
2066
+		if (!is_readable($self->sslActionCacheFile))
2067 2067
 		{
2068 2068
 			unset($self->ssl_actions);
2069 2069
 			$buff = '<?php if(!defined("__XE__"))exit;';
2070 2070
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2071 2071
 		}
2072 2072
 
2073
-		foreach($action_array as $action)
2073
+		foreach ($action_array as $action)
2074 2074
 		{
2075
-			if(!isset($self->ssl_actions[$action]))
2075
+			if (!isset($self->ssl_actions[$action]))
2076 2076
 			{
2077 2077
 				$self->ssl_actions[$action] = 1;
2078 2078
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2091,7 +2091,7 @@  discard block
 block discarded – undo
2091 2091
 	{
2092 2092
 		$self = self::getInstance();
2093 2093
 
2094
-		if($self->isExistsSSLAction($action))
2094
+		if ($self->isExistsSSLAction($action))
2095 2095
 		{
2096 2096
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2097 2097
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 	function getSSLActions()
2109 2109
 	{
2110 2110
 		$self = self::getInstance();
2111
-		if($self->getSslStatus() == 'optional')
2111
+		if ($self->getSslStatus() == 'optional')
2112 2112
 		{
2113 2113
 			return $self->ssl_actions;
2114 2114
 		}
@@ -2135,12 +2135,12 @@  discard block
 block discarded – undo
2135 2135
 	 */
2136 2136
 	function normalizeFilePath($file)
2137 2137
 	{
2138
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2138
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2139 2139
 		{
2140
-			$file = './' . $file;
2140
+			$file = './'.$file;
2141 2141
 		}
2142 2142
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2143
-		while(strpos($file, '/../') !== FALSE)
2143
+		while (strpos($file, '/../') !== FALSE)
2144 2144
 		{
2145 2145
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2146 2146
 		}
@@ -2159,13 +2159,13 @@  discard block
 block discarded – undo
2159 2159
 	{
2160 2160
 		$file = self::normalizeFilePath($file);
2161 2161
 		$script_path = getScriptPath();
2162
-		if(strpos($file, './') === 0)
2162
+		if (strpos($file, './') === 0)
2163 2163
 		{
2164
-			$file = $script_path . substr($file, 2);
2164
+			$file = $script_path.substr($file, 2);
2165 2165
 		}
2166
-		elseif(strpos($file, '../') === 0)
2166
+		elseif (strpos($file, '../') === 0)
2167 2167
 		{
2168
-			$file = self::normalizeFilePath($script_path . $file);
2168
+			$file = self::normalizeFilePath($script_path.$file);
2169 2169
 		}
2170 2170
 
2171 2171
 		return $file;
@@ -2235,12 +2235,12 @@  discard block
 block discarded – undo
2235 2235
 	 */
2236 2236
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2237 2237
 	{
2238
-		if($isRuleset)
2238
+		if ($isRuleset)
2239 2239
 		{
2240
-			if(strpos($file, '#') !== FALSE)
2240
+			if (strpos($file, '#') !== FALSE)
2241 2241
 			{
2242 2242
 				$file = str_replace('#', '', $file);
2243
-				if(!is_readable($file))
2243
+				if (!is_readable($file))
2244 2244
 				{
2245 2245
 					$file = $autoPath;
2246 2246
 				}
@@ -2305,9 +2305,9 @@  discard block
 block discarded – undo
2305 2305
 		ksort($files);
2306 2306
 		$files = array_values($files);
2307 2307
 		$filenames = array();
2308
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2308
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2309 2309
 		{
2310
-			if(in_array($files[$i]['file'], $filenames))
2310
+			if (in_array($files[$i]['file'], $filenames))
2311 2311
 			{
2312 2312
 				unset($files[$i]);
2313 2313
 			}
@@ -2392,14 +2392,14 @@  discard block
 block discarded – undo
2392 2392
 	 */
2393 2393
 	function getJavascriptPluginInfo($pluginName)
2394 2394
 	{
2395
-		if($plugin_name == 'ui.datepicker')
2395
+		if ($plugin_name == 'ui.datepicker')
2396 2396
 		{
2397 2397
 			$plugin_name = 'ui';
2398 2398
 		}
2399 2399
 
2400
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2401
-		$info_file = $plugin_path . 'plugin.load';
2402
-		if(!is_readable($info_file))
2400
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2401
+		$info_file = $plugin_path.'plugin.load';
2402
+		if (!is_readable($info_file))
2403 2403
 		{
2404 2404
 			return;
2405 2405
 		}
@@ -2409,32 +2409,32 @@  discard block
 block discarded – undo
2409 2409
 		$result->jsList = array();
2410 2410
 		$result->cssList = array();
2411 2411
 
2412
-		foreach($list as $filename)
2412
+		foreach ($list as $filename)
2413 2413
 		{
2414 2414
 			$filename = trim($filename);
2415
-			if(!$filename)
2415
+			if (!$filename)
2416 2416
 			{
2417 2417
 				continue;
2418 2418
 			}
2419 2419
 
2420
-			if(strncasecmp('./', $filename, 2) === 0)
2420
+			if (strncasecmp('./', $filename, 2) === 0)
2421 2421
 			{
2422 2422
 				$filename = substr($filename, 2);
2423 2423
 			}
2424 2424
 
2425
-			if(substr_compare($filename, '.js', -3) === 0)
2425
+			if (substr_compare($filename, '.js', -3) === 0)
2426 2426
 			{
2427
-				$result->jsList[] = $plugin_path . $filename;
2427
+				$result->jsList[] = $plugin_path.$filename;
2428 2428
 			}
2429
-			elseif(substr_compare($filename, '.css', -4) === 0)
2429
+			elseif (substr_compare($filename, '.css', -4) === 0)
2430 2430
 			{
2431
-				$result->cssList[] = $plugin_path . $filename;
2431
+				$result->cssList[] = $plugin_path.$filename;
2432 2432
 			}
2433 2433
 		}
2434 2434
 
2435
-		if(is_dir($plugin_path . 'lang'))
2435
+		if (is_dir($plugin_path.'lang'))
2436 2436
 		{
2437
-			$result->langPath = $plugin_path . 'lang';
2437
+			$result->langPath = $plugin_path.'lang';
2438 2438
 		}
2439 2439
 
2440 2440
 		return $result;
@@ -2450,50 +2450,50 @@  discard block
 block discarded – undo
2450 2450
 		static $loaded_plugins = array();
2451 2451
 
2452 2452
 		$self = self::getInstance();
2453
-		if($plugin_name == 'ui.datepicker')
2453
+		if ($plugin_name == 'ui.datepicker')
2454 2454
 		{
2455 2455
 			$plugin_name = 'ui';
2456 2456
 		}
2457 2457
 
2458
-		if($loaded_plugins[$plugin_name])
2458
+		if ($loaded_plugins[$plugin_name])
2459 2459
 		{
2460 2460
 			return;
2461 2461
 		}
2462 2462
 		$loaded_plugins[$plugin_name] = TRUE;
2463 2463
 
2464
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2465
-		$info_file = $plugin_path . 'plugin.load';
2466
-		if(!is_readable($info_file))
2464
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2465
+		$info_file = $plugin_path.'plugin.load';
2466
+		if (!is_readable($info_file))
2467 2467
 		{
2468 2468
 			return;
2469 2469
 		}
2470 2470
 
2471 2471
 		$list = file($info_file);
2472
-		foreach($list as $filename)
2472
+		foreach ($list as $filename)
2473 2473
 		{
2474 2474
 			$filename = trim($filename);
2475
-			if(!$filename)
2475
+			if (!$filename)
2476 2476
 			{
2477 2477
 				continue;
2478 2478
 			}
2479 2479
 
2480
-			if(strncasecmp('./', $filename, 2) === 0)
2480
+			if (strncasecmp('./', $filename, 2) === 0)
2481 2481
 			{
2482 2482
 				$filename = substr($filename, 2);
2483 2483
 			}
2484
-			if(substr_compare($filename, '.js', -3) === 0)
2484
+			if (substr_compare($filename, '.js', -3) === 0)
2485 2485
 			{
2486
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2486
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2487 2487
 			}
2488
-			if(substr_compare($filename, '.css', -4) === 0)
2488
+			if (substr_compare($filename, '.css', -4) === 0)
2489 2489
 			{
2490
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2490
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2491 2491
 			}
2492 2492
 		}
2493 2493
 
2494
-		if(is_dir($plugin_path . 'lang'))
2494
+		if (is_dir($plugin_path.'lang'))
2495 2495
 		{
2496
-			$self->loadLang($plugin_path . 'lang');
2496
+			$self->loadLang($plugin_path.'lang');
2497 2497
 		}
2498 2498
 	}
2499 2499
 
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
 	function addHtmlHeader($header)
2507 2507
 	{
2508 2508
 		$self = self::getInstance();
2509
-		$self->html_header .= "\n" . $header;
2509
+		$self->html_header .= "\n".$header;
2510 2510
 	}
2511 2511
 
2512 2512
 	function clearHtmlHeader()
@@ -2558,7 +2558,7 @@  discard block
 block discarded – undo
2558 2558
 	function addBodyHeader($header)
2559 2559
 	{
2560 2560
 		$self = self::getInstance();
2561
-		$self->body_header .= "\n" . $header;
2561
+		$self->body_header .= "\n".$header;
2562 2562
 	}
2563 2563
 
2564 2564
 	/**
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
 	function addHtmlFooter($footer)
2581 2581
 	{
2582 2582
 		$self = self::getInstance();
2583
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2583
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2584 2584
 	}
2585 2585
 
2586 2586
 	/**
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
 	 */
2602 2602
 	function getConfigFile()
2603 2603
 	{
2604
-		return _XE_PATH_ . 'files/config/db.config.php';
2604
+		return _XE_PATH_.'files/config/db.config.php';
2605 2605
 	}
2606 2606
 
2607 2607
 	/**
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
 	 */
2612 2612
 	function getFTPConfigFile()
2613 2613
 	{
2614
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2614
+		return _XE_PATH_.'files/config/ftp.config.php';
2615 2615
 	}
2616 2616
 
2617 2617
 	/**
@@ -2663,14 +2663,14 @@  discard block
 block discarded – undo
2663 2663
 		$_path = explode('/', $path);
2664 2664
 		$_base = explode('/', $base_url);
2665 2665
 
2666
-		if(!$_base[count($_base) - 1])
2666
+		if (!$_base[count($_base) - 1])
2667 2667
 		{
2668 2668
 			array_pop($_base);
2669 2669
 		}
2670 2670
 
2671
-		foreach($_xe as $idx => $dir)
2671
+		foreach ($_xe as $idx => $dir)
2672 2672
 		{
2673
-			if($_path[0] != $dir)
2673
+			if ($_path[0] != $dir)
2674 2674
 			{
2675 2675
 				break;
2676 2676
 			}
@@ -2678,9 +2678,9 @@  discard block
 block discarded – undo
2678 2678
 		}
2679 2679
 
2680 2680
 		$idx = count($_xe) - $idx - 1;
2681
-		while($idx--)
2681
+		while ($idx--)
2682 2682
 		{
2683
-			if(count($_base) > 0)
2683
+			if (count($_base) > 0)
2684 2684
 			{
2685 2685
 				array_shift($_base);
2686 2686
 			}
@@ -2690,13 +2690,13 @@  discard block
 block discarded – undo
2690 2690
 			}
2691 2691
 		}
2692 2692
 
2693
-		if(count($_base) > 0)
2693
+		if (count($_base) > 0)
2694 2694
 		{
2695 2695
 			array_unshift($_path, join('/', $_base));
2696 2696
 		}
2697 2697
 
2698
-		$path = '/' . join('/', $_path);
2699
-		if(substr_compare($path, '/', -1) !== 0)
2698
+		$path = '/'.join('/', $_path);
2699
+		if (substr_compare($path, '/', -1) !== 0)
2700 2700
 		{
2701 2701
 			$path .= '/';
2702 2702
 		}
@@ -2711,13 +2711,13 @@  discard block
 block discarded – undo
2711 2711
 	{
2712 2712
 		$self = self::getInstance();
2713 2713
 
2714
-		if(!is_array($self->meta_tags))
2714
+		if (!is_array($self->meta_tags))
2715 2715
 		{
2716 2716
 			$self->meta_tags = array();
2717 2717
 		}
2718 2718
 
2719 2719
 		$ret = array();
2720
-		foreach($self->meta_tags as $key => $val)
2720
+		foreach ($self->meta_tags as $key => $val)
2721 2721
 		{
2722 2722
 			list($name, $is_http_equiv) = explode("\t", $key);
2723 2723
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2738 2738
 	{
2739 2739
 		$self = self::getInstance();
2740
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2740
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2741 2741
 	}
2742 2742
 
2743 2743
 }
Please login to merge, or discard this patch.