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 ( 636838...8041ee )
by gyeong-won
06:25
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   +179 added lines, -179 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,29 +229,29 @@  discard block
 block discarded – undo
229 229
 			$urlInfo = parse_url($url);
230 230
 			$host = $urlInfo['host'];
231 231
 
232
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
232
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
233 233
 			{
234 234
 				throw new Exception('msg_default_url_is_null');
235 235
 			}
236 236
 		}
237 237
 
238
-		if(!$this->document_srl && $this->mid && $this->entry)
238
+		if (!$this->document_srl && $this->mid && $this->entry)
239 239
 		{
240 240
 			$oDocumentModel = getModel('document');
241 241
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
242
-			if($this->document_srl)
242
+			if ($this->document_srl)
243 243
 			{
244 244
 				Context::set('document_srl', $this->document_srl);
245 245
 			}
246 246
 		}
247 247
 
248 248
 		// Get module's information based on document_srl, if it's specified
249
-		if($this->document_srl)
249
+		if ($this->document_srl)
250 250
 		{
251 251
 
252 252
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
253 253
 			// If the document does not exist, remove document_srl
254
-			if(!$module_info)
254
+			if (!$module_info)
255 255
 			{
256 256
 				unset($this->document_srl);
257 257
 			}
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 			{
260 260
 				// If it exists, compare mid based on the module information
261 261
 				// if mids are not matching, set it as the document's mid
262
-				if(!$this->mid || ($this->mid != $module_info->mid))
262
+				if (!$this->mid || ($this->mid != $module_info->mid))
263 263
 				{
264 264
 
265
-					if(Context::getRequestMethod() == 'GET')
265
+					if (Context::getRequestMethod() == 'GET')
266 266
 					{
267 267
 						$this->mid = $module_info->mid;
268
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
268
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
269 269
 						return FALSE;
270 270
 					}
271 271
 					else
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 				}
278 278
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
279
-				if($this->module && $module_info->module != $this->module)
279
+				if ($this->module && $module_info->module != $this->module)
280 280
 				{
281 281
 					unset($module_info);
282 282
 				}
@@ -285,36 +285,36 @@  discard block
 block discarded – undo
285 285
 		}
286 286
 
287 287
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
288
-		if(!$module_info && $this->mid)
288
+		if (!$module_info && $this->mid)
289 289
 		{
290 290
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
291 291
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
292 292
 		}
293 293
 
294 294
 		// redirect, if module_site_srl and site_srl are different
295
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
295
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
296 296
 		{
297 297
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
298
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
298
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
299 299
 			return FALSE;
300 300
 		}
301 301
 
302 302
 		// If module_info is not set still, and $module does not exist, find the default module
303
-		if(!$module_info && !$this->module && !$this->mid)
303
+		if (!$module_info && !$this->module && !$this->mid)
304 304
 		{
305 305
 			$module_info = $site_module_info;
306 306
 		}
307 307
 
308
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
308
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
309 309
 		{
310 310
 			$module_info = $site_module_info;
311 311
 		}
312 312
 
313 313
 		// redirect, if site_srl of module_info is different from one of site's module_info
314
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
314
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
315 315
 		{
316 316
 			// If the module is of virtual site
317
-			if($module_info->site_srl)
317
+			if ($module_info->site_srl)
318 318
 			{
319 319
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
320 320
 				$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'));
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			else
324 324
 			{
325 325
 				$db_info = Context::getDBInfo();
326
-				if(!$db_info->default_url)
326
+				if (!$db_info->default_url)
327 327
 				{
328 328
 					return Context::getLang('msg_default_url_is_not_defined');
329 329
 				}
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 					$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'));
333 333
 				}
334 334
 			}
335
-			header("location:" . $redirect_url);
335
+			header("location:".$redirect_url);
336 336
 			return FALSE;
337 337
 		}
338 338
 
339 339
 		// If module info was set, retrieve variables from the module information
340
-		if($module_info)
340
+		if ($module_info)
341 341
 		{
342 342
 			$this->module = $module_info->module;
343 343
 			$this->mid = $module_info->mid;
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
349 349
 
350 350
 			// use the site default layout.
351
-			if($module_info->{$targetSrl} == -1)
351
+			if ($module_info->{$targetSrl} == -1)
352 352
 			{
353 353
 				$oLayoutAdminModel = getAdminModel('layout');
354 354
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		}
367 367
 
368 368
 		// Set module and mid into module_info
369
-		if(!isset($this->module_info))
369
+		if (!isset($this->module_info))
370 370
 		{
371 371
 			$this->module_info = new stdClass();
372 372
 		}
@@ -377,21 +377,21 @@  discard block
 block discarded – undo
377 377
 		$this->module_info->site_srl = $site_module_info->site_srl;
378 378
 
379 379
 		// Still no module? it's an error
380
-		if(!$this->module)
380
+		if (!$this->module)
381 381
 		{
382 382
 			$this->error = 'msg_module_is_not_exists';
383 383
 			$this->httpStatusCode = '404';
384 384
 		}
385 385
 
386 386
 		// If mid exists, set mid into context
387
-		if($this->mid)
387
+		if ($this->mid)
388 388
 		{
389 389
 			Context::set('mid', $this->mid, TRUE);
390 390
 		}
391 391
 
392 392
 		// Call a trigger after moduleHandler init
393 393
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
394
-		if(!$output->toBool())
394
+		if (!$output->toBool())
395 395
 		{
396 396
 			$this->error = $output->getMessage();
397 397
 			return TRUE;
@@ -413,14 +413,14 @@  discard block
 block discarded – undo
413 413
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
414 414
 
415 415
 		// If error occurred while preparation, return a message instance
416
-		if($this->error)
416
+		if ($this->error)
417 417
 		{
418 418
 			$this->_setInputErrorToContext();
419 419
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
420 420
 			$oMessageObject->setError(-1);
421 421
 			$oMessageObject->setMessage($this->error);
422 422
 			$oMessageObject->dispMessage();
423
-			if($this->httpStatusCode)
423
+			if ($this->httpStatusCode)
424 424
 			{
425 425
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
426 426
 			}
@@ -431,22 +431,22 @@  discard block
 block discarded – undo
431 431
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
432 432
 
433 433
 		// If not installed yet, modify act
434
-		if($this->module == "install")
434
+		if ($this->module == "install")
435 435
 		{
436
-			if(!$this->act || !$xml_info->action->{$this->act})
436
+			if (!$this->act || !$xml_info->action->{$this->act})
437 437
 			{
438 438
 				$this->act = $xml_info->default_index_act;
439 439
 			}
440 440
 		}
441 441
 
442 442
 		// if act exists, find type of the action, if not use default index act
443
-		if(!$this->act)
443
+		if (!$this->act)
444 444
 		{
445 445
 			$this->act = $xml_info->default_index_act;
446 446
 		}
447 447
 
448 448
 		// still no act means error
449
-		if(!$this->act)
449
+		if (!$this->act)
450 450
 		{
451 451
 			$this->error = 'msg_module_is_not_exists';
452 452
 			$this->httpStatusCode = '404';
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$oMessageObject->setError(-1);
457 457
 			$oMessageObject->setMessage($this->error);
458 458
 			$oMessageObject->dispMessage();
459
-			if($this->httpStatusCode)
459
+			if ($this->httpStatusCode)
460 460
 			{
461 461
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
462 462
 			}
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
 			Context::addMetaTag('robots', 'noindex');
475 475
 		}
476 476
 
477
-		if(!$kind && $this->module == 'admin')
477
+		if (!$kind && $this->module == 'admin')
478 478
 		{
479 479
 			$kind = 'admin';
480 480
 		}
481 481
 
482 482
 		// check REQUEST_METHOD in controller
483
-		if($type == 'controller')
483
+		if ($type == 'controller')
484 484
 		{
485 485
 			$allowedMethod = $xml_info->action->{$this->act}->method;
486 486
 
487
-			if(!$allowedMethod)
487
+			if (!$allowedMethod)
488 488
 			{
489 489
 				$allowedMethodList[0] = 'POST';
490 490
 			}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
494 494
 			}
495 495
 
496
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
496
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
497 497
 			{
498 498
 				$this->error = "msg_invalid_request";
499 499
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			}
505 505
 		}
506 506
 
507
-		if($this->module_info->use_mobile != "Y")
507
+		if ($this->module_info->use_mobile != "Y")
508 508
 		{
509 509
 			Mobile::setMobile(FALSE);
510 510
 		}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
 		// check CSRF for non-GET actions
515 515
 		$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
516
-		if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
516
+		if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
517 517
 		{
518 518
 			$this->error = 'msg_invalid_request';
519 519
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		}
525 525
 
526 526
 		// Admin ip
527
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
527
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
528 528
 		{
529 529
 			$this->_setInputErrorToContext();
530 530
 			$this->error = "msg_not_permitted_act";
@@ -536,13 +536,13 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		// if(type == view, and case for using mobilephone)
539
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
539
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
540 540
 		{
541 541
 			$orig_type = "view";
542 542
 			$type = "mobile";
543 543
 			// create a module instance
544 544
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
545
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
545
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
546 546
 			{
547 547
 				$type = $orig_type;
548 548
 				Mobile::setMobile(FALSE);
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
556 556
 		}
557 557
 
558
-		if(!is_object($oModule))
558
+		if (!is_object($oModule))
559 559
 		{
560 560
 			$this->_setInputErrorToContext();
561 561
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
562 562
 			$oMessageObject->setError(-1);
563 563
 			$oMessageObject->setMessage($this->error);
564 564
 			$oMessageObject->dispMessage();
565
-			if($this->httpStatusCode)
565
+			if ($this->httpStatusCode)
566 566
 			{
567 567
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
568 568
 			}
@@ -570,10 +570,10 @@  discard block
 block discarded – undo
570 570
 		}
571 571
 
572 572
 		// If there is no such action in the module object
573
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
573
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
574 574
 		{
575 575
 
576
-			if(!Context::isInstalled())
576
+			if (!Context::isInstalled())
577 577
 			{
578 578
 				$this->_setInputErrorToContext();
579 579
 				$this->error = 'msg_invalid_request';
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 				$oMessageObject->setError(-1);
582 582
 				$oMessageObject->setMessage($this->error);
583 583
 				$oMessageObject->dispMessage();
584
-				if($this->httpStatusCode)
584
+				if ($this->httpStatusCode)
585 585
 				{
586 586
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
587 587
 				}
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 
591 591
 			$forward = NULL;
592 592
 			// 1. Look for the module with action name
593
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
593
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
594 594
 			{
595
-				$module = strtolower($matches[2] . $matches[3]);
595
+				$module = strtolower($matches[2].$matches[3]);
596 596
 				$xml_info = $oModuleModel->getModuleActionXml($module);
597 597
 
598
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
598
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
599 599
 				{
600 600
 					$forward = new stdClass();
601 601
 					$forward->module = $module;
@@ -616,12 +616,12 @@  discard block
 block discarded – undo
616 616
 				}
617 617
 			}
618 618
 
619
-			if(!$forward)
619
+			if (!$forward)
620 620
 			{
621 621
 				$forward = $oModuleModel->getActionForward($this->act);
622 622
 			}
623 623
 
624
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
624
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
625 625
 			{
626 626
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
627 627
 				$type = $forward->type;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 				$tpl_path = $oModule->getTemplatePath();
630 630
 				$orig_module = $oModule;
631 631
 
632
-				if($forward->meta_noindex === 'true') {
632
+				if ($forward->meta_noindex === 'true') {
633 633
 					Context::addMetaTag('robots', 'noindex');
634 634
 				}
635 635
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
 				// check CSRF for non-GET actions
639 639
 				$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
640
-				if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
640
+				if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
641 641
 				{
642 642
 					$this->error = 'msg_invalid_request';
643 643
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
 
650 650
 				// SECISSUE also check foward act method
651 651
 				// check REQUEST_METHOD in controller
652
-				if($type == 'controller')
652
+				if ($type == 'controller')
653 653
 				{
654 654
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
655 655
 
656
-					if(!$allowedMethod)
656
+					if (!$allowedMethod)
657 657
 					{
658 658
 						$allowedMethodList[0] = 'POST';
659 659
 					}
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
663 663
 					}
664 664
 
665
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
665
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
666 666
 					{
667 667
 						$this->error = "msg_invalid_request";
668 668
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -673,13 +673,13 @@  discard block
 block discarded – undo
673 673
 					}
674 674
 				}
675 675
 
676
-				if($type == "view" && Mobile::isFromMobilePhone())
676
+				if ($type == "view" && Mobile::isFromMobilePhone())
677 677
 				{
678 678
 					$orig_type = "view";
679 679
 					$type = "mobile";
680 680
 					// create a module instance
681 681
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
682
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
682
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
683 683
 					{
684 684
 						$type = $orig_type;
685 685
 						Mobile::setMobile(FALSE);
@@ -691,25 +691,25 @@  discard block
 block discarded – undo
691 691
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
692 692
 				}
693 693
 
694
-				if(!is_object($oModule))
694
+				if (!is_object($oModule))
695 695
 				{
696 696
 					$this->_setInputErrorToContext();
697 697
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
698 698
 					$oMessageObject->setError(-1);
699 699
 					$oMessageObject->setMessage('msg_module_is_not_exists');
700 700
 					$oMessageObject->dispMessage();
701
-					if($this->httpStatusCode)
701
+					if ($this->httpStatusCode)
702 702
 					{
703 703
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
704 704
 					}
705 705
 					return $oMessageObject;
706 706
 				}
707 707
 
708
-				if($this->module == "admin" && $type == "view")
708
+				if ($this->module == "admin" && $type == "view")
709 709
 				{
710
-					if($logged_info->is_admin == 'Y')
710
+					if ($logged_info->is_admin == 'Y')
711 711
 					{
712
-						if($this->act != 'dispLayoutAdminLayoutModify')
712
+						if ($this->act != 'dispLayoutAdminLayoutModify')
713 713
 						{
714 714
 							$oAdminView = getAdminView('admin');
715 715
 							$oAdminView->makeGnbUrl($forward->module);
@@ -729,10 +729,10 @@  discard block
 block discarded – undo
729 729
 						return $oMessageObject;
730 730
 					}
731 731
 				}
732
-				if($kind == 'admin')
732
+				if ($kind == 'admin')
733 733
 				{
734 734
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
735
-					if(!$grant->manager)
735
+					if (!$grant->manager)
736 736
 					{
737 737
 						$this->_setInputErrorToContext();
738 738
 						$this->error = 'msg_is_not_manager';
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 					}
745 745
 					else
746 746
 					{
747
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
747
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
748 748
 						{
749 749
 							$this->_setInputErrorToContext();
750 750
 							$this->error = 'msg_is_not_administrator';
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 					}
758 758
 				}
759 759
 			}
760
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
760
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
761 761
 			{
762 762
 				$this->act = $xml_info->default_index_act;
763 763
 			}
@@ -771,16 +771,16 @@  discard block
 block discarded – undo
771 771
 		}
772 772
 
773 773
 		// ruleset check...
774
-		if(!empty($ruleset))
774
+		if (!empty($ruleset))
775 775
 		{
776 776
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
777 777
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
778
-			if(!empty($rulesetFile))
778
+			if (!empty($rulesetFile))
779 779
 			{
780
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
780
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
781 781
 				{
782 782
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
783
-					foreach($errorLang as $key => $val)
783
+					foreach ($errorLang as $key => $val)
784 784
 					{
785 785
 						Context::setLang($key, $val);
786 786
 					}
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 
790 790
 				$Validator = new Validator($rulesetFile);
791 791
 				$result = $Validator->validate();
792
-				if(!$result)
792
+				if (!$result)
793 793
 				{
794 794
 					$lastError = $Validator->getLastError();
795 795
 					$returnUrl = Context::get('error_return_url');
@@ -821,26 +821,26 @@  discard block
 block discarded – undo
821 821
 				'dispLayoutPreviewWithModule' => 1
822 822
 		);
823 823
 		$db_use_mobile = Mobile::isMobileEnabled();
824
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
824
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
825 825
 		{
826 826
 			global $lang;
827 827
 			$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>';
828
-			$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>';
828
+			$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>';
829 829
 			Context::addHtmlHeader($header);
830 830
 			Context::addHtmlFooter($footer);
831 831
 		}
832 832
 
833
-		if(($type == 'view' || $type == 'mobile') && $kind != 'admin')
833
+		if (($type == 'view' || $type == 'mobile') && $kind != 'admin')
834 834
 		{
835 835
 			$module_config = $oModuleModel->getModuleConfig('module');
836
-			if($module_config->htmlFooter)
836
+			if ($module_config->htmlFooter)
837 837
 			{
838 838
 				Context::addHtmlFooter($module_config->htmlFooter);
839 839
 			}
840
-			if($module_config->siteTitle)
840
+			if ($module_config->siteTitle)
841 841
 			{
842 842
 				$siteTitle = Context::getBrowserTitle();
843
-				if(!$siteTitle)
843
+				if (!$siteTitle)
844 844
 				{
845 845
 					Context::setBrowserTitle($module_config->siteTitle);
846 846
 				}
@@ -857,18 +857,18 @@  discard block
 block discarded – undo
857 857
 		$procResult = $oModule->proc();
858 858
 
859 859
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
860
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
860
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
861 861
 		{
862 862
 			$error = $oModule->getError();
863 863
 			$message = $oModule->getMessage();
864 864
 			$messageType = $oModule->getMessageType();
865 865
 			$redirectUrl = $oModule->getRedirectUrl();
866
-			if($messageType == 'error') debugPrint($message, 'ERROR');
866
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
867 867
 
868
-			if(!$procResult)
868
+			if (!$procResult)
869 869
 			{
870 870
 				$this->error = $message;
871
-				if(!$redirectUrl && Context::get('error_return_url'))
871
+				if (!$redirectUrl && Context::get('error_return_url'))
872 872
 				{
873 873
 					$redirectUrl = Context::get('error_return_url');
874 874
 				}
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 
882 882
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
883 883
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
884
-			if($message != 'success')
884
+			if ($message != 'success')
885 885
 			{
886 886
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
887 887
 			}
888 888
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
889 889
 
890
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
890
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
891 891
 			{
892 892
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
893 893
 			}
@@ -903,27 +903,27 @@  discard block
 block discarded – undo
903 903
 	 * */
904 904
 	function _setInputErrorToContext()
905 905
 	{
906
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
906
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
907 907
 		{
908 908
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
909 909
 		}
910
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
910
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
911 911
 		{
912 912
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
913 913
 		}
914
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
914
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
915 915
 		{
916 916
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
917 917
 		}
918
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
918
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
919 919
 		{
920 920
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
921 921
 		}
922
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
922
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
923 923
 		{
924 924
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
925 925
 		}
926
-		if(count($_SESSION['INPUT_ERROR']))
926
+		if (count($_SESSION['INPUT_ERROR']))
927 927
 		{
928 928
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
929 929
 		}
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	{
954 954
 		$requestVars = Context::getRequestVars();
955 955
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
956
-		foreach($requestVars AS $key => $value)
956
+		foreach ($requestVars AS $key => $value)
957 957
 		{
958 958
 			$_SESSION['INPUT_ERROR'][$key] = $value;
959 959
 		}
@@ -967,41 +967,41 @@  discard block
 block discarded – undo
967 967
 	function displayContent($oModule = NULL)
968 968
 	{
969 969
 		// If the module is not set or not an object, set error
970
-		if(!$oModule || !is_object($oModule))
970
+		if (!$oModule || !is_object($oModule))
971 971
 		{
972 972
 			$this->error = 'msg_module_is_not_exists';
973 973
 			$this->httpStatusCode = '404';
974 974
 		}
975 975
 
976 976
 		// If connection to DB has a problem even though it's not install module, set error
977
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
977
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
978 978
 		{
979 979
 			$this->error = 'msg_dbconnect_failed';
980 980
 		}
981 981
 
982 982
 		// Call trigger after moduleHandler proc
983 983
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
984
-		if(!$output->toBool())
984
+		if (!$output->toBool())
985 985
 		{
986 986
 			$this->error = $output->getMessage();
987 987
 		}
988 988
 
989 989
 		// Use message view object, if HTML call
990 990
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
991
-		if(!isset($methodList[Context::getRequestMethod()]))
991
+		if (!isset($methodList[Context::getRequestMethod()]))
992 992
 		{
993 993
 
994
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
994
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
995 995
 			{
996 996
 				$display_handler = new DisplayHandler();
997 997
 				$display_handler->_debugOutput();
998 998
 
999
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
999
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
1000 1000
 				return;
1001 1001
 			}
1002 1002
 
1003 1003
 			// If error occurred, handle it
1004
-			if($this->error)
1004
+			if ($this->error)
1005 1005
 			{
1006 1006
 				// display content with message module instance
1007 1007
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -1010,14 +1010,14 @@  discard block
 block discarded – undo
1010 1010
 				$oMessageObject->setMessage($this->error);
1011 1011
 				$oMessageObject->dispMessage();
1012 1012
 
1013
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1013
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1014 1014
 				{
1015 1015
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
1016 1016
 					$oMessageObject->setTemplateFile('http_status_code');
1017 1017
 				}
1018 1018
 
1019 1019
 				// If module was called normally, change the templates of the module into ones of the message view module
1020
-				if($oModule)
1020
+				if ($oModule)
1021 1021
 				{
1022 1022
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1023 1023
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 			}
1033 1033
 
1034 1034
 			// Check if layout_srl exists for the module
1035
-			if(Mobile::isFromMobilePhone())
1035
+			if (Mobile::isFromMobilePhone())
1036 1036
 			{
1037 1037
 				$layout_srl = $oModule->module_info->mlayout_srl;
1038 1038
 			}
@@ -1042,58 +1042,58 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 
1044 1044
 			// if layout_srl is rollback by module, set default layout
1045
-			if($layout_srl == -1)
1045
+			if ($layout_srl == -1)
1046 1046
 			{
1047 1047
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1048 1048
 				$oLayoutAdminModel = getAdminModel('layout');
1049 1049
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1050 1050
 			}
1051 1051
 
1052
-			if($layout_srl && !$oModule->getLayoutFile())
1052
+			if ($layout_srl && !$oModule->getLayoutFile())
1053 1053
 			{
1054 1054
 
1055 1055
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1056 1056
 				$oLayoutModel = getModel('layout');
1057 1057
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1058
-				if($layout_info)
1058
+				if ($layout_info)
1059 1059
 				{
1060 1060
 
1061 1061
 					// Input extra_vars into $layout_info
1062
-					if($layout_info->extra_var_count)
1062
+					if ($layout_info->extra_var_count)
1063 1063
 					{
1064 1064
 
1065
-						foreach($layout_info->extra_var as $var_id => $val)
1065
+						foreach ($layout_info->extra_var as $var_id => $val)
1066 1066
 						{
1067
-							if($val->type == 'image')
1067
+							if ($val->type == 'image')
1068 1068
 							{
1069
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1069
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1070 1070
 								{
1071
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1071
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1072 1072
 								}
1073 1073
 							}
1074 1074
 							$layout_info->{$var_id} = $val->value;
1075 1075
 						}
1076 1076
 					}
1077 1077
 					// Set menus into context
1078
-					if($layout_info->menu_count)
1078
+					if ($layout_info->menu_count)
1079 1079
 					{
1080
-						foreach($layout_info->menu as $menu_id => $menu)
1080
+						foreach ($layout_info->menu as $menu_id => $menu)
1081 1081
 						{
1082 1082
 							// set default menu set(included home menu)
1083
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1083
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1084 1084
 							{
1085 1085
 								$oMenuAdminController = getAdminController('menu');
1086 1086
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1087 1087
 
1088
-								if(FileHandler::exists($homeMenuCacheFile))
1088
+								if (FileHandler::exists($homeMenuCacheFile))
1089 1089
 								{
1090 1090
 									include($homeMenuCacheFile);
1091 1091
 								}
1092 1092
 
1093
-								if(!$menu->menu_srl)
1093
+								if (!$menu->menu_srl)
1094 1094
 								{
1095
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1096
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1095
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1096
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1097 1097
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1098 1098
 								}
1099 1099
 								else
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 							}
1105 1105
 
1106 1106
 							$php_file = FileHandler::exists($menu->php_file);
1107
-							if($php_file)
1107
+							if ($php_file)
1108 1108
 							{
1109 1109
 								include($php_file);
1110 1110
 							}
@@ -1120,17 +1120,17 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 					// If layout was modified, use the modified version
1122 1122
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1123
-					if(file_exists($edited_layout))
1123
+					if (file_exists($edited_layout))
1124 1124
 					{
1125 1125
 						$oModule->setEditedLayoutFile($edited_layout);
1126 1126
 					}
1127 1127
 				}
1128 1128
 			}
1129 1129
 			$isLayoutDrop = Context::get('isLayoutDrop');
1130
-			if($isLayoutDrop)
1130
+			if ($isLayoutDrop)
1131 1131
 			{
1132 1132
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1133
-				if($kind == 'admin')
1133
+				if ($kind == 'admin')
1134 1134
 				{
1135 1135
 					$oModule->setLayoutFile('popup_layout');
1136 1136
 				}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1169 1169
 	{
1170 1170
 
1171
-		if(__DEBUG__ == 3)
1171
+		if (__DEBUG__ == 3)
1172 1172
 		{
1173 1173
 			$start_time = getMicroTime();
1174 1174
 		}
@@ -1178,51 +1178,51 @@  discard block
 block discarded – undo
1178 1178
 		$type = strtolower($type);
1179 1179
 
1180 1180
 		$kinds = array('svc' => 1, 'admin' => 1);
1181
-		if(!isset($kinds[$kind]))
1181
+		if (!isset($kinds[$kind]))
1182 1182
 		{
1183 1183
 			$kind = 'svc';
1184 1184
 		}
1185 1185
 
1186
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1186
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1187 1187
 
1188
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1188
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1189 1189
 		{
1190 1190
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1191 1191
 		}
1192 1192
 
1193 1193
 		// if there is no instance of the module in global variable, create a new one
1194
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1194
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1195 1195
 		{
1196 1196
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1197 1197
 
1198
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1198
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1199 1199
 			{
1200 1200
 				$module = $parent_module;
1201 1201
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1202 1202
 			}
1203 1203
 
1204 1204
 			// Check if the base class and instance class exist
1205
-			if(!class_exists($module, true))
1205
+			if (!class_exists($module, true))
1206 1206
 			{
1207 1207
 				return NULL;
1208 1208
 			}
1209
-			if(!class_exists($instance_name, true))
1209
+			if (!class_exists($instance_name, true))
1210 1210
 			{
1211 1211
 				return NULL;
1212 1212
 			}
1213 1213
 
1214 1214
 			// Create an instance
1215 1215
 			$oModule = new $instance_name();
1216
-			if(!is_object($oModule))
1216
+			if (!is_object($oModule))
1217 1217
 			{
1218 1218
 				return NULL;
1219 1219
 			}
1220 1220
 
1221 1221
 			// Load language files for the class
1222
-			Context::loadLang($class_path . 'lang');
1223
-			if($extend_module)
1222
+			Context::loadLang($class_path.'lang');
1223
+			if ($extend_module)
1224 1224
 			{
1225
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1225
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1226 1226
 			}
1227 1227
 
1228 1228
 			// Set variables to the instance
@@ -1230,10 +1230,10 @@  discard block
 block discarded – undo
1230 1230
 			$oModule->setModulePath($class_path);
1231 1231
 
1232 1232
 			// If the module has a constructor, run it.
1233
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1233
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1234 1234
 			{
1235 1235
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1236
-				if(@method_exists($oModule, $instance_name))
1236
+				if (@method_exists($oModule, $instance_name))
1237 1237
 				{
1238 1238
 					$oModule->{$instance_name}();
1239 1239
 				}
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1244 1244
 		}
1245 1245
 
1246
-		if(__DEBUG__ == 3)
1246
+		if (__DEBUG__ == 3)
1247 1247
 		{
1248 1248
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1249 1249
 		}
@@ -1259,17 +1259,17 @@  discard block
 block discarded – undo
1259 1259
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1260 1260
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1261 1261
 
1262
-		$types = array('view','controller','model','api','wap','mobile','class');
1263
-		if(!in_array($type, $types))
1262
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1263
+		if (!in_array($type, $types))
1264 1264
 		{
1265 1265
 			$type = $types[0];
1266 1266
 		}
1267
-		if($type == 'class')
1267
+		if ($type == 'class')
1268 1268
 		{
1269 1269
 			$instanceName = '%s';
1270 1270
 			$classFile = '%s%s.%s.php';
1271 1271
 		}
1272
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1272
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1273 1273
 		{
1274 1274
 			$instanceName = '%sAdmin%s';
1275 1275
 			$classFile = '%s%s.admin.%s.php';
@@ -1294,26 +1294,26 @@  discard block
 block discarded – undo
1294 1294
 	function triggerCall($trigger_name, $called_position, &$obj)
1295 1295
 	{
1296 1296
 		// skip if not installed
1297
-		if(!Context::isInstalled())
1297
+		if (!Context::isInstalled())
1298 1298
 		{
1299 1299
 			return new BaseObject();
1300 1300
 		}
1301 1301
 
1302 1302
 		$oModuleModel = getModel('module');
1303 1303
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1304
-		if(!$triggers || count($triggers) < 1)
1304
+		if (!$triggers || count($triggers) < 1)
1305 1305
 		{
1306 1306
 			return new BaseObject();
1307 1307
 		}
1308 1308
 
1309 1309
 		//store before trigger call time
1310 1310
 		$before_trigger_time = NULL;
1311
-		if(__LOG_SLOW_TRIGGER__> 0)
1311
+		if (__LOG_SLOW_TRIGGER__ > 0)
1312 1312
 		{
1313 1313
 			$before_trigger_time = microtime(true);
1314 1314
 		}
1315 1315
 
1316
-		foreach($triggers as $item)
1316
+		foreach ($triggers as $item)
1317 1317
 		{
1318 1318
 			$module = $item->module;
1319 1319
 			$type = $item->type;
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 
1322 1322
 			// todo why don't we call a normal class object ?
1323 1323
 			$oModule = getModule($module, $type);
1324
-			if(!$oModule || !method_exists($oModule, $called_method))
1324
+			if (!$oModule || !method_exists($oModule, $called_method))
1325 1325
 			{
1326 1326
 				continue;
1327 1327
 			}
@@ -1334,12 +1334,12 @@  discard block
 block discarded – undo
1334 1334
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1335 1335
 
1336 1336
 			$slowlog = new stdClass;
1337
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1338
-			$slowlog->called = $module . '.' . $called_method;
1337
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1338
+			$slowlog->called = $module.'.'.$called_method;
1339 1339
 			$slowlog->called_extension = $module;
1340
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1340
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1341 1341
 
1342
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1342
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1343 1343
 			{
1344 1344
 				return $output;
1345 1345
 			}
@@ -1424,9 +1424,9 @@  discard block
 block discarded – undo
1424 1424
 			'511' => 'Network Authentication Required',
1425 1425
 		);
1426 1426
 		$statusMessage = $statusMessageList[$code];
1427
-		if(!$statusMessage)
1427
+		if (!$statusMessage)
1428 1428
 		{
1429
-			$statusMessage = 'HTTP ' . $code;
1429
+			$statusMessage = 'HTTP '.$code;
1430 1430
 		}
1431 1431
 
1432 1432
 		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.