Completed
Pull Request — release-2.1 (#4231)
by Mert
11:55
created
Sources/Subs-Menu.php 1 patch
Braces   +87 added lines, -63 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
  * Create a menu.
@@ -64,22 +65,26 @@  discard block
 block discarded – undo
64 65
 	$menu_context['current_action'] = isset($menuOptions['action']) ? $menuOptions['action'] : $context['current_action'];
65 66
 
66 67
 	// Allow extend *any* menu with a single hook
67
-	if (!empty($menu_context['current_action']))
68
-		call_integration_hook('integrate_' . $menu_context['current_action'] . '_areas', array(&$menuData));
68
+	if (!empty($menu_context['current_action'])) {
69
+			call_integration_hook('integrate_' . $menu_context['current_action'] . '_areas', array(&$menuData));
70
+	}
69 71
 
70 72
 	// What is the current area selected?
71
-	if (isset($menuOptions['current_area']) || isset($_GET['area']))
72
-		$menu_context['current_area'] = isset($menuOptions['current_area']) ? $menuOptions['current_area'] : $_GET['area'];
73
+	if (isset($menuOptions['current_area']) || isset($_GET['area'])) {
74
+			$menu_context['current_area'] = isset($menuOptions['current_area']) ? $menuOptions['current_area'] : $_GET['area'];
75
+	}
73 76
 
74 77
 	// Build a list of additional parameters that should go in the URL.
75 78
 	$menu_context['extra_parameters'] = '';
76
-	if (!empty($menuOptions['extra_url_parameters']))
77
-		foreach ($menuOptions['extra_url_parameters'] as $key => $value)
79
+	if (!empty($menuOptions['extra_url_parameters'])) {
80
+			foreach ($menuOptions['extra_url_parameters'] as $key => $value)
78 81
 			$menu_context['extra_parameters'] .= ';' . $key . '=' . $value;
82
+	}
79 83
 
80 84
 	// Only include the session ID in the URL if it's strictly necessary.
81
-	if (empty($menuOptions['disable_url_session_check']))
82
-		$menu_context['extra_parameters'] .= ';' . $context['session_var'] . '=' . $context['session_id'];
85
+	if (empty($menuOptions['disable_url_session_check'])) {
86
+			$menu_context['extra_parameters'] .= ';' . $context['session_var'] . '=' . $context['session_id'];
87
+	}
83 88
 
84 89
 	$include_data = array();
85 90
 
@@ -87,8 +92,9 @@  discard block
 block discarded – undo
87 92
 	foreach ($menuData as $section_id => $section)
88 93
 	{
89 94
 		// Is this enabled - or has as permission check - which fails?
90
-		if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($section['permission']) && !allowedTo($section['permission'])))
91
-			continue;
95
+		if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($section['permission']) && !allowedTo($section['permission']))) {
96
+					continue;
97
+		}
92 98
 
93 99
 		// Now we cycle through the sections to pick the right area.
94 100
 		foreach ($section['areas'] as $area_id => $area)
@@ -110,41 +116,45 @@  discard block
 block discarded – undo
110 116
 					if (empty($area['hidden']))
111 117
 					{
112 118
 						// First time this section?
113
-						if (!isset($menu_context['sections'][$section_id]))
114
-							$menu_context['sections'][$section_id]['title'] = $section['title'];
119
+						if (!isset($menu_context['sections'][$section_id])) {
120
+													$menu_context['sections'][$section_id]['title'] = $section['title'];
121
+						}
115 122
 
116 123
 						$menu_context['sections'][$section_id]['areas'][$area_id] = array('label' => isset($area['label']) ? $area['label'] : $txt[$area_id]);
117 124
 						// We'll need the ID as well...
118 125
 						$menu_context['sections'][$section_id]['id'] = $section_id;
119 126
 						// Does it have a custom URL?
120
-						if (isset($area['custom_url']))
121
-							$menu_context['sections'][$section_id]['areas'][$area_id]['url'] = $area['custom_url'];
127
+						if (isset($area['custom_url'])) {
128
+													$menu_context['sections'][$section_id]['areas'][$area_id]['url'] = $area['custom_url'];
129
+						}
122 130
 
123 131
 						// Does this area have its own icon?
124
-						if (!isset($area['force_menu_into_arms_of_another_menu']) && $user_info['name'] == 'iamanoompaloompa')
125
-							$menu_context['sections'][$section_id]['areas'][$area_id] = $smcFunc['json_decode'](base64_decode('eyJsYWJlbCI6Ik9vbXBhIExvb21wYSIsInVybCI6Imh0dHBzOlwvXC9lbi53aWtpcGVkaWEub3JnXC93aWtpXC9Pb21wYV9Mb29tcGFzPyIsImljb24iOiI8aW1nIHNyYz1cImh0dHBzOlwvXC93d3cuc2ltcGxlbWFjaGluZXMub3JnXC9pbWFnZXNcL29vbXBhLmdpZlwiIGFsdD1cIkknbSBhbiBPb21wYSBMb29tcGFcIiBcLz4ifQ=='), true);
126
-						elseif (isset($area['icon']) && file_exists($settings['theme_dir'] . '/images/admin/' . $area['icon']))
127
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['images_url'] . '/admin/' . $area['icon'] . '" alt="">';
128
-						elseif (isset($area['icon']) && file_exists($settings['default_theme_dir'] . '/images/admin/' . $area['icon']))
129
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['default_images_url'] . '/admin/' . $area['icon'] . '" alt="">';
130
-						elseif (isset($area['icon']))
131
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area['icon'] . '"></span>';
132
-						else
133
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area_id . '"></span>';
134
-
135
-						if (isset($area['icon_class']) && empty($menu_context['sections'][$section_id]['areas'][$area_id]['icon']))
136
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . $area['icon_class'];
137
-						elseif (isset($area['icon']))
132
+						if (!isset($area['force_menu_into_arms_of_another_menu']) && $user_info['name'] == 'iamanoompaloompa') {
133
+													$menu_context['sections'][$section_id]['areas'][$area_id] = $smcFunc['json_decode'](base64_decode('eyJsYWJlbCI6Ik9vbXBhIExvb21wYSIsInVybCI6Imh0dHBzOlwvXC9lbi53aWtpcGVkaWEub3JnXC93aWtpXC9Pb21wYV9Mb29tcGFzPyIsImljb24iOiI8aW1nIHNyYz1cImh0dHBzOlwvXC93d3cuc2ltcGxlbWFjaGluZXMub3JnXC9pbWFnZXNcL29vbXBhLmdpZlwiIGFsdD1cIkknbSBhbiBPb21wYSBMb29tcGFcIiBcLz4ifQ=='), true);
134
+						} elseif (isset($area['icon']) && file_exists($settings['theme_dir'] . '/images/admin/' . $area['icon'])) {
135
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['images_url'] . '/admin/' . $area['icon'] . '" alt="">';
136
+						} elseif (isset($area['icon']) && file_exists($settings['default_theme_dir'] . '/images/admin/' . $area['icon'])) {
137
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img src="' . $settings['default_images_url'] . '/admin/' . $area['icon'] . '" alt="">';
138
+						} elseif (isset($area['icon'])) {
139
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area['icon'] . '"></span>';
140
+						} else {
141
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<span class="generic_icons ' . $area_id . '"></span>';
142
+						}
143
+
144
+						if (isset($area['icon_class']) && empty($menu_context['sections'][$section_id]['areas'][$area_id]['icon'])) {
145
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . $area['icon_class'];
146
+						} elseif (isset($area['icon']))
138 147
 						{
139
-							if ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['theme_dir'] . '/images/admin/big/' . $area['icon']))
140
-								$menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['theme_url'] . '/images/admin/big/' . $area['icon'];
141
-							elseif ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['default_theme_dir'] . '/images/admin/big/' . $area['icon']))
142
-								$menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['default_theme_url'] . '/images/admin/big/' . $area['icon'];
148
+							if ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['theme_dir'] . '/images/admin/big/' . $area['icon'])) {
149
+															$menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['theme_url'] . '/images/admin/big/' . $area['icon'];
150
+							} elseif ((substr($area['icon'], -4) === '.png' || substr($area['icon'], -4) === '.gif') && file_exists($settings['default_theme_dir'] . '/images/admin/big/' . $area['icon'])) {
151
+															$menu_context['sections'][$section_id]['areas'][$area_id]['icon_file'] = $settings['default_theme_url'] . '/images/admin/big/' . $area['icon'];
152
+							}
143 153
 
144 154
 							$menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . str_replace(array('.png', '.gif'), '', $area['icon']);
155
+						} else {
156
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . str_replace(array('.png', '.gif'), '', $area_id);
145 157
 						}
146
-						else
147
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon_class'] = $menu_context['current_action'] . '_menu_icon ' . str_replace(array('.png', '.gif'), '', $area_id);
148 158
 
149 159
 						// This is a shortcut for Font-Icon users so they don't have to re-do whole CSS.
150 160
 						$menu_context['sections'][$section_id]['areas'][$area_id]['plain_class'] = $area['icon'];
@@ -161,35 +171,41 @@  discard block
 block discarded – undo
161 171
 							{
162 172
 								if ((empty($sub[1]) || allowedTo($sub[1])) && (!isset($sub['enabled']) || !empty($sub['enabled'])))
163 173
 								{
164
-									if ($first_sa == null)
165
-										$first_sa = $sa;
174
+									if ($first_sa == null) {
175
+																			$first_sa = $sa;
176
+									}
166 177
 
167 178
 									$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa] = array('label' => $sub[0]);
168 179
 									// Custom URL?
169
-									if (isset($sub['url']))
170
-										$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['url'] = $sub['url'];
180
+									if (isset($sub['url'])) {
181
+																			$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['url'] = $sub['url'];
182
+									}
171 183
 
172 184
 									// A bit complicated - but is this set?
173 185
 									if ($menu_context['current_area'] == $area_id)
174 186
 									{
175 187
 										// Save which is the first...
176
-										if (empty($first_sa))
177
-											$first_sa = $sa;
188
+										if (empty($first_sa)) {
189
+																					$first_sa = $sa;
190
+										}
178 191
 
179 192
 										// Is this the current subsection?
180
-										if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == $sa)
181
-											$menu_context['current_subsection'] = $sa;
193
+										if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == $sa) {
194
+																					$menu_context['current_subsection'] = $sa;
195
+										}
182 196
 										// Otherwise is it the default?
183
-										elseif (!isset($menu_context['current_subsection']) && !empty($sub[2]))
184
-											$menu_context['current_subsection'] = $sa;
197
+										elseif (!isset($menu_context['current_subsection']) && !empty($sub[2])) {
198
+																					$menu_context['current_subsection'] = $sa;
199
+										}
185 200
 									}
186 201
 
187 202
 									// Let's assume this is the last, for now.
188 203
 									$last_sa = $sa;
189 204
 								}
190 205
 								// Mark it as disabled...
191
-								else
192
-									$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true;
206
+								else {
207
+																	$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true;
208
+								}
193 209
 							}
194 210
 
195 211
 							// Set which one is first, last and selected in the group.
@@ -198,8 +214,9 @@  discard block
 block discarded – undo
198 214
 								$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$context['right_to_left'] ? $last_sa : $first_sa]['is_first'] = true;
199 215
 								$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$context['right_to_left'] ? $first_sa : $last_sa]['is_last'] = true;
200 216
 
201
-								if ($menu_context['current_area'] == $area_id && !isset($menu_context['current_subsection']))
202
-									$menu_context['current_subsection'] = $first_sa;
217
+								if ($menu_context['current_area'] == $area_id && !isset($menu_context['current_subsection'])) {
218
+																	$menu_context['current_subsection'] = $first_sa;
219
+								}
203 220
 							}
204 221
 						}
205 222
 					}
@@ -233,23 +250,26 @@  discard block
 block discarded – undo
233 250
 	$menu_context['base_url'] = isset($menuOptions['base_url']) ? $menuOptions['base_url'] : $scripturl . '?action=' . $menu_context['current_action'];
234 251
 
235 252
 	// If we didn't find the area we were looking for go to a default one.
236
-	if (isset($backup_area) && empty($found_section))
237
-		$menu_context['current_area'] = $backup_area;
253
+	if (isset($backup_area) && empty($found_section)) {
254
+			$menu_context['current_area'] = $backup_area;
255
+	}
238 256
 
239 257
 	// If there are sections quickly goes through all the sections to check if the base menu has an url
240 258
 	if (!empty($menu_context['current_section']))
241 259
 	{
242 260
 		$menu_context['sections'][$menu_context['current_section']]['selected'] = true;
243 261
 		$menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['selected'] = true;
244
-		if (!empty($menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]))
245
-			$menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]['selected'] = true;
262
+		if (!empty($menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']])) {
263
+					$menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]['selected'] = true;
264
+		}
246 265
 
247
-		foreach ($menu_context['sections'] as $section_id => $section)
248
-			foreach ($section['areas'] as $area_id => $area)
266
+		foreach ($menu_context['sections'] as $section_id => $section) {
267
+					foreach ($section['areas'] as $area_id => $area)
249 268
 			{
250 269
 				if (!isset($menu_context['sections'][$section_id]['url']))
251 270
 				{
252 271
 					$menu_context['sections'][$section_id]['url'] = isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $area_id;
272
+		}
253 273
 					break;
254 274
 				}
255 275
 			}
@@ -260,8 +280,9 @@  discard block
 block discarded – undo
260 280
 	{
261 281
 		// Never happened!
262 282
 		$context['max_menu_id']--;
263
-		if ($context['max_menu_id'] == 0)
264
-			unset($context['max_menu_id']);
283
+		if ($context['max_menu_id'] == 0) {
284
+					unset($context['max_menu_id']);
285
+		}
265 286
 
266 287
 		return false;
267 288
 	}
@@ -272,8 +293,9 @@  discard block
 block discarded – undo
272 293
 	$context['template_layers'][] = $menu_context['layer_name'];
273 294
 
274 295
 	// Check we had something - for sanity sake.
275
-	if (empty($include_data))
276
-		return false;
296
+	if (empty($include_data)) {
297
+			return false;
298
+	}
277 299
 
278 300
 	// Finally - return information on the selected item.
279 301
 	$include_data += array(
@@ -296,12 +318,14 @@  discard block
 block discarded – undo
296 318
 	global $context;
297 319
 
298 320
 	$menu_name = $menu_id == 'last' && isset($context['max_menu_id']) && isset($context['menu_data_' . $context['max_menu_id']]) ? 'menu_data_' . $context['max_menu_id'] : 'menu_data_' . $menu_id;
299
-	if (!isset($context[$menu_name]))
300
-		return false;
321
+	if (!isset($context[$menu_name])) {
322
+			return false;
323
+	}
301 324
 
302 325
 	$layer_index = array_search($context[$menu_name]['layer_name'], $context['template_layers']);
303
-	if ($layer_index !== false)
304
-		unset($context['template_layers'][$layer_index]);
326
+	if ($layer_index !== false) {
327
+			unset($context['template_layers'][$layer_index]);
328
+	}
305 329
 
306 330
 	unset($context[$menu_name]);
307 331
 }
Please login to merge, or discard this patch.
Themes/default/index.template.php 1 patch
Braces   +89 added lines, -61 removed lines patch added patch discarded remove patch
@@ -72,9 +72,10 @@  discard block
 block discarded – undo
72 72
 
73 73
 	// Allow css/js files to be disable for this specific theme.
74 74
 	// Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference.
75
-	if (!isset($settings['disable_files']))
76
-		$settings['disable_files'] = array();
77
-}
75
+	if (!isset($settings['disable_files'])) {
76
+			$settings['disable_files'] = array();
77
+	}
78
+	}
78 79
 
79 80
 /**
80 81
  * The main sub template above the content.
@@ -111,8 +112,9 @@  discard block
 block discarded – undo
111 112
 		echo '
112 113
 	<meta';
113 114
 
114
-		foreach ($meta_tag as $meta_key => $meta_value)
115
-			echo ' ', $meta_key, '="', $meta_value, '"';
115
+		foreach ($meta_tag as $meta_key => $meta_value) {
116
+					echo ' ', $meta_key, '="', $meta_value, '"';
117
+		}
116 118
 
117 119
 		echo '>';
118 120
 	}
@@ -123,14 +125,16 @@  discard block
 block discarded – undo
123 125
 	<meta name="theme-color" content="#557EA0">';
124 126
 
125 127
 	// Please don't index these Mr Robot.
126
-	if (!empty($context['robot_no_index']))
127
-		echo '
128
+	if (!empty($context['robot_no_index'])) {
129
+			echo '
128 130
 	<meta name="robots" content="noindex">';
131
+	}
129 132
 
130 133
 	// Present a canonical url for search engines to prevent duplicate content in their indices.
131
-	if (!empty($context['canonical_url']))
132
-		echo '
134
+	if (!empty($context['canonical_url'])) {
135
+			echo '
133 136
 	<link rel="canonical" href="', $context['canonical_url'], '">';
137
+	}
134 138
 
135 139
 	// Show all the relative links, such as help, search, contents, and the like.
136 140
 	echo '
@@ -139,10 +143,11 @@  discard block
 block discarded – undo
139 143
 	<link rel="search" href="' . $scripturl . '?action=search">' : '');
140 144
 
141 145
 	// If RSS feeds are enabled, advertise the presence of one.
142
-	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
143
-		echo '
146
+	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) {
147
+			echo '
144 148
 	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?action=.xml;type=rss2', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">
145 149
 	<link rel="alternate" type="application/atom+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?action=.xml;type=atom', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">';
150
+	}
146 151
 
147 152
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
148 153
 	if (!empty($context['links']['next']))
@@ -158,9 +163,10 @@  discard block
 block discarded – undo
158 163
 	}
159 164
 
160 165
 	// If we're in a board, or a topic for that matter, the index will be the board's index.
161
-	if (!empty($context['current_board']))
162
-		echo '
166
+	if (!empty($context['current_board'])) {
167
+			echo '
163 168
 	<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">';
169
+	}
164 170
 
165 171
 	// Output any remaining HTML headers. (from mods, maybe?)
166 172
 	echo $context['html_headers'];
@@ -191,8 +197,9 @@  discard block
 block discarded – undo
191 197
 		<ul class="floatleft" id="top_info">
192 198
 			<li>
193 199
 				<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
194
-					if (!empty($context['user']['avatar']))
195
-						echo $context['user']['avatar']['image'];
200
+					if (!empty($context['user']['avatar'])) {
201
+											echo $context['user']['avatar']['image'];
202
+					}
196 203
 					echo $context['user']['name'], '</a>
197 204
 				<div id="profile_menu" class="top_menu"></div>
198 205
 			</li>';
@@ -220,17 +227,18 @@  discard block
 block discarded – undo
220 227
 	}
221 228
 	// Otherwise they're a guest. Ask them to either register or login.
222 229
 	else
223
-		if (empty($maintenance))
224
-			echo '
230
+		if (empty($maintenance)) {
231
+					echo '
225 232
 			<ul class="floatleft welcome">
226 233
 				<li>', 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'), '</li>
227 234
 			</ul>';
228
-		else
229
-			//In maintenance mode, only login is allowed and don't show OverlayDiv
235
+		} else {
236
+					//In maintenance mode, only login is allowed and don't show OverlayDiv
230 237
 			echo '
231 238
 			<ul class="floatleft welcome">
232 239
 				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
233 240
 			</ul>';
241
+		}
234 242
 
235 243
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
236 244
 	{
@@ -238,9 +246,10 @@  discard block
 block discarded – undo
238 246
 		<form id="languages_form" method="get" class="floatright">
239 247
 			<select id="language_select" name="language" onchange="this.form.submit()">';
240 248
 
241
-		foreach ($context['languages'] as $language)
242
-			echo '
249
+		foreach ($context['languages'] as $language) {
250
+					echo '
243 251
 				<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';
252
+		}
244 253
 
245 254
 		echo '
246 255
 			</select>
@@ -264,31 +273,36 @@  discard block
 block discarded – undo
264 273
 				<option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>';
265 274
 
266 275
 		// Can't limit it to a specific topic if we are not in one
267
-		if (!empty($context['current_topic']))
268
-			echo '
276
+		if (!empty($context['current_topic'])) {
277
+					echo '
269 278
 				<option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>';
279
+		}
270 280
 
271 281
 		// Can't limit it to a specific board if we are not in one
272
-		if (!empty($context['current_board']))
273
-			echo '
282
+		if (!empty($context['current_board'])) {
283
+					echo '
274 284
 				<option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>';
285
+		}
275 286
 
276 287
 		// Can't search for members if we can't see the memberlist
277
-		if (!empty($context['allow_memberlist']))
278
-			echo '
288
+		if (!empty($context['allow_memberlist'])) {
289
+					echo '
279 290
 				<option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>';
291
+		}
280 292
 
281 293
 		echo '
282 294
 			</select>';
283 295
 
284 296
 		// Search within current topic?
285
-		if (!empty($context['current_topic']))
286
-			echo '
297
+		if (!empty($context['current_topic'])) {
298
+					echo '
287 299
 			<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
300
+		}
288 301
 		// If we're on a certain board, limit it to this board ;).
289
-		elseif (!empty($context['current_board']))
290
-			echo '
302
+		elseif (!empty($context['current_board'])) {
303
+					echo '
291 304
 			<input type="hidden" name="sd_brd" value="', $context['current_board'], '">';
305
+		}
292 306
 
293 307
 		echo '
294 308
 			<input type="submit" name="search2" value="', $txt['search'], '" class="button_submit">
@@ -318,12 +332,13 @@  discard block
 block discarded – undo
318 332
 						', $context['current_time'], '
319 333
 					</div>';
320 334
 	// Show a random news item? (or you could pick one from news_lines...)
321
-	if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
322
-		echo '
335
+	if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
336
+			echo '
323 337
 					<div class="news">
324 338
 						<h2>', $txt['news'], ': </h2>
325 339
 						<p>', $context['random_news_line'], '</p>
326 340
 					</div>';
341
+	}
327 342
 
328 343
 	echo '
329 344
 					<hr class="clear">
@@ -386,9 +401,10 @@  discard block
 block discarded – undo
386 401
 		</ul>';
387 402
 
388 403
 	// Show the load time?
389
-	if ($context['show_load_time'])
390
-		echo '
404
+	if ($context['show_load_time']) {
405
+			echo '
391 406
 		<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
407
+	}
392 408
 
393 409
 	echo '
394 410
 	</div>';
@@ -418,19 +434,21 @@  discard block
 block discarded – undo
418 434
 	global $context, $shown_linktree, $scripturl, $txt;
419 435
 
420 436
 	// If linktree is empty, just return - also allow an override.
421
-	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
422
-		return;
437
+	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) {
438
+			return;
439
+	}
423 440
 
424 441
 	echo '
425 442
 				<div class="navigate_section">
426 443
 					<ul>';
427 444
 
428
-	if ($context['user']['is_logged'])
429
-	echo '
445
+	if ($context['user']['is_logged']) {
446
+		echo '
430 447
 						<li class="unread_links">
431 448
 							<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a>
432 449
 							<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a>
433 450
 						</li>';
451
+	}
434 452
 
435 453
 	// Each tree item has a URL and name. Some may have extra_before and extra_after.
436 454
 	foreach ($context['linktree'] as $link_num => $tree)
@@ -441,25 +459,29 @@  discard block
 block discarded – undo
441 459
 		// Don't show a separator for the first one.
442 460
 		// Better here. Always points to the next level when the linktree breaks to a second line.
443 461
 		// Picked a better looking HTML entity, and added support for RTL plus a span for styling.
444
-		if ($link_num != 0)
445
-			echo '
462
+		if ($link_num != 0) {
463
+					echo '
446 464
 							<span class="dividers">', $context['right_to_left'] ? ' &#9668; ' : ' &#9658; ', '</span>';
465
+		}
447 466
 
448 467
 		// Show something before the link?
449
-		if (isset($tree['extra_before']))
450
-			echo $tree['extra_before'], ' ';
468
+		if (isset($tree['extra_before'])) {
469
+					echo $tree['extra_before'], ' ';
470
+		}
451 471
 
452 472
 		// Show the link, including a URL if it should have one.
453
-		if (isset($tree['url']))
454
-			echo '
473
+		if (isset($tree['url'])) {
474
+					echo '
455 475
 					<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>';
456
-		else
457
-			echo '
476
+		} else {
477
+					echo '
458 478
 					<span>' . $tree['name'] . '</span>';
479
+		}
459 480
 
460 481
 		// Show something after the link...?
461
-		if (isset($tree['extra_after']))
462
-			echo ' ', $tree['extra_after'];
482
+		if (isset($tree['extra_after'])) {
483
+					echo ' ', $tree['extra_after'];
484
+		}
463 485
 
464 486
 		echo '
465 487
 						</li>';
@@ -509,13 +531,14 @@  discard block
 block discarded – undo
509 531
 					echo '
510 532
 									<ul>';
511 533
 
512
-					foreach ($childbutton['sub_buttons'] as $grandchildbutton)
513
-						echo '
534
+					foreach ($childbutton['sub_buttons'] as $grandchildbutton) {
535
+											echo '
514 536
 										<li>
515 537
 											<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
516 538
 												', $grandchildbutton['title'], '
517 539
 											</a>
518 540
 										</li>';
541
+					}
519 542
 
520 543
 					echo '
521 544
 									</ul>';
@@ -546,8 +569,9 @@  discard block
 block discarded – undo
546 569
 {
547 570
 	global $context, $txt;
548 571
 
549
-	if (!is_array($strip_options))
550
-		$strip_options = array();
572
+	if (!is_array($strip_options)) {
573
+			$strip_options = array();
574
+	}
551 575
 
552 576
 	// Create the buttons...
553 577
 	$buttons = array();
@@ -556,8 +580,9 @@  discard block
 block discarded – undo
556 580
 		// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!)
557 581
 		if (!isset($value['test']) || !empty($context[$value['test']]))
558 582
 		{
559
-			if (!isset($value['id']))
560
-				$value['id'] = $key;
583
+			if (!isset($value['id'])) {
584
+							$value['id'] = $key;
585
+			}
561 586
 
562 587
 			$button = '
563 588
 				<a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';
@@ -570,13 +595,15 @@  discard block
 block discarded – undo
570 595
 							<div class="overview">';
571 596
 				foreach ($value['sub_buttons'] as $element)
572 597
 				{
573
-					if (isset($element['test']) && empty($context[$element['test']]))
574
-						continue;
598
+					if (isset($element['test']) && empty($context[$element['test']])) {
599
+											continue;
600
+					}
575 601
 
576 602
 					$button .= '
577 603
 								<a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>';
578
-					if (isset($txt[$element['text'] . '_desc']))
579
-						$button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>';
604
+					if (isset($txt[$element['text'] . '_desc'])) {
605
+											$button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>';
606
+					}
580 607
 					$button .= '</a>';
581 608
 				}
582 609
 				$button .= '
@@ -590,8 +617,9 @@  discard block
 block discarded – undo
590 617
 	}
591 618
 
592 619
 	// No buttons? No button strip either.
593
-	if (empty($buttons))
594
-		return;
620
+	if (empty($buttons)) {
621
+			return;
622
+	}
595 623
 
596 624
 	echo '
597 625
 		<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '>
Please login to merge, or discard this patch.