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 (#1814)
by
unknown
13:24 queued 02:11
created
addons/captcha_member/captcha_member.addon.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -286,6 +286,9 @@
 block discarded – undo
286 286
 			exit();
287 287
 		}
288 288
 
289
+		/**
290
+		 * @param string $string
291
+		 */
289 292
 		function createCaptchaAudio($string)
290 293
 		{
291 294
 			$data = '';
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined("__XE__")) exit();
4
+if (!defined("__XE__")) exit();
5 5
 
6 6
 /**
7 7
  * @file captcha.addon.php
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  * @brief Captcha for a particular action
10 10
  * English alphabets and voice verification added
11 11
  * */
12
-if(!class_exists('AddonMemberCaptcha', false))
12
+if (!class_exists('AddonMemberCaptcha', false))
13 13
 {
14 14
 	// On the mobile mode, XE Core does not load jquery and xe.js as normal.
15
-	if(Mobile::isFromMobilePhone())
15
+	if (Mobile::isFromMobilePhone())
16 16
 	{
17 17
 		Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true);
18 18
 		Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true);
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		function before_module_init(&$ModuleHandler)
40 40
 		{
41 41
 			$logged_info = Context::get('logged_info');
42
-			if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
42
+			if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
43 43
 			{
44 44
 				return false;
45 45
 			}
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 			// {
48 48
 			// 	return false;
49 49
 			// }
50
-			if($_SESSION['XE_VALIDATOR_ERROR'] == -1)
50
+			if ($_SESSION['XE_VALIDATOR_ERROR'] == -1)
51 51
 			{
52 52
 				$_SESSION['member_captcha_authed'] = false;
53 53
 			}
54
-			if($_SESSION['member_captcha_authed'])
54
+			if ($_SESSION['member_captcha_authed'])
55 55
 			{
56 56
 				return false;
57 57
 			}
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
 			$type = Context::get('captchaType');
60 60
 
61 61
 			$this->target_acts = array();
62
-			if($this->addon_info->apply_find_account == 'apply')
62
+			if ($this->addon_info->apply_find_account == 'apply')
63 63
 			{
64 64
 				$this->target_acts[] = 'procMemberFindAccount';
65 65
 			}
66
-			if($this->addon_info->apply_resend_auth_mail == 'apply')
66
+			if ($this->addon_info->apply_resend_auth_mail == 'apply')
67 67
 			{
68 68
 				$this->target_acts[] = 'procMemberResendAuthMail';
69 69
 			}
70
-			if($this->addon_info->apply_signup == 'apply')
70
+			if ($this->addon_info->apply_signup == 'apply')
71 71
 			{
72 72
 				$this->target_acts[] = 'procMemberInsert';
73 73
 			}
74 74
 
75
-			if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
75
+			if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
76 76
 			{
77
-				if($type == 'inline')
77
+				if ($type == 'inline')
78 78
 				{
79
-					if(!$this->compareCaptcha())
79
+					if (!$this->compareCaptcha())
80 80
 					{
81 81
 						Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang');
82 82
 						$_SESSION['XE_VALIDATOR_ERROR'] = -1;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			}
98 98
 
99 99
 			// compare session when calling actions such as writing a post or a comment on the board/issue tracker module
100
-			if(!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts))
100
+			if (!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts))
101 101
 			{
102 102
 				Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang');
103 103
 				$ModuleHandler->error = "captcha_denied";
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		function createKeyword()
110 110
 		{
111 111
 			$type = Context::get('captchaType');
112
-			if($type == 'inline' && $_SESSION['captcha_keyword'])
112
+			if ($type == 'inline' && $_SESSION['captcha_keyword'])
113 113
 			{
114 114
 				return;
115 115
 			}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		function before_module_init_setCaptchaSession()
124 124
 		{
125
-			if($_SESSION['member_captcha_authed'])
125
+			if ($_SESSION['member_captcha_authed'])
126 126
 			{
127 127
 				return false;
128 128
 			}
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 
152 152
 		function before_module_init_captchaImage()
153 153
 		{
154
-			if($_SESSION['member_captcha_authed'])
154
+			if ($_SESSION['member_captcha_authed'])
155 155
 			{
156 156
 				return false;
157 157
 			}
158
-			if(Context::get('renew'))
158
+			if (Context::get('renew'))
159 159
 			{
160 160
 				$this->createKeyword();
161 161
 			}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		function createCaptchaImage($string)
178 178
 		{
179 179
 			$arr = array();
180
-			for($i = 0, $c = strlen($string); $i < $c; $i++)
180
+			for ($i = 0, $c = strlen($string); $i < $c; $i++)
181 181
 			{
182 182
 				$arr[] = $string{$i};
183 183
 			}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			shuffle($deg);
200 200
 
201 201
 			// Create an image for each letter
202
-			foreach($arr as $i => $str)
202
+			foreach ($arr as $i => $str)
203 203
 			{
204 204
 				$im[$i + 1] = @imagecreate($w, $h);
205 205
 				$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				$ran = range(1, 20);
210 210
 				shuffle($ran);
211 211
 
212
-				if(function_exists('imagerotate'))
212
+				if (function_exists('imagerotate'))
213 213
 				{
214 214
 					imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color);
215 215
 					$im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			}
225 225
 
226 226
 			// Combine images of each character
227
-			for($i = 1; $i < count($im); $i++)
227
+			for ($i = 1; $i < count($im); $i++)
228 228
 			{
229 229
 				imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h);
230 230
 				imagedestroy($im[$i]);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h);
237 237
 			imagedestroy($im[0]);
238 238
 
239
-			if(function_exists('imageantialias'))
239
+			if (function_exists('imageantialias'))
240 240
 			{
241 241
 				imageantialias($big, true);
242 242
 			}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 			$h = $h * $big_count;
249 249
 			$d = array_pop($deg);
250 250
 
251
-			for($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
251
+			for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
252 252
 			{
253 253
 				imageline($big, 0, $i + $d, $w, $i, $line_color);
254 254
 			}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			$x = range(0, ($w - 10));
257 257
 			shuffle($x);
258 258
 
259
-			for($i = 0; $i < 200; $i++)
259
+			for ($i = 0; $i < 200; $i++)
260 260
 			{
261 261
 				imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color);
262 262
 			}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		function before_module_init_captchaAudio()
268 268
 		{
269
-			if($_SESSION['member_captcha_authed'])
269
+			if ($_SESSION['member_captcha_authed'])
270 270
 			{
271 271
 				return false;
272 272
 			}
@@ -290,17 +290,17 @@  discard block
 block discarded – undo
290 290
 		{
291 291
 			$data = '';
292 292
 			$_audio = './addons/captcha_member/audio/F_%s.mp3';
293
-			for($i = 0, $c = strlen($string); $i < $c; $i++)
293
+			for ($i = 0, $c = strlen($string); $i < $c; $i++)
294 294
 			{
295 295
 				$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
296 296
 
297 297
 				$start = rand(5, 68); // Random start in 4-byte header and 64 byte data
298 298
 				$datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes
299 299
 
300
-				for($j = $start; $j < $datalen; $j+=64)
300
+				for ($j = $start; $j < $datalen; $j += 64)
301 301
 				{
302 302
 					$ch = ord($_data{$j});
303
-					if($ch < 9 || $ch > 119)
303
+					if ($ch < 9 || $ch > 119)
304 304
 					{
305 305
 						continue;
306 306
 					}
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 
316 316
 		function compareCaptcha()
317 317
 		{
318
-			if(!in_array(Context::get('act'), $this->target_acts)) return true;
318
+			if (!in_array(Context::get('act'), $this->target_acts)) return true;
319 319
 
320
-			if($_SESSION['member_captcha_authed'])
320
+			if ($_SESSION['member_captcha_authed'])
321 321
 			{
322 322
 				return true;
323 323
 			}
324 324
 
325
-			if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
325
+			if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
326 326
 			{
327 327
 				$_SESSION['member_captcha_authed'] = true;
328 328
 				return true;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
 		function before_module_init_captchaCompare()
337 337
 		{
338
-			if(!$this->compareCaptcha())
338
+			if (!$this->compareCaptcha())
339 339
 			{
340 340
 				return false;
341 341
 			}
@@ -395,18 +395,18 @@  discard block
 block discarded – undo
395 395
 
396 396
 $oAddonMemberCaptcha = &$GLOBALS['__AddonMemberCaptcha__'];
397 397
 
398
-if(method_exists($oAddonMemberCaptcha, $called_position))
398
+if (method_exists($oAddonMemberCaptcha, $called_position))
399 399
 {
400
-	if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this)))
400
+	if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this)))
401 401
 	{
402 402
 		return false;
403 403
 	}
404 404
 }
405 405
 
406 406
 $addon_act = Context::get('captcha_action');
407
-if($addon_act && method_exists($oAddonMemberCaptcha, $called_position . '_' . $addon_act))
407
+if ($addon_act && method_exists($oAddonMemberCaptcha, $called_position . '_' . $addon_act))
408 408
 {
409
-	if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position . '_' . $addon_act), array(&$this)))
409
+	if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position . '_' . $addon_act), array(&$this)))
410 410
 	{
411 411
 		return false;
412 412
 	}
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined("__XE__")) exit();
4
+if(!defined("__XE__")) {
5
+	exit();
6
+}
5 7
 
6 8
 /**
7 9
  * @file captcha.addon.php
@@ -85,8 +87,7 @@  discard block
 block discarded – undo
85 87
 						$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url');
86 88
 						$ModuleHandler->_setInputValueToSession();
87 89
 					}
88
-				}
89
-				else
90
+				} else
90 91
 				{
91 92
 					Context::addHtmlHeader('<script>
92 93
 						if(!captchaTargetAct) {var captchaTargetAct = [];}
@@ -216,8 +217,7 @@  discard block
 block discarded – undo
216 217
 
217 218
 					$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
218 219
 					imagecolortransparent($im[$i + 1], $background_color);
219
-				}
220
-				else
220
+				} else
221 221
 				{
222 222
 					imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color);
223 223
 				}
@@ -315,7 +315,9 @@  discard block
 block discarded – undo
315 315
 
316 316
 		function compareCaptcha()
317 317
 		{
318
-			if(!in_array(Context::get('act'), $this->target_acts)) return true;
318
+			if(!in_array(Context::get('act'), $this->target_acts)) {
319
+				return true;
320
+			}
319 321
 
320 322
 			if($_SESSION['member_captcha_authed'])
321 323
 			{
Please login to merge, or discard this patch.
addons/mobile/classes/mobile.class.php 3 patches
Doc Comments   +13 added lines patch added patch discarded remove patch
@@ -279,6 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 	/**
281 281
 	 * @brief Specify title
282
+	 * @param string $title
282 283
 	 */
283 284
 	function setTitle($title)
284 285
 	{
@@ -298,6 +299,7 @@  discard block
 block discarded – undo
298 299
 	/**
299 300
 	 * @brief Content Cleanup
300 301
 	 * In HTML content, the ability to extract text and links
302
+	 * @param string $content
301 303
 	 */
302 304
 	function setContent($content)
303 305
 	{
@@ -371,6 +373,9 @@  discard block
 block discarded – undo
371 373
 
372 374
 	/**
373 375
 	 * @brief cutting the number of byte functions
376
+	 * @param string $string
377
+	 * @param integer $cut_size
378
+	 * @return string
374 379
 	 */
375 380
 	function cutStr($string, $cut_size)
376 381
 	{
@@ -387,6 +392,8 @@  discard block
 block discarded – undo
387 392
 
388 393
 	/**
389 394
 	 * @brief Specifies the home url
395
+	 * @param string $url
396
+	 * @param string $text
390 397
 	 */
391 398
 	function setHomeUrl($url, $text)
392 399
 	{
@@ -397,6 +404,8 @@  discard block
 block discarded – undo
397 404
 
398 405
 	/**
399 406
 	 * @brief Specify upper url
407
+	 * @param string $url
408
+	 * @param string $text
400 409
 	 */
401 410
 	function setUpperUrl($url, $text)
402 411
 	{
@@ -407,6 +416,8 @@  discard block
 block discarded – undo
407 416
 
408 417
 	/**
409 418
 	 * @brief Specify prev url
419
+	 * @param string $url
420
+	 * @param string $text
410 421
 	 */
411 422
 	function setPrevUrl($url, $text)
412 423
 	{
@@ -417,6 +428,8 @@  discard block
 block discarded – undo
417 428
 
418 429
 	/**
419 430
 	 * @brief Specify next url
431
+	 * @param string $url
432
+	 * @param string $text
420 433
 	 */
421 434
 	function setNextUrl($url, $text)
422 435
 	{
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 	{
46 46
 		static $instance = null;
47 47
 
48
-		if(!$instance)
48
+		if (!$instance)
49 49
 		{
50 50
 
51 51
 			$browserType = mobileXE::getBrowserType();
52
-			if(!$browserType) return;
52
+			if (!$browserType) return;
53 53
 
54 54
 			$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
55 55
 			require_once($class_file);
56 56
 			// Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..)
57
-			$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
58
-			if($this->lang)
57
+			$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php');
58
+			if ($this->lang)
59 59
 			{
60 60
 				$lang_supported = Context::get('lang_supported');
61
-				$this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang);
62
-				if(isset($lang_supported[$this->lang])) Context::setLangType($this->lang);
61
+				$this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang);
62
+				if (isset($lang_supported[$this->lang])) Context::setLangType($this->lang);
63 63
 			}
64
-			Context::loadLang(_XE_PATH_.'addons/mobile/lang');
64
+			Context::loadLang(_XE_PATH_ . 'addons/mobile/lang');
65 65
 
66 66
 			$instance = new wap();
67 67
 
68
-			$mobilePage = (int)Context::get('mpage');
69
-			if(!$mobilePage) $mobilePage = 1;
68
+			$mobilePage = (int) Context::get('mpage');
69
+			if (!$mobilePage) $mobilePage = 1;
70 70
 
71 71
 			$instance->setMobilePage($mobilePage);
72 72
 		}
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	function mobileXE()
80 80
 	{
81 81
 		// Check navigation mode
82
-		if(Context::get('nm'))
82
+		if (Context::get('nm'))
83 83
 		{
84 84
 			$this->navigationMode = 1;
85
-			$this->cmid = (int)Context::get('cmid');
85
+			$this->cmid = (int) Context::get('cmid');
86 86
 		}
87 87
 
88
-		if(Context::get('lcm'))
88
+		if (Context::get('lcm'))
89 89
 		{
90 90
 			$this->languageMode = 1;
91 91
 			$this->lang = Context::get('sel_lang');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	function isNavigationMode()
100 100
 	{
101
-		return ($this->navigationMode && $this->module_info->menu_srl)?true:false;
101
+		return ($this->navigationMode && $this->module_info->menu_srl) ? true : false;
102 102
 	}
103 103
 
104 104
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	function isLangChange()
109 109
 	{
110
-		if($this->languageMode) return true;
110
+		if ($this->languageMode) return true;
111 111
 		else return false;
112 112
 	}
113 113
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		$lang_supported = Context::get('lang_supported');
121 121
 		// Make sure that the language variables and parameters are valid
122
-		if($this->lang && isset($lang_supported[$this->lang]))
122
+		if ($this->lang && isset($lang_supported[$this->lang]))
123 123
 		{
124
-			$langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
125
-			if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
126
-			$langbuff = '<?php /**'.$this->lang.'**/ ?>';
127
-			FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php',$langbuff);
124
+			$langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php');
125
+			if ($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php');
126
+			$langbuff = '<?php /**' . $this->lang . '**/ ?>';
127
+			FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php', $langbuff);
128 128
 		}
129 129
 	}
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	function setModuleInfo(&$module_info)
135 135
 	{
136
-		if($this->module_info) return; 
136
+		if ($this->module_info) return; 
137 137
 		$this->module_info = $module_info;
138 138
 	}
139 139
 
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function setModuleInstance(&$oModule)
144 144
 	{
145
-		if($this->oModule) return;
145
+		if ($this->oModule) return;
146 146
 		// Save instance
147 147
 		$this->oModule = $oModule;
148 148
 		// Of the current module if there is a menu by menu
149
-		$menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl);
150
-		if(!file_exists($menu_cache_file)) return;
149
+		$menu_cache_file = sprintf(_XE_PATH_ . 'files/cache/menu/%d.php', $this->module_info->menu_srl);
150
+		if (!file_exists($menu_cache_file)) return;
151 151
 
152 152
 		include $menu_cache_file;
153 153
 		// One-dimensional arrangement of menu changes
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
 		$this->index_mid = $k[0];
163 163
 		// The depth of the current menu, the top button to specify if one or more
164 164
 		$cur_menu_item = $listed_items[$node_list[$this->module_info->mid]];
165
-		if($cur_menu_item['parent_srl'])
165
+		if ($cur_menu_item['parent_srl'])
166 166
 		{
167 167
 			$parent_srl = $cur_menu_item['parent_srl'];
168
-			if($parent_srl && $listed_items[$parent_srl])
168
+			if ($parent_srl && $listed_items[$parent_srl])
169 169
 			{
170 170
 				$parent_item = $listed_items[$parent_srl];
171
-				if($parent_item) $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper'));
171
+				if ($parent_item) $this->setUpperUrl(getUrl('', 'mid', $parent_item['mid']), Context::getLang('cmd_go_upper'));
172 172
 			}
173 173
 		}
174 174
 		elseif (!$this->isNavigationMode())
175 175
 		{
176
-			$this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap'));
176
+			$this->setUpperUrl(getUrl('', 'mid', $this->index_mid, 'nm', '1', 'cmid', 0), Context::getLang('cmd_view_sitemap'));
177 177
 		}
178 178
 	}
179 179
 
@@ -183,19 +183,19 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	function getBrowserType()
185 185
 	{
186
-		if(Context::get('smartphone')) return null;
186
+		if (Context::get('smartphone')) return null;
187 187
 		// Determine the type of browser
188 188
 		$browserAccept = $_SERVER['HTTP_ACCEPT'];
189 189
 		$userAgent = $_SERVER['HTTP_USER_AGENT'];
190 190
 		$wap_sid = $_SERVER['HTTP_X_UP_SUBNO'];
191 191
 
192
-		if(stripos($userAgent, "SKT11") !== FALSE || stripos($browserAccept, "skt") !== FALSE)
192
+		if (stripos($userAgent, "SKT11") !== FALSE || stripos($browserAccept, "skt") !== FALSE)
193 193
 		{
194
-			Context::set('mobile_skt',1);
194
+			Context::set('mobile_skt', 1);
195 195
 			return "wml";
196 196
 		}
197
-		elseif(stripos($browserAccept, "hdml") !== FALSE) return "hdml";
198
-		elseif(stripos($userAgent, "cellphone") !== FALSE) return  "mhtml";
197
+		elseif (stripos($browserAccept, "hdml") !== FALSE) return "hdml";
198
+		elseif (stripos($userAgent, "cellphone") !== FALSE) return  "mhtml";
199 199
 		return null;
200 200
 	}
201 201
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	function setCharSet($charset = 'UTF-8')
206 206
 	{
207
-		if(!$charset) $charset = 'UTF-8';
207
+		if (!$charset) $charset = 'UTF-8';
208 208
 		// SKT supports the euc-kr
209
-		if(Context::get('mobile_skt')==1) $charset = 'euc-kr';
209
+		if (Context::get('mobile_skt') == 1) $charset = 'euc-kr';
210 210
 
211 211
 		$this->charset = $charset;
212 212
 	}
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 	/**
215 215
 	 * @brief Limited capacity of mobile devices, specifying a different virtual page
216 216
 	 */
217
-	function setMobilePage($page=1)
217
+	function setMobilePage($page = 1)
218 218
 	{
219
-		if(!$page) $page = 1;
219
+		if (!$page) $page = 1;
220 220
 		$this->mobilePage = $page;
221 221
 	}
222 222
 
@@ -227,34 +227,34 @@  discard block
 block discarded – undo
227 227
 	{
228 228
 		// If more than nine the number of menu paging processing itself
229 229
 		$menu_count = count($childs);
230
-		if($menu_count>9)
230
+		if ($menu_count > 9)
231 231
 		{
232
-			$startNum = ($this->mobilePage-1)*9;
232
+			$startNum = ($this->mobilePage - 1) * 9;
233 233
 			$idx = 0;
234 234
 			$new_childs = array();
235
-			foreach($childs as $k => $v)
235
+			foreach ($childs as $k => $v)
236 236
 			{
237
-				if($idx >= $startNum && $idx < $startNum+9)
237
+				if ($idx >= $startNum && $idx < $startNum + 9)
238 238
 				{
239 239
 					$new_childs[$k] = $v;
240 240
 				}
241
-				$idx ++;
241
+				$idx++;
242 242
 			}
243 243
 			$childs = $new_childs;
244 244
 
245
-			$this->totalPage = (int)(($menu_count-1)/9)+1;
245
+			$this->totalPage = (int) (($menu_count - 1) / 9) + 1;
246 246
 			// next/prevUrl specify
247
-			if($this->mobilePage>1)
247
+			if ($this->mobilePage > 1)
248 248
 			{
249
-				$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1);
250
-				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage);
249
+				$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage - 1);
250
+				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage - 1, $this->totalPage);
251 251
 				$this->setPrevUrl($url, $text);
252 252
 			}
253 253
 
254
-			if($this->mobilePage<$this->totalPage)
254
+			if ($this->mobilePage < $this->totalPage)
255 255
 			{
256
-				$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage+1);
257
-				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage+1, $this->totalPage);
256
+				$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage + 1);
257
+				$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage + 1, $this->totalPage);
258 258
 				$this->setNextUrl($url, $text);
259 259
 			}
260 260
 		} 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	function hasChilds()
268 268
 	{
269
-		return count($this->childs)?true:0;
269
+		return count($this->childs) ? true : 0;
270 270
 	}
271 271
 
272 272
 	/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	function setContent($content)
303 303
 	{
304 304
 		$oModuleController = getController('module');
305
-		$allow_tag_array = array('<a>','<br>','<p>','<b>','<i>','<u>','<em>','<small>','<strong>','<big>','<table>','<tr>','<td>');
305
+		$allow_tag_array = array('<a>', '<br>', '<p>', '<b>', '<i>', '<u>', '<em>', '<small>', '<strong>', '<big>', '<table>', '<tr>', '<td>');
306 306
 		// Links/wrap, remove all tags except gangjoman
307 307
 		$content = strip_tags($content, implode($allow_tag_array));
308 308
 		// Margins tab removed
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
 		// Repeat two more times the space and remove julnanumeul
311 311
 		$content = preg_replace('/( ){2,}/s', '', $content);
312 312
 		$content = preg_replace("/([\r\n]+)/s", "\r\n", $content);
313
-		$content = preg_replace(array("/<a/i","/<\/a/i","/<b/i","/<\/b/i","/<br/i"),array('<a','</a','<b','</b','<br'),$content);
314
-		$content = str_replace(array("<br>","<br />"), array("<br/>","<br/>"), $content);
313
+		$content = preg_replace(array("/<a/i", "/<\/a/i", "/<b/i", "/<\/b/i", "/<br/i"), array('<a', '</a', '<b', '</b', '<br'), $content);
314
+		$content = str_replace(array("<br>", "<br />"), array("<br/>", "<br/>"), $content);
315 315
 
316
-		while(strpos($content, '<br/><br/>'))
316
+		while (strpos($content, '<br/><br/>'))
317 317
 		{
318
-			$content = str_replace('<br/><br/>','<br/>',$content);
318
+			$content = str_replace('<br/><br/>', '<br/>', $content);
319 319
 		}
320 320
 		// If the required size of a deck of mobile content to write down all the dividing pages
321 321
 		$contents = array();
322
-		while($content)
322
+		while ($content)
323 323
 		{
324 324
 			$tmp = $this->cutStr($content, $this->deckSize, '');
325 325
 			$contents[] = $tmp;
@@ -327,46 +327,46 @@  discard block
 block discarded – undo
327 327
 
328 328
 			//$content = str_replace(array('&','<','>','"','&amp;nbsp;'), array('&amp;','&lt;','&gt;','&quot;',' '), $content);
329 329
 
330
-			foreach($allow_tag_array as $tag)
330
+			foreach ($allow_tag_array as $tag)
331 331
 			{
332
-				if($tag == '<br>') continue;
333
-				$tag_open_pos = strpos($content, str_replace('>','',$tag));
334
-				$tag_close_pos = strpos($content, str_replace('<','</',$tag));
335
-				if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos)
332
+				if ($tag == '<br>') continue;
333
+				$tag_open_pos = strpos($content, str_replace('>', '', $tag));
334
+				$tag_close_pos = strpos($content, str_replace('<', '</', $tag));
335
+				if ($tag_open_pos !== false && $tag_close_pos || $tag_close_pos < $tag_open_pos)
336 336
 				{
337
-					$contents[count($contents)-1] .= substr($content, 0, $tag_close_pos + strlen($tag) + 1);
337
+					$contents[count($contents) - 1] .= substr($content, 0, $tag_close_pos + strlen($tag) + 1);
338 338
 					$content = substr($content, $tag_close_pos + strlen($tag) + 1);
339 339
 				}
340 340
 			}
341 341
 
342 342
 			$tag_open_pos = strpos($content, '&');
343 343
 			$tag_close_pos = strpos($content, ';');
344
-			if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos)
344
+			if ($tag_open_pos !== false && $tag_close_pos || $tag_close_pos < $tag_open_pos)
345 345
 			{
346
-				$contents[count($contents)-1] .= substr($content, 0, $tag_close_pos + 1);
346
+				$contents[count($contents) - 1] .= substr($content, 0, $tag_close_pos + 1);
347 347
 				$content = substr($content, $tag_close_pos + 1);
348 348
 			}
349 349
 		}
350 350
 
351 351
 		$this->totalPage = count($contents);
352 352
 		// next/prevUrl specify
353
-		if($this->mobilePage>1)
353
+		if ($this->mobilePage > 1)
354 354
 		{
355
-			$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1);
356
-			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage);
355
+			$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage - 1);
356
+			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage - 1, $this->totalPage);
357 357
 			$this->setPrevUrl($url, $text);
358 358
 		}
359 359
 
360
-		if($this->mobilePage<$this->totalPage)
360
+		if ($this->mobilePage < $this->totalPage)
361 361
 		{
362
-			$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage+1);
363
-			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage+1, $this->totalPage);
362
+			$url = getUrl('mid', $_GET['mid'], 'mpage', $this->mobilePage + 1);
363
+			$text = sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $this->mobilePage + 1, $this->totalPage);
364 364
 			$this->setNextUrl($url, $text);
365 365
 		}
366 366
 
367
-		$this->content = $contents[$this->mobilePage-1];
367
+		$this->content = $contents[$this->mobilePage - 1];
368 368
 		$oModuleController->replaceDefinedLangCode($this->content);
369
-		$content = str_replace(array('$','\''), array('$$','&apos;'), $content);
369
+		$content = str_replace(array('$', '\''), array('$$', '&apos;'), $content);
370 370
 	}
371 371
 
372 372
 	/**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	function cutStr($string, $cut_size)
376 376
 	{
377
-		return preg_match('/.{'.$cut_size.'}/su', $string, $arr) ? $arr[0] : $string; 
377
+		return preg_match('/.{' . $cut_size . '}/su', $string, $arr) ? $arr[0] : $string; 
378 378
 	}
379 379
 
380 380
 	/**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	function setHomeUrl($url, $text)
392 392
 	{
393
-		if(!$url) $url = '#';
393
+		if (!$url) $url = '#';
394 394
 		$this->homeUrl->url = $url;
395 395
 		$this->homeUrl->text = $text;
396 396
 	}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	function setUpperUrl($url, $text)
402 402
 	{
403
-		if(!$url) $url = '#';
403
+		if (!$url) $url = '#';
404 404
 		$this->upperUrl->url = $url;
405 405
 		$this->upperUrl->text = $text;
406 406
 	}
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 */
411 411
 	function setPrevUrl($url, $text)
412 412
 	{
413
-		if(!$url) $url = '#';
413
+		if (!$url) $url = '#';
414 414
 		$this->prevUrl->url = $url;
415 415
 		$this->prevUrl->text = $text;
416 416
 	}
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	function setNextUrl($url, $text)
422 422
 	{
423
-		if(!$url) $url = '#';
423
+		if (!$url) $url = '#';
424 424
 		$this->nextUrl->url = $url;
425 425
 		$this->nextUrl->text = $text;
426 426
 	}
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 	 */
431 431
 	function setEtcBtn($url, $text)
432 432
 	{
433
-		if(!$url) $url = '#';
433
+		if (!$url) $url = '#';
434 434
 		$etc['url'] = $url;
435 435
 		$etc['text'] = htmlspecialchars($text);
436 436
 		$this->etcBtn[] = $etc;
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 		// Home button assignments
445 445
 		$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
446 446
 		// Specify the title
447
-		if(!$this->title) $this->setTitle(Context::getBrowserTitle());
447
+		if (!$this->title) $this->setTitle(Context::getBrowserTitle());
448 448
 
449 449
 		ob_start();
450 450
 		// Output header
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 
461 461
 		$content = ob_get_clean();
462 462
 		// After conversion output
463
-		if(strtolower($this->charset) == 'utf-8') print $content;
464
-		else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content);
463
+		if (strtolower($this->charset) == 'utf-8') print $content;
464
+		else print iconv('UTF-8', $this->charset . "//TRANSLIT//IGNORE", $content);
465 465
 
466 466
 		exit();
467 467
 	}
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	function getListedItems($menu, &$listed_items, &$node_list)
492 492
 	{
493
-		if(!count($menu)) return;
494
-		foreach($menu as $node_srl => $item)
493
+		if (!count($menu)) return;
494
+		foreach ($menu as $node_srl => $item)
495 495
 		{
496
-			if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url']))
496
+			if (preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url']))
497 497
 			{
498 498
 				$mid = $item['mid'] = $item['url'];
499 499
 				$node_list[$mid] = $node_srl;
@@ -515,17 +515,17 @@  discard block
 block discarded – undo
515 515
 	{
516 516
 		$childs = array();
517 517
 
518
-		if($this->cmid)
518
+		if ($this->cmid)
519 519
 		{
520 520
 			$cur_item = $this->listed_items[$this->cmid];
521
-			$upper_srl = $cur_item['parent_srl'];;
522
-			$list = $cur_item['list'];;
523
-			$this->setUpperUrl(getUrl('cmid',$upper_srl), Context::getLang('cmd_go_upper'));
524
-			if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url']))
521
+			$upper_srl = $cur_item['parent_srl']; ;
522
+			$list = $cur_item['list']; ;
523
+			$this->setUpperUrl(getUrl('cmid', $upper_srl), Context::getLang('cmd_go_upper'));
524
+			if (preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url']))
525 525
 			{
526 526
 				$obj = array();
527
-				$obj['href'] = getUrl('','mid',$cur_item['url']);
528
-				$obj['link'] = $obj['text'] = '['.$cur_item['text'].']';
527
+				$obj['href'] = getUrl('', 'mid', $cur_item['url']);
528
+				$obj['link'] = $obj['text'] = '[' . $cur_item['text'] . ']';
529 529
 				$childs[] = $obj;
530 530
 			}
531 531
 
@@ -536,19 +536,19 @@  discard block
 block discarded – undo
536 536
 			$upper_srl = 0;
537 537
 		}
538 538
 
539
-		if(count($list))
539
+		if (count($list))
540 540
 		{
541
-			foreach($list as $key => $val)
541
+			foreach ($list as $key => $val)
542 542
 			{
543
-				if(!$val['text']) continue;
543
+				if (!$val['text']) continue;
544 544
 				$obj = array();
545
-				if(!count($val['list']))
545
+				if (!count($val['list']))
546 546
 				{
547
-					$obj['href'] = getUrl('','mid',$val['url']);
547
+					$obj['href'] = getUrl('', 'mid', $val['url']);
548 548
 				}
549 549
 				else
550 550
 				{
551
-					$obj['href'] = getUrl('cmid',$val['node_srl']);
551
+					$obj['href'] = getUrl('cmid', $val['node_srl']);
552 552
 				}
553 553
 				$obj['link'] = $obj['text'] = $val['text'];
554 554
 				$childs[] = $obj;
@@ -566,26 +566,26 @@  discard block
 block discarded – undo
566 566
 	{
567 567
 		$childs = array();
568 568
 
569
-		$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
570
-		if($this->lang)
569
+		$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/' . md5(trim($_SERVER['HTTP_USER_AGENT']) . trim($_SERVER['HTTP_PHONE_NUMBER']) . trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])) . '.php');
570
+		if ($this->lang)
571 571
 		{
572
-			$this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang);
572
+			$this->lang = str_replace(array('<?php /**', '**/ ?>'), array('', ''), $this->lang);
573 573
 			Context::setLangType($this->lang);
574 574
 		}
575 575
 		$lang_supported = Context::get('lang_supported');
576 576
 		$lang_type = Context::getLangType();
577 577
 		$obj = array();
578
-		$obj['link'] = $obj['text'] = Context::getLang('president_lang').' : '.$lang_supported[$lang_type];
579
-		$obj['href'] = getUrl('sel_lang',$lang_type);
578
+		$obj['link'] = $obj['text'] = Context::getLang('president_lang') . ' : ' . $lang_supported[$lang_type];
579
+		$obj['href'] = getUrl('sel_lang', $lang_type);
580 580
 		$childs[] = $obj;
581 581
 
582
-		if(is_array($lang_supported))
582
+		if (is_array($lang_supported))
583 583
 		{
584
-			foreach($lang_supported as $key => $val)
584
+			foreach ($lang_supported as $key => $val)
585 585
 			{
586 586
 				$obj = array();
587 587
 				$obj['link'] = $obj['text'] = $val;
588
-				$obj['href'] = getUrl('sel_lang',$key);
588
+				$obj['href'] = getUrl('sel_lang', $key);
589 589
 				$childs[] = $obj;
590 590
 			}
591 591
 		}
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
 	{
603 603
 		// Create WAP class objects of the selected module
604 604
 		$oModule = &getWap($this->module_info->module);
605
-		if(!$oModule || !method_exists($oModule, 'procWAP') ) return;
605
+		if (!$oModule || !method_exists($oModule, 'procWAP')) return;
606 606
 
607 607
 		$vars = get_object_vars($this->oModule);
608
-		if(count($vars)) foreach($vars as $key => $val) $oModule->{$key}  = $val;
608
+		if (count($vars)) foreach ($vars as $key => $val) $oModule->{$key} = $val;
609 609
 		// Run
610 610
 		$oModule->procWAP($this);
611 611
 		// Output
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 */
618 618
 	function displayContent()
619 619
 	{
620
-		Context::set('layout','none');
620
+		Context::set('layout', 'none');
621 621
 		// Compile a template
622 622
 		$oTemplate = new TemplateHandler();
623 623
 		$oContext = &Context::getInstance();
Please login to merge, or discard this patch.
Braces   +87 added lines, -37 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@  discard block
 block discarded – undo
49 49
 		{
50 50
 
51 51
 			$browserType = mobileXE::getBrowserType();
52
-			if(!$browserType) return;
52
+			if(!$browserType) {
53
+				return;
54
+			}
53 55
 
54 56
 			$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
55 57
 			require_once($class_file);
@@ -59,14 +61,18 @@  discard block
 block discarded – undo
59 61
 			{
60 62
 				$lang_supported = Context::get('lang_supported');
61 63
 				$this->lang = str_replace(array('<?php /**','**/ ?>'),array('',''),$this->lang);
62
-				if(isset($lang_supported[$this->lang])) Context::setLangType($this->lang);
64
+				if(isset($lang_supported[$this->lang])) {
65
+					Context::setLangType($this->lang);
66
+				}
63 67
 			}
64 68
 			Context::loadLang(_XE_PATH_.'addons/mobile/lang');
65 69
 
66 70
 			$instance = new wap();
67 71
 
68 72
 			$mobilePage = (int)Context::get('mpage');
69
-			if(!$mobilePage) $mobilePage = 1;
73
+			if(!$mobilePage) {
74
+				$mobilePage = 1;
75
+			}
70 76
 
71 77
 			$instance->setMobilePage($mobilePage);
72 78
 		}
@@ -107,8 +113,11 @@  discard block
 block discarded – undo
107 113
 	 */
108 114
 	function isLangChange()
109 115
 	{
110
-		if($this->languageMode) return true;
111
-		else return false;
116
+		if($this->languageMode) {
117
+			return true;
118
+		} else {
119
+			return false;
120
+		}
112 121
 	}
113 122
 
114 123
 	/**
@@ -122,7 +131,9 @@  discard block
 block discarded – undo
122 131
 		if($this->lang && isset($lang_supported[$this->lang]))
123 132
 		{
124 133
 			$langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
125
-			if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
134
+			if($langbuff) {
135
+				FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
136
+			}
126 137
 			$langbuff = '<?php /**'.$this->lang.'**/ ?>';
127 138
 			FileHandler::writeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php',$langbuff);
128 139
 		}
@@ -133,7 +144,9 @@  discard block
 block discarded – undo
133 144
 	 */
134 145
 	function setModuleInfo(&$module_info)
135 146
 	{
136
-		if($this->module_info) return; 
147
+		if($this->module_info) {
148
+			return;
149
+		}
137 150
 		$this->module_info = $module_info;
138 151
 	}
139 152
 
@@ -142,12 +155,16 @@  discard block
 block discarded – undo
142 155
 	 */
143 156
 	function setModuleInstance(&$oModule)
144 157
 	{
145
-		if($this->oModule) return;
158
+		if($this->oModule) {
159
+			return;
160
+		}
146 161
 		// Save instance
147 162
 		$this->oModule = $oModule;
148 163
 		// Of the current module if there is a menu by menu
149 164
 		$menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl);
150
-		if(!file_exists($menu_cache_file)) return;
165
+		if(!file_exists($menu_cache_file)) {
166
+			return;
167
+		}
151 168
 
152 169
 		include $menu_cache_file;
153 170
 		// One-dimensional arrangement of menu changes
@@ -168,10 +185,11 @@  discard block
 block discarded – undo
168 185
 			if($parent_srl && $listed_items[$parent_srl])
169 186
 			{
170 187
 				$parent_item = $listed_items[$parent_srl];
171
-				if($parent_item) $this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper'));
188
+				if($parent_item) {
189
+					$this->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper'));
190
+				}
172 191
 			}
173
-		}
174
-		elseif (!$this->isNavigationMode())
192
+		} elseif (!$this->isNavigationMode())
175 193
 		{
176 194
 			$this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap'));
177 195
 		}
@@ -183,7 +201,9 @@  discard block
 block discarded – undo
183 201
 	 */
184 202
 	function getBrowserType()
185 203
 	{
186
-		if(Context::get('smartphone')) return null;
204
+		if(Context::get('smartphone')) {
205
+			return null;
206
+		}
187 207
 		// Determine the type of browser
188 208
 		$browserAccept = $_SERVER['HTTP_ACCEPT'];
189 209
 		$userAgent = $_SERVER['HTTP_USER_AGENT'];
@@ -193,9 +213,11 @@  discard block
 block discarded – undo
193 213
 		{
194 214
 			Context::set('mobile_skt',1);
195 215
 			return "wml";
216
+		} elseif(stripos($browserAccept, "hdml") !== FALSE) {
217
+			return "hdml";
218
+		} elseif(stripos($userAgent, "cellphone") !== FALSE) {
219
+			return  "mhtml";
196 220
 		}
197
-		elseif(stripos($browserAccept, "hdml") !== FALSE) return "hdml";
198
-		elseif(stripos($userAgent, "cellphone") !== FALSE) return  "mhtml";
199 221
 		return null;
200 222
 	}
201 223
 
@@ -204,9 +226,13 @@  discard block
 block discarded – undo
204 226
 	 */
205 227
 	function setCharSet($charset = 'UTF-8')
206 228
 	{
207
-		if(!$charset) $charset = 'UTF-8';
229
+		if(!$charset) {
230
+			$charset = 'UTF-8';
231
+		}
208 232
 		// SKT supports the euc-kr
209
-		if(Context::get('mobile_skt')==1) $charset = 'euc-kr';
233
+		if(Context::get('mobile_skt')==1) {
234
+			$charset = 'euc-kr';
235
+		}
210 236
 
211 237
 		$this->charset = $charset;
212 238
 	}
@@ -216,7 +242,9 @@  discard block
 block discarded – undo
216 242
 	 */
217 243
 	function setMobilePage($page=1)
218 244
 	{
219
-		if(!$page) $page = 1;
245
+		if(!$page) {
246
+			$page = 1;
247
+		}
220 248
 		$this->mobilePage = $page;
221 249
 	}
222 250
 
@@ -329,7 +357,9 @@  discard block
 block discarded – undo
329 357
 
330 358
 			foreach($allow_tag_array as $tag)
331 359
 			{
332
-				if($tag == '<br>') continue;
360
+				if($tag == '<br>') {
361
+					continue;
362
+				}
333 363
 				$tag_open_pos = strpos($content, str_replace('>','',$tag));
334 364
 				$tag_close_pos = strpos($content, str_replace('<','</',$tag));
335 365
 				if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos)
@@ -390,7 +420,9 @@  discard block
 block discarded – undo
390 420
 	 */
391 421
 	function setHomeUrl($url, $text)
392 422
 	{
393
-		if(!$url) $url = '#';
423
+		if(!$url) {
424
+			$url = '#';
425
+		}
394 426
 		$this->homeUrl->url = $url;
395 427
 		$this->homeUrl->text = $text;
396 428
 	}
@@ -400,7 +432,9 @@  discard block
 block discarded – undo
400 432
 	 */
401 433
 	function setUpperUrl($url, $text)
402 434
 	{
403
-		if(!$url) $url = '#';
435
+		if(!$url) {
436
+			$url = '#';
437
+		}
404 438
 		$this->upperUrl->url = $url;
405 439
 		$this->upperUrl->text = $text;
406 440
 	}
@@ -410,7 +444,9 @@  discard block
 block discarded – undo
410 444
 	 */
411 445
 	function setPrevUrl($url, $text)
412 446
 	{
413
-		if(!$url) $url = '#';
447
+		if(!$url) {
448
+			$url = '#';
449
+		}
414 450
 		$this->prevUrl->url = $url;
415 451
 		$this->prevUrl->text = $text;
416 452
 	}
@@ -420,7 +456,9 @@  discard block
 block discarded – undo
420 456
 	 */
421 457
 	function setNextUrl($url, $text)
422 458
 	{
423
-		if(!$url) $url = '#';
459
+		if(!$url) {
460
+			$url = '#';
461
+		}
424 462
 		$this->nextUrl->url = $url;
425 463
 		$this->nextUrl->text = $text;
426 464
 	}
@@ -430,7 +468,9 @@  discard block
 block discarded – undo
430 468
 	 */
431 469
 	function setEtcBtn($url, $text)
432 470
 	{
433
-		if(!$url) $url = '#';
471
+		if(!$url) {
472
+			$url = '#';
473
+		}
434 474
 		$etc['url'] = $url;
435 475
 		$etc['text'] = htmlspecialchars($text);
436 476
 		$this->etcBtn[] = $etc;
@@ -444,7 +484,9 @@  discard block
 block discarded – undo
444 484
 		// Home button assignments
445 485
 		$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
446 486
 		// Specify the title
447
-		if(!$this->title) $this->setTitle(Context::getBrowserTitle());
487
+		if(!$this->title) {
488
+			$this->setTitle(Context::getBrowserTitle());
489
+		}
448 490
 
449 491
 		ob_start();
450 492
 		// Output header
@@ -460,8 +502,11 @@  discard block
 block discarded – undo
460 502
 
461 503
 		$content = ob_get_clean();
462 504
 		// After conversion output
463
-		if(strtolower($this->charset) == 'utf-8') print $content;
464
-		else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content);
505
+		if(strtolower($this->charset) == 'utf-8') {
506
+			print $content;
507
+		} else {
508
+			print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content);
509
+		}
465 510
 
466 511
 		exit();
467 512
 	}
@@ -490,15 +535,16 @@  discard block
 block discarded – undo
490 535
 	 */
491 536
 	function getListedItems($menu, &$listed_items, &$node_list)
492 537
 	{
493
-		if(!count($menu)) return;
538
+		if(!count($menu)) {
539
+			return;
540
+		}
494 541
 		foreach($menu as $node_srl => $item)
495 542
 		{
496 543
 			if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url']))
497 544
 			{
498 545
 				$mid = $item['mid'] = $item['url'];
499 546
 				$node_list[$mid] = $node_srl;
500
-			}
501
-			else
547
+			} else
502 548
 			{
503 549
 				$mid = $item['mid'] = null;
504 550
 			}
@@ -529,8 +575,7 @@  discard block
 block discarded – undo
529 575
 				$childs[] = $obj;
530 576
 			}
531 577
 
532
-		}
533
-		else
578
+		} else
534 579
 		{
535 580
 			$list = $this->menu;
536 581
 			$upper_srl = 0;
@@ -540,13 +585,14 @@  discard block
 block discarded – undo
540 585
 		{
541 586
 			foreach($list as $key => $val)
542 587
 			{
543
-				if(!$val['text']) continue;
588
+				if(!$val['text']) {
589
+					continue;
590
+				}
544 591
 				$obj = array();
545 592
 				if(!count($val['list']))
546 593
 				{
547 594
 					$obj['href'] = getUrl('','mid',$val['url']);
548
-				}
549
-				else
595
+				} else
550 596
 				{
551 597
 					$obj['href'] = getUrl('cmid',$val['node_srl']);
552 598
 				}
@@ -602,10 +648,14 @@  discard block
 block discarded – undo
602 648
 	{
603 649
 		// Create WAP class objects of the selected module
604 650
 		$oModule = &getWap($this->module_info->module);
605
-		if(!$oModule || !method_exists($oModule, 'procWAP') ) return;
651
+		if(!$oModule || !method_exists($oModule, 'procWAP') ) {
652
+			return;
653
+		}
606 654
 
607 655
 		$vars = get_object_vars($this->oModule);
608
-		if(count($vars)) foreach($vars as $key => $val) $oModule->{$key}  = $val;
656
+		if(count($vars)) {
657
+			foreach($vars as $key => $val) $oModule->{$key}  = $val;
658
+		}
609 659
 		// Run
610 660
 		$oModule->procWAP($this);
611 661
 		// Output
Please login to merge, or discard this patch.
classes/cache/CacheFile.class.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * Return whether support or not support cache
57 57
 	 *
58
-	 * @return true
58
+	 * @return boolean
59 59
 	 */
60 60
 	function isSupport()
61 61
 	{
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	/**
165 165
 	 * Truncate all existing variables at the cache
166 166
 	 *
167
-	 * @return bool Returns true on success or false on failure.
167
+	 * @return boolean|null Returns true on success or false on failure.
168 168
 	 */
169 169
 	function truncate()
170 170
 	{
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getInstance()
25 25
 	{
26
-		if(!$GLOBALS['__CacheFile__'])
26
+		if (!$GLOBALS['__CacheFile__'])
27 27
 		{
28 28
 			$GLOBALS['__CacheFile__'] = new CacheFile();
29 29
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
79 79
 		$content[] = 'return \'' . addslashes(serialize($obj)) . '\';';
80 80
 		FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
81
-		if(function_exists('opcache_invalidate'))
81
+		if (function_exists('opcache_invalidate'))
82 82
 		{
83 83
 			@opcache_invalidate($cache_file, true);
84 84
 		}
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	{
96 96
 		$cache_file = $this->getCacheFileName($key);
97 97
 
98
-		if(file_exists($cache_file))
98
+		if (file_exists($cache_file))
99 99
 		{
100
-			if($modified_time > 0 && filemtime($cache_file) < $modified_timed)
100
+			if ($modified_time > 0 && filemtime($cache_file) < $modified_timed)
101 101
 			{
102 102
 				FileHandler::removeFile($cache_file);
103 103
 				return false;
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	function get($key, $modified_time = 0)
120 120
 	{
121
-		if(!$cache_file = FileHandler::exists($this->getCacheFileName($key)))
121
+		if (!$cache_file = FileHandler::exists($this->getCacheFileName($key)))
122 122
 		{
123 123
 			return false;
124 124
 		}
125 125
 
126
-		if($modified_time > 0 && filemtime($cache_file) < $modified_timed)
126
+		if ($modified_time > 0 && filemtime($cache_file) < $modified_timed)
127 127
 		{
128 128
 			FileHandler::removeFile($cache_file);
129 129
 			return false;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	function _delete($_key)
144 144
 	{
145 145
 		$cache_file = $this->getCacheFileName($_key);
146
-		if(function_exists('opcache_invalidate'))
146
+		if (function_exists('opcache_invalidate'))
147 147
 		{
148 148
 			@opcache_invalidate($cache_file, true);
149 149
 		}
Please login to merge, or discard this patch.
classes/cache/CacheHandler.class.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param string $key Cache key
149 149
 	 * @param int $modified_time 	Unix time of data modified.
150 150
 	 * 								If stored time is older then modified time, return false.
151
-	 * @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success.
151
+	 * @return boolean Return false on failure or older then modified time. Return the string associated with the $key on success.
152 152
 	 */
153 153
 	function get($key, $modified_time = 0)
154 154
 	{
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param int $valid_time	Time for the variable to live in the cache in seconds.
171 171
 	 * 							After the value specified in ttl has passed the stored variable will be deleted from the cache.
172 172
 	 * 							If no ttl is supplied, use the default valid time.
173
-	 * @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
173
+	 * @return boolean Returns true on success or false on failure. If use CacheFile, returns void.
174 174
 	 */
175 175
 	function put($key, $obj, $valid_time = 0)
176 176
 	{
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	/**
226 226
 	 * Truncate all cache
227 227
 	 *
228
-	 * @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
228
+	 * @return boolean Returns true on success or false on failure. If use CacheFile, returns void.
229 229
 	 */
230 230
 	function truncate()
231 231
 	{
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param string $key Cache key
298 298
 	 * @param int $modified_time 	Unix time of data modified.
299 299
 	 * 								If stored time is older then modified time, return false.
300
-	 * @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success.
300
+	 * @return boolean Return false on failure or older then modified time. Return the string associated with the $key on success.
301 301
 	 */
302 302
 	function get($key, $modified_time = 0)
303 303
 	{
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @param int $valid_time	Time for the variable to live in the cache in seconds.
313 313
 	 * 							After the value specified in ttl has passed the stored variable will be deleted from the cache.
314 314
 	 * 							If no ttl is supplied, use the default valid time.
315
-	 * @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
315
+	 * @return boolean Returns true on success or false on failure. If use CacheFile, returns void.
316 316
 	 */
317 317
 	function put($key, $obj, $valid_time = 0)
318 318
 	{
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	/**
346 346
 	 * Truncate all cache
347 347
 	 *
348
-	 * @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
348
+	 * @return boolean Returns true on success or false on failure. If use CacheFile, returns void.
349 349
 	 */
350 350
 	function truncate()
351 351
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	function &getInstance($target = 'object', $info = null, $always_use_file = false)
32 32
 	{
33 33
 		$cache_handler_key = $target . ($always_use_file ? '_file' : '');
34
-		if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key])
34
+		if (!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key])
35 35
 		{
36 36
 			$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file);
37 37
 		}
@@ -51,61 +51,61 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	function CacheHandler($target, $info = null, $always_use_file = false)
53 53
 	{
54
-		if(!$info)
54
+		if (!$info)
55 55
 		{
56 56
 			$info = Context::getDBInfo();
57 57
 		}
58 58
 
59
-		if($info)
59
+		if ($info)
60 60
 		{
61
-			if($target == 'object')
61
+			if ($target == 'object')
62 62
 			{
63
-				if($info->use_object_cache == 'apc')
63
+				if ($info->use_object_cache == 'apc')
64 64
 				{
65 65
 					$type = 'apc';
66 66
 				}
67
-				else if(substr($info->use_object_cache, 0, 8) == 'memcache')
67
+				else if (substr($info->use_object_cache, 0, 8) == 'memcache')
68 68
 				{
69 69
 					$type = 'memcache';
70 70
 					$url = $info->use_object_cache;
71 71
 				}
72
-				else if($info->use_object_cache == 'wincache')
72
+				else if ($info->use_object_cache == 'wincache')
73 73
 				{
74 74
 					$type = 'wincache';
75 75
 				}
76
-				else if($info->use_object_cache == 'file')
76
+				else if ($info->use_object_cache == 'file')
77 77
 				{
78 78
 					$type = 'file';
79 79
 				}
80
-				else if($always_use_file)
80
+				else if ($always_use_file)
81 81
 				{
82 82
 					$type = 'file';
83 83
 				}
84 84
 			}
85
-			else if($target == 'template')
85
+			else if ($target == 'template')
86 86
 			{
87
-				if($info->use_template_cache == 'apc')
87
+				if ($info->use_template_cache == 'apc')
88 88
 				{
89 89
 					$type = 'apc';
90 90
 				}
91
-				else if(substr($info->use_template_cache, 0, 8) == 'memcache')
91
+				else if (substr($info->use_template_cache, 0, 8) == 'memcache')
92 92
 				{
93 93
 					$type = 'memcache';
94 94
 					$url = $info->use_template_cache;
95 95
 				}
96
-				else if($info->use_template_cache == 'wincache')
96
+				else if ($info->use_template_cache == 'wincache')
97 97
 				{
98 98
 					$type = 'wincache';
99 99
 				}
100 100
 			}
101 101
 
102
-			if($type)
102
+			if ($type)
103 103
 			{
104 104
 				$class = 'Cache' . ucfirst($type);
105 105
 				include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class);
106 106
 				$this->handler = call_user_func(array($class, 'getInstance'), $url);
107 107
 				$this->keyGroupVersions = $this->handler->get('key_group_versions', 0);
108
-				if(!$this->keyGroupVersions)
108
+				if (!$this->keyGroupVersions)
109 109
 				{
110 110
 					$this->keyGroupVersions = array();
111 111
 					$this->handler->put('key_group_versions', $this->keyGroupVersions, 0);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	function isSupport()
123 123
 	{
124
-		if($this->handler && $this->handler->isSupport())
124
+		if ($this->handler && $this->handler->isSupport())
125 125
 		{
126 126
 			return true;
127 127
 		}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	function get($key, $modified_time = 0)
154 154
 	{
155
-		if(!$this->handler)
155
+		if (!$this->handler)
156 156
 		{
157 157
 			return false;
158 158
 		}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	function put($key, $obj, $valid_time = 0)
176 176
 	{
177
-		if(!$this->handler && !$key)
177
+		if (!$this->handler && !$key)
178 178
 		{
179 179
 			return false;
180 180
 		}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	function delete($key)
194 194
 	{
195
-		if(!$this->handler)
195
+		if (!$this->handler)
196 196
 		{
197 197
 			return false;
198 198
 		}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	function isValid($key, $modified_time)
214 214
 	{
215
-		if(!$this->handler)
215
+		if (!$this->handler)
216 216
 		{
217 217
 			return false;
218 218
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	function truncate()
231 231
 	{
232
-		if(!$this->handler)
232
+		if (!$this->handler)
233 233
 		{
234 234
 			return false;
235 235
 		}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	function getGroupKey($keyGroupName, $key)
257 257
 	{
258
-		if(!$this->keyGroupVersions[$keyGroupName])
258
+		if (!$this->keyGroupVersions[$keyGroupName])
259 259
 		{
260 260
 			$this->keyGroupVersions[$keyGroupName] = 1;
261 261
 			$this->handler->put('key_group_versions', $this->keyGroupVersions, 0);
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -63,37 +63,30 @@
 block discarded – undo
63 63
 				if($info->use_object_cache == 'apc')
64 64
 				{
65 65
 					$type = 'apc';
66
-				}
67
-				else if(substr($info->use_object_cache, 0, 8) == 'memcache')
66
+				} else if(substr($info->use_object_cache, 0, 8) == 'memcache')
68 67
 				{
69 68
 					$type = 'memcache';
70 69
 					$url = $info->use_object_cache;
71
-				}
72
-				else if($info->use_object_cache == 'wincache')
70
+				} else if($info->use_object_cache == 'wincache')
73 71
 				{
74 72
 					$type = 'wincache';
75
-				}
76
-				else if($info->use_object_cache == 'file')
73
+				} else if($info->use_object_cache == 'file')
77 74
 				{
78 75
 					$type = 'file';
79
-				}
80
-				else if($always_use_file)
76
+				} else if($always_use_file)
81 77
 				{
82 78
 					$type = 'file';
83 79
 				}
84
-			}
85
-			else if($target == 'template')
80
+			} else if($target == 'template')
86 81
 			{
87 82
 				if($info->use_template_cache == 'apc')
88 83
 				{
89 84
 					$type = 'apc';
90
-				}
91
-				else if(substr($info->use_template_cache, 0, 8) == 'memcache')
85
+				} else if(substr($info->use_template_cache, 0, 8) == 'memcache')
92 86
 				{
93 87
 					$type = 'memcache';
94 88
 					$url = $info->use_template_cache;
95
-				}
96
-				else if($info->use_template_cache == 'wincache')
89
+				} else if($info->use_template_cache == 'wincache')
97 90
 				{
98 91
 					$type = 'wincache';
99 92
 				}
Please login to merge, or discard this patch.
classes/context/Context.class.php 4 patches
Doc Comments   +16 added lines, -12 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
 	{
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 	/**
723 723
 	 * Get FTP information
724 724
 	 *
725
-	 * @return object FTP information
725
+	 * @return string FTP information
726 726
 	 */
727 727
 	function getFTPInfo()
728 728
 	{
@@ -867,6 +867,7 @@  discard block
 block discarded – undo
867 867
 	 * Evaluation of xml language file
868 868
 	 *
869 869
 	 * @param string Path of the language file
870
+	 * @param string $path
870 871
 	 * @return void
871 872
 	 */
872 873
 	function _evalxmlLang($path)
@@ -1006,7 +1007,7 @@  discard block
 block discarded – undo
1006 1007
 	/**
1007 1008
 	 * Convert strings of variables in $source_object into UTF-8
1008 1009
 	 *
1009
-	 * @param object $source_obj Conatins strings to convert
1010
+	 * @param stdClass $source_obj Conatins strings to convert
1010 1011
 	 * @return object converted object
1011 1012
 	 */
1012 1013
 	function convertEncoding($source_obj)
@@ -1044,11 +1045,11 @@  discard block
 block discarded – undo
1044 1045
 	/**
1045 1046
 	 * Check flag
1046 1047
 	 *
1047
-	 * @param mixed $val
1048
+	 * @param boolean $val
1048 1049
 	 * @param string $key
1049 1050
 	 * @param mixed $charset charset
1050 1051
 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
1051
-	 * @return void
1052
+	 * @return null|boolean
1052 1053
 	 */
1053 1054
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1054 1055
 	{
@@ -1101,6 +1102,9 @@  discard block
 block discarded – undo
1101 1102
 		return $obj->str;
1102 1103
 	}
1103 1104
 
1105
+	/**
1106
+	 * @return string
1107
+	 */
1104 1108
 	function decodeIdna($domain)
1105 1109
 	{
1106 1110
 		if(strpos($domain, 'xn--') !== FALSE)
@@ -1314,7 +1318,7 @@  discard block
 block discarded – undo
1314 1318
 	 *
1315 1319
 	 * @param string $key Variable key
1316 1320
 	 * @param object $val Variable value
1317
-	 * @return mixed filtered value
1321
+	 * @return string filtered value
1318 1322
 	 */
1319 1323
 	function _filterXmlVars($key, $val)
1320 1324
 	{
@@ -1366,7 +1370,7 @@  discard block
 block discarded – undo
1366 1370
 	 * @see Cast variables, such as _srl, page, and cpage, into interger
1367 1371
 	 * @param string $key Variable key
1368 1372
 	 * @param string $val Variable value
1369
-	 * @param string $do_stripslashes Whether to strip slashes
1373
+	 * @param integer $do_stripslashes Whether to strip slashes
1370 1374
 	 * @return mixed filtered value. Type are string or array
1371 1375
 	 */
1372 1376
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
@@ -1865,7 +1869,7 @@  discard block
 block discarded – undo
1865 1869
 	 *
1866 1870
 	 * @param string $key Key
1867 1871
 	 * @param string $val Value
1868
-	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars.
1872
+	 * @param integer $set_to_get_vars If not FALSE, Set to get vars.
1869 1873
 	 * @return void
1870 1874
 	 */
1871 1875
 	function set($key, $val, $set_to_get_vars = 0)
@@ -1907,7 +1911,7 @@  discard block
 block discarded – undo
1907 1911
 	/**
1908 1912
 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...)
1909 1913
 	 *
1910
-	 * @return object
1914
+	 * @return null|stdClass
1911 1915
 	 */
1912 1916
 	function gets()
1913 1917
 	{
@@ -1980,7 +1984,7 @@  discard block
 block discarded – undo
1980 1984
 	/**
1981 1985
 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
1982 1986
 	 *
1983
-	 * @param string $action act name
1987
+	 * @param string[] $action_array
1984 1988
 	 * @return void
1985 1989
 	 */
1986 1990
 	function addSSLActions($action_array)
@@ -2150,7 +2154,7 @@  discard block
 block discarded – undo
2150 2154
 	 * @param string $file File name with path
2151 2155
 	 * @param string $optimized optimized (That seems to not use)
2152 2156
 	 * @param string $targetie target IE
2153
-	 * @param string $index index
2157
+	 * @param integer $index index
2154 2158
 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
2155 2159
 	 * @param bool $isRuleset Use ruleset
2156 2160
 	 * @param string $autoPath If path not readed, set the path automatically.
@@ -2260,7 +2264,7 @@  discard block
 block discarded – undo
2260 2264
 	 * @param string $optimized optimized (That seems to not use)
2261 2265
 	 * @param string $media Media query
2262 2266
 	 * @param string $targetie target IE
2263
-	 * @param string $index index
2267
+	 * @param integer $index index
2264 2268
 	 * @return void
2265 2269
 	 *
2266 2270
 	 */
Please login to merge, or discard this patch.
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.
Spacing   +237 added lines, -237 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,9 +201,9 @@  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
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
206
-			if(!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']))
206
+			if (!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']))
207 207
 			{
208 208
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
209 209
 			}
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 		$this->_setUploadedArgument();
226 226
 
227 227
 		$this->loadDBInfo();
228
-		if($this->db_info->use_sitelock == 'Y')
228
+		if ($this->db_info->use_sitelock == 'Y')
229 229
 		{
230
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
230
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
231 231
 
232
-			if(!IpFilter::filter($whitelist))
232
+			if (!IpFilter::filter($whitelist))
233 233
 			{
234 234
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
235 235
 				$message = $this->db_info->sitelock_message;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 				define('_XE_SITELOCK_MESSAGE_', $message);
240 240
 
241 241
 				header("HTTP/1.1 403 Forbidden");
242
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
242
+				if (FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
243 243
 				{
244 244
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
245 245
 				}
@@ -252,39 +252,39 @@  discard block
 block discarded – undo
252 252
 		}
253 253
 
254 254
 		// If XE is installed, get virtual site information
255
-		if(self::isInstalled())
255
+		if (self::isInstalled())
256 256
 		{
257 257
 			$oModuleModel = getModel('module');
258 258
 			$site_module_info = $oModuleModel->getDefaultMid();
259 259
 
260
-			if(!isset($site_module_info))
260
+			if (!isset($site_module_info))
261 261
 			{
262 262
 				$site_module_info = new stdClass();
263 263
 			}
264 264
 
265 265
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
266
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
266
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
267 267
 			{
268 268
 				$site_module_info->domain = $this->db_info->default_url;
269 269
 			}
270 270
 
271 271
 			$this->set('site_module_info', $site_module_info);
272
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
272
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
273 273
 			{
274 274
 				$this->set('vid', $site_module_info->domain, TRUE);
275 275
 			}
276 276
 
277
-			if(!isset($this->db_info))
277
+			if (!isset($this->db_info))
278 278
 			{
279 279
 				$this->db_info = new stdClass();
280 280
 			}
281 281
 
282 282
 			$this->db_info->lang_type = $site_module_info->default_language;
283
-			if(!$this->db_info->lang_type)
283
+			if (!$this->db_info->lang_type)
284 284
 			{
285 285
 				$this->db_info->lang_type = 'en';
286 286
 			}
287
-			if(!$this->db_info->use_db_session)
287
+			if (!$this->db_info->use_db_session)
288 288
 			{
289 289
 				$this->db_info->use_db_session = 'N';
290 290
 			}
@@ -294,30 +294,30 @@  discard block
 block discarded – undo
294 294
 		$lang_supported = $this->loadLangSelected();
295 295
 
296 296
 		// Retrieve language type set in user's cookie
297
-		if($this->lang_type = $this->get('l'))
297
+		if ($this->lang_type = $this->get('l'))
298 298
 		{
299
-			if($_COOKIE['lang_type'] != $this->lang_type)
299
+			if ($_COOKIE['lang_type'] != $this->lang_type)
300 300
 			{
301 301
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
302 302
 			}
303 303
 		}
304
-		elseif($_COOKIE['lang_type'])
304
+		elseif ($_COOKIE['lang_type'])
305 305
 		{
306 306
 			$this->lang_type = $_COOKIE['lang_type'];
307 307
 		}
308 308
 
309 309
 		// If it's not exists, follow default language type set in db_info
310
-		if(!$this->lang_type)
310
+		if (!$this->lang_type)
311 311
 		{
312 312
 			$this->lang_type = $this->db_info->lang_type;
313 313
 		}
314 314
 
315 315
 		// if still lang_type has not been set or has not-supported type , set as English.
316
-		if(!$this->lang_type)
316
+		if (!$this->lang_type)
317 317
 		{
318 318
 			$this->lang_type = 'en';
319 319
 		}
320
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
320
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
321 321
 		{
322 322
 			$this->lang_type = 'en';
323 323
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
330 330
 
331 331
 		// set session handler
332
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
332
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
333 333
 		{
334 334
 			$oSessionModel = getModel('session');
335 335
 			$oSessionController = getController('session');
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			);
339 339
 		}
340 340
 
341
-		if($sess = $_POST[session_name()]) session_id($sess);
341
+		if ($sess = $_POST[session_name()]) session_id($sess);
342 342
 		session_start();
343 343
 
344 344
 		// set authentication information in Context and session
345
-		if(self::isInstalled())
345
+		if (self::isInstalled())
346 346
 		{
347 347
 			$oModuleModel = getModel('module');
348 348
 			$oModuleModel->loadModuleExtends();
@@ -350,15 +350,15 @@  discard block
 block discarded – undo
350 350
 			$oMemberModel = getModel('member');
351 351
 			$oMemberController = getController('member');
352 352
 
353
-			if($oMemberController && $oMemberModel)
353
+			if ($oMemberController && $oMemberModel)
354 354
 			{
355 355
 				// if signed in, validate it.
356
-				if($oMemberModel->isLogged())
356
+				if ($oMemberModel->isLogged())
357 357
 				{
358 358
 					$oMemberController->setSessionInfo();
359 359
 				}
360 360
 				// check auto sign-in
361
-				elseif($_COOKIE['xeak'])
361
+				elseif ($_COOKIE['xeak'])
362 362
 				{
363 363
 					$oMemberController->doAutologin();
364 364
 				}
@@ -378,28 +378,28 @@  discard block
 block discarded – undo
378 378
 		// set locations for javascript use
379 379
 		$url = array();
380 380
 		$current_url = self::getRequestUri();
381
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
381
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
382 382
 		{
383
-			if($this->get_vars)
383
+			if ($this->get_vars)
384 384
 			{
385 385
 				$url = array();
386
-				foreach($this->get_vars as $key => $val)
386
+				foreach ($this->get_vars as $key => $val)
387 387
 				{
388
-					if(is_array($val) && count($val) > 0)
388
+					if (is_array($val) && count($val) > 0)
389 389
 					{
390
-						foreach($val as $k => $v)
390
+						foreach ($val as $k => $v)
391 391
 						{
392 392
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
393 393
 						}
394 394
 					}
395
-					elseif($val)
395
+					elseif ($val)
396 396
 					{
397 397
 						$url[] = $key . '=' . urlencode($val);
398 398
 					}
399 399
 				}
400 400
 
401 401
 				$current_url = self::getRequestUri();
402
-				if($url) $current_url .= '?' . join('&', $url);
402
+				if ($url) $current_url .= '?' . join('&', $url);
403 403
 			}
404 404
 			else
405 405
 			{
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 		$this->set('current_url', $current_url);
415 415
 		$this->set('request_uri', self::getRequestUri());
416 416
 
417
-		if(strpos($current_url, 'xn--') !== FALSE)
417
+		if (strpos($current_url, 'xn--') !== FALSE)
418 418
 		{
419 419
 			$this->set('current_url', self::decodeIdna($current_url));
420 420
 		}
421 421
 
422
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
422
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
423 423
 		{
424 424
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
425 425
 		}
@@ -444,19 +444,19 @@  discard block
 block discarded – undo
444 444
 	{
445 445
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
446 446
 
447
-		if(!$self->isInstalled())
447
+		if (!$self->isInstalled())
448 448
 		{
449 449
 			return;
450 450
 		}
451 451
 
452 452
 		$config_file = $self->getConfigFile();
453
-		if(is_readable($config_file))
453
+		if (is_readable($config_file))
454 454
 		{
455 455
 			include($config_file);
456 456
 		}
457 457
 
458 458
 		// If master_db information does not exist, the config file needs to be updated
459
-		if(!isset($db_info->master_db))
459
+		if (!isset($db_info->master_db))
460 460
 		{
461 461
 			$db_info->master_db = array();
462 462
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
475 475
 			unset($db_info->db_table_prefix);
476 476
 
477
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
477
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
478 478
 			{
479 479
 				$db_info->master_db["db_table_prefix"] .= '_';
480 480
 			}
@@ -486,33 +486,33 @@  discard block
 block discarded – undo
486 486
 			$oInstallController->makeConfigFile();
487 487
 		}
488 488
 
489
-		if(!$db_info->use_prepared_statements)
489
+		if (!$db_info->use_prepared_statements)
490 490
 		{
491 491
 			$db_info->use_prepared_statements = 'Y';
492 492
 		}
493 493
 
494
-		if(!$db_info->time_zone)
494
+		if (!$db_info->time_zone)
495 495
 			$db_info->time_zone = date('O');
496 496
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
497 497
 
498
-		if($db_info->qmail_compatibility != 'Y')
498
+		if ($db_info->qmail_compatibility != 'Y')
499 499
 			$db_info->qmail_compatibility = 'N';
500 500
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
501 501
 
502
-		if(!$db_info->use_db_session)
502
+		if (!$db_info->use_db_session)
503 503
 			$db_info->use_db_session = 'N';
504
-		if(!$db_info->use_ssl)
504
+		if (!$db_info->use_ssl)
505 505
 			$db_info->use_ssl = 'none';
506 506
 		$this->set('_use_ssl', $db_info->use_ssl);
507 507
 
508 508
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
509 509
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
510 510
 
511
-		if(!$db_info->sitelock_whitelist) {
511
+		if (!$db_info->sitelock_whitelist) {
512 512
 			$db_info->sitelock_whitelist = '127.0.0.1';
513 513
 		}
514 514
 
515
-		if(is_string($db_info->sitelock_whitelist)) {
515
+		if (is_string($db_info->sitelock_whitelist)) {
516 516
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
517 517
 		}
518 518
 
@@ -583,10 +583,10 @@  discard block
 block discarded – undo
583 583
 	function loadLangSupported()
584 584
 	{
585 585
 		static $lang_supported = null;
586
-		if(!$lang_supported)
586
+		if (!$lang_supported)
587 587
 		{
588 588
 			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
589
-			foreach($langs as $val)
589
+			foreach ($langs as $val)
590 590
 			{
591 591
 				list($lang_prefix, $lang_text) = explode(',', $val);
592 592
 				$lang_text = trim($lang_text);
@@ -604,17 +604,17 @@  discard block
 block discarded – undo
604 604
 	function loadLangSelected()
605 605
 	{
606 606
 		static $lang_selected = null;
607
-		if(!$lang_selected)
607
+		if (!$lang_selected)
608 608
 		{
609 609
 			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
610 610
 			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
611
-			if(!FileHandler::hasContent($selected_lang_file))
611
+			if (!FileHandler::hasContent($selected_lang_file))
612 612
 			{
613 613
 				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
614 614
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
615 615
 			}
616 616
 
617
-			if(!FileHandler::hasContent($selected_lang_file))
617
+			if (!FileHandler::hasContent($selected_lang_file))
618 618
 			{
619 619
 				$buff = FileHandler::readFile($orig_lang_file);
620 620
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 			else
624 624
 			{
625 625
 				$langs = file($selected_lang_file);
626
-				foreach($langs as $val)
626
+				foreach ($langs as $val)
627 627
 				{
628 628
 					list($lang_prefix, $lang_text) = explode(',', $val);
629 629
 					$lang_text = trim($lang_text);
@@ -642,32 +642,32 @@  discard block
 block discarded – undo
642 642
 	function checkSSO()
643 643
 	{
644 644
 		// pass if it's not GET request or XE is not yet installed
645
-		if($this->db_info->use_sso != 'Y' || isCrawler())
645
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
646 646
 		{
647 647
 			return TRUE;
648 648
 		}
649 649
 		$checkActList = array('rss' => 1, 'atom' => 1);
650
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
650
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
651 651
 		{
652 652
 			return TRUE;
653 653
 		}
654 654
 
655 655
 		// pass if default URL is not set
656 656
 		$default_url = trim($this->db_info->default_url);
657
-		if(!$default_url)
657
+		if (!$default_url)
658 658
 		{
659 659
 			return TRUE;
660 660
 		}
661 661
 
662
-		if(substr_compare($default_url, '/', -1) !== 0)
662
+		if (substr_compare($default_url, '/', -1) !== 0)
663 663
 		{
664 664
 			$default_url .= '/';
665 665
 		}
666 666
 
667 667
 		// for sites recieving SSO valdiation
668
-		if($default_url == self::getRequestUri())
668
+		if ($default_url == self::getRequestUri())
669 669
 		{
670
-			if(self::get('default_url'))
670
+			if (self::get('default_url'))
671 671
 			{
672 672
 				$url = base64_decode(self::get('default_url'));
673 673
 				$url_info = parse_url($url);
@@ -675,14 +675,14 @@  discard block
 block discarded – undo
675 675
 				$oModuleModel = getModel('module');
676 676
 				$target_domain = (stripos($url, $default_url) !== 0) ? $url_info['host'] : $default_url;
677 677
 				$site_info = $oModuleModel->getSiteInfoByDomain($target_domain);
678
-				if(!$site_info->site_srl) {
678
+				if (!$site_info->site_srl) {
679 679
 					$oModuleObject = new ModuleObject();
680 680
 					$oModuleObject->stop('msg_invalid_request');
681 681
 
682 682
 					return false;
683 683
 				}
684 684
 
685
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id();
685
+				$url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id();
686 686
 				$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']);
687 687
 				header('location:' . $redirect_url);
688 688
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 		else
694 694
 		{
695 695
 			// result handling : set session_name()
696
-			if($session_name = self::get('SSOID'))
696
+			if ($session_name = self::get('SSOID'))
697 697
 			{
698 698
 				setcookie(session_name(), $session_name);
699 699
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 				return FALSE;
703 703
 				// send SSO request
704 704
 			}
705
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
705
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
706 706
 			{
707 707
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
708 708
 				$url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl()));
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 	{
734 734
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
735 735
 
736
-		if(!$self->isFTPRegisted())
736
+		if (!$self->isFTPRegisted())
737 737
 		{
738 738
 			return null;
739 739
 		}
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 	 */
752 752
 	function addBrowserTitle($site_title)
753 753
 	{
754
-		if(!$site_title)
754
+		if (!$site_title)
755 755
 		{
756 756
 			return;
757 757
 		}
758 758
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
759 759
 
760
-		if($self->site_title)
760
+		if ($self->site_title)
761 761
 		{
762 762
 			$self->site_title .= ' - ' . $site_title;
763 763
 		}
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 	 */
776 776
 	function setBrowserTitle($site_title)
777 777
 	{
778
-		if(!$site_title)
778
+		if (!$site_title)
779 779
 		{
780 780
 			return;
781 781
 		}
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 		$oModuleModel = getModel('module');
808 808
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
809 809
 
810
-		if(isset($moduleConfig->siteTitle))
810
+		if (isset($moduleConfig->siteTitle))
811 811
 		{
812 812
 			return $moduleConfig->siteTitle;
813 813
 		}
@@ -834,30 +834,30 @@  discard block
 block discarded – undo
834 834
 		global $lang;
835 835
 
836 836
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
837
-		if(!$self->lang_type)
837
+		if (!$self->lang_type)
838 838
 		{
839 839
 			return;
840 840
 		}
841
-		if(!is_object($lang))
841
+		if (!is_object($lang))
842 842
 		{
843 843
 			$lang = new stdClass;
844 844
 		}
845 845
 
846
-		if(!($filename = $self->_loadXmlLang($path)))
846
+		if (!($filename = $self->_loadXmlLang($path)))
847 847
 		{
848 848
 			$filename = $self->_loadPhpLang($path);
849 849
 		}
850 850
 
851
-		if(!is_array($self->loaded_lang_files))
851
+		if (!is_array($self->loaded_lang_files))
852 852
 		{
853 853
 			$self->loaded_lang_files = array();
854 854
 		}
855
-		if(in_array($filename, $self->loaded_lang_files))
855
+		if (in_array($filename, $self->loaded_lang_files))
856 856
 		{
857 857
 			return;
858 858
 		}
859 859
 
860
-		if($filename && is_readable($filename))
860
+		if ($filename && is_readable($filename))
861 861
 		{
862 862
 			$self->loaded_lang_files[] = $filename;
863 863
 			include($filename);
@@ -878,16 +878,16 @@  discard block
 block discarded – undo
878 878
 	{
879 879
 		global $lang;
880 880
 
881
-		if(!$path) return;
881
+		if (!$path) return;
882 882
 
883 883
 		$_path = 'eval://' . $path;
884 884
 
885
-		if(in_array($_path, $this->loaded_lang_files))
885
+		if (in_array($_path, $this->loaded_lang_files))
886 886
 		{
887 887
 			return;
888 888
 		}
889 889
 
890
-		if(substr_compare($path, '/', -1) !== 0)
890
+		if (substr_compare($path, '/', -1) !== 0)
891 891
 		{
892 892
 			$path .= '/';
893 893
 		}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
896 896
 		$content = $oXmlLangParser->getCompileContent();
897 897
 
898
-		if($content)
898
+		if ($content)
899 899
 		{
900 900
 			$this->loaded_lang_files[] = $_path;
901 901
 			eval($content);
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	 */
911 911
 	function _loadXmlLang($path)
912 912
 	{
913
-		if(!$path) return;
913
+		if (!$path) return;
914 914
 
915 915
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
916 916
 		return $oXmlLangParser->compile();
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function _loadPhpLang($path)
926 926
 	{
927
-		if(!$path) return;
927
+		if (!$path) return;
928 928
 
929
-		if(substr_compare($path, '/', -1) !== 0)
929
+		if (substr_compare($path, '/', -1) !== 0)
930 930
 		{
931 931
 			$path .= '/';
932 932
 		}
@@ -934,12 +934,12 @@  discard block
 block discarded – undo
934 934
 		$file = sprintf($path_tpl, $this->lang_type);
935 935
 
936 936
 		$langs = array('ko', 'en'); // this will be configurable.
937
-		while(!is_readable($file) && $langs[0])
937
+		while (!is_readable($file) && $langs[0])
938 938
 		{
939 939
 			$file = sprintf($path_tpl, array_shift($langs));
940 940
 		}
941 941
 
942
-		if(!is_readable($file))
942
+		if (!is_readable($file))
943 943
 		{
944 944
 			return FALSE;
945 945
 		}
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 	 */
982 982
 	function getLang($code)
983 983
 	{
984
-		if(!$code)
984
+		if (!$code)
985 985
 		{
986 986
 			return;
987 987
 		}
988
-		if($GLOBALS['lang']->{$code})
988
+		if ($GLOBALS['lang']->{$code})
989 989
 		{
990 990
 			return $GLOBALS['lang']->{$code};
991 991
 		}
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	 */
1002 1002
 	function setLang($code, $val)
1003 1003
 	{
1004
-		if(!isset($GLOBALS['lang']))
1004
+		if (!isset($GLOBALS['lang']))
1005 1005
 		{
1006 1006
 			$GLOBALS['lang'] = new stdClass();
1007 1007
 		}
@@ -1029,17 +1029,17 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
 		$obj = clone $source_obj;
1031 1031
 
1032
-		foreach($charset_list as $charset)
1032
+		foreach ($charset_list as $charset)
1033 1033
 		{
1034
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1034
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1035 1035
 			$flag = self::checkConvertFlag($flag = TRUE);
1036
-			if($flag)
1036
+			if ($flag)
1037 1037
 			{
1038
-				if($charset == 'UTF-8')
1038
+				if ($charset == 'UTF-8')
1039 1039
 				{
1040 1040
 					return $obj;
1041 1041
 				}
1042
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1042
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1043 1043
 				return $obj;
1044 1044
 			}
1045 1045
 		}
@@ -1058,11 +1058,11 @@  discard block
 block discarded – undo
1058 1058
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1059 1059
 	{
1060 1060
 		static $flag = TRUE;
1061
-		if($charset)
1061
+		if ($charset)
1062 1062
 		{
1063
-			if(is_array($val))
1064
-				array_walk($val,'Context::checkConvertFlag',$charset);
1065
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1063
+			if (is_array($val))
1064
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1065
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1066 1066
 			else $flag = FALSE;
1067 1067
 		}
1068 1068
 		else
@@ -1086,9 +1086,9 @@  discard block
 block discarded – undo
1086 1086
 	{
1087 1087
 		if (is_array($val))
1088 1088
 		{
1089
-			array_walk($val,'Context::doConvertEncoding',$charset);
1089
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1090 1090
 		}
1091
-		else $val = iconv($charset,'UTF-8',$val);
1091
+		else $val = iconv($charset, 'UTF-8', $val);
1092 1092
 	}
1093 1093
 
1094 1094
 	/**
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 	 */
1100 1100
 	function convertEncodingStr($str)
1101 1101
 	{
1102
-        if(!$str) return null;
1102
+        if (!$str) return null;
1103 1103
 		$obj = new stdClass();
1104 1104
 		$obj->str = $str;
1105 1105
 		$obj = self::convertEncoding($obj);
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 	function decodeIdna($domain)
1110 1110
 	{
1111
-		if(strpos($domain, 'xn--') !== FALSE)
1111
+		if (strpos($domain, 'xn--') !== FALSE)
1112 1112
 		{
1113 1113
 			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1114 1114
 			$IDN = new idna_convert(array('idn_version' => 2008));
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	{
1142 1142
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1143 1143
 
1144
-		if($self->response_method)
1144
+		if ($self->response_method)
1145 1145
 		{
1146 1146
 			return $self->response_method;
1147 1147
 		}
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1182 1182
 
1183 1183
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1184
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1184
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1185 1185
 		{
1186 1186
 			$this->isSuccessInit = FALSE;
1187 1187
 		}
@@ -1194,30 +1194,30 @@  discard block
 block discarded – undo
1194 1194
 	 */
1195 1195
 	function _setRequestArgument()
1196 1196
 	{
1197
-		if(!count($_REQUEST))
1197
+		if (!count($_REQUEST))
1198 1198
 		{
1199 1199
 			return;
1200 1200
 		}
1201 1201
 
1202 1202
 		$requestMethod = $this->getRequestMethod();
1203
-		foreach($_REQUEST as $key => $val)
1203
+		foreach ($_REQUEST as $key => $val)
1204 1204
 		{
1205
-			if($val === '' || self::get($key))
1205
+			if ($val === '' || self::get($key))
1206 1206
 			{
1207 1207
 				continue;
1208 1208
 			}
1209 1209
 			$key = htmlentities($key);
1210 1210
 			$val = $this->_filterRequestVar($key, $val);
1211 1211
 
1212
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1212
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1213 1213
 			{
1214 1214
 				$set_to_vars = TRUE;
1215 1215
 			}
1216
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1216
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1217 1217
 			{
1218 1218
 				$set_to_vars = TRUE;
1219 1219
 			}
1220
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1220
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1221 1221
 			{
1222 1222
 				$set_to_vars = TRUE;
1223 1223
 			}
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 				$set_to_vars = FALSE;
1227 1227
 			}
1228 1228
 
1229
-			if($set_to_vars)
1229
+			if ($set_to_vars)
1230 1230
 			{
1231 1231
 				$this->_recursiveCheckVar($val);
1232 1232
 			}
@@ -1237,20 +1237,20 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 	function _recursiveCheckVar($val)
1239 1239
 	{
1240
-		if(is_string($val))
1240
+		if (is_string($val))
1241 1241
 		{
1242
-			foreach($this->patterns as $pattern)
1242
+			foreach ($this->patterns as $pattern)
1243 1243
 			{
1244
-				if(preg_match($pattern, $val))
1244
+				if (preg_match($pattern, $val))
1245 1245
 				{
1246 1246
 					$this->isSuccessInit = FALSE;
1247 1247
 					return;
1248 1248
 				}
1249 1249
 			}
1250 1250
 		}
1251
-		else if(is_array($val))
1251
+		else if (is_array($val))
1252 1252
 		{
1253
-			foreach($val as $val2)
1253
+			foreach ($val as $val2)
1254 1254
 			{
1255 1255
 				$this->_recursiveCheckVar($val2);
1256 1256
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	 */
1265 1265
 	function _setJSONRequestArgument()
1266 1266
 	{
1267
-		if($this->getRequestMethod() != 'JSON')
1267
+		if ($this->getRequestMethod() != 'JSON')
1268 1268
 		{
1269 1269
 			return;
1270 1270
 		}
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 		$params = array();
1273 1273
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1274 1274
 
1275
-		foreach($params as $key => $val)
1275
+		foreach ($params as $key => $val)
1276 1276
 		{
1277 1277
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1278 1278
 		}
@@ -1285,13 +1285,13 @@  discard block
 block discarded – undo
1285 1285
 	 */
1286 1286
 	function _setXmlRpcArgument()
1287 1287
 	{
1288
-		if($this->getRequestMethod() != 'XMLRPC')
1288
+		if ($this->getRequestMethod() != 'XMLRPC')
1289 1289
 		{
1290 1290
 			return;
1291 1291
 		}
1292 1292
 
1293 1293
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1294
-		if(Security::detectingXEE($xml))
1294
+		if (Security::detectingXEE($xml))
1295 1295
 		{
1296 1296
 			header("HTTP/1.0 400 Bad Request");
1297 1297
 			exit;
@@ -1303,12 +1303,12 @@  discard block
 block discarded – undo
1303 1303
 		$params = $xml_obj->methodcall->params;
1304 1304
 		unset($params->node_name, $params->attrs, $params->body);
1305 1305
 
1306
-		if(!count(get_object_vars($params)))
1306
+		if (!count(get_object_vars($params)))
1307 1307
 		{
1308 1308
 			return;
1309 1309
 		}
1310 1310
 
1311
-		foreach($params as $key => $val)
1311
+		foreach ($params as $key => $val)
1312 1312
 		{
1313 1313
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1314 1314
 		}
@@ -1323,10 +1323,10 @@  discard block
 block discarded – undo
1323 1323
 	 */
1324 1324
 	function _filterXmlVars($key, $val)
1325 1325
 	{
1326
-		if(is_array($val))
1326
+		if (is_array($val))
1327 1327
 		{
1328 1328
 			$stack = array();
1329
-			foreach($val as $k => $v)
1329
+			foreach ($val as $k => $v)
1330 1330
 			{
1331 1331
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1332 1332
 			}
@@ -1336,20 +1336,20 @@  discard block
 block discarded – undo
1336 1336
 
1337 1337
 		$body = $val->body;
1338 1338
 		unset($val->node_name, $val->attrs, $val->body);
1339
-		if(!count(get_object_vars($val)))
1339
+		if (!count(get_object_vars($val)))
1340 1340
 		{
1341 1341
 			return $this->_filterRequestVar($key, $body, 0);
1342 1342
 		}
1343 1343
 
1344 1344
 		$stack = new stdClass();
1345
-		foreach($val as $k => $v)
1345
+		foreach ($val as $k => $v)
1346 1346
 		{
1347 1347
 			$output = $this->_filterXmlVars($k, $v);
1348
-			if(is_object($v) && $v->attrs->type == 'array')
1348
+			if (is_object($v) && $v->attrs->type == 'array')
1349 1349
 			{
1350 1350
 				$output = array($output);
1351 1351
 			}
1352
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1352
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1353 1353
 			{
1354 1354
 				return $output;
1355 1355
 			}
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 			$stack->{$k} = $output;
1358 1358
 		}
1359 1359
 
1360
-		if(!count(get_object_vars($stack)))
1360
+		if (!count(get_object_vars($stack)))
1361 1361
 		{
1362 1362
 			return NULL;
1363 1363
 		}
@@ -1376,24 +1376,24 @@  discard block
 block discarded – undo
1376 1376
 	 */
1377 1377
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1378 1378
 	{
1379
-		if(!($isArray = is_array($val)))
1379
+		if (!($isArray = is_array($val)))
1380 1380
 		{
1381 1381
 			$val = array($val);
1382 1382
 		}
1383 1383
 
1384 1384
 		$result = array();
1385
-		foreach($val as $k => $v)
1385
+		foreach ($val as $k => $v)
1386 1386
 		{
1387 1387
 			$k = htmlentities($k);
1388
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1388
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1389 1389
 			{
1390 1390
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1391 1391
 			}
1392
-			elseif($key === 'mid' || $key === 'search_keyword')
1392
+			elseif ($key === 'mid' || $key === 'search_keyword')
1393 1393
 			{
1394 1394
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1395 1395
 			}
1396
-			elseif($key === 'vid')
1396
+			elseif ($key === 'vid')
1397 1397
 			{
1398 1398
 				$result[$k] = urlencode($v);
1399 1399
 			}
@@ -1401,12 +1401,12 @@  discard block
 block discarded – undo
1401 1401
 			{
1402 1402
 				$result[$k] = $v;
1403 1403
 
1404
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1404
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1405 1405
 				{
1406 1406
 					$result[$k] = stripslashes($result[$k]);
1407 1407
 				}
1408 1408
 
1409
-				if(!is_array($result[$k]))
1409
+				if (!is_array($result[$k]))
1410 1410
 				{
1411 1411
 					$result[$k] = trim($result[$k]);
1412 1412
 				}
@@ -1434,17 +1434,17 @@  discard block
 block discarded – undo
1434 1434
 	 */
1435 1435
 	function _setUploadedArgument()
1436 1436
 	{
1437
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1437
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1438 1438
 		{
1439 1439
 			return;
1440 1440
 		}
1441 1441
 
1442
-		foreach($_FILES as $key => $val)
1442
+		foreach ($_FILES as $key => $val)
1443 1443
 		{
1444 1444
 			$tmp_name = $val['tmp_name'];
1445
-			if(!is_array($tmp_name))
1445
+			if (!is_array($tmp_name))
1446 1446
 			{
1447
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1447
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1448 1448
 				{
1449 1449
 					continue;
1450 1450
 				}
@@ -1454,9 +1454,9 @@  discard block
 block discarded – undo
1454 1454
 			}
1455 1455
 			else
1456 1456
 			{
1457
-				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1457
+				for ($i = 0, $c = count($tmp_name); $i < $c; $i++)
1458 1458
 				{
1459
-					if($val['size'][$i] > 0)
1459
+					if ($val['size'][$i] > 0)
1460 1460
 					{
1461 1461
 						$file['name'] = $val['name'][$i];
1462 1462
 						$file['type'] = $val['type'][$i];
@@ -1488,12 +1488,12 @@  discard block
 block discarded – undo
1488 1488
 	function getRequestUrl()
1489 1489
 	{
1490 1490
 		static $url = null;
1491
-		if(is_null($url))
1491
+		if (is_null($url))
1492 1492
 		{
1493 1493
 			$url = self::getRequestUri();
1494
-			if(count($_GET) > 0)
1494
+			if (count($_GET) > 0)
1495 1495
 			{
1496
-				foreach($_GET as $key => $val)
1496
+				foreach ($_GET as $key => $val)
1497 1497
 				{
1498 1498
 					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1499 1499
 				}
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1513 1513
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1514 1514
 
1515
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1515
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1516 1516
 		{
1517 1517
 			unset($js_callback_func);
1518 1518
 			unset($_GET['xe_js_callback']);
@@ -1540,22 +1540,22 @@  discard block
 block discarded – undo
1540 1540
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1541 1541
 
1542 1542
 		// retrieve virtual site information
1543
-		if(is_null($site_module_info))
1543
+		if (is_null($site_module_info))
1544 1544
 		{
1545 1545
 			$site_module_info = self::get('site_module_info');
1546 1546
 		}
1547 1547
 
1548 1548
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1549
-		if($domain && isSiteID($domain))
1549
+		if ($domain && isSiteID($domain))
1550 1550
 		{
1551 1551
 			$vid = $domain;
1552 1552
 			$domain = '';
1553 1553
 		}
1554 1554
 
1555 1555
 		// If $domain, $vid are not set, use current site information
1556
-		if(!$domain && !$vid)
1556
+		if (!$domain && !$vid)
1557 1557
 		{
1558
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1558
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1559 1559
 			{
1560 1560
 				$vid = $site_module_info->domain;
1561 1561
 			}
@@ -1566,21 +1566,21 @@  discard block
 block discarded – undo
1566 1566
 		}
1567 1567
 
1568 1568
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1569
-		if($domain)
1569
+		if ($domain)
1570 1570
 		{
1571 1571
 			$domain_info = parse_url($domain);
1572
-			if(is_null($current_info))
1572
+			if (is_null($current_info))
1573 1573
 			{
1574 1574
 				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1575 1575
 			}
1576
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1576
+			if ($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1577 1577
 			{
1578 1578
 				unset($domain);
1579 1579
 			}
1580 1580
 			else
1581 1581
 			{
1582 1582
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1583
-				if(substr_compare($domain, '/', -1) !== 0)
1583
+				if (substr_compare($domain, '/', -1) !== 0)
1584 1584
 				{
1585 1585
 					$domain .= '/';
1586 1586
 				}
@@ -1590,10 +1590,10 @@  discard block
 block discarded – undo
1590 1590
 		$get_vars = array();
1591 1591
 
1592 1592
 		// If there is no GET variables or first argument is '' to reset variables
1593
-		if(!$self->get_vars || $args_list[0] == '')
1593
+		if (!$self->get_vars || $args_list[0] == '')
1594 1594
 		{
1595 1595
 			// rearrange args_list
1596
-			if(is_array($args_list) && $args_list[0] == '')
1596
+			if (is_array($args_list) && $args_list[0] == '')
1597 1597
 			{
1598 1598
 				array_shift($args_list);
1599 1599
 			}
@@ -1605,13 +1605,13 @@  discard block
 block discarded – undo
1605 1605
 		}
1606 1606
 
1607 1607
 		// arrange args_list
1608
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1608
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1609 1609
 		{
1610 1610
 			$key = $args_list[$i];
1611 1611
 			$val = trim($args_list[$i + 1]);
1612 1612
 
1613 1613
 			// If value is not set, remove the key
1614
-			if(!isset($val) || !strlen($val))
1614
+			if (!isset($val) || !strlen($val))
1615 1615
 			{
1616 1616
 				unset($get_vars[$key]);
1617 1617
 				continue;
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
 		// remove vid, rnd
1624 1624
 		unset($get_vars['rnd']);
1625
-		if($vid)
1625
+		if ($vid)
1626 1626
 		{
1627 1627
 			$get_vars['vid'] = $vid;
1628 1628
 		}
@@ -1639,17 +1639,17 @@  discard block
 block discarded – undo
1639 1639
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1640 1640
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1641 1641
 		);
1642
-		if($act_alias[$act])
1642
+		if ($act_alias[$act])
1643 1643
 		{
1644 1644
 			$get_vars['act'] = $act_alias[$act];
1645 1645
 		}
1646 1646
 
1647 1647
 		// organize URL
1648 1648
 		$query = '';
1649
-		if(count($get_vars) > 0)
1649
+		if (count($get_vars) > 0)
1650 1650
 		{
1651 1651
 			// if using rewrite mod
1652
-			if($self->allow_rewrite)
1652
+			if ($self->allow_rewrite)
1653 1653
 			{
1654 1654
 				$var_keys = array_keys($get_vars);
1655 1655
 				sort($var_keys);
@@ -1687,24 +1687,24 @@  discard block
 block discarded – undo
1687 1687
 				$query = $target_map[$target];
1688 1688
 			}
1689 1689
 
1690
-			if(!$query)
1690
+			if (!$query)
1691 1691
 			{
1692 1692
 				$queries = array();
1693
-				foreach($get_vars as $key => $val)
1693
+				foreach ($get_vars as $key => $val)
1694 1694
 				{
1695
-					if(is_array($val) && count($val) > 0)
1695
+					if (is_array($val) && count($val) > 0)
1696 1696
 					{
1697
-						foreach($val as $k => $v)
1697
+						foreach ($val as $k => $v)
1698 1698
 						{
1699 1699
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1700 1700
 						}
1701 1701
 					}
1702
-					elseif(!is_array($val))
1702
+					elseif (!is_array($val))
1703 1703
 					{
1704 1704
 						$queries[] = $key . '=' . urlencode($val);
1705 1705
 					}
1706 1706
 				}
1707
-				if(count($queries) > 0)
1707
+				if (count($queries) > 0)
1708 1708
 				{
1709 1709
 					$query = 'index.php?' . join('&', $queries);
1710 1710
 				}
@@ -1713,12 +1713,12 @@  discard block
 block discarded – undo
1713 1713
 
1714 1714
 		// If using SSL always
1715 1715
 		$_use_ssl = $self->get('_use_ssl');
1716
-		if($_use_ssl == 'always')
1716
+		if ($_use_ssl == 'always')
1717 1717
 		{
1718 1718
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1719 1719
 			// optional SSL use
1720 1720
 		}
1721
-		elseif($_use_ssl == 'optional')
1721
+		elseif ($_use_ssl == 'optional')
1722 1722
 		{
1723 1723
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1724 1724
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
@@ -1727,11 +1727,11 @@  discard block
 block discarded – undo
1727 1727
 		else
1728 1728
 		{
1729 1729
 			// currently on SSL but target is not based on SSL
1730
-			if($_SERVER['HTTPS'] == 'on')
1730
+			if ($_SERVER['HTTPS'] == 'on')
1731 1731
 			{
1732 1732
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1733 1733
 			}
1734
-			else if($domain) // if $domain is set
1734
+			else if ($domain) // if $domain is set
1735 1735
 			{
1736 1736
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1737 1737
 			}
@@ -1741,12 +1741,12 @@  discard block
 block discarded – undo
1741 1741
 			}
1742 1742
 		}
1743 1743
 
1744
-		if(!$encode)
1744
+		if (!$encode)
1745 1745
 		{
1746 1746
 			return $query;
1747 1747
 		}
1748 1748
 
1749
-		if(!$autoEncode)
1749
+		if (!$autoEncode)
1750 1750
 		{
1751 1751
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1752 1752
 		}
@@ -1755,9 +1755,9 @@  discard block
 block discarded – undo
1755 1755
 		$encode_queries = array();
1756 1756
 		$parsedUrl = parse_url($query);
1757 1757
 		parse_str($parsedUrl['query'], $output);
1758
-		foreach($output as $key => $value)
1758
+		foreach ($output as $key => $value)
1759 1759
 		{
1760
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1760
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1761 1761
 			{
1762 1762
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1763 1763
 			}
@@ -1779,17 +1779,17 @@  discard block
 block discarded – undo
1779 1779
 		static $url = array();
1780 1780
 
1781 1781
 		// Check HTTP Request
1782
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1782
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1783 1783
 		{
1784 1784
 			return;
1785 1785
 		}
1786 1786
 
1787
-		if(self::get('_use_ssl') == 'always')
1787
+		if (self::get('_use_ssl') == 'always')
1788 1788
 		{
1789 1789
 			$ssl_mode = ENFORCE_SSL;
1790 1790
 		}
1791 1791
 
1792
-		if($domain)
1792
+		if ($domain)
1793 1793
 		{
1794 1794
 			$domain_key = md5($domain);
1795 1795
 		}
@@ -1798,14 +1798,14 @@  discard block
 block discarded – undo
1798 1798
 			$domain_key = 'default';
1799 1799
 		}
1800 1800
 
1801
-		if(isset($url[$ssl_mode][$domain_key]))
1801
+		if (isset($url[$ssl_mode][$domain_key]))
1802 1802
 		{
1803 1803
 			return $url[$ssl_mode][$domain_key];
1804 1804
 		}
1805 1805
 
1806 1806
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1807 1807
 
1808
-		switch($ssl_mode)
1808
+		switch ($ssl_mode)
1809 1809
 		{
1810 1810
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1811 1811
 				break;
@@ -1815,12 +1815,12 @@  discard block
 block discarded – undo
1815 1815
 				break;
1816 1816
 		}
1817 1817
 
1818
-		if($domain)
1818
+		if ($domain)
1819 1819
 		{
1820 1820
 			$target_url = trim($domain);
1821
-			if(substr_compare($target_url, '/', -1) !== 0)
1821
+			if (substr_compare($target_url, '/', -1) !== 0)
1822 1822
 			{
1823
-				$target_url.= '/';
1823
+				$target_url .= '/';
1824 1824
 			}
1825 1825
 		}
1826 1826
 		else
@@ -1830,19 +1830,19 @@  discard block
 block discarded – undo
1830 1830
 
1831 1831
 		$url_info = parse_url('http://' . $target_url);
1832 1832
 
1833
-		if($current_use_ssl != $use_ssl)
1833
+		if ($current_use_ssl != $use_ssl)
1834 1834
 		{
1835 1835
 			unset($url_info['port']);
1836 1836
 		}
1837 1837
 
1838
-		if($use_ssl)
1838
+		if ($use_ssl)
1839 1839
 		{
1840 1840
 			$port = self::get('_https_port');
1841
-			if($port && $port != 443)
1841
+			if ($port && $port != 443)
1842 1842
 			{
1843 1843
 				$url_info['port'] = $port;
1844 1844
 			}
1845
-			elseif($url_info['port'] == 443)
1845
+			elseif ($url_info['port'] == 443)
1846 1846
 			{
1847 1847
 				unset($url_info['port']);
1848 1848
 			}
@@ -1850,11 +1850,11 @@  discard block
 block discarded – undo
1850 1850
 		else
1851 1851
 		{
1852 1852
 			$port = self::get('_http_port');
1853
-			if($port && $port != 80)
1853
+			if ($port && $port != 80)
1854 1854
 			{
1855 1855
 				$url_info['port'] = $port;
1856 1856
 			}
1857
-			elseif($url_info['port'] == 80)
1857
+			elseif ($url_info['port'] == 80)
1858 1858
 			{
1859 1859
 				unset($url_info['port']);
1860 1860
 			}
@@ -1877,16 +1877,16 @@  discard block
 block discarded – undo
1877 1877
 	{
1878 1878
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1879 1879
 		$self->context->{$key} = $val;
1880
-		if($set_to_get_vars === FALSE)
1880
+		if ($set_to_get_vars === FALSE)
1881 1881
 		{
1882 1882
 			return;
1883 1883
 		}
1884
-		if($val === NULL || $val === '')
1884
+		if ($val === NULL || $val === '')
1885 1885
 		{
1886 1886
 			unset($self->get_vars->{$key});
1887 1887
 			return;
1888 1888
 		}
1889
-		if($set_to_get_vars || $self->get_vars->{$key})
1889
+		if ($set_to_get_vars || $self->get_vars->{$key})
1890 1890
 		{
1891 1891
 			$self->get_vars->{$key} = $val;
1892 1892
 		}
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 	{
1903 1903
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1904 1904
 
1905
-		if(!isset($self->context->{$key}))
1905
+		if (!isset($self->context->{$key}))
1906 1906
 		{
1907 1907
 			return null;
1908 1908
 		}
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 	function gets()
1918 1918
 	{
1919 1919
 		$num_args = func_num_args();
1920
-		if($num_args < 1)
1920
+		if ($num_args < 1)
1921 1921
 		{
1922 1922
 			return;
1923 1923
 		}
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 
1926 1926
 		$args_list = func_get_args();
1927 1927
 		$output = new stdClass();
1928
-		foreach($args_list as $v)
1928
+		foreach ($args_list as $v)
1929 1929
 		{
1930 1930
 			$output->{$v} = $self->get($v);
1931 1931
 		}
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 	function getRequestVars()
1952 1952
 	{
1953 1953
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1954
-		if($self->get_vars)
1954
+		if ($self->get_vars)
1955 1955
 		{
1956 1956
 			return clone($self->get_vars);
1957 1957
 		}
@@ -1968,13 +1968,13 @@  discard block
 block discarded – undo
1968 1968
 	{
1969 1969
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1970 1970
 
1971
-		if(!is_readable($self->sslActionCacheFile))
1971
+		if (!is_readable($self->sslActionCacheFile))
1972 1972
 		{
1973 1973
 			$buff = '<?php if(!defined("__XE__"))exit;';
1974 1974
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
1975 1975
 		}
1976 1976
 
1977
-		if(!isset($self->ssl_actions[$action]))
1977
+		if (!isset($self->ssl_actions[$action]))
1978 1978
 		{
1979 1979
 			$self->ssl_actions[$action] = 1;
1980 1980
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -1992,16 +1992,16 @@  discard block
 block discarded – undo
1992 1992
 	{
1993 1993
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1994 1994
 
1995
-		if(!is_readable($self->sslActionCacheFile))
1995
+		if (!is_readable($self->sslActionCacheFile))
1996 1996
 		{
1997 1997
 			unset($self->ssl_actions);
1998 1998
 			$buff = '<?php if(!defined("__XE__"))exit;';
1999 1999
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2000 2000
 		}
2001 2001
 
2002
-		foreach($action_array as $action)
2002
+		foreach ($action_array as $action)
2003 2003
 		{
2004
-			if(!isset($self->ssl_actions[$action]))
2004
+			if (!isset($self->ssl_actions[$action]))
2005 2005
 			{
2006 2006
 				$self->ssl_actions[$action] = 1;
2007 2007
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 	{
2021 2021
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2022 2022
 
2023
-		if($self->isExistsSSLAction($action))
2023
+		if ($self->isExistsSSLAction($action))
2024 2024
 		{
2025 2025
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2026 2026
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2037,7 +2037,7 @@  discard block
 block discarded – undo
2037 2037
 	function getSSLActions()
2038 2038
 	{
2039 2039
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2040
-		if($self->getSslStatus() == 'optional')
2040
+		if ($self->getSslStatus() == 'optional')
2041 2041
 		{
2042 2042
 			return $self->ssl_actions;
2043 2043
 		}
@@ -2064,12 +2064,12 @@  discard block
 block discarded – undo
2064 2064
 	 */
2065 2065
 	function normalizeFilePath($file)
2066 2066
 	{
2067
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2067
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2068 2068
 		{
2069 2069
 			$file = './' . $file;
2070 2070
 		}
2071 2071
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2072
-		while(strpos($file, '/../') !== FALSE)
2072
+		while (strpos($file, '/../') !== FALSE)
2073 2073
 		{
2074 2074
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2075 2075
 		}
@@ -2087,11 +2087,11 @@  discard block
 block discarded – undo
2087 2087
 	function getAbsFileUrl($file)
2088 2088
 	{
2089 2089
 		$file = self::normalizeFilePath($file);
2090
-		if(strpos($file, './') === 0)
2090
+		if (strpos($file, './') === 0)
2091 2091
 		{
2092 2092
 			$file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2);
2093 2093
 		}
2094
-		elseif(strpos($file, '../') === 0)
2094
+		elseif (strpos($file, '../') === 0)
2095 2095
 		{
2096 2096
 			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}");
2097 2097
 		}
@@ -2163,12 +2163,12 @@  discard block
 block discarded – undo
2163 2163
 	 */
2164 2164
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2165 2165
 	{
2166
-		if($isRuleset)
2166
+		if ($isRuleset)
2167 2167
 		{
2168
-			if(strpos($file, '#') !== FALSE)
2168
+			if (strpos($file, '#') !== FALSE)
2169 2169
 			{
2170 2170
 				$file = str_replace('#', '', $file);
2171
-				if(!is_readable($file))
2171
+				if (!is_readable($file))
2172 2172
 				{
2173 2173
 					$file = $autoPath;
2174 2174
 				}
@@ -2233,9 +2233,9 @@  discard block
 block discarded – undo
2233 2233
 		ksort($files);
2234 2234
 		$files = array_values($files);
2235 2235
 		$filenames = array();
2236
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2236
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2237 2237
 		{
2238
-			if(in_array($files[$i]['file'], $filenames))
2238
+			if (in_array($files[$i]['file'], $filenames))
2239 2239
 			{
2240 2240
 				unset($files[$i]);
2241 2241
 			}
@@ -2320,14 +2320,14 @@  discard block
 block discarded – undo
2320 2320
 	 */
2321 2321
 	function getJavascriptPluginInfo($pluginName)
2322 2322
 	{
2323
-		if($plugin_name == 'ui.datepicker')
2323
+		if ($plugin_name == 'ui.datepicker')
2324 2324
 		{
2325 2325
 			$plugin_name = 'ui';
2326 2326
 		}
2327 2327
 
2328 2328
 		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2329 2329
 		$info_file = $plugin_path . 'plugin.load';
2330
-		if(!is_readable($info_file))
2330
+		if (!is_readable($info_file))
2331 2331
 		{
2332 2332
 			return;
2333 2333
 		}
@@ -2337,30 +2337,30 @@  discard block
 block discarded – undo
2337 2337
 		$result->jsList = array();
2338 2338
 		$result->cssList = array();
2339 2339
 
2340
-		foreach($list as $filename)
2340
+		foreach ($list as $filename)
2341 2341
 		{
2342 2342
 			$filename = trim($filename);
2343
-			if(!$filename)
2343
+			if (!$filename)
2344 2344
 			{
2345 2345
 				continue;
2346 2346
 			}
2347 2347
 
2348
-			if(strncasecmp('./', $filename, 2) === 0)
2348
+			if (strncasecmp('./', $filename, 2) === 0)
2349 2349
 			{
2350 2350
 				$filename = substr($filename, 2);
2351 2351
 			}
2352 2352
 
2353
-			if(substr_compare($filename, '.js', -3) === 0)
2353
+			if (substr_compare($filename, '.js', -3) === 0)
2354 2354
 			{
2355 2355
 				$result->jsList[] = $plugin_path . $filename;
2356 2356
 			}
2357
-			elseif(substr_compare($filename, '.css', -4) === 0)
2357
+			elseif (substr_compare($filename, '.css', -4) === 0)
2358 2358
 			{
2359 2359
 				$result->cssList[] = $plugin_path . $filename;
2360 2360
 			}
2361 2361
 		}
2362 2362
 
2363
-		if(is_dir($plugin_path . 'lang'))
2363
+		if (is_dir($plugin_path . 'lang'))
2364 2364
 		{
2365 2365
 			$result->langPath = $plugin_path . 'lang';
2366 2366
 		}
@@ -2378,12 +2378,12 @@  discard block
 block discarded – undo
2378 2378
 		static $loaded_plugins = array();
2379 2379
 
2380 2380
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2381
-		if($plugin_name == 'ui.datepicker')
2381
+		if ($plugin_name == 'ui.datepicker')
2382 2382
 		{
2383 2383
 			$plugin_name = 'ui';
2384 2384
 		}
2385 2385
 
2386
-		if($loaded_plugins[$plugin_name])
2386
+		if ($loaded_plugins[$plugin_name])
2387 2387
 		{
2388 2388
 			return;
2389 2389
 		}
@@ -2391,35 +2391,35 @@  discard block
 block discarded – undo
2391 2391
 
2392 2392
 		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2393 2393
 		$info_file = $plugin_path . 'plugin.load';
2394
-		if(!is_readable($info_file))
2394
+		if (!is_readable($info_file))
2395 2395
 		{
2396 2396
 			return;
2397 2397
 		}
2398 2398
 
2399 2399
 		$list = file($info_file);
2400
-		foreach($list as $filename)
2400
+		foreach ($list as $filename)
2401 2401
 		{
2402 2402
 			$filename = trim($filename);
2403
-			if(!$filename)
2403
+			if (!$filename)
2404 2404
 			{
2405 2405
 				continue;
2406 2406
 			}
2407 2407
 
2408
-			if(strncasecmp('./', $filename, 2) === 0)
2408
+			if (strncasecmp('./', $filename, 2) === 0)
2409 2409
 			{
2410 2410
 				$filename = substr($filename, 2);
2411 2411
 			}
2412
-			if(substr_compare($filename, '.js', -3) === 0)
2412
+			if (substr_compare($filename, '.js', -3) === 0)
2413 2413
 			{
2414 2414
 				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2415 2415
 			}
2416
-			if(substr_compare($filename, '.css', -4) === 0)
2416
+			if (substr_compare($filename, '.css', -4) === 0)
2417 2417
 			{
2418 2418
 				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2419 2419
 			}
2420 2420
 		}
2421 2421
 
2422
-		if(is_dir($plugin_path . 'lang'))
2422
+		if (is_dir($plugin_path . 'lang'))
2423 2423
 		{
2424 2424
 			$self->loadLang($plugin_path . 'lang');
2425 2425
 		}
@@ -2591,14 +2591,14 @@  discard block
 block discarded – undo
2591 2591
 		$_path = explode('/', $path);
2592 2592
 		$_base = explode('/', $base_url);
2593 2593
 
2594
-		if(!$_base[count($_base) - 1])
2594
+		if (!$_base[count($_base) - 1])
2595 2595
 		{
2596 2596
 			array_pop($_base);
2597 2597
 		}
2598 2598
 
2599
-		foreach($_xe as $idx => $dir)
2599
+		foreach ($_xe as $idx => $dir)
2600 2600
 		{
2601
-			if($_path[0] != $dir)
2601
+			if ($_path[0] != $dir)
2602 2602
 			{
2603 2603
 				break;
2604 2604
 			}
@@ -2606,9 +2606,9 @@  discard block
 block discarded – undo
2606 2606
 		}
2607 2607
 
2608 2608
 		$idx = count($_xe) - $idx - 1;
2609
-		while($idx--)
2609
+		while ($idx--)
2610 2610
 		{
2611
-			if(count($_base) > 0)
2611
+			if (count($_base) > 0)
2612 2612
 			{
2613 2613
 				array_shift($_base);
2614 2614
 			}
@@ -2618,13 +2618,13 @@  discard block
 block discarded – undo
2618 2618
 			}
2619 2619
 		}
2620 2620
 
2621
-		if(count($_base) > 0)
2621
+		if (count($_base) > 0)
2622 2622
 		{
2623 2623
 			array_unshift($_path, join('/', $_base));
2624 2624
 		}
2625 2625
 
2626 2626
 		$path = '/' . join('/', $_path);
2627
-		if(substr_compare($path, '/', -1) !== 0)
2627
+		if (substr_compare($path, '/', -1) !== 0)
2628 2628
 		{
2629 2629
 			$path .= '/';
2630 2630
 		}
@@ -2639,13 +2639,13 @@  discard block
 block discarded – undo
2639 2639
 	{
2640 2640
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2641 2641
 
2642
-		if(!is_array($self->meta_tags))
2642
+		if (!is_array($self->meta_tags))
2643 2643
 		{
2644 2644
 			$self->meta_tags = array();
2645 2645
 		}
2646 2646
 
2647 2647
 		$ret = array();
2648
-		foreach($self->meta_tags as $key => $val)
2648
+		foreach ($self->meta_tags as $key => $val)
2649 2649
 		{
2650 2650
 			list($name, $is_http_equiv) = explode("\t", $key);
2651 2651
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
Please login to merge, or discard this patch.
Braces   +79 added lines, -91 removed lines patch added patch discarded remove patch
@@ -227,7 +227,9 @@  discard block
 block discarded – undo
227 227
 		$this->loadDBInfo();
228 228
 		if($this->db_info->use_sitelock == 'Y')
229 229
 		{
230
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
230
+			if(is_array($this->db_info->sitelock_whitelist)) {
231
+				$whitelist = $this->db_info->sitelock_whitelist;
232
+			}
231 233
 
232 234
 			if(!IpFilter::filter($whitelist))
233 235
 			{
@@ -242,8 +244,7 @@  discard block
 block discarded – undo
242 244
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
243 245
 				{
244 246
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
245
-				}
246
-				else
247
+				} else
247 248
 				{
248 249
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
249 250
 				}
@@ -300,8 +301,7 @@  discard block
 block discarded – undo
300 301
 			{
301 302
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
302 303
 			}
303
-		}
304
-		elseif($_COOKIE['lang_type'])
304
+		} elseif($_COOKIE['lang_type'])
305 305
 		{
306 306
 			$this->lang_type = $_COOKIE['lang_type'];
307 307
 		}
@@ -338,7 +338,9 @@  discard block
 block discarded – undo
338 338
 			);
339 339
 		}
340 340
 
341
-		if($sess = $_POST[session_name()]) session_id($sess);
341
+		if($sess = $_POST[session_name()]) {
342
+			session_id($sess);
343
+		}
342 344
 		session_start();
343 345
 
344 346
 		// set authentication information in Context and session
@@ -391,22 +393,21 @@  discard block
 block discarded – undo
391 393
 						{
392 394
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
393 395
 						}
394
-					}
395
-					elseif($val)
396
+					} elseif($val)
396 397
 					{
397 398
 						$url[] = $key . '=' . urlencode($val);
398 399
 					}
399 400
 				}
400 401
 
401 402
 				$current_url = self::getRequestUri();
402
-				if($url) $current_url .= '?' . join('&', $url);
403
-			}
404
-			else
403
+				if($url) {
404
+					$current_url .= '?' . join('&', $url);
405
+				}
406
+			} else
405 407
 			{
406 408
 				$current_url = $this->getUrl();
407 409
 			}
408
-		}
409
-		else
410
+		} else
410 411
 		{
411 412
 			$current_url = self::getRequestUri();
412 413
 		}
@@ -491,18 +492,22 @@  discard block
 block discarded – undo
491 492
 			$db_info->use_prepared_statements = 'Y';
492 493
 		}
493 494
 
494
-		if(!$db_info->time_zone)
495
-			$db_info->time_zone = date('O');
495
+		if(!$db_info->time_zone) {
496
+					$db_info->time_zone = date('O');
497
+		}
496 498
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
497 499
 
498
-		if($db_info->qmail_compatibility != 'Y')
499
-			$db_info->qmail_compatibility = 'N';
500
+		if($db_info->qmail_compatibility != 'Y') {
501
+					$db_info->qmail_compatibility = 'N';
502
+		}
500 503
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
501 504
 
502
-		if(!$db_info->use_db_session)
503
-			$db_info->use_db_session = 'N';
504
-		if(!$db_info->use_ssl)
505
-			$db_info->use_ssl = 'none';
505
+		if(!$db_info->use_db_session) {
506
+					$db_info->use_db_session = 'N';
507
+		}
508
+		if(!$db_info->use_ssl) {
509
+					$db_info->use_ssl = 'none';
510
+		}
506 511
 		$this->set('_use_ssl', $db_info->use_ssl);
507 512
 
508 513
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -619,8 +624,7 @@  discard block
 block discarded – undo
619 624
 				$buff = FileHandler::readFile($orig_lang_file);
620 625
 				FileHandler::writeFile($selected_lang_file, $buff);
621 626
 				$lang_selected = self::loadLangSupported();
622
-			}
623
-			else
627
+			} else
624 628
 			{
625 629
 				$langs = file($selected_lang_file);
626 630
 				foreach($langs as $val)
@@ -689,8 +693,7 @@  discard block
 block discarded – undo
689 693
 				return FALSE;
690 694
 			}
691 695
 			// for sites requesting SSO validation
692
-		}
693
-		else
696
+		} else
694 697
 		{
695 698
 			// result handling : set session_name()
696 699
 			if($session_name = self::get('SSOID'))
@@ -701,8 +704,7 @@  discard block
 block discarded – undo
701 704
 				header('location:' . $url);
702 705
 				return FALSE;
703 706
 				// send SSO request
704
-			}
705
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
707
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
706 708
 			{
707 709
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
708 710
 				$url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl()));
@@ -760,8 +762,7 @@  discard block
 block discarded – undo
760 762
 		if($self->site_title)
761 763
 		{
762 764
 			$self->site_title .= ' - ' . $site_title;
763
-		}
764
-		else
765
+		} else
765 766
 		{
766 767
 			$self->site_title = $site_title;
767 768
 		}
@@ -861,8 +862,7 @@  discard block
 block discarded – undo
861 862
 		{
862 863
 			$self->loaded_lang_files[] = $filename;
863 864
 			include($filename);
864
-		}
865
-		else
865
+		} else
866 866
 		{
867 867
 			$self->_evalxmlLang($path);
868 868
 		}
@@ -878,7 +878,9 @@  discard block
 block discarded – undo
878 878
 	{
879 879
 		global $lang;
880 880
 
881
-		if(!$path) return;
881
+		if(!$path) {
882
+			return;
883
+		}
882 884
 
883 885
 		$_path = 'eval://' . $path;
884 886
 
@@ -910,7 +912,9 @@  discard block
 block discarded – undo
910 912
 	 */
911 913
 	function _loadXmlLang($path)
912 914
 	{
913
-		if(!$path) return;
915
+		if(!$path) {
916
+			return;
917
+		}
914 918
 
915 919
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
916 920
 		return $oXmlLangParser->compile();
@@ -924,7 +928,9 @@  discard block
 block discarded – undo
924 928
 	 */
925 929
 	function _loadPhpLang($path)
926 930
 	{
927
-		if(!$path) return;
931
+		if(!$path) {
932
+			return;
933
+		}
928 934
 
929 935
 		if(substr_compare($path, '/', -1) !== 0)
930 936
 		{
@@ -1060,12 +1066,14 @@  discard block
 block discarded – undo
1060 1066
 		static $flag = TRUE;
1061 1067
 		if($charset)
1062 1068
 		{
1063
-			if(is_array($val))
1064
-				array_walk($val,'Context::checkConvertFlag',$charset);
1065
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1066
-			else $flag = FALSE;
1067
-		}
1068
-		else
1069
+			if(is_array($val)) {
1070
+							array_walk($val,'Context::checkConvertFlag',$charset);
1071
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1072
+				$flag = FALSE;
1073
+			} else {
1074
+				$flag = FALSE;
1075
+			}
1076
+		} else
1069 1077
 		{
1070 1078
 			$return = $flag;
1071 1079
 			$flag = TRUE;
@@ -1087,8 +1095,9 @@  discard block
 block discarded – undo
1087 1095
 		if (is_array($val))
1088 1096
 		{
1089 1097
 			array_walk($val,'Context::doConvertEncoding',$charset);
1098
+		} else {
1099
+			$val = iconv($charset,'UTF-8',$val);
1090 1100
 		}
1091
-		else $val = iconv($charset,'UTF-8',$val);
1092 1101
 	}
1093 1102
 
1094 1103
 	/**
@@ -1099,7 +1108,9 @@  discard block
 block discarded – undo
1099 1108
 	 */
1100 1109
 	function convertEncodingStr($str)
1101 1110
 	{
1102
-        if(!$str) return null;
1111
+        if(!$str) {
1112
+        	return null;
1113
+        }
1103 1114
 		$obj = new stdClass();
1104 1115
 		$obj->str = $str;
1105 1116
 		$obj = self::convertEncoding($obj);
@@ -1212,16 +1223,13 @@  discard block
 block discarded – undo
1212 1223
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1213 1224
 			{
1214 1225
 				$set_to_vars = TRUE;
1215
-			}
1216
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1226
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1217 1227
 			{
1218 1228
 				$set_to_vars = TRUE;
1219
-			}
1220
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1229
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1221 1230
 			{
1222 1231
 				$set_to_vars = TRUE;
1223
-			}
1224
-			else
1232
+			} else
1225 1233
 			{
1226 1234
 				$set_to_vars = FALSE;
1227 1235
 			}
@@ -1247,8 +1255,7 @@  discard block
 block discarded – undo
1247 1255
 					return;
1248 1256
 				}
1249 1257
 			}
1250
-		}
1251
-		else if(is_array($val))
1258
+		} else if(is_array($val))
1252 1259
 		{
1253 1260
 			foreach($val as $val2)
1254 1261
 			{
@@ -1388,16 +1395,13 @@  discard block
 block discarded – undo
1388 1395
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1389 1396
 			{
1390 1397
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1391
-			}
1392
-			elseif($key === 'mid' || $key === 'search_keyword')
1398
+			} elseif($key === 'mid' || $key === 'search_keyword')
1393 1399
 			{
1394 1400
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1395
-			}
1396
-			elseif($key === 'vid')
1401
+			} elseif($key === 'vid')
1397 1402
 			{
1398 1403
 				$result[$k] = urlencode($v);
1399
-			}
1400
-			else
1404
+			} else
1401 1405
 			{
1402 1406
 				$result[$k] = $v;
1403 1407
 
@@ -1451,8 +1455,7 @@  discard block
 block discarded – undo
1451 1455
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1452 1456
 				$this->set($key, $val, TRUE);
1453 1457
 				$this->is_uploaded = TRUE;
1454
-			}
1455
-			else
1458
+			} else
1456 1459
 			{
1457 1460
 				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1458 1461
 				{
@@ -1558,8 +1561,7 @@  discard block
 block discarded – undo
1558 1561
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1559 1562
 			{
1560 1563
 				$vid = $site_module_info->domain;
1561
-			}
1562
-			else
1564
+			} else
1563 1565
 			{
1564 1566
 				$domain = $site_module_info->domain;
1565 1567
 			}
@@ -1576,8 +1578,7 @@  discard block
 block discarded – undo
1576 1578
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1577 1579
 			{
1578 1580
 				unset($domain);
1579
-			}
1580
-			else
1581
+			} else
1581 1582
 			{
1582 1583
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1583 1584
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1597,8 +1598,7 @@  discard block
 block discarded – undo
1597 1598
 			{
1598 1599
 				array_shift($args_list);
1599 1600
 			}
1600
-		}
1601
-		else
1601
+		} else
1602 1602
 		{
1603 1603
 			// Otherwise, make GET variables into array
1604 1604
 			$get_vars = get_object_vars($self->get_vars);
@@ -1625,8 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 		if($vid)
1626 1626
 		{
1627 1627
 			$get_vars['vid'] = $vid;
1628
-		}
1629
-		else
1628
+		} else
1630 1629
 		{
1631 1630
 			unset($get_vars['vid']);
1632 1631
 		}
@@ -1698,8 +1697,7 @@  discard block
 block discarded – undo
1698 1697
 						{
1699 1698
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1700 1699
 						}
1701
-					}
1702
-					elseif(!is_array($val))
1700
+					} elseif(!is_array($val))
1703 1701
 					{
1704 1702
 						$queries[] = $key . '=' . urlencode($val);
1705 1703
 					}
@@ -1717,25 +1715,23 @@  discard block
 block discarded – undo
1717 1715
 		{
1718 1716
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1719 1717
 			// optional SSL use
1720
-		}
1721
-		elseif($_use_ssl == 'optional')
1718
+		} elseif($_use_ssl == 'optional')
1722 1719
 		{
1723 1720
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1724 1721
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1725 1722
 			// no SSL
1726
-		}
1727
-		else
1723
+		} else
1728 1724
 		{
1729 1725
 			// currently on SSL but target is not based on SSL
1730 1726
 			if($_SERVER['HTTPS'] == 'on')
1731 1727
 			{
1732 1728
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1733
-			}
1734
-			else if($domain) // if $domain is set
1729
+			} else if($domain) {
1730
+				// if $domain is set
1735 1731
 			{
1736 1732
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1737 1733
 			}
1738
-			else
1734
+			} else
1739 1735
 			{
1740 1736
 				$query = getScriptPath() . $query;
1741 1737
 			}
@@ -1792,8 +1788,7 @@  discard block
 block discarded – undo
1792 1788
 		if($domain)
1793 1789
 		{
1794 1790
 			$domain_key = md5($domain);
1795
-		}
1796
-		else
1791
+		} else
1797 1792
 		{
1798 1793
 			$domain_key = 'default';
1799 1794
 		}
@@ -1822,8 +1817,7 @@  discard block
 block discarded – undo
1822 1817
 			{
1823 1818
 				$target_url.= '/';
1824 1819
 			}
1825
-		}
1826
-		else
1820
+		} else
1827 1821
 		{
1828 1822
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1829 1823
 		}
@@ -1841,20 +1835,17 @@  discard block
 block discarded – undo
1841 1835
 			if($port && $port != 443)
1842 1836
 			{
1843 1837
 				$url_info['port'] = $port;
1844
-			}
1845
-			elseif($url_info['port'] == 443)
1838
+			} elseif($url_info['port'] == 443)
1846 1839
 			{
1847 1840
 				unset($url_info['port']);
1848 1841
 			}
1849
-		}
1850
-		else
1842
+		} else
1851 1843
 		{
1852 1844
 			$port = self::get('_http_port');
1853 1845
 			if($port && $port != 80)
1854 1846
 			{
1855 1847
 				$url_info['port'] = $port;
1856
-			}
1857
-			elseif($url_info['port'] == 80)
1848
+			} elseif($url_info['port'] == 80)
1858 1849
 			{
1859 1850
 				unset($url_info['port']);
1860 1851
 			}
@@ -2090,8 +2081,7 @@  discard block
 block discarded – undo
2090 2081
 		if(strpos($file, './') === 0)
2091 2082
 		{
2092 2083
 			$file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2);
2093
-		}
2094
-		elseif(strpos($file, '../') === 0)
2084
+		} elseif(strpos($file, '../') === 0)
2095 2085
 		{
2096 2086
 			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}");
2097 2087
 		}
@@ -2353,8 +2343,7 @@  discard block
 block discarded – undo
2353 2343
 			if(substr_compare($filename, '.js', -3) === 0)
2354 2344
 			{
2355 2345
 				$result->jsList[] = $plugin_path . $filename;
2356
-			}
2357
-			elseif(substr_compare($filename, '.css', -4) === 0)
2346
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2358 2347
 			{
2359 2348
 				$result->cssList[] = $plugin_path . $filename;
2360 2349
 			}
@@ -2611,8 +2600,7 @@  discard block
 block discarded – undo
2611 2600
 			if(count($_base) > 0)
2612 2601
 			{
2613 2602
 				array_shift($_base);
2614
-			}
2615
-			else
2603
+			} else
2616 2604
 			{
2617 2605
 				array_unshift($_base, '..');
2618 2606
 			}
Please login to merge, or discard this patch.
classes/db/DBCubrid.class.php 3 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @param int $size column size
478 478
 	 * @param string|int $default default value
479 479
 	 * @param boolean $notnull not null status, default value is false
480
-	 * @return void
480
+	 * @return resource|null
481 481
 	 */
482 482
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE)
483 483
 	{
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	/**
694 694
 	 * Creates a table by using xml contents
695 695
 	 * @param string $xml_doc xml schema contents
696
-	 * @return void|object
696
+	 * @return null|resource
697 697
 	 */
698 698
 	function createTableByXml($xml_doc)
699 699
 	{
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	/**
704 704
 	 * Creates a table by using xml file path
705 705
 	 * @param string $file_name xml schema file path
706
-	 * @return void|object
706
+	 * @return null|resource
707 707
 	 */
708 708
 	function createTableByXmlFile($file_name)
709 709
 	{
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	 * opt : notnull, default, size\n
724 724
 	 * index : primary key, index, unique\n
725 725
 	 * @param string $xml_doc xml schema contents
726
-	 * @return void|object
726
+	 * @return null|resource
727 727
 	 */
728 728
 	function _createTable($xml_doc)
729 729
 	{
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 	 * @param Object $queryObject
952 952
 	 * @param resource $connection
953 953
 	 * @param boolean $with_values
954
-	 * @return Object
954
+	 * @return Object|null
955 955
 	 */
956 956
 	function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE)
957 957
 	{
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 	/**
996 996
 	 * If have a error, return error object
997 997
 	 * @param Object $queryObject
998
-	 * @return Object
998
+	 * @return Object|null
999 999
 	 */
1000 1000
 	function queryError($queryObject)
1001 1001
 	{
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	 * @param Object $queryObject
1019 1019
 	 * @param resource $connection
1020 1020
 	 * @param boolean $with_values
1021
-	 * @return Object Object with page info containing
1021
+	 * @return Object|null Object with page info containing
1022 1022
 	 */
1023 1023
 	function queryPageLimit($queryObject, $connection, $with_values)
1024 1024
 	{
Please login to merge, or discard this patch.
Braces   +28 added lines, -40 removed lines patch added patch discarded remove patch
@@ -90,8 +90,9 @@  discard block
 block discarded – undo
90 90
 			define('__CUBRID_VERSION__', $cubrid_version);
91 91
 		}
92 92
 
93
-		if(__CUBRID_VERSION__ >= '8.4.0')
94
-			cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
93
+		if(__CUBRID_VERSION__ >= '8.4.0') {
94
+					cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
95
+		}
95 96
 
96 97
 		return $result;
97 98
 	}
@@ -153,8 +154,7 @@  discard block
 block discarded – undo
153 154
 			if(!$transactionLevel)
154 155
 			{
155 156
 				cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE);
156
-			}
157
-			else
157
+			} else
158 158
 			{
159 159
 				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
160 160
 			}
@@ -176,8 +176,7 @@  discard block
 block discarded – undo
176 176
 		if($point)
177 177
 		{
178 178
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
179
-		}
180
-		else
179
+		} else
181 180
 		{
182 181
 			@cubrid_rollback($connection);
183 182
 		}
@@ -251,8 +250,7 @@  discard block
 block discarded – undo
251 250
 								return false;
252 251
 							}
253 252
 						}
254
-					}
255
-					else
253
+					} else
256 254
 					{
257 255
 						$bound = @cubrid_bind($req, ++$position, $value, $bind_type);
258 256
 						if(!$bound)
@@ -343,8 +341,7 @@  discard block
 block discarded – undo
343 341
 			if($arrayIndexEndValue)
344 342
 			{
345 343
 				$output[$arrayIndexEndValue--] = $tmp;
346
-			}
347
-			else
344
+			} else
348 345
 			{
349 346
 				$output[] = $tmp;
350 347
 			}
@@ -395,8 +392,9 @@  discard block
 block discarded – undo
395 392
 	 */
396 393
 	function _makeSequence()
397 394
 	{
398
-		if($_GLOBALS['XE_EXISTS_SEQUENCE'])
399
-			return;
395
+		if($_GLOBALS['XE_EXISTS_SEQUENCE']) {
396
+					return;
397
+		}
400 398
 
401 399
 		// check cubrid serial
402 400
 		$query = sprintf('select count(*) as "count" from "db_serial" where name=\'%ssequence\'', $this->prefix);
@@ -421,8 +419,7 @@  discard block
 block discarded – undo
421 419
 			if($srl < 1)
422 420
 			{
423 421
 				$start = 1;
424
-			}
425
-			else
422
+			} else
426 423
 			{
427 424
 				$start = $srl + 1000000;
428 425
 			}
@@ -445,8 +442,7 @@  discard block
 block discarded – undo
445 442
 		if($target_name == 'sequence')
446 443
 		{
447 444
 			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name);
448
-		}
449
-		else
445
+		} else
450 446
 		{
451 447
 			$query = sprintf("select \"class_name\" from \"db_class\" where \"class_name\" = '%s%s'", $this->prefix, $target_name);
452 448
 		}
@@ -455,8 +451,7 @@  discard block
 block discarded – undo
455 451
 		if(cubrid_num_rows($result) > 0)
456 452
 		{
457 453
 			$output = TRUE;
458
-		}
459
-		else
454
+		} else
460 455
 		{
461 456
 			$output = FALSE;
462 457
 		}
@@ -500,8 +495,7 @@  discard block
 block discarded – undo
500 495
 		if($size)
501 496
 		{
502 497
 			$query .= sprintf("%s(%s) ", $type, $size);
503
-		}
504
-		else
498
+		} else
505 499
 		{
506 500
 			$query .= sprintf("%s ", $type);
507 501
 		}
@@ -511,8 +505,7 @@  discard block
 block discarded – undo
511 505
 			if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
512 506
 			{
513 507
 				$query .= sprintf("default %d ", $default);
514
-			}
515
-			else
508
+			} else
516 509
 			{
517 510
 				$query .= sprintf("default '%s' ", $default);
518 511
 			}
@@ -553,8 +546,7 @@  discard block
 block discarded – undo
553 546
 		if(cubrid_num_rows($result) > 0)
554 547
 		{
555 548
 			$output = TRUE;
556
-		}
557
-		else
549
+		} else
558 550
 		{
559 551
 			$output = FALSE;
560 552
 		}
@@ -674,8 +666,7 @@  discard block
 block discarded – undo
674 666
 		if(!is_array($output))
675 667
 		{
676 668
 			$indexes_to_be_deleted = array($output);
677
-		}
678
-		else
669
+		} else
679 670
 		{
680 671
 			$indexes_to_be_deleted = $output;
681 672
 		}
@@ -758,8 +749,7 @@  discard block
 block discarded – undo
758 749
 		if(!is_array($xml_obj->table->column))
759 750
 		{
760 751
 			$columns[] = $xml_obj->table->column;
761
-		}
762
-		else
752
+		} else
763 753
 		{
764 754
 			$columns = $xml_obj->table->column;
765 755
 		}
@@ -799,8 +789,9 @@  discard block
 block discarded – undo
799 789
 
800 790
 			if($type == 'varchar' || $type == 'char')
801 791
 			{
802
-				if($size)
803
-					$size = $size * 3;
792
+				if($size) {
793
+									$size = $size * 3;
794
+				}
804 795
 			}
805 796
 
806 797
 
@@ -809,12 +800,10 @@  discard block
 block discarded – undo
809 800
 			if($primary_key)
810 801
 			{
811 802
 				$primary_list[] = $name;
812
-			}
813
-			else if($unique)
803
+			} else if($unique)
814 804
 			{
815 805
 				$unique_list[$unique][] = $name;
816
-			}
817
-			else if($index)
806
+			} else if($index)
818 807
 			{
819 808
 				$index_list[$index][] = $name;
820 809
 			}
@@ -964,8 +953,7 @@  discard block
 block discarded – undo
964 953
 		if($limit && $limit->isPageHandler())
965 954
 		{
966 955
 			return $this->queryPageLimit($queryObject, $connection, $with_values);
967
-		}
968
-		else
956
+		} else
969 957
 		{
970 958
 			$query = $this->getSelectSql($queryObject, $with_values);
971 959
 			if(is_a($query, 'Object'))
@@ -1009,8 +997,9 @@  discard block
 block discarded – undo
1009 997
 			$buff->data = array();
1010 998
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
1011 999
 			return $buff;
1012
-		}else
1013
-			return;
1000
+		} else {
1001
+					return;
1002
+		}
1014 1003
 	}
1015 1004
 
1016 1005
 	/**
@@ -1069,8 +1058,7 @@  discard block
 block discarded – undo
1069 1058
 		if($total_count)
1070 1059
 		{
1071 1060
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
1072
-		}
1073
-		else
1061
+		} else
1074 1062
 		{
1075 1063
 			$total_page = 1;
1076 1064
 		}
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 		$result = @cubrid_connect($connection["db_hostname"], $connection["db_port"], $connection["db_database"], $connection["db_userid"], $connection["db_password"]);
77 77
 
78 78
 		// check connections
79
-		if(!$result)
79
+		if (!$result)
80 80
 		{
81 81
 			$this->setError(-1, 'database connect fail');
82 82
 			return;
83 83
 		}
84 84
 
85
-		if(!defined('__CUBRID_VERSION__'))
85
+		if (!defined('__CUBRID_VERSION__'))
86 86
 		{
87 87
 			$cubrid_version = cubrid_get_server_info($result);
88 88
 			$cubrid_version_elem = explode('.', $cubrid_version);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			define('__CUBRID_VERSION__', $cubrid_version);
91 91
 		}
92 92
 
93
-		if(__CUBRID_VERSION__ >= '8.4.0')
93
+		if (__CUBRID_VERSION__ >= '8.4.0')
94 94
 			cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
95 95
 
96 96
 		return $result;
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function addQuotes($string)
118 118
 	{
119
-		if(version_compare(PHP_VERSION, "5.4.0", "<") &&
119
+		if (version_compare(PHP_VERSION, "5.4.0", "<") &&
120 120
 				get_magic_quotes_gpc())
121 121
 		{
122 122
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
123 123
 		}
124 124
 
125
-		if(!is_numeric($string))
125
+		if (!is_numeric($string))
126 126
 		{
127 127
 			/*
128 128
 			  if ($this->isConnected()) {
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	function _begin($transactionLevel = 0)
148 148
 	{
149
-		if(__CUBRID_VERSION__ >= '8.4.0')
149
+		if (__CUBRID_VERSION__ >= '8.4.0')
150 150
 		{
151 151
 			$connection = $this->_getConnection('master');
152 152
 
153
-			if(!$transactionLevel)
153
+			if (!$transactionLevel)
154 154
 			{
155 155
 				cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE);
156 156
 			}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$point = $transactionLevel - 1;
175 175
 
176
-		if($point)
176
+		if ($point)
177 177
 		{
178 178
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
179 179
 		}
@@ -206,29 +206,29 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function __query($query, $connection)
208 208
 	{
209
-		if($this->use_prepared_statements == 'Y')
209
+		if ($this->use_prepared_statements == 'Y')
210 210
 		{
211 211
 			$req = @cubrid_prepare($connection, $query);
212
-			if(!$req)
212
+			if (!$req)
213 213
 			{
214 214
 				$this->_setError();
215 215
 				return false;
216 216
 			}
217 217
 
218 218
 			$position = 0;
219
-			if($this->param)
219
+			if ($this->param)
220 220
 			{
221
-				foreach($this->param as $param)
221
+				foreach ($this->param as $param)
222 222
 				{
223 223
 					$value = $param->getUnescapedValue();
224 224
 					$type = $param->getType();
225 225
 
226
-					if($param->isColumnName())
226
+					if ($param->isColumnName())
227 227
 					{
228 228
 						continue;
229 229
 					}
230 230
 
231
-					switch($type)
231
+					switch ($type)
232 232
 					{
233 233
 						case 'number' :
234 234
 							$bind_type = 'numeric';
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 							$bind_type = 'string';
241 241
 					}
242 242
 
243
-					if(is_array($value))
243
+					if (is_array($value))
244 244
 					{
245
-						foreach($value as $v)
245
+						foreach ($value as $v)
246 246
 						{
247 247
 							$bound = @cubrid_bind($req, ++$position, $v, $bind_type);
248
-							if(!$bound)
248
+							if (!$bound)
249 249
 							{
250 250
 								$this->_setError();
251 251
 								return false;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 					else
256 256
 					{
257 257
 						$bound = @cubrid_bind($req, ++$position, $value, $bind_type);
258
-						if(!$bound)
258
+						if (!$bound)
259 259
 						{
260 260
 							$this->_setError();
261 261
 							return false;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			}
266 266
 
267 267
 			$result = @cubrid_execute($req);
268
-			if(!$result)
268
+			if (!$result)
269 269
 			{
270 270
 				$this->_setError();
271 271
 				return false;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		// Execute the query
276 276
 		$result = @cubrid_execute($connection, $query);
277 277
 		// error check
278
-		if(!$result)
278
+		if (!$result)
279 279
 		{
280 280
 			$this->_setError();
281 281
 			return false;
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 	function _fetch($result, $arrayIndexEndValue = NULL)
307 307
 	{
308 308
 		$output = array();
309
-		if(!$this->isConnected() || $this->isError() || !$result)
309
+		if (!$this->isConnected() || $this->isError() || !$result)
310 310
 		{
311 311
 			return array();
312 312
 		}
313 313
 
314
-		if($this->use_prepared_statements == 'Y')
314
+		if ($this->use_prepared_statements == 'Y')
315 315
 		{
316 316
 
317 317
 		}
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
 		$col_names = cubrid_column_names($result);
323 323
 		$max = count($col_types);
324 324
 
325
-		for($count = 0; $count < $max; $count++)
325
+		for ($count = 0; $count < $max; $count++)
326 326
 		{
327
-			if(preg_match("/^char/", $col_types[$count]) > 0)
327
+			if (preg_match("/^char/", $col_types[$count]) > 0)
328 328
 			{
329 329
 				$char_type_fields[] = $col_names[$count];
330 330
 			}
331 331
 		}
332 332
 
333
-		while($tmp = cubrid_fetch($result, CUBRID_OBJECT))
333
+		while ($tmp = cubrid_fetch($result, CUBRID_OBJECT))
334 334
 		{
335
-			if(is_array($char_type_fields))
335
+			if (is_array($char_type_fields))
336 336
 			{
337
-				foreach($char_type_fields as $val)
337
+				foreach ($char_type_fields as $val)
338 338
 				{
339 339
 					$tmp->{$val} = rtrim($tmp->{$val});
340 340
 				}
341 341
 			}
342 342
 
343
-			if($arrayIndexEndValue)
343
+			if ($arrayIndexEndValue)
344 344
 			{
345 345
 				$output[$arrayIndexEndValue--] = $tmp;
346 346
 			}
@@ -352,15 +352,15 @@  discard block
 block discarded – undo
352 352
 
353 353
 		unset($char_type_fields);
354 354
 
355
-		if($result)
355
+		if ($result)
356 356
 		{
357 357
 			cubrid_close_request($result);
358 358
 		}
359 359
 
360
-		if(count($output) == 1)
360
+		if (count($output) == 1)
361 361
 		{
362 362
 			// If call is made for pagination, always return array
363
-			if(isset($arrayIndexEndValue))
363
+			if (isset($arrayIndexEndValue))
364 364
 			{
365 365
 				return $output;
366 366
 			}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	function _makeSequence()
397 397
 	{
398
-		if($_GLOBALS['XE_EXISTS_SEQUENCE'])
398
+		if ($_GLOBALS['XE_EXISTS_SEQUENCE'])
399 399
 			return;
400 400
 
401 401
 		// check cubrid serial
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		$output = $this->_fetch($result);
405 405
 
406 406
 		// if do not create serial
407
-		if($output->count == 0)
407
+		if ($output->count == 0)
408 408
 		{
409 409
 			$query = sprintf('select max("a"."srl") as "srl" from ' .
410 410
 					'( select max("document_srl") as "srl" from ' .
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 			$result = $this->_query($query);
419 419
 			$output = $this->_fetch($result);
420 420
 			$srl = $output->srl;
421
-			if($srl < 1)
421
+			if ($srl < 1)
422 422
 			{
423 423
 				$start = 1;
424 424
 			}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 */
443 443
 	function isTableExists($target_name)
444 444
 	{
445
-		if($target_name == 'sequence')
445
+		if ($target_name == 'sequence')
446 446
 		{
447 447
 			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name);
448 448
 		}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		}
453 453
 
454 454
 		$result = $this->_query($query);
455
-		if(cubrid_num_rows($result) > 0)
455
+		if (cubrid_num_rows($result) > 0)
456 456
 		{
457 457
 			$output = TRUE;
458 458
 		}
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			$output = FALSE;
462 462
 		}
463 463
 
464
-		if($result)
464
+		if ($result)
465 465
 		{
466 466
 			cubrid_close_request($result);
467 467
 		}
@@ -482,22 +482,22 @@  discard block
 block discarded – undo
482 482
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE)
483 483
 	{
484 484
 		$type = strtoupper($this->column_type[$type]);
485
-		if($type == 'INTEGER')
485
+		if ($type == 'INTEGER')
486 486
 		{
487 487
 			$size = '';
488 488
 		}
489 489
 
490 490
 		$query = sprintf("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name);
491 491
 
492
-		if($type == 'char' || $type == 'varchar')
492
+		if ($type == 'char' || $type == 'varchar')
493 493
 		{
494
-			if($size)
494
+			if ($size)
495 495
 			{
496 496
 				$size = $size * 3;
497 497
 			}
498 498
 		}
499 499
 
500
-		if($size)
500
+		if ($size)
501 501
 		{
502 502
 			$query .= sprintf("%s(%s) ", $type, $size);
503 503
 		}
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 			$query .= sprintf("%s ", $type);
507 507
 		}
508 508
 
509
-		if(isset($default))
509
+		if (isset($default))
510 510
 		{
511
-			if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
511
+			if ($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
512 512
 			{
513 513
 				$query .= sprintf("default %d ", $default);
514 514
 			}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			}
519 519
 		}
520 520
 
521
-		if($notnull)
521
+		if ($notnull)
522 522
 		{
523 523
 			$query .= "not null ";
524 524
 		}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$query = sprintf("select \"attr_name\" from \"db_attribute\" where " . "\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name);
551 551
 		$result = $this->_query($query);
552 552
 
553
-		if(cubrid_num_rows($result) > 0)
553
+		if (cubrid_num_rows($result) > 0)
554 554
 		{
555 555
 			$output = TRUE;
556 556
 		}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			$output = FALSE;
560 560
 		}
561 561
 
562
-		if($result)
562
+		if ($result)
563 563
 		{
564 564
 			cubrid_close_request($result);
565 565
 		}
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = FALSE)
581 581
 	{
582
-		if(!is_array($target_columns))
582
+		if (!is_array($target_columns))
583 583
 		{
584 584
 			$target_columns = array($target_columns);
585 585
 		}
@@ -614,14 +614,14 @@  discard block
 block discarded – undo
614 614
 		$query = sprintf("select \"index_name\" from \"db_index\" where " . "\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix . $index_name, $index_name);
615 615
 		$result = $this->_query($query);
616 616
 
617
-		if($this->isError())
617
+		if ($this->isError())
618 618
 		{
619 619
 			return FALSE;
620 620
 		}
621 621
 
622 622
 		$output = $this->_fetch($result);
623 623
 
624
-		if(!$output)
624
+		if (!$output)
625 625
 		{
626 626
 			return FALSE;
627 627
 		}
@@ -660,18 +660,18 @@  discard block
 block discarded – undo
660 660
 		);
661 661
 		$result = $this->_query($query);
662 662
 
663
-		if($this->isError())
663
+		if ($this->isError())
664 664
 		{
665 665
 			return FALSE;
666 666
 		}
667 667
 
668 668
 		$output = $this->_fetch($result);
669
-		if(!$output)
669
+		if (!$output)
670 670
 		{
671 671
 			return FALSE;
672 672
 		}
673 673
 
674
-		if(!is_array($output))
674
+		if (!is_array($output))
675 675
 		{
676 676
 			$indexes_to_be_deleted = array($output);
677 677
 		}
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 			$indexes_to_be_deleted = $output;
681 681
 		}
682 682
 
683
-		foreach($indexes_to_be_deleted as $index)
683
+		foreach ($indexes_to_be_deleted as $index)
684 684
 		{
685 685
 			$this->dropIndex(substr($index->class_name, strlen($this->prefix))
686 686
 					, $this->prefix . $index->unprefixed_index_name
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	function createTableByXmlFile($file_name)
709 709
 	{
710
-		if(!file_exists($file_name))
710
+		if (!file_exists($file_name))
711 711
 		{
712 712
 			return;
713 713
 		}
@@ -734,13 +734,13 @@  discard block
 block discarded – undo
734 734
 		$table_name = $xml_obj->table->attrs->name;
735 735
 
736 736
 		// if the table already exists exit function
737
-		if($this->isTableExists($table_name))
737
+		if ($this->isTableExists($table_name))
738 738
 		{
739 739
 			return;
740 740
 		}
741 741
 
742 742
 		// If the table name is sequence, it creates a serial
743
-		if($table_name == 'sequence')
743
+		if ($table_name == 'sequence')
744 744
 		{
745 745
 			$query = sprintf('create serial "%s" start with 1 increment by 1' .
746 746
 					' minvalue 1 ' .
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 		$query = sprintf('create class "%s";', $table_name);
756 756
 		$this->_query($query);
757 757
 
758
-		if(!is_array($xml_obj->table->column))
758
+		if (!is_array($xml_obj->table->column))
759 759
 		{
760 760
 			$columns[] = $xml_obj->table->column;
761 761
 		}
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 		$unique_list = array();
771 771
 		$index_list = array();
772 772
 
773
-		foreach($columns as $column)
773
+		foreach ($columns as $column)
774 774
 		{
775 775
 			$name = $column->attrs->name;
776 776
 			$type = $column->attrs->type;
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 			$unique = $column->attrs->unique;
782 782
 			$default = $column->attrs->default;
783 783
 
784
-			switch($this->column_type[$type])
784
+			switch ($this->column_type[$type])
785 785
 			{
786 786
 				case 'integer' :
787 787
 					$size = NULL;
@@ -791,30 +791,30 @@  discard block
 block discarded – undo
791 791
 					break;
792 792
 			}
793 793
 
794
-			if(isset($default) && ($type == 'varchar' || $type == 'char' ||
794
+			if (isset($default) && ($type == 'varchar' || $type == 'char' ||
795 795
 					$type == 'text' || $type == 'tinytext' || $type == 'bigtext'))
796 796
 			{
797 797
 				$default = sprintf("'%s'", $default);
798 798
 			}
799 799
 
800
-			if($type == 'varchar' || $type == 'char')
800
+			if ($type == 'varchar' || $type == 'char')
801 801
 			{
802
-				if($size)
802
+				if ($size)
803 803
 					$size = $size * 3;
804 804
 			}
805 805
 
806 806
 
807 807
 			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default " . $default : '', $notnull ? 'not null' : '');
808 808
 
809
-			if($primary_key)
809
+			if ($primary_key)
810 810
 			{
811 811
 				$primary_list[] = $name;
812 812
 			}
813
-			else if($unique)
813
+			else if ($unique)
814 814
 			{
815 815
 				$unique_list[$unique][] = $name;
816 816
 			}
817
-			else if($index)
817
+			else if ($index)
818 818
 			{
819 819
 				$index_list[$index][] = $name;
820 820
 			}
@@ -823,24 +823,24 @@  discard block
 block discarded – undo
823 823
 		$query .= implode(',', $column_schema) . ';';
824 824
 		$this->_query($query);
825 825
 
826
-		if(count($primary_list))
826
+		if (count($primary_list))
827 827
 		{
828 828
 			$query = sprintf("alter class \"%s\" add attribute constraint " . "\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"' . implode('","', $primary_list) . '"');
829 829
 			$this->_query($query);
830 830
 		}
831 831
 
832
-		if(count($unique_list))
832
+		if (count($unique_list))
833 833
 		{
834
-			foreach($unique_list as $key => $val)
834
+			foreach ($unique_list as $key => $val)
835 835
 			{
836 836
 				$query = sprintf("create unique index \"%s\" on \"%s\" " . "(%s);", $key, $table_name, '"' . implode('","', $val) . '"');
837 837
 				$this->_query($query);
838 838
 			}
839 839
 		}
840 840
 
841
-		if(count($index_list))
841
+		if (count($index_list))
842 842
 		{
843
-			foreach($index_list as $key => $val)
843
+			foreach ($index_list as $key => $val)
844 844
 			{
845 845
 				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"' . implode('","', $val) . '"');
846 846
 				$this->_query($query);
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 	 */
857 857
 	function _executeInsertAct($queryObject, $with_values = TRUE)
858 858
 	{
859
-		if($this->use_prepared_statements == 'Y')
859
+		if ($this->use_prepared_statements == 'Y')
860 860
 		{
861 861
 			$this->param = $queryObject->getArguments();
862 862
 			$with_values = FALSE;
863 863
 		}
864 864
 		$query = $this->getInsertSql($queryObject, $with_values);
865
-		if(is_a($query, 'XEObject'))
865
+		if (is_a($query, 'XEObject'))
866 866
 		{
867 867
 			unset($this->param);
868 868
 			return;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
872 872
 
873 873
 		$result = $this->_query($query);
874
-		if($result && !$this->transaction_started)
874
+		if ($result && !$this->transaction_started)
875 875
 		{
876 876
 			$this->_commit();
877 877
 		}
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
 	 */
888 888
 	function _executeUpdateAct($queryObject, $with_values = TRUE)
889 889
 	{
890
-		if($this->use_prepared_statements == 'Y')
890
+		if ($this->use_prepared_statements == 'Y')
891 891
 		{
892 892
 			$this->param = $queryObject->getArguments();
893 893
 			$with_values = FALSE;
894 894
 		}
895 895
 		$query = $this->getUpdateSql($queryObject, $with_values);
896
-		if(is_a($query, 'XEObject'))
896
+		if (is_a($query, 'XEObject'))
897 897
 		{
898 898
 			unset($this->param);
899 899
 			return;
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 
904 904
 		$result = $this->_query($query);
905 905
 
906
-		if($result && !$this->transaction_started)
906
+		if ($result && !$this->transaction_started)
907 907
 		{
908 908
 			$this->_commit();
909 909
 		}
@@ -919,13 +919,13 @@  discard block
 block discarded – undo
919 919
 	 */
920 920
 	function _executeDeleteAct($queryObject, $with_values = TRUE)
921 921
 	{
922
-		if($this->use_prepared_statements == 'Y')
922
+		if ($this->use_prepared_statements == 'Y')
923 923
 		{
924 924
 			$this->param = $queryObject->getArguments();
925 925
 			$with_values = FALSE;
926 926
 		}
927 927
 		$query = $this->getDeleteSql($queryObject, $with_values);
928
-		if(is_a($query, 'XEObject'))
928
+		if (is_a($query, 'XEObject'))
929 929
 		{
930 930
 			unset($this->param);
931 931
 			return;
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 
936 936
 		$result = $this->_query($query);
937 937
 
938
-		if($result && !$this->transaction_started)
938
+		if ($result && !$this->transaction_started)
939 939
 		{
940 940
 			$this->_commit();
941 941
 		}
@@ -955,20 +955,20 @@  discard block
 block discarded – undo
955 955
 	 */
956 956
 	function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE)
957 957
 	{
958
-		if($this->use_prepared_statements == 'Y')
958
+		if ($this->use_prepared_statements == 'Y')
959 959
 		{
960 960
 			$this->param = $queryObject->getArguments();
961 961
 			$with_values = FALSE;
962 962
 		}
963 963
 		$limit = $queryObject->getLimit();
964
-		if($limit && $limit->isPageHandler())
964
+		if ($limit && $limit->isPageHandler())
965 965
 		{
966 966
 			return $this->queryPageLimit($queryObject, $connection, $with_values);
967 967
 		}
968 968
 		else
969 969
 		{
970 970
 			$query = $this->getSelectSql($queryObject, $with_values);
971
-			if(is_a($query, 'XEObject'))
971
+			if (is_a($query, 'XEObject'))
972 972
 			{
973 973
 				unset($this->param);
974 974
 				return;
@@ -977,14 +977,14 @@  discard block
 block discarded – undo
977 977
 			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
978 978
 			$result = $this->_query($query, $connection);
979 979
 
980
-			if($this->isError())
980
+			if ($this->isError())
981 981
 			{
982 982
 				unset($this->param);
983 983
 				return $this->queryError($queryObject);
984 984
 			}
985 985
 
986 986
 			$data = $this->_fetch($result);
987
-			$buff = new Object ();
987
+			$buff = new Object();
988 988
 			$buff->data = $data;
989 989
 
990 990
 			unset($this->param);
@@ -1000,16 +1000,16 @@  discard block
 block discarded – undo
1000 1000
 	function queryError($queryObject)
1001 1001
 	{
1002 1002
 		$limit = $queryObject->getLimit();
1003
-		if($limit && $limit->isPageHandler())
1003
+		if ($limit && $limit->isPageHandler())
1004 1004
 		{
1005
-			$buff = new Object ();
1005
+			$buff = new Object();
1006 1006
 			$buff->total_count = 0;
1007 1007
 			$buff->total_page = 0;
1008 1008
 			$buff->page = 1;
1009 1009
 			$buff->data = array();
1010 1010
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
1011 1011
 			return $buff;
1012
-		}else
1012
+		} else
1013 1013
 			return;
1014 1014
 	}
1015 1015
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 		$temp_select = $queryObject->getSelectString($with_values);
1032 1032
 		$uses_distinct = stripos($temp_select, "distinct") !== FALSE;
1033 1033
 		$uses_groupby = $queryObject->getGroupByString() != '';
1034
-		if($uses_distinct || $uses_groupby)
1034
+		if ($uses_distinct || $uses_groupby)
1035 1035
 		{
1036 1036
 			$count_query = sprintf('select %s %s %s %s'
1037 1037
 					, $temp_select
@@ -1050,23 +1050,23 @@  discard block
 block discarded – undo
1050 1050
 		$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
1051 1051
 
1052 1052
 		$list_count = $limit->list_count->getValue();
1053
-		if(!$list_count)
1053
+		if (!$list_count)
1054 1054
 		{
1055 1055
 			$list_count = 20;
1056 1056
 		}
1057 1057
 		$page_count = $limit->page_count->getValue();
1058
-		if(!$page_count)
1058
+		if (!$page_count)
1059 1059
 		{
1060 1060
 			$page_count = 10;
1061 1061
 		}
1062 1062
 		$page = $limit->page->getValue();
1063
-		if(!$page || $page < 1)
1063
+		if (!$page || $page < 1)
1064 1064
 		{
1065 1065
 			$page = 1;
1066 1066
 		}
1067 1067
 
1068 1068
 		// total pages
1069
-		if($total_count)
1069
+		if ($total_count)
1070 1070
 		{
1071 1071
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
1072 1072
 		}
@@ -1076,11 +1076,11 @@  discard block
 block discarded – undo
1076 1076
 		}
1077 1077
 
1078 1078
 		// check the page variables
1079
-		if($page > $total_page)
1079
+		if ($page > $total_page)
1080 1080
 		{
1081 1081
 			// If requested page is bigger than total number of pages, return empty list
1082 1082
 
1083
-			$buff = new Object ();
1083
+			$buff = new Object();
1084 1084
 			$buff->total_count = $total_count;
1085 1085
 			$buff->total_page = $total_page;
1086 1086
 			$buff->page = $page;
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 		$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
1095 1095
 		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
1096 1096
 		$result = $this->_query($query, $connection);
1097
-		if($this->isError())
1097
+		if ($this->isError())
1098 1098
 		{
1099 1099
 			unset($this->param);
1100 1100
 			return $this->queryError($queryObject);
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 		$virtual_no = $total_count - ($page - 1) * $list_count;
1104 1104
 		$data = $this->_fetch($result, $virtual_no);
1105 1105
 
1106
-		$buff = new Object ();
1106
+		$buff = new Object();
1107 1107
 		$buff->total_count = $total_count;
1108 1108
 		$buff->total_page = $total_page;
1109 1109
 		$buff->page = $page;
@@ -1135,39 +1135,39 @@  discard block
 block discarded – undo
1135 1135
 	{
1136 1136
 
1137 1137
 		$select = $query->getSelectString($with_values);
1138
-		if($select == '')
1138
+		if ($select == '')
1139 1139
 		{
1140 1140
 			return new Object(-1, "Invalid query");
1141 1141
 		}
1142 1142
 		$select = 'SELECT ' . $select;
1143 1143
 
1144 1144
 		$from = $query->getFromString($with_values);
1145
-		if($from == '')
1145
+		if ($from == '')
1146 1146
 		{
1147 1147
 			return new Object(-1, "Invalid query");
1148 1148
 		}
1149 1149
 		$from = ' FROM ' . $from;
1150 1150
 
1151 1151
 		$where = $query->getWhereString($with_values);
1152
-		if($where != '')
1152
+		if ($where != '')
1153 1153
 		{
1154 1154
 			$where = ' WHERE ' . $where;
1155 1155
 		}
1156 1156
 
1157 1157
 		$groupBy = $query->getGroupByString();
1158
-		if($groupBy != '')
1158
+		if ($groupBy != '')
1159 1159
 		{
1160 1160
 			$groupBy = ' GROUP BY ' . $groupBy;
1161 1161
 		}
1162 1162
 
1163 1163
 		$orderBy = $query->getOrderByString();
1164
-		if($orderBy != '')
1164
+		if ($orderBy != '')
1165 1165
 		{
1166 1166
 			$orderBy = ' ORDER BY ' . $orderBy;
1167 1167
 		}
1168 1168
 
1169 1169
 		$limit = $query->getLimitString();
1170
-		if($limit != '')
1170
+		if ($limit != '')
1171 1171
 		{
1172 1172
 			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count);
1173 1173
 		}
Please login to merge, or discard this patch.
classes/db/DBMssql.class.php 3 patches
Doc Comments   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	/**
112 112
 	 * DB transaction start
113 113
 	 * this method is private
114
-	 * @return boolean
114
+	 * @return null|boolean
115 115
 	 */
116 116
 	function _begin($transactionLevel)
117 117
 	{
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * this method is private
171 171
 	 * @param string $query
172 172
 	 * @param resource $connection
173
-	 * @return resource|boolean Returns a statement resource on success and FALSE if an error occurred.
173
+	 * @return resource Returns a statement resource on success and FALSE if an error occurred.
174 174
 	 */
175 175
 	function __query($query, $connection)
176 176
 	{
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param int $size column size
376 376
 	 * @param string|int $default default value
377 377
 	 * @param boolean $notnull not null status, default value is false
378
-	 * @return void
378
+	 * @return null|resource
379 379
 	 */
380 380
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
381 381
 	{
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * Check column exist status of the table
432 432
 	 * @param string $table_name table name
433 433
 	 * @param string $column_name column name
434
-	 * @return boolean
434
+	 * @return null|boolean
435 435
 	 */
436 436
 	function isColumnExists($table_name, $column_name)
437 437
 	{
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 * Check index status of the table
496 496
 	 * @param string $table_name table name
497 497
 	 * @param string $index_name index name
498
-	 * @return boolean
498
+	 * @return null|boolean
499 499
 	 */
500 500
 	function isIndexExists($table_name, $index_name)
501 501
 	{
@@ -728,6 +728,7 @@  discard block
 block discarded – undo
728 728
 	 * Return select query string
729 729
 	 * @param object $query
730 730
 	 * @param boolean $with_values
731
+	 * @param resource $connection
731 732
 	 * @return string
732 733
 	 */
733 734
 	function getSelectSql($query, $with_values = TRUE, $connection=NULL)
@@ -839,7 +840,7 @@  discard block
 block discarded – undo
839 840
 	 * it supports a method as navigation
840 841
 	 * @param Object $queryObject
841 842
 	 * @param resource $connection
842
-	 * @return Object
843
+	 * @return Object|null
843 844
 	 */
844 845
 	function _executeSelectAct($queryObject, $connection = null)
845 846
 	{
@@ -879,7 +880,7 @@  discard block
 block discarded – undo
879 880
 	/**
880 881
 	 * If have a error, return error object
881 882
 	 * @param Object $queryObject
882
-	 * @return Object
883
+	 * @return Object|null
883 884
 	 */
884 885
 	function queryError($queryObject)
885 886
 	{
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		//sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
71 71
 		$result = @sqlsrv_connect($connection["db_hostname"], array('Database' => $connection["db_database"], 'UID' => $connection["db_userid"], 'PWD' => $connection["db_password"]));
72 72
 
73
-		if(!$result)
73
+		if (!$result)
74 74
 		{
75 75
 			$errors = print_r(sqlsrv_errors(), true);
76 76
 			$this->setError(-1, 'database connect fail' . PHP_EOL . $errors);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	function addQuotes($string)
101 101
 	{
102
-		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
102
+		if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
103 103
 		{
104 104
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
105 105
 		}
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	{
118 118
 		$connection = $this->_getConnection('master');
119 119
 
120
-		if(!$transactionLevel)
120
+		if (!$transactionLevel)
121 121
 		{
122
-			if(sqlsrv_begin_transaction($connection) === false)
122
+			if (sqlsrv_begin_transaction($connection) === false)
123 123
 			{
124 124
 				return;
125 125
 			}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$point = $transactionLevel - 1;
144 144
 
145
-		if($point)
145
+		if ($point)
146 146
 		{
147 147
 			$this->_query("ROLLBACK TRANS SP" . $point, $connection);
148 148
 		}
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 	{
177 177
 		$_param = array();
178 178
 
179
-		if(count($this->param))
179
+		if (count($this->param))
180 180
 		{
181
-			foreach($this->param as $k => $o)
181
+			foreach ($this->param as $k => $o)
182 182
 			{
183
-				if($o->isColumnName())
183
+				if ($o->isColumnName())
184 184
 				{
185 185
 					continue;
186 186
 				}
187
-				if($o->getType() == 'number')
187
+				if ($o->getType() == 'number')
188 188
 				{
189 189
 					$value = $o->getUnescapedValue();
190
-					if(is_array($value))
190
+					if (is_array($value))
191 191
 					{
192 192
 						$_param = array_merge($_param, $value);
193 193
 					}
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 				else
200 200
 				{
201 201
 					$value = $o->getUnescapedValue();
202
-					if(is_array($value))
202
+					if (is_array($value))
203 203
 					{
204
-						foreach($value as $v)
204
+						foreach ($value as $v)
205 205
 						{
206 206
 							$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
207 207
 						}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
 		// Run the query statement
218 218
 		$result = false;
219
-		if(count($_param))
219
+		if (count($_param))
220 220
 		{
221 221
 			$args = $this->_getParametersByReference($_param);
222 222
 			$stmt = sqlsrv_prepare($connection, $query, $args);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$stmt = sqlsrv_prepare($connection, $query);
227 227
 		}
228 228
 
229
-		if(!$stmt)
229
+		if (!$stmt)
230 230
 		{
231 231
 			$result = false;
232 232
 		}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		}
237 237
 
238 238
 		// Error Check
239
-		if(!$result)
239
+		if (!$result)
240 240
 		{
241 241
 			$this->setError(print_r(sqlsrv_errors(), true));
242 242
 		}
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 		$copy = array();
260 260
 		$args = array();
261 261
 		$i = 0;
262
-		foreach($_param as $key => $value)
262
+		foreach ($_param as $key => $value)
263 263
 		{
264
-			if(is_array($value))
264
+			if (is_array($value))
265 265
 			{
266 266
 				$value_copy = $value;
267 267
 				$value_arg = array();
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	function _fetch($result, $arrayIndexEndValue = NULL)
289 289
 	{
290 290
 		$output = array();
291
-		if(!$this->isConnected() || $this->isError() || !$result)
291
+		if (!$this->isConnected() || $this->isError() || !$result)
292 292
 		{
293 293
 			return $output;
294 294
 		}
@@ -296,18 +296,18 @@  discard block
 block discarded – undo
296 296
 		$c = sqlsrv_num_fields($result);
297 297
 		$m = null;
298 298
 
299
-		while(sqlsrv_fetch($result))
299
+		while (sqlsrv_fetch($result))
300 300
 		{
301
-			if(!$m)
301
+			if (!$m)
302 302
 			{
303 303
 				$m = sqlsrv_field_metadata($result);
304 304
 			}
305 305
 			unset($row);
306
-			for($i = 0; $i < $c; $i++)
306
+			for ($i = 0; $i < $c; $i++)
307 307
 			{
308 308
 				$row->{$m[$i]['Name']} = sqlsrv_get_field($result, $i, SQLSRV_PHPTYPE_STRING('utf-8'));
309 309
 			}
310
-			if($arrayIndexEndValue)
310
+			if ($arrayIndexEndValue)
311 311
 			{
312 312
 				$output[$arrayIndexEndValue--] = $row;
313 313
 			}
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 			}
318 318
 		}
319 319
 
320
-		if(count($output) == 1)
320
+		if (count($output) == 1)
321 321
 		{
322
-			if(isset($arrayIndexEndValue))
322
+			if (isset($arrayIndexEndValue))
323 323
 			{
324 324
 				return $output;
325 325
 			}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 		$result = $this->_query($query);
361 361
 		$tmp = $this->_fetch($result);
362 362
 
363
-		if(!$tmp)
363
+		if (!$tmp)
364 364
 		{
365 365
 			return false;
366 366
 		}
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
381 381
 	{
382
-		if($this->isColumnExists($table_name, $column_name))
382
+		if ($this->isColumnExists($table_name, $column_name))
383 383
 		{
384 384
 			return;
385 385
 		}
386 386
 		$type = $this->column_type[$type];
387
-		if(strtoupper($type) == 'INTEGER')
387
+		if (strtoupper($type) == 'INTEGER')
388 388
 		{
389 389
 			$size = '';
390 390
 		}
391 391
 
392 392
 		$query = sprintf("alter table %s%s add %s ", $this->prefix, $table_name, $column_name);
393
-		if($size)
393
+		if ($size)
394 394
 		{
395 395
 			$query .= sprintf(" %s(%s) ", $type, $size);
396 396
 		}
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
 			$query .= sprintf(" %s ", $type);
400 400
 		}
401 401
 
402
-		if(isset($default))
402
+		if (isset($default))
403 403
 		{
404 404
 			$query .= sprintf(" default '%s' ", $default);
405 405
 		}
406
-		if($notnull)
406
+		if ($notnull)
407 407
 		{
408 408
 			$query .= " not null ";
409 409
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	function dropColumn($table_name, $column_name)
421 421
 	{
422
-		if(!$this->isColumnExists($table_name, $column_name))
422
+		if (!$this->isColumnExists($table_name, $column_name))
423 423
 		{
424 424
 			return;
425 425
 		}
@@ -437,12 +437,12 @@  discard block
 block discarded – undo
437 437
 	{
438 438
 		$query = sprintf("select syscolumns.name as name from syscolumns, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = syscolumns.id and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name);
439 439
 		$result = $this->_query($query);
440
-		if($this->isError())
440
+		if ($this->isError())
441 441
 		{
442 442
 			return;
443 443
 		}
444 444
 		$tmp = $this->_fetch($result);
445
-		if(!$tmp->name)
445
+		if (!$tmp->name)
446 446
 		{
447 447
 			return false;
448 448
 		}
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 	 */
462 462
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = false)
463 463
 	{
464
-		if($this->isIndexExists($table_name, $index_name))
464
+		if ($this->isIndexExists($table_name, $index_name))
465 465
 		{
466 466
 			return;
467 467
 		}
468
-		if(!is_array($target_columns))
468
+		if (!is_array($target_columns))
469 469
 		{
470 470
 			$target_columns = array($target_columns);
471 471
 		}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 */
484 484
 	function dropIndex($table_name, $index_name, $is_unique = false)
485 485
 	{
486
-		if(!$this->isIndexExists($table_name, $index_name))
486
+		if (!$this->isIndexExists($table_name, $index_name))
487 487
 		{
488 488
 			return;
489 489
 		}
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 		$query = sprintf("select sysindexes.name as name from sysindexes, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = sysindexes.id and sysindexes.name = '%s'", $this->prefix, $table_name, $index_name);
503 503
 
504 504
 		$result = $this->_query($query);
505
-		if($this->isError())
505
+		if ($this->isError())
506 506
 		{
507 507
 			return;
508 508
 		}
509 509
 		$tmp = $this->_fetch($result);
510 510
 
511
-		if(!$tmp->name)
511
+		if (!$tmp->name)
512 512
 		{
513 513
 			return false;
514 514
 		}
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	function createTableByXmlFile($file_name)
534 534
 	{
535
-		if(!file_exists($file_name))
535
+		if (!file_exists($file_name))
536 536
 		{
537 537
 			return;
538 538
 		}
@@ -557,12 +557,12 @@  discard block
 block discarded – undo
557 557
 		$xml_obj = $oXml->parse($xml_doc);
558 558
 		// Create a table schema
559 559
 		$table_name = $xml_obj->table->attrs->name;
560
-		if($this->isTableExists($table_name))
560
+		if ($this->isTableExists($table_name))
561 561
 		{
562 562
 			return;
563 563
 		}
564 564
 
565
-		if($table_name == 'sequence')
565
+		if ($table_name == 'sequence')
566 566
 		{
567 567
 			$table_name = $this->prefix . $table_name;
568 568
 			$query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name);
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 		{
573 573
 			$table_name = $this->prefix . $table_name;
574 574
 
575
-			if(!is_array($xml_obj->table->column))
575
+			if (!is_array($xml_obj->table->column))
576 576
 			{
577 577
 				$columns[] = $xml_obj->table->column;
578 578
 			}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			$index_list = array();
587 587
 
588 588
 			$typeList = array('number' => 1, 'text' => 1);
589
-			foreach($columns as $column)
589
+			foreach ($columns as $column)
590 590
 			{
591 591
 				$name = $column->attrs->name;
592 592
 				$type = $column->attrs->type;
@@ -600,44 +600,44 @@  discard block
 block discarded – undo
600 600
 
601 601
 				$column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : '');
602 602
 
603
-				if($primary_key)
603
+				if ($primary_key)
604 604
 				{
605 605
 					$primary_list[] = $name;
606 606
 				}
607
-				else if($unique)
607
+				else if ($unique)
608 608
 				{
609 609
 					$unique_list[$unique][] = $name;
610 610
 				}
611
-				else if($index)
611
+				else if ($index)
612 612
 				{
613 613
 					$index_list[$index][] = $name;
614 614
 				}
615 615
 			}
616 616
 
617
-			if(count($primary_list))
617
+			if (count($primary_list))
618 618
 			{
619 619
 				$column_schema[] = sprintf("primary key (%s)", '"' . implode($primary_list, '","') . '"');
620 620
 			}
621 621
 
622 622
 			$schema = sprintf('create table [%s] (%s%s)', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"));
623 623
 			$output = $this->_query($schema);
624
-			if(!$output)
624
+			if (!$output)
625 625
 			{
626 626
 				return false;
627 627
 			}
628 628
 
629
-			if(count($unique_list))
629
+			if (count($unique_list))
630 630
 			{
631
-				foreach($unique_list as $key => $val)
631
+				foreach ($unique_list as $key => $val)
632 632
 				{
633 633
 					$query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']');
634 634
 					$this->_query($query);
635 635
 				}
636 636
 			}
637 637
 
638
-			if(count($index_list))
638
+			if (count($index_list))
639 639
 			{
640
-				foreach($index_list as $key => $val)
640
+				foreach ($index_list as $key => $val)
641 641
 				{
642 642
 					$query = sprintf("create index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']');
643 643
 					$this->_query($query);
@@ -682,27 +682,27 @@  discard block
 block discarded – undo
682 682
 	function getUpdateSql($query, $with_values = true, $with_priority = false)
683 683
 	{
684 684
 		$columnsList = $query->getUpdateString($with_values);
685
-		if($columnsList == '')
685
+		if ($columnsList == '')
686 686
 		{
687 687
 			return new Object(-1, "Invalid query");
688 688
 		}
689 689
 
690 690
 		$from = $query->getFromString($with_values);
691
-		if($from == '')
691
+		if ($from == '')
692 692
 		{
693 693
 			return new Object(-1, "Invalid query");
694 694
 		}
695 695
 
696 696
 		$tables = $query->getTables();
697 697
 		$alias_list = '';
698
-		foreach($tables as $table)
698
+		foreach ($tables as $table)
699 699
 		{
700 700
 			$alias_list .= $table->getAlias();
701 701
 		}
702 702
 		implode(',', explode(' ', $alias_list));
703 703
 
704 704
 		$where = $query->getWhereString($with_values);
705
-		if($where != '')
705
+		if ($where != '')
706 706
 		{
707 707
 			$where = ' WHERE ' . $where;
708 708
 		}
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * @param boolean $with_values
731 731
 	 * @return string
732 732
 	 */
733
-	function getSelectSql($query, $with_values = TRUE, $connection=NULL)
733
+	function getSelectSql($query, $with_values = TRUE, $connection = NULL)
734 734
 	{
735 735
 		$with_values = false;
736 736
 
@@ -740,21 +740,21 @@  discard block
 block discarded – undo
740 740
 		$limit = '';
741 741
 		$limitCount = '';
742 742
 		$limitQueryPart = $query->getLimit();
743
-		if($limitQueryPart)
743
+		if ($limitQueryPart)
744 744
 		{
745 745
 			$limitCount = $limitQueryPart->getLimit();
746 746
 		}
747
-		if($limitCount != '')
747
+		if ($limitCount != '')
748 748
 		{
749 749
 			$limit = 'SELECT TOP ' . $limitCount;
750 750
 		}
751 751
 
752 752
 		$select = $query->getSelectString($with_values);
753
-		if($select == '')
753
+		if ($select == '')
754 754
 		{
755 755
 			return new Object(-1, "Invalid query");
756 756
 		}
757
-		if($limit != '')
757
+		if ($limit != '')
758 758
 		{
759 759
 			$select = $limit . ' ' . $select;
760 760
 		}
@@ -764,51 +764,51 @@  discard block
 block discarded – undo
764 764
 		}
765 765
 
766 766
 		$from = $query->getFromString($with_values);
767
-		if($from == '')
767
+		if ($from == '')
768 768
 		{
769 769
 			return new Object(-1, "Invalid query");
770 770
 		}
771 771
 		$from = ' FROM ' . $from;
772 772
 
773 773
 		$where = $query->getWhereString($with_values);
774
-		if($where != '')
774
+		if ($where != '')
775 775
 		{
776 776
 			$where = ' WHERE ' . $where;
777 777
 		}
778 778
 
779 779
 		$groupBy = $query->getGroupByString();
780
-		if($groupBy != '')
780
+		if ($groupBy != '')
781 781
 		{
782 782
 			$groupBy = ' GROUP BY ' . $groupBy;
783 783
 		}
784 784
 
785 785
 		$orderBy = $query->getOrderByString();
786
-		if($orderBy != '')
786
+		if ($orderBy != '')
787 787
 		{
788 788
 			$orderBy = ' ORDER BY ' . $orderBy;
789 789
 		}
790 790
 
791
-		if($limitCount != '' && $query->limit->start > 0)
791
+		if ($limitCount != '' && $query->limit->start > 0)
792 792
 		{
793 793
 			$order = $query->getOrder();
794 794
 			$first_columns = array();
795
-			foreach($order as $val)
795
+			foreach ($order as $val)
796 796
 			{
797 797
 				$tmpColumnName = $val->getPureColumnName();
798
-				$first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder()=='asc'?'max':'min', $tmpColumnName, $tmpColumnName);
798
+				$first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder() == 'asc' ? 'max' : 'min', $tmpColumnName, $tmpColumnName);
799 799
 				$first_sub_columns[] = $tmpColumnName;
800 800
 			}
801 801
 
802
-			$first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',',$first_columns),  $query->limit->start, implode(',',$first_sub_columns), $from, $where, $groupBy, $orderBy);
802
+			$first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',', $first_columns), $query->limit->start, implode(',', $first_sub_columns), $from, $where, $groupBy, $orderBy);
803 803
 			$this->param = $query->getArguments();
804 804
 			$result = $this->__query($first_query, $connection);
805 805
 			$tmp = $this->_fetch($result);
806 806
 
807 807
 			$sub_cond = array();
808
-			foreach($order as $k => $v)
808
+			foreach ($order as $k => $v)
809 809
 			{
810 810
 				//for example... use Document
811
-				if(get_class($v->sort_order) == 'SortArgument')
811
+				if (get_class($v->sort_order) == 'SortArgument')
812 812
 				{
813 813
 					$sort_order = $v->sort_order->value;
814 814
 				}
@@ -818,19 +818,19 @@  discard block
 block discarded – undo
818 818
 					$sort_order = $v->sort_order;
819 819
 				}
820 820
 
821
-				$sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order=='asc'?'>':'<', $tmp->{$v->getPureColumnName()});
821
+				$sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order == 'asc' ? '>' : '<', $tmp->{$v->getPureColumnName()});
822 822
 			}
823 823
 
824
-			if(!$where)
824
+			if (!$where)
825 825
 			{
826
-				$sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )';
826
+				$sub_condition = ' WHERE ( ' . implode(' and ', $sub_cond) . ' )';
827 827
 			}
828 828
 			else
829 829
 			{
830
-				$sub_condition = ' and ( '.implode(' and ',$sub_cond).' )';
830
+				$sub_condition = ' and ( ' . implode(' and ', $sub_cond) . ' )';
831 831
 			}
832 832
 		}
833
-		return $select . ' ' . $from . ' ' . $where .$sub_condition. ' ' . $groupBy . ' ' . $orderBy;
833
+		return $select . ' ' . $from . ' ' . $where . $sub_condition . ' ' . $groupBy . ' ' . $orderBy;
834 834
 	}
835 835
 
836 836
 	/**
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	{
846 846
 		$query = $this->getSelectSql($queryObject, true, $connection);
847 847
 
848
-		if(strpos($query, "substr"))
848
+		if (strpos($query, "substr"))
849 849
 		{
850 850
 			$query = str_replace("substr", "substring", $query);
851 851
 		}
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 		$query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
857 857
 		$result = $this->_query($query, $connection);
858 858
 
859
-		if($this->isError())
859
+		if ($this->isError())
860 860
 		{
861 861
 			return $this->queryError($queryObject);
862 862
 		}
@@ -884,9 +884,9 @@  discard block
 block discarded – undo
884 884
 	function queryError($queryObject)
885 885
 	{
886 886
 		$limit = $queryObject->getLimit();
887
-		if($limit && $limit->isPageHandler())
887
+		if ($limit && $limit->isPageHandler())
888 888
 		{
889
-			$buff = new Object ();
889
+			$buff = new Object();
890 890
 			$buff->total_count = 0;
891 891
 			$buff->total_page = 0;
892 892
 			$buff->page = 1;
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	function queryPageLimit($queryObject, $result, $connection)
911 911
 	{
912 912
 		$limit = $queryObject->getLimit();
913
-		if($limit && $limit->isPageHandler())
913
+		if ($limit && $limit->isPageHandler())
914 914
 		{
915 915
 			// Total count
916 916
 			$temp_where = $queryObject->getWhereString(true, false);
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 			$temp_select = $queryObject->getSelectString(true);
921 921
 			$uses_distinct = stripos($temp_select, "distinct") !== false;
922 922
 			$uses_groupby = $queryObject->getGroupByString() != '';
923
-			if($uses_distinct || $uses_groupby)
923
+			if ($uses_distinct || $uses_groupby)
924 924
 			{
925 925
 				$count_query = sprintf('select %s %s %s %s'
926 926
 						, $temp_select
@@ -940,22 +940,22 @@  discard block
 block discarded – undo
940 940
 			$total_count = (int) $count_output->count;
941 941
 
942 942
 			$list_count = $limit->list_count->getValue();
943
-			if(!$list_count)
943
+			if (!$list_count)
944 944
 			{
945 945
 				$list_count = 20;
946 946
 			}
947 947
 			$page_count = $limit->page_count->getValue();
948
-			if(!$page_count)
948
+			if (!$page_count)
949 949
 			{
950 950
 				$page_count = 10;
951 951
 			}
952 952
 			$page = $limit->page->getValue();
953
-			if(!$page || $page < 1)
953
+			if (!$page || $page < 1)
954 954
 			{
955 955
 				$page = 1;
956 956
 			}
957 957
 			// Total pages
958
-			if($total_count)
958
+			if ($total_count)
959 959
 			{
960 960
 				$total_page = (int) (($total_count - 1) / $list_count) + 1;
961 961
 			}
@@ -965,11 +965,11 @@  discard block
 block discarded – undo
965 965
 			}
966 966
 
967 967
 			// check the page variables
968
-			if($page > $total_page)
968
+			if ($page > $total_page)
969 969
 			{
970 970
 				// If requested page is bigger than total number of pages, return empty list
971 971
 
972
-				$buff = new Object ();
972
+				$buff = new Object();
973 973
 				$buff->total_count = $total_count;
974 974
 				$buff->total_page = $total_page;
975 975
 				$buff->page = $page;
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 				$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
978 978
 				return $buff;
979 979
 
980
-				if($queryObject->usesClickCount())
980
+				if ($queryObject->usesClickCount())
981 981
 				{
982 982
 					$update_query = $this->getClickCountQuery($queryObject);
983 983
 					$this->_executeUpdateAct($update_query);
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 			$virtual_no = $total_count - $start_count;
990 990
 			$data = $this->_fetch($result, $virtual_no);
991 991
 
992
-			$buff = new Object ();
992
+			$buff = new Object();
993 993
 			$buff->total_count = $total_count;
994 994
 			$buff->total_page = $total_page;
995 995
 			$buff->page = $page;
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 		else
1000 1000
 		{
1001 1001
 			$data = $this->_fetch($result);
1002
-			$buff = new Object ();
1002
+			$buff = new Object();
1003 1003
 			$buff->data = $data;
1004 1004
 		}
1005 1005
 		return $buff;
Please login to merge, or discard this patch.
Braces   +21 added lines, -42 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
 			{
124 124
 				return;
125 125
 			}
126
-		}
127
-		else
126
+		} else
128 127
 		{
129 128
 			$this->_query("SAVE TRANS SP" . $transactionLevel, $connection);
130 129
 		}
@@ -145,8 +144,7 @@  discard block
 block discarded – undo
145 144
 		if($point)
146 145
 		{
147 146
 			$this->_query("ROLLBACK TRANS SP" . $point, $connection);
148
-		}
149
-		else
147
+		} else
150 148
 		{
151 149
 			sqlsrv_rollback($connection);
152 150
 		}
@@ -190,13 +188,11 @@  discard block
 block discarded – undo
190 188
 					if(is_array($value))
191 189
 					{
192 190
 						$_param = array_merge($_param, $value);
193
-					}
194
-					else
191
+					} else
195 192
 					{
196 193
 						$_param[] = $o->getUnescapedValue();
197 194
 					}
198
-				}
199
-				else
195
+				} else
200 196
 				{
201 197
 					$value = $o->getUnescapedValue();
202 198
 					if(is_array($value))
@@ -205,8 +201,7 @@  discard block
 block discarded – undo
205 201
 						{
206 202
 							$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
207 203
 						}
208
-					}
209
-					else
204
+					} else
210 205
 					{
211 206
 						$_param[] = array($value, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
212 207
 					}
@@ -220,8 +215,7 @@  discard block
 block discarded – undo
220 215
 		{
221 216
 			$args = $this->_getParametersByReference($_param);
222 217
 			$stmt = sqlsrv_prepare($connection, $query, $args);
223
-		}
224
-		else
218
+		} else
225 219
 		{
226 220
 			$stmt = sqlsrv_prepare($connection, $query);
227 221
 		}
@@ -229,8 +223,7 @@  discard block
 block discarded – undo
229 223
 		if(!$stmt)
230 224
 		{
231 225
 			$result = false;
232
-		}
233
-		else
226
+		} else
234 227
 		{
235 228
 			$result = sqlsrv_execute($stmt);
236 229
 		}
@@ -268,8 +261,7 @@  discard block
 block discarded – undo
268 261
 				$value_arg[] = &$value_copy[0];
269 262
 				$value_arg[] = $value_copy[1];
270 263
 				$value_arg[] = $value_copy[2];
271
-			}
272
-			else
264
+			} else
273 265
 			{
274 266
 				$value_arg = $value;
275 267
 			}
@@ -310,8 +302,7 @@  discard block
 block discarded – undo
310 302
 			if($arrayIndexEndValue)
311 303
 			{
312 304
 				$output[$arrayIndexEndValue--] = $row;
313
-			}
314
-			else
305
+			} else
315 306
 			{
316 307
 				$output[] = $row;
317 308
 			}
@@ -322,8 +313,7 @@  discard block
 block discarded – undo
322 313
 			if(isset($arrayIndexEndValue))
323 314
 			{
324 315
 				return $output;
325
-			}
326
-			else
316
+			} else
327 317
 			{
328 318
 				return $output[0];
329 319
 			}
@@ -393,8 +383,7 @@  discard block
 block discarded – undo
393 383
 		if($size)
394 384
 		{
395 385
 			$query .= sprintf(" %s(%s) ", $type, $size);
396
-		}
397
-		else
386
+		} else
398 387
 		{
399 388
 			$query .= sprintf(" %s ", $type);
400 389
 		}
@@ -567,16 +556,14 @@  discard block
 block discarded – undo
567 556
 			$table_name = $this->prefix . $table_name;
568 557
 			$query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name);
569 558
 			return $this->_query($query);
570
-		}
571
-		else
559
+		} else
572 560
 		{
573 561
 			$table_name = $this->prefix . $table_name;
574 562
 
575 563
 			if(!is_array($xml_obj->table->column))
576 564
 			{
577 565
 				$columns[] = $xml_obj->table->column;
578
-			}
579
-			else
566
+			} else
580 567
 			{
581 568
 				$columns = $xml_obj->table->column;
582 569
 			}
@@ -603,12 +590,10 @@  discard block
 block discarded – undo
603 590
 				if($primary_key)
604 591
 				{
605 592
 					$primary_list[] = $name;
606
-				}
607
-				else if($unique)
593
+				} else if($unique)
608 594
 				{
609 595
 					$unique_list[$unique][] = $name;
610
-				}
611
-				else if($index)
596
+				} else if($index)
612 597
 				{
613 598
 					$index_list[$index][] = $name;
614 599
 				}
@@ -757,8 +742,7 @@  discard block
 block discarded – undo
757 742
 		if($limit != '')
758 743
 		{
759 744
 			$select = $limit . ' ' . $select;
760
-		}
761
-		else
745
+		} else
762 746
 		{
763 747
 			$select = 'SELECT ' . $select;
764 748
 		}
@@ -824,8 +808,7 @@  discard block
 block discarded – undo
824 808
 			if(!$where)
825 809
 			{
826 810
 				$sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )';
827
-			}
828
-			else
811
+			} else
829 812
 			{
830 813
 				$sub_condition = ' and ( '.implode(' and ',$sub_cond).' )';
831 814
 			}
@@ -859,8 +842,7 @@  discard block
 block discarded – undo
859 842
 		if($this->isError())
860 843
 		{
861 844
 			return $this->queryError($queryObject);
862
-		}
863
-		else
845
+		} else
864 846
 		{
865 847
 			return $this->queryPageLimit($queryObject, $result, $connection);
866 848
 		}
@@ -893,8 +875,7 @@  discard block
 block discarded – undo
893 875
 			$buff->data = array();
894 876
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
895 877
 			return $buff;
896
-		}
897
-		else
878
+		} else
898 879
 		{
899 880
 			return;
900 881
 		}
@@ -958,8 +939,7 @@  discard block
 block discarded – undo
958 939
 			if($total_count)
959 940
 			{
960 941
 				$total_page = (int) (($total_count - 1) / $list_count) + 1;
961
-			}
962
-			else
942
+			} else
963 943
 			{
964 944
 				$total_page = 1;
965 945
 			}
@@ -995,8 +975,7 @@  discard block
 block discarded – undo
995 975
 			$buff->page = $page;
996 976
 			$buff->data = $data;
997 977
 			$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
998
-		}
999
-		else
978
+		} else
1000 979
 		{
1001 980
 			$data = $this->_fetch($result);
1002 981
 			$buff = new Object ();
Please login to merge, or discard this patch.
classes/db/DBMysql.class.php 3 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param int $size column size
298 298
 	 * @param string|int $default default value
299 299
 	 * @param boolean $notnull not null status, default value is false
300
-	 * @return void
300
+	 * @return resource|null
301 301
 	 */
302 302
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
303 303
 	{
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * Check column exist status of the table
345 345
 	 * @param string $table_name table name
346 346
 	 * @param string $column_name column name
347
-	 * @return boolean
347
+	 * @return null|boolean
348 348
 	 */
349 349
 	function isColumnExists($table_name, $column_name)
350 350
 	{
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * Check index status of the table
409 409
 	 * @param string $table_name table name
410 410
 	 * @param string $index_name index name
411
-	 * @return boolean
411
+	 * @return null|boolean
412 412
 	 */
413 413
 	function isIndexExists($table_name, $index_name)
414 414
 	{
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	/**
443 443
 	 * Creates a table by using xml contents
444 444
 	 * @param string $xml_doc xml schema contents
445
-	 * @return void|object
445
+	 * @return null|false
446 446
 	 */
447 447
 	function createTableByXml($xml_doc)
448 448
 	{
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * Creates a table by using xml file path
454 454
 	 * @param string $file_name xml schema file path
455
-	 * @return void|object
455
+	 * @return null|false
456 456
 	 */
457 457
 	function createTableByXmlFile($file_name)
458 458
 	{
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * opt : notnull, default, size\n
473 473
 	 * index : primary key, index, unique\n
474 474
 	 * @param string $xml_doc xml schema contents
475
-	 * @return void|object
475
+	 * @return null|false
476 476
 	 */
477 477
 	function _createTable($xml_doc)
478 478
 	{
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @param Object $queryObject
619 619
 	 * @param resource $connection
620 620
 	 * @param boolean $with_values
621
-	 * @return Object
621
+	 * @return Object|null
622 622
 	 */
623 623
 	function _executeSelectAct($queryObject, $connection = null, $with_values = true)
624 624
 	{
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	/**
704 704
 	 * If have a error, return error object
705 705
 	 * @param Object $queryObject
706
-	 * @return Object
706
+	 * @return Object|null
707 707
 	 */
708 708
 	function queryError($queryObject)
709 709
 	{
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * @param resource $result
731 731
 	 * @param resource $connection
732 732
 	 * @param boolean $with_values
733
-	 * @return Object Object with page info containing
733
+	 * @return Object|null Object with page info containing
734 734
 	 */
735 735
 	function queryPageLimit($queryObject, $result, $connection, $with_values = true)
736 736
 	{
Please login to merge, or discard this patch.
Braces   +17 added lines, -22 removed lines patch added patch discarded remove patch
@@ -214,8 +214,7 @@  discard block
 block discarded – undo
214 214
 			if($arrayIndexEndValue)
215 215
 			{
216 216
 				$output[$arrayIndexEndValue--] = $tmp;
217
-			}
218
-			else
217
+			} else
219 218
 			{
220 219
 				$output[] = $tmp;
221 220
 			}
@@ -225,8 +224,7 @@  discard block
 block discarded – undo
225 224
 			if(isset($arrayIndexEndValue))
226 225
 			{
227 226
 				return $output;
228
-			}
229
-			else
227
+			} else
230 228
 			{
231 229
 				return $output[0];
232 230
 			}
@@ -311,8 +309,7 @@  discard block
 block discarded – undo
311 309
 		if($size)
312 310
 		{
313 311
 			$query .= sprintf(" %s(%s) ", $type, $size);
314
-		}
315
-		else
312
+		} else
316 313
 		{
317 314
 			$query .= sprintf(" %s ", $type);
318 315
 		}
@@ -490,8 +487,7 @@  discard block
 block discarded – undo
490 487
 		if(!is_array($xml_obj->table->column))
491 488
 		{
492 489
 			$columns[] = $xml_obj->table->column;
493
-		}
494
-		else
490
+		} else
495 491
 		{
496 492
 			$columns = $xml_obj->table->column;
497 493
 		}
@@ -517,12 +513,10 @@  discard block
 block discarded – undo
517 513
 			if($primary_key)
518 514
 			{
519 515
 				$primary_list[] = $name;
520
-			}
521
-			else if($unique)
516
+			} else if($unique)
522 517
 			{
523 518
 				$unique_list[$unique][] = $name;
524
-			}
525
-			else if($index)
519
+			} else if($index)
526 520
 			{
527 521
 				$index_list[$index][] = $name;
528 522
 			}
@@ -552,8 +546,9 @@  discard block
 block discarded – undo
552 546
 		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM  CHARACTER SET utf8 COLLATE utf8_general_ci");
553 547
 
554 548
 		$output = $this->_query($schema);
555
-		if(!$output)
556
-			return false;
549
+		if(!$output) {
550
+					return false;
551
+		}
557 552
 	}
558 553
 
559 554
 	/**
@@ -584,8 +579,11 @@  discard block
 block discarded – undo
584 579
 		$query = $this->getUpdateSql($queryObject, $with_values, true);
585 580
 		if(is_a($query, 'Object'))
586 581
 		{
587
-			if(!$query->toBool()) return $query;
588
-			else return;
582
+			if(!$query->toBool()) {
583
+				return $query;
584
+			} else {
585
+				return;
586
+			}
589 587
 		}
590 588
 
591 589
 		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
@@ -627,8 +625,7 @@  discard block
 block discarded – undo
627 625
 		if($limit && $limit->isPageHandler())
628 626
 		{
629 627
 			return $this->queryPageLimit($queryObject, $result, $connection, $with_values);
630
-		}
631
-		else
628
+		} else
632 629
 		{
633 630
 			$query = $this->getSelectSql($queryObject, $with_values);
634 631
 			if(is_a($query, 'Object'))
@@ -717,8 +714,7 @@  discard block
 block discarded – undo
717 714
 			$buff->data = array();
718 715
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
719 716
 			return $buff;
720
-		}
721
-		else
717
+		} else
722 718
 		{
723 719
 			return;
724 720
 		}
@@ -781,8 +777,7 @@  discard block
 block discarded – undo
781 777
 		if($total_count)
782 778
 		{
783 779
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
784
-		}
785
-		else
780
+		} else
786 781
 		{
787 782
 			$total_page = 1;
788 783
 		}
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -67,32 +67,32 @@  discard block
 block discarded – undo
67 67
 	function __connect($connection)
68 68
 	{
69 69
 		// Ignore if no DB information exists
70
-		if(strpos($connection["db_hostname"], ':') === false && $connection["db_port"])
70
+		if (strpos($connection["db_hostname"], ':') === false && $connection["db_port"])
71 71
 		{
72 72
 			$connection["db_hostname"] .= ':' . $connection["db_port"];
73 73
 		}
74 74
 
75 75
 		// Attempt to connect
76 76
 		$result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]);
77
-		if(!$result)
77
+		if (!$result)
78 78
 		{
79 79
 			exit('XE cannot connect to DB.');
80 80
 		}
81 81
 
82
-		if(mysql_error())
82
+		if (mysql_error())
83 83
 		{
84 84
 			$this->setError(mysql_errno(), mysql_error());
85 85
 			return;
86 86
 		}
87 87
 		// Error appears if the version is lower than 4.1
88
-		if(version_compare(mysql_get_server_info($result), '4.1', '<'))
88
+		if (version_compare(mysql_get_server_info($result), '4.1', '<'))
89 89
 		{
90 90
 			$this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is ' . mysql_get_server_info());
91 91
 			return;
92 92
 		}
93 93
 		// select db
94 94
 		@mysql_select_db($connection["db_database"], $result);
95
-		if(mysql_error())
95
+		if (mysql_error())
96 96
 		{
97 97
 			$this->setError(mysql_errno(), mysql_error());
98 98
 			return;
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	function addQuotes($string)
133 133
 	{
134
-		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
134
+		if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
135 135
 		{
136 136
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
137 137
 		}
138
-		if(!is_numeric($string))
138
+		if (!is_numeric($string))
139 139
 		{
140 140
 			$string = @mysql_real_escape_string($string);
141 141
 		}
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	function __query($query, $connection)
183 183
 	{
184
-		if(!$connection)
184
+		if (!$connection)
185 185
 		{
186 186
 			exit('XE cannot handle DB connection.');
187 187
 		}
188 188
 		// Run the query statement
189 189
 		$result = mysql_query($query, $connection);
190 190
 		// Error Check
191
-		if(mysql_error($connection))
191
+		if (mysql_error($connection))
192 192
 		{
193 193
 			$this->setError(mysql_errno($connection), mysql_error($connection));
194 194
 		}
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 	function _fetch($result, $arrayIndexEndValue = NULL)
206 206
 	{
207 207
 		$output = array();
208
-		if(!$this->isConnected() || $this->isError() || !$result)
208
+		if (!$this->isConnected() || $this->isError() || !$result)
209 209
 		{
210 210
 			return $output;
211 211
 		}
212
-		while($tmp = $this->db_fetch_object($result))
212
+		while ($tmp = $this->db_fetch_object($result))
213 213
 		{
214
-			if($arrayIndexEndValue)
214
+			if ($arrayIndexEndValue)
215 215
 			{
216 216
 				$output[$arrayIndexEndValue--] = $tmp;
217 217
 			}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 				$output[] = $tmp;
221 221
 			}
222 222
 		}
223
-		if(count($output) == 1)
223
+		if (count($output) == 1)
224 224
 		{
225
-			if(isset($arrayIndexEndValue))
225
+			if (isset($arrayIndexEndValue))
226 226
 			{
227 227
 				return $output;
228 228
 			}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		$query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix);
246 246
 		$this->_query($query);
247 247
 		$sequence = $this->db_insert_id();
248
-		if($sequence % 10000 == 0)
248
+		if ($sequence % 10000 == 0)
249 249
 		{
250 250
 			$query = sprintf("delete from  `%ssequence` where seq < %d", $this->prefix, $sequence);
251 251
 			$this->_query($query);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		$query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($password));
266 266
 		$result = $this->_query($query);
267 267
 		$tmp = $this->_fetch($result);
268
-		if($tmp->password === $saved_password || $tmp->old_password === $saved_password)
268
+		if ($tmp->password === $saved_password || $tmp->old_password === $saved_password)
269 269
 		{
270 270
 			return true;
271 271
 		}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($target_name));
283 283
 		$result = $this->_query($query);
284 284
 		$tmp = $this->_fetch($result);
285
-		if(!$tmp)
285
+		if (!$tmp)
286 286
 		{
287 287
 			return false;
288 288
 		}
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
303 303
 	{
304 304
 		$type = $this->column_type[$type];
305
-		if(strtoupper($type) == 'INTEGER')
305
+		if (strtoupper($type) == 'INTEGER')
306 306
 		{
307 307
 			$size = '';
308 308
 		}
309 309
 
310 310
 		$query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name);
311
-		if($size)
311
+		if ($size)
312 312
 		{
313 313
 			$query .= sprintf(" %s(%s) ", $type, $size);
314 314
 		}
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 		{
317 317
 			$query .= sprintf(" %s ", $type);
318 318
 		}
319
-		if(isset($default))
319
+		if (isset($default))
320 320
 		{
321 321
 			$query .= sprintf(" default '%s' ", $default);
322 322
 		}
323
-		if($notnull)
323
+		if ($notnull)
324 324
 		{
325 325
 			$query .= " not null ";
326 326
 		}
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 	{
351 351
 		$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name);
352 352
 		$result = $this->_query($query);
353
-		if($this->isError())
353
+		if ($this->isError())
354 354
 		{
355 355
 			return;
356 356
 		}
357 357
 		$output = $this->_fetch($result);
358
-		if($output)
358
+		if ($output)
359 359
 		{
360 360
 			$column_name = strtolower($column_name);
361
-			foreach($output as $key => $val)
361
+			foreach ($output as $key => $val)
362 362
 			{
363 363
 				$name = strtolower($val->Field);
364
-				if($column_name == $name)
364
+				if ($column_name == $name)
365 365
 				{
366 366
 					return true;
367 367
 				}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = false)
384 384
 	{
385
-		if(!is_array($target_columns))
385
+		if (!is_array($target_columns))
386 386
 		{
387 387
 			$target_columns = array($target_columns);
388 388
 		}
@@ -415,23 +415,23 @@  discard block
 block discarded – undo
415 415
 		//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
416 416
 		$query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name);
417 417
 		$result = $this->_query($query);
418
-		if($this->isError())
418
+		if ($this->isError())
419 419
 		{
420 420
 			return;
421 421
 		}
422 422
 		$output = $this->_fetch($result);
423
-		if(!$output)
423
+		if (!$output)
424 424
 		{
425 425
 			return;
426 426
 		}
427
-		if(!is_array($output))
427
+		if (!is_array($output))
428 428
 		{
429 429
 			$output = array($output);
430 430
 		}
431 431
 
432
-		for($i = 0; $i < count($output); $i++)
432
+		for ($i = 0; $i < count($output); $i++)
433 433
 		{
434
-			if($output[$i]->Key_name == $index_name)
434
+			if ($output[$i]->Key_name == $index_name)
435 435
 			{
436 436
 				return true;
437 437
 			}
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	function createTableByXmlFile($file_name)
458 458
 	{
459
-		if(!file_exists($file_name))
459
+		if (!file_exists($file_name))
460 460
 		{
461 461
 			return;
462 462
 		}
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
 		$xml_obj = $oXml->parse($xml_doc);
482 482
 		// Create a table schema
483 483
 		$table_name = $xml_obj->table->attrs->name;
484
-		if($this->isTableExists($table_name))
484
+		if ($this->isTableExists($table_name))
485 485
 		{
486 486
 			return;
487 487
 		}
488 488
 		$table_name = $this->prefix . $table_name;
489 489
 
490
-		if(!is_array($xml_obj->table->column))
490
+		if (!is_array($xml_obj->table->column))
491 491
 		{
492 492
 			$columns[] = $xml_obj->table->column;
493 493
 		}
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		$unique_list = array();
501 501
 		$index_list = array();
502 502
 
503
-		foreach($columns as $column)
503
+		foreach ($columns as $column)
504 504
 		{
505 505
 			$name = $column->attrs->name;
506 506
 			$type = $column->attrs->type;
@@ -514,36 +514,36 @@  discard block
 block discarded – undo
514 514
 
515 515
 			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
516 516
 
517
-			if($primary_key)
517
+			if ($primary_key)
518 518
 			{
519 519
 				$primary_list[] = $name;
520 520
 			}
521
-			else if($unique)
521
+			else if ($unique)
522 522
 			{
523 523
 				$unique_list[$unique][] = $name;
524 524
 			}
525
-			else if($index)
525
+			else if ($index)
526 526
 			{
527 527
 				$index_list[$index][] = $name;
528 528
 			}
529 529
 		}
530 530
 
531
-		if(count($primary_list))
531
+		if (count($primary_list))
532 532
 		{
533 533
 			$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
534 534
 		}
535 535
 
536
-		if(count($unique_list))
536
+		if (count($unique_list))
537 537
 		{
538
-			foreach($unique_list as $key => $val)
538
+			foreach ($unique_list as $key => $val)
539 539
 			{
540 540
 				$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
541 541
 			}
542 542
 		}
543 543
 
544
-		if(count($index_list))
544
+		if (count($index_list))
545 545
 		{
546
-			foreach($index_list as $key => $val)
546
+			foreach ($index_list as $key => $val)
547 547
 			{
548 548
 				$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
549 549
 			}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM  CHARACTER SET utf8 COLLATE utf8_general_ci");
553 553
 
554 554
 		$output = $this->_query($schema);
555
-		if(!$output)
555
+		if (!$output)
556 556
 			return false;
557 557
 	}
558 558
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	{
567 567
 		$query = $this->getInsertSql($queryObject, $with_values, true);
568 568
 		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
569
-		if(is_a($query, 'XEObject'))
569
+		if (is_a($query, 'XEObject'))
570 570
 		{
571 571
 			return;
572 572
 		}
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
 	function _executeUpdateAct($queryObject, $with_values = true)
583 583
 	{
584 584
 		$query = $this->getUpdateSql($queryObject, $with_values, true);
585
-		if(is_a($query, 'XEObject'))
585
+		if (is_a($query, 'XEObject'))
586 586
 		{
587
-			if(!$query->toBool()) return $query;
587
+			if (!$query->toBool()) return $query;
588 588
 			else return;
589 589
 		}
590 590
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	{
605 605
 		$query = $this->getDeleteSql($queryObject, $with_values, true);
606 606
 		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
607
-		if(is_a($query, 'XEObject'))
607
+		if (is_a($query, 'XEObject'))
608 608
 		{
609 609
 			return;
610 610
 		}
@@ -624,30 +624,30 @@  discard block
 block discarded – undo
624 624
 	{
625 625
 		$limit = $queryObject->getLimit();
626 626
 		$result = NULL;
627
-		if($limit && $limit->isPageHandler())
627
+		if ($limit && $limit->isPageHandler())
628 628
 		{
629 629
 			return $this->queryPageLimit($queryObject, $result, $connection, $with_values);
630 630
 		}
631 631
 		else
632 632
 		{
633 633
 			$query = $this->getSelectSql($queryObject, $with_values);
634
-			if(is_a($query, 'XEObject'))
634
+			if (is_a($query, 'XEObject'))
635 635
 			{
636 636
 				return;
637 637
 			}
638 638
 			$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
639 639
 
640 640
 			$result = $this->_query($query, $connection);
641
-			if($this->isError())
641
+			if ($this->isError())
642 642
 			{
643 643
 				return $this->queryError($queryObject);
644 644
 			}
645 645
 
646 646
 			$data = $this->_fetch($result);
647
-			$buff = new Object ();
647
+			$buff = new Object();
648 648
 			$buff->data = $data;
649 649
 
650
-			if($queryObject->usesClickCount())
650
+			if ($queryObject->usesClickCount())
651 651
 			{
652 652
 				$update_query = $this->getClickCountQuery($queryObject);
653 653
 				$this->_executeUpdateAct($update_query, $with_values);
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 	function queryError($queryObject)
709 709
 	{
710 710
 		$limit = $queryObject->getLimit();
711
-		if($limit && $limit->isPageHandler())
711
+		if ($limit && $limit->isPageHandler())
712 712
 		{
713
-			$buff = new Object ();
713
+			$buff = new Object();
714 714
 			$buff->total_count = 0;
715 715
 			$buff->total_page = 0;
716 716
 			$buff->page = 1;
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		$temp_select = $queryObject->getSelectString($with_values);
744 744
 		$uses_distinct = stripos($temp_select, "distinct") !== false;
745 745
 		$uses_groupby = $queryObject->getGroupByString() != '';
746
-		if($uses_distinct || $uses_groupby)
746
+		if ($uses_distinct || $uses_groupby)
747 747
 		{
748 748
 			$count_query = sprintf('select %s %s %s %s'
749 749
 					, $temp_select == '*' ? '1' : $temp_select
@@ -762,23 +762,23 @@  discard block
 block discarded – undo
762 762
 		$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
763 763
 
764 764
 		$list_count = $limit->list_count->getValue();
765
-		if(!$list_count)
765
+		if (!$list_count)
766 766
 		{
767 767
 			$list_count = 20;
768 768
 		}
769 769
 		$page_count = $limit->page_count->getValue();
770
-		if(!$page_count)
770
+		if (!$page_count)
771 771
 		{
772 772
 			$page_count = 10;
773 773
 		}
774 774
 		$page = $limit->page->getValue();
775
-		if(!$page || $page < 1)
775
+		if (!$page || $page < 1)
776 776
 		{
777 777
 			$page = 1;
778 778
 		}
779 779
 
780 780
 		// total pages
781
-		if($total_count)
781
+		if ($total_count)
782 782
 		{
783 783
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
784 784
 		}
@@ -788,10 +788,10 @@  discard block
 block discarded – undo
788 788
 		}
789 789
 
790 790
 		// check the page variables
791
-		if($page > $total_page)
791
+		if ($page > $total_page)
792 792
 		{
793 793
 			// If requested page is bigger than total number of pages, return empty list
794
-			$buff = new Object ();
794
+			$buff = new Object();
795 795
 			$buff->total_count = $total_count;
796 796
 			$buff->total_page = $total_page;
797 797
 			$buff->page = $page;
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
 		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
807 807
 		$result = $this->_query($query, $connection);
808
-		if($this->isError())
808
+		if ($this->isError())
809 809
 		{
810 810
 			return $this->queryError($queryObject);
811 811
 		}
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		$virtual_no = $total_count - ($page - 1) * $list_count;
814 814
 		$data = $this->_fetch($result, $virtual_no);
815 815
 
816
-		$buff = new Object ();
816
+		$buff = new Object();
817 817
 		$buff->total_count = $total_count;
818 818
 		$buff->total_page = $total_page;
819 819
 		$buff->page = $page;
@@ -833,39 +833,39 @@  discard block
 block discarded – undo
833 833
 	function getSelectPageSql($query, $with_values = true, $start_count = 0, $list_count = 0)
834 834
 	{
835 835
 		$select = $query->getSelectString($with_values);
836
-		if($select == '')
836
+		if ($select == '')
837 837
 		{
838 838
 			return new Object(-1, "Invalid query");
839 839
 		}
840 840
 		$select = 'SELECT ' . $select;
841 841
 
842 842
 		$from = $query->getFromString($with_values);
843
-		if($from == '')
843
+		if ($from == '')
844 844
 		{
845 845
 			return new Object(-1, "Invalid query");
846 846
 		}
847 847
 		$from = ' FROM ' . $from;
848 848
 
849 849
 		$where = $query->getWhereString($with_values);
850
-		if($where != '')
850
+		if ($where != '')
851 851
 		{
852 852
 			$where = ' WHERE ' . $where;
853 853
 		}
854 854
 
855 855
 		$groupBy = $query->getGroupByString();
856
-		if($groupBy != '')
856
+		if ($groupBy != '')
857 857
 		{
858 858
 			$groupBy = ' GROUP BY ' . $groupBy;
859 859
 		}
860 860
 
861 861
 		$orderBy = $query->getOrderByString();
862
-		if($orderBy != '')
862
+		if ($orderBy != '')
863 863
 		{
864 864
 			$orderBy = ' ORDER BY ' . $orderBy;
865 865
 		}
866 866
 
867 867
 		$limit = $query->getLimitString();
868
-		if($limit != '')
868
+		if ($limit != '')
869 869
 		{
870 870
 			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count);
871 871
 		}
Please login to merge, or discard this patch.
classes/db/DBMysql_innodb.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
 	 * opt : notnull, default, size\n
132 132
 	 * index : primary key, index, unique\n
133 133
 	 * @param string $xml_doc xml schema contents
134
-	 * @return void|object
134
+	 * @return null|false
135 135
 	 */
136 136
 	function _createTable($xml_doc)
137 137
 	{
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$connection = $this->_getConnection('master');
57 57
 
58
-		if(!$transactionLevel)
58
+		if (!$transactionLevel)
59 59
 		{
60 60
 			$this->_query("START TRANSACTION", $connection);
61 61
 		}
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 		$point = $transactionLevel - 1;
79 79
 
80
-		if($point)
80
+		if ($point)
81 81
 		{
82 82
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
83 83
 		}
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	function __query($query, $connection)
111 111
 	{
112
-		if(!$connection)
112
+		if (!$connection)
113 113
 		{
114 114
 			exit('XE cannot handle DB connection.');
115 115
 		}
116 116
 		// Run the query statement
117 117
 		$result = @mysql_query($query, $connection);
118 118
 		// Error Check
119
-		if(mysql_error($connection))
119
+		if (mysql_error($connection))
120 120
 		{
121 121
 			$this->setError(mysql_errno($connection), mysql_error($connection));
122 122
 		}
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 		$xml_obj = $oXml->parse($xml_doc);
141 141
 		// Create a table schema
142 142
 		$table_name = $xml_obj->table->attrs->name;
143
-		if($this->isTableExists($table_name))
143
+		if ($this->isTableExists($table_name))
144 144
 		{
145 145
 			return;
146 146
 		}
147 147
 		$table_name = $this->prefix . $table_name;
148 148
 
149
-		if(!is_array($xml_obj->table->column))
149
+		if (!is_array($xml_obj->table->column))
150 150
 		{
151 151
 			$columns[] = $xml_obj->table->column;
152 152
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 			$columns = $xml_obj->table->column;
156 156
 		}
157 157
 
158
-		foreach($columns as $column)
158
+		foreach ($columns as $column)
159 159
 		{
160 160
 			$name = $column->attrs->name;
161 161
 			$type = $column->attrs->type;
@@ -169,36 +169,36 @@  discard block
 block discarded – undo
169 169
 
170 170
 			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
171 171
 
172
-			if($primary_key)
172
+			if ($primary_key)
173 173
 			{
174 174
 				$primary_list[] = $name;
175 175
 			}
176
-			else if($unique)
176
+			else if ($unique)
177 177
 			{
178 178
 				$unique_list[$unique][] = $name;
179 179
 			}
180
-			else if($index)
180
+			else if ($index)
181 181
 			{
182 182
 				$index_list[$index][] = $name;
183 183
 			}
184 184
 		}
185 185
 
186
-		if(count($primary_list))
186
+		if (count($primary_list))
187 187
 		{
188 188
 			$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
189 189
 		}
190 190
 
191
-		if(count($unique_list))
191
+		if (count($unique_list))
192 192
 		{
193
-			foreach($unique_list as $key => $val)
193
+			foreach ($unique_list as $key => $val)
194 194
 			{
195 195
 				$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
196 196
 			}
197 197
 		}
198 198
 
199
-		if(count($index_list))
199
+		if (count($index_list))
200 200
 		{
201
-			foreach($index_list as $key => $val)
201
+			foreach ($index_list as $key => $val)
202 202
 			{
203 203
 				$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
204 204
 			}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci");
208 208
 
209 209
 		$output = $this->_query($schema);
210
-		if(!$output)
210
+		if (!$output)
211 211
 		{
212 212
 			return false;
213 213
 		}
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
 		if(!$transactionLevel)
59 59
 		{
60 60
 			$this->_query("START TRANSACTION", $connection);
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
65 64
 		}
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
 		if($point)
81 80
 		{
82 81
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
83
-		}
84
-		else
82
+		} else
85 83
 		{
86 84
 			$this->_query("ROLLBACK", $connection);
87 85
 		}
@@ -149,8 +147,7 @@  discard block
 block discarded – undo
149 147
 		if(!is_array($xml_obj->table->column))
150 148
 		{
151 149
 			$columns[] = $xml_obj->table->column;
152
-		}
153
-		else
150
+		} else
154 151
 		{
155 152
 			$columns = $xml_obj->table->column;
156 153
 		}
@@ -172,12 +169,10 @@  discard block
 block discarded – undo
172 169
 			if($primary_key)
173 170
 			{
174 171
 				$primary_list[] = $name;
175
-			}
176
-			else if($unique)
172
+			} else if($unique)
177 173
 			{
178 174
 				$unique_list[$unique][] = $name;
179
-			}
180
-			else if($index)
175
+			} else if($index)
181 176
 			{
182 177
 				$index_list[$index][] = $name;
183 178
 			}
Please login to merge, or discard this patch.