Completed
Pull Request — release-2.1 (#3807)
by Martyn
07:18
created
Themes/default/Who.template.php 1 patch
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@  discard block
 block discarded – undo
31 31
 					<div class="selectbox floatright" id="upper_show">', $txt['who_show1'], '
32 32
 						<select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">';
33 33
 
34
-	foreach ($context['show_methods'] as $value => $label)
35
-		echo '
34
+	foreach ($context['show_methods'] as $value => $label) {
35
+			echo '
36 36
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
37
+	}
37 38
 	echo '
38 39
 						</select>
39 40
 						<noscript>
@@ -71,9 +72,10 @@  discard block
 block discarded – undo
71 72
 									', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
72 73
 								</span>';
73 74
 
74
-		if (!empty($member['ip']))
75
-			echo '
75
+		if (!empty($member['ip'])) {
76
+					echo '
76 77
 								(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
78
+		}
77 79
 
78 80
 		echo '
79 81
 							</td>
@@ -103,9 +105,10 @@  discard block
 block discarded – undo
103 105
 					<div class="selectbox floatright">', $txt['who_show1'], '
104 106
 						<select name="show" onchange="document.forms.whoFilter.submit();">';
105 107
 
106
-	foreach ($context['show_methods'] as $value => $label)
107
-		echo '
108
+	foreach ($context['show_methods'] as $value => $label) {
109
+			echo '
108 110
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
111
+	}
109 112
 	echo '
110 113
 						</select>
111 114
 						<noscript>
@@ -134,17 +137,19 @@  discard block
 block discarded – undo
134 137
 
135 138
 	foreach ($context['credits'] as $section)
136 139
 	{
137
-		if (isset($section['pretext']))
138
-		echo '
140
+		if (isset($section['pretext'])) {
141
+				echo '
139 142
 		<div class="windowbg noup">
140 143
 			<p>', $section['pretext'], '</p>
141 144
 		</div>';
145
+		}
142 146
 
143
-		if (isset($section['title']))
144
-		echo '
147
+		if (isset($section['title'])) {
148
+				echo '
145 149
 		<div class="cat_bar">
146 150
 			<h3 class="catbg">', $section['title'], '</h3>
147 151
 		</div>';
152
+		}
148 153
 
149 154
 		echo '
150 155
 		<div class="windowbg2 noup">
@@ -152,17 +157,18 @@  discard block
 block discarded – undo
152 157
 
153 158
 		foreach ($section['groups'] as $group)
154 159
 		{
155
-			if (isset($group['title']))
156
-				echo '
160
+			if (isset($group['title'])) {
161
+							echo '
157 162
 				<dt>
158 163
 					<strong>', $group['title'], '</strong>
159 164
 				</dt>
160 165
 				<dd>';
166
+			}
161 167
 
162 168
 			// Try to make this read nicely.
163
-			if (count($group['members']) <= 2)
164
-				echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
165
-			else
169
+			if (count($group['members']) <= 2) {
170
+							echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
171
+			} else
166 172
 			{
167 173
 				$last_peep = array_pop($group['members']);
168 174
 				echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
@@ -175,9 +181,10 @@  discard block
 block discarded – undo
175 181
 		echo '
176 182
 			</dl>';
177 183
 
178
-		if (isset($section['posttext']))
179
-			echo '
184
+		if (isset($section['posttext'])) {
185
+					echo '
180 186
 				<p class="posttext">', $section['posttext'], '</p>';
187
+		}
181 188
 
182 189
 		echo '
183 190
 		</div>';
@@ -192,26 +199,29 @@  discard block
 block discarded – undo
192 199
 		</div>
193 200
 		<div class="windowbg noup">';
194 201
 
195
-		if (!empty($context['credits_software_graphics']['graphics']))
196
-			echo '
202
+		if (!empty($context['credits_software_graphics']['graphics'])) {
203
+					echo '
197 204
 			<dl>
198 205
 				<dt><strong>', $txt['credits_graphics'], '</strong></dt>
199 206
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd>
200 207
 			</dl>';
208
+		}
201 209
 
202
-		if (!empty($context['credits_software_graphics']['software']))
203
-			echo '
210
+		if (!empty($context['credits_software_graphics']['software'])) {
211
+					echo '
204 212
 			<dl>
205 213
 				<dt><strong>', $txt['credits_software'], '</strong></dt>
206 214
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd>
207 215
 			</dl>';
216
+		}
208 217
 
209
-		if (!empty($context['credits_software_graphics']['fonts']))
210
-			echo '
218
+		if (!empty($context['credits_software_graphics']['fonts'])) {
219
+					echo '
211 220
 			<dl>
212 221
 				<dt><strong>', $txt['credits_fonts'], '</strong></dt>
213 222
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd>
214 223
 			</dl>';
224
+		}
215 225
 		echo '
216 226
 		</div>';
217 227
 	}
@@ -226,16 +236,18 @@  discard block
 block discarded – undo
226 236
 		<div class="windowbg noup">';
227 237
 
228 238
 		// Display the credits.
229
-		if (!empty($context['credits_modifications']))
230
-			echo '
239
+		if (!empty($context['credits_modifications'])) {
240
+					echo '
231 241
 			', implode('
232 242
 			<br>', $context['credits_modifications']);
243
+		}
233 244
 
234 245
 		// Legacy.
235
-		if (!empty($context['copyrights']['mods']))
236
-			echo (empty($context['credits_modifications']) ? '<br>' : ''),
246
+		if (!empty($context['copyrights']['mods'])) {
247
+					echo (empty($context['credits_modifications']) ? '<br>' : ''),
237 248
 			implode('
238 249
 			<br>', $context['copyrights']['mods']);
250
+		}
239 251
 
240 252
 		echo '
241 253
 		</div>';
Please login to merge, or discard this patch.
Themes/default/ManageSearch.template.php 1 patch
Braces   +23 added lines, -18 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 			<div class="windowbg2 noup">
112 112
 				<dl class="settings">';
113 113
 
114
-	if (!empty($context['table_info']))
115
-		echo '
114
+	if (!empty($context['table_info'])) {
115
+			echo '
116 116
 					<dt>
117 117
 						<strong>', $txt['search_method_messages_table_space'], ':</strong>
118 118
 					</dt>
@@ -125,6 +125,7 @@  discard block
 block discarded – undo
125 125
 					<dd>
126 126
 						', $context['table_info']['index_length'], '
127 127
 					</dd>';
128
+	}
128 129
 	echo '
129 130
 				</dl>
130 131
 				', $context['double_index'] ? '<div class="noticebox">
@@ -146,16 +147,17 @@  discard block
 block discarded – undo
146 147
 						<dd>
147 148
 
148 149
 							<span class="smalltext">';
149
-	if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext']))
150
-		echo '
150
+	if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) {
151
+			echo '
151 152
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]';
152
-	elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext']))
153
-		echo '
153
+	} elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) {
154
+			echo '
154 155
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create'];
155
-	else
156
-		echo '
156
+	} else {
157
+			echo '
157 158
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br>
158 159
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length'];
160
+	}
159 161
 	echo '
160 162
 								</span>
161 163
 						</dd>';
@@ -168,25 +170,27 @@  discard block
 block discarded – undo
168 170
 						</dt>
169 171
 						<dd>
170 172
 							<span class="smalltext">';
171
-	if ($context['custom_index'])
172
-		echo '
173
+	if ($context['custom_index']) {
174
+			echo '
173 175
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br>
174 176
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
175
-	elseif ($context['partial_custom_index'])
176
-		echo '
177
+	} elseif ($context['partial_custom_index']) {
178
+			echo '
177 179
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br>
178 180
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
179
-	else
180
-		echo '
181
+	} else {
182
+			echo '
181 183
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]';
184
+	}
182 185
 	echo '
183 186
 							</span>
184 187
 						</dd>';
185 188
 
186 189
 	foreach ($context['search_apis'] as $api)
187 190
 	{
188
-		if (empty($api['label']) || $api['has_template'])
189
-			continue;
191
+		if (empty($api['label']) || $api['has_template']) {
192
+					continue;
193
+		}
190 194
 
191 195
 		echo '
192 196
 						<dt>
@@ -194,12 +198,13 @@  discard block
 block discarded – undo
194 198
 							', $api['label'] ,'
195 199
 						</dt>';
196 200
 
197
-	if ($api['desc'])
198
-		echo '
201
+	if ($api['desc']) {
202
+			echo '
199 203
 						<dd>
200 204
 							<span class="smalltext">', $api['desc'], '</span>
201 205
 						</dd>';
202 206
 	}
207
+	}
203 208
 
204 209
 	echo '
205 210
 					</dl>
Please login to merge, or discard this patch.
Themes/default/Stats.template.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
 				<dt>', $txt['users_online_today'], ':</dt>
45 45
 				<dd>', $context['online_today'], '</dd>';
46 46
 
47
-	if (!empty($modSettings['hitStats']))
48
-		echo '
47
+	if (!empty($modSettings['hitStats'])) {
48
+			echo '
49 49
 				<dt>', $txt['num_hits'], ':</dt>
50 50
 				<dd>', $context['num_hits'], '</dd>';
51
+	}
51 52
 
52 53
 	echo '
53 54
 			</dl>
@@ -71,17 +72,19 @@  discard block
 block discarded – undo
71 72
 				<dt>', $txt['gender_stats'], ':</dt>
72 73
 				<dd>';
73 74
 
74
-		foreach ($context['gender'] as $g => $n)
75
-			echo $g, ': ', $n, '<br>';
75
+		foreach ($context['gender'] as $g => $n) {
76
+					echo $g, ': ', $n, '<br>';
77
+		}
76 78
 
77 79
 		echo '
78 80
 				</dd>';
79 81
 	}
80 82
 
81
-	if (!empty($modSettings['hitStats']))
82
-		echo '
83
+	if (!empty($modSettings['hitStats'])) {
84
+			echo '
83 85
 				<dt>', $txt['average_hits'], ':</dt>
84 86
 				<dd>', $context['average_hits'], '</dd>';
87
+	}
85 88
 
86 89
 	echo '
87 90
 			</dl>';
@@ -105,14 +108,15 @@  discard block
 block discarded – undo
105 108
 						</dt>
106 109
 						<dd class="statsbar">';
107 110
 
108
-			if (!empty($item['percent']))
109
-				echo '
111
+			if (!empty($item['percent'])) {
112
+							echo '
110 113
 							<div class="bar" style="width: ', $item['percent'], '%;">
111 114
 								<span class="righttext">', $item['num'], '</span>
112 115
 							</div>';
113
-			else
114
-				echo '
116
+			} else {
117
+							echo '
115 118
 							<div class="bar empty"><span class="righttext">', $item['num'], '</span></div>';
119
+			}
116 120
 
117 121
 			echo '
118 122
 						</dd>';
@@ -144,9 +148,10 @@  discard block
 block discarded – undo
144 148
 					<th>', $txt['stats_new_members'], '</th>
145 149
 					<th>', $txt['most_online'], '</th>';
146 150
 
147
-		if (!empty($modSettings['hitStats']))
148
-			echo '
151
+		if (!empty($modSettings['hitStats'])) {
152
+					echo '
149 153
 					<th>', $txt['page_views'], '</th>';
154
+		}
150 155
 
151 156
 		echo '
152 157
 				</tr>
@@ -165,9 +170,10 @@  discard block
 block discarded – undo
165 170
 					<th>', $year['new_members'], '</th>
166 171
 					<th>', $year['most_members_online'], '</th>';
167 172
 
168
-			if (!empty($modSettings['hitStats']))
169
-				echo '
173
+			if (!empty($modSettings['hitStats'])) {
174
+							echo '
170 175
 					<th>', $year['hits'], '</th>';
176
+			}
171 177
 
172 178
 			echo '
173 179
 				</tr>';
@@ -184,9 +190,10 @@  discard block
 block discarded – undo
184 190
 					<th>', $month['new_members'], '</th>
185 191
 					<th>', $month['most_members_online'], '</th>';
186 192
 
187
-				if (!empty($modSettings['hitStats']))
188
-					echo '
193
+				if (!empty($modSettings['hitStats'])) {
194
+									echo '
189 195
 					<th>', $month['hits'], '</th>';
196
+				}
190 197
 
191 198
 				echo '
192 199
 				</tr>';
@@ -203,9 +210,10 @@  discard block
 block discarded – undo
203 210
 					<td>', $day['new_members'], '</td>
204 211
 					<td>', $day['most_members_online'], '</td>';
205 212
 
206
-						if (!empty($modSettings['hitStats']))
207
-							echo '
213
+						if (!empty($modSettings['hitStats'])) {
214
+													echo '
208 215
 					<td>', $day['hits'], '</td>';
216
+						}
209 217
 
210 218
 						echo '
211 219
 				</tr>';
Please login to merge, or discard this patch.
cron.php 1 patch
Braces   +36 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,37 +41,43 @@  discard block
 block discarded – undo
41 41
 define('TIME_START', microtime(true));
42 42
 
43 43
 // Just being safe...
44
-foreach (array('db_character_set', 'cachedir') as $variable)
44
+foreach (array('db_character_set', 'cachedir') as $variable) {
45 45
 	if (isset($GLOBALS[$variable]))
46 46
 		unset($GLOBALS[$variable]);
47
+}
47 48
 
48 49
 // Get the forum's settings for database and file paths.
49 50
 require_once(dirname(__FILE__) . '/Settings.php');
50 51
 
51 52
 // Make absolutely sure the cache directory is defined.
52
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
53
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
53 54
 	$cachedir = $boarddir . '/cache';
55
+}
54 56
 
55 57
 // Don't do john didley if the forum's been shut down competely.
56
-if ($maintenance == 2)
58
+if ($maintenance == 2) {
57 59
 	die($mmessage);
60
+}
58 61
 
59 62
 // Fix for using the current directory as a path.
60
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
63
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
61 64
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
65
+}
62 66
 
63 67
 // Have we already turned this off? If so, exist gracefully.
64
-if (file_exists($cachedir . '/cron.lock'))
68
+if (file_exists($cachedir . '/cron.lock')) {
65 69
 	obExit_cron();
70
+}
66 71
 
67 72
 // Before we go any further, if this is not a CLI request, we need to do some checking.
68 73
 if (!FROM_CLI)
69 74
 {
70 75
 	// We will clean up $_GET shortly. But we want to this ASAP.
71 76
 	$ts = isset($_GET['ts']) ? (int) $_GET['ts'] : 0;
72
-	if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20)
73
-		obExit_cron();
74
-}
77
+	if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20) {
78
+			obExit_cron();
79
+	}
80
+	}
75 81
 
76 82
 // Load the most important includes. In general, a background should be loading its own dependencies.
77 83
 require_once($sourcedir . '/Errors.php');
@@ -123,8 +129,9 @@  discard block
 block discarded – undo
123 129
 	global $smcFunc;
124 130
 
125 131
 	// Check we haven't run over our time limit.
126
-	if (microtime(true) - TIME_START > MAX_CRON_TIME)
127
-		return false;
132
+	if (microtime(true) - TIME_START > MAX_CRON_TIME) {
133
+			return false;
134
+	}
128 135
 
129 136
 	// Try to find a task. Specifically, try to find one that hasn't been claimed previously, or failing that,
130 137
 	// a task that was claimed but failed for whatever reason and failed long enough ago. We should not care
@@ -159,14 +166,12 @@  discard block
 block discarded – undo
159 166
 			// Update the time and go back.
160 167
 			$row['claimed_time'] = time();
161 168
 			return $row;
162
-		}
163
-		else
169
+		} else
164 170
 		{
165 171
 			// Uh oh, we just missed it. Try to claim another one, and let it fall through if there aren't any.
166 172
 			return fetch_task();
167 173
 		}
168
-	}
169
-	else
174
+	} else
170 175
 	{
171 176
 		// No dice. Clean up and go home.
172 177
 		$smcFunc['db_free_result']($request);
@@ -187,8 +192,9 @@  discard block
 block discarded – undo
187 192
 	if (!empty($task_details['task_file']))
188 193
 	{
189 194
 		$include = strtr(trim($task_details['task_file']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
190
-		if (file_exists($include))
191
-			require_once($include);
195
+		if (file_exists($include)) {
196
+					require_once($include);
197
+		}
192 198
 	}
193 199
 
194 200
 	if (empty($task_details['task_class']))
@@ -204,8 +210,7 @@  discard block
 block discarded – undo
204 210
 		$details = empty($task_details['task_data']) ? array() : json_decode($task_details['task_data'], true);
205 211
 		$bgtask = new $task_details['task_class']($details);
206 212
 		return $bgtask->execute();
207
-	}
208
-	else
213
+	} else
209 214
 	{
210 215
 		log_error('Invalid background task specified: (class: ' . $task_details['task_class'] . ', ' . (empty($task_details['task_file']) ? ' no file' : ' to load ' . $task_details['task_file']) . ')');
211 216
 		return true; // So we clear it from the queue.
@@ -224,8 +229,9 @@  discard block
 block discarded – undo
224 229
 	$scripturl = $boardurl . '/index.php';
225 230
 
226 231
 	// These keys shouldn't be set...ever.
227
-	if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
228
-		die('Invalid request variable.');
232
+	if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
233
+			die('Invalid request variable.');
234
+	}
229 235
 
230 236
 	// Save some memory.. (since we don't use these anyway.)
231 237
 	unset($GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_VARS']);
@@ -246,26 +252,28 @@  discard block
 block discarded – undo
246 252
 	global $modSettings;
247 253
 
248 254
 	// Ignore errors if we're ignoring them or they are strict notices from PHP 5 (which cannot be solved without breaking PHP 4.)
249
-	if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && !empty($modSettings['enableErrorLogging'])))
250
-		return;
255
+	if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && !empty($modSettings['enableErrorLogging']))) {
256
+			return;
257
+	}
251 258
 
252 259
 	$error_type = 'cron';
253 260
 
254 261
 	log_error($error_level . ': ' . $error_string, $error_type, $file, $line);
255 262
 
256 263
 	// If this is an E_ERROR or E_USER_ERROR.... die.  Violently so.
257
-	if ($error_level % 255 == E_ERROR)
258
-		die('No direct access...');
259
-}
264
+	if ($error_level % 255 == E_ERROR) {
265
+			die('No direct access...');
266
+	}
267
+	}
260 268
 
261 269
 /**
262 270
  * The exit function
263 271
  */
264 272
 function obExit_cron()
265 273
 {
266
-	if (FROM_CLI)
267
-		die(0);
268
-	else
274
+	if (FROM_CLI) {
275
+			die(0);
276
+	} else
269 277
 	{
270 278
 		header('Content-Type: image/gif');
271 279
 		die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
Please login to merge, or discard this patch.
subscriptions.php 1 patch
Braces   +38 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 // Start things rolling by getting SMF alive...
18 18
 $ssi_guest_access = true;
19
-if (!file_exists(dirname(__FILE__) . '/SSI.php'))
19
+if (!file_exists(dirname(__FILE__) . '/SSI.php')) {
20 20
 	die('Cannot find SSI.php');
21
+}
21 22
 
22 23
 require_once(dirname(__FILE__) . '/SSI.php');
23 24
 require_once($sourcedir . '/ManagePaid.php');
@@ -35,20 +36,22 @@  discard block
 block discarded – undo
35 36
 }
36 37
 
37 38
 // I assume we're even active?
38
-if (empty($modSettings['paid_enabled']))
39
+if (empty($modSettings['paid_enabled'])) {
39 40
 	exit;
41
+}
40 42
 
41 43
 // If we have some custom people who find out about problems load them here.
42 44
 $notify_users = array();
43 45
 if (!empty($modSettings['paid_email_to']))
44 46
 {
45
-	foreach (explode(',', $modSettings['paid_email_to']) as $email)
46
-		$notify_users[] = array(
47
+	foreach (explode(',', $modSettings['paid_email_to']) as $email) {
48
+			$notify_users[] = array(
47 49
 			'email' => $email,
48 50
 			'name' => $txt['who_member'],
49 51
 			'id' => 0,
50 52
 		);
51
-}
53
+	}
54
+	}
52 55
 
53 56
 // We need to see whether we can find the correct payment gateway,
54 57
 // we'll going to go through all our gateway scripts and find out
@@ -65,8 +68,9 @@  discard block
 block discarded – undo
65 68
 	}
66 69
 }
67 70
 
68
-if (empty($txnType))
71
+if (empty($txnType)) {
69 72
 	generateSubscriptionError($txt['paid_unknown_transaction_type']);
73
+}
70 74
 
71 75
 // Get the subscription and member ID amoungst others...
72 76
 @list($subscription_id, $member_id) = $gatewayClass->precheck();
@@ -76,8 +80,9 @@  discard block
 block discarded – undo
76 80
 $member_id = (int) $member_id;
77 81
 
78 82
 // This would be bad...
79
-if (empty($member_id))
83
+if (empty($member_id)) {
80 84
 	generateSubscriptionError($txt['paid_empty_member']);
85
+}
81 86
 
82 87
 // Verify the member.
83 88
 $request = $smcFunc['db_query']('', '
@@ -89,8 +94,9 @@  discard block
 block discarded – undo
89 94
 	)
90 95
 );
91 96
 // Didn't find them?
92
-if ($smcFunc['db_num_rows']($request) === 0)
97
+if ($smcFunc['db_num_rows']($request) === 0) {
93 98
 	generateSubscriptionError(sprintf($txt['paid_could_not_find_member'], $member_id));
99
+}
94 100
 $member_info = $smcFunc['db_fetch_assoc']($request);
95 101
 $smcFunc['db_free_result']($request);
96 102
 
@@ -105,8 +111,9 @@  discard block
 block discarded – undo
105 111
 );
106 112
 
107 113
 // Didn't find it?
108
-if ($smcFunc['db_num_rows']($request) === 0)
114
+if ($smcFunc['db_num_rows']($request) === 0) {
109 115
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription'], $member_id, $subscription_id));
116
+}
110 117
 
111 118
 $subscription_info = $smcFunc['db_fetch_assoc']($request);
112 119
 $smcFunc['db_free_result']($request);
@@ -123,8 +130,9 @@  discard block
 block discarded – undo
123 130
 		'current_member' => $member_id,
124 131
 	)
125 132
 );
126
-if ($smcFunc['db_num_rows']($request) === 0)
133
+if ($smcFunc['db_num_rows']($request) === 0) {
127 134
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription_log'], $member_id, $subscription_id));
135
+}
128 136
 $subscription_info += $smcFunc['db_fetch_assoc']($request);
129 137
 $smcFunc['db_free_result']($request);
130 138
 
@@ -139,8 +147,7 @@  discard block
 block discarded – undo
139 147
 		removeSubscription($subscription_id, $member_id);
140 148
 		$subscription_act = time();
141 149
 		$status = 0;
142
-	}
143
-	else
150
+	} else
144 151
 	{
145 152
 		loadSubscriptions();
146 153
 		$subscription_act = $subscription_info['end_time'] - $context['subscriptions'][$subscription_id]['num_length'];
@@ -188,16 +195,18 @@  discard block
 block discarded – undo
188 195
 	if (!$gatewayClass->isSubscription())
189 196
 	{
190 197
 		$real_details = json_decode($subscription_info['pending_details'], true);
191
-		if (empty($real_details))
192
-			generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
198
+		if (empty($real_details)) {
199
+					generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
200
+		}
193 201
 
194 202
 		// Now we just try to find anything pending.
195 203
 		// We don't really care which it is as security happens later.
196 204
 		foreach ($real_details as $id => $detail)
197 205
 		{
198 206
 			unset($real_details[$id]);
199
-			if ($detail[3] == 'payback' && $subscription_info['payments_pending'])
200
-				$subscription_info['payments_pending']--;
207
+			if ($detail[3] == 'payback' && $subscription_info['payments_pending']) {
208
+							$subscription_info['payments_pending']--;
209
+			}
201 210
 			break;
202 211
 		}
203 212
 
@@ -223,10 +232,11 @@  discard block
 block discarded – undo
223 232
 		// This is a little harder, can we find the right duration?
224 233
 		foreach ($cost as $duration => $value)
225 234
 		{
226
-			if ($duration == 'fixed')
227
-				continue;
228
-			elseif ((float) $value == (float) $total_cost)
229
-				$found_duration = strtoupper(substr($duration, 0, 1));
235
+			if ($duration == 'fixed') {
236
+							continue;
237
+			} elseif ((float) $value == (float) $total_cost) {
238
+							$found_duration = strtoupper(substr($duration, 0, 1));
239
+			}
230 240
 		}
231 241
 
232 242
 		// If we have the duration then we're done.
@@ -235,8 +245,7 @@  discard block
 block discarded – undo
235 245
 			$notify = true;
236 246
 			addSubscription($subscription_id, $member_id, $found_duration);
237 247
 		}
238
-	}
239
-	else
248
+	} else
240 249
 	{
241 250
 		$actual_cost = $cost['fixed'];
242 251
 
@@ -268,10 +277,10 @@  discard block
 block discarded – undo
268 277
 // Maybe they're cancelling. Some subscriptions may require actively doing something, but PayPal doesn't, for example.
269 278
 elseif ($gatewayClass->isCancellation())
270 279
 {
271
-	if (method_exists($gatewayClass, 'performCancel'))
272
-		$gatewayClass->performCancel($subscription_id, $member_id, $subscription_info);
273
-}
274
-else
280
+	if (method_exists($gatewayClass, 'performCancel')) {
281
+			$gatewayClass->performCancel($subscription_id, $member_id, $subscription_info);
282
+	}
283
+	} else
275 284
 {
276 285
 	// Some other "valid" transaction such as:
277 286
 	//
@@ -308,8 +317,9 @@  discard block
 block discarded – undo
308 317
 	// Maybe we can try to give them the post data?
309 318
 	if (!empty($_POST))
310 319
 	{
311
-		foreach ($_POST as $key => $val)
312
-			$text .= '<br>' . $smcFunc['htmlspecialchars']($key) . ': ' . $smcFunc['htmlspecialchars']($val);
320
+		foreach ($_POST as $key => $val) {
321
+					$text .= '<br>' . $smcFunc['htmlspecialchars']($key) . ': ' . $smcFunc['htmlspecialchars']($val);
322
+		}
313 323
 	}
314 324
 
315 325
 	// Then just log and die.
Please login to merge, or discard this patch.
Sources/Subs-Categories.php 1 patch
Braces   +44 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
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
  * Edit the position and properties of a category.
@@ -42,8 +43,9 @@  discard block
 block discarded – undo
42 43
 		$cat_order = array();
43 44
 
44 45
 		// Setting 'move_after' to '0' moves the category to the top.
45
-		if ($catOptions['move_after'] == 0)
46
-			$cats[] = $category_id;
46
+		if ($catOptions['move_after'] == 0) {
47
+					$cats[] = $category_id;
48
+		}
47 49
 
48 50
 		// Grab the categories sorted by cat_order.
49 51
 		$request = $smcFunc['db_query']('', '
@@ -55,17 +57,19 @@  discard block
 block discarded – undo
55 57
 		);
56 58
 		while ($row = $smcFunc['db_fetch_assoc']($request))
57 59
 		{
58
-			if ($row['id_cat'] != $category_id)
59
-				$cats[] = $row['id_cat'];
60
-			if ($row['id_cat'] == $catOptions['move_after'])
61
-				$cats[] = $category_id;
60
+			if ($row['id_cat'] != $category_id) {
61
+							$cats[] = $row['id_cat'];
62
+			}
63
+			if ($row['id_cat'] == $catOptions['move_after']) {
64
+							$cats[] = $category_id;
65
+			}
62 66
 			$cat_order[$row['id_cat']] = $row['cat_order'];
63 67
 		}
64 68
 		$smcFunc['db_free_result']($request);
65 69
 
66 70
 		// Set the new order for the categories.
67
-		foreach ($cats as $index => $cat)
68
-			if ($index != $cat_order[$cat])
71
+		foreach ($cats as $index => $cat) {
72
+					if ($index != $cat_order[$cat])
69 73
 				$smcFunc['db_query']('', '
70 74
 					UPDATE {db_prefix}categories
71 75
 					SET cat_order = {int:new_order}
@@ -75,6 +79,7 @@  discard block
 block discarded – undo
75 79
 						'current_category' => $cat,
76 80
 					)
77 81
 				);
82
+		}
78 83
 
79 84
 		// If the category order changed, so did the board order.
80 85
 		require_once($sourcedir . '/Subs-Boards.php');
@@ -117,8 +122,9 @@  discard block
 block discarded – undo
117 122
 			))
118 123
 		);
119 124
 
120
-		if (empty($catOptions['dont_log']))
121
-			logAction('edit_cat', array('catname' => isset($catOptions['cat_name']) ? $catOptions['cat_name'] : $category_id), 'admin');
125
+		if (empty($catOptions['dont_log'])) {
126
+					logAction('edit_cat', array('catname' => isset($catOptions['cat_name']) ? $catOptions['cat_name'] : $category_id), 'admin');
127
+		}
122 128
 	}
123 129
 }
124 130
 
@@ -135,16 +141,20 @@  discard block
 block discarded – undo
135 141
 	global $smcFunc;
136 142
 
137 143
 	// Check required values.
138
-	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '')
139
-		trigger_error('createCategory(): A category name is required', E_USER_ERROR);
144
+	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '') {
145
+			trigger_error('createCategory(): A category name is required', E_USER_ERROR);
146
+	}
140 147
 
141 148
 	// Set default values.
142
-	if (!isset($catOptions['cat_desc']))
143
-		$catOptions['cat_desc'] = '';
144
-	if (!isset($catOptions['move_after']))
145
-		$catOptions['move_after'] = 0;
146
-	if (!isset($catOptions['is_collapsible']))
147
-		$catOptions['is_collapsible'] = true;
149
+	if (!isset($catOptions['cat_desc'])) {
150
+			$catOptions['cat_desc'] = '';
151
+	}
152
+	if (!isset($catOptions['move_after'])) {
153
+			$catOptions['move_after'] = 0;
154
+	}
155
+	if (!isset($catOptions['is_collapsible'])) {
156
+			$catOptions['is_collapsible'] = true;
157
+	}
148 158
 	// Don't log an edit right after.
149 159
 	$catOptions['dont_log'] = true;
150 160
 
@@ -212,21 +222,24 @@  discard block
 block discarded – undo
212 222
 			)
213 223
 		);
214 224
 		$boards_inside = array();
215
-		while ($row = $smcFunc['db_fetch_assoc']($request))
216
-			$boards_inside[] = $row['id_board'];
225
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
226
+					$boards_inside[] = $row['id_board'];
227
+		}
217 228
 		$smcFunc['db_free_result']($request);
218 229
 
219
-		if (!empty($boards_inside))
220
-			deleteBoards($boards_inside, null);
230
+		if (!empty($boards_inside)) {
231
+					deleteBoards($boards_inside, null);
232
+		}
221 233
 	}
222 234
 
223 235
 	// Make sure the safe category is really safe.
224
-	elseif (in_array($moveBoardsTo, $categories))
225
-		trigger_error('deleteCategories(): You cannot move the boards to a category that\'s being deleted', E_USER_ERROR);
236
+	elseif (in_array($moveBoardsTo, $categories)) {
237
+			trigger_error('deleteCategories(): You cannot move the boards to a category that\'s being deleted', E_USER_ERROR);
238
+	}
226 239
 
227 240
 	// Move the boards inside the categories to a safe category.
228
-	else
229
-		$smcFunc['db_query']('', '
241
+	else {
242
+			$smcFunc['db_query']('', '
230 243
 			UPDATE {db_prefix}boards
231 244
 			SET id_cat = {int:new_parent_cat}
232 245
 			WHERE id_cat IN ({array_int:category_list})',
@@ -235,6 +248,7 @@  discard block
 block discarded – undo
235 248
 				'new_parent_cat' => $moveBoardsTo,
236 249
 			)
237 250
 		);
251
+	}
238 252
 
239 253
 	// Do the deletion of the category itself
240 254
 	$smcFunc['db_query']('', '
@@ -246,8 +260,9 @@  discard block
 block discarded – undo
246 260
 	);
247 261
 
248 262
 	// Log what we've done.
249
-	foreach ($categories as $category)
250
-		logAction('delete_cat', array('catname' => $cat_tree[$category]['node']['name']), 'admin');
263
+	foreach ($categories as $category) {
264
+			logAction('delete_cat', array('catname' => $cat_tree[$category]['node']['name']), 'admin');
265
+	}
251 266
 
252 267
 	// Get all boards back into the right order.
253 268
 	reorderBoards();
Please login to merge, or discard this patch.
Sources/Who.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 						'Shitiz &quot;Dragooon&quot; Garg',
591 591
 						'Karl &quot;RegularExpression&quot; Benson',
592 592
 						'Matthew &quot;Labradoodle-360&quot; Kerle',
593
-						$user_info['is_admin'] ? 'Matt &quot;Grudge&quot; Wolf': 'Grudge',
593
+						$user_info['is_admin'] ? 'Matt &quot;Grudge&quot; Wolf' : 'Grudge',
594 594
 						'Michael &quot;Thantos&quot; Miller',
595 595
 						'Norv',
596 596
 						'Peter "Arantor" Spicer',
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
 			$credit_info = smf_json_decode($row['credits'], true);
814 814
 
815 815
 			$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' &copy; ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);
816
-			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
816
+			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
817 817
 			$version = $txt['credits_version'] . ' ' . $row['version'];
818 818
 			$title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version;
819 819
 
820 820
 			// build this one out and stash it away
821 821
 			$mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>';
822
-			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license  : '') . (!empty($copyright) ? ' | ' . $copyright  : '');
822
+			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : '');
823 823
 		}
824 824
 		cache_put_data('mods_credits', $mods, 86400);
825 825
 	}
Please login to merge, or discard this patch.
Braces   +126 added lines, -95 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 3
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Who's online, and what are they doing?
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
 	isAllowedTo('who_view');
36 37
 
37 38
 	// You can't do anything if this is off.
38
-	if (empty($modSettings['who_enabled']))
39
-		fatal_lang_error('who_off', false);
39
+	if (empty($modSettings['who_enabled'])) {
40
+			fatal_lang_error('who_off', false);
41
+	}
40 42
 
41 43
 	// Load the 'Who' template.
42 44
 	loadTemplate('Who');
@@ -71,9 +73,9 @@  discard block
 block discarded – undo
71 73
 		$show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)';
72 74
 		$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
73 75
 		$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
76
+	} elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders') {
77
+			unset($_SESSION['who_online_filter']);
74 78
 	}
75
-	elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders')
76
-		unset($_SESSION['who_online_filter']);
77 79
 
78 80
 	// Does the user prefer a different sort direction?
79 81
 	if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']]))
@@ -97,20 +99,24 @@  discard block
 block discarded – undo
97 99
 	$context['sort_direction'] = isset($_REQUEST['asc']) || (isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc') ? 'up' : 'down';
98 100
 
99 101
 	$conditions = array();
100
-	if (!allowedTo('moderate_forum'))
101
-		$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
102
+	if (!allowedTo('moderate_forum')) {
103
+			$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
104
+	}
102 105
 
103 106
 	// Fallback to top filter?
104
-	if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top']))
105
-		$_REQUEST['show'] = $_REQUEST['show_top'];
107
+	if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) {
108
+			$_REQUEST['show'] = $_REQUEST['show_top'];
109
+	}
106 110
 	// Does the user wish to apply a filter?
107
-	if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']]))
108
-		$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
111
+	if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) {
112
+			$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
113
+	}
109 114
 	// Perhaps we saved a filter earlier in the session?
110
-	elseif (isset($_SESSION['who_online_filter']))
111
-		$context['show_by'] = $_SESSION['who_online_filter'];
112
-	else
113
-		$context['show_by'] = 'members';
115
+	elseif (isset($_SESSION['who_online_filter'])) {
116
+			$context['show_by'] = $_SESSION['who_online_filter'];
117
+	} else {
118
+			$context['show_by'] = 'members';
119
+	}
114 120
 
115 121
 	$conditions[] = $show_methods[$context['show_by']];
116 122
 
@@ -156,8 +162,9 @@  discard block
 block discarded – undo
156 162
 	while ($row = $smcFunc['db_fetch_assoc']($request))
157 163
 	{
158 164
 		$actions = smf_json_decode($row['url'], true);
159
-		if ($actions === false)
160
-			continue;
165
+		if ($actions === false) {
166
+					continue;
167
+		}
161 168
 
162 169
 		// Send the information to the template.
163 170
 		$context['members'][$row['session']] = array(
@@ -195,8 +202,8 @@  discard block
 block discarded – undo
195 202
 	$spiderContext = array();
196 203
 	if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
197 204
 	{
198
-		foreach (smf_json_decode($modSettings['spider_name_cache'], true) as $id => $name)
199
-			$spiderContext[$id] = array(
205
+		foreach (smf_json_decode($modSettings['spider_name_cache'], true) as $id => $name) {
206
+					$spiderContext[$id] = array(
200 207
 				'id' => 0,
201 208
 				'name' => $name,
202 209
 				'group' => $txt['spiders'],
@@ -205,6 +212,7 @@  discard block
 block discarded – undo
205 212
 				'email' => $name,
206 213
 				'is_guest' => true
207 214
 			);
215
+		}
208 216
 	}
209 217
 
210 218
 	$url_data = determineActions($url_data);
@@ -219,16 +227,18 @@  discard block
 block discarded – undo
219 227
 	// Put it in the context variables.
220 228
 	foreach ($context['members'] as $i => $member)
221 229
 	{
222
-		if ($member['id'] != 0)
223
-			$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
230
+		if ($member['id'] != 0) {
231
+					$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
232
+		}
224 233
 
225 234
 		// Keep the IP that came from the database.
226 235
 		$memberContext[$member['id']]['ip'] = $member['ip'];
227 236
 		$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
228
-		if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']]))
229
-			$context['members'][$i] += $spiderContext[$member['id_spider']];
230
-		else
231
-			$context['members'][$i] += $memberContext[$member['id']];
237
+		if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']])) {
238
+					$context['members'][$i] += $spiderContext[$member['id_spider']];
239
+		} else {
240
+					$context['members'][$i] += $memberContext[$member['id']];
241
+		}
232 242
 	}
233 243
 
234 244
 	// Some people can't send personal messages...
@@ -263,8 +273,9 @@  discard block
 block discarded – undo
263 273
 {
264 274
 	global $txt, $user_info, $modSettings, $smcFunc;
265 275
 
266
-	if (!allowedTo('who_view'))
267
-		return array();
276
+	if (!allowedTo('who_view')) {
277
+			return array();
278
+	}
268 279
 	loadLanguage('Who');
269 280
 
270 281
 	// Actions that require a specific permission level.
@@ -292,10 +303,11 @@  discard block
 block discarded – undo
292 303
 	);
293 304
 	call_integration_hook('who_allowed', array(&$allowedActions));
294 305
 
295
-	if (!is_array($urls))
296
-		$url_list = array(array($urls, $user_info['id']));
297
-	else
298
-		$url_list = $urls;
306
+	if (!is_array($urls)) {
307
+			$url_list = array(array($urls, $user_info['id']));
308
+	} else {
309
+			$url_list = $urls;
310
+	}
299 311
 
300 312
 	// These are done to later query these in large chunks. (instead of one by one.)
301 313
 	$topic_ids = array();
@@ -307,12 +319,14 @@  discard block
 block discarded – undo
307 319
 	{
308 320
 		// Get the request parameters..
309 321
 		$actions = smf_json_decode($url[0], true);
310
-		if ($actions === false)
311
-			continue;
322
+		if ($actions === false) {
323
+					continue;
324
+		}
312 325
 
313 326
 		// If it's the admin or moderation center, and there is an area set, use that instead.
314
-		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area']))
315
-			$actions['action'] = $actions['area'];
327
+		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area'])) {
328
+					$actions['action'] = $actions['area'];
329
+		}
316 330
 
317 331
 		// Check if there was no action or the action is display.
318 332
 		if (!isset($actions['action']) || $actions['action'] == 'display')
@@ -332,12 +346,14 @@  discard block
 block discarded – undo
332 346
 				$board_ids[$actions['board']][$k] = $txt['who_board'];
333 347
 			}
334 348
 			// It's the board index!!  It must be!
335
-			else
336
-				$data[$k] = $txt['who_index'];
349
+			else {
350
+							$data[$k] = $txt['who_index'];
351
+			}
337 352
 		}
338 353
 		// Probably an error or some goon?
339
-		elseif ($actions['action'] == '')
340
-			$data[$k] = $txt['who_index'];
354
+		elseif ($actions['action'] == '') {
355
+					$data[$k] = $txt['who_index'];
356
+		}
341 357
 		// Some other normal action...?
342 358
 		else
343 359
 		{
@@ -345,23 +361,25 @@  discard block
 block discarded – undo
345 361
 			if ($actions['action'] == 'profile')
346 362
 			{
347 363
 				// Whose?  Their own?
348
-				if (empty($actions['u']))
349
-					$actions['u'] = $url[1];
364
+				if (empty($actions['u'])) {
365
+									$actions['u'] = $url[1];
366
+				}
350 367
 
351 368
 				$data[$k] = $txt['who_hidden'];
352 369
 				$profile_ids[(int) $actions['u']][$k] = $actions['u'] == $url[1] ? $txt['who_viewownprofile'] : $txt['who_viewprofile'];
353
-			}
354
-			elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
370
+			} elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
355 371
 			{
356 372
 				$data[$k] = $txt['who_hidden'];
357 373
 				$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
358 374
 			}
359 375
 			// A subaction anyone can view... if the language string is there, show it.
360
-			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']]))
361
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
376
+			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']])) {
377
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
378
+			}
362 379
 			// An action any old fellow can look at. (if ['whoall_' . $action] exists, we know everyone can see it.)
363
-			elseif (isset($txt['whoall_' . $actions['action']]))
364
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
380
+			elseif (isset($txt['whoall_' . $actions['action']])) {
381
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
382
+			}
365 383
 			// Viewable if and only if they can see the board...
366 384
 			elseif (isset($txt['whotopic_' . $actions['action']]))
367 385
 			{
@@ -370,8 +388,7 @@  discard block
 block discarded – undo
370 388
 
371 389
 				$data[$k] = $txt['who_hidden'];
372 390
 				$topic_ids[$topic][$k] = $txt['whotopic_' . $actions['action']];
373
-			}
374
-			elseif (isset($txt['whopost_' . $actions['action']]))
391
+			} elseif (isset($txt['whopost_' . $actions['action']]))
375 392
 			{
376 393
 				// Find out what message they are accessing.
377 394
 				$msgid = (int) (isset($actions['msg']) ? $actions['msg'] : (isset($actions['quote']) ? $actions['quote'] : 0));
@@ -394,41 +411,46 @@  discard block
 block discarded – undo
394 411
 				$data[$k] = sprintf($txt['whopost_' . $actions['action']], $id_topic, $subject);
395 412
 				$smcFunc['db_free_result']($result);
396 413
 
397
-				if (empty($id_topic))
398
-					$data[$k] = $txt['who_hidden'];
414
+				if (empty($id_topic)) {
415
+									$data[$k] = $txt['who_hidden'];
416
+				}
399 417
 			}
400 418
 			// Viewable only by administrators.. (if it starts with whoadmin, it's admin only!)
401
-			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']]))
402
-				$data[$k] = $txt['whoadmin_' . $actions['action']];
419
+			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']])) {
420
+							$data[$k] = $txt['whoadmin_' . $actions['action']];
421
+			}
403 422
 			// Viewable by permission level.
404 423
 			elseif (isset($allowedActions[$actions['action']]))
405 424
 			{
406
-				if (allowedTo($allowedActions[$actions['action']]))
407
-					$data[$k] = $txt['whoallow_' . $actions['action']];
408
-				elseif (in_array('moderate_forum', $allowedActions[$actions['action']]))
409
-					$data[$k] = $txt['who_moderate'];
410
-				elseif (in_array('admin_forum', $allowedActions[$actions['action']]))
411
-					$data[$k] = $txt['who_admin'];
412
-				else
413
-					$data[$k] = $txt['who_hidden'];
425
+				if (allowedTo($allowedActions[$actions['action']])) {
426
+									$data[$k] = $txt['whoallow_' . $actions['action']];
427
+				} elseif (in_array('moderate_forum', $allowedActions[$actions['action']])) {
428
+									$data[$k] = $txt['who_moderate'];
429
+				} elseif (in_array('admin_forum', $allowedActions[$actions['action']])) {
430
+									$data[$k] = $txt['who_admin'];
431
+				} else {
432
+									$data[$k] = $txt['who_hidden'];
433
+				}
434
+			} elseif (!empty($actions['action'])) {
435
+							$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
436
+			} else {
437
+							$data[$k] = $txt['who_unknown'];
414 438
 			}
415
-			elseif (!empty($actions['action']))
416
-				$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
417
-			else
418
-				$data[$k] = $txt['who_unknown'];
419 439
 		}
420 440
 
421 441
 		if (isset($actions['error']))
422 442
 		{
423
-			if (isset($txt[$actions['error']]))
424
-				$error_message = str_replace('"', '&quot;', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
425
-			elseif ($actions['error'] == 'guest_login')
426
-				$error_message = str_replace('"', '&quot;', $txt['who_guest_login']);
427
-			else
428
-				$error_message = str_replace('"', '&quot;', $actions['error']);
429
-
430
-			if (!empty($error_message))
431
-				$data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>';
443
+			if (isset($txt[$actions['error']])) {
444
+							$error_message = str_replace('"', '&quot;', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
445
+			} elseif ($actions['error'] == 'guest_login') {
446
+							$error_message = str_replace('"', '&quot;', $txt['who_guest_login']);
447
+			} else {
448
+							$error_message = str_replace('"', '&quot;', $actions['error']);
449
+			}
450
+
451
+			if (!empty($error_message)) {
452
+							$data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>';
453
+			}
432 454
 		}
433 455
 
434 456
 		// Maybe the action is integrated into another system?
@@ -439,12 +461,15 @@  discard block
 block discarded – undo
439 461
 				if (!empty($integrate_action))
440 462
 				{
441 463
 					$data[$k] = $integrate_action;
442
-					if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k]))
443
-						$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
444
-					if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k]))
445
-						$board_ids[(int) $actions['board']][$k] = $integrate_action;
446
-					if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k]))
447
-						$profile_ids[(int) $actions['u']][$k] = $integrate_action;
464
+					if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k])) {
465
+											$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
466
+					}
467
+					if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k])) {
468
+											$board_ids[(int) $actions['board']][$k] = $integrate_action;
469
+					}
470
+					if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k])) {
471
+											$profile_ids[(int) $actions['u']][$k] = $integrate_action;
472
+					}
448 473
 					break;
449 474
 				}
450 475
 			}
@@ -472,8 +497,9 @@  discard block
 block discarded – undo
472 497
 		while ($row = $smcFunc['db_fetch_assoc']($result))
473 498
 		{
474 499
 			// Show the topic's subject for each of the actions.
475
-			foreach ($topic_ids[$row['id_topic']] as $k => $session_text)
476
-				$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
500
+			foreach ($topic_ids[$row['id_topic']] as $k => $session_text) {
501
+							$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
502
+			}
477 503
 		}
478 504
 		$smcFunc['db_free_result']($result);
479 505
 	}
@@ -495,8 +521,9 @@  discard block
 block discarded – undo
495 521
 		while ($row = $smcFunc['db_fetch_assoc']($result))
496 522
 		{
497 523
 			// Put the board name into the string for each member...
498
-			foreach ($board_ids[$row['id_board']] as $k => $session_text)
499
-				$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
524
+			foreach ($board_ids[$row['id_board']] as $k => $session_text) {
525
+							$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
526
+			}
500 527
 		}
501 528
 		$smcFunc['db_free_result']($result);
502 529
 	}
@@ -518,23 +545,26 @@  discard block
 block discarded – undo
518 545
 		while ($row = $smcFunc['db_fetch_assoc']($result))
519 546
 		{
520 547
 			// If they aren't allowed to view this person's profile, skip it.
521
-			if (!$allow_view_any && ($user_info['id'] != $row['id_member']))
522
-				continue;
548
+			if (!$allow_view_any && ($user_info['id'] != $row['id_member'])) {
549
+							continue;
550
+			}
523 551
 
524 552
 			// Set their action on each - session/text to sprintf.
525
-			foreach ($profile_ids[$row['id_member']] as $k => $session_text)
526
-				$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
553
+			foreach ($profile_ids[$row['id_member']] as $k => $session_text) {
554
+							$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
555
+			}
527 556
 		}
528 557
 		$smcFunc['db_free_result']($result);
529 558
 	}
530 559
 
531 560
 	call_integration_hook('whos_online_after', array(&$urls, &$data));
532 561
 
533
-	if (!is_array($urls))
534
-		return isset($data[0]) ? $data[0] : false;
535
-	else
536
-		return $data;
537
-}
562
+	if (!is_array($urls)) {
563
+			return isset($data[0]) ? $data[0] : false;
564
+	} else {
565
+			return $data;
566
+	}
567
+	}
538 568
 
539 569
 /**
540 570
  * It prepares credit and copyright information for the credits page or the admin page
@@ -709,8 +739,8 @@  discard block
 block discarded – undo
709 739
 	);
710 740
 
711 741
 	// Give the translators some credit for their hard work.
712
-	if (!empty($txt['translation_credits']))
713
-		$context['credits'][] = array(
742
+	if (!empty($txt['translation_credits'])) {
743
+			$context['credits'][] = array(
714 744
 			'title' => $txt['credits_groups_translation'],
715 745
 			'groups' => array(
716 746
 				array(
@@ -719,6 +749,7 @@  discard block
 block discarded – undo
719 749
 				),
720 750
 			),
721 751
 		);
752
+	}
722 753
 
723 754
 	$context['credits'][] = array(
724 755
 		'title' => $txt['credits_special'],
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -673,7 +673,7 @@
 block discarded – undo
673 673
 						'Nikola &quot;Dzonny&quot; Novakovi&cacute;',
674 674
 						// Localizers
675 675
 						'Dr. Deejay',
676
-                        			'd3vcho',
676
+									'd3vcho',
677 677
 						// Former Localizers
678 678
 						'Relyana',
679 679
 					),
Please login to merge, or discard this patch.
Sources/Subs-Recent.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
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
  * Get the latest posts of a forum.
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 		censorText($row['body']);
60 61
 
61 62
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
62
-		if ($smcFunc['strlen']($row['body']) > 128)
63
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
63
+		if ($smcFunc['strlen']($row['body']) > 128) {
64
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
65
+		}
64 66
 
65 67
 		// Build the array.
66 68
 		$posts[] = array(
Please login to merge, or discard this patch.
Sources/PackageGet.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
 		{
182 182
 			collapsedDiv.show(\'slow\');
183 183
 			icon.removeClass(\'toggle_down\').addClass(\'toggle_up\');
184
-			icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) .');
184
+			icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) . ');
185 185
 		}
186 186
 
187 187
 		else
188 188
 		{
189 189
 			collapsedDiv.hide(\'slow\');
190 190
 			icon.removeClass(\'toggle_up\').addClass(\'toggle_down\');
191
-			icon.prop(\'title\', '. JavaScriptEscape($txt['show']) .');
191
+			icon.prop(\'title\', '. JavaScriptEscape($txt['show']) . ');
192 192
 		}
193 193
 
194 194
 	});', true);
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
 	// Setup the correct template, even though I'll admit we ain't downloading ;)
643 643
 	$context['sub_template'] = 'downloaded';
644
-	$allowext = array('.zip','.tgz','.gz');
644
+	$allowext = array('.zip', '.tgz', '.gz');
645 645
 	// @todo Use FTP if the Packages directory is not writable.
646 646
 
647 647
 	// Check the file was even sent!
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
 	// Make sure it has a sane filename.
654 654
 	$_FILES['package']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['package']['name']);
655 655
 	$extension = substr(strrchr(strtolower($_FILES['package']['name']), '.'), 0);
656
-	if(!in_array($extension, $allowext))
656
+	if (!in_array($extension, $allowext))
657 657
 	{
658 658
 		fatal_lang_error('package_upload_error_supports', false, array('zip, tgz, tar.gz'));
659 659
 	}
660 660
 	
661 661
 	// We only need the filename...
662
-	$extension = ($extension == '.gz') ? '.tar.gz' : $extension ;
662
+	$extension = ($extension == '.gz') ? '.tar.gz' : $extension;
663 663
 	$packageName = time() . $extension;
664 664
 
665 665
 	// Setup the destination and throw an error if the file is already there!
Please login to merge, or discard this patch.
Braces   +197 added lines, -154 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
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
  * Browse the list of package servers, add servers...
@@ -43,13 +44,15 @@  discard block
 block discarded – undo
43 44
 	);
44 45
 
45 46
 	// Now let's decide where we are taking this...
46
-	if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]))
47
-		$context['sub_action'] = $_REQUEST['sa'];
47
+	if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) {
48
+			$context['sub_action'] = $_REQUEST['sa'];
49
+	}
48 50
 	// We need to support possible old javascript links...
49
-	elseif (isset($_GET['pgdownload']))
50
-		$context['sub_action'] = 'download';
51
-	else
52
-		$context['sub_action'] = 'servers';
51
+	elseif (isset($_GET['pgdownload'])) {
52
+			$context['sub_action'] = 'download';
53
+	} else {
54
+			$context['sub_action'] = 'servers';
55
+	}
53 56
 
54 57
 	// We need to force the "Download" tab as selected.
55 58
 	$context['menu_data_' . $context['admin_menu_id']]['current_subsection'] = 'packageget';
@@ -141,17 +144,19 @@  discard block
 block discarded – undo
141 144
 			{
142 145
 				require_once($sourcedir . '/Class-Package.php');
143 146
 				$ftp = new ftp_connection(null);
147
+			} elseif ($ftp->error !== false && !isset($ftp_error)) {
148
+							$ftp_error = $ftp->last_message === null ? '' : $ftp->last_message;
144 149
 			}
145
-			elseif ($ftp->error !== false && !isset($ftp_error))
146
-				$ftp_error = $ftp->last_message === null ? '' : $ftp->last_message;
147 150
 
148 151
 			list ($username, $detect_path, $found_path) = $ftp->detect_path($packagesdir);
149 152
 
150
-			if ($found_path || !isset($_POST['ftp_path']))
151
-				$_POST['ftp_path'] = $detect_path;
153
+			if ($found_path || !isset($_POST['ftp_path'])) {
154
+							$_POST['ftp_path'] = $detect_path;
155
+			}
152 156
 
153
-			if (!isset($_POST['ftp_username']))
154
-				$_POST['ftp_username'] = $username;
157
+			if (!isset($_POST['ftp_username'])) {
158
+							$_POST['ftp_username'] = $username;
159
+			}
155 160
 
156 161
 			$context['package_ftp'] = array(
157 162
 				'server' => isset($_POST['ftp_server']) ? $_POST['ftp_server'] : (isset($modSettings['package_server']) ? $modSettings['package_server'] : 'localhost'),
@@ -160,8 +165,7 @@  discard block
 block discarded – undo
160 165
 				'path' => $_POST['ftp_path'],
161 166
 				'error' => empty($ftp_error) ? null : $ftp_error,
162 167
 			);
163
-		}
164
-		else
168
+		} else
165 169
 		{
166 170
 			$context['package_download_broken'] = false;
167 171
 
@@ -203,8 +207,9 @@  discard block
 block discarded – undo
203 207
 
204 208
 	if (isset($_GET['server']))
205 209
 	{
206
-		if ($_GET['server'] == '')
207
-			redirectexit('action=admin;area=packages;get');
210
+		if ($_GET['server'] == '') {
211
+					redirectexit('action=admin;area=packages;get');
212
+		}
208 213
 
209 214
 		$server = (int) $_GET['server'];
210 215
 
@@ -222,17 +227,18 @@  discard block
 block discarded – undo
222 227
 		$smcFunc['db_free_result']($request);
223 228
 
224 229
 		// If the server does not exist, dump out.
225
-		if (empty($url))
226
-			fatal_lang_error('couldnt_connect', false);
230
+		if (empty($url)) {
231
+					fatal_lang_error('couldnt_connect', false);
232
+		}
227 233
 
228 234
 		// If there is a relative link, append to the stored server url.
229
-		if (isset($_GET['relative']))
230
-			$url = $url . (substr($url, -1) == '/' ? '' : '/') . $_GET['relative'];
235
+		if (isset($_GET['relative'])) {
236
+					$url = $url . (substr($url, -1) == '/' ? '' : '/') . $_GET['relative'];
237
+		}
231 238
 
232 239
 		// Clear any "absolute" URL.  Since "server" is present, "absolute" is garbage.
233 240
 		unset($_GET['absolute']);
234
-	}
235
-	elseif (isset($_GET['absolute']) && $_GET['absolute'] != '')
241
+	} elseif (isset($_GET['absolute']) && $_GET['absolute'] != '')
236 242
 	{
237 243
 		// Initialize the requried variables.
238 244
 		$server = '';
@@ -256,16 +262,19 @@  discard block
 block discarded – undo
256 262
 		}
257 263
 	}
258 264
 	// Minimum required parameter did not exist so dump out.
259
-	else
260
-		fatal_lang_error('couldnt_connect', false);
265
+	else {
266
+			fatal_lang_error('couldnt_connect', false);
267
+	}
261 268
 
262 269
 	// Attempt to connect.  If unsuccessful... try the URL.
263
-	if (!isset($_GET['package']) || file_exists($_GET['package']))
264
-		$_GET['package'] = $url . '/packages.xml?language=' . $context['user']['language'];
270
+	if (!isset($_GET['package']) || file_exists($_GET['package'])) {
271
+			$_GET['package'] = $url . '/packages.xml?language=' . $context['user']['language'];
272
+	}
265 273
 
266 274
 	// Check to be sure the packages.xml file actually exists where it is should be... or dump out.
267
-	if ((isset($_GET['absolute']) || isset($_GET['relative'])) && !url_exists($_GET['package']))
268
-		fatal_lang_error('packageget_unable', false, array($url . '/index.php'));
275
+	if ((isset($_GET['absolute']) || isset($_GET['relative'])) && !url_exists($_GET['package'])) {
276
+			fatal_lang_error('packageget_unable', false, array($url . '/index.php'));
277
+	}
269 278
 
270 279
 	// Might take some time.
271 280
 	@set_time_limit(600);
@@ -275,8 +284,9 @@  discard block
 block discarded – undo
275 284
 	$listing = new xmlArray(fetch_web_data($_GET['package']), true);
276 285
 
277 286
 	// Errm.... empty file?  Try the URL....
278
-	if (!$listing->exists('package-list'))
279
-		fatal_lang_error('packageget_unable', false, array($url . '/index.php'));
287
+	if (!$listing->exists('package-list')) {
288
+			fatal_lang_error('packageget_unable', false, array($url . '/index.php'));
289
+	}
280 290
 
281 291
 	// List out the packages...
282 292
 	$context['package_list'] = array();
@@ -284,8 +294,9 @@  discard block
 block discarded – undo
284 294
 	$listing = $listing->path('package-list[0]');
285 295
 
286 296
 	// Use the package list's name if it exists.
287
-	if ($listing->exists('list-title'))
288
-		$name = $smcFunc['htmlspecialchars']($listing->fetch('list-title'));
297
+	if ($listing->exists('list-title')) {
298
+			$name = $smcFunc['htmlspecialchars']($listing->fetch('list-title'));
299
+	}
289 300
 
290 301
 	// Pick the correct template.
291 302
 	$context['sub_template'] = 'package_list';
@@ -300,28 +311,32 @@  discard block
 block discarded – undo
300 311
 
301 312
 	$installed_mods = array();
302 313
 	// Look through the list of installed mods...
303
-	foreach ($instmods as $installed_mod)
304
-		$installed_mods[$installed_mod['package_id']] = $installed_mod['version'];
314
+	foreach ($instmods as $installed_mod) {
315
+			$installed_mods[$installed_mod['package_id']] = $installed_mod['version'];
316
+	}
305 317
 
306 318
 	// Get default author and email if they exist.
307 319
 	if ($listing->exists('default-author'))
308 320
 	{
309 321
 		$default_author = $smcFunc['htmlspecialchars']($listing->fetch('default-author'));
310
-		if ($listing->exists('default-author/@email') && filter_var($listing->fetch('default-author/@email'), FILTER_VALIDATE_EMAIL))
311
-			$default_email = $smcFunc['htmlspecialchars']($listing->fetch('default-author/@email'));
322
+		if ($listing->exists('default-author/@email') && filter_var($listing->fetch('default-author/@email'), FILTER_VALIDATE_EMAIL)) {
323
+					$default_email = $smcFunc['htmlspecialchars']($listing->fetch('default-author/@email'));
324
+		}
312 325
 	}
313 326
 
314 327
 	// Get default web site if it exists.
315 328
 	if ($listing->exists('default-website'))
316 329
 	{
317 330
 		$default_website = $smcFunc['htmlspecialchars']($listing->fetch('default-website'));
318
-		if ($listing->exists('default-website/@title'))
319
-			$default_title = $smcFunc['htmlspecialchars']($listing->fetch('default-website/@title'));
331
+		if ($listing->exists('default-website/@title')) {
332
+					$default_title = $smcFunc['htmlspecialchars']($listing->fetch('default-website/@title'));
333
+		}
320 334
 	}
321 335
 
322 336
 	$the_version = strtr($forum_version, array('SMF ' => ''));
323
-	if (!empty($_SESSION['version_emulate']))
324
-		$the_version = $_SESSION['version_emulate'];
337
+	if (!empty($_SESSION['version_emulate'])) {
338
+			$the_version = $_SESSION['version_emulate'];
339
+	}
325 340
 
326 341
 	$packageNum = 0;
327 342
 	$packageSection = 0;
@@ -342,11 +357,13 @@  discard block
 block discarded – undo
342 357
 				'type' => $thisPackage->name(),
343 358
 			);
344 359
 
345
-			if (in_array($package['type'], array('title', 'text')))
346
-				$context['package_list'][$packageSection][$package['type']] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.'));
360
+			if (in_array($package['type'], array('title', 'text'))) {
361
+							$context['package_list'][$packageSection][$package['type']] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.'));
362
+			}
347 363
 			// It's a Title, Heading, Rule or Text.
348
-			elseif (in_array($package['type'], array('heading', 'rule')))
349
-				$package['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.'));
364
+			elseif (in_array($package['type'], array('heading', 'rule'))) {
365
+							$package['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.'));
366
+			}
350 367
 			// It's a Remote link.
351 368
 			elseif ($package['type'] == 'remote')
352 369
 			{
@@ -354,20 +371,21 @@  discard block
 block discarded – undo
354 371
 
355 372
 				if ($remote_type == 'relative' && substr($thisPackage->fetch('@href'), 0, 7) != 'http://' && substr($thisPackage->fetch('@href'), 0, 8) != 'https://')
356 373
 				{
357
-					if (isset($_GET['absolute']))
358
-						$current_url = $_GET['absolute'] . '/';
359
-					elseif (isset($_GET['relative']))
360
-						$current_url = $_GET['relative'] . '/';
361
-					else
362
-						$current_url = '';
374
+					if (isset($_GET['absolute'])) {
375
+											$current_url = $_GET['absolute'] . '/';
376
+					} elseif (isset($_GET['relative'])) {
377
+											$current_url = $_GET['relative'] . '/';
378
+					} else {
379
+											$current_url = '';
380
+					}
363 381
 
364 382
 					$current_url .= $thisPackage->fetch('@href');
365
-					if (isset($_GET['absolute']))
366
-						$package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;absolute=' . $current_url;
367
-					else
368
-						$package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $context['package_server'] . ';relative=' . $current_url;
369
-				}
370
-				else
383
+					if (isset($_GET['absolute'])) {
384
+											$package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;absolute=' . $current_url;
385
+					} else {
386
+											$package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $context['package_server'] . ';relative=' . $current_url;
387
+					}
388
+				} else
371 389
 				{
372 390
 					$current_url = $thisPackage->fetch('@href');
373 391
 					$package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;absolute=' . $current_url;
@@ -379,25 +397,28 @@  discard block
 block discarded – undo
379 397
 			// It's a package...
380 398
 			else
381 399
 			{
382
-				if (isset($_GET['absolute']))
383
-					$current_url = $_GET['absolute'] . '/';
384
-				elseif (isset($_GET['relative']))
385
-					$current_url = $_GET['relative'] . '/';
386
-				else
387
-					$current_url = '';
400
+				if (isset($_GET['absolute'])) {
401
+									$current_url = $_GET['absolute'] . '/';
402
+				} elseif (isset($_GET['relative'])) {
403
+									$current_url = $_GET['relative'] . '/';
404
+				} else {
405
+									$current_url = '';
406
+				}
388 407
 
389 408
 				$server_att = $server != '' ? ';server=' . $server : '';
390 409
 
391 410
 				$package += $thisPackage->to_array();
392 411
 
393
-				if (isset($package['website']))
394
-					unset($package['website']);
412
+				if (isset($package['website'])) {
413
+									unset($package['website']);
414
+				}
395 415
 				$package['author'] = array();
396 416
 
397
-				if ($package['description'] == '')
398
-					$package['description'] = $txt['package_no_description'];
399
-				else
400
-					$package['description'] = parse_bbc(preg_replace('~\[[/]?html\]~i', '', $smcFunc['htmlspecialchars']($package['description'])));
417
+				if ($package['description'] == '') {
418
+									$package['description'] = $txt['package_no_description'];
419
+				} else {
420
+									$package['description'] = parse_bbc(preg_replace('~\[[/]?html\]~i', '', $smcFunc['htmlspecialchars']($package['description'])));
421
+				}
401 422
 
402 423
 				$package['is_installed'] = isset($installed_mods[$package['id']]);
403 424
 				$package['is_current'] = $package['is_installed'] && ($installed_mods[$package['id']] == $package['version']);
@@ -406,12 +427,14 @@  discard block
 block discarded – undo
406 427
 				// This package is either not installed, or installed but old.  Is it supported on this version of SMF?
407 428
 				if (!$package['is_installed'] || (!$package['is_current'] && !$package['is_newer']))
408 429
 				{
409
-					if ($thisPackage->exists('version/@for'))
410
-						$package['can_install'] = matchPackageVersion($the_version, $thisPackage->fetch('version/@for'));
430
+					if ($thisPackage->exists('version/@for')) {
431
+											$package['can_install'] = matchPackageVersion($the_version, $thisPackage->fetch('version/@for'));
432
+					}
411 433
 				}
412 434
 				// Okay, it's already installed AND up to date.
413
-				else
414
-					$package['can_install'] = false;
435
+				else {
436
+									$package['can_install'] = false;
437
+				}
415 438
 
416 439
 				$already_exists = getPackageInfo(basename($package['filename']));
417 440
 				$package['download_conflict'] = is_array($already_exists) && $already_exists['id'] == $package['id'] && $already_exists['version'] != $package['version'];
@@ -423,40 +446,44 @@  discard block
 block discarded – undo
423 446
 
424 447
 				if ($thisPackage->exists('author') || isset($default_author))
425 448
 				{
426
-					if ($thisPackage->exists('author/@email') && filter_var($thisPackage->fetch('author/@email'), FILTER_VALIDATE_EMAIL))
427
-						$package['author']['email'] = $thisPackage->fetch('author/@email');
428
-					elseif (isset($default_email))
429
-						$package['author']['email'] = $default_email;
430
-
431
-					if ($thisPackage->exists('author') && $thisPackage->fetch('author') != '')
432
-						$package['author']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('author'));
433
-					else
434
-						$package['author']['name'] = $default_author;
435
-
436
-					if (!empty($package['author']['email']))
437
-						$package['author']['link'] = '<a href="mailto:' . $package['author']['email'] . '">' . $package['author']['name'] . '</a>';
449
+					if ($thisPackage->exists('author/@email') && filter_var($thisPackage->fetch('author/@email'), FILTER_VALIDATE_EMAIL)) {
450
+											$package['author']['email'] = $thisPackage->fetch('author/@email');
451
+					} elseif (isset($default_email)) {
452
+											$package['author']['email'] = $default_email;
453
+					}
454
+
455
+					if ($thisPackage->exists('author') && $thisPackage->fetch('author') != '') {
456
+											$package['author']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('author'));
457
+					} else {
458
+											$package['author']['name'] = $default_author;
459
+					}
460
+
461
+					if (!empty($package['author']['email'])) {
462
+											$package['author']['link'] = '<a href="mailto:' . $package['author']['email'] . '">' . $package['author']['name'] . '</a>';
463
+					}
438 464
 				}
439 465
 
440 466
 				if ($thisPackage->exists('website') || isset($default_website))
441 467
 				{
442
-					if ($thisPackage->exists('website') && $thisPackage->exists('website/@title'))
443
-						$package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website/@title'));
444
-					elseif (isset($default_title))
445
-						$package['author']['website']['name'] = $default_title;
446
-					elseif ($thisPackage->exists('website'))
447
-						$package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website'));
448
-					else
449
-						$package['author']['website']['name'] = $default_website;
450
-
451
-					if ($thisPackage->exists('website') && $thisPackage->fetch('website') != '')
452
-						$authorhompage = $smcFunc['htmlspecialchars']($thisPackage->fetch('website'));
453
-					else
454
-						$authorhompage = $default_website;
468
+					if ($thisPackage->exists('website') && $thisPackage->exists('website/@title')) {
469
+											$package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website/@title'));
470
+					} elseif (isset($default_title)) {
471
+											$package['author']['website']['name'] = $default_title;
472
+					} elseif ($thisPackage->exists('website')) {
473
+											$package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website'));
474
+					} else {
475
+											$package['author']['website']['name'] = $default_website;
476
+					}
477
+
478
+					if ($thisPackage->exists('website') && $thisPackage->fetch('website') != '') {
479
+											$authorhompage = $smcFunc['htmlspecialchars']($thisPackage->fetch('website'));
480
+					} else {
481
+											$authorhompage = $default_website;
482
+					}
455 483
 
456 484
 					$package['author']['website']['href'] = $authorhompage;
457 485
 					$package['author']['website']['link'] = '<a href="' . $authorhompage . '">' . $package['author']['website']['name'] . '</a>';
458
-				}
459
-				else
486
+				} else
460 487
 				{
461 488
 					$package['author']['website']['href'] = '';
462 489
 					$package['author']['website']['link'] = '';
@@ -472,11 +499,13 @@  discard block
 block discarded – undo
472 499
 			$packageNum = in_array($package['type'], array('title', 'heading', 'text', 'remote', 'rule')) ? 0 : $packageNum + 1;
473 500
 			$package['count'] = $packageNum;
474 501
 
475
-			if (!in_array($package['type'], array('title', 'text')))
476
-				$context['package_list'][$packageSection]['items'][] = $package;
502
+			if (!in_array($package['type'], array('title', 'text'))) {
503
+							$context['package_list'][$packageSection]['items'][] = $package;
504
+			}
477 505
 
478
-			if ($package['count'] > 1)
479
-				$context['list_type'] = 'ol';
506
+			if ($package['count'] > 1) {
507
+							$context['list_type'] = 'ol';
508
+			}
480 509
 		}
481 510
 
482 511
 		$packageSection++;
@@ -489,8 +518,9 @@  discard block
 block discarded – undo
489 518
 	{
490 519
 		foreach ($packageSection['items'] as $i => $package)
491 520
 		{
492
-			if ($package['count'] == 0 || isset($package['can_install']))
493
-				continue;
521
+			if ($package['count'] == 0 || isset($package['can_install'])) {
522
+							continue;
523
+			}
494 524
 
495 525
 			$context['package_list'][$ps_id]['items'][$i]['can_install'] = false;
496 526
 
@@ -539,8 +569,9 @@  discard block
 block discarded – undo
539 569
 	checkSession('get');
540 570
 
541 571
 	// To download something, we need a valid server or url.
542
-	if (empty($_GET['server']) && (!empty($_GET['get']) && !empty($_REQUEST['package'])))
543
-		fatal_lang_error('package_get_error_is_zero', false);
572
+	if (empty($_GET['server']) && (!empty($_GET['get']) && !empty($_REQUEST['package']))) {
573
+			fatal_lang_error('package_get_error_is_zero', false);
574
+	}
544 575
 
545 576
 	if (isset($_GET['server']))
546 577
 	{
@@ -560,22 +591,23 @@  discard block
 block discarded – undo
560 591
 		$smcFunc['db_free_result']($request);
561 592
 
562 593
 		// If server does not exist then dump out.
563
-		if (empty($url))
564
-			fatal_lang_error('couldnt_connect', false);
594
+		if (empty($url)) {
595
+					fatal_lang_error('couldnt_connect', false);
596
+		}
565 597
 
566 598
 		$url = $url . '/';
567
-	}
568
-	else
599
+	} else
569 600
 	{
570 601
 		// Initialize the requried variables.
571 602
 		$server = '';
572 603
 		$url = '';
573 604
 	}
574 605
 
575
-	if (isset($_REQUEST['byurl']) && !empty($_POST['filename']))
576
-		$package_name = basename($_REQUEST['filename']);
577
-	else
578
-		$package_name = basename($_REQUEST['package']);
606
+	if (isset($_REQUEST['byurl']) && !empty($_POST['filename'])) {
607
+			$package_name = basename($_REQUEST['filename']);
608
+	} else {
609
+			$package_name = basename($_REQUEST['package']);
610
+	}
579 611
 
580 612
 	if (isset($_REQUEST['conflict']) || (isset($_REQUEST['auto']) && file_exists($packagesdir . '/' . $package_name)))
581 613
 	{
@@ -584,14 +616,15 @@  discard block
 block discarded – undo
584 616
 		{
585 617
 			$ext = substr($package_name, strrpos(substr($package_name, 0, -3), '.'));
586 618
 			$package_name = substr($package_name, 0, strrpos(substr($package_name, 0, -3), '.')) . '_';
619
+		} else {
620
+					$ext = '';
587 621
 		}
588
-		else
589
-			$ext = '';
590 622
 
591 623
 		// Find the first available.
592 624
 		$i = 1;
593
-		while (file_exists($packagesdir . '/' . $package_name . $i . $ext))
594
-			$i++;
625
+		while (file_exists($packagesdir . '/' . $package_name . $i . $ext)) {
626
+					$i++;
627
+		}
595 628
 
596 629
 		$package_name = $package_name . $i . $ext;
597 630
 	}
@@ -601,25 +634,28 @@  discard block
 block discarded – undo
601 634
 	package_put_contents($packagesdir . '/' . $package_name, fetch_web_data($url . $_REQUEST['package']));
602 635
 
603 636
 	// Done!  Did we get this package automatically?
604
-	if (preg_match('~^http://[\w_\-]+\.simplemachines\.org/~', $_REQUEST['package']) == 1 && strpos($_REQUEST['package'], 'dlattach') === false && isset($_REQUEST['auto']))
605
-		redirectexit('action=admin;area=packages;sa=install;package=' . $package_name);
637
+	if (preg_match('~^http://[\w_\-]+\.simplemachines\.org/~', $_REQUEST['package']) == 1 && strpos($_REQUEST['package'], 'dlattach') === false && isset($_REQUEST['auto'])) {
638
+			redirectexit('action=admin;area=packages;sa=install;package=' . $package_name);
639
+	}
606 640
 
607 641
 	// You just downloaded a mod from SERVER_NAME_GOES_HERE.
608 642
 	$context['package_server'] = $server;
609 643
 
610 644
 	$context['package'] = getPackageInfo($package_name);
611 645
 
612
-	if (!is_array($context['package']))
613
-		fatal_lang_error('package_cant_download', false);
646
+	if (!is_array($context['package'])) {
647
+			fatal_lang_error('package_cant_download', false);
648
+	}
614 649
 
615
-	if ($context['package']['type'] == 'modification')
616
-		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
617
-	elseif ($context['package']['type'] == 'avatar')
618
-		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>';
619
-	elseif ($context['package']['type'] == 'language')
620
-		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>';
621
-	else
622
-		$context['package']['install']['link'] = '';
650
+	if ($context['package']['type'] == 'modification') {
651
+			$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
652
+	} elseif ($context['package']['type'] == 'avatar') {
653
+			$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>';
654
+	} elseif ($context['package']['type'] == 'language') {
655
+			$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>';
656
+	} else {
657
+			$context['package']['install']['link'] = '';
658
+	}
623 659
 
624 660
 	// Does a 3rd party hook want to do some additional changes?
625 661
 	call_integration_hook('integrate_package_download');
@@ -645,10 +681,11 @@  discard block
 block discarded – undo
645 681
 	// @todo Use FTP if the Packages directory is not writable.
646 682
 
647 683
 	// Check the file was even sent!
648
-	if (!isset($_FILES['package']['name']) || $_FILES['package']['name'] == '')
649
-		fatal_lang_error('package_upload_error_nofile');
650
-	elseif (!is_uploaded_file($_FILES['package']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['package']['tmp_name'])))
651
-		fatal_lang_error('package_upload_error_failed');
684
+	if (!isset($_FILES['package']['name']) || $_FILES['package']['name'] == '') {
685
+			fatal_lang_error('package_upload_error_nofile');
686
+	} elseif (!is_uploaded_file($_FILES['package']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['package']['tmp_name']))) {
687
+			fatal_lang_error('package_upload_error_failed');
688
+	}
652 689
 
653 690
 	// Make sure it has a sane filename.
654 691
 	$_FILES['package']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['package']['name']);
@@ -665,8 +702,9 @@  discard block
 block discarded – undo
665 702
 	// Setup the destination and throw an error if the file is already there!
666 703
 	$destination = $packagesdir . '/' . $packageName;
667 704
 	// @todo Maybe just roll it like we do for downloads?
668
-	if (file_exists($destination))
669
-		fatal_lang_error('package_upload_error_exists');
705
+	if (file_exists($destination)) {
706
+			fatal_lang_error('package_upload_error_exists');
707
+	}
670 708
 
671 709
 	// Now move the file.
672 710
 	move_uploaded_file($_FILES['package']['tmp_name'], $destination);
@@ -689,12 +727,14 @@  discard block
 block discarded – undo
689 727
 	{
690 728
 		while ($package = readdir($dir))
691 729
 		{
692
-			if ($package == '.' || $package == '..' || $package == 'temp' || $package == $packageName || (!(is_dir($packagesdir . '/' . $package) && file_exists($packagesdir . '/' . $package . '/package-info.xml')) && substr(strtolower($package), -7) != '.tar.gz' && substr(strtolower($package), -4) != '.tgz' && substr(strtolower($package), -4) != '.zip'))
693
-				continue;
730
+			if ($package == '.' || $package == '..' || $package == 'temp' || $package == $packageName || (!(is_dir($packagesdir . '/' . $package) && file_exists($packagesdir . '/' . $package . '/package-info.xml')) && substr(strtolower($package), -7) != '.tar.gz' && substr(strtolower($package), -4) != '.tgz' && substr(strtolower($package), -4) != '.zip')) {
731
+							continue;
732
+			}
694 733
 
695 734
 			$packageInfo = getPackageInfo($package);
696
-			if (!is_array($packageInfo))
697
-				continue;
735
+			if (!is_array($packageInfo)) {
736
+							continue;
737
+			}
698 738
 
699 739
 			if ($packageInfo['id'] == $context['package']['id'] && $packageInfo['version'] == $context['package']['version'])
700 740
 			{
@@ -706,14 +746,15 @@  discard block
 block discarded – undo
706 746
 		closedir($dir);
707 747
 	}
708 748
 
709
-	if ($context['package']['type'] == 'modification')
710
-		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
711
-	elseif ($context['package']['type'] == 'avatar')
712
-		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>';
713
-	elseif ($context['package']['type'] == 'language')
714
-		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>';
715
-	else
716
-		$context['package']['install']['link'] = '';
749
+	if ($context['package']['type'] == 'modification') {
750
+			$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
751
+	} elseif ($context['package']['type'] == 'avatar') {
752
+			$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>';
753
+	} elseif ($context['package']['type'] == 'language') {
754
+			$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>';
755
+	} else {
756
+			$context['package']['install']['link'] = '';
757
+	}
717 758
 
718 759
 	// Does a 3rd party hook want to do some additional changes?
719 760
 	call_integration_hook('integrate_package_upload');
@@ -736,16 +777,18 @@  discard block
 block discarded – undo
736 777
 	checkSession();
737 778
 
738 779
 	// If they put a slash on the end, get rid of it.
739
-	if (substr($_POST['serverurl'], -1) == '/')
740
-		$_POST['serverurl'] = substr($_POST['serverurl'], 0, -1);
780
+	if (substr($_POST['serverurl'], -1) == '/') {
781
+			$_POST['serverurl'] = substr($_POST['serverurl'], 0, -1);
782
+	}
741 783
 
742 784
 	// Are they both nice and clean?
743 785
 	$servername = trim($smcFunc['htmlspecialchars']($_POST['servername']));
744 786
 	$serverurl = trim($smcFunc['htmlspecialchars']($_POST['serverurl']));
745 787
 
746 788
 	// Make sure the URL has the correct prefix.
747
-	if (strpos($serverurl, 'http://') !== 0 && strpos($serverurl, 'https://') !== 0)
748
-		$serverurl = 'http://' . $serverurl;
789
+	if (strpos($serverurl, 'http://') !== 0 && strpos($serverurl, 'https://') !== 0) {
790
+			$serverurl = 'http://' . $serverurl;
791
+	}
749 792
 
750 793
 	$smcFunc['db_insert']('',
751 794
 		'{db_prefix}package_servers',
Please login to merge, or discard this patch.