Completed
Pull Request — release-2.1 (#4090)
by Rick
08:48
created
Themes/default/Calendar.template.php 1 patch
Braces   +152 added lines, -116 removed lines patch added patch discarded remove patch
@@ -40,16 +40,14 @@  discard block
 block discarded – undo
40 40
 				', template_show_upcoming_list('main'), '
41 41
 			</div>
42 42
 		';
43
-	}
44
-	elseif ($context['calendar_view'] == 'view_week')
43
+	} elseif ($context['calendar_view'] == 'view_week')
45 44
 	{
46 45
 		echo '
47 46
 			<div id="main_grid">
48 47
 				', template_show_week_grid('main'), '
49 48
 			</div>
50 49
 		';
51
-	}
52
-	else
50
+	} else
53 51
 	{
54 52
 		echo '
55 53
 			<div id="main_grid">
@@ -75,8 +73,9 @@  discard block
 block discarded – undo
75 73
 	global $context, $scripturl, $txt;
76 74
 
77 75
 	// Bail out if we have nothing to work with
78
-	if (!isset($context['calendar_grid_' . $grid_name]))
79
-		return false;
76
+	if (!isset($context['calendar_grid_' . $grid_name])) {
77
+			return false;
78
+	}
80 79
 
81 80
 	// Protect programmer sanity
82 81
 	$calendar_data = &$context['calendar_grid_' . $grid_name];
@@ -113,11 +112,13 @@  discard block
 block discarded – undo
113 112
 					<li class="windowbg">
114 113
 						<b class="event_title">', $event['link'], '</b>';
115 114
 
116
-				if ($event['can_edit'])
117
-					echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
115
+				if ($event['can_edit']) {
116
+									echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
117
+				}
118 118
 
119
-				if ($event['can_export'])
120
-					echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
119
+				if ($event['can_export']) {
120
+									echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
121
+				}
121 122
 
122 123
 				echo '
123 124
 						<br>';
@@ -125,14 +126,14 @@  discard block
 block discarded – undo
125 126
 				if (!empty($event['allday']))
126 127
 				{
127 128
 					echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : '';
128
-				}
129
-				else
129
+				} else
130 130
 				{
131 131
 					// Display event info relative to user's local timezone
132 132
 					echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
133 133
 
134
-					if ($event['start_date_local'] != $event['end_date_local'])
135
-						echo trim($event['end_date_local']) . ', ';
134
+					if ($event['start_date_local'] != $event['end_date_local']) {
135
+											echo trim($event['end_date_local']) . ', ';
136
+					}
136 137
 
137 138
 					echo trim($event['end_time_local']);
138 139
 
@@ -141,23 +142,27 @@  discard block
 block discarded – undo
141 142
 					{
142 143
 						echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">';
143 144
 
144
-						if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig'])
145
-							echo trim($event['start_date_orig']), ', ';
145
+						if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) {
146
+													echo trim($event['start_date_orig']), ', ';
147
+						}
146 148
 
147 149
 						echo trim($event['start_time_orig']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
148 150
 
149
-						if ($event['start_date_orig'] != $event['end_date_orig'])
150
-							echo trim($event['end_date_orig']) . ', ';
151
+						if ($event['start_date_orig'] != $event['end_date_orig']) {
152
+													echo trim($event['end_date_orig']) . ', ';
153
+						}
151 154
 
152 155
 						echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)';
153 156
 					}
154 157
 					// Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion
155
-					else
156
-						echo ' ', $event['tz_abbrev'], '</time>';
158
+					else {
159
+											echo ' ', $event['tz_abbrev'], '</time>';
160
+					}
157 161
 				}
158 162
 
159
-				if (!empty($event['location']))
160
-					echo '<br>', $event['location'];
163
+				if (!empty($event['location'])) {
164
+									echo '<br>', $event['location'];
165
+				}
161 166
 
162 167
 				echo '
163 168
 					</li>';
@@ -189,8 +194,9 @@  discard block
 block discarded – undo
189 194
 
190 195
 			$birthdays = array();
191 196
 
192
-			foreach ($date as $member)
193
-				$birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>';
197
+			foreach ($date as $member) {
198
+							$birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>';
199
+			}
194 200
 
195 201
 			echo implode(', ', $birthdays);
196 202
 
@@ -221,8 +227,9 @@  discard block
 block discarded – undo
221 227
 			$date_local = $date['date_local'];
222 228
 			unset($date['date_local']);
223 229
 
224
-			foreach ($date as $holiday)
225
-				$holidays[] = $holiday . ' (' . $date_local . ')';
230
+			foreach ($date as $holiday) {
231
+							$holidays[] = $holiday . ' (' . $date_local . ')';
232
+			}
226 233
 		}
227 234
 
228 235
 		echo implode(', ', $holidays);
@@ -245,17 +252,19 @@  discard block
 block discarded – undo
245 252
 	global $context, $txt, $scripturl, $modSettings;
246 253
 
247 254
 	// If the grid doesn't exist, no point in proceeding.
248
-	if (!isset($context['calendar_grid_' . $grid_name]))
249
-		return false;
255
+	if (!isset($context['calendar_grid_' . $grid_name])) {
256
+			return false;
257
+	}
250 258
 
251 259
 	// A handy little pointer variable.
252 260
 	$calendar_data = &$context['calendar_grid_' . $grid_name];
253 261
 
254 262
 	// Some conditions for whether or not we should show the week links *here*.
255
-	if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false)))
256
-		$show_week_links = true;
257
-	else
258
-		$show_week_links = false;
263
+	if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) {
264
+			$show_week_links = true;
265
+	} else {
266
+			$show_week_links = false;
267
+	}
259 268
 
260 269
 	// Assuming that we've not disabled it, show the title block!
261 270
 	if (empty($calendar_data['disable_title']))
@@ -294,8 +303,9 @@  discard block
 block discarded – undo
294 303
 	}
295 304
 
296 305
 	// Show the controls on main grids
297
-	if ($is_mini === false)
298
-		template_calendar_top($calendar_data);
306
+	if ($is_mini === false) {
307
+			template_calendar_top($calendar_data);
308
+	}
299 309
 
300 310
 	// Finally, the main calendar table.
301 311
 	echo '<table class="calendar_table">';
@@ -306,8 +316,9 @@  discard block
 block discarded – undo
306 316
 		echo '<tr>';
307 317
 
308 318
 		// If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared!
309
-		if ($show_week_links === true)
310
-			echo '<th>&nbsp;</th>';
319
+		if ($show_week_links === true) {
320
+					echo '<th>&nbsp;</th>';
321
+		}
311 322
 
312 323
 		// Now, loop through each actual day of the week.
313 324
 		foreach ($calendar_data['week_days'] as $day)
@@ -354,27 +365,29 @@  discard block
 block discarded – undo
354 365
 				// Additional classes are given for events, holidays, and birthdays.
355 366
 				if (!empty($day['events']) && !empty($calendar_data['highlight']['events']))
356 367
 				{
357
-					if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3)))
358
-						$classes[] = 'events';
359
-					elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3)))
360
-						$classes[] = 'events';
368
+					if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) {
369
+											$classes[] = 'events';
370
+					} elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) {
371
+											$classes[] = 'events';
372
+					}
361 373
 				}
362 374
 				if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays']))
363 375
 				{
364
-					if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3)))
365
-						$classes[] = 'holidays';
366
-					elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3)))
367
-						$classes[] = 'holidays';
376
+					if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) {
377
+											$classes[] = 'holidays';
378
+					} elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) {
379
+											$classes[] = 'holidays';
380
+					}
368 381
 				}
369 382
 				if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays']))
370 383
 				{
371
-					if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3)))
372
-						$classes[] = 'birthdays';
373
-					elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3)))
374
-						$classes[] = 'birthdays';
384
+					if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) {
385
+											$classes[] = 'birthdays';
386
+					} elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) {
387
+											$classes[] = 'birthdays';
388
+					}
375 389
 				}
376
-			}
377
-			else
390
+			} else
378 391
 			{
379 392
 				// Default Classes (either compact or comfortable and disabled).
380 393
 				$classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable';
@@ -392,17 +405,19 @@  discard block
 block discarded – undo
392 405
 				$title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : '';
393 406
 
394 407
 				// The actual day number - be it a link, or just plain old text!
395
-				if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
396
-					echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
397
-				else
398
-					echo '<span class="day_text">', $title_prefix, $day['day'], '</span>';
408
+				if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) {
409
+									echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
410
+				} else {
411
+									echo '<span class="day_text">', $title_prefix, $day['day'], '</span>';
412
+				}
399 413
 
400 414
 				// A lot of stuff, we're not showing on mini-calendars to conserve space.
401 415
 				if ($is_mini === false)
402 416
 				{
403 417
 					// Holidays are always fun, let's show them!
404
-					if (!empty($day['holidays']))
405
-						echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>';
418
+					if (!empty($day['holidays'])) {
419
+											echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>';
420
+					}
406 421
 
407 422
 					// Happy Birthday Dear, Member!
408 423
 					if (!empty($day['birthdays']))
@@ -420,14 +435,16 @@  discard block
 block discarded – undo
420 435
 							echo '<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'] || ($count == 10 && $use_js_hide) ? '' : ', ';
421 436
 
422 437
 							// 9...10! Let's stop there.
423
-							if ($birthday_count == 10 && $use_js_hide)
424
-								// !!TODO - Inline CSS and JavaScript should be moved.
438
+							if ($birthday_count == 10 && $use_js_hide) {
439
+															// !!TODO - Inline CSS and JavaScript should be moved.
425 440
 								echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, ';
441
+							}
426 442
 
427 443
 							++$birthday_count;
428 444
 						}
429
-						if ($use_js_hide)
430
-							echo '</span>';
445
+						if ($use_js_hide) {
446
+													echo '</span>';
447
+						}
431 448
 
432 449
 						echo '</div>';
433 450
 					}
@@ -437,8 +454,9 @@  discard block
 block discarded – undo
437 454
 					{
438 455
 						// Sort events by start time (all day events will be listed first)
439 456
 						uasort($day['events'], function($a, $b) {
440
-						    if ($a['start_timestamp'] == $b['start_timestamp'])
441
-						        return 0;
457
+						    if ($a['start_timestamp'] == $b['start_timestamp']) {
458
+						    						        return 0;
459
+						    }
442 460
 						    return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1;
443 461
 						});
444 462
 
@@ -454,17 +472,19 @@  discard block
 block discarded – undo
454 472
 
455 473
 							echo '<div class="event_wrapper', $event['starts_today'] == true ? ' event_starts_today' : '', $event['ends_today'] == true ? ' event_ends_today' : '', $event['allday'] == true ? ' allday' : '', $event['is_selected'] ? ' sel_event' : '', '">', $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">';
456 474
 
457
-							if (!empty($event['start_time_local']) && $event['starts_today'] == true)
458
-								echo trim(str_replace(':00 ', ' ', $event['start_time_local']));
459
-							elseif (!empty($event['end_time_local']) && $event['ends_today'] == true)
460
-								echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local']));
461
-							elseif (!empty($event['allday']))
462
-								echo $txt['calendar_allday'];
475
+							if (!empty($event['start_time_local']) && $event['starts_today'] == true) {
476
+															echo trim(str_replace(':00 ', ' ', $event['start_time_local']));
477
+							} elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) {
478
+															echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local']));
479
+							} elseif (!empty($event['allday'])) {
480
+															echo $txt['calendar_allday'];
481
+							}
463 482
 
464 483
 							echo '</span>';
465 484
 
466
-							if (!empty($event['location']))
467
-								echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
485
+							if (!empty($event['location'])) {
486
+															echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
487
+							}
468 488
 
469 489
 							if ($event['can_edit'] || $event['can_export'])
470 490
 							{
@@ -501,10 +521,11 @@  discard block
 block discarded – undo
501 521
 			// Otherwise, assuming it's not a mini-calendar, we can show previous / next month days!
502 522
 			elseif ($is_mini === false)
503 523
 			{
504
-				if (empty($current_month_started) && !empty($context['calendar_grid_prev']))
505
-					echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>';
506
-				elseif (!empty($current_month_started) && !empty($context['calendar_grid_next']))
507
-					echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>';
524
+				if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) {
525
+									echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>';
526
+				} elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) {
527
+									echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>';
528
+				}
508 529
 			}
509 530
 
510 531
 			// Close this day and increase var count.
@@ -530,8 +551,9 @@  discard block
 block discarded – undo
530 551
 	global $context, $txt, $scripturl, $modSettings;
531 552
 
532 553
 	// We might have no reason to proceed, if the variable isn't there.
533
-	if (!isset($context['calendar_grid_' . $grid_name]))
534
-		return false;
554
+	if (!isset($context['calendar_grid_' . $grid_name])) {
555
+			return false;
556
+	}
535 557
 
536 558
 	// Handy pointer.
537 559
 	$calendar_data = &$context['calendar_grid_' . $grid_name];
@@ -566,8 +588,9 @@  discard block
 block discarded – undo
566 588
 					}
567 589
 
568 590
 					// The Month Title + Week Number...
569
-					if (!empty($calendar_data['week_title']))
570
-							echo $calendar_data['week_title'];
591
+					if (!empty($calendar_data['week_title'])) {
592
+												echo $calendar_data['week_title'];
593
+					}
571 594
 
572 595
 					echo '
573 596
 					</h3>
@@ -606,10 +629,11 @@  discard block
 block discarded – undo
606 629
 						<tr class="days_wrapper">
607 630
 							<td class="', implode(' ', $classes), ' act_day">';
608 631
 							// Should the day number be a link?
609
-							if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
610
-								echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>';
611
-							else
612
-								echo $txt['days'][$day['day_of_week']], ' - ', $day['day'];
632
+							if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) {
633
+															echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>';
634
+							} else {
635
+															echo $txt['days'][$day['day_of_week']], ' - ', $day['day'];
636
+							}
613 637
 
614 638
 							echo '</td>
615 639
 							<td class="', implode(' ', $classes), '', empty($day['events']) ? (' disabled' . ($context['can_post'] ? ' week_post' : '')) : ' events', ' event_col" data-css-prefix="' . $txt['events'] . ' ', (empty($day['events']) && empty($context['can_post'])) ? $txt['none'] : '', '">';
@@ -618,8 +642,9 @@  discard block
 block discarded – undo
618 642
 							{
619 643
 								// Sort events by start time (all day events will be listed first)
620 644
 								uasort($day['events'], function($a, $b) {
621
-								    if ($a['start_timestamp'] == $b['start_timestamp'])
622
-								        return 0;
645
+								    if ($a['start_timestamp'] == $b['start_timestamp']) {
646
+								    								        return 0;
647
+								    }
623 648
 								    return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1;
624 649
 								});
625 650
 
@@ -631,15 +656,17 @@  discard block
 block discarded – undo
631 656
 
632 657
 									echo $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">';
633 658
 
634
-									if (!empty($event['start_time_local']))
635
-										echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' &ndash; ' . trim($event['end_time_local']) : '';
636
-									else
637
-										echo $txt['calendar_allday'];
659
+									if (!empty($event['start_time_local'])) {
660
+																			echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' &ndash; ' . trim($event['end_time_local']) : '';
661
+									} else {
662
+																			echo $txt['calendar_allday'];
663
+									}
638 664
 
639 665
 									echo '</span>';
640 666
 
641
-									if (!empty($event['location']))
642
-										echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
667
+									if (!empty($event['location'])) {
668
+																			echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
669
+									}
643 670
 
644 671
 									if (!empty($event_icons_needed))
645 672
 									{
@@ -676,8 +703,7 @@  discard block
 block discarded – undo
676 703
 									</div>
677 704
 									<br class="clear">';
678 705
 								}
679
-							}
680
-							else
706
+							} else
681 707
 							{
682 708
 								if (!empty($context['can_post']))
683 709
 								{
@@ -690,8 +716,9 @@  discard block
 block discarded – undo
690 716
 							echo '</td>
691 717
 							<td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col" data-css-prefix="' . $txt['calendar_prompt'] . ' ">';
692 718
 							// Show any holidays!
693
-							if (!empty($day['holidays']))
694
-								echo implode('<br>', $day['holidays']);
719
+							if (!empty($day['holidays'])) {
720
+															echo implode('<br>', $day['holidays']);
721
+							}
695 722
 
696 723
 							echo '</td>
697 724
 							<td class="', implode(' ', $classes), '', !empty($day['birthdays']) ? ' birthdays' : ' disabled', ' birthday_col" data-css-prefix="' . $txt['birthdays'] . ' ">';
@@ -749,8 +776,7 @@  discard block
 block discarded – undo
749 776
 				<input type="text" name="end_date" id="end_date" maxlength="10" value="', $calendar_data['end_date'], '" tabindex="', $context['tabindex']++, '" class="input_text date_input end" data-type="date">
750 777
 				<input type="submit" class="button_submit" style="float:none" id="view_button" value="', $txt['view'], '">
751 778
 			</form>';
752
-	}
753
-	else
779
+	} else
754 780
 	{
755 781
 		echo'
756 782
 			<form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '">
@@ -792,8 +818,9 @@  discard block
 block discarded – undo
792 818
 	echo '
793 819
 		<form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);smc_saveEntities(\'postevent\', [\'evtitle\']);" style="margin: 0;">';
794 820
 
795
-	if (!empty($context['event']['new']))
796
-		echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">';
821
+	if (!empty($context['event']['new'])) {
822
+			echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">';
823
+	}
797 824
 
798 825
 	// Start the main table.
799 826
 	echo '
@@ -843,9 +870,10 @@  discard block
 block discarded – undo
843 870
 		{
844 871
 			echo '
845 872
 								<optgroup label="', $category['name'], '">';
846
-			foreach ($category['boards'] as $board)
847
-				echo '
873
+			foreach ($category['boards'] as $board) {
874
+							echo '
848 875
 									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
876
+			}
849 877
 			echo '
850 878
 								</optgroup>';
851 879
 		}
@@ -881,9 +909,10 @@  discard block
 block discarded – undo
881 909
 							<span class="label">', $txt['calendar_timezone'], '</span>
882 910
 							<select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>';
883 911
 
884
-	foreach ($context['all_timezones'] as $tz => $tzname)
885
-		echo '
912
+	foreach ($context['all_timezones'] as $tz => $tzname) {
913
+			echo '
886 914
 								<option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>';
915
+	}
887 916
 
888 917
 	echo '
889 918
 							</select>
@@ -898,9 +927,10 @@  discard block
 block discarded – undo
898 927
 	echo '
899 928
 				<input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button_submit">';
900 929
 	// Delete button?
901
-	if (empty($context['event']['new']))
902
-		echo '
930
+	if (empty($context['event']['new'])) {
931
+			echo '
903 932
 				<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button_submit you_sure">';
933
+	}
904 934
 
905 935
 	echo '
906 936
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -944,9 +974,10 @@  discard block
 block discarded – undo
944 974
 
945 975
 		foreach ($context['clockicons'] as $t => $v)
946 976
 		{
947
-			foreach ($v as $i)
948
-				echo '
977
+			foreach ($v as $i) {
978
+							echo '
949 979
 			icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
980
+			}
950 981
 		}
951 982
 
952 983
 		echo '
@@ -971,13 +1002,14 @@  discard block
 block discarded – undo
971 1002
 
972 1003
 		foreach ($context['clockicons'] as $t => $v)
973 1004
 		{
974
-			foreach ($v as $i)
975
-				echo '
1005
+			foreach ($v as $i) {
1006
+							echo '
976 1007
 			if (', $t, ' >= ', $i, ')
977 1008
 			{
978 1009
 				turnon.push("', $t, '_', $i, '");
979 1010
 				', $t, ' -= ', $i, ';
980 1011
 			}';
1012
+			}
981 1013
 		}
982 1014
 
983 1015
 		echo '
@@ -1041,9 +1073,10 @@  discard block
 block discarded – undo
1041 1073
 
1042 1074
 	foreach ($context['clockicons'] as $t => $v)
1043 1075
 	{
1044
-		foreach ($v as $i)
1045
-			echo '
1076
+		foreach ($v as $i) {
1077
+					echo '
1046 1078
 		icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
1079
+		}
1047 1080
 	}
1048 1081
 
1049 1082
 	echo '
@@ -1060,13 +1093,14 @@  discard block
 block discarded – undo
1060 1093
 
1061 1094
 	foreach ($context['clockicons'] as $t => $v)
1062 1095
 	{
1063
-		foreach ($v as $i)
1064
-			echo '
1096
+		foreach ($v as $i) {
1097
+					echo '
1065 1098
 		if (', $t, ' >= ', $i, ')
1066 1099
 		{
1067 1100
 			turnon.push("', $t, '_', $i, '");
1068 1101
 			', $t, ' -= ', $i, ';
1069 1102
 		}';
1103
+		}
1070 1104
 	}
1071 1105
 
1072 1106
 	echo '
@@ -1125,9 +1159,10 @@  discard block
 block discarded – undo
1125 1159
 
1126 1160
 	foreach ($context['clockicons'] as $t => $v)
1127 1161
 	{
1128
-		foreach ($v as $i)
1129
-			echo '
1162
+		foreach ($v as $i) {
1163
+					echo '
1130 1164
 		icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
1165
+		}
1131 1166
 	}
1132 1167
 
1133 1168
 	echo '
@@ -1148,13 +1183,14 @@  discard block
 block discarded – undo
1148 1183
 
1149 1184
 	foreach ($context['clockicons'] as $t => $v)
1150 1185
 	{
1151
-		foreach ($v as $i)
1152
-		echo '
1186
+		foreach ($v as $i) {
1187
+				echo '
1153 1188
 		if (', $t, ' >= ', $i, ')
1154 1189
 		{
1155 1190
 			turnon.push("', $t, '_', $i, '");
1156 1191
 			', $t, ' -= ', $i, ';
1157 1192
 		}';
1193
+		}
1158 1194
 	}
1159 1195
 
1160 1196
 	echo '
Please login to merge, or discard this patch.
Themes/default/Admin.template.php 1 patch
Braces   +173 added lines, -125 removed lines patch added patch discarded remove patch
@@ -64,9 +64,10 @@  discard block
 block discarded – undo
64 64
 										<strong>', $txt['administrators'], ':</strong>
65 65
 										', implode(', ', $context['administrators']);
66 66
 	// If we have lots of admins... don't show them all.
67
-	if (!empty($context['more_admins_link']))
68
-		echo '
67
+	if (!empty($context['more_admins_link'])) {
68
+			echo '
69 69
 							(', $context['more_admins_link'], ')';
70
+	}
70 71
 
71 72
 	echo '
72 73
 									</div>
@@ -83,16 +84,18 @@  discard block
 block discarded – undo
83 84
 		foreach ($area['areas'] as $item_id => $item)
84 85
 		{
85 86
 			// No point showing the 'home' page here, we're already on it!
86
-			if ($area_id == 'forum' && $item_id == 'index')
87
-				continue;
87
+			if ($area_id == 'forum' && $item_id == 'index') {
88
+							continue;
89
+			}
88 90
 
89 91
 			$url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : '');
90
-			if (!empty($item['icon_file']))
91
-				echo '
92
+			if (!empty($item['icon_file'])) {
93
+							echo '
92 94
 							<a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>';
93
-			else
94
-				echo '
95
+			} else {
96
+							echo '
95 97
 							<a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>';
98
+			}
96 99
 		}
97 100
 
98 101
 		echo '
@@ -103,10 +106,11 @@  discard block
 block discarded – undo
103 106
 					</div>';
104 107
 
105 108
 	// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
106
-	if (empty($modSettings['disable_smf_js']))
107
-		echo '
109
+	if (empty($modSettings['disable_smf_js'])) {
110
+			echo '
108 111
 					<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
109 112
 					<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
113
+	}
110 114
 
111 115
 	// This sets the announcements and current versions themselves ;).
112 116
 	echo '
@@ -185,9 +189,10 @@  discard block
 block discarded – undo
185 189
 								<em>', $version['version'], '</em>';
186 190
 
187 191
 		// more details for this item, show them a link
188
-		if ($context['can_admin'] && isset($version['more']))
189
-			echo
192
+		if ($context['can_admin'] && isset($version['more'])) {
193
+					echo
190 194
 								' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>';
195
+		}
191 196
 		echo '
192 197
 								<br>';
193 198
 	}
@@ -218,20 +223,22 @@  discard block
 block discarded – undo
218 223
 
219 224
 	foreach ($context['credits'] as $section)
220 225
 	{
221
-		if (isset($section['pretext']))
222
-			echo '
226
+		if (isset($section['pretext'])) {
227
+					echo '
223 228
 								<p>', $section['pretext'], '</p><hr>';
229
+		}
224 230
 
225 231
 		echo '
226 232
 								<dl>';
227 233
 
228 234
 		foreach ($section['groups'] as $group)
229 235
 		{
230
-			if (isset($group['title']))
231
-				echo '
236
+			if (isset($group['title'])) {
237
+							echo '
232 238
 									<dt>
233 239
 										<strong>', $group['title'], ':</strong>
234 240
 									</dt>';
241
+			}
235 242
 
236 243
 			echo '
237 244
 									<dd>', implode(', ', $group['members']), '</dd>';
@@ -240,10 +247,11 @@  discard block
 block discarded – undo
240 247
 		echo '
241 248
 								</dl>';
242 249
 
243
-		if (isset($section['posttext']))
244
-			echo '
250
+		if (isset($section['posttext'])) {
251
+					echo '
245 252
 								<hr>
246 253
 								<p>', $section['posttext'], '</p>';
254
+		}
247 255
 	}
248 256
 
249 257
 	echo '
@@ -259,9 +267,10 @@  discard block
 block discarded – undo
259 267
 							smfSupportVersions.forum = "', $context['forum_version'], '";';
260 268
 
261 269
 	// Don't worry, none of this is logged, it's just used to give information that might be of use.
262
-	foreach ($context['current_versions'] as $variable => $version)
263
-		echo '
270
+	foreach ($context['current_versions'] as $variable => $version) {
271
+			echo '
264 272
 							smfSupportVersions.', $variable, ' = "', $version['version'], '";';
273
+	}
265 274
 
266 275
 	// Now we just have to include the script and wait ;).
267 276
 	echo '
@@ -358,8 +367,8 @@  discard block
 block discarded – undo
358 367
 							<tbody>';
359 368
 
360 369
 	// Loop through every source file displaying its version - using javascript.
361
-	foreach ($context['file_versions'] as $filename => $version)
362
-		echo '
370
+	foreach ($context['file_versions'] as $filename => $version) {
371
+			echo '
363 372
 								<tr class="windowbg">
364 373
 									<td class="half_table">
365 374
 										', $filename, '
@@ -371,6 +380,7 @@  discard block
 block discarded – undo
371 380
 										<em id="currentSources', $filename, '">??</em>
372 381
 									</td>
373 382
 								</tr>';
383
+	}
374 384
 
375 385
 	// Default template files.
376 386
 	echo '
@@ -396,8 +406,8 @@  discard block
 block discarded – undo
396 406
 							<table id="Default" class="table_grid">
397 407
 								<tbody>';
398 408
 
399
-	foreach ($context['default_template_versions'] as $filename => $version)
400
-		echo '
409
+	foreach ($context['default_template_versions'] as $filename => $version) {
410
+			echo '
401 411
 									<tr class="windowbg">
402 412
 										<td class="half_table">
403 413
 											', $filename, '
@@ -409,6 +419,7 @@  discard block
 block discarded – undo
409 419
 											<em id="currentDefault', $filename, '">??</em>
410 420
 										</td>
411 421
 									</tr>';
422
+	}
412 423
 
413 424
 	// Now the language files...
414 425
 	echo '
@@ -436,8 +447,8 @@  discard block
 block discarded – undo
436 447
 
437 448
 	foreach ($context['default_language_versions'] as $language => $files)
438 449
 	{
439
-		foreach ($files as $filename => $version)
440
-			echo '
450
+		foreach ($files as $filename => $version) {
451
+					echo '
441 452
 									<tr class="windowbg">
442 453
 										<td class="half_table">
443 454
 											', $filename, '.<em>', $language, '</em>.php
@@ -449,6 +460,7 @@  discard block
 block discarded – undo
449 460
 											<em id="current', $filename, '.', $language, '">??</em>
450 461
 										</td>
451 462
 									</tr>';
463
+		}
452 464
 	}
453 465
 
454 466
 	echo '
@@ -478,8 +490,8 @@  discard block
 block discarded – undo
478 490
 							<table id="Templates" class="table_grid">
479 491
 								<tbody>';
480 492
 
481
-		foreach ($context['template_versions'] as $filename => $version)
482
-			echo '
493
+		foreach ($context['template_versions'] as $filename => $version) {
494
+					echo '
483 495
 									<tr class="windowbg">
484 496
 										<td class="half_table">
485 497
 											', $filename, '
@@ -491,6 +503,7 @@  discard block
 block discarded – undo
491 503
 											<em id="currentTemplates', $filename, '">??</em>
492 504
 										</td>
493 505
 									</tr>';
506
+		}
494 507
 
495 508
 		echo '
496 509
 								</tbody>
@@ -520,8 +533,8 @@  discard block
 block discarded – undo
520 533
 							<table id="Tasks" class="table_grid">
521 534
 								<tbody>';
522 535
 
523
-		foreach ($context['tasks_versions'] as $filename => $version)
524
-			echo '
536
+		foreach ($context['tasks_versions'] as $filename => $version) {
537
+					echo '
525 538
 									<tr class="windowbg">
526 539
 										<td class="half_table">
527 540
 											', $filename, '
@@ -533,6 +546,7 @@  discard block
 block discarded – undo
533 546
 											<em id="currentTasks', $filename, '">??</em>
534 547
 										</td>
535 548
 									</tr>';
549
+		}
536 550
 
537 551
 		echo '
538 552
 								</tbody>
@@ -574,9 +588,10 @@  discard block
 block discarded – undo
574 588
 {
575 589
 	global $context, $scripturl, $txt, $modSettings;
576 590
 
577
-	if (!empty($context['saved_successful']))
578
-		echo '
591
+	if (!empty($context['saved_successful'])) {
592
+			echo '
579 593
 					<div class="infobox">', $txt['settings_saved'], '</div>';
594
+	}
580 595
 
581 596
 	// First section is for adding/removing words from the censored list.
582 597
 	echo '
@@ -591,11 +606,12 @@  discard block
 block discarded – undo
591 606
 								<p>', $txt['admin_censored_where'], '</p>';
592 607
 
593 608
 	// Show text boxes for censoring [bad   ] => [good  ].
594
-	foreach ($context['censored_words'] as $vulgar => $proper)
595
-		echo '
609
+	foreach ($context['censored_words'] as $vulgar => $proper) {
610
+			echo '
596 611
 								<div class="block">
597 612
 									<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> =&gt; <input type="text" name="censor_proper[]" value="', $proper, '" size="30">
598 613
 								</div>';
614
+	}
599 615
 
600 616
 	// Now provide a way to censor more words.
601 617
 	echo '
@@ -669,19 +685,21 @@  discard block
 block discarded – undo
669 685
 						<div class="windowbg2 noup">
670 686
 							', $txt['not_done_reason'];
671 687
 
672
-	if (!empty($context['continue_percent']))
673
-		echo '
688
+	if (!empty($context['continue_percent'])) {
689
+			echo '
674 690
 							<div class="progress_bar">
675 691
 								<div class="full_bar">', $context['continue_percent'], '%</div>
676 692
 								<div class="green_percent" style="width: ', $context['continue_percent'], '%;">&nbsp;</div>
677 693
 							</div>';
694
+	}
678 695
 
679
-	if (!empty($context['substep_enabled']))
680
-		echo '
696
+	if (!empty($context['substep_enabled'])) {
697
+			echo '
681 698
 							<div class="progress_bar">
682 699
 								<div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div>
683 700
 								<div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;">&nbsp;</div>
684 701
 							</div>';
702
+	}
685 703
 
686 704
 	echo '
687 705
 							<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
@@ -716,35 +734,40 @@  discard block
 block discarded – undo
716 734
 {
717 735
 	global $context, $txt, $scripturl;
718 736
 
719
-	if (!empty($context['saved_successful']))
720
-		echo '
737
+	if (!empty($context['saved_successful'])) {
738
+			echo '
721 739
 					<div class="infobox">', $txt['settings_saved'], '</div>';
722
-	elseif (!empty($context['saved_failed']))
723
-		echo '
740
+	} elseif (!empty($context['saved_failed'])) {
741
+			echo '
724 742
 					<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>';
743
+	}
725 744
 
726
-	if (!empty($context['settings_pre_javascript']))
727
-		echo '
745
+	if (!empty($context['settings_pre_javascript'])) {
746
+			echo '
728 747
 					<script>', $context['settings_pre_javascript'], '</script>';
748
+	}
729 749
 
730
-	if (!empty($context['settings_insert_above']))
731
-		echo $context['settings_insert_above'];
750
+	if (!empty($context['settings_insert_above'])) {
751
+			echo $context['settings_insert_above'];
752
+	}
732 753
 
733 754
 	echo '
734 755
 					<div id="admincenter">
735 756
 						<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
736 757
 
737 758
 	// Is there a custom title?
738
-	if (isset($context['settings_title']))
739
-		echo '
759
+	if (isset($context['settings_title'])) {
760
+			echo '
740 761
 							<div class="cat_bar">
741 762
 								<h3 class="catbg">', $context['settings_title'], '</h3>
742 763
 							</div>';
764
+	}
743 765
 
744 766
 	// Have we got a message to display?
745
-	if (!empty($context['settings_message']))
746
-		echo '
767
+	if (!empty($context['settings_message'])) {
768
+			echo '
747 769
 							<div class="information">', $context['settings_message'], '</div>';
770
+	}
748 771
 
749 772
 	// Now actually loop through all the variables.
750 773
 	$is_open = false;
@@ -797,8 +820,9 @@  discard block
 block discarded – undo
797 820
 		// Hang about? Are you pulling my leg - a callback?!
798 821
 		if (is_array($config_var) && $config_var['type'] == 'callback')
799 822
 		{
800
-			if (function_exists('template_callback_' . $config_var['name']))
801
-				call_user_func('template_callback_' . $config_var['name']);
823
+			if (function_exists('template_callback_' . $config_var['name'])) {
824
+							call_user_func('template_callback_' . $config_var['name']);
825
+			}
802 826
 
803 827
 			continue;
804 828
 		}
@@ -828,9 +852,10 @@  discard block
 block discarded – undo
828 852
 				$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time');
829 853
 
830 854
 				// Show the [?] button.
831
-				if ($config_var['help'])
832
-					echo '
855
+				if ($config_var['help']) {
856
+									echo '
833 857
 							<a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ';
858
+				}
834 859
 
835 860
 				echo '
836 861
 										<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
@@ -839,22 +864,25 @@  discard block
 block discarded – undo
839 864
 										$config_var['preinput'];
840 865
 
841 866
 				// Show a check box.
842
-				if ($config_var['type'] == 'check')
843
-					echo '
867
+				if ($config_var['type'] == 'check') {
868
+									echo '
844 869
 										<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1" class="input_check">';
870
+				}
845 871
 				// Escape (via htmlspecialchars.) the text box.
846
-				elseif ($config_var['type'] == 'password')
847
-					echo '
872
+				elseif ($config_var['type'] == 'password') {
873
+									echo '
848 874
 										<input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;" class="input_password"><br>
849 875
 										<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password">';
876
+				}
850 877
 				// Show a selection box.
851 878
 				elseif ($config_var['type'] == 'select')
852 879
 				{
853 880
 					echo '
854 881
 										<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>';
855
-					foreach ($config_var['data'] as $option)
856
-						echo '
882
+					foreach ($config_var['data'] as $option) {
883
+											echo '
857 884
 											<option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';
885
+					}
858 886
 					echo '
859 887
 										</select>';
860 888
 				}
@@ -868,15 +896,17 @@  discard block
 block discarded – undo
868 896
 												<legend class="board_selector"><a href="#">', $txt['select_boards_from_list'], '</a></legend>';
869 897
 					foreach ($context['board_list'] as $id_cat => $cat)
870 898
 					{
871
-						if (!$first)
872
-							echo '
899
+						if (!$first) {
900
+													echo '
873 901
 											<hr>';
902
+						}
874 903
 						echo '
875 904
 											<strong>', $cat['name'], '</strong>
876 905
 											<ul>';
877
-						foreach ($cat['boards'] as $id_board => $brd)
878
-							echo '
906
+						foreach ($cat['boards'] as $id_board => $brd) {
907
+													echo '
879 908
 												<li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1" class="input_check"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat('&nbsp; &nbsp;', $brd['child_level']) : '', $brd['name'], '</label></li>';
909
+						}
880 910
 
881 911
 						echo '
882 912
 											</ul>';
@@ -886,12 +916,14 @@  discard block
 block discarded – undo
886 916
 											</fieldset>';
887 917
 				}
888 918
 				// Text area?
889
-				elseif ($config_var['type'] == 'large_text')
890
-					echo '
919
+				elseif ($config_var['type'] == 'large_text') {
920
+									echo '
891 921
 											<textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
922
+				}
892 923
 				// Permission group?
893
-				elseif ($config_var['type'] == 'permissions')
894
-					theme_inline_permissions($config_var['name']);
924
+				elseif ($config_var['type'] == 'permissions') {
925
+									theme_inline_permissions($config_var['name']);
926
+				}
895 927
 				// BBC selection?
896 928
 				elseif ($config_var['type'] == 'bbc')
897 929
 				{
@@ -902,20 +934,22 @@  discard block
 block discarded – undo
902 934
 
903 935
 					foreach ($context['bbc_columns'] as $bbcColumn)
904 936
 					{
905
-						foreach ($bbcColumn as $bbcTag)
906
-							echo '
937
+						foreach ($bbcColumn as $bbcTag) {
938
+													echo '
907 939
 														<li class="list_bbc floatleft">
908 940
 															<input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', ' class="input_check"> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', '
909 941
 														</li>';
942
+						}
910 943
 					}
911 944
 					echo '							</ul>
912 945
 												<input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', ' class="input_check"> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
913 946
 											</fieldset>';
914 947
 				}
915 948
 				// A simple message?
916
-				elseif ($config_var['type'] == 'var_message')
917
-					echo '
949
+				elseif ($config_var['type'] == 'var_message') {
950
+									echo '
918 951
 											<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>';
952
+				}
919 953
 				// Assume it must be a text box
920 954
 				else
921 955
 				{
@@ -940,63 +974,70 @@  discard block
 block discarded – undo
940 974
 											' . $config_var['postinput'] : '',
941 975
 										'</dd>';
942 976
 			}
943
-		}
944
-
945
-		else
977
+		} else
946 978
 		{
947 979
 			// Just show a separator.
948
-			if ($config_var == '')
949
-				echo '
980
+			if ($config_var == '') {
981
+							echo '
950 982
 								</dl>
951 983
 								<hr>
952 984
 								<dl class="settings">';
953
-			else
954
-				echo '
985
+			} else {
986
+							echo '
955 987
 									<dd>
956 988
 										<strong>' . $config_var . '</strong>
957 989
 									</dd>';
990
+			}
958 991
 		}
959 992
 	}
960 993
 
961
-	if ($is_open)
962
-		echo '
994
+	if ($is_open) {
995
+			echo '
963 996
 								</dl>';
997
+	}
964 998
 
965
-	if (empty($context['settings_save_dont_show']))
966
-		echo '
999
+	if (empty($context['settings_save_dont_show'])) {
1000
+			echo '
967 1001
 								<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit">';
1002
+	}
968 1003
 
969
-	if ($is_open)
970
-		echo '
1004
+	if ($is_open) {
1005
+			echo '
971 1006
 							</div>';
1007
+	}
972 1008
 
973 1009
 
974 1010
 	// At least one token has to be used!
975
-	if (isset($context['admin-ssc_token']))
976
-		echo '
1011
+	if (isset($context['admin-ssc_token'])) {
1012
+			echo '
977 1013
 							<input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">';
1014
+	}
978 1015
 
979
-	if (isset($context['admin-dbsc_token']))
980
-		echo '
1016
+	if (isset($context['admin-dbsc_token'])) {
1017
+			echo '
981 1018
 							<input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">';
1019
+	}
982 1020
 
983
-	if (isset($context['admin-mp_token']))
984
-		echo '
1021
+	if (isset($context['admin-mp_token'])) {
1022
+			echo '
985 1023
 							<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">';
1024
+	}
986 1025
 
987 1026
 	echo '
988 1027
 							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
989 1028
 						</form>
990 1029
 					</div>';
991 1030
 
992
-	if (!empty($context['settings_post_javascript']))
993
-		echo '
1031
+	if (!empty($context['settings_post_javascript'])) {
1032
+			echo '
994 1033
 					<script>
995 1034
 					', $context['settings_post_javascript'], '
996 1035
 					</script>';
1036
+	}
997 1037
 
998
-	if (!empty($context['settings_insert_below']))
999
-		echo $context['settings_insert_below'];
1038
+	if (!empty($context['settings_insert_below'])) {
1039
+			echo $context['settings_insert_below'];
1040
+	}
1000 1041
 
1001 1042
 	// We may have added a board listing. If we did, we need to make it work.
1002 1043
 	addInlineJavascript('
@@ -1019,9 +1060,10 @@  discard block
 block discarded – undo
1019 1060
 {
1020 1061
 	global $context, $txt;
1021 1062
 
1022
-	if (!empty($context['saved_successful']))
1023
-		echo '
1063
+	if (!empty($context['saved_successful'])) {
1064
+			echo '
1024 1065
 					<div class="infobox">', $txt['settings_saved'], '</div>';
1066
+	}
1025 1067
 
1026 1068
 	// Standard fields.
1027 1069
 	template_show_list('standard_profile_fields');
@@ -1053,11 +1095,12 @@  discard block
 block discarded – undo
1053 1095
 	if (isset($_GET['msg']))
1054 1096
 	{
1055 1097
 		loadLanguage('Errors');
1056
-		if (isset($txt['custom_option_' . $_GET['msg']]))
1057
-			echo '
1098
+		if (isset($txt['custom_option_' . $_GET['msg']])) {
1099
+					echo '
1058 1100
 					<div class="errorbox">',
1059 1101
 						$txt['custom_option_' . $_GET['msg']], '
1060 1102
 					</div>';
1103
+		}
1061 1104
 	}
1062 1105
 
1063 1106
 	echo '
@@ -1123,9 +1166,10 @@  discard block
 block discarded – undo
1123 1166
 										<dd>
1124 1167
 											<select name="placement" id="placement">';
1125 1168
 
1126
-	foreach ($context['cust_profile_fields_placement'] as $order => $name)
1127
-		echo '
1169
+	foreach ($context['cust_profile_fields_placement'] as $order => $name) {
1170
+			echo '
1128 1171
 												<option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>';
1172
+	}
1129 1173
 
1130 1174
 	echo '
1131 1175
 											</select>
@@ -1148,9 +1192,10 @@  discard block
 block discarded – undo
1148 1192
 										</dt>
1149 1193
 										<dd>
1150 1194
 											<select name="field_type" id="field_type" onchange="updateInputBoxes();">';
1151
-	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type)
1152
-		echo '
1195
+	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) {
1196
+			echo '
1153 1197
 												<option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>';
1198
+	}
1154 1199
 
1155 1200
 	echo '
1156 1201
 											</select>
@@ -1251,9 +1296,10 @@  discard block
 block discarded – undo
1251 1296
 								</fieldset>
1252 1297
 									<input type="submit" name="save" value="', $txt['save'], '" class="button_submit">';
1253 1298
 
1254
-	if ($context['fid'])
1255
-		echo '
1299
+	if ($context['fid']) {
1300
+			echo '
1256 1301
 									<input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button_submit you_sure">';
1302
+	}
1257 1303
 
1258 1304
 	echo '
1259 1305
 							</div>
@@ -1296,8 +1342,7 @@  discard block
 block discarded – undo
1296 1342
 	{
1297 1343
 		echo '
1298 1344
 						<p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>';
1299
-	}
1300
-	else
1345
+	} else
1301 1346
 	{
1302 1347
 		echo '
1303 1348
 						<ol class="search_results">';
@@ -1323,9 +1368,10 @@  discard block
 block discarded – undo
1323 1368
 							<li>
1324 1369
 								<a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']';
1325 1370
 
1326
-				if ($result['help'])
1327
-					echo '
1371
+				if ($result['help']) {
1372
+									echo '
1328 1373
 								<p class="double_height">', $result['help'], '</p>';
1374
+				}
1329 1375
 
1330 1376
 				echo '
1331 1377
 							</li>';
@@ -1365,18 +1411,20 @@  discard block
 block discarded – undo
1365 1411
 									<strong>', $txt['setup_verification_answer'], '</strong>
1366 1412
 								</dd>';
1367 1413
 
1368
-		if (!empty($context['qa_by_lang'][$lang_id]))
1369
-			foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1414
+		if (!empty($context['qa_by_lang'][$lang_id])) {
1415
+					foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1370 1416
 			{
1371 1417
 				$question = $context['question_answers'][$q_id];
1418
+		}
1372 1419
 				echo '
1373 1420
 								<dt>
1374 1421
 									<input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="input_text verification_question">
1375 1422
 								</dt>
1376 1423
 								<dd>';
1377
-				foreach ($question['answers'] as $answer)
1378
-					echo '
1424
+				foreach ($question['answers'] as $answer) {
1425
+									echo '
1379 1426
 									<input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="input_text verification_answer">';
1427
+				}
1380 1428
 
1381 1429
 				echo '
1382 1430
 									<div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div>
@@ -1415,11 +1463,12 @@  discard block
 block discarded – undo
1415 1463
 							', $txt['errors_found'], ':
1416 1464
 							<ul>';
1417 1465
 
1418
-			foreach ($context['repair_errors'] as $error)
1419
-				echo '
1466
+			foreach ($context['repair_errors'] as $error) {
1467
+							echo '
1420 1468
 								<li>
1421 1469
 									', $error, '
1422 1470
 								</li>';
1471
+			}
1423 1472
 
1424 1473
 			echo '
1425 1474
 							</ul>
@@ -1429,16 +1478,15 @@  discard block
 block discarded – undo
1429 1478
 							<p class="padding">
1430 1479
 								<strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong>
1431 1480
 							</p>';
1432
-		}
1433
-		else
1434
-			echo '
1481
+		} else {
1482
+					echo '
1435 1483
 							<p>', $txt['maintain_no_errors'], '</p>
1436 1484
 							<p class="padding">
1437 1485
 								<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
1438 1486
 							</p>';
1487
+		}
1439 1488
 
1440
-	}
1441
-	else
1489
+	} else
1442 1490
 	{
1443 1491
 		if (!empty($context['redirect_to_recount']))
1444 1492
 		{
@@ -1450,8 +1498,7 @@  discard block
 block discarded – undo
1450 1498
 								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1451 1499
 								<input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '">
1452 1500
 							</form>';
1453
-		}
1454
-		else
1501
+		} else
1455 1502
 		{
1456 1503
 			echo '
1457 1504
 							<p>', $txt['errors_fixed'], '</p>
@@ -1603,8 +1650,8 @@  discard block
 block discarded – undo
1603 1650
 function template_admin_quick_search()
1604 1651
 {
1605 1652
 	global $context, $txt;
1606
-	if ($context['user']['is_admin'])
1607
-		echo '
1653
+	if ($context['user']['is_admin']) {
1654
+			echo '
1608 1655
 								<span class="floatright admin_search">
1609 1656
 									<span class="generic_icons filter centericon"></span>
1610 1657
 									<input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text">
@@ -1615,6 +1662,7 @@  discard block
 block discarded – undo
1615 1662
 									</select>
1616 1663
 									<input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit">
1617 1664
 								</span>';
1618
-}
1665
+	}
1666
+	}
1619 1667
 
1620 1668
 ?>
1621 1669
\ No newline at end of file
Please login to merge, or discard this patch.