GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( d17fbe...edd528 )
by gyeong-won
05:47
created
addons/captcha/captcha.addon.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -275,6 +275,9 @@
 block discarded – undo
275 275
 			exit();
276 276
 		}
277 277
 
278
+		/**
279
+		 * @param string $string
280
+		 */
278 281
 		function createCaptchaAudio($string)
279 282
 		{
280 283
 			$data = '';
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
@@ -74,8 +76,7 @@  discard block
 block discarded – undo
74 76
 						$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url');
75 77
 						$ModuleHandler->_setInputValueToSession();
76 78
 					}
77
-				}
78
-				else
79
+				} else
79 80
 				{
80 81
 					Context::addHtmlHeader('<script>
81 82
 						if(!captchaTargetAct) {var captchaTargetAct = [];}
@@ -205,8 +206,7 @@  discard block
 block discarded – undo
205 206
 
206 207
 					$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
207 208
 					imagecolortransparent($im[$i + 1], $background_color);
208
-				}
209
-				else
209
+				} else
210 210
 				{
211 211
 					imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color);
212 212
 				}
@@ -304,7 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 		function compareCaptcha()
306 306
 		{
307
-			if(!in_array(Context::get('act'), $this->target_acts)) return true;
307
+			if(!in_array(Context::get('act'), $this->target_acts)) {
308
+				return true;
309
+			}
308 310
 
309 311
 			if($_SESSION['captcha_authed'])
310 312
 			{
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 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,7 +9,7 @@  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('AddonCaptcha', false))
12
+if (!class_exists('AddonCaptcha', false))
13 13
 {
14 14
 	class AddonCaptcha
15 15
 	{
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		function before_module_proc()
26 26
 		{
27
-			if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed'])
27
+			if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed'])
28 28
 			{
29 29
 				unset($_SESSION['captcha_authed']);
30 30
 			}
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 		function before_module_init(&$ModuleHandler)
34 34
 		{
35 35
 			$logged_info = Context::get('logged_info');
36
-			if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
36
+			if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
37 37
 			{
38 38
 				return false;
39 39
 			}
40
-			if($this->addon_info->target != 'all' && Context::get('is_logged'))
40
+			if ($this->addon_info->target != 'all' && Context::get('is_logged'))
41 41
 			{
42 42
 				return false;
43 43
 			}
44
-			if($_SESSION['XE_VALIDATOR_ERROR'] == -1)
44
+			if ($_SESSION['XE_VALIDATOR_ERROR'] == -1)
45 45
 			{
46 46
 				$_SESSION['captcha_authed'] = false;
47 47
 			}
48
-			if($_SESSION['captcha_authed'])
48
+			if ($_SESSION['captcha_authed'])
49 49
 			{
50 50
 				return false;
51 51
 			}
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 
55 55
 			$this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment');
56 56
 
57
-			if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
57
+			if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
58 58
 			{
59
-				if($type == 'inline')
59
+				if ($type == 'inline')
60 60
 				{
61
-					if(!$this->compareCaptcha())
61
+					if (!$this->compareCaptcha())
62 62
 					{
63
-						Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
63
+						Context::loadLang(_XE_PATH_.'addons/captcha/lang');
64 64
 						$_SESSION['XE_VALIDATOR_ERROR'] = -1;
65 65
 						$_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied');
66 66
 						$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
 				{
73 73
 					Context::addHtmlHeader('<script>
74 74
 						if(!captchaTargetAct) {var captchaTargetAct = [];}
75
-						captchaTargetAct.push("' . implode('","', $this->target_acts) . '");
75
+						captchaTargetAct.push("' . implode('","', $this->target_acts).'");
76 76
 						</script>');
77 77
 					Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true);
78 78
 				}
79 79
 			}
80 80
 
81 81
 			// compare session when calling actions such as writing a post or a comment on the board/issue tracker module
82
-			if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts))
82
+			if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts))
83 83
 			{
84
-				Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
84
+				Context::loadLang(_XE_PATH_.'addons/captcha/lang');
85 85
 				$ModuleHandler->error = "captcha_denied";
86 86
 			}
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		function createKeyword()
92 92
 		{
93 93
 			$type = Context::get('captchaType');
94
-			if($type == 'inline' && $_SESSION['captcha_keyword'])
94
+			if ($type == 'inline' && $_SESSION['captcha_keyword'])
95 95
 			{
96 96
 				return;
97 97
 			}
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 
105 105
 		function before_module_init_setCaptchaSession()
106 106
 		{
107
-			if($_SESSION['captcha_authed'])
107
+			if ($_SESSION['captcha_authed'])
108 108
 			{
109 109
 				return false;
110 110
 			}
111 111
 			// Load language files
112
-			Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
112
+			Context::loadLang(_XE_PATH_.'addons/captcha/lang');
113 113
 			// Generate keywords
114 114
 			$this->createKeyword();
115 115
 
116 116
 			$target = Context::getLang('target_captcha');
117 117
 			header("Content-Type: text/xml; charset=UTF-8");
118 118
 			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
119
-			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
119
+			header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
120 120
 			header("Cache-Control: no-store, no-cache, must-revalidate");
121 121
 			header("Cache-Control: post-check=0, pre-check=0", false);
122 122
 			header("Pragma: no-cache");
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		function before_module_init_captchaImage()
135 135
 		{
136
-			if($_SESSION['captcha_authed'])
136
+			if ($_SESSION['captcha_authed'])
137 137
 			{
138 138
 				return false;
139 139
 			}
140
-			if(Context::get('renew'))
140
+			if (Context::get('renew'))
141 141
 			{
142 142
 				$this->createKeyword();
143 143
 			}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		function createCaptchaImage($string)
160 160
 		{
161 161
 			$arr = array();
162
-			for($i = 0, $c = strlen($string); $i < $c; $i++)
162
+			for ($i = 0, $c = strlen($string); $i < $c; $i++)
163 163
 			{
164 164
 				$arr[] = $string{$i};
165 165
 			}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			shuffle($deg);
182 182
 
183 183
 			// Create an image for each letter
184
-			foreach($arr as $i => $str)
184
+			foreach ($arr as $i => $str)
185 185
 			{
186 186
 				$im[$i + 1] = @imagecreate($w, $h);
187 187
 				$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				$ran = range(1, 20);
192 192
 				shuffle($ran);
193 193
 
194
-				if(function_exists('imagerotate'))
194
+				if (function_exists('imagerotate'))
195 195
 				{
196 196
 					imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color);
197 197
 					$im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			}
207 207
 
208 208
 			// Combine images of each character
209
-			for($i = 1, $c = count($im); $i<$c; $i++)
209
+			for ($i = 1, $c = count($im); $i < $c; $i++)
210 210
 			{
211 211
 				imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h);
212 212
 				imagedestroy($im[$i]);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 			imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h);
219 219
 			imagedestroy($im[0]);
220 220
 
221
-			if(function_exists('imageantialias'))
221
+			if (function_exists('imageantialias'))
222 222
 			{
223 223
 				imageantialias($big, true);
224 224
 			}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			$h = $h * $big_count;
231 231
 			$d = array_pop($deg);
232 232
 
233
-			for($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
233
+			for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
234 234
 			{
235 235
 				imageline($big, 0, $i + $d, $w, $i, $line_color);
236 236
 			}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			$x = range(0, ($w - 10));
239 239
 			shuffle($x);
240 240
 
241
-			for($i = 0; $i < 200; $i++)
241
+			for ($i = 0; $i < 200; $i++)
242 242
 			{
243 243
 				imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color);
244 244
 			}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		function before_module_init_captchaAudio()
250 250
 		{
251
-			if($_SESSION['captcha_authed'])
251
+			if ($_SESSION['captcha_authed'])
252 252
 			{
253 253
 				return false;
254 254
 			}
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 			header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\"");
261 261
 			header('Cache-Control: no-store, no-cache, must-revalidate');
262 262
 			header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
263
-			header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
264
-			header('Content-Length: ' . strlen($data));
263
+			header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT');
264
+			header('Content-Length: '.strlen($data));
265 265
 
266 266
 			echo $data;
267 267
 			Context::close();
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 		{
273 273
 			$data = '';
274 274
 			$_audio = './addons/captcha/audio/F_%s.mp3';
275
-			for($i = 0, $c = strlen($string); $i < $c; $i++)
275
+			for ($i = 0, $c = strlen($string); $i < $c; $i++)
276 276
 			{
277 277
 				$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
278 278
 
279 279
 				$start = rand(5, 68); // Random start in 4-byte header and 64 byte data
280 280
 				$datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes
281 281
 
282
-				for($j = $start; $j < $datalen; $j+=64)
282
+				for ($j = $start; $j < $datalen; $j += 64)
283 283
 				{
284 284
 					$ch = ord($_data{$j});
285
-					if($ch < 9 || $ch > 119)
285
+					if ($ch < 9 || $ch > 119)
286 286
 					{
287 287
 						continue;
288 288
 					}
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
 
298 298
 		function compareCaptcha()
299 299
 		{
300
-			if(!in_array(Context::get('act'), $this->target_acts)) return true;
300
+			if (!in_array(Context::get('act'), $this->target_acts)) return true;
301 301
 
302
-			if($_SESSION['captcha_authed'])
302
+			if ($_SESSION['captcha_authed'])
303 303
 			{
304 304
 				return true;
305 305
 			}
306 306
 
307
-			if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
307
+			if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
308 308
 			{
309 309
 				$_SESSION['captcha_authed'] = true;
310 310
 				return true;
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
 
318 318
 		function before_module_init_captchaCompare()
319 319
 		{
320
-			if(!$this->compareCaptcha())
320
+			if (!$this->compareCaptcha())
321 321
 			{
322 322
 				return false;
323 323
 			}
324 324
 
325 325
 			header("Content-Type: text/xml; charset=UTF-8");
326 326
 			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
327
-			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
327
+			header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
328 328
 			header("Cache-Control: no-store, no-cache, must-revalidate");
329 329
 			header("Cache-Control: post-check=0, pre-check=0", false);
330 330
 			header("Pragma: no-cache");
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			unset($_SESSION['captcha_authed']);
340 340
 			$this->createKeyword();
341 341
 
342
-			$swfURL = getUrl() . 'addons/captcha/swf/play.swf';
342
+			$swfURL = getUrl().'addons/captcha/swf/play.swf';
343 343
 			Context::unloadFile('./addons/captcha/captcha.min.js');
344 344
 			Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body'));
345 345
 
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
 
378 378
 $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__'];
379 379
 
380
-if(method_exists($oAddonCaptcha, $called_position))
380
+if (method_exists($oAddonCaptcha, $called_position))
381 381
 {
382
-	if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this)))
382
+	if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this)))
383 383
 	{
384 384
 		return false;
385 385
 	}
386 386
 }
387 387
 
388 388
 $addon_act = Context::get('captcha_action');
389
-if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act))
389
+if ($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act))
390 390
 {
391
-	if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this)))
391
+	if (!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this)))
392 392
 	{
393 393
 		return false;
394 394
 	}
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   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	function __construct($auto_connect = TRUE)
24 24
 	{
25 25
 		$this->_setDBInfo();
26
-		if($auto_connect) $this->_connect();
26
+		if ($auto_connect) $this->_connect();
27 27
 	}
28 28
 
29 29
 	/**
@@ -55,13 +55,13 @@  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
 		}
62 62
 		else
63 63
 		{
64
-			$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
64
+			$this->_query("SAVEPOINT SP".$transactionLevel, $connection);
65 65
 		}
66 66
 		return true;
67 67
 	}
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 
78 78
 		$point = $transactionLevel - 1;
79 79
 
80
-		if($point)
80
+		if ($point)
81 81
 		{
82
-			$this->_query("ROLLBACK TO SP" . $point, $connection);
82
+			$this->_query("ROLLBACK TO SP".$point, $connection);
83 83
 		}
84 84
 		else
85 85
 		{
@@ -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
-		$table_name = $this->prefix . $table_name;
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;
@@ -167,47 +167,47 @@  discard block
 block discarded – undo
167 167
 			$default = $column->attrs->default;
168 168
 			$auto_increment = $column->attrs->auto_increment;
169 169
 
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' : '');
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
-			$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
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
-				$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
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
-				$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
203
+				$column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`');
204 204
 			}
205 205
 		}
206 206
 
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   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	function __construct($auto_connect = TRUE)
24 24
 	{
25 25
 		$this->_setDBInfo();
26
-		if($auto_connect) $this->_connect();
26
+		if($auto_connect) {
27
+			$this->_connect();
28
+		}
27 29
 	}
28 30
 
29 31
 	/**
@@ -58,8 +60,7 @@  discard block
 block discarded – undo
58 60
 		if(!$transactionLevel)
59 61
 		{
60 62
 			$this->_query("START TRANSACTION", $connection);
61
-		}
62
-		else
63
+		} else
63 64
 		{
64 65
 			$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
65 66
 		}
@@ -80,8 +81,7 @@  discard block
 block discarded – undo
80 81
 		if($point)
81 82
 		{
82 83
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
83
-		}
84
-		else
84
+		} else
85 85
 		{
86 86
 			$this->_query("ROLLBACK", $connection);
87 87
 		}
@@ -149,8 +149,7 @@  discard block
 block discarded – undo
149 149
 		if(!is_array($xml_obj->table->column))
150 150
 		{
151 151
 			$columns[] = $xml_obj->table->column;
152
-		}
153
-		else
152
+		} else
154 153
 		{
155 154
 			$columns = $xml_obj->table->column;
156 155
 		}
@@ -172,12 +171,10 @@  discard block
 block discarded – undo
172 171
 			if($primary_key)
173 172
 			{
174 173
 				$primary_list[] = $name;
175
-			}
176
-			else if($unique)
174
+			} else if($unique)
177 175
 			{
178 176
 				$unique_list[$unique][] = $name;
179
-			}
180
-			else if($index)
177
+			} else if($index)
181 178
 			{
182 179
 				$index_list[$index][] = $name;
183 180
 			}
Please login to merge, or discard this patch.
classes/db/queryparts/Query.class.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -251,6 +251,9 @@
 block discarded – undo
251 251
 		return $this->orderby;
252 252
 	}
253 253
 
254
+	/**
255
+	 * @param integer $limit
256
+	 */
254 257
 	function setLimit($limit = NULL)
255 258
 	{
256 259
 		if(!isset($limit))
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -378,8 +378,7 @@  discard block
 block discarded – undo
378 378
 				if($column->isSubquery())
379 379
 				{
380 380
 					$select[] = $column->toString($with_values) . ' as ' . $column->getAlias();
381
-				}
382
-				else
381
+				} else
383 382
 				{
384 383
 					$select[] = $column->getExpression($with_values);
385 384
 				}
@@ -403,7 +402,9 @@  discard block
 block discarded – undo
403 402
 			}
404 403
 		}
405 404
 
406
-		if(!$update) return;
405
+		if(!$update) {
406
+			return;
407
+		}
407 408
 		return trim(implode($update, ', '));
408 409
 	}
409 410
 
@@ -465,8 +466,7 @@  discard block
 block discarded – undo
465 466
 			if($table->isJoinTable() || !$simple_table_count)
466 467
 			{
467 468
 				$from .= $table->toString($with_values) . ' ';
468
-			}
469
-			else
469
+			} else
470 470
 			{
471 471
 				$from .= ', ' . $table->toString($with_values) . ' ';
472 472
 			}
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$this->action = $action;
109 109
 		$this->priority = $priority;
110 110
 
111
-		if(!isset($tables))
111
+		if (!isset($tables))
112 112
 		{
113 113
 			return;
114 114
 		}
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 	function setColumnList($columnList)
145 145
 	{
146 146
 		$this->columnList = $columnList;
147
-		if(count($this->columnList) > 0)
147
+		if (count($this->columnList) > 0)
148 148
 		{
149 149
 			$selectColumns = array();
150 150
 			$dbParser = DB::getParser();
151 151
 
152
-			foreach($this->columnList as $columnName)
152
+			foreach ($this->columnList as $columnName)
153 153
 			{
154 154
 				$columnName = $dbParser->escapeColumn($columnName);
155 155
 				$selectColumns[] = new SelectExpression($columnName);
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
 
162 162
 	function setColumns($columns)
163 163
 	{
164
-		if(!isset($columns) || count($columns) === 0)
164
+		if (!isset($columns) || count($columns) === 0)
165 165
 		{
166 166
 			$this->columns = array(new StarExpression());
167 167
 			return;
168 168
 		}
169 169
 
170
-		if(!is_array($columns))
170
+		if (!is_array($columns))
171 171
 		{
172 172
 			$columns = array($columns);
173 173
 		}
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 
178 178
 	function setTables($tables)
179 179
 	{
180
-		if(!isset($tables) || count($tables) === 0)
180
+		if (!isset($tables) || count($tables) === 0)
181 181
 		{
182 182
 			$this->setError(TRUE);
183 183
 			$this->setMessage("You must provide at least one table for the query.");
184 184
 			return;
185 185
 		}
186 186
 
187
-		if(!is_array($tables))
187
+		if (!is_array($tables))
188 188
 		{
189 189
 			$tables = array($tables);
190 190
 		}
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 	function setConditions($conditions)
201 201
 	{
202 202
 		$this->conditions = array();
203
-		if(!isset($conditions) || count($conditions) === 0)
203
+		if (!isset($conditions) || count($conditions) === 0)
204 204
 		{
205 205
 			return;
206 206
 		}
207
-		if(!is_array($conditions))
207
+		if (!is_array($conditions))
208 208
 		{
209 209
 			$conditions = array($conditions);
210 210
 		}
211 211
 
212
-		foreach($conditions as $conditionGroup)
212
+		foreach ($conditions as $conditionGroup)
213 213
 		{
214
-			if($conditionGroup->show())
214
+			if ($conditionGroup->show())
215 215
 			{
216 216
 				$this->conditions[] = $conditionGroup;
217 217
 			}
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 
221 221
 	function setGroups($groups)
222 222
 	{
223
-		if(!isset($groups) || count($groups) === 0)
223
+		if (!isset($groups) || count($groups) === 0)
224 224
 		{
225 225
 			return;
226 226
 		}
227
-		if(!is_array($groups))
227
+		if (!is_array($groups))
228 228
 		{
229 229
 			$groups = array($groups);
230 230
 		}
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 
235 235
 	function setOrder($order)
236 236
 	{
237
-		if(!isset($order) || count($order) === 0)
237
+		if (!isset($order) || count($order) === 0)
238 238
 		{
239 239
 			return;
240 240
 		}
241
-		if(!is_array($order))
241
+		if (!is_array($order))
242 242
 		{
243 243
 			$order = array($order);
244 244
 		}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 	function setLimit($limit = NULL)
255 255
 	{
256
-		if(!isset($limit))
256
+		if (!isset($limit))
257 257
 		{
258 258
 			return;
259 259
 		}
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 	function getClickCountColumns()
355 355
 	{
356 356
 		$click_count_columns = array();
357
-		foreach($this->columns as $column)
357
+		foreach ($this->columns as $column)
358 358
 		{
359
-			if($column->show() && is_a($column, 'ClickCountExpression'))
359
+			if ($column->show() && is_a($column, 'ClickCountExpression'))
360 360
 			{
361 361
 				$click_count_columns[] = $column;
362 362
 			}
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	function getSelectString($with_values = TRUE)
373 373
 	{
374
-		foreach($this->columns as $column)
374
+		foreach ($this->columns as $column)
375 375
 		{
376
-			if($column->show())
376
+			if ($column->show())
377 377
 			{
378
-				if($column->isSubquery())
378
+				if ($column->isSubquery())
379 379
 				{
380
-					$select[] = $column->toString($with_values) . ' as ' . $column->getAlias();
380
+					$select[] = $column->toString($with_values).' as '.$column->getAlias();
381 381
 				}
382 382
 				else
383 383
 				{
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	function getUpdateString($with_values = TRUE)
397 397
 	{
398
-		foreach($this->columns as $column)
398
+		foreach ($this->columns as $column)
399 399
 		{
400
-			if($column->show())
400
+			if ($column->show())
401 401
 			{
402 402
 				$update[] = $column->getExpression($with_values);
403 403
 			}
404 404
 		}
405 405
 
406
-		if(!$update) return;
406
+		if (!$update) return;
407 407
 		return trim(implode($update, ', '));
408 408
 	}
409 409
 
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 	{
417 417
 		$columnsList = '';
418 418
 		// means we have insert-select
419
-		if($this->subquery)
419
+		if ($this->subquery)
420 420
 		{
421
-			foreach($this->columns as $column)
421
+			foreach ($this->columns as $column)
422 422
 			{
423
-				$columnsList .= $column->getColumnName() . ', ';
423
+				$columnsList .= $column->getColumnName().', ';
424 424
 			}
425 425
 			$columnsList = substr($columnsList, 0, -2);
426 426
 			$selectStatement = $this->subquery->toString($with_values);
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 		}
430 430
 
431 431
 		$valuesList = '';
432
-		foreach($this->columns as $column)
432
+		foreach ($this->columns as $column)
433 433
 		{
434
-			if($column->show())
434
+			if ($column->show())
435 435
 			{
436
-				$columnsList .= $column->getColumnName() . ', ';
437
-				$valuesList .= $column->getValue($with_values) . ', ';
436
+				$columnsList .= $column->getColumnName().', ';
437
+				$valuesList .= $column->getValue($with_values).', ';
438 438
 			}
439 439
 		}
440 440
 		$columnsList = substr($columnsList, 0, -2);
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
 	{
461 461
 		$from = '';
462 462
 		$simple_table_count = 0;
463
-		foreach($this->tables as $table)
463
+		foreach ($this->tables as $table)
464 464
 		{
465
-			if($table->isJoinTable() || !$simple_table_count)
465
+			if ($table->isJoinTable() || !$simple_table_count)
466 466
 			{
467
-				$from .= $table->toString($with_values) . ' ';
467
+				$from .= $table->toString($with_values).' ';
468 468
 			}
469 469
 			else
470 470
 			{
471
-				$from .= ', ' . $table->toString($with_values) . ' ';
471
+				$from .= ', '.$table->toString($with_values).' ';
472 472
 			}
473 473
 
474
-			if(is_a($table, 'Subquery'))
474
+			if (is_a($table, 'Subquery'))
475 475
 			{
476
-				$from .= $table->getAlias() ? ' as ' . $table->getAlias() . ' ' : ' ';
476
+				$from .= $table->getAlias() ? ' as '.$table->getAlias().' ' : ' ';
477 477
 			}
478 478
 
479 479
 			$simple_table_count++;
480 480
 		}
481
-		if(trim($from) == '')
481
+		if (trim($from) == '')
482 482
 		{
483 483
 			return '';
484 484
 		}
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 		$where = '';
497 497
 		$condition_count = 0;
498 498
 
499
-		foreach($this->conditions as $conditionGroup)
499
+		foreach ($this->conditions as $conditionGroup)
500 500
 		{
501
-			if($condition_count === 0)
501
+			if ($condition_count === 0)
502 502
 			{
503 503
 				$conditionGroup->setPipe("");
504 504
 			}
@@ -507,26 +507,26 @@  discard block
 block discarded – undo
507 507
 			$condition_count++;
508 508
 		}
509 509
 
510
-		if($with_optimization &&
510
+		if ($with_optimization &&
511 511
 				(strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order')))
512 512
 		{
513 513
 
514
-			if($condition_count !== 0)
514
+			if ($condition_count !== 0)
515 515
 			{
516
-				$where = '(' . $where . ') ';
516
+				$where = '('.$where.') ';
517 517
 			}
518 518
 
519
-			foreach($this->orderby as $order)
519
+			foreach ($this->orderby as $order)
520 520
 			{
521 521
 				$colName = $order->getColumnName();
522
-				if(strstr($colName, 'list_order') || strstr($colName, 'update_order'))
522
+				if (strstr($colName, 'list_order') || strstr($colName, 'update_order'))
523 523
 				{
524 524
 					$opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and');
525
-					if($condition_count === 0)
525
+					if ($condition_count === 0)
526 526
 					{
527 527
 						$opt_condition->setPipe("");
528 528
 					}
529
-					$where .= $opt_condition->toString($with_values) . ' ';
529
+					$where .= $opt_condition->toString($with_values).' ';
530 530
 					$condition_count++;
531 531
 				}
532 532
 			}
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 	function getGroupByString()
543 543
 	{
544 544
 		$groupBy = '';
545
-		if($this->groups)
545
+		if ($this->groups)
546 546
 		{
547
-			if($this->groups[0] !== "")
547
+			if ($this->groups[0] !== "")
548 548
 			{
549 549
 				$groupBy = implode(', ', $this->groups);
550 550
 			}
@@ -558,16 +558,16 @@  discard block
 block discarded – undo
558 558
 	 */
559 559
 	function getOrderByString()
560 560
 	{
561
-		if(!$this->_orderByString)
561
+		if (!$this->_orderByString)
562 562
 		{
563
-			if(count($this->orderby) === 0)
563
+			if (count($this->orderby) === 0)
564 564
 			{
565 565
 				return '';
566 566
 			}
567 567
 			$orderBy = '';
568
-			foreach($this->orderby as $order)
568
+			foreach ($this->orderby as $order)
569 569
 			{
570
-				$orderBy .= $order->toString() . ', ';
570
+				$orderBy .= $order->toString().', ';
571 571
 			}
572 572
 			$orderBy = substr($orderBy, 0, -2);
573 573
 			$this->_orderByString = $orderBy;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	function getLimitString()
588 588
 	{
589 589
 		$limit = '';
590
-		if(count($this->limit) > 0)
590
+		if (count($this->limit) > 0)
591 591
 		{
592 592
 			$limit = '';
593 593
 			$limit .= $this->limit->toString();
@@ -606,19 +606,19 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	function getArguments()
608 608
 	{
609
-		if(!isset($this->arguments))
609
+		if (!isset($this->arguments))
610 610
 		{
611 611
 			$this->arguments = array();
612 612
 
613 613
 			// Join table arguments
614
-			if(count($this->tables) > 0)
614
+			if (count($this->tables) > 0)
615 615
 			{
616
-				foreach($this->tables as $table)
616
+				foreach ($this->tables as $table)
617 617
 				{
618
-					if($table->isJoinTable() || is_a($table, 'Subquery'))
618
+					if ($table->isJoinTable() || is_a($table, 'Subquery'))
619 619
 					{
620 620
 						$args = $table->getArguments();
621
-						if($args)
621
+						if ($args)
622 622
 						{
623 623
 							$this->arguments = array_merge($this->arguments, $args);
624 624
 						}
@@ -628,14 +628,14 @@  discard block
 block discarded – undo
628 628
 
629 629
 			// Column arguments
630 630
 			// The if is for delete statements, all others must have columns
631
-			if(count($this->columns) > 0)
631
+			if (count($this->columns) > 0)
632 632
 			{
633
-				foreach($this->columns as $column)
633
+				foreach ($this->columns as $column)
634 634
 				{
635
-					if($column->show())
635
+					if ($column->show())
636 636
 					{
637 637
 						$args = $column->getArguments();
638
-						if($args)
638
+						if ($args)
639 639
 						{
640 640
 							$this->arguments = array_merge($this->arguments, $args);
641 641
 						}
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
 			}
645 645
 
646 646
 			// Condition arguments
647
-			if(count($this->conditions) > 0)
647
+			if (count($this->conditions) > 0)
648 648
 			{
649
-				foreach($this->conditions as $conditionGroup)
649
+				foreach ($this->conditions as $conditionGroup)
650 650
 				{
651 651
 					$args = $conditionGroup->getArguments();
652
-					if(count($args) > 0)
652
+					if (count($args) > 0)
653 653
 					{
654 654
 						$this->arguments = array_merge($this->arguments, $args);
655 655
 					}
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
 			}
658 658
 
659 659
 			// Navigation arguments
660
-			if(count($this->orderby) > 0)
660
+			if (count($this->orderby) > 0)
661 661
 			{
662
-				foreach($this->orderby as $order)
662
+				foreach ($this->orderby as $order)
663 663
 				{
664 664
 					$args = $order->getArguments();
665
-					if(count($args) > 0)
665
+					if (count($args) > 0)
666 666
 					{
667 667
 						$this->arguments = array_merge($this->arguments, $args);
668 668
 					}
Please login to merge, or discard this patch.
classes/display/DisplayHandler.class.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n
134 134
 	 * This method only functions when __DEBUG__ variable is set to 1.
135 135
 	 * __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php
136
-	 * @return void
136
+	 * @return null|string
137 137
 	 */
138 138
 	function _debugOutput()
139 139
 	{
@@ -358,6 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
 	/**
360 360
 	 * print a HTTP HEADER for HTML, which is encoded in UTF-8
361
+	 * @param integer $code
361 362
 	 * @return void
362 363
 	 */
363 364
 	function _printHttpStatusCode($code)
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	function printContent(&$oModule)
26 26
 	{
27 27
 		// Check if the gzip encoding supported
28
-		if(
28
+		if (
29 29
 				(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
30 30
 				strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE &&
31 31
 				extension_loaded('zlib') &&
@@ -36,23 +36,23 @@  discard block
 block discarded – undo
36 36
 		}
37 37
 
38 38
 		// Extract contents to display by the request method
39
-		if(Context::get('xeVirtualRequestMethod') == 'xml')
39
+		if (Context::get('xeVirtualRequestMethod') == 'xml')
40 40
 		{
41 41
 			$handler = new VirtualXMLDisplayHandler();
42 42
 		}
43
-		else if(Context::getRequestMethod() == 'XMLRPC')
43
+		else if (Context::getRequestMethod() == 'XMLRPC')
44 44
 		{
45 45
 			$handler = new XMLDisplayHandler();
46
-			if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
46
+			if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
47 47
 			{
48 48
 				$this->gz_enabled = FALSE;
49 49
 			}
50 50
 		}
51
-		else if(Context::getRequestMethod() == 'JSON')
51
+		else if (Context::getRequestMethod() == 'JSON')
52 52
 		{
53 53
 			$handler = new JSONDisplayHandler();
54 54
 		}
55
-		else if(Context::getRequestMethod() == 'JS_CALLBACK')
55
+		else if (Context::getRequestMethod() == 'JS_CALLBACK')
56 56
 		{
57 57
 			$handler = new JSCallbackDisplayHandler();
58 58
 		}
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 		$called_position = 'before_display_content';
71 71
 		$oAddonController = getController('addon');
72 72
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
73
-		if(file_exists($addon_file)) include($addon_file);
73
+		if (file_exists($addon_file)) include($addon_file);
74 74
 
75
-		if(method_exists($handler, "prepareToPrint"))
75
+		if (method_exists($handler, "prepareToPrint"))
76 76
 		{
77 77
 			$handler->prepareToPrint($output);
78 78
 		}
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
 		// header output
81 81
 
82 82
 		$httpStatusCode = $oModule->getHttpStatusCode();
83
-		if($httpStatusCode && $httpStatusCode != 200)
83
+		if ($httpStatusCode && $httpStatusCode != 200)
84 84
 		{
85 85
 			$this->_printHttpStatusCode($httpStatusCode);
86 86
 		}
87 87
 		else
88 88
 		{
89
-			if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
89
+			if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
90 90
 			{
91 91
 				$this->_printJSONHeader();
92 92
 			}
93
-			else if(Context::getResponseMethod() != 'HTML')
93
+			else if (Context::getResponseMethod() != 'HTML')
94 94
 			{
95 95
 				$this->_printXMLHeader();
96 96
 			}
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 
107 107
 		// disable gzip if output already exists
108 108
 		ob_flush();
109
-		if(headers_sent())
109
+		if (headers_sent())
110 110
 		{
111 111
 			$this->gz_enabled = FALSE;
112 112
 		}
113 113
 
114 114
 		// enable gzip using zlib extension
115
-		if($this->gz_enabled)
115
+		if ($this->gz_enabled)
116 116
 		{
117 117
 			ini_set('zlib.output_compression', true);
118 118
 		}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	function _debugOutput()
135 135
 	{
136
-		if(!__DEBUG__)
136
+		if (!__DEBUG__)
137 137
 		{
138 138
 			return;
139 139
 		}
@@ -141,32 +141,32 @@  discard block
 block discarded – undo
141 141
 		$end = getMicroTime();
142 142
 
143 143
 		// Firebug console output
144
-		if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
144
+		if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
145 145
 		{
146 146
 			static $firephp;
147
-			if(!isset($firephp))
147
+			if (!isset($firephp))
148 148
 			{
149 149
 				$firephp = FirePHP::getInstance(true);
150 150
 			}
151 151
 
152
-			if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
152
+			if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
153 153
 			{
154 154
 				$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
155 155
 				return;
156 156
 			}
157 157
 			// display total execution time and Request/Response info
158
-			if(__DEBUG__ & 2)
158
+			if (__DEBUG__ & 2)
159 159
 			{
160 160
 				$firephp->fb(
161 161
 						array(
162
-							'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(),
162
+							'Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(),
163 163
 							array(
164 164
 								array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'),
165 165
 								array(
166 166
 									sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']),
167 167
 									$_SERVER['REQUEST_METHOD'],
168 168
 									Context::getResponseMethod(),
169
-									$this->content_size . ' byte',
169
+									$this->content_size.' byte',
170 170
 									FileHandler::filesize(memory_get_peak_usage())
171 171
 								)
172 172
 							)
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 				);
176 176
 				$firephp->fb(
177 177
 						array(
178
-							'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__),
178
+							'Elapsed time >>> Total : '.sprintf('%0.5f sec', $end - __StartTime__),
179 179
 							array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'),
180 180
 								array(
181 181
 									sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 			}
194 194
 
195 195
 			// display DB query history
196
-			if((__DEBUG__ & 4) && $GLOBALS['__db_queries__'])
196
+			if ((__DEBUG__ & 4) && $GLOBALS['__db_queries__'])
197 197
 			{
198 198
 				$queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query'));
199
-				foreach($GLOBALS['__db_queries__'] as $query)
199
+				foreach ($GLOBALS['__db_queries__'] as $query)
200 200
 				{
201
-					$queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']);
201
+					$queries_output[] = array($query['result'].PHP_EOL.sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']).PHP_EOL.$query['called_method'].'()'.PHP_EOL.$query['query_id'], $query['query']);
202 202
 				}
203 203
 				$firephp->fb(
204 204
 						array(
205
-							'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
205
+							'DB Queries >>> '.count($GLOBALS['__db_queries__']).' Queries, '.sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
206 206
 							$queries_output
207 207
 						),
208 208
 						'TABLE'
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 
216 216
 			$buff = array();
217 217
 			// display total execution time and Request/Response info
218
-			if(__DEBUG__ & 2)
218
+			if (__DEBUG__ & 2)
219 219
 			{
220
-				if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
220
+				if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
221 221
 				{
222 222
 					return;
223 223
 				}
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
 				$buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']);
249 249
 			}
250 250
 			// DB Logging
251
-			if(__DEBUG__ & 4)
251
+			if (__DEBUG__ & 4)
252 252
 			{
253
-				if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
253
+				if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
254 254
 				{
255 255
 					return;
256 256
 				}
257 257
 
258
-				if($GLOBALS['__db_queries__'])
258
+				if ($GLOBALS['__db_queries__'])
259 259
 				{
260 260
 					$buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']);
261 261
 					$num = 0;
262 262
 
263
-					foreach($GLOBALS['__db_queries__'] as $query)
263
+					foreach ($GLOBALS['__db_queries__'] as $query)
264 264
 					{
265
-						if($query['result'] == 'Success')
265
+						if ($query['result'] == 'Success')
266 266
 						{
267 267
 							$query_result = "Query Success";
268 268
 						}
@@ -279,30 +279,30 @@  discard block
 block discarded – undo
279 279
 			}
280 280
 
281 281
 			// Output in HTML comments
282
-			if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML')
282
+			if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML')
283 283
 			{
284 284
 				$buff = implode("\r\n", $buff);
285 285
 				$buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
286 286
 
287
-				if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
287
+				if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
288 288
 				{
289 289
 					$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
290 290
 				}
291 291
 
292
-				return "<!--\r\n" . $buff . "\r\n-->";
292
+				return "<!--\r\n".$buff."\r\n-->";
293 293
 			}
294 294
 
295 295
 			// Output to a file
296
-			if($buff && __DEBUG_OUTPUT__ == 0)
296
+			if ($buff && __DEBUG_OUTPUT__ == 0)
297 297
 			{
298
-				$debug_file = _XE_PATH_ . 'files/_debug_message.php';
298
+				$debug_file = _XE_PATH_.'files/_debug_message.php';
299 299
 				$buff = implode(PHP_EOL, $buff);
300 300
 				$buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true));
301 301
 
302
-				$buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80);
303
-				$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
302
+				$buff = str_repeat('=', 80)."\n".$buff."\n".str_repeat('-', 80);
303
+				$buff = "\n<?php\n/*".$buff."*/\n?>\n";
304 304
 
305
-				if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX))
305
+				if (!@file_put_contents($debug_file, $buff, FILE_APPEND | LOCK_EX))
306 306
 				{
307 307
 					return;
308 308
 				}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	{
319 319
 		header("Content-Type: text/xml; charset=UTF-8");
320 320
 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
321
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
321
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
322 322
 		header("Cache-Control: no-store, no-cache, must-revalidate");
323 323
 		header("Cache-Control: post-check=0, pre-check=0", false);
324 324
 		header("Pragma: no-cache");
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	{
333 333
 		header("Content-Type: text/html; charset=UTF-8");
334 334
 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
335
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
335
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
336 336
 		header("Cache-Control: no-store, no-cache, must-revalidate");
337 337
 		header("Cache-Control: post-check=0, pre-check=0", false);
338 338
 		header("Pragma: no-cache");
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	{
347 347
 		header("Content-Type: text/html; charset=UTF-8");
348 348
 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
349
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
349
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
350 350
 		header("Cache-Control: no-store, no-cache, must-revalidate");
351 351
 		header("Cache-Control: post-check=0, pre-check=0", false);
352 352
 		header("Pragma: no-cache");
Please login to merge, or discard this patch.
Braces   +12 added lines, -19 removed lines patch added patch discarded remove patch
@@ -39,24 +39,20 @@  discard block
 block discarded – undo
39 39
 		if(Context::get('xeVirtualRequestMethod') == 'xml')
40 40
 		{
41 41
 			$handler = new VirtualXMLDisplayHandler();
42
-		}
43
-		else if(Context::getRequestMethod() == 'XMLRPC')
42
+		} else if(Context::getRequestMethod() == 'XMLRPC')
44 43
 		{
45 44
 			$handler = new XMLDisplayHandler();
46 45
 			if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
47 46
 			{
48 47
 				$this->gz_enabled = FALSE;
49 48
 			}
50
-		}
51
-		else if(Context::getRequestMethod() == 'JSON')
49
+		} else if(Context::getRequestMethod() == 'JSON')
52 50
 		{
53 51
 			$handler = new JSONDisplayHandler();
54
-		}
55
-		else if(Context::getRequestMethod() == 'JS_CALLBACK')
52
+		} else if(Context::getRequestMethod() == 'JS_CALLBACK')
56 53
 		{
57 54
 			$handler = new JSCallbackDisplayHandler();
58
-		}
59
-		else
55
+		} else
60 56
 		{
61 57
 			$handler = new HTMLDisplayHandler();
62 58
 		}
@@ -70,7 +66,9 @@  discard block
 block discarded – undo
70 66
 		$called_position = 'before_display_content';
71 67
 		$oAddonController = getController('addon');
72 68
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
73
-		if(file_exists($addon_file)) include($addon_file);
69
+		if(file_exists($addon_file)) {
70
+			include($addon_file);
71
+		}
74 72
 
75 73
 		if(method_exists($handler, "prepareToPrint"))
76 74
 		{
@@ -83,18 +81,15 @@  discard block
 block discarded – undo
83 81
 		if($httpStatusCode && $httpStatusCode != 200)
84 82
 		{
85 83
 			$this->_printHttpStatusCode($httpStatusCode);
86
-		}
87
-		else
84
+		} else
88 85
 		{
89 86
 			if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
90 87
 			{
91 88
 				$this->_printJSONHeader();
92
-			}
93
-			else if(Context::getResponseMethod() != 'HTML')
89
+			} else if(Context::getResponseMethod() != 'HTML')
94 90
 			{
95 91
 				$this->_printXMLHeader();
96
-			}
97
-			else
92
+			} else
98 93
 			{
99 94
 				$this->_printHTMLHeader();
100 95
 			}
@@ -209,8 +204,7 @@  discard block
 block discarded – undo
209 204
 				);
210 205
 			}
211 206
 			// dislpay the file and HTML comments
212
-		}
213
-		else
207
+		} else
214 208
 		{
215 209
 
216 210
 			$buff = array();
@@ -265,8 +259,7 @@  discard block
 block discarded – undo
265 259
 						if($query['result'] == 'Success')
266 260
 						{
267 261
 							$query_result = "Query Success";
268
-						}
269
-						else
262
+						} else
270 263
 						{
271 264
 							$query_result = sprintf("Query $s : %d\n\t\t\t   %s", $query['result'], $query['errno'], $query['errstr']);
272 265
 						}
Please login to merge, or discard this patch.
classes/display/HTMLDisplayHandler.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -370,7 +370,7 @@
 block discarded – undo
370 370
 	/**
371 371
 	 * add given .css or .js file names in widget code to Context
372 372
 	 * @param array $matches
373
-	 * @return void
373
+	 * @return string|null
374 374
 	 */
375 375
 	function _transMeta($matches)
376 376
 	{
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 		$template_path = $oModule->getTemplatePath();
21 21
 
22
-		if(!is_dir($template_path))
22
+		if (!is_dir($template_path))
23 23
 		{
24
-			if($oModule->module_info->module == $oModule->module)
24
+			if ($oModule->module_info->module == $oModule->module)
25 25
 			{
26 26
 				$skin = $oModule->origin_module_info->skin;
27 27
 			}
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
 				$skin = $oModule->module_config->skin;
31 31
 			}
32 32
 
33
-			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false)
33
+			if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false)
34 34
 			{
35
-				if($skin && is_string($skin))
35
+				if ($skin && is_string($skin))
36 36
 				{
37 37
 					$theme_skin = explode('|@|', $skin);
38 38
 					$template_path = $oModule->getTemplatePath();
39
-					if(count($theme_skin) == 2)
39
+					if (count($theme_skin) == 2)
40 40
 					{
41 41
 						$theme_path = sprintf('./themes/%s', $theme_skin[0]);
42 42
 						// FIXME $theme_path $theme_path $theme_path ??
43
-						if(substr($theme_path, 0, strlen($theme_path)) != $theme_path)
43
+						if (substr($theme_path, 0, strlen($theme_path)) != $theme_path)
44 44
 						{
45 45
 							$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
46 46
 						}
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
 		$output = $oTemplate->compile($template_path, $tpl_file);
62 62
 
63 63
 		// add .x div for adminitration pages
64
-		if(Context::getResponseMethod() == 'HTML')
64
+		if (Context::getResponseMethod() == 'HTML')
65 65
 		{
66
-			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify')
66
+			if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify')
67 67
 			{
68
-				$output = '<div class="x">' . $output . '</div>';
68
+				$output = '<div class="x">'.$output.'</div>';
69 69
 			}
70 70
 
71
-			if(Context::get('layout') != 'none')
71
+			if (Context::get('layout') != 'none')
72 72
 			{
73
-				if(__DEBUG__ == 3)
73
+				if (__DEBUG__ == 3)
74 74
 				{
75 75
 					$start = getMicroTime();
76 76
 				}
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 				$layout_srl = $layout_info->layout_srl;
89 89
 
90 90
 				// compile if connected to the layout
91
-				if($layout_srl > 0)
91
+				if ($layout_srl > 0)
92 92
 				{
93 93
 
94 94
 					// handle separately if the layout is faceoff
95
-					if($layout_info && $layout_info->type == 'faceoff')
95
+					if ($layout_info && $layout_info->type == 'faceoff')
96 96
 					{
97 97
 						$oLayoutModel->doActivateFaceOff($layout_info);
98 98
 						Context::set('layout_info', $layout_info);
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 					// search if the changes CSS exists in the admin layout edit window
102 102
 					$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
103 103
 
104
-					if(FileHandler::exists($edited_layout_css))
104
+					if (FileHandler::exists($edited_layout_css))
105 105
 					{
106 106
 						Context::loadFile(array($edited_layout_css, 'all', '', 100));
107 107
 					}
108 108
 				}
109
-				if(!$layout_path)
109
+				if (!$layout_path)
110 110
 				{
111 111
 					$layout_path = './common/tpl';
112 112
 				}
113
-				if(!$layout_file)
113
+				if (!$layout_file)
114 114
 				{
115 115
 					$layout_file = 'default_layout';
116 116
 				}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 				// if popup_layout, remove admin bar.
120 120
 				$realLayoutPath = FileHandler::getRealPath($layout_path);
121
-				if(substr_compare($realLayoutPath, '/', -1) !== 0)
121
+				if (substr_compare($realLayoutPath, '/', -1) !== 0)
122 122
 				{
123 123
 					$realLayoutPath .= '/';
124 124
 				}
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 				$pathInfo = pathinfo($layout_file);
127 127
 				$onlyLayoutFile = $pathInfo['filename'];
128 128
 
129
-				if(__DEBUG__ == 3)
129
+				if (__DEBUG__ == 3)
130 130
 				{
131 131
 					$GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start;
132 132
 				}
133 133
 
134
-				if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always'))
134
+				if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always'))
135 135
 				{
136 136
 					Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>');
137 137
 				}
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	function prepareToPrint(&$output)
149 149
 	{
150
-		if(Context::getResponseMethod() != 'HTML')
150
+		if (Context::getResponseMethod() != 'HTML')
151 151
 		{
152 152
 			return;
153 153
 		}
154 154
 
155
-		if(__DEBUG__ == 3)
155
+		if (__DEBUG__ == 3)
156 156
 		{
157 157
 			$start = getMicroTime();
158 158
 		}
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
 		$output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output);
171 171
 
172 172
 		// handles a relative path generated by using the rewrite module
173
-		if(Context::isAllowRewrite())
173
+		if (Context::isAllowRewrite())
174 174
 		{
175 175
 			$url = parse_url(Context::getRequestUri());
176 176
 			$real_path = $url['path'];
177 177
 
178 178
 			$pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s';
179
-			$output = preg_replace($pattern, 'src=$1' . $real_path . '$2$3', $output);
179
+			$output = preg_replace($pattern, 'src=$1'.$real_path.'$2$3', $output);
180 180
 
181 181
 			$pattern = '/href=("|\'){1}(\?[^"\']+)/s';
182
-			$output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output);
182
+			$output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output);
183 183
 
184
-			if(Context::get('vid'))
184
+			if (Context::get('vid'))
185 185
 			{
186
-				$pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is';
186
+				$pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is';
187 187
 				$output = preg_replace($pattern, '/?$1=', $output);
188 188
 			}
189 189
 		}
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 		// prevent the 2nd request due to url(none) of the background-image
192 192
 		$output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output);
193 193
 
194
-		if(is_array(Context::get('INPUT_ERROR')))
194
+		if (is_array(Context::get('INPUT_ERROR')))
195 195
 		{
196 196
 			$INPUT_ERROR = Context::get('INPUT_ERROR');
197 197
 			$keys = array_keys($INPUT_ERROR);
198
-			$keys = '(' . implode('|', $keys) . ')';
198
+			$keys = '('.implode('|', $keys).')';
199 199
 
200
-			$output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output);
201
-			$output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output);
202
-			$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
200
+			$output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output);
201
+			$output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output);
202
+			$output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
203 203
 		}
204 204
 
205
-		if(__DEBUG__ == 3)
205
+		if (__DEBUG__ == 3)
206 206
 		{
207 207
 			$GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start;
208 208
 		}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		// convert the final layout
221 221
 		Context::set('content', $output);
222 222
 		$oTemplate = TemplateHandler::getInstance();
223
-		if(Mobile::isFromMobilePhone())
223
+		if (Mobile::isFromMobilePhone())
224 224
 		{
225 225
 			$this->_loadMobileJSCSS();
226 226
 			$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
 	{
246 246
 		$INPUT_ERROR = Context::get('INPUT_ERROR');
247 247
 
248
-		$str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4];
248
+		$str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4];
249 249
 
250 250
 		// get type
251 251
 		$type = 'text';
252
-		if(preg_match('/\stype="([a-z]+)"/i', $str, $m))
252
+		if (preg_match('/\stype="([a-z]+)"/i', $str, $m))
253 253
 		{
254 254
 			$type = strtolower($m[1]);
255 255
 		}
256 256
 
257
-		switch($type)
257
+		switch ($type)
258 258
 		{
259 259
 			case 'text':
260 260
 			case 'hidden':
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			case 'number':
273 273
 			case 'range':
274 274
 			case 'color':
275
-				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"';
275
+				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"';
276 276
 				break;
277 277
 			case 'password':
278 278
 				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str);
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 			case 'radio':
281 281
 			case 'checkbox':
282 282
 				$str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str);
283
-				if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str))
283
+				if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str))
284 284
 				{
285 285
 					$str .= ' checked="checked"';
286 286
 				}
287 287
 				break;
288 288
 		}
289 289
 
290
-		return $str . ' />';
290
+		return $str.' />';
291 291
 	}
292 292
 
293 293
 	/**
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 		preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m);
305 305
 
306 306
 		$key = array_search($INPUT_ERROR[$matches[1]], $m[1]);
307
-		if($key === FALSE)
307
+		if ($key === FALSE)
308 308
 		{
309 309
 			return $matches[0];
310 310
 		}
311 311
 
312 312
 		$m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]);
313 313
 
314
-		return $mm[0] . implode('', $m[0]) . '</select>';
314
+		return $mm[0].implode('', $m[0]).'</select>';
315 315
 	}
316 316
 
317 317
 	/**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	{
324 324
 		$INPUT_ERROR = Context::get('INPUT_ERROR');
325 325
 		preg_match('@<textarea.*?>@is', $matches[0], $mm);
326
-		return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>';
326
+		return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>';
327 327
 	}
328 328
 
329 329
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	function _moveStyleToHeader($matches)
336 336
 	{
337
-		if(isset($matches[1]) && stristr($matches[1], 'scoped'))
337
+		if (isset($matches[1]) && stristr($matches[1], 'scoped'))
338 338
 		{
339 339
 			return $matches[0];
340 340
 		}
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	function _transMeta($matches)
372 372
 	{
373
-		if($matches[1])
373
+		if ($matches[1])
374 374
 		{
375 375
 			return '';
376 376
 		}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		$lang_type = Context::getLangType();
388 388
 
389 389
 		// add common JS/CSS files
390
-		if(__DEBUG__ || !__XE_VERSION_STABLE__)
390
+		if (__DEBUG__ || !__XE_VERSION_STABLE__)
391 391
 		{
392 392
 			$oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1110000), true);
393 393
 			$oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1100000), true);
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			$oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true);
401 401
 			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true);
402 402
 			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true);
403
-			if(!__DISABLE_DEFAULT_CSS__)
403
+			if (!__DISABLE_DEFAULT_CSS__)
404 404
 			{
405 405
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
406 406
 			}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true);
416 416
 			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true);
417 417
 			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true);
418
-			if(!__DISABLE_DEFAULT_CSS__)
418
+			if (!__DISABLE_DEFAULT_CSS__)
419 419
 			{
420 420
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
421 421
 			}
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 		}
427 427
 
428 428
 		// for admin page, add admin css
429
-		if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
429
+		if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
430 430
 		{
431
-			if(__DEBUG__ || !__XE_VERSION_STABLE__)
431
+			if (__DEBUG__ || !__XE_VERSION_STABLE__)
432 432
 			{
433 433
 				$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true);
434 434
 				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		$lang_type = Context::getLangType();
461 461
 
462 462
 		// add common JS/CSS files
463
-		if(__DEBUG__ || !__XE_VERSION_STABLE__)
463
+		if (__DEBUG__ || !__XE_VERSION_STABLE__)
464 464
 		{
465 465
 			$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -1100000), true);
466 466
 			$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -1000000), true);
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			$oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true);
473 473
 			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true);
474 474
 			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true);
475
-			if(!__DISABLE_DEFAULT_CSS__)
475
+			if (!__DISABLE_DEFAULT_CSS__)
476 476
 			{
477 477
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
478 478
 				$oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true);
489 489
 			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true);
490 490
 			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true);
491
-			if(!__DISABLE_DEFAULT_CSS__)
491
+			if (!__DISABLE_DEFAULT_CSS__)
492 492
 			{
493 493
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
494 494
 				$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true);
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 			if($oModule->module_info->module == $oModule->module)
25 25
 			{
26 26
 				$skin = $oModule->origin_module_info->skin;
27
-			}
28
-			else
27
+			} else
29 28
 			{
30 29
 				$skin = $oModule->module_config->skin;
31 30
 			}
@@ -45,13 +44,11 @@  discard block
 block discarded – undo
45 44
 							$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
46 45
 						}
47 46
 					}
48
-				}
49
-				else
47
+				} else
50 48
 				{
51 49
 					$template_path = $oModule->getTemplatePath();
52 50
 				}
53
-			}
54
-			else
51
+			} else
55 52
 			{
56 53
 				$template_path = $oModule->getTemplatePath();
57 54
 			}
@@ -224,8 +221,7 @@  discard block
 block discarded – undo
224 221
 		{
225 222
 			$this->_loadMobileJSCSS();
226 223
 			$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
227
-		}
228
-		else
224
+		} else
229 225
 		{
230 226
 			$this->_loadJSCSS();
231 227
 			$output = $oTemplate->compile('./common/tpl', 'common_layout');
@@ -403,13 +399,11 @@  discard block
 block discarded – undo
403 399
 			if(!__DISABLE_DEFAULT_CSS__)
404 400
 			{
405 401
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
406
-			}
407
-			else
402
+			} else
408 403
 			{
409 404
 				$oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true);
410 405
 			}
411
-		}
412
-		else
406
+		} else
413 407
 		{
414 408
 			$oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -1110000), true);
415 409
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true);
@@ -418,8 +412,7 @@  discard block
 block discarded – undo
418 412
 			if(!__DISABLE_DEFAULT_CSS__)
419 413
 			{
420 414
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
421
-			}
422
-			else
415
+			} else
423 416
 			{
424 417
 				$oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
425 418
 			}
@@ -437,8 +430,7 @@  discard block
 block discarded – undo
437 430
 				$oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true);
438 431
 				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
439 432
 				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
440
-			}
441
-			else
433
+			} else
442 434
 			{
443 435
 				$oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true);
444 436
 				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
@@ -476,14 +468,12 @@  discard block
 block discarded – undo
476 468
 			{
477 469
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
478 470
 				$oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true);
479
-			}
480
-			else
471
+			} else
481 472
 			{
482 473
 				$oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true);
483 474
 				$oContext->unloadFile(array('./common/css/mobile.css', '', '', -10000000), true);
484 475
 			}
485
-		}
486
-		else
476
+		} else
487 477
 		{
488 478
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true);
489 479
 			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true);
@@ -492,8 +482,7 @@  discard block
 block discarded – undo
492 482
 			{
493 483
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
494 484
 				$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true);
495
-			}
496
-			else
485
+			} else
497 486
 			{
498 487
 				$oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
499 488
 				$oContext->unloadFile(array('./common/css/mobile.min.css', '', '', -10000000), true);
Please login to merge, or discard this patch.
classes/httprequest/XEHttpRequest.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 
52 52
 	/**
53 53
 	 * Mether to add key/value pair to the HTTP request header
54
-	 * @param int|string $key HTTP header element
54
+	 * @param string $key HTTP header element
55 55
 	 * @param string $value value string for HTTP header element
56 56
 	 * @return void
57 57
 	 */
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
97 97
 		if(FALSE && is_callable('curl_init'))
98 98
 		{
99 99
 			return $this->sendWithCurl($target, $method, $timeout, $post_vars);
100
-		}
101
-		else
100
+		} else
102 101
 		{
103 102
 			return $this->sendWithSock($target, $method, $timeout, $post_vars);
104 103
 		}
@@ -179,8 +178,7 @@  discard block
 block discarded – undo
179 178
 				{
180 179
 					$body .= fgets($sock, $chunk_size+1);
181 180
 				}
182
-			}
183
-			else
181
+			} else
184 182
 			{
185 183
 				$body .= fgets($sock, 512);
186 184
 			}
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * constructor
42 42
 	 * @return void
43 43
 	 */
44
-	function __construct($host, $port, $scheme='')
44
+	function __construct($host, $port, $scheme = '')
45 45
 	{
46 46
 		$this->m_host = $host;
47 47
 		$this->m_port = $port;
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 		$this->addToHeader('Connection', 'close');
77 77
 
78 78
 		$method = strtoupper($method);
79
-		if(!$allow_methods)
79
+		if (!$allow_methods)
80 80
 		{
81 81
 			$allow_methods = explode(' ', 'GET POST PUT');
82 82
 		}
83
-		if(!in_array($method, $allow_methods))
83
+		if (!in_array($method, $allow_methods))
84 84
 		{
85 85
 			$method = $allow_methods[0];
86 86
 		}
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 		$timout = max((int) $timeout, 0);
90 90
 
91 91
 		// list of post variables
92
-		if(!is_array($post_vars))
92
+		if (!is_array($post_vars))
93 93
 		{
94 94
 			$post_vars = array();
95 95
 		}
96 96
 
97
-		if(FALSE && is_callable('curl_init'))
97
+		if (FALSE && is_callable('curl_init'))
98 98
 		{
99 99
 			return $this->sendWithCurl($target, $method, $timeout, $post_vars);
100 100
 		}
@@ -117,30 +117,30 @@  discard block
 block discarded – undo
117 117
 		static $crlf = "\r\n";
118 118
 
119 119
 		$scheme = '';
120
-		if($this->m_scheme=='https')
120
+		if ($this->m_scheme == 'https')
121 121
 		{
122 122
 			$scheme = 'ssl://';
123 123
 		}
124 124
 
125
-		$sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout);
126
-		if(!$sock)
125
+		$sock = @fsockopen($scheme.$this->m_host, $this->m_port, $errno, $errstr, $timeout);
126
+		if (!$sock)
127 127
 		{
128 128
 			return new BaseObject(-1, 'socket_connect_failed');
129 129
 		}
130 130
 
131 131
 		$headers = $this->m_headers + array();
132
-		if(!isset($headers['Accept-Encoding']))
132
+		if (!isset($headers['Accept-Encoding']))
133 133
 		{
134 134
 			$headers['Accept-Encoding'] = 'identity';
135 135
 		}
136 136
 
137 137
 		// post body
138 138
 		$post_body = '';
139
-		if($method == 'POST' && count($post_vars))
139
+		if ($method == 'POST' && count($post_vars))
140 140
 		{
141
-			foreach($post_vars as $key => $value)
141
+			foreach ($post_vars as $key => $value)
142 142
 			{
143
-				$post_body .= urlencode($key) . '=' . urlencode($value) . '&';
143
+				$post_body .= urlencode($key).'='.urlencode($value).'&';
144 144
 			}
145 145
 			$post_body = substr($post_body, 0, -1);
146 146
 
@@ -149,35 +149,35 @@  discard block
 block discarded – undo
149 149
 		}
150 150
 
151 151
 		$request = "$method $target HTTP/1.1$crlf";
152
-		foreach($headers as $equiv => $content)
152
+		foreach ($headers as $equiv => $content)
153 153
 		{
154 154
 			$request .= "$equiv: $content$crlf";
155 155
 		}
156
-		$request .= $crlf . $post_body;
156
+		$request .= $crlf.$post_body;
157 157
 		fwrite($sock, $request);
158 158
 
159 159
 		list($httpver, $code, $status) = preg_split('/ +/', rtrim(fgets($sock)), 3);
160 160
 
161 161
 		// read response headers
162 162
 		$is_chunked = FALSE;
163
-		while(strlen(trim($line = fgets($sock))))
163
+		while (strlen(trim($line = fgets($sock))))
164 164
 		{
165 165
 			list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2);
166
-			if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked')
166
+			if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked')
167 167
 			{
168 168
 				$is_chunked = TRUE;
169 169
 			}
170 170
 		}
171 171
 
172 172
 		$body = '';
173
-		while(!feof($sock))
173
+		while (!feof($sock))
174 174
 		{
175
-			if($is_chunked)
175
+			if ($is_chunked)
176 176
 			{
177 177
 				$chunk_size = hexdec(fgets($sock));
178
-				if($chunk_size)
178
+				if ($chunk_size)
179 179
 				{
180
-					$body .= fgets($sock, $chunk_size+1);
180
+					$body .= fgets($sock, $chunk_size + 1);
181 181
 				}
182 182
 			}
183 183
 			else
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
220 220
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
221 221
 
222
-		switch($method)
222
+		switch ($method)
223 223
 		{
224 224
 			case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true);
225 225
 				break;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 
234 234
 		$arr_headers = array();
235
-		foreach($headers as $key => $value)
235
+		foreach ($headers as $key => $value)
236 236
 		{
237 237
 			$arr_headers[] = "$key: $value";
238 238
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers);
241 241
 
242 242
 		$body = curl_exec($ch);
243
-		if(curl_errno($ch))
243
+		if (curl_errno($ch))
244 244
 		{
245 245
 			return new BaseObject(-1, 'socket_connect_failed');
246 246
 		}
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 4 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 	/**
114 114
 	 * Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action
115
-	 * @return boolean true: OK, false: redirected
115
+	 * @return string|boolean true: OK, false: redirected
116 116
 	 * */
117 117
 	function init()
118 118
 	{
@@ -1128,6 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 		return $GLOBALS['_loaded_module'][$module][$type][$kind];
1129 1129
 	}
1130 1130
 
1131
+	/**
1132
+	 * @param string $type
1133
+	 * @param string $kind
1134
+	 */
1131 1135
 	function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName)
1132 1136
 	{
1133 1137
 		$classPath = ModuleHandler::getModulePath($module);
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,10 +59,10 @@
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
63
-        {
64
-            $this->entry = Context::convertEncodingStr($entry);
65
-        }
62
+		if($entry = Context::get('entry'))
63
+		{
64
+			$this->entry = Context::convertEncodingStr($entry);
65
+		}
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
Please login to merge, or discard this patch.
Braces   +30 added lines, -45 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if(file_exists($addon_file)) {
119
+			include($addon_file);
120
+		}
119 121
 	}
120 122
 
121 123
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
@@ -257,8 +259,7 @@  discard block
 block discarded – undo
257 259
 			if(!$module_info)
258 260
 			{
259 261
 				unset($this->document_srl);
260
-			}
261
-			else
262
+			} else
262 263
 			{
263 264
 				// If it exists, compare mid based on the module information
264 265
 				// if mids are not matching, set it as the document's mid
@@ -270,8 +271,7 @@  discard block
 block discarded – undo
270 271
 						$this->mid = $module_info->mid;
271 272
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 273
 						return FALSE;
273
-					}
274
-					else
274
+					} else
275 275
 					{
276 276
 						$this->mid = $module_info->mid;
277 277
 						Context::set('mid', $this->mid);
@@ -322,15 +322,13 @@  discard block
 block discarded – undo
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
324 324
 				// If it's called from a virtual site, though it's not a module of the virtual site
325
-			}
326
-			else
325
+			} else
327 326
 			{
328 327
 				$db_info = Context::getDBInfo();
329 328
 				if(!$db_info->default_url)
330 329
 				{
331 330
 					return Context::getLang('msg_default_url_is_not_defined');
332
-				}
333
-				else
331
+				} else
334 332
 				{
335 333
 					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
336 334
 				}
@@ -355,8 +353,7 @@  discard block
 block discarded – undo
355 353
 			{
356 354
 				$oLayoutAdminModel = getAdminModel('layout');
357 355
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
358
-			}
359
-			else
356
+			} else
360 357
 			{
361 358
 				$layoutSrl = $module_info->{$targetSrl};
362 359
 			}
@@ -490,8 +487,7 @@  discard block
 block discarded – undo
490 487
 			if(!$allowedMethod)
491 488
 			{
492 489
 				$allowedMethodList[0] = 'POST';
493
-			}
494
-			else
490
+			} else
495 491
 			{
496 492
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
497 493
 			}
@@ -551,8 +547,7 @@  discard block
 block discarded – undo
551 547
 				Mobile::setMobile(FALSE);
552 548
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
553 549
 			}
554
-		}
555
-		else
550
+		} else
556 551
 		{
557 552
 			// create a module instance
558 553
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -606,8 +601,7 @@  discard block
 block discarded – undo
606 601
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
607 602
 					$forward->meta_noindex = $xml_info->action->{$this->act}->meta_noindex;
608 603
 					$forward->act = $this->act;
609
-				}
610
-				else
604
+				} else
611 605
 				{
612 606
 					$this->error = 'msg_invalid_request';
613 607
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -659,8 +653,7 @@  discard block
 block discarded – undo
659 653
 					if(!$allowedMethod)
660 654
 					{
661 655
 						$allowedMethodList[0] = 'POST';
662
-					}
663
-					else
656
+					} else
664 657
 					{
665 658
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
666 659
 					}
@@ -688,8 +681,7 @@  discard block
 block discarded – undo
688 681
 						Mobile::setMobile(FALSE);
689 682
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
690 683
 					}
691
-				}
692
-				else
684
+				} else
693 685
 				{
694 686
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
695 687
 				}
@@ -719,8 +711,7 @@  discard block
 block discarded – undo
719 711
 							$oModule->setLayoutPath("./modules/admin/tpl");
720 712
 							$oModule->setLayoutFile("layout.html");
721 713
 						}
722
-					}
723
-					else
714
+					} else
724 715
 					{
725 716
 						$this->_setInputErrorToContext();
726 717
 
@@ -744,8 +735,7 @@  discard block
 block discarded – undo
744 735
 						$oMessageObject->setMessage($this->error);
745 736
 						$oMessageObject->dispMessage();
746 737
 						return $oMessageObject;
747
-					}
748
-					else
738
+					} else
749 739
 					{
750 740
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
751 741
 						{
@@ -759,12 +749,10 @@  discard block
 block discarded – undo
759 749
 						}
760 750
 					}
761 751
 				}
762
-			}
763
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
752
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
764 753
 			{
765 754
 				$this->act = $xml_info->default_index_act;
766
-			}
767
-			else
755
+			} else
768 756
 			{
769 757
 				$this->error = 'msg_invalid_request';
770 758
 				$oModule->setError(-1);
@@ -866,7 +854,9 @@  discard block
 block discarded – undo
866 854
 			$message = $oModule->getMessage();
867 855
 			$messageType = $oModule->getMessageType();
868 856
 			$redirectUrl = $oModule->getRedirectUrl();
869
-			if($messageType == 'error') debugPrint($message, 'ERROR');
857
+			if($messageType == 'error') {
858
+				debugPrint($message, 'ERROR');
859
+			}
870 860
 
871 861
 			if(!$procResult)
872 862
 			{
@@ -876,8 +866,7 @@  discard block
 block discarded – undo
876 866
 					$redirectUrl = Context::get('error_return_url');
877 867
 				}
878 868
 				$this->_setInputValueToSession();
879
-			}
880
-			else
869
+			} else
881 870
 			{
882 871
 
883 872
 			}
@@ -1025,8 +1014,7 @@  discard block
 block discarded – undo
1025 1014
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1026 1015
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
1027 1016
 					// Otherwise, set message instance as the target module
1028
-				}
1029
-				else
1017
+				} else
1030 1018
 				{
1031 1019
 					$oModule = $oMessageObject;
1032 1020
 				}
@@ -1038,8 +1026,7 @@  discard block
 block discarded – undo
1038 1026
 			if(Mobile::isFromMobilePhone())
1039 1027
 			{
1040 1028
 				$layout_srl = $oModule->module_info->mlayout_srl;
1041
-			}
1042
-			else
1029
+			} else
1043 1030
 			{
1044 1031
 				$layout_srl = $oModule->module_info->layout_srl;
1045 1032
 			}
@@ -1098,8 +1085,7 @@  discard block
 block discarded – undo
1098 1085
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1099 1086
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1100 1087
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1101
-								}
1102
-								else
1088
+								} else
1103 1089
 								{
1104 1090
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
1105 1091
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1136,8 +1122,7 @@  discard block
 block discarded – undo
1136 1122
 				if($kind == 'admin')
1137 1123
 				{
1138 1124
 					$oModule->setLayoutFile('popup_layout');
1139
-				}
1140
-				else
1125
+				} else
1141 1126
 				{
1142 1127
 					$oModule->setLayoutPath('common/tpl');
1143 1128
 					$oModule->setLayoutFile('default_layout');
@@ -1271,13 +1256,11 @@  discard block
 block discarded – undo
1271 1256
 		{
1272 1257
 			$instanceName = '%s';
1273 1258
 			$classFile = '%s%s.%s.php';
1274
-		}
1275
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1259
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1276 1260
 		{
1277 1261
 			$instanceName = '%sAdmin%s';
1278 1262
 			$classFile = '%s%s.admin.%s.php';
1279
-		}
1280
-		else
1263
+		} else
1281 1264
 		{
1282 1265
 			$instanceName = '%s%s';
1283 1266
 			$classFile = '%s%s.%s.php';
@@ -1340,7 +1323,9 @@  discard block
 block discarded – undo
1340 1323
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1341 1324
 			$slowlog->called = $module . '.' . $called_method;
1342 1325
 			$slowlog->called_extension = $module;
1343
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1326
+			if($trigger_name != 'XE.writeSlowlog') {
1327
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1328
+			}
1344 1329
 
1345 1330
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1346 1331
 			{
Please login to merge, or discard this patch.
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function __construct($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
36 36
 	{
37 37
 		// If XE has not installed yet, set module as install
38
-		if(!Context::isInstalled())
38
+		if (!Context::isInstalled())
39 39
 		{
40 40
 			$this->module = 'install';
41 41
 			$this->act = Context::get('act');
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$oContext = Context::getInstance();
46
-		if($oContext->isSuccessInit == FALSE)
46
+		if ($oContext->isSuccessInit == FALSE)
47 47
 		{
48 48
 			// @see https://github.com/xpressengine/xe-core/issues/2304
49 49
 			$this->error = 'msg_invalid_request';
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 		$this->mid = $mid ? $mid : Context::get('mid');
57 57
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
58 58
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
59
-        if($entry = Context::get('entry'))
59
+        if ($entry = Context::get('entry'))
60 60
         {
61 61
             $this->entry = Context::convertEncodingStr($entry);
62 62
         }
63 63
 
64 64
 		// Validate variables to prevent XSS
65 65
 		$isInvalid = NULL;
66
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
66
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
67 67
 		{
68 68
 			$isInvalid = TRUE;
69 69
 		}
70
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
70
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
71 71
 		{
72 72
 			$isInvalid = TRUE;
73 73
 		}
74
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
74
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
75 75
 		{
76 76
 			$isInvalid = TRUE;
77 77
 		}
78
-		if($isInvalid)
78
+		if ($isInvalid)
79 79
 		{
80 80
 			htmlHeader();
81 81
 			echo Context::getLang("msg_invalid_request");
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 			exit;
85 85
 		}
86 86
 
87
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
87
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
88 88
 		{
89
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
89
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
90 90
 			{
91
-				if(Context::get('_https_port')!=null) {
92
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
91
+				if (Context::get('_https_port') != null) {
92
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
93 93
 				} else {
94
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
94
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
95 95
 				}
96 96
 				return;
97 97
 			}
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 
100 100
 		// call a trigger before moduleHandler init
101 101
 		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
102
-		if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
102
+		if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
103 103
 		{
104
-			if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
104
+			if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
105 105
 			{
106 106
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
107 107
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -112,40 +112,40 @@  discard block
 block discarded – undo
112 112
 		$called_position = 'before_module_init';
113 113
 		$oAddonController = getController('addon');
114 114
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
115
-		if(file_exists($addon_file)) include($addon_file);
115
+		if (file_exists($addon_file)) include($addon_file);
116 116
 	}
117 117
 
118 118
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
119 119
 	{
120
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
120
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
121 121
 		{
122 122
 			return false;
123 123
 		}
124 124
 
125 125
 		set_error_handler(function() { }, ~0);
126 126
 
127
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
128
-		if(!file_exists($debug_file))
127
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
128
+		if (!file_exists($debug_file))
129 129
 		{
130 130
 			$print[] = '<?php exit() ?>';
131 131
 		}
132 132
 
133 133
 		$errorname = self::getErrorType($errnumber);
134
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
134
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
135 135
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
136 136
 		$backtrace = debug_backtrace($backtrace_args);
137
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
137
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
138 138
 		{
139 139
 			array_shift($backtrace);
140 140
 		}
141 141
 
142
-		foreach($backtrace as $key => $value)
142
+		foreach ($backtrace as $key => $value)
143 143
 		{
144
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
144
+			$message = '    - '.$value['file'].' : '.$value['line'];
145 145
 			$print[] = $message;
146 146
 		}
147 147
 		$print[] = PHP_EOL;
148
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
148
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
149 149
 		restore_error_handler();
150 150
 
151 151
 		return true;
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 
162 162
 		set_error_handler(function() { }, ~0);
163 163
 
164
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
165
-		if(!file_exists($debug_file))
164
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
165
+		if (!file_exists($debug_file))
166 166
 		{
167 167
 			$print[] = '<?php exit() ?>';
168 168
 		}
169 169
 
170 170
 		$errorname = self::getErrorType($errinfo['type']);
171 171
 		$print[] = '['.date('Y-m-d H:i:s').']';
172
-		$print[] = $errorname . ' : ' . $errinfo['message'];
172
+		$print[] = $errorname.' : '.$errinfo['message'];
173 173
 
174
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
174
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
175 175
 		$print[] = $message;
176 176
 
177 177
 		$print[] = PHP_EOL;
178
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
178
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
179 179
 		set_error_handler(array($this, 'dummyHandler'), ~0);
180 180
 
181 181
 		return true;
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 		$defaultUrlInfo = parse_url($dbInfo->default_url);
220 220
 		$defaultHost = $defaultUrlInfo['host'];
221 221
 
222
-		foreach($urls as $url)
222
+		foreach ($urls as $url)
223 223
 		{
224
-			if(empty($url))
224
+			if (empty($url))
225 225
 			{
226 226
 				continue;
227 227
 			}
@@ -229,34 +229,34 @@  discard block
 block discarded – undo
229 229
 			$urlInfo = parse_url(urldecode($url));
230 230
 			$host = $urlInfo['host'];
231 231
 
232
-			if((!$urlInfo || !$host) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", $uri) === 0)
232
+			if ((!$urlInfo || !$host) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", $uri) === 0)
233 233
 			{
234 234
 				throw new Exception('msg_invalid_request');
235 235
 			}
236 236
 
237
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
237
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
238 238
 			{
239 239
 				throw new Exception('msg_default_url_is_null');
240 240
 			}
241 241
 		}
242 242
 
243
-		if(!$this->document_srl && $this->mid && $this->entry)
243
+		if (!$this->document_srl && $this->mid && $this->entry)
244 244
 		{
245 245
 			$oDocumentModel = getModel('document');
246 246
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
247
-			if($this->document_srl)
247
+			if ($this->document_srl)
248 248
 			{
249 249
 				Context::set('document_srl', $this->document_srl);
250 250
 			}
251 251
 		}
252 252
 
253 253
 		// Get module's information based on document_srl, if it's specified
254
-		if($this->document_srl)
254
+		if ($this->document_srl)
255 255
 		{
256 256
 
257 257
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
258 258
 			// If the document does not exist, remove document_srl
259
-			if(!$module_info)
259
+			if (!$module_info)
260 260
 			{
261 261
 				unset($this->document_srl);
262 262
 			}
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
 			{
265 265
 				// If it exists, compare mid based on the module information
266 266
 				// if mids are not matching, set it as the document's mid
267
-				if(!$this->mid || ($this->mid != $module_info->mid))
267
+				if (!$this->mid || ($this->mid != $module_info->mid))
268 268
 				{
269 269
 
270
-					if(Context::getRequestMethod() == 'GET')
270
+					if (Context::getRequestMethod() == 'GET')
271 271
 					{
272 272
 						$this->mid = $module_info->mid;
273
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
273
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
274 274
 						return FALSE;
275 275
 					}
276 276
 					else
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 				}
283 283
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
284
-				if($this->module && $module_info->module != $this->module)
284
+				if ($this->module && $module_info->module != $this->module)
285 285
 				{
286 286
 					unset($module_info);
287 287
 				}
@@ -290,36 +290,36 @@  discard block
 block discarded – undo
290 290
 		}
291 291
 
292 292
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
293
-		if(!$module_info && $this->mid)
293
+		if (!$module_info && $this->mid)
294 294
 		{
295 295
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
296 296
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
297 297
 		}
298 298
 
299 299
 		// redirect, if module_site_srl and site_srl are different
300
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
300
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
301 301
 		{
302 302
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
303
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
303
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
304 304
 			return FALSE;
305 305
 		}
306 306
 
307 307
 		// If module_info is not set still, and $module does not exist, find the default module
308
-		if(!$module_info && !$this->module && !$this->mid)
308
+		if (!$module_info && !$this->module && !$this->mid)
309 309
 		{
310 310
 			$module_info = $site_module_info;
311 311
 		}
312 312
 
313
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
313
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
314 314
 		{
315 315
 			$module_info = $site_module_info;
316 316
 		}
317 317
 
318 318
 		// redirect, if site_srl of module_info is different from one of site's module_info
319
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
319
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
320 320
 		{
321 321
 			// If the module is of virtual site
322
-			if($module_info->site_srl)
322
+			if ($module_info->site_srl)
323 323
 			{
324 324
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
325 325
 				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			else
329 329
 			{
330 330
 				$db_info = Context::getDBInfo();
331
-				if(!$db_info->default_url)
331
+				if (!$db_info->default_url)
332 332
 				{
333 333
 					return Context::getLang('msg_default_url_is_not_defined');
334 334
 				}
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
338 338
 				}
339 339
 			}
340
-			header("location:" . $redirect_url);
340
+			header("location:".$redirect_url);
341 341
 			return FALSE;
342 342
 		}
343 343
 
344 344
 		// If module info was set, retrieve variables from the module information
345
-		if($module_info)
345
+		if ($module_info)
346 346
 		{
347 347
 			$this->module = $module_info->module;
348 348
 			$this->mid = $module_info->mid;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
354 354
 
355 355
 			// use the site default layout.
356
-			if($module_info->{$targetSrl} == -1)
356
+			if ($module_info->{$targetSrl} == -1)
357 357
 			{
358 358
 				$oLayoutAdminModel = getAdminModel('layout');
359 359
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		}
372 372
 
373 373
 		// Set module and mid into module_info
374
-		if(!isset($this->module_info))
374
+		if (!isset($this->module_info))
375 375
 		{
376 376
 			$this->module_info = new stdClass();
377 377
 		}
@@ -382,21 +382,21 @@  discard block
 block discarded – undo
382 382
 		$this->module_info->site_srl = $site_module_info->site_srl;
383 383
 
384 384
 		// Still no module? it's an error
385
-		if(!$this->module)
385
+		if (!$this->module)
386 386
 		{
387 387
 			$this->error = 'msg_module_is_not_exists';
388 388
 			$this->httpStatusCode = '404';
389 389
 		}
390 390
 
391 391
 		// If mid exists, set mid into context
392
-		if($this->mid)
392
+		if ($this->mid)
393 393
 		{
394 394
 			Context::set('mid', $this->mid, TRUE);
395 395
 		}
396 396
 
397 397
 		// Call a trigger after moduleHandler init
398 398
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
399
-		if(!$output->toBool())
399
+		if (!$output->toBool())
400 400
 		{
401 401
 			$this->error = $output->getMessage();
402 402
 			return TRUE;
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
419 419
 
420 420
 		// If error occurred while preparation, return a message instance
421
-		if($this->error)
421
+		if ($this->error)
422 422
 		{
423 423
 			$this->_setInputErrorToContext();
424 424
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
425 425
 			$oMessageObject->setError(-1);
426 426
 			$oMessageObject->setMessage($this->error);
427 427
 			$oMessageObject->dispMessage();
428
-			if($this->httpStatusCode)
428
+			if ($this->httpStatusCode)
429 429
 			{
430 430
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
431 431
 			}
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
437 437
 
438 438
 		// If not installed yet, modify act
439
-		if($this->module == "install")
439
+		if ($this->module == "install")
440 440
 		{
441
-			if(!$this->act || !$xml_info->action->{$this->act})
441
+			if (!$this->act || !$xml_info->action->{$this->act})
442 442
 			{
443 443
 				$this->act = $xml_info->default_index_act;
444 444
 			}
445 445
 		}
446 446
 
447 447
 		// if act exists, find type of the action, if not use default index act
448
-		if(!$this->act)
448
+		if (!$this->act)
449 449
 		{
450 450
 			$this->act = $xml_info->default_index_act;
451 451
 		}
452 452
 
453 453
 		// still no act means error
454
-		if(!$this->act)
454
+		if (!$this->act)
455 455
 		{
456 456
 			$this->error = 'msg_module_is_not_exists';
457 457
 			$this->httpStatusCode = '404';
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			$oMessageObject->setError(-1);
462 462
 			$oMessageObject->setMessage($this->error);
463 463
 			$oMessageObject->dispMessage();
464
-			if($this->httpStatusCode)
464
+			if ($this->httpStatusCode)
465 465
 			{
466 466
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
467 467
 			}
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
 			Context::addMetaTag('robots', 'noindex');
480 480
 		}
481 481
 
482
-		if(!$kind && $this->module == 'admin')
482
+		if (!$kind && $this->module == 'admin')
483 483
 		{
484 484
 			$kind = 'admin';
485 485
 		}
486 486
 
487 487
 		// check REQUEST_METHOD in controller
488
-		if($type == 'controller')
488
+		if ($type == 'controller')
489 489
 		{
490 490
 			$allowedMethod = $xml_info->action->{$this->act}->method;
491 491
 
492
-			if(!$allowedMethod)
492
+			if (!$allowedMethod)
493 493
 			{
494 494
 				$allowedMethodList[0] = 'POST';
495 495
 			}
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
499 499
 			}
500 500
 
501
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
501
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
502 502
 			{
503 503
 				$this->error = "msg_invalid_request";
504 504
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			}
510 510
 		}
511 511
 
512
-		if($this->module_info->use_mobile != "Y")
512
+		if ($this->module_info->use_mobile != "Y")
513 513
 		{
514 514
 			Mobile::setMobile(FALSE);
515 515
 		}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 
519 519
 		// check CSRF for non-GET actions
520 520
 		$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
521
-		if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
521
+		if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
522 522
 		{
523 523
 			$this->error = 'msg_invalid_request';
524 524
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		}
530 530
 
531 531
 		// Admin ip
532
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
532
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
533 533
 		{
534 534
 			$this->_setInputErrorToContext();
535 535
 			$this->error = "msg_not_permitted_act";
@@ -541,13 +541,13 @@  discard block
 block discarded – undo
541 541
 		}
542 542
 
543 543
 		// if(type == view, and case for using mobilephone)
544
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
544
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
545 545
 		{
546 546
 			$orig_type = "view";
547 547
 			$type = "mobile";
548 548
 			// create a module instance
549 549
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
550
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
550
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
551 551
 			{
552 552
 				$type = $orig_type;
553 553
 				Mobile::setMobile(FALSE);
@@ -560,14 +560,14 @@  discard block
 block discarded – undo
560 560
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
561 561
 		}
562 562
 
563
-		if(!is_object($oModule))
563
+		if (!is_object($oModule))
564 564
 		{
565 565
 			$this->_setInputErrorToContext();
566 566
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
567 567
 			$oMessageObject->setError(-1);
568 568
 			$oMessageObject->setMessage($this->error);
569 569
 			$oMessageObject->dispMessage();
570
-			if($this->httpStatusCode)
570
+			if ($this->httpStatusCode)
571 571
 			{
572 572
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
573 573
 			}
@@ -575,10 +575,10 @@  discard block
 block discarded – undo
575 575
 		}
576 576
 
577 577
 		// If there is no such action in the module object
578
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
578
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
579 579
 		{
580 580
 
581
-			if(!Context::isInstalled())
581
+			if (!Context::isInstalled())
582 582
 			{
583 583
 				$this->_setInputErrorToContext();
584 584
 				$this->error = 'msg_invalid_request';
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 				$oMessageObject->setError(-1);
587 587
 				$oMessageObject->setMessage($this->error);
588 588
 				$oMessageObject->dispMessage();
589
-				if($this->httpStatusCode)
589
+				if ($this->httpStatusCode)
590 590
 				{
591 591
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
592 592
 				}
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
 
596 596
 			$forward = NULL;
597 597
 			// 1. Look for the module with action name
598
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
598
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
599 599
 			{
600
-				$module = strtolower($matches[2] . $matches[3]);
600
+				$module = strtolower($matches[2].$matches[3]);
601 601
 				$xml_info = $oModuleModel->getModuleActionXml($module);
602 602
 
603
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
603
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
604 604
 				{
605 605
 					$forward = new stdClass();
606 606
 					$forward->module = $module;
@@ -621,12 +621,12 @@  discard block
 block discarded – undo
621 621
 				}
622 622
 			}
623 623
 
624
-			if(!$forward)
624
+			if (!$forward)
625 625
 			{
626 626
 				$forward = $oModuleModel->getActionForward($this->act);
627 627
 			}
628 628
 
629
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
629
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
630 630
 			{
631 631
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
632 632
 				$type = $forward->type;
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 				$tpl_path = $oModule->getTemplatePath();
635 635
 				$orig_module = $oModule;
636 636
 
637
-				if($forward->meta_noindex === 'true') {
637
+				if ($forward->meta_noindex === 'true') {
638 638
 					Context::addMetaTag('robots', 'noindex');
639 639
 				}
640 640
 
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 
643 643
 				// check CSRF for non-GET actions
644 644
 				$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
645
-				if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
645
+				if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
646 646
 				{
647 647
 					$this->error = 'msg_invalid_request';
648 648
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -654,11 +654,11 @@  discard block
 block discarded – undo
654 654
 
655 655
 				// SECISSUE also check foward act method
656 656
 				// check REQUEST_METHOD in controller
657
-				if($type == 'controller')
657
+				if ($type == 'controller')
658 658
 				{
659 659
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
660 660
 
661
-					if(!$allowedMethod)
661
+					if (!$allowedMethod)
662 662
 					{
663 663
 						$allowedMethodList[0] = 'POST';
664 664
 					}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
668 668
 					}
669 669
 
670
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
670
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
671 671
 					{
672 672
 						$this->error = "msg_invalid_request";
673 673
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 					}
679 679
 				}
680 680
 
681
-				if($type == "view" && Mobile::isFromMobilePhone())
681
+				if ($type == "view" && Mobile::isFromMobilePhone())
682 682
 				{
683 683
 					$orig_type = "view";
684 684
 					$type = "mobile";
685 685
 					// create a module instance
686 686
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
687
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
687
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
688 688
 					{
689 689
 						$type = $orig_type;
690 690
 						Mobile::setMobile(FALSE);
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
697 697
 				}
698 698
 
699
-				if(!is_object($oModule))
699
+				if (!is_object($oModule))
700 700
 				{
701 701
 					$this->_setInputErrorToContext();
702 702
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
703 703
 					$oMessageObject->setError(-1);
704 704
 					$oMessageObject->setMessage('msg_module_is_not_exists');
705 705
 					$oMessageObject->dispMessage();
706
-					if($this->httpStatusCode)
706
+					if ($this->httpStatusCode)
707 707
 					{
708 708
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
709 709
 					}
710 710
 					return $oMessageObject;
711 711
 				}
712 712
 
713
-				if($this->module == "admin" && $type == "view")
713
+				if ($this->module == "admin" && $type == "view")
714 714
 				{
715
-					if($logged_info->is_admin == 'Y')
715
+					if ($logged_info->is_admin == 'Y')
716 716
 					{
717
-						if($this->act != 'dispLayoutAdminLayoutModify')
717
+						if ($this->act != 'dispLayoutAdminLayoutModify')
718 718
 						{
719 719
 							$oAdminView = getAdminView('admin');
720 720
 							$oAdminView->makeGnbUrl($forward->module);
@@ -734,10 +734,10 @@  discard block
 block discarded – undo
734 734
 						return $oMessageObject;
735 735
 					}
736 736
 				}
737
-				if($kind == 'admin')
737
+				if ($kind == 'admin')
738 738
 				{
739 739
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
740
-					if(!$grant->manager)
740
+					if (!$grant->manager)
741 741
 					{
742 742
 						$this->_setInputErrorToContext();
743 743
 						$this->error = 'msg_is_not_manager';
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 					}
750 750
 					else
751 751
 					{
752
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
752
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
753 753
 						{
754 754
 							$this->_setInputErrorToContext();
755 755
 							$this->error = 'msg_is_not_administrator';
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 					}
763 763
 				}
764 764
 			}
765
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
765
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
766 766
 			{
767 767
 				$this->act = $xml_info->default_index_act;
768 768
 			}
@@ -776,16 +776,16 @@  discard block
 block discarded – undo
776 776
 		}
777 777
 
778 778
 		// ruleset check...
779
-		if(!empty($ruleset))
779
+		if (!empty($ruleset))
780 780
 		{
781 781
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
782 782
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
783
-			if(!empty($rulesetFile))
783
+			if (!empty($rulesetFile))
784 784
 			{
785
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
785
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
786 786
 				{
787 787
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
788
-					foreach($errorLang as $key => $val)
788
+					foreach ($errorLang as $key => $val)
789 789
 					{
790 790
 						Context::setLang($key, $val);
791 791
 					}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 
795 795
 				$Validator = new Validator($rulesetFile);
796 796
 				$result = $Validator->validate();
797
-				if(!$result)
797
+				if (!$result)
798 798
 				{
799 799
 					$lastError = $Validator->getLastError();
800 800
 					$returnUrl = Context::get('error_return_url');
@@ -826,26 +826,26 @@  discard block
 block discarded – undo
826 826
 				'dispLayoutPreviewWithModule' => 1
827 827
 		);
828 828
 		$db_use_mobile = Mobile::isMobileEnabled();
829
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
829
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
830 830
 		{
831 831
 			global $lang;
832 832
 			$header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
833
-			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>';
833
+			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>';
834 834
 			Context::addHtmlHeader($header);
835 835
 			Context::addHtmlFooter($footer);
836 836
 		}
837 837
 
838
-		if(($type == 'view' || $type == 'mobile') && $kind != 'admin')
838
+		if (($type == 'view' || $type == 'mobile') && $kind != 'admin')
839 839
 		{
840 840
 			$module_config = $oModuleModel->getModuleConfig('module');
841
-			if($module_config->htmlFooter)
841
+			if ($module_config->htmlFooter)
842 842
 			{
843 843
 				Context::addHtmlFooter($module_config->htmlFooter);
844 844
 			}
845
-			if($module_config->siteTitle)
845
+			if ($module_config->siteTitle)
846 846
 			{
847 847
 				$siteTitle = Context::getBrowserTitle();
848
-				if(!$siteTitle)
848
+				if (!$siteTitle)
849 849
 				{
850 850
 					Context::setBrowserTitle($module_config->siteTitle);
851 851
 				}
@@ -862,18 +862,18 @@  discard block
 block discarded – undo
862 862
 		$procResult = $oModule->proc();
863 863
 
864 864
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
865
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
865
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
866 866
 		{
867 867
 			$error = $oModule->getError();
868 868
 			$message = $oModule->getMessage();
869 869
 			$messageType = $oModule->getMessageType();
870 870
 			$redirectUrl = $oModule->getRedirectUrl();
871
-			if($messageType == 'error') debugPrint($message, 'ERROR');
871
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
872 872
 
873
-			if(!$procResult)
873
+			if (!$procResult)
874 874
 			{
875 875
 				$this->error = $message;
876
-				if(!$redirectUrl && Context::get('error_return_url'))
876
+				if (!$redirectUrl && Context::get('error_return_url'))
877 877
 				{
878 878
 					$redirectUrl = Context::get('error_return_url');
879 879
 				}
@@ -886,13 +886,13 @@  discard block
 block discarded – undo
886 886
 
887 887
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
888 888
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
889
-			if($message != 'success')
889
+			if ($message != 'success')
890 890
 			{
891 891
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
892 892
 			}
893 893
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
894 894
 
895
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
895
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
896 896
 			{
897 897
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
898 898
 			}
@@ -908,27 +908,27 @@  discard block
 block discarded – undo
908 908
 	 * */
909 909
 	function _setInputErrorToContext()
910 910
 	{
911
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
911
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
912 912
 		{
913 913
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
914 914
 		}
915
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
915
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
916 916
 		{
917 917
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
918 918
 		}
919
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
919
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
920 920
 		{
921 921
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
922 922
 		}
923
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
923
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
924 924
 		{
925 925
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
926 926
 		}
927
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
927
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
928 928
 		{
929 929
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
930 930
 		}
931
-		if(count($_SESSION['INPUT_ERROR']))
931
+		if (count($_SESSION['INPUT_ERROR']))
932 932
 		{
933 933
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
934 934
 		}
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	{
959 959
 		$requestVars = Context::getRequestVars();
960 960
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
961
-		foreach($requestVars AS $key => $value)
961
+		foreach ($requestVars AS $key => $value)
962 962
 		{
963 963
 			$_SESSION['INPUT_ERROR'][$key] = $value;
964 964
 		}
@@ -972,41 +972,41 @@  discard block
 block discarded – undo
972 972
 	function displayContent($oModule = NULL)
973 973
 	{
974 974
 		// If the module is not set or not an object, set error
975
-		if(!$oModule || !is_object($oModule))
975
+		if (!$oModule || !is_object($oModule))
976 976
 		{
977 977
 			$this->error = 'msg_module_is_not_exists';
978 978
 			$this->httpStatusCode = '404';
979 979
 		}
980 980
 
981 981
 		// If connection to DB has a problem even though it's not install module, set error
982
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
982
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
983 983
 		{
984 984
 			$this->error = 'msg_dbconnect_failed';
985 985
 		}
986 986
 
987 987
 		// Call trigger after moduleHandler proc
988 988
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
989
-		if(!$output->toBool())
989
+		if (!$output->toBool())
990 990
 		{
991 991
 			$this->error = $output->getMessage();
992 992
 		}
993 993
 
994 994
 		// Use message view object, if HTML call
995 995
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
996
-		if(!isset($methodList[Context::getRequestMethod()]))
996
+		if (!isset($methodList[Context::getRequestMethod()]))
997 997
 		{
998 998
 
999
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
999
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
1000 1000
 			{
1001 1001
 				$display_handler = new DisplayHandler();
1002 1002
 				$display_handler->_debugOutput();
1003 1003
 
1004
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
1004
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
1005 1005
 				return;
1006 1006
 			}
1007 1007
 
1008 1008
 			// If error occurred, handle it
1009
-			if($this->error)
1009
+			if ($this->error)
1010 1010
 			{
1011 1011
 				// display content with message module instance
1012 1012
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 				$oMessageObject->setMessage($this->error);
1016 1016
 				$oMessageObject->dispMessage();
1017 1017
 
1018
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1018
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1019 1019
 				{
1020 1020
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
1021 1021
 					$oMessageObject->setTemplateFile('http_status_code');
1022 1022
 				}
1023 1023
 
1024 1024
 				// If module was called normally, change the templates of the module into ones of the message view module
1025
-				if($oModule)
1025
+				if ($oModule)
1026 1026
 				{
1027 1027
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1028 1028
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 			}
1038 1038
 
1039 1039
 			// Check if layout_srl exists for the module
1040
-			if(Mobile::isFromMobilePhone())
1040
+			if (Mobile::isFromMobilePhone())
1041 1041
 			{
1042 1042
 				$layout_srl = $oModule->module_info->mlayout_srl;
1043 1043
 			}
@@ -1047,58 +1047,58 @@  discard block
 block discarded – undo
1047 1047
 			}
1048 1048
 
1049 1049
 			// if layout_srl is rollback by module, set default layout
1050
-			if($layout_srl == -1)
1050
+			if ($layout_srl == -1)
1051 1051
 			{
1052 1052
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1053 1053
 				$oLayoutAdminModel = getAdminModel('layout');
1054 1054
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1055 1055
 			}
1056 1056
 
1057
-			if($layout_srl && !$oModule->getLayoutFile())
1057
+			if ($layout_srl && !$oModule->getLayoutFile())
1058 1058
 			{
1059 1059
 
1060 1060
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1061 1061
 				$oLayoutModel = getModel('layout');
1062 1062
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1063
-				if($layout_info)
1063
+				if ($layout_info)
1064 1064
 				{
1065 1065
 
1066 1066
 					// Input extra_vars into $layout_info
1067
-					if($layout_info->extra_var_count)
1067
+					if ($layout_info->extra_var_count)
1068 1068
 					{
1069 1069
 
1070
-						foreach($layout_info->extra_var as $var_id => $val)
1070
+						foreach ($layout_info->extra_var as $var_id => $val)
1071 1071
 						{
1072
-							if($val->type == 'image')
1072
+							if ($val->type == 'image')
1073 1073
 							{
1074
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1074
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1075 1075
 								{
1076
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1076
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1077 1077
 								}
1078 1078
 							}
1079 1079
 							$layout_info->{$var_id} = $val->value;
1080 1080
 						}
1081 1081
 					}
1082 1082
 					// Set menus into context
1083
-					if($layout_info->menu_count)
1083
+					if ($layout_info->menu_count)
1084 1084
 					{
1085
-						foreach($layout_info->menu as $menu_id => $menu)
1085
+						foreach ($layout_info->menu as $menu_id => $menu)
1086 1086
 						{
1087 1087
 							// set default menu set(included home menu)
1088
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1088
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1089 1089
 							{
1090 1090
 								$oMenuAdminController = getAdminController('menu');
1091 1091
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1092 1092
 
1093
-								if(FileHandler::exists($homeMenuCacheFile))
1093
+								if (FileHandler::exists($homeMenuCacheFile))
1094 1094
 								{
1095 1095
 									include($homeMenuCacheFile);
1096 1096
 								}
1097 1097
 
1098
-								if(!$menu->menu_srl)
1098
+								if (!$menu->menu_srl)
1099 1099
 								{
1100
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1101
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1100
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1101
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1102 1102
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1103 1103
 								}
1104 1104
 								else
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 							}
1110 1110
 
1111 1111
 							$php_file = FileHandler::exists($menu->php_file);
1112
-							if($php_file)
1112
+							if ($php_file)
1113 1113
 							{
1114 1114
 								include($php_file);
1115 1115
 							}
@@ -1125,17 +1125,17 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 					// If layout was modified, use the modified version
1127 1127
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1128
-					if(file_exists($edited_layout))
1128
+					if (file_exists($edited_layout))
1129 1129
 					{
1130 1130
 						$oModule->setEditedLayoutFile($edited_layout);
1131 1131
 					}
1132 1132
 				}
1133 1133
 			}
1134 1134
 			$isLayoutDrop = Context::get('isLayoutDrop');
1135
-			if($isLayoutDrop)
1135
+			if ($isLayoutDrop)
1136 1136
 			{
1137 1137
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1138
-				if($kind == 'admin')
1138
+				if ($kind == 'admin')
1139 1139
 				{
1140 1140
 					$oModule->setLayoutFile('popup_layout');
1141 1141
 				}
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1174 1174
 	{
1175 1175
 
1176
-		if(__DEBUG__ == 3)
1176
+		if (__DEBUG__ == 3)
1177 1177
 		{
1178 1178
 			$start_time = getMicroTime();
1179 1179
 		}
@@ -1183,51 +1183,51 @@  discard block
 block discarded – undo
1183 1183
 		$type = strtolower($type);
1184 1184
 
1185 1185
 		$kinds = array('svc' => 1, 'admin' => 1);
1186
-		if(!isset($kinds[$kind]))
1186
+		if (!isset($kinds[$kind]))
1187 1187
 		{
1188 1188
 			$kind = 'svc';
1189 1189
 		}
1190 1190
 
1191
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1191
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1192 1192
 
1193
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1193
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1194 1194
 		{
1195 1195
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1196 1196
 		}
1197 1197
 
1198 1198
 		// if there is no instance of the module in global variable, create a new one
1199
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1199
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1200 1200
 		{
1201 1201
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1202 1202
 
1203
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1203
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1204 1204
 			{
1205 1205
 				$module = $parent_module;
1206 1206
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1207 1207
 			}
1208 1208
 
1209 1209
 			// Check if the base class and instance class exist
1210
-			if(!class_exists($module, true))
1210
+			if (!class_exists($module, true))
1211 1211
 			{
1212 1212
 				return NULL;
1213 1213
 			}
1214
-			if(!class_exists($instance_name, true))
1214
+			if (!class_exists($instance_name, true))
1215 1215
 			{
1216 1216
 				return NULL;
1217 1217
 			}
1218 1218
 
1219 1219
 			// Create an instance
1220 1220
 			$oModule = new $instance_name();
1221
-			if(!is_object($oModule))
1221
+			if (!is_object($oModule))
1222 1222
 			{
1223 1223
 				return NULL;
1224 1224
 			}
1225 1225
 
1226 1226
 			// Load language files for the class
1227
-			Context::loadLang($class_path . 'lang');
1228
-			if($extend_module)
1227
+			Context::loadLang($class_path.'lang');
1228
+			if ($extend_module)
1229 1229
 			{
1230
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1230
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1231 1231
 			}
1232 1232
 
1233 1233
 			// Set variables to the instance
@@ -1235,10 +1235,10 @@  discard block
 block discarded – undo
1235 1235
 			$oModule->setModulePath($class_path);
1236 1236
 
1237 1237
 			// If the module has a constructor, run it.
1238
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1238
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1239 1239
 			{
1240 1240
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1241
-				if(@method_exists($oModule, $instance_name))
1241
+				if (@method_exists($oModule, $instance_name))
1242 1242
 				{
1243 1243
 					$oModule->{$instance_name}();
1244 1244
 				}
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1249 1249
 		}
1250 1250
 
1251
-		if(__DEBUG__ == 3)
1251
+		if (__DEBUG__ == 3)
1252 1252
 		{
1253 1253
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1254 1254
 		}
@@ -1264,17 +1264,17 @@  discard block
 block discarded – undo
1264 1264
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1265 1265
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1266 1266
 
1267
-		$types = array('view','controller','model','api','wap','mobile','class');
1268
-		if(!in_array($type, $types))
1267
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1268
+		if (!in_array($type, $types))
1269 1269
 		{
1270 1270
 			$type = $types[0];
1271 1271
 		}
1272
-		if($type == 'class')
1272
+		if ($type == 'class')
1273 1273
 		{
1274 1274
 			$instanceName = '%s';
1275 1275
 			$classFile = '%s%s.%s.php';
1276 1276
 		}
1277
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1277
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1278 1278
 		{
1279 1279
 			$instanceName = '%sAdmin%s';
1280 1280
 			$classFile = '%s%s.admin.%s.php';
@@ -1299,26 +1299,26 @@  discard block
 block discarded – undo
1299 1299
 	function triggerCall($trigger_name, $called_position, &$obj)
1300 1300
 	{
1301 1301
 		// skip if not installed
1302
-		if(!Context::isInstalled())
1302
+		if (!Context::isInstalled())
1303 1303
 		{
1304 1304
 			return new BaseObject();
1305 1305
 		}
1306 1306
 
1307 1307
 		$oModuleModel = getModel('module');
1308 1308
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1309
-		if(!$triggers || count($triggers) < 1)
1309
+		if (!$triggers || count($triggers) < 1)
1310 1310
 		{
1311 1311
 			return new BaseObject();
1312 1312
 		}
1313 1313
 
1314 1314
 		//store before trigger call time
1315 1315
 		$before_trigger_time = NULL;
1316
-		if(__LOG_SLOW_TRIGGER__> 0)
1316
+		if (__LOG_SLOW_TRIGGER__ > 0)
1317 1317
 		{
1318 1318
 			$before_trigger_time = microtime(true);
1319 1319
 		}
1320 1320
 
1321
-		foreach($triggers as $item)
1321
+		foreach ($triggers as $item)
1322 1322
 		{
1323 1323
 			$module = $item->module;
1324 1324
 			$type = $item->type;
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 
1327 1327
 			// todo why don't we call a normal class object ?
1328 1328
 			$oModule = getModule($module, $type);
1329
-			if(!$oModule || !method_exists($oModule, $called_method))
1329
+			if (!$oModule || !method_exists($oModule, $called_method))
1330 1330
 			{
1331 1331
 				continue;
1332 1332
 			}
@@ -1339,12 +1339,12 @@  discard block
 block discarded – undo
1339 1339
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1340 1340
 
1341 1341
 			$slowlog = new stdClass;
1342
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1343
-			$slowlog->called = $module . '.' . $called_method;
1342
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1343
+			$slowlog->called = $module.'.'.$called_method;
1344 1344
 			$slowlog->called_extension = $module;
1345
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1345
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1346 1346
 
1347
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1347
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1348 1348
 			{
1349 1349
 				return $output;
1350 1350
 			}
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
 			'511' => 'Network Authentication Required',
1430 1430
 		);
1431 1431
 		$statusMessage = $statusMessageList[$code];
1432
-		if(!$statusMessage)
1432
+		if (!$statusMessage)
1433 1433
 		{
1434
-			$statusMessage = 'HTTP ' . $code;
1434
+			$statusMessage = 'HTTP '.$code;
1435 1435
 		}
1436 1436
 
1437 1437
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.
classes/module/ModuleObject.class.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 	/**
143 143
 	 * sett to set module information
144
-	 * @param object $module_info object containing module information
144
+	 * @param stdClass $module_info object containing module information
145 145
 	 * @param object $xml_info object containing module description
146 146
 	 * @return void
147 147
 	 * */
@@ -247,6 +247,7 @@  discard block
 block discarded – undo
247 247
 	/**
248 248
 	 * set the file name of the template file
249 249
 	 * @param string name of file
250
+	 * @param string $filename
250 251
 	 * @return void
251 252
 	 * */
252 253
 	function setTemplateFile($filename)
@@ -270,6 +271,7 @@  discard block
 block discarded – undo
270 271
 	/**
271 272
 	 * set the directory path of the template directory
272 273
 	 * @param string path of template directory.
274
+	 * @param string $path
273 275
 	 * @return void
274 276
 	 * */
275 277
 	function setTemplatePath($path)
@@ -325,6 +327,7 @@  discard block
 block discarded – undo
325 327
 	/**
326 328
 	 * set the file name of the layout file
327 329
 	 * @param string name of file
330
+	 * @param string $filename
328 331
 	 * @return void
329 332
 	 * */
330 333
 	function setLayoutFile($filename)
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 * */
45 45
 	function setModulePath($path)
46 46
 	{
47
-		if(substr_compare($path, '/', -1) !== 0)
47
+		if (substr_compare($path, '/', -1) !== 0)
48 48
 		{
49
-			$path.='/';
49
+			$path .= '/';
50 50
 		}
51 51
 		$this->module_path = $path;
52 52
 	}
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	function setRedirectUrl($url = './', $output = NULL)
61 61
 	{
62 62
 		$ajaxRequestMethod = array_flip($this->ajaxRequestMethod);
63
-		if(!isset($ajaxRequestMethod[Context::getRequestMethod()]))
63
+		if (!isset($ajaxRequestMethod[Context::getRequestMethod()]))
64 64
 		{
65 65
 			$this->add('redirect_url', $url);
66 66
 		}
67 67
 
68
-		if($output !== NULL && is_object($output))
68
+		if ($output !== NULL && is_object($output))
69 69
 		{
70 70
 			return $output;
71 71
 		}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$type = $this->get('message_type');
112 112
 		$typeList = array('error' => 1, 'info' => 1, 'update' => 1);
113
-		if(!isset($typeList[$type]))
113
+		if (!isset($typeList[$type]))
114 114
 		{
115 115
 			$type = $this->getError() ? 'error' : 'info';
116 116
 		}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		$oModuleModel = getModel('module');
162 162
 		// permission settings. access, manager(== is_admin) are fixed and privilege name in XE
163 163
 		$module_srl = Context::get('module_srl');
164
-		if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl))
164
+		if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl))
165 165
 		{
166 166
 			$request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
167
-			if($request_module->module_srl == $module_srl)
167
+			if ($request_module->module_srl == $module_srl)
168 168
 			{
169 169
 				$grant = $oModuleModel->getGrant($request_module, $logged_info);
170 170
 			}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		{
174 174
 			$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
175 175
 			// have at least access grant
176
-			if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication'))
176
+			if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication'))
177 177
 			{
178 178
 				$grant->access = 1;
179 179
 			}
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
 		// display no permission if the current module doesn't have an access privilege
182 182
 		//if(!$grant->access) return $this->stop("msg_not_permitted");
183 183
 		// checks permission and action if you don't have an admin privilege
184
-		if(!$grant->manager)
184
+		if (!$grant->manager)
185 185
 		{
186 186
 			// get permission types(guest, member, manager, root) of the currently requested action
187 187
 			$permission_target = $xml_info->permission->{$this->act};
188 188
 			// check manager if a permission in module.xml otherwise action if no permission
189
-			if(!$permission_target && substr_count($this->act, 'Admin'))
189
+			if (!$permission_target && substr_count($this->act, 'Admin'))
190 190
 			{
191 191
 				$permission_target = 'manager';
192 192
 			}
193 193
 			// Check permissions
194
-			switch($permission_target)
194
+			switch ($permission_target)
195 195
 			{
196 196
 				case 'root' :
197 197
 				case 'manager' :
198 198
 					$this->stop('msg_is_not_administrator');
199 199
 					return;
200 200
 				case 'member' :
201
-					if(!$is_logged)
201
+					if (!$is_logged)
202 202
 					{
203 203
 						$this->stop('msg_not_permitted_act');
204 204
 						return;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
 		$this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl);
215 215
 
216
-		if(method_exists($this, 'init'))
216
+		if (method_exists($this, 'init'))
217 217
 		{
218 218
 			$this->init();
219 219
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * */
252 252
 	function setTemplateFile($filename)
253 253
 	{
254
-		if(isset($filename) && substr_compare($filename, '.html', -5) !== 0)
254
+		if (isset($filename) && substr_compare($filename, '.html', -5) !== 0)
255 255
 		{
256 256
 			$filename .= '.html';
257 257
 		}
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 	 * */
275 275
 	function setTemplatePath($path)
276 276
 	{
277
-		if(!$path) return;
277
+		if (!$path) return;
278 278
 
279
-		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
279
+		if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
280 280
 		{
281
-			$path = './' . $path;
281
+			$path = './'.$path;
282 282
 		}
283 283
 
284
-		if(substr_compare($path, '/', -1) !== 0)
284
+		if (substr_compare($path, '/', -1) !== 0)
285 285
 		{
286 286
 			$path .= '/';
287 287
 		}
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 * */
305 305
 	function setEditedLayoutFile($filename)
306 306
 	{
307
-		if(!$filename) return;
307
+		if (!$filename) return;
308 308
 
309
-		if(substr_compare($filename, '.html', -5) !== 0)
309
+		if (substr_compare($filename, '.html', -5) !== 0)
310 310
 		{
311 311
 			$filename .= '.html';
312 312
 		}
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 * */
330 330
 	function setLayoutFile($filename)
331 331
 	{
332
-		if(!$filename) return;
332
+		if (!$filename) return;
333 333
 
334
-		if(substr_compare($filename, '.html', -5) !== 0)
334
+		if (substr_compare($filename, '.html', -5) !== 0)
335 335
 		{
336 336
 			$filename .= '.html';
337 337
 		}
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
 	 * */
354 354
 	function setLayoutPath($path)
355 355
 	{
356
-		if(!$path) return;
356
+		if (!$path) return;
357 357
 
358
-		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
358
+		if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
359 359
 		{
360
-			$path = './' . $path;
360
+			$path = './'.$path;
361 361
 		}
362
-		if(substr_compare($path, '/', -1) !== 0)
362
+		if (substr_compare($path, '/', -1) !== 0)
363 363
 		{
364 364
 			$path .= '/';
365 365
 		}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	function proc()
383 383
 	{
384 384
 		// pass if stop_proc is true
385
-		if($this->stop_proc)
385
+		if ($this->stop_proc)
386 386
 		{
387 387
 			debugPrint($this->message, 'ERROR');
388 388
 			return FALSE;
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
 		// trigger call
392 392
 		$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this);
393
-		if(!$triggerOutput->toBool())
393
+		if (!$triggerOutput->toBool())
394 394
 		{
395 395
 			$this->setError($triggerOutput->getError());
396 396
 			$this->setMessage($triggerOutput->getMessage());
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
 		$called_position = 'before_module_proc';
402 402
 		$oAddonController = getController('addon');
403 403
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
404
-		if(FileHandler::exists($addon_file)) include($addon_file);
404
+		if (FileHandler::exists($addon_file)) include($addon_file);
405 405
 
406
-		if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
406
+		if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
407 407
 		{
408 408
 			// Check permissions
409
-			if($this->module_srl && !$this->grant->access)
409
+			if ($this->module_srl && !$this->grant->access)
410 410
 			{
411 411
 				$this->stop("msg_not_permitted_act");
412 412
 				return FALSE;
@@ -415,21 +415,21 @@  discard block
 block discarded – undo
415 415
 			// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
416 416
 			$is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N'));
417 417
 			$usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET'));
418
-			if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
418
+			if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
419 419
 			{
420 420
 				$dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins';
421 421
 				$valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin';
422 422
 				$oModuleModel = getModel('module');
423 423
 				$skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
424 424
 				$skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType);
425
-				if($this->module == 'page')
425
+				if ($this->module == 'page')
426 426
 				{
427 427
 					$this->module_info->{$valueName} = $skinName;
428 428
 				}
429 429
 				else
430 430
 				{
431 431
 					$isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE);
432
-					if(!$isTemplatPath)
432
+					if (!$isTemplatPath)
433 433
 					{
434 434
 						$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName));
435 435
 					}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		// trigger call
451 451
 		$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
452
-		if(!$triggerOutput->toBool())
452
+		if (!$triggerOutput->toBool())
453 453
 		{
454 454
 			$this->setError($triggerOutput->getError());
455 455
 			$this->setMessage($triggerOutput->getMessage());
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
 		$called_position = 'after_module_proc';
461 461
 		$oAddonController = getController('addon');
462 462
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
463
-		if(FileHandler::exists($addon_file)) include($addon_file);
463
+		if (FileHandler::exists($addon_file)) include($addon_file);
464 464
 
465
-		if(is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject'))
465
+		if (is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject'))
466 466
 		{
467 467
 			$this->setError($output->getError());
468 468
 			$this->setMessage($output->getMessage());
469 469
 
470
-			if(!$output->toBool())
470
+			if (!$output->toBool())
471 471
 			{
472 472
 				return FALSE;
473 473
 			}
474 474
 		}
475 475
 		// execute api methods of the module if view action is and result is XMLRPC or JSON
476
-		if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
476
+		if ($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
477 477
 		{
478
-			if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
478
+			if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
479 479
 			{
480 480
 				$oAPI = getAPI($this->module_info->module, 'api');
481
-				if(method_exists($oAPI, $this->act))
481
+				if (method_exists($oAPI, $this->act))
482 482
 				{
483 483
 					$oAPI->{$this->act}($this);
484 484
 				}
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -168,8 +168,7 @@  discard block
 block discarded – undo
168 168
 			{
169 169
 				$grant = $oModuleModel->getGrant($request_module, $logged_info);
170 170
 			}
171
-		}
172
-		else
171
+		} else
173 172
 		{
174 173
 			$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
175 174
 			// have at least access grant
@@ -274,7 +273,9 @@  discard block
 block discarded – undo
274 273
 	 * */
275 274
 	function setTemplatePath($path)
276 275
 	{
277
-		if(!$path) return;
276
+		if(!$path) {
277
+			return;
278
+		}
278 279
 
279 280
 		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
280 281
 		{
@@ -304,7 +305,9 @@  discard block
 block discarded – undo
304 305
 	 * */
305 306
 	function setEditedLayoutFile($filename)
306 307
 	{
307
-		if(!$filename) return;
308
+		if(!$filename) {
309
+			return;
310
+		}
308 311
 
309 312
 		if(substr_compare($filename, '.html', -5) !== 0)
310 313
 		{
@@ -329,7 +332,9 @@  discard block
 block discarded – undo
329 332
 	 * */
330 333
 	function setLayoutFile($filename)
331 334
 	{
332
-		if(!$filename) return;
335
+		if(!$filename) {
336
+			return;
337
+		}
333 338
 
334 339
 		if(substr_compare($filename, '.html', -5) !== 0)
335 340
 		{
@@ -353,7 +358,9 @@  discard block
 block discarded – undo
353 358
 	 * */
354 359
 	function setLayoutPath($path)
355 360
 	{
356
-		if(!$path) return;
361
+		if(!$path) {
362
+			return;
363
+		}
357 364
 
358 365
 		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
359 366
 		{
@@ -401,7 +408,9 @@  discard block
 block discarded – undo
401 408
 		$called_position = 'before_module_proc';
402 409
 		$oAddonController = getController('addon');
403 410
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
404
-		if(FileHandler::exists($addon_file)) include($addon_file);
411
+		if(FileHandler::exists($addon_file)) {
412
+			include($addon_file);
413
+		}
405 414
 
406 415
 		if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
407 416
 		{
@@ -425,8 +434,7 @@  discard block
 block discarded – undo
425 434
 				if($this->module == 'page')
426 435
 				{
427 436
 					$this->module_info->{$valueName} = $skinName;
428
-				}
429
-				else
437
+				} else
430 438
 				{
431 439
 					$isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE);
432 440
 					if(!$isTemplatPath)
@@ -441,8 +449,7 @@  discard block
 block discarded – undo
441 449
 			Context::set('module_info', $this->module_info);
442 450
 			// Run
443 451
 			$output = $this->{$this->act}();
444
-		}
445
-		else
452
+		} else
446 453
 		{
447 454
 			return FALSE;
448 455
 		}
@@ -460,7 +467,9 @@  discard block
 block discarded – undo
460 467
 		$called_position = 'after_module_proc';
461 468
 		$oAddonController = getController('addon');
462 469
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
463
-		if(FileHandler::exists($addon_file)) include($addon_file);
470
+		if(FileHandler::exists($addon_file)) {
471
+			include($addon_file);
472
+		}
464 473
 
465 474
 		if(is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject'))
466 475
 		{
Please login to merge, or discard this patch.
classes/security/EmbedFilter.class.php 3 patches
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -295,6 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 	/**
297 297
 	 * Check the content.
298
+	 * @param string $content
298 299
 	 * @return void
299 300
 	 */
300 301
 	function check(&$content)
@@ -487,7 +488,7 @@  discard block
 block discarded – undo
487 488
 
488 489
 	/**
489 490
 	 * Check white domain in object data attribute or embed src attribute.
490
-	 * @return string
491
+	 * @return boolean
491 492
 	 */
492 493
 	function isWhiteDomain($urlAttribute)
493 494
 	{
@@ -506,7 +507,7 @@  discard block
 block discarded – undo
506 507
 
507 508
 	/**
508 509
 	 * Check white domain in iframe src attribute.
509
-	 * @return string
510
+	 * @return boolean
510 511
 	 */
511 512
 	function isWhiteIframeDomain($urlAttribute)
512 513
 	{
@@ -525,7 +526,7 @@  discard block
 block discarded – undo
525 526
 
526 527
 	/**
527 528
 	 * Check white mime type in object type attribute or embed type attribute.
528
-	 * @return string
529
+	 * @return boolean
529 530
 	 */
530 531
 	function isWhiteMimetype($mimeType)
531 532
 	{
@@ -590,7 +591,7 @@  discard block
 block discarded – undo
590 591
 
591 592
 	/**
592 593
 	 * Make white domain list cache file from xml config file.
593
-	 * @param $whitelist array
594
+	 * @param stdClass $whitelist array
594 595
 	 * @return void
595 596
 	 */
596 597
 	function _makeWhiteDomainList($whitelist = NULL)
Please login to merge, or discard this patch.
Braces   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -563,14 +563,12 @@  discard block
 block discarded – undo
563 563
 				}
564 564
 				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
565 565
 			}
566
-		}
567
-		else if($m[1] == 'embed')
566
+		} else if($m[1] == 'embed')
568 567
 		{
569 568
 			if(stripos($m[0], 'allowscriptaccess'))
570 569
 			{
571 570
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
572
-			}
573
-			else
571
+			} else
574 572
 			{
575 573
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
576 574
 			}
@@ -627,8 +625,7 @@  discard block
 block discarded – undo
627 625
 			{
628 626
 				$whiteUrlList = $whitelist->object;
629 627
 				$whiteIframeUrlList = $whitelist->iframe;
630
-			}
631
-			else
628
+			} else
632 629
 			{
633 630
 				$xmlBuff = FileHandler::readFile($this->whiteUrlXmlFile);
634 631
 
@@ -636,8 +633,12 @@  discard block
 block discarded – undo
636 633
 				$domainListObj = $xmlParser->parse($xmlBuff);
637 634
 				$embedDomainList = $domainListObj->whiteurl->embed->domain;
638 635
 				$iframeDomainList = $domainListObj->whiteurl->iframe->domain;
639
-				if(!is_array($embedDomainList)) $embedDomainList = array();
640
-				if(!is_array($iframeDomainList)) $iframeDomainList = array();
636
+				if(!is_array($embedDomainList)) {
637
+					$embedDomainList = array();
638
+				}
639
+				if(!is_array($iframeDomainList)) {
640
+					$iframeDomainList = array();
641
+				}
641 642
 
642 643
 				foreach($embedDomainList AS $key => $value)
643 644
 				{
@@ -648,8 +649,7 @@  discard block
 block discarded – undo
648 649
 						{
649 650
 							$whiteUrlList[] = $value->body;
650 651
 						}
651
-					}
652
-					else
652
+					} else
653 653
 					{
654 654
 						$whiteUrlList[] = $patternList->body;
655 655
 					}
@@ -664,8 +664,7 @@  discard block
 block discarded – undo
664 664
 						{
665 665
 							$whiteIframeUrlList[] = $value->body;
666 666
 						}
667
-					}
668
-					else
667
+					} else
669 668
 					{
670 669
 						$whiteIframeUrlList[] = $patternList->body;
671 670
 					}
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 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
-include _XE_PATH_ . 'classes/security/phphtmlparser/src/htmlparser.inc';
4
+include _XE_PATH_.'classes/security/phphtmlparser/src/htmlparser.inc';
5 5
 
6 6
 class EmbedFilter
7 7
 {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	function getInstance()
278 278
 	{
279
-		if(!isset($GLOBALS['__EMBEDFILTER_INSTANCE__']))
279
+		if (!isset($GLOBALS['__EMBEDFILTER_INSTANCE__']))
280 280
 		{
281 281
 			$GLOBALS['__EMBEDFILTER_INSTANCE__'] = new EmbedFilter();
282 282
 		}
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 	{
317 317
 		preg_match_all('/<\s*object\s*[^>]+(?:\/?>?)/is', $content, $m);
318 318
 		$objectTagList = $m[0];
319
-		if($objectTagList)
319
+		if ($objectTagList)
320 320
 		{
321
-			foreach($objectTagList AS $key => $objectTag)
321
+			foreach ($objectTagList AS $key => $objectTag)
322 322
 			{
323 323
 				$isWhiteDomain = true;
324 324
 				$isWhiteMimetype = true;
@@ -326,21 +326,21 @@  discard block
 block discarded – undo
326 326
 				$ext = '';
327 327
 
328 328
 				$parser = new HtmlParser($objectTag);
329
-				while($parser->parse())
329
+				while ($parser->parse())
330 330
 				{
331
-					if(is_array($parser->iNodeAttributes))
331
+					if (is_array($parser->iNodeAttributes))
332 332
 					{
333
-						foreach($parser->iNodeAttributes AS $attrName => $attrValue)
333
+						foreach ($parser->iNodeAttributes AS $attrName => $attrValue)
334 334
 						{
335 335
 							// data url check
336
-							if($attrValue && strtolower($attrName) == 'data')
336
+							if ($attrValue && strtolower($attrName) == 'data')
337 337
 							{
338 338
 								$ext = strtolower(substr(strrchr($attrValue, "."), 1));
339 339
 								$isWhiteDomain = $this->isWhiteDomain($attrValue);
340 340
 							}
341 341
 
342 342
 							// mime type check
343
-							if(strtolower($attrName) == 'type' && $attrValue)
343
+							if (strtolower($attrName) == 'type' && $attrValue)
344 344
 							{
345 345
 								$isWhiteMimetype = $this->isWhiteMimetype($attrValue);
346 346
 							}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 					}
349 349
 				}
350 350
 
351
-				if(!$isWhiteDomain || !$isWhiteMimetype)
351
+				if (!$isWhiteDomain || !$isWhiteMimetype)
352 352
 				{
353 353
 					$content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
354 354
 				}
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 	{
365 365
 		preg_match_all('/<\s*embed\s*[^>]+(?:\/?>?)/is', $content, $m);
366 366
 		$embedTagList = $m[0];
367
-		if($embedTagList)
367
+		if ($embedTagList)
368 368
 		{
369
-			foreach($embedTagList AS $key => $embedTag)
369
+			foreach ($embedTagList AS $key => $embedTag)
370 370
 			{
371 371
 				$isWhiteDomain = TRUE;
372 372
 				$isWhiteMimetype = TRUE;
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
 				$ext = '';
375 375
 
376 376
 				$parser = new HtmlParser($embedTag);
377
-				while($parser->parse())
377
+				while ($parser->parse())
378 378
 				{
379
-					if(is_array($parser->iNodeAttributes))
379
+					if (is_array($parser->iNodeAttributes))
380 380
 					{
381
-						foreach($parser->iNodeAttributes AS $attrName => $attrValue)
381
+						foreach ($parser->iNodeAttributes AS $attrName => $attrValue)
382 382
 						{
383 383
 							// src url check
384
-							if($attrValue && strtolower($attrName) == 'src')
384
+							if ($attrValue && strtolower($attrName) == 'src')
385 385
 							{
386 386
 								$ext = strtolower(substr(strrchr($attrValue, "."), 1));
387 387
 								$isWhiteDomain = $this->isWhiteDomain($attrValue);
388 388
 							}
389 389
 
390 390
 							// mime type check
391
-							if(strtolower($attrName) == 'type' && $attrValue)
391
+							if (strtolower($attrName) == 'type' && $attrValue)
392 392
 							{
393 393
 								$isWhiteMimetype = $this->isWhiteMimetype($attrValue);
394 394
 							}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 					}
397 397
 				}
398 398
 
399
-				if(!$isWhiteDomain || !$isWhiteMimetype)
399
+				if (!$isWhiteDomain || !$isWhiteMimetype)
400 400
 				{
401 401
 					$content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
402 402
 				}
@@ -415,22 +415,22 @@  discard block
 block discarded – undo
415 415
 
416 416
 		preg_match_all('/<\s*iframe\s*[^>]+(?:\/?>?)/is', $content, $m);
417 417
 		$iframeTagList = $m[0];
418
-		if($iframeTagList)
418
+		if ($iframeTagList)
419 419
 		{
420
-			foreach($iframeTagList AS $key => $iframeTag)
420
+			foreach ($iframeTagList AS $key => $iframeTag)
421 421
 			{
422 422
 				$isWhiteDomain = TRUE;
423 423
 				$ext = '';
424 424
 
425 425
 				$parser = new HtmlParser($iframeTag);
426
-				while($parser->parse())
426
+				while ($parser->parse())
427 427
 				{
428
-					if(is_array($parser->iNodeAttributes))
428
+					if (is_array($parser->iNodeAttributes))
429 429
 					{
430
-						foreach($parser->iNodeAttributes AS $attrName => $attrValue)
430
+						foreach ($parser->iNodeAttributes AS $attrName => $attrValue)
431 431
 						{
432 432
 							// src url check
433
-							if(strtolower($attrName) == 'src' && $attrValue)
433
+							if (strtolower($attrName) == 'src' && $attrValue)
434 434
 							{
435 435
 								$ext = strtolower(substr(strrchr($attrValue, "."), 1));
436 436
 								$isWhiteDomain = $this->isWhiteIframeDomain($attrValue);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 					}
440 440
 				}
441 441
 
442
-				if(!$isWhiteDomain)
442
+				if (!$isWhiteDomain)
443 443
 				{
444 444
 					$content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
445 445
 				}
@@ -455,26 +455,26 @@  discard block
 block discarded – undo
455 455
 	{
456 456
 		preg_match_all('/<\s*param\s*[^>]+(?:\/?>?)/is', $content, $m);
457 457
 		$paramTagList = $m[0];
458
-		if($paramTagList)
458
+		if ($paramTagList)
459 459
 		{
460
-			foreach($paramTagList AS $key => $paramTag)
460
+			foreach ($paramTagList AS $key => $paramTag)
461 461
 			{
462 462
 				$isWhiteDomain = TRUE;
463 463
 				$isWhiteExt = TRUE;
464 464
 				$ext = '';
465 465
 
466 466
 				$parser = new HtmlParser($paramTag);
467
-				while($parser->parse())
467
+				while ($parser->parse())
468 468
 				{
469
-					if($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value'])
469
+					if ($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value'])
470 470
 					{
471 471
 						$name = strtolower($parser->iNodeAttributes['name']);
472
-						if($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source')
472
+						if ($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source')
473 473
 						{
474 474
 							$ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1));
475 475
 							$isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']);
476 476
 
477
-							if(!$isWhiteDomain)
477
+							if (!$isWhiteDomain)
478 478
 							{
479 479
 								$content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
480 480
 							}
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 	 */
492 492
 	function isWhiteDomain($urlAttribute)
493 493
 	{
494
-		if(is_array($this->whiteUrlList))
494
+		if (is_array($this->whiteUrlList))
495 495
 		{
496
-			foreach($this->whiteUrlList AS $key => $value)
496
+			foreach ($this->whiteUrlList AS $key => $value)
497 497
 			{
498
-				if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute))
498
+				if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute))
499 499
 				{
500 500
 					return TRUE;
501 501
 				}
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 */
511 511
 	function isWhiteIframeDomain($urlAttribute)
512 512
 	{
513
-		if(is_array($this->whiteIframeUrlList))
513
+		if (is_array($this->whiteIframeUrlList))
514 514
 		{
515
-			foreach($this->whiteIframeUrlList AS $key => $value)
515
+			foreach ($this->whiteIframeUrlList AS $key => $value)
516 516
 			{
517
-				if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute))
517
+				if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute))
518 518
 				{
519 519
 					return TRUE;
520 520
 				}
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 */
530 530
 	function isWhiteMimetype($mimeType)
531 531
 	{
532
-		if(isset($this->mimeTypeList[$mimeType]))
532
+		if (isset($this->mimeTypeList[$mimeType]))
533 533
 		{
534 534
 			return TRUE;
535 535
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
 	function isWhiteExt($ext)
540 540
 	{
541
-		if(isset($this->extList[$ext]))
541
+		if (isset($this->extList[$ext]))
542 542
 		{
543 543
 			return TRUE;
544 544
 		}
@@ -547,26 +547,26 @@  discard block
 block discarded – undo
547 547
 
548 548
 	function _checkAllowScriptAccess($m)
549 549
 	{
550
-		if($m[1] == 'object')
550
+		if ($m[1] == 'object')
551 551
 		{
552 552
 			$this->allowscriptaccessList[] = 1;
553 553
 		}
554 554
 
555
-		if($m[1] == 'param')
555
+		if ($m[1] == 'param')
556 556
 		{
557
-			if(stripos($m[0], 'allowscriptaccess'))
557
+			if (stripos($m[0], 'allowscriptaccess'))
558 558
 			{
559 559
 				$m[0] = '<param name="allowscriptaccess" value="never"';
560
-				if(substr($m[0], -1) == '/')
560
+				if (substr($m[0], -1) == '/')
561 561
 				{
562 562
 					$m[0] .= '/';
563 563
 				}
564 564
 				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
565 565
 			}
566 566
 		}
567
-		else if($m[1] == 'embed')
567
+		else if ($m[1] == 'embed')
568 568
 		{
569
-			if(stripos($m[0], 'allowscriptaccess'))
569
+			if (stripos($m[0], 'allowscriptaccess'))
570 570
 			{
571 571
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
572 572
 			}
@@ -580,9 +580,9 @@  discard block
 block discarded – undo
580 580
 
581 581
 	function _addAllowScriptAccess($m)
582 582
 	{
583
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
583
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
584 584
 		{
585
-			$m[0] = $m[0] . '<param name="allowscriptaccess" value="never"></param>';
585
+			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
586 586
 		}
587 587
 		$this->allowscriptaccessKey++;
588 588
 		return $m[0];
@@ -599,31 +599,31 @@  discard block
 block discarded – undo
599 599
 		$whiteUrlCacheFile = FileHandler::getRealPath($this->whiteUrlCacheFile);
600 600
 
601 601
 		$isMake = FALSE;
602
-		if(!file_exists($whiteUrlCacheFile))
602
+		if (!file_exists($whiteUrlCacheFile))
603 603
 		{
604 604
 			$isMake = TRUE;
605 605
 		}
606
-		if(file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile))
606
+		if (file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile))
607 607
 		{
608 608
 			$isMake = TRUE;
609 609
 		}
610 610
 
611
-		if(gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array')
611
+		if (gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array')
612 612
 		{
613 613
 			$isMake = FALSE;
614 614
 		}
615 615
 
616
-		if(isset($whitelist) && gettype($whitelist) == 'object')
616
+		if (isset($whitelist) && gettype($whitelist) == 'object')
617 617
 		{
618 618
 			$isMake = TRUE;
619 619
 		}
620 620
 
621
-		if($isMake)
621
+		if ($isMake)
622 622
 		{
623 623
 			$whiteUrlList = array();
624 624
 			$whiteIframeUrlList = array();
625 625
 
626
-			if(gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array')
626
+			if (gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array')
627 627
 			{
628 628
 				$whiteUrlList = $whitelist->object;
629 629
 				$whiteIframeUrlList = $whitelist->iframe;
@@ -636,15 +636,15 @@  discard block
 block discarded – undo
636 636
 				$domainListObj = $xmlParser->parse($xmlBuff);
637 637
 				$embedDomainList = $domainListObj->whiteurl->embed->domain;
638 638
 				$iframeDomainList = $domainListObj->whiteurl->iframe->domain;
639
-				if(!is_array($embedDomainList)) $embedDomainList = array();
640
-				if(!is_array($iframeDomainList)) $iframeDomainList = array();
639
+				if (!is_array($embedDomainList)) $embedDomainList = array();
640
+				if (!is_array($iframeDomainList)) $iframeDomainList = array();
641 641
 
642
-				foreach($embedDomainList AS $key => $value)
642
+				foreach ($embedDomainList AS $key => $value)
643 643
 				{
644 644
 					$patternList = $value->pattern;
645
-					if(is_array($patternList))
645
+					if (is_array($patternList))
646 646
 					{
647
-						foreach($patternList AS $key => $value)
647
+						foreach ($patternList AS $key => $value)
648 648
 						{
649 649
 							$whiteUrlList[] = $value->body;
650 650
 						}
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 					}
656 656
 				}
657 657
 
658
-				foreach($iframeDomainList AS $key => $value)
658
+				foreach ($iframeDomainList AS $key => $value)
659 659
 				{
660 660
 					$patternList = $value->pattern;
661
-					if(is_array($patternList))
661
+					if (is_array($patternList))
662 662
 					{
663
-						foreach($patternList AS $key => $value)
663
+						foreach ($patternList AS $key => $value)
664 664
 						{
665 665
 							$whiteIframeUrlList[] = $value->body;
666 666
 						}
@@ -674,12 +674,12 @@  discard block
 block discarded – undo
674 674
 
675 675
 			$db_info = Context::getDBInfo();
676 676
 
677
-			if($db_info->embed_white_object)
677
+			if ($db_info->embed_white_object)
678 678
 			{
679 679
 				$whiteUrlList = array_merge($whiteUrlList, $db_info->embed_white_object);
680 680
 			}
681 681
 
682
-			if($db_info->embed_white_iframe)
682
+			if ($db_info->embed_white_iframe)
683 683
 			{
684 684
 				$whiteIframeUrlList = array_merge($whiteIframeUrlList, $db_info->embed_white_iframe);
685 685
 			}
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 
692 692
 			$buff = array();
693 693
 			$buff[] = '<?php if(!defined("__XE__")) exit();';
694
-			$buff[] = '$whiteUrlList = ' . var_export($whiteUrlList, TRUE) . ';';
695
-			$buff[] = '$whiteIframeUrlList = ' . var_export($whiteIframeUrlList, TRUE) . ';';
694
+			$buff[] = '$whiteUrlList = '.var_export($whiteUrlList, TRUE).';';
695
+			$buff[] = '$whiteIframeUrlList = '.var_export($whiteIframeUrlList, TRUE).';';
696 696
 
697 697
 			FileHandler::writeFile($this->whiteUrlCacheFile, implode(PHP_EOL, $buff));
698 698
 		}
Please login to merge, or discard this patch.