GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#1805)
by
unknown
18:31
created
classes/editor/EditorHandler.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
 	{
21 21
 		Context::set('component_info', $info);
22 22
 
23
-		if(!$info->extra_vars)
23
+		if (!$info->extra_vars)
24 24
 		{
25 25
 			return;
26 26
 		}
27 27
 
28
-		foreach($info->extra_vars as $key => $val)
28
+		foreach ($info->extra_vars as $key => $val)
29 29
 		{
30 30
 			$this->{$key} = trim($val->value);
31 31
 		}
Please login to merge, or discard this patch.
classes/extravar/Extravar.class.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	function setExtraVarKeys($extra_keys)
53 53
 	{
54
-		if(!is_array($extra_keys) || count($extra_keys) < 1)
54
+		if (!is_array($extra_keys) || count($extra_keys) < 1)
55 55
 		{
56 56
 			return;
57 57
 		}
58 58
 
59
-		foreach($extra_keys as $val)
59
+		foreach ($extra_keys as $val)
60 60
 		{
61 61
 			$obj = new ExtraItem($val->module_srl, $val->idx, $val->name, $val->type, $val->default, $val->desc, $val->is_required, $val->search, $val->value, $val->eid);
62 62
 			$this->keys[$val->idx] = $obj;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	function ExtraItem($module_srl, $idx, $name, $type = 'text', $default = null, $desc = '', $is_required = 'N', $search = 'N', $value = null, $eid = '')
161 161
 	{
162
-		if(!$idx)
162
+		if (!$idx)
163 163
 		{
164 164
 			return;
165 165
 		}
@@ -197,36 +197,36 @@  discard block
 block discarded – undo
197 197
 	function _getTypeValue($type, $value)
198 198
 	{
199 199
 		$value = trim($value);
200
-		if(!isset($value))
200
+		if (!isset($value))
201 201
 		{
202 202
 			return;
203 203
 		}
204 204
 
205
-		switch($type)
205
+		switch ($type)
206 206
 		{
207 207
 			case 'homepage' :
208
-				if($value && !preg_match('/^([a-z]+):\/\//i', $value))
208
+				if ($value && !preg_match('/^([a-z]+):\/\//i', $value))
209 209
 				{
210 210
 					$value = 'http://' . $value;
211 211
 				}
212 212
 				return htmlspecialchars($value, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
213 213
 
214 214
 			case 'tel' :
215
-				if(is_array($value))
215
+				if (is_array($value))
216 216
 				{
217 217
 					$values = $value;
218 218
 				}
219
-				elseif(strpos($value, '|@|') !== FALSE)
219
+				elseif (strpos($value, '|@|') !== FALSE)
220 220
 				{
221 221
 					$values = explode('|@|', $value);
222 222
 				}
223
-				elseif(strpos($value, ',') !== FALSE)
223
+				elseif (strpos($value, ',') !== FALSE)
224 224
 				{
225 225
 					$values = explode(',', $value);
226 226
 				}
227 227
 
228 228
 				$values = array_values($values);
229
-				for($i = 0, $c = count($values); $i < $c; $i++)
229
+				for ($i = 0, $c = count($values); $i < $c; $i++)
230 230
 				{
231 231
 					$values[$i] = trim(htmlspecialchars($values[$i], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
232 232
 				}
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
 			case 'checkbox' :
236 236
 			case 'radio' :
237 237
 			case 'select' :
238
-				if(is_array($value))
238
+				if (is_array($value))
239 239
 				{
240 240
 					$values = $value;
241 241
 				}
242
-				elseif(strpos($value, '|@|') !== FALSE)
242
+				elseif (strpos($value, '|@|') !== FALSE)
243 243
 				{
244 244
 					$values = explode('|@|', $value);
245 245
 				}
246
-				elseif(strpos($value, ',') !== FALSE)
246
+				elseif (strpos($value, ',') !== FALSE)
247 247
 				{
248 248
 					$values = explode(',', $value);
249 249
 				}
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 				}
254 254
 
255 255
 				$values = array_values($values);
256
-				for($i = 0, $c = count($values); $i < $c; $i++)
256
+				for ($i = 0, $c = count($values); $i < $c; $i++)
257 257
 				{
258 258
 					$values[$i] = trim(htmlspecialchars($values[$i], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
259 259
 				}
260 260
 				return $values;
261 261
 
262 262
 			case 'kr_zip' :
263
-				if(is_array($value))
263
+				if (is_array($value))
264 264
 				{
265 265
 					$values = $value;
266 266
 				}
267
-				elseif(strpos($value, '|@|') !== false)
267
+				elseif (strpos($value, '|@|') !== false)
268 268
 				{
269 269
 					$values = explode('|@|', $value);
270 270
 				}
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				}
275 275
 
276 276
 				$values = array_values($values);
277
-				for($i = 0, $c = count($values); $i < $c; $i++)
277
+				for ($i = 0, $c = count($values); $i < $c; $i++)
278 278
 				{
279 279
 					$values[$i] = trim(htmlspecialchars($values[$i], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
280 280
 				}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	{
309 309
 		$value = $this->_getTypeValue($this->type, $this->value);
310 310
 
311
-		switch($this->type)
311
+		switch ($this->type)
312 312
 		{
313 313
 			case 'homepage' :
314 314
 				return ($value) ? (sprintf('<a href="%s" target="_blank">%s</a>', $value, strlen($value) > 60 ? substr($value, 0, 40) . '...' . substr($value, -10) : $value)) : "";
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
 			case 'checkbox' :
329 329
 			case 'select' :
330 330
 			case 'radio' :
331
-				if(is_array($value))
331
+				if (is_array($value))
332 332
 				{
333 333
 					return implode(',', $value);
334 334
 				}
335 335
 				return $value;
336 336
 
337 337
 			case 'kr_zip' :
338
-				if(is_array($value))
338
+				if (is_array($value))
339 339
 				{
340 340
 					return implode(' ', $value);
341 341
 				}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		$tmp_id = $column_name . '-' . $id_num++;
365 365
 
366 366
 		$buff = array();
367
-		switch($type)
367
+		switch ($type)
368 368
 		{
369 369
 			// Homepage
370 370
 			case 'homepage' :
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 			// multiple choice
388 388
 			case 'checkbox' :
389 389
 				$buff[] = '<ul>';
390
-				foreach($default as $v)
390
+				foreach ($default as $v)
391 391
 				{
392 392
 					$checked = '';
393
-					if($value && in_array(trim($v), $value))
393
+					if ($value && in_array(trim($v), $value))
394 394
 					{
395 395
 						$checked = ' checked="checked"';
396 396
 					}
@@ -398,17 +398,17 @@  discard block
 block discarded – undo
398 398
 					// Temporary ID for labeling
399 399
 					$tmp_id = $column_name . '-' . $id_num++;
400 400
 
401
-					$buff[] ='  <li><input type="checkbox" name="' . $column_name . '[]" id="' . $tmp_id . '" value="' . htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '" ' . $checked . ' /><label for="' . $tmp_id . '">' . $v . '</label></li>';
401
+					$buff[] = '  <li><input type="checkbox" name="' . $column_name . '[]" id="' . $tmp_id . '" value="' . htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '" ' . $checked . ' /><label for="' . $tmp_id . '">' . $v . '</label></li>';
402 402
 				}
403 403
 				$buff[] = '</ul>';
404 404
 				break;
405 405
 			// single choice
406 406
 			case 'select' :
407 407
 				$buff[] = '<select name="' . $column_name . '" class="select">';
408
-				foreach($default as $v)
408
+				foreach ($default as $v)
409 409
 				{
410 410
 					$selected = '';
411
-					if($value && in_array(trim($v), $value))
411
+					if ($value && in_array(trim($v), $value))
412 412
 					{
413 413
 						$selected = ' selected="selected"';
414 414
 					}
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 			// radio
420 420
 			case 'radio' :
421 421
 				$buff[] = '<ul>';
422
-				foreach($default as $v)
422
+				foreach ($default as $v)
423 423
 				{
424 424
 					$checked = '';
425
-					if($value && in_array(trim($v), $value))
425
+					if ($value && in_array(trim($v), $value))
426 426
 					{
427 427
 						$checked = ' checked="checked"';
428 428
 					}
@@ -440,38 +440,38 @@  discard block
 block discarded – undo
440 440
 				Context::loadJavascriptPlugin('ui.datepicker');
441 441
 
442 442
 				$buff[] = '<input type="hidden" name="' . $column_name . '" value="' . $value . '" />'; 
443
-				$buff[] =	'<input type="text" id="date_' . $column_name . '" value="' . zdate($value, 'Y-m-d') . '" class="date" />';
444
-				$buff[] =	'<input type="button" value="' . Context::getLang('cmd_delete') . '" class="btn" id="dateRemover_' . $column_name . '" />';
445
-				$buff[] =	'<script type="text/javascript">';
443
+				$buff[] = '<input type="text" id="date_' . $column_name . '" value="' . zdate($value, 'Y-m-d') . '" class="date" />';
444
+				$buff[] = '<input type="button" value="' . Context::getLang('cmd_delete') . '" class="btn" id="dateRemover_' . $column_name . '" />';
445
+				$buff[] = '<script type="text/javascript">';
446 446
 				$buff[] = '//<![CDATA[';
447
-				$buff[] =	'(function($){';
448
-				$buff[] =	'$(function(){';
449
-				$buff[] =	'  var option = { dateFormat: "yy-mm-dd", changeMonth:true, changeYear:true, gotoCurrent:false, yearRange:\'-100:+10\', onSelect:function(){';
450
-				$buff[] =	'    $(this).prev(\'input[type="hidden"]\').val(this.value.replace(/-/g,""))}';
451
-				$buff[] =	'  };';
452
-				$buff[] =	'  $.extend(option,$.datepicker.regional[\'' . Context::getLangType() . '\']);';
453
-				$buff[] =	'  $("#date_' . $column_name . '").datepicker(option);';
454
-				$buff[] =	'  $("#dateRemover_' . $column_name . '").click(function(){';
455
-				$buff[] =	'    $(this).siblings("input").val("");';
456
-				$buff[] =	'    return false;';
457
-				$buff[] =	'  })';
458
-				$buff[] =	'});';
459
-				$buff[] =	'})(jQuery);';
447
+				$buff[] = '(function($){';
448
+				$buff[] = '$(function(){';
449
+				$buff[] = '  var option = { dateFormat: "yy-mm-dd", changeMonth:true, changeYear:true, gotoCurrent:false, yearRange:\'-100:+10\', onSelect:function(){';
450
+				$buff[] = '    $(this).prev(\'input[type="hidden"]\').val(this.value.replace(/-/g,""))}';
451
+				$buff[] = '  };';
452
+				$buff[] = '  $.extend(option,$.datepicker.regional[\'' . Context::getLangType() . '\']);';
453
+				$buff[] = '  $("#date_' . $column_name . '").datepicker(option);';
454
+				$buff[] = '  $("#dateRemover_' . $column_name . '").click(function(){';
455
+				$buff[] = '    $(this).siblings("input").val("");';
456
+				$buff[] = '    return false;';
457
+				$buff[] = '  })';
458
+				$buff[] = '});';
459
+				$buff[] = '})(jQuery);';
460 460
 				$buff[] = '//]]>';
461 461
 				$buff[] = '</script>';
462 462
 				break;
463 463
 			// address
464 464
 			case "kr_zip" :
465
-				if(($oKrzipModel = getModel('krzip')) && method_exists($oKrzipModel , 'getKrzipCodeSearchHtml' ))
465
+				if (($oKrzipModel = getModel('krzip')) && method_exists($oKrzipModel, 'getKrzipCodeSearchHtml'))
466 466
 				{
467
-					$buff[] =  $oKrzipModel->getKrzipCodeSearchHtml($column_name, $value);
467
+					$buff[] = $oKrzipModel->getKrzipCodeSearchHtml($column_name, $value);
468 468
 				}
469 469
 				break;
470 470
 			// General text
471 471
 			default :
472
-				$buff[] =' <input type="text" name="' . $column_name . '" value="' . ($value ? $value : $default) . '" class="text" />';
472
+				$buff[] = ' <input type="text" name="' . $column_name . '" value="' . ($value ? $value : $default) . '" class="text" />';
473 473
 		}
474
-		if($this->desc)
474
+		if ($this->desc)
475 475
 		{
476 476
 			$oModuleController = getController('module');
477 477
 			$oModuleController->replaceDefinedLangCode($this->desc);
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -215,12 +215,10 @@  discard block
 block discarded – undo
215 215
 				if(is_array($value))
216 216
 				{
217 217
 					$values = $value;
218
-				}
219
-				elseif(strpos($value, '|@|') !== FALSE)
218
+				} elseif(strpos($value, '|@|') !== FALSE)
220 219
 				{
221 220
 					$values = explode('|@|', $value);
222
-				}
223
-				elseif(strpos($value, ',') !== FALSE)
221
+				} elseif(strpos($value, ',') !== FALSE)
224 222
 				{
225 223
 					$values = explode(',', $value);
226 224
 				}
@@ -238,16 +236,13 @@  discard block
 block discarded – undo
238 236
 				if(is_array($value))
239 237
 				{
240 238
 					$values = $value;
241
-				}
242
-				elseif(strpos($value, '|@|') !== FALSE)
239
+				} elseif(strpos($value, '|@|') !== FALSE)
243 240
 				{
244 241
 					$values = explode('|@|', $value);
245
-				}
246
-				elseif(strpos($value, ',') !== FALSE)
242
+				} elseif(strpos($value, ',') !== FALSE)
247 243
 				{
248 244
 					$values = explode(',', $value);
249
-				}
250
-				else
245
+				} else
251 246
 				{
252 247
 					$values = array($value);
253 248
 				}
@@ -263,12 +258,10 @@  discard block
 block discarded – undo
263 258
 				if(is_array($value))
264 259
 				{
265 260
 					$values = $value;
266
-				}
267
-				elseif(strpos($value, '|@|') !== false)
261
+				} elseif(strpos($value, '|@|') !== false)
268 262
 				{
269 263
 					$values = explode('|@|', $value);
270
-				}
271
-				else
264
+				} else
272 265
 				{
273 266
 					$values = array($value);
274 267
 				}
Please login to merge, or discard this patch.
classes/file/FileObject.class.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	function FileObject($path, $mode)
38 38
 	{
39
-		if($path != NULL)
39
+		if ($path != NULL)
40 40
 		{
41 41
 			$this->Open($path, $mode);
42 42
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	function append($file_name)
52 52
 	{
53 53
 		$target = new FileObject($file_name, "r");
54
-		while(!$target->feof())
54
+		while (!$target->feof())
55 55
 		{
56 56
 			$readstr = $target->read();
57 57
 			$this->write($readstr);
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	function write($str)
90 90
 	{
91 91
 		$len = strlen($str);
92
-		if(!$str || $len <= 0)
92
+		if (!$str || $len <= 0)
93 93
 		{
94 94
 			return FALSE;
95 95
 		}
96
-		if(!$this->fp)
96
+		if (!$this->fp)
97 97
 		{
98 98
 			return FALSE;
99 99
 		}
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	function open($path, $mode)
114 114
 	{
115
-		if($this->fp != NULL)
115
+		if ($this->fp != NULL)
116 116
 		{
117 117
 			$this->close();
118 118
 		}
119 119
 		$this->fp = fopen($path, $mode);
120
-		if(!is_resource($this->fp))
120
+		if (!is_resource($this->fp))
121 121
 		{
122 122
 			$this->fp = NULL;
123 123
 			return FALSE;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	function getPath()
135 135
 	{
136
-		if($this->fp != NULL)
136
+		if ($this->fp != NULL)
137 137
 		{
138 138
 			return $this->path;
139 139
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	function close()
152 152
 	{
153
-		if($this->fp != NULL)
153
+		if ($this->fp != NULL)
154 154
 		{
155 155
 			fclose($this->fp);
156 156
 			$this->fp = NULL;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@
 block discarded – undo
136 136
 		if($this->fp != NULL)
137 137
 		{
138 138
 			return $this->path;
139
-		}
140
-		else
139
+		} else
141 140
 		{
142 141
 			return NULL;
143 142
 		}
Please login to merge, or discard this patch.
classes/mobile/Mobile.class.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	function &getInstance()
24 24
 	{
25 25
 		static $theInstance;
26
-		if(!isset($theInstance))
26
+		if (!isset($theInstance))
27 27
 		{
28 28
 			$theInstance = new Mobile();
29 29
 		}
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	function _isFromMobilePhone()
50 50
 	{
51
-		if($this->ismobile !== NULL)
51
+		if ($this->ismobile !== NULL)
52 52
 		{
53 53
 			return $this->ismobile;
54 54
 		}
55
-		if(Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"])
55
+		if (Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"])
56 56
 		{
57 57
 			return ($this->ismobile = false);
58 58
 		}
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
 		$this->ismobile = FALSE;
64 64
 
65 65
 		$m = Context::get('m');
66
-		if(strlen($m) == 1)
66
+		if (strlen($m) == 1)
67 67
 		{
68
-			if($m == "1")
68
+			if ($m == "1")
69 69
 			{
70 70
 				$this->ismobile = TRUE;
71 71
 			}
72
-			elseif($m == "0")
72
+			elseif ($m == "0")
73 73
 			{
74 74
 				$this->ismobile = FALSE;
75 75
 			}
76 76
 		}
77
-		elseif(isset($_COOKIE['mobile']))
77
+		elseif (isset($_COOKIE['mobile']))
78 78
 		{
79
-			if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
79
+			if ($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
80 80
 			{
81
-				if($_COOKIE['mobile'] == 'true')
81
+				if ($_COOKIE['mobile'] == 'true')
82 82
 				{
83 83
 					$this->ismobile = TRUE;
84 84
 				}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				$this->ismobile = FALSE;
93 93
 				setcookie("mobile", FALSE, 0, $xe_web_path);
94 94
 				setcookie("user-agent", FALSE, 0, $xe_web_path);
95
-				if(!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent())
95
+				if (!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent())
96 96
 				{
97 97
 					$this->ismobile = TRUE;
98 98
 				}
@@ -100,36 +100,36 @@  discard block
 block discarded – undo
100 100
 		}
101 101
 		else
102 102
 		{
103
-			if($this->isMobilePadCheckByAgent())
103
+			if ($this->isMobilePadCheckByAgent())
104 104
 			{
105 105
 				$this->ismobile = FALSE;
106 106
 			}
107 107
 			else
108 108
 			{
109
-				if($this->isMobileCheckByAgent())
109
+				if ($this->isMobileCheckByAgent())
110 110
 				{
111 111
 					$this->ismobile = TRUE;
112 112
 				}
113 113
 			}
114 114
 		}
115 115
 
116
-		if($this->ismobile !== NULL)
116
+		if ($this->ismobile !== NULL)
117 117
 		{
118
-			if($this->ismobile == TRUE)
118
+			if ($this->ismobile == TRUE)
119 119
 			{
120
-				if($_COOKIE['mobile'] != 'true')
120
+				if ($_COOKIE['mobile'] != 'true')
121 121
 				{
122 122
 					$_COOKIE['mobile'] = 'true';
123 123
 					setcookie("mobile", 'true', 0, $xe_web_path);
124 124
 				}
125 125
 			}
126
-			elseif($_COOKIE['mobile'] != 'false')
126
+			elseif ($_COOKIE['mobile'] != 'false')
127 127
 			{
128 128
 				$_COOKIE['mobile'] = 'false';
129 129
 				setcookie("mobile", 'false', 0, $xe_web_path);
130 130
 			}
131 131
 
132
-			if($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
132
+			if ($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
133 133
 			{
134 134
 				setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']), 0, $xe_web_path);
135 135
 			}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	function isMobileCheckByAgent()
147 147
 	{
148 148
 		static $UACheck;
149
-		if(isset($UACheck))
149
+		if (isset($UACheck))
150 150
 		{
151 151
 			return $UACheck;
152 152
 		}
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 		$oMobile = Mobile::getInstance();
155 155
 		$mobileAgent = array('iPod', 'iPhone', 'Android', 'BlackBerry', 'SymbianOS', 'Bada', 'Tizen', 'Kindle', 'Wii', 'SCH-', 'SPH-', 'CANU-', 'Windows Phone', 'Windows CE', 'POLARIS', 'Palm', 'Dorothy Browser', 'Mobile', 'Opera Mobi', 'Opera Mini', 'Minimo', 'AvantGo', 'NetFront', 'Nokia', 'LGPlayer', 'SonyEricsson', 'HTC');
156 156
 
157
-		if($oMobile->isMobilePadCheckByAgent())
157
+		if ($oMobile->isMobilePadCheckByAgent())
158 158
 		{
159 159
 			$UACheck = TRUE;
160 160
 			return TRUE;
161 161
 		}
162 162
 
163
-		foreach($mobileAgent as $agent)
163
+		foreach ($mobileAgent as $agent)
164 164
 		{
165
-			if(stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
165
+			if (stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
166 166
 			{
167 167
 				$UACheck = TRUE;
168 168
 				return TRUE;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	function isMobilePadCheckByAgent()
181 181
 	{
182 182
 		static $UACheck;
183
-		if(isset($UACheck))
183
+		if (isset($UACheck))
184 184
 		{
185 185
 			return $UACheck;
186 186
 		}
@@ -190,21 +190,21 @@  discard block
 block discarded – undo
190 190
 		// $exceptionAgent[0] contains exception agents for all exceptions.
191 191
 		$exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile');
192 192
 
193
-		foreach($padAgent as $agent)
193
+		foreach ($padAgent as $agent)
194 194
 		{
195
-			if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
195
+			if (strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
196 196
 			{
197
-				if(!isset($exceptionAgent[$agent]))
197
+				if (!isset($exceptionAgent[$agent]))
198 198
 				{
199 199
 					$UACheck = TRUE;
200 200
 					return TRUE;
201 201
 				}
202
-				elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
202
+				elseif (strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
203 203
 				{
204 204
 					// If the agent is the Android, that can be either tablet and mobile phone.
205
-					foreach($exceptionAgent[0] as $val)
205
+					foreach ($exceptionAgent[0] as $val)
206 206
 					{
207
-						if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE)
207
+						if (strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE)
208 208
 						{
209 209
 							$UACheck = FALSE;
210 210
 							return FALSE;
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -68,26 +68,22 @@  discard block
 block discarded – undo
68 68
 			if($m == "1")
69 69
 			{
70 70
 				$this->ismobile = TRUE;
71
-			}
72
-			elseif($m == "0")
71
+			} elseif($m == "0")
73 72
 			{
74 73
 				$this->ismobile = FALSE;
75 74
 			}
76
-		}
77
-		elseif(isset($_COOKIE['mobile']))
75
+		} elseif(isset($_COOKIE['mobile']))
78 76
 		{
79 77
 			if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
80 78
 			{
81 79
 				if($_COOKIE['mobile'] == 'true')
82 80
 				{
83 81
 					$this->ismobile = TRUE;
84
-				}
85
-				else
82
+				} else
86 83
 				{
87 84
 					$this->ismobile = FALSE;
88 85
 				}
89
-			}
90
-			else
86
+			} else
91 87
 			{
92 88
 				$this->ismobile = FALSE;
93 89
 				setcookie("mobile", FALSE, 0, $xe_web_path);
@@ -97,14 +93,12 @@  discard block
 block discarded – undo
97 93
 					$this->ismobile = TRUE;
98 94
 				}
99 95
 			}
100
-		}
101
-		else
96
+		} else
102 97
 		{
103 98
 			if($this->isMobilePadCheckByAgent())
104 99
 			{
105 100
 				$this->ismobile = FALSE;
106
-			}
107
-			else
101
+			} else
108 102
 			{
109 103
 				if($this->isMobileCheckByAgent())
110 104
 				{
@@ -122,8 +116,7 @@  discard block
 block discarded – undo
122 116
 					$_COOKIE['mobile'] = 'true';
123 117
 					setcookie("mobile", 'true', 0, $xe_web_path);
124 118
 				}
125
-			}
126
-			elseif($_COOKIE['mobile'] != 'false')
119
+			} elseif($_COOKIE['mobile'] != 'false')
127 120
 			{
128 121
 				$_COOKIE['mobile'] = 'false';
129 122
 				setcookie("mobile", 'false', 0, $xe_web_path);
@@ -198,8 +191,7 @@  discard block
 block discarded – undo
198 191
 				{
199 192
 					$UACheck = TRUE;
200 193
 					return TRUE;
201
-				}
202
-				elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
194
+				} elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
203 195
 				{
204 196
 					// If the agent is the Android, that can be either tablet and mobile phone.
205 197
 					foreach($exceptionAgent[0] as $val)
Please login to merge, or discard this patch.
classes/page/PageHandler.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 		$this->point = 0;
40 40
 
41 41
 		$first_page = $cur_page - (int) ($page_count / 2);
42
-		if($first_page < 1)
42
+		if ($first_page < 1)
43 43
 		{
44 44
 			$first_page = 1;
45 45
 		}
46 46
 
47
-		if($total_page > $page_count && $first_page + $page_count - 1 > $total_page)
47
+		if ($total_page > $page_count && $first_page + $page_count - 1 > $total_page)
48 48
 		{
49 49
 			$first_page -= $first_page + $page_count - 1 - $total_page;
50 50
 		}
51 51
 
52 52
 		$last_page = $total_page;
53
-		if($last_page > $total_page)
53
+		if ($last_page > $total_page)
54 54
 		{
55 55
 			$last_page = $total_page;
56 56
 		}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$this->first_page = $first_page;
59 59
 		$this->last_page = $last_page;
60 60
 
61
-		if($total_page < $this->page_count)
61
+		if ($total_page < $this->page_count)
62 62
 		{
63 63
 			$this->page_count = $total_page;
64 64
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	function getNextPage()
72 72
 	{
73 73
 		$page = $this->first_page + $this->point++;
74
-		if($this->point > $this->page_count || $page > $this->last_page)
74
+		if ($this->point > $this->page_count || $page > $this->last_page)
75 75
 		{
76 76
 			$page = 0;
77 77
 		}
Please login to merge, or discard this patch.
classes/security/IpFilter.class.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@  discard block
 block discarded – undo
5 5
 {
6 6
 	public function filter($ip_list, $ip = NULL)
7 7
 	{
8
-		if(!$ip) $ip = $_SERVER['REMOTE_ADDR'];
8
+		if (!$ip) $ip = $_SERVER['REMOTE_ADDR'];
9 9
 		$long_ip = ip2long($ip);
10
-		foreach($ip_list as $filter_ip)
10
+		foreach ($ip_list as $filter_ip)
11 11
 		{	
12 12
 			$range = explode('-', $filter_ip);
13
-			if(!$range[1]) // single address type
13
+			if (!$range[1]) // single address type
14 14
 			{
15 15
 				$star_pos = strpos($filter_ip, '*');
16
-				if($star_pos !== FALSE ) // wild card exist 
16
+				if ($star_pos !== FALSE) // wild card exist 
17 17
 				{
18
-					if(strncmp($filter_ip, $ip, $star_pos)===0) return true;
18
+					if (strncmp($filter_ip, $ip, $star_pos) === 0) return true;
19 19
 				}
20
-				else if(strcmp($filter_ip, $ip)===0)
20
+				else if (strcmp($filter_ip, $ip) === 0)
21 21
 				{
22 22
 					return true;
23 23
 				}
24 24
 			}
25
-			else if(ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip)
25
+			else if (ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip)
26 26
 			{
27 27
 				return true;
28 28
 			}
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 					)
75 75
 				)
76 76
 			$/";
77
-		$regex = str_replace(array("\r\n", "\n", "\r","\t"," "), '', $regex);
77
+		$regex = str_replace(array("\r\n", "\n", "\r", "\t", " "), '', $regex);
78 78
 		
79
-		foreach($ip_list as $i => $ip)
79
+		foreach ($ip_list as $i => $ip)
80 80
 		{
81 81
 			preg_match($regex, $ip, $matches);
82
-			if(!count($matches)) return false;
82
+			if (!count($matches)) return false;
83 83
 		}
84 84
 		
85 85
 		return true;
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,24 +5,28 @@  discard block
 block discarded – undo
5 5
 {
6 6
 	public function filter($ip_list, $ip = NULL)
7 7
 	{
8
-		if(!$ip) $ip = $_SERVER['REMOTE_ADDR'];
8
+		if(!$ip) {
9
+			$ip = $_SERVER['REMOTE_ADDR'];
10
+		}
9 11
 		$long_ip = ip2long($ip);
10 12
 		foreach($ip_list as $filter_ip)
11 13
 		{	
12 14
 			$range = explode('-', $filter_ip);
13
-			if(!$range[1]) // single address type
15
+			if(!$range[1]) {
16
+				// single address type
14 17
 			{
15 18
 				$star_pos = strpos($filter_ip, '*');
16
-				if($star_pos !== FALSE ) // wild card exist 
19
+			}
20
+				if($star_pos !== FALSE ) {
21
+					// wild card exist 
17 22
 				{
18 23
 					if(strncmp($filter_ip, $ip, $star_pos)===0) return true;
19 24
 				}
20
-				else if(strcmp($filter_ip, $ip)===0)
25
+				} else if(strcmp($filter_ip, $ip)===0)
21 26
 				{
22 27
 					return true;
23 28
 				}
24
-			}
25
-			else if(ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip)
29
+			} else if(ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip)
26 30
 			{
27 31
 				return true;
28 32
 			}
@@ -79,7 +83,9 @@  discard block
 block discarded – undo
79 83
 		foreach($ip_list as $i => $ip)
80 84
 		{
81 85
 			preg_match($regex, $ip, $matches);
82
-			if(!count($matches)) return false;
86
+			if(!count($matches)) {
87
+				return false;
88
+			}
83 89
 		}
84 90
 		
85 91
 		return true;
Please login to merge, or discard this patch.
classes/security/Password.class.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 	public function getSupportedAlgorithms()
20 20
 	{
21 21
 		$retval = array();
22
-		if(function_exists('hash_hmac') && in_array('sha256', hash_algos()))
22
+		if (function_exists('hash_hmac') && in_array('sha256', hash_algos()))
23 23
 		{
24 24
 			$retval['pbkdf2'] = 'pbkdf2';
25 25
 		}
26
-		if(version_compare(PHP_VERSION, '5.3.7', '>=') && defined('CRYPT_BLOWFISH'))
26
+		if (version_compare(PHP_VERSION, '5.3.7', '>=') && defined('CRYPT_BLOWFISH'))
27 27
 		{
28 28
 			$retval['bcrypt'] = 'bcrypt';
29 29
 		}
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function getCurrentlySelectedAlgorithm()
49 49
 	{
50
-		if(function_exists('getModel'))
50
+		if (function_exists('getModel'))
51 51
 		{
52 52
 			$config = getModel('member')->getMemberConfig();
53 53
 			$algorithm = $config->password_hashing_algorithm;
54
-			if(strval($algorithm) === '')
54
+			if (strval($algorithm) === '')
55 55
 			{
56
-				$algorithm = 'md5';  // Historical default for XE
56
+				$algorithm = 'md5'; // Historical default for XE
57 57
 			}
58 58
 		}
59 59
 		else
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function getWorkFactor()
71 71
 	{
72
-		if(function_exists('getModel'))
72
+		if (function_exists('getModel'))
73 73
 		{
74 74
 			$config = getModel('member')->getMemberConfig();
75 75
 			$work_factor = $config->password_hashing_work_factor;
76
-			if(!$work_factor || $work_factor < 4 || $work_factor > 31)
76
+			if (!$work_factor || $work_factor < 4 || $work_factor > 31)
77 77
 			{
78
-				$work_factor = 8;  // Reasonable default
78
+				$work_factor = 8; // Reasonable default
79 79
 			}
80 80
 		}
81 81
 		else
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function createHash($password, $algorithm = null)
95 95
 	{
96
-		if($algorithm === null)
96
+		if ($algorithm === null)
97 97
 		{
98 98
 			$algorithm = $this->getCurrentlySelectedAlgorithm();
99 99
 		}
100
-		if(!array_key_exists($algorithm, $this->getSupportedAlgorithms()))
100
+		if (!array_key_exists($algorithm, $this->getSupportedAlgorithms()))
101 101
 		{
102 102
 			return false;
103 103
 		}
104 104
 
105 105
 		$password = trim($password);
106 106
 
107
-		switch($algorithm)
107
+		switch ($algorithm)
108 108
 		{
109 109
 			case 'md5':
110 110
 				return md5($password);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 				$iterations = pow(2, $this->getWorkFactor() + 5);
114 114
 				$salt = $this->createSecureSalt(12, 'alnum');
115 115
 				$hash = base64_encode($this->pbkdf2($password, $salt, 'sha256', $iterations, 24));
116
-				return 'sha256:'.sprintf('%07d', $iterations).':'.$salt.':'.$hash;
116
+				return 'sha256:' . sprintf('%07d', $iterations) . ':' . $salt . ':' . $hash;
117 117
 
118 118
 			case 'bcrypt':
119 119
 				return $this->bcrypt($password);
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function checkPassword($password, $hash, $algorithm = null)
134 134
 	{
135
-		if($algorithm === null)
135
+		if ($algorithm === null)
136 136
 		{
137 137
 			$algorithm = $this->checkAlgorithm($hash);
138 138
 		}
139 139
 
140 140
 		$password = trim($password);
141 141
 
142
-		switch($algorithm)
142
+		switch ($algorithm)
143 143
 		{
144 144
 			case 'md5':
145 145
 				return md5($password) === $hash || md5(sha1(md5($password))) === $hash;
@@ -173,23 +173,23 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	function checkAlgorithm($hash)
175 175
 	{
176
-		if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
176
+		if (preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
177 177
 		{
178 178
 			return 'bcrypt';
179 179
 		}
180
-		elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
180
+		elseif (preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
181 181
 		{
182 182
 			return 'pbkdf2';
183 183
 		}
184
-		elseif(strlen($hash) === 32 && ctype_xdigit($hash))
184
+		elseif (strlen($hash) === 32 && ctype_xdigit($hash))
185 185
 		{
186 186
 			return 'md5';
187 187
 		}
188
-		elseif(strlen($hash) === 16 && ctype_xdigit($hash))
188
+		elseif (strlen($hash) === 16 && ctype_xdigit($hash))
189 189
 		{
190 190
 			return 'mysql_old_password';
191 191
 		}
192
-		elseif(strlen($hash) === 41 && $hash[0] === '*')
192
+		elseif (strlen($hash) === 41 && $hash[0] === '*')
193 193
 		{
194 194
 			return 'mysql_password';
195 195
 		}
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function checkWorkFactor($hash)
208 208
 	{
209
-		if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
209
+		if (preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
210 210
 		{
211 211
 			return intval($matches[1], 10);
212 212
 		}
213
-		elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
213
+		elseif (preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
214 214
 		{
215 215
 			return max(0, round(log($matches[1], 2)) - 5);
216 216
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	public function createSecureSalt($length, $format = 'hex')
230 230
 	{
231 231
 		// Find out how many bytes of entropy we really need
232
-		switch($format)
232
+		switch ($format)
233 233
 		{
234 234
 			case 'hex':
235 235
 				$entropy_required_bytes = ceil($length / 2);
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 
248 248
 		// Find and use the most secure way to generate a random string
249 249
 		$is_windows = (defined('PHP_OS') && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
250
-		if(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(PHP_VERSION, '5.4', '>=')))
250
+		if (function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(PHP_VERSION, '5.4', '>=')))
251 251
 		{
252 252
 			$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
253 253
 		}
254
-		elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>=')))
254
+		elseif (function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>=')))
255 255
 		{
256 256
 			$entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_DEV_URANDOM);
257 257
 		}
258
-		elseif(function_exists('mcrypt_create_iv') && $is_windows)
258
+		elseif (function_exists('mcrypt_create_iv') && $is_windows)
259 259
 		{
260 260
 			$entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_RAND);
261 261
 		}
262
-		elseif(!$is_windows && @is_readable('/dev/urandom'))
262
+		elseif (!$is_windows && @is_readable('/dev/urandom'))
263 263
 		{
264 264
 			$fp = fopen('/dev/urandom', 'rb');
265 265
 			$entropy = fread($fp, $entropy_capped_bytes);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		else
269 269
 		{
270 270
 			$entropy = '';
271
-			for($i = 0; $i < $entropy_capped_bytes; $i += 2)
271
+			for ($i = 0; $i < $entropy_capped_bytes; $i += 2)
272 272
 			{
273 273
 				$entropy .= pack('S', rand(0, 65536) ^ mt_rand(0, 65535));
274 274
 			}
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 
277 277
 		// Mixing (see RFC 4086 section 5)
278 278
 		$output = '';
279
-		for($i = 0; $i < $entropy_required_bytes; $i += 32)
279
+		for ($i = 0; $i < $entropy_required_bytes; $i += 32)
280 280
 		{
281 281
 			$output .= hash('sha256', $entropy . $i . rand(), true);
282 282
 		}
283 283
 
284 284
 		// Encode and return the random string
285
-		switch($format)
285
+		switch ($format)
286 286
 		{
287 287
 			case 'hex':
288 288
 				return substr(bin2hex($output), 0, $length);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 				return substr($output, 0, $length);
291 291
 			case 'printable':
292 292
 				$salt = '';
293
-				for($i = 0; $i < $length; $i++)
293
+				for ($i = 0; $i < $length; $i++)
294 294
 				{
295 295
 					$salt .= chr(33 + (crc32(sha1($i . $output)) % 94));
296 296
 				}
@@ -310,15 +310,15 @@  discard block
 block discarded – undo
310 310
 	 */
311 311
 	public function createTemporaryPassword($length = 16)
312 312
 	{
313
-		while(true)
313
+		while (true)
314 314
 		{
315 315
 			$source = base64_encode($this->createSecureSalt(64, 'binary'));
316 316
 			$source = strtr($source, 'iIoOjl10/', '@#$%&*-!?');
317 317
 			$source_length = strlen($source);
318
-			for($i = 0; $i < $source_length - $length; $i++)
318
+			for ($i = 0; $i < $source_length - $length; $i++)
319 319
 			{
320 320
 				$candidate = substr($source, $i, $length);
321
-				if(preg_match('/[a-z]/', $candidate) && preg_match('/[A-Z]/', $candidate) &&
321
+				if (preg_match('/[a-z]/', $candidate) && preg_match('/[A-Z]/', $candidate) &&
322 322
 					preg_match('/[0-9]/', $candidate) && preg_match('/[^a-zA-Z0-9]/', $candidate))
323 323
 				{
324 324
 					return $candidate;
@@ -338,19 +338,19 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24)
340 340
 	{
341
-		if(function_exists('hash_pbkdf2'))
341
+		if (function_exists('hash_pbkdf2'))
342 342
 		{
343 343
 			return hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, true);
344 344
 		}
345 345
 		else
346 346
 		{
347 347
 			$output = '';
348
-			$block_count = ceil($length / strlen(hash($algorithm, '', true)));  // key length divided by the length of one hash
349
-			for($i = 1; $i <= $block_count; $i++)
348
+			$block_count = ceil($length / strlen(hash($algorithm, '', true))); // key length divided by the length of one hash
349
+			for ($i = 1; $i <= $block_count; $i++)
350 350
 			{
351
-				$last = $salt . pack('N', $i);  // $i encoded as 4 bytes, big endian
352
-				$last = $xorsum = hash_hmac($algorithm, $last, $password, true);  // first iteration
353
-				for($j = 1; $j < $iterations; $j++)  // The other $count - 1 iterations
351
+				$last = $salt . pack('N', $i); // $i encoded as 4 bytes, big endian
352
+				$last = $xorsum = hash_hmac($algorithm, $last, $password, true); // first iteration
353
+				for ($j = 1; $j < $iterations; $j++)  // The other $count - 1 iterations
354 354
 				{
355 355
 					$xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));
356 356
 				}
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	public function bcrypt($password, $salt = null)
370 370
 	{
371
-		if($salt === null)
371
+		if ($salt === null)
372 372
 		{
373
-			$salt = '$2y$'.sprintf('%02d', $this->getWorkFactor()).'$'.$this->createSecureSalt(22, 'alnum');
373
+			$salt = '$2y$' . sprintf('%02d', $this->getWorkFactor()) . '$' . $this->createSecureSalt(22, 'alnum');
374 374
 		}
375 375
 		return crypt($password, $salt);
376 376
 	}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	{
386 386
 		$diff = strlen($a) ^ strlen($b);
387 387
 		$maxlen = min(strlen($a), strlen($b));
388
-		for($i = 0; $i < $maxlen; $i++)
388
+		for ($i = 0; $i < $maxlen; $i++)
389 389
 		{
390 390
 			$diff |= ord($a[$i]) ^ ord($b[$i]);
391 391
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -29 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
 			{
56 56
 				$algorithm = 'md5';  // Historical default for XE
57 57
 			}
58
-		}
59
-		else
58
+		} else
60 59
 		{
61 60
 			$algorithm = 'md5';
62 61
 		}
@@ -77,8 +76,7 @@  discard block
 block discarded – undo
77 76
 			{
78 77
 				$work_factor = 8;  // Reasonable default
79 78
 			}
80
-		}
81
-		else
79
+		} else
82 80
 		{
83 81
 			$work_factor = 8;
84 82
 		}
@@ -176,24 +174,19 @@  discard block
 block discarded – undo
176 174
 		if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
177 175
 		{
178 176
 			return 'bcrypt';
179
-		}
180
-		elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
177
+		} elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
181 178
 		{
182 179
 			return 'pbkdf2';
183
-		}
184
-		elseif(strlen($hash) === 32 && ctype_xdigit($hash))
180
+		} elseif(strlen($hash) === 32 && ctype_xdigit($hash))
185 181
 		{
186 182
 			return 'md5';
187
-		}
188
-		elseif(strlen($hash) === 16 && ctype_xdigit($hash))
183
+		} elseif(strlen($hash) === 16 && ctype_xdigit($hash))
189 184
 		{
190 185
 			return 'mysql_old_password';
191
-		}
192
-		elseif(strlen($hash) === 41 && $hash[0] === '*')
186
+		} elseif(strlen($hash) === 41 && $hash[0] === '*')
193 187
 		{
194 188
 			return 'mysql_password';
195
-		}
196
-		else
189
+		} else
197 190
 		{
198 191
 			return false;
199 192
 		}
@@ -209,12 +202,10 @@  discard block
 block discarded – undo
209 202
 		if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
210 203
 		{
211 204
 			return intval($matches[1], 10);
212
-		}
213
-		elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
205
+		} elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
214 206
 		{
215 207
 			return max(0, round(log($matches[1], 2)) - 5);
216
-		}
217
-		else
208
+		} else
218 209
 		{
219 210
 			return false;
220 211
 		}
@@ -250,22 +241,18 @@  discard block
 block discarded – undo
250 241
 		if(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(PHP_VERSION, '5.4', '>=')))
251 242
 		{
252 243
 			$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
253
-		}
254
-		elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>=')))
244
+		} elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>=')))
255 245
 		{
256 246
 			$entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_DEV_URANDOM);
257
-		}
258
-		elseif(function_exists('mcrypt_create_iv') && $is_windows)
247
+		} elseif(function_exists('mcrypt_create_iv') && $is_windows)
259 248
 		{
260 249
 			$entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_RAND);
261
-		}
262
-		elseif(!$is_windows && @is_readable('/dev/urandom'))
250
+		} elseif(!$is_windows && @is_readable('/dev/urandom'))
263 251
 		{
264 252
 			$fp = fopen('/dev/urandom', 'rb');
265 253
 			$entropy = fread($fp, $entropy_capped_bytes);
266 254
 			fclose($fp);
267
-		}
268
-		else
255
+		} else
269 256
 		{
270 257
 			$entropy = '';
271 258
 			for($i = 0; $i < $entropy_capped_bytes; $i += 2)
@@ -341,8 +328,7 @@  discard block
 block discarded – undo
341 328
 		if(function_exists('hash_pbkdf2'))
342 329
 		{
343 330
 			return hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, true);
344
-		}
345
-		else
331
+		} else
346 332
 		{
347 333
 			$output = '';
348 334
 			$block_count = ceil($length / strlen(hash($algorithm, '', true)));  // key length divided by the length of one hash
@@ -350,10 +336,12 @@  discard block
 block discarded – undo
350 336
 			{
351 337
 				$last = $salt . pack('N', $i);  // $i encoded as 4 bytes, big endian
352 338
 				$last = $xorsum = hash_hmac($algorithm, $last, $password, true);  // first iteration
353
-				for($j = 1; $j < $iterations; $j++)  // The other $count - 1 iterations
339
+				for($j = 1; $j < $iterations; $j++) {
340
+					// The other $count - 1 iterations
354 341
 				{
355 342
 					$xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));
356 343
 				}
344
+				}
357 345
 				$output .= $xorsum;
358 346
 			}
359 347
 			return substr($output, 0, $length);
Please login to merge, or discard this patch.
classes/security/Purifier.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function getInstance()
24 24
 	{
25
-		if(!isset($GLOBALS['__PURIFIER_INSTANCE__']))
25
+		if (!isset($GLOBALS['__PURIFIER_INSTANCE__']))
26 26
 		{
27 27
 			$GLOBALS['__PURIFIER_INSTANCE__'] = new Purifier();
28 28
 		}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	{
53 53
 		// add attribute for edit component
54 54
 		$editComponentAttrs = $this->_searchEditComponent($content);
55
-		if(is_array($editComponentAttrs))
55
+		if (is_array($editComponentAttrs))
56 56
 		{
57
-			foreach($editComponentAttrs AS $k => $v)
57
+			foreach ($editComponentAttrs AS $k => $v)
58 58
 			{
59 59
 				$this->_def->addAttribute('img', $v, 'CDATA');
60 60
 				$this->_def->addAttribute('div', $v, 'CDATA');
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 
64 64
 		// add attribute for widget component
65 65
 		$widgetAttrs = $this->_searchWidget($content);
66
-		if(is_array($widgetAttrs))
66
+		if (is_array($widgetAttrs))
67 67
 		{
68
-			foreach($widgetAttrs AS $k => $v)
68
+			foreach ($widgetAttrs AS $k => $v)
69 69
 			{
70 70
 				$this->_def->addAttribute('img', $v, 'CDATA');
71 71
 			}
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 		preg_match_all('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', $content, $m);
83 83
 
84 84
 		$attributeList = array();
85
-		if(is_array($m[2]))
85
+		if (is_array($m[2]))
86 86
 		{
87
-			foreach($m[2] as $key => $value)
87
+			foreach ($m[2] as $key => $value)
88 88
 			{
89 89
 				unset($script, $m2);
90 90
 				$script = " {$m[2][$key]} editor_component={$m[3][$key]}";
91 91
 
92
-				if(preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
92
+				if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
93 93
 				{
94
-					foreach($m2[1] as $value2)
94
+					foreach ($m2[1] as $value2)
95 95
 					{
96 96
 						//SECISSUE check style attr
97
-						if($value2 == 'style')
97
+						if ($value2 == 'style')
98 98
 						{
99 99
 							continue;
100 100
 						}
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
 		preg_match_all('!<(?:(div)|img)([^>]*)class="zbxe_widget_output"([^>]*)>(?(1)(.*?)</div>)!is', $content, $m);
118 118
 
119 119
 		$attributeList = array();
120
-		if(is_array($m[3]))
120
+		if (is_array($m[3]))
121 121
 		{
122 122
 			$content = str_replace('<img class="zbxe_widget_output"', '<img src="" class="zbxe_widget_output"', $content);
123 123
 
124
-			foreach($m[3] as $key => $value)
124
+			foreach ($m[3] as $key => $value)
125 125
 			{
126 126
 				if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2))
127 127
 				{
128
-					foreach($m2[1] as $value2)
128
+					foreach ($m2[1] as $value2)
129 129
 					{
130 130
 						//SECISSUE check style attr
131
-						if($value2 == 'style')
131
+						if ($value2 == 'style')
132 132
 						{
133 133
 							continue;
134 134
 						}
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 		$whiteDomainRegex = '%^(';
150 150
 		$whiteDomainCount = count($whiteIframeUrlList);
151 151
 
152
-		$i=1;
153
-		if(is_array($whiteIframeUrlList))
152
+		$i = 1;
153
+		if (is_array($whiteIframeUrlList))
154 154
 		{
155
-			foreach($whiteIframeUrlList as $value)
155
+			foreach ($whiteIframeUrlList as $value)
156 156
 			{
157 157
 				$whiteDomainRegex .= $value;
158 158
 
159
-				if($i < $whiteDomainCount)
159
+				if ($i < $whiteDomainCount)
160 160
 				{
161 161
 					$whiteDomainRegex .= '|';
162 162
 				}
Please login to merge, or discard this patch.
classes/security/htmlpurifier/library/HTMLPurifier.auto.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
  * This is a stub include that automatically configures the include path.
5 5
  */
6 6
 
7
-set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
7
+set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
8 8
 require_once 'HTMLPurifier/Bootstrap.php';
9 9
 require_once 'HTMLPurifier.autoload.php';
10 10
 
Please login to merge, or discard this patch.