Completed
Push — release-2.1 ( deac78...651c45 )
by Colin
39:45 queued 31:25
created
Themes/default/Memberlist.template.php 1 patch
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,9 +27,10 @@  discard block
 block discarded – undo
27 27
 			<h3 class="catbg">
28 28
 				<span class="floatleft">', $txt['members_list'], '</span>';
29 29
 
30
-	if (!isset($context['old_search']))
31
-		echo '
30
+	if (!isset($context['old_search'])) {
31
+			echo '
32 32
 				<span class="floatright">', $context['letter_links'], '</span>';
33
+	}
33 34
 	echo '
34 35
 			</h3>
35 36
 		</div>';
@@ -44,20 +45,23 @@  discard block
 block discarded – undo
44 45
 	foreach ($context['columns'] as $key => $column)
45 46
 	{
46 47
 		// @TODO maybe find something nicer?
47
-		if ($key == 'email_address' && !$context['can_send_email'])
48
-			continue;
48
+		if ($key == 'email_address' && !$context['can_send_email']) {
49
+					continue;
50
+		}
49 51
 
50 52
 		// This is a selected column, so underline it or some such.
51
-		if ($column['selected'])
52
-			echo '
53
+		if ($column['selected']) {
54
+					echo '
53 55
 						<th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', ' selected" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . '>
54 56
 							<a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></th>';
57
+		}
55 58
 
56 59
 		// This is just some column... show the link and be done with it.
57
-		else
58
-			echo '
60
+		else {
61
+					echo '
59 62
 						<th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' style="width: ' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
60 63
 						', $column['link'], '</th>';
64
+		}
61 65
 	}
62 66
 
63 67
 	echo '
@@ -77,9 +81,10 @@  discard block
 block discarded – undo
77 81
 						</td>
78 82
 						<td class="lefttext">', $member['link'], '</td>';
79 83
 
80
-			if (!isset($context['disabled_fields']['website']))
81
-				echo '
84
+			if (!isset($context['disabled_fields']['website'])) {
85
+							echo '
82 86
 						<td class="centertext website_url">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank" rel="noopener"><span class="generic_icons www" title="' . $member['website']['title'] . '"></span></a>' : '', '</td>';
87
+			}
83 88
 
84 89
 			// Group and date.
85 90
 			echo '
@@ -92,32 +97,35 @@  discard block
 block discarded – undo
92 97
 						<td class="centertext post_count">', $member['posts'], '</td>
93 98
 						<td class="statsbar">';
94 99
 
95
-				if (!empty($member['post_percent']))
96
-					echo '
100
+				if (!empty($member['post_percent'])) {
101
+									echo '
97 102
 							<div class="generic_bar">
98 103
 								<div class="bar" style="width: ', $member['post_percent'], '%;"></div>
99 104
 							</div>';
105
+				}
100 106
 
101 107
 				echo '
102 108
 						</td>';
103 109
 			}
104 110
 
105 111
 			// Show custom fields marked to be shown here
106
-			if (!empty($context['custom_profile_fields']['columns']))
107
-				foreach ($context['custom_profile_fields']['columns'] as $key => $column)
112
+			if (!empty($context['custom_profile_fields']['columns'])) {
113
+							foreach ($context['custom_profile_fields']['columns'] as $key => $column)
108 114
 					echo '
109 115
 						<td class="centertext">', $member['options'][$key], '</td>';
116
+			}
110 117
 
111 118
 			echo '
112 119
 					</tr>';
113 120
 		}
114 121
 	}
115 122
 	// No members?
116
-	else
117
-		echo '
123
+	else {
124
+			echo '
118 125
 					<tr>
119 126
 						<td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
120 127
 					</tr>';
128
+	}
121 129
 
122 130
 	echo '
123 131
 				</tbody>
@@ -130,11 +138,12 @@  discard block
 block discarded – undo
130 138
 			<div class="pagelinks floatleft">', $context['page_index'], '</div>';
131 139
 
132 140
 	// If it is displaying the result of a search show a "search again" link to edit their criteria.
133
-	if (isset($context['old_search']))
134
-		echo '
141
+	if (isset($context['old_search'])) {
142
+			echo '
135 143
 			<div class="buttonlist floatright">
136 144
 				<a class="button" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
137 145
 			</div>';
146
+	}
138 147
 	echo '
139 148
 		</div>
140 149
 	</div><!-- #memberlist -->';
@@ -174,12 +183,13 @@  discard block
 block discarded – undo
174 183
 					<dd>
175 184
 						<ul>';
176 185
 
177
-	foreach ($context['search_fields'] as $id => $title)
178
-		echo '
186
+	foreach ($context['search_fields'] as $id => $title) {
187
+			echo '
179 188
 							<li>
180 189
 								<input type="checkbox" name="fields[]" id="fields-', $id, '" value="', $id, '"', in_array($id, $context['search_defaults']) ? ' checked' : '', '>
181 190
 								<label for="fields-', $id, '">', $title, '</label>
182 191
 							</li>';
192
+	}
183 193
 
184 194
 	echo '
185 195
 						</ul>
Please login to merge, or discard this patch.
Sources/Subs-Editor.php 1 patch
Braces   +409 added lines, -307 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * !!!Compatibility!!!
@@ -30,8 +31,9 @@  discard block
 block discarded – undo
30 31
 {
31 32
 	global $modSettings;
32 33
 
33
-	if (!$compat_mode)
34
-		return $text;
34
+	if (!$compat_mode) {
35
+			return $text;
36
+	}
35 37
 
36 38
 	// Turn line breaks back into br's.
37 39
 	$text = strtr($text, array("\r" => '', "\n" => '<br>'));
@@ -48,8 +50,9 @@  discard block
 block discarded – undo
48 50
 			for ($i = 0, $n = count($parts); $i < $n; $i++)
49 51
 			{
50 52
 				// Value of 2 means we're inside the tag.
51
-				if ($i % 4 == 2)
52
-					$parts[$i] = strtr($parts[$i], array('[' => '&#91;', ']' => '&#93;', "'" => "'"));
53
+				if ($i % 4 == 2) {
54
+									$parts[$i] = strtr($parts[$i], array('[' => '&#91;', ']' => '&#93;', "'" => "'"));
55
+				}
53 56
 			}
54 57
 			// Put our humpty dumpty message back together again.
55 58
 			$text = implode('', $parts);
@@ -107,8 +110,9 @@  discard block
 block discarded – undo
107 110
 	$text = preg_replace('~</p>\s*(?!<)~i', '</p><br>', $text);
108 111
 
109 112
 	// Safari/webkit wraps lines in Wysiwyg in <div>'s.
110
-	if (isBrowser('webkit'))
111
-		$text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text);
113
+	if (isBrowser('webkit')) {
114
+			$text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text);
115
+	}
112 116
 
113 117
 	// If there's a trailing break get rid of it - Firefox tends to add one.
114 118
 	$text = preg_replace('~<br\s?/?' . '>$~i', '', $text);
@@ -123,8 +127,9 @@  discard block
 block discarded – undo
123 127
 		for ($i = 0, $n = count($parts); $i < $n; $i++)
124 128
 		{
125 129
 			// Value of 2 means we're inside the tag.
126
-			if ($i % 4 == 2)
127
-				$parts[$i] = strip_tags($parts[$i]);
130
+			if ($i % 4 == 2) {
131
+							$parts[$i] = strip_tags($parts[$i]);
132
+			}
128 133
 		}
129 134
 
130 135
 		$text = strtr(implode('', $parts), array('#smf_br_spec_grudge_cool!#' => '<br>'));
@@ -150,18 +155,19 @@  discard block
 block discarded – undo
150 155
 			{
151 156
 				$found = array_search($file, $smileysto);
152 157
 				// Note the weirdness here is to stop double spaces between smileys.
153
-				if ($found)
154
-					$matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#';
155
-				else
156
-					$matches[1][$k] = '';
158
+				if ($found) {
159
+									$matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#';
160
+				} else {
161
+									$matches[1][$k] = '';
162
+				}
157 163
 			}
158
-		}
159
-		else
164
+		} else
160 165
 		{
161 166
 			// Load all the smileys.
162 167
 			$names = array();
163
-			foreach ($matches[1] as $file)
164
-				$names[] = $file;
168
+			foreach ($matches[1] as $file) {
169
+							$names[] = $file;
170
+			}
165 171
 			$names = array_unique($names);
166 172
 
167 173
 			if (!empty($names))
@@ -175,13 +181,15 @@  discard block
 block discarded – undo
175 181
 					)
176 182
 				);
177 183
 				$mappings = array();
178
-				while ($row = $smcFunc['db_fetch_assoc']($request))
179
-					$mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']);
184
+				while ($row = $smcFunc['db_fetch_assoc']($request)) {
185
+									$mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']);
186
+				}
180 187
 				$smcFunc['db_free_result']($request);
181 188
 
182
-				foreach ($matches[1] as $k => $file)
183
-					if (isset($mappings[$file]))
189
+				foreach ($matches[1] as $k => $file) {
190
+									if (isset($mappings[$file]))
184 191
 						$matches[1][$k] = '-[]-smf_smily_start#|#' . $mappings[$file] . '-[]-smf_smily_end#|#';
192
+				}
185 193
 			}
186 194
 		}
187 195
 
@@ -193,8 +201,9 @@  discard block
 block discarded – undo
193 201
 	}
194 202
 
195 203
 	// Only try to buy more time if the client didn't quit.
196
-	if (connection_aborted() && $context['server']['is_apache'])
197
-		@apache_reset_timeout();
204
+	if (connection_aborted() && $context['server']['is_apache']) {
205
+			@apache_reset_timeout();
206
+	}
198 207
 
199 208
 	$parts = preg_split('~(<[A-Za-z]+\s*[^<>]*?style="?[^<>"]+"?[^<>]*?(?:/?)>|</[A-Za-z]+>)~', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
200 209
 	$replacement = '';
@@ -205,9 +214,9 @@  discard block
 block discarded – undo
205 214
 		if (preg_match('~(<([A-Za-z]+)\s*[^<>]*?)style="?([^<>"]+)"?([^<>]*?(/?)>)~', $part, $matches) === 1)
206 215
 		{
207 216
 			// If it's being closed instantly, we can't deal with it...yet.
208
-			if ($matches[5] === '/')
209
-				continue;
210
-			else
217
+			if ($matches[5] === '/') {
218
+							continue;
219
+			} else
211 220
 			{
212 221
 				// Get an array of styles that apply to this element. (The strtr is there to combat HTML generated by Word.)
213 222
 				$styles = explode(';', strtr($matches[3], array('&quot;' => '')));
@@ -223,8 +232,9 @@  discard block
 block discarded – undo
223 232
 					$clean_type_value_pair = strtolower(strtr(trim($type_value_pair), '=', ':'));
224 233
 
225 234
 					// Something like 'font-weight: bold' is expected here.
226
-					if (strpos($clean_type_value_pair, ':') === false)
227
-						continue;
235
+					if (strpos($clean_type_value_pair, ':') === false) {
236
+											continue;
237
+					}
228 238
 
229 239
 					// Capture the elements of a single style item (e.g. 'font-weight' and 'bold').
230 240
 					list ($style_type, $style_value) = explode(':', $type_value_pair);
@@ -246,8 +256,7 @@  discard block
 block discarded – undo
246 256
 							{
247 257
 								$curCloseTags .= '[/u]';
248 258
 								$replacement .= '[u]';
249
-							}
250
-							elseif ($style_value == 'line-through')
259
+							} elseif ($style_value == 'line-through')
251 260
 							{
252 261
 								$curCloseTags .= '[/s]';
253 262
 								$replacement .= '[s]';
@@ -259,13 +268,11 @@  discard block
 block discarded – undo
259 268
 							{
260 269
 								$curCloseTags .= '[/left]';
261 270
 								$replacement .= '[left]';
262
-							}
263
-							elseif ($style_value == 'center')
271
+							} elseif ($style_value == 'center')
264 272
 							{
265 273
 								$curCloseTags .= '[/center]';
266 274
 								$replacement .= '[center]';
267
-							}
268
-							elseif ($style_value == 'right')
275
+							} elseif ($style_value == 'right')
269 276
 							{
270 277
 								$curCloseTags .= '[/right]';
271 278
 								$replacement .= '[right]';
@@ -287,8 +294,9 @@  discard block
 block discarded – undo
287 294
 
288 295
 						case 'font-size':
289 296
 							// Sometimes people put decimals where decimals should not be.
290
-							if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1)
291
-								$style_value = $dec_matches[1] . $dec_matches[2];
297
+							if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) {
298
+															$style_value = $dec_matches[1] . $dec_matches[2];
299
+							}
292 300
 
293 301
 							$curCloseTags .= '[/size]';
294 302
 							$replacement .= '[size=' . $style_value . ']';
@@ -296,8 +304,9 @@  discard block
 block discarded – undo
296 304
 
297 305
 						case 'font-family':
298 306
 							// Only get the first freaking font if there's a list!
299
-							if (strpos($style_value, ',') !== false)
300
-								$style_value = substr($style_value, 0, strpos($style_value, ','));
307
+							if (strpos($style_value, ',') !== false) {
308
+															$style_value = substr($style_value, 0, strpos($style_value, ','));
309
+							}
301 310
 
302 311
 							$curCloseTags .= '[/font]';
303 312
 							$replacement .= '[font=' . strtr($style_value, array("'" => '')) . ']';
@@ -306,13 +315,15 @@  discard block
 block discarded – undo
306 315
 						// This is a hack for images with dimensions embedded.
307 316
 						case 'width':
308 317
 						case 'height':
309
-							if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1)
310
-								$extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"';
318
+							if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) {
319
+															$extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"';
320
+							}
311 321
 						break;
312 322
 
313 323
 						case 'list-style-type':
314
-							if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1)
315
-								$extra_attr .= ' listtype="' . $listType[0] . '"';
324
+							if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) {
325
+															$extra_attr .= ' listtype="' . $listType[0] . '"';
326
+							}
316 327
 						break;
317 328
 					}
318 329
 				}
@@ -325,18 +336,17 @@  discard block
 block discarded – undo
325 336
 				}
326 337
 
327 338
 				// If there's something that still needs closing, push it to the stack.
328
-				if (!empty($curCloseTags))
329
-					array_push($stack, array(
339
+				if (!empty($curCloseTags)) {
340
+									array_push($stack, array(
330 341
 							'element' => strtolower($curElement),
331 342
 							'closeTags' => $curCloseTags
332 343
 						)
333 344
 					);
334
-				elseif (!empty($extra_attr))
335
-					$replacement .= $precedingStyle . $extra_attr . $afterStyle;
345
+				} elseif (!empty($extra_attr)) {
346
+									$replacement .= $precedingStyle . $extra_attr . $afterStyle;
347
+				}
336 348
 			}
337
-		}
338
-
339
-		elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1)
349
+		} elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1)
340 350
 		{
341 351
 			// Is this the element that we've been waiting for to be closed?
342 352
 			if (!empty($stack) && strtolower($matches[1]) === $stack[count($stack) - 1]['element'])
@@ -346,28 +356,32 @@  discard block
 block discarded – undo
346 356
 			}
347 357
 
348 358
 			// Must've been something else.
349
-			else
350
-				$replacement .= $part;
359
+			else {
360
+							$replacement .= $part;
361
+			}
351 362
 		}
352 363
 		// In all other cases, just add the part to the replacement.
353
-		else
354
-			$replacement .= $part;
364
+		else {
365
+					$replacement .= $part;
366
+		}
355 367
 	}
356 368
 
357 369
 	// Now put back the replacement in the text.
358 370
 	$text = $replacement;
359 371
 
360 372
 	// We are not finished yet, request more time.
361
-	if (connection_aborted() && $context['server']['is_apache'])
362
-		@apache_reset_timeout();
373
+	if (connection_aborted() && $context['server']['is_apache']) {
374
+			@apache_reset_timeout();
375
+	}
363 376
 
364 377
 	// Let's pull out any legacy alignments.
365 378
 	while (preg_match('~<([A-Za-z]+)\s+[^<>]*?(align="*(left|center|right)"*)[^<>]*?(/?)>~i', $text, $matches) === 1)
366 379
 	{
367 380
 		// Find the position in the text of this tag over again.
368 381
 		$start_pos = strpos($text, $matches[0]);
369
-		if ($start_pos === false)
370
-			break;
382
+		if ($start_pos === false) {
383
+					break;
384
+		}
371 385
 
372 386
 		// End tag?
373 387
 		if ($matches[4] != '/' && strpos($text, '</' . $matches[1] . '>', $start_pos) !== false)
@@ -381,8 +395,7 @@  discard block
 block discarded – undo
381 395
 
382 396
 			// Put the tags back into the body.
383 397
 			$text = substr($text, 0, $start_pos) . $tag . '[' . $matches[3] . ']' . $content . '[/' . $matches[3] . ']' . substr($text, $end_pos);
384
-		}
385
-		else
398
+		} else
386 399
 		{
387 400
 			// Just get rid of this evil tag.
388 401
 			$text = substr($text, 0, $start_pos) . substr($text, $start_pos + strlen($matches[0]));
@@ -395,8 +408,9 @@  discard block
 block discarded – undo
395 408
 		// Find the position of this again.
396 409
 		$start_pos = strpos($text, $matches[0]);
397 410
 		$end_pos = false;
398
-		if ($start_pos === false)
399
-			break;
411
+		if ($start_pos === false) {
412
+					break;
413
+		}
400 414
 
401 415
 		// This must have an end tag - and we must find the right one.
402 416
 		$lower_text = strtolower($text);
@@ -429,8 +443,9 @@  discard block
 block discarded – undo
429 443
 				break;
430 444
 			}
431 445
 		}
432
-		if ($end_pos === false)
433
-			break;
446
+		if ($end_pos === false) {
447
+					break;
448
+		}
434 449
 
435 450
 		// Now work out what the attributes are.
436 451
 		$attribs = fetchTagAttributes($matches[1]);
@@ -444,11 +459,11 @@  discard block
 block discarded – undo
444 459
 				$v = (int) trim($v);
445 460
 				$v = empty($v) ? 1 : $v;
446 461
 				$tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]');
462
+			} elseif ($s == 'face') {
463
+							$tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]');
464
+			} elseif ($s == 'color') {
465
+							$tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]');
447 466
 			}
448
-			elseif ($s == 'face')
449
-				$tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]');
450
-			elseif ($s == 'color')
451
-				$tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]');
452 467
 		}
453 468
 
454 469
 		// As before add in our tags.
@@ -456,8 +471,9 @@  discard block
 block discarded – undo
456 471
 		foreach ($tags as $tag)
457 472
 		{
458 473
 			$before .= $tag[0];
459
-			if (isset($tag[1]))
460
-				$after = $tag[1] . $after;
474
+			if (isset($tag[1])) {
475
+							$after = $tag[1] . $after;
476
+			}
461 477
 		}
462 478
 
463 479
 		// Remove the tag so it's never checked again.
@@ -468,8 +484,9 @@  discard block
 block discarded – undo
468 484
 	}
469 485
 
470 486
 	// Almost there, just a little more time.
471
-	if (connection_aborted() && $context['server']['is_apache'])
472
-		@apache_reset_timeout();
487
+	if (connection_aborted() && $context['server']['is_apache']) {
488
+			@apache_reset_timeout();
489
+	}
473 490
 
474 491
 	if (count($parts = preg_split('~<(/?)(li|ol|ul)([^>]*)>~i', $text, null, PREG_SPLIT_DELIM_CAPTURE)) > 1)
475 492
 	{
@@ -525,12 +542,13 @@  discard block
 block discarded – undo
525 542
 						{
526 543
 							$inList = true;
527 544
 
528
-							if ($tag === 'ol')
529
-								$listType = 'decimal';
530
-							elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1)
531
-								$listType = $listTypeMapping[$match[1]];
532
-							else
533
-								$listType = null;
545
+							if ($tag === 'ol') {
546
+															$listType = 'decimal';
547
+							} elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) {
548
+															$listType = $listTypeMapping[$match[1]];
549
+							} else {
550
+															$listType = null;
551
+							}
534 552
 
535 553
 							$listDepth++;
536 554
 
@@ -594,9 +612,7 @@  discard block
 block discarded – undo
594 612
 							$parts[$i + 1] = '';
595 613
 							$parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]';
596 614
 							$parts[$i + 3] = '';
597
-						}
598
-
599
-						else
615
+						} else
600 616
 						{
601 617
 							// We're in a list item.
602 618
 							if ($listDepth > 0)
@@ -633,9 +649,7 @@  discard block
 block discarded – undo
633 649
 							$parts[$i + 1] = '';
634 650
 							$parts[$i + 2] = '';
635 651
 							$parts[$i + 3] = '';
636
-						}
637
-
638
-						else
652
+						} else
639 653
 						{
640 654
 							// Remove the trailing breaks from the list item.
641 655
 							$parts[$i] = preg_replace('~\s*<br\s*' . '/?' . '>\s*$~', '', $parts[$i]);
@@ -673,8 +687,9 @@  discard block
 block discarded – undo
673 687
 			$text .= str_repeat("\t", $listDepth) . '[/list]';
674 688
 		}
675 689
 
676
-		for ($i = $listDepth; $i > 0; $i--)
677
-			$text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]';
690
+		for ($i = $listDepth; $i > 0; $i--) {
691
+					$text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]';
692
+		}
678 693
 	}
679 694
 
680 695
 	// I love my own image...
@@ -682,8 +697,9 @@  discard block
 block discarded – undo
682 697
 	{
683 698
 		// Find the position of the image.
684 699
 		$start_pos = strpos($text, $matches[0]);
685
-		if ($start_pos === false)
686
-			break;
700
+		if ($start_pos === false) {
701
+					break;
702
+		}
687 703
 		$end_pos = $start_pos + strlen($matches[0]);
688 704
 
689 705
 		$params = '';
@@ -692,12 +708,13 @@  discard block
 block discarded – undo
692 708
 		$attrs = fetchTagAttributes($matches[1]);
693 709
 		foreach ($attrs as $attrib => $value)
694 710
 		{
695
-			if (in_array($attrib, array('width', 'height')))
696
-				$params .= ' ' . $attrib . '=' . (int) $value;
697
-			elseif ($attrib == 'alt' && trim($value) != '')
698
-				$params .= ' alt=' . trim($value);
699
-			elseif ($attrib == 'src')
700
-				$src = trim($value);
711
+			if (in_array($attrib, array('width', 'height'))) {
712
+							$params .= ' ' . $attrib . '=' . (int) $value;
713
+			} elseif ($attrib == 'alt' && trim($value) != '') {
714
+							$params .= ' alt=' . trim($value);
715
+			} elseif ($attrib == 'src') {
716
+							$src = trim($value);
717
+			}
701 718
 		}
702 719
 
703 720
 		$tag = '';
@@ -708,10 +725,11 @@  discard block
 block discarded – undo
708 725
 			{
709 726
 				$baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']);
710 727
 
711
-				if (substr($src, 0, 1) === '/')
712
-					$src = $baseURL . $src;
713
-				else
714
-					$src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src;
728
+				if (substr($src, 0, 1) === '/') {
729
+									$src = $baseURL . $src;
730
+				} else {
731
+									$src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src;
732
+				}
715 733
 			}
716 734
 
717 735
 			$tag = '[img' . $params . ']' . $src . '[/img]';
@@ -889,20 +907,23 @@  discard block
 block discarded – undo
889 907
 		},
890 908
 	);
891 909
 
892
-	foreach ($tags as $tag => $replace)
893
-		$text = preg_replace_callback($tag, $replace, $text);
910
+	foreach ($tags as $tag => $replace) {
911
+			$text = preg_replace_callback($tag, $replace, $text);
912
+	}
894 913
 
895 914
 	// Please give us just a little more time.
896
-	if (connection_aborted() && $context['server']['is_apache'])
897
-		@apache_reset_timeout();
915
+	if (connection_aborted() && $context['server']['is_apache']) {
916
+			@apache_reset_timeout();
917
+	}
898 918
 
899 919
 	// What about URL's - the pain in the ass of the tag world.
900 920
 	while (preg_match('~<a\s+([^<>]*)>([^<>]*)</a>~i', $text, $matches) === 1)
901 921
 	{
902 922
 		// Find the position of the URL.
903 923
 		$start_pos = strpos($text, $matches[0]);
904
-		if ($start_pos === false)
905
-			break;
924
+		if ($start_pos === false) {
925
+					break;
926
+		}
906 927
 		$end_pos = $start_pos + strlen($matches[0]);
907 928
 
908 929
 		$tag_type = 'url';
@@ -916,8 +937,9 @@  discard block
 block discarded – undo
916 937
 				$href = trim($value);
917 938
 
918 939
 				// Are we dealing with an FTP link?
919
-				if (preg_match('~^ftps?://~', $href) === 1)
920
-					$tag_type = 'ftp';
940
+				if (preg_match('~^ftps?://~', $href) === 1) {
941
+									$tag_type = 'ftp';
942
+				}
921 943
 
922 944
 				// Or is this a link to an email address?
923 945
 				elseif (substr($href, 0, 7) == 'mailto:')
@@ -931,28 +953,31 @@  discard block
 block discarded – undo
931 953
 				{
932 954
 					$baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']);
933 955
 
934
-					if (substr($href, 0, 1) === '/')
935
-						$href = $baseURL . $href;
936
-					else
937
-						$href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href;
956
+					if (substr($href, 0, 1) === '/') {
957
+											$href = $baseURL . $href;
958
+					} else {
959
+											$href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href;
960
+					}
938 961
 				}
939 962
 			}
940 963
 
941 964
 			// External URL?
942 965
 			if ($attrib == 'target' && $tag_type == 'url')
943 966
 			{
944
-				if (trim($value) == '_blank')
945
-					$tag_type == 'iurl';
967
+				if (trim($value) == '_blank') {
968
+									$tag_type == 'iurl';
969
+				}
946 970
 			}
947 971
 		}
948 972
 
949 973
 		$tag = '';
950 974
 		if ($href != '')
951 975
 		{
952
-			if ($matches[2] == $href)
953
-				$tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']';
954
-			else
955
-				$tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']';
976
+			if ($matches[2] == $href) {
977
+							$tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']';
978
+			} else {
979
+							$tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']';
980
+			}
956 981
 		}
957 982
 
958 983
 		// Replace the tag
@@ -991,17 +1016,18 @@  discard block
 block discarded – undo
991 1016
 		// We're either moving from the key to the attribute or we're in a string and this is fine.
992 1017
 		if ($text[$i] == '=')
993 1018
 		{
994
-			if ($tag_state == 0)
995
-				$tag_state = 1;
996
-			elseif ($tag_state == 2)
997
-				$value .= '=';
1019
+			if ($tag_state == 0) {
1020
+							$tag_state = 1;
1021
+			} elseif ($tag_state == 2) {
1022
+							$value .= '=';
1023
+			}
998 1024
 		}
999 1025
 		// A space is either moving from an attribute back to a potential key or in a string is fine.
1000 1026
 		elseif ($text[$i] == ' ')
1001 1027
 		{
1002
-			if ($tag_state == 2)
1003
-				$value .= ' ';
1004
-			elseif ($tag_state == 1)
1028
+			if ($tag_state == 2) {
1029
+							$value .= ' ';
1030
+			} elseif ($tag_state == 1)
1005 1031
 			{
1006 1032
 				$attribs[$key] = $value;
1007 1033
 				$key = $value = '';
@@ -1012,24 +1038,27 @@  discard block
 block discarded – undo
1012 1038
 		elseif ($text[$i] == '"')
1013 1039
 		{
1014 1040
 			// Must be either going into or out of a string.
1015
-			if ($tag_state == 1)
1016
-				$tag_state = 2;
1017
-			else
1018
-				$tag_state = 1;
1041
+			if ($tag_state == 1) {
1042
+							$tag_state = 2;
1043
+			} else {
1044
+							$tag_state = 1;
1045
+			}
1019 1046
 		}
1020 1047
 		// Otherwise it's fine.
1021 1048
 		else
1022 1049
 		{
1023
-			if ($tag_state == 0)
1024
-				$key .= $text[$i];
1025
-			else
1026
-				$value .= $text[$i];
1050
+			if ($tag_state == 0) {
1051
+							$key .= $text[$i];
1052
+			} else {
1053
+							$value .= $text[$i];
1054
+			}
1027 1055
 		}
1028 1056
 	}
1029 1057
 
1030 1058
 	// Anything left?
1031
-	if ($key != '' && $value != '')
1032
-		$attribs[$key] = $value;
1059
+	if ($key != '' && $value != '') {
1060
+			$attribs[$key] = $value;
1061
+	}
1033 1062
 
1034 1063
 	return $attribs;
1035 1064
 }
@@ -1045,15 +1074,17 @@  discard block
 block discarded – undo
1045 1074
 	global $modSettings;
1046 1075
 
1047 1076
 	// Don't care about the texts that are too short.
1048
-	if (strlen($text) < 3)
1049
-		return $text;
1077
+	if (strlen($text) < 3) {
1078
+			return $text;
1079
+	}
1050 1080
 
1051 1081
 	// A list of tags that's disabled by the admin.
1052 1082
 	$disabled = empty($modSettings['disabledBBC']) ? array() : array_flip(explode(',', strtolower($modSettings['disabledBBC'])));
1053 1083
 
1054 1084
 	// Add flash if it's disabled as embedded tag.
1055
-	if (empty($modSettings['enableEmbeddedFlash']))
1056
-		$disabled['flash'] = true;
1085
+	if (empty($modSettings['enableEmbeddedFlash'])) {
1086
+			$disabled['flash'] = true;
1087
+	}
1057 1088
 
1058 1089
 	// Get a list of all the tags that are not disabled.
1059 1090
 	$all_tags = parse_bbc(false);
@@ -1061,10 +1092,12 @@  discard block
 block discarded – undo
1061 1092
 	$self_closing_tags = array();
1062 1093
 	foreach ($all_tags as $tag)
1063 1094
 	{
1064
-		if (!isset($disabled[$tag['tag']]))
1065
-			$valid_tags[$tag['tag']] = !empty($tag['block_level']);
1066
-		if (isset($tag['type']) && $tag['type'] == 'closed')
1067
-			$self_closing_tags[] = $tag['tag'];
1095
+		if (!isset($disabled[$tag['tag']])) {
1096
+					$valid_tags[$tag['tag']] = !empty($tag['block_level']);
1097
+		}
1098
+		if (isset($tag['type']) && $tag['type'] == 'closed') {
1099
+					$self_closing_tags[] = $tag['tag'];
1100
+		}
1068 1101
 	}
1069 1102
 
1070 1103
 	// Right - we're going to start by going through the whole lot to make sure we don't have align stuff crossed as this happens load and is stupid!
@@ -1091,16 +1124,19 @@  discard block
 block discarded – undo
1091 1124
 				$tagName = substr($match, $isClosingTag ? 2 : 1, -1);
1092 1125
 
1093 1126
 				// We're closing the exact same tag that we opened.
1094
-				if ($isClosingTag && $insideTag === $tagName)
1095
-					$insideTag = null;
1127
+				if ($isClosingTag && $insideTag === $tagName) {
1128
+									$insideTag = null;
1129
+				}
1096 1130
 
1097 1131
 				// We're opening a tag and we're not yet inside one either
1098
-				elseif (!$isClosingTag && $insideTag === null)
1099
-					$insideTag = $tagName;
1132
+				elseif (!$isClosingTag && $insideTag === null) {
1133
+									$insideTag = $tagName;
1134
+				}
1100 1135
 
1101 1136
 				// In all other cases, this tag must be invalid
1102
-				else
1103
-					unset($matches[$i]);
1137
+				else {
1138
+									unset($matches[$i]);
1139
+				}
1104 1140
 			}
1105 1141
 
1106 1142
 			// The next one is gonna be the other one.
@@ -1108,8 +1144,9 @@  discard block
 block discarded – undo
1108 1144
 		}
1109 1145
 
1110 1146
 		// We're still inside a tag and had no chance for closure?
1111
-		if ($insideTag !== null)
1112
-			$matches[] = '[/' . $insideTag . ']';
1147
+		if ($insideTag !== null) {
1148
+					$matches[] = '[/' . $insideTag . ']';
1149
+		}
1113 1150
 
1114 1151
 		// And a complete text string again.
1115 1152
 		$text = implode('', $matches);
@@ -1118,8 +1155,9 @@  discard block
 block discarded – undo
1118 1155
 	// Quickly remove any tags which are back to back.
1119 1156
 	$backToBackPattern = '~\\[(' . implode('|', array_diff(array_keys($valid_tags), array('td', 'anchor'))) . ')[^<>\\[\\]]*\\]\s*\\[/\\1\\]~';
1120 1157
 	$lastlen = 0;
1121
-	while (strlen($text) !== $lastlen)
1122
-		$lastlen = strlen($text = preg_replace($backToBackPattern, '', $text));
1158
+	while (strlen($text) !== $lastlen) {
1159
+			$lastlen = strlen($text = preg_replace($backToBackPattern, '', $text));
1160
+	}
1123 1161
 
1124 1162
 	// Need to sort the tags my name length.
1125 1163
 	uksort($valid_tags, 'sort_array_length');
@@ -1156,8 +1194,9 @@  discard block
 block discarded – undo
1156 1194
 			$isCompetingTag = in_array($tag, $competing_tags);
1157 1195
 
1158 1196
 			// Check if this might be one of those cleaned out tags.
1159
-			if ($tag === '')
1160
-				continue;
1197
+			if ($tag === '') {
1198
+							continue;
1199
+			}
1161 1200
 
1162 1201
 			// Special case: inside [code] blocks any code is left untouched.
1163 1202
 			elseif ($tag === 'code')
@@ -1168,8 +1207,9 @@  discard block
 block discarded – undo
1168 1207
 					$inCode = false;
1169 1208
 
1170 1209
 					// Reopen tags that were closed before the code block.
1171
-					if (!empty($inlineElements))
1172
-						$parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']';
1210
+					if (!empty($inlineElements)) {
1211
+											$parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']';
1212
+					}
1173 1213
 				}
1174 1214
 
1175 1215
 				// We're outside a coding and nobbc block and opening it.
@@ -1198,8 +1238,9 @@  discard block
 block discarded – undo
1198 1238
 					$inNoBbc = false;
1199 1239
 
1200 1240
 					// Some inline elements might've been closed that need reopening.
1201
-					if (!empty($inlineElements))
1202
-						$parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']';
1241
+					if (!empty($inlineElements)) {
1242
+											$parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']';
1243
+					}
1203 1244
 				}
1204 1245
 
1205 1246
 				// We're outside a nobbc and coding block and opening it.
@@ -1219,8 +1260,9 @@  discard block
 block discarded – undo
1219 1260
 			}
1220 1261
 
1221 1262
 			// So, we're inside one of the special blocks: ignore any tag.
1222
-			elseif ($inCode || $inNoBbc)
1223
-				continue;
1263
+			elseif ($inCode || $inNoBbc) {
1264
+							continue;
1265
+			}
1224 1266
 
1225 1267
 			// We're dealing with an opening tag.
1226 1268
 			if ($isOpeningTag)
@@ -1261,8 +1303,9 @@  discard block
 block discarded – undo
1261 1303
 							if ($parts[$j + 3] === $tag)
1262 1304
 							{
1263 1305
 								// If it's an opening tag, increase the level.
1264
-								if ($parts[$j + 2] === '')
1265
-									$curLevel++;
1306
+								if ($parts[$j + 2] === '') {
1307
+																	$curLevel++;
1308
+								}
1266 1309
 
1267 1310
 								// A closing tag, decrease the level.
1268 1311
 								else
@@ -1285,13 +1328,15 @@  discard block
 block discarded – undo
1285 1328
 					{
1286 1329
 						if ($isCompetingTag)
1287 1330
 						{
1288
-							if (!isset($competingElements[$tag]))
1289
-								$competingElements[$tag] = array();
1331
+							if (!isset($competingElements[$tag])) {
1332
+															$competingElements[$tag] = array();
1333
+							}
1290 1334
 
1291 1335
 							$competingElements[$tag][] = $parts[$i + 4];
1292 1336
 
1293
-							if (count($competingElements[$tag]) > 1)
1294
-								$parts[$i] .= '[/' . $tag . ']';
1337
+							if (count($competingElements[$tag]) > 1) {
1338
+															$parts[$i] .= '[/' . $tag . ']';
1339
+							}
1295 1340
 						}
1296 1341
 
1297 1342
 						$inlineElements[$elementContent] = $tag;
@@ -1311,15 +1356,17 @@  discard block
 block discarded – undo
1311 1356
 						$addClosingTags = array();
1312 1357
 						while ($element = array_pop($blockElements))
1313 1358
 						{
1314
-							if ($element === $tag)
1315
-								break;
1359
+							if ($element === $tag) {
1360
+															break;
1361
+							}
1316 1362
 
1317 1363
 							// Still a block tag was open not equal to this tag.
1318 1364
 							$addClosingTags[] = $element['type'];
1319 1365
 						}
1320 1366
 
1321
-						if (!empty($addClosingTags))
1322
-							$parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1];
1367
+						if (!empty($addClosingTags)) {
1368
+													$parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1];
1369
+						}
1323 1370
 
1324 1371
 						// Apparently the closing tag was not found on the stack.
1325 1372
 						if (!is_string($element) || $element !== $tag)
@@ -1329,8 +1376,7 @@  discard block
 block discarded – undo
1329 1376
 							$parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = '';
1330 1377
 							continue;
1331 1378
 						}
1332
-					}
1333
-					else
1379
+					} else
1334 1380
 					{
1335 1381
 						// Get rid of this closing tag!
1336 1382
 						$parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = '';
@@ -1359,53 +1405,62 @@  discard block
 block discarded – undo
1359 1405
 							unset($inlineElements[$tagContentToBeClosed]);
1360 1406
 
1361 1407
 							// Was this the tag we were looking for?
1362
-							if ($tagToBeClosed === $tag)
1363
-								break;
1408
+							if ($tagToBeClosed === $tag) {
1409
+															break;
1410
+							}
1364 1411
 
1365 1412
 							// Nope, close it and look further!
1366
-							else
1367
-								$parts[$i] .= '[/' . $tagToBeClosed . ']';
1413
+							else {
1414
+															$parts[$i] .= '[/' . $tagToBeClosed . ']';
1415
+							}
1368 1416
 						}
1369 1417
 
1370 1418
 						if ($isCompetingTag && !empty($competingElements[$tag]))
1371 1419
 						{
1372 1420
 							array_pop($competingElements[$tag]);
1373 1421
 
1374
-							if (count($competingElements[$tag]) > 0)
1375
-								$parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5];
1422
+							if (count($competingElements[$tag]) > 0) {
1423
+															$parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5];
1424
+							}
1376 1425
 						}
1377 1426
 					}
1378 1427
 
1379 1428
 					// Unexpected closing tag, ex-ter-mi-nate.
1380
-					else
1381
-						$parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = '';
1429
+					else {
1430
+											$parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = '';
1431
+					}
1382 1432
 				}
1383 1433
 			}
1384 1434
 		}
1385 1435
 
1386 1436
 		// Close the code tags.
1387
-		if ($inCode)
1388
-			$parts[$i] .= '[/code]';
1437
+		if ($inCode) {
1438
+					$parts[$i] .= '[/code]';
1439
+		}
1389 1440
 
1390 1441
 		// The same for nobbc tags.
1391
-		elseif ($inNoBbc)
1392
-			$parts[$i] .= '[/nobbc]';
1442
+		elseif ($inNoBbc) {
1443
+					$parts[$i] .= '[/nobbc]';
1444
+		}
1393 1445
 
1394 1446
 		// Still inline tags left unclosed? Close them now, better late than never.
1395
-		elseif (!empty($inlineElements))
1396
-			$parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']';
1447
+		elseif (!empty($inlineElements)) {
1448
+					$parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']';
1449
+		}
1397 1450
 
1398 1451
 		// Now close the block elements.
1399
-		if (!empty($blockElements))
1400
-			$parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']';
1452
+		if (!empty($blockElements)) {
1453
+					$parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']';
1454
+		}
1401 1455
 
1402 1456
 		$text = implode('', $parts);
1403 1457
 	}
1404 1458
 
1405 1459
 	// Final clean up of back to back tags.
1406 1460
 	$lastlen = 0;
1407
-	while (strlen($text) !== $lastlen)
1408
-		$lastlen = strlen($text = preg_replace($backToBackPattern, '', $text));
1461
+	while (strlen($text) !== $lastlen) {
1462
+			$lastlen = strlen($text = preg_replace($backToBackPattern, '', $text));
1463
+	}
1409 1464
 
1410 1465
 	return $text;
1411 1466
 }
@@ -1434,22 +1489,25 @@  discard block
 block discarded – undo
1434 1489
 	$context['template_layers'] = array();
1435 1490
 	// Lets make sure we aren't going to output anything nasty.
1436 1491
 	@ob_end_clean();
1437
-	if (!empty($modSettings['enableCompressedOutput']))
1438
-		@ob_start('ob_gzhandler');
1439
-	else
1440
-		@ob_start();
1492
+	if (!empty($modSettings['enableCompressedOutput'])) {
1493
+			@ob_start('ob_gzhandler');
1494
+	} else {
1495
+			@ob_start();
1496
+	}
1441 1497
 
1442 1498
 	// If we don't have any locale better avoid broken js
1443
-	if (empty($txt['lang_locale']))
1444
-		die();
1499
+	if (empty($txt['lang_locale'])) {
1500
+			die();
1501
+	}
1445 1502
 
1446 1503
 	$file_data = '(function ($) {
1447 1504
 	\'use strict\';
1448 1505
 
1449 1506
 	$.sceditor.locale[' . JavaScriptEscape($txt['lang_locale']) . '] = {';
1450
-	foreach ($editortxt as $key => $val)
1451
-		$file_data .= '
1507
+	foreach ($editortxt as $key => $val) {
1508
+			$file_data .= '
1452 1509
 		' . JavaScriptEscape($key) . ': ' . JavaScriptEscape($val) . ',';
1510
+	}
1453 1511
 
1454 1512
 	$file_data .= '
1455 1513
 		dateFormat: "day.month.year"
@@ -1517,8 +1575,9 @@  discard block
 block discarded – undo
1517 1575
 				)
1518 1576
 			);
1519 1577
 			$icon_data = array();
1520
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1521
-				$icon_data[] = $row;
1578
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1579
+							$icon_data[] = $row;
1580
+			}
1522 1581
 			$smcFunc['db_free_result']($request);
1523 1582
 
1524 1583
 			$icons = array();
@@ -1533,9 +1592,9 @@  discard block
 block discarded – undo
1533 1592
 			}
1534 1593
 
1535 1594
 			cache_put_data('posting_icons-' . $board_id, $icons, 480);
1595
+		} else {
1596
+					$icons = $temp;
1536 1597
 		}
1537
-		else
1538
-			$icons = $temp;
1539 1598
 	}
1540 1599
 	call_integration_hook('integrate_load_message_icons', array(&$icons));
1541 1600
 
@@ -1577,8 +1636,9 @@  discard block
 block discarded – undo
1577 1636
 	{
1578 1637
 		// Some general stuff.
1579 1638
 		$settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
1580
-		if (!empty($context['drafts_autosave']))
1581
-			$context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000;
1639
+		if (!empty($context['drafts_autosave'])) {
1640
+					$context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000;
1641
+		}
1582 1642
 
1583 1643
 		// This really has some WYSIWYG stuff.
1584 1644
 		loadCSSFile('jquery.sceditor.css', array('force_current' => false, 'validate' => true), 'smf_jquery_sceditor');
@@ -1596,8 +1656,9 @@  discard block
 block discarded – undo
1596 1656
 		var bbc_quote = \'' . addcslashes($txt['quote'], "'") . '\';
1597 1657
 		var bbc_search_on = \'' . addcslashes($txt['search_on'], "'") . '\';');
1598 1658
 		// editor language file
1599
-		if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US')
1600
-			loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language');
1659
+		if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') {
1660
+					loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language');
1661
+		}
1601 1662
 
1602 1663
 		$context['shortcuts_text'] = $txt['shortcuts' . (!empty($context['drafts_save']) ? '_drafts' : '') . (stripos($_SERVER['HTTP_USER_AGENT'], 'Macintosh') !== false ? '_mac' : (isBrowser('is_firefox') ? '_firefox' : ''))];
1603 1664
 		$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv'))));
@@ -1606,11 +1667,12 @@  discard block
 block discarded – undo
1606 1667
 			loadJavaScriptFile('spellcheck.js', array('minimize' => true), 'smf_spellcheck');
1607 1668
 
1608 1669
 			// Some hidden information is needed in order to make the spell checking work.
1609
-			if (!isset($_REQUEST['xml']))
1610
-				$context['insert_after_template'] .= '
1670
+			if (!isset($_REQUEST['xml'])) {
1671
+							$context['insert_after_template'] .= '
1611 1672
 		<form name="spell_form" id="spell_form" method="post" accept-charset="' . $context['character_set'] . '" target="spellWindow" action="' . $scripturl . '?action=spellcheck">
1612 1673
 			<input type="hidden" name="spellstring" value="">
1613 1674
 		</form>';
1675
+			}
1614 1676
 		}
1615 1677
 	}
1616 1678
 
@@ -1802,10 +1864,12 @@  discard block
 block discarded – undo
1802 1864
 
1803 1865
 		// Generate a list of buttons that shouldn't be shown - this should be the fastest way to do this.
1804 1866
 		$disabled_tags = array();
1805
-		if (!empty($modSettings['disabledBBC']))
1806
-			$disabled_tags = explode(',', $modSettings['disabledBBC']);
1807
-		if (empty($modSettings['enableEmbeddedFlash']))
1808
-			$disabled_tags[] = 'flash';
1867
+		if (!empty($modSettings['disabledBBC'])) {
1868
+					$disabled_tags = explode(',', $modSettings['disabledBBC']);
1869
+		}
1870
+		if (empty($modSettings['enableEmbeddedFlash'])) {
1871
+					$disabled_tags[] = 'flash';
1872
+		}
1809 1873
 
1810 1874
 		foreach ($disabled_tags as $tag)
1811 1875
 		{
@@ -1817,9 +1881,10 @@  discard block
 block discarded – undo
1817 1881
 				$context['disabled_tags']['orderedlist'] = true;
1818 1882
 			}
1819 1883
 
1820
-			foreach ($editor_tag_map as $thisTag => $tagNameBBC)
1821
-				if ($tag === $thisTag)
1884
+			foreach ($editor_tag_map as $thisTag => $tagNameBBC) {
1885
+							if ($tag === $thisTag)
1822 1886
 					$context['disabled_tags'][$tagNameBBC] = true;
1887
+			}
1823 1888
 
1824 1889
 			$context['disabled_tags'][$tag] = true;
1825 1890
 		}
@@ -1830,8 +1895,9 @@  discard block
 block discarded – undo
1830 1895
 
1831 1896
 		foreach ($context['bbc_tags'] as $row => $tagRow)
1832 1897
 		{
1833
-			if (!isset($context['bbc_toolbar'][$row]))
1834
-				$context['bbc_toolbar'][$row] = array();
1898
+			if (!isset($context['bbc_toolbar'][$row])) {
1899
+							$context['bbc_toolbar'][$row] = array();
1900
+			}
1835 1901
 
1836 1902
 			$tagsRow = array();
1837 1903
 
@@ -1867,20 +1933,21 @@  discard block
 block discarded – undo
1867 1933
 
1868 1934
 					$context['bbcodes_handlers'] .= '
1869 1935
 						});';
1870
-				}
1871
-				else
1936
+				} else
1872 1937
 				{
1873 1938
 					$context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
1874 1939
 					$tagsRow = array();
1875 1940
 				}
1876 1941
 			}
1877 1942
 
1878
-			if (!empty($tagsRow))
1879
-				$context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
1943
+			if (!empty($tagsRow)) {
1944
+							$context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
1945
+			}
1880 1946
 		}
1881 1947
 
1882
-		if (!empty($bbcodes_styles))
1883
-			addInlineCss($bbcodes_styles);
1948
+		if (!empty($bbcodes_styles)) {
1949
+					addInlineCss($bbcodes_styles);
1950
+		}
1884 1951
 	}
1885 1952
 
1886 1953
 	// Initialize smiley array... if not loaded before.
@@ -1892,8 +1959,8 @@  discard block
 block discarded – undo
1892 1959
 		);
1893 1960
 
1894 1961
 		// Load smileys - don't bother to run a query if we're not using the database's ones anyhow.
1895
-		if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none')
1896
-			$context['smileys']['postform'][] = array(
1962
+		if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') {
1963
+					$context['smileys']['postform'][] = array(
1897 1964
 				'smileys' => array(
1898 1965
 					array(
1899 1966
 						'code' => ':)',
@@ -1979,7 +2046,7 @@  discard block
 block discarded – undo
1979 2046
 				),
1980 2047
 				'isLast' => true,
1981 2048
 			);
1982
-		elseif ($user_info['smiley_set'] != 'none')
2049
+		} elseif ($user_info['smiley_set'] != 'none')
1983 2050
 		{
1984 2051
 			if (($temp = cache_get_data('posting_smileys', 480)) == null)
1985 2052
 			{
@@ -2002,17 +2069,19 @@  discard block
 block discarded – undo
2002 2069
 
2003 2070
 				foreach ($context['smileys'] as $section => $smileyRows)
2004 2071
 				{
2005
-					foreach ($smileyRows as $rowIndex => $smileys)
2006
-						$context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true;
2072
+					foreach ($smileyRows as $rowIndex => $smileys) {
2073
+											$context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true;
2074
+					}
2007 2075
 
2008
-					if (!empty($smileyRows))
2009
-						$context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true;
2076
+					if (!empty($smileyRows)) {
2077
+											$context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true;
2078
+					}
2010 2079
 				}
2011 2080
 
2012 2081
 				cache_put_data('posting_smileys', $context['smileys'], 480);
2082
+			} else {
2083
+							$context['smileys'] = $temp;
2013 2084
 			}
2014
-			else
2015
-				$context['smileys'] = $temp;
2016 2085
 		}
2017 2086
 	}
2018 2087
 
@@ -2028,12 +2097,15 @@  discard block
 block discarded – undo
2028 2097
 		'plugins' => 'undo',
2029 2098
 		'bbcodeTrim' => true,
2030 2099
 	);
2031
-	if (!empty($context['controls']['richedit'][$editorOptions['id']]['locale']))
2032
-		$sce_options['locale'] = $context['controls']['richedit'][$editorOptions['id']]['locale'];
2033
-	if (!empty($context['right_to_left']))
2034
-		$sce_options['rtl'] = true;
2035
-	if ($editorOptions['id'] != 'quickReply')
2036
-		$sce_options['autofocus'] = true;
2100
+	if (!empty($context['controls']['richedit'][$editorOptions['id']]['locale'])) {
2101
+			$sce_options['locale'] = $context['controls']['richedit'][$editorOptions['id']]['locale'];
2102
+	}
2103
+	if (!empty($context['right_to_left'])) {
2104
+			$sce_options['rtl'] = true;
2105
+	}
2106
+	if ($editorOptions['id'] != 'quickReply') {
2107
+			$sce_options['autofocus'] = true;
2108
+	}
2037 2109
 
2038 2110
 	$sce_options['emoticons'] = array();
2039 2111
 	$sce_options['emoticonsDescriptions'] = array();
@@ -2050,10 +2122,11 @@  discard block
 block discarded – undo
2050 2122
 			$countLocations--;
2051 2123
 
2052 2124
 			unset($smiley_location);
2053
-			if ($location == 'postform')
2054
-				$smiley_location = &$sce_options['emoticons']['dropdown'];
2055
-			elseif ($location == 'popup')
2056
-				$smiley_location = &$sce_options['emoticons']['popup'];
2125
+			if ($location == 'postform') {
2126
+							$smiley_location = &$sce_options['emoticons']['dropdown'];
2127
+			} elseif ($location == 'popup') {
2128
+							$smiley_location = &$sce_options['emoticons']['popup'];
2129
+			}
2057 2130
 
2058 2131
 			$numRows = count($smileyRows);
2059 2132
 
@@ -2067,8 +2140,9 @@  discard block
 block discarded – undo
2067 2140
 					$sce_options['emoticonsDescriptions'][$smiley['code']] = $smiley['description'];
2068 2141
 				}
2069 2142
 
2070
-				if (empty($smileyRow['isLast']) && $numRows != 1)
2071
-					$smiley_location['-' . $emptyPlaceholder++] = '';
2143
+				if (empty($smileyRow['isLast']) && $numRows != 1) {
2144
+									$smiley_location['-' . $emptyPlaceholder++] = '';
2145
+				}
2072 2146
 			}
2073 2147
 		}
2074 2148
 	}
@@ -2083,8 +2157,9 @@  discard block
 block discarded – undo
2083 2157
 
2084 2158
 			$count_tags--;
2085 2159
 
2086
-			if (!empty($count_tags))
2087
-				$sce_options['toolbar'] .= '||';
2160
+			if (!empty($count_tags)) {
2161
+							$sce_options['toolbar'] .= '||';
2162
+			}
2088 2163
 		}
2089 2164
 	}
2090 2165
 
@@ -2112,8 +2187,9 @@  discard block
 block discarded – undo
2112 2187
 		loadTemplate('GenericControls');
2113 2188
 
2114 2189
 		// Some javascript ma'am?
2115
-		if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual'])))
2116
-			loadJavaScriptFile('captcha.js', array('minimize' => true), 'smf_captcha');
2190
+		if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) {
2191
+					loadJavaScriptFile('captcha.js', array('minimize' => true), 'smf_captcha');
2192
+		}
2117 2193
 
2118 2194
 		$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
2119 2195
 
@@ -2126,8 +2202,8 @@  discard block
 block discarded – undo
2126 2202
 	$isNew = !isset($context['controls']['verification'][$verificationOptions['id']]);
2127 2203
 
2128 2204
 	// Log this into our collection.
2129
-	if ($isNew)
2130
-		$context['controls']['verification'][$verificationOptions['id']] = array(
2205
+	if ($isNew) {
2206
+			$context['controls']['verification'][$verificationOptions['id']] = array(
2131 2207
 			'id' => $verificationOptions['id'],
2132 2208
 			'empty_field' => empty($verificationOptions['no_empty_field']),
2133 2209
 			'show_visual' => !empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual'])),
@@ -2138,13 +2214,15 @@  discard block
 block discarded – undo
2138 2214
 			'questions' => array(),
2139 2215
 			'can_recaptcha' => !empty($modSettings['recaptcha_enabled']) && !empty($modSettings['recaptcha_site_key']) && !empty($modSettings['recaptcha_secret_key']),
2140 2216
 		);
2217
+	}
2141 2218
 	$thisVerification = &$context['controls']['verification'][$verificationOptions['id']];
2142 2219
 
2143 2220
 	// Is there actually going to be anything?
2144
-	if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha']))
2145
-		return false;
2146
-	elseif (!$isNew && !$do_test)
2147
-		return true;
2221
+	if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) {
2222
+			return false;
2223
+	} elseif (!$isNew && !$do_test) {
2224
+			return true;
2225
+	}
2148 2226
 
2149 2227
 	// Sanitize reCAPTCHA fields?
2150 2228
 	if ($thisVerification['can_recaptcha'])
@@ -2157,11 +2235,12 @@  discard block
 block discarded – undo
2157 2235
 	}
2158 2236
 
2159 2237
 	// Add javascript for the object.
2160
-	if ($context['controls']['verification'][$verificationOptions['id']]['show_visual'])
2161
-		$context['insert_after_template'] .= '
2238
+	if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) {
2239
+			$context['insert_after_template'] .= '
2162 2240
 			<script>
2163 2241
 				var verification' . $verificationOptions['id'] . 'Handle = new smfCaptcha("' . $thisVerification['image_href'] . '", "' . $verificationOptions['id'] . '", ' . ($context['use_graphic_library'] ? 1 : 0) . ');
2164 2242
 			</script>';
2243
+	}
2165 2244
 
2166 2245
 	// If we want questions do we have a cache of all the IDs?
2167 2246
 	if (!empty($thisVerification['number_questions']) && empty($modSettings['question_id_cache']))
@@ -2184,8 +2263,9 @@  discard block
 block discarded – undo
2184 2263
 				unset ($row['id_question']);
2185 2264
 				// Make them all lowercase. We can't directly use $smcFunc['strtolower'] with array_walk, so do it manually, eh?
2186 2265
 				$row['answers'] = $smcFunc['json_decode']($row['answers'], true);
2187
-				foreach ($row['answers'] as $k => $v)
2188
-					$row['answers'][$k] = $smcFunc['strtolower']($v);
2266
+				foreach ($row['answers'] as $k => $v) {
2267
+									$row['answers'][$k] = $smcFunc['strtolower']($v);
2268
+				}
2189 2269
 
2190 2270
 				$modSettings['question_id_cache']['questions'][$id_question] = $row;
2191 2271
 				$modSettings['question_id_cache']['langs'][$row['lngfile']][] = $id_question;
@@ -2196,35 +2276,42 @@  discard block
 block discarded – undo
2196 2276
 		}
2197 2277
 	}
2198 2278
 
2199
-	if (!isset($_SESSION[$verificationOptions['id'] . '_vv']))
2200
-		$_SESSION[$verificationOptions['id'] . '_vv'] = array();
2279
+	if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) {
2280
+			$_SESSION[$verificationOptions['id'] . '_vv'] = array();
2281
+	}
2201 2282
 
2202 2283
 	// Do we need to refresh the verification?
2203
-	if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh']))
2204
-		$force_refresh = true;
2205
-	else
2206
-		$force_refresh = false;
2284
+	if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) {
2285
+			$force_refresh = true;
2286
+	} else {
2287
+			$force_refresh = false;
2288
+	}
2207 2289
 
2208 2290
 	// This can also force a fresh, although unlikely.
2209
-	if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q'])))
2210
-		$force_refresh = true;
2291
+	if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) {
2292
+			$force_refresh = true;
2293
+	}
2211 2294
 
2212 2295
 	$verification_errors = array();
2213 2296
 	// Start with any testing.
2214 2297
 	if ($do_test)
2215 2298
 	{
2216 2299
 		// This cannot happen!
2217
-		if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count']))
2218
-			fatal_lang_error('no_access', false);
2300
+		if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) {
2301
+					fatal_lang_error('no_access', false);
2302
+		}
2219 2303
 		// ... nor this!
2220
-		if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q'])))
2221
-			fatal_lang_error('no_access', false);
2304
+		if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) {
2305
+					fatal_lang_error('no_access', false);
2306
+		}
2222 2307
 		// Hmm, it's requested but not actually declared. This shouldn't happen.
2223
-		if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']))
2224
-			fatal_lang_error('no_access', false);
2308
+		if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) {
2309
+					fatal_lang_error('no_access', false);
2310
+		}
2225 2311
 		// While we're here, did the user do something bad?
2226
-		if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']]))
2227
-			$verification_errors[] = 'wrong_verification_answer';
2312
+		if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) {
2313
+					$verification_errors[] = 'wrong_verification_answer';
2314
+		}
2228 2315
 
2229 2316
 		if ($thisVerification['can_recaptcha'])
2230 2317
 		{
@@ -2235,22 +2322,25 @@  discard block
 block discarded – undo
2235 2322
 			{
2236 2323
 				$resp = $reCaptcha->verify($_POST['g-recaptcha-response'], $user_info['ip']);
2237 2324
 
2238
-				if (!$resp->isSuccess())
2239
-					$verification_errors[] = 'wrong_verification_code';
2325
+				if (!$resp->isSuccess()) {
2326
+									$verification_errors[] = 'wrong_verification_code';
2327
+				}
2328
+			} else {
2329
+							$verification_errors[] = 'wrong_verification_code';
2240 2330
 			}
2241
-			else
2242
-				$verification_errors[] = 'wrong_verification_code';
2243 2331
 		}
2244
-		if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code']))
2245
-			$verification_errors[] = 'wrong_verification_code';
2332
+		if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) {
2333
+					$verification_errors[] = 'wrong_verification_code';
2334
+		}
2246 2335
 		if ($thisVerification['number_questions'])
2247 2336
 		{
2248 2337
 			$incorrectQuestions = array();
2249 2338
 			foreach ($_SESSION[$verificationOptions['id'] . '_vv']['q'] as $q)
2250 2339
 			{
2251 2340
 				// We don't have this question any more, thus no answers.
2252
-				if (!isset($modSettings['question_id_cache']['questions'][$q]))
2253
-					continue;
2341
+				if (!isset($modSettings['question_id_cache']['questions'][$q])) {
2342
+									continue;
2343
+				}
2254 2344
 				// This is quite complex. We have our question but it might have multiple answers.
2255 2345
 				// First, did they actually answer this question?
2256 2346
 				if (!isset($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) || trim($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) == '')
@@ -2262,24 +2352,28 @@  discard block
 block discarded – undo
2262 2352
 				else
2263 2353
 				{
2264 2354
 					$given_answer = trim($smcFunc['htmlspecialchars'](strtolower($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q])));
2265
-					if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers']))
2266
-						$incorrectQuestions[] = $q;
2355
+					if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) {
2356
+											$incorrectQuestions[] = $q;
2357
+					}
2267 2358
 				}
2268 2359
 			}
2269 2360
 
2270
-			if (!empty($incorrectQuestions))
2271
-				$verification_errors[] = 'wrong_verification_answer';
2361
+			if (!empty($incorrectQuestions)) {
2362
+							$verification_errors[] = 'wrong_verification_answer';
2363
+			}
2272 2364
 		}
2273 2365
 	}
2274 2366
 
2275 2367
 	// Any errors means we refresh potentially.
2276 2368
 	if (!empty($verification_errors))
2277 2369
 	{
2278
-		if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors']))
2279
-			$_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0;
2370
+		if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) {
2371
+					$_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0;
2372
+		}
2280 2373
 		// Too many errors?
2281
-		elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors'])
2282
-			$force_refresh = true;
2374
+		elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) {
2375
+					$force_refresh = true;
2376
+		}
2283 2377
 
2284 2378
 		// Keep a track of these.
2285 2379
 		$_SESSION[$verificationOptions['id'] . '_vv']['errors']++;
@@ -2312,8 +2406,9 @@  discard block
 block discarded – undo
2312 2406
 			// Are we overriding the range?
2313 2407
 			$character_range = !empty($verificationOptions['override_range']) ? $verificationOptions['override_range'] : $context['standard_captcha_range'];
2314 2408
 
2315
-			for ($i = 0; $i < 6; $i++)
2316
-				$_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)];
2409
+			for ($i = 0; $i < 6; $i++) {
2410
+							$_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)];
2411
+			}
2317 2412
 		}
2318 2413
 
2319 2414
 		// Getting some new questions?
@@ -2321,8 +2416,9 @@  discard block
 block discarded – undo
2321 2416
 		{
2322 2417
 			// Attempt to try the current page's language, followed by the user's preference, followed by the site default.
2323 2418
 			$possible_langs = array();
2324
-			if (isset($_SESSION['language']))
2325
-				$possible_langs[] = strtr($_SESSION['language'], array('-utf8' => ''));
2419
+			if (isset($_SESSION['language'])) {
2420
+							$possible_langs[] = strtr($_SESSION['language'], array('-utf8' => ''));
2421
+			}
2326 2422
 			if (!empty($user_info['language']));
2327 2423
 			$possible_langs[] = $user_info['language'];
2328 2424
 			$possible_langs[] = $language;
@@ -2341,8 +2437,7 @@  discard block
 block discarded – undo
2341 2437
 				}
2342 2438
 			}
2343 2439
 		}
2344
-	}
2345
-	else
2440
+	} else
2346 2441
 	{
2347 2442
 		// Same questions as before.
2348 2443
 		$questionIDs = !empty($_SESSION[$verificationOptions['id'] . '_vv']['q']) ? $_SESSION[$verificationOptions['id'] . '_vv']['q'] : array();
@@ -2352,8 +2447,9 @@  discard block
 block discarded – undo
2352 2447
 	// If we do have an empty field, it would be nice to hide it from legitimate users who shouldn't be populating it anyway.
2353 2448
 	if (!empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']))
2354 2449
 	{
2355
-		if (!isset($context['html_headers']))
2356
-			$context['html_headers'] = '';
2450
+		if (!isset($context['html_headers'])) {
2451
+					$context['html_headers'] = '';
2452
+		}
2357 2453
 		$context['html_headers'] .= '<style>.vv_special { display:none; }</style>';
2358 2454
 	}
2359 2455
 
@@ -2379,11 +2475,13 @@  discard block
 block discarded – undo
2379 2475
 	$_SESSION[$verificationOptions['id'] . '_vv']['count'] = empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) ? 1 : $_SESSION[$verificationOptions['id'] . '_vv']['count'] + 1;
2380 2476
 
2381 2477
 	// Return errors if we have them.
2382
-	if (!empty($verification_errors))
2383
-		return $verification_errors;
2478
+	if (!empty($verification_errors)) {
2479
+			return $verification_errors;
2480
+	}
2384 2481
 	// If we had a test that one, make a note.
2385
-	elseif ($do_test)
2386
-		$_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true;
2482
+	elseif ($do_test) {
2483
+			$_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true;
2484
+	}
2387 2485
 
2388 2486
 	// Say that everything went well chaps.
2389 2487
 	return true;
@@ -2408,8 +2506,9 @@  discard block
 block discarded – undo
2408 2506
 	call_integration_hook('integrate_autosuggest', array(&$searchTypes));
2409 2507
 
2410 2508
 	// If we're just checking the callback function is registered return true or false.
2411
-	if ($checkRegistered != null)
2412
-		return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered);
2509
+	if ($checkRegistered != null) {
2510
+			return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered);
2511
+	}
2413 2512
 
2414 2513
 	checkSession('get');
2415 2514
 	loadTemplate('Xml');
@@ -2560,24 +2659,27 @@  discard block
 block discarded – undo
2560 2659
 		foreach ($possible_versions as $ver)
2561 2660
 		{
2562 2661
 			$ver = trim($ver);
2563
-			if (strpos($ver, 'SMF') === 0)
2564
-				$versions[] = $ver;
2662
+			if (strpos($ver, 'SMF') === 0) {
2663
+							$versions[] = $ver;
2664
+			}
2565 2665
 		}
2566 2666
 	}
2567 2667
 	$smcFunc['db_free_result']($request);
2568 2668
 
2569 2669
 	// Just in case we don't have ANYthing.
2570
-	if (empty($versions))
2571
-		$versions = array('SMF 2.0');
2670
+	if (empty($versions)) {
2671
+			$versions = array('SMF 2.0');
2672
+	}
2572 2673
 
2573
-	foreach ($versions as $id => $version)
2574
-		if (strpos($version, strtoupper($_REQUEST['search'])) !== false)
2674
+	foreach ($versions as $id => $version) {
2675
+			if (strpos($version, strtoupper($_REQUEST['search'])) !== false)
2575 2676
 			$xml_data['items']['children'][] = array(
2576 2677
 				'attributes' => array(
2577 2678
 					'id' => $id,
2578 2679
 				),
2579 2680
 				'value' => $version,
2580 2681
 			);
2682
+	}
2581 2683
 
2582 2684
 	return $xml_data;
2583 2685
 }
Please login to merge, or discard this patch.
Sources/Security.php 1 patch
Braces   +258 added lines, -199 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Check if the user is who he/she says he is
@@ -42,12 +43,14 @@  discard block
 block discarded – undo
42 43
 	$refreshTime = isset($_GET['xml']) ? 4200 : 3600;
43 44
 
44 45
 	// Is the security option off?
45
-	if (!empty($modSettings['securityDisable' . ($type != 'admin' ? '_' . $type : '')]))
46
-		return;
46
+	if (!empty($modSettings['securityDisable' . ($type != 'admin' ? '_' . $type : '')])) {
47
+			return;
48
+	}
47 49
 
48 50
 	// Or are they already logged in?, Moderator or admin session is need for this area
49
-	if ((!empty($_SESSION[$type . '_time']) && $_SESSION[$type . '_time'] + $refreshTime >= time()) || (!empty($_SESSION['admin_time']) && $_SESSION['admin_time'] + $refreshTime >= time()))
50
-		return;
51
+	if ((!empty($_SESSION[$type . '_time']) && $_SESSION[$type . '_time'] + $refreshTime >= time()) || (!empty($_SESSION['admin_time']) && $_SESSION['admin_time'] + $refreshTime >= time())) {
52
+			return;
53
+	}
51 54
 
52 55
 	require_once($sourcedir . '/Subs-Auth.php');
53 56
 
@@ -55,8 +58,9 @@  discard block
 block discarded – undo
55 58
 	if (isset($_POST[$type . '_pass']))
56 59
 	{
57 60
 		// Check to ensure we're forcing SSL for authentication
58
-		if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
59
-			fatal_lang_error('login_ssl_required');
61
+		if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
62
+					fatal_lang_error('login_ssl_required');
63
+		}
60 64
 
61 65
 		checkSession();
62 66
 
@@ -72,17 +76,19 @@  discard block
 block discarded – undo
72 76
 	}
73 77
 
74 78
 	// Better be sure to remember the real referer
75
-	if (empty($_SESSION['request_referer']))
76
-		$_SESSION['request_referer'] = isset($_SERVER['HTTP_REFERER']) ? @parse_url($_SERVER['HTTP_REFERER']) : array();
77
-	elseif (empty($_POST))
78
-		unset($_SESSION['request_referer']);
79
+	if (empty($_SESSION['request_referer'])) {
80
+			$_SESSION['request_referer'] = isset($_SERVER['HTTP_REFERER']) ? @parse_url($_SERVER['HTTP_REFERER']) : array();
81
+	} elseif (empty($_POST)) {
82
+			unset($_SESSION['request_referer']);
83
+	}
79 84
 
80 85
 	// Need to type in a password for that, man.
81
-	if (!isset($_GET['xml']))
82
-		adminLogin($type);
83
-	else
84
-		return 'session_verify_fail';
85
-}
86
+	if (!isset($_GET['xml'])) {
87
+			adminLogin($type);
88
+	} else {
89
+			return 'session_verify_fail';
90
+	}
91
+	}
86 92
 
87 93
 /**
88 94
  * Require a user who is logged in. (not a guest.)
@@ -96,25 +102,30 @@  discard block
 block discarded – undo
96 102
 	global $user_info, $txt, $context, $scripturl, $modSettings;
97 103
 
98 104
 	// Luckily, this person isn't a guest.
99
-	if (!$user_info['is_guest'])
100
-		return;
105
+	if (!$user_info['is_guest']) {
106
+			return;
107
+	}
101 108
 
102 109
 	// Log what they were trying to do didn't work)
103
-	if (!empty($modSettings['who_enabled']))
104
-		$_GET['error'] = 'guest_login';
110
+	if (!empty($modSettings['who_enabled'])) {
111
+			$_GET['error'] = 'guest_login';
112
+	}
105 113
 	writeLog(true);
106 114
 
107 115
 	// Just die.
108
-	if (isset($_REQUEST['xml']))
109
-		obExit(false);
116
+	if (isset($_REQUEST['xml'])) {
117
+			obExit(false);
118
+	}
110 119
 
111 120
 	// Attempt to detect if they came from dlattach.
112
-	if (SMF != 'SSI' && empty($context['theme_loaded']))
113
-		loadTheme();
121
+	if (SMF != 'SSI' && empty($context['theme_loaded'])) {
122
+			loadTheme();
123
+	}
114 124
 
115 125
 	// Never redirect to an attachment
116
-	if (strpos($_SERVER['REQUEST_URL'], 'dlattach') === false)
117
-		$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
126
+	if (strpos($_SERVER['REQUEST_URL'], 'dlattach') === false) {
127
+			$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
128
+	}
118 129
 
119 130
 	// Load the Login template and language file.
120 131
 	loadLanguage('Login');
@@ -124,8 +135,7 @@  discard block
 block discarded – undo
124 135
 	{
125 136
 		$_SESSION['login_url'] = $scripturl . '?' . $_SERVER['QUERY_STRING'];
126 137
 		redirectexit('action=login');
127
-	}
128
-	else
138
+	} else
129 139
 	{
130 140
 		loadTemplate('Login');
131 141
 		$context['sub_template'] = 'kick_guest';
@@ -155,8 +165,9 @@  discard block
 block discarded – undo
155 165
 	global $sourcedir, $cookiename, $user_settings, $smcFunc;
156 166
 
157 167
 	// You cannot be banned if you are an admin - doesn't help if you log out.
158
-	if ($user_info['is_admin'])
159
-		return;
168
+	if ($user_info['is_admin']) {
169
+			return;
170
+	}
160 171
 
161 172
 	// Only check the ban every so often. (to reduce load.)
162 173
 	if ($forceCheck || !isset($_SESSION['ban']) || empty($modSettings['banLastUpdated']) || ($_SESSION['ban']['last_checked'] < $modSettings['banLastUpdated']) || $_SESSION['ban']['id_member'] != $user_info['id'] || $_SESSION['ban']['ip'] != $user_info['ip'] || $_SESSION['ban']['ip2'] != $user_info['ip2'] || (isset($user_info['email'], $_SESSION['ban']['email']) && $_SESSION['ban']['email'] != $user_info['email']))
@@ -177,8 +188,9 @@  discard block
 block discarded – undo
177 188
 		// Check both IP addresses.
178 189
 		foreach (array('ip', 'ip2') as $ip_number)
179 190
 		{
180
-			if ($ip_number == 'ip2' && $user_info['ip2'] == $user_info['ip'])
181
-				continue;
191
+			if ($ip_number == 'ip2' && $user_info['ip2'] == $user_info['ip']) {
192
+							continue;
193
+			}
182 194
 			$ban_query[] = ' {inet:' . $ip_number . '} BETWEEN bi.ip_low and bi.ip_high';
183 195
 			$ban_query_vars[$ip_number] = $user_info[$ip_number];
184 196
 			// IP was valid, maybe there's also a hostname...
@@ -228,24 +240,28 @@  discard block
 block discarded – undo
228 240
 			// Store every type of ban that applies to you in your session.
229 241
 			while ($row = $smcFunc['db_fetch_assoc']($request))
230 242
 			{
231
-				foreach ($restrictions as $restriction)
232
-					if (!empty($row[$restriction]))
243
+				foreach ($restrictions as $restriction) {
244
+									if (!empty($row[$restriction]))
233 245
 					{
234 246
 						$_SESSION['ban'][$restriction]['reason'] = $row['reason'];
247
+				}
235 248
 						$_SESSION['ban'][$restriction]['ids'][] = $row['id_ban'];
236
-						if (!isset($_SESSION['ban']['expire_time']) || ($_SESSION['ban']['expire_time'] != 0 && ($row['expire_time'] == 0 || $row['expire_time'] > $_SESSION['ban']['expire_time'])))
237
-							$_SESSION['ban']['expire_time'] = $row['expire_time'];
249
+						if (!isset($_SESSION['ban']['expire_time']) || ($_SESSION['ban']['expire_time'] != 0 && ($row['expire_time'] == 0 || $row['expire_time'] > $_SESSION['ban']['expire_time']))) {
250
+													$_SESSION['ban']['expire_time'] = $row['expire_time'];
251
+						}
238 252
 
239
-						if (!$user_info['is_guest'] && $restriction == 'cannot_access' && ($row['id_member'] == $user_info['id'] || $row['email_address'] == $user_info['email']))
240
-							$flag_is_activated = true;
253
+						if (!$user_info['is_guest'] && $restriction == 'cannot_access' && ($row['id_member'] == $user_info['id'] || $row['email_address'] == $user_info['email'])) {
254
+													$flag_is_activated = true;
255
+						}
241 256
 					}
242 257
 			}
243 258
 			$smcFunc['db_free_result']($request);
244 259
 		}
245 260
 
246 261
 		// Mark the cannot_access and cannot_post bans as being 'hit'.
247
-		if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post']) || isset($_SESSION['ban']['cannot_login']))
248
-			log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array(), isset($_SESSION['ban']['cannot_login']) ? $_SESSION['ban']['cannot_login']['ids'] : array()));
262
+		if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post']) || isset($_SESSION['ban']['cannot_login'])) {
263
+					log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array(), isset($_SESSION['ban']['cannot_login']) ? $_SESSION['ban']['cannot_login']['ids'] : array()));
264
+		}
249 265
 
250 266
 		// If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
251 267
 		if ($user_info['id'] && (($user_settings['is_activated'] >= 10 && !$flag_is_activated)
@@ -260,8 +276,9 @@  discard block
 block discarded – undo
260 276
 	if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_']))
261 277
 	{
262 278
 		$bans = explode(',', $_COOKIE[$cookiename . '_']);
263
-		foreach ($bans as $key => $value)
264
-			$bans[$key] = (int) $value;
279
+		foreach ($bans as $key => $value) {
280
+					$bans[$key] = (int) $value;
281
+		}
265 282
 		$request = $smcFunc['db_query']('', '
266 283
 			SELECT bi.id_ban, bg.reason, COALESCE(bg.expire_time, 0) AS expire_time
267 284
 			FROM {db_prefix}ban_items AS bi
@@ -298,14 +315,15 @@  discard block
 block discarded – undo
298 315
 	if (isset($_SESSION['ban']['cannot_access']))
299 316
 	{
300 317
 		// We don't wanna see you!
301
-		if (!$user_info['is_guest'])
302
-			$smcFunc['db_query']('', '
318
+		if (!$user_info['is_guest']) {
319
+					$smcFunc['db_query']('', '
303 320
 				DELETE FROM {db_prefix}log_online
304 321
 				WHERE id_member = {int:current_member}',
305 322
 				array(
306 323
 					'current_member' => $user_info['id'],
307 324
 				)
308 325
 			);
326
+		}
309 327
 
310 328
 		// 'Log' the user out.  Can't have any funny business... (save the name!)
311 329
 		$old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
@@ -391,9 +409,10 @@  discard block
 block discarded – undo
391 409
 	}
392 410
 
393 411
 	// Fix up the banning permissions.
394
-	if (isset($user_info['permissions']))
395
-		banPermissions();
396
-}
412
+	if (isset($user_info['permissions'])) {
413
+			banPermissions();
414
+	}
415
+	}
397 416
 
398 417
 /**
399 418
  * Fix permissions according to ban status.
@@ -404,8 +423,9 @@  discard block
 block discarded – undo
404 423
 	global $user_info, $sourcedir, $modSettings, $context;
405 424
 
406 425
 	// Somehow they got here, at least take away all permissions...
407
-	if (isset($_SESSION['ban']['cannot_access']))
408
-		$user_info['permissions'] = array();
426
+	if (isset($_SESSION['ban']['cannot_access'])) {
427
+			$user_info['permissions'] = array();
428
+	}
409 429
 	// Okay, well, you can watch, but don't touch a thing.
410 430
 	elseif (isset($_SESSION['ban']['cannot_post']) || (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $user_info['warning']))
411 431
 	{
@@ -447,19 +467,20 @@  discard block
 block discarded – undo
447 467
 		call_integration_hook('integrate_warn_permissions', array(&$permission_change));
448 468
 		foreach ($permission_change as $old => $new)
449 469
 		{
450
-			if (!in_array($old, $user_info['permissions']))
451
-				unset($permission_change[$old]);
452
-			else
453
-				$user_info['permissions'][] = $new;
470
+			if (!in_array($old, $user_info['permissions'])) {
471
+							unset($permission_change[$old]);
472
+			} else {
473
+							$user_info['permissions'][] = $new;
474
+			}
454 475
 		}
455 476
 		$user_info['permissions'] = array_diff($user_info['permissions'], array_keys($permission_change));
456 477
 	}
457 478
 
458 479
 	// @todo Find a better place to call this? Needs to be after permissions loaded!
459 480
 	// Finally, some bits we cache in the session because it saves queries.
460
-	if (isset($_SESSION['mc']) && $_SESSION['mc']['time'] > $modSettings['settings_updated'] && $_SESSION['mc']['id'] == $user_info['id'])
461
-		$user_info['mod_cache'] = $_SESSION['mc'];
462
-	else
481
+	if (isset($_SESSION['mc']) && $_SESSION['mc']['time'] > $modSettings['settings_updated'] && $_SESSION['mc']['id'] == $user_info['id']) {
482
+			$user_info['mod_cache'] = $_SESSION['mc'];
483
+	} else
463 484
 	{
464 485
 		require_once($sourcedir . '/Subs-Auth.php');
465 486
 		rebuildModCache();
@@ -470,14 +491,12 @@  discard block
 block discarded – undo
470 491
 	{
471 492
 		$context['open_mod_reports'] = $_SESSION['rc']['reports'];
472 493
 		$context['open_member_reports'] = $_SESSION['rc']['member_reports'];
473
-	}
474
-	elseif ($_SESSION['mc']['bq'] != '0=1')
494
+	} elseif ($_SESSION['mc']['bq'] != '0=1')
475 495
 	{
476 496
 		require_once($sourcedir . '/Subs-ReportedContent.php');
477 497
 		$context['open_mod_reports'] = recountOpenReports('posts');
478 498
 		$context['open_member_reports'] = recountOpenReports('members');
479
-	}
480
-	else
499
+	} else
481 500
 	{
482 501
 		$context['open_mod_reports'] = 0;
483 502
 		$context['open_member_reports'] = 0;
@@ -497,8 +516,9 @@  discard block
 block discarded – undo
497 516
 	global $user_info, $smcFunc;
498 517
 
499 518
 	// Don't log web accelerators, it's very confusing...
500
-	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
501
-		return;
519
+	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') {
520
+			return;
521
+	}
502 522
 
503 523
 	$smcFunc['db_insert']('',
504 524
 		'{db_prefix}log_banned',
@@ -508,8 +528,8 @@  discard block
 block discarded – undo
508 528
 	);
509 529
 
510 530
 	// One extra point for these bans.
511
-	if (!empty($ban_ids))
512
-		$smcFunc['db_query']('', '
531
+	if (!empty($ban_ids)) {
532
+			$smcFunc['db_query']('', '
513 533
 			UPDATE {db_prefix}ban_items
514 534
 			SET hits = hits + 1
515 535
 			WHERE id_ban IN ({array_int:ban_ids})',
@@ -517,7 +537,8 @@  discard block
 block discarded – undo
517 537
 				'ban_ids' => $ban_ids,
518 538
 			)
519 539
 		);
520
-}
540
+	}
541
+	}
521 542
 
522 543
 /**
523 544
  * Checks if a given email address might be banned.
@@ -533,8 +554,9 @@  discard block
 block discarded – undo
533 554
 	global $txt, $smcFunc;
534 555
 
535 556
 	// Can't ban an empty email
536
-	if (empty($email) || trim($email) == '')
537
-		return;
557
+	if (empty($email) || trim($email) == '') {
558
+			return;
559
+	}
538 560
 
539 561
 	// Let's start with the bans based on your IP/hostname/memberID...
540 562
 	$ban_ids = isset($_SESSION['ban'][$restriction]) ? $_SESSION['ban'][$restriction]['ids'] : array();
@@ -607,16 +629,18 @@  discard block
 block discarded – undo
607 629
 	if ($type == 'post')
608 630
 	{
609 631
 		$check = isset($_POST[$_SESSION['session_var']]) ? $_POST[$_SESSION['session_var']] : (empty($modSettings['strictSessionCheck']) && isset($_POST['sc']) ? $_POST['sc'] : null);
610
-		if ($check !== $sc)
611
-			$error = 'session_timeout';
632
+		if ($check !== $sc) {
633
+					$error = 'session_timeout';
634
+		}
612 635
 	}
613 636
 
614 637
 	// How about $_GET['sesc']?
615 638
 	elseif ($type == 'get')
616 639
 	{
617 640
 		$check = isset($_GET[$_SESSION['session_var']]) ? $_GET[$_SESSION['session_var']] : (empty($modSettings['strictSessionCheck']) && isset($_GET['sesc']) ? $_GET['sesc'] : null);
618
-		if ($check !== $sc)
619
-			$error = 'session_verify_fail';
641
+		if ($check !== $sc) {
642
+					$error = 'session_verify_fail';
643
+		}
620 644
 	}
621 645
 
622 646
 	// Or can it be in either?
@@ -624,13 +648,15 @@  discard block
 block discarded – undo
624 648
 	{
625 649
 		$check = isset($_GET[$_SESSION['session_var']]) ? $_GET[$_SESSION['session_var']] : (empty($modSettings['strictSessionCheck']) && isset($_GET['sesc']) ? $_GET['sesc'] : (isset($_POST[$_SESSION['session_var']]) ? $_POST[$_SESSION['session_var']] : (empty($modSettings['strictSessionCheck']) && isset($_POST['sc']) ? $_POST['sc'] : null)));
626 650
 
627
-		if ($check !== $sc)
628
-			$error = 'session_verify_fail';
651
+		if ($check !== $sc) {
652
+					$error = 'session_verify_fail';
653
+		}
629 654
 	}
630 655
 
631 656
 	// Verify that they aren't changing user agents on us - that could be bad.
632
-	if ((!isset($_SESSION['USER_AGENT']) || $_SESSION['USER_AGENT'] != $_SERVER['HTTP_USER_AGENT']) && empty($modSettings['disableCheckUA']))
633
-		$error = 'session_verify_fail';
657
+	if ((!isset($_SESSION['USER_AGENT']) || $_SESSION['USER_AGENT'] != $_SERVER['HTTP_USER_AGENT']) && empty($modSettings['disableCheckUA'])) {
658
+			$error = 'session_verify_fail';
659
+	}
634 660
 
635 661
 	// Make sure a page with session check requirement is not being prefetched.
636 662
 	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
@@ -641,30 +667,35 @@  discard block
 block discarded – undo
641 667
 	}
642 668
 
643 669
 	// Check the referring site - it should be the same server at least!
644
-	if (isset($_SESSION['request_referer']))
645
-		$referrer = $_SESSION['request_referer'];
646
-	else
647
-		$referrer = isset($_SERVER['HTTP_REFERER']) ? @parse_url($_SERVER['HTTP_REFERER']) : array();
670
+	if (isset($_SESSION['request_referer'])) {
671
+			$referrer = $_SESSION['request_referer'];
672
+	} else {
673
+			$referrer = isset($_SERVER['HTTP_REFERER']) ? @parse_url($_SERVER['HTTP_REFERER']) : array();
674
+	}
648 675
 	if (!empty($referrer['host']))
649 676
 	{
650
-		if (strpos($_SERVER['HTTP_HOST'], ':') !== false)
651
-			$real_host = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], ':'));
652
-		else
653
-			$real_host = $_SERVER['HTTP_HOST'];
677
+		if (strpos($_SERVER['HTTP_HOST'], ':') !== false) {
678
+					$real_host = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], ':'));
679
+		} else {
680
+					$real_host = $_SERVER['HTTP_HOST'];
681
+		}
654 682
 
655 683
 		$parsed_url = parse_url($boardurl);
656 684
 
657 685
 		// Are global cookies on?  If so, let's check them ;).
658 686
 		if (!empty($modSettings['globalCookies']))
659 687
 		{
660
-			if (preg_match('~(?:[^\.]+\.)?([^\.]{3,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
661
-				$parsed_url['host'] = $parts[1];
688
+			if (preg_match('~(?:[^\.]+\.)?([^\.]{3,}\..+)\z~i', $parsed_url['host'], $parts) == 1) {
689
+							$parsed_url['host'] = $parts[1];
690
+			}
662 691
 
663
-			if (preg_match('~(?:[^\.]+\.)?([^\.]{3,}\..+)\z~i', $referrer['host'], $parts) == 1)
664
-				$referrer['host'] = $parts[1];
692
+			if (preg_match('~(?:[^\.]+\.)?([^\.]{3,}\..+)\z~i', $referrer['host'], $parts) == 1) {
693
+							$referrer['host'] = $parts[1];
694
+			}
665 695
 
666
-			if (preg_match('~(?:[^\.]+\.)?([^\.]{3,}\..+)\z~i', $real_host, $parts) == 1)
667
-				$real_host = $parts[1];
696
+			if (preg_match('~(?:[^\.]+\.)?([^\.]{3,}\..+)\z~i', $real_host, $parts) == 1) {
697
+							$real_host = $parts[1];
698
+			}
668 699
 		}
669 700
 
670 701
 		// Okay: referrer must either match parsed_url or real_host.
@@ -682,12 +713,14 @@  discard block
 block discarded – undo
682 713
 		$log_error = true;
683 714
 	}
684 715
 
685
-	if (strtolower($_SERVER['HTTP_USER_AGENT']) == 'hacker')
686
-		fatal_error('Sound the alarm!  It\'s a hacker!  Close the castle gates!!', false);
716
+	if (strtolower($_SERVER['HTTP_USER_AGENT']) == 'hacker') {
717
+			fatal_error('Sound the alarm!  It\'s a hacker!  Close the castle gates!!', false);
718
+	}
687 719
 
688 720
 	// Everything is ok, return an empty string.
689
-	if (!isset($error))
690
-		return '';
721
+	if (!isset($error)) {
722
+			return '';
723
+	}
691 724
 	// A session error occurred, show the error.
692 725
 	elseif ($is_fatal)
693 726
 	{
@@ -696,13 +729,14 @@  discard block
 block discarded – undo
696 729
 			ob_end_clean();
697 730
 			header('HTTP/1.1 403 Forbidden - Session timeout');
698 731
 			die;
732
+		} else {
733
+					fatal_lang_error($error, isset($log_error) ? 'user' : false);
699 734
 		}
700
-		else
701
-			fatal_lang_error($error, isset($log_error) ? 'user' : false);
702 735
 	}
703 736
 	// A session error occurred, return the error to the calling function.
704
-	else
705
-		return $error;
737
+	else {
738
+			return $error;
739
+	}
706 740
 
707 741
 	// We really should never fall through here, for very important reasons.  Let's make sure.
708 742
 	trigger_error('Hacking attempt...', E_USER_ERROR);
@@ -718,10 +752,9 @@  discard block
 block discarded – undo
718 752
 {
719 753
 	global $modSettings;
720 754
 
721
-	if (isset($_GET['confirm']) && isset($_SESSION['confirm_' . $action]) && md5($_GET['confirm'] . $_SERVER['HTTP_USER_AGENT']) == $_SESSION['confirm_' . $action])
722
-		return true;
723
-
724
-	else
755
+	if (isset($_GET['confirm']) && isset($_SESSION['confirm_' . $action]) && md5($_GET['confirm'] . $_SERVER['HTTP_USER_AGENT']) == $_SESSION['confirm_' . $action]) {
756
+			return true;
757
+	} else
725 758
 	{
726 759
 		$token = md5(mt_rand() . session_id() . (string) microtime() . $modSettings['rand_seed']);
727 760
 		$_SESSION['confirm_' . $action] = md5($token . $_SERVER['HTTP_USER_AGENT']);
@@ -772,9 +805,9 @@  discard block
 block discarded – undo
772 805
 			$return = $_SESSION['token'][$type . '-' . $action][3];
773 806
 			unset($_SESSION['token'][$type . '-' . $action]);
774 807
 			return $return;
808
+		} else {
809
+					return '';
775 810
 		}
776
-		else
777
-			return '';
778 811
 	}
779 812
 
780 813
 	// This nasty piece of code validates a token.
@@ -805,12 +838,14 @@  discard block
 block discarded – undo
805 838
 		fatal_lang_error('token_verify_fail', false);
806 839
 	}
807 840
 	// Remove this token as its useless
808
-	else
809
-		unset($_SESSION['token'][$type . '-' . $action]);
841
+	else {
842
+			unset($_SESSION['token'][$type . '-' . $action]);
843
+	}
810 844
 
811 845
 	// Randomly check if we should remove some older tokens.
812
-	if (mt_rand(0, 138) == 23)
813
-		cleanTokens();
846
+	if (mt_rand(0, 138) == 23) {
847
+			cleanTokens();
848
+	}
814 849
 
815 850
 	return false;
816 851
 }
@@ -825,14 +860,16 @@  discard block
 block discarded – undo
825 860
 function cleanTokens($complete = false)
826 861
 {
827 862
 	// We appreciate cleaning up after yourselves.
828
-	if (!isset($_SESSION['token']))
829
-		return;
863
+	if (!isset($_SESSION['token'])) {
864
+			return;
865
+	}
830 866
 
831 867
 	// Clean up tokens, trying to give enough time still.
832
-	foreach ($_SESSION['token'] as $key => $data)
833
-		if ($data[2] + 10800 < time() || $complete)
868
+	foreach ($_SESSION['token'] as $key => $data) {
869
+			if ($data[2] + 10800 < time() || $complete)
834 870
 			unset($_SESSION['token'][$key]);
835
-}
871
+	}
872
+	}
836 873
 
837 874
 /**
838 875
  * Check whether a form has been submitted twice.
@@ -850,37 +887,40 @@  discard block
 block discarded – undo
850 887
 {
851 888
 	global $context;
852 889
 
853
-	if (!isset($_SESSION['forms']))
854
-		$_SESSION['forms'] = array();
890
+	if (!isset($_SESSION['forms'])) {
891
+			$_SESSION['forms'] = array();
892
+	}
855 893
 
856 894
 	// Register a form number and store it in the session stack. (use this on the page that has the form.)
857 895
 	if ($action == 'register')
858 896
 	{
859 897
 		$context['form_sequence_number'] = 0;
860
-		while (empty($context['form_sequence_number']) || in_array($context['form_sequence_number'], $_SESSION['forms']))
861
-			$context['form_sequence_number'] = mt_rand(1, 16000000);
898
+		while (empty($context['form_sequence_number']) || in_array($context['form_sequence_number'], $_SESSION['forms'])) {
899
+					$context['form_sequence_number'] = mt_rand(1, 16000000);
900
+		}
862 901
 	}
863 902
 	// Check whether the submitted number can be found in the session.
864 903
 	elseif ($action == 'check')
865 904
 	{
866
-		if (!isset($_REQUEST['seqnum']))
867
-			return true;
868
-		elseif (!in_array($_REQUEST['seqnum'], $_SESSION['forms']))
905
+		if (!isset($_REQUEST['seqnum'])) {
906
+					return true;
907
+		} elseif (!in_array($_REQUEST['seqnum'], $_SESSION['forms']))
869 908
 		{
870 909
 			$_SESSION['forms'][] = (int) $_REQUEST['seqnum'];
871 910
 			return true;
911
+		} elseif ($is_fatal) {
912
+					fatal_lang_error('error_form_already_submitted', false);
913
+		} else {
914
+					return false;
872 915
 		}
873
-		elseif ($is_fatal)
874
-			fatal_lang_error('error_form_already_submitted', false);
875
-		else
876
-			return false;
877 916
 	}
878 917
 	// Don't check, just free the stack number.
879
-	elseif ($action == 'free' && isset($_REQUEST['seqnum']) && in_array($_REQUEST['seqnum'], $_SESSION['forms']))
880
-		$_SESSION['forms'] = array_diff($_SESSION['forms'], array($_REQUEST['seqnum']));
881
-	elseif ($action != 'free')
882
-		trigger_error('checkSubmitOnce(): Invalid action \'' . $action . '\'', E_USER_WARNING);
883
-}
918
+	elseif ($action == 'free' && isset($_REQUEST['seqnum']) && in_array($_REQUEST['seqnum'], $_SESSION['forms'])) {
919
+			$_SESSION['forms'] = array_diff($_SESSION['forms'], array($_REQUEST['seqnum']));
920
+	} elseif ($action != 'free') {
921
+			trigger_error('checkSubmitOnce(): Invalid action \'' . $action . '\'', E_USER_WARNING);
922
+	}
923
+	}
884 924
 
885 925
 /**
886 926
  * Check the user's permissions.
@@ -899,16 +939,19 @@  discard block
 block discarded – undo
899 939
 	global $user_info, $smcFunc;
900 940
 
901 941
 	// You're always allowed to do nothing. (unless you're a working man, MR. LAZY :P!)
902
-	if (empty($permission))
903
-		return true;
942
+	if (empty($permission)) {
943
+			return true;
944
+	}
904 945
 
905 946
 	// You're never allowed to do something if your data hasn't been loaded yet!
906
-	if (empty($user_info))
907
-		return false;
947
+	if (empty($user_info)) {
948
+			return false;
949
+	}
908 950
 
909 951
 	// Administrators are supermen :P.
910
-	if ($user_info['is_admin'])
911
-		return true;
952
+	if ($user_info['is_admin']) {
953
+			return true;
954
+	}
912 955
 
913 956
 	// Let's ensure this is an array.
914 957
 	$permission = (array) $permission;
@@ -916,14 +959,16 @@  discard block
 block discarded – undo
916 959
 	// Are we checking the _current_ board, or some other boards?
917 960
 	if ($boards === null)
918 961
 	{
919
-		if (count(array_intersect($permission, $user_info['permissions'])) != 0)
920
-			return true;
962
+		if (count(array_intersect($permission, $user_info['permissions'])) != 0) {
963
+					return true;
964
+		}
921 965
 		// You aren't allowed, by default.
922
-		else
923
-			return false;
966
+		else {
967
+					return false;
968
+		}
969
+	} elseif (!is_array($boards)) {
970
+			$boards = array($boards);
924 971
 	}
925
-	elseif (!is_array($boards))
926
-		$boards = array($boards);
927 972
 
928 973
 	$request = $smcFunc['db_query']('', '
929 974
 		SELECT MIN(bp.add_deny) AS add_deny
@@ -951,20 +996,23 @@  discard block
 block discarded – undo
951 996
 		while ($row = $smcFunc['db_fetch_assoc']($request))
952 997
 		{
953 998
 			$result = !empty($row['add_deny']);
954
-			if ($result == true)
955
-				break;
999
+			if ($result == true) {
1000
+							break;
1001
+			}
956 1002
 		}
957 1003
 		$smcFunc['db_free_result']($request);
958 1004
 		return $result;
959 1005
 	}
960 1006
 
961 1007
 	// Make sure they can do it on all of the boards.
962
-	if ($smcFunc['db_num_rows']($request) != count($boards))
963
-		return false;
1008
+	if ($smcFunc['db_num_rows']($request) != count($boards)) {
1009
+			return false;
1010
+	}
964 1011
 
965 1012
 	$result = true;
966
-	while ($row = $smcFunc['db_fetch_assoc']($request))
967
-		$result &= !empty($row['add_deny']);
1013
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1014
+			$result &= !empty($row['add_deny']);
1015
+	}
968 1016
 	$smcFunc['db_free_result']($request);
969 1017
 
970 1018
 	// If the query returned 1, they can do it... otherwise, they can't.
@@ -1031,9 +1079,10 @@  discard block
 block discarded – undo
1031 1079
 
1032 1080
 	// If you're doing something on behalf of some "heavy" permissions, validate your session.
1033 1081
 	// (take out the heavy permissions, and if you can't do anything but those, you need a validated session.)
1034
-	if (!allowedTo(array_diff($permission, $heavy_permissions), $boards))
1035
-		validateSession();
1036
-}
1082
+	if (!allowedTo(array_diff($permission, $heavy_permissions), $boards)) {
1083
+			validateSession();
1084
+	}
1085
+	}
1037 1086
 
1038 1087
 /**
1039 1088
  * Return the boards a user has a certain (board) permission on. (array(0) if all.)
@@ -1052,8 +1101,9 @@  discard block
 block discarded – undo
1052 1101
 	global $user_info, $smcFunc;
1053 1102
 
1054 1103
 	// Arrays are nice, most of the time.
1055
-	if (!is_array($permissions))
1056
-		$permissions = array($permissions);
1104
+	if (!is_array($permissions)) {
1105
+			$permissions = array($permissions);
1106
+	}
1057 1107
 
1058 1108
 	/*
1059 1109
 	 * Set $simple to true to use this function as it were in SMF 2.0.x.
@@ -1065,13 +1115,14 @@  discard block
 block discarded – undo
1065 1115
 	// Administrators are all powerful, sorry.
1066 1116
 	if ($user_info['is_admin'])
1067 1117
 	{
1068
-		if ($simple)
1069
-			return array(0);
1070
-		else
1118
+		if ($simple) {
1119
+					return array(0);
1120
+		} else
1071 1121
 		{
1072 1122
 			$boards = array();
1073
-			foreach ($permissions as $permission)
1074
-				$boards[$permission] = array(0);
1123
+			foreach ($permissions as $permission) {
1124
+							$boards[$permission] = array(0);
1125
+			}
1075 1126
 
1076 1127
 			return $boards;
1077 1128
 		}
@@ -1103,31 +1154,32 @@  discard block
 block discarded – undo
1103 1154
 	{
1104 1155
 		if ($simple)
1105 1156
 		{
1106
-			if (empty($row['add_deny']))
1107
-				$deny_boards[] = $row['id_board'];
1108
-			else
1109
-				$boards[] = $row['id_board'];
1110
-		}
1111
-		else
1157
+			if (empty($row['add_deny'])) {
1158
+							$deny_boards[] = $row['id_board'];
1159
+			} else {
1160
+							$boards[] = $row['id_board'];
1161
+			}
1162
+		} else
1112 1163
 		{
1113
-			if (empty($row['add_deny']))
1114
-				$deny_boards[$row['permission']][] = $row['id_board'];
1115
-			else
1116
-				$boards[$row['permission']][] = $row['id_board'];
1164
+			if (empty($row['add_deny'])) {
1165
+							$deny_boards[$row['permission']][] = $row['id_board'];
1166
+			} else {
1167
+							$boards[$row['permission']][] = $row['id_board'];
1168
+			}
1117 1169
 		}
1118 1170
 	}
1119 1171
 	$smcFunc['db_free_result']($request);
1120 1172
 
1121
-	if ($simple)
1122
-		$boards = array_unique(array_values(array_diff($boards, $deny_boards)));
1123
-	else
1173
+	if ($simple) {
1174
+			$boards = array_unique(array_values(array_diff($boards, $deny_boards)));
1175
+	} else
1124 1176
 	{
1125 1177
 		foreach ($permissions as $permission)
1126 1178
 		{
1127 1179
 			// never had it to start with
1128
-			if (empty($boards[$permission]))
1129
-				$boards[$permission] = array();
1130
-			else
1180
+			if (empty($boards[$permission])) {
1181
+							$boards[$permission] = array();
1182
+			} else
1131 1183
 			{
1132 1184
 				// Or it may have been removed
1133 1185
 				$deny_boards[$permission] = isset($deny_boards[$permission]) ? $deny_boards[$permission] : array();
@@ -1163,10 +1215,11 @@  discard block
 block discarded – undo
1163 1215
 
1164 1216
 
1165 1217
 	// Moderators are free...
1166
-	if (!allowedTo('moderate_board'))
1167
-		$timeLimit = isset($timeOverrides[$error_type]) ? $timeOverrides[$error_type] : $modSettings['spamWaitTime'];
1168
-	else
1169
-		$timeLimit = 2;
1218
+	if (!allowedTo('moderate_board')) {
1219
+			$timeLimit = isset($timeOverrides[$error_type]) ? $timeOverrides[$error_type] : $modSettings['spamWaitTime'];
1220
+	} else {
1221
+			$timeLimit = 2;
1222
+	}
1170 1223
 
1171 1224
 	call_integration_hook('integrate_spam_protection', array(&$timeOverrides, &$timeLimit));
1172 1225
 
@@ -1193,8 +1246,9 @@  discard block
 block discarded – undo
1193 1246
 	if ($smcFunc['db_affected_rows']() != 1)
1194 1247
 	{
1195 1248
 		// Spammer!  You only have to wait a *few* seconds!
1196
-		if (!$only_return_result)
1197
-			fatal_lang_error($error_type . '_WaitTime_broken', false, array($timeLimit));
1249
+		if (!$only_return_result) {
1250
+					fatal_lang_error($error_type . '_WaitTime_broken', false, array($timeLimit));
1251
+		}
1198 1252
 
1199 1253
 		return true;
1200 1254
 	}
@@ -1212,11 +1266,13 @@  discard block
 block discarded – undo
1212 1266
  */
1213 1267
 function secureDirectory($path, $attachments = false)
1214 1268
 {
1215
-	if (empty($path))
1216
-		return 'empty_path';
1269
+	if (empty($path)) {
1270
+			return 'empty_path';
1271
+	}
1217 1272
 
1218
-	if (!is_writable($path))
1219
-		return 'path_not_writable';
1273
+	if (!is_writable($path)) {
1274
+			return 'path_not_writable';
1275
+	}
1220 1276
 
1221 1277
 	$directoryname = basename($path);
1222 1278
 
@@ -1228,9 +1284,9 @@  discard block
 block discarded – undo
1228 1284
 
1229 1285
 RemoveHandler .php .php3 .phtml .cgi .fcgi .pl .fpl .shtml';
1230 1286
 
1231
-	if (file_exists($path . '/.htaccess'))
1232
-		$errors[] = 'htaccess_exists';
1233
-	else
1287
+	if (file_exists($path . '/.htaccess')) {
1288
+			$errors[] = 'htaccess_exists';
1289
+	} else
1234 1290
 	{
1235 1291
 		$fh = @fopen($path . '/.htaccess', 'w');
1236 1292
 		if ($fh)
@@ -1243,9 +1299,9 @@  discard block
 block discarded – undo
1243 1299
 		$errors[] = 'htaccess_cannot_create_file';
1244 1300
 	}
1245 1301
 
1246
-	if (file_exists($path . '/index.php'))
1247
-		$errors[] = 'index-php_exists';
1248
-	else
1302
+	if (file_exists($path . '/index.php')) {
1303
+			$errors[] = 'index-php_exists';
1304
+	} else
1249 1305
 	{
1250 1306
 		$fh = @fopen($path . '/index.php', 'w');
1251 1307
 		if ($fh)
@@ -1273,11 +1329,12 @@  discard block
 block discarded – undo
1273 1329
 		$errors[] = 'index-php_cannot_create_file';
1274 1330
 	}
1275 1331
 
1276
-	if (!empty($errors))
1277
-		return $errors;
1278
-	else
1279
-		return true;
1280
-}
1332
+	if (!empty($errors)) {
1333
+			return $errors;
1334
+	} else {
1335
+			return true;
1336
+	}
1337
+	}
1281 1338
 
1282 1339
 /**
1283 1340
 * This sets the X-Frame-Options header.
@@ -1290,14 +1347,16 @@  discard block
 block discarded – undo
1290 1347
 	global $modSettings;
1291 1348
 
1292 1349
 	$option = 'SAMEORIGIN';
1293
-	if (is_null($override) && !empty($modSettings['frame_security']))
1294
-		$option = $modSettings['frame_security'];
1295
-	elseif (in_array($override, array('SAMEORIGIN', 'DENY')))
1296
-		$option = $override;
1350
+	if (is_null($override) && !empty($modSettings['frame_security'])) {
1351
+			$option = $modSettings['frame_security'];
1352
+	} elseif (in_array($override, array('SAMEORIGIN', 'DENY'))) {
1353
+			$option = $override;
1354
+	}
1297 1355
 
1298 1356
 	// Don't bother setting the header if we have disabled it.
1299
-	if ($option == 'DISABLE')
1300
-		return;
1357
+	if ($option == 'DISABLE') {
1358
+			return;
1359
+	}
1301 1360
 
1302 1361
 	// Finally set it.
1303 1362
 	header('x-frame-options: ' . $option);
Please login to merge, or discard this patch.
Themes/default/Register.template.php 1 patch
Braces   +90 added lines, -65 removed lines patch added patch discarded remove patch
@@ -28,14 +28,15 @@  discard block
 block discarded – undo
28 28
 			<div id="confirm_buttons">';
29 29
 
30 30
 	// Age restriction in effect?
31
-	if ($context['show_coppa'])
32
-		echo '
31
+	if ($context['show_coppa']) {
32
+			echo '
33 33
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
34 34
 				<br>
35 35
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
36
-	else
37
-		echo '
36
+	} else {
37
+			echo '
38 38
 				<input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button">';
39
+	}
39 40
 
40 41
 	echo '
41 42
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -78,9 +79,10 @@  discard block
 block discarded – undo
78 79
 			<ul>';
79 80
 
80 81
 		// Cycle through each error and display an error message.
81
-		foreach ($context['registration_errors'] as $error)
82
-			echo '
82
+		foreach ($context['registration_errors'] as $error) {
83
+					echo '
83 84
 				<li>', $error, '</li>';
85
+		}
84 86
 
85 87
 		echo '
86 88
 			</ul>
@@ -149,14 +151,15 @@  discard block
 block discarded – undo
149 151
 		echo '
150 152
 					<dl class="register_form">';
151 153
 
152
-		foreach ($context['custom_fields'] as $field)
153
-			if ($field['show_reg'] > 1)
154
+		foreach ($context['custom_fields'] as $field) {
155
+					if ($field['show_reg'] > 1)
154 156
 				echo '
155 157
 						<dt>
156 158
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
157 159
 							<span class="smalltext">', $field['desc'], '</span>
158 160
 						</dt>
159 161
 						<dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>';
162
+		}
160 163
 
161 164
 		echo '
162 165
 					</dl>';
@@ -167,14 +170,15 @@  discard block
 block discarded – undo
167 170
 			</div><!-- .roundframe -->';
168 171
 
169 172
 	// If we have either of these, show the extra group.
170
-	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
171
-		echo '
173
+	if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
174
+			echo '
172 175
 			<div class="title_bar title_top">
173 176
 				<h3 class="titlebg">', $txt['additional_information'], '</h3>
174 177
 			</div>
175 178
 			<div class="roundframe noup">
176 179
 				<fieldset>
177 180
 					<dl class="register_form" id="custom_group">';
181
+	}
178 182
 
179 183
 	if (!empty($context['profile_fields']))
180 184
 	{
@@ -188,41 +192,45 @@  discard block
 block discarded – undo
188 192
 					$callback_func = 'template_profile_' . $field['callback_func'];
189 193
 					$callback_func();
190 194
 				}
191
-			}
192
-			else
195
+			} else
193 196
 			{
194 197
 				echo '
195 198
 						<dt>
196 199
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>';
197 200
 
198 201
 				// Does it have any subtext to show?
199
-				if (!empty($field['subtext']))
200
-					echo '
202
+				if (!empty($field['subtext'])) {
203
+									echo '
201 204
 							<span class="smalltext">', $field['subtext'], '</span>';
205
+				}
202 206
 
203 207
 				echo '
204 208
 						</dt>
205 209
 						<dd>';
206 210
 
207 211
 				// Want to put something infront of the box?
208
-				if (!empty($field['preinput']))
209
-					echo '
212
+				if (!empty($field['preinput'])) {
213
+									echo '
210 214
 							', $field['preinput'];
215
+				}
211 216
 
212 217
 				// What type of data are we showing?
213
-				if ($field['type'] == 'label')
214
-					echo '
218
+				if ($field['type'] == 'label') {
219
+									echo '
215 220
 							', $field['value'];
221
+				}
216 222
 
217 223
 				// Maybe it's a text box - very likely!
218
-				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url')))
219
-					echo '
224
+				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url'))) {
225
+									echo '
220 226
 							<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
227
+				}
221 228
 
222 229
 				// You "checking" me out? ;)
223
-				elseif ($field['type'] == 'check')
224
-					echo '
230
+				elseif ($field['type'] == 'check') {
231
+									echo '
225 232
 							<input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
233
+				}
226 234
 
227 235
 				// Always fun - select boxes!
228 236
 				elseif ($field['type'] == 'select')
@@ -233,14 +241,16 @@  discard block
 block discarded – undo
233 241
 					if (isset($field['options']))
234 242
 					{
235 243
 						// Is this some code to generate the options?
236
-						if (!is_array($field['options']))
237
-							$field['options'] = eval($field['options']);
244
+						if (!is_array($field['options'])) {
245
+													$field['options'] = eval($field['options']);
246
+						}
238 247
 
239 248
 						// Assuming we now have some!
240
-						if (is_array($field['options']))
241
-							foreach ($field['options'] as $value => $name)
249
+						if (is_array($field['options'])) {
250
+													foreach ($field['options'] as $value => $name)
242 251
 								echo '
243 252
 								<option', is_numeric($value) ? ' value="" disabled' : ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>';
253
+						}
244 254
 					}
245 255
 
246 256
 					echo '
@@ -248,9 +258,10 @@  discard block
 block discarded – undo
248 258
 				}
249 259
 
250 260
 				// Something to end with?
251
-				if (!empty($field['postinput']))
252
-					echo '
261
+				if (!empty($field['postinput'])) {
262
+									echo '
253 263
 							', $field['postinput'];
264
+				}
254 265
 
255 266
 				echo '
256 267
 						</dd>';
@@ -261,25 +272,27 @@  discard block
 block discarded – undo
261 272
 	// Are there any custom fields?
262 273
 	if (!empty($context['custom_fields']))
263 274
 	{
264
-		foreach ($context['custom_fields'] as $field)
265
-			if ($field['show_reg'] < 2)
275
+		foreach ($context['custom_fields'] as $field) {
276
+					if ($field['show_reg'] < 2)
266 277
 				echo '
267 278
 						<dt>
268 279
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
269 280
 							<span class="smalltext">', $field['desc'], '</span>
270 281
 						</dt>
271 282
 						<dd>', $field['input_html'], '</dd>';
283
+		}
272 284
 	}
273 285
 
274 286
 	// If we have either of these, close the list like a proper gent.
275
-	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
276
-		echo '
287
+	if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
288
+			echo '
277 289
 					</dl>
278 290
 				</fieldset>
279 291
 			</div><!-- .roundframe -->';
292
+	}
280 293
 
281
-	if ($context['visual_verification'])
282
-		echo '
294
+	if ($context['visual_verification']) {
295
+			echo '
283 296
 			<div class="title_bar title_top">
284 297
 				<h3 class="titlebg">', $txt['verification'], '</h3>
285 298
 			</div>
@@ -288,19 +301,21 @@  discard block
 block discarded – undo
288 301
 					', template_control_verification($context['visual_verification_id'], 'all'), '
289 302
 				</fieldset>
290 303
 			</div>';
304
+	}
291 305
 
292 306
 	echo '
293 307
 			<div id="confirm_buttons" class="flow_auto">';
294 308
 
295 309
 	// Age restriction in effect?
296
-	if (!$context['require_agreement'] && $context['show_coppa'])
297
-		echo '
310
+	if (!$context['require_agreement'] && $context['show_coppa']) {
311
+			echo '
298 312
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
299 313
 				<br>
300 314
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
301
-	else
302
-		echo '
315
+	} else {
316
+			echo '
303 317
 				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">';
318
+	}
304 319
 
305 320
 	echo '
306 321
 			</div>
@@ -362,25 +377,28 @@  discard block
 block discarded – undo
362 377
 				<p>', $context['coppa']['many_options'] ? $txt['coppa_send_to_two_options'] : $txt['coppa_send_to_one_option'], '</p>';
363 378
 
364 379
 	// Can they send by post?
365
-	if (!empty($context['coppa']['post']))
366
-		echo '
380
+	if (!empty($context['coppa']['post'])) {
381
+			echo '
367 382
 				<h4>1) ', $txt['coppa_send_by_post'], '</h4>
368 383
 				<div class="coppa_contact">
369 384
 					', $context['coppa']['post'], '
370 385
 				</div>';
386
+	}
371 387
 
372 388
 	// Can they send by fax??
373
-	if (!empty($context['coppa']['fax']))
374
-		echo '
389
+	if (!empty($context['coppa']['fax'])) {
390
+			echo '
375 391
 				<h4>', !empty($context['coppa']['post']) ? '2' : '1', ') ', $txt['coppa_send_by_fax'], '</h4>
376 392
 				<div class="coppa_contact">
377 393
 					', $context['coppa']['fax'], '
378 394
 				</div>';
395
+	}
379 396
 
380 397
 	// Offer an alternative Phone Number?
381
-	if ($context['coppa']['phone'])
382
-		echo '
398
+	if ($context['coppa']['phone']) {
399
+			echo '
383 400
 				<p>', $context['coppa']['phone'], '</p>';
401
+	}
384 402
 
385 403
 	echo '
386 404
 			</div><!-- #coppa -->';
@@ -445,19 +463,20 @@  discard block
 block discarded – undo
445 463
 	<body style="margin: 1ex;">
446 464
 		<div class="windowbg description" style="text-align: center;">';
447 465
 
448
-	if (isBrowser('is_ie') || isBrowser('is_ie11'))
449
-		echo '
466
+	if (isBrowser('is_ie') || isBrowser('is_ie11')) {
467
+			echo '
450 468
 			<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav">
451 469
 				<param name="AutoStart" value="1">
452 470
 				<param name="FileName" value="', $context['verification_sound_href'], '">
453 471
 			</object>';
454
-	else
455
-		echo '
472
+	} else {
473
+			echo '
456 474
 			<audio src="', $context['verification_sound_href'], '" controls>
457 475
 				<object type="audio/x-wav" data="', $context['verification_sound_href'], '">
458 476
 					<a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a>
459 477
 				</object>
460 478
 			</audio>';
479
+	}
461 480
 
462 481
 	echo '
463 482
 			<br>
@@ -485,11 +504,12 @@  discard block
 block discarded – undo
485 504
 				</div>
486 505
 				<div id="register_screen" class="windowbg noup">';
487 506
 
488
-	if (!empty($context['registration_done']))
489
-		echo '
507
+	if (!empty($context['registration_done'])) {
508
+			echo '
490 509
 					<div class="infobox">
491 510
 						', $context['registration_done'], '
492 511
 					</div>';
512
+	}
493 513
 
494 514
 	echo '
495 515
 					<dl class="register_form" id="admin_register_form">
@@ -525,9 +545,10 @@  discard block
 block discarded – undo
525 545
 						<dd>
526 546
 							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
527 547
 
528
-		foreach ($context['member_groups'] as $id => $name)
529
-			echo '
548
+		foreach ($context['member_groups'] as $id => $name) {
549
+					echo '
530 550
 								<option value="', $id, '">', $name, '</option>';
551
+		}
531 552
 
532 553
 		echo '
533 554
 							</select>
@@ -535,8 +556,8 @@  discard block
 block discarded – undo
535 556
 	}
536 557
 
537 558
 	// If there is any field marked as required, show it here!
538
-	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
539
-		foreach ($context['custom_fields'] as $field)
559
+	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) {
560
+			foreach ($context['custom_fields'] as $field)
540 561
 			if ($field['show_reg'] > 1)
541 562
 				echo '
542 563
 						<dt>
@@ -546,6 +567,7 @@  discard block
 block discarded – undo
546 567
 						<dd>
547 568
 							', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '
548 569
 						</dd>';
570
+	}
549 571
 
550 572
 	echo '
551 573
 						<dt>
@@ -582,13 +604,13 @@  discard block
 block discarded – undo
582 604
 {
583 605
 	global $context, $scripturl, $txt;
584 606
 
585
-	if (!empty($context['saved_successful']))
586
-		echo '
607
+	if (!empty($context['saved_successful'])) {
608
+			echo '
587 609
 		<div class="infobox">', $txt['settings_saved'], '</div>';
588
-
589
-	elseif (!empty($context['could_not_save']))
590
-		echo '
610
+	} elseif (!empty($context['could_not_save'])) {
611
+			echo '
591 612
 		<div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>';
613
+	}
592 614
 
593 615
 	// Just a big box to edit the text file ;)
594 616
 	echo '
@@ -598,9 +620,10 @@  discard block
 block discarded – undo
598 620
 			</div>';
599 621
 
600 622
 	// Warning for if the file isn't writable.
601
-	if (!empty($context['warning']))
602
-		echo '
623
+	if (!empty($context['warning'])) {
624
+			echo '
603 625
 			<p class="error">', $context['warning'], '</p>';
626
+	}
604 627
 
605 628
 	echo '
606 629
 			<div class="windowbg noup" id="registration_agreement">';
@@ -617,9 +640,10 @@  discard block
 block discarded – undo
617 640
 						<strong>', $txt['admin_agreement_select_language'], ':</strong>
618 641
 						<select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">';
619 642
 
620
-		foreach ($context['editable_agreements'] as $file => $name)
621
-			echo '
643
+		foreach ($context['editable_agreements'] as $file => $name) {
644
+					echo '
622 645
 							<option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>';
646
+		}
623 647
 
624 648
 		echo '
625 649
 						</select>
@@ -659,9 +683,10 @@  discard block
 block discarded – undo
659 683
 {
660 684
 	global $context, $scripturl, $txt;
661 685
 
662
-	if (!empty($context['saved_successful']))
663
-		echo '
686
+	if (!empty($context['saved_successful'])) {
687
+			echo '
664 688
 	<div class="infobox">', $txt['settings_saved'], '</div>';
689
+	}
665 690
 
666 691
 	echo '
667 692
 	<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
Please login to merge, or discard this patch.
Themes/default/ManageBoards.template.php 1 patch
Braces   +99 added lines, -68 removed lines patch added patch discarded remove patch
@@ -25,18 +25,20 @@  discard block
 block discarded – undo
25 25
 		</div>
26 26
 		<div class="windowbg noup">';
27 27
 
28
-	if (!empty($context['move_board']))
29
-		echo '
28
+	if (!empty($context['move_board'])) {
29
+			echo '
30 30
 			<div class="noticebox">
31 31
 				', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=manageboards">', $txt['mboards_cancel_moving'], '</a>]', '
32 32
 			</div>';
33
+	}
33 34
 
34 35
 	// No categories so show a label.
35
-	if (empty($context['categories']))
36
-		echo '
36
+	if (empty($context['categories'])) {
37
+			echo '
37 38
 			<div class="windowbg centertext">
38 39
 				', $txt['mboards_no_cats'], '
39 40
 			</div>';
41
+	}
40 42
 
41 43
 	// Loop through every category, listing the boards in each as we go.
42 44
 	foreach ($context['categories'] as $category)
@@ -54,9 +56,10 @@  discard block
 block discarded – undo
54 56
 			<form action="', $scripturl, '?action=admin;area=manageboards;sa=newboard;cat=', $category['id'], '" method="post" accept-charset="', $context['character_set'], '">
55 57
 				<ul id="category_', $category['id'], '" class="nolist">';
56 58
 
57
-		if (!empty($category['move_link']))
58
-			echo '
59
+		if (!empty($category['move_link'])) {
60
+					echo '
59 61
 					<li><a href="', $category['move_link']['href'], '" title="', $category['move_link']['label'], '"><span class="generic_icons select_above"></span></a></li>';
62
+		}
60 63
 
61 64
 		$recycle_board = '<a href="' . $scripturl . '?action=admin;area=manageboards;sa=settings"> <img src="' . $settings['images_url'] . '/post/recycled.png" alt="' . $txt['recycle_board'] . '" title="' . $txt['recycle_board'] . '"></a>';
62 65
 		$redirect_board = '<img src="' . $settings['images_url'] . '/new_redirect.png" alt="' . $txt['redirect_board_desc'] . '" title="' . $txt['redirect_board_desc'] . '">';
@@ -79,9 +82,10 @@  discard block
 block discarded – undo
79 82
 				echo '
80 83
 					<li class="windowbg" style="padding-', $context['right_to_left'] ? 'right' : 'left', ': ', 5 + 30 * $board['move_links'][0]['child_level'], 'px;">';
81 84
 
82
-				foreach ($board['move_links'] as $link)
83
-					echo '
85
+				foreach ($board['move_links'] as $link) {
86
+									echo '
84 87
 						<a href="', $link['href'], '" class="move_links" title="', $link['label'], '"><span class="generic_icons select_', $link['class'], '" title="', $link['label'], '"></span></a>';
88
+				}
85 89
 
86 90
 				echo '
87 91
 					</li>';
@@ -130,9 +134,10 @@  discard block
 block discarded – undo
130 134
 						<select name="cat_order">';
131 135
 
132 136
 		// Print every existing category into a select box.
133
-		foreach ($context['category_order'] as $order)
134
-			echo '
137
+		foreach ($context['category_order'] as $order) {
138
+					echo '
135 139
 							<option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
140
+		}
136 141
 		echo '
137 142
 						</select>
138 143
 					</dd>';
@@ -167,14 +172,15 @@  discard block
 block discarded – undo
167 172
 	{
168 173
 		foreach ($context['custom_category_settings'] as $catset_id => $catset)
169 174
 		{
170
-			if (!empty($catset['dt']) && !empty($catset['dd']))
171
-				echo '
175
+			if (!empty($catset['dt']) && !empty($catset['dd'])) {
176
+							echo '
172 177
 					<dt class="clear', !is_numeric($catset_id) ? ' catset_' . $catset_id : '', '">
173 178
 						', $catset['dt'], '
174 179
 					</dt>
175 180
 					<dd', !is_numeric($catset_id) ? ' class="catset_' . $catset_id . '"' : '', '>
176 181
 						', $catset['dd'], '
177 182
 					</dd>';
183
+			}
178 184
 		}
179 185
 	}
180 186
 
@@ -182,21 +188,23 @@  discard block
 block discarded – undo
182 188
 	echo '
183 189
 				</dl>';
184 190
 
185
-	if (isset($context['category']['is_new']))
186
-		echo '
191
+	if (isset($context['category']['is_new'])) {
192
+			echo '
187 193
 				<input type="submit" name="add" value="', $txt['mboards_add_cat_button'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button">';
188
-	else
189
-		echo '
194
+	} else {
195
+			echo '
190 196
 				<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button">
191 197
 				<input type="submit" name="delete" value="', $txt['mboards_delete_cat'], '" data-confirm="', $txt['catConfirm'], '" class="button you_sure">';
198
+	}
192 199
 	echo '
193 200
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
194 201
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
195 202
 
196 203
 	// If this category is empty we don't bother with the next confirmation screen.
197
-	if ($context['category']['is_empty'])
198
-		echo '
204
+	if ($context['category']['is_empty']) {
205
+			echo '
199 206
 				<input type="hidden" name="empty" value="1">';
207
+	}
200 208
 
201 209
 	echo '
202 210
 			</div><!-- .windowbg -->
@@ -223,9 +231,10 @@  discard block
 block discarded – undo
223 231
 				<p>', $txt['mboards_delete_cat_contains'], ':</p>
224 232
 				<ul>';
225 233
 
226
-	foreach ($context['category']['children'] as $child)
227
-		echo '
234
+	foreach ($context['category']['children'] as $child) {
235
+			echo '
228 236
 					<li>', $child, '</li>';
237
+	}
229 238
 
230 239
 	echo '
231 240
 				</ul>
@@ -239,10 +248,11 @@  discard block
 block discarded – undo
239 248
 					<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1"', count($context['category_order']) == 1 ? ' disabled' : '', '>', $txt['mboards_delete_option2'], '</label>:
240 249
 					<select name="cat_to"', count($context['category_order']) == 1 ? ' disabled' : '', '>';
241 250
 
242
-	foreach ($context['category_order'] as $cat)
243
-		if ($cat['id'] != 0)
251
+	foreach ($context['category_order'] as $cat) {
252
+			if ($cat['id'] != 0)
244 253
 			echo '
245 254
 						<option value="', $cat['id'], '">', $cat['true_name'], '</option>';
255
+	}
246 256
 
247 257
 	echo '
248 258
 					</select>
@@ -285,9 +295,10 @@  discard block
 block discarded – undo
285 295
 					<dd>
286 296
 						<select name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">';
287 297
 
288
-	foreach ($context['categories'] as $category)
289
-		echo '
298
+	foreach ($context['categories'] as $category) {
299
+			echo '
290 300
 							<option', $category['selected'] ? ' selected' : '', ' value="', $category['id'], '">', $category['name'], '</option>';
301
+	}
291 302
 	echo '
292 303
 						</select>
293 304
 					</dd>';
@@ -315,9 +326,10 @@  discard block
 block discarded – undo
315 326
 						<select id="board_order" name="board_order"', !isset($context['board']['is_new']) ? ' disabled' : '', '>
316 327
 							', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '';
317 328
 
318
-		foreach ($context['board_order'] as $order)
319
-			echo '
329
+		foreach ($context['board_order'] as $order) {
330
+					echo '
320 331
 							<option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
332
+		}
321 333
 		echo '
322 334
 						</select>
323 335
 					</dd>';
@@ -346,13 +358,15 @@  discard block
 block discarded – undo
346 358
 					<dd>
347 359
 						<select name="profile">';
348 360
 
349
-	if (isset($context['board']['is_new']))
350
-		echo '
361
+	if (isset($context['board']['is_new'])) {
362
+			echo '
351 363
 							<option value="-1">[', $txt['permission_profile_inherit'], ']</option>';
364
+	}
352 365
 
353
-	foreach ($context['profiles'] as $id => $profile)
354
-		echo '
366
+	foreach ($context['profiles'] as $id => $profile) {
367
+			echo '
355 368
 							<option value="', $id, '"', $id == $context['board']['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
369
+	}
356 370
 
357 371
 	echo '
358 372
 						</select>
@@ -365,8 +379,8 @@  discard block
 block discarded – undo
365 379
 					</dt>
366 380
 					<dd>';
367 381
 
368
-	if (!empty($modSettings['deny_boards_access']))
369
-		echo '
382
+	if (!empty($modSettings['deny_boards_access'])) {
383
+			echo '
370 384
 						<table>
371 385
 							<tr>
372 386
 								<td></td>
@@ -374,10 +388,11 @@  discard block
 block discarded – undo
374 388
 								<th>', $txt['permissions_option_off'], '</th>
375 389
 								<th>', $txt['permissions_option_deny'], '</th>
376 390
 							</tr>';
391
+	}
377 392
 
378 393
 	// List all the membergroups so the user can choose who may access this board.
379
-	foreach ($context['groups'] as $group)
380
-		if (empty($modSettings['deny_boards_access']))
394
+	foreach ($context['groups'] as $group) {
395
+			if (empty($modSettings['deny_boards_access']))
381 396
 			echo '
382 397
 						<label for="groups_', $group['id'], '">
383 398
 							<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', in_array($group['id'], $context['board_managers']) ? ' checked disabled' : ($group['allow'] ? ' checked' : ''), '>
@@ -385,8 +400,9 @@  discard block
 block discarded – undo
385 400
 								', $group['name'], '
386 401
 							</span>
387 402
 						</label><br>';
388
-		else
389
-			echo '
403
+	}
404
+		else {
405
+					echo '
390 406
 							<tr>
391 407
 								<td>
392 408
 									<label for="groups_', $group['id'], '_a">
@@ -406,16 +422,17 @@  discard block
 block discarded – undo
406 422
 								</td>
407 423
 								<td></td>
408 424
 							</tr>';
425
+		}
409 426
 
410
-	if (empty($modSettings['deny_boards_access']))
411
-		echo '
427
+	if (empty($modSettings['deny_boards_access'])) {
428
+			echo '
412 429
 						<span class="select_all_box">
413 430
 							<em>', $txt['check_all'], '</em> <input type="checkbox" onclick="invertAll(this, this.form, \'groups[\');">
414 431
 						</span>
415 432
 						<br><br>
416 433
 					</dd>';
417
-	else
418
-		echo '
434
+	} else {
435
+			echo '
419 436
 							<tr class="select_all_box">
420 437
 								<td>
421 438
 								</td>
@@ -434,6 +451,7 @@  discard block
 block discarded – undo
434 451
 							</tr>
435 452
 						</table>
436 453
 					</dd>';
454
+	}
437 455
 
438 456
 	// Options to choose moderators, specify as announcement board and choose whether to count posts here.
439 457
 	echo '
@@ -488,8 +506,8 @@  discard block
 block discarded – undo
488 506
 					</dl>
489 507
 				</div>';
490 508
 
491
-		if ($context['board']['redirect'])
492
-			echo '
509
+		if ($context['board']['redirect']) {
510
+					echo '
493 511
 				<div id="reset_redirect_div">
494 512
 					<dl class="settings">
495 513
 						<dt>
@@ -502,6 +520,7 @@  discard block
 block discarded – undo
502 520
 						</dd>
503 521
 					</dl>
504 522
 				</div>';
523
+		}
505 524
 	}
506 525
 
507 526
 	echo '
@@ -529,9 +548,10 @@  discard block
 block discarded – undo
529 548
 							<select name="boardtheme" id="boardtheme" onchange="refreshOptions();">
530 549
 								<option value="0"', $context['board']['theme'] == 0 ? ' selected' : '', '>', $txt['mboards_theme_default'], '</option>';
531 550
 
532
-	foreach ($context['themes'] as $theme)
533
-		echo '
551
+	foreach ($context['themes'] as $theme) {
552
+			echo '
534 553
 									<option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
554
+	}
535 555
 
536 556
 	echo '
537 557
 							</select>
@@ -560,14 +580,15 @@  discard block
 block discarded – undo
560 580
 
561 581
 		foreach ($context['custom_board_settings'] as $cbs_id => $cbs)
562 582
 		{
563
-			if (!empty($cbs['dt']) && !empty($cbs['dd']))
564
-				echo '
583
+			if (!empty($cbs['dt']) && !empty($cbs['dd'])) {
584
+							echo '
565 585
 						<dt class="clear', !is_numeric($cbs_id) ? ' cbs_' . $cbs_id : '', '">
566 586
 							', $cbs['dt'], '
567 587
 						</dt>
568 588
 						<dd', !is_numeric($cbs_id) ? ' class="cbs_' . $cbs_id . '"' : '', '>
569 589
 							', $cbs['dd'], '
570 590
 						</dd>';
591
+			}
571 592
 		}
572 593
 
573 594
 		echo '
@@ -575,9 +596,10 @@  discard block
 block discarded – undo
575 596
 				</div>';
576 597
 	}
577 598
 
578
-	if (!empty($context['board']['is_recycle']))
579
-		echo '
599
+	if (!empty($context['board']['is_recycle'])) {
600
+			echo '
580 601
 				<div class="noticebox">', $txt['mboards_recycle_disabled_delete'], '</div>';
602
+	}
581 603
 
582 604
 	echo '
583 605
 				<input type="hidden" name="rid" value="', $context['redirect_location'], '">
@@ -585,21 +607,24 @@  discard block
 block discarded – undo
585 607
 				<input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '">';
586 608
 
587 609
 	// If this board has no children don't bother with the next confirmation screen.
588
-	if ($context['board']['no_children'])
589
-		echo '
610
+	if ($context['board']['no_children']) {
611
+			echo '
590 612
 				<input type="hidden" name="no_children" value="1">';
613
+	}
591 614
 
592
-	if (isset($context['board']['is_new']))
593
-		echo '
615
+	if (isset($context['board']['is_new'])) {
616
+			echo '
594 617
 				<input type="hidden" name="cur_cat" value="', $context['board']['category'], '">
595 618
 				<input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" class="button">';
596
-	else
597
-		echo '
619
+	} else {
620
+			echo '
598 621
 				<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" class="button">';
622
+	}
599 623
 
600
-	if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle']))
601
-		echo '
624
+	if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) {
625
+			echo '
602 626
 				<input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" data-confirm="', $txt['boardConfirm'], '" class="button you_sure">';
627
+	}
603 628
 	echo '
604 629
 			</div><!-- .windowbg -->
605 630
 		</form>
@@ -620,12 +645,13 @@  discard block
 block discarded – undo
620 645
 			sItemListContainerId: \'moderator_container\',
621 646
 			aListItems: [';
622 647
 
623
-	foreach ($context['board']['moderators'] as $id_member => $member_name)
624
-		echo '
648
+	foreach ($context['board']['moderators'] as $id_member => $member_name) {
649
+			echo '
625 650
 				{
626 651
 					sItemId: ', JavaScriptEscape($id_member), ',
627 652
 					sItemName: ', JavaScriptEscape($member_name), '
628 653
 				}', $id_member == $context['board']['last_moderator_id'] ? '' : ',';
654
+	}
629 655
 
630 656
 	echo '
631 657
 			]
@@ -645,12 +671,13 @@  discard block
 block discarded – undo
645 671
 			sItemListContainerId: \'moderator_group_container\',
646 672
 			aListItems: [';
647 673
 
648
-	foreach ($context['board']['moderator_groups'] as $id_group => $group_name)
649
-		echo '
674
+	foreach ($context['board']['moderator_groups'] as $id_group => $group_name) {
675
+			echo '
650 676
 				{
651 677
 					sItemId: ', JavaScriptEscape($id_group), ',
652 678
 					sItemName: ', JavaScriptEscape($group_name), '
653 679
 				}', $id_group == $context['board']['last_moderator_group_id'] ? '' : ',';
680
+	}
654 681
 
655 682
 		echo '
656 683
 			]
@@ -676,17 +703,19 @@  discard block
 block discarded – undo
676 703
 		echo '
677 704
 			document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";';
678 705
 
679
-		if ($context['board']['redirect'])
680
-			echo '
706
+		if ($context['board']['redirect']) {
707
+					echo '
681 708
 			document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";';
709
+		}
682 710
 	}
683 711
 
684 712
 	// Include any JavaScript added by mods using the 'integrate_edit_board' hook.
685 713
 	if (!empty($context['custom_refreshOptions']) && is_array($context['custom_refreshOptions']))
686 714
 	{
687
-		foreach ($context['custom_refreshOptions'] as $refreshOption)
688
-			echo '
715
+		foreach ($context['custom_refreshOptions'] as $refreshOption) {
716
+					echo '
689 717
 			', $refreshOption;
718
+		}
690 719
 	}
691 720
 
692 721
 	echo '
@@ -715,9 +744,10 @@  discard block
 block discarded – undo
715 744
 				<p>', $txt['mboards_delete_board_contains'], '</p>
716 745
 				<ul>';
717 746
 
718
-	foreach ($context['children'] as $child)
719
-		echo '
747
+	foreach ($context['children'] as $child) {
748
+			echo '
720 749
 					<li>', $child['node']['name'], '</li>';
750
+	}
721 751
 
722 752
 	echo '
723 753
 				</ul>
@@ -731,10 +761,11 @@  discard block
 block discarded – undo
731 761
 					<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1"', empty($context['can_move_children']) ? ' disabled' : '', '>', $txt['mboards_delete_board_option2'], '</label>:
732 762
 					<select name="board_to"', empty($context['can_move_children']) ? ' disabled' : '', '>';
733 763
 
734
-	foreach ($context['board_order'] as $board)
735
-		if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
764
+	foreach ($context['board_order'] as $board) {
765
+			if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
736 766
 			echo '
737 767
 						<option value="', $board['id'], '">', $board['name'], '</option>';
768
+	}
738 769
 
739 770
 	echo '
740 771
 					</select>
Please login to merge, or discard this patch.
Themes/default/ManageAttachments.template.php 1 patch
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -121,9 +121,10 @@  discard block
 block discarded – undo
121 121
 		<h3 class="catbg">', $txt['attachment_transfer'], '</h3>
122 122
 	</div>';
123 123
 
124
-	if (!empty($context['results']))
125
-		echo '
124
+	if (!empty($context['results'])) {
125
+			echo '
126 126
 	<div class="noticebox">', $context['results'], '</div>';
127
+	}
127 128
 
128 129
 	echo '
129 130
 	<div class="windowbg noup">
@@ -135,9 +136,10 @@  discard block
 block discarded – undo
135 136
 					<select name="from">
136 137
 						<option value="0">', $txt['attachment_transfer_select'], '</option>';
137 138
 
138
-	foreach ($context['attach_dirs'] as $id => $dir)
139
-		echo '
139
+	foreach ($context['attach_dirs'] as $id => $dir) {
140
+			echo '
140 141
 						<option value="', $id, '">', $dir, '</option>';
142
+	}
141 143
 
142 144
 	echo '
143 145
 					</select>
@@ -148,13 +150,14 @@  discard block
 block discarded – undo
148 150
 						<option value="0">', $txt['attachment_transfer_auto_select'], '</option>
149 151
 						<option value="-1">', $txt['attachment_transfer_forum_root'], '</option>';
150 152
 
151
-	if (!empty($context['base_dirs']))
152
-		foreach ($context['base_dirs'] as $id => $dir)
153
+	if (!empty($context['base_dirs'])) {
154
+			foreach ($context['base_dirs'] as $id => $dir)
153 155
 			echo '
154 156
 						<option value="', $id, '">', $dir, '</option>';
155
-	else
156
-			echo '
157
+	} else {
158
+				echo '
157 159
 						<option value="0" disabled>', $txt['attachment_transfer_no_base'], '</option>';
160
+	}
158 161
 
159 162
 	echo '
160 163
 					</select>
@@ -164,18 +167,20 @@  discard block
 block discarded – undo
164 167
 					<select name="to">
165 168
 						<option value="0">', $txt['attachment_transfer_select'], '</option>';
166 169
 
167
-	foreach ($context['attach_dirs'] as $id => $dir)
168
-		echo '
170
+	foreach ($context['attach_dirs'] as $id => $dir) {
171
+			echo '
169 172
 						<option value="', $id, '">', $dir, '</option>';
173
+	}
170 174
 
171 175
 	echo '
172 176
 					</select>
173 177
 				</dd>';
174 178
 
175
-	if (!empty($modSettings['attachmentDirFileLimit']))
176
-		echo '
179
+	if (!empty($modSettings['attachmentDirFileLimit'])) {
180
+			echo '
177 181
 				<dt>', $txt['attachment_transfer_empty'], '</dt>
178 182
 				<dd><input type="checkbox" name="empty_it"', $context['checked'] ? ' checked' : '', '></dd>';
183
+	}
179 184
 
180 185
 	echo '
181 186
 			</dl>
@@ -211,8 +216,8 @@  discard block
 block discarded – undo
211 216
 	global $context, $txt, $scripturl;
212 217
 
213 218
 	// If we've completed just let them know!
214
-	if ($context['completed'])
215
-		echo '
219
+	if ($context['completed']) {
220
+			echo '
216 221
 	<div id="manage_attachments">
217 222
 		<div class="cat_bar">
218 223
 			<h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
@@ -221,10 +226,11 @@  discard block
 block discarded – undo
221 226
 			', $txt['repair_attachments_complete_desc'], '
222 227
 		</div>
223 228
 	</div>';
229
+	}
224 230
 
225 231
 	// What about if no errors were even found?
226
-	elseif (!$context['errors_found'])
227
-		echo '
232
+	elseif (!$context['errors_found']) {
233
+			echo '
228 234
 	<div id="manage_attachments">
229 235
 		<div class="cat_bar">
230 236
 			<h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
@@ -233,6 +239,7 @@  discard block
 block discarded – undo
233 239
 			', $txt['repair_attachments_no_errors'], '
234 240
 		</div>
235 241
 	</div>';
242
+	}
236 243
 
237 244
 	// Otherwise, I'm sad to say, we have a problem!
238 245
 	else
@@ -247,11 +254,12 @@  discard block
 block discarded – undo
247 254
 				<p>', $txt['repair_attachments_error_desc'], '</p>';
248 255
 
249 256
 		// Loop through each error reporting the status
250
-		foreach ($context['repair_errors'] as $error => $number)
251
-			if (!empty($number))
257
+		foreach ($context['repair_errors'] as $error => $number) {
258
+					if (!empty($number))
252 259
 				echo '
253 260
 				<input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '">
254 261
 				<label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br>';
262
+		}
255 263
 
256 264
 		echo '
257 265
 				<br>
@@ -270,8 +278,9 @@  discard block
 block discarded – undo
270 278
 {
271 279
 	global $modSettings;
272 280
 
273
-	if (!empty($modSettings['attachment_basedirectories']))
274
-		template_show_list('base_paths');
281
+	if (!empty($modSettings['attachment_basedirectories'])) {
282
+			template_show_list('base_paths');
283
+	}
275 284
 
276 285
 	template_show_list('attach_paths');
277 286
 }
Please login to merge, or discard this patch.
Themes/default/ModerationCenter.template.php 1 patch
Braces   +59 added lines, -41 removed lines patch added patch discarded remove patch
@@ -54,18 +54,20 @@  discard block
 block discarded – undo
54 54
 		<div class="windowbg noup" id="group_requests_panel">
55 55
 			<ul>';
56 56
 
57
-	foreach ($context['group_requests'] as $request)
58
-		echo '
57
+	foreach ($context['group_requests'] as $request) {
58
+			echo '
59 59
 				<li class="smalltext">
60 60
 					<a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
61 61
 				</li>';
62
+	}
62 63
 
63 64
 	// Don't have any watched users right now?
64
-	if (empty($context['group_requests']))
65
-		echo '
65
+	if (empty($context['group_requests'])) {
66
+			echo '
66 67
 				<li>
67 68
 					<strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
68 69
 				</li>';
70
+	}
69 71
 
70 72
 	echo '
71 73
 			</ul>
@@ -121,18 +123,20 @@  discard block
 block discarded – undo
121 123
 		<div class="windowbg noup" id="watched_users_panel">
122 124
 			<ul>';
123 125
 
124
-	foreach ($context['watched_users'] as $user)
125
-		echo '
126
+	foreach ($context['watched_users'] as $user) {
127
+			echo '
126 128
 				<li>
127 129
 					<span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
128 130
 				</li>';
131
+	}
129 132
 
130 133
 	// Don't have any watched users right now?
131
-	if (empty($context['watched_users']))
132
-		echo '
134
+	if (empty($context['watched_users'])) {
135
+			echo '
133 136
 				<li>
134 137
 					<strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
135 138
 				</li>';
139
+	}
136 140
 
137 141
 	echo '
138 142
 			</ul>
@@ -188,18 +192,20 @@  discard block
 block discarded – undo
188 192
 		<div class="windowbg noup" id="reported_posts_panel">
189 193
 			<ul>';
190 194
 
191
-	foreach ($context['reported_posts'] as $post)
192
-		echo '
195
+	foreach ($context['reported_posts'] as $post) {
196
+			echo '
193 197
 				<li>
194 198
 					<span class="smalltext">', sprintf($txt['mc_post_report'], $post['report_link'], $post['author']['link']), '</span>
195 199
 				</li>';
200
+	}
196 201
 
197 202
 	// Don't have any watched users right now?
198
-	if (empty($context['reported_posts']))
199
-		echo '
203
+	if (empty($context['reported_posts'])) {
204
+			echo '
200 205
 				<li>
201 206
 					<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
202 207
 				</li>';
208
+	}
203 209
 
204 210
 	echo '
205 211
 			</ul>
@@ -255,18 +261,20 @@  discard block
 block discarded – undo
255 261
 		<div class="windowbg noup" id="reported_users_panel">
256 262
 			<ul>';
257 263
 
258
-	foreach ($context['reported_users'] as $user)
259
-		echo '
264
+	foreach ($context['reported_users'] as $user) {
265
+			echo '
260 266
 				<li>
261 267
 					<span class="smalltext">', $user['user']['link'], '</span>
262 268
 				</li>';
269
+	}
263 270
 
264 271
 	// Don't have any watched users right now?
265
-	if (empty($context['reported_users']))
266
-		echo '
272
+	if (empty($context['reported_users'])) {
273
+			echo '
267 274
 				<li>
268 275
 					<strong class="smalltext">', $txt['mc_reported_users_none'], '</strong>
269 276
 				</li>';
277
+	}
270 278
 
271 279
 	echo '
272 280
 			</ul>
@@ -313,11 +321,12 @@  discard block
 block discarded – undo
313 321
 	global $context, $txt, $scripturl;
314 322
 
315 323
 	// Let them know the action was a success.
316
-	if (!empty($context['report_post_action']))
317
-		echo '
324
+	if (!empty($context['report_post_action'])) {
325
+			echo '
318 326
 		<div class="infobox">
319 327
 			', $txt['report_action_' . $context['report_post_action']], '
320 328
 		</div>';
329
+	}
321 330
 
322 331
 	echo '
323 332
 		<div id="modnotes">
@@ -333,11 +342,12 @@  discard block
 block discarded – undo
333 342
 					<ul class="moderation_notes">';
334 343
 
335 344
 		// Cycle through the notes.
336
-		foreach ($context['notes'] as $note)
337
-			echo '
345
+		foreach ($context['notes'] as $note) {
346
+					echo '
338 347
 						<li class="smalltext">
339 348
 							', ($note['can_delete'] ? '<a href="' . $note['delete_href'] . ';' . $context['mod-modnote-del_token_var'] . '=' . $context['mod-modnote-del_token'] . '" data-confirm="' . $txt['mc_reportedp_delete_confirm'] . '" class="you_sure"><span class="generic_icons delete"></span></a>' : ''), $note['time'], ' <strong>', $note['author']['link'], ':</strong> ', $note['text'], '
340 349
 						</li>';
350
+		}
341 351
 
342 352
 		echo '
343 353
 					</ul>
@@ -378,18 +388,19 @@  discard block
 block discarded – undo
378 388
 	$remove_button = create_button('delete', 'remove_message', 'remove');
379 389
 
380 390
 	// No posts?
381
-	if (empty($context['unapproved_items']))
382
-		echo '
391
+	if (empty($context['unapproved_items'])) {
392
+			echo '
383 393
 			<div class="windowbg">
384 394
 				<p class="centertext">
385 395
 					', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '
386 396
 				</p>
387 397
 			</div>';
388
-	else
389
-		echo '
398
+	} else {
399
+			echo '
390 400
 			<div class="pagesection floatleft">
391 401
 				', $context['page_index'], '
392 402
 			</div>';
403
+	}
393 404
 
394 405
 	foreach ($context['unapproved_items'] as $item)
395 406
 	{
@@ -408,14 +419,16 @@  discard block
 block discarded – undo
408 419
 				<span class="floatright">
409 420
 					<a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';approve=', $item['id'], '">', $approve_button, '</a>';
410 421
 
411
-		if ($item['can_delete'])
412
-			echo '
422
+		if ($item['can_delete']) {
423
+					echo '
413 424
 					', $context['menu_separator'], '
414 425
 					<a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';delete=', $item['id'], '">', $remove_button, '</a>';
426
+		}
415 427
 
416
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
417
-			echo '
428
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
429
+					echo '
418 430
 					<input type="checkbox" name="item[]" value="', $item['id'], '" checked> ';
431
+		}
419 432
 
420 433
 		echo '
421 434
 				</span>
@@ -425,8 +438,8 @@  discard block
 block discarded – undo
425 438
 	echo '
426 439
 			<div class="pagesection">';
427 440
 
428
-	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
429
-		echo '
441
+	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
442
+			echo '
430 443
 				<div class="floatright">
431 444
 					<select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
432 445
 						<option value="0">', $txt['with_selected'], ':</option>
@@ -438,12 +451,14 @@  discard block
 block discarded – undo
438 451
 						<input type="submit" name="mc_go" value="', $txt['go'], '" class="button">
439 452
 					</noscript>
440 453
 				</div>';
454
+	}
441 455
 
442
-	if (!empty($context['unapproved_items']))
443
-		echo '
456
+	if (!empty($context['unapproved_items'])) {
457
+			echo '
444 458
 				<div class="floatleft">
445 459
 					<div class="pagelinks">', $context['page_index'], '</div>
446 460
 				</div>';
461
+	}
447 462
 
448 463
 	echo '
449 464
 			</div><!-- .pagesection -->
@@ -464,8 +479,9 @@  discard block
 block discarded – undo
464 479
 
465 480
 	// We'll have a delete please bob.
466 481
 	// @todo Discuss this with the team and rewrite if required.
467
-	if (empty($delete_button))
468
-		$delete_button = create_button('delete', 'remove_message', 'remove', 'class="centericon"');
482
+	if (empty($delete_button)) {
483
+			$delete_button = create_button('delete', 'remove_message', 'remove', 'class="centericon"');
484
+	}
469 485
 
470 486
 	$output_html = '
471 487
 					<div>
@@ -474,10 +490,11 @@  discard block
 block discarded – undo
474 490
 						</div>
475 491
 						<div class="floatright">';
476 492
 
477
-	if ($post['can_delete'])
478
-		$output_html .= '
493
+	if ($post['can_delete']) {
494
+			$output_html .= '
479 495
 							<a href="' . $scripturl . '?action=moderate;area=userwatch;sa=post;delete=' . $post['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" data-confirm="' . $txt['mc_watched_users_delete_post'] . '" class="you_sure">' . $delete_button . '</a>
480 496
 							<input type="checkbox" name="delete[]" value="' . $post['id'] . '">';
497
+	}
481 498
 
482 499
 	$output_html .= '
483 500
 						</div>
@@ -521,12 +538,12 @@  discard block
 block discarded – undo
521 538
 				<input type="submit" name="save" value="', $txt['save'], '" class="button">
522 539
 			</div>
523 540
 		</form>';
524
-	}
525
-	else
526
-		echo '
541
+	} else {
542
+			echo '
527 543
 		<div class="windowbg">
528 544
 			<div class="centertext">', $txt['mc_no_settings'], '</div>
529 545
 		</div>';
546
+	}
530 547
 
531 548
 	echo '
532 549
 	</div><!-- #modcenter -->';
@@ -622,13 +639,14 @@  discard block
 block discarded – undo
622 639
 					</dd>
623 640
 				</dl>';
624 641
 
625
-	if ($context['template_data']['can_edit_personal'])
626
-		echo '
642
+	if ($context['template_data']['can_edit_personal']) {
643
+			echo '
627 644
 				<input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', '>
628 645
 					<label for="make_personal">
629 646
 						<strong>', $txt['mc_warning_template_personal'], '</strong>
630 647
 					</label>
631 648
 					<p class="smalltext">', $txt['mc_warning_template_personal_desc'], '</p>';
649
+	}
632 650
 
633 651
 	echo '
634 652
 				<input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button">
Please login to merge, or discard this patch.
Themes/default/ReportedContent.template.php 1 patch
Braces   +66 added lines, -44 removed lines patch added patch discarded remove patch
@@ -18,11 +18,12 @@  discard block
 block discarded – undo
18 18
 	global $context, $txt, $scripturl;
19 19
 
20 20
 	// Let them know the action was a success.
21
-	if (!empty($context['report_post_action']))
22
-		echo '
21
+	if (!empty($context['report_post_action'])) {
22
+			echo '
23 23
 	<div class="infobox">
24 24
 		', $txt['report_action_' . $context['report_post_action']], '
25 25
 	</div>';
26
+	}
26 27
 
27 28
 	echo '
28 29
 	<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reportedposts;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
 
53 54
 		// Prepare the comments...
54 55
 		$comments = array();
55
-		foreach ($report['comments'] as $comment)
56
-			$comments[$comment['member']['id']] = $comment['member']['link'];
56
+		foreach ($report['comments'] as $comment) {
57
+					$comments[$comment['member']['id']] = $comment['member']['link'];
58
+		}
57 59
 
58 60
 		echo '
59 61
 				', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
@@ -69,18 +71,21 @@  discard block
 block discarded – undo
69 71
 				<li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
70 72
 
71 73
 		// Delete message button.
72
-		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
73
-			echo '
74
+		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))) {
75
+					echo '
74 76
 				<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'], '.0;msg=', $report['topic']['id_msg'], ';modcenter;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['mc_reportedp_delete_confirm'], '" class="you_sure">', $delete_button, '</a></li>';
77
+		}
75 78
 
76 79
 		// Ban this user button.
77
-		if (!$report['closed'] && !empty($context['report_manage_bans']))
78
-			echo '
80
+		if (!$report['closed'] && !empty($context['report_manage_bans'])) {
81
+					echo '
79 82
 				<li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u=' . $report['author']['id'] : ';msg=' . $report['topic']['id_msg']), ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
83
+		}
80 84
 
81
-		if (!$context['view_closed'])
82
-			echo '
85
+		if (!$context['view_closed']) {
86
+					echo '
83 87
 				<li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';
88
+		}
84 89
 
85 90
 		echo '
86 91
 			</ul>
@@ -88,18 +93,20 @@  discard block
 block discarded – undo
88 93
 	}
89 94
 
90 95
 	// Were none found?
91
-	if (empty($context['reports']))
92
-		echo '
96
+	if (empty($context['reports'])) {
97
+			echo '
93 98
 		<div class="windowbg">
94 99
 			<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
95 100
 		</div>';
101
+	}
96 102
 
97 103
 	echo '
98 104
 		<div class="pagesection">';
99 105
 
100
-	if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'])
101
-		echo '
106
+	if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many']) {
107
+			echo '
102 108
 			<div class="pagelinks floatleft">' . $context['page_index'] . '</div>';
109
+	}
103 110
 
104 111
 	echo '
105 112
 			<div class="floatright">', !$context['view_closed'] ? '
@@ -130,18 +137,20 @@  discard block
 block discarded – undo
130 137
 			<div class="modbox">
131 138
 				<ul>';
132 139
 
133
-	foreach ($context['reported_posts'] as $report)
134
-		echo '
140
+	foreach ($context['reported_posts'] as $report) {
141
+			echo '
135 142
 					<li class="smalltext">
136 143
 						<a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
137 144
 					</li>';
145
+	}
138 146
 
139 147
 	// Don't have any watched users right now?
140
-	if (empty($context['reported_posts']))
141
-		echo '
148
+	if (empty($context['reported_posts'])) {
149
+			echo '
142 150
 					<li>
143 151
 						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
144 152
 					</li>';
153
+	}
145 154
 
146 155
 	echo '
147 156
 				</ul>
@@ -189,11 +198,12 @@  discard block
 block discarded – undo
189 198
 	global $context, $scripturl, $txt;
190 199
 
191 200
 	// Let them know the action was a success.
192
-	if (!empty($context['report_post_action']))
193
-		echo '
201
+	if (!empty($context['report_post_action'])) {
202
+			echo '
194 203
 	<div class="infobox">
195 204
 		', $txt['report_action_' . $context['report_post_action']], '
196 205
 	</div>';
206
+	}
197 207
 
198 208
 	echo '
199 209
 	<div id="modcenter">
@@ -229,14 +239,15 @@  discard block
 block discarded – undo
229 239
 				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
230 240
 			</div>';
231 241
 
232
-	foreach ($context['report']['comments'] as $comment)
233
-		echo '
242
+	foreach ($context['report']['comments'] as $comment) {
243
+			echo '
234 244
 			<div class="windowbg">
235 245
 				<p class="smalltext">
236 246
 					', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
237 247
 				</p>
238 248
 				<p>', $comment['message'], '</p>
239 249
 			</div>';
250
+	}
240 251
 
241 252
 	echo '
242 253
 			<br>
@@ -245,11 +256,12 @@  discard block
 block discarded – undo
245 256
 			</div>
246 257
 			<div>';
247 258
 
248
-	if (empty($context['report']['mod_comments']))
249
-		echo '
259
+	if (empty($context['report']['mod_comments'])) {
260
+			echo '
250 261
 				<div class="information">
251 262
 					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
252 263
 				</div>';
264
+	}
253 265
 
254 266
 	foreach ($context['report']['mod_comments'] as $comment)
255 267
 	{
@@ -335,18 +347,20 @@  discard block
 block discarded – undo
335 347
 			<div class="modbox">
336 348
 				<ul>';
337 349
 
338
-	foreach ($context['reported_members'] as $report)
339
-		echo '
350
+	foreach ($context['reported_members'] as $report) {
351
+			echo '
340 352
 					<li class="smalltext">
341 353
 						<a href="', $report['report_href'], '">', $report['user_name'], '</a>
342 354
 					</li>';
355
+	}
343 356
 
344 357
 	// Don't have any reported members right now?
345
-	if (empty($context['reported_members']))
346
-		echo '
358
+	if (empty($context['reported_members'])) {
359
+			echo '
347 360
 					<li>
348 361
 						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
349 362
 					</li>';
363
+	}
350 364
 
351 365
 	echo '
352 366
 				</ul>
@@ -394,11 +408,12 @@  discard block
 block discarded – undo
394 408
 	global $context, $txt, $scripturl;
395 409
 
396 410
 	// Let them know the action was a success.
397
-	if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']]))
398
-		echo '
411
+	if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']])) {
412
+			echo '
399 413
 	<div class="infobox">
400 414
 		', $txt['report_action_' . $context['report_post_action']], '
401 415
 	</div>';
416
+	}
402 417
 
403 418
 	echo '
404 419
 	<form id="reported_members" action="', $scripturl, '?action=moderate;area=reportedmembers;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
@@ -430,8 +445,9 @@  discard block
 block discarded – undo
430 445
 
431 446
 		// Prepare the comments...
432 447
 		$comments = array();
433
-		foreach ($report['comments'] as $comment)
434
-			$comments[$comment['member']['id']] = $comment['member']['link'];
448
+		foreach ($report['comments'] as $comment) {
449
+					$comments[$comment['member']['id']] = $comment['member']['link'];
450
+		}
435 451
 
436 452
 		echo '
437 453
 				', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
@@ -443,13 +459,15 @@  discard block
 block discarded – undo
443 459
 				<li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
444 460
 
445 461
 		// Ban this user button.
446
-		if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
447
-			echo '
462
+		if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id'])) {
463
+					echo '
448 464
 				<li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
465
+		}
449 466
 
450
-		if (!$context['view_closed'])
451
-			echo '
467
+		if (!$context['view_closed']) {
468
+					echo '
452 469
 				<li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';
470
+		}
453 471
 
454 472
 			echo '
455 473
 			</ul>
@@ -457,11 +475,12 @@  discard block
 block discarded – undo
457 475
 	}
458 476
 
459 477
 	// Were none found?
460
-	if (empty($context['reports']))
461
-		echo '
478
+	if (empty($context['reports'])) {
479
+			echo '
462 480
 		<div class="windowbg">
463 481
 			<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
464 482
 		</div>';
483
+	}
465 484
 
466 485
 	echo '
467 486
 		<div class="pagesection">
@@ -482,11 +501,12 @@  discard block
 block discarded – undo
482 501
 	global $context, $scripturl, $txt;
483 502
 
484 503
 	// Let them know the action was a success.
485
-	if (!empty($context['report_post_action']))
486
-		echo '
504
+	if (!empty($context['report_post_action'])) {
505
+			echo '
487 506
 	<div class="infobox">
488 507
 		', $txt['report_action_' . $context['report_post_action']], '
489 508
 	</div>';
509
+	}
490 510
 
491 511
 	echo '
492 512
 	<div id="modcenter">
@@ -519,14 +539,15 @@  discard block
 block discarded – undo
519 539
 				<h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
520 540
 			</div>';
521 541
 
522
-	foreach ($context['report']['comments'] as $comment)
523
-		echo '
542
+	foreach ($context['report']['comments'] as $comment) {
543
+			echo '
524 544
 			<div class="windowbg">
525 545
 				<p class="smalltext">
526 546
 					', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
527 547
 				</p>
528 548
 				<p>', $comment['message'], '</p>
529 549
 			</div>';
550
+	}
530 551
 
531 552
 	echo '
532 553
 			<br>
@@ -535,11 +556,12 @@  discard block
 block discarded – undo
535 556
 			</div>
536 557
 			<div>';
537 558
 
538
-	if (empty($context['report']['mod_comments']))
539
-		echo '
559
+	if (empty($context['report']['mod_comments'])) {
560
+			echo '
540 561
 				<div class="information">
541 562
 					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
542 563
 				</div>';
564
+	}
543 565
 
544 566
 	foreach ($context['report']['mod_comments'] as $comment)
545 567
 	{
Please login to merge, or discard this patch.
Themes/default/ManageCalendar.template.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,9 +40,10 @@  discard block
 block discarded – undo
40 40
 							<option value="0000"', $context['holiday']['year'] == '0000' ? ' selected' : '', '>', $txt['every_year'], '</option>';
41 41
 
42 42
 	// Show a list of all the years we allow...
43
-	for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
44
-		echo '
43
+	for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) {
44
+			echo '
45 45
 							<option value="', $year, '"', $year == $context['holiday']['year'] ? ' selected' : '', '>', $year, '</option>';
46
+	}
46 47
 
47 48
 	echo '
48 49
 						</select>
@@ -50,9 +51,10 @@  discard block
 block discarded – undo
50 51
 						<select name="month" id="month" onchange="generateDays();">';
51 52
 
52 53
 	// There are 12 months per year - ensure that they all get listed.
53
-	for ($month = 1; $month <= 12; $month++)
54
-		echo '
54
+	for ($month = 1; $month <= 12; $month++) {
55
+			echo '
55 56
 							<option value="', $month, '"', $month == $context['holiday']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>';
57
+	}
56 58
 
57 59
 	echo '
58 60
 						</select>
@@ -60,23 +62,25 @@  discard block
 block discarded – undo
60 62
 						<select name="day" id="day" onchange="generateDays();">';
61 63
 
62 64
 	// This prints out all the days in the current month - this changes dynamically as we switch months.
63
-	for ($day = 1; $day <= $context['holiday']['last_day']; $day++)
64
-		echo '
65
+	for ($day = 1; $day <= $context['holiday']['last_day']; $day++) {
66
+			echo '
65 67
 							<option value="', $day, '"', $day == $context['holiday']['day'] ? ' selected' : '', '>', $day, '</option>';
68
+	}
66 69
 
67 70
 	echo '
68 71
 						</select>
69 72
 					</dd>
70 73
 				</dl>';
71 74
 
72
-	if ($context['is_new'])
73
-		echo '
75
+	if ($context['is_new']) {
76
+			echo '
74 77
 				<input type="submit" value="', $txt['holidays_button_add'], '" class="button">';
75
-	else
76
-		echo '
78
+	} else {
79
+			echo '
77 80
 				<input type="submit" name="edit" value="', $txt['holidays_button_edit'], '" class="button">
78 81
 				<input type="submit" name="delete" value="', $txt['holidays_button_remove'], '" class="button">
79 82
 				<input type="hidden" name="holiday" value="', $context['holiday']['id'], '">';
83
+	}
80 84
 	echo '
81 85
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
82 86
 			</div><!-- .windowbg -->
Please login to merge, or discard this patch.