Completed
Pull Request — release-2.1 (#5058)
by 01
120:18 queued 71:00
created
Sources/Subs-Themes.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@
 block discarded – undo
425 425
  *
426 426
  * This is a recursive function, it will call itself if there are subdirs inside the main directory.
427 427
  * @param string $path The absolute path to the directory to be removed
428
- * @return bool true when success, false on error.
428
+ * @return false|null true when success, false on error.
429 429
  */
430 430
 function remove_dir($path)
431 431
 {
Please login to merge, or discard this patch.
Braces   +67 added lines, -46 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
  * Gets a single theme's info.
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 	global $smcFunc, $modSettings;
28 29
 
29 30
 	// No data, no fun!
30
-	if (empty($id))
31
-		return false;
31
+	if (empty($id)) {
32
+			return false;
33
+	}
32 34
 
33 35
 	// Make sure $id is an int.
34 36
 	$id = (int) $id;
@@ -171,8 +173,9 @@  discard block
 block discarded – undo
171 173
 	global $smcFunc, $sourcedir, $forum_version, $txt, $scripturl, $context;
172 174
 	global $explicit_images;
173 175
 
174
-	if (empty($path))
175
-		return false;
176
+	if (empty($path)) {
177
+			return false;
178
+	}
176 179
 
177 180
 	$xml_data = array();
178 181
 	$explicit_images = false;
@@ -229,9 +232,10 @@  discard block
 block discarded – undo
229 232
 	);
230 233
 
231 234
 	// Assign the values to be stored.
232
-	foreach ($xml_elements as $var => $name)
233
-		if (!empty($theme_info_xml[$name]))
235
+	foreach ($xml_elements as $var => $name) {
236
+			if (!empty($theme_info_xml[$name]))
234 237
 			$xml_data[$var] = $theme_info_xml[$name];
238
+	}
235 239
 
236 240
 	// Add the supported versions.
237 241
 	$xml_data['install_for'] = $install_versions;
@@ -243,8 +247,9 @@  discard block
 block discarded – undo
243 247
 		$explicit_images = true;
244 248
 	}
245 249
 
246
-	if (!empty($theme_info_xml['extra']))
247
-		$xml_data += $smcFunc['json_decode']($theme_info_xml['extra'], true);
250
+	if (!empty($theme_info_xml['extra'])) {
251
+			$xml_data += $smcFunc['json_decode']($theme_info_xml['extra'], true);
252
+	}
248 253
 
249 254
 	return $xml_data;
250 255
 }
@@ -262,12 +267,14 @@  discard block
 block discarded – undo
262 267
 	global $settings, $explicit_images;
263 268
 
264 269
 	// External use? no problem!
265
-	if ($to_install)
266
-		$context['to_install'] = $to_install;
270
+	if ($to_install) {
271
+			$context['to_install'] = $to_install;
272
+	}
267 273
 
268 274
 	// One last check.
269
-	if (empty($context['to_install']['theme_dir']) || basename($context['to_install']['theme_dir']) == 'Themes')
270
-		fatal_lang_error('theme_install_invalid_dir', false);
275
+	if (empty($context['to_install']['theme_dir']) || basename($context['to_install']['theme_dir']) == 'Themes') {
276
+			fatal_lang_error('theme_install_invalid_dir', false);
277
+	}
271 278
 
272 279
 	// OK, is this a newer version of an already installed theme?
273 280
 	if (!empty($context['to_install']['version']))
@@ -291,8 +298,8 @@  discard block
 block discarded – undo
291 298
 		$smcFunc['db_free_result']($request);
292 299
 
293 300
 		// Got something, lets figure it out what to do next.
294
-		if (!empty($to_update) && !empty($to_update['version']))
295
-			switch (compareVersions($context['to_install']['version'], $to_update['version']))
301
+		if (!empty($to_update) && !empty($to_update['version'])) {
302
+					switch (compareVersions($context['to_install']['version'], $to_update['version']))
296 303
 			{
297 304
 				case 1: // Got a newer version, update the old entry.
298 305
 					$smcFunc['db_query']('', '
@@ -306,6 +313,7 @@  discard block
 block discarded – undo
306 313
 							'id_theme' => $to_update['id_theme'],
307 314
 						)
308 315
 					);
316
+		}
309 317
 
310 318
 					// Done with the update, tell the user about it.
311 319
 					$context['to_install']['updated'] = true;
@@ -371,13 +379,15 @@  discard block
 block discarded – undo
371 379
 				$context['to_install']['base_theme_url'] = $temp['theme_url'];
372 380
 				$context['to_install']['base_theme_dir'] = $temp['theme_dir'];
373 381
 
374
-				if (empty($explicit_images) && !empty($context['to_install']['base_theme_url']))
375
-					$context['to_install']['theme_url'] = $context['to_install']['base_theme_url'];
382
+				if (empty($explicit_images) && !empty($context['to_install']['base_theme_url'])) {
383
+									$context['to_install']['theme_url'] = $context['to_install']['base_theme_url'];
384
+				}
376 385
 			}
377 386
 
378 387
 			// Nope, sorry, couldn't find any theme already installed.
379
-			else
380
-				fatal_lang_error('package_get_error_theme_no_based_on_found', false, $context['to_install']['based_on']);
388
+			else {
389
+							fatal_lang_error('package_get_error_theme_no_based_on_found', false, $context['to_install']['based_on']);
390
+			}
381 391
 		}
382 392
 
383 393
 		unset($context['to_install']['based_on']);
@@ -400,16 +410,18 @@  discard block
 block discarded – undo
400 410
 	call_integration_hook('integrate_theme_install', array(&$context['to_install'], $id_theme));
401 411
 
402 412
 	$inserts = array();
403
-	foreach ($context['to_install'] as $var => $val)
404
-		$inserts[] = array($id_theme, $var, $val);
413
+	foreach ($context['to_install'] as $var => $val) {
414
+			$inserts[] = array($id_theme, $var, $val);
415
+	}
405 416
 
406
-	if (!empty($inserts))
407
-		$smcFunc['db_insert']('insert',
417
+	if (!empty($inserts)) {
418
+			$smcFunc['db_insert']('insert',
408 419
 			'{db_prefix}themes',
409 420
 			array('id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
410 421
 			$inserts,
411 422
 			array('id_theme', 'variable')
412 423
 		);
424
+	}
413 425
 
414 426
 	// Update the known and enable Theme's settings.
415 427
 	$known = strtr($modSettings['knownThemes'] . ',' . $id_theme, array(',,' => ','));
@@ -428,21 +440,24 @@  discard block
 block discarded – undo
428 440
  */
429 441
 function remove_dir($path)
430 442
 {
431
-	if (empty($path))
432
-		return false;
443
+	if (empty($path)) {
444
+			return false;
445
+	}
433 446
 
434 447
 	if (is_dir($path))
435 448
 	{
436 449
 		$objects = scandir($path);
437 450
 
438
-		foreach ($objects as $object)
439
-			if ($object != '.' && $object != '..')
451
+		foreach ($objects as $object) {
452
+					if ($object != '.' && $object != '..')
440 453
 			{
441 454
 				if (filetype($path . '/' . $object) == 'dir')
442 455
 					remove_dir($path . '/' . $object);
456
+		}
443 457
 
444
-				else
445
-					unlink($path . '/' . $object);
458
+				else {
459
+									unlink($path . '/' . $object);
460
+				}
446 461
 			}
447 462
 	}
448 463
 
@@ -461,8 +476,9 @@  discard block
 block discarded – undo
461 476
 	global $smcFunc, $modSettings;
462 477
 
463 478
 	// Can't delete the default theme, sorry!
464
-	if (empty($themeID) || $themeID == 1)
465
-		return false;
479
+	if (empty($themeID) || $themeID == 1) {
480
+			return false;
481
+	}
466 482
 
467 483
 	$known = explode(',', $modSettings['knownThemes']);
468 484
 	$enable = explode(',', $modSettings['enableThemes']);
@@ -512,8 +528,9 @@  discard block
 block discarded – undo
512 528
 	updateSettings(array('enableThemes' => $enable, 'knownThemes' => $known));
513 529
 
514 530
 	// Fix it if the theme was the overall default theme.
515
-	if ($modSettings['theme_guests'] == $themeID)
516
-		updateSettings(array('theme_guests' => '1'));
531
+	if ($modSettings['theme_guests'] == $themeID) {
532
+			updateSettings(array('theme_guests' => '1'));
533
+	}
517 534
 
518 535
 	return true;
519 536
 }
@@ -530,13 +547,15 @@  discard block
 block discarded – undo
530 547
 	global $scripturl, $txt, $context;
531 548
 
532 549
 	// Is it even a directory?
533
-	if (!is_dir($path))
534
-		fatal_lang_error('error_invalid_dir', 'critical');
550
+	if (!is_dir($path)) {
551
+			fatal_lang_error('error_invalid_dir', 'critical');
552
+	}
535 553
 
536 554
 	$dir = dir($path);
537 555
 	$entries = array();
538
-	while ($entry = $dir->read())
539
-		$entries[] = $entry;
556
+	while ($entry = $dir->read()) {
557
+			$entries[] = $entry;
558
+	}
540 559
 	$dir->close();
541 560
 
542 561
 	natcasesort($entries);
@@ -547,11 +566,12 @@  discard block
 block discarded – undo
547 566
 	foreach ($entries as $entry)
548 567
 	{
549 568
 		// Skip all dot files, including .htaccess.
550
-		if (substr($entry, 0, 1) == '.' || $entry == 'CVS')
551
-			continue;
569
+		if (substr($entry, 0, 1) == '.' || $entry == 'CVS') {
570
+					continue;
571
+		}
552 572
 
553
-		if (is_dir($path . '/' . $entry))
554
-			$listing1[] = array(
573
+		if (is_dir($path . '/' . $entry)) {
574
+					$listing1[] = array(
555 575
 				'filename' => $entry,
556 576
 				'is_writable' => is_writable($path . '/' . $entry),
557 577
 				'is_directory' => true,
@@ -561,13 +581,14 @@  discard block
 block discarded – undo
561 581
 				'href' => $scripturl . '?action=admin;area=theme;th=' . $_GET['th'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=edit;directory=' . $relative . $entry,
562 582
 				'size' => '',
563 583
 			);
564
-		else
584
+		} else
565 585
 		{
566 586
 			$size = filesize($path . '/' . $entry);
567
-			if ($size > 2048 || $size == 1024)
568
-				$size = comma_format($size / 1024) . ' ' . $txt['themeadmin_edit_kilobytes'];
569
-			else
570
-				$size = comma_format($size) . ' ' . $txt['themeadmin_edit_bytes'];
587
+			if ($size > 2048 || $size == 1024) {
588
+							$size = comma_format($size / 1024) . ' ' . $txt['themeadmin_edit_kilobytes'];
589
+			} else {
590
+							$size = comma_format($size) . ' ' . $txt['themeadmin_edit_bytes'];
591
+			}
571 592
 
572 593
 			$listing2[] = array(
573 594
 				'filename' => $entry,
Please login to merge, or discard this patch.
Sources/Subscriptions-PayPal.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -402,7 +402,7 @@
 block discarded – undo
402 402
 	 * A private function to find out the subscription details.
403 403
 	 *
404 404
 	 * @access private
405
-	 * @return boolean|void False on failure, otherwise just sets $_POST['item_number']
405
+	 * @return false|null False on failure, otherwise just sets $_POST['item_number']
406 406
 	 */
407 407
 	private function _findSubscription()
408 408
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@
 block discarded – undo
236 236
 			$header = 'POST /cgi-bin/webscr HTTP/1.1' . "\r\n";
237 237
 			$header .= 'content-type: application/x-www-form-urlencoded' . "\r\n";
238 238
 			$header .= 'Host: www.' . (!empty($modSettings['paidsubs_test']) ? 'sandbox.' : '') . 'paypal.com' . "\r\n";
239
-			$header .= 'content-length: ' . strlen ($requestString) . "\r\n";
239
+			$header .= 'content-length: ' . strlen($requestString) . "\r\n";
240 240
 			$header .= 'connection: close' . "\r\n\r\n";
241 241
 
242 242
 			// Open the connection.
Please login to merge, or discard this patch.
Braces   +83 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 // This won't be dedicated without this - this must exist in each gateway!
15 15
 // SMF Payment Gateway: paypal
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Class for returning available form data for this gateway
@@ -118,8 +119,7 @@  discard block
 block discarded – undo
118 119
 		{
119 120
 			$return_data['hidden']['p3'] = 1;
120 121
 			$return_data['hidden']['t3'] = strtoupper(substr($period, 0, 1));
121
-		}
122
-		else
122
+		} else
123 123
 		{
124 124
 			preg_match('~(\d*)(\w)~', $sub_data['real_length'], $match);
125 125
 			$unit = $match[1];
@@ -130,14 +130,15 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		// If it's repeatable do some javascript to respect this idea.
133
-		if (!empty($sub_data['repeatable']))
134
-			$return_data['javascript'] = '
133
+		if (!empty($sub_data['repeatable'])) {
134
+					$return_data['javascript'] = '
135 135
 				document.write(\'<label for="do_paypal_recur"><input type="checkbox" name="do_paypal_recur" id="do_paypal_recur" checked onclick="switchPaypalRecur();">' . $txt['paid_make_recurring'] . '</label><br>\');
136 136
 
137 137
 				function switchPaypalRecur()
138 138
 				{
139 139
 					document.getElementById("paypal_cmd").value = document.getElementById("do_paypal_recur").checked ? "_xclick-subscriptions" : "_xclick";
140 140
 				}';
141
+		}
141 142
 
142 143
 		return $return_data;
143 144
 	}
@@ -160,20 +161,24 @@  discard block
 block discarded – undo
160 161
 		global $modSettings;
161 162
 
162 163
 		// Has the user set up an email address?
163
-		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email'])))
164
-			return false;
164
+		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email']))) {
165
+					return false;
166
+		}
165 167
 		// Check the correct transaction types are even here.
166
-		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email'])))
167
-			return false;
168
+		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email']))) {
169
+					return false;
170
+		}
168 171
 		// Correct email address?
169
-		if (!isset($_POST['business']))
170
-			$_POST['business'] = $_POST['receiver_email'];
172
+		if (!isset($_POST['business'])) {
173
+					$_POST['business'] = $_POST['receiver_email'];
174
+		}
171 175
 
172 176
 		// Are we testing?
173
-		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
174
-			return false;
175
-		elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails']))))
176
-			return false;
177
+		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
178
+					return false;
179
+		} elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails'])))) {
180
+					return false;
181
+		}
177 182
 		return true;
178 183
 	}
179 184
 
@@ -192,15 +197,17 @@  discard block
 block discarded – undo
192 197
 		global $modSettings, $txt;
193 198
 
194 199
 		// Put this to some default value.
195
-		if (!isset($_POST['txn_type']))
196
-			$_POST['txn_type'] = '';
200
+		if (!isset($_POST['txn_type'])) {
201
+					$_POST['txn_type'] = '';
202
+		}
197 203
 
198 204
 		// Build the request string - starting with the minimum requirement.
199 205
 		$requestString = 'cmd=_notify-validate';
200 206
 
201 207
 		// Now my dear, add all the posted bits in the order we got them
202
-		foreach ($_POST as $k => $v)
203
-			$requestString .= '&' . $k . '=' . urlencode($v);
208
+		foreach ($_POST as $k => $v) {
209
+					$requestString .= '&' . $k . '=' . urlencode($v);
210
+		}
204 211
 
205 212
 		// Can we use curl?
206 213
 		if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr'))
@@ -240,14 +247,16 @@  discard block
 block discarded – undo
240 247
 			$header .= 'connection: close' . "\r\n\r\n";
241 248
 
242 249
 			// Open the connection.
243
-			if (!empty($modSettings['paidsubs_test']))
244
-				$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
245
-			else
246
-				$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
250
+			if (!empty($modSettings['paidsubs_test'])) {
251
+							$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
252
+			} else {
253
+							$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
254
+			}
247 255
 
248 256
 			// Did it work?
249
-			if (!$fp)
250
-				generateSubscriptionError($txt['paypal_could_not_connect']);
257
+			if (!$fp) {
258
+							generateSubscriptionError($txt['paypal_could_not_connect']);
259
+			}
251 260
 
252 261
 			// Put the data to the port.
253 262
 			fputs($fp, $header . $requestString);
@@ -256,8 +265,9 @@  discard block
 block discarded – undo
256 265
 			while (!feof($fp))
257 266
 			{
258 267
 				$this->return_data = fgets($fp, 1024);
259
-				if (strcmp(trim($this->return_data), 'VERIFIED') === 0)
260
-					break;
268
+				if (strcmp(trim($this->return_data), 'VERIFIED') === 0) {
269
+									break;
270
+				}
261 271
 			}
262 272
 
263 273
 			// Clean up.
@@ -265,28 +275,34 @@  discard block
 block discarded – undo
265 275
 		}
266 276
 
267 277
 		// If this isn't verified then give up...
268
-		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0)
269
-			exit;
278
+		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0) {
279
+					exit;
280
+		}
270 281
 
271 282
 		// Check that this is intended for us.
272
-		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
273
-			exit;
283
+		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
284
+					exit;
285
+		}
274 286
 
275 287
 		// Is this a subscription - and if so is it a secondary payment that we need to process?
276 288
 		// If so, make sure we get it in the expected format. Seems PayPal sometimes sends it without urlencoding.
277
-		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false)
278
-			$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
279
-		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false))
280
-			// Calculate the subscription it relates to!
289
+		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false) {
290
+					$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
291
+		}
292
+		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false)) {
293
+					// Calculate the subscription it relates to!
281 294
 			$this->_findSubscription();
295
+		}
282 296
 
283 297
 		// Verify the currency!
284
-		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code']))
285
-			exit;
298
+		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code'])) {
299
+					exit;
300
+		}
286 301
 
287 302
 		// Can't exist if it doesn't contain anything.
288
-		if (empty($_POST['item_number']))
289
-			exit;
303
+		if (empty($_POST['item_number'])) {
304
+					exit;
305
+		}
290 306
 
291 307
 		// Return the id_sub and id_member
292 308
 		return explode('+', $_POST['item_number']);
@@ -299,10 +315,11 @@  discard block
 block discarded – undo
299 315
 	 */
300 316
 	public function isRefund()
301 317
 	{
302
-		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed'))
303
-			return true;
304
-		else
305
-			return false;
318
+		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed')) {
319
+					return true;
320
+		} else {
321
+					return false;
322
+		}
306 323
 	}
307 324
 
308 325
 	/**
@@ -312,10 +329,11 @@  discard block
 block discarded – undo
312 329
 	 */
313 330
 	public function isSubscription()
314 331
 	{
315
-		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed')
316
-			return true;
317
-		else
318
-			return false;
332
+		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed') {
333
+					return true;
334
+		} else {
335
+					return false;
336
+		}
319 337
 	}
320 338
 
321 339
 	/**
@@ -325,10 +343,11 @@  discard block
 block discarded – undo
325 343
 	 */
326 344
 	public function isPayment()
327 345
 	{
328
-		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept')
329
-			return true;
330
-		else
331
-			return false;
346
+		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept') {
347
+					return true;
348
+		} else {
349
+					return false;
350
+		}
332 351
 	}
333 352
 
334 353
 	/**
@@ -341,10 +360,11 @@  discard block
 block discarded – undo
341 360
 		// subscr_cancel is sent when the user cancels, subscr_eot is sent when the subscription reaches final payment
342 361
 		// Neither require us to *do* anything as per performCancel().
343 362
 		// subscr_eot, if sent, indicates an end of payments term.
344
-		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot')
345
-			return true;
346
-		else
347
-			return false;
363
+		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot') {
364
+					return true;
365
+		} else {
366
+					return false;
367
+		}
348 368
 	}
349 369
 
350 370
 	/**
@@ -408,8 +428,9 @@  discard block
 block discarded – undo
408 428
 		global $smcFunc;
409 429
 
410 430
 		// Assume we have this?
411
-		if (empty($_POST['subscr_id']))
412
-			return false;
431
+		if (empty($_POST['subscr_id'])) {
432
+					return false;
433
+		}
413 434
 
414 435
 		// Do we have this in the database?
415 436
 		$request = $smcFunc['db_query']('', '
@@ -438,11 +459,12 @@  discard block
 block discarded – undo
438 459
 						'payer_email' => $_POST['payer_email'],
439 460
 					)
440 461
 				);
441
-				if ($smcFunc['db_num_rows']($request) === 0)
442
-					return false;
462
+				if ($smcFunc['db_num_rows']($request) === 0) {
463
+									return false;
464
+				}
465
+			} else {
466
+							return false;
443 467
 			}
444
-			else
445
-				return false;
446 468
 		}
447 469
 		list ($member_id, $subscription_id) = $smcFunc['db_fetch_row']($request);
448 470
 		$_POST['item_number'] = $member_id . '+' . $subscription_id;
Please login to merge, or discard this patch.
Sources/Xml.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 /**
81 81
  * Handles retrieving previews of news items, newsletters, signatures and warnings.
82 82
  * Calls the appropriate function based on $_POST['item']
83
- * @return void|bool Returns false if $_POST['item'] isn't set or isn't valid
83
+ * @return false|null Returns false if $_POST['item'] isn't set or isn't valid
84 84
  */
85 85
 function RetrievePreview()
86 86
 {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -272,13 +272,13 @@
 block discarded – undo
272 272
 				$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body'];
273 273
 			// Add in few replacements.
274 274
 			/**
275
-			* These are the defaults:
276
-			* - {MEMBER} - Member Name. => current user for review
277
-			* - {MESSAGE} - Link to Offending Post. (If Applicable) => not applicable here, so not replaced
278
-			* - {FORUMNAME} - Forum Name.
279
-			* - {SCRIPTURL} - Web address of forum.
280
-			* - {REGARDS} - Standard email sign-off.
281
-			*/
275
+			 * These are the defaults:
276
+			 * - {MEMBER} - Member Name. => current user for review
277
+			 * - {MESSAGE} - Link to Offending Post. (If Applicable) => not applicable here, so not replaced
278
+			 * - {FORUMNAME} - Forum Name.
279
+			 * - {SCRIPTURL} - Web address of forum.
280
+			 * - {REGARDS} - Standard email sign-off.
281
+			 */
282 282
 			$find = array(
283 283
 				'{MEMBER}',
284 284
 				'{FORUMNAME}',
Please login to merge, or discard this patch.
Braces   +55 added lines, -42 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
  * The main handler and designator for AJAX stuff - jumpto, message icons and previews
@@ -32,8 +33,9 @@  discard block
 block discarded – undo
32 33
 	// Easy adding of sub actions.
33 34
 	call_integration_hook('integrate_XMLhttpMain_subActions', array(&$subActions));
34 35
 
35
-	if (!isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']]))
36
-		fatal_lang_error('no_access', false);
36
+	if (!isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']])) {
37
+			fatal_lang_error('no_access', false);
38
+	}
37 39
 
38 40
 	call_helper($subActions[$_REQUEST['sa']]);
39 41
 }
@@ -57,8 +59,9 @@  discard block
 block discarded – undo
57 59
 	foreach ($context['jump_to'] as $id_cat => $cat)
58 60
 	{
59 61
 		$context['jump_to'][$id_cat]['name'] = un_htmlspecialchars(strip_tags($cat['name']));
60
-		foreach ($cat['boards'] as $id_board => $board)
61
-			$context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name']));
62
+		foreach ($cat['boards'] as $id_board => $board) {
63
+					$context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name']));
64
+		}
62 65
 	}
63 66
 
64 67
 	$context['sub_template'] = 'jump_to';
@@ -95,8 +98,9 @@  discard block
 block discarded – undo
95 98
 
96 99
 	$context['sub_template'] = 'generic_xml';
97 100
 
98
-	if (!isset($_POST['item']) || !in_array($_POST['item'], $items))
99
-		return false;
101
+	if (!isset($_POST['item']) || !in_array($_POST['item'], $items)) {
102
+			return false;
103
+	}
100 104
 
101 105
 	$_POST['item']();
102 106
 }
@@ -112,10 +116,11 @@  discard block
 block discarded – undo
112 116
 
113 117
 	$errors = array();
114 118
 	$news = !isset($_POST['news']) ? '' : $smcFunc['htmlspecialchars']($_POST['news'], ENT_QUOTES);
115
-	if (empty($news))
116
-		$errors[] = array('value' => 'no_news');
117
-	else
118
-		preparsecode($news);
119
+	if (empty($news)) {
120
+			$errors[] = array('value' => 'no_news');
121
+	} else {
122
+			preparsecode($news);
123
+	}
119 124
 
120 125
 	$context['xml_data'] = array(
121 126
 		'news' => array(
@@ -148,10 +153,12 @@  discard block
 block discarded – undo
148 153
 	$context['send_pm'] = !empty($_POST['send_pm']) ? 1 : 0;
149 154
 	$context['send_html'] = !empty($_POST['send_html']) ? 1 : 0;
150 155
 
151
-	if (empty($_POST['subject']))
152
-		$context['post_error']['messages'][] = $txt['error_no_subject'];
153
-	if (empty($_POST['message']))
154
-		$context['post_error']['messages'][] = $txt['error_no_message'];
156
+	if (empty($_POST['subject'])) {
157
+			$context['post_error']['messages'][] = $txt['error_no_subject'];
158
+	}
159
+	if (empty($_POST['message'])) {
160
+			$context['post_error']['messages'][] = $txt['error_no_message'];
161
+	}
155 162
 
156 163
 	prepareMailingForPreview();
157 164
 
@@ -196,38 +203,41 @@  discard block
 block discarded – undo
196 203
 		$preview_signature = !empty($_POST['signature']) ? $_POST['signature'] : $txt['no_signature_preview'];
197 204
 		$validation = profileValidateSignature($preview_signature);
198 205
 
199
-		if ($validation !== true && $validation !== false)
200
-			$errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error'));
206
+		if ($validation !== true && $validation !== false) {
207
+					$errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error'));
208
+		}
201 209
 
202 210
 		censorText($preview_signature);
203 211
 		$preview_signature = parse_bbc($preview_signature, true, 'sig' . $user);
204
-	}
205
-	elseif (!$can_change)
212
+	} elseif (!$can_change)
206 213
 	{
207
-		if ($is_owner)
208
-			$errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error'));
209
-		else
210
-			$errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error'));
214
+		if ($is_owner) {
215
+					$errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error'));
216
+		} else {
217
+					$errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error'));
218
+		}
219
+	} else {
220
+			$errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error'));
211 221
 	}
212
-	else
213
-		$errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error'));
214 222
 
215 223
 	$context['xml_data']['signatures'] = array(
216 224
 			'identifier' => 'signature',
217 225
 			'children' => array()
218 226
 		);
219
-	if (isset($current_signature))
220
-		$context['xml_data']['signatures']['children'][] = array(
227
+	if (isset($current_signature)) {
228
+			$context['xml_data']['signatures']['children'][] = array(
221 229
 					'value' => $current_signature,
222 230
 					'attributes' => array('type' => 'current'),
223 231
 				);
224
-	if (isset($preview_signature))
225
-		$context['xml_data']['signatures']['children'][] = array(
232
+	}
233
+	if (isset($preview_signature)) {
234
+			$context['xml_data']['signatures']['children'][] = array(
226 235
 					'value' => $preview_signature,
227 236
 					'attributes' => array('type' => 'preview'),
228 237
 				);
229
-	if (!empty($errors))
230
-		$context['xml_data']['errors'] = array(
238
+	}
239
+	if (!empty($errors)) {
240
+			$context['xml_data']['errors'] = array(
231 241
 			'identifier' => 'error',
232 242
 			'children' => array_merge(
233 243
 				array(
@@ -239,7 +249,8 @@  discard block
 block discarded – undo
239 249
 				$errors
240 250
 			),
241 251
 		);
242
-}
252
+	}
253
+	}
243 254
 
244 255
 /**
245 256
  * Handles previewing user warnings
@@ -259,15 +270,17 @@  discard block
 block discarded – undo
259 270
 		$context['preview_subject'] = !empty($_POST['title']) ? trim($smcFunc['htmlspecialchars']($_POST['title'])) : '';
260 271
 		if (isset($_POST['issuing']))
261 272
 		{
262
-			if (empty($_POST['title']) || empty($_POST['body']))
263
-				$context['post_error']['messages'][] = $txt['warning_notify_blank'];
264
-		}
265
-		else
273
+			if (empty($_POST['title']) || empty($_POST['body'])) {
274
+							$context['post_error']['messages'][] = $txt['warning_notify_blank'];
275
+			}
276
+		} else
266 277
 		{
267
-			if (empty($_POST['title']))
268
-				$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title'];
269
-			if (empty($_POST['body']))
270
-				$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body'];
278
+			if (empty($_POST['title'])) {
279
+							$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title'];
280
+			}
281
+			if (empty($_POST['body'])) {
282
+							$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body'];
283
+			}
271 284
 			// Add in few replacements.
272 285
 			/**
273 286
 			* These are the defaults:
@@ -298,9 +311,9 @@  discard block
 block discarded – undo
298 311
 			$warning_body = parse_bbc($warning_body, true);
299 312
 		}
300 313
 		$context['preview_message'] = $warning_body;
314
+	} else {
315
+			$context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
301 316
 	}
302
-	else
303
-		$context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
304 317
 
305 318
 	$context['sub_template'] = 'warning';
306 319
 }
Please login to merge, or discard this patch.
SSI.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 /**
1718 1718
  * Show today's birthdays.
1719 1719
  * @param string $output_method The output method. If 'echo', displays a list of users, otherwise returns an array of info about them.
1720
- * @return void|array Displays a list of users or returns an array of info about them depending on output_method.
1720
+ * @return null|string Displays a list of users or returns an array of info about them depending on output_method.
1721 1721
  */
1722 1722
 function ssi_todaysBirthdays($output_method = 'echo')
1723 1723
 {
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 /**
1747 1747
  * Shows today's holidays.
1748 1748
  * @param string $output_method The output method. If 'echo', displays a list of holidays, otherwise returns an array of info about them.
1749
- * @return void|array Displays a list of holidays or returns an array of info about them depending on output_method
1749
+ * @return null|string Displays a list of holidays or returns an array of info about them depending on output_method
1750 1750
  */
1751 1751
 function ssi_todaysHolidays($output_method = 'echo')
1752 1752
 {
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 
1774 1774
 /**
1775 1775
  * @param string $output_method The output method. If 'echo', displays a list of events, otherwise returns an array of info about them.
1776
- * @return void|array Displays a list of events or returns an array of info about them depending on output_method
1776
+ * @return null|string Displays a list of events or returns an array of info about them depending on output_method
1777 1777
  */
1778 1778
 function ssi_todaysEvents($output_method = 'echo')
1779 1779
 {
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 /**
1808 1808
  * Shows today's calendar items (events, birthdays and holidays)
1809 1809
  * @param string $output_method The output method. If 'echo', displays a list of calendar items, otherwise returns an array of info about them.
1810
- * @return void|array Displays a list of calendar items or returns an array of info about them depending on output_method
1810
+ * @return null|string Displays a list of calendar items or returns an array of info about them depending on output_method
1811 1811
  */
1812 1812
 function ssi_todaysCalendar($output_method = 'echo')
1813 1813
 {
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
  * @param int|string $id The ID or username of a user
2199 2199
  * @param string $password The password to check
2200 2200
  * @param bool $is_username If true, treats $id as a username rather than a user ID
2201
- * @return bool Whether or not the password is correct.
2201
+ * @return null|boolean Whether or not the password is correct.
2202 2202
  */
2203 2203
 function ssi_checkPassword($id = null, $password = null, $is_username = false)
2204 2204
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
  *
105 105
  * @param string $class The fully-qualified class name.
106 106
  */
107
-spl_autoload_register(function ($class) use ($sourcedir)
107
+spl_autoload_register(function($class) use ($sourcedir)
108 108
 {
109 109
 	$classMap = array(
110 110
 		'ReCaptcha\\' => 'ReCaptcha/',
Please login to merge, or discard this patch.
Braces   +430 added lines, -308 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Don't do anything if SMF is already loaded.
15
-if (defined('SMF'))
15
+if (defined('SMF')) {
16 16
 	return true;
17
+}
17 18
 
18 19
 define('SMF', 'SSI');
19 20
 
@@ -28,16 +29,18 @@  discard block
 block discarded – undo
28 29
 $time_start = microtime(true);
29 30
 
30 31
 // Just being safe...
31
-foreach (array('db_character_set', 'cachedir') as $variable)
32
+foreach (array('db_character_set', 'cachedir') as $variable) {
32 33
 	if (isset($GLOBALS[$variable]))
33 34
 		unset($GLOBALS[$variable]);
35
+}
34 36
 
35 37
 // Get the forum's settings for database and file paths.
36 38
 require_once(dirname(__FILE__) . '/Settings.php');
37 39
 
38 40
 // Make absolutely sure the cache directory is defined.
39
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
41
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
40 42
 	$cachedir = $boarddir . '/cache';
43
+}
41 44
 
42 45
 $ssi_error_reporting = error_reporting(E_ALL);
43 46
 /* Set this to one of three values depending on what you want to happen in the case of a fatal error.
@@ -48,12 +51,14 @@  discard block
 block discarded – undo
48 51
 $ssi_on_error_method = false;
49 52
 
50 53
 // Don't do john didley if the forum's been shut down completely.
51
-if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true))
54
+if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) {
52 55
 	die($mmessage);
56
+}
53 57
 
54 58
 // Fix for using the current directory as a path.
55
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
59
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
56 60
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
61
+}
57 62
 
58 63
 // Load the important includes.
59 64
 require_once($sourcedir . '/QueryString.php');
@@ -78,26 +83,30 @@  discard block
 block discarded – undo
78 83
 cleanRequest();
79 84
 
80 85
 // Seed the random generator?
81
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
86
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
82 87
 	smf_seed_generator();
88
+}
83 89
 
84 90
 // Check on any hacking attempts.
85
-if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
91
+if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
86 92
 	die('No direct access...');
87
-elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme)
93
+} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) {
88 94
 	die('No direct access...');
89
-elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme)
95
+} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) {
90 96
 	die('No direct access...');
91
-elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers)
97
+} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) {
92 98
 	die('No direct access...');
93
-if (isset($_REQUEST['context']))
99
+}
100
+if (isset($_REQUEST['context'])) {
94 101
 	die('No direct access...');
102
+}
95 103
 
96 104
 // Gzip output? (because it must be boolean and true, this can't be hacked.)
97
-if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>='))
105
+if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) {
98 106
 	ob_start('ob_gzhandler');
99
-else
107
+} else {
100 108
 	$modSettings['enableCompressedOutput'] = '0';
109
+}
101 110
 
102 111
 /**
103 112
  * An autoloader for certain classes.
@@ -146,9 +155,9 @@  discard block
 block discarded – undo
146 155
 ob_start('ob_sessrewrite');
147 156
 
148 157
 // Start the session... known to scramble SSI includes in cases...
149
-if (!headers_sent())
158
+if (!headers_sent()) {
150 159
 	loadSession();
151
-else
160
+} else
152 161
 {
153 162
 	if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()]))
154 163
 	{
@@ -182,12 +191,14 @@  discard block
 block discarded – undo
182 191
 loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0);
183 192
 
184 193
 // @todo: probably not the best place, but somewhere it should be set...
185
-if (!headers_sent())
194
+if (!headers_sent()) {
186 195
 	header('content-type: text/html; charset=' . (empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set']));
196
+}
187 197
 
188 198
 // Take care of any banning that needs to be done.
189
-if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true))
199
+if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) {
190 200
 	is_not_banned();
201
+}
191 202
 
192 203
 // Do we allow guests in here?
193 204
 if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php')
@@ -202,17 +213,19 @@  discard block
 block discarded – undo
202 213
 {
203 214
 	$context['template_layers'] = $ssi_layers;
204 215
 	template_header();
205
-}
206
-else
216
+} else {
207 217
 	setupThemeContext();
218
+}
208 219
 
209 220
 // Make sure they didn't muss around with the settings... but only if it's not cli.
210
-if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '')
221
+if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') {
211 222
 	trigger_error($txt['ssi_session_broken'], E_USER_NOTICE);
223
+}
212 224
 
213 225
 // Without visiting the forum this session variable might not be set on submit.
214
-if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote'))
226
+if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) {
215 227
 	$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
228
+}
216 229
 
217 230
 // Have the ability to easily add functions to SSI.
218 231
 call_integration_hook('integrate_SSI');
@@ -221,11 +234,13 @@  discard block
 block discarded – undo
221 234
 if (basename($_SERVER['PHP_SELF']) == 'SSI.php')
222 235
 {
223 236
 	// You shouldn't just access SSI.php directly by URL!!
224
-	if (!isset($_GET['ssi_function']))
225
-		die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
237
+	if (!isset($_GET['ssi_function'])) {
238
+			die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
239
+	}
226 240
 	// Call a function passed by GET.
227
-	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest']))
228
-		call_user_func('ssi_' . $_GET['ssi_function']);
241
+	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) {
242
+			call_user_func('ssi_' . $_GET['ssi_function']);
243
+	}
229 244
 	exit;
230 245
 }
231 246
 
@@ -242,9 +257,10 @@  discard block
 block discarded – undo
242 257
  */
243 258
 function ssi_shutdown()
244 259
 {
245
-	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown')
246
-		template_footer();
247
-}
260
+	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') {
261
+			template_footer();
262
+	}
263
+	}
248 264
 
249 265
 /**
250 266
  * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new.
@@ -257,15 +273,17 @@  discard block
 block discarded – undo
257 273
 
258 274
 	if ($output_method == 'echo')
259 275
 	{
260
-		if ($context['user']['is_guest'])
261
-			echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
262
-		else
263
-			echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
276
+		if ($context['user']['is_guest']) {
277
+					echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
278
+		} else {
279
+					echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
280
+		}
264 281
 	}
265 282
 	// Don't echo... then do what?!
266
-	else
267
-		return $context['user'];
268
-}
283
+	else {
284
+			return $context['user'];
285
+	}
286
+	}
269 287
 
270 288
 /**
271 289
  * Display a menu bar, like is displayed at the top of the forum.
@@ -276,12 +294,14 @@  discard block
 block discarded – undo
276 294
 {
277 295
 	global $context;
278 296
 
279
-	if ($output_method == 'echo')
280
-		template_menu();
297
+	if ($output_method == 'echo') {
298
+			template_menu();
299
+	}
281 300
 	// What else could this do?
282
-	else
283
-		return $context['menu_buttons'];
284
-}
301
+	else {
302
+			return $context['menu_buttons'];
303
+	}
304
+	}
285 305
 
286 306
 /**
287 307
  * Show a logout link.
@@ -293,20 +313,23 @@  discard block
 block discarded – undo
293 313
 {
294 314
 	global $context, $txt, $scripturl;
295 315
 
296
-	if ($redirect_to != '')
297
-		$_SESSION['logout_url'] = $redirect_to;
316
+	if ($redirect_to != '') {
317
+			$_SESSION['logout_url'] = $redirect_to;
318
+	}
298 319
 
299 320
 	// Guests can't log out.
300
-	if ($context['user']['is_guest'])
301
-		return false;
321
+	if ($context['user']['is_guest']) {
322
+			return false;
323
+	}
302 324
 
303 325
 	$link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>';
304 326
 
305
-	if ($output_method == 'echo')
306
-		echo $link;
307
-	else
308
-		return $link;
309
-}
327
+	if ($output_method == 'echo') {
328
+			echo $link;
329
+	} else {
330
+			return $link;
331
+	}
332
+	}
310 333
 
311 334
 /**
312 335
  * Recent post list:   [board] Subject by Poster    Date
@@ -322,17 +345,17 @@  discard block
 block discarded – undo
322 345
 	global $modSettings, $context;
323 346
 
324 347
 	// Excluding certain boards...
325
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
326
-		$exclude_boards = array($modSettings['recycle_board']);
327
-	else
328
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
348
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
349
+			$exclude_boards = array($modSettings['recycle_board']);
350
+	} else {
351
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
352
+	}
329 353
 
330 354
 	// What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter.
331 355
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
332 356
 	{
333 357
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
334
-	}
335
-	elseif ($include_boards != null)
358
+	} elseif ($include_boards != null)
336 359
 	{
337 360
 		$include_boards = array();
338 361
 	}
@@ -369,8 +392,9 @@  discard block
 block discarded – undo
369 392
 {
370 393
 	global $modSettings;
371 394
 
372
-	if (empty($post_ids))
373
-		return;
395
+	if (empty($post_ids)) {
396
+			return;
397
+	}
374 398
 
375 399
 	// Allow the user to request more than one - why not?
376 400
 	$post_ids = is_array($post_ids) ? $post_ids : array($post_ids);
@@ -405,8 +429,9 @@  discard block
 block discarded – undo
405 429
 	global $scripturl, $txt, $user_info;
406 430
 	global $modSettings, $smcFunc, $context;
407 431
 
408
-	if (!empty($modSettings['enable_likes']))
409
-		$context['can_like'] = allowedTo('likes_like');
432
+	if (!empty($modSettings['enable_likes'])) {
433
+			$context['can_like'] = allowedTo('likes_like');
434
+	}
410 435
 
411 436
 	// Find all the posts. Newer ones will have higher IDs.
412 437
 	$request = $smcFunc['db_query']('substring', '
@@ -472,12 +497,13 @@  discard block
 block discarded – undo
472 497
 		);
473 498
 
474 499
 		// Get the likes for each message.
475
-		if (!empty($modSettings['enable_likes']))
476
-			$posts[$row['id_msg']]['likes'] = array(
500
+		if (!empty($modSettings['enable_likes'])) {
501
+					$posts[$row['id_msg']]['likes'] = array(
477 502
 				'count' => $row['likes'],
478 503
 				'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])),
479 504
 				'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']),
480 505
 			);
506
+		}
481 507
 	}
482 508
 	$smcFunc['db_free_result']($request);
483 509
 
@@ -485,13 +511,14 @@  discard block
 block discarded – undo
485 511
 	call_integration_hook('integrate_ssi_queryPosts', array(&$posts));
486 512
 
487 513
 	// Just return it.
488
-	if ($output_method != 'echo' || empty($posts))
489
-		return $posts;
514
+	if ($output_method != 'echo' || empty($posts)) {
515
+			return $posts;
516
+	}
490 517
 
491 518
 	echo '
492 519
 		<table style="border: none" class="ssi_table">';
493
-	foreach ($posts as $post)
494
-		echo '
520
+	foreach ($posts as $post) {
521
+			echo '
495 522
 			<tr>
496 523
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
497 524
 					[', $post['board']['link'], ']
@@ -505,6 +532,7 @@  discard block
 block discarded – undo
505 532
 					', $post['time'], '
506 533
 				</td>
507 534
 			</tr>';
535
+	}
508 536
 	echo '
509 537
 		</table>';
510 538
 }
@@ -522,25 +550,26 @@  discard block
 block discarded – undo
522 550
 	global $settings, $scripturl, $txt, $user_info;
523 551
 	global $modSettings, $smcFunc, $context;
524 552
 
525
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
526
-		$exclude_boards = array($modSettings['recycle_board']);
527
-	else
528
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
553
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
554
+			$exclude_boards = array($modSettings['recycle_board']);
555
+	} else {
556
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
557
+	}
529 558
 
530 559
 	// Only some boards?.
531 560
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
532 561
 	{
533 562
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
534
-	}
535
-	elseif ($include_boards != null)
563
+	} elseif ($include_boards != null)
536 564
 	{
537 565
 		$output_method = $include_boards;
538 566
 		$include_boards = array();
539 567
 	}
540 568
 
541 569
 	$icon_sources = array();
542
-	foreach ($context['stable_icons'] as $icon)
543
-		$icon_sources[$icon] = 'images_url';
570
+	foreach ($context['stable_icons'] as $icon) {
571
+			$icon_sources[$icon] = 'images_url';
572
+	}
544 573
 
545 574
 	// Find all the posts in distinct topics.  Newer ones will have higher IDs.
546 575
 	$request = $smcFunc['db_query']('substring', '
@@ -565,13 +594,15 @@  discard block
 block discarded – undo
565 594
 		)
566 595
 	);
567 596
 	$topics = array();
568
-	while ($row = $smcFunc['db_fetch_assoc']($request))
569
-		$topics[$row['id_topic']] = $row;
597
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
598
+			$topics[$row['id_topic']] = $row;
599
+	}
570 600
 	$smcFunc['db_free_result']($request);
571 601
 
572 602
 	// Did we find anything? If not, bail.
573
-	if (empty($topics))
574
-		return array();
603
+	if (empty($topics)) {
604
+			return array();
605
+	}
575 606
 
576 607
 	$recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
577 608
 
@@ -599,21 +630,24 @@  discard block
 block discarded – undo
599 630
 	while ($row = $smcFunc['db_fetch_assoc']($request))
600 631
 	{
601 632
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
602
-		if ($smcFunc['strlen']($row['body']) > 128)
603
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
633
+		if ($smcFunc['strlen']($row['body']) > 128) {
634
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
635
+		}
604 636
 
605 637
 		// Censor the subject.
606 638
 		censorText($row['subject']);
607 639
 		censorText($row['body']);
608 640
 
609 641
 		// Recycled icon
610
-		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board'])
611
-			$row['icon'] = 'recycled';
642
+		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) {
643
+					$row['icon'] = 'recycled';
644
+		}
612 645
 
613
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
614
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
615
-		elseif (!isset($icon_sources[$row['icon']]))
616
-			$icon_sources[$row['icon']] = 'images_url';
646
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
647
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
648
+		} elseif (!isset($icon_sources[$row['icon']])) {
649
+					$icon_sources[$row['icon']] = 'images_url';
650
+		}
617 651
 
618 652
 		// Build the array.
619 653
 		$posts[] = array(
@@ -652,13 +686,14 @@  discard block
 block discarded – undo
652 686
 	call_integration_hook('integrate_ssi_recentTopics', array(&$posts));
653 687
 
654 688
 	// Just return it.
655
-	if ($output_method != 'echo' || empty($posts))
656
-		return $posts;
689
+	if ($output_method != 'echo' || empty($posts)) {
690
+			return $posts;
691
+	}
657 692
 
658 693
 	echo '
659 694
 		<table style="border: none" class="ssi_table">';
660
-	foreach ($posts as $post)
661
-		echo '
695
+	foreach ($posts as $post) {
696
+			echo '
662 697
 			<tr>
663 698
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
664 699
 					[', $post['board']['link'], ']
@@ -672,6 +707,7 @@  discard block
 block discarded – undo
672 707
 					', $post['time'], '
673 708
 				</td>
674 709
 			</tr>';
710
+	}
675 711
 	echo '
676 712
 		</table>';
677 713
 }
@@ -696,27 +732,30 @@  discard block
 block discarded – undo
696 732
 		)
697 733
 	);
698 734
 	$return = array();
699
-	while ($row = $smcFunc['db_fetch_assoc']($request))
700
-		$return[] = array(
735
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
736
+			$return[] = array(
701 737
 			'id' => $row['id_member'],
702 738
 			'name' => $row['real_name'],
703 739
 			'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
704 740
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
705 741
 			'posts' => $row['posts']
706 742
 		);
743
+	}
707 744
 	$smcFunc['db_free_result']($request);
708 745
 
709 746
 	// If mods want to do somthing with this list of members, let them do that now.
710 747
 	call_integration_hook('integrate_ssi_topPoster', array(&$return));
711 748
 
712 749
 	// Just return all the top posters.
713
-	if ($output_method != 'echo')
714
-		return $return;
750
+	if ($output_method != 'echo') {
751
+			return $return;
752
+	}
715 753
 
716 754
 	// Make a quick array to list the links in.
717 755
 	$temp_array = array();
718
-	foreach ($return as $member)
719
-		$temp_array[] = $member['link'];
756
+	foreach ($return as $member) {
757
+			$temp_array[] = $member['link'];
758
+	}
720 759
 
721 760
 	echo implode(', ', $temp_array);
722 761
 }
@@ -748,8 +787,8 @@  discard block
 block discarded – undo
748 787
 		)
749 788
 	);
750 789
 	$boards = array();
751
-	while ($row = $smcFunc['db_fetch_assoc']($request))
752
-		$boards[] = array(
790
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
791
+			$boards[] = array(
753 792
 			'id' => $row['id_board'],
754 793
 			'num_posts' => $row['num_posts'],
755 794
 			'num_topics' => $row['num_topics'],
@@ -758,14 +797,16 @@  discard block
 block discarded – undo
758 797
 			'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
759 798
 			'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'
760 799
 		);
800
+	}
761 801
 	$smcFunc['db_free_result']($request);
762 802
 
763 803
 	// If mods want to do somthing with this list of boards, let them do that now.
764 804
 	call_integration_hook('integrate_ssi_topBoards', array(&$boards));
765 805
 
766 806
 	// If we shouldn't output or have nothing to output, just jump out.
767
-	if ($output_method != 'echo' || empty($boards))
768
-		return $boards;
807
+	if ($output_method != 'echo' || empty($boards)) {
808
+			return $boards;
809
+	}
769 810
 
770 811
 	echo '
771 812
 		<table class="ssi_table">
@@ -774,13 +815,14 @@  discard block
 block discarded – undo
774 815
 				<th style="text-align: left">', $txt['board_topics'], '</th>
775 816
 				<th style="text-align: left">', $txt['posts'], '</th>
776 817
 			</tr>';
777
-	foreach ($boards as $sBoard)
778
-		echo '
818
+	foreach ($boards as $sBoard) {
819
+			echo '
779 820
 			<tr>
780 821
 				<td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '" class="new_posts">' . $txt['new'] . '</a>' : '', '</td>
781 822
 				<td style="text-align: right">', comma_format($sBoard['num_topics']), '</td>
782 823
 				<td style="text-align: right">', comma_format($sBoard['num_posts']), '</td>
783 824
 			</tr>';
825
+	}
784 826
 	echo '
785 827
 		</table>';
786 828
 }
@@ -813,12 +855,13 @@  discard block
 block discarded – undo
813 855
 			)
814 856
 		);
815 857
 		$topic_ids = array();
816
-		while ($row = $smcFunc['db_fetch_assoc']($request))
817
-			$topic_ids[] = $row['id_topic'];
858
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
859
+					$topic_ids[] = $row['id_topic'];
860
+		}
818 861
 		$smcFunc['db_free_result']($request);
862
+	} else {
863
+			$topic_ids = array();
819 864
 	}
820
-	else
821
-		$topic_ids = array();
822 865
 
823 866
 	$request = $smcFunc['db_query']('', '
824 867
 		SELECT m.subject, m.id_topic, t.num_views, t.num_replies
@@ -857,8 +900,9 @@  discard block
 block discarded – undo
857 900
 	// If mods want to do somthing with this list of topics, let them do that now.
858 901
 	call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type));
859 902
 
860
-	if ($output_method != 'echo' || empty($topics))
861
-		return $topics;
903
+	if ($output_method != 'echo' || empty($topics)) {
904
+			return $topics;
905
+	}
862 906
 
863 907
 	echo '
864 908
 		<table class="ssi_table">
@@ -867,8 +911,8 @@  discard block
 block discarded – undo
867 911
 				<th style="text-align: left">', $txt['views'], '</th>
868 912
 				<th style="text-align: left">', $txt['replies'], '</th>
869 913
 			</tr>';
870
-	foreach ($topics as $sTopic)
871
-		echo '
914
+	foreach ($topics as $sTopic) {
915
+			echo '
872 916
 			<tr>
873 917
 				<td style="text-align: left">
874 918
 					', $sTopic['link'], '
@@ -876,6 +920,7 @@  discard block
 block discarded – undo
876 920
 				<td style="text-align: right">', comma_format($sTopic['num_views']), '</td>
877 921
 				<td style="text-align: right">', comma_format($sTopic['num_replies']), '</td>
878 922
 			</tr>';
923
+	}
879 924
 	echo '
880 925
 		</table>';
881 926
 }
@@ -911,12 +956,13 @@  discard block
 block discarded – undo
911 956
 {
912 957
 	global $txt, $context;
913 958
 
914
-	if ($output_method == 'echo')
915
-		echo '
959
+	if ($output_method == 'echo') {
960
+			echo '
916 961
 	', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>';
917
-	else
918
-		return $context['common_stats']['latest_member'];
919
-}
962
+	} else {
963
+			return $context['common_stats']['latest_member'];
964
+	}
965
+	}
920 966
 
921 967
 /**
922 968
  * Fetches a random member.
@@ -965,8 +1011,9 @@  discard block
 block discarded – undo
965 1011
 	}
966 1012
 
967 1013
 	// Just to be sure put the random generator back to something... random.
968
-	if ($random_type != '')
969
-		mt_srand(time());
1014
+	if ($random_type != '') {
1015
+			mt_srand(time());
1016
+	}
970 1017
 
971 1018
 	return $result;
972 1019
 }
@@ -979,8 +1026,9 @@  discard block
 block discarded – undo
979 1026
  */
980 1027
 function ssi_fetchMember($member_ids = array(), $output_method = 'echo')
981 1028
 {
982
-	if (empty($member_ids))
983
-		return;
1029
+	if (empty($member_ids)) {
1030
+			return;
1031
+	}
984 1032
 
985 1033
 	// Can have more than one member if you really want...
986 1034
 	$member_ids = is_array($member_ids) ? $member_ids : array($member_ids);
@@ -1005,8 +1053,9 @@  discard block
 block discarded – undo
1005 1053
  */
1006 1054
 function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo')
1007 1055
 {
1008
-	if ($group_id === null)
1009
-		return;
1056
+	if ($group_id === null) {
1057
+			return;
1058
+	}
1010 1059
 
1011 1060
 	$query_where = '
1012 1061
 		id_group = {int:id_group}
@@ -1033,8 +1082,9 @@  discard block
 block discarded – undo
1033 1082
 {
1034 1083
 	global $smcFunc, $memberContext;
1035 1084
 
1036
-	if ($query_where === null)
1037
-		return;
1085
+	if ($query_where === null) {
1086
+			return;
1087
+	}
1038 1088
 
1039 1089
 	// Fetch the members in question.
1040 1090
 	$request = $smcFunc['db_query']('', '
@@ -1047,12 +1097,14 @@  discard block
 block discarded – undo
1047 1097
 		))
1048 1098
 	);
1049 1099
 	$members = array();
1050
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1051
-		$members[] = $row['id_member'];
1100
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1101
+			$members[] = $row['id_member'];
1102
+	}
1052 1103
 	$smcFunc['db_free_result']($request);
1053 1104
 
1054
-	if (empty($members))
1055
-		return array();
1105
+	if (empty($members)) {
1106
+			return array();
1107
+	}
1056 1108
 
1057 1109
 	// If mods want to do somthing with this list of members, let them do that now.
1058 1110
 	call_integration_hook('integrate_ssi_queryMembers', array(&$members));
@@ -1061,23 +1113,25 @@  discard block
 block discarded – undo
1061 1113
 	loadMemberData($members);
1062 1114
 
1063 1115
 	// Draw the table!
1064
-	if ($output_method == 'echo')
1065
-		echo '
1116
+	if ($output_method == 'echo') {
1117
+			echo '
1066 1118
 		<table style="border: none" class="ssi_table">';
1119
+	}
1067 1120
 
1068 1121
 	$query_members = array();
1069 1122
 	foreach ($members as $member)
1070 1123
 	{
1071 1124
 		// Load their context data.
1072
-		if (!loadMemberContext($member))
1073
-			continue;
1125
+		if (!loadMemberContext($member)) {
1126
+					continue;
1127
+		}
1074 1128
 
1075 1129
 		// Store this member's information.
1076 1130
 		$query_members[$member] = $memberContext[$member];
1077 1131
 
1078 1132
 		// Only do something if we're echo'ing.
1079
-		if ($output_method == 'echo')
1080
-			echo '
1133
+		if ($output_method == 'echo') {
1134
+					echo '
1081 1135
 			<tr>
1082 1136
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
1083 1137
 					', $query_members[$member]['link'], '
@@ -1085,12 +1139,14 @@  discard block
 block discarded – undo
1085 1139
 					<br>', $query_members[$member]['avatar']['image'], '
1086 1140
 				</td>
1087 1141
 			</tr>';
1142
+		}
1088 1143
 	}
1089 1144
 
1090 1145
 	// End the table if appropriate.
1091
-	if ($output_method == 'echo')
1092
-		echo '
1146
+	if ($output_method == 'echo') {
1147
+			echo '
1093 1148
 		</table>';
1149
+	}
1094 1150
 
1095 1151
 	// Send back the data.
1096 1152
 	return $query_members;
@@ -1105,8 +1161,9 @@  discard block
 block discarded – undo
1105 1161
 {
1106 1162
 	global $txt, $scripturl, $modSettings, $smcFunc;
1107 1163
 
1108
-	if (!allowedTo('view_stats'))
1109
-		return;
1164
+	if (!allowedTo('view_stats')) {
1165
+			return;
1166
+	}
1110 1167
 
1111 1168
 	$totals = array(
1112 1169
 		'members' => $modSettings['totalMembers'],
@@ -1135,8 +1192,9 @@  discard block
 block discarded – undo
1135 1192
 	// If mods want to do somthing with the board stats, let them do that now.
1136 1193
 	call_integration_hook('integrate_ssi_boardStats', array(&$totals));
1137 1194
 
1138
-	if ($output_method != 'echo')
1139
-		return $totals;
1195
+	if ($output_method != 'echo') {
1196
+			return $totals;
1197
+	}
1140 1198
 
1141 1199
 	echo '
1142 1200
 		', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br>
@@ -1165,8 +1223,8 @@  discard block
 block discarded – undo
1165 1223
 	call_integration_hook('integrate_ssi_whosOnline', array(&$return));
1166 1224
 
1167 1225
 	// Add some redundancy for backwards compatibility reasons.
1168
-	if ($output_method != 'echo')
1169
-		return $return + array(
1226
+	if ($output_method != 'echo') {
1227
+			return $return + array(
1170 1228
 			'users' => $return['users_online'],
1171 1229
 			'guests' => $return['num_guests'],
1172 1230
 			'hidden' => $return['num_users_hidden'],
@@ -1174,29 +1232,35 @@  discard block
 block discarded – undo
1174 1232
 			'num_users' => $return['num_users_online'],
1175 1233
 			'total_users' => $return['num_users_online'] + $return['num_guests'],
1176 1234
 		);
1235
+	}
1177 1236
 
1178 1237
 	echo '
1179 1238
 		', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
1180 1239
 
1181 1240
 	$bracketList = array();
1182
-	if (!empty($user_info['buddies']))
1183
-		$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1184
-	if (!empty($return['num_spiders']))
1185
-		$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1186
-	if (!empty($return['num_users_hidden']))
1187
-		$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1241
+	if (!empty($user_info['buddies'])) {
1242
+			$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1243
+	}
1244
+	if (!empty($return['num_spiders'])) {
1245
+			$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1246
+	}
1247
+	if (!empty($return['num_users_hidden'])) {
1248
+			$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1249
+	}
1188 1250
 
1189
-	if (!empty($bracketList))
1190
-		echo ' (' . implode(', ', $bracketList) . ')';
1251
+	if (!empty($bracketList)) {
1252
+			echo ' (' . implode(', ', $bracketList) . ')';
1253
+	}
1191 1254
 
1192 1255
 	echo '<br>
1193 1256
 			', implode(', ', $return['list_users_online']);
1194 1257
 
1195 1258
 	// Showing membergroups?
1196
-	if (!empty($settings['show_group_key']) && !empty($return['membergroups']))
1197
-		echo '<br>
1259
+	if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) {
1260
+			echo '<br>
1198 1261
 			[' . implode(']&nbsp;&nbsp;[', $return['membergroups']) . ']';
1199
-}
1262
+	}
1263
+	}
1200 1264
 
1201 1265
 /**
1202 1266
  * Just like whosOnline except it also logs the online presence.
@@ -1207,11 +1271,12 @@  discard block
 block discarded – undo
1207 1271
 {
1208 1272
 	writeLog();
1209 1273
 
1210
-	if ($output_method != 'echo')
1211
-		return ssi_whosOnline($output_method);
1212
-	else
1213
-		ssi_whosOnline($output_method);
1214
-}
1274
+	if ($output_method != 'echo') {
1275
+			return ssi_whosOnline($output_method);
1276
+	} else {
1277
+			ssi_whosOnline($output_method);
1278
+	}
1279
+	}
1215 1280
 
1216 1281
 // Shows a login box.
1217 1282
 /**
@@ -1224,11 +1289,13 @@  discard block
 block discarded – undo
1224 1289
 {
1225 1290
 	global $scripturl, $txt, $user_info, $context;
1226 1291
 
1227
-	if ($redirect_to != '')
1228
-		$_SESSION['login_url'] = $redirect_to;
1292
+	if ($redirect_to != '') {
1293
+			$_SESSION['login_url'] = $redirect_to;
1294
+	}
1229 1295
 
1230
-	if ($output_method != 'echo' || !$user_info['is_guest'])
1231
-		return $user_info['is_guest'];
1296
+	if ($output_method != 'echo' || !$user_info['is_guest']) {
1297
+			return $user_info['is_guest'];
1298
+	}
1232 1299
 
1233 1300
 	// Create a login token
1234 1301
 	createToken('login');
@@ -1280,8 +1347,9 @@  discard block
 block discarded – undo
1280 1347
 
1281 1348
 	$boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote'));
1282 1349
 
1283
-	if (empty($boardsAllowed))
1284
-		return array();
1350
+	if (empty($boardsAllowed)) {
1351
+			return array();
1352
+	}
1285 1353
 
1286 1354
 	$request = $smcFunc['db_query']('', '
1287 1355
 		SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time
@@ -1314,12 +1382,14 @@  discard block
 block discarded – undo
1314 1382
 	$smcFunc['db_free_result']($request);
1315 1383
 
1316 1384
 	// This user has voted on all the polls.
1317
-	if (empty($row) || !is_array($row))
1318
-		return array();
1385
+	if (empty($row) || !is_array($row)) {
1386
+			return array();
1387
+	}
1319 1388
 
1320 1389
 	// If this is a guest who's voted we'll through ourselves to show poll to show the results.
1321
-	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))))
1322
-		return ssi_showPoll($row['id_topic'], $output_method);
1390
+	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) {
1391
+			return ssi_showPoll($row['id_topic'], $output_method);
1392
+	}
1323 1393
 
1324 1394
 	$request = $smcFunc['db_query']('', '
1325 1395
 		SELECT COUNT(DISTINCT id_member)
@@ -1383,8 +1453,9 @@  discard block
 block discarded – undo
1383 1453
 	// If mods want to do somthing with this list of polls, let them do that now.
1384 1454
 	call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead));
1385 1455
 
1386
-	if ($output_method != 'echo')
1387
-		return $return;
1456
+	if ($output_method != 'echo') {
1457
+			return $return;
1458
+	}
1388 1459
 
1389 1460
 	if ($allow_view_results)
1390 1461
 	{
@@ -1393,19 +1464,20 @@  discard block
 block discarded – undo
1393 1464
 			<strong>', $return['question'], '</strong><br>
1394 1465
 			', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1395 1466
 
1396
-		foreach ($return['options'] as $option)
1397
-			echo '
1467
+		foreach ($return['options'] as $option) {
1468
+					echo '
1398 1469
 			<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1470
+		}
1399 1471
 
1400 1472
 		echo '
1401 1473
 			<input type="submit" value="', $txt['poll_vote'], '" class="button">
1402 1474
 			<input type="hidden" name="poll" value="', $return['id'], '">
1403 1475
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1404 1476
 		</form>';
1477
+	} else {
1478
+			echo $txt['poll_cannot_see'];
1479
+	}
1405 1480
 	}
1406
-	else
1407
-		echo $txt['poll_cannot_see'];
1408
-}
1409 1481
 
1410 1482
 /**
1411 1483
  * Shows the poll from the specified topic
@@ -1419,13 +1491,15 @@  discard block
 block discarded – undo
1419 1491
 
1420 1492
 	$boardsAllowed = boardsAllowedTo('poll_view');
1421 1493
 
1422
-	if (empty($boardsAllowed))
1423
-		return array();
1494
+	if (empty($boardsAllowed)) {
1495
+			return array();
1496
+	}
1424 1497
 
1425
-	if ($topic === null && isset($_REQUEST['ssi_topic']))
1426
-		$topic = (int) $_REQUEST['ssi_topic'];
1427
-	else
1428
-		$topic = (int) $topic;
1498
+	if ($topic === null && isset($_REQUEST['ssi_topic'])) {
1499
+			$topic = (int) $_REQUEST['ssi_topic'];
1500
+	} else {
1501
+			$topic = (int) $topic;
1502
+	}
1429 1503
 
1430 1504
 	$request = $smcFunc['db_query']('', '
1431 1505
 		SELECT
@@ -1446,17 +1520,18 @@  discard block
 block discarded – undo
1446 1520
 	);
1447 1521
 
1448 1522
 	// Either this topic has no poll, or the user cannot view it.
1449
-	if ($smcFunc['db_num_rows']($request) == 0)
1450
-		return array();
1523
+	if ($smcFunc['db_num_rows']($request) == 0) {
1524
+			return array();
1525
+	}
1451 1526
 
1452 1527
 	$row = $smcFunc['db_fetch_assoc']($request);
1453 1528
 	$smcFunc['db_free_result']($request);
1454 1529
 
1455 1530
 	// Check if they can vote.
1456 1531
 	$already_voted = false;
1457
-	if (!empty($row['expire_time']) && $row['expire_time'] < time())
1458
-		$allow_vote = false;
1459
-	elseif ($user_info['is_guest'])
1532
+	if (!empty($row['expire_time']) && $row['expire_time'] < time()) {
1533
+			$allow_vote = false;
1534
+	} elseif ($user_info['is_guest'])
1460 1535
 	{
1461 1536
 		// There's a difference between "allowed to vote" and "already voted"...
1462 1537
 		$allow_vote = $row['guest_vote'];
@@ -1466,10 +1541,9 @@  discard block
 block discarded – undo
1466 1541
 		{
1467 1542
 			$already_voted = true;
1468 1543
 		}
1469
-	}
1470
-	elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board']))
1471
-		$allow_vote = false;
1472
-	else
1544
+	} elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) {
1545
+			$allow_vote = false;
1546
+	} else
1473 1547
 	{
1474 1548
 		$request = $smcFunc['db_query']('', '
1475 1549
 			SELECT id_member
@@ -1551,8 +1625,9 @@  discard block
 block discarded – undo
1551 1625
 	// If mods want to do somthing with this poll, let them do that now.
1552 1626
 	call_integration_hook('integrate_ssi_showPoll', array(&$return));
1553 1627
 
1554
-	if ($output_method != 'echo')
1555
-		return $return;
1628
+	if ($output_method != 'echo') {
1629
+			return $return;
1630
+	}
1556 1631
 
1557 1632
 	if ($return['allow_vote'])
1558 1633
 	{
@@ -1561,17 +1636,17 @@  discard block
 block discarded – undo
1561 1636
 				<strong>', $return['question'], '</strong><br>
1562 1637
 				', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1563 1638
 
1564
-		foreach ($return['options'] as $option)
1565
-			echo '
1639
+		foreach ($return['options'] as $option) {
1640
+					echo '
1566 1641
 				<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1642
+		}
1567 1643
 
1568 1644
 		echo '
1569 1645
 				<input type="submit" value="', $txt['poll_vote'], '" class="button">
1570 1646
 				<input type="hidden" name="poll" value="', $return['id'], '">
1571 1647
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1572 1648
 			</form>';
1573
-	}
1574
-	else
1649
+	} else
1575 1650
 	{
1576 1651
 		echo '
1577 1652
 			<div class="ssi_poll">
@@ -1651,27 +1726,32 @@  discard block
 block discarded – undo
1651 1726
 			'is_approved' => 1,
1652 1727
 		)
1653 1728
 	);
1654
-	if ($smcFunc['db_num_rows']($request) == 0)
1655
-		die;
1729
+	if ($smcFunc['db_num_rows']($request) == 0) {
1730
+			die;
1731
+	}
1656 1732
 	$row = $smcFunc['db_fetch_assoc']($request);
1657 1733
 	$smcFunc['db_free_result']($request);
1658 1734
 
1659
-	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time']))
1660
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1735
+	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) {
1736
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1737
+	}
1661 1738
 
1662 1739
 	// Too many options checked?
1663
-	if (count($_REQUEST['options']) > $row['max_votes'])
1664
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1740
+	if (count($_REQUEST['options']) > $row['max_votes']) {
1741
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1742
+	}
1665 1743
 
1666 1744
 	// It's a guest who has already voted?
1667 1745
 	if ($user_info['is_guest'])
1668 1746
 	{
1669 1747
 		// Guest voting disabled?
1670
-		if (!$row['guest_vote'])
1671
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1748
+		if (!$row['guest_vote']) {
1749
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1750
+		}
1672 1751
 		// Already voted?
1673
-		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))
1674
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1752
+		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) {
1753
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1754
+		}
1675 1755
 	}
1676 1756
 
1677 1757
 	$sOptions = array();
@@ -1725,11 +1805,13 @@  discard block
 block discarded – undo
1725 1805
 {
1726 1806
 	global $scripturl, $txt, $context;
1727 1807
 
1728
-	if (!allowedTo('search_posts'))
1729
-		return;
1808
+	if (!allowedTo('search_posts')) {
1809
+			return;
1810
+	}
1730 1811
 
1731
-	if ($output_method != 'echo')
1732
-		return $scripturl . '?action=search';
1812
+	if ($output_method != 'echo') {
1813
+			return $scripturl . '?action=search';
1814
+	}
1733 1815
 
1734 1816
 	echo '
1735 1817
 		<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
@@ -1751,8 +1833,9 @@  discard block
 block discarded – undo
1751 1833
 	// If mods want to do somthing with the news, let them do that now. Don't need to pass the news line itself, since it is already in $context.
1752 1834
 	call_integration_hook('integrate_ssi_news');
1753 1835
 
1754
-	if ($output_method != 'echo')
1755
-		return $context['random_news_line'];
1836
+	if ($output_method != 'echo') {
1837
+			return $context['random_news_line'];
1838
+	}
1756 1839
 
1757 1840
 	echo $context['random_news_line'];
1758 1841
 }
@@ -1766,8 +1849,9 @@  discard block
 block discarded – undo
1766 1849
 {
1767 1850
 	global $scripturl, $modSettings, $user_info;
1768 1851
 
1769
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view'))
1770
-		return;
1852
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) {
1853
+			return;
1854
+	}
1771 1855
 
1772 1856
 	$eventOptions = array(
1773 1857
 		'include_birthdays' => true,
@@ -1778,13 +1862,15 @@  discard block
 block discarded – undo
1778 1862
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1779 1863
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1780 1864
 
1781
-	if ($output_method != 'echo')
1782
-		return $return['calendar_birthdays'];
1865
+	if ($output_method != 'echo') {
1866
+			return $return['calendar_birthdays'];
1867
+	}
1783 1868
 
1784
-	foreach ($return['calendar_birthdays'] as $member)
1785
-		echo '
1869
+	foreach ($return['calendar_birthdays'] as $member) {
1870
+			echo '
1786 1871
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');
1787
-}
1872
+	}
1873
+	}
1788 1874
 
1789 1875
 /**
1790 1876
  * Shows today's holidays.
@@ -1795,8 +1881,9 @@  discard block
 block discarded – undo
1795 1881
 {
1796 1882
 	global $modSettings, $user_info;
1797 1883
 
1798
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1799
-		return;
1884
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1885
+			return;
1886
+	}
1800 1887
 
1801 1888
 	$eventOptions = array(
1802 1889
 		'include_holidays' => true,
@@ -1807,8 +1894,9 @@  discard block
 block discarded – undo
1807 1894
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1808 1895
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1809 1896
 
1810
-	if ($output_method != 'echo')
1811
-		return $return['calendar_holidays'];
1897
+	if ($output_method != 'echo') {
1898
+			return $return['calendar_holidays'];
1899
+	}
1812 1900
 
1813 1901
 	echo '
1814 1902
 		', implode(', ', $return['calendar_holidays']);
@@ -1822,8 +1910,9 @@  discard block
 block discarded – undo
1822 1910
 {
1823 1911
 	global $modSettings, $user_info;
1824 1912
 
1825
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1826
-		return;
1913
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1914
+			return;
1915
+	}
1827 1916
 
1828 1917
 	$eventOptions = array(
1829 1918
 		'include_events' => true,
@@ -1834,14 +1923,16 @@  discard block
 block discarded – undo
1834 1923
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1835 1924
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1836 1925
 
1837
-	if ($output_method != 'echo')
1838
-		return $return['calendar_events'];
1926
+	if ($output_method != 'echo') {
1927
+			return $return['calendar_events'];
1928
+	}
1839 1929
 
1840 1930
 	foreach ($return['calendar_events'] as $event)
1841 1931
 	{
1842
-		if ($event['can_edit'])
1843
-			echo '
1932
+		if ($event['can_edit']) {
1933
+					echo '
1844 1934
 	<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1935
+		}
1845 1936
 		echo '
1846 1937
 	' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1847 1938
 	}
@@ -1856,8 +1947,9 @@  discard block
 block discarded – undo
1856 1947
 {
1857 1948
 	global $modSettings, $txt, $scripturl, $user_info;
1858 1949
 
1859
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1860
-		return;
1950
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1951
+			return;
1952
+	}
1861 1953
 
1862 1954
 	$eventOptions = array(
1863 1955
 		'include_birthdays' => allowedTo('profile_view'),
@@ -1870,19 +1962,22 @@  discard block
 block discarded – undo
1870 1962
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1871 1963
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1872 1964
 
1873
-	if ($output_method != 'echo')
1874
-		return $return;
1965
+	if ($output_method != 'echo') {
1966
+			return $return;
1967
+	}
1875 1968
 
1876
-	if (!empty($return['calendar_holidays']))
1877
-		echo '
1969
+	if (!empty($return['calendar_holidays'])) {
1970
+			echo '
1878 1971
 			<span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>';
1972
+	}
1879 1973
 	if (!empty($return['calendar_birthdays']))
1880 1974
 	{
1881 1975
 		echo '
1882 1976
 			<span class="birthday">' . $txt['birthdays_upcoming'] . '</span> ';
1883
-		foreach ($return['calendar_birthdays'] as $member)
1884
-			echo '
1977
+		foreach ($return['calendar_birthdays'] as $member) {
1978
+					echo '
1885 1979
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : '';
1980
+		}
1886 1981
 		echo '
1887 1982
 			<br>';
1888 1983
 	}
@@ -1892,9 +1987,10 @@  discard block
 block discarded – undo
1892 1987
 			<span class="event">' . $txt['events_upcoming'] . '</span> ';
1893 1988
 		foreach ($return['calendar_events'] as $event)
1894 1989
 		{
1895
-			if ($event['can_edit'])
1896
-				echo '
1990
+			if ($event['can_edit']) {
1991
+							echo '
1897 1992
 			<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1993
+			}
1898 1994
 			echo '
1899 1995
 			' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1900 1996
 		}
@@ -1918,25 +2014,29 @@  discard block
 block discarded – undo
1918 2014
 	loadLanguage('Stats');
1919 2015
 
1920 2016
 	// Must be integers....
1921
-	if ($limit === null)
1922
-		$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1923
-	else
1924
-		$limit = (int) $limit;
1925
-
1926
-	if ($start === null)
1927
-		$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1928
-	else
1929
-		$start = (int) $start;
1930
-
1931
-	if ($board !== null)
1932
-		$board = (int) $board;
1933
-	elseif (isset($_GET['board']))
1934
-		$board = (int) $_GET['board'];
1935
-
1936
-	if ($length === null)
1937
-		$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1938
-	else
1939
-		$length = (int) $length;
2017
+	if ($limit === null) {
2018
+			$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
2019
+	} else {
2020
+			$limit = (int) $limit;
2021
+	}
2022
+
2023
+	if ($start === null) {
2024
+			$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
2025
+	} else {
2026
+			$start = (int) $start;
2027
+	}
2028
+
2029
+	if ($board !== null) {
2030
+			$board = (int) $board;
2031
+	} elseif (isset($_GET['board'])) {
2032
+			$board = (int) $_GET['board'];
2033
+	}
2034
+
2035
+	if ($length === null) {
2036
+			$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
2037
+	} else {
2038
+			$length = (int) $length;
2039
+	}
1940 2040
 
1941 2041
 	$limit = max(0, $limit);
1942 2042
 	$start = max(0, $start);
@@ -1954,17 +2054,19 @@  discard block
 block discarded – undo
1954 2054
 	);
1955 2055
 	if ($smcFunc['db_num_rows']($request) == 0)
1956 2056
 	{
1957
-		if ($output_method == 'echo')
1958
-			die($txt['ssi_no_guests']);
1959
-		else
1960
-			return array();
2057
+		if ($output_method == 'echo') {
2058
+					die($txt['ssi_no_guests']);
2059
+		} else {
2060
+					return array();
2061
+		}
1961 2062
 	}
1962 2063
 	list ($board) = $smcFunc['db_fetch_row']($request);
1963 2064
 	$smcFunc['db_free_result']($request);
1964 2065
 
1965 2066
 	$icon_sources = array();
1966
-	foreach ($context['stable_icons'] as $icon)
1967
-		$icon_sources[$icon] = 'images_url';
2067
+	foreach ($context['stable_icons'] as $icon) {
2068
+			$icon_sources[$icon] = 'images_url';
2069
+	}
1968 2070
 
1969 2071
 	if (!empty($modSettings['enable_likes']))
1970 2072
 	{
@@ -1987,12 +2089,14 @@  discard block
 block discarded – undo
1987 2089
 		)
1988 2090
 	);
1989 2091
 	$posts = array();
1990
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1991
-		$posts[] = $row['id_first_msg'];
2092
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2093
+			$posts[] = $row['id_first_msg'];
2094
+	}
1992 2095
 	$smcFunc['db_free_result']($request);
1993 2096
 
1994
-	if (empty($posts))
1995
-		return array();
2097
+	if (empty($posts)) {
2098
+			return array();
2099
+	}
1996 2100
 
1997 2101
 	// Find the posts.
1998 2102
 	$request = $smcFunc['db_query']('', '
@@ -2022,26 +2126,30 @@  discard block
 block discarded – undo
2022 2126
 			$last_space = strrpos($row['body'], ' ');
2023 2127
 			$last_open = strrpos($row['body'], '<');
2024 2128
 			$last_close = strrpos($row['body'], '>');
2025
-			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6)
2026
-				$cutoff = $last_open;
2027
-			elseif (empty($last_close) || $last_close < $last_open)
2028
-				$cutoff = $last_space;
2129
+			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) {
2130
+							$cutoff = $last_open;
2131
+			} elseif (empty($last_close) || $last_close < $last_open) {
2132
+							$cutoff = $last_space;
2133
+			}
2029 2134
 
2030
-			if ($cutoff !== false)
2031
-				$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2135
+			if ($cutoff !== false) {
2136
+							$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2137
+			}
2032 2138
 			$row['body'] .= '...';
2033 2139
 		}
2034 2140
 
2035 2141
 		$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
2036 2142
 
2037
-		if (!empty($recycle_board) && $row['id_board'] == $recycle_board)
2038
-			$row['icon'] = 'recycled';
2143
+		if (!empty($recycle_board) && $row['id_board'] == $recycle_board) {
2144
+					$row['icon'] = 'recycled';
2145
+		}
2039 2146
 
2040 2147
 		// Check that this message icon is there...
2041
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
2042
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2043
-		elseif (!isset($icon_sources[$row['icon']]))
2044
-			$icon_sources[$row['icon']] = 'images_url';
2148
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
2149
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2150
+		} elseif (!isset($icon_sources[$row['icon']])) {
2151
+					$icon_sources[$row['icon']] = 'images_url';
2152
+		}
2045 2153
 
2046 2154
 		censorText($row['subject']);
2047 2155
 		censorText($row['body']);
@@ -2078,16 +2186,18 @@  discard block
 block discarded – undo
2078 2186
 	}
2079 2187
 	$smcFunc['db_free_result']($request);
2080 2188
 
2081
-	if (empty($return))
2082
-		return $return;
2189
+	if (empty($return)) {
2190
+			return $return;
2191
+	}
2083 2192
 
2084 2193
 	$return[count($return) - 1]['is_last'] = true;
2085 2194
 
2086 2195
 	// If mods want to do somthing with this list of posts, let them do that now.
2087 2196
 	call_integration_hook('integrate_ssi_boardNews', array(&$return));
2088 2197
 
2089
-	if ($output_method != 'echo')
2090
-		return $return;
2198
+	if ($output_method != 'echo') {
2199
+			return $return;
2200
+	}
2091 2201
 
2092 2202
 	foreach ($return as $news)
2093 2203
 	{
@@ -2139,9 +2249,10 @@  discard block
 block discarded – undo
2139 2249
 		echo '
2140 2250
 			</div>';
2141 2251
 
2142
-		if (!$news['is_last'])
2143
-			echo '
2252
+		if (!$news['is_last']) {
2253
+					echo '
2144 2254
 			<hr>';
2255
+		}
2145 2256
 	}
2146 2257
 }
2147 2258
 
@@ -2155,8 +2266,9 @@  discard block
 block discarded – undo
2155 2266
 {
2156 2267
 	global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc;
2157 2268
 
2158
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
2159
-		return;
2269
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
2270
+			return;
2271
+	}
2160 2272
 
2161 2273
 	// Find all events which are happening in the near future that the member can see.
2162 2274
 	$request = $smcFunc['db_query']('', '
@@ -2182,20 +2294,23 @@  discard block
 block discarded – undo
2182 2294
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2183 2295
 	{
2184 2296
 		// Check if we've already come by an event linked to this same topic with the same title... and don't display it if we have.
2185
-		if (!empty($duplicates[$row['title'] . $row['id_topic']]))
2186
-			continue;
2297
+		if (!empty($duplicates[$row['title'] . $row['id_topic']])) {
2298
+					continue;
2299
+		}
2187 2300
 
2188 2301
 		// Censor the title.
2189 2302
 		censorText($row['title']);
2190 2303
 
2191
-		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false)))
2192
-			$date = strftime('%Y-%m-%d', forum_time(false));
2193
-		else
2194
-			$date = $row['start_date'];
2304
+		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) {
2305
+					$date = strftime('%Y-%m-%d', forum_time(false));
2306
+		} else {
2307
+					$date = $row['start_date'];
2308
+		}
2195 2309
 
2196 2310
 		// If the topic it is attached to is not approved then don't link it.
2197
-		if (!empty($row['id_first_msg']) && !$row['approved'])
2198
-			$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2311
+		if (!empty($row['id_first_msg']) && !$row['approved']) {
2312
+					$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2313
+		}
2199 2314
 
2200 2315
 		$allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false;
2201 2316
 
@@ -2221,24 +2336,27 @@  discard block
 block discarded – undo
2221 2336
 	}
2222 2337
 	$smcFunc['db_free_result']($request);
2223 2338
 
2224
-	foreach ($return as $mday => $array)
2225
-		$return[$mday][count($array) - 1]['is_last'] = true;
2339
+	foreach ($return as $mday => $array) {
2340
+			$return[$mday][count($array) - 1]['is_last'] = true;
2341
+	}
2226 2342
 
2227 2343
 	// If mods want to do somthing with this list of events, let them do that now.
2228 2344
 	call_integration_hook('integrate_ssi_recentEvents', array(&$return));
2229 2345
 
2230
-	if ($output_method != 'echo' || empty($return))
2231
-		return $return;
2346
+	if ($output_method != 'echo' || empty($return)) {
2347
+			return $return;
2348
+	}
2232 2349
 
2233 2350
 	// Well the output method is echo.
2234 2351
 	echo '
2235 2352
 			<span class="event">' . $txt['events'] . '</span> ';
2236
-	foreach ($return as $mday => $array)
2237
-		foreach ($array as $event)
2353
+	foreach ($return as $mday => $array) {
2354
+			foreach ($array as $event)
2238 2355
 		{
2239 2356
 			if ($event['can_edit'])
2240 2357
 				echo '
2241 2358
 				<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
2359
+	}
2242 2360
 
2243 2361
 			echo '
2244 2362
 				' . $event['link'] . (!$event['is_last'] ? ', ' : '');
@@ -2257,8 +2375,9 @@  discard block
 block discarded – undo
2257 2375
 	global $smcFunc;
2258 2376
 
2259 2377
 	// If $id is null, this was most likely called from a query string and should do nothing.
2260
-	if ($id === null)
2261
-		return;
2378
+	if ($id === null) {
2379
+			return;
2380
+	}
2262 2381
 
2263 2382
 	$request = $smcFunc['db_query']('', '
2264 2383
 		SELECT passwd, member_name, is_activated
@@ -2290,8 +2409,9 @@  discard block
 block discarded – undo
2290 2409
 	$attachments_boards = boardsAllowedTo('view_attachments');
2291 2410
 
2292 2411
 	// No boards?  Adios amigo.
2293
-	if (empty($attachments_boards))
2294
-		return array();
2412
+	if (empty($attachments_boards)) {
2413
+			return array();
2414
+	}
2295 2415
 
2296 2416
 	// Is it an array?
2297 2417
 	$attachment_ext = (array) $attachment_ext;
@@ -2375,8 +2495,9 @@  discard block
 block discarded – undo
2375 2495
 	call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments));
2376 2496
 
2377 2497
 	// So you just want an array?  Here you can have it.
2378
-	if ($output_method == 'array' || empty($attachments))
2379
-		return $attachments;
2498
+	if ($output_method == 'array' || empty($attachments)) {
2499
+			return $attachments;
2500
+	}
2380 2501
 
2381 2502
 	// Give them the default.
2382 2503
 	echo '
@@ -2387,14 +2508,15 @@  discard block
 block discarded – undo
2387 2508
 				<th style="text-align: left; padding: 2">', $txt['downloads'], '</th>
2388 2509
 				<th style="text-align: left; padding: 2">', $txt['filesize'], '</th>
2389 2510
 			</tr>';
2390
-	foreach ($attachments as $attach)
2391
-		echo '
2511
+	foreach ($attachments as $attach) {
2512
+			echo '
2392 2513
 			<tr>
2393 2514
 				<td>', $attach['file']['link'], '</td>
2394 2515
 				<td>', $attach['member']['link'], '</td>
2395 2516
 				<td style="text-align: center">', $attach['file']['downloads'], '</td>
2396 2517
 				<td>', $attach['file']['filesize'], '</td>
2397 2518
 			</tr>';
2519
+	}
2398 2520
 	echo '
2399 2521
 		</table>';
2400 2522
 }
Please login to merge, or discard this patch.
Themes/default/GenericControls.template.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@
 block discarded – undo
227 227
  * @param int|string $verify_id The verification control ID
228 228
  * @param string $display_type What type to display. Can be 'single' to only show one verification option or 'all' to show all of them
229 229
  * @param bool $reset Whether to reset the internal tracking counter
230
- * @return bool False if there's nothing else to show, true if $display_type is 'single', nothing otherwise
230
+ * @return boolean|null False if there's nothing else to show, true if $display_type is 'single', nothing otherwise
231 231
  */
232 232
 function template_control_verification($verify_id, $display_type = 'all', $reset = false)
233 233
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -300,7 +300,7 @@
 block discarded – undo
300 300
 				echo '
301 301
 				<div class="g-recaptcha centertext" data-sitekey="' . $verify_context['recaptcha_site_key'] . '" data-theme="' . $verify_context['recaptcha_theme'] . '"></div>
302 302
 				<br>
303
-				<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang.'"></script>';
303
+				<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang . '"></script>';
304 304
 			}
305 305
 		}
306 306
 		else
Please login to merge, or discard this patch.
Braces   +74 added lines, -54 removed lines patch added patch discarded remove patch
@@ -23,11 +23,13 @@  discard block
 block discarded – undo
23 23
 
24 24
 	$editor_context = &$context['controls']['richedit'][$editor_id];
25 25
 
26
-	if ($smileyContainer === null)
27
-		$editor_context['sce_options']['emoticonsEnabled'] = false;
26
+	if ($smileyContainer === null) {
27
+			$editor_context['sce_options']['emoticonsEnabled'] = false;
28
+	}
28 29
 
29
-	if ($bbcContainer === null)
30
-		$editor_context['sce_options']['toolbar'] = '';
30
+	if ($bbcContainer === null) {
31
+			$editor_context['sce_options']['toolbar'] = '';
32
+	}
31 33
 
32 34
 	echo '
33 35
 		<textarea class="editor" name="', $editor_id, '" id="', $editor_id, '" cols="600" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '" style="width: ', $editor_context['width'], '; height: ', $editor_context['height'], ';', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? 'border: 1px solid red;' : '', '"', !empty($context['editor']['required']) ? ' required' : '', '>', $editor_context['value'], '</textarea>
@@ -40,18 +42,21 @@  discard block
 block discarded – undo
40 42
 				var textarea = $("#', $editor_id, '").get(0);
41 43
 				sceditor.create(textarea, ', $smcFunc['json_encode']($editor_context['sce_options'], JSON_PRETTY_PRINT), ');';
42 44
 
43
-	if ($editor_context['sce_options']['emoticonsEnabled'])
44
-		echo '
45
+	if ($editor_context['sce_options']['emoticonsEnabled']) {
46
+			echo '
45 47
 				sceditor.instance(textarea).createPermanentDropDown();';
48
+	}
46 49
 
47
-	if (empty($editor_context['rich_active']))
48
-		echo '
50
+	if (empty($editor_context['rich_active'])) {
51
+			echo '
49 52
 				sceditor.instance(textarea).toggleSourceMode();';
53
+	}
50 54
 
51
-	if (isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']))
52
-		echo '
55
+	if (isset($context['post_error']['no_message']) || isset($context['post_error']['long_message'])) {
56
+			echo '
53 57
 				$(".sceditor-container").find("textarea").each(function() {$(this).css({border: "1px solid red"})});
54 58
 				$(".sceditor-container").find("iframe").each(function() {$(this).css({border: "1px solid red"})});';
59
+	}
55 60
 
56 61
 	echo '
57 62
 			});';
@@ -88,42 +93,47 @@  discard block
 block discarded – undo
88 93
 
89 94
 	$tempTab = $context['tabindex'];
90 95
 
91
-	if (!empty($context['drafts_pm_save']))
92
-		$tempTab++;
93
-	elseif (!empty($context['drafts_save']))
94
-		$tempTab++;
95
-	elseif ($editor_context['preview_type'])
96
-		$tempTab++;
97
-	elseif ($context['show_spellchecking'])
98
-		$tempTab++;
96
+	if (!empty($context['drafts_pm_save'])) {
97
+			$tempTab++;
98
+	} elseif (!empty($context['drafts_save'])) {
99
+			$tempTab++;
100
+	} elseif ($editor_context['preview_type']) {
101
+			$tempTab++;
102
+	} elseif ($context['show_spellchecking']) {
103
+			$tempTab++;
104
+	}
99 105
 
100 106
 	$tempTab++;
101 107
 	$context['tabindex'] = $tempTab;
102 108
 
103
-	if (!empty($context['drafts_pm_save']))
104
-		echo '
109
+	if (!empty($context['drafts_pm_save'])) {
110
+			echo '
105 111
 		<input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button">
106 112
 		<input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">';
113
+	}
107 114
 
108
-	if (!empty($context['drafts_save']))
109
-		echo '
115
+	if (!empty($context['drafts_save'])) {
116
+			echo '
110 117
 		<input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" class="button">
111 118
 		<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '">';
119
+	}
112 120
 
113
-	if ($context['show_spellchecking'])
114
-		echo '
121
+	if ($context['show_spellchecking']) {
122
+			echo '
115 123
 		<input type="button" value="', $txt['spell_check'], '" tabindex="', --$tempTab, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button">';
124
+	}
116 125
 
117
-	if ($editor_context['preview_type'])
118
-		echo '
126
+	if ($editor_context['preview_type']) {
127
+			echo '
119 128
 		<input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', --$tempTab, '" onclick="', $editor_context['preview_type'] == 2 ? '' : 'return submitThisOnce(this);', '" accesskey="p" class="button">';
129
+	}
120 130
 
121 131
 	echo '
122 132
 		<input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" name="post" tabindex="', --$tempTab, '" onclick="return submitThisOnce(this);" accesskey="s" class="button">';
123 133
 
124 134
 	// Load in the PM autosaver if it's enabled
125
-	if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave']))
126
-		echo '
135
+	if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) {
136
+			echo '
127 137
 		<span class="righttext padding" style="display: block">
128 138
 			<span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"></span>
129 139
 			<span id="draft_lastautosave" ></span>
@@ -141,10 +151,11 @@  discard block
 block discarded – undo
141 151
 				iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), '
142 152
 			});
143 153
 		</script>';
154
+	}
144 155
 
145 156
 	// Start an instance of the auto saver if its enabled
146
-	if (!empty($context['drafts_save']) && !empty($context['drafts_autosave']))
147
-		echo '
157
+	if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) {
158
+			echo '
148 159
 		<span class="righttext padding" style="display: block">
149 160
 			<span id="throbber" style="display:none"><img src="', $settings['images_url'], '/loading_sm.gif" alt="" class="centericon"></span>
150 161
 			<span id="draft_lastautosave" ></span>
@@ -161,7 +172,8 @@  discard block
 block discarded – undo
161 172
 				iFreq: ', $context['drafts_autosave_frequency'], '
162 173
 			});
163 174
 		</script>';
164
-}
175
+	}
176
+	}
165 177
 
166 178
 /**
167 179
  * This template displays a verification form
@@ -178,51 +190,57 @@  discard block
 block discarded – undo
178 190
 	$verify_context = &$context['controls']['verification'][$verify_id];
179 191
 
180 192
 	// Keep track of where we are.
181
-	if (empty($verify_context['tracking']) || $reset)
182
-		$verify_context['tracking'] = 0;
193
+	if (empty($verify_context['tracking']) || $reset) {
194
+			$verify_context['tracking'] = 0;
195
+	}
183 196
 
184 197
 	// How many items are there to display in total.
185 198
 	$total_items = count($verify_context['questions']) + ($verify_context['show_visual'] || $verify_context['can_recaptcha'] ? 1 : 0);
186 199
 
187 200
 	// If we've gone too far, stop.
188
-	if ($verify_context['tracking'] > $total_items)
189
-		return false;
201
+	if ($verify_context['tracking'] > $total_items) {
202
+			return false;
203
+	}
190 204
 
191 205
 	// Loop through each item to show them.
192 206
 	for ($i = 0; $i < $total_items; $i++)
193 207
 	{
194 208
 		// If we're after a single item only show it if we're in the right place.
195
-		if ($display_type == 'single' && $verify_context['tracking'] != $i)
196
-			continue;
209
+		if ($display_type == 'single' && $verify_context['tracking'] != $i) {
210
+					continue;
211
+		}
197 212
 
198
-		if ($display_type != 'single')
199
-			echo '
213
+		if ($display_type != 'single') {
214
+					echo '
200 215
 			<div id="verification_control_', $i, '" class="verification_control">';
216
+		}
201 217
 
202 218
 		// Display empty field, but only if we have one, and it's the first time.
203
-		if ($verify_context['empty_field'] && empty($i))
204
-			echo '
219
+		if ($verify_context['empty_field'] && empty($i)) {
220
+					echo '
205 221
 				<div class="smalltext vv_special">
206 222
 					', $txt['visual_verification_hidden'], ':
207 223
 					<input type="text" name="', $_SESSION[$verify_id . '_vv']['empty_field'], '" autocomplete="off" size="30" value="">
208 224
 				</div>';
225
+		}
209 226
 
210 227
 		// Do the actual stuff
211 228
 		if ($i == 0 && ($verify_context['show_visual'] || $verify_context['can_recaptcha']))
212 229
 		{
213 230
 			if ($verify_context['show_visual'])
214 231
 			{
215
-				if ($context['use_graphic_library'])
216
-					echo '
232
+				if ($context['use_graphic_library']) {
233
+									echo '
217 234
 				<img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '">';
218
-				else
219
-					echo '
235
+				} else {
236
+									echo '
220 237
 				<img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1">
221 238
 				<img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2">
222 239
 				<img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3">
223 240
 				<img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4">
224 241
 				<img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5">
225 242
 				<img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6">';
243
+				}
226 244
 
227 245
 				echo '
228 246
 				<div class="smalltext" style="margin: 4px 0 8px 0;">
@@ -240,8 +258,7 @@  discard block
 block discarded – undo
240 258
 				<br>
241 259
 				<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang.'"></script>';
242 260
 			}
243
-		}
244
-		else
261
+		} else
245 262
 		{
246 263
 			// Where in the question array is this question?
247 264
 			$qIndex = $verify_context['show_visual'] ? $i - 1 : $i;
@@ -253,21 +270,24 @@  discard block
 block discarded – undo
253 270
 				</div>';
254 271
 		}
255 272
 
256
-		if ($display_type != 'single')
257
-			echo '
273
+		if ($display_type != 'single') {
274
+					echo '
258 275
 			</div><!-- #verification_control_[i] -->';
276
+		}
259 277
 
260 278
 		// If we were displaying just one and we did it, break.
261
-		if ($display_type == 'single' && $verify_context['tracking'] == $i)
262
-			break;
279
+		if ($display_type == 'single' && $verify_context['tracking'] == $i) {
280
+					break;
281
+		}
263 282
 	}
264 283
 
265 284
 	// Assume we found something, always.
266 285
 	$verify_context['tracking']++;
267 286
 
268 287
 	// Tell something displaying piecemeal to keep going.
269
-	if ($display_type == 'single')
270
-		return true;
271
-}
288
+	if ($display_type == 'single') {
289
+			return true;
290
+	}
291
+	}
272 292
 
273 293
 ?>
274 294
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/Packages.template.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1096,7 +1096,7 @@
 block discarded – undo
1096 1096
 /**
1097 1097
  * CHMOD control form
1098 1098
  *
1099
- * @return bool False if nothing to do.
1099
+ * @return false|null False if nothing to do.
1100 1100
  */
1101 1101
 function template_control_chmod()
1102 1102
 {
Please login to merge, or discard this patch.
Braces   +175 added lines, -128 removed lines patch added patch discarded remove patch
@@ -30,25 +30,27 @@  discard block
 block discarded – undo
30 30
 		</div>
31 31
 		<div class="information">';
32 32
 
33
-	if ($context['is_installed'])
34
-		echo '
33
+	if ($context['is_installed']) {
34
+			echo '
35 35
 			<strong>', $txt['package_installed_warning1'], '</strong><br>
36 36
 			<br>
37 37
 			', $txt['package_installed_warning2'], '<br>
38 38
 			<br>';
39
+	}
39 40
 
40 41
 	echo $txt['package_installed_warning3'], '
41 42
 		</div>
42 43
 		<br>';
43 44
 
44 45
 	// Do errors exist in the install? If so light them up like a christmas tree.
45
-	if ($context['has_failure'])
46
-		echo '
46
+	if ($context['has_failure']) {
47
+			echo '
47 48
 		<div class="errorbox">
48 49
 			', sprintf($txt['package_will_fail_title'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]), '<br>
49 50
 			', sprintf($txt['package_will_fail_warning'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]),
50 51
 			!empty($context['failure_details']) ? '<br><br><strong>' . $context['failure_details'] . '</strong>' : '', '
51 52
 		</div>';
53
+	}
52 54
 
53 55
 	// Display the package readme if one exists
54 56
 	if (isset($context['package_readme']))
@@ -62,9 +64,10 @@  discard block
 block discarded – undo
62 64
 			<span class="floatright">', $txt['package_available_readme_language'], '
63 65
 				<select name="readme_language" id="readme_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', ';package=', $context['filename'], ';readme=\' + this.options[this.selectedIndex].value + \';license=\' + get_selected(\'license_language\'));">';
64 66
 
65
-		foreach ($context['readmes'] as $a => $b)
66
-			echo '
67
+		foreach ($context['readmes'] as $a => $b) {
68
+					echo '
67 69
 					<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>';
70
+		}
68 71
 
69 72
 		echo '
70 73
 				</select>
@@ -85,9 +88,10 @@  discard block
 block discarded – undo
85 88
 			<span class="floatright">', $txt['package_available_license_language'], '
86 89
 				<select name="license_language" id="license_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=install', ';package=', $context['filename'], ';license=\' + this.options[this.selectedIndex].value + \';readme=\' + get_selected(\'readme_language\'));">';
87 90
 
88
-		foreach ($context['licenses'] as $a => $b)
89
-			echo '
91
+		foreach ($context['licenses'] as $a => $b) {
92
+					echo '
90 93
 					<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>';
94
+		}
91 95
 		echo '
92 96
 				</select>
93 97
 			</span>
@@ -114,9 +118,10 @@  discard block
 block discarded – undo
114 118
 					', $txt['package_db_uninstall_actions'], ':
115 119
 					<ul>';
116 120
 
117
-		foreach ($context['database_changes'] as $change)
118
-			echo '
121
+		foreach ($context['database_changes'] as $change) {
122
+					echo '
119 123
 						<li>', $change, '</li>';
124
+		}
120 125
 
121 126
 		echo '
122 127
 					</ul>
@@ -127,14 +132,14 @@  discard block
 block discarded – undo
127 132
 	echo '
128 133
 			<div class="information">';
129 134
 
130
-	if (empty($context['actions']) && empty($context['database_changes']))
131
-		echo '
135
+	if (empty($context['actions']) && empty($context['database_changes'])) {
136
+			echo '
132 137
 				<br>
133 138
 				<div class="errorbox">
134 139
 					', $txt['corrupt_compatible'], '
135 140
 				</div>
136 141
 			</div><!-- .information -->';
137
-	else
142
+	} else
138 143
 	{
139 144
 		echo '
140 145
 				', $txt['perform_actions'], '
@@ -238,9 +243,10 @@  discard block
 block discarded – undo
238 243
 						<td></td>
239 244
 						<td>';
240 245
 
241
-				if (!empty($context['themes_locked']))
242
-					echo '
246
+				if (!empty($context['themes_locked'])) {
247
+									echo '
243 248
 							<input type="hidden" name="custom_theme[]" value="', $id, '">';
249
+				}
244 250
 				echo '
245 251
 							<input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" onclick="', (!empty($theme['has_failure']) ? 'if (this.form.custom_theme_' . $id . '.checked && !confirm(\'' . $txt['package_theme_failure_warning'] . '\')) return false;' : ''), 'invertAll(this, this.form, \'dummy_theme_', $id, '\', true);"', !empty($context['themes_locked']) ? ' disabled checked' : '', '>
246 252
 						</td>
@@ -306,21 +312,23 @@  discard block
 block discarded – undo
306 312
 	}
307 313
 
308 314
 	// Are we effectively ready to install?
309
-	if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes'])))
310
-		echo '
315
+	if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes']))) {
316
+			echo '
311 317
 			<div class="righttext padding">
312 318
 				<input type="submit" value="', $context['uninstalling'] ? $txt['package_uninstall_now'] : $txt['package_install_now'], '" onclick="return ', !empty($context['has_failure']) ? '(submitThisOnce(this) &amp;&amp; confirm(\'' . ($context['uninstalling'] ? $txt['package_will_fail_popup_uninstall'] : $txt['package_will_fail_popup']) . '\'))' : 'submitThisOnce(this)', ';" class="button">
313 319
 			</div>';
320
+	}
314 321
 
315 322
 	// If we need ftp information then demand it!
316
-	elseif ($context['ftp_needed'])
317
-		echo '
323
+	elseif ($context['ftp_needed']) {
324
+			echo '
318 325
 			<div class="cat_bar">
319 326
 				<h3 class="catbg">', $txt['package_ftp_necessary'], '</h3>
320 327
 			</div>
321 328
 			<div>
322 329
 				', template_control_chmod(), '
323 330
 			</div>';
331
+	}
324 332
 
325 333
 	echo '
326 334
 
@@ -336,8 +344,8 @@  discard block
 block discarded – undo
336 344
 	// Operations.
337 345
 	if (!empty($js_operations))
338 346
 	{
339
-		foreach ($js_operations as $key => $operation)
340
-			echo '
347
+		foreach ($js_operations as $key => $operation) {
348
+					echo '
341 349
 		aOperationElements[', $key, '] = new smc_Toggle({
342 350
 			bToggleEnabled: true,
343 351
 			bNoAnimate: true,
@@ -355,6 +363,7 @@  discard block
 block discarded – undo
355 363
 				}
356 364
 			]
357 365
 		});';
366
+		}
358 367
 	}
359 368
 
360 369
 	echo '
@@ -376,14 +385,15 @@  discard block
 block discarded – undo
376 385
 	</script>';
377 386
 
378 387
 	// And a bit more for database changes.
379
-	if (!empty($context['database_changes']))
380
-		echo '
388
+	if (!empty($context['database_changes'])) {
389
+			echo '
381 390
 	<script>
382 391
 		var database_changes_area = document.getElementById(\'db_changes_div\');
383 392
 		var db_vis = false;
384 393
 		database_changes_area.classList.add(\'hidden\');
385 394
 	</script>';
386
-}
395
+	}
396
+	}
387 397
 
388 398
 /**
389 399
  * Extract package contents
@@ -392,8 +402,8 @@  discard block
 block discarded – undo
392 402
 {
393 403
 	global $context, $txt, $scripturl;
394 404
 
395
-	if (!empty($context['redirect_url']))
396
-		echo '
405
+	if (!empty($context['redirect_url'])) {
406
+			echo '
397 407
 	<script>
398 408
 		setTimeout("doRedirect();", ', empty($context['redirect_timeout']) ? '5000' : $context['redirect_timeout'], ');
399 409
 
@@ -402,49 +412,48 @@  discard block
 block discarded – undo
402 412
 			window.location = "', $context['redirect_url'], '";
403 413
 		}
404 414
 	</script>';
415
+	}
405 416
 
406
-	if (empty($context['redirect_url']))
407
-		echo '
417
+	if (empty($context['redirect_url'])) {
418
+			echo '
408 419
 		<div class="cat_bar">
409 420
 			<h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3>
410 421
 		</div>
411 422
 		<div class="information">', $txt['package_installed_extract'], '</div>';
412
-	else
413
-		echo '
423
+	} else {
424
+			echo '
414 425
 		<div class="cat_bar">
415 426
 			<h3 class="catbg">', $txt['package_installed_redirecting'], '</h3>
416 427
 		</div>';
428
+	}
417 429
 
418 430
 	echo '
419 431
 		<div class="windowbg">';
420 432
 
421 433
 	// If we are going to redirect we have a slightly different agenda.
422
-	if (!empty($context['redirect_url']))
423
-		echo '
434
+	if (!empty($context['redirect_url'])) {
435
+			echo '
424 436
 			', $context['redirect_text'], '<br><br>
425 437
 			<a href="', $context['redirect_url'], '">', $txt['package_installed_redirect_go_now'], '</a> | <a href="', $scripturl, '?action=admin;area=packages;sa=browse">', $txt['package_installed_redirect_cancel'], '</a>';
426
-
427
-	elseif ($context['uninstalling'])
428
-		echo '
438
+	} elseif ($context['uninstalling']) {
439
+			echo '
429 440
 			', $txt['package_uninstall_done'];
430
-
431
-	elseif ($context['install_finished'])
441
+	} elseif ($context['install_finished'])
432 442
 	{
433
-		if ($context['extract_type'] == 'avatar')
434
-			echo '
443
+		if ($context['extract_type'] == 'avatar') {
444
+					echo '
435 445
 			', $txt['avatars_extracted'];
436
-
437
-		elseif ($context['extract_type'] == 'language')
438
-			echo '
446
+		} elseif ($context['extract_type'] == 'language') {
447
+					echo '
439 448
 			', $txt['language_extracted'];
440
-
441
-		else
442
-			echo '
449
+		} else {
450
+					echo '
443 451
 			', $txt['package_installed_done'];
444
-	}
445
-	else
446
-		echo '
452
+		}
453
+	} else {
454
+			echo '
447 455
 			', $txt['corrupt_compatible'];
456
+	}
448 457
 
449 458
 	echo '
450 459
 		</div><!-- .windowbg -->';
@@ -474,9 +483,10 @@  discard block
 block discarded – undo
474 483
 		<div class="windowbg">
475 484
 			<ol>';
476 485
 
477
-	foreach ($context['files'] as $fileinfo)
478
-		echo '
486
+	foreach ($context['files'] as $fileinfo) {
487
+			echo '
479 488
 				<li><a href="', $scripturl, '?action=admin;area=packages;sa=examine;package=', $context['filename'], ';file=', $fileinfo['filename'], '" title="', $txt['view'], '">', $fileinfo['filename'], '</a> (', $fileinfo['size'], ' ', $txt['package_bytes'], ')</li>';
489
+	}
480 490
 
481 491
 	echo '
482 492
 			</ol>
@@ -536,9 +546,10 @@  discard block
 block discarded – undo
536 546
 			</script>
537 547
 			<div id="yourVersion" style="display:none">', $context['forum_version'], '</div>';
538 548
 
539
-	if (empty($modSettings['disable_smf_js']))
540
-		echo '
549
+	if (empty($modSettings['disable_smf_js'])) {
550
+			echo '
541 551
 			<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
552
+	}
542 553
 
543 554
 	// This sets the announcements and current versions themselves ;).
544 555
 	echo '
@@ -576,12 +587,13 @@  discard block
 block discarded – undo
576 587
 		}
577 588
 	}
578 589
 
579
-	if (!$mods_available)
580
-		echo '
590
+	if (!$mods_available) {
591
+			echo '
581 592
 		<div class="noticebox">', $txt['no_packages'], '</div>';
582
-	else
583
-		echo '
593
+	} else {
594
+			echo '
584 595
 		<br>';
596
+	}
585 597
 
586 598
 	// The advanced (emulation) box, collapsed by default
587 599
 	echo '
@@ -608,9 +620,10 @@  discard block
 block discarded – undo
608 620
 							<a id="revert" name="revert"></a>
609 621
 							<select name="version_emulate" id="ve">';
610 622
 
611
-	foreach ($context['emulation_versions'] as $version)
612
-		echo '
623
+	foreach ($context['emulation_versions'] as $version) {
624
+			echo '
613 625
 								<option value="', $version, '"', ($version == $context['selected_version'] ? ' selected="selected"' : ''), '>', $version, '</option>';
626
+	}
614 627
 
615 628
 	echo '
616 629
 							</select>
@@ -665,11 +678,12 @@  discard block
 block discarded – undo
665 678
 {
666 679
 	global $context, $txt, $scripturl;
667 680
 
668
-	if (!empty($context['package_ftp']['error']))
669
-		echo '
681
+	if (!empty($context['package_ftp']['error'])) {
682
+			echo '
670 683
 	<div class="errorbox">
671 684
 		<pre>', $context['package_ftp']['error'], '</pre>
672 685
 	</div>';
686
+	}
673 687
 
674 688
 	echo '
675 689
 	<div id="admin_form_wrapper">
@@ -752,13 +766,14 @@  discard block
 block discarded – undo
752 766
 					<legend>' . $txt['package_servers'] . '</legend>
753 767
 					<ul class="package_servers">';
754 768
 
755
-	foreach ($context['servers'] as $server)
756
-		echo '
769
+	foreach ($context['servers'] as $server) {
770
+			echo '
757 771
 						<li class="flow_auto">
758 772
 							<span class="floatleft">' . $server['name'] . '</span>
759 773
 							<span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=remove;server=' . $server['id'] . ';', $context['session_var'], '=', $context['session_id'], '">[ ' . $txt['delete'] . ' ]</a></span>
760 774
 							<span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span>
761 775
 						</li>';
776
+	}
762 777
 	echo '
763 778
 					</ul>
764 779
 				</fieldset>
@@ -842,11 +857,12 @@  discard block
 block discarded – undo
842 857
 		<div class="windowbg">';
843 858
 
844 859
 	// No packages, as yet.
845
-	if (empty($context['package_list']))
846
-		echo '
860
+	if (empty($context['package_list'])) {
861
+			echo '
847 862
 			<ul>
848 863
 				<li>', $txt['no_packages'], '</li>
849 864
 			</ul>';
865
+	}
850 866
 
851 867
 	// List out the packages...
852 868
 	else
@@ -860,11 +876,12 @@  discard block
 block discarded – undo
860 876
 				<li>
861 877
 					<strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>';
862 878
 
863
-			if (!empty($packageSection['text']))
864
-				echo '
879
+			if (!empty($packageSection['text'])) {
880
+							echo '
865 881
 					<div class="sub_bar">
866 882
 						<h3 class="subbg">', $packageSection['text'], '</h3>
867 883
 					</div>';
884
+			}
868 885
 
869 886
 			echo '
870 887
 					<', $context['list_type'], ' id="package_section_', $i, '" class="packages">';
@@ -875,24 +892,28 @@  discard block
 block discarded – undo
875 892
 						<li>';
876 893
 
877 894
 				// Textual message. Could be empty just for a blank line...
878
-				if ($package['is_text'])
879
-					echo '
895
+				if ($package['is_text']) {
896
+									echo '
880 897
 							', empty($package['name']) ? '&nbsp;' : $package['name'];
898
+				}
881 899
 
882 900
 				// This is supposed to be a rule..
883
-				elseif ($package['is_line'])
884
-					echo '
901
+				elseif ($package['is_line']) {
902
+									echo '
885 903
 							<hr>';
904
+				}
886 905
 
887 906
 				// A remote link.
888
-				elseif ($package['is_remote'])
889
-					echo '
907
+				elseif ($package['is_remote']) {
908
+									echo '
890 909
 							<strong>', $package['link'], '</strong>';
910
+				}
891 911
 
892 912
 				// A title?
893
-				elseif ($package['is_heading'] || $package['is_title'])
894
-					echo '
913
+				elseif ($package['is_heading'] || $package['is_title']) {
914
+									echo '
895 915
 							<strong>', $package['name'], '</strong>';
916
+				}
896 917
 
897 918
 				// Otherwise, it's a package.
898 919
 				else
@@ -903,32 +924,36 @@  discard block
 block discarded – undo
903 924
 						<ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">';
904 925
 
905 926
 					// Show the mod type?
906
-					if ($package['type'] != '')
907
-						echo '
927
+					if ($package['type'] != '') {
928
+											echo '
908 929
 							<li class="package_section">
909 930
 								', $txt['package_type'], ':&nbsp; ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '
910 931
 							</li>';
932
+					}
911 933
 
912 934
 					// Show the version number?
913
-					if ($package['version'] != '')
914
-						echo '
935
+					if ($package['version'] != '') {
936
+											echo '
915 937
 							<li class="package_section">
916 938
 								', $txt['mod_version'], ':&nbsp; ', $package['version'], '
917 939
 							</li>';
940
+					}
918 941
 
919 942
 					// How 'bout the author?
920
-					if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link']))
921
-						echo '
943
+					if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) {
944
+											echo '
922 945
 							<li class="package_section">
923 946
 								', $txt['mod_author'], ':&nbsp; ', $package['author']['link'], '
924 947
 							</li>';
948
+					}
925 949
 
926 950
 					// The homepage...
927
-					if ($package['author']['website']['link'] != '')
928
-						echo '
951
+					if ($package['author']['website']['link'] != '') {
952
+											echo '
929 953
 							<li class="package_section">
930 954
 								', $txt['author_website'], ':&nbsp; ', $package['author']['website']['link'], '
931 955
 							</li>';
956
+					}
932 957
 
933 958
 					// Description: bleh bleh!
934 959
 					// Location of file: http://someplace/.
@@ -986,8 +1011,8 @@  discard block
 block discarded – undo
986 1011
 
987 1012
 			foreach ($ps['items'] as $id => $package)
988 1013
 			{
989
-				if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote'])
990
-					echo '
1014
+				if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) {
1015
+									echo '
991 1016
 		var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({
992 1017
 			bToggleEnabled: true,
993 1018
 			bCurrentlyCollapsed: true,
@@ -1002,6 +1027,7 @@  discard block
 block discarded – undo
1002 1027
 				}
1003 1028
 			]
1004 1029
 		});';
1030
+				}
1005 1031
 			}
1006 1032
 		}
1007 1033
 
@@ -1044,9 +1070,10 @@  discard block
 block discarded – undo
1044 1070
 {
1045 1071
 	global $context, $txt, $scripturl;
1046 1072
 
1047
-	if (!empty($context['saved_successful']))
1048
-		echo '
1073
+	if (!empty($context['saved_successful'])) {
1074
+			echo '
1049 1075
 	<div class="infobox">', $txt['settings_saved'], '</div>';
1076
+	}
1050 1077
 
1051 1078
 	echo '
1052 1079
 		<div class="cat_bar">
@@ -1106,8 +1133,9 @@  discard block
 block discarded – undo
1106 1133
 	global $context, $txt;
1107 1134
 
1108 1135
 	// Nothing to do? Brilliant!
1109
-	if (empty($context['package_ftp']))
1110
-		return false;
1136
+	if (empty($context['package_ftp'])) {
1137
+			return false;
1138
+	}
1111 1139
 
1112 1140
 	if (empty($context['package_ftp']['form_elements_only']))
1113 1141
 	{
@@ -1117,19 +1145,21 @@  discard block
 block discarded – undo
1117 1145
 					', $txt['package_ftp_why_file_list'], '
1118 1146
 					<ul style="display: inline;">';
1119 1147
 
1120
-		if (!empty($context['notwritable_files']))
1121
-			foreach ($context['notwritable_files'] as $file)
1148
+		if (!empty($context['notwritable_files'])) {
1149
+					foreach ($context['notwritable_files'] as $file)
1122 1150
 				echo '
1123 1151
 						<li>', $file, '</li>';
1152
+		}
1124 1153
 
1125 1154
 		echo '
1126 1155
 					</ul>';
1127 1156
 
1128
-		if (!$context['server']['is_windows'])
1129
-			echo '
1157
+		if (!$context['server']['is_windows']) {
1158
+					echo '
1130 1159
 					<hr>
1131 1160
 					', $txt['package_chmod_linux'], '<br>
1132 1161
 					<samp># chmod a+w ', implode(' ', $context['notwritable_files']), '</samp>';
1162
+		}
1133 1163
 
1134 1164
 		echo '
1135 1165
 				</div><!-- #need_writable_list -->';
@@ -1142,9 +1172,10 @@  discard block
 block discarded – undo
1142 1172
 					</div>
1143 1173
 				</div>';
1144 1174
 
1145
-	if (!empty($context['package_ftp']['destination']))
1146
-		echo '
1175
+	if (!empty($context['package_ftp']['destination'])) {
1176
+			echo '
1147 1177
 				<form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '">';
1178
+	}
1148 1179
 
1149 1180
 	echo '
1150 1181
 					<fieldset>
@@ -1178,24 +1209,27 @@  discard block
 block discarded – undo
1178 1209
 					</dl>
1179 1210
 					</fieldset>';
1180 1211
 
1181
-	if (empty($context['package_ftp']['form_elements_only']))
1182
-		echo '
1212
+	if (empty($context['package_ftp']['form_elements_only'])) {
1213
+			echo '
1183 1214
 					<div class="righttext" style="margin: 1ex;">
1184 1215
 						<span id="test_ftp_placeholder_full"></span>
1185 1216
 						<input type="submit" value="', $txt['package_proceed'], '" class="button">
1186 1217
 					</div>';
1218
+	}
1187 1219
 
1188
-	if (!empty($context['package_ftp']['destination']))
1189
-		echo '
1220
+	if (!empty($context['package_ftp']['destination'])) {
1221
+			echo '
1190 1222
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1191 1223
 				</form>';
1224
+	}
1192 1225
 
1193 1226
 	// Hide the details of the list.
1194
-	if (empty($context['package_ftp']['form_elements_only']))
1195
-		echo '
1227
+	if (empty($context['package_ftp']['form_elements_only'])) {
1228
+			echo '
1196 1229
 				<script>
1197 1230
 					document.getElementById(\'need_writable_list\').style.display = \'none\';
1198 1231
 				</script>';
1232
+	}
1199 1233
 
1200 1234
 	// Quick generate the test button.
1201 1235
 	echo '
@@ -1552,9 +1586,10 @@  discard block
 block discarded – undo
1552 1586
 					<td width="30%">
1553 1587
 						<strong>';
1554 1588
 
1555
-		if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
1556
-			echo '
1589
+		if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) {
1590
+					echo '
1557 1591
 							<span class="generic_icons folder"></span>';
1592
+		}
1558 1593
 
1559 1594
 		echo '
1560 1595
 							', $name, '
@@ -1581,8 +1616,9 @@  discard block
 block discarded – undo
1581 1616
 					</td>
1582 1617
 				</tr>';
1583 1618
 
1584
-		if (!empty($dir['contents']))
1585
-			template_permission_show_contents($name, $dir['contents'], 1);
1619
+		if (!empty($dir['contents'])) {
1620
+					template_permission_show_contents($name, $dir['contents'], 1);
1621
+		}
1586 1622
 	}
1587 1623
 
1588 1624
 	echo '
@@ -1618,13 +1654,14 @@  discard block
 block discarded – undo
1618 1654
 			</fieldset>';
1619 1655
 
1620 1656
 	// Likely to need FTP?
1621
-	if (empty($context['ftp_connected']))
1622
-		echo '
1657
+	if (empty($context['ftp_connected'])) {
1658
+			echo '
1623 1659
 			<p>
1624 1660
 				', $txt['package_file_perms_ftp_details'], ':
1625 1661
 			</p>
1626 1662
 			', template_control_chmod(), '
1627 1663
 			<div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>';
1664
+	}
1628 1665
 
1629 1666
 	echo '
1630 1667
 			<span id="test_ftp_placeholder_full"></span>
@@ -1633,9 +1670,10 @@  discard block
 block discarded – undo
1633 1670
 		</div><!-- .windowbg -->';
1634 1671
 
1635 1672
 	// Any looks fors we've already done?
1636
-	foreach ($context['look_for'] as $path)
1637
-		echo '
1673
+	foreach ($context['look_for'] as $path) {
1674
+			echo '
1638 1675
 		<input type="hidden" name="back_look[]" value="', $path, '">';
1676
+	}
1639 1677
 
1640 1678
 	echo '
1641 1679
 	</form>
@@ -1677,9 +1715,10 @@  discard block
 block discarded – undo
1677 1715
 					<td class="smalltext" width="30%">' . str_repeat('&nbsp;', $level * 5), '
1678 1716
 					', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '<a id="link_' . $cur_ident . '" href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident . '/' . $name) . ';back_look=' . $context['back_look_data'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . $cur_ident . '" onclick="return expandFolder(\'' . $cur_ident . '\', \'' . addcslashes($ident . '/' . $name, "'\\") . '\');">' : '';
1679 1717
 
1680
-			if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
1681
-				echo '
1718
+			if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) {
1719
+							echo '
1682 1720
 						<span class="generic_icons folder"></span>';
1721
+			}
1683 1722
 
1684 1723
 			echo '
1685 1724
 						', $name, '
@@ -1697,34 +1736,38 @@  discard block
 block discarded – undo
1697 1736
 				</tr>
1698 1737
 				<tr id="insert_div_loc_' . $cur_ident . '" style="display: none;"><td></td></tr>';
1699 1738
 
1700
-			if (!empty($dir['contents']))
1701
-				template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files']));
1739
+			if (!empty($dir['contents'])) {
1740
+							template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files']));
1741
+			}
1702 1742
 		}
1703 1743
 	}
1704 1744
 
1705 1745
 	// We have more files to show?
1706
-	if ($has_more)
1707
-		echo '
1746
+	if ($has_more) {
1747
+			echo '
1708 1748
 				<tr class="windowbg" id="content_', $js_ident, '_more">
1709 1749
 					<td class="smalltext" width="40%">' . str_repeat('&nbsp;', $level * 5), '
1710 1750
 						&#171; <a href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident) . ';fileoffset=', ($context['file_offset'] + $context['file_limit']), ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident) . '">', $txt['package_file_perms_more_files'], '</a> &#187;
1711 1751
 					</td>
1712 1752
 					<td colspan="6"></td>
1713 1753
 				</tr>';
1754
+	}
1714 1755
 
1715 1756
 	if ($drawn_div)
1716 1757
 	{
1717 1758
 		// Hide anything too far down the tree.
1718 1759
 		$isFound = false;
1719
-		foreach ($context['look_for'] as $tree)
1720
-			if (substr($tree, 0, strlen($ident)) == $ident)
1760
+		foreach ($context['look_for'] as $tree) {
1761
+					if (substr($tree, 0, strlen($ident)) == $ident)
1721 1762
 				$isFound = true;
1763
+		}
1722 1764
 
1723
-		if ($level > 1 && !$isFound)
1724
-			echo '
1765
+		if ($level > 1 && !$isFound) {
1766
+					echo '
1725 1767
 		<script>
1726 1768
 			expandFolder(\'', $js_ident, '\', \'\');
1727 1769
 		</script>';
1770
+		}
1728 1771
 	}
1729 1772
 }
1730 1773
 
@@ -1743,11 +1786,12 @@  discard block
 block discarded – undo
1743 1786
 				<h3 class="catbg">', $txt['package_file_perms_applying'], '</h3>
1744 1787
 			</div>';
1745 1788
 
1746
-	if (!empty($context['skip_ftp']))
1747
-		echo '
1789
+	if (!empty($context['skip_ftp'])) {
1790
+			echo '
1748 1791
 			<div class="errorbox">
1749 1792
 				', $txt['package_file_perms_skipping_ftp'], '
1750 1793
 			</div>';
1794
+	}
1751 1795
 
1752 1796
 	// How many have we done?
1753 1797
 	$remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']);
@@ -1785,28 +1829,31 @@  discard block
 block discarded – undo
1785 1829
 				<br>';
1786 1830
 
1787 1831
 	// Put out the right hidden data.
1788
-	if ($context['method'] == 'individual')
1789
-		echo '
1832
+	if ($context['method'] == 'individual') {
1833
+			echo '
1790 1834
 				<input type="hidden" name="custom_value" value="', $context['custom_value'], '">
1791 1835
 				<input type="hidden" name="totalItems" value="', $context['total_items'], '">
1792 1836
 				<input type="hidden" name="toProcess" value="', $context['to_process_encode'], '">';
1793
-	else
1794
-		echo '
1837
+	} else {
1838
+			echo '
1795 1839
 				<input type="hidden" name="predefined" value="', $context['predefined_type'], '">
1796 1840
 				<input type="hidden" name="fileOffset" value="', $context['file_offset'], '">
1797 1841
 				<input type="hidden" name="totalItems" value="', $context['total_items'], '">
1798 1842
 				<input type="hidden" name="dirList" value="', $context['directory_list_encode'], '">
1799 1843
 				<input type="hidden" name="specialFiles" value="', $context['special_files_encode'], '">';
1844
+	}
1800 1845
 
1801 1846
 	// Are we not using FTP for whatever reason.
1802
-	if (!empty($context['skip_ftp']))
1803
-		echo '
1847
+	if (!empty($context['skip_ftp'])) {
1848
+			echo '
1804 1849
 				<input type="hidden" name="skip_ftp" value="1">';
1850
+	}
1805 1851
 
1806 1852
 	// Retain state.
1807
-	foreach ($context['back_look_data'] as $path)
1808
-		echo '
1853
+	foreach ($context['back_look_data'] as $path) {
1854
+			echo '
1809 1855
 				<input type="hidden" name="back_look[]" value="', $path, '">';
1856
+	}
1810 1857
 
1811 1858
 	echo '
1812 1859
 				<input type="hidden" name="method" value="', $context['method'], '">
Please login to merge, or discard this patch.
Packages/backups/index.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Try to handle it with the upper level index.php. (it should know what to do.)
4
-if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
4
+if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) {
5 5
 	include (dirname(dirname(__FILE__)) . '/index.php');
6
-else
6
+} else {
7 7
 	exit;
8
+}
8 9
 
9 10
 ?>
10 11
\ No newline at end of file
Please login to merge, or discard this patch.
ssi_examples.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -583,8 +583,7 @@  discard block
 block discarded – undo
583 583
 	{
584 584
 		$header = '<?php require("' . ($user_info['is_admin'] ? addslashes(realpath($boarddir . '/SSI.php')) : 'SSI.php') . '"); ?>' . "\n" . $header;
585 585
 		return $header . template_homepage_sample1_html() . $footer;
586
-	}
587
-	else
586
+	} else
588 587
 	{
589 588
 		echo $header;
590 589
 		template_homepage_sample1_php();
@@ -599,9 +598,10 @@  discard block
 block discarded – undo
599 598
 
600 599
 	$topics = ssi_recentTopics(8, null, null, 'array');
601 600
 
602
-	foreach ($topics as $topic)
603
-		echo '
601
+	foreach ($topics as $topic) {
602
+			echo '
604 603
 			<li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>';
604
+	}
605 605
 
606 606
 	unset($topics);
607 607
 
Please login to merge, or discard this patch.
Themes/default/MoveTopic.template.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
 		foreach ($category['boards'] as $board)
41 41
 			echo '
42
-									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=&gt; ' : '', $board['name'], '</option>';
42
+									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt; ' : '', $board['name'], '</option>';
43 43
 		echo '
44 44
 								</optgroup>';
45 45
 	}
Please login to merge, or discard this patch.
Braces   +32 added lines, -23 removed lines patch added patch discarded remove patch
@@ -37,9 +37,10 @@  discard block
 block discarded – undo
37 37
 		echo '
38 38
 								<optgroup label="', $category['name'], '">';
39 39
 
40
-		foreach ($category['boards'] as $board)
41
-			echo '
40
+		foreach ($category['boards'] as $board) {
41
+					echo '
42 42
 									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=&gt; ' : '', $board['name'], '</option>';
43
+		}
43 44
 		echo '
44 45
 								</optgroup>';
45 46
 	}
@@ -70,9 +71,10 @@  discard block
 block discarded – undo
70 71
 				</div><!-- .move_topic -->
71 72
 			</div><!-- .windowbg -->';
72 73
 
73
-	if ($context['back_to_topic'])
74
-		echo '
74
+	if ($context['back_to_topic']) {
75
+			echo '
75 76
 			<input type="hidden" name="goback" value="1">';
77
+	}
76 78
 
77 79
 	echo '
78 80
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -125,10 +127,10 @@  discard block
 block discarded – undo
125 127
 									<option value="86400">', $txt['two_months'], '</option>
126 128
 								</select>
127 129
 							</dd>';
128
-	}
129
-	else
130
-		echo '
130
+	} else {
131
+			echo '
131 132
 							<input type="hidden" name="redirect_expires" value="0">';
133
+	}
132 134
 
133 135
 	echo '
134 136
 						</dl>
@@ -207,9 +209,10 @@  discard block
 block discarded – undo
207 209
 			echo '
208 210
 							<optgroup label="', $cat['name'], '">';
209 211
 
210
-			foreach ($cat['boards'] as $board)
211
-				echo '
212
+			foreach ($cat['boards'] as $board) {
213
+							echo '
212 214
 								<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '</option>';
215
+			}
213 216
 
214 217
 			echo '
215 218
 							</optgroup>';
@@ -219,9 +222,9 @@  discard block
 block discarded – undo
219 222
 						<input type="hidden" name="from" value="' . $context['origin_topic'] . '">
220 223
 						<input type="submit" value="', $txt['go'], '" class="button">
221 224
 					</form>';
225
+	} else {
226
+			echo $txt['target_below'];
222 227
 	}
223
-	else
224
-		echo $txt['target_below'];
225 228
 
226 229
 	echo '		</h4>
227 230
 			</div><!-- .title_bar -->
@@ -239,12 +242,13 @@  discard block
 block discarded – undo
239 242
 
240 243
 		$merge_button = create_button('merge', 'merge', '');
241 244
 
242
-		foreach ($context['topics'] as $topic)
243
-			echo '
245
+		foreach ($context['topics'] as $topic) {
246
+					echo '
244 247
 						<li>
245 248
 							<a href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a>
246 249
 							<a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank" rel="noopener">', $topic['subject'], '</a> ', $txt['started_by'], ' ', $topic['poster']['link'], '
247 250
 						</li>';
251
+		}
248 252
 
249 253
 		echo '
250 254
 					</ul>
@@ -255,9 +259,10 @@  discard block
 block discarded – undo
255 259
 				</div>';
256 260
 	}
257 261
 	// Just a nice "There aren't any topics" message
258
-	else
259
-		echo '
262
+	else {
263
+			echo '
260 264
 				<div class="windowbg">', $txt['topic_alert_none'], '</div>';
265
+	}
261 266
 
262 267
 	echo '
263 268
 				<br>
@@ -307,8 +312,8 @@  discard block
 block discarded – undo
307 312
 				</thead>
308 313
 				<tbody>';
309 314
 
310
-	foreach ($context['topics'] as $topic)
311
-		echo '
315
+	foreach ($context['topics'] as $topic) {
316
+			echo '
312 317
 					<tr class="windowbg">
313 318
 						<td>
314 319
 							<input type="checkbox" name="topics[]" value="' . $topic['id'] . '" checked>
@@ -328,6 +333,7 @@  discard block
 block discarded – undo
328 333
 							<input type="checkbox" name="notifications[]" value="' . $topic['id'] . '" checked>
329 334
 						</td>
330 335
 					</tr>';
336
+	}
331 337
 	echo '
332 338
 				</tbody>
333 339
 			</table>
@@ -337,9 +343,10 @@  discard block
 block discarded – undo
337 343
 					<legend>', $txt['merge_select_subject'], '</legend>
338 344
 					<select name="subject" onchange="this.form.custom_subject.style.display = (this.options[this.selectedIndex].value != 0) ? \'none\': \'\' ;">';
339 345
 
340
-	foreach ($context['topics'] as $topic)
341
-		echo '
346
+	foreach ($context['topics'] as $topic) {
347
+			echo '
342 348
 						<option value="', $topic['id'], '"' . ($topic['selected'] ? ' selected' : '') . '>', $topic['subject'], '</option>';
349
+	}
343 350
 	echo '
344 351
 						<option value="0">', $txt['merge_custom_subject'], ':</option>
345 352
 					</select>
@@ -358,11 +365,12 @@  discard block
 block discarded – undo
358 365
 					<legend>', $txt['merge_select_target_board'], '</legend>
359 366
 					<ul>';
360 367
 
361
-		foreach ($context['boards'] as $board)
362
-			echo '
368
+		foreach ($context['boards'] as $board) {
369
+					echo '
363 370
 						<li>
364 371
 							<input type="radio" name="board" value="' . $board['id'] . '"' . ($board['selected'] ? ' checked' : '') . '> ' . $board['name'] . '
365 372
 						</li>';
373
+		}
366 374
 		echo '
367 375
 					</ul>
368 376
 				</fieldset>';
@@ -374,11 +382,12 @@  discard block
 block discarded – undo
374 382
 					<legend>' . $txt['merge_select_poll'] . '</legend>
375 383
 					<ul>';
376 384
 
377
-		foreach ($context['polls'] as $poll)
378
-			echo '
385
+		foreach ($context['polls'] as $poll) {
386
+					echo '
379 387
 						<li>
380 388
 							<input type="radio" name="poll" value="' . $poll['id'] . '"' . ($poll['selected'] ? ' checked' : '') . '> ' . $poll['question'] . ' (' . $txt['topic'] . ': <a href="' . $scripturl . '?topic=' . $poll['topic']['id'] . '.0" target="_blank" rel="noopener">' . $poll['topic']['subject'] . '</a>)
381 389
 						</li>';
390
+		}
382 391
 		echo '
383 392
 						<li>
384 393
 							<input type="radio" name="poll" value="-1"> (' . $txt['merge_no_poll'] . ')
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	// Stick our "create a redirection topic" template in here...
66 66
 	template_redirect_options('move');
67 67
 
68
-    echo '
68
+	echo '
69 69
 					<input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button">
70 70
 				</div><!-- .move_topic -->
71 71
 			</div><!-- .windowbg -->';
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function template_redirect_options($type)
90 90
 {
91
-    global $txt, $context, $modSettings;
91
+	global $txt, $context, $modSettings;
92 92
 
93
-    echo '
93
+	echo '
94 94
 					<label for="postRedirect">
95 95
 						<input type="checkbox" name="postRedirect" id="postRedirect"', $context['is_approved'] ? ' checked' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt[$type . '_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').classList.toggle(\'hidden\');"> ', $txt['post_redirection'], '.
96 96
 					</label>
Please login to merge, or discard this patch.