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