GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2307)
by
unknown
06:09
created
classes/context/Context.class.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1094,7 +1094,7 @@
 block discarded – undo
1094 1094
 	 */
1095 1095
 	function convertEncodingStr($str)
1096 1096
 	{
1097
-        if(!$str) return null;
1097
+		if(!$str) return null;
1098 1098
 		$obj = new stdClass();
1099 1099
 		$obj->str = $str;
1100 1100
 		$obj = self::convertEncoding($obj);
Please login to merge, or discard this patch.
Doc Comments   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	/**
158 158
 	 * returns static context object (Singleton). It's to use Context without declaration of an object
159 159
 	 *
160
-	 * @return object Instance
160
+	 * @return Context Instance
161 161
 	 */
162 162
 	function &getInstance()
163 163
 	{
@@ -891,6 +891,7 @@  discard block
 block discarded – undo
891 891
 	 * Evaluation of xml language file
892 892
 	 *
893 893
 	 * @param string Path of the language file
894
+	 * @param string $path
894 895
 	 * @return void
895 896
 	 */
896 897
 	function _evalxmlLang($path)
@@ -1030,7 +1031,7 @@  discard block
 block discarded – undo
1030 1031
 	/**
1031 1032
 	 * Convert strings of variables in $source_object into UTF-8
1032 1033
 	 *
1033
-	 * @param object $source_obj Conatins strings to convert
1034
+	 * @param stdClass $source_obj Conatins strings to convert
1034 1035
 	 * @return object converted object
1035 1036
 	 */
1036 1037
 	function convertEncoding($source_obj)
@@ -1065,11 +1066,11 @@  discard block
 block discarded – undo
1065 1066
 	/**
1066 1067
 	 * Check flag
1067 1068
 	 *
1068
-	 * @param mixed $val
1069
+	 * @param boolean $val
1069 1070
 	 * @param string $key
1070 1071
 	 * @param mixed $charset charset
1071 1072
 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
1072
-	 * @return void
1073
+	 * @return null|boolean
1073 1074
 	 */
1074 1075
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1075 1076
 	{
@@ -1935,7 +1936,7 @@  discard block
 block discarded – undo
1935 1936
 	 *
1936 1937
 	 * @param string $key Key
1937 1938
 	 * @param mixed $val Value
1938
-	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars.
1939
+	 * @param integer $set_to_get_vars If not FALSE, Set to get vars.
1939 1940
 	 * @return void
1940 1941
 	 */
1941 1942
 	function set($key, $val, $set_to_get_vars = 0)
@@ -1977,7 +1978,7 @@  discard block
 block discarded – undo
1977 1978
 	/**
1978 1979
 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...)
1979 1980
 	 *
1980
-	 * @return object
1981
+	 * @return null|stdClass
1981 1982
 	 */
1982 1983
 	function gets()
1983 1984
 	{
@@ -2050,7 +2051,7 @@  discard block
 block discarded – undo
2050 2051
 	/**
2051 2052
 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
2052 2053
 	 *
2053
-	 * @param string $action act name
2054
+	 * @param string[] $action_array
2054 2055
 	 * @return void
2055 2056
 	 */
2056 2057
 	function addSSLActions($action_array)
@@ -2221,7 +2222,7 @@  discard block
 block discarded – undo
2221 2222
 	 * @param string $file File name with path
2222 2223
 	 * @param string $optimized optimized (That seems to not use)
2223 2224
 	 * @param string $targetie target IE
2224
-	 * @param string $index index
2225
+	 * @param integer $index index
2225 2226
 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
2226 2227
 	 * @param bool $isRuleset Use ruleset
2227 2228
 	 * @param string $autoPath If path not readed, set the path automatically.
@@ -2331,7 +2332,7 @@  discard block
 block discarded – undo
2331 2332
 	 * @param string $optimized optimized (That seems to not use)
2332 2333
 	 * @param string $media Media query
2333 2334
 	 * @param string $targetie target IE
2334
-	 * @param string $index index
2335
+	 * @param integer $index index
2335 2336
 	 * @return void
2336 2337
 	 *
2337 2338
 	 */
Please login to merge, or discard this patch.
Braces   +115 added lines, -113 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
 		}
@@ -492,18 +493,22 @@  discard block
 block discarded – undo
492 493
 			$db_info->use_prepared_statements = 'Y';
493 494
 		}
494 495
 
495
-		if(!$db_info->time_zone)
496
-			$db_info->time_zone = date('O');
496
+		if(!$db_info->time_zone) {
497
+					$db_info->time_zone = date('O');
498
+		}
497 499
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 500
 
499
-		if($db_info->qmail_compatibility != 'Y')
500
-			$db_info->qmail_compatibility = 'N';
501
+		if($db_info->qmail_compatibility != 'Y') {
502
+					$db_info->qmail_compatibility = 'N';
503
+		}
501 504
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 505
 
503
-		if(!$db_info->use_db_session)
504
-			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
506
-			$db_info->use_ssl = 'none';
506
+		if(!$db_info->use_db_session) {
507
+					$db_info->use_db_session = 'N';
508
+		}
509
+		if(!$db_info->use_ssl) {
510
+					$db_info->use_ssl = 'none';
511
+		}
507 512
 		$this->set('_use_ssl', $db_info->use_ssl);
508 513
 
509 514
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -514,7 +519,9 @@  discard block
 block discarded – undo
514 519
 		}
515 520
 
516 521
 		// @see https://github.com/xpressengine/xe-core/issues/2301
517
-		if($db_info->safeguard !== 'Y') $db_info->safeguard = 'N';
522
+		if($db_info->safeguard !== 'Y') {
523
+			$db_info->safeguard = 'N';
524
+		}
518 525
 
519 526
 		if(is_string($db_info->sitelock_whitelist)) {
520 527
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
@@ -623,8 +630,7 @@  discard block
 block discarded – undo
623 630
 				$buff = FileHandler::readFile($orig_lang_file);
624 631
 				FileHandler::writeFile($selected_lang_file, $buff);
625 632
 				$lang_selected = self::loadLangSupported();
626
-			}
627
-			else
633
+			} else
628 634
 			{
629 635
 				$langs = file($selected_lang_file);
630 636
 				foreach($langs as $val)
@@ -683,15 +689,16 @@  discard block
 block discarded – undo
683 689
 
684 690
 				$oModuleModel = getModel('module');
685 691
 				$domain = $url_info['host'] . $url_info['path'];
686
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
692
+				if(substr_compare($domain, '/', -1) === 0) {
693
+					$domain = substr($domain, 0, -1);
694
+				}
687 695
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
688 696
 
689 697
 				if($site_info->site_srl)
690 698
 				{
691 699
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
692 700
 				$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']);
693
-				}
694
-				else
701
+				} else
695 702
 				{
696 703
 					$redirect_url = $url;
697 704
 				}
@@ -700,8 +707,7 @@  discard block
 block discarded – undo
700 707
 				return FALSE;
701 708
 			}
702 709
 			// for sites requesting SSO validation
703
-		}
704
-		else
710
+		} else
705 711
 		{
706 712
 			// result handling : set session_name()
707 713
 			if($session_name = self::get('SSOID'))
@@ -718,8 +724,7 @@  discard block
 block discarded – undo
718 724
 				header('location:' . $url);
719 725
 				return FALSE;
720 726
 				// send SSO request
721
-			}
722
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
727
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
723 728
 			{
724 729
 				setcookie('sso', md5(self::getRequestUri()));
725 730
 				$origin_url = self::getRequestUrl();
@@ -779,8 +784,7 @@  discard block
 block discarded – undo
779 784
 		if($self->site_title)
780 785
 		{
781 786
 			$self->site_title .= ' - ' . $site_title;
782
-		}
783
-		else
787
+		} else
784 788
 		{
785 789
 			$self->site_title = $site_title;
786 790
 		}
@@ -880,8 +884,7 @@  discard block
 block discarded – undo
880 884
 		{
881 885
 			$self->loaded_lang_files[] = $filename;
882 886
 			include($filename);
883
-		}
884
-		else
887
+		} else
885 888
 		{
886 889
 			$self->_evalxmlLang($path);
887 890
 		}
@@ -897,7 +900,9 @@  discard block
 block discarded – undo
897 900
 	{
898 901
 		global $lang;
899 902
 
900
-		if(!$path) return;
903
+		if(!$path) {
904
+			return;
905
+		}
901 906
 
902 907
 		$_path = 'eval://' . $path;
903 908
 
@@ -929,7 +934,9 @@  discard block
 block discarded – undo
929 934
 	 */
930 935
 	function _loadXmlLang($path)
931 936
 	{
932
-		if(!$path) return;
937
+		if(!$path) {
938
+			return;
939
+		}
933 940
 
934 941
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
935 942
 		return $oXmlLangParser->compile();
@@ -943,7 +950,9 @@  discard block
 block discarded – undo
943 950
 	 */
944 951
 	function _loadPhpLang($path)
945 952
 	{
946
-		if(!$path) return;
953
+		if(!$path) {
954
+			return;
955
+		}
947 956
 
948 957
 		if(substr_compare($path, '/', -1) !== 0)
949 958
 		{
@@ -1076,12 +1085,14 @@  discard block
 block discarded – undo
1076 1085
 		static $flag = TRUE;
1077 1086
 		if($charset)
1078 1087
 		{
1079
-			if(is_array($val))
1080
-				array_walk($val,'Context::checkConvertFlag',$charset);
1081
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1082
-			else $flag = FALSE;
1083
-		}
1084
-		else
1088
+			if(is_array($val)) {
1089
+							array_walk($val,'Context::checkConvertFlag',$charset);
1090
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1091
+				$flag = FALSE;
1092
+			} else {
1093
+				$flag = FALSE;
1094
+			}
1095
+		} else
1085 1096
 		{
1086 1097
 			$return = $flag;
1087 1098
 			$flag = TRUE;
@@ -1103,8 +1114,9 @@  discard block
 block discarded – undo
1103 1114
 		if (is_array($val))
1104 1115
 		{
1105 1116
 			array_walk($val,'Context::doConvertEncoding',$charset);
1117
+		} else {
1118
+			$val = iconv($charset,'UTF-8',$val);
1106 1119
 		}
1107
-		else $val = iconv($charset,'UTF-8',$val);
1108 1120
 	}
1109 1121
 
1110 1122
 	/**
@@ -1115,7 +1127,9 @@  discard block
 block discarded – undo
1115 1127
 	 */
1116 1128
 	function convertEncodingStr($str)
1117 1129
 	{
1118
-        if(!$str) return null;
1130
+        if(!$str) {
1131
+        	return null;
1132
+        }
1119 1133
 		$obj = new stdClass();
1120 1134
 		$obj->str = $str;
1121 1135
 		$obj = self::convertEncoding($obj);
@@ -1228,16 +1242,13 @@  discard block
 block discarded – undo
1228 1242
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1229 1243
 			{
1230 1244
 				$set_to_vars = TRUE;
1231
-			}
1232
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1245
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1233 1246
 			{
1234 1247
 				$set_to_vars = TRUE;
1235
-			}
1236
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1248
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1237 1249
 			{
1238 1250
 				$set_to_vars = TRUE;
1239
-			}
1240
-			else
1251
+			} else
1241 1252
 			{
1242 1253
 				$set_to_vars = FALSE;
1243 1254
 			}
@@ -1263,8 +1274,7 @@  discard block
 block discarded – undo
1263 1274
 					return;
1264 1275
 				}
1265 1276
 			}
1266
-		}
1267
-		else if(is_array($val))
1277
+		} else if(is_array($val))
1268 1278
 		{
1269 1279
 			foreach($val as $val2)
1270 1280
 			{
@@ -1412,24 +1422,19 @@  discard block
 block discarded – undo
1412 1422
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1413 1423
 			{
1414 1424
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1415
-			}
1416
-			elseif($key === 'mid' || $key === 'search_keyword')
1425
+			} elseif($key === 'mid' || $key === 'search_keyword')
1417 1426
 			{
1418 1427
 				$result[$k] = escape($v, false);
1419
-			}
1420
-			elseif($key === 'vid')
1428
+			} elseif($key === 'vid')
1421 1429
 			{
1422 1430
 				$result[$k] = urlencode($v);
1423
-			}
1424
-			elseif($key === 'xe_validator_id')
1431
+			} elseif($key === 'xe_validator_id')
1425 1432
 			{
1426 1433
 				$result[$k] = escape($v, false);
1427
-			}
1428
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1434
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1429 1435
 			{
1430 1436
 				unset($result[$k]);
1431
-			}
1432
-			else
1437
+			} else
1433 1438
 			{
1434 1439
 				$result[$k] = $v;
1435 1440
 
@@ -1438,8 +1443,7 @@  discard block
 block discarded – undo
1438 1443
 					if (is_array($result[$k]))
1439 1444
 					{
1440 1445
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1441
-					}
1442
-					else
1446
+					} else
1443 1447
 					{
1444 1448
 						$result[$k] = stripslashes($result[$k]);
1445 1449
 					}
@@ -1448,8 +1452,7 @@  discard block
 block discarded – undo
1448 1452
 				if(is_array($result[$k]))
1449 1453
 				{
1450 1454
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1451
-				}
1452
-				else
1455
+				} else
1453 1456
 				{
1454 1457
 					$result[$k] = trim($result[$k]);
1455 1458
 				}
@@ -1499,8 +1502,7 @@  discard block
 block discarded – undo
1499 1502
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1500 1503
 				$this->set($key, $val, TRUE);
1501 1504
 				$this->is_uploaded = TRUE;
1502
-			}
1503
-			else
1505
+			} else
1504 1506
 			{
1505 1507
 				$files = array();
1506 1508
 				$count_files = count($tmp_name);
@@ -1518,7 +1520,9 @@  discard block
 block discarded – undo
1518 1520
 						$files[] = $file;
1519 1521
 					}
1520 1522
 				}
1521
-				if($files) $this->set($key, $files, TRUE);
1523
+				if($files) {
1524
+					$this->set($key, $files, TRUE);
1525
+				}
1522 1526
 			}
1523 1527
 		}
1524 1528
 	}
@@ -1610,8 +1614,7 @@  discard block
 block discarded – undo
1610 1614
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1611 1615
 			{
1612 1616
 				$vid = $site_module_info->domain;
1613
-			}
1614
-			else
1617
+			} else
1615 1618
 			{
1616 1619
 				$domain = $site_module_info->domain;
1617 1620
 			}
@@ -1628,8 +1631,7 @@  discard block
 block discarded – undo
1628 1631
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1629 1632
 			{
1630 1633
 				unset($domain);
1631
-			}
1632
-			else
1634
+			} else
1633 1635
 			{
1634 1636
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1635 1637
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1649,23 +1651,35 @@  discard block
 block discarded – undo
1649 1651
 			{
1650 1652
 				array_shift($args_list);
1651 1653
 			}
1652
-		}
1653
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1654
+		} elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1654 1655
 		{
1655 1656
 			// Otherwise, make GET variables into array
1656 1657
 			$get_vars = get_object_vars($self->get_vars);
1657
-		}
1658
-		else
1658
+		} else
1659 1659
 		{
1660
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1661
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1662
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1663
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1664
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1665
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1660
+			if(!!$self->get_vars->module) {
1661
+				$get_vars['module'] = $self->get_vars->module;
1662
+			}
1663
+			if(!!$self->get_vars->mid) {
1664
+				$get_vars['mid'] = $self->get_vars->mid;
1665
+			}
1666
+			if(!!$self->get_vars->act) {
1667
+				$get_vars['act'] = $self->get_vars->act;
1668
+			}
1669
+			if(!!$self->get_vars->page) {
1670
+				$get_vars['page'] = $self->get_vars->page;
1671
+			}
1672
+			if(!!$self->get_vars->search_target) {
1673
+				$get_vars['search_target'] = $self->get_vars->search_target;
1674
+			}
1675
+			if(!!$self->get_vars->search_keyword) {
1676
+				$get_vars['search_keyword'] = $self->get_vars->search_keyword;
1677
+			}
1666 1678
 			if($get_vars['act'] == 'IS')
1667 1679
 			{
1668
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1680
+				if(!!$self->get_vars->is_keyword) {
1681
+					$get_vars['is_keyword'] = $self->get_vars->is_keyword;
1682
+				}
1669 1683
 			}
1670 1684
 		}
1671 1685
 
@@ -1690,8 +1704,7 @@  discard block
 block discarded – undo
1690 1704
 		if($vid)
1691 1705
 		{
1692 1706
 			$get_vars['vid'] = $vid;
1693
-		}
1694
-		else
1707
+		} else
1695 1708
 		{
1696 1709
 			unset($get_vars['vid']);
1697 1710
 		}
@@ -1763,8 +1776,7 @@  discard block
 block discarded – undo
1763 1776
 						{
1764 1777
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1765 1778
 						}
1766
-					}
1767
-					elseif(!is_array($val))
1779
+					} elseif(!is_array($val))
1768 1780
 					{
1769 1781
 						$queries[] = $key . '=' . urlencode($val);
1770 1782
 					}
@@ -1782,25 +1794,23 @@  discard block
 block discarded – undo
1782 1794
 		{
1783 1795
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1784 1796
 			// optional SSL use
1785
-		}
1786
-		elseif($_use_ssl == 'optional')
1797
+		} elseif($_use_ssl == 'optional')
1787 1798
 		{
1788 1799
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1789 1800
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1790 1801
 			// no SSL
1791
-		}
1792
-		else
1802
+		} else
1793 1803
 		{
1794 1804
 			// currently on SSL but target is not based on SSL
1795 1805
 			if($_SERVER['HTTPS'] == 'on')
1796 1806
 			{
1797 1807
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1798
-			}
1799
-			else if($domain) // if $domain is set
1808
+			} else if($domain) {
1809
+				// if $domain is set
1800 1810
 			{
1801 1811
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1802 1812
 			}
1803
-			else
1813
+			} else
1804 1814
 			{
1805 1815
 				$query = getScriptPath() . $query;
1806 1816
 			}
@@ -1857,8 +1867,7 @@  discard block
 block discarded – undo
1857 1867
 		if($domain)
1858 1868
 		{
1859 1869
 			$domain_key = md5($domain);
1860
-		}
1861
-		else
1870
+		} else
1862 1871
 		{
1863 1872
 			$domain_key = 'default';
1864 1873
 		}
@@ -1887,8 +1896,7 @@  discard block
 block discarded – undo
1887 1896
 			{
1888 1897
 				$target_url.= '/';
1889 1898
 			}
1890
-		}
1891
-		else
1899
+		} else
1892 1900
 		{
1893 1901
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1894 1902
 		}
@@ -1906,20 +1914,17 @@  discard block
 block discarded – undo
1906 1914
 			if($port && $port != 443)
1907 1915
 			{
1908 1916
 				$url_info['port'] = $port;
1909
-			}
1910
-			elseif($url_info['port'] == 443)
1917
+			} elseif($url_info['port'] == 443)
1911 1918
 			{
1912 1919
 				unset($url_info['port']);
1913 1920
 			}
1914
-		}
1915
-		else
1921
+		} else
1916 1922
 		{
1917 1923
 			$port = self::get('_http_port');
1918 1924
 			if($port && $port != 80)
1919 1925
 			{
1920 1926
 				$url_info['port'] = $port;
1921
-			}
1922
-			elseif($url_info['port'] == 80)
1927
+			} elseif($url_info['port'] == 80)
1923 1928
 			{
1924 1929
 				unset($url_info['port']);
1925 1930
 			}
@@ -2156,8 +2161,7 @@  discard block
 block discarded – undo
2156 2161
 		if(strpos($file, './') === 0)
2157 2162
 		{
2158 2163
 			$file = $script_path . substr($file, 2);
2159
-		}
2160
-		elseif(strpos($file, '../') === 0)
2164
+		} elseif(strpos($file, '../') === 0)
2161 2165
 		{
2162 2166
 			$file = self::normalizeFilePath($script_path . $file);
2163 2167
 		}
@@ -2419,8 +2423,7 @@  discard block
 block discarded – undo
2419 2423
 			if(substr_compare($filename, '.js', -3) === 0)
2420 2424
 			{
2421 2425
 				$result->jsList[] = $plugin_path . $filename;
2422
-			}
2423
-			elseif(substr_compare($filename, '.css', -4) === 0)
2426
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2424 2427
 			{
2425 2428
 				$result->cssList[] = $plugin_path . $filename;
2426 2429
 			}
@@ -2677,8 +2680,7 @@  discard block
 block discarded – undo
2677 2680
 			if(count($_base) > 0)
2678 2681
 			{
2679 2682
 				array_shift($_base);
2680
-			}
2681
-			else
2683
+			} else
2682 2684
 			{
2683 2685
 				array_unshift($_base, '..');
2684 2686
 			}
Please login to merge, or discard this patch.
Spacing   +314 added lines, -314 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,36 +487,36 @@  discard block
 block discarded – undo
487 487
 			$oInstallController->makeConfigFile();
488 488
 		}
489 489
 
490
-		if(!$db_info->use_prepared_statements)
490
+		if (!$db_info->use_prepared_statements)
491 491
 		{
492 492
 			$db_info->use_prepared_statements = 'Y';
493 493
 		}
494 494
 
495
-		if(!$db_info->time_zone)
495
+		if (!$db_info->time_zone)
496 496
 			$db_info->time_zone = date('O');
497 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 498
 
499
-		if($db_info->qmail_compatibility != 'Y')
499
+		if ($db_info->qmail_compatibility != 'Y')
500 500
 			$db_info->qmail_compatibility = 'N';
501 501
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 502
 
503
-		if(!$db_info->use_db_session)
503
+		if (!$db_info->use_db_session)
504 504
 			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
505
+		if (!$db_info->use_ssl)
506 506
 			$db_info->use_ssl = 'none';
507 507
 		$this->set('_use_ssl', $db_info->use_ssl);
508 508
 
509 509
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
510 510
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
511 511
 
512
-		if(!$db_info->sitelock_whitelist) {
512
+		if (!$db_info->sitelock_whitelist) {
513 513
 			$db_info->sitelock_whitelist = '127.0.0.1';
514 514
 		}
515 515
 
516 516
 		// @see https://github.com/xpressengine/xe-core/issues/2301
517
-		if($db_info->safeguard !== 'Y') $db_info->safeguard = 'N';
517
+		if ($db_info->safeguard !== 'Y') $db_info->safeguard = 'N';
518 518
 
519
-		if(is_string($db_info->sitelock_whitelist)) {
519
+		if (is_string($db_info->sitelock_whitelist)) {
520 520
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
521 521
 		}
522 522
 
@@ -587,10 +587,10 @@  discard block
 block discarded – undo
587 587
 	function loadLangSupported()
588 588
 	{
589 589
 		static $lang_supported = null;
590
-		if(!$lang_supported)
590
+		if (!$lang_supported)
591 591
 		{
592
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
593
-			foreach($langs as $val)
592
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
593
+			foreach ($langs as $val)
594 594
 			{
595 595
 				list($lang_prefix, $lang_text) = explode(',', $val);
596 596
 				$lang_text = trim($lang_text);
@@ -608,17 +608,17 @@  discard block
 block discarded – undo
608 608
 	function loadLangSelected()
609 609
 	{
610 610
 		static $lang_selected = null;
611
-		if(!$lang_selected)
611
+		if (!$lang_selected)
612 612
 		{
613
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
614
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
615
-			if(!FileHandler::hasContent($selected_lang_file))
613
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
614
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
615
+			if (!FileHandler::hasContent($selected_lang_file))
616 616
 			{
617
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
617
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
618 618
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
619 619
 			}
620 620
 
621
-			if(!FileHandler::hasContent($selected_lang_file))
621
+			if (!FileHandler::hasContent($selected_lang_file))
622 622
 			{
623 623
 				$buff = FileHandler::readFile($orig_lang_file);
624 624
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			else
628 628
 			{
629 629
 				$langs = file($selected_lang_file);
630
-				foreach($langs as $val)
630
+				foreach ($langs as $val)
631 631
 				{
632 632
 					list($lang_prefix, $lang_text) = explode(',', $val);
633 633
 					$lang_text = trim($lang_text);
@@ -646,56 +646,56 @@  discard block
 block discarded – undo
646 646
 	function checkSSO()
647 647
 	{
648 648
 		// pass if it's not GET request or XE is not yet installed
649
-		if($this->db_info->use_sso != 'Y' || isCrawler())
649
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
650 650
 		{
651 651
 			return TRUE;
652 652
 		}
653 653
 		$checkActList = array('rss' => 1, 'atom' => 1);
654
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
654
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
655 655
 		{
656 656
 			return TRUE;
657 657
 		}
658 658
 
659 659
 		// pass if default URL is not set
660 660
 		$default_url = trim($this->db_info->default_url);
661
-		if(!$default_url)
661
+		if (!$default_url)
662 662
 		{
663 663
 			return TRUE;
664 664
 		}
665 665
 
666
-		if(substr_compare($default_url, '/', -1) !== 0)
666
+		if (substr_compare($default_url, '/', -1) !== 0)
667 667
 		{
668 668
 			$default_url .= '/';
669 669
 		}
670 670
 
671 671
 		// for sites recieving SSO valdiation
672
-		if($default_url == self::getRequestUri())
672
+		if ($default_url == self::getRequestUri())
673 673
 		{
674
-			if(self::get('url'))
674
+			if (self::get('url'))
675 675
 			{
676 676
 				$url = base64_decode(self::get('url'));
677 677
 				$url_info = parse_url($url);
678
-				if(!Password::checkSignature($url, self::get('sig')))
678
+				if (!Password::checkSignature($url, self::get('sig')))
679 679
 				{
680 680
 					echo self::get('lang')->msg_invalid_request;
681 681
 					return false;
682 682
 				}
683 683
 
684 684
 				$oModuleModel = getModel('module');
685
-				$domain = $url_info['host'] . $url_info['path'];
686
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
685
+				$domain = $url_info['host'].$url_info['path'];
686
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
687 687
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
688 688
 
689
-				if($site_info->site_srl)
689
+				if ($site_info->site_srl)
690 690
 				{
691
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
692
-				$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']);
691
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
692
+				$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']);
693 693
 				}
694 694
 				else
695 695
 				{
696 696
 					$redirect_url = $url;
697 697
 				}
698
-				header('location:' . $redirect_url);
698
+				header('location:'.$redirect_url);
699 699
 
700 700
 				return FALSE;
701 701
 			}
@@ -704,9 +704,9 @@  discard block
 block discarded – undo
704 704
 		else
705 705
 		{
706 706
 			// result handling : set session_name()
707
-			if($session_name = self::get('SSOID'))
707
+			if ($session_name = self::get('SSOID'))
708 708
 			{
709
-				if(!Password::checkSignature($session_name, self::get('sig')))
709
+				if (!Password::checkSignature($session_name, self::get('sig')))
710 710
 				{
711 711
 					echo self::get('lang')->msg_invalid_request;
712 712
 					return false;
@@ -715,17 +715,17 @@  discard block
 block discarded – undo
715 715
 				setcookie(session_name(), $session_name);
716 716
 
717 717
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
718
-				header('location:' . $url);
718
+				header('location:'.$url);
719 719
 				return FALSE;
720 720
 				// send SSO request
721 721
 			}
722
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
722
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
723 723
 			{
724 724
 				setcookie('sso', md5(self::getRequestUri()));
725 725
 				$origin_url = self::getRequestUrl();
726 726
 				$origin_sig = Password::createSignature($origin_url);
727 727
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
728
-				header('location:' . $url);
728
+				header('location:'.$url);
729 729
 				return FALSE;
730 730
 			}
731 731
 		}
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	{
753 753
 		$self = self::getInstance();
754 754
 
755
-		if(!$self->isFTPRegisted())
755
+		if (!$self->isFTPRegisted())
756 756
 		{
757 757
 			return null;
758 758
 		}
@@ -770,15 +770,15 @@  discard block
 block discarded – undo
770 770
 	 */
771 771
 	function addBrowserTitle($site_title)
772 772
 	{
773
-		if(!$site_title)
773
+		if (!$site_title)
774 774
 		{
775 775
 			return;
776 776
 		}
777 777
 		$self = self::getInstance();
778 778
 
779
-		if($self->site_title)
779
+		if ($self->site_title)
780 780
 		{
781
-			$self->site_title .= ' - ' . $site_title;
781
+			$self->site_title .= ' - '.$site_title;
782 782
 		}
783 783
 		else
784 784
 		{
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	 */
795 795
 	function setBrowserTitle($site_title)
796 796
 	{
797
-		if(!$site_title)
797
+		if (!$site_title)
798 798
 		{
799 799
 			return;
800 800
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$oModuleModel = getModel('module');
827 827
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
828 828
 
829
-		if(isset($moduleConfig->siteTitle))
829
+		if (isset($moduleConfig->siteTitle))
830 830
 		{
831 831
 			return $moduleConfig->siteTitle;
832 832
 		}
@@ -853,30 +853,30 @@  discard block
 block discarded – undo
853 853
 		global $lang;
854 854
 
855 855
 		$self = self::getInstance();
856
-		if(!$self->lang_type)
856
+		if (!$self->lang_type)
857 857
 		{
858 858
 			return;
859 859
 		}
860
-		if(!is_object($lang))
860
+		if (!is_object($lang))
861 861
 		{
862 862
 			$lang = new stdClass;
863 863
 		}
864 864
 
865
-		if(!($filename = $self->_loadXmlLang($path)))
865
+		if (!($filename = $self->_loadXmlLang($path)))
866 866
 		{
867 867
 			$filename = $self->_loadPhpLang($path);
868 868
 		}
869 869
 
870
-		if(!is_array($self->loaded_lang_files))
870
+		if (!is_array($self->loaded_lang_files))
871 871
 		{
872 872
 			$self->loaded_lang_files = array();
873 873
 		}
874
-		if(in_array($filename, $self->loaded_lang_files))
874
+		if (in_array($filename, $self->loaded_lang_files))
875 875
 		{
876 876
 			return;
877 877
 		}
878 878
 
879
-		if($filename && is_readable($filename))
879
+		if ($filename && is_readable($filename))
880 880
 		{
881 881
 			$self->loaded_lang_files[] = $filename;
882 882
 			include($filename);
@@ -897,24 +897,24 @@  discard block
 block discarded – undo
897 897
 	{
898 898
 		global $lang;
899 899
 
900
-		if(!$path) return;
900
+		if (!$path) return;
901 901
 
902
-		$_path = 'eval://' . $path;
902
+		$_path = 'eval://'.$path;
903 903
 
904
-		if(in_array($_path, $this->loaded_lang_files))
904
+		if (in_array($_path, $this->loaded_lang_files))
905 905
 		{
906 906
 			return;
907 907
 		}
908 908
 
909
-		if(substr_compare($path, '/', -1) !== 0)
909
+		if (substr_compare($path, '/', -1) !== 0)
910 910
 		{
911 911
 			$path .= '/';
912 912
 		}
913 913
 
914
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
914
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
915 915
 		$content = $oXmlLangParser->getCompileContent();
916 916
 
917
-		if($content)
917
+		if ($content)
918 918
 		{
919 919
 			$this->loaded_lang_files[] = $_path;
920 920
 			eval($content);
@@ -929,9 +929,9 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	function _loadXmlLang($path)
931 931
 	{
932
-		if(!$path) return;
932
+		if (!$path) return;
933 933
 
934
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
934
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
935 935
 		return $oXmlLangParser->compile();
936 936
 	}
937 937
 
@@ -943,22 +943,22 @@  discard block
 block discarded – undo
943 943
 	 */
944 944
 	function _loadPhpLang($path)
945 945
 	{
946
-		if(!$path) return;
946
+		if (!$path) return;
947 947
 
948
-		if(substr_compare($path, '/', -1) !== 0)
948
+		if (substr_compare($path, '/', -1) !== 0)
949 949
 		{
950 950
 			$path .= '/';
951 951
 		}
952
-		$path_tpl = $path . '%s.lang.php';
952
+		$path_tpl = $path.'%s.lang.php';
953 953
 		$file = sprintf($path_tpl, $this->lang_type);
954 954
 
955 955
 		$langs = array('ko', 'en'); // this will be configurable.
956
-		while(!is_readable($file) && $langs[0])
956
+		while (!is_readable($file) && $langs[0])
957 957
 		{
958 958
 			$file = sprintf($path_tpl, array_shift($langs));
959 959
 		}
960 960
 
961
-		if(!is_readable($file))
961
+		if (!is_readable($file))
962 962
 		{
963 963
 			return FALSE;
964 964
 		}
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
 	 */
1001 1001
 	function getLang($code)
1002 1002
 	{
1003
-		if(!$code)
1003
+		if (!$code)
1004 1004
 		{
1005 1005
 			return;
1006 1006
 		}
1007
-		if($GLOBALS['lang']->{$code})
1007
+		if ($GLOBALS['lang']->{$code})
1008 1008
 		{
1009 1009
 			return $GLOBALS['lang']->{$code};
1010 1010
 		}
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	 */
1021 1021
 	function setLang($code, $val)
1022 1022
 	{
1023
-		if(!isset($GLOBALS['lang']))
1023
+		if (!isset($GLOBALS['lang']))
1024 1024
 		{
1025 1025
 			$GLOBALS['lang'] = new stdClass();
1026 1026
 		}
@@ -1045,17 +1045,17 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
 		$obj = clone $source_obj;
1047 1047
 
1048
-		foreach($charset_list as $charset)
1048
+		foreach ($charset_list as $charset)
1049 1049
 		{
1050
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1050
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1051 1051
 			$flag = self::checkConvertFlag($flag = TRUE);
1052
-			if($flag)
1052
+			if ($flag)
1053 1053
 			{
1054
-				if($charset == 'UTF-8')
1054
+				if ($charset == 'UTF-8')
1055 1055
 				{
1056 1056
 					return $obj;
1057 1057
 				}
1058
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1058
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1059 1059
 				return $obj;
1060 1060
 			}
1061 1061
 		}
@@ -1074,11 +1074,11 @@  discard block
 block discarded – undo
1074 1074
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1075 1075
 	{
1076 1076
 		static $flag = TRUE;
1077
-		if($charset)
1077
+		if ($charset)
1078 1078
 		{
1079
-			if(is_array($val))
1080
-				array_walk($val,'Context::checkConvertFlag',$charset);
1081
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1079
+			if (is_array($val))
1080
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1081
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1082 1082
 			else $flag = FALSE;
1083 1083
 		}
1084 1084
 		else
@@ -1102,9 +1102,9 @@  discard block
 block discarded – undo
1102 1102
 	{
1103 1103
 		if (is_array($val))
1104 1104
 		{
1105
-			array_walk($val,'Context::doConvertEncoding',$charset);
1105
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1106 1106
 		}
1107
-		else $val = iconv($charset,'UTF-8',$val);
1107
+		else $val = iconv($charset, 'UTF-8', $val);
1108 1108
 	}
1109 1109
 
1110 1110
 	/**
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 */
1116 1116
 	function convertEncodingStr($str)
1117 1117
 	{
1118
-        if(!$str) return null;
1118
+        if (!$str) return null;
1119 1119
 		$obj = new stdClass();
1120 1120
 		$obj->str = $str;
1121 1121
 		$obj = self::convertEncoding($obj);
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 	function decodeIdna($domain)
1126 1126
 	{
1127
-		if(strpos($domain, 'xn--') !== FALSE)
1127
+		if (strpos($domain, 'xn--') !== FALSE)
1128 1128
 		{
1129
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1129
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1130 1130
 			$IDN = new idna_convert(array('idn_version' => 2008));
1131 1131
 			$domain = $IDN->decode($domain);
1132 1132
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 	{
1158 1158
 		$self = self::getInstance();
1159 1159
 
1160
-		if($self->response_method)
1160
+		if ($self->response_method)
1161 1161
 		{
1162 1162
 			return $self->response_method;
1163 1163
 		}
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1198 1198
 
1199 1199
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1200
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1200
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1201 1201
 		{
1202 1202
 			$this->isSuccessInit = FALSE;
1203 1203
 		}
@@ -1210,30 +1210,30 @@  discard block
 block discarded – undo
1210 1210
 	 */
1211 1211
 	function _setRequestArgument()
1212 1212
 	{
1213
-		if(!count($_REQUEST))
1213
+		if (!count($_REQUEST))
1214 1214
 		{
1215 1215
 			return;
1216 1216
 		}
1217 1217
 
1218 1218
 		$requestMethod = $this->getRequestMethod();
1219
-		foreach($_REQUEST as $key => $val)
1219
+		foreach ($_REQUEST as $key => $val)
1220 1220
 		{
1221
-			if($val === '' || self::get($key))
1221
+			if ($val === '' || self::get($key))
1222 1222
 			{
1223 1223
 				continue;
1224 1224
 			}
1225 1225
 			$key = htmlentities($key);
1226 1226
 			$val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET'));
1227 1227
 
1228
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1228
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1229 1229
 			{
1230 1230
 				$set_to_vars = TRUE;
1231 1231
 			}
1232
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1232
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1233 1233
 			{
1234 1234
 				$set_to_vars = TRUE;
1235 1235
 			}
1236
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1236
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1237 1237
 			{
1238 1238
 				$set_to_vars = TRUE;
1239 1239
 			}
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 				$set_to_vars = FALSE;
1243 1243
 			}
1244 1244
 
1245
-			if($set_to_vars)
1245
+			if ($set_to_vars)
1246 1246
 			{
1247 1247
 				$this->_recursiveCheckVar($val);
1248 1248
 			}
@@ -1253,20 +1253,20 @@  discard block
 block discarded – undo
1253 1253
 
1254 1254
 	function _recursiveCheckVar($val)
1255 1255
 	{
1256
-		if(is_string($val))
1256
+		if (is_string($val))
1257 1257
 		{
1258
-			foreach($this->patterns as $pattern)
1258
+			foreach ($this->patterns as $pattern)
1259 1259
 			{
1260
-				if(preg_match($pattern, $val))
1260
+				if (preg_match($pattern, $val))
1261 1261
 				{
1262 1262
 					$this->isSuccessInit = FALSE;
1263 1263
 					return;
1264 1264
 				}
1265 1265
 			}
1266 1266
 		}
1267
-		else if(is_array($val))
1267
+		else if (is_array($val))
1268 1268
 		{
1269
-			foreach($val as $val2)
1269
+			foreach ($val as $val2)
1270 1270
 			{
1271 1271
 				$this->_recursiveCheckVar($val2);
1272 1272
 			}
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 	 */
1281 1281
 	function _setJSONRequestArgument()
1282 1282
 	{
1283
-		if($this->getRequestMethod() != 'JSON')
1283
+		if ($this->getRequestMethod() != 'JSON')
1284 1284
 		{
1285 1285
 			return;
1286 1286
 		}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 		$params = array();
1289 1289
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1290 1290
 
1291
-		foreach($params as $key => $val)
1291
+		foreach ($params as $key => $val)
1292 1292
 		{
1293 1293
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1294 1294
 		}
@@ -1301,13 +1301,13 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	function _setXmlRpcArgument()
1303 1303
 	{
1304
-		if($this->getRequestMethod() != 'XMLRPC')
1304
+		if ($this->getRequestMethod() != 'XMLRPC')
1305 1305
 		{
1306 1306
 			return;
1307 1307
 		}
1308 1308
 
1309 1309
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1310
-		if(Security::detectingXEE($xml))
1310
+		if (Security::detectingXEE($xml))
1311 1311
 		{
1312 1312
 			header("HTTP/1.0 400 Bad Request");
1313 1313
 			exit;
@@ -1319,12 +1319,12 @@  discard block
 block discarded – undo
1319 1319
 		$params = $xml_obj->methodcall->params;
1320 1320
 		unset($params->node_name, $params->attrs, $params->body);
1321 1321
 
1322
-		if(!count(get_object_vars($params)))
1322
+		if (!count(get_object_vars($params)))
1323 1323
 		{
1324 1324
 			return;
1325 1325
 		}
1326 1326
 
1327
-		foreach($params as $key => $val)
1327
+		foreach ($params as $key => $val)
1328 1328
 		{
1329 1329
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1330 1330
 		}
@@ -1339,10 +1339,10 @@  discard block
 block discarded – undo
1339 1339
 	 */
1340 1340
 	function _filterXmlVars($key, $val)
1341 1341
 	{
1342
-		if(is_array($val))
1342
+		if (is_array($val))
1343 1343
 		{
1344 1344
 			$stack = array();
1345
-			foreach($val as $k => $v)
1345
+			foreach ($val as $k => $v)
1346 1346
 			{
1347 1347
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1348 1348
 			}
@@ -1352,20 +1352,20 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
 		$body = $val->body;
1354 1354
 		unset($val->node_name, $val->attrs, $val->body);
1355
-		if(!count(get_object_vars($val)))
1355
+		if (!count(get_object_vars($val)))
1356 1356
 		{
1357 1357
 			return $this->_filterRequestVar($key, $body, 0);
1358 1358
 		}
1359 1359
 
1360 1360
 		$stack = new stdClass();
1361
-		foreach($val as $k => $v)
1361
+		foreach ($val as $k => $v)
1362 1362
 		{
1363 1363
 			$output = $this->_filterXmlVars($k, $v);
1364
-			if(is_object($v) && $v->attrs->type == 'array')
1364
+			if (is_object($v) && $v->attrs->type == 'array')
1365 1365
 			{
1366 1366
 				$output = array($output);
1367 1367
 			}
1368
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1368
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1369 1369
 			{
1370 1370
 				return $output;
1371 1371
 			}
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 			$stack->{$k} = $output;
1374 1374
 		}
1375 1375
 
1376
-		if(!count(get_object_vars($stack)))
1376
+		if (!count(get_object_vars($stack)))
1377 1377
 		{
1378 1378
 			return NULL;
1379 1379
 		}
@@ -1392,16 +1392,16 @@  discard block
 block discarded – undo
1392 1392
 	 */
1393 1393
 	function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false)
1394 1394
 	{
1395
-		if(!($isArray = is_array($val)))
1395
+		if (!($isArray = is_array($val)))
1396 1396
 		{
1397 1397
 			$val = array($val);
1398 1398
 		}
1399 1399
 
1400 1400
 		$result = array();
1401
-		foreach($val as $k => $v)
1401
+		foreach ($val as $k => $v)
1402 1402
 		{
1403
-			if($remove_hack && !is_array($v)) {
1404
-				if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1403
+			if ($remove_hack && !is_array($v)) {
1404
+				if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1405 1405
 				{
1406 1406
 					$result[$k] = escape($v);
1407 1407
 					continue;
@@ -1409,23 +1409,23 @@  discard block
 block discarded – undo
1409 1409
 			}
1410 1410
 
1411 1411
 			$k = htmlentities($k);
1412
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1412
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1413 1413
 			{
1414 1414
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1415 1415
 			}
1416
-			elseif($key === 'mid' || $key === 'search_keyword')
1416
+			elseif ($key === 'mid' || $key === 'search_keyword')
1417 1417
 			{
1418 1418
 				$result[$k] = escape($v, false);
1419 1419
 			}
1420
-			elseif($key === 'vid')
1420
+			elseif ($key === 'vid')
1421 1421
 			{
1422 1422
 				$result[$k] = urlencode($v);
1423 1423
 			}
1424
-			elseif($key === 'xe_validator_id')
1424
+			elseif ($key === 'xe_validator_id')
1425 1425
 			{
1426 1426
 				$result[$k] = escape($v, false);
1427 1427
 			}
1428
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1428
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1429 1429
 			{
1430 1430
 				unset($result[$k]);
1431 1431
 			}
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 			{
1434 1434
 				$result[$k] = $v;
1435 1435
 
1436
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1436
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1437 1437
 				{
1438 1438
 					if (is_array($result[$k]))
1439 1439
 					{
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 					}
1446 1446
 				}
1447 1447
 
1448
-				if(is_array($result[$k]))
1448
+				if (is_array($result[$k]))
1449 1449
 				{
1450 1450
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1451 1451
 				}
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 					$result[$k] = trim($result[$k]);
1455 1455
 				}
1456 1456
 
1457
-				if($remove_hack)
1457
+				if ($remove_hack)
1458 1458
 				{
1459 1459
 					$result[$k] = escape($result[$k], false);
1460 1460
 				}
@@ -1482,17 +1482,17 @@  discard block
 block discarded – undo
1482 1482
 	 */
1483 1483
 	function _setUploadedArgument()
1484 1484
 	{
1485
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1485
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1486 1486
 		{
1487 1487
 			return;
1488 1488
 		}
1489 1489
 
1490
-		foreach($_FILES as $key => $val)
1490
+		foreach ($_FILES as $key => $val)
1491 1491
 		{
1492 1492
 			$tmp_name = $val['tmp_name'];
1493
-			if(!is_array($tmp_name))
1493
+			if (!is_array($tmp_name))
1494 1494
 			{
1495
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1495
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1496 1496
 				{
1497 1497
 					continue;
1498 1498
 				}
@@ -1505,9 +1505,9 @@  discard block
 block discarded – undo
1505 1505
 				$files = array();
1506 1506
 				$count_files = count($tmp_name);
1507 1507
 
1508
-				for($i = 0; $i < $count_files; $i++)
1508
+				for ($i = 0; $i < $count_files; $i++)
1509 1509
 				{
1510
-					if($val['size'][$i] > 0)
1510
+					if ($val['size'][$i] > 0)
1511 1511
 					{
1512 1512
 						$file = array();
1513 1513
 						$file['name'] = $val['name'][$i];
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 						$files[] = $file;
1519 1519
 					}
1520 1520
 				}
1521
-				if($files) $this->set($key, $files, TRUE);
1521
+				if ($files) $this->set($key, $files, TRUE);
1522 1522
 			}
1523 1523
 		}
1524 1524
 	}
@@ -1540,16 +1540,16 @@  discard block
 block discarded – undo
1540 1540
 	function getRequestUrl()
1541 1541
 	{
1542 1542
 		static $url = null;
1543
-		if(is_null($url))
1543
+		if (is_null($url))
1544 1544
 		{
1545 1545
 			$url = self::getRequestUri();
1546
-			if(count($_GET) > 0)
1546
+			if (count($_GET) > 0)
1547 1547
 			{
1548
-				foreach($_GET as $key => $val)
1548
+				foreach ($_GET as $key => $val)
1549 1549
 				{
1550
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1550
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1551 1551
 				}
1552
-				$url .= '?' . join('&', $vars);
1552
+				$url .= '?'.join('&', $vars);
1553 1553
 			}
1554 1554
 		}
1555 1555
 		return $url;
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 		$self = self::getInstance();
1565 1565
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1566 1566
 
1567
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1567
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1568 1568
 		{
1569 1569
 			unset($js_callback_func);
1570 1570
 			unset($_GET['xe_js_callback']);
@@ -1592,22 +1592,22 @@  discard block
 block discarded – undo
1592 1592
 		$self = self::getInstance();
1593 1593
 
1594 1594
 		// retrieve virtual site information
1595
-		if(is_null($site_module_info))
1595
+		if (is_null($site_module_info))
1596 1596
 		{
1597 1597
 			$site_module_info = self::get('site_module_info');
1598 1598
 		}
1599 1599
 
1600 1600
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1601
-		if($domain && isSiteID($domain))
1601
+		if ($domain && isSiteID($domain))
1602 1602
 		{
1603 1603
 			$vid = $domain;
1604 1604
 			$domain = '';
1605 1605
 		}
1606 1606
 
1607 1607
 		// If $domain, $vid are not set, use current site information
1608
-		if(!$domain && !$vid)
1608
+		if (!$domain && !$vid)
1609 1609
 		{
1610
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1610
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1611 1611
 			{
1612 1612
 				$vid = $site_module_info->domain;
1613 1613
 			}
@@ -1618,21 +1618,21 @@  discard block
 block discarded – undo
1618 1618
 		}
1619 1619
 
1620 1620
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1621
-		if($domain)
1621
+		if ($domain)
1622 1622
 		{
1623 1623
 			$domain_info = parse_url($domain);
1624
-			if(is_null($current_info))
1624
+			if (is_null($current_info))
1625 1625
 			{
1626
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1626
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1627 1627
 			}
1628
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1628
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1629 1629
 			{
1630 1630
 				unset($domain);
1631 1631
 			}
1632 1632
 			else
1633 1633
 			{
1634 1634
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1635
-				if(substr_compare($domain, '/', -1) !== 0)
1635
+				if (substr_compare($domain, '/', -1) !== 0)
1636 1636
 				{
1637 1637
 					$domain .= '/';
1638 1638
 				}
@@ -1642,41 +1642,41 @@  discard block
 block discarded – undo
1642 1642
 		$get_vars = array();
1643 1643
 
1644 1644
 		// If there is no GET variables or first argument is '' to reset variables
1645
-		if(!$self->get_vars || $args_list[0] == '')
1645
+		if (!$self->get_vars || $args_list[0] == '')
1646 1646
 		{
1647 1647
 			// rearrange args_list
1648
-			if(is_array($args_list) && $args_list[0] == '')
1648
+			if (is_array($args_list) && $args_list[0] == '')
1649 1649
 			{
1650 1650
 				array_shift($args_list);
1651 1651
 			}
1652 1652
 		}
1653
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1653
+		elseif ($_SERVER['REQUEST_METHOD'] == 'GET')
1654 1654
 		{
1655 1655
 			// Otherwise, make GET variables into array
1656 1656
 			$get_vars = get_object_vars($self->get_vars);
1657 1657
 		}
1658 1658
 		else
1659 1659
 		{
1660
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1661
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1662
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1663
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1664
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1665
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1666
-			if($get_vars['act'] == 'IS')
1660
+			if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1661
+			if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1662
+			if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1663
+			if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1664
+			if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1665
+			if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1666
+			if ($get_vars['act'] == 'IS')
1667 1667
 			{
1668
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1668
+				if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1669 1669
 			}
1670 1670
 		}
1671 1671
 
1672 1672
 		// arrange args_list
1673
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1673
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1674 1674
 		{
1675 1675
 			$key = $args_list[$i];
1676 1676
 			$val = trim($args_list[$i + 1]);
1677 1677
 
1678 1678
 			// If value is not set, remove the key
1679
-			if(!isset($val) || !strlen($val))
1679
+			if (!isset($val) || !strlen($val))
1680 1680
 			{
1681 1681
 				unset($get_vars[$key]);
1682 1682
 				continue;
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 
1688 1688
 		// remove vid, rnd
1689 1689
 		unset($get_vars['rnd']);
1690
-		if($vid)
1690
+		if ($vid)
1691 1691
 		{
1692 1692
 			$get_vars['vid'] = $vid;
1693 1693
 		}
@@ -1704,17 +1704,17 @@  discard block
 block discarded – undo
1704 1704
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1705 1705
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1706 1706
 		);
1707
-		if($act_alias[$act])
1707
+		if ($act_alias[$act])
1708 1708
 		{
1709 1709
 			$get_vars['act'] = $act_alias[$act];
1710 1710
 		}
1711 1711
 
1712 1712
 		// organize URL
1713 1713
 		$query = '';
1714
-		if(count($get_vars) > 0)
1714
+		if (count($get_vars) > 0)
1715 1715
 		{
1716 1716
 			// if using rewrite mod
1717
-			if($self->allow_rewrite)
1717
+			if ($self->allow_rewrite)
1718 1718
 			{
1719 1719
 				$var_keys = array_keys($get_vars);
1720 1720
 				sort($var_keys);
@@ -1734,8 +1734,8 @@  discard block
 block discarded – undo
1734 1734
 					'vid' => $vid,
1735 1735
 					'mid' => $mid,
1736 1736
 					'mid.vid' => "$vid/$mid",
1737
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1738
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1737
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1738
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1739 1739
 					'document_srl' => $srl,
1740 1740
 					'document_srl.mid' => "$mid/$srl",
1741 1741
 					'document_srl.vid' => "$vid/$srl",
@@ -1752,66 +1752,66 @@  discard block
 block discarded – undo
1752 1752
 				$query = $target_map[$target];
1753 1753
 			}
1754 1754
 
1755
-			if(!$query)
1755
+			if (!$query)
1756 1756
 			{
1757 1757
 				$queries = array();
1758
-				foreach($get_vars as $key => $val)
1758
+				foreach ($get_vars as $key => $val)
1759 1759
 				{
1760
-					if(is_array($val) && count($val) > 0)
1760
+					if (is_array($val) && count($val) > 0)
1761 1761
 					{
1762
-						foreach($val as $k => $v)
1762
+						foreach ($val as $k => $v)
1763 1763
 						{
1764
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1764
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1765 1765
 						}
1766 1766
 					}
1767
-					elseif(!is_array($val))
1767
+					elseif (!is_array($val))
1768 1768
 					{
1769
-						$queries[] = $key . '=' . urlencode($val);
1769
+						$queries[] = $key.'='.urlencode($val);
1770 1770
 					}
1771 1771
 				}
1772
-				if(count($queries) > 0)
1772
+				if (count($queries) > 0)
1773 1773
 				{
1774
-					$query = 'index.php?' . join('&', $queries);
1774
+					$query = 'index.php?'.join('&', $queries);
1775 1775
 				}
1776 1776
 			}
1777 1777
 		}
1778 1778
 
1779 1779
 		// If using SSL always
1780 1780
 		$_use_ssl = $self->get('_use_ssl');
1781
-		if($_use_ssl == 'always')
1781
+		if ($_use_ssl == 'always')
1782 1782
 		{
1783
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1783
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1784 1784
 			// optional SSL use
1785 1785
 		}
1786
-		elseif($_use_ssl == 'optional')
1786
+		elseif ($_use_ssl == 'optional')
1787 1787
 		{
1788 1788
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1789
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1789
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1790 1790
 			// no SSL
1791 1791
 		}
1792 1792
 		else
1793 1793
 		{
1794 1794
 			// currently on SSL but target is not based on SSL
1795
-			if($_SERVER['HTTPS'] == 'on')
1795
+			if ($_SERVER['HTTPS'] == 'on')
1796 1796
 			{
1797
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1797
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1798 1798
 			}
1799
-			else if($domain) // if $domain is set
1799
+			else if ($domain) // if $domain is set
1800 1800
 			{
1801
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1801
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1802 1802
 			}
1803 1803
 			else
1804 1804
 			{
1805
-				$query = getScriptPath() . $query;
1805
+				$query = getScriptPath().$query;
1806 1806
 			}
1807 1807
 		}
1808 1808
 
1809
-		if(!$encode)
1809
+		if (!$encode)
1810 1810
 		{
1811 1811
 			return $query;
1812 1812
 		}
1813 1813
 
1814
-		if(!$autoEncode)
1814
+		if (!$autoEncode)
1815 1815
 		{
1816 1816
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1817 1817
 		}
@@ -1820,16 +1820,16 @@  discard block
 block discarded – undo
1820 1820
 		$encode_queries = array();
1821 1821
 		$parsedUrl = parse_url($query);
1822 1822
 		parse_str($parsedUrl['query'], $output);
1823
-		foreach($output as $key => $value)
1823
+		foreach ($output as $key => $value)
1824 1824
 		{
1825
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1825
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1826 1826
 			{
1827 1827
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1828 1828
 			}
1829
-			$encode_queries[] = $key . '=' . $value;
1829
+			$encode_queries[] = $key.'='.$value;
1830 1830
 		}
1831 1831
 
1832
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1832
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1833 1833
 	}
1834 1834
 
1835 1835
 	/**
@@ -1844,17 +1844,17 @@  discard block
 block discarded – undo
1844 1844
 		static $url = array();
1845 1845
 
1846 1846
 		// Check HTTP Request
1847
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1847
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1848 1848
 		{
1849 1849
 			return;
1850 1850
 		}
1851 1851
 
1852
-		if(self::get('_use_ssl') == 'always')
1852
+		if (self::get('_use_ssl') == 'always')
1853 1853
 		{
1854 1854
 			$ssl_mode = ENFORCE_SSL;
1855 1855
 		}
1856 1856
 
1857
-		if($domain)
1857
+		if ($domain)
1858 1858
 		{
1859 1859
 			$domain_key = md5($domain);
1860 1860
 		}
@@ -1863,14 +1863,14 @@  discard block
 block discarded – undo
1863 1863
 			$domain_key = 'default';
1864 1864
 		}
1865 1865
 
1866
-		if(isset($url[$ssl_mode][$domain_key]))
1866
+		if (isset($url[$ssl_mode][$domain_key]))
1867 1867
 		{
1868 1868
 			return $url[$ssl_mode][$domain_key];
1869 1869
 		}
1870 1870
 
1871 1871
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1872 1872
 
1873
-		switch($ssl_mode)
1873
+		switch ($ssl_mode)
1874 1874
 		{
1875 1875
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1876 1876
 				break;
@@ -1880,34 +1880,34 @@  discard block
 block discarded – undo
1880 1880
 				break;
1881 1881
 		}
1882 1882
 
1883
-		if($domain)
1883
+		if ($domain)
1884 1884
 		{
1885 1885
 			$target_url = trim($domain);
1886
-			if(substr_compare($target_url, '/', -1) !== 0)
1886
+			if (substr_compare($target_url, '/', -1) !== 0)
1887 1887
 			{
1888
-				$target_url.= '/';
1888
+				$target_url .= '/';
1889 1889
 			}
1890 1890
 		}
1891 1891
 		else
1892 1892
 		{
1893
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1893
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1894 1894
 		}
1895 1895
 
1896
-		$url_info = parse_url('http://' . $target_url);
1896
+		$url_info = parse_url('http://'.$target_url);
1897 1897
 
1898
-		if($current_use_ssl != $use_ssl)
1898
+		if ($current_use_ssl != $use_ssl)
1899 1899
 		{
1900 1900
 			unset($url_info['port']);
1901 1901
 		}
1902 1902
 
1903
-		if($use_ssl)
1903
+		if ($use_ssl)
1904 1904
 		{
1905 1905
 			$port = self::get('_https_port');
1906
-			if($port && $port != 443)
1906
+			if ($port && $port != 443)
1907 1907
 			{
1908 1908
 				$url_info['port'] = $port;
1909 1909
 			}
1910
-			elseif($url_info['port'] == 443)
1910
+			elseif ($url_info['port'] == 443)
1911 1911
 			{
1912 1912
 				unset($url_info['port']);
1913 1913
 			}
@@ -1915,17 +1915,17 @@  discard block
 block discarded – undo
1915 1915
 		else
1916 1916
 		{
1917 1917
 			$port = self::get('_http_port');
1918
-			if($port && $port != 80)
1918
+			if ($port && $port != 80)
1919 1919
 			{
1920 1920
 				$url_info['port'] = $port;
1921 1921
 			}
1922
-			elseif($url_info['port'] == 80)
1922
+			elseif ($url_info['port'] == 80)
1923 1923
 			{
1924 1924
 				unset($url_info['port']);
1925 1925
 			}
1926 1926
 		}
1927 1927
 
1928
-		$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']);
1928
+		$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']);
1929 1929
 
1930 1930
 		return $url[$ssl_mode][$domain_key];
1931 1931
 	}
@@ -1942,16 +1942,16 @@  discard block
 block discarded – undo
1942 1942
 	{
1943 1943
 		$self = self::getInstance();
1944 1944
 		$self->context->{$key} = $val;
1945
-		if($set_to_get_vars === FALSE)
1945
+		if ($set_to_get_vars === FALSE)
1946 1946
 		{
1947 1947
 			return;
1948 1948
 		}
1949
-		if($val === NULL || $val === '')
1949
+		if ($val === NULL || $val === '')
1950 1950
 		{
1951 1951
 			unset($self->get_vars->{$key});
1952 1952
 			return;
1953 1953
 		}
1954
-		if($set_to_get_vars || $self->get_vars->{$key})
1954
+		if ($set_to_get_vars || $self->get_vars->{$key})
1955 1955
 		{
1956 1956
 			$self->get_vars->{$key} = $val;
1957 1957
 		}
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 	{
1968 1968
 		$self = self::getInstance();
1969 1969
 
1970
-		if(!isset($self->context->{$key}))
1970
+		if (!isset($self->context->{$key}))
1971 1971
 		{
1972 1972
 			return null;
1973 1973
 		}
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
 	function gets()
1983 1983
 	{
1984 1984
 		$num_args = func_num_args();
1985
-		if($num_args < 1)
1985
+		if ($num_args < 1)
1986 1986
 		{
1987 1987
 			return;
1988 1988
 		}
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 
1991 1991
 		$args_list = func_get_args();
1992 1992
 		$output = new stdClass();
1993
-		foreach($args_list as $v)
1993
+		foreach ($args_list as $v)
1994 1994
 		{
1995 1995
 			$output->{$v} = $self->get($v);
1996 1996
 		}
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
 	function getRequestVars()
2017 2017
 	{
2018 2018
 		$self = self::getInstance();
2019
-		if($self->get_vars)
2019
+		if ($self->get_vars)
2020 2020
 		{
2021 2021
 			return clone($self->get_vars);
2022 2022
 		}
@@ -2033,13 +2033,13 @@  discard block
 block discarded – undo
2033 2033
 	{
2034 2034
 		$self = self::getInstance();
2035 2035
 
2036
-		if(!is_readable($self->sslActionCacheFile))
2036
+		if (!is_readable($self->sslActionCacheFile))
2037 2037
 		{
2038 2038
 			$buff = '<?php if(!defined("__XE__"))exit;';
2039 2039
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2040 2040
 		}
2041 2041
 
2042
-		if(!isset($self->ssl_actions[$action]))
2042
+		if (!isset($self->ssl_actions[$action]))
2043 2043
 		{
2044 2044
 			$self->ssl_actions[$action] = 1;
2045 2045
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2057,16 +2057,16 @@  discard block
 block discarded – undo
2057 2057
 	{
2058 2058
 		$self = self::getInstance();
2059 2059
 
2060
-		if(!is_readable($self->sslActionCacheFile))
2060
+		if (!is_readable($self->sslActionCacheFile))
2061 2061
 		{
2062 2062
 			unset($self->ssl_actions);
2063 2063
 			$buff = '<?php if(!defined("__XE__"))exit;';
2064 2064
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2065 2065
 		}
2066 2066
 
2067
-		foreach($action_array as $action)
2067
+		foreach ($action_array as $action)
2068 2068
 		{
2069
-			if(!isset($self->ssl_actions[$action]))
2069
+			if (!isset($self->ssl_actions[$action]))
2070 2070
 			{
2071 2071
 				$self->ssl_actions[$action] = 1;
2072 2072
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
 	{
2086 2086
 		$self = self::getInstance();
2087 2087
 
2088
-		if($self->isExistsSSLAction($action))
2088
+		if ($self->isExistsSSLAction($action))
2089 2089
 		{
2090 2090
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2091 2091
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 	function getSSLActions()
2103 2103
 	{
2104 2104
 		$self = self::getInstance();
2105
-		if($self->getSslStatus() == 'optional')
2105
+		if ($self->getSslStatus() == 'optional')
2106 2106
 		{
2107 2107
 			return $self->ssl_actions;
2108 2108
 		}
@@ -2129,12 +2129,12 @@  discard block
 block discarded – undo
2129 2129
 	 */
2130 2130
 	function normalizeFilePath($file)
2131 2131
 	{
2132
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2132
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2133 2133
 		{
2134
-			$file = './' . $file;
2134
+			$file = './'.$file;
2135 2135
 		}
2136 2136
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2137
-		while(strpos($file, '/../') !== FALSE)
2137
+		while (strpos($file, '/../') !== FALSE)
2138 2138
 		{
2139 2139
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2140 2140
 		}
@@ -2153,13 +2153,13 @@  discard block
 block discarded – undo
2153 2153
 	{
2154 2154
 		$file = self::normalizeFilePath($file);
2155 2155
 		$script_path = getScriptPath();
2156
-		if(strpos($file, './') === 0)
2156
+		if (strpos($file, './') === 0)
2157 2157
 		{
2158
-			$file = $script_path . substr($file, 2);
2158
+			$file = $script_path.substr($file, 2);
2159 2159
 		}
2160
-		elseif(strpos($file, '../') === 0)
2160
+		elseif (strpos($file, '../') === 0)
2161 2161
 		{
2162
-			$file = self::normalizeFilePath($script_path . $file);
2162
+			$file = self::normalizeFilePath($script_path.$file);
2163 2163
 		}
2164 2164
 
2165 2165
 		return $file;
@@ -2229,12 +2229,12 @@  discard block
 block discarded – undo
2229 2229
 	 */
2230 2230
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2231 2231
 	{
2232
-		if($isRuleset)
2232
+		if ($isRuleset)
2233 2233
 		{
2234
-			if(strpos($file, '#') !== FALSE)
2234
+			if (strpos($file, '#') !== FALSE)
2235 2235
 			{
2236 2236
 				$file = str_replace('#', '', $file);
2237
-				if(!is_readable($file))
2237
+				if (!is_readable($file))
2238 2238
 				{
2239 2239
 					$file = $autoPath;
2240 2240
 				}
@@ -2299,9 +2299,9 @@  discard block
 block discarded – undo
2299 2299
 		ksort($files);
2300 2300
 		$files = array_values($files);
2301 2301
 		$filenames = array();
2302
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2302
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2303 2303
 		{
2304
-			if(in_array($files[$i]['file'], $filenames))
2304
+			if (in_array($files[$i]['file'], $filenames))
2305 2305
 			{
2306 2306
 				unset($files[$i]);
2307 2307
 			}
@@ -2386,14 +2386,14 @@  discard block
 block discarded – undo
2386 2386
 	 */
2387 2387
 	function getJavascriptPluginInfo($pluginName)
2388 2388
 	{
2389
-		if($plugin_name == 'ui.datepicker')
2389
+		if ($plugin_name == 'ui.datepicker')
2390 2390
 		{
2391 2391
 			$plugin_name = 'ui';
2392 2392
 		}
2393 2393
 
2394
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2395
-		$info_file = $plugin_path . 'plugin.load';
2396
-		if(!is_readable($info_file))
2394
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2395
+		$info_file = $plugin_path.'plugin.load';
2396
+		if (!is_readable($info_file))
2397 2397
 		{
2398 2398
 			return;
2399 2399
 		}
@@ -2403,32 +2403,32 @@  discard block
 block discarded – undo
2403 2403
 		$result->jsList = array();
2404 2404
 		$result->cssList = array();
2405 2405
 
2406
-		foreach($list as $filename)
2406
+		foreach ($list as $filename)
2407 2407
 		{
2408 2408
 			$filename = trim($filename);
2409
-			if(!$filename)
2409
+			if (!$filename)
2410 2410
 			{
2411 2411
 				continue;
2412 2412
 			}
2413 2413
 
2414
-			if(strncasecmp('./', $filename, 2) === 0)
2414
+			if (strncasecmp('./', $filename, 2) === 0)
2415 2415
 			{
2416 2416
 				$filename = substr($filename, 2);
2417 2417
 			}
2418 2418
 
2419
-			if(substr_compare($filename, '.js', -3) === 0)
2419
+			if (substr_compare($filename, '.js', -3) === 0)
2420 2420
 			{
2421
-				$result->jsList[] = $plugin_path . $filename;
2421
+				$result->jsList[] = $plugin_path.$filename;
2422 2422
 			}
2423
-			elseif(substr_compare($filename, '.css', -4) === 0)
2423
+			elseif (substr_compare($filename, '.css', -4) === 0)
2424 2424
 			{
2425
-				$result->cssList[] = $plugin_path . $filename;
2425
+				$result->cssList[] = $plugin_path.$filename;
2426 2426
 			}
2427 2427
 		}
2428 2428
 
2429
-		if(is_dir($plugin_path . 'lang'))
2429
+		if (is_dir($plugin_path.'lang'))
2430 2430
 		{
2431
-			$result->langPath = $plugin_path . 'lang';
2431
+			$result->langPath = $plugin_path.'lang';
2432 2432
 		}
2433 2433
 
2434 2434
 		return $result;
@@ -2444,50 +2444,50 @@  discard block
 block discarded – undo
2444 2444
 		static $loaded_plugins = array();
2445 2445
 
2446 2446
 		$self = self::getInstance();
2447
-		if($plugin_name == 'ui.datepicker')
2447
+		if ($plugin_name == 'ui.datepicker')
2448 2448
 		{
2449 2449
 			$plugin_name = 'ui';
2450 2450
 		}
2451 2451
 
2452
-		if($loaded_plugins[$plugin_name])
2452
+		if ($loaded_plugins[$plugin_name])
2453 2453
 		{
2454 2454
 			return;
2455 2455
 		}
2456 2456
 		$loaded_plugins[$plugin_name] = TRUE;
2457 2457
 
2458
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2459
-		$info_file = $plugin_path . 'plugin.load';
2460
-		if(!is_readable($info_file))
2458
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2459
+		$info_file = $plugin_path.'plugin.load';
2460
+		if (!is_readable($info_file))
2461 2461
 		{
2462 2462
 			return;
2463 2463
 		}
2464 2464
 
2465 2465
 		$list = file($info_file);
2466
-		foreach($list as $filename)
2466
+		foreach ($list as $filename)
2467 2467
 		{
2468 2468
 			$filename = trim($filename);
2469
-			if(!$filename)
2469
+			if (!$filename)
2470 2470
 			{
2471 2471
 				continue;
2472 2472
 			}
2473 2473
 
2474
-			if(strncasecmp('./', $filename, 2) === 0)
2474
+			if (strncasecmp('./', $filename, 2) === 0)
2475 2475
 			{
2476 2476
 				$filename = substr($filename, 2);
2477 2477
 			}
2478
-			if(substr_compare($filename, '.js', -3) === 0)
2478
+			if (substr_compare($filename, '.js', -3) === 0)
2479 2479
 			{
2480
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2480
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2481 2481
 			}
2482
-			if(substr_compare($filename, '.css', -4) === 0)
2482
+			if (substr_compare($filename, '.css', -4) === 0)
2483 2483
 			{
2484
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2484
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2485 2485
 			}
2486 2486
 		}
2487 2487
 
2488
-		if(is_dir($plugin_path . 'lang'))
2488
+		if (is_dir($plugin_path.'lang'))
2489 2489
 		{
2490
-			$self->loadLang($plugin_path . 'lang');
2490
+			$self->loadLang($plugin_path.'lang');
2491 2491
 		}
2492 2492
 	}
2493 2493
 
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 	function addHtmlHeader($header)
2501 2501
 	{
2502 2502
 		$self = self::getInstance();
2503
-		$self->html_header .= "\n" . $header;
2503
+		$self->html_header .= "\n".$header;
2504 2504
 	}
2505 2505
 
2506 2506
 	function clearHtmlHeader()
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
 	function addBodyHeader($header)
2553 2553
 	{
2554 2554
 		$self = self::getInstance();
2555
-		$self->body_header .= "\n" . $header;
2555
+		$self->body_header .= "\n".$header;
2556 2556
 	}
2557 2557
 
2558 2558
 	/**
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
 	function addHtmlFooter($footer)
2575 2575
 	{
2576 2576
 		$self = self::getInstance();
2577
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2577
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2578 2578
 	}
2579 2579
 
2580 2580
 	/**
@@ -2595,7 +2595,7 @@  discard block
 block discarded – undo
2595 2595
 	 */
2596 2596
 	function getConfigFile()
2597 2597
 	{
2598
-		return _XE_PATH_ . 'files/config/db.config.php';
2598
+		return _XE_PATH_.'files/config/db.config.php';
2599 2599
 	}
2600 2600
 
2601 2601
 	/**
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 	 */
2606 2606
 	function getFTPConfigFile()
2607 2607
 	{
2608
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2608
+		return _XE_PATH_.'files/config/ftp.config.php';
2609 2609
 	}
2610 2610
 
2611 2611
 	/**
@@ -2657,14 +2657,14 @@  discard block
 block discarded – undo
2657 2657
 		$_path = explode('/', $path);
2658 2658
 		$_base = explode('/', $base_url);
2659 2659
 
2660
-		if(!$_base[count($_base) - 1])
2660
+		if (!$_base[count($_base) - 1])
2661 2661
 		{
2662 2662
 			array_pop($_base);
2663 2663
 		}
2664 2664
 
2665
-		foreach($_xe as $idx => $dir)
2665
+		foreach ($_xe as $idx => $dir)
2666 2666
 		{
2667
-			if($_path[0] != $dir)
2667
+			if ($_path[0] != $dir)
2668 2668
 			{
2669 2669
 				break;
2670 2670
 			}
@@ -2672,9 +2672,9 @@  discard block
 block discarded – undo
2672 2672
 		}
2673 2673
 
2674 2674
 		$idx = count($_xe) - $idx - 1;
2675
-		while($idx--)
2675
+		while ($idx--)
2676 2676
 		{
2677
-			if(count($_base) > 0)
2677
+			if (count($_base) > 0)
2678 2678
 			{
2679 2679
 				array_shift($_base);
2680 2680
 			}
@@ -2684,13 +2684,13 @@  discard block
 block discarded – undo
2684 2684
 			}
2685 2685
 		}
2686 2686
 
2687
-		if(count($_base) > 0)
2687
+		if (count($_base) > 0)
2688 2688
 		{
2689 2689
 			array_unshift($_path, join('/', $_base));
2690 2690
 		}
2691 2691
 
2692
-		$path = '/' . join('/', $_path);
2693
-		if(substr_compare($path, '/', -1) !== 0)
2692
+		$path = '/'.join('/', $_path);
2693
+		if (substr_compare($path, '/', -1) !== 0)
2694 2694
 		{
2695 2695
 			$path .= '/';
2696 2696
 		}
@@ -2705,13 +2705,13 @@  discard block
 block discarded – undo
2705 2705
 	{
2706 2706
 		$self = self::getInstance();
2707 2707
 
2708
-		if(!is_array($self->meta_tags))
2708
+		if (!is_array($self->meta_tags))
2709 2709
 		{
2710 2710
 			$self->meta_tags = array();
2711 2711
 		}
2712 2712
 
2713 2713
 		$ret = array();
2714
-		foreach($self->meta_tags as $key => $val)
2714
+		foreach ($self->meta_tags as $key => $val)
2715 2715
 		{
2716 2716
 			list($name, $is_http_equiv) = explode("\t", $key);
2717 2717
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2731,7 +2731,7 @@  discard block
 block discarded – undo
2731 2731
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2732 2732
 	{
2733 2733
 		$self = self::getInstance();
2734
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2734
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2735 2735
 	}
2736 2736
 
2737 2737
 }
Please login to merge, or discard this patch.
classes/db/DB.class.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -470,7 +470,7 @@
 block discarded – undo
470 470
 	 * set query debug log
471 471
 	 * @param array $log values set query debug
472 472
 	 * @return void
473
-	*/
473
+	 */
474 474
 	function setQueryLog($log)
475 475
 	{
476 476
 		$GLOBALS['__db_queries__'][] = $log;
Please login to merge, or discard this patch.
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
 	/**
492 492
 	 * Returns object of error info
493
-	 * @return object object of error
493
+	 * @return BaseObject object of error
494 494
 	 */
495 495
 	function getError()
496 496
 	{
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 * Returns counter cache data
668 668
 	 * @param array|string $tables tables to get data
669 669
 	 * @param string $condition condition to get data
670
-	 * @return int count of cache data
670
+	 * @return boolean count of cache data
671 671
 	 */
672 672
 	function getCountCache($tables, $condition)
673 673
 	{
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @param array|string $tables tables to save data
728 728
 	 * @param string $condition condition to save data
729 729
 	 * @param int $count count of cache data to save
730
-	 * @return void
730
+	 * @return boolean
731 731
 	 */
732 732
 	function putCountCache($tables, $condition, $count = 0)
733 733
 	{
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 	/**
811 811
 	 * Return select query string
812
-	 * @param object $query
812
+	 * @param BaseObject $query
813 813
 	 * @param boolean $with_values
814 814
 	 * @return string
815 815
 	 */
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 
904 904
 	/**
905 905
 	 * Return delete query string
906
-	 * @param object $query
906
+	 * @param BaseObject $query
907 907
 	 * @param boolean $with_values
908 908
 	 * @param boolean $with_priority
909 909
 	 * @return string
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 
936 936
 	/**
937 937
 	 * Return update query string
938
-	 * @param object $query
938
+	 * @param BaseObject $query
939 939
 	 * @param boolean $with_values
940 940
 	 * @param boolean $with_priority
941 941
 	 * @return string
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 
968 968
 	/**
969 969
 	 * Return insert query string
970
-	 * @param object $query
970
+	 * @param BaseObject $query
971 971
 	 * @param boolean $with_values
972 972
 	 * @param boolean $with_priority
973 973
 	 * @return string
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	 * DB Connect
1239 1239
 	 * this method is protected
1240 1240
 	 * @param array $connection
1241
-	 * @return void
1241
+	 * @return resource
1242 1242
 	 */
1243 1243
 	function __connect($connection)
1244 1244
 	{
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	function getInstance($db_type = NULL)
143 143
 	{
144
-		if(!$db_type)
144
+		if (!$db_type)
145 145
 		{
146 146
 			$db_type = Context::getDBType();
147 147
 		}
148
-		if(!$db_type && Context::isInstalled())
148
+		if (!$db_type && Context::isInstalled())
149 149
 		{
150 150
 			return new BaseObject(-1, 'msg_db_not_setted');
151 151
 		}
152 152
 
153
-		if(!isset($GLOBALS['__DB__']))
153
+		if (!isset($GLOBALS['__DB__']))
154 154
 		{
155 155
 			$GLOBALS['__DB__'] = array();
156 156
 		}
157
-		if(!isset($GLOBALS['__DB__'][$db_type]))
157
+		if (!isset($GLOBALS['__DB__'][$db_type]))
158 158
 		{
159
-			$class_name = 'DB' . ucfirst($db_type);
160
-			$class_file = _XE_PATH_ . "classes/db/$class_name.class.php";
161
-			if(!file_exists($class_file))
159
+			$class_name = 'DB'.ucfirst($db_type);
160
+			$class_file = _XE_PATH_."classes/db/$class_name.class.php";
161
+			if (!file_exists($class_file))
162 162
 			{
163 163
 				return new BaseObject(-1, 'msg_db_not_setted');
164 164
 			}
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function DB()
189 189
 	{
190
-		$this->count_cache_path = _XE_PATH_ . $this->count_cache_path;
191
-		$this->cache_file = _XE_PATH_ . $this->cache_file;
190
+		$this->count_cache_path = _XE_PATH_.$this->count_cache_path;
191
+		$this->cache_file = _XE_PATH_.$this->cache_file;
192 192
 	}
193 193
 
194 194
 	/**
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public static function getEnableList()
212 212
 	{
213
-		if(!self::$supported_list)
213
+		if (!self::$supported_list)
214 214
 		{
215 215
 			$oDB = new DB();
216 216
 			self::$supported_list = $oDB->_getSupportedList();
217 217
 		}
218 218
 
219 219
 		$enableList = array();
220
-		if(is_array(self::$supported_list))
220
+		if (is_array(self::$supported_list))
221 221
 		{
222
-			foreach(self::$supported_list AS $key => $value)
222
+			foreach (self::$supported_list AS $key => $value)
223 223
 			{
224
-				if($value->enable)
224
+				if ($value->enable)
225 225
 				{
226 226
 					$enableList[] = $value;
227 227
 				}
@@ -237,18 +237,18 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public static function getDisableList()
239 239
 	{
240
-		if(!self::$supported_list)
240
+		if (!self::$supported_list)
241 241
 		{
242 242
 			$oDB = new DB();
243 243
 			self::$supported_list = $oDB->_getSupportedList();
244 244
 		}
245 245
 
246 246
 		$disableList = array();
247
-		if(is_array(self::$supported_list))
247
+		if (is_array(self::$supported_list))
248 248
 		{
249
-			foreach(self::$supported_list AS $key => $value)
249
+			foreach (self::$supported_list AS $key => $value)
250 250
 			{
251
-				if(!$value->enable)
251
+				if (!$value->enable)
252 252
 				{
253 253
 					$disableList[] = $value;
254 254
 				}
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
 	function _getSupportedList()
266 266
 	{
267 267
 		static $get_supported_list = '';
268
-		if(is_array($get_supported_list))
268
+		if (is_array($get_supported_list))
269 269
 		{
270 270
 			self::$supported_list = $get_supported_list;
271 271
 			return self::$supported_list;
272 272
 		}
273 273
 		$get_supported_list = array();
274
-		$db_classes_path = _XE_PATH_ . "classes/db/";
274
+		$db_classes_path = _XE_PATH_."classes/db/";
275 275
 		$filter = "/^DB([^\.]+)\.class\.php/i";
276 276
 		$supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE);
277 277
 
278 278
 		// after creating instance of class, check is supported
279
-		for($i = 0; $i < count($supported_list); $i++)
279
+		for ($i = 0; $i < count($supported_list); $i++)
280 280
 		{
281 281
 			$db_type = $supported_list[$i];
282 282
 
283 283
 			$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1)));
284
-			$class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name);
285
-			if(!file_exists($class_file))
284
+			$class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name);
285
+			if (!file_exists($class_file))
286 286
 			{
287 287
 				continue;
288 288
 			}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			require_once($class_file);
292 292
 			$oDB = new $class_name(FALSE);
293 293
 
294
-			if(!$oDB)
294
+			if (!$oDB)
295 295
 			{
296 296
 				continue;
297 297
 			}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	function _sortDBMS($a, $b)
317 317
 	{
318
-		if(!isset($this->priority_dbms[$a->db_type]))
318
+		if (!isset($this->priority_dbms[$a->db_type]))
319 319
 		{
320 320
 			$priority_a = 0;
321 321
 		}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			$priority_a = $this->priority_dbms[$a->db_type];
325 325
 		}
326 326
 
327
-		if(!isset($this->priority_dbms[$b->db_type]))
327
+		if (!isset($this->priority_dbms[$b->db_type]))
328 328
 		{
329 329
 			$priority_b = 0;
330 330
 		}
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 			$priority_b = $this->priority_dbms[$b->db_type];
334 334
 		}
335 335
 
336
-		if($priority_a == $priority_b)
336
+		if ($priority_a == $priority_b)
337 337
 		{
338 338
 			return 0;
339 339
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 */
360 360
 	function isConnected($type = 'master', $indx = 0)
361 361
 	{
362
-		if($type == 'master')
362
+		if ($type == 'master')
363 363
 		{
364 364
 			return $this->master_db["is_connected"] ? TRUE : FALSE;
365 365
 		}
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	 */
389 389
 	function actFinish()
390 390
 	{
391
-		if(!$this->query)
391
+		if (!$this->query)
392 392
 		{
393 393
 			return;
394 394
 		}
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
 
410 410
 		$bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace();
411 411
 
412
-		foreach($bt as $no => $call)
412
+		foreach ($bt as $no => $call)
413 413
 		{
414
-			if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray')
414
+			if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray')
415 415
 			{
416 416
 				$call_no = $no;
417 417
 				$call_no++;
418 418
 				$log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line'];
419
-				$log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']);
419
+				$log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']);
420 420
 				$call_no++;
421 421
 				$log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function'];
422 422
 				break;
@@ -424,22 +424,22 @@  discard block
 block discarded – undo
424 424
 		}
425 425
 
426 426
 		// leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined)
427
-		if($this->isError())
427
+		if ($this->isError())
428 428
 		{
429 429
 			$log['result'] = 'Failed';
430 430
 			$log['errno'] = $this->errno;
431 431
 			$log['errstr'] = $this->errstr;
432 432
 
433
-			if(__DEBUG_DB_OUTPUT__ == 1)
433
+			if (__DEBUG_DB_OUTPUT__ == 1)
434 434
 			{
435
-				$debug_file = _XE_PATH_ . "files/_debug_db_query.php";
435
+				$debug_file = _XE_PATH_."files/_debug_db_query.php";
436 436
 				$buff = array();
437
-				if(!file_exists($debug_file))
437
+				if (!file_exists($debug_file))
438 438
 				{
439
-					$buff[] = '<?php exit(); ?' . '>';
439
+					$buff[] = '<?php exit(); ?'.'>';
440 440
 				}
441 441
 				$buff[] = print_r($log, TRUE);
442
-				@file_put_contents($debug_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX);
442
+				@file_put_contents($debug_file, implode("\n", $buff)."\n\n", FILE_APPEND | LOCK_EX);
443 443
 			}
444 444
 		}
445 445
 		else
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		$log_args = new stdClass;
453 453
 		$log_args->query = $this->query;
454 454
 		$log_args->query_id = $this->query_id;
455
-		$log_args->caller = $log['called_method'] . '() in ' . $log['called_file'];
455
+		$log_args->caller = $log['called_method'].'() in '.$log['called_file'];
456 456
 		$log_args->connection = $log['connection'];
457 457
 		writeSlowlog('query', $elapsed_time, $log_args);
458 458
 	}
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	{
511 511
 		static $cache_file = array();
512 512
 
513
-		if(!$query_id)
513
+		if (!$query_id)
514 514
 		{
515 515
 			return new BaseObject(-1, 'msg_invalid_queryid');
516 516
 		}
517
-		if(!$this->db_type)
517
+		if (!$this->db_type)
518 518
 		{
519 519
 			return;
520 520
 		}
@@ -523,20 +523,20 @@  discard block
 block discarded – undo
523 523
 
524 524
 		$this->query_id = $query_id;
525 525
 
526
-		if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id]))
526
+		if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id]))
527 527
 		{
528 528
 			$id_args = explode('.', $query_id);
529
-			if(count($id_args) == 2)
529
+			if (count($id_args) == 2)
530 530
 			{
531 531
 				$target = 'modules';
532 532
 				$module = $id_args[0];
533 533
 				$id = $id_args[1];
534 534
 			}
535
-			elseif(count($id_args) == 3)
535
+			elseif (count($id_args) == 3)
536 536
 			{
537 537
 				$target = $id_args[0];
538 538
 				$typeList = array('addons' => 1, 'widgets' => 1);
539
-				if(!isset($typeList[$target]))
539
+				if (!isset($typeList[$target]))
540 540
 				{
541 541
 					$this->actDBClassFinish();
542 542
 					return;
@@ -544,14 +544,14 @@  discard block
 block discarded – undo
544 544
 				$module = $id_args[1];
545 545
 				$id = $id_args[2];
546 546
 			}
547
-			if(!$target || !$module || !$id)
547
+			if (!$target || !$module || !$id)
548 548
 			{
549 549
 				$this->actDBClassFinish();
550 550
 				return new BaseObject(-1, 'msg_invalid_queryid');
551 551
 			}
552 552
 
553 553
 			$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
554
-			if(!file_exists($xml_file))
554
+			if (!file_exists($xml_file))
555 555
 			{
556 556
 				$this->actDBClassFinish();
557 557
 				return new BaseObject(-1, 'msg_invalid_queryid');
@@ -579,13 +579,13 @@  discard block
 block discarded – undo
579 579
 		$cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type);
580 580
 
581 581
 		$cache_time = -1;
582
-		if(file_exists($cache_file))
582
+		if (file_exists($cache_file))
583 583
 		{
584 584
 			$cache_time = filemtime($cache_file);
585 585
 		}
586 586
 
587 587
 		// if there is no cache file or is not new, find original xml query file and parse it
588
-		if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php'))
588
+		if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_.'classes/xml/XmlQueryParser.class.php'))
589 589
 		{
590 590
 			$oParser = new XmlQueryParser();
591 591
 			$oParser->parse($query_id, $xml_file, $cache_file);
@@ -606,27 +606,27 @@  discard block
 block discarded – undo
606 606
 	{
607 607
 		global $lang;
608 608
 		
609
-		if(!in_array($type, array('master','slave'))) $type = 'slave';
609
+		if (!in_array($type, array('master', 'slave'))) $type = 'slave';
610 610
 
611
-		if(!file_exists($cache_file))
611
+		if (!file_exists($cache_file))
612 612
 		{
613 613
 			return new BaseObject(-1, 'msg_invalid_queryid');
614 614
 		}
615 615
 
616
-		if($source_args)
616
+		if ($source_args)
617 617
 		{
618 618
 			$args = clone $source_args;
619 619
 		}
620 620
 
621 621
 		$output = include($cache_file);
622 622
 
623
-		if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool())
623
+		if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool())
624 624
 		{
625 625
 			return $output;
626 626
 		}
627 627
 
628 628
 		// execute appropriate query
629
-		switch($output->getAction())
629
+		switch ($output->getAction())
630 630
 		{
631 631
 			case 'insert' :
632 632
 			case 'insert-select' :
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
 				break;
650 650
 		}
651 651
 
652
-		if($this->isError())
652
+		if ($this->isError())
653 653
 		{
654 654
 			$output = $this->getError();
655 655
 		}
656
-		else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject'))
656
+		else if (!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject'))
657 657
 		{
658 658
 			$output = new BaseObject();
659 659
 		}
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	 */
800 800
 	function dropTable($table_name)
801 801
 	{
802
-		if(!$table_name)
802
+		if (!$table_name)
803 803
 		{
804 804
 			return;
805 805
 		}
@@ -816,59 +816,59 @@  discard block
 block discarded – undo
816 816
 	function getSelectSql($query, $with_values = TRUE)
817 817
 	{
818 818
 		$select = $query->getSelectString($with_values);
819
-		if($select == '')
819
+		if ($select == '')
820 820
 		{
821 821
 			return new BaseObject(-1, "Invalid query");
822 822
 		}
823
-		$select = 'SELECT ' . $select;
823
+		$select = 'SELECT '.$select;
824 824
 
825 825
 		$from = $query->getFromString($with_values);
826
-		if($from == '')
826
+		if ($from == '')
827 827
 		{
828 828
 			return new BaseObject(-1, "Invalid query");
829 829
 		}
830
-		$from = ' FROM ' . $from;
830
+		$from = ' FROM '.$from;
831 831
 
832 832
 		$where = $query->getWhereString($with_values);
833
-		if($where != '')
833
+		if ($where != '')
834 834
 		{
835
-			$where = ' WHERE ' . $where;
835
+			$where = ' WHERE '.$where;
836 836
 		}
837 837
 
838 838
 		$tableObjects = $query->getTables();
839 839
 		$index_hint_list = '';
840
-		foreach($tableObjects as $tableObject)
840
+		foreach ($tableObjects as $tableObject)
841 841
 		{
842
-			if(is_a($tableObject, 'CubridTableWithHint'))
842
+			if (is_a($tableObject, 'CubridTableWithHint'))
843 843
 			{
844
-				$index_hint_list .= $tableObject->getIndexHintString() . ', ';
844
+				$index_hint_list .= $tableObject->getIndexHintString().', ';
845 845
 			}
846 846
 		}
847 847
 		$index_hint_list = substr($index_hint_list, 0, -2);
848
-		if($index_hint_list != '')
848
+		if ($index_hint_list != '')
849 849
 		{
850
-			$index_hint_list = 'USING INDEX ' . $index_hint_list;
850
+			$index_hint_list = 'USING INDEX '.$index_hint_list;
851 851
 		}
852 852
 
853 853
 		$groupBy = $query->getGroupByString();
854
-		if($groupBy != '')
854
+		if ($groupBy != '')
855 855
 		{
856
-			$groupBy = ' GROUP BY ' . $groupBy;
856
+			$groupBy = ' GROUP BY '.$groupBy;
857 857
 		}
858 858
 
859 859
 		$orderBy = $query->getOrderByString();
860
-		if($orderBy != '')
860
+		if ($orderBy != '')
861 861
 		{
862
-			$orderBy = ' ORDER BY ' . $orderBy;
862
+			$orderBy = ' ORDER BY '.$orderBy;
863 863
 		}
864 864
 
865 865
 		$limit = $query->getLimitString();
866
-		if($limit != '')
866
+		if ($limit != '')
867 867
 		{
868
-			$limit = ' LIMIT ' . $limit;
868
+			$limit = ' LIMIT '.$limit;
869 869
 		}
870 870
 
871
-		return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
871
+		return $select.' '.$from.' '.$where.' '.$index_hint_list.' '.$groupBy.' '.$orderBy.' '.$limit;
872 872
 	}
873 873
 
874 874
 	/**
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	{
887 887
 		$new_update_columns = array();
888 888
 		$click_count_columns = $queryObject->getClickCountColumns();
889
-		foreach($click_count_columns as $click_count_column)
889
+		foreach ($click_count_columns as $click_count_column)
890 890
 		{
891 891
 			$click_count_column_name = $click_count_column->column_name;
892 892
 
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
 		$sql .= $tables[0]->getAlias();
919 919
 
920 920
 		$from = $query->getFromString($with_values);
921
-		if($from == '')
921
+		if ($from == '')
922 922
 		{
923 923
 			return new BaseObject(-1, "Invalid query");
924 924
 		}
925
-		$sql .= ' FROM ' . $from;
925
+		$sql .= ' FROM '.$from;
926 926
 
927 927
 		$where = $query->getWhereString($with_values);
928
-		if($where != '')
928
+		if ($where != '')
929 929
 		{
930
-			$sql .= ' WHERE ' . $where;
930
+			$sql .= ' WHERE '.$where;
931 931
 		}
932 932
 
933 933
 		return $sql;
@@ -943,26 +943,26 @@  discard block
 block discarded – undo
943 943
 	function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE)
944 944
 	{
945 945
 		$columnsList = $query->getUpdateString($with_values);
946
-		if($columnsList == '')
946
+		if ($columnsList == '')
947 947
 		{
948 948
 			return new BaseObject(-1, "Invalid query");
949 949
 		}
950 950
 
951 951
 		$tables = $query->getFromString($with_values);
952
-		if($tables == '')
952
+		if ($tables == '')
953 953
 		{
954 954
 			return new BaseObject(-1, "Invalid query");
955 955
 		}
956 956
 
957 957
 		$where = $query->getWhereString($with_values);
958
-		if($where != '')
958
+		if ($where != '')
959 959
 		{
960
-			$where = ' WHERE ' . $where;
960
+			$where = ' WHERE '.$where;
961 961
 		}
962 962
 
963 963
 		$priority = $with_priority ? $query->getPriority() : '';
964 964
 
965
-		return "UPDATE $priority $tables SET $columnsList " . $where;
965
+		return "UPDATE $priority $tables SET $columnsList ".$where;
966 966
 	}
967 967
 
968 968
 	/**
@@ -1000,27 +1000,27 @@  discard block
 block discarded – undo
1000 1000
 	 */
1001 1001
 	function _getConnection($type = 'master', $indx = NULL)
1002 1002
 	{
1003
-		if($type == 'master')
1003
+		if ($type == 'master')
1004 1004
 		{
1005
-			if(!$this->master_db['is_connected'])
1005
+			if (!$this->master_db['is_connected'])
1006 1006
 			{
1007 1007
 				$this->_connect($type);
1008 1008
 			}
1009
-			$this->connection = 'Master ' . $this->master_db['db_hostname'];
1009
+			$this->connection = 'Master '.$this->master_db['db_hostname'];
1010 1010
 			return $this->master_db["resource"];
1011 1011
 		}
1012 1012
 
1013
-		if($indx === NULL)
1013
+		if ($indx === NULL)
1014 1014
 		{
1015 1015
 			$indx = $this->_getSlaveConnectionStringIndex($type);
1016 1016
 		}
1017 1017
 
1018
-		if(!$this->slave_db[$indx]['is_connected'])
1018
+		if (!$this->slave_db[$indx]['is_connected'])
1019 1019
 		{
1020 1020
 			$this->_connect($type, $indx);
1021 1021
 		}
1022 1022
 
1023
-		$this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname'];
1023
+		$this->connection = 'Slave '.$this->slave_db[$indx]['db_hostname'];
1024 1024
 		return $this->slave_db[$indx]["resource"];
1025 1025
 	}
1026 1026
 
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
1030 1030
 	 */
1031 1031
 	function _dbInfoExists()
1032 1032
 	{
1033
-		if(!$this->master_db)
1033
+		if (!$this->master_db)
1034 1034
 		{
1035 1035
 			return FALSE;
1036 1036
 		}
1037
-		if(count($this->slave_db) === 0)
1037
+		if (count($this->slave_db) === 0)
1038 1038
 		{
1039 1039
 			return FALSE;
1040 1040
 		}
@@ -1060,12 +1060,12 @@  discard block
 block discarded – undo
1060 1060
 	 */
1061 1061
 	function close($type = 'master', $indx = 0)
1062 1062
 	{
1063
-		if(!$this->isConnected($type, $indx))
1063
+		if (!$this->isConnected($type, $indx))
1064 1064
 		{
1065 1065
 			return;
1066 1066
 		}
1067 1067
 
1068
-		if($type == 'master')
1068
+		if ($type == 'master')
1069 1069
 		{
1070 1070
 			$connection = &$this->master_db;
1071 1071
 		}
@@ -1096,12 +1096,12 @@  discard block
 block discarded – undo
1096 1096
 	 */
1097 1097
 	function begin()
1098 1098
 	{
1099
-		if(!$this->isConnected())
1099
+		if (!$this->isConnected())
1100 1100
 		{
1101 1101
 			return;
1102 1102
 		}
1103 1103
 
1104
-		if($this->_begin($this->transactionNestedLevel))
1104
+		if ($this->_begin($this->transactionNestedLevel))
1105 1105
 		{
1106 1106
 			$this->transaction_started = TRUE;
1107 1107
 			$this->transactionNestedLevel++;
@@ -1124,15 +1124,15 @@  discard block
 block discarded – undo
1124 1124
 	 */
1125 1125
 	function rollback()
1126 1126
 	{
1127
-		if(!$this->isConnected() || !$this->transaction_started)
1127
+		if (!$this->isConnected() || !$this->transaction_started)
1128 1128
 		{
1129 1129
 			return;
1130 1130
 		}
1131
-		if($this->_rollback($this->transactionNestedLevel))
1131
+		if ($this->_rollback($this->transactionNestedLevel))
1132 1132
 		{
1133 1133
 			$this->transactionNestedLevel--;
1134 1134
 
1135
-			if(!$this->transactionNestedLevel)
1135
+			if (!$this->transactionNestedLevel)
1136 1136
 			{
1137 1137
 				$this->transaction_started = FALSE;
1138 1138
 			}
@@ -1156,11 +1156,11 @@  discard block
 block discarded – undo
1156 1156
 	 */
1157 1157
 	function commit($force = FALSE)
1158 1158
 	{
1159
-		if(!$force && (!$this->isConnected() || !$this->transaction_started))
1159
+		if (!$force && (!$this->isConnected() || !$this->transaction_started))
1160 1160
 		{
1161 1161
 			return;
1162 1162
 		}
1163
-		if($this->transactionNestedLevel == 1 && $this->_commit())
1163
+		if ($this->transactionNestedLevel == 1 && $this->_commit())
1164 1164
 		{
1165 1165
 			$this->transaction_started = FALSE;
1166 1166
 			$this->transactionNestedLevel = 0;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	 */
1193 1193
 	function _query($query, $connection = NULL)
1194 1194
 	{
1195
-		if($connection == NULL)
1195
+		if ($connection == NULL)
1196 1196
 		{
1197 1197
 			$connection = $this->_getConnection('master');
1198 1198
 		}
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 	{
1218 1218
 		$db_info = Context::getDBInfo();
1219 1219
 		$this->master_db = $db_info->master_db;
1220
-		if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"]
1220
+		if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"]
1221 1221
 				&& $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"]
1222 1222
 				&& $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"]
1223 1223
 				&& $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"]
@@ -1265,18 +1265,18 @@  discard block
 block discarded – undo
1265 1265
 	 */
1266 1266
 	function _connect($type = 'master', $indx = 0)
1267 1267
 	{
1268
-		if($this->isConnected($type, $indx))
1268
+		if ($this->isConnected($type, $indx))
1269 1269
 		{
1270 1270
 			return;
1271 1271
 		}
1272 1272
 
1273 1273
 		// Ignore if no DB information exists
1274
-		if(!$this->_dbInfoExists())
1274
+		if (!$this->_dbInfoExists())
1275 1275
 		{
1276 1276
 			return;
1277 1277
 		}
1278 1278
 
1279
-		if($type == 'master')
1279
+		if ($type == 'master')
1280 1280
 		{
1281 1281
 			$connection = &$this->master_db;
1282 1282
 		}
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		}
1287 1287
 
1288 1288
 		$result = $this->__connect($connection);
1289
-		if($result === NULL || $result === FALSE)
1289
+		if ($result === NULL || $result === FALSE)
1290 1290
 		{
1291 1291
 			$connection["is_connected"] = FALSE;
1292 1292
 			return;
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 		$connection["is_connected"] = TRUE;
1298 1298
 
1299 1299
 		// Save connection info for db logs
1300
-		$this->connection = ucfirst($type) . ' ' . $connection["db_hostname"];
1300
+		$this->connection = ucfirst($type).' '.$connection["db_hostname"];
1301 1301
 
1302 1302
 		// regist $this->close callback
1303 1303
 		register_shutdown_function(array($this, "close"));
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
 	 */
1323 1323
 	function actDBClassFinish()
1324 1324
 	{
1325
-		if(!$this->query)
1325
+		if (!$this->query)
1326 1326
 		{
1327 1327
 			return;
1328 1328
 		}
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 	function getParser($force = FALSE)
1346 1346
 	{
1347 1347
 		static $dbParser = NULL;
1348
-		if(!$dbParser || $force)
1348
+		if (!$dbParser || $force)
1349 1349
 		{
1350 1350
 			$oDB = DB::getInstance();
1351 1351
 			$dbParser = $oDB->getParser();
Please login to merge, or discard this patch.
Braces   +13 added lines, -21 removed lines patch added patch discarded remove patch
@@ -318,8 +318,7 @@  discard block
 block discarded – undo
318 318
 		if(!isset($this->priority_dbms[$a->db_type]))
319 319
 		{
320 320
 			$priority_a = 0;
321
-		}
322
-		else
321
+		} else
323 322
 		{
324 323
 			$priority_a = $this->priority_dbms[$a->db_type];
325 324
 		}
@@ -327,8 +326,7 @@  discard block
 block discarded – undo
327 326
 		if(!isset($this->priority_dbms[$b->db_type]))
328 327
 		{
329 328
 			$priority_b = 0;
330
-		}
331
-		else
329
+		} else
332 330
 		{
333 331
 			$priority_b = $this->priority_dbms[$b->db_type];
334 332
 		}
@@ -362,8 +360,7 @@  discard block
 block discarded – undo
362 360
 		if($type == 'master')
363 361
 		{
364 362
 			return $this->master_db["is_connected"] ? TRUE : FALSE;
365
-		}
366
-		else
363
+		} else
367 364
 		{
368 365
 			return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE;
369 366
 		}
@@ -441,8 +438,7 @@  discard block
 block discarded – undo
441 438
 				$buff[] = print_r($log, TRUE);
442 439
 				@file_put_contents($debug_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX);
443 440
 			}
444
-		}
445
-		else
441
+		} else
446 442
 		{
447 443
 			$log['result'] = 'Success';
448 444
 		}
@@ -531,8 +527,7 @@  discard block
 block discarded – undo
531 527
 				$target = 'modules';
532 528
 				$module = $id_args[0];
533 529
 				$id = $id_args[1];
534
-			}
535
-			elseif(count($id_args) == 3)
530
+			} elseif(count($id_args) == 3)
536 531
 			{
537 532
 				$target = $id_args[0];
538 533
 				$typeList = array('addons' => 1, 'widgets' => 1);
@@ -606,7 +601,9 @@  discard block
 block discarded – undo
606 601
 	{
607 602
 		global $lang;
608 603
 		
609
-		if(!in_array($type, array('master','slave'))) $type = 'slave';
604
+		if(!in_array($type, array('master','slave'))) {
605
+			$type = 'slave';
606
+		}
610 607
 
611 608
 		if(!file_exists($cache_file))
612 609
 		{
@@ -652,8 +649,7 @@  discard block
 block discarded – undo
652 649
 		if($this->isError())
653 650
 		{
654 651
 			$output = $this->getError();
655
-		}
656
-		else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject'))
652
+		} else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject'))
657 653
 		{
658 654
 			$output = new BaseObject();
659 655
 		}
@@ -1068,8 +1064,7 @@  discard block
 block discarded – undo
1068 1064
 		if($type == 'master')
1069 1065
 		{
1070 1066
 			$connection = &$this->master_db;
1071
-		}
1072
-		else
1067
+		} else
1073 1068
 		{
1074 1069
 			$connection = &$this->slave_db[$indx];
1075 1070
 		}
@@ -1164,8 +1159,7 @@  discard block
 block discarded – undo
1164 1159
 		{
1165 1160
 			$this->transaction_started = FALSE;
1166 1161
 			$this->transactionNestedLevel = 0;
1167
-		}
1168
-		else
1162
+		} else
1169 1163
 		{
1170 1164
 			$this->transactionNestedLevel--;
1171 1165
 		}
@@ -1225,8 +1219,7 @@  discard block
 block discarded – undo
1225 1219
 		)
1226 1220
 		{
1227 1221
 			$this->slave_db[0] = &$this->master_db;
1228
-		}
1229
-		else
1222
+		} else
1230 1223
 		{
1231 1224
 			$this->slave_db = $db_info->slave_db;
1232 1225
 		}
@@ -1279,8 +1272,7 @@  discard block
 block discarded – undo
1279 1272
 		if($type == 'master')
1280 1273
 		{
1281 1274
 			$connection = &$this->master_db;
1282
-		}
1283
-		else
1275
+		} else
1284 1276
 		{
1285 1277
 			$connection = &$this->slave_db[$indx];
1286 1278
 		}
Please login to merge, or discard this patch.
classes/db/queryparts/condition/ConditionGroup.class.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
 		if(count($this->conditions) === 0)
43 43
 		{
44 44
 			$this->_show = false;
45
-		}
46
-		else
45
+		} else
47 46
 		{
48 47
 			$this->_show = true;
49 48
 		}
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	function ConditionGroup($conditions, $pipe = "")
33 33
 	{
34 34
 		$this->conditions = array();
35
-		foreach($conditions as $condition)
35
+		foreach ($conditions as $condition)
36 36
 		{
37
-			if($condition->show())
37
+			if ($condition->show())
38 38
 			{
39 39
 				$this->conditions[] = $condition;
40 40
 			}
41 41
 		}
42
-		if(count($this->conditions) === 0)
42
+		if (count($this->conditions) === 0)
43 43
 		{
44 44
 			$this->_show = false;
45 45
 		}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 	function setPipe($pipe)
60 60
 	{
61
-		if($this->pipe !== $pipe)
61
+		if ($this->pipe !== $pipe)
62 62
 		{
63 63
 			$this->_group = null;
64 64
 		}
@@ -72,24 +72,24 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	function toString($with_value = true)
74 74
 	{
75
-		if(!isset($this->_group))
75
+		if (!isset($this->_group))
76 76
 		{
77 77
 			$cond_indx = 0;
78 78
 			$group = '';
79 79
 
80
-			foreach($this->conditions as $condition)
80
+			foreach ($this->conditions as $condition)
81 81
 			{
82
-				if($cond_indx === 0)
82
+				if ($cond_indx === 0)
83 83
 				{
84 84
 					$condition->setPipe("");
85 85
 				}
86
-				$group .= $condition->toString($with_value) . ' ';
86
+				$group .= $condition->toString($with_value).' ';
87 87
 				$cond_indx++;
88 88
 			}
89 89
 
90
-			if($this->pipe !== "" && trim($group) !== '')
90
+			if ($this->pipe !== "" && trim($group) !== '')
91 91
 			{
92
-				$group = $this->pipe . ' (' . $group . ')';
92
+				$group = $this->pipe.' ('.$group.')';
93 93
 			}
94 94
 
95 95
 			$this->_group = $group;
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	function getArguments()
105 105
 	{
106 106
 		$args = array();
107
-		foreach($this->conditions as $condition)
107
+		foreach ($this->conditions as $condition)
108 108
 		{
109 109
 			$arg = $condition->getArgument();
110
-			if($arg)
110
+			if ($arg)
111 111
 			{
112 112
 				$args[] = $arg;
113 113
 			}
Please login to merge, or discard this patch.
classes/db/queryparts/condition/ConditionWithArgument.class.php 2 patches
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 	function getArgument()
32 32
 	{
33
-		if(!$this->show())
34
-			return;
33
+		if(!$this->show()) {
34
+					return;
35
+		}
35 36
 		return $this->argument;
36 37
 	}
37 38
 
@@ -55,15 +56,13 @@  discard block
 block discarded – undo
55 56
 				$q = substr($q, 0, -1);
56 57
 			}
57 58
 			$q = '(' . $q . ')';
58
-		}
59
-		else
59
+		} else
60 60
 		{
61 61
 			// Prepared statements: column names should not be sent as query arguments, but instead concatenated to query string
62 62
 			if($this->argument->isColumnName())
63 63
 			{
64 64
 				$q = $value;
65
-			}
66
-			else
65
+			} else
67 66
 			{
68 67
 				$q = '?';
69 68
 			}
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function ConditionWithArgument($column_name, $argument, $operation, $pipe = "")
21 21
 	{
22
-		if($argument === null)
22
+		if ($argument === null)
23 23
 		{
24 24
 			$this->_show = false;
25 25
 			return;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 	function getArgument()
32 32
 	{
33
-		if(!$this->show())
33
+		if (!$this->show())
34 34
 			return;
35 35
 		return $this->argument;
36 36
 	}
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 	{
44 44
 		$value = $this->argument->getUnescapedValue();
45 45
 
46
-		if(is_array($value))
46
+		if (is_array($value))
47 47
 		{
48 48
 			$q = '';
49
-			foreach($value as $v)
49
+			foreach ($value as $v)
50 50
 			{
51 51
 				$q .= '?,';
52 52
 			}
53
-			if($q !== '')
53
+			if ($q !== '')
54 54
 			{
55 55
 				$q = substr($q, 0, -1);
56 56
 			}
57
-			$q = '(' . $q . ')';
57
+			$q = '('.$q.')';
58 58
 		}
59 59
 		else
60 60
 		{
61 61
 			// Prepared statements: column names should not be sent as query arguments, but instead concatenated to query string
62
-			if($this->argument->isColumnName())
62
+			if ($this->argument->isColumnName())
63 63
 			{
64 64
 				$q = $value;
65 65
 			}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$q = '?';
69 69
 			}
70 70
 		}
71
-		return $this->pipe . ' ' . $this->getConditionPart($q);
71
+		return $this->pipe.' '.$this->getConditionPart($q);
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	function show()
78 78
 	{
79
-		if(!isset($this->_show))
79
+		if (!isset($this->_show))
80 80
 		{
81
-			if(!$this->argument->isValid())
81
+			if (!$this->argument->isValid())
82 82
 			{
83 83
 				$this->_show = false;
84 84
 			}
85
-			if($this->_value === '\'\'')
85
+			if ($this->_value === '\'\'')
86 86
 			{
87 87
 				$this->_show = false;
88 88
 			}
89
-			if(!isset($this->_show))
89
+			if (!isset($this->_show))
90 90
 			{
91 91
 				return parent::show();
92 92
 			}
Please login to merge, or discard this patch.
classes/db/queryparts/expression/ClickCountExpression.class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		parent::SelectExpression($column_name, $alias);
29 29
 
30
-		if(!is_bool($click_count))
30
+		if (!is_bool($click_count))
31 31
 		{
32 32
 			// error_log("Click_count value for $column_name was not boolean", 0);
33 33
 			$this->click_count = false;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	function getExpression()
48 48
 	{
49 49
 		$db_type = Context::getDBType();
50
-		if($db_type == 'cubrid')
50
+		if ($db_type == 'cubrid')
51 51
 		{
52 52
 			return "INCR($this->column_name)";
53 53
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
 		if($db_type == 'cubrid')
51 51
 		{
52 52
 			return "INCR($this->column_name)";
53
-		}
54
-		else
53
+		} else
55 54
 		{
56 55
 			return "$this->column_name";
57 56
 		}
Please login to merge, or discard this patch.
classes/db/queryparts/expression/InsertExpression.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 	function getValue($with_values = true)
33 33
 	{
34
-		if($with_values)
34
+		if ($with_values)
35 35
 		{
36 36
 			return $this->argument->getValue();
37 37
 		}
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 
41 41
 	function show()
42 42
 	{
43
-		if(!$this->argument)
43
+		if (!$this->argument)
44 44
 		{
45 45
 			return false;
46 46
 		}
47 47
 		$value = $this->argument->getValue();
48
-		if(!isset($value))
48
+		if (!isset($value))
49 49
 		{
50 50
 			return false;
51 51
 		}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 	function getArguments()
61 61
 	{
62
-		if($this->argument)
62
+		if ($this->argument)
63 63
 		{
64 64
 			return array($this->argument);
65 65
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
62 62
 		if($this->argument)
63 63
 		{
64 64
 			return array($this->argument);
65
-		}
66
-		else
65
+		} else
67 66
 		{
68 67
 			return array();
69 68
 		}
Please login to merge, or discard this patch.
classes/db/queryparts/order/OrderByColumn.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@
 block discarded – undo
59 59
 	function getArguments()
60 60
 	{
61 61
 		$args = array();
62
-		if(is_a($this->column_name, 'Argument'))
62
+		if (is_a($this->column_name, 'Argument'))
63 63
 		{
64 64
 			$args[] = $this->column_name;
65 65
 		}
66
-		if(is_a($this->sort_order, 'Argument'))
66
+		if (is_a($this->sort_order, 'Argument'))
67 67
 		{
68 68
 			$args[] = $this->sort_order;
69 69
 		}
Please login to merge, or discard this patch.
classes/db/queryparts/table/MysqlTableWithHint.class.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,12 +53,10 @@
 block discarded – undo
53 53
 			if($index_hint_type == 'USE')
54 54
 			{
55 55
 				$use_index_hint .= $index_hint->getIndexName() . ', ';
56
-			}
57
-			else if($index_hint_type == 'FORCE')
56
+			} else if($index_hint_type == 'FORCE')
58 57
 			{
59 58
 				$force_index_hint .= $index_hint->getIndexName() . ', ';
60
-			}
61
-			else if($index_hint_type == 'IGNORE')
59
+			} else if($index_hint_type == 'IGNORE')
62 60
 			{
63 61
 				$ignore_index_hint .= $index_hint->getIndexName() . ', ';
64 62
 			}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,33 +47,33 @@
 block discarded – undo
47 47
 		$use_index_hint = '';
48 48
 		$force_index_hint = '';
49 49
 		$ignore_index_hint = '';
50
-		foreach($this->index_hints_list as $index_hint)
50
+		foreach ($this->index_hints_list as $index_hint)
51 51
 		{
52 52
 			$index_hint_type = $index_hint->getIndexHintType();
53
-			if($index_hint_type == 'USE')
53
+			if ($index_hint_type == 'USE')
54 54
 			{
55
-				$use_index_hint .= $index_hint->getIndexName() . ', ';
55
+				$use_index_hint .= $index_hint->getIndexName().', ';
56 56
 			}
57
-			else if($index_hint_type == 'FORCE')
57
+			else if ($index_hint_type == 'FORCE')
58 58
 			{
59
-				$force_index_hint .= $index_hint->getIndexName() . ', ';
59
+				$force_index_hint .= $index_hint->getIndexName().', ';
60 60
 			}
61
-			else if($index_hint_type == 'IGNORE')
61
+			else if ($index_hint_type == 'IGNORE')
62 62
 			{
63
-				$ignore_index_hint .= $index_hint->getIndexName() . ', ';
63
+				$ignore_index_hint .= $index_hint->getIndexName().', ';
64 64
 			}
65 65
 		}
66
-		if($use_index_hint != '')
66
+		if ($use_index_hint != '')
67 67
 		{
68
-			$result .= ' USE INDEX (' . substr($use_index_hint, 0, -2) . ') ';
68
+			$result .= ' USE INDEX ('.substr($use_index_hint, 0, -2).') ';
69 69
 		}
70
-		if($force_index_hint != '')
70
+		if ($force_index_hint != '')
71 71
 		{
72
-			$result .= ' FORCE INDEX (' . substr($force_index_hint, 0, -2) . ') ';
72
+			$result .= ' FORCE INDEX ('.substr($force_index_hint, 0, -2).') ';
73 73
 		}
74
-		if($ignore_index_hint != '')
74
+		if ($ignore_index_hint != '')
75 75
 		{
76
-			$result .= ' IGNORE INDEX (' . substr($ignore_index_hint, 0, -2) . ') ';
76
+			$result .= ' IGNORE INDEX ('.substr($ignore_index_hint, 0, -2).') ';
77 77
 		}
78 78
 		return $result;
79 79
 	}
Please login to merge, or discard this patch.
classes/editor/EditorHandler.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
 	{
21 21
 		Context::set('component_info', $info);
22 22
 
23
-		if(!$info->extra_vars)
23
+		if (!$info->extra_vars)
24 24
 		{
25 25
 			return;
26 26
 		}
27 27
 
28
-		foreach($info->extra_vars as $key => $val)
28
+		foreach ($info->extra_vars as $key => $val)
29 29
 		{
30 30
 			$this->{$key} = trim($val->value);
31 31
 		}
Please login to merge, or discard this patch.