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
Push — develop ( c9ce46...9cfa33 )
by gyeong-won
09:36
created
classes/context/Context.class.php 2 patches
Spacing   +301 added lines, -301 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');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,56 +641,56 @@  discard block
 block discarded – undo
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 679
 				$oModuleModel = getModel('module');
680
-				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
680
+				$domain = $url_info['host'].$url_info['path'];
681
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
682 682
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 683
 
684
-				if($site_info->site_srl)
684
+				if ($site_info->site_srl)
685 685
 				{
686
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687
-				$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']);
686
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
687
+				$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']);
688 688
 				}
689 689
 				else
690 690
 				{
691 691
 					$redirect_url = $url;
692 692
 				}
693
-				header('location:' . $redirect_url);
693
+				header('location:'.$redirect_url);
694 694
 
695 695
 				return FALSE;
696 696
 			}
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 		else
700 700
 		{
701 701
 			// result handling : set session_name()
702
-			if($session_name = self::get('SSOID'))
702
+			if ($session_name = self::get('SSOID'))
703 703
 			{
704
-				if(!Password::checkSignature($session_name, self::get('sig')))
704
+				if (!Password::checkSignature($session_name, self::get('sig')))
705 705
 				{
706 706
 					echo self::get('lang')->msg_invalid_request;
707 707
 					return false;
@@ -710,17 +710,17 @@  discard block
 block discarded – undo
710 710
 				setcookie(session_name(), $session_name);
711 711
 
712 712
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
713
-				header('location:' . $url);
713
+				header('location:'.$url);
714 714
 				return FALSE;
715 715
 				// send SSO request
716 716
 			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
717
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 718
 			{
719 719
 				setcookie('sso', md5(self::getRequestUri()));
720 720
 				$origin_url = self::getRequestUrl();
721 721
 				$origin_sig = Password::createSignature($origin_url);
722 722
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
723
-				header('location:' . $url);
723
+				header('location:'.$url);
724 724
 				return FALSE;
725 725
 			}
726 726
 		}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	{
748 748
 		$self = self::getInstance();
749 749
 
750
-		if(!$self->isFTPRegisted())
750
+		if (!$self->isFTPRegisted())
751 751
 		{
752 752
 			return null;
753 753
 		}
@@ -765,15 +765,15 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	function addBrowserTitle($site_title)
767 767
 	{
768
-		if(!$site_title)
768
+		if (!$site_title)
769 769
 		{
770 770
 			return;
771 771
 		}
772 772
 		$self = self::getInstance();
773 773
 
774
-		if($self->site_title)
774
+		if ($self->site_title)
775 775
 		{
776
-			$self->site_title .= ' - ' . $site_title;
776
+			$self->site_title .= ' - '.$site_title;
777 777
 		}
778 778
 		else
779 779
 		{
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 */
790 790
 	function setBrowserTitle($site_title)
791 791
 	{
792
-		if(!$site_title)
792
+		if (!$site_title)
793 793
 		{
794 794
 			return;
795 795
 		}
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		$oModuleModel = getModel('module');
822 822
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
823 823
 
824
-		if(isset($moduleConfig->siteTitle))
824
+		if (isset($moduleConfig->siteTitle))
825 825
 		{
826 826
 			return $moduleConfig->siteTitle;
827 827
 		}
@@ -848,30 +848,30 @@  discard block
 block discarded – undo
848 848
 		global $lang;
849 849
 
850 850
 		$self = self::getInstance();
851
-		if(!$self->lang_type)
851
+		if (!$self->lang_type)
852 852
 		{
853 853
 			return;
854 854
 		}
855
-		if(!is_object($lang))
855
+		if (!is_object($lang))
856 856
 		{
857 857
 			$lang = new stdClass;
858 858
 		}
859 859
 
860
-		if(!($filename = $self->_loadXmlLang($path)))
860
+		if (!($filename = $self->_loadXmlLang($path)))
861 861
 		{
862 862
 			$filename = $self->_loadPhpLang($path);
863 863
 		}
864 864
 
865
-		if(!is_array($self->loaded_lang_files))
865
+		if (!is_array($self->loaded_lang_files))
866 866
 		{
867 867
 			$self->loaded_lang_files = array();
868 868
 		}
869
-		if(in_array($filename, $self->loaded_lang_files))
869
+		if (in_array($filename, $self->loaded_lang_files))
870 870
 		{
871 871
 			return;
872 872
 		}
873 873
 
874
-		if($filename && is_readable($filename))
874
+		if ($filename && is_readable($filename))
875 875
 		{
876 876
 			$self->loaded_lang_files[] = $filename;
877 877
 			include($filename);
@@ -892,24 +892,24 @@  discard block
 block discarded – undo
892 892
 	{
893 893
 		global $lang;
894 894
 
895
-		if(!$path) return;
895
+		if (!$path) return;
896 896
 
897
-		$_path = 'eval://' . $path;
897
+		$_path = 'eval://'.$path;
898 898
 
899
-		if(in_array($_path, $this->loaded_lang_files))
899
+		if (in_array($_path, $this->loaded_lang_files))
900 900
 		{
901 901
 			return;
902 902
 		}
903 903
 
904
-		if(substr_compare($path, '/', -1) !== 0)
904
+		if (substr_compare($path, '/', -1) !== 0)
905 905
 		{
906 906
 			$path .= '/';
907 907
 		}
908 908
 
909
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
909
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
910 910
 		$content = $oXmlLangParser->getCompileContent();
911 911
 
912
-		if($content)
912
+		if ($content)
913 913
 		{
914 914
 			$this->loaded_lang_files[] = $_path;
915 915
 			eval($content);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function _loadXmlLang($path)
926 926
 	{
927
-		if(!$path) return;
927
+		if (!$path) return;
928 928
 
929
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
929
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
930 930
 		return $oXmlLangParser->compile();
931 931
 	}
932 932
 
@@ -938,22 +938,22 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	function _loadPhpLang($path)
940 940
 	{
941
-		if(!$path) return;
941
+		if (!$path) return;
942 942
 
943
-		if(substr_compare($path, '/', -1) !== 0)
943
+		if (substr_compare($path, '/', -1) !== 0)
944 944
 		{
945 945
 			$path .= '/';
946 946
 		}
947
-		$path_tpl = $path . '%s.lang.php';
947
+		$path_tpl = $path.'%s.lang.php';
948 948
 		$file = sprintf($path_tpl, $this->lang_type);
949 949
 
950 950
 		$langs = array('ko', 'en'); // this will be configurable.
951
-		while(!is_readable($file) && $langs[0])
951
+		while (!is_readable($file) && $langs[0])
952 952
 		{
953 953
 			$file = sprintf($path_tpl, array_shift($langs));
954 954
 		}
955 955
 
956
-		if(!is_readable($file))
956
+		if (!is_readable($file))
957 957
 		{
958 958
 			return FALSE;
959 959
 		}
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 	 */
996 996
 	function getLang($code)
997 997
 	{
998
-		if(!$code)
998
+		if (!$code)
999 999
 		{
1000 1000
 			return;
1001 1001
 		}
1002
-		if($GLOBALS['lang']->{$code})
1002
+		if ($GLOBALS['lang']->{$code})
1003 1003
 		{
1004 1004
 			return $GLOBALS['lang']->{$code};
1005 1005
 		}
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 */
1016 1016
 	function setLang($code, $val)
1017 1017
 	{
1018
-		if(!isset($GLOBALS['lang']))
1018
+		if (!isset($GLOBALS['lang']))
1019 1019
 		{
1020 1020
 			$GLOBALS['lang'] = new stdClass();
1021 1021
 		}
@@ -1043,17 +1043,17 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		$obj = clone $source_obj;
1045 1045
 
1046
-		foreach($charset_list as $charset)
1046
+		foreach ($charset_list as $charset)
1047 1047
 		{
1048
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1048
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1049 1049
 			$flag = self::checkConvertFlag($flag = TRUE);
1050
-			if($flag)
1050
+			if ($flag)
1051 1051
 			{
1052
-				if($charset == 'UTF-8')
1052
+				if ($charset == 'UTF-8')
1053 1053
 				{
1054 1054
 					return $obj;
1055 1055
 				}
1056
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1056
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1057 1057
 				return $obj;
1058 1058
 			}
1059 1059
 		}
@@ -1072,11 +1072,11 @@  discard block
 block discarded – undo
1072 1072
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1073 1073
 	{
1074 1074
 		static $flag = TRUE;
1075
-		if($charset)
1075
+		if ($charset)
1076 1076
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1077
+			if (is_array($val))
1078
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1079
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1080 1080
 			else $flag = FALSE;
1081 1081
 		}
1082 1082
 		else
@@ -1100,9 +1100,9 @@  discard block
 block discarded – undo
1100 1100
 	{
1101 1101
 		if (is_array($val))
1102 1102
 		{
1103
-			array_walk($val,'Context::doConvertEncoding',$charset);
1103
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1104 1104
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1105
+		else $val = iconv($charset, 'UTF-8', $val);
1106 1106
 	}
1107 1107
 
1108 1108
 	/**
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 	 */
1114 1114
 	function convertEncodingStr($str)
1115 1115
 	{
1116
-        if(!$str) return null;
1116
+        if (!$str) return null;
1117 1117
 		$obj = new stdClass();
1118 1118
 		$obj->str = $str;
1119 1119
 		$obj = self::convertEncoding($obj);
@@ -1122,9 +1122,9 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
 	function decodeIdna($domain)
1124 1124
 	{
1125
-		if(strpos($domain, 'xn--') !== FALSE)
1125
+		if (strpos($domain, 'xn--') !== FALSE)
1126 1126
 		{
1127
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1127
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1128 1128
 			$IDN = new idna_convert(array('idn_version' => 2008));
1129 1129
 			$domain = $IDN->decode($domain);
1130 1130
 		}
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	{
1156 1156
 		$self = self::getInstance();
1157 1157
 
1158
-		if($self->response_method)
1158
+		if ($self->response_method)
1159 1159
 		{
1160 1160
 			return $self->response_method;
1161 1161
 		}
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1196 1196
 
1197 1197
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1198
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1198
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1199 1199
 		{
1200 1200
 			$this->isSuccessInit = FALSE;
1201 1201
 		}
@@ -1208,30 +1208,30 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	function _setRequestArgument()
1210 1210
 	{
1211
-		if(!count($_REQUEST))
1211
+		if (!count($_REQUEST))
1212 1212
 		{
1213 1213
 			return;
1214 1214
 		}
1215 1215
 
1216 1216
 		$requestMethod = $this->getRequestMethod();
1217
-		foreach($_REQUEST as $key => $val)
1217
+		foreach ($_REQUEST as $key => $val)
1218 1218
 		{
1219
-			if($val === '' || self::get($key))
1219
+			if ($val === '' || self::get($key))
1220 1220
 			{
1221 1221
 				continue;
1222 1222
 			}
1223 1223
 			$key = htmlentities($key);
1224 1224
 			$val = $this->_filterRequestVar($key, $val);
1225 1225
 
1226
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1226
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1227 1227
 			{
1228 1228
 				$set_to_vars = TRUE;
1229 1229
 			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1230
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1231 1231
 			{
1232 1232
 				$set_to_vars = TRUE;
1233 1233
 			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1234
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1235
 			{
1236 1236
 				$set_to_vars = TRUE;
1237 1237
 			}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 				$set_to_vars = FALSE;
1241 1241
 			}
1242 1242
 
1243
-			if($set_to_vars)
1243
+			if ($set_to_vars)
1244 1244
 			{
1245 1245
 				$this->_recursiveCheckVar($val);
1246 1246
 			}
@@ -1251,20 +1251,20 @@  discard block
 block discarded – undo
1251 1251
 
1252 1252
 	function _recursiveCheckVar($val)
1253 1253
 	{
1254
-		if(is_string($val))
1254
+		if (is_string($val))
1255 1255
 		{
1256
-			foreach($this->patterns as $pattern)
1256
+			foreach ($this->patterns as $pattern)
1257 1257
 			{
1258
-				if(preg_match($pattern, $val))
1258
+				if (preg_match($pattern, $val))
1259 1259
 				{
1260 1260
 					$this->isSuccessInit = FALSE;
1261 1261
 					return;
1262 1262
 				}
1263 1263
 			}
1264 1264
 		}
1265
-		else if(is_array($val))
1265
+		else if (is_array($val))
1266 1266
 		{
1267
-			foreach($val as $val2)
1267
+			foreach ($val as $val2)
1268 1268
 			{
1269 1269
 				$this->_recursiveCheckVar($val2);
1270 1270
 			}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	function _setJSONRequestArgument()
1280 1280
 	{
1281
-		if($this->getRequestMethod() != 'JSON')
1281
+		if ($this->getRequestMethod() != 'JSON')
1282 1282
 		{
1283 1283
 			return;
1284 1284
 		}
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		$params = array();
1287 1287
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1288 1288
 
1289
-		foreach($params as $key => $val)
1289
+		foreach ($params as $key => $val)
1290 1290
 		{
1291 1291
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1292 1292
 		}
@@ -1299,13 +1299,13 @@  discard block
 block discarded – undo
1299 1299
 	 */
1300 1300
 	function _setXmlRpcArgument()
1301 1301
 	{
1302
-		if($this->getRequestMethod() != 'XMLRPC')
1302
+		if ($this->getRequestMethod() != 'XMLRPC')
1303 1303
 		{
1304 1304
 			return;
1305 1305
 		}
1306 1306
 
1307 1307
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1308
-		if(Security::detectingXEE($xml))
1308
+		if (Security::detectingXEE($xml))
1309 1309
 		{
1310 1310
 			header("HTTP/1.0 400 Bad Request");
1311 1311
 			exit;
@@ -1317,12 +1317,12 @@  discard block
 block discarded – undo
1317 1317
 		$params = $xml_obj->methodcall->params;
1318 1318
 		unset($params->node_name, $params->attrs, $params->body);
1319 1319
 
1320
-		if(!count(get_object_vars($params)))
1320
+		if (!count(get_object_vars($params)))
1321 1321
 		{
1322 1322
 			return;
1323 1323
 		}
1324 1324
 
1325
-		foreach($params as $key => $val)
1325
+		foreach ($params as $key => $val)
1326 1326
 		{
1327 1327
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1328 1328
 		}
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 	 */
1338 1338
 	function _filterXmlVars($key, $val)
1339 1339
 	{
1340
-		if(is_array($val))
1340
+		if (is_array($val))
1341 1341
 		{
1342 1342
 			$stack = array();
1343
-			foreach($val as $k => $v)
1343
+			foreach ($val as $k => $v)
1344 1344
 			{
1345 1345
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1346 1346
 			}
@@ -1350,20 +1350,20 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 		$body = $val->body;
1352 1352
 		unset($val->node_name, $val->attrs, $val->body);
1353
-		if(!count(get_object_vars($val)))
1353
+		if (!count(get_object_vars($val)))
1354 1354
 		{
1355 1355
 			return $this->_filterRequestVar($key, $body, 0);
1356 1356
 		}
1357 1357
 
1358 1358
 		$stack = new stdClass();
1359
-		foreach($val as $k => $v)
1359
+		foreach ($val as $k => $v)
1360 1360
 		{
1361 1361
 			$output = $this->_filterXmlVars($k, $v);
1362
-			if(is_object($v) && $v->attrs->type == 'array')
1362
+			if (is_object($v) && $v->attrs->type == 'array')
1363 1363
 			{
1364 1364
 				$output = array($output);
1365 1365
 			}
1366
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1366
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1367 1367
 			{
1368 1368
 				return $output;
1369 1369
 			}
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 			$stack->{$k} = $output;
1372 1372
 		}
1373 1373
 
1374
-		if(!count(get_object_vars($stack)))
1374
+		if (!count(get_object_vars($stack)))
1375 1375
 		{
1376 1376
 			return NULL;
1377 1377
 		}
@@ -1390,32 +1390,32 @@  discard block
 block discarded – undo
1390 1390
 	 */
1391 1391
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1392 1392
 	{
1393
-		if(!($isArray = is_array($val)))
1393
+		if (!($isArray = is_array($val)))
1394 1394
 		{
1395 1395
 			$val = array($val);
1396 1396
 		}
1397 1397
 
1398 1398
 		$result = array();
1399
-		foreach($val as $k => $v)
1399
+		foreach ($val as $k => $v)
1400 1400
 		{
1401 1401
 			$k = htmlentities($k);
1402
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1402
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1403
 			{
1404 1404
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405 1405
 			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1406
+			elseif ($key === 'mid' || $key === 'search_keyword')
1407 1407
 			{
1408 1408
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409 1409
 			}
1410
-			elseif($key === 'vid')
1410
+			elseif ($key === 'vid')
1411 1411
 			{
1412 1412
 				$result[$k] = urlencode($v);
1413 1413
 			}
1414
-			elseif($key === 'xe_validator_id')
1414
+			elseif ($key === 'xe_validator_id')
1415 1415
 			{
1416 1416
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417 1417
 			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1418
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1419
 			{
1420 1420
 				unset($result[$k]);
1421 1421
 			}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 			{
1424 1424
 				$result[$k] = $v;
1425 1425
 
1426
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1426
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1427 1427
 				{
1428 1428
 					if (is_array($result[$k]))
1429 1429
 					{
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 					}
1436 1436
 				}
1437 1437
 
1438
-				if(is_array($result[$k]))
1438
+				if (is_array($result[$k]))
1439 1439
 				{
1440 1440
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441 1441
 				}
@@ -1467,17 +1467,17 @@  discard block
 block discarded – undo
1467 1467
 	 */
1468 1468
 	function _setUploadedArgument()
1469 1469
 	{
1470
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1470
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1471 1471
 		{
1472 1472
 			return;
1473 1473
 		}
1474 1474
 
1475
-		foreach($_FILES as $key => $val)
1475
+		foreach ($_FILES as $key => $val)
1476 1476
 		{
1477 1477
 			$tmp_name = $val['tmp_name'];
1478
-			if(!is_array($tmp_name))
1478
+			if (!is_array($tmp_name))
1479 1479
 			{
1480
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1480
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1481 1481
 				{
1482 1482
 					continue;
1483 1483
 				}
@@ -1490,9 +1490,9 @@  discard block
 block discarded – undo
1490 1490
 				$files = array();
1491 1491
 				$count_files = count($tmp_name);
1492 1492
 
1493
-				for($i = 0; $i < $count_files; $i++)
1493
+				for ($i = 0; $i < $count_files; $i++)
1494 1494
 				{
1495
-					if($val['size'][$i] > 0)
1495
+					if ($val['size'][$i] > 0)
1496 1496
 					{
1497 1497
 						$file = array();
1498 1498
 						$file['name'] = $val['name'][$i];
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 						$files[] = $file;
1504 1504
 					}
1505 1505
 				}
1506
-				if($files) $this->set($key, $files, TRUE);
1506
+				if ($files) $this->set($key, $files, TRUE);
1507 1507
 			}
1508 1508
 		}
1509 1509
 	}
@@ -1525,16 +1525,16 @@  discard block
 block discarded – undo
1525 1525
 	function getRequestUrl()
1526 1526
 	{
1527 1527
 		static $url = null;
1528
-		if(is_null($url))
1528
+		if (is_null($url))
1529 1529
 		{
1530 1530
 			$url = self::getRequestUri();
1531
-			if(count($_GET) > 0)
1531
+			if (count($_GET) > 0)
1532 1532
 			{
1533
-				foreach($_GET as $key => $val)
1533
+				foreach ($_GET as $key => $val)
1534 1534
 				{
1535
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1535
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1536 1536
 				}
1537
-				$url .= '?' . join('&', $vars);
1537
+				$url .= '?'.join('&', $vars);
1538 1538
 			}
1539 1539
 		}
1540 1540
 		return $url;
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
 		$self = self::getInstance();
1550 1550
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1551 1551
 
1552
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1552
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1553 1553
 		{
1554 1554
 			unset($js_callback_func);
1555 1555
 			unset($_GET['xe_js_callback']);
@@ -1577,22 +1577,22 @@  discard block
 block discarded – undo
1577 1577
 		$self = self::getInstance();
1578 1578
 
1579 1579
 		// retrieve virtual site information
1580
-		if(is_null($site_module_info))
1580
+		if (is_null($site_module_info))
1581 1581
 		{
1582 1582
 			$site_module_info = self::get('site_module_info');
1583 1583
 		}
1584 1584
 
1585 1585
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1586
-		if($domain && isSiteID($domain))
1586
+		if ($domain && isSiteID($domain))
1587 1587
 		{
1588 1588
 			$vid = $domain;
1589 1589
 			$domain = '';
1590 1590
 		}
1591 1591
 
1592 1592
 		// If $domain, $vid are not set, use current site information
1593
-		if(!$domain && !$vid)
1593
+		if (!$domain && !$vid)
1594 1594
 		{
1595
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1595
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1596 1596
 			{
1597 1597
 				$vid = $site_module_info->domain;
1598 1598
 			}
@@ -1603,21 +1603,21 @@  discard block
 block discarded – undo
1603 1603
 		}
1604 1604
 
1605 1605
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1606
-		if($domain)
1606
+		if ($domain)
1607 1607
 		{
1608 1608
 			$domain_info = parse_url($domain);
1609
-			if(is_null($current_info))
1609
+			if (is_null($current_info))
1610 1610
 			{
1611
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1611
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1612 1612
 			}
1613
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1613
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1614 1614
 			{
1615 1615
 				unset($domain);
1616 1616
 			}
1617 1617
 			else
1618 1618
 			{
1619 1619
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1620
-				if(substr_compare($domain, '/', -1) !== 0)
1620
+				if (substr_compare($domain, '/', -1) !== 0)
1621 1621
 				{
1622 1622
 					$domain .= '/';
1623 1623
 				}
@@ -1627,10 +1627,10 @@  discard block
 block discarded – undo
1627 1627
 		$get_vars = array();
1628 1628
 
1629 1629
 		// If there is no GET variables or first argument is '' to reset variables
1630
-		if(!$self->get_vars || $args_list[0] == '')
1630
+		if (!$self->get_vars || $args_list[0] == '')
1631 1631
 		{
1632 1632
 			// rearrange args_list
1633
-			if(is_array($args_list) && $args_list[0] == '')
1633
+			if (is_array($args_list) && $args_list[0] == '')
1634 1634
 			{
1635 1635
 				array_shift($args_list);
1636 1636
 			}
@@ -1642,13 +1642,13 @@  discard block
 block discarded – undo
1642 1642
 		}
1643 1643
 
1644 1644
 		// arrange args_list
1645
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1645
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1646 1646
 		{
1647 1647
 			$key = $args_list[$i];
1648 1648
 			$val = trim($args_list[$i + 1]);
1649 1649
 
1650 1650
 			// If value is not set, remove the key
1651
-			if(!isset($val) || !strlen($val))
1651
+			if (!isset($val) || !strlen($val))
1652 1652
 			{
1653 1653
 				unset($get_vars[$key]);
1654 1654
 				continue;
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
 		// remove vid, rnd
1661 1661
 		unset($get_vars['rnd']);
1662
-		if($vid)
1662
+		if ($vid)
1663 1663
 		{
1664 1664
 			$get_vars['vid'] = $vid;
1665 1665
 		}
@@ -1676,17 +1676,17 @@  discard block
 block discarded – undo
1676 1676
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1677 1677
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1678 1678
 		);
1679
-		if($act_alias[$act])
1679
+		if ($act_alias[$act])
1680 1680
 		{
1681 1681
 			$get_vars['act'] = $act_alias[$act];
1682 1682
 		}
1683 1683
 
1684 1684
 		// organize URL
1685 1685
 		$query = '';
1686
-		if(count($get_vars) > 0)
1686
+		if (count($get_vars) > 0)
1687 1687
 		{
1688 1688
 			// if using rewrite mod
1689
-			if($self->allow_rewrite)
1689
+			if ($self->allow_rewrite)
1690 1690
 			{
1691 1691
 				$var_keys = array_keys($get_vars);
1692 1692
 				sort($var_keys);
@@ -1706,8 +1706,8 @@  discard block
 block discarded – undo
1706 1706
 					'vid' => $vid,
1707 1707
 					'mid' => $mid,
1708 1708
 					'mid.vid' => "$vid/$mid",
1709
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1710
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1709
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1710
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1711 1711
 					'document_srl' => $srl,
1712 1712
 					'document_srl.mid' => "$mid/$srl",
1713 1713
 					'document_srl.vid' => "$vid/$srl",
@@ -1724,66 +1724,66 @@  discard block
 block discarded – undo
1724 1724
 				$query = $target_map[$target];
1725 1725
 			}
1726 1726
 
1727
-			if(!$query)
1727
+			if (!$query)
1728 1728
 			{
1729 1729
 				$queries = array();
1730
-				foreach($get_vars as $key => $val)
1730
+				foreach ($get_vars as $key => $val)
1731 1731
 				{
1732
-					if(is_array($val) && count($val) > 0)
1732
+					if (is_array($val) && count($val) > 0)
1733 1733
 					{
1734
-						foreach($val as $k => $v)
1734
+						foreach ($val as $k => $v)
1735 1735
 						{
1736
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1736
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1737 1737
 						}
1738 1738
 					}
1739
-					elseif(!is_array($val))
1739
+					elseif (!is_array($val))
1740 1740
 					{
1741
-						$queries[] = $key . '=' . urlencode($val);
1741
+						$queries[] = $key.'='.urlencode($val);
1742 1742
 					}
1743 1743
 				}
1744
-				if(count($queries) > 0)
1744
+				if (count($queries) > 0)
1745 1745
 				{
1746
-					$query = 'index.php?' . join('&', $queries);
1746
+					$query = 'index.php?'.join('&', $queries);
1747 1747
 				}
1748 1748
 			}
1749 1749
 		}
1750 1750
 
1751 1751
 		// If using SSL always
1752 1752
 		$_use_ssl = $self->get('_use_ssl');
1753
-		if($_use_ssl == 'always')
1753
+		if ($_use_ssl == 'always')
1754 1754
 		{
1755
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1755
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1756 1756
 			// optional SSL use
1757 1757
 		}
1758
-		elseif($_use_ssl == 'optional')
1758
+		elseif ($_use_ssl == 'optional')
1759 1759
 		{
1760 1760
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1761
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1761
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1762 1762
 			// no SSL
1763 1763
 		}
1764 1764
 		else
1765 1765
 		{
1766 1766
 			// currently on SSL but target is not based on SSL
1767
-			if($_SERVER['HTTPS'] == 'on')
1767
+			if ($_SERVER['HTTPS'] == 'on')
1768 1768
 			{
1769
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1769
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1770 1770
 			}
1771
-			else if($domain) // if $domain is set
1771
+			else if ($domain) // if $domain is set
1772 1772
 			{
1773
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1773
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1774 1774
 			}
1775 1775
 			else
1776 1776
 			{
1777
-				$query = getScriptPath() . $query;
1777
+				$query = getScriptPath().$query;
1778 1778
 			}
1779 1779
 		}
1780 1780
 
1781
-		if(!$encode)
1781
+		if (!$encode)
1782 1782
 		{
1783 1783
 			return $query;
1784 1784
 		}
1785 1785
 
1786
-		if(!$autoEncode)
1786
+		if (!$autoEncode)
1787 1787
 		{
1788 1788
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1789 1789
 		}
@@ -1792,16 +1792,16 @@  discard block
 block discarded – undo
1792 1792
 		$encode_queries = array();
1793 1793
 		$parsedUrl = parse_url($query);
1794 1794
 		parse_str($parsedUrl['query'], $output);
1795
-		foreach($output as $key => $value)
1795
+		foreach ($output as $key => $value)
1796 1796
 		{
1797
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1797
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1798 1798
 			{
1799 1799
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1800 1800
 			}
1801
-			$encode_queries[] = $key . '=' . $value;
1801
+			$encode_queries[] = $key.'='.$value;
1802 1802
 		}
1803 1803
 
1804
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1804
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1805 1805
 	}
1806 1806
 
1807 1807
 	/**
@@ -1816,17 +1816,17 @@  discard block
 block discarded – undo
1816 1816
 		static $url = array();
1817 1817
 
1818 1818
 		// Check HTTP Request
1819
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1819
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1820 1820
 		{
1821 1821
 			return;
1822 1822
 		}
1823 1823
 
1824
-		if(self::get('_use_ssl') == 'always')
1824
+		if (self::get('_use_ssl') == 'always')
1825 1825
 		{
1826 1826
 			$ssl_mode = ENFORCE_SSL;
1827 1827
 		}
1828 1828
 
1829
-		if($domain)
1829
+		if ($domain)
1830 1830
 		{
1831 1831
 			$domain_key = md5($domain);
1832 1832
 		}
@@ -1835,14 +1835,14 @@  discard block
 block discarded – undo
1835 1835
 			$domain_key = 'default';
1836 1836
 		}
1837 1837
 
1838
-		if(isset($url[$ssl_mode][$domain_key]))
1838
+		if (isset($url[$ssl_mode][$domain_key]))
1839 1839
 		{
1840 1840
 			return $url[$ssl_mode][$domain_key];
1841 1841
 		}
1842 1842
 
1843 1843
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1844 1844
 
1845
-		switch($ssl_mode)
1845
+		switch ($ssl_mode)
1846 1846
 		{
1847 1847
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1848 1848
 				break;
@@ -1852,34 +1852,34 @@  discard block
 block discarded – undo
1852 1852
 				break;
1853 1853
 		}
1854 1854
 
1855
-		if($domain)
1855
+		if ($domain)
1856 1856
 		{
1857 1857
 			$target_url = trim($domain);
1858
-			if(substr_compare($target_url, '/', -1) !== 0)
1858
+			if (substr_compare($target_url, '/', -1) !== 0)
1859 1859
 			{
1860
-				$target_url.= '/';
1860
+				$target_url .= '/';
1861 1861
 			}
1862 1862
 		}
1863 1863
 		else
1864 1864
 		{
1865
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1865
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1866 1866
 		}
1867 1867
 
1868
-		$url_info = parse_url('http://' . $target_url);
1868
+		$url_info = parse_url('http://'.$target_url);
1869 1869
 
1870
-		if($current_use_ssl != $use_ssl)
1870
+		if ($current_use_ssl != $use_ssl)
1871 1871
 		{
1872 1872
 			unset($url_info['port']);
1873 1873
 		}
1874 1874
 
1875
-		if($use_ssl)
1875
+		if ($use_ssl)
1876 1876
 		{
1877 1877
 			$port = self::get('_https_port');
1878
-			if($port && $port != 443)
1878
+			if ($port && $port != 443)
1879 1879
 			{
1880 1880
 				$url_info['port'] = $port;
1881 1881
 			}
1882
-			elseif($url_info['port'] == 443)
1882
+			elseif ($url_info['port'] == 443)
1883 1883
 			{
1884 1884
 				unset($url_info['port']);
1885 1885
 			}
@@ -1887,17 +1887,17 @@  discard block
 block discarded – undo
1887 1887
 		else
1888 1888
 		{
1889 1889
 			$port = self::get('_http_port');
1890
-			if($port && $port != 80)
1890
+			if ($port && $port != 80)
1891 1891
 			{
1892 1892
 				$url_info['port'] = $port;
1893 1893
 			}
1894
-			elseif($url_info['port'] == 80)
1894
+			elseif ($url_info['port'] == 80)
1895 1895
 			{
1896 1896
 				unset($url_info['port']);
1897 1897
 			}
1898 1898
 		}
1899 1899
 
1900
-		$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']);
1900
+		$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']);
1901 1901
 
1902 1902
 		return $url[$ssl_mode][$domain_key];
1903 1903
 	}
@@ -1914,16 +1914,16 @@  discard block
 block discarded – undo
1914 1914
 	{
1915 1915
 		$self = self::getInstance();
1916 1916
 		$self->context->{$key} = $val;
1917
-		if($set_to_get_vars === FALSE)
1917
+		if ($set_to_get_vars === FALSE)
1918 1918
 		{
1919 1919
 			return;
1920 1920
 		}
1921
-		if($val === NULL || $val === '')
1921
+		if ($val === NULL || $val === '')
1922 1922
 		{
1923 1923
 			unset($self->get_vars->{$key});
1924 1924
 			return;
1925 1925
 		}
1926
-		if($set_to_get_vars || $self->get_vars->{$key})
1926
+		if ($set_to_get_vars || $self->get_vars->{$key})
1927 1927
 		{
1928 1928
 			$self->get_vars->{$key} = $val;
1929 1929
 		}
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
 	{
1940 1940
 		$self = self::getInstance();
1941 1941
 
1942
-		if(!isset($self->context->{$key}))
1942
+		if (!isset($self->context->{$key}))
1943 1943
 		{
1944 1944
 			return null;
1945 1945
 		}
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 	function gets()
1955 1955
 	{
1956 1956
 		$num_args = func_num_args();
1957
-		if($num_args < 1)
1957
+		if ($num_args < 1)
1958 1958
 		{
1959 1959
 			return;
1960 1960
 		}
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
 
1963 1963
 		$args_list = func_get_args();
1964 1964
 		$output = new stdClass();
1965
-		foreach($args_list as $v)
1965
+		foreach ($args_list as $v)
1966 1966
 		{
1967 1967
 			$output->{$v} = $self->get($v);
1968 1968
 		}
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 	function getRequestVars()
1989 1989
 	{
1990 1990
 		$self = self::getInstance();
1991
-		if($self->get_vars)
1991
+		if ($self->get_vars)
1992 1992
 		{
1993 1993
 			return clone($self->get_vars);
1994 1994
 		}
@@ -2005,13 +2005,13 @@  discard block
 block discarded – undo
2005 2005
 	{
2006 2006
 		$self = self::getInstance();
2007 2007
 
2008
-		if(!is_readable($self->sslActionCacheFile))
2008
+		if (!is_readable($self->sslActionCacheFile))
2009 2009
 		{
2010 2010
 			$buff = '<?php if(!defined("__XE__"))exit;';
2011 2011
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2012 2012
 		}
2013 2013
 
2014
-		if(!isset($self->ssl_actions[$action]))
2014
+		if (!isset($self->ssl_actions[$action]))
2015 2015
 		{
2016 2016
 			$self->ssl_actions[$action] = 1;
2017 2017
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2029,16 +2029,16 @@  discard block
 block discarded – undo
2029 2029
 	{
2030 2030
 		$self = self::getInstance();
2031 2031
 
2032
-		if(!is_readable($self->sslActionCacheFile))
2032
+		if (!is_readable($self->sslActionCacheFile))
2033 2033
 		{
2034 2034
 			unset($self->ssl_actions);
2035 2035
 			$buff = '<?php if(!defined("__XE__"))exit;';
2036 2036
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2037 2037
 		}
2038 2038
 
2039
-		foreach($action_array as $action)
2039
+		foreach ($action_array as $action)
2040 2040
 		{
2041
-			if(!isset($self->ssl_actions[$action]))
2041
+			if (!isset($self->ssl_actions[$action]))
2042 2042
 			{
2043 2043
 				$self->ssl_actions[$action] = 1;
2044 2044
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2057,7 +2057,7 @@  discard block
 block discarded – undo
2057 2057
 	{
2058 2058
 		$self = self::getInstance();
2059 2059
 
2060
-		if($self->isExistsSSLAction($action))
2060
+		if ($self->isExistsSSLAction($action))
2061 2061
 		{
2062 2062
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2063 2063
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 	function getSSLActions()
2075 2075
 	{
2076 2076
 		$self = self::getInstance();
2077
-		if($self->getSslStatus() == 'optional')
2077
+		if ($self->getSslStatus() == 'optional')
2078 2078
 		{
2079 2079
 			return $self->ssl_actions;
2080 2080
 		}
@@ -2101,12 +2101,12 @@  discard block
 block discarded – undo
2101 2101
 	 */
2102 2102
 	function normalizeFilePath($file)
2103 2103
 	{
2104
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2104
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2105 2105
 		{
2106
-			$file = './' . $file;
2106
+			$file = './'.$file;
2107 2107
 		}
2108 2108
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2109
-		while(strpos($file, '/../') !== FALSE)
2109
+		while (strpos($file, '/../') !== FALSE)
2110 2110
 		{
2111 2111
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2112 2112
 		}
@@ -2125,13 +2125,13 @@  discard block
 block discarded – undo
2125 2125
 	{
2126 2126
 		$file = self::normalizeFilePath($file);
2127 2127
 		$script_path = getScriptPath();
2128
-		if(strpos($file, './') === 0)
2128
+		if (strpos($file, './') === 0)
2129 2129
 		{
2130
-			$file = $script_path . substr($file, 2);
2130
+			$file = $script_path.substr($file, 2);
2131 2131
 		}
2132
-		elseif(strpos($file, '../') === 0)
2132
+		elseif (strpos($file, '../') === 0)
2133 2133
 		{
2134
-			$file = self::normalizeFilePath($script_path . $file);
2134
+			$file = self::normalizeFilePath($script_path.$file);
2135 2135
 		}
2136 2136
 
2137 2137
 		return $file;
@@ -2201,12 +2201,12 @@  discard block
 block discarded – undo
2201 2201
 	 */
2202 2202
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2203 2203
 	{
2204
-		if($isRuleset)
2204
+		if ($isRuleset)
2205 2205
 		{
2206
-			if(strpos($file, '#') !== FALSE)
2206
+			if (strpos($file, '#') !== FALSE)
2207 2207
 			{
2208 2208
 				$file = str_replace('#', '', $file);
2209
-				if(!is_readable($file))
2209
+				if (!is_readable($file))
2210 2210
 				{
2211 2211
 					$file = $autoPath;
2212 2212
 				}
@@ -2271,9 +2271,9 @@  discard block
 block discarded – undo
2271 2271
 		ksort($files);
2272 2272
 		$files = array_values($files);
2273 2273
 		$filenames = array();
2274
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2274
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2275 2275
 		{
2276
-			if(in_array($files[$i]['file'], $filenames))
2276
+			if (in_array($files[$i]['file'], $filenames))
2277 2277
 			{
2278 2278
 				unset($files[$i]);
2279 2279
 			}
@@ -2358,14 +2358,14 @@  discard block
 block discarded – undo
2358 2358
 	 */
2359 2359
 	function getJavascriptPluginInfo($pluginName)
2360 2360
 	{
2361
-		if($plugin_name == 'ui.datepicker')
2361
+		if ($plugin_name == 'ui.datepicker')
2362 2362
 		{
2363 2363
 			$plugin_name = 'ui';
2364 2364
 		}
2365 2365
 
2366
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2367
-		$info_file = $plugin_path . 'plugin.load';
2368
-		if(!is_readable($info_file))
2366
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2367
+		$info_file = $plugin_path.'plugin.load';
2368
+		if (!is_readable($info_file))
2369 2369
 		{
2370 2370
 			return;
2371 2371
 		}
@@ -2375,32 +2375,32 @@  discard block
 block discarded – undo
2375 2375
 		$result->jsList = array();
2376 2376
 		$result->cssList = array();
2377 2377
 
2378
-		foreach($list as $filename)
2378
+		foreach ($list as $filename)
2379 2379
 		{
2380 2380
 			$filename = trim($filename);
2381
-			if(!$filename)
2381
+			if (!$filename)
2382 2382
 			{
2383 2383
 				continue;
2384 2384
 			}
2385 2385
 
2386
-			if(strncasecmp('./', $filename, 2) === 0)
2386
+			if (strncasecmp('./', $filename, 2) === 0)
2387 2387
 			{
2388 2388
 				$filename = substr($filename, 2);
2389 2389
 			}
2390 2390
 
2391
-			if(substr_compare($filename, '.js', -3) === 0)
2391
+			if (substr_compare($filename, '.js', -3) === 0)
2392 2392
 			{
2393
-				$result->jsList[] = $plugin_path . $filename;
2393
+				$result->jsList[] = $plugin_path.$filename;
2394 2394
 			}
2395
-			elseif(substr_compare($filename, '.css', -4) === 0)
2395
+			elseif (substr_compare($filename, '.css', -4) === 0)
2396 2396
 			{
2397
-				$result->cssList[] = $plugin_path . $filename;
2397
+				$result->cssList[] = $plugin_path.$filename;
2398 2398
 			}
2399 2399
 		}
2400 2400
 
2401
-		if(is_dir($plugin_path . 'lang'))
2401
+		if (is_dir($plugin_path.'lang'))
2402 2402
 		{
2403
-			$result->langPath = $plugin_path . 'lang';
2403
+			$result->langPath = $plugin_path.'lang';
2404 2404
 		}
2405 2405
 
2406 2406
 		return $result;
@@ -2416,50 +2416,50 @@  discard block
 block discarded – undo
2416 2416
 		static $loaded_plugins = array();
2417 2417
 
2418 2418
 		$self = self::getInstance();
2419
-		if($plugin_name == 'ui.datepicker')
2419
+		if ($plugin_name == 'ui.datepicker')
2420 2420
 		{
2421 2421
 			$plugin_name = 'ui';
2422 2422
 		}
2423 2423
 
2424
-		if($loaded_plugins[$plugin_name])
2424
+		if ($loaded_plugins[$plugin_name])
2425 2425
 		{
2426 2426
 			return;
2427 2427
 		}
2428 2428
 		$loaded_plugins[$plugin_name] = TRUE;
2429 2429
 
2430
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2431
-		$info_file = $plugin_path . 'plugin.load';
2432
-		if(!is_readable($info_file))
2430
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2431
+		$info_file = $plugin_path.'plugin.load';
2432
+		if (!is_readable($info_file))
2433 2433
 		{
2434 2434
 			return;
2435 2435
 		}
2436 2436
 
2437 2437
 		$list = file($info_file);
2438
-		foreach($list as $filename)
2438
+		foreach ($list as $filename)
2439 2439
 		{
2440 2440
 			$filename = trim($filename);
2441
-			if(!$filename)
2441
+			if (!$filename)
2442 2442
 			{
2443 2443
 				continue;
2444 2444
 			}
2445 2445
 
2446
-			if(strncasecmp('./', $filename, 2) === 0)
2446
+			if (strncasecmp('./', $filename, 2) === 0)
2447 2447
 			{
2448 2448
 				$filename = substr($filename, 2);
2449 2449
 			}
2450
-			if(substr_compare($filename, '.js', -3) === 0)
2450
+			if (substr_compare($filename, '.js', -3) === 0)
2451 2451
 			{
2452
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2452
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2453 2453
 			}
2454
-			if(substr_compare($filename, '.css', -4) === 0)
2454
+			if (substr_compare($filename, '.css', -4) === 0)
2455 2455
 			{
2456
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2456
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2457 2457
 			}
2458 2458
 		}
2459 2459
 
2460
-		if(is_dir($plugin_path . 'lang'))
2460
+		if (is_dir($plugin_path.'lang'))
2461 2461
 		{
2462
-			$self->loadLang($plugin_path . 'lang');
2462
+			$self->loadLang($plugin_path.'lang');
2463 2463
 		}
2464 2464
 	}
2465 2465
 
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 	function addHtmlHeader($header)
2473 2473
 	{
2474 2474
 		$self = self::getInstance();
2475
-		$self->html_header .= "\n" . $header;
2475
+		$self->html_header .= "\n".$header;
2476 2476
 	}
2477 2477
 
2478 2478
 	function clearHtmlHeader()
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
 	function addBodyHeader($header)
2525 2525
 	{
2526 2526
 		$self = self::getInstance();
2527
-		$self->body_header .= "\n" . $header;
2527
+		$self->body_header .= "\n".$header;
2528 2528
 	}
2529 2529
 
2530 2530
 	/**
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
 	function addHtmlFooter($footer)
2547 2547
 	{
2548 2548
 		$self = self::getInstance();
2549
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2549
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2550 2550
 	}
2551 2551
 
2552 2552
 	/**
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 	 */
2568 2568
 	function getConfigFile()
2569 2569
 	{
2570
-		return _XE_PATH_ . 'files/config/db.config.php';
2570
+		return _XE_PATH_.'files/config/db.config.php';
2571 2571
 	}
2572 2572
 
2573 2573
 	/**
@@ -2577,7 +2577,7 @@  discard block
 block discarded – undo
2577 2577
 	 */
2578 2578
 	function getFTPConfigFile()
2579 2579
 	{
2580
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2580
+		return _XE_PATH_.'files/config/ftp.config.php';
2581 2581
 	}
2582 2582
 
2583 2583
 	/**
@@ -2629,14 +2629,14 @@  discard block
 block discarded – undo
2629 2629
 		$_path = explode('/', $path);
2630 2630
 		$_base = explode('/', $base_url);
2631 2631
 
2632
-		if(!$_base[count($_base) - 1])
2632
+		if (!$_base[count($_base) - 1])
2633 2633
 		{
2634 2634
 			array_pop($_base);
2635 2635
 		}
2636 2636
 
2637
-		foreach($_xe as $idx => $dir)
2637
+		foreach ($_xe as $idx => $dir)
2638 2638
 		{
2639
-			if($_path[0] != $dir)
2639
+			if ($_path[0] != $dir)
2640 2640
 			{
2641 2641
 				break;
2642 2642
 			}
@@ -2644,9 +2644,9 @@  discard block
 block discarded – undo
2644 2644
 		}
2645 2645
 
2646 2646
 		$idx = count($_xe) - $idx - 1;
2647
-		while($idx--)
2647
+		while ($idx--)
2648 2648
 		{
2649
-			if(count($_base) > 0)
2649
+			if (count($_base) > 0)
2650 2650
 			{
2651 2651
 				array_shift($_base);
2652 2652
 			}
@@ -2656,13 +2656,13 @@  discard block
 block discarded – undo
2656 2656
 			}
2657 2657
 		}
2658 2658
 
2659
-		if(count($_base) > 0)
2659
+		if (count($_base) > 0)
2660 2660
 		{
2661 2661
 			array_unshift($_path, join('/', $_base));
2662 2662
 		}
2663 2663
 
2664
-		$path = '/' . join('/', $_path);
2665
-		if(substr_compare($path, '/', -1) !== 0)
2664
+		$path = '/'.join('/', $_path);
2665
+		if (substr_compare($path, '/', -1) !== 0)
2666 2666
 		{
2667 2667
 			$path .= '/';
2668 2668
 		}
@@ -2677,13 +2677,13 @@  discard block
 block discarded – undo
2677 2677
 	{
2678 2678
 		$self = self::getInstance();
2679 2679
 
2680
-		if(!is_array($self->meta_tags))
2680
+		if (!is_array($self->meta_tags))
2681 2681
 		{
2682 2682
 			$self->meta_tags = array();
2683 2683
 		}
2684 2684
 
2685 2685
 		$ret = array();
2686
-		foreach($self->meta_tags as $key => $val)
2686
+		foreach ($self->meta_tags as $key => $val)
2687 2687
 		{
2688 2688
 			list($name, $is_http_equiv) = explode("\t", $key);
2689 2689
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2704 2704
 	{
2705 2705
 		$self = self::getInstance();
2706
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2706
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2707 2707
 	}
2708 2708
 
2709 2709
 }
Please login to merge, or discard this patch.
Braces   +90 added lines, -103 removed lines patch added patch discarded remove patch
@@ -230,7 +230,9 @@  discard block
 block discarded – undo
230 230
 		$this->loadDBInfo();
231 231
 		if($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if(is_array($this->db_info->sitelock_whitelist)) {
234
+				$whitelist = $this->db_info->sitelock_whitelist;
235
+			}
234 236
 
235 237
 			if(!IpFilter::filter($whitelist))
236 238
 			{
@@ -245,8 +247,7 @@  discard block
 block discarded – undo
245 247
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
246 248
 				{
247 249
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
248
-				}
249
-				else
250
+				} else
250 251
 				{
251 252
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
252 253
 				}
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 			{
304 305
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 306
 			}
306
-		}
307
-		elseif($_COOKIE['lang_type'])
307
+		} elseif($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
@@ -341,7 +341,9 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if($sess = $_POST[session_name()]) {
345
+			session_id($sess);
346
+		}
345 347
 		session_start();
346 348
 
347 349
 		// set authentication information in Context and session
@@ -394,22 +396,21 @@  discard block
 block discarded – undo
394 396
 						{
395 397
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396 398
 						}
397
-					}
398
-					elseif($val)
399
+					} elseif($val)
399 400
 					{
400 401
 						$url[] = $key . '=' . urlencode($val);
401 402
 					}
402 403
 				}
403 404
 
404 405
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
406
-			}
407
-			else
406
+				if($url) {
407
+					$current_url .= '?' . join('&', $url);
408
+				}
409
+			} else
408 410
 			{
409 411
 				$current_url = $this->getUrl();
410 412
 			}
411
-		}
412
-		else
413
+		} else
413 414
 		{
414 415
 			$current_url = self::getRequestUri();
415 416
 		}
@@ -490,18 +491,22 @@  discard block
 block discarded – undo
490 491
 			$db_info->use_prepared_statements = 'Y';
491 492
 		}
492 493
 
493
-		if(!$db_info->time_zone)
494
-			$db_info->time_zone = date('O');
494
+		if(!$db_info->time_zone) {
495
+					$db_info->time_zone = date('O');
496
+		}
495 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 498
 
497
-		if($db_info->qmail_compatibility != 'Y')
498
-			$db_info->qmail_compatibility = 'N';
499
+		if($db_info->qmail_compatibility != 'Y') {
500
+					$db_info->qmail_compatibility = 'N';
501
+		}
499 502
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 503
 
501
-		if(!$db_info->use_db_session)
502
-			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
504
-			$db_info->use_ssl = 'none';
504
+		if(!$db_info->use_db_session) {
505
+					$db_info->use_db_session = 'N';
506
+		}
507
+		if(!$db_info->use_ssl) {
508
+					$db_info->use_ssl = 'none';
509
+		}
505 510
 		$this->set('_use_ssl', $db_info->use_ssl);
506 511
 
507 512
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -618,8 +623,7 @@  discard block
 block discarded – undo
618 623
 				$buff = FileHandler::readFile($orig_lang_file);
619 624
 				FileHandler::writeFile($selected_lang_file, $buff);
620 625
 				$lang_selected = self::loadLangSupported();
621
-			}
622
-			else
626
+			} else
623 627
 			{
624 628
 				$langs = file($selected_lang_file);
625 629
 				foreach($langs as $val)
@@ -678,15 +682,16 @@  discard block
 block discarded – undo
678 682
 
679 683
 				$oModuleModel = getModel('module');
680 684
 				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
685
+				if(substr_compare($domain, '/', -1) === 0) {
686
+					$domain = substr($domain, 0, -1);
687
+				}
682 688
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 689
 
684 690
 				if($site_info->site_srl)
685 691
 				{
686 692
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687 693
 				$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']);
688
-				}
689
-				else
694
+				} else
690 695
 				{
691 696
 					$redirect_url = $url;
692 697
 				}
@@ -695,8 +700,7 @@  discard block
 block discarded – undo
695 700
 				return FALSE;
696 701
 			}
697 702
 			// for sites requesting SSO validation
698
-		}
699
-		else
703
+		} else
700 704
 		{
701 705
 			// result handling : set session_name()
702 706
 			if($session_name = self::get('SSOID'))
@@ -713,8 +717,7 @@  discard block
 block discarded – undo
713 717
 				header('location:' . $url);
714 718
 				return FALSE;
715 719
 				// send SSO request
716
-			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 721
 			{
719 722
 				setcookie('sso', md5(self::getRequestUri()));
720 723
 				$origin_url = self::getRequestUrl();
@@ -774,8 +777,7 @@  discard block
 block discarded – undo
774 777
 		if($self->site_title)
775 778
 		{
776 779
 			$self->site_title .= ' - ' . $site_title;
777
-		}
778
-		else
780
+		} else
779 781
 		{
780 782
 			$self->site_title = $site_title;
781 783
 		}
@@ -875,8 +877,7 @@  discard block
 block discarded – undo
875 877
 		{
876 878
 			$self->loaded_lang_files[] = $filename;
877 879
 			include($filename);
878
-		}
879
-		else
880
+		} else
880 881
 		{
881 882
 			$self->_evalxmlLang($path);
882 883
 		}
@@ -892,7 +893,9 @@  discard block
 block discarded – undo
892 893
 	{
893 894
 		global $lang;
894 895
 
895
-		if(!$path) return;
896
+		if(!$path) {
897
+			return;
898
+		}
896 899
 
897 900
 		$_path = 'eval://' . $path;
898 901
 
@@ -924,7 +927,9 @@  discard block
 block discarded – undo
924 927
 	 */
925 928
 	function _loadXmlLang($path)
926 929
 	{
927
-		if(!$path) return;
930
+		if(!$path) {
931
+			return;
932
+		}
928 933
 
929 934
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
930 935
 		return $oXmlLangParser->compile();
@@ -938,7 +943,9 @@  discard block
 block discarded – undo
938 943
 	 */
939 944
 	function _loadPhpLang($path)
940 945
 	{
941
-		if(!$path) return;
946
+		if(!$path) {
947
+			return;
948
+		}
942 949
 
943 950
 		if(substr_compare($path, '/', -1) !== 0)
944 951
 		{
@@ -1074,12 +1081,14 @@  discard block
 block discarded – undo
1074 1081
 		static $flag = TRUE;
1075 1082
 		if($charset)
1076 1083
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1080
-			else $flag = FALSE;
1081
-		}
1082
-		else
1084
+			if(is_array($val)) {
1085
+							array_walk($val,'Context::checkConvertFlag',$charset);
1086
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1087
+				$flag = FALSE;
1088
+			} else {
1089
+				$flag = FALSE;
1090
+			}
1091
+		} else
1083 1092
 		{
1084 1093
 			$return = $flag;
1085 1094
 			$flag = TRUE;
@@ -1101,8 +1110,9 @@  discard block
 block discarded – undo
1101 1110
 		if (is_array($val))
1102 1111
 		{
1103 1112
 			array_walk($val,'Context::doConvertEncoding',$charset);
1113
+		} else {
1114
+			$val = iconv($charset,'UTF-8',$val);
1104 1115
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1106 1116
 	}
1107 1117
 
1108 1118
 	/**
@@ -1113,7 +1123,9 @@  discard block
 block discarded – undo
1113 1123
 	 */
1114 1124
 	function convertEncodingStr($str)
1115 1125
 	{
1116
-        if(!$str) return null;
1126
+        if(!$str) {
1127
+        	return null;
1128
+        }
1117 1129
 		$obj = new stdClass();
1118 1130
 		$obj->str = $str;
1119 1131
 		$obj = self::convertEncoding($obj);
@@ -1226,16 +1238,13 @@  discard block
 block discarded – undo
1226 1238
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1227 1239
 			{
1228 1240
 				$set_to_vars = TRUE;
1229
-			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1241
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1231 1242
 			{
1232 1243
 				$set_to_vars = TRUE;
1233
-			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1245
 			{
1236 1246
 				$set_to_vars = TRUE;
1237
-			}
1238
-			else
1247
+			} else
1239 1248
 			{
1240 1249
 				$set_to_vars = FALSE;
1241 1250
 			}
@@ -1261,8 +1270,7 @@  discard block
 block discarded – undo
1261 1270
 					return;
1262 1271
 				}
1263 1272
 			}
1264
-		}
1265
-		else if(is_array($val))
1273
+		} else if(is_array($val))
1266 1274
 		{
1267 1275
 			foreach($val as $val2)
1268 1276
 			{
@@ -1402,24 +1410,19 @@  discard block
 block discarded – undo
1402 1410
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1411
 			{
1404 1412
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405
-			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1413
+			} elseif($key === 'mid' || $key === 'search_keyword')
1407 1414
 			{
1408 1415
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409
-			}
1410
-			elseif($key === 'vid')
1416
+			} elseif($key === 'vid')
1411 1417
 			{
1412 1418
 				$result[$k] = urlencode($v);
1413
-			}
1414
-			elseif($key === 'xe_validator_id')
1419
+			} elseif($key === 'xe_validator_id')
1415 1420
 			{
1416 1421
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417
-			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1422
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1423
 			{
1420 1424
 				unset($result[$k]);
1421
-			}
1422
-			else
1425
+			} else
1423 1426
 			{
1424 1427
 				$result[$k] = $v;
1425 1428
 
@@ -1428,8 +1431,7 @@  discard block
 block discarded – undo
1428 1431
 					if (is_array($result[$k]))
1429 1432
 					{
1430 1433
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1431
-					}
1432
-					else
1434
+					} else
1433 1435
 					{
1434 1436
 						$result[$k] = stripslashes($result[$k]);
1435 1437
 					}
@@ -1438,8 +1440,7 @@  discard block
 block discarded – undo
1438 1440
 				if(is_array($result[$k]))
1439 1441
 				{
1440 1442
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441
-				}
1442
-				else
1443
+				} else
1443 1444
 				{
1444 1445
 					$result[$k] = trim($result[$k]);
1445 1446
 				}
@@ -1484,8 +1485,7 @@  discard block
 block discarded – undo
1484 1485
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1485 1486
 				$this->set($key, $val, TRUE);
1486 1487
 				$this->is_uploaded = TRUE;
1487
-			}
1488
-			else
1488
+			} else
1489 1489
 			{
1490 1490
 				$files = array();
1491 1491
 				$count_files = count($tmp_name);
@@ -1503,7 +1503,9 @@  discard block
 block discarded – undo
1503 1503
 						$files[] = $file;
1504 1504
 					}
1505 1505
 				}
1506
-				if($files) $this->set($key, $files, TRUE);
1506
+				if($files) {
1507
+					$this->set($key, $files, TRUE);
1508
+				}
1507 1509
 			}
1508 1510
 		}
1509 1511
 	}
@@ -1595,8 +1597,7 @@  discard block
 block discarded – undo
1595 1597
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1596 1598
 			{
1597 1599
 				$vid = $site_module_info->domain;
1598
-			}
1599
-			else
1600
+			} else
1600 1601
 			{
1601 1602
 				$domain = $site_module_info->domain;
1602 1603
 			}
@@ -1613,8 +1614,7 @@  discard block
 block discarded – undo
1613 1614
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1614 1615
 			{
1615 1616
 				unset($domain);
1616
-			}
1617
-			else
1617
+			} else
1618 1618
 			{
1619 1619
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1620 1620
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1634,8 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 			{
1635 1635
 				array_shift($args_list);
1636 1636
 			}
1637
-		}
1638
-		else
1637
+		} else
1639 1638
 		{
1640 1639
 			// Otherwise, make GET variables into array
1641 1640
 			$get_vars = get_object_vars($self->get_vars);
@@ -1662,8 +1661,7 @@  discard block
 block discarded – undo
1662 1661
 		if($vid)
1663 1662
 		{
1664 1663
 			$get_vars['vid'] = $vid;
1665
-		}
1666
-		else
1664
+		} else
1667 1665
 		{
1668 1666
 			unset($get_vars['vid']);
1669 1667
 		}
@@ -1735,8 +1733,7 @@  discard block
 block discarded – undo
1735 1733
 						{
1736 1734
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1737 1735
 						}
1738
-					}
1739
-					elseif(!is_array($val))
1736
+					} elseif(!is_array($val))
1740 1737
 					{
1741 1738
 						$queries[] = $key . '=' . urlencode($val);
1742 1739
 					}
@@ -1754,25 +1751,23 @@  discard block
 block discarded – undo
1754 1751
 		{
1755 1752
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1756 1753
 			// optional SSL use
1757
-		}
1758
-		elseif($_use_ssl == 'optional')
1754
+		} elseif($_use_ssl == 'optional')
1759 1755
 		{
1760 1756
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1761 1757
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1762 1758
 			// no SSL
1763
-		}
1764
-		else
1759
+		} else
1765 1760
 		{
1766 1761
 			// currently on SSL but target is not based on SSL
1767 1762
 			if($_SERVER['HTTPS'] == 'on')
1768 1763
 			{
1769 1764
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1770
-			}
1771
-			else if($domain) // if $domain is set
1765
+			} else if($domain) {
1766
+				// if $domain is set
1772 1767
 			{
1773 1768
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1774 1769
 			}
1775
-			else
1770
+			} else
1776 1771
 			{
1777 1772
 				$query = getScriptPath() . $query;
1778 1773
 			}
@@ -1829,8 +1824,7 @@  discard block
 block discarded – undo
1829 1824
 		if($domain)
1830 1825
 		{
1831 1826
 			$domain_key = md5($domain);
1832
-		}
1833
-		else
1827
+		} else
1834 1828
 		{
1835 1829
 			$domain_key = 'default';
1836 1830
 		}
@@ -1859,8 +1853,7 @@  discard block
 block discarded – undo
1859 1853
 			{
1860 1854
 				$target_url.= '/';
1861 1855
 			}
1862
-		}
1863
-		else
1856
+		} else
1864 1857
 		{
1865 1858
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1866 1859
 		}
@@ -1878,20 +1871,17 @@  discard block
 block discarded – undo
1878 1871
 			if($port && $port != 443)
1879 1872
 			{
1880 1873
 				$url_info['port'] = $port;
1881
-			}
1882
-			elseif($url_info['port'] == 443)
1874
+			} elseif($url_info['port'] == 443)
1883 1875
 			{
1884 1876
 				unset($url_info['port']);
1885 1877
 			}
1886
-		}
1887
-		else
1878
+		} else
1888 1879
 		{
1889 1880
 			$port = self::get('_http_port');
1890 1881
 			if($port && $port != 80)
1891 1882
 			{
1892 1883
 				$url_info['port'] = $port;
1893
-			}
1894
-			elseif($url_info['port'] == 80)
1884
+			} elseif($url_info['port'] == 80)
1895 1885
 			{
1896 1886
 				unset($url_info['port']);
1897 1887
 			}
@@ -2128,8 +2118,7 @@  discard block
 block discarded – undo
2128 2118
 		if(strpos($file, './') === 0)
2129 2119
 		{
2130 2120
 			$file = $script_path . substr($file, 2);
2131
-		}
2132
-		elseif(strpos($file, '../') === 0)
2121
+		} elseif(strpos($file, '../') === 0)
2133 2122
 		{
2134 2123
 			$file = self::normalizeFilePath($script_path . $file);
2135 2124
 		}
@@ -2391,8 +2380,7 @@  discard block
 block discarded – undo
2391 2380
 			if(substr_compare($filename, '.js', -3) === 0)
2392 2381
 			{
2393 2382
 				$result->jsList[] = $plugin_path . $filename;
2394
-			}
2395
-			elseif(substr_compare($filename, '.css', -4) === 0)
2383
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2396 2384
 			{
2397 2385
 				$result->cssList[] = $plugin_path . $filename;
2398 2386
 			}
@@ -2649,8 +2637,7 @@  discard block
 block discarded – undo
2649 2637
 			if(count($_base) > 0)
2650 2638
 			{
2651 2639
 				array_shift($_base);
2652
-			}
2653
-			else
2640
+			} else
2654 2641
 			{
2655 2642
 				array_unshift($_base, '..');
2656 2643
 			}
Please login to merge, or discard this patch.