Completed
Push — release-2.1 ( b31e7f...1ca3a6 )
by Jeremy
06:13
created
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.
Themes/default/Memberlist.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 			if (!empty($context['custom_profile_fields']['columns']))
107 107
 				foreach ($context['custom_profile_fields']['columns'] as $key => $column)
108 108
 					echo '
109
-						<td class="' , $key , ' centertext">', $member['options'][$key], '</td>';
109
+						<td class="' , $key, ' centertext">', $member['options'][$key], '</td>';
110 110
 
111 111
 			echo '
112 112
 					</tr>';
Please login to merge, or discard this 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="real_name 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="website_url centertext">', $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 '
@@ -91,33 +96,36 @@  discard block
 block discarded – undo
91 96
 				echo '
92 97
 						<td class="post_count centertext">';
93 98
 
94
-				if (!empty($member['post_percent']))
95
-					echo '
99
+				if (!empty($member['post_percent'])) {
100
+									echo '
96 101
 							<div class="generic_bar">
97 102
 								<div class="bar" style="width: ', $member['post_percent'], '%;"></div>
98 103
 								<span>', $member['posts'], '</span>
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="' , $key , ' 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/Register.php 1 patch
Braces   +182 added lines, -132 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 4
16 16
  */
17 17
 
18
-if (!defined('SMF'))
18
+if (!defined('SMF')) {
19 19
 	die('No direct access...');
20
+}
20 21
 
21 22
 /**
22 23
  * Begin the registration process.
@@ -29,19 +30,23 @@  discard block
 block discarded – undo
29 30
 	global $language, $scripturl, $smcFunc, $sourcedir, $cur_profile;
30 31
 
31 32
 	// Is this an incoming AJAX check?
32
-	if (isset($_GET['sa']) && $_GET['sa'] == 'usernamecheck')
33
-		return RegisterCheckUsername();
33
+	if (isset($_GET['sa']) && $_GET['sa'] == 'usernamecheck') {
34
+			return RegisterCheckUsername();
35
+	}
34 36
 
35 37
 	// Check if the administrator has it disabled.
36
-	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == '3')
37
-		fatal_lang_error('registration_disabled', false);
38
+	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == '3') {
39
+			fatal_lang_error('registration_disabled', false);
40
+	}
38 41
 
39 42
 	// If this user is an admin - redirect them to the admin registration page.
40
-	if (allowedTo('moderate_forum') && !$user_info['is_guest'])
41
-		redirectexit('action=admin;area=regcenter;sa=register');
43
+	if (allowedTo('moderate_forum') && !$user_info['is_guest']) {
44
+			redirectexit('action=admin;area=regcenter;sa=register');
45
+	}
42 46
 	// You are not a guest, so you are a member - and members don't get to register twice!
43
-	elseif (empty($user_info['is_guest']))
44
-		redirectexit();
47
+	elseif (empty($user_info['is_guest'])) {
48
+			redirectexit();
49
+	}
45 50
 
46 51
 	loadLanguage('Login');
47 52
 	loadTemplate('Register');
@@ -82,16 +87,18 @@  discard block
 block discarded – undo
82 87
 		}
83 88
 	}
84 89
 	// Make sure they don't squeeze through without agreeing.
85
-	elseif ($current_step > 1 && $context['require_agreement'] && !$context['registration_passed_agreement'])
86
-		$current_step = 1;
90
+	elseif ($current_step > 1 && $context['require_agreement'] && !$context['registration_passed_agreement']) {
91
+			$current_step = 1;
92
+	}
87 93
 
88 94
 	// Show the user the right form.
89 95
 	$context['sub_template'] = $current_step == 1 ? 'registration_agreement' : 'registration_form';
90 96
 	$context['page_title'] = $current_step == 1 ? $txt['registration_agreement'] : $txt['registration_form'];
91 97
 
92 98
 	// Kinda need this.
93
-	if ($context['sub_template'] == 'registration_form')
94
-		loadJavaScriptFile('register.js', array('defer' => false, 'minimize' => true), 'smf_register');
99
+	if ($context['sub_template'] == 'registration_form') {
100
+			loadJavaScriptFile('register.js', array('defer' => false, 'minimize' => true), 'smf_register');
101
+	}
95 102
 
96 103
 	// Add the register chain to the link tree.
97 104
 	$context['linktree'][] = array(
@@ -100,24 +107,26 @@  discard block
 block discarded – undo
100 107
 	);
101 108
 
102 109
 	// Prepare the time gate! Do it like so, in case later steps want to reset the limit for any reason, but make sure the time is the current one.
103
-	if (!isset($_SESSION['register']))
104
-		$_SESSION['register'] = array(
110
+	if (!isset($_SESSION['register'])) {
111
+			$_SESSION['register'] = array(
105 112
 			'timenow' => time(),
106 113
 			'limit' => 10, // minimum number of seconds required on this page for registration
107 114
 		);
108
-	else
109
-		$_SESSION['register']['timenow'] = time();
115
+	} else {
116
+			$_SESSION['register']['timenow'] = time();
117
+	}
110 118
 
111 119
 	// If you have to agree to the agreement, it needs to be fetched from the file.
112 120
 	if ($context['require_agreement'])
113 121
 	{
114 122
 		// Have we got a localized one?
115
-		if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt'))
116
-			$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']);
117
-		elseif (file_exists($boarddir . '/agreement.txt'))
118
-			$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement');
119
-		else
120
-			$context['agreement'] = '';
123
+		if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt')) {
124
+					$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']);
125
+		} elseif (file_exists($boarddir . '/agreement.txt')) {
126
+					$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement');
127
+		} else {
128
+					$context['agreement'] = '';
129
+		}
121 130
 
122 131
 		// Nothing to show, lets disable registration and inform the admin of this error
123 132
 		if (empty($context['agreement']))
@@ -133,8 +142,9 @@  discard block
 block discarded – undo
133 142
 		$selectedLanguage = empty($_SESSION['language']) ? $language : $_SESSION['language'];
134 143
 
135 144
 		// Do we have any languages?
136
-		if (empty($context['languages']))
137
-			getLanguages();
145
+		if (empty($context['languages'])) {
146
+					getLanguages();
147
+		}
138 148
 
139 149
 		// Try to find our selected language.
140 150
 		foreach ($context['languages'] as $key => $lang)
@@ -142,8 +152,9 @@  discard block
 block discarded – undo
142 152
 			$context['languages'][$key]['name'] = strtr($lang['name'], array('-utf8' => ''));
143 153
 
144 154
 			// Found it!
145
-			if ($selectedLanguage == $lang['filename'])
146
-				$context['languages'][$key]['selected'] = true;
155
+			if ($selectedLanguage == $lang['filename']) {
156
+							$context['languages'][$key]['selected'] = true;
157
+			}
147 158
 		}
148 159
 	}
149 160
 
@@ -170,16 +181,19 @@  discard block
 block discarded – undo
170 181
 		if (in_array('website', $reg_fields))
171 182
 		{
172 183
 			unset($reg_fields['website']);
173
-			if (isset($_POST['website_title']))
174
-				$cur_profile['website_title'] = $smcFunc['htmlspecialchars']($_POST['website_title']);
175
-			if (isset($_POST['website_url']))
176
-				$cur_profile['website_url'] = $smcFunc['htmlspecialchars']($_POST['website_url']);
184
+			if (isset($_POST['website_title'])) {
185
+							$cur_profile['website_title'] = $smcFunc['htmlspecialchars']($_POST['website_title']);
186
+			}
187
+			if (isset($_POST['website_url'])) {
188
+							$cur_profile['website_url'] = $smcFunc['htmlspecialchars']($_POST['website_url']);
189
+			}
177 190
 		}
178 191
 
179 192
 		// We might have had some submissions on this front - go check.
180
-		foreach ($reg_fields as $field)
181
-			if (isset($_POST[$field]))
193
+		foreach ($reg_fields as $field) {
194
+					if (isset($_POST[$field]))
182 195
 				$cur_profile[$field] = $smcFunc['htmlspecialchars']($_POST[$field]);
196
+		}
183 197
 
184 198
 		// Load all the fields in question.
185 199
 		setupProfileContext($reg_fields);
@@ -196,8 +210,9 @@  discard block
 block discarded – undo
196 210
 		$context['visual_verification_id'] = $verificationOptions['id'];
197 211
 	}
198 212
 	// Otherwise we have nothing to show.
199
-	else
200
-		$context['visual_verification'] = false;
213
+	else {
214
+			$context['visual_verification'] = false;
215
+	}
201 216
 
202 217
 
203 218
 	$context += array(
@@ -208,8 +223,9 @@  discard block
 block discarded – undo
208 223
 
209 224
 	// Were there any errors?
210 225
 	$context['registration_errors'] = array();
211
-	if (!empty($reg_errors))
212
-		$context['registration_errors'] = $reg_errors;
226
+	if (!empty($reg_errors)) {
227
+			$context['registration_errors'] = $reg_errors;
228
+	}
213 229
 
214 230
 	createToken('register');
215 231
 }
@@ -226,27 +242,32 @@  discard block
 block discarded – undo
226 242
 	validateToken('register');
227 243
 
228 244
 	// Check to ensure we're forcing SSL for authentication
229
-	if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
230
-		fatal_lang_error('register_ssl_required');
245
+	if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
246
+			fatal_lang_error('register_ssl_required');
247
+	}
231 248
 
232 249
 	// Start collecting together any errors.
233 250
 	$reg_errors = array();
234 251
 
235 252
 	// You can't register if it's disabled.
236
-	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
237
-		fatal_lang_error('registration_disabled', false);
253
+	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3) {
254
+			fatal_lang_error('registration_disabled', false);
255
+	}
238 256
 
239 257
 	// Well, if you don't agree, you can't register.
240
-	if (!empty($modSettings['requireAgreement']) && empty($_SESSION['registration_agreed']))
241
-		redirectexit();
258
+	if (!empty($modSettings['requireAgreement']) && empty($_SESSION['registration_agreed'])) {
259
+			redirectexit();
260
+	}
242 261
 
243 262
 	// Make sure they came from *somewhere*, have a session.
244
-	if (!isset($_SESSION['old_url']))
245
-		redirectexit('action=signup');
263
+	if (!isset($_SESSION['old_url'])) {
264
+			redirectexit('action=signup');
265
+	}
246 266
 
247 267
 	// If we don't require an agreement, we need a extra check for coppa.
248
-	if (empty($modSettings['requireAgreement']) && !empty($modSettings['coppaAge']))
249
-		$_SESSION['skip_coppa'] = !empty($_POST['accept_agreement']);
268
+	if (empty($modSettings['requireAgreement']) && !empty($modSettings['coppaAge'])) {
269
+			$_SESSION['skip_coppa'] = !empty($_POST['accept_agreement']);
270
+	}
250 271
 	// Are they under age, and under age users are banned?
251 272
 	if (!empty($modSettings['coppaAge']) && empty($modSettings['coppaType']) && empty($_SESSION['skip_coppa']))
252 273
 	{
@@ -255,8 +276,9 @@  discard block
 block discarded – undo
255 276
 	}
256 277
 
257 278
 	// Check the time gate for miscreants. First make sure they came from somewhere that actually set it up.
258
-	if (empty($_SESSION['register']['timenow']) || empty($_SESSION['register']['limit']))
259
-		redirectexit('action=signup');
279
+	if (empty($_SESSION['register']['timenow']) || empty($_SESSION['register']['limit'])) {
280
+			redirectexit('action=signup');
281
+	}
260 282
 	// Failing that, check the time on it.
261 283
 	if (time() - $_SESSION['register']['timenow'] < $_SESSION['register']['limit'])
262 284
 	{
@@ -276,8 +298,9 @@  discard block
 block discarded – undo
276 298
 		if (is_array($context['visual_verification']))
277 299
 		{
278 300
 			loadLanguage('Errors');
279
-			foreach ($context['visual_verification'] as $error)
280
-				$reg_errors[] = $txt['error_' . $error];
301
+			foreach ($context['visual_verification'] as $error) {
302
+							$reg_errors[] = $txt['error_' . $error];
303
+			}
281 304
 		}
282 305
 	}
283 306
 
@@ -286,14 +309,16 @@  discard block
 block discarded – undo
286 309
 		if (!is_array($_POST[$key]))
287 310
 		{
288 311
 			// For UTF-8, replace any kind of space with a normal space, and remove any kind of control character (incl. "\n" and "\r"), then trim.
289
-			if ($context['utf8'])
290
-				$_POST[$key] = $smcFunc['htmltrim'](preg_replace(array('~\p{Z}+~u', '~\p{C}+~u'), array(' ', ''), $_POST[$key]));
312
+			if ($context['utf8']) {
313
+							$_POST[$key] = $smcFunc['htmltrim'](preg_replace(array('~\p{Z}+~u', '~\p{C}+~u'), array(' ', ''), $_POST[$key]));
314
+			}
291 315
 			// Otherwise, just remove "\n" and "\r", then trim.
292
-			else
293
-				$_POST[$key] = $smcFunc['htmltrim'](str_replace(array("\n", "\r"), '', $_POST[$key]));
316
+			else {
317
+							$_POST[$key] = $smcFunc['htmltrim'](str_replace(array("\n", "\r"), '', $_POST[$key]));
318
+			}
319
+		} else {
320
+					$_POST[$key] = htmltrim__recursive($_POST[$key]);
294 321
 		}
295
-		else
296
-			$_POST[$key] = htmltrim__recursive($_POST[$key]);
297 322
 	}
298 323
 
299 324
 	// Collect all extra registration fields someone might have filled in.
@@ -328,13 +353,15 @@  discard block
 block discarded – undo
328 353
 			$possible_strings = array_merge(array('website_url', 'website_title'), $possible_strings);
329 354
 
330 355
 			// Make sure their website URL is squeaky clean
331
-			if (isset($_POST['website_url']))
332
-				$_POST['website_url'] = (string) validate_iri(sanitize_iri($_POST['website_url']));
356
+			if (isset($_POST['website_url'])) {
357
+							$_POST['website_url'] = (string) validate_iri(sanitize_iri($_POST['website_url']));
358
+			}
333 359
 		}
334 360
 	}
335 361
 
336
-	if (isset($_POST['secret_answer']) && $_POST['secret_answer'] != '')
337
-		$_POST['secret_answer'] = md5($_POST['secret_answer']);
362
+	if (isset($_POST['secret_answer']) && $_POST['secret_answer'] != '') {
363
+			$_POST['secret_answer'] = md5($_POST['secret_answer']);
364
+	}
338 365
 
339 366
 	// Needed for isReservedName() and registerMember().
340 367
 	require_once($sourcedir . '/Subs-Members.php');
@@ -343,8 +370,9 @@  discard block
 block discarded – undo
343 370
 	if (isset($_POST['real_name']))
344 371
 	{
345 372
 		// Are you already allowed to edit the displayed name?
346
-		if (allowedTo('profile_displayed_name') || allowedTo('moderate_forum'))
347
-			$canEditDisplayName = true;
373
+		if (allowedTo('profile_displayed_name') || allowedTo('moderate_forum')) {
374
+					$canEditDisplayName = true;
375
+		}
348 376
 
349 377
 		// If you are a guest, will you be allowed to once you register?
350 378
 		else
@@ -363,32 +391,37 @@  discard block
 block discarded – undo
363 391
 		}
364 392
 
365 393
 		// Only set it if you can and if we are sure it is good
366
-		if ($canEditDisplayName && $smcFunc['htmltrim']($_POST['real_name']) != '' && !isReservedName($_POST['real_name']) && $smcFunc['strlen']($_POST['real_name']) < 60)
367
-				$possible_strings[] = 'real_name';
394
+		if ($canEditDisplayName && $smcFunc['htmltrim']($_POST['real_name']) != '' && !isReservedName($_POST['real_name']) && $smcFunc['strlen']($_POST['real_name']) < 60) {
395
+						$possible_strings[] = 'real_name';
396
+		}
368 397
 	}
369 398
 
370 399
 	// Handle a string as a birthdate...
371
-	if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
372
-		$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
400
+	if (isset($_POST['birthdate']) && $_POST['birthdate'] != '') {
401
+			$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
402
+	}
373 403
 	// Or birthdate parts...
374
-	elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']))
375
-		$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
404
+	elseif (!empty($_POST['bday1']) && !empty($_POST['bday2'])) {
405
+			$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
406
+	}
376 407
 
377 408
 	// Validate the passed language file.
378 409
 	if (isset($_POST['lngfile']) && !empty($modSettings['userLanguage']))
379 410
 	{
380 411
 		// Do we have any languages?
381
-		if (empty($context['languages']))
382
-			getLanguages();
412
+		if (empty($context['languages'])) {
413
+					getLanguages();
414
+		}
383 415
 
384 416
 		// Did we find it?
385
-		if (isset($context['languages'][$_POST['lngfile']]))
386
-			$_SESSION['language'] = $_POST['lngfile'];
387
-		else
417
+		if (isset($context['languages'][$_POST['lngfile']])) {
418
+					$_SESSION['language'] = $_POST['lngfile'];
419
+		} else {
420
+					unset($_POST['lngfile']);
421
+		}
422
+	} else {
388 423
 			unset($_POST['lngfile']);
389 424
 	}
390
-	else
391
-		unset($_POST['lngfile']);
392 425
 
393 426
 	// Set the options needed for registration.
394 427
 	$regOptions = array(
@@ -408,22 +441,27 @@  discard block
 block discarded – undo
408 441
 	);
409 442
 
410 443
 	// Include the additional options that might have been filled in.
411
-	foreach ($possible_strings as $var)
412
-		if (isset($_POST[$var]))
444
+	foreach ($possible_strings as $var) {
445
+			if (isset($_POST[$var]))
413 446
 			$regOptions['extra_register_vars'][$var] = $smcFunc['htmlspecialchars']($_POST[$var], ENT_QUOTES);
414
-	foreach ($possible_ints as $var)
415
-		if (isset($_POST[$var]))
447
+	}
448
+	foreach ($possible_ints as $var) {
449
+			if (isset($_POST[$var]))
416 450
 			$regOptions['extra_register_vars'][$var] = (int) $_POST[$var];
417
-	foreach ($possible_floats as $var)
418
-		if (isset($_POST[$var]))
451
+	}
452
+	foreach ($possible_floats as $var) {
453
+			if (isset($_POST[$var]))
419 454
 			$regOptions['extra_register_vars'][$var] = (float) $_POST[$var];
420
-	foreach ($possible_bools as $var)
421
-		if (isset($_POST[$var]))
455
+	}
456
+	foreach ($possible_bools as $var) {
457
+			if (isset($_POST[$var]))
422 458
 			$regOptions['extra_register_vars'][$var] = empty($_POST[$var]) ? 0 : 1;
459
+	}
423 460
 
424 461
 	// Registration options are always default options...
425
-	if (isset($_POST['default_options']))
426
-		$_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options'];
462
+	if (isset($_POST['default_options'])) {
463
+			$_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options'];
464
+	}
427 465
 	$regOptions['theme_vars'] = isset($_POST['options']) && is_array($_POST['options']) ? $_POST['options'] : array();
428 466
 
429 467
 	// Make sure they are clean, dammit!
@@ -443,12 +481,14 @@  discard block
 block discarded – undo
443 481
 	while ($row = $smcFunc['db_fetch_assoc']($request))
444 482
 	{
445 483
 		// Don't allow overriding of the theme variables.
446
-		if (isset($regOptions['theme_vars'][$row['col_name']]))
447
-			unset($regOptions['theme_vars'][$row['col_name']]);
484
+		if (isset($regOptions['theme_vars'][$row['col_name']])) {
485
+					unset($regOptions['theme_vars'][$row['col_name']]);
486
+		}
448 487
 
449 488
 		// Not actually showing it then?
450
-		if (!$row['show_reg'])
451
-			continue;
489
+		if (!$row['show_reg']) {
490
+					continue;
491
+		}
452 492
 
453 493
 		// Prepare the value!
454 494
 		$value = isset($_POST['customfield'][$row['col_name']]) ? trim($_POST['customfield'][$row['col_name']]) : '';
@@ -457,24 +497,27 @@  discard block
 block discarded – undo
457 497
 		if (!in_array($row['field_type'], array('check', 'select', 'radio')))
458 498
 		{
459 499
 			// Is it too long?
460
-			if ($row['field_length'] && $row['field_length'] < $smcFunc['strlen']($value))
461
-				$custom_field_errors[] = array('custom_field_too_long', array($row['field_name'], $row['field_length']));
500
+			if ($row['field_length'] && $row['field_length'] < $smcFunc['strlen']($value)) {
501
+							$custom_field_errors[] = array('custom_field_too_long', array($row['field_name'], $row['field_length']));
502
+			}
462 503
 
463 504
 			// Any masks to apply?
464 505
 			if ($row['field_type'] == 'text' && !empty($row['mask']) && $row['mask'] != 'none')
465 506
 			{
466
-				if ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255))
467
-					$custom_field_errors[] = array('custom_field_invalid_email', array($row['field_name']));
468
-				elseif ($row['mask'] == 'number' && preg_match('~[^\d]~', $value))
469
-					$custom_field_errors[] = array('custom_field_not_number', array($row['field_name']));
470
-				elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0)
471
-					$custom_field_errors[] = array('custom_field_inproper_format', array($row['field_name']));
507
+				if ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) {
508
+									$custom_field_errors[] = array('custom_field_invalid_email', array($row['field_name']));
509
+				} elseif ($row['mask'] == 'number' && preg_match('~[^\d]~', $value)) {
510
+									$custom_field_errors[] = array('custom_field_not_number', array($row['field_name']));
511
+				} elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) {
512
+									$custom_field_errors[] = array('custom_field_inproper_format', array($row['field_name']));
513
+				}
472 514
 			}
473 515
 		}
474 516
 
475 517
 		// Is this required but not there?
476
-		if (trim($value) == '' && $row['show_reg'] > 1)
477
-			$custom_field_errors[] = array('custom_field_empty', array($row['field_name']));
518
+		if (trim($value) == '' && $row['show_reg'] > 1) {
519
+					$custom_field_errors[] = array('custom_field_empty', array($row['field_name']));
520
+		}
478 521
 	}
479 522
 	$smcFunc['db_free_result']($request);
480 523
 
@@ -482,8 +525,9 @@  discard block
 block discarded – undo
482 525
 	if (!empty($custom_field_errors))
483 526
 	{
484 527
 		loadLanguage('Errors');
485
-		foreach ($custom_field_errors as $error)
486
-			$reg_errors[] = vsprintf($txt['error_' . $error[0]], $error[1]);
528
+		foreach ($custom_field_errors as $error) {
529
+					$reg_errors[] = vsprintf($txt['error_' . $error[0]], $error[1]);
530
+		}
487 531
 	}
488 532
 
489 533
 	// Lets check for other errors before trying to register the member.
@@ -528,8 +572,9 @@  discard block
 block discarded – undo
528 572
 	}
529 573
 
530 574
 	// If COPPA has been selected then things get complicated, setup the template.
531
-	if (!empty($modSettings['coppaAge']) && empty($_SESSION['skip_coppa']))
532
-		redirectexit('action=coppa;member=' . $memberID);
575
+	if (!empty($modSettings['coppaAge']) && empty($_SESSION['skip_coppa'])) {
576
+			redirectexit('action=coppa;member=' . $memberID);
577
+	}
533 578
 	// Basic template variable setup.
534 579
 	elseif (!empty($modSettings['registration_method']))
535 580
 	{
@@ -541,8 +586,7 @@  discard block
 block discarded – undo
541 586
 			'sub_template' => 'after',
542 587
 			'description' => $modSettings['registration_method'] == 2 ? $txt['approval_after_registration'] : $txt['activate_after_registration']
543 588
 		);
544
-	}
545
-	else
589
+	} else
546 590
 	{
547 591
 		call_integration_hook('integrate_activate', array($regOptions['username']));
548 592
 
@@ -562,16 +606,18 @@  discard block
 block discarded – undo
562 606
 	global $context, $txt, $modSettings, $scripturl, $sourcedir, $smcFunc, $language, $user_info;
563 607
 
564 608
 	// Logged in users should not bother to activate their accounts
565
-	if (!empty($user_info['id']))
566
-		redirectexit();
609
+	if (!empty($user_info['id'])) {
610
+			redirectexit();
611
+	}
567 612
 
568 613
 	loadLanguage('Login');
569 614
 	loadTemplate('Login');
570 615
 
571 616
 	if (empty($_REQUEST['u']) && empty($_POST['user']))
572 617
 	{
573
-		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == '3')
574
-			fatal_lang_error('no_access', false);
618
+		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == '3') {
619
+					fatal_lang_error('no_access', false);
620
+		}
575 621
 
576 622
 		$context['member_id'] = 0;
577 623
 		$context['sub_template'] = 'resend';
@@ -611,11 +657,13 @@  discard block
 block discarded – undo
611 657
 	// Change their email address? (they probably tried a fake one first :P.)
612 658
 	if (isset($_POST['new_email'], $_REQUEST['passwd']) && hash_password($row['member_name'], $_REQUEST['passwd']) == $row['passwd'] && ($row['is_activated'] == 0 || $row['is_activated'] == 2))
613 659
 	{
614
-		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == 3)
615
-			fatal_lang_error('no_access', false);
660
+		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == 3) {
661
+					fatal_lang_error('no_access', false);
662
+		}
616 663
 
617
-		if (!filter_var($_POST['new_email'], FILTER_VALIDATE_EMAIL))
618
-			fatal_error(sprintf($txt['valid_email_needed'], $smcFunc['htmlspecialchars']($_POST['new_email'])), false);
664
+		if (!filter_var($_POST['new_email'], FILTER_VALIDATE_EMAIL)) {
665
+					fatal_error(sprintf($txt['valid_email_needed'], $smcFunc['htmlspecialchars']($_POST['new_email'])), false);
666
+		}
619 667
 
620 668
 		// Make sure their email isn't banned.
621 669
 		isBannedEmail($_POST['new_email'], 'cannot_register', $txt['ban_register_prohibited']);
@@ -631,8 +679,9 @@  discard block
 block discarded – undo
631 679
 			)
632 680
 		);
633 681
 
634
-		if ($smcFunc['db_num_rows']($request) != 0)
635
-			fatal_lang_error('email_in_use', false, array($smcFunc['htmlspecialchars']($_POST['new_email'])));
682
+		if ($smcFunc['db_num_rows']($request) != 0) {
683
+					fatal_lang_error('email_in_use', false, array($smcFunc['htmlspecialchars']($_POST['new_email'])));
684
+		}
636 685
 		$smcFunc['db_free_result']($request);
637 686
 
638 687
 		updateMemberData($row['id_member'], array('email_address' => $_POST['new_email']));
@@ -670,9 +719,9 @@  discard block
 block discarded – undo
670 719
 	// Quit if this code is not right.
671 720
 	if (empty($_REQUEST['code']) || $row['validation_code'] != $_REQUEST['code'])
672 721
 	{
673
-		if (!empty($row['is_activated']))
674
-			fatal_lang_error('already_activated', false);
675
-		elseif ($row['validation_code'] == '')
722
+		if (!empty($row['is_activated'])) {
723
+					fatal_lang_error('already_activated', false);
724
+		} elseif ($row['validation_code'] == '')
676 725
 		{
677 726
 			loadLanguage('Profile');
678 727
 			fatal_error(sprintf($txt['registration_not_approved'], $scripturl . '?action=activate;user=' . $row['member_name']), false);
@@ -722,8 +771,9 @@  discard block
 block discarded – undo
722 771
 	loadTemplate('Register');
723 772
 
724 773
 	// No User ID??
725
-	if (!isset($_GET['member']))
726
-		fatal_lang_error('no_access', false);
774
+	if (!isset($_GET['member'])) {
775
+			fatal_lang_error('no_access', false);
776
+	}
727 777
 
728 778
 	// Get the user details...
729 779
 	$request = $smcFunc['db_query']('', '
@@ -736,8 +786,9 @@  discard block
 block discarded – undo
736 786
 			'is_coppa' => 5,
737 787
 		)
738 788
 	);
739
-	if ($smcFunc['db_num_rows']($request) == 0)
740
-		fatal_lang_error('no_access', false);
789
+	if ($smcFunc['db_num_rows']($request) == 0) {
790
+			fatal_lang_error('no_access', false);
791
+	}
741 792
 	list ($username) = $smcFunc['db_fetch_row']($request);
742 793
 	$smcFunc['db_free_result']($request);
743 794
 
@@ -775,8 +826,7 @@  discard block
 block discarded – undo
775 826
 			echo $data;
776 827
 			obExit(false);
777 828
 		}
778
-	}
779
-	else
829
+	} else
780 830
 	{
781 831
 		$context += array(
782 832
 			'page_title' => $txt['coppa_title'],
@@ -829,8 +879,9 @@  discard block
 block discarded – undo
829 879
 	{
830 880
 		require_once($sourcedir . '/Subs-Graphics.php');
831 881
 
832
-		if (in_array('gd', get_loaded_extensions()) && !showCodeImage($code))
833
-			send_http_status(400);
882
+		if (in_array('gd', get_loaded_extensions()) && !showCodeImage($code)) {
883
+					send_http_status(400);
884
+		}
834 885
 
835 886
 		// Otherwise just show a pre-defined letter.
836 887
 		elseif (isset($_REQUEST['letter']))
@@ -848,14 +899,13 @@  discard block
 block discarded – undo
848 899
 			header('content-type: image/gif');
849 900
 			die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
850 901
 		}
851
-	}
852
-
853
-	elseif ($_REQUEST['format'] === '.wav')
902
+	} elseif ($_REQUEST['format'] === '.wav')
854 903
 	{
855 904
 		require_once($sourcedir . '/Subs-Sound.php');
856 905
 
857
-		if (!createWaveFile($code))
858
-			send_http_status(400);
906
+		if (!createWaveFile($code)) {
907
+					send_http_status(400);
908
+		}
859 909
 	}
860 910
 
861 911
 	// We all die one day...
Please login to merge, or discard this patch.
Sources/ShowAttachments.php 1 patch
Braces   +59 added lines, -52 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Downloads an avatar or attachment based on $_GET['attach'], and increments the download count.
@@ -40,11 +41,11 @@  discard block
 block discarded – undo
40 41
 
41 42
 	if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0)
42 43
 	{
43
-		if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler')
44
-			$modSettings['enableCompressedOutput'] = 0;
45
-
46
-		else
47
-			ob_start('ob_gzhandler');
44
+		if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') {
45
+					$modSettings['enableCompressedOutput'] = 0;
46
+		} else {
47
+					ob_start('ob_gzhandler');
48
+		}
48 49
 	}
49 50
 
50 51
 	if (empty($modSettings['enableCompressedOutput']))
@@ -76,8 +77,9 @@  discard block
 block discarded – undo
76 77
 	}
77 78
 
78 79
 	// Use cache when possible.
79
-	if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null)
80
-		list($file, $thumbFile) = $cache;
80
+	if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) {
81
+			list($file, $thumbFile) = $cache;
82
+	}
81 83
 
82 84
 	// Get the info from the DB.
83 85
 	if (empty($file) || empty($thumbFile) && !empty($file['id_thumb']))
@@ -85,10 +87,9 @@  discard block
 block discarded – undo
85 87
 		// Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request.
86 88
 		$attachRequest = null;
87 89
 		call_integration_hook('integrate_download_request', array(&$attachRequest));
88
-		if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest))
89
-			$request = $attachRequest;
90
-
91
-		else
90
+		if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) {
91
+					$request = $attachRequest;
92
+		} else
92 93
 		{
93 94
 			// Make sure this attachment is on this board and load its info while we are at it.
94 95
 			$request = $smcFunc['db_query']('', '
@@ -181,13 +182,15 @@  discard block
 block discarded – undo
181 182
 		}
182 183
 
183 184
 		// Cache it.
184
-		if (!empty($file) || !empty($thumbFile))
185
-			cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900));
185
+		if (!empty($file) || !empty($thumbFile)) {
186
+					cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900));
187
+		}
186 188
 	}
187 189
 
188 190
 	// Replace the normal file with its thumbnail if it has one!
189
-	if (!empty($showThumb) && !empty($thumbFile))
190
-		$file = $thumbFile;
191
+	if (!empty($showThumb) && !empty($thumbFile)) {
192
+			$file = $thumbFile;
193
+	}
191 194
 
192 195
 	// No point in a nicer message, because this is supposed to be an attachment anyway...
193 196
 	if (!file_exists($file['filePath']))
@@ -237,8 +240,8 @@  discard block
 block discarded – undo
237 240
 	}
238 241
 
239 242
 	// Update the download counter (unless it's a thumbnail or resuming an incomplete download).
240
-	if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0)
241
-		$smcFunc['db_query']('', '
243
+	if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) {
244
+			$smcFunc['db_query']('', '
242 245
 			UPDATE {db_prefix}attachments
243 246
 			SET downloads = downloads + 1
244 247
 			WHERE id_attach = {int:id_attach}',
@@ -246,12 +249,14 @@  discard block
 block discarded – undo
246 249
 				'id_attach' => $attachId,
247 250
 			)
248 251
 		);
252
+	}
249 253
 
250 254
 	// Send the attachment headers.
251 255
 	header('pragma: ');
252 256
 
253
-	if (!isBrowser('gecko'))
254
-		header('content-transfer-encoding: binary');
257
+	if (!isBrowser('gecko')) {
258
+			header('content-transfer-encoding: binary');
259
+	}
255 260
 
256 261
 	header('expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
257 262
 	header('last-modified: ' . gmdate('D, d M Y H:i:s', filemtime($file['filePath'])) . ' GMT');
@@ -260,18 +265,19 @@  discard block
 block discarded – undo
260 265
 	header('etag: ' . $eTag);
261 266
 
262 267
 	// Make sure the mime type warrants an inline display.
263
-	if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0)
264
-		unset($_REQUEST['image']);
268
+	if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) {
269
+			unset($_REQUEST['image']);
270
+	}
265 271
 
266 272
 	// Does this have a mime type?
267
-	elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff'))))
268
-		header('content-type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp')));
269
-
270
-	else
273
+	elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) {
274
+			header('content-type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp')));
275
+	} else
271 276
 	{
272 277
 		header('content-type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream'));
273
-		if (isset($_REQUEST['image']))
274
-			unset($_REQUEST['image']);
278
+		if (isset($_REQUEST['image'])) {
279
+					unset($_REQUEST['image']);
280
+		}
275 281
 	}
276 282
 
277 283
 	// Convert the file to UTF-8, cuz most browsers dig that.
@@ -279,24 +285,22 @@  discard block
 block discarded – undo
279 285
 	$disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline';
280 286
 
281 287
 	// Different browsers like different standards...
282
-	if (isBrowser('firefox'))
283
-		header('content-disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));
284
-
285
-	elseif (isBrowser('opera'))
286
-		header('content-disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');
287
-
288
-	elseif (isBrowser('ie'))
289
-		header('content-disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');
290
-
291
-	else
292
-		header('content-disposition: ' . $disposition . '; filename="' . $utf8name . '"');
288
+	if (isBrowser('firefox')) {
289
+			header('content-disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));
290
+	} elseif (isBrowser('opera')) {
291
+			header('content-disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');
292
+	} elseif (isBrowser('ie')) {
293
+			header('content-disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');
294
+	} else {
295
+			header('content-disposition: ' . $disposition . '; filename="' . $utf8name . '"');
296
+	}
293 297
 
294 298
 	// If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE.
295
-	if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff')))
296
-		header('cache-control: no-cache');
297
-
298
-	else
299
-		header('cache-control: max-age=' . (525600 * 60) . ', private');
299
+	if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) {
300
+			header('cache-control: no-cache');
301
+	} else {
302
+			header('cache-control: max-age=' . (525600 * 60) . ', private');
303
+	}
300 304
 
301 305
 	// Multipart and resuming support
302 306
 	if (isset($_SERVER['HTTP_RANGE']))
@@ -304,9 +308,9 @@  discard block
 block discarded – undo
304 308
 		send_http_status(206);
305 309
 		header("content-length: $new_length");
306 310
 		header("content-range: bytes $range-$range_end/$size");
311
+	} else {
312
+			header("content-length: " . $size);
307 313
 	}
308
-	else
309
-		header("content-length: " . $size);
310 314
 
311 315
 
312 316
 	// Try to buy some time...
@@ -315,8 +319,9 @@  discard block
 block discarded – undo
315 319
 	// For multipart/resumable downloads, send the requested chunk(s) of the file
316 320
 	if (isset($_SERVER['HTTP_RANGE']))
317 321
 	{
318
-		while (@ob_get_level() > 0)
319
-			@ob_end_clean();
322
+		while (@ob_get_level() > 0) {
323
+					@ob_end_clean();
324
+		}
320 325
 
321 326
 		// 40 kilobytes is a good-ish amount
322 327
 		$chunksize = 40 * 1024;
@@ -340,8 +345,9 @@  discard block
 block discarded – undo
340 345
 	elseif ($size > 4194304)
341 346
 	{
342 347
 		// Forcibly end any output buffering going on.
343
-		while (@ob_get_level() > 0)
344
-			@ob_end_clean();
348
+		while (@ob_get_level() > 0) {
349
+					@ob_end_clean();
350
+		}
345 351
 
346 352
 		$fp = fopen($file['filePath'], 'rb');
347 353
 		while (!feof($fp))
@@ -353,8 +359,9 @@  discard block
 block discarded – undo
353 359
 	}
354 360
 
355 361
 	// On some of the less-bright hosts, readfile() is disabled.  It's just a faster, more byte safe, version of what's in the if.
356
-	elseif (@readfile($file['filePath']) === null)
357
-		echo file_get_contents($file['filePath']);
362
+	elseif (@readfile($file['filePath']) === null) {
363
+			echo file_get_contents($file['filePath']);
364
+	}
358 365
 
359 366
 	die();
360 367
 }
Please login to merge, or discard this patch.
Themes/default/ManageMaintenance.template.php 1 patch
Braces   +42 added lines, -29 removed lines patch added patch discarded remove patch
@@ -18,11 +18,12 @@  discard block
 block discarded – undo
18 18
 	global $context, $txt, $scripturl, $modSettings;
19 19
 
20 20
 	// If maintenance has finished tell the user.
21
-	if (!empty($context['maintenance_finished']))
22
-		echo '
21
+	if (!empty($context['maintenance_finished'])) {
22
+			echo '
23 23
 	<div class="infobox">
24 24
 		', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
25 25
 	</div>';
26
+	}
26 27
 
27 28
 	echo '
28 29
 	<div id="manage_maintenance">
@@ -39,8 +40,8 @@  discard block
 block discarded – undo
39 40
 		</div>';
40 41
 
41 42
 	// Show an option to convert the body column of the post table to MEDIUMTEXT or TEXT
42
-	if (isset($context['convert_to']))
43
-		echo '
43
+	if (isset($context['convert_to'])) {
44
+			echo '
44 45
 		<div class="cat_bar">
45 46
 			<h3 class="catbg">', $txt[$context['convert_to'] . '_title'], '</h3>
46 47
 		</div>
@@ -53,10 +54,11 @@  discard block
 block discarded – undo
53 54
 				<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
54 55
 			</form>
55 56
 		</div>';
57
+	}
56 58
 
57 59
 	// We might want to convert entities if we're on UTF-8.
58
-	if ($context['convert_entities'])
59
-		echo '
60
+	if ($context['convert_entities']) {
61
+			echo '
60 62
 		<div class="cat_bar">
61 63
 			<h3 class="catbg">', $txt['entity_convert_title'], '</h3>
62 64
 		</div>
@@ -68,6 +70,7 @@  discard block
 block discarded – undo
68 70
 				<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
69 71
 			</form>
70 72
 		</div>';
73
+	}
71 74
 
72 75
 	echo '
73 76
 	</div><!-- #manage_maintenance -->';
@@ -85,11 +88,12 @@  discard block
 block discarded – undo
85 88
 	<div id="manage_maintenance">';
86 89
 
87 90
 	// If maintenance has finished tell the user.
88
-	if (!empty($context['maintenance_finished']))
89
-		echo '
91
+	if (!empty($context['maintenance_finished'])) {
92
+			echo '
90 93
 		<div class="infobox">
91 94
 			', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
92 95
 		</div>';
96
+	}
93 97
 
94 98
 	echo '
95 99
 		<div class="cat_bar">
@@ -221,11 +225,12 @@  discard block
 block discarded – undo
221 225
 	<div id="manage_maintenance">';
222 226
 
223 227
 	// If maintenance has finished, tell the user.
224
-	if (!empty($context['maintenance_finished']))
225
-		echo '
228
+	if (!empty($context['maintenance_finished'])) {
229
+			echo '
226 230
 		<div class="infobox">
227 231
 			', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
228 232
 		</div>';
233
+	}
229 234
 
230 235
 	echo '
231 236
 		<div class="cat_bar">
@@ -287,9 +292,10 @@  discard block
 block discarded – undo
287 292
 				</p>
288 293
 				<div style="display: none;" id="membersPanel">';
289 294
 
290
-	foreach ($context['membergroups'] as $group)
291
-		echo '
295
+	foreach ($context['membergroups'] as $group) {
296
+			echo '
292 297
 					<label for="groups', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups', $group['id'], '" checked> ', $group['name'], '</label><br>';
298
+	}
293 299
 
294 300
 	echo '
295 301
 				</div>
@@ -333,11 +339,12 @@  discard block
 block discarded – undo
333 339
 	global $scripturl, $txt, $context, $settings, $modSettings;
334 340
 
335 341
 	// If maintenance has finished tell the user.
336
-	if (!empty($context['maintenance_finished']))
337
-		echo '
342
+	if (!empty($context['maintenance_finished'])) {
343
+			echo '
338 344
 	<div class="infobox">
339 345
 		', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
340 346
 	</div>';
347
+	}
341 348
 
342 349
 	// Bit of javascript for showing which boards to prune in an otherwise hidden list.
343 350
 	echo '
@@ -405,21 +412,23 @@  discard block
 block discarded – undo
405 412
 								<ul>';
406 413
 
407 414
 		// Display a checkbox with every board.
408
-		foreach ($category['boards'] as $board)
409
-			echo '
415
+		foreach ($category['boards'] as $board) {
416
+					echo '
410 417
 									<li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;">
411 418
 										<label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked>', $board['name'], '</label>
412 419
 									</li>';
420
+		}
413 421
 
414 422
 		echo '
415 423
 								</ul>
416 424
 							</fieldset>';
417 425
 
418 426
 		// Increase $i, and check if we're at the middle yet.
419
-		if (++$i == $middle)
420
-			echo '
427
+		if (++$i == $middle) {
428
+					echo '
421 429
 						</div><!-- .floatleft -->
422 430
 						<div class="floatright" style="width: 49%;">';
431
+		}
423 432
 	}
424 433
 
425 434
 	echo '
@@ -461,9 +470,10 @@  discard block
 block discarded – undo
461 470
 		echo '
462 471
 						<optgroup label="', $category['name'], '">';
463 472
 
464
-		foreach ($category['boards'] as $board)
465
-			echo '
473
+		foreach ($category['boards'] as $board) {
474
+					echo '
466 475
 							<option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
476
+		}
467 477
 
468 478
 		echo '
469 479
 						</optgroup>';
@@ -481,9 +491,10 @@  discard block
 block discarded – undo
481 491
 		echo '
482 492
 						<optgroup label="', $category['name'], '">';
483 493
 
484
-		foreach ($category['boards'] as $board)
485
-			echo '
494
+		foreach ($category['boards'] as $board) {
495
+					echo '
486 496
 							<option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
497
+		}
487 498
 
488 499
 		echo '
489 500
 						</optgroup>';
@@ -526,9 +537,10 @@  discard block
 block discarded – undo
526 537
 				', $txt['database_optimize_attempt'], '<br>';
527 538
 
528 539
 	// List each table being optimized...
529
-	foreach ($context['optimized_tables'] as $table)
530
-		echo '
540
+	foreach ($context['optimized_tables'] as $table) {
541
+			echo '
531 542
 				', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br>';
543
+	}
532 544
 
533 545
 	// How did we go?
534 546
 	echo '
@@ -588,13 +600,14 @@  discard block
 block discarded – undo
588 600
 				</li>
589 601
 			</ul>';
590 602
 
591
-		if (!empty($context['exceeding_messages_morethan']))
592
-			echo '
603
+		if (!empty($context['exceeding_messages_morethan'])) {
604
+					echo '
593 605
 			<p>', $context['exceeding_messages_morethan'], '</p>';
594
-	}
595
-	else
596
-		echo '
606
+		}
607
+	} else {
608
+			echo '
597 609
 			<p class="infobox">', $txt['convert_to_text'], '</p>';
610
+	}
598 611
 
599 612
 	echo '
600 613
 			<form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" 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">';
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/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">
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">
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">';
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,18 +604,19 @@  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
 	// Warning for if the file isn't writable.
594
-	if (!empty($context['warning']))
595
-		echo '
616
+	if (!empty($context['warning'])) {
617
+			echo '
596 618
 		<div class="errorbox">', $context['warning'], '</div>';
619
+	}
597 620
 
598 621
 	// Just a big box to edit the text file ;)
599 622
 	echo '
@@ -615,9 +638,10 @@  discard block
 block discarded – undo
615 638
 						<strong>', $txt['admin_agreement_select_language'], ':</strong>
616 639
 						<select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">';
617 640
 
618
-		foreach ($context['editable_agreements'] as $file => $name)
619
-			echo '
641
+		foreach ($context['editable_agreements'] as $file => $name) {
642
+					echo '
620 643
 							<option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>';
644
+		}
621 645
 
622 646
 		echo '
623 647
 						</select>
@@ -657,9 +681,10 @@  discard block
 block discarded – undo
657 681
 {
658 682
 	global $context, $scripturl, $txt;
659 683
 
660
-	if (!empty($context['saved_successful']))
661
-		echo '
684
+	if (!empty($context['saved_successful'])) {
685
+			echo '
662 686
 	<div class="infobox">', $txt['settings_saved'], '</div>';
687
+	}
663 688
 
664 689
 	echo '
665 690
 	<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/ManageBans.template.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,9 +29,10 @@  discard block
 block discarded – undo
29 29
 				<strong>', $txt['ban_errors_detected'], '</strong>
30 30
 				<ul>';
31 31
 
32
-		foreach ($context['error_messages'] as $error)
33
-			echo '
32
+		foreach ($context['error_messages'] as $error) {
33
+					echo '
34 34
 					<li class="error">', $error, '</li>';
35
+		}
35 36
 
36 37
 		echo '
37 38
 				</ul>
@@ -45,9 +46,10 @@  discard block
 block discarded – undo
45 46
 				</h3>
46 47
 			</div>';
47 48
 
48
-	if ($context['ban']['is_new'])
49
-		echo '
49
+	if ($context['ban']['is_new']) {
50
+			echo '
50 51
 			<div class="information noup">', $txt['ban_add_notes'], '</div>';
52
+	}
51 53
 
52 54
 	echo '
53 55
 			<div class="windowbg noup">
@@ -59,8 +61,8 @@  discard block
 block discarded – undo
59 61
 						<input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60">
60 62
 					</dd>';
61 63
 
62
-	if (isset($context['ban']['reason']))
63
-		echo '
64
+	if (isset($context['ban']['reason'])) {
65
+			echo '
64 66
 					<dt>
65 67
 						<strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br>
66 68
 						<span class="smalltext">', $txt['ban_reason_desc'], '</span>
@@ -68,9 +70,10 @@  discard block
 block discarded – undo
68 70
 					<dd>
69 71
 						<textarea name="reason" id="reason" cols="40" rows="3">', $context['ban']['reason'], '</textarea>
70 72
 					</dd>';
73
+	}
71 74
 
72
-	if (isset($context['ban']['notes']))
73
-		echo '
75
+	if (isset($context['ban']['notes'])) {
76
+			echo '
74 77
 					<dt>
75 78
 						<strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br>
76 79
 						<span class="smalltext">', $txt['ban_notes_desc'], '</span>
@@ -78,6 +81,7 @@  discard block
 block discarded – undo
78 81
 					<dd>
79 82
 						<textarea name="notes" id="ban_notes" cols="40" rows="3">', $context['ban']['notes'], '</textarea>
80 83
 					</dd>';
84
+	}
81 85
 
82 86
 	echo '
83 87
 				</dl>
@@ -117,8 +121,8 @@  discard block
 block discarded – undo
117 121
 							<input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
118 122
 						</dd>';
119 123
 
120
-		if (empty($modSettings['disableHostnameLookup']))
121
-			echo '
124
+		if (empty($modSettings['disableHostnameLookup'])) {
125
+					echo '
122 126
 						<dt>
123 127
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '>
124 128
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -126,6 +130,7 @@  discard block
 block discarded – undo
126 130
 						<dd>
127 131
 							<input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
128 132
 						</dd>';
133
+		}
129 134
 
130 135
 		echo '
131 136
 						<dt>
@@ -155,14 +160,15 @@  discard block
 block discarded – undo
155 160
 					<dl class="settings">';
156 161
 
157 162
 					$count = 0;
158
-					foreach ($ban_ips as $ip)
159
-						echo '
163
+					foreach ($ban_ips as $ip) {
164
+											echo '
160 165
 						<dt>
161 166
 							<input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '">
162 167
 						</dt>
163 168
 						<dd>
164 169
 							<label for="suggestions_', $key, '_', $count++, '">', $ip, '</label>
165 170
 						</dd>';
171
+					}
166 172
 
167 173
 					echo '
168 174
 					</dl>';
@@ -204,8 +210,8 @@  discard block
 block discarded – undo
204 210
 		addLoadEvent(fUpdateStatus);';
205 211
 
206 212
 	// Auto suggest only needed for adding new bans, not editing
207
-	if ($context['ban']['is_new'] && empty($_REQUEST['u']))
208
-		echo '
213
+	if ($context['ban']['is_new'] && empty($_REQUEST['u'])) {
214
+			echo '
209 215
 		var oAddMemberSuggest = new smc_AutoSuggest({
210 216
 			sSelf: \'oAddMemberSuggest\',
211 217
 			sSessionId: smf_session_id,
@@ -223,6 +229,7 @@  discard block
 block discarded – undo
223 229
 			return true;
224 230
 		}
225 231
 		oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');';
232
+	}
226 233
 
227 234
 	echo '
228 235
 		function confirmBan(aForm)
@@ -271,8 +278,8 @@  discard block
 block discarded – undo
271 278
 							<input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
272 279
 						</dd>';
273 280
 
274
-	if (empty($modSettings['disableHostnameLookup']))
275
-		echo '
281
+	if (empty($modSettings['disableHostnameLookup'])) {
282
+			echo '
276 283
 						<dt>
277 284
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '>
278 285
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -280,6 +287,7 @@  discard block
 block discarded – undo
280 287
 						<dd>
281 288
 							<input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
282 289
 						</dd>';
290
+	}
283 291
 
284 292
 	echo '
285 293
 						<dt>
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
@@ -116,9 +116,10 @@  discard block
 block discarded – undo
116 116
 		</div><!-- .windowbg -->
117 117
 	</div><!-- #manage_attachments -->';
118 118
 
119
-	if (!empty($context['results']))
120
-		echo '
119
+	if (!empty($context['results'])) {
120
+			echo '
121 121
 	<div class="noticebox">', $context['results'], '</div>';
122
+	}
122 123
 
123 124
 	echo '
124 125
 	<div id="transfer" class="cat_bar">
@@ -133,9 +134,10 @@  discard block
 block discarded – undo
133 134
 					<select name="from">
134 135
 						<option value="0">', $txt['attachment_transfer_select'], '</option>';
135 136
 
136
-	foreach ($context['attach_dirs'] as $id => $dir)
137
-		echo '
137
+	foreach ($context['attach_dirs'] as $id => $dir) {
138
+			echo '
138 139
 						<option value="', $id, '">', $dir, '</option>';
140
+	}
139 141
 
140 142
 	echo '
141 143
 					</select>
@@ -146,13 +148,14 @@  discard block
 block discarded – undo
146 148
 						<option value="0">', $txt['attachment_transfer_auto_select'], '</option>
147 149
 						<option value="-1">', $txt['attachment_transfer_forum_root'], '</option>';
148 150
 
149
-	if (!empty($context['base_dirs']))
150
-		foreach ($context['base_dirs'] as $id => $dir)
151
+	if (!empty($context['base_dirs'])) {
152
+			foreach ($context['base_dirs'] as $id => $dir)
151 153
 			echo '
152 154
 						<option value="', $id, '">', $dir, '</option>';
153
-	else
154
-			echo '
155
+	} else {
156
+				echo '
155 157
 						<option value="0" disabled>', $txt['attachment_transfer_no_base'], '</option>';
158
+	}
156 159
 
157 160
 	echo '
158 161
 					</select>
@@ -162,18 +165,20 @@  discard block
 block discarded – undo
162 165
 					<select name="to">
163 166
 						<option value="0">', $txt['attachment_transfer_select'], '</option>';
164 167
 
165
-	foreach ($context['attach_dirs'] as $id => $dir)
166
-		echo '
168
+	foreach ($context['attach_dirs'] as $id => $dir) {
169
+			echo '
167 170
 						<option value="', $id, '">', $dir, '</option>';
171
+	}
168 172
 
169 173
 	echo '
170 174
 					</select>
171 175
 				</dd>';
172 176
 
173
-	if (!empty($modSettings['attachmentDirFileLimit']))
174
-		echo '
177
+	if (!empty($modSettings['attachmentDirFileLimit'])) {
178
+			echo '
175 179
 				<dt>', $txt['attachment_transfer_empty'], '</dt>
176 180
 				<dd><input type="checkbox" name="empty_it"', $context['checked'] ? ' checked' : '', '></dd>';
181
+	}
177 182
 
178 183
 	echo '
179 184
 			</dl>
@@ -209,8 +214,8 @@  discard block
 block discarded – undo
209 214
 	global $context, $txt, $scripturl;
210 215
 
211 216
 	// If we've completed just let them know!
212
-	if ($context['completed'])
213
-		echo '
217
+	if ($context['completed']) {
218
+			echo '
214 219
 	<div id="manage_attachments">
215 220
 		<div class="cat_bar">
216 221
 			<h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
@@ -219,10 +224,11 @@  discard block
 block discarded – undo
219 224
 			', $txt['repair_attachments_complete_desc'], '
220 225
 		</div>
221 226
 	</div>';
227
+	}
222 228
 
223 229
 	// What about if no errors were even found?
224
-	elseif (!$context['errors_found'])
225
-		echo '
230
+	elseif (!$context['errors_found']) {
231
+			echo '
226 232
 	<div id="manage_attachments">
227 233
 		<div class="cat_bar">
228 234
 			<h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
@@ -231,6 +237,7 @@  discard block
 block discarded – undo
231 237
 			', $txt['repair_attachments_no_errors'], '
232 238
 		</div>
233 239
 	</div>';
240
+	}
234 241
 
235 242
 	// Otherwise, I'm sad to say, we have a problem!
236 243
 	else
@@ -245,11 +252,12 @@  discard block
 block discarded – undo
245 252
 				<p>', $txt['repair_attachments_error_desc'], '</p>';
246 253
 
247 254
 		// Loop through each error reporting the status
248
-		foreach ($context['repair_errors'] as $error => $number)
249
-			if (!empty($number))
255
+		foreach ($context['repair_errors'] as $error => $number) {
256
+					if (!empty($number))
250 257
 				echo '
251 258
 				<input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '">
252 259
 				<label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br>';
260
+		}
253 261
 
254 262
 		echo '
255 263
 				<br>
@@ -268,8 +276,9 @@  discard block
 block discarded – undo
268 276
 {
269 277
 	global $modSettings;
270 278
 
271
-	if (!empty($modSettings['attachment_basedirectories']))
272
-		template_show_list('base_paths');
279
+	if (!empty($modSettings['attachment_basedirectories'])) {
280
+			template_show_list('base_paths');
281
+	}
273 282
 
274 283
 	template_show_list('attach_paths');
275 284
 }
Please login to merge, or discard this patch.