@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | // This won't be dedicated without this - this must exist in each gateway! |
15 | 15 | // SMF Payment Gateway: paypal |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Class for returning available form data for this gateway |
@@ -118,8 +119,7 @@ discard block |
||
118 | 119 | { |
119 | 120 | $return_data['hidden']['p3'] = 1; |
120 | 121 | $return_data['hidden']['t3'] = strtoupper(substr($period, 0, 1)); |
121 | - } |
|
122 | - else |
|
122 | + } else |
|
123 | 123 | { |
124 | 124 | preg_match('~(\d*)(\w)~', $sub_data['real_length'], $match); |
125 | 125 | $unit = $match[1]; |
@@ -130,14 +130,15 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // If it's repeatable do some javascript to respect this idea. |
133 | - if (!empty($sub_data['repeatable'])) |
|
134 | - $return_data['javascript'] = ' |
|
133 | + if (!empty($sub_data['repeatable'])) { |
|
134 | + $return_data['javascript'] = ' |
|
135 | 135 | document.write(\'<label for="do_paypal_recur"><input type="checkbox" name="do_paypal_recur" id="do_paypal_recur" checked onclick="switchPaypalRecur();" class="input_check">' . $txt['paid_make_recurring'] . '</label><br>\'); |
136 | 136 | |
137 | 137 | function switchPaypalRecur() |
138 | 138 | { |
139 | 139 | document.getElementById("paypal_cmd").value = document.getElementById("do_paypal_recur").checked ? "_xclick-subscriptions" : "_xclick"; |
140 | 140 | }'; |
141 | + } |
|
141 | 142 | |
142 | 143 | return $return_data; |
143 | 144 | } |
@@ -160,20 +161,24 @@ discard block |
||
160 | 161 | global $modSettings; |
161 | 162 | |
162 | 163 | // Has the user set up an email address? |
163 | - if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email']))) |
|
164 | - return false; |
|
164 | + if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email']))) { |
|
165 | + return false; |
|
166 | + } |
|
165 | 167 | // Check the correct transaction types are even here. |
166 | - if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email']))) |
|
167 | - return false; |
|
168 | + if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email']))) { |
|
169 | + return false; |
|
170 | + } |
|
168 | 171 | // Correct email address? |
169 | - if (!isset($_POST['business'])) |
|
170 | - $_POST['business'] = $_POST['receiver_email']; |
|
172 | + if (!isset($_POST['business'])) { |
|
173 | + $_POST['business'] = $_POST['receiver_email']; |
|
174 | + } |
|
171 | 175 | |
172 | 176 | // Are we testing? |
173 | - if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) |
|
174 | - return false; |
|
175 | - elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails'])))) |
|
176 | - return false; |
|
177 | + if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) { |
|
178 | + return false; |
|
179 | + } elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails'])))) { |
|
180 | + return false; |
|
181 | + } |
|
177 | 182 | return true; |
178 | 183 | } |
179 | 184 | |
@@ -192,15 +197,17 @@ discard block |
||
192 | 197 | global $modSettings, $txt; |
193 | 198 | |
194 | 199 | // Put this to some default value. |
195 | - if (!isset($_POST['txn_type'])) |
|
196 | - $_POST['txn_type'] = ''; |
|
200 | + if (!isset($_POST['txn_type'])) { |
|
201 | + $_POST['txn_type'] = ''; |
|
202 | + } |
|
197 | 203 | |
198 | 204 | // Build the request string - starting with the minimum requirement. |
199 | 205 | $requestString = 'cmd=_notify-validate'; |
200 | 206 | |
201 | 207 | // Now my dear, add all the posted bits in the order we got them |
202 | - foreach ($_POST as $k => $v) |
|
203 | - $requestString .= '&' . $k . '=' . urlencode($v); |
|
208 | + foreach ($_POST as $k => $v) { |
|
209 | + $requestString .= '&' . $k . '=' . urlencode($v); |
|
210 | + } |
|
204 | 211 | |
205 | 212 | // Can we use curl? |
206 | 213 | if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr')) |
@@ -240,14 +247,16 @@ discard block |
||
240 | 247 | $header .= 'Connection: close' . "\r\n\r\n"; |
241 | 248 | |
242 | 249 | // Open the connection. |
243 | - if (!empty($modSettings['paidsubs_test'])) |
|
244 | - $fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); |
|
245 | - else |
|
246 | - $fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30); |
|
250 | + if (!empty($modSettings['paidsubs_test'])) { |
|
251 | + $fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); |
|
252 | + } else { |
|
253 | + $fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30); |
|
254 | + } |
|
247 | 255 | |
248 | 256 | // Did it work? |
249 | - if (!$fp) |
|
250 | - generateSubscriptionError($txt['paypal_could_not_connect']); |
|
257 | + if (!$fp) { |
|
258 | + generateSubscriptionError($txt['paypal_could_not_connect']); |
|
259 | + } |
|
251 | 260 | |
252 | 261 | // Put the data to the port. |
253 | 262 | fputs($fp, $header . $requestString); |
@@ -256,8 +265,9 @@ discard block |
||
256 | 265 | while (!feof($fp)) |
257 | 266 | { |
258 | 267 | $this->return_data = fgets($fp, 1024); |
259 | - if (strcmp(trim($this->return_data), 'VERIFIED') === 0) |
|
260 | - break; |
|
268 | + if (strcmp(trim($this->return_data), 'VERIFIED') === 0) { |
|
269 | + break; |
|
270 | + } |
|
261 | 271 | } |
262 | 272 | |
263 | 273 | // Clean up. |
@@ -265,28 +275,34 @@ discard block |
||
265 | 275 | } |
266 | 276 | |
267 | 277 | // If this isn't verified then give up... |
268 | - if (strcmp(trim($this->return_data), 'VERIFIED') !== 0) |
|
269 | - exit; |
|
278 | + if (strcmp(trim($this->return_data), 'VERIFIED') !== 0) { |
|
279 | + exit; |
|
280 | + } |
|
270 | 281 | |
271 | 282 | // Check that this is intended for us. |
272 | - if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) |
|
273 | - exit; |
|
283 | + if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) { |
|
284 | + exit; |
|
285 | + } |
|
274 | 286 | |
275 | 287 | // Is this a subscription - and if so is it a secondary payment that we need to process? |
276 | 288 | // If so, make sure we get it in the expected format. Seems PayPal sometimes sends it without urlencoding. |
277 | - if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false) |
|
278 | - $_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']); |
|
279 | - if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false)) |
|
280 | - // Calculate the subscription it relates to! |
|
289 | + if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false) { |
|
290 | + $_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']); |
|
291 | + } |
|
292 | + if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false)) { |
|
293 | + // Calculate the subscription it relates to! |
|
281 | 294 | $this->_findSubscription(); |
295 | + } |
|
282 | 296 | |
283 | 297 | // Verify the currency! |
284 | - if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code'])) |
|
285 | - exit; |
|
298 | + if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code'])) { |
|
299 | + exit; |
|
300 | + } |
|
286 | 301 | |
287 | 302 | // Can't exist if it doesn't contain anything. |
288 | - if (empty($_POST['item_number'])) |
|
289 | - exit; |
|
303 | + if (empty($_POST['item_number'])) { |
|
304 | + exit; |
|
305 | + } |
|
290 | 306 | |
291 | 307 | // Return the id_sub and id_member |
292 | 308 | return explode('+', $_POST['item_number']); |
@@ -299,10 +315,11 @@ discard block |
||
299 | 315 | */ |
300 | 316 | public function isRefund() |
301 | 317 | { |
302 | - if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed')) |
|
303 | - return true; |
|
304 | - else |
|
305 | - return false; |
|
318 | + if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed')) { |
|
319 | + return true; |
|
320 | + } else { |
|
321 | + return false; |
|
322 | + } |
|
306 | 323 | } |
307 | 324 | |
308 | 325 | /** |
@@ -312,10 +329,11 @@ discard block |
||
312 | 329 | */ |
313 | 330 | public function isSubscription() |
314 | 331 | { |
315 | - if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed') |
|
316 | - return true; |
|
317 | - else |
|
318 | - return false; |
|
332 | + if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed') { |
|
333 | + return true; |
|
334 | + } else { |
|
335 | + return false; |
|
336 | + } |
|
319 | 337 | } |
320 | 338 | |
321 | 339 | /** |
@@ -325,10 +343,11 @@ discard block |
||
325 | 343 | */ |
326 | 344 | public function isPayment() |
327 | 345 | { |
328 | - if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept') |
|
329 | - return true; |
|
330 | - else |
|
331 | - return false; |
|
346 | + if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept') { |
|
347 | + return true; |
|
348 | + } else { |
|
349 | + return false; |
|
350 | + } |
|
332 | 351 | } |
333 | 352 | |
334 | 353 | /** |
@@ -341,10 +360,11 @@ discard block |
||
341 | 360 | // subscr_cancel is sent when the user cancels, subscr_eot is sent when the subscription reaches final payment |
342 | 361 | // Neither require us to *do* anything as per performCancel(). |
343 | 362 | // subscr_eot, if sent, indicates an end of payments term. |
344 | - if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot') |
|
345 | - return true; |
|
346 | - else |
|
347 | - return false; |
|
363 | + if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot') { |
|
364 | + return true; |
|
365 | + } else { |
|
366 | + return false; |
|
367 | + } |
|
348 | 368 | } |
349 | 369 | |
350 | 370 | /** |
@@ -409,8 +429,9 @@ discard block |
||
409 | 429 | global $smcFunc; |
410 | 430 | |
411 | 431 | // Assume we have this? |
412 | - if (empty($_POST['subscr_id'])) |
|
413 | - return false; |
|
432 | + if (empty($_POST['subscr_id'])) { |
|
433 | + return false; |
|
434 | + } |
|
414 | 435 | |
415 | 436 | // Do we have this in the database? |
416 | 437 | $request = $smcFunc['db_query']('', ' |
@@ -439,11 +460,12 @@ discard block |
||
439 | 460 | 'payer_email' => $_POST['payer_email'], |
440 | 461 | ) |
441 | 462 | ); |
442 | - if ($smcFunc['db_num_rows']($request) === 0) |
|
443 | - return false; |
|
463 | + if ($smcFunc['db_num_rows']($request) === 0) { |
|
464 | + return false; |
|
465 | + } |
|
466 | + } else { |
|
467 | + return false; |
|
444 | 468 | } |
445 | - else |
|
446 | - return false; |
|
447 | 469 | } |
448 | 470 | list ($member_id, $subscription_id) = $smcFunc['db_fetch_row']($request); |
449 | 471 | $_POST['item_number'] = $member_id . '+' . $subscription_id; |
@@ -22,22 +22,24 @@ discard block |
||
22 | 22 | <script>'; |
23 | 23 | |
24 | 24 | // When using Go Back due to fatal_error, allow the form to be re-submitted with changes. |
25 | - if (isBrowser('is_firefox')) |
|
26 | - echo ' |
|
25 | + if (isBrowser('is_firefox')) { |
|
26 | + echo ' |
|
27 | 27 | window.addEventListener("pageshow", reActivate, false);'; |
28 | + } |
|
28 | 29 | |
29 | 30 | // Start with message icons - and any missing from this theme. |
30 | 31 | echo ' |
31 | 32 | var icon_urls = {'; |
32 | - foreach ($context['icons'] as $icon) |
|
33 | - echo ' |
|
33 | + foreach ($context['icons'] as $icon) { |
|
34 | + echo ' |
|
34 | 35 | \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ','; |
36 | + } |
|
35 | 37 | echo ' |
36 | 38 | };'; |
37 | 39 | |
38 | 40 | // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations. |
39 | - if ($context['make_poll']) |
|
40 | - echo ' |
|
41 | + if ($context['make_poll']) { |
|
42 | + echo ' |
|
41 | 43 | var pollOptionNum = 0, pollTabIndex; |
42 | 44 | var pollOptionId = ', $context['last_choice_id'], '; |
43 | 45 | function addPollOption() |
@@ -56,11 +58,13 @@ discard block |
||
56 | 58 | |
57 | 59 | setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<dt><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>:</dt><dd><input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text"></dd><p id="pollMoreOptions"></p>'), '); |
58 | 60 | }'; |
61 | + } |
|
59 | 62 | |
60 | 63 | // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here. |
61 | - if ($context['make_event']) |
|
62 | - echo ' |
|
64 | + if ($context['make_event']) { |
|
65 | + echo ' |
|
63 | 66 | var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];'; |
67 | + } |
|
64 | 68 | |
65 | 69 | // End of the javascript, start the form and display the link tree. |
66 | 70 | echo ' |
@@ -80,9 +84,10 @@ discard block |
||
80 | 84 | </div> |
81 | 85 | </div><br>'; |
82 | 86 | |
83 | - if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) |
|
84 | - echo ' |
|
87 | + if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) { |
|
88 | + echo ' |
|
85 | 89 | <input type="hidden" name="eventid" value="', $context['event']['id'], '">'; |
90 | + } |
|
86 | 91 | |
87 | 92 | // Start the main table. |
88 | 93 | echo ' |
@@ -117,18 +122,20 @@ discard block |
||
117 | 122 | } |
118 | 123 | |
119 | 124 | // If it's locked, show a message to warn the replier. |
120 | - if (!empty($context['locked'])) |
|
121 | - echo ' |
|
125 | + if (!empty($context['locked'])) { |
|
126 | + echo ' |
|
122 | 127 | <p class="errorbox"> |
123 | 128 | ', $txt['topic_locked_no_reply'], ' |
124 | 129 | </p>'; |
130 | + } |
|
125 | 131 | |
126 | - if (!empty($modSettings['drafts_post_enabled'])) |
|
127 | - echo ' |
|
132 | + if (!empty($modSettings['drafts_post_enabled'])) { |
|
133 | + echo ' |
|
128 | 134 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
129 | 135 | sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), ' |
130 | 136 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
131 | 137 | </div>'; |
138 | + } |
|
132 | 139 | |
133 | 140 | // The post header... important stuff |
134 | 141 | echo ' |
@@ -180,9 +187,10 @@ discard block |
||
180 | 187 | { |
181 | 188 | echo ' |
182 | 189 | <optgroup label="', $category['name'], '">'; |
183 | - foreach ($category['boards'] as $board) |
|
184 | - echo ' |
|
190 | + foreach ($category['boards'] as $board) { |
|
191 | + echo ' |
|
185 | 192 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], ' </option>'; |
193 | + } |
|
186 | 194 | echo ' |
187 | 195 | </optgroup>'; |
188 | 196 | } |
@@ -218,9 +226,10 @@ discard block |
||
218 | 226 | <span class="label">', $txt['calendar_timezone'], '</span> |
219 | 227 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
220 | 228 | |
221 | - foreach ($context['all_timezones'] as $tz => $tzname) |
|
222 | - echo ' |
|
229 | + foreach ($context['all_timezones'] as $tz => $tzname) { |
|
230 | + echo ' |
|
223 | 231 | <option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
232 | + } |
|
224 | 233 | |
225 | 234 | echo ' |
226 | 235 | </select> |
@@ -286,14 +295,15 @@ discard block |
||
286 | 295 | <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', ' class="input_check"> |
287 | 296 | </dd>'; |
288 | 297 | |
289 | - if ($context['poll_options']['guest_vote_enabled']) |
|
290 | - echo ' |
|
298 | + if ($context['poll_options']['guest_vote_enabled']) { |
|
299 | + echo ' |
|
291 | 300 | <dt> |
292 | 301 | <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> |
293 | 302 | </dt> |
294 | 303 | <dd> |
295 | 304 | <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked' : '', ' class="input_check"> |
296 | 305 | </dd>'; |
306 | + } |
|
297 | 307 | |
298 | 308 | echo ' |
299 | 309 | <dt> |
@@ -314,8 +324,8 @@ discard block |
||
314 | 324 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'); |
315 | 325 | |
316 | 326 | // If we're editing and displaying edit details, show a box where they can say why |
317 | - if (isset($context['editing']) && $modSettings['show_modify']) |
|
318 | - echo ' |
|
327 | + if (isset($context['editing']) && $modSettings['show_modify']) { |
|
328 | + echo ' |
|
319 | 329 | <dl> |
320 | 330 | <dt class="clear"> |
321 | 331 | <span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span> |
@@ -324,20 +334,23 @@ discard block |
||
324 | 334 | <input type="text" name="modify_reason"', isset($context['last_modified_reason']) ? ' value="' . $context['last_modified_reason'] . '"' : '', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text"> |
325 | 335 | </dd> |
326 | 336 | </dl>'; |
337 | + } |
|
327 | 338 | |
328 | 339 | // If this message has been edited in the past - display when it was. |
329 | - if (isset($context['last_modified'])) |
|
330 | - echo ' |
|
340 | + if (isset($context['last_modified'])) { |
|
341 | + echo ' |
|
331 | 342 | <div class="padding smalltext"> |
332 | 343 | ', $context['last_modified_text'], ' |
333 | 344 | </div>'; |
345 | + } |
|
334 | 346 | |
335 | 347 | // If the admin has enabled the hiding of the additional options - show a link and image for it. |
336 | - if (!empty($modSettings['additional_options_collapsable'])) |
|
337 | - echo ' |
|
348 | + if (!empty($modSettings['additional_options_collapsable'])) { |
|
349 | + echo ' |
|
338 | 350 | <div id="postAdditionalOptionsHeader"> |
339 | 351 | <strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong> |
340 | 352 | </div>'; |
353 | + } |
|
341 | 354 | |
342 | 355 | echo ' |
343 | 356 | <div id="postAdditionalOptions">'; |
@@ -369,19 +382,21 @@ discard block |
||
369 | 382 | <input type="hidden" name="attach_del[]" value="0"> |
370 | 383 | ', $txt['uncheck_unwatchd_attach'], ': |
371 | 384 | </dd>'; |
372 | - foreach ($context['current_attachments'] as $attachment) |
|
373 | - echo ' |
|
385 | + foreach ($context['current_attachments'] as $attachment) { |
|
386 | + echo ' |
|
374 | 387 | <dd class="smalltext"> |
375 | 388 | <label for="attachment_', $attachment['attachID'], '"><input type="checkbox" id="attachment_', $attachment['attachID'], '" name="attach_del[]" value="', $attachment['attachID'], '"', empty($attachment['unchecked']) ? ' checked' : '', ' class="input_check"> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), |
376 | 389 | !empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label> |
377 | 390 | </dd>'; |
391 | + } |
|
378 | 392 | |
379 | 393 | echo ' |
380 | 394 | </dl>'; |
381 | 395 | |
382 | - if (!empty($context['files_in_session_warning'])) |
|
383 | - echo ' |
|
396 | + if (!empty($context['files_in_session_warning'])) { |
|
397 | + echo ' |
|
384 | 398 | <div class="smalltext">', $context['files_in_session_warning'], '</div>'; |
399 | + } |
|
385 | 400 | } |
386 | 401 | |
387 | 402 | // Is the user allowed to post any additional ones? If so give them the boxes to do it! |
@@ -434,8 +449,8 @@ discard block |
||
434 | 449 | ', empty($modSettings['attachmentSizeLimit']) ? '' : ('<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '">'); |
435 | 450 | |
436 | 451 | // Show more boxes if they aren't approaching that limit. |
437 | - if ($context['num_allowed_attachments'] > 1) |
|
438 | - echo ' |
|
452 | + if ($context['num_allowed_attachments'] > 1) { |
|
453 | + echo ' |
|
439 | 454 | <script> |
440 | 455 | var allowed_attachments = ', $context['num_allowed_attachments'], '; |
441 | 456 | var current_attachment = 1; |
@@ -456,9 +471,10 @@ discard block |
||
456 | 471 | </div> |
457 | 472 | </div> |
458 | 473 | </dd>'; |
459 | - else |
|
460 | - echo ' |
|
474 | + } else { |
|
475 | + echo ' |
|
461 | 476 | </dd>'; |
477 | + } |
|
462 | 478 | |
463 | 479 | // Add any template changes for an alternative upload system here. |
464 | 480 | call_integration_hook('integrate_upload_template'); |
@@ -467,21 +483,25 @@ discard block |
||
467 | 483 | <dd class="smalltext">'; |
468 | 484 | |
469 | 485 | // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed. |
470 | - if (!empty($modSettings['attachmentCheckExtensions'])) |
|
471 | - echo ' |
|
486 | + if (!empty($modSettings['attachmentCheckExtensions'])) { |
|
487 | + echo ' |
|
472 | 488 | ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br>'; |
489 | + } |
|
473 | 490 | |
474 | - if (!empty($context['attachment_restrictions'])) |
|
475 | - echo ' |
|
491 | + if (!empty($context['attachment_restrictions'])) { |
|
492 | + echo ' |
|
476 | 493 | ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br>'; |
494 | + } |
|
477 | 495 | |
478 | - if ($context['num_allowed_attachments'] == 0) |
|
479 | - echo ' |
|
496 | + if ($context['num_allowed_attachments'] == 0) { |
|
497 | + echo ' |
|
480 | 498 | ', $txt['attach_limit_nag'], '<br>'; |
499 | + } |
|
481 | 500 | |
482 | - if (!$context['can_post_attachment_unapproved']) |
|
483 | - echo ' |
|
501 | + if (!$context['can_post_attachment_unapproved']) { |
|
502 | + echo ' |
|
484 | 503 | <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br>'; |
504 | + } |
|
485 | 505 | |
486 | 506 | echo ' |
487 | 507 | </dd> |
@@ -504,10 +524,11 @@ discard block |
||
504 | 524 | <dt><strong>', $txt['subject'], '</strong></dt> |
505 | 525 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
506 | 526 | |
507 | - foreach ($context['drafts'] as $draft) |
|
508 | - echo ' |
|
527 | + foreach ($context['drafts'] as $draft) { |
|
528 | + echo ' |
|
509 | 529 | <dt>', $draft['link'], '</dt> |
510 | 530 | <dd>', $draft['poster_time'], '</dd>'; |
531 | + } |
|
511 | 532 | echo ' |
512 | 533 | </dl> |
513 | 534 | </div>'; |
@@ -532,9 +553,10 @@ discard block |
||
532 | 553 | ', template_control_richedit_buttons($context['post_box_name']); |
533 | 554 | |
534 | 555 | // Option to delete an event if user is editing one. |
535 | - if ($context['make_event'] && !$context['event']['new']) |
|
536 | - echo ' |
|
556 | + if ($context['make_event'] && !$context['event']['new']) { |
|
557 | + echo ' |
|
537 | 558 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['event_delete_confirm'] ,'" class="button_submit you_sure">'; |
559 | + } |
|
538 | 560 | |
539 | 561 | echo ' |
540 | 562 | </span> |
@@ -543,9 +565,10 @@ discard block |
||
543 | 565 | <br class="clear">'; |
544 | 566 | |
545 | 567 | // Assuming this isn't a new topic pass across the last message id. |
546 | - if (isset($context['topic_last_message'])) |
|
547 | - echo ' |
|
568 | + if (isset($context['topic_last_message'])) { |
|
569 | + echo ' |
|
548 | 570 | <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">'; |
571 | + } |
|
549 | 572 | |
550 | 573 | echo ' |
551 | 574 | <input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '"> |
@@ -687,9 +710,10 @@ discard block |
||
687 | 710 | |
688 | 711 | newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \'"><div id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">« <strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \' »</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';'; |
689 | 712 | |
690 | - if ($context['can_quote']) |
|
691 | - echo ' |
|
713 | + if ($context['can_quote']) { |
|
714 | + echo ' |
|
692 | 715 | newPostsHTML += \'<ul class="quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>', $txt['quote'], '</span><\' + \'/a></li></ul>\';'; |
716 | + } |
|
693 | 717 | |
694 | 718 | echo ' |
695 | 719 | newPostsHTML += \'<br class="clear">\'; |
@@ -732,8 +756,8 @@ discard block |
||
732 | 756 | }'; |
733 | 757 | |
734 | 758 | // Code for showing and hiding additional options. |
735 | - if (!empty($modSettings['additional_options_collapsable'])) |
|
736 | - echo ' |
|
759 | + if (!empty($modSettings['additional_options_collapsable'])) { |
|
760 | + echo ' |
|
737 | 761 | var oSwapAdditionalOptions = new smc_Toggle({ |
738 | 762 | bToggleEnabled: true, |
739 | 763 | bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ', |
@@ -761,10 +785,11 @@ discard block |
||
761 | 785 | } |
762 | 786 | ] |
763 | 787 | });'; |
788 | + } |
|
764 | 789 | |
765 | 790 | // Code for showing and hiding drafts |
766 | - if (!empty($context['drafts'])) |
|
767 | - echo ' |
|
791 | + if (!empty($context['drafts'])) { |
|
792 | + echo ' |
|
768 | 793 | var oSwapDraftOptions = new smc_Toggle({ |
769 | 794 | bToggleEnabled: true, |
770 | 795 | bCurrentlyCollapsed: true, |
@@ -786,6 +811,7 @@ discard block |
||
786 | 811 | } |
787 | 812 | ] |
788 | 813 | });'; |
814 | + } |
|
789 | 815 | |
790 | 816 | echo ' |
791 | 817 | var oEditorID = "', $context['post_box_name'] ,'"; |
@@ -806,8 +832,9 @@ discard block |
||
806 | 832 | foreach ($context['previous_posts'] as $post) |
807 | 833 | { |
808 | 834 | $ignoring = false; |
809 | - if (!empty($post['is_ignored'])) |
|
810 | - $ignored_posts[] = $ignoring = $post['id']; |
|
835 | + if (!empty($post['is_ignored'])) { |
|
836 | + $ignored_posts[] = $ignoring = $post['id']; |
|
837 | + } |
|
811 | 838 | |
812 | 839 | echo ' |
813 | 840 | <div class="windowbg"> |
@@ -990,10 +1017,10 @@ discard block |
||
990 | 1017 | <div id="temporary_posting_area" style="display: none;"></div> |
991 | 1018 | <script>'; |
992 | 1019 | |
993 | - if ($context['close_window']) |
|
994 | - echo ' |
|
1020 | + if ($context['close_window']) { |
|
1021 | + echo ' |
|
995 | 1022 | window.close();'; |
996 | - else |
|
1023 | + } else |
|
997 | 1024 | { |
998 | 1025 | // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;). |
999 | 1026 | echo ' |
@@ -1047,11 +1074,12 @@ discard block |
||
1047 | 1074 | </p> |
1048 | 1075 | <ul>'; |
1049 | 1076 | |
1050 | - foreach ($context['groups'] as $group) |
|
1051 | - echo ' |
|
1077 | + foreach ($context['groups'] as $group) { |
|
1078 | + echo ' |
|
1052 | 1079 | <li> |
1053 | 1080 | <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked class="input_check"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em> |
1054 | 1081 | </li>'; |
1082 | + } |
|
1055 | 1083 | |
1056 | 1084 | echo ' |
1057 | 1085 | <li> |
@@ -12,8 +12,9 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Don't do anything if SMF is already loaded. |
15 | -if (defined('SMF')) |
|
15 | +if (defined('SMF')) { |
|
16 | 16 | return true; |
17 | +} |
|
17 | 18 | |
18 | 19 | define('SMF', 'SSI'); |
19 | 20 | |
@@ -28,16 +29,18 @@ discard block |
||
28 | 29 | $time_start = microtime(); |
29 | 30 | |
30 | 31 | // Just being safe... |
31 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
32 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
32 | 33 | if (isset($GLOBALS[$variable])) |
33 | 34 | unset($GLOBALS[$variable]); |
35 | +} |
|
34 | 36 | |
35 | 37 | // Get the forum's settings for database and file paths. |
36 | 38 | require_once(dirname(__FILE__) . '/Settings.php'); |
37 | 39 | |
38 | 40 | // Make absolutely sure the cache directory is defined. |
39 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
41 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
40 | 42 | $cachedir = $boarddir . '/cache'; |
43 | +} |
|
41 | 44 | |
42 | 45 | $ssi_error_reporting = error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL); |
43 | 46 | /* Set this to one of three values depending on what you want to happen in the case of a fatal error. |
@@ -48,12 +51,14 @@ discard block |
||
48 | 51 | $ssi_on_error_method = false; |
49 | 52 | |
50 | 53 | // Don't do john didley if the forum's been shut down completely. |
51 | -if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) |
|
54 | +if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) { |
|
52 | 55 | die($mmessage); |
56 | +} |
|
53 | 57 | |
54 | 58 | // Fix for using the current directory as a path. |
55 | -if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') |
|
59 | +if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') { |
|
56 | 60 | $sourcedir = dirname(__FILE__) . substr($sourcedir, 1); |
61 | +} |
|
57 | 62 | |
58 | 63 | // Load the important includes. |
59 | 64 | require_once($sourcedir . '/QueryString.php'); |
@@ -78,34 +83,38 @@ discard block |
||
78 | 83 | cleanRequest(); |
79 | 84 | |
80 | 85 | // Seed the random generator? |
81 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
86 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
82 | 87 | smf_seed_generator(); |
88 | +} |
|
83 | 89 | |
84 | 90 | // Check on any hacking attempts. |
85 | -if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) |
|
91 | +if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) { |
|
86 | 92 | die('No direct access...'); |
87 | -elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) |
|
93 | +} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) { |
|
88 | 94 | die('No direct access...'); |
89 | -elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) |
|
95 | +} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) { |
|
90 | 96 | die('No direct access...'); |
91 | -elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) |
|
97 | +} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) { |
|
92 | 98 | die('No direct access...'); |
93 | -if (isset($_REQUEST['context'])) |
|
99 | +} |
|
100 | +if (isset($_REQUEST['context'])) { |
|
94 | 101 | die('No direct access...'); |
102 | +} |
|
95 | 103 | |
96 | 104 | // Gzip output? (because it must be boolean and true, this can't be hacked.) |
97 | -if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) |
|
105 | +if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) { |
|
98 | 106 | ob_start('ob_gzhandler'); |
99 | -else |
|
107 | +} else { |
|
100 | 108 | $modSettings['enableCompressedOutput'] = '0'; |
109 | +} |
|
101 | 110 | |
102 | 111 | // Primarily, this is to fix the URLs... |
103 | 112 | ob_start('ob_sessrewrite'); |
104 | 113 | |
105 | 114 | // Start the session... known to scramble SSI includes in cases... |
106 | -if (!headers_sent()) |
|
115 | +if (!headers_sent()) { |
|
107 | 116 | loadSession(); |
108 | -else |
|
117 | +} else |
|
109 | 118 | { |
110 | 119 | if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()])) |
111 | 120 | { |
@@ -139,12 +148,14 @@ discard block |
||
139 | 148 | loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0); |
140 | 149 | |
141 | 150 | // @todo: probably not the best place, but somewhere it should be set... |
142 | -if (!headers_sent()) |
|
151 | +if (!headers_sent()) { |
|
143 | 152 | header('Content-Type: text/html; charset=' . (empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set'])); |
153 | +} |
|
144 | 154 | |
145 | 155 | // Take care of any banning that needs to be done. |
146 | -if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) |
|
156 | +if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) { |
|
147 | 157 | is_not_banned(); |
158 | +} |
|
148 | 159 | |
149 | 160 | // Do we allow guests in here? |
150 | 161 | if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php') |
@@ -159,17 +170,19 @@ discard block |
||
159 | 170 | { |
160 | 171 | $context['template_layers'] = $ssi_layers; |
161 | 172 | template_header(); |
162 | -} |
|
163 | -else |
|
173 | +} else { |
|
164 | 174 | setupThemeContext(); |
175 | +} |
|
165 | 176 | |
166 | 177 | // Make sure they didn't muss around with the settings... but only if it's not cli. |
167 | -if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') |
|
178 | +if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') { |
|
168 | 179 | trigger_error($txt['ssi_session_broken'], E_USER_NOTICE); |
180 | +} |
|
169 | 181 | |
170 | 182 | // Without visiting the forum this session variable might not be set on submit. |
171 | -if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) |
|
183 | +if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) { |
|
172 | 184 | $_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; |
185 | +} |
|
173 | 186 | |
174 | 187 | // Have the ability to easily add functions to SSI. |
175 | 188 | call_integration_hook('integrate_SSI'); |
@@ -178,11 +191,13 @@ discard block |
||
178 | 191 | if (basename($_SERVER['PHP_SELF']) == 'SSI.php') |
179 | 192 | { |
180 | 193 | // You shouldn't just access SSI.php directly by URL!! |
181 | - if (!isset($_GET['ssi_function'])) |
|
182 | - die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\'')); |
|
194 | + if (!isset($_GET['ssi_function'])) { |
|
195 | + die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\'')); |
|
196 | + } |
|
183 | 197 | // Call a function passed by GET. |
184 | - if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) |
|
185 | - call_user_func('ssi_' . $_GET['ssi_function']); |
|
198 | + if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) { |
|
199 | + call_user_func('ssi_' . $_GET['ssi_function']); |
|
200 | + } |
|
186 | 201 | exit; |
187 | 202 | } |
188 | 203 | |
@@ -199,9 +214,10 @@ discard block |
||
199 | 214 | */ |
200 | 215 | function ssi_shutdown() |
201 | 216 | { |
202 | - if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') |
|
203 | - template_footer(); |
|
204 | -} |
|
217 | + if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') { |
|
218 | + template_footer(); |
|
219 | + } |
|
220 | + } |
|
205 | 221 | |
206 | 222 | /** |
207 | 223 | * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new. |
@@ -214,15 +230,17 @@ discard block |
||
214 | 230 | |
215 | 231 | if ($output_method == 'echo') |
216 | 232 | { |
217 | - if ($context['user']['is_guest']) |
|
218 | - echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'); |
|
219 | - else |
|
220 | - echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : ''; |
|
233 | + if ($context['user']['is_guest']) { |
|
234 | + echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'); |
|
235 | + } else { |
|
236 | + echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : ''; |
|
237 | + } |
|
221 | 238 | } |
222 | 239 | // Don't echo... then do what?! |
223 | - else |
|
224 | - return $context['user']; |
|
225 | -} |
|
240 | + else { |
|
241 | + return $context['user']; |
|
242 | + } |
|
243 | + } |
|
226 | 244 | |
227 | 245 | /** |
228 | 246 | * Display a menu bar, like is displayed at the top of the forum. |
@@ -233,12 +251,14 @@ discard block |
||
233 | 251 | { |
234 | 252 | global $context; |
235 | 253 | |
236 | - if ($output_method == 'echo') |
|
237 | - template_menu(); |
|
254 | + if ($output_method == 'echo') { |
|
255 | + template_menu(); |
|
256 | + } |
|
238 | 257 | // What else could this do? |
239 | - else |
|
240 | - return $context['menu_buttons']; |
|
241 | -} |
|
258 | + else { |
|
259 | + return $context['menu_buttons']; |
|
260 | + } |
|
261 | + } |
|
242 | 262 | |
243 | 263 | /** |
244 | 264 | * Show a logout link. |
@@ -250,20 +270,23 @@ discard block |
||
250 | 270 | { |
251 | 271 | global $context, $txt, $scripturl; |
252 | 272 | |
253 | - if ($redirect_to != '') |
|
254 | - $_SESSION['logout_url'] = $redirect_to; |
|
273 | + if ($redirect_to != '') { |
|
274 | + $_SESSION['logout_url'] = $redirect_to; |
|
275 | + } |
|
255 | 276 | |
256 | 277 | // Guests can't log out. |
257 | - if ($context['user']['is_guest']) |
|
258 | - return false; |
|
278 | + if ($context['user']['is_guest']) { |
|
279 | + return false; |
|
280 | + } |
|
259 | 281 | |
260 | 282 | $link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>'; |
261 | 283 | |
262 | - if ($output_method == 'echo') |
|
263 | - echo $link; |
|
264 | - else |
|
265 | - return $link; |
|
266 | -} |
|
284 | + if ($output_method == 'echo') { |
|
285 | + echo $link; |
|
286 | + } else { |
|
287 | + return $link; |
|
288 | + } |
|
289 | + } |
|
267 | 290 | |
268 | 291 | /** |
269 | 292 | * Recent post list: [board] Subject by Poster Date |
@@ -279,17 +302,17 @@ discard block |
||
279 | 302 | global $modSettings, $context; |
280 | 303 | |
281 | 304 | // Excluding certain boards... |
282 | - if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) |
|
283 | - $exclude_boards = array($modSettings['recycle_board']); |
|
284 | - else |
|
285 | - $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
305 | + if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) { |
|
306 | + $exclude_boards = array($modSettings['recycle_board']); |
|
307 | + } else { |
|
308 | + $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
309 | + } |
|
286 | 310 | |
287 | 311 | // What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter. |
288 | 312 | if (is_array($include_boards) || (int) $include_boards === $include_boards) |
289 | 313 | { |
290 | 314 | $include_boards = is_array($include_boards) ? $include_boards : array($include_boards); |
291 | - } |
|
292 | - elseif ($include_boards != null) |
|
315 | + } elseif ($include_boards != null) |
|
293 | 316 | { |
294 | 317 | $include_boards = array(); |
295 | 318 | } |
@@ -326,8 +349,9 @@ discard block |
||
326 | 349 | { |
327 | 350 | global $modSettings; |
328 | 351 | |
329 | - if (empty($post_ids)) |
|
330 | - return; |
|
352 | + if (empty($post_ids)) { |
|
353 | + return; |
|
354 | + } |
|
331 | 355 | |
332 | 356 | // Allow the user to request more than one - why not? |
333 | 357 | $post_ids = is_array($post_ids) ? $post_ids : array($post_ids); |
@@ -362,8 +386,9 @@ discard block |
||
362 | 386 | global $scripturl, $txt, $user_info; |
363 | 387 | global $modSettings, $smcFunc, $context; |
364 | 388 | |
365 | - if (!empty($modSettings['enable_likes'])) |
|
366 | - $context['can_like'] = allowedTo('likes_like'); |
|
389 | + if (!empty($modSettings['enable_likes'])) { |
|
390 | + $context['can_like'] = allowedTo('likes_like'); |
|
391 | + } |
|
367 | 392 | |
368 | 393 | // Find all the posts. Newer ones will have higher IDs. |
369 | 394 | $request = $smcFunc['db_query']('substring', ' |
@@ -429,12 +454,13 @@ discard block |
||
429 | 454 | ); |
430 | 455 | |
431 | 456 | // Get the likes for each message. |
432 | - if (!empty($modSettings['enable_likes'])) |
|
433 | - $posts[$row['id_msg']]['likes'] = array( |
|
457 | + if (!empty($modSettings['enable_likes'])) { |
|
458 | + $posts[$row['id_msg']]['likes'] = array( |
|
434 | 459 | 'count' => $row['likes'], |
435 | 460 | 'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])), |
436 | 461 | 'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']), |
437 | 462 | ); |
463 | + } |
|
438 | 464 | } |
439 | 465 | $smcFunc['db_free_result']($request); |
440 | 466 | |
@@ -442,13 +468,14 @@ discard block |
||
442 | 468 | call_integration_hook('integrate_ssi_queryPosts', array(&$posts)); |
443 | 469 | |
444 | 470 | // Just return it. |
445 | - if ($output_method != 'echo' || empty($posts)) |
|
446 | - return $posts; |
|
471 | + if ($output_method != 'echo' || empty($posts)) { |
|
472 | + return $posts; |
|
473 | + } |
|
447 | 474 | |
448 | 475 | echo ' |
449 | 476 | <table style="border: none" class="ssi_table">'; |
450 | - foreach ($posts as $post) |
|
451 | - echo ' |
|
477 | + foreach ($posts as $post) { |
|
478 | + echo ' |
|
452 | 479 | <tr> |
453 | 480 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
454 | 481 | [', $post['board']['link'], '] |
@@ -462,6 +489,7 @@ discard block |
||
462 | 489 | ', $post['time'], ' |
463 | 490 | </td> |
464 | 491 | </tr>'; |
492 | + } |
|
465 | 493 | echo ' |
466 | 494 | </table>'; |
467 | 495 | } |
@@ -479,25 +507,26 @@ discard block |
||
479 | 507 | global $settings, $scripturl, $txt, $user_info; |
480 | 508 | global $modSettings, $smcFunc, $context; |
481 | 509 | |
482 | - if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) |
|
483 | - $exclude_boards = array($modSettings['recycle_board']); |
|
484 | - else |
|
485 | - $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
510 | + if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) { |
|
511 | + $exclude_boards = array($modSettings['recycle_board']); |
|
512 | + } else { |
|
513 | + $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards)); |
|
514 | + } |
|
486 | 515 | |
487 | 516 | // Only some boards?. |
488 | 517 | if (is_array($include_boards) || (int) $include_boards === $include_boards) |
489 | 518 | { |
490 | 519 | $include_boards = is_array($include_boards) ? $include_boards : array($include_boards); |
491 | - } |
|
492 | - elseif ($include_boards != null) |
|
520 | + } elseif ($include_boards != null) |
|
493 | 521 | { |
494 | 522 | $output_method = $include_boards; |
495 | 523 | $include_boards = array(); |
496 | 524 | } |
497 | 525 | |
498 | 526 | $icon_sources = array(); |
499 | - foreach ($context['stable_icons'] as $icon) |
|
500 | - $icon_sources[$icon] = 'images_url'; |
|
527 | + foreach ($context['stable_icons'] as $icon) { |
|
528 | + $icon_sources[$icon] = 'images_url'; |
|
529 | + } |
|
501 | 530 | |
502 | 531 | // Find all the posts in distinct topics. Newer ones will have higher IDs. |
503 | 532 | $request = $smcFunc['db_query']('substring', ' |
@@ -522,13 +551,15 @@ discard block |
||
522 | 551 | ) |
523 | 552 | ); |
524 | 553 | $topics = array(); |
525 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
526 | - $topics[$row['id_topic']] = $row; |
|
554 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
555 | + $topics[$row['id_topic']] = $row; |
|
556 | + } |
|
527 | 557 | $smcFunc['db_free_result']($request); |
528 | 558 | |
529 | 559 | // Did we find anything? If not, bail. |
530 | - if (empty($topics)) |
|
531 | - return array(); |
|
560 | + if (empty($topics)) { |
|
561 | + return array(); |
|
562 | + } |
|
532 | 563 | |
533 | 564 | $recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0; |
534 | 565 | |
@@ -556,19 +587,22 @@ discard block |
||
556 | 587 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
557 | 588 | { |
558 | 589 | $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => ' '))); |
559 | - if ($smcFunc['strlen']($row['body']) > 128) |
|
560 | - $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...'; |
|
590 | + if ($smcFunc['strlen']($row['body']) > 128) { |
|
591 | + $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...'; |
|
592 | + } |
|
561 | 593 | |
562 | 594 | // Censor the subject. |
563 | 595 | censorText($row['subject']); |
564 | 596 | censorText($row['body']); |
565 | 597 | |
566 | 598 | // Recycled icon |
567 | - if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) |
|
568 | - $row['icon'] = 'recycled'; |
|
599 | + if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) { |
|
600 | + $row['icon'] = 'recycled'; |
|
601 | + } |
|
569 | 602 | |
570 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
571 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
603 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
604 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
605 | + } |
|
572 | 606 | |
573 | 607 | // Build the array. |
574 | 608 | $posts[] = array( |
@@ -607,13 +641,14 @@ discard block |
||
607 | 641 | call_integration_hook('integrate_ssi_recentTopics', array(&$posts)); |
608 | 642 | |
609 | 643 | // Just return it. |
610 | - if ($output_method != 'echo' || empty($posts)) |
|
611 | - return $posts; |
|
644 | + if ($output_method != 'echo' || empty($posts)) { |
|
645 | + return $posts; |
|
646 | + } |
|
612 | 647 | |
613 | 648 | echo ' |
614 | 649 | <table style="border: none" class="ssi_table">'; |
615 | - foreach ($posts as $post) |
|
616 | - echo ' |
|
650 | + foreach ($posts as $post) { |
|
651 | + echo ' |
|
617 | 652 | <tr> |
618 | 653 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
619 | 654 | [', $post['board']['link'], '] |
@@ -627,6 +662,7 @@ discard block |
||
627 | 662 | ', $post['time'], ' |
628 | 663 | </td> |
629 | 664 | </tr>'; |
665 | + } |
|
630 | 666 | echo ' |
631 | 667 | </table>'; |
632 | 668 | } |
@@ -651,27 +687,30 @@ discard block |
||
651 | 687 | ) |
652 | 688 | ); |
653 | 689 | $return = array(); |
654 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
655 | - $return[] = array( |
|
690 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
691 | + $return[] = array( |
|
656 | 692 | 'id' => $row['id_member'], |
657 | 693 | 'name' => $row['real_name'], |
658 | 694 | 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], |
659 | 695 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>', |
660 | 696 | 'posts' => $row['posts'] |
661 | 697 | ); |
698 | + } |
|
662 | 699 | $smcFunc['db_free_result']($request); |
663 | 700 | |
664 | 701 | // If mods want to do somthing with this list of members, let them do that now. |
665 | 702 | call_integration_hook('integrate_ssi_topPoster', array(&$return)); |
666 | 703 | |
667 | 704 | // Just return all the top posters. |
668 | - if ($output_method != 'echo') |
|
669 | - return $return; |
|
705 | + if ($output_method != 'echo') { |
|
706 | + return $return; |
|
707 | + } |
|
670 | 708 | |
671 | 709 | // Make a quick array to list the links in. |
672 | 710 | $temp_array = array(); |
673 | - foreach ($return as $member) |
|
674 | - $temp_array[] = $member['link']; |
|
711 | + foreach ($return as $member) { |
|
712 | + $temp_array[] = $member['link']; |
|
713 | + } |
|
675 | 714 | |
676 | 715 | echo implode(', ', $temp_array); |
677 | 716 | } |
@@ -703,8 +742,8 @@ discard block |
||
703 | 742 | ) |
704 | 743 | ); |
705 | 744 | $boards = array(); |
706 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
707 | - $boards[] = array( |
|
745 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
746 | + $boards[] = array( |
|
708 | 747 | 'id' => $row['id_board'], |
709 | 748 | 'num_posts' => $row['num_posts'], |
710 | 749 | 'num_topics' => $row['num_topics'], |
@@ -713,14 +752,16 @@ discard block |
||
713 | 752 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
714 | 753 | 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>' |
715 | 754 | ); |
755 | + } |
|
716 | 756 | $smcFunc['db_free_result']($request); |
717 | 757 | |
718 | 758 | // If mods want to do somthing with this list of boards, let them do that now. |
719 | 759 | call_integration_hook('integrate_ssi_topBoards', array(&$boards)); |
720 | 760 | |
721 | 761 | // If we shouldn't output or have nothing to output, just jump out. |
722 | - if ($output_method != 'echo' || empty($boards)) |
|
723 | - return $boards; |
|
762 | + if ($output_method != 'echo' || empty($boards)) { |
|
763 | + return $boards; |
|
764 | + } |
|
724 | 765 | |
725 | 766 | echo ' |
726 | 767 | <table class="ssi_table"> |
@@ -729,13 +770,14 @@ discard block |
||
729 | 770 | <th style="text-align: left">', $txt['board_topics'], '</th> |
730 | 771 | <th style="text-align: left">', $txt['posts'], '</th> |
731 | 772 | </tr>'; |
732 | - foreach ($boards as $sBoard) |
|
733 | - echo ' |
|
773 | + foreach ($boards as $sBoard) { |
|
774 | + echo ' |
|
734 | 775 | <tr> |
735 | 776 | <td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>' : '', '</td> |
736 | 777 | <td style="text-align: right">', comma_format($sBoard['num_topics']), '</td> |
737 | 778 | <td style="text-align: right">', comma_format($sBoard['num_posts']), '</td> |
738 | 779 | </tr>'; |
780 | + } |
|
739 | 781 | echo ' |
740 | 782 | </table>'; |
741 | 783 | } |
@@ -768,12 +810,13 @@ discard block |
||
768 | 810 | ) |
769 | 811 | ); |
770 | 812 | $topic_ids = array(); |
771 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
772 | - $topic_ids[] = $row['id_topic']; |
|
813 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
814 | + $topic_ids[] = $row['id_topic']; |
|
815 | + } |
|
773 | 816 | $smcFunc['db_free_result']($request); |
817 | + } else { |
|
818 | + $topic_ids = array(); |
|
774 | 819 | } |
775 | - else |
|
776 | - $topic_ids = array(); |
|
777 | 820 | |
778 | 821 | $request = $smcFunc['db_query']('', ' |
779 | 822 | SELECT m.subject, m.id_topic, t.num_views, t.num_replies |
@@ -812,8 +855,9 @@ discard block |
||
812 | 855 | // If mods want to do somthing with this list of topics, let them do that now. |
813 | 856 | call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type)); |
814 | 857 | |
815 | - if ($output_method != 'echo' || empty($topics)) |
|
816 | - return $topics; |
|
858 | + if ($output_method != 'echo' || empty($topics)) { |
|
859 | + return $topics; |
|
860 | + } |
|
817 | 861 | |
818 | 862 | echo ' |
819 | 863 | <table class="ssi_table"> |
@@ -822,8 +866,8 @@ discard block |
||
822 | 866 | <th style="text-align: left">', $txt['views'], '</th> |
823 | 867 | <th style="text-align: left">', $txt['replies'], '</th> |
824 | 868 | </tr>'; |
825 | - foreach ($topics as $sTopic) |
|
826 | - echo ' |
|
869 | + foreach ($topics as $sTopic) { |
|
870 | + echo ' |
|
827 | 871 | <tr> |
828 | 872 | <td style="text-align: left"> |
829 | 873 | ', $sTopic['link'], ' |
@@ -831,6 +875,7 @@ discard block |
||
831 | 875 | <td style="text-align: right">', comma_format($sTopic['num_views']), '</td> |
832 | 876 | <td style="text-align: right">', comma_format($sTopic['num_replies']), '</td> |
833 | 877 | </tr>'; |
878 | + } |
|
834 | 879 | echo ' |
835 | 880 | </table>'; |
836 | 881 | } |
@@ -866,12 +911,13 @@ discard block |
||
866 | 911 | { |
867 | 912 | global $txt, $context; |
868 | 913 | |
869 | - if ($output_method == 'echo') |
|
870 | - echo ' |
|
914 | + if ($output_method == 'echo') { |
|
915 | + echo ' |
|
871 | 916 | ', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>'; |
872 | - else |
|
873 | - return $context['common_stats']['latest_member']; |
|
874 | -} |
|
917 | + } else { |
|
918 | + return $context['common_stats']['latest_member']; |
|
919 | + } |
|
920 | + } |
|
875 | 921 | |
876 | 922 | /** |
877 | 923 | * Fetches a random member. |
@@ -920,8 +966,9 @@ discard block |
||
920 | 966 | } |
921 | 967 | |
922 | 968 | // Just to be sure put the random generator back to something... random. |
923 | - if ($random_type != '') |
|
924 | - mt_srand(time()); |
|
969 | + if ($random_type != '') { |
|
970 | + mt_srand(time()); |
|
971 | + } |
|
925 | 972 | |
926 | 973 | return $result; |
927 | 974 | } |
@@ -934,8 +981,9 @@ discard block |
||
934 | 981 | */ |
935 | 982 | function ssi_fetchMember($member_ids = array(), $output_method = 'echo') |
936 | 983 | { |
937 | - if (empty($member_ids)) |
|
938 | - return; |
|
984 | + if (empty($member_ids)) { |
|
985 | + return; |
|
986 | + } |
|
939 | 987 | |
940 | 988 | // Can have more than one member if you really want... |
941 | 989 | $member_ids = is_array($member_ids) ? $member_ids : array($member_ids); |
@@ -960,8 +1008,9 @@ discard block |
||
960 | 1008 | */ |
961 | 1009 | function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo') |
962 | 1010 | { |
963 | - if ($group_id === null) |
|
964 | - return; |
|
1011 | + if ($group_id === null) { |
|
1012 | + return; |
|
1013 | + } |
|
965 | 1014 | |
966 | 1015 | $query_where = ' |
967 | 1016 | id_group = {int:id_group} |
@@ -988,8 +1037,9 @@ discard block |
||
988 | 1037 | { |
989 | 1038 | global $smcFunc, $memberContext; |
990 | 1039 | |
991 | - if ($query_where === null) |
|
992 | - return; |
|
1040 | + if ($query_where === null) { |
|
1041 | + return; |
|
1042 | + } |
|
993 | 1043 | |
994 | 1044 | // Fetch the members in question. |
995 | 1045 | $request = $smcFunc['db_query']('', ' |
@@ -1002,12 +1052,14 @@ discard block |
||
1002 | 1052 | )) |
1003 | 1053 | ); |
1004 | 1054 | $members = array(); |
1005 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1006 | - $members[] = $row['id_member']; |
|
1055 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1056 | + $members[] = $row['id_member']; |
|
1057 | + } |
|
1007 | 1058 | $smcFunc['db_free_result']($request); |
1008 | 1059 | |
1009 | - if (empty($members)) |
|
1010 | - return array(); |
|
1060 | + if (empty($members)) { |
|
1061 | + return array(); |
|
1062 | + } |
|
1011 | 1063 | |
1012 | 1064 | // If mods want to do somthing with this list of members, let them do that now. |
1013 | 1065 | call_integration_hook('integrate_ssi_queryMembers', array(&$members)); |
@@ -1016,23 +1068,25 @@ discard block |
||
1016 | 1068 | loadMemberData($members); |
1017 | 1069 | |
1018 | 1070 | // Draw the table! |
1019 | - if ($output_method == 'echo') |
|
1020 | - echo ' |
|
1071 | + if ($output_method == 'echo') { |
|
1072 | + echo ' |
|
1021 | 1073 | <table style="border: none" class="ssi_table">'; |
1074 | + } |
|
1022 | 1075 | |
1023 | 1076 | $query_members = array(); |
1024 | 1077 | foreach ($members as $member) |
1025 | 1078 | { |
1026 | 1079 | // Load their context data. |
1027 | - if (!loadMemberContext($member)) |
|
1028 | - continue; |
|
1080 | + if (!loadMemberContext($member)) { |
|
1081 | + continue; |
|
1082 | + } |
|
1029 | 1083 | |
1030 | 1084 | // Store this member's information. |
1031 | 1085 | $query_members[$member] = $memberContext[$member]; |
1032 | 1086 | |
1033 | 1087 | // Only do something if we're echo'ing. |
1034 | - if ($output_method == 'echo') |
|
1035 | - echo ' |
|
1088 | + if ($output_method == 'echo') { |
|
1089 | + echo ' |
|
1036 | 1090 | <tr> |
1037 | 1091 | <td style="text-align: right; vertical-align: top; white-space: nowrap"> |
1038 | 1092 | ', $query_members[$member]['link'], ' |
@@ -1040,12 +1094,14 @@ discard block |
||
1040 | 1094 | <br>', $query_members[$member]['avatar']['image'], ' |
1041 | 1095 | </td> |
1042 | 1096 | </tr>'; |
1097 | + } |
|
1043 | 1098 | } |
1044 | 1099 | |
1045 | 1100 | // End the table if appropriate. |
1046 | - if ($output_method == 'echo') |
|
1047 | - echo ' |
|
1101 | + if ($output_method == 'echo') { |
|
1102 | + echo ' |
|
1048 | 1103 | </table>'; |
1104 | + } |
|
1049 | 1105 | |
1050 | 1106 | // Send back the data. |
1051 | 1107 | return $query_members; |
@@ -1060,8 +1116,9 @@ discard block |
||
1060 | 1116 | { |
1061 | 1117 | global $txt, $scripturl, $modSettings, $smcFunc; |
1062 | 1118 | |
1063 | - if (!allowedTo('view_stats')) |
|
1064 | - return; |
|
1119 | + if (!allowedTo('view_stats')) { |
|
1120 | + return; |
|
1121 | + } |
|
1065 | 1122 | |
1066 | 1123 | $totals = array( |
1067 | 1124 | 'members' => $modSettings['totalMembers'], |
@@ -1090,8 +1147,9 @@ discard block |
||
1090 | 1147 | // If mods want to do somthing with the board stats, let them do that now. |
1091 | 1148 | call_integration_hook('integrate_ssi_boardStats', array(&$totals)); |
1092 | 1149 | |
1093 | - if ($output_method != 'echo') |
|
1094 | - return $totals; |
|
1150 | + if ($output_method != 'echo') { |
|
1151 | + return $totals; |
|
1152 | + } |
|
1095 | 1153 | |
1096 | 1154 | echo ' |
1097 | 1155 | ', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br> |
@@ -1120,8 +1178,8 @@ discard block |
||
1120 | 1178 | call_integration_hook('integrate_ssi_whosOnline', array(&$return)); |
1121 | 1179 | |
1122 | 1180 | // Add some redundancy for backwards compatibility reasons. |
1123 | - if ($output_method != 'echo') |
|
1124 | - return $return + array( |
|
1181 | + if ($output_method != 'echo') { |
|
1182 | + return $return + array( |
|
1125 | 1183 | 'users' => $return['users_online'], |
1126 | 1184 | 'guests' => $return['num_guests'], |
1127 | 1185 | 'hidden' => $return['num_users_hidden'], |
@@ -1129,29 +1187,35 @@ discard block |
||
1129 | 1187 | 'num_users' => $return['num_users_online'], |
1130 | 1188 | 'total_users' => $return['num_users_online'] + $return['num_guests'], |
1131 | 1189 | ); |
1190 | + } |
|
1132 | 1191 | |
1133 | 1192 | echo ' |
1134 | 1193 | ', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users']; |
1135 | 1194 | |
1136 | 1195 | $bracketList = array(); |
1137 | - if (!empty($user_info['buddies'])) |
|
1138 | - $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
1139 | - if (!empty($return['num_spiders'])) |
|
1140 | - $bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
1141 | - if (!empty($return['num_users_hidden'])) |
|
1142 | - $bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden']; |
|
1196 | + if (!empty($user_info['buddies'])) { |
|
1197 | + $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
1198 | + } |
|
1199 | + if (!empty($return['num_spiders'])) { |
|
1200 | + $bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
1201 | + } |
|
1202 | + if (!empty($return['num_users_hidden'])) { |
|
1203 | + $bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden']; |
|
1204 | + } |
|
1143 | 1205 | |
1144 | - if (!empty($bracketList)) |
|
1145 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
1206 | + if (!empty($bracketList)) { |
|
1207 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
1208 | + } |
|
1146 | 1209 | |
1147 | 1210 | echo '<br> |
1148 | 1211 | ', implode(', ', $return['list_users_online']); |
1149 | 1212 | |
1150 | 1213 | // Showing membergroups? |
1151 | - if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) |
|
1152 | - echo '<br> |
|
1214 | + if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) { |
|
1215 | + echo '<br> |
|
1153 | 1216 | [' . implode('] [', $return['membergroups']) . ']'; |
1154 | -} |
|
1217 | + } |
|
1218 | + } |
|
1155 | 1219 | |
1156 | 1220 | /** |
1157 | 1221 | * Just like whosOnline except it also logs the online presence. |
@@ -1162,11 +1226,12 @@ discard block |
||
1162 | 1226 | { |
1163 | 1227 | writeLog(); |
1164 | 1228 | |
1165 | - if ($output_method != 'echo') |
|
1166 | - return ssi_whosOnline($output_method); |
|
1167 | - else |
|
1168 | - ssi_whosOnline($output_method); |
|
1169 | -} |
|
1229 | + if ($output_method != 'echo') { |
|
1230 | + return ssi_whosOnline($output_method); |
|
1231 | + } else { |
|
1232 | + ssi_whosOnline($output_method); |
|
1233 | + } |
|
1234 | + } |
|
1170 | 1235 | |
1171 | 1236 | // Shows a login box. |
1172 | 1237 | /** |
@@ -1179,11 +1244,13 @@ discard block |
||
1179 | 1244 | { |
1180 | 1245 | global $scripturl, $txt, $user_info, $context; |
1181 | 1246 | |
1182 | - if ($redirect_to != '') |
|
1183 | - $_SESSION['login_url'] = $redirect_to; |
|
1247 | + if ($redirect_to != '') { |
|
1248 | + $_SESSION['login_url'] = $redirect_to; |
|
1249 | + } |
|
1184 | 1250 | |
1185 | - if ($output_method != 'echo' || !$user_info['is_guest']) |
|
1186 | - return $user_info['is_guest']; |
|
1251 | + if ($output_method != 'echo' || !$user_info['is_guest']) { |
|
1252 | + return $user_info['is_guest']; |
|
1253 | + } |
|
1187 | 1254 | |
1188 | 1255 | // Create a login token |
1189 | 1256 | createToken('login'); |
@@ -1235,8 +1302,9 @@ discard block |
||
1235 | 1302 | |
1236 | 1303 | $boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote')); |
1237 | 1304 | |
1238 | - if (empty($boardsAllowed)) |
|
1239 | - return array(); |
|
1305 | + if (empty($boardsAllowed)) { |
|
1306 | + return array(); |
|
1307 | + } |
|
1240 | 1308 | |
1241 | 1309 | $request = $smcFunc['db_query']('', ' |
1242 | 1310 | SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time |
@@ -1269,12 +1337,14 @@ discard block |
||
1269 | 1337 | $smcFunc['db_free_result']($request); |
1270 | 1338 | |
1271 | 1339 | // This user has voted on all the polls. |
1272 | - if (empty($row) || !is_array($row)) |
|
1273 | - return array(); |
|
1340 | + if (empty($row) || !is_array($row)) { |
|
1341 | + return array(); |
|
1342 | + } |
|
1274 | 1343 | |
1275 | 1344 | // If this is a guest who's voted we'll through ourselves to show poll to show the results. |
1276 | - if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) |
|
1277 | - return ssi_showPoll($row['id_topic'], $output_method); |
|
1345 | + if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) { |
|
1346 | + return ssi_showPoll($row['id_topic'], $output_method); |
|
1347 | + } |
|
1278 | 1348 | |
1279 | 1349 | $request = $smcFunc['db_query']('', ' |
1280 | 1350 | SELECT COUNT(DISTINCT id_member) |
@@ -1338,8 +1408,9 @@ discard block |
||
1338 | 1408 | // If mods want to do somthing with this list of polls, let them do that now. |
1339 | 1409 | call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead)); |
1340 | 1410 | |
1341 | - if ($output_method != 'echo') |
|
1342 | - return $return; |
|
1411 | + if ($output_method != 'echo') { |
|
1412 | + return $return; |
|
1413 | + } |
|
1343 | 1414 | |
1344 | 1415 | if ($allow_view_results) |
1345 | 1416 | { |
@@ -1348,19 +1419,20 @@ discard block |
||
1348 | 1419 | <strong>', $return['question'], '</strong><br> |
1349 | 1420 | ', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : ''; |
1350 | 1421 | |
1351 | - foreach ($return['options'] as $option) |
|
1352 | - echo ' |
|
1422 | + foreach ($return['options'] as $option) { |
|
1423 | + echo ' |
|
1353 | 1424 | <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>'; |
1425 | + } |
|
1354 | 1426 | |
1355 | 1427 | echo ' |
1356 | 1428 | <input type="submit" value="', $txt['poll_vote'], '" class="button_submit"> |
1357 | 1429 | <input type="hidden" name="poll" value="', $return['id'], '"> |
1358 | 1430 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1359 | 1431 | </form>'; |
1432 | + } else { |
|
1433 | + echo $txt['poll_cannot_see']; |
|
1434 | + } |
|
1360 | 1435 | } |
1361 | - else |
|
1362 | - echo $txt['poll_cannot_see']; |
|
1363 | -} |
|
1364 | 1436 | |
1365 | 1437 | /** |
1366 | 1438 | * Shows the poll from the specified topic |
@@ -1374,13 +1446,15 @@ discard block |
||
1374 | 1446 | |
1375 | 1447 | $boardsAllowed = boardsAllowedTo('poll_view'); |
1376 | 1448 | |
1377 | - if (empty($boardsAllowed)) |
|
1378 | - return array(); |
|
1449 | + if (empty($boardsAllowed)) { |
|
1450 | + return array(); |
|
1451 | + } |
|
1379 | 1452 | |
1380 | - if ($topic === null && isset($_REQUEST['ssi_topic'])) |
|
1381 | - $topic = (int) $_REQUEST['ssi_topic']; |
|
1382 | - else |
|
1383 | - $topic = (int) $topic; |
|
1453 | + if ($topic === null && isset($_REQUEST['ssi_topic'])) { |
|
1454 | + $topic = (int) $_REQUEST['ssi_topic']; |
|
1455 | + } else { |
|
1456 | + $topic = (int) $topic; |
|
1457 | + } |
|
1384 | 1458 | |
1385 | 1459 | $request = $smcFunc['db_query']('', ' |
1386 | 1460 | SELECT |
@@ -1401,17 +1475,18 @@ discard block |
||
1401 | 1475 | ); |
1402 | 1476 | |
1403 | 1477 | // Either this topic has no poll, or the user cannot view it. |
1404 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1405 | - return array(); |
|
1478 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1479 | + return array(); |
|
1480 | + } |
|
1406 | 1481 | |
1407 | 1482 | $row = $smcFunc['db_fetch_assoc']($request); |
1408 | 1483 | $smcFunc['db_free_result']($request); |
1409 | 1484 | |
1410 | 1485 | // Check if they can vote. |
1411 | 1486 | $already_voted = false; |
1412 | - if (!empty($row['expire_time']) && $row['expire_time'] < time()) |
|
1413 | - $allow_vote = false; |
|
1414 | - elseif ($user_info['is_guest']) |
|
1487 | + if (!empty($row['expire_time']) && $row['expire_time'] < time()) { |
|
1488 | + $allow_vote = false; |
|
1489 | + } elseif ($user_info['is_guest']) |
|
1415 | 1490 | { |
1416 | 1491 | // There's a difference between "allowed to vote" and "already voted"... |
1417 | 1492 | $allow_vote = $row['guest_vote']; |
@@ -1421,10 +1496,9 @@ discard block |
||
1421 | 1496 | { |
1422 | 1497 | $already_voted = true; |
1423 | 1498 | } |
1424 | - } |
|
1425 | - elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) |
|
1426 | - $allow_vote = false; |
|
1427 | - else |
|
1499 | + } elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) { |
|
1500 | + $allow_vote = false; |
|
1501 | + } else |
|
1428 | 1502 | { |
1429 | 1503 | $request = $smcFunc['db_query']('', ' |
1430 | 1504 | SELECT id_member |
@@ -1506,8 +1580,9 @@ discard block |
||
1506 | 1580 | // If mods want to do somthing with this poll, let them do that now. |
1507 | 1581 | call_integration_hook('integrate_ssi_showPoll', array(&$return)); |
1508 | 1582 | |
1509 | - if ($output_method != 'echo') |
|
1510 | - return $return; |
|
1583 | + if ($output_method != 'echo') { |
|
1584 | + return $return; |
|
1585 | + } |
|
1511 | 1586 | |
1512 | 1587 | if ($return['allow_vote']) |
1513 | 1588 | { |
@@ -1516,17 +1591,17 @@ discard block |
||
1516 | 1591 | <strong>', $return['question'], '</strong><br> |
1517 | 1592 | ', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : ''; |
1518 | 1593 | |
1519 | - foreach ($return['options'] as $option) |
|
1520 | - echo ' |
|
1594 | + foreach ($return['options'] as $option) { |
|
1595 | + echo ' |
|
1521 | 1596 | <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>'; |
1597 | + } |
|
1522 | 1598 | |
1523 | 1599 | echo ' |
1524 | 1600 | <input type="submit" value="', $txt['poll_vote'], '" class="button_submit"> |
1525 | 1601 | <input type="hidden" name="poll" value="', $return['id'], '"> |
1526 | 1602 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1527 | 1603 | </form>'; |
1528 | - } |
|
1529 | - else |
|
1604 | + } else |
|
1530 | 1605 | { |
1531 | 1606 | echo ' |
1532 | 1607 | <div class="ssi_poll"> |
@@ -1606,27 +1681,32 @@ discard block |
||
1606 | 1681 | 'is_approved' => 1, |
1607 | 1682 | ) |
1608 | 1683 | ); |
1609 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1610 | - die; |
|
1684 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1685 | + die; |
|
1686 | + } |
|
1611 | 1687 | $row = $smcFunc['db_fetch_assoc']($request); |
1612 | 1688 | $smcFunc['db_free_result']($request); |
1613 | 1689 | |
1614 | - if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) |
|
1615 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1690 | + if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) { |
|
1691 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1692 | + } |
|
1616 | 1693 | |
1617 | 1694 | // Too many options checked? |
1618 | - if (count($_REQUEST['options']) > $row['max_votes']) |
|
1619 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1695 | + if (count($_REQUEST['options']) > $row['max_votes']) { |
|
1696 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1697 | + } |
|
1620 | 1698 | |
1621 | 1699 | // It's a guest who has already voted? |
1622 | 1700 | if ($user_info['is_guest']) |
1623 | 1701 | { |
1624 | 1702 | // Guest voting disabled? |
1625 | - if (!$row['guest_vote']) |
|
1626 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1703 | + if (!$row['guest_vote']) { |
|
1704 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1705 | + } |
|
1627 | 1706 | // Already voted? |
1628 | - elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) |
|
1629 | - redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1707 | + elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) { |
|
1708 | + redirectexit('topic=' . $row['id_topic'] . '.0'); |
|
1709 | + } |
|
1630 | 1710 | } |
1631 | 1711 | |
1632 | 1712 | $sOptions = array(); |
@@ -1680,11 +1760,13 @@ discard block |
||
1680 | 1760 | { |
1681 | 1761 | global $scripturl, $txt, $context; |
1682 | 1762 | |
1683 | - if (!allowedTo('search_posts')) |
|
1684 | - return; |
|
1763 | + if (!allowedTo('search_posts')) { |
|
1764 | + return; |
|
1765 | + } |
|
1685 | 1766 | |
1686 | - if ($output_method != 'echo') |
|
1687 | - return $scripturl . '?action=search'; |
|
1767 | + if ($output_method != 'echo') { |
|
1768 | + return $scripturl . '?action=search'; |
|
1769 | + } |
|
1688 | 1770 | |
1689 | 1771 | echo ' |
1690 | 1772 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -1706,8 +1788,9 @@ discard block |
||
1706 | 1788 | // If mods want to do somthing with the news, let them do that now. Don't need to pass the news line itself, since it is already in $context. |
1707 | 1789 | call_integration_hook('integrate_ssi_news'); |
1708 | 1790 | |
1709 | - if ($output_method != 'echo') |
|
1710 | - return $context['random_news_line']; |
|
1791 | + if ($output_method != 'echo') { |
|
1792 | + return $context['random_news_line']; |
|
1793 | + } |
|
1711 | 1794 | |
1712 | 1795 | echo $context['random_news_line']; |
1713 | 1796 | } |
@@ -1721,8 +1804,9 @@ discard block |
||
1721 | 1804 | { |
1722 | 1805 | global $scripturl, $modSettings, $user_info; |
1723 | 1806 | |
1724 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) |
|
1725 | - return; |
|
1807 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) { |
|
1808 | + return; |
|
1809 | + } |
|
1726 | 1810 | |
1727 | 1811 | $eventOptions = array( |
1728 | 1812 | 'include_birthdays' => true, |
@@ -1733,13 +1817,15 @@ discard block |
||
1733 | 1817 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
1734 | 1818 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
1735 | 1819 | |
1736 | - if ($output_method != 'echo') |
|
1737 | - return $return['calendar_birthdays']; |
|
1820 | + if ($output_method != 'echo') { |
|
1821 | + return $return['calendar_birthdays']; |
|
1822 | + } |
|
1738 | 1823 | |
1739 | - foreach ($return['calendar_birthdays'] as $member) |
|
1740 | - echo ' |
|
1824 | + foreach ($return['calendar_birthdays'] as $member) { |
|
1825 | + echo ' |
|
1741 | 1826 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : ''); |
1742 | -} |
|
1827 | + } |
|
1828 | + } |
|
1743 | 1829 | |
1744 | 1830 | /** |
1745 | 1831 | * Shows today's holidays. |
@@ -1750,8 +1836,9 @@ discard block |
||
1750 | 1836 | { |
1751 | 1837 | global $modSettings, $user_info; |
1752 | 1838 | |
1753 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
1754 | - return; |
|
1839 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
1840 | + return; |
|
1841 | + } |
|
1755 | 1842 | |
1756 | 1843 | $eventOptions = array( |
1757 | 1844 | 'include_holidays' => true, |
@@ -1762,8 +1849,9 @@ discard block |
||
1762 | 1849 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
1763 | 1850 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
1764 | 1851 | |
1765 | - if ($output_method != 'echo') |
|
1766 | - return $return['calendar_holidays']; |
|
1852 | + if ($output_method != 'echo') { |
|
1853 | + return $return['calendar_holidays']; |
|
1854 | + } |
|
1767 | 1855 | |
1768 | 1856 | echo ' |
1769 | 1857 | ', implode(', ', $return['calendar_holidays']); |
@@ -1777,8 +1865,9 @@ discard block |
||
1777 | 1865 | { |
1778 | 1866 | global $modSettings, $user_info; |
1779 | 1867 | |
1780 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
1781 | - return; |
|
1868 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
1869 | + return; |
|
1870 | + } |
|
1782 | 1871 | |
1783 | 1872 | $eventOptions = array( |
1784 | 1873 | 'include_events' => true, |
@@ -1789,14 +1878,16 @@ discard block |
||
1789 | 1878 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
1790 | 1879 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
1791 | 1880 | |
1792 | - if ($output_method != 'echo') |
|
1793 | - return $return['calendar_events']; |
|
1881 | + if ($output_method != 'echo') { |
|
1882 | + return $return['calendar_events']; |
|
1883 | + } |
|
1794 | 1884 | |
1795 | 1885 | foreach ($return['calendar_events'] as $event) |
1796 | 1886 | { |
1797 | - if ($event['can_edit']) |
|
1798 | - echo ' |
|
1887 | + if ($event['can_edit']) { |
|
1888 | + echo ' |
|
1799 | 1889 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
1890 | + } |
|
1800 | 1891 | echo ' |
1801 | 1892 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
1802 | 1893 | } |
@@ -1811,8 +1902,9 @@ discard block |
||
1811 | 1902 | { |
1812 | 1903 | global $modSettings, $txt, $scripturl, $user_info; |
1813 | 1904 | |
1814 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
1815 | - return; |
|
1905 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
1906 | + return; |
|
1907 | + } |
|
1816 | 1908 | |
1817 | 1909 | $eventOptions = array( |
1818 | 1910 | 'include_birthdays' => allowedTo('profile_view'), |
@@ -1825,19 +1917,22 @@ discard block |
||
1825 | 1917 | // The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary |
1826 | 1918 | call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions)); |
1827 | 1919 | |
1828 | - if ($output_method != 'echo') |
|
1829 | - return $return; |
|
1920 | + if ($output_method != 'echo') { |
|
1921 | + return $return; |
|
1922 | + } |
|
1830 | 1923 | |
1831 | - if (!empty($return['calendar_holidays'])) |
|
1832 | - echo ' |
|
1924 | + if (!empty($return['calendar_holidays'])) { |
|
1925 | + echo ' |
|
1833 | 1926 | <span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>'; |
1927 | + } |
|
1834 | 1928 | if (!empty($return['calendar_birthdays'])) |
1835 | 1929 | { |
1836 | 1930 | echo ' |
1837 | 1931 | <span class="birthday">' . $txt['birthdays_upcoming'] . '</span> '; |
1838 | - foreach ($return['calendar_birthdays'] as $member) |
|
1839 | - echo ' |
|
1932 | + foreach ($return['calendar_birthdays'] as $member) { |
|
1933 | + echo ' |
|
1840 | 1934 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : ''; |
1935 | + } |
|
1841 | 1936 | echo ' |
1842 | 1937 | <br>'; |
1843 | 1938 | } |
@@ -1847,9 +1942,10 @@ discard block |
||
1847 | 1942 | <span class="event">' . $txt['events_upcoming'] . '</span> '; |
1848 | 1943 | foreach ($return['calendar_events'] as $event) |
1849 | 1944 | { |
1850 | - if ($event['can_edit']) |
|
1851 | - echo ' |
|
1945 | + if ($event['can_edit']) { |
|
1946 | + echo ' |
|
1852 | 1947 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
1948 | + } |
|
1853 | 1949 | echo ' |
1854 | 1950 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
1855 | 1951 | } |
@@ -1873,25 +1969,29 @@ discard block |
||
1873 | 1969 | loadLanguage('Stats'); |
1874 | 1970 | |
1875 | 1971 | // Must be integers.... |
1876 | - if ($limit === null) |
|
1877 | - $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5; |
|
1878 | - else |
|
1879 | - $limit = (int) $limit; |
|
1880 | - |
|
1881 | - if ($start === null) |
|
1882 | - $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
1883 | - else |
|
1884 | - $start = (int) $start; |
|
1885 | - |
|
1886 | - if ($board !== null) |
|
1887 | - $board = (int) $board; |
|
1888 | - elseif (isset($_GET['board'])) |
|
1889 | - $board = (int) $_GET['board']; |
|
1890 | - |
|
1891 | - if ($length === null) |
|
1892 | - $length = isset($_GET['length']) ? (int) $_GET['length'] : 0; |
|
1893 | - else |
|
1894 | - $length = (int) $length; |
|
1972 | + if ($limit === null) { |
|
1973 | + $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5; |
|
1974 | + } else { |
|
1975 | + $limit = (int) $limit; |
|
1976 | + } |
|
1977 | + |
|
1978 | + if ($start === null) { |
|
1979 | + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
1980 | + } else { |
|
1981 | + $start = (int) $start; |
|
1982 | + } |
|
1983 | + |
|
1984 | + if ($board !== null) { |
|
1985 | + $board = (int) $board; |
|
1986 | + } elseif (isset($_GET['board'])) { |
|
1987 | + $board = (int) $_GET['board']; |
|
1988 | + } |
|
1989 | + |
|
1990 | + if ($length === null) { |
|
1991 | + $length = isset($_GET['length']) ? (int) $_GET['length'] : 0; |
|
1992 | + } else { |
|
1993 | + $length = (int) $length; |
|
1994 | + } |
|
1895 | 1995 | |
1896 | 1996 | $limit = max(0, $limit); |
1897 | 1997 | $start = max(0, $start); |
@@ -1909,17 +2009,19 @@ discard block |
||
1909 | 2009 | ); |
1910 | 2010 | if ($smcFunc['db_num_rows']($request) == 0) |
1911 | 2011 | { |
1912 | - if ($output_method == 'echo') |
|
1913 | - die($txt['ssi_no_guests']); |
|
1914 | - else |
|
1915 | - return array(); |
|
2012 | + if ($output_method == 'echo') { |
|
2013 | + die($txt['ssi_no_guests']); |
|
2014 | + } else { |
|
2015 | + return array(); |
|
2016 | + } |
|
1916 | 2017 | } |
1917 | 2018 | list ($board) = $smcFunc['db_fetch_row']($request); |
1918 | 2019 | $smcFunc['db_free_result']($request); |
1919 | 2020 | |
1920 | 2021 | $icon_sources = array(); |
1921 | - foreach ($context['stable_icons'] as $icon) |
|
1922 | - $icon_sources[$icon] = 'images_url'; |
|
2022 | + foreach ($context['stable_icons'] as $icon) { |
|
2023 | + $icon_sources[$icon] = 'images_url'; |
|
2024 | + } |
|
1923 | 2025 | |
1924 | 2026 | if (!empty($modSettings['enable_likes'])) |
1925 | 2027 | { |
@@ -1943,12 +2045,14 @@ discard block |
||
1943 | 2045 | ) |
1944 | 2046 | ); |
1945 | 2047 | $posts = array(); |
1946 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1947 | - $posts[] = $row['id_first_msg']; |
|
2048 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2049 | + $posts[] = $row['id_first_msg']; |
|
2050 | + } |
|
1948 | 2051 | $smcFunc['db_free_result']($request); |
1949 | 2052 | |
1950 | - if (empty($posts)) |
|
1951 | - return array(); |
|
2053 | + if (empty($posts)) { |
|
2054 | + return array(); |
|
2055 | + } |
|
1952 | 2056 | |
1953 | 2057 | // Find the posts. |
1954 | 2058 | $request = $smcFunc['db_query']('', ' |
@@ -1978,24 +2082,28 @@ discard block |
||
1978 | 2082 | $last_space = strrpos($row['body'], ' '); |
1979 | 2083 | $last_open = strrpos($row['body'], '<'); |
1980 | 2084 | $last_close = strrpos($row['body'], '>'); |
1981 | - if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) |
|
1982 | - $cutoff = $last_open; |
|
1983 | - elseif (empty($last_close) || $last_close < $last_open) |
|
1984 | - $cutoff = $last_space; |
|
2085 | + if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) { |
|
2086 | + $cutoff = $last_open; |
|
2087 | + } elseif (empty($last_close) || $last_close < $last_open) { |
|
2088 | + $cutoff = $last_space; |
|
2089 | + } |
|
1985 | 2090 | |
1986 | - if ($cutoff !== false) |
|
1987 | - $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
2091 | + if ($cutoff !== false) { |
|
2092 | + $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); |
|
2093 | + } |
|
1988 | 2094 | $row['body'] .= '...'; |
1989 | 2095 | } |
1990 | 2096 | |
1991 | 2097 | $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']); |
1992 | 2098 | |
1993 | - if (!empty($recycle_board) && $row['id_board'] == $recycle_board) |
|
1994 | - $row['icon'] = 'recycled'; |
|
2099 | + if (!empty($recycle_board) && $row['id_board'] == $recycle_board) { |
|
2100 | + $row['icon'] = 'recycled'; |
|
2101 | + } |
|
1995 | 2102 | |
1996 | 2103 | // Check that this message icon is there... |
1997 | - if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) |
|
1998 | - $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
2104 | + if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) { |
|
2105 | + $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
2106 | + } |
|
1999 | 2107 | |
2000 | 2108 | censorText($row['subject']); |
2001 | 2109 | censorText($row['body']); |
@@ -2032,16 +2140,18 @@ discard block |
||
2032 | 2140 | } |
2033 | 2141 | $smcFunc['db_free_result']($request); |
2034 | 2142 | |
2035 | - if (empty($return)) |
|
2036 | - return $return; |
|
2143 | + if (empty($return)) { |
|
2144 | + return $return; |
|
2145 | + } |
|
2037 | 2146 | |
2038 | 2147 | $return[count($return) - 1]['is_last'] = true; |
2039 | 2148 | |
2040 | 2149 | // If mods want to do somthing with this list of posts, let them do that now. |
2041 | 2150 | call_integration_hook('integrate_ssi_boardNews', array(&$return)); |
2042 | 2151 | |
2043 | - if ($output_method != 'echo') |
|
2044 | - return $return; |
|
2152 | + if ($output_method != 'echo') { |
|
2153 | + return $return; |
|
2154 | + } |
|
2045 | 2155 | |
2046 | 2156 | foreach ($return as $news) |
2047 | 2157 | { |
@@ -2093,9 +2203,10 @@ discard block |
||
2093 | 2203 | echo ' |
2094 | 2204 | </div>'; |
2095 | 2205 | |
2096 | - if (!$news['is_last']) |
|
2097 | - echo ' |
|
2206 | + if (!$news['is_last']) { |
|
2207 | + echo ' |
|
2098 | 2208 | <hr>'; |
2209 | + } |
|
2099 | 2210 | } |
2100 | 2211 | } |
2101 | 2212 | |
@@ -2109,8 +2220,9 @@ discard block |
||
2109 | 2220 | { |
2110 | 2221 | global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc; |
2111 | 2222 | |
2112 | - if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) |
|
2113 | - return; |
|
2223 | + if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) { |
|
2224 | + return; |
|
2225 | + } |
|
2114 | 2226 | |
2115 | 2227 | // Find all events which are happening in the near future that the member can see. |
2116 | 2228 | $request = $smcFunc['db_query']('', ' |
@@ -2136,20 +2248,23 @@ discard block |
||
2136 | 2248 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2137 | 2249 | { |
2138 | 2250 | // Check if we've already come by an event linked to this same topic with the same title... and don't display it if we have. |
2139 | - if (!empty($duplicates[$row['title'] . $row['id_topic']])) |
|
2140 | - continue; |
|
2251 | + if (!empty($duplicates[$row['title'] . $row['id_topic']])) { |
|
2252 | + continue; |
|
2253 | + } |
|
2141 | 2254 | |
2142 | 2255 | // Censor the title. |
2143 | 2256 | censorText($row['title']); |
2144 | 2257 | |
2145 | - if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) |
|
2146 | - $date = strftime('%Y-%m-%d', forum_time(false)); |
|
2147 | - else |
|
2148 | - $date = $row['start_date']; |
|
2258 | + if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) { |
|
2259 | + $date = strftime('%Y-%m-%d', forum_time(false)); |
|
2260 | + } else { |
|
2261 | + $date = $row['start_date']; |
|
2262 | + } |
|
2149 | 2263 | |
2150 | 2264 | // If the topic it is attached to is not approved then don't link it. |
2151 | - if (!empty($row['id_first_msg']) && !$row['approved']) |
|
2152 | - $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
2265 | + if (!empty($row['id_first_msg']) && !$row['approved']) { |
|
2266 | + $row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0; |
|
2267 | + } |
|
2153 | 2268 | |
2154 | 2269 | $allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false; |
2155 | 2270 | |
@@ -2175,24 +2290,27 @@ discard block |
||
2175 | 2290 | } |
2176 | 2291 | $smcFunc['db_free_result']($request); |
2177 | 2292 | |
2178 | - foreach ($return as $mday => $array) |
|
2179 | - $return[$mday][count($array) - 1]['is_last'] = true; |
|
2293 | + foreach ($return as $mday => $array) { |
|
2294 | + $return[$mday][count($array) - 1]['is_last'] = true; |
|
2295 | + } |
|
2180 | 2296 | |
2181 | 2297 | // If mods want to do somthing with this list of events, let them do that now. |
2182 | 2298 | call_integration_hook('integrate_ssi_recentEvents', array(&$return)); |
2183 | 2299 | |
2184 | - if ($output_method != 'echo' || empty($return)) |
|
2185 | - return $return; |
|
2300 | + if ($output_method != 'echo' || empty($return)) { |
|
2301 | + return $return; |
|
2302 | + } |
|
2186 | 2303 | |
2187 | 2304 | // Well the output method is echo. |
2188 | 2305 | echo ' |
2189 | 2306 | <span class="event">' . $txt['events'] . '</span> '; |
2190 | - foreach ($return as $mday => $array) |
|
2191 | - foreach ($array as $event) |
|
2307 | + foreach ($return as $mday => $array) { |
|
2308 | + foreach ($array as $event) |
|
2192 | 2309 | { |
2193 | 2310 | if ($event['can_edit']) |
2194 | 2311 | echo ' |
2195 | 2312 | <a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> '; |
2313 | + } |
|
2196 | 2314 | |
2197 | 2315 | echo ' |
2198 | 2316 | ' . $event['link'] . (!$event['is_last'] ? ', ' : ''); |
@@ -2211,8 +2329,9 @@ discard block |
||
2211 | 2329 | global $smcFunc; |
2212 | 2330 | |
2213 | 2331 | // If $id is null, this was most likely called from a query string and should do nothing. |
2214 | - if ($id === null) |
|
2215 | - return; |
|
2332 | + if ($id === null) { |
|
2333 | + return; |
|
2334 | + } |
|
2216 | 2335 | |
2217 | 2336 | $request = $smcFunc['db_query']('', ' |
2218 | 2337 | SELECT passwd, member_name, is_activated |
@@ -2244,8 +2363,9 @@ discard block |
||
2244 | 2363 | $attachments_boards = boardsAllowedTo('view_attachments'); |
2245 | 2364 | |
2246 | 2365 | // No boards? Adios amigo. |
2247 | - if (empty($attachments_boards)) |
|
2248 | - return array(); |
|
2366 | + if (empty($attachments_boards)) { |
|
2367 | + return array(); |
|
2368 | + } |
|
2249 | 2369 | |
2250 | 2370 | // Is it an array? |
2251 | 2371 | $attachment_ext = (array) $attachment_ext; |
@@ -2329,8 +2449,9 @@ discard block |
||
2329 | 2449 | call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments)); |
2330 | 2450 | |
2331 | 2451 | // So you just want an array? Here you can have it. |
2332 | - if ($output_method == 'array' || empty($attachments)) |
|
2333 | - return $attachments; |
|
2452 | + if ($output_method == 'array' || empty($attachments)) { |
|
2453 | + return $attachments; |
|
2454 | + } |
|
2334 | 2455 | |
2335 | 2456 | // Give them the default. |
2336 | 2457 | echo ' |
@@ -2341,14 +2462,15 @@ discard block |
||
2341 | 2462 | <th style="text-align: left; padding: 2">', $txt['downloads'], '</th> |
2342 | 2463 | <th style="text-align: left; padding: 2">', $txt['filesize'], '</th> |
2343 | 2464 | </tr>'; |
2344 | - foreach ($attachments as $attach) |
|
2345 | - echo ' |
|
2465 | + foreach ($attachments as $attach) { |
|
2466 | + echo ' |
|
2346 | 2467 | <tr> |
2347 | 2468 | <td>', $attach['file']['link'], '</td> |
2348 | 2469 | <td>', $attach['member']['link'], '</td> |
2349 | 2470 | <td style="text-align: center">', $attach['file']['downloads'], '</td> |
2350 | 2471 | <td>', $attach['file']['filesize'], '</td> |
2351 | 2472 | </tr>'; |
2473 | + } |
|
2352 | 2474 | echo ' |
2353 | 2475 | </table>'; |
2354 | 2476 | } |
@@ -32,16 +32,18 @@ discard block |
||
32 | 32 | ob_start(); |
33 | 33 | |
34 | 34 | // Do some cleaning, just in case. |
35 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
35 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
36 | 36 | if (isset($GLOBALS[$variable])) |
37 | 37 | unset($GLOBALS[$variable], $GLOBALS[$variable]); |
38 | +} |
|
38 | 39 | |
39 | 40 | // Load the settings... |
40 | 41 | require_once(dirname(__FILE__) . '/Settings.php'); |
41 | 42 | |
42 | 43 | // Make absolutely sure the cache directory is defined. |
43 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
44 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
44 | 45 | $cachedir = $boarddir . '/cache'; |
46 | +} |
|
45 | 47 | |
46 | 48 | // Without those we can't go anywhere |
47 | 49 | require_once($sourcedir . '/QueryString.php'); |
@@ -51,8 +53,9 @@ discard block |
||
51 | 53 | require_once($sourcedir . '/Load.php'); |
52 | 54 | |
53 | 55 | // If $maintenance is set specifically to 2, then we're upgrading or something. |
54 | -if (!empty($maintenance) && $maintenance == 2) |
|
56 | +if (!empty($maintenance) && $maintenance == 2) { |
|
55 | 57 | display_maintenance_message(); |
58 | +} |
|
56 | 59 | |
57 | 60 | // Create a variable to store some SMF specific functions in. |
58 | 61 | $smcFunc = array(); |
@@ -67,8 +70,9 @@ discard block |
||
67 | 70 | cleanRequest(); |
68 | 71 | |
69 | 72 | // Seed the random generator. |
70 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
73 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
71 | 74 | smf_seed_generator(); |
75 | +} |
|
72 | 76 | |
73 | 77 | // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out! |
74 | 78 | if (isset($_GET['scheduled'])) |
@@ -88,9 +92,9 @@ discard block |
||
88 | 92 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent()) |
89 | 93 | { |
90 | 94 | // If zlib is being used, turn off output compression. |
91 | - if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') |
|
92 | - $modSettings['enableCompressedOutput'] = '0'; |
|
93 | - else |
|
95 | + if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') { |
|
96 | + $modSettings['enableCompressedOutput'] = '0'; |
|
97 | + } else |
|
94 | 98 | { |
95 | 99 | ob_end_clean(); |
96 | 100 | ob_start('ob_gzhandler'); |
@@ -182,18 +186,21 @@ discard block |
||
182 | 186 | loadPermissions(); |
183 | 187 | |
184 | 188 | // Attachments don't require the entire theme to be loaded. |
185 | - if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') |
|
186 | - detectBrowser(); |
|
189 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') { |
|
190 | + detectBrowser(); |
|
191 | + } |
|
187 | 192 | // Load the current theme. (note that ?theme=1 will also work, may be used for guest theming.) |
188 | - else |
|
189 | - loadTheme(); |
|
193 | + else { |
|
194 | + loadTheme(); |
|
195 | + } |
|
190 | 196 | |
191 | 197 | // Check if the user should be disallowed access. |
192 | 198 | is_not_banned(); |
193 | 199 | |
194 | 200 | // If we are in a topic and don't have permission to approve it then duck out now. |
195 | - if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) |
|
196 | - fatal_lang_error('not_a_topic', false); |
|
201 | + if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) { |
|
202 | + fatal_lang_error('not_a_topic', false); |
|
203 | + } |
|
197 | 204 | |
198 | 205 | $no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'); |
199 | 206 | call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions)); |
@@ -204,8 +211,9 @@ discard block |
||
204 | 211 | writeLog(); |
205 | 212 | |
206 | 213 | // Track forum statistics and hits...? |
207 | - if (!empty($modSettings['hitStats'])) |
|
208 | - trackStats(array('hits' => '+')); |
|
214 | + if (!empty($modSettings['hitStats'])) { |
|
215 | + trackStats(array('hits' => '+')); |
|
216 | + } |
|
209 | 217 | } |
210 | 218 | unset($no_stat_actions); |
211 | 219 | |
@@ -219,13 +227,14 @@ discard block |
||
219 | 227 | return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout')); |
220 | 228 | } |
221 | 229 | // Don't even try it, sonny. |
222 | - else |
|
223 | - return 'InMaintenance'; |
|
230 | + else { |
|
231 | + return 'InMaintenance'; |
|
232 | + } |
|
224 | 233 | } |
225 | 234 | // If guest access is off, a guest can only do one of the very few following actions. |
226 | - elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) |
|
227 | - return 'KickGuest'; |
|
228 | - elseif (empty($_REQUEST['action'])) |
|
235 | + elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) { |
|
236 | + return 'KickGuest'; |
|
237 | + } elseif (empty($_REQUEST['action'])) |
|
229 | 238 | { |
230 | 239 | // Action and board are both empty... BoardIndex! Unless someone else wants to do something different. |
231 | 240 | if (empty($board) && empty($topic)) |
@@ -239,8 +248,9 @@ discard block |
||
239 | 248 | |
240 | 249 | $call = call_helper($defaultAction, true); |
241 | 250 | |
242 | - if (!empty($call)) |
|
243 | - return $call; |
|
251 | + if (!empty($call)) { |
|
252 | + return $call; |
|
253 | + } |
|
244 | 254 | } |
245 | 255 | |
246 | 256 | // No default action huh? then go to our good old BoardIndex. |
@@ -370,8 +380,9 @@ discard block |
||
370 | 380 | |
371 | 381 | $call = call_helper($fallbackAction, true); |
372 | 382 | |
373 | - if (!empty($call)) |
|
374 | - return $call; |
|
383 | + if (!empty($call)) { |
|
384 | + return $call; |
|
385 | + } |
|
375 | 386 | } |
376 | 387 | |
377 | 388 | // No fallback action, huh? |
@@ -64,9 +64,10 @@ discard block |
||
64 | 64 | <strong>', $txt['administrators'], ':</strong> |
65 | 65 | ', implode(', ', $context['administrators']); |
66 | 66 | // If we have lots of admins... don't show them all. |
67 | - if (!empty($context['more_admins_link'])) |
|
68 | - echo ' |
|
67 | + if (!empty($context['more_admins_link'])) { |
|
68 | + echo ' |
|
69 | 69 | (', $context['more_admins_link'], ')'; |
70 | + } |
|
70 | 71 | |
71 | 72 | echo ' |
72 | 73 | </div> |
@@ -83,16 +84,18 @@ discard block |
||
83 | 84 | foreach ($area['areas'] as $item_id => $item) |
84 | 85 | { |
85 | 86 | // No point showing the 'home' page here, we're already on it! |
86 | - if ($area_id == 'forum' && $item_id == 'index') |
|
87 | - continue; |
|
87 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | $url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : ''); |
90 | - if (!empty($item['icon_file'])) |
|
91 | - echo ' |
|
92 | + if (!empty($item['icon_file'])) { |
|
93 | + echo ' |
|
92 | 94 | <a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
93 | - else |
|
94 | - echo ' |
|
95 | + } else { |
|
96 | + echo ' |
|
95 | 97 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
98 | + } |
|
96 | 99 | } |
97 | 100 | |
98 | 101 | echo ' |
@@ -103,10 +106,11 @@ discard block |
||
103 | 106 | </div>'; |
104 | 107 | |
105 | 108 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
106 | - if (empty($modSettings['disable_smf_js'])) |
|
107 | - echo ' |
|
109 | + if (empty($modSettings['disable_smf_js'])) { |
|
110 | + echo ' |
|
108 | 111 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
109 | 112 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
113 | + } |
|
110 | 114 | |
111 | 115 | // This sets the announcements and current versions themselves ;). |
112 | 116 | echo ' |
@@ -185,9 +189,10 @@ discard block |
||
185 | 189 | <em>', $version['version'], '</em>'; |
186 | 190 | |
187 | 191 | // more details for this item, show them a link |
188 | - if ($context['can_admin'] && isset($version['more'])) |
|
189 | - echo |
|
192 | + if ($context['can_admin'] && isset($version['more'])) { |
|
193 | + echo |
|
190 | 194 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
195 | + } |
|
191 | 196 | echo ' |
192 | 197 | <br>'; |
193 | 198 | } |
@@ -218,20 +223,22 @@ discard block |
||
218 | 223 | |
219 | 224 | foreach ($context['credits'] as $section) |
220 | 225 | { |
221 | - if (isset($section['pretext'])) |
|
222 | - echo ' |
|
226 | + if (isset($section['pretext'])) { |
|
227 | + echo ' |
|
223 | 228 | <p>', $section['pretext'], '</p><hr>'; |
229 | + } |
|
224 | 230 | |
225 | 231 | echo ' |
226 | 232 | <dl>'; |
227 | 233 | |
228 | 234 | foreach ($section['groups'] as $group) |
229 | 235 | { |
230 | - if (isset($group['title'])) |
|
231 | - echo ' |
|
236 | + if (isset($group['title'])) { |
|
237 | + echo ' |
|
232 | 238 | <dt> |
233 | 239 | <strong>', $group['title'], ':</strong> |
234 | 240 | </dt>'; |
241 | + } |
|
235 | 242 | |
236 | 243 | echo ' |
237 | 244 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -240,10 +247,11 @@ discard block |
||
240 | 247 | echo ' |
241 | 248 | </dl>'; |
242 | 249 | |
243 | - if (isset($section['posttext'])) |
|
244 | - echo ' |
|
250 | + if (isset($section['posttext'])) { |
|
251 | + echo ' |
|
245 | 252 | <hr> |
246 | 253 | <p>', $section['posttext'], '</p>'; |
254 | + } |
|
247 | 255 | } |
248 | 256 | |
249 | 257 | echo ' |
@@ -259,9 +267,10 @@ discard block |
||
259 | 267 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
260 | 268 | |
261 | 269 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
262 | - foreach ($context['current_versions'] as $variable => $version) |
|
263 | - echo ' |
|
270 | + foreach ($context['current_versions'] as $variable => $version) { |
|
271 | + echo ' |
|
264 | 272 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
273 | + } |
|
265 | 274 | |
266 | 275 | // Now we just have to include the script and wait ;). |
267 | 276 | echo ' |
@@ -358,8 +367,8 @@ discard block |
||
358 | 367 | <tbody>'; |
359 | 368 | |
360 | 369 | // Loop through every source file displaying its version - using javascript. |
361 | - foreach ($context['file_versions'] as $filename => $version) |
|
362 | - echo ' |
|
370 | + foreach ($context['file_versions'] as $filename => $version) { |
|
371 | + echo ' |
|
363 | 372 | <tr class="windowbg"> |
364 | 373 | <td class="half_table"> |
365 | 374 | ', $filename, ' |
@@ -371,6 +380,7 @@ discard block |
||
371 | 380 | <em id="currentSources', $filename, '">??</em> |
372 | 381 | </td> |
373 | 382 | </tr>'; |
383 | + } |
|
374 | 384 | |
375 | 385 | // Default template files. |
376 | 386 | echo ' |
@@ -396,8 +406,8 @@ discard block |
||
396 | 406 | <table id="Default" class="table_grid"> |
397 | 407 | <tbody>'; |
398 | 408 | |
399 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
400 | - echo ' |
|
409 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
410 | + echo ' |
|
401 | 411 | <tr class="windowbg"> |
402 | 412 | <td class="half_table"> |
403 | 413 | ', $filename, ' |
@@ -409,6 +419,7 @@ discard block |
||
409 | 419 | <em id="currentDefault', $filename, '">??</em> |
410 | 420 | </td> |
411 | 421 | </tr>'; |
422 | + } |
|
412 | 423 | |
413 | 424 | // Now the language files... |
414 | 425 | echo ' |
@@ -436,8 +447,8 @@ discard block |
||
436 | 447 | |
437 | 448 | foreach ($context['default_language_versions'] as $language => $files) |
438 | 449 | { |
439 | - foreach ($files as $filename => $version) |
|
440 | - echo ' |
|
450 | + foreach ($files as $filename => $version) { |
|
451 | + echo ' |
|
441 | 452 | <tr class="windowbg"> |
442 | 453 | <td class="half_table"> |
443 | 454 | ', $filename, '.<em>', $language, '</em>.php |
@@ -449,6 +460,7 @@ discard block |
||
449 | 460 | <em id="current', $filename, '.', $language, '">??</em> |
450 | 461 | </td> |
451 | 462 | </tr>'; |
463 | + } |
|
452 | 464 | } |
453 | 465 | |
454 | 466 | echo ' |
@@ -478,8 +490,8 @@ discard block |
||
478 | 490 | <table id="Templates" class="table_grid"> |
479 | 491 | <tbody>'; |
480 | 492 | |
481 | - foreach ($context['template_versions'] as $filename => $version) |
|
482 | - echo ' |
|
493 | + foreach ($context['template_versions'] as $filename => $version) { |
|
494 | + echo ' |
|
483 | 495 | <tr class="windowbg"> |
484 | 496 | <td class="half_table"> |
485 | 497 | ', $filename, ' |
@@ -491,6 +503,7 @@ discard block |
||
491 | 503 | <em id="currentTemplates', $filename, '">??</em> |
492 | 504 | </td> |
493 | 505 | </tr>'; |
506 | + } |
|
494 | 507 | |
495 | 508 | echo ' |
496 | 509 | </tbody> |
@@ -520,8 +533,8 @@ discard block |
||
520 | 533 | <table id="Tasks" class="table_grid"> |
521 | 534 | <tbody>'; |
522 | 535 | |
523 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
524 | - echo ' |
|
536 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
537 | + echo ' |
|
525 | 538 | <tr class="windowbg"> |
526 | 539 | <td class="half_table"> |
527 | 540 | ', $filename, ' |
@@ -533,6 +546,7 @@ discard block |
||
533 | 546 | <em id="currentTasks', $filename, '">??</em> |
534 | 547 | </td> |
535 | 548 | </tr>'; |
549 | + } |
|
536 | 550 | |
537 | 551 | echo ' |
538 | 552 | </tbody> |
@@ -574,9 +588,10 @@ discard block |
||
574 | 588 | { |
575 | 589 | global $context, $scripturl, $txt, $modSettings; |
576 | 590 | |
577 | - if (!empty($context['saved_successful'])) |
|
578 | - echo ' |
|
591 | + if (!empty($context['saved_successful'])) { |
|
592 | + echo ' |
|
579 | 593 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
594 | + } |
|
580 | 595 | |
581 | 596 | // First section is for adding/removing words from the censored list. |
582 | 597 | echo ' |
@@ -591,11 +606,12 @@ discard block |
||
591 | 606 | <p>', $txt['admin_censored_where'], '</p>'; |
592 | 607 | |
593 | 608 | // Show text boxes for censoring [bad ] => [good ]. |
594 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
595 | - echo ' |
|
609 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
610 | + echo ' |
|
596 | 611 | <div class="block"> |
597 | 612 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
598 | 613 | </div>'; |
614 | + } |
|
599 | 615 | |
600 | 616 | // Now provide a way to censor more words. |
601 | 617 | echo ' |
@@ -669,19 +685,21 @@ discard block |
||
669 | 685 | <div class="windowbg2 noup"> |
670 | 686 | ', $txt['not_done_reason']; |
671 | 687 | |
672 | - if (!empty($context['continue_percent'])) |
|
673 | - echo ' |
|
688 | + if (!empty($context['continue_percent'])) { |
|
689 | + echo ' |
|
674 | 690 | <div class="progress_bar"> |
675 | 691 | <div class="full_bar">', $context['continue_percent'], '%</div> |
676 | 692 | <div class="green_percent" style="width: ', $context['continue_percent'], '%;"> </div> |
677 | 693 | </div>'; |
694 | + } |
|
678 | 695 | |
679 | - if (!empty($context['substep_enabled'])) |
|
680 | - echo ' |
|
696 | + if (!empty($context['substep_enabled'])) { |
|
697 | + echo ' |
|
681 | 698 | <div class="progress_bar"> |
682 | 699 | <div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div> |
683 | 700 | <div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;"> </div> |
684 | 701 | </div>'; |
702 | + } |
|
685 | 703 | |
686 | 704 | echo ' |
687 | 705 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit"> |
@@ -716,35 +734,40 @@ discard block |
||
716 | 734 | { |
717 | 735 | global $context, $txt, $scripturl; |
718 | 736 | |
719 | - if (!empty($context['saved_successful'])) |
|
720 | - echo ' |
|
737 | + if (!empty($context['saved_successful'])) { |
|
738 | + echo ' |
|
721 | 739 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
722 | - elseif (!empty($context['saved_failed'])) |
|
723 | - echo ' |
|
740 | + } elseif (!empty($context['saved_failed'])) { |
|
741 | + echo ' |
|
724 | 742 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
743 | + } |
|
725 | 744 | |
726 | - if (!empty($context['settings_pre_javascript'])) |
|
727 | - echo ' |
|
745 | + if (!empty($context['settings_pre_javascript'])) { |
|
746 | + echo ' |
|
728 | 747 | <script>', $context['settings_pre_javascript'], '</script>'; |
748 | + } |
|
729 | 749 | |
730 | - if (!empty($context['settings_insert_above'])) |
|
731 | - echo $context['settings_insert_above']; |
|
750 | + if (!empty($context['settings_insert_above'])) { |
|
751 | + echo $context['settings_insert_above']; |
|
752 | + } |
|
732 | 753 | |
733 | 754 | echo ' |
734 | 755 | <div id="admincenter"> |
735 | 756 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>'; |
736 | 757 | |
737 | 758 | // Is there a custom title? |
738 | - if (isset($context['settings_title'])) |
|
739 | - echo ' |
|
759 | + if (isset($context['settings_title'])) { |
|
760 | + echo ' |
|
740 | 761 | <div class="cat_bar"> |
741 | 762 | <h3 class="catbg">', $context['settings_title'], '</h3> |
742 | 763 | </div>'; |
764 | + } |
|
743 | 765 | |
744 | 766 | // Have we got a message to display? |
745 | - if (!empty($context['settings_message'])) |
|
746 | - echo ' |
|
767 | + if (!empty($context['settings_message'])) { |
|
768 | + echo ' |
|
747 | 769 | <div class="information">', $context['settings_message'], '</div>'; |
770 | + } |
|
748 | 771 | |
749 | 772 | // Now actually loop through all the variables. |
750 | 773 | $is_open = false; |
@@ -797,8 +820,9 @@ discard block |
||
797 | 820 | // Hang about? Are you pulling my leg - a callback?! |
798 | 821 | if (is_array($config_var) && $config_var['type'] == 'callback') |
799 | 822 | { |
800 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
801 | - call_user_func('template_callback_' . $config_var['name']); |
|
823 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
824 | + call_user_func('template_callback_' . $config_var['name']); |
|
825 | + } |
|
802 | 826 | |
803 | 827 | continue; |
804 | 828 | } |
@@ -828,9 +852,10 @@ discard block |
||
828 | 852 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
829 | 853 | |
830 | 854 | // Show the [?] button. |
831 | - if ($config_var['help']) |
|
832 | - echo ' |
|
855 | + if ($config_var['help']) { |
|
856 | + echo ' |
|
833 | 857 | <a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
858 | + } |
|
834 | 859 | |
835 | 860 | echo ' |
836 | 861 | <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
@@ -839,22 +864,25 @@ discard block |
||
839 | 864 | $config_var['preinput']; |
840 | 865 | |
841 | 866 | // Show a check box. |
842 | - if ($config_var['type'] == 'check') |
|
843 | - echo ' |
|
867 | + if ($config_var['type'] == 'check') { |
|
868 | + echo ' |
|
844 | 869 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1" class="input_check">'; |
870 | + } |
|
845 | 871 | // Escape (via htmlspecialchars.) the text box. |
846 | - elseif ($config_var['type'] == 'password') |
|
847 | - echo ' |
|
872 | + elseif ($config_var['type'] == 'password') { |
|
873 | + echo ' |
|
848 | 874 | <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;" class="input_password"><br> |
849 | 875 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password">'; |
876 | + } |
|
850 | 877 | // Show a selection box. |
851 | 878 | elseif ($config_var['type'] == 'select') |
852 | 879 | { |
853 | 880 | echo ' |
854 | 881 | <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
855 | - foreach ($config_var['data'] as $option) |
|
856 | - echo ' |
|
882 | + foreach ($config_var['data'] as $option) { |
|
883 | + echo ' |
|
857 | 884 | <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>'; |
885 | + } |
|
858 | 886 | echo ' |
859 | 887 | </select>'; |
860 | 888 | } |
@@ -868,15 +896,17 @@ discard block |
||
868 | 896 | <legend class="board_selector"><a href="#">', $txt['select_boards_from_list'], '</a></legend>'; |
869 | 897 | foreach ($context['board_list'] as $id_cat => $cat) |
870 | 898 | { |
871 | - if (!$first) |
|
872 | - echo ' |
|
899 | + if (!$first) { |
|
900 | + echo ' |
|
873 | 901 | <hr>'; |
902 | + } |
|
874 | 903 | echo ' |
875 | 904 | <strong>', $cat['name'], '</strong> |
876 | 905 | <ul>'; |
877 | - foreach ($cat['boards'] as $id_board => $brd) |
|
878 | - echo ' |
|
906 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
907 | + echo ' |
|
879 | 908 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1" class="input_check"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
909 | + } |
|
880 | 910 | |
881 | 911 | echo ' |
882 | 912 | </ul>'; |
@@ -886,12 +916,14 @@ discard block |
||
886 | 916 | </fieldset>'; |
887 | 917 | } |
888 | 918 | // Text area? |
889 | - elseif ($config_var['type'] == 'large_text') |
|
890 | - echo ' |
|
919 | + elseif ($config_var['type'] == 'large_text') { |
|
920 | + echo ' |
|
891 | 921 | <textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>'; |
922 | + } |
|
892 | 923 | // Permission group? |
893 | - elseif ($config_var['type'] == 'permissions') |
|
894 | - theme_inline_permissions($config_var['name']); |
|
924 | + elseif ($config_var['type'] == 'permissions') { |
|
925 | + theme_inline_permissions($config_var['name']); |
|
926 | + } |
|
895 | 927 | // BBC selection? |
896 | 928 | elseif ($config_var['type'] == 'bbc') |
897 | 929 | { |
@@ -902,20 +934,22 @@ discard block |
||
902 | 934 | |
903 | 935 | foreach ($context['bbc_columns'] as $bbcColumn) |
904 | 936 | { |
905 | - foreach ($bbcColumn as $bbcTag) |
|
906 | - echo ' |
|
937 | + foreach ($bbcColumn as $bbcTag) { |
|
938 | + echo ' |
|
907 | 939 | <li class="list_bbc floatleft"> |
908 | 940 | <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', ' class="input_check"> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', ' |
909 | 941 | </li>'; |
942 | + } |
|
910 | 943 | } |
911 | 944 | echo ' </ul> |
912 | 945 | <input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', ' class="input_check"> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
913 | 946 | </fieldset>'; |
914 | 947 | } |
915 | 948 | // A simple message? |
916 | - elseif ($config_var['type'] == 'var_message') |
|
917 | - echo ' |
|
949 | + elseif ($config_var['type'] == 'var_message') { |
|
950 | + echo ' |
|
918 | 951 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>'; |
952 | + } |
|
919 | 953 | // Assume it must be a text box |
920 | 954 | else |
921 | 955 | { |
@@ -940,63 +974,70 @@ discard block |
||
940 | 974 | ' . $config_var['postinput'] : '', |
941 | 975 | '</dd>'; |
942 | 976 | } |
943 | - } |
|
944 | - |
|
945 | - else |
|
977 | + } else |
|
946 | 978 | { |
947 | 979 | // Just show a separator. |
948 | - if ($config_var == '') |
|
949 | - echo ' |
|
980 | + if ($config_var == '') { |
|
981 | + echo ' |
|
950 | 982 | </dl> |
951 | 983 | <hr> |
952 | 984 | <dl class="settings">'; |
953 | - else |
|
954 | - echo ' |
|
985 | + } else { |
|
986 | + echo ' |
|
955 | 987 | <dd> |
956 | 988 | <strong>' . $config_var . '</strong> |
957 | 989 | </dd>'; |
990 | + } |
|
958 | 991 | } |
959 | 992 | } |
960 | 993 | |
961 | - if ($is_open) |
|
962 | - echo ' |
|
994 | + if ($is_open) { |
|
995 | + echo ' |
|
963 | 996 | </dl>'; |
997 | + } |
|
964 | 998 | |
965 | - if (empty($context['settings_save_dont_show'])) |
|
966 | - echo ' |
|
999 | + if (empty($context['settings_save_dont_show'])) { |
|
1000 | + echo ' |
|
967 | 1001 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit">'; |
1002 | + } |
|
968 | 1003 | |
969 | - if ($is_open) |
|
970 | - echo ' |
|
1004 | + if ($is_open) { |
|
1005 | + echo ' |
|
971 | 1006 | </div>'; |
1007 | + } |
|
972 | 1008 | |
973 | 1009 | |
974 | 1010 | // At least one token has to be used! |
975 | - if (isset($context['admin-ssc_token'])) |
|
976 | - echo ' |
|
1011 | + if (isset($context['admin-ssc_token'])) { |
|
1012 | + echo ' |
|
977 | 1013 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
1014 | + } |
|
978 | 1015 | |
979 | - if (isset($context['admin-dbsc_token'])) |
|
980 | - echo ' |
|
1016 | + if (isset($context['admin-dbsc_token'])) { |
|
1017 | + echo ' |
|
981 | 1018 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
1019 | + } |
|
982 | 1020 | |
983 | - if (isset($context['admin-mp_token'])) |
|
984 | - echo ' |
|
1021 | + if (isset($context['admin-mp_token'])) { |
|
1022 | + echo ' |
|
985 | 1023 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1024 | + } |
|
986 | 1025 | |
987 | 1026 | echo ' |
988 | 1027 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
989 | 1028 | </form> |
990 | 1029 | </div>'; |
991 | 1030 | |
992 | - if (!empty($context['settings_post_javascript'])) |
|
993 | - echo ' |
|
1031 | + if (!empty($context['settings_post_javascript'])) { |
|
1032 | + echo ' |
|
994 | 1033 | <script> |
995 | 1034 | ', $context['settings_post_javascript'], ' |
996 | 1035 | </script>'; |
1036 | + } |
|
997 | 1037 | |
998 | - if (!empty($context['settings_insert_below'])) |
|
999 | - echo $context['settings_insert_below']; |
|
1038 | + if (!empty($context['settings_insert_below'])) { |
|
1039 | + echo $context['settings_insert_below']; |
|
1040 | + } |
|
1000 | 1041 | |
1001 | 1042 | // We may have added a board listing. If we did, we need to make it work. |
1002 | 1043 | addInlineJavascript(' |
@@ -1019,9 +1060,10 @@ discard block |
||
1019 | 1060 | { |
1020 | 1061 | global $context, $txt; |
1021 | 1062 | |
1022 | - if (!empty($context['saved_successful'])) |
|
1023 | - echo ' |
|
1063 | + if (!empty($context['saved_successful'])) { |
|
1064 | + echo ' |
|
1024 | 1065 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1066 | + } |
|
1025 | 1067 | |
1026 | 1068 | // Standard fields. |
1027 | 1069 | template_show_list('standard_profile_fields'); |
@@ -1053,11 +1095,12 @@ discard block |
||
1053 | 1095 | if (isset($_GET['msg'])) |
1054 | 1096 | { |
1055 | 1097 | loadLanguage('Errors'); |
1056 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
1057 | - echo ' |
|
1098 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
1099 | + echo ' |
|
1058 | 1100 | <div class="errorbox">', |
1059 | 1101 | $txt['custom_option_' . $_GET['msg']], ' |
1060 | 1102 | </div>'; |
1103 | + } |
|
1061 | 1104 | } |
1062 | 1105 | |
1063 | 1106 | echo ' |
@@ -1123,9 +1166,10 @@ discard block |
||
1123 | 1166 | <dd> |
1124 | 1167 | <select name="placement" id="placement">'; |
1125 | 1168 | |
1126 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
1127 | - echo ' |
|
1169 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
1170 | + echo ' |
|
1128 | 1171 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1172 | + } |
|
1129 | 1173 | |
1130 | 1174 | echo ' |
1131 | 1175 | </select> |
@@ -1148,9 +1192,10 @@ discard block |
||
1148 | 1192 | </dt> |
1149 | 1193 | <dd> |
1150 | 1194 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1151 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
1152 | - echo ' |
|
1195 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
1196 | + echo ' |
|
1153 | 1197 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1198 | + } |
|
1154 | 1199 | |
1155 | 1200 | echo ' |
1156 | 1201 | </select> |
@@ -1251,9 +1296,10 @@ discard block |
||
1251 | 1296 | </fieldset> |
1252 | 1297 | <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">'; |
1253 | 1298 | |
1254 | - if ($context['fid']) |
|
1255 | - echo ' |
|
1299 | + if ($context['fid']) { |
|
1300 | + echo ' |
|
1256 | 1301 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button_submit you_sure">'; |
1302 | + } |
|
1257 | 1303 | |
1258 | 1304 | echo ' |
1259 | 1305 | </div> |
@@ -1296,8 +1342,7 @@ discard block |
||
1296 | 1342 | { |
1297 | 1343 | echo ' |
1298 | 1344 | <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>'; |
1299 | - } |
|
1300 | - else |
|
1345 | + } else |
|
1301 | 1346 | { |
1302 | 1347 | echo ' |
1303 | 1348 | <ol class="search_results">'; |
@@ -1323,9 +1368,10 @@ discard block |
||
1323 | 1368 | <li> |
1324 | 1369 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1325 | 1370 | |
1326 | - if ($result['help']) |
|
1327 | - echo ' |
|
1371 | + if ($result['help']) { |
|
1372 | + echo ' |
|
1328 | 1373 | <p class="double_height">', $result['help'], '</p>'; |
1374 | + } |
|
1329 | 1375 | |
1330 | 1376 | echo ' |
1331 | 1377 | </li>'; |
@@ -1365,18 +1411,20 @@ discard block |
||
1365 | 1411 | <strong>', $txt['setup_verification_answer'], '</strong> |
1366 | 1412 | </dd>'; |
1367 | 1413 | |
1368 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
1369 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1414 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
1415 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1370 | 1416 | { |
1371 | 1417 | $question = $context['question_answers'][$q_id]; |
1418 | + } |
|
1372 | 1419 | echo ' |
1373 | 1420 | <dt> |
1374 | 1421 | <input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="input_text verification_question"> |
1375 | 1422 | </dt> |
1376 | 1423 | <dd>'; |
1377 | - foreach ($question['answers'] as $answer) |
|
1378 | - echo ' |
|
1424 | + foreach ($question['answers'] as $answer) { |
|
1425 | + echo ' |
|
1379 | 1426 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="input_text verification_answer">'; |
1427 | + } |
|
1380 | 1428 | |
1381 | 1429 | echo ' |
1382 | 1430 | <div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1415,11 +1463,12 @@ discard block |
||
1415 | 1463 | ', $txt['errors_found'], ': |
1416 | 1464 | <ul>'; |
1417 | 1465 | |
1418 | - foreach ($context['repair_errors'] as $error) |
|
1419 | - echo ' |
|
1466 | + foreach ($context['repair_errors'] as $error) { |
|
1467 | + echo ' |
|
1420 | 1468 | <li> |
1421 | 1469 | ', $error, ' |
1422 | 1470 | </li>'; |
1471 | + } |
|
1423 | 1472 | |
1424 | 1473 | echo ' |
1425 | 1474 | </ul> |
@@ -1429,16 +1478,15 @@ discard block |
||
1429 | 1478 | <p class="padding"> |
1430 | 1479 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1431 | 1480 | </p>'; |
1432 | - } |
|
1433 | - else |
|
1434 | - echo ' |
|
1481 | + } else { |
|
1482 | + echo ' |
|
1435 | 1483 | <p>', $txt['maintain_no_errors'], '</p> |
1436 | 1484 | <p class="padding"> |
1437 | 1485 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1438 | 1486 | </p>'; |
1487 | + } |
|
1439 | 1488 | |
1440 | - } |
|
1441 | - else |
|
1489 | + } else |
|
1442 | 1490 | { |
1443 | 1491 | if (!empty($context['redirect_to_recount'])) |
1444 | 1492 | { |
@@ -1450,8 +1498,7 @@ discard block |
||
1450 | 1498 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1451 | 1499 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1452 | 1500 | </form>'; |
1453 | - } |
|
1454 | - else |
|
1501 | + } else |
|
1455 | 1502 | { |
1456 | 1503 | echo ' |
1457 | 1504 | <p>', $txt['errors_fixed'], '</p> |
@@ -1603,8 +1650,8 @@ discard block |
||
1603 | 1650 | function template_admin_quick_search() |
1604 | 1651 | { |
1605 | 1652 | global $context, $txt; |
1606 | - if ($context['user']['is_admin']) |
|
1607 | - echo ' |
|
1653 | + if ($context['user']['is_admin']) { |
|
1654 | + echo ' |
|
1608 | 1655 | <span class="floatright admin_search"> |
1609 | 1656 | <span class="generic_icons filter centericon"></span> |
1610 | 1657 | <input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text"> |
@@ -1615,6 +1662,7 @@ discard block |
||
1615 | 1662 | </select> |
1616 | 1663 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit"> |
1617 | 1664 | </span>'; |
1618 | -} |
|
1665 | + } |
|
1666 | + } |
|
1619 | 1667 | |
1620 | 1668 | ?> |
1621 | 1669 | \ No newline at end of file |
@@ -40,16 +40,14 @@ discard block |
||
40 | 40 | ', template_show_upcoming_list('main'), ' |
41 | 41 | </div> |
42 | 42 | '; |
43 | - } |
|
44 | - elseif ($context['calendar_view'] == 'viewweek') |
|
43 | + } elseif ($context['calendar_view'] == 'viewweek') |
|
45 | 44 | { |
46 | 45 | echo ' |
47 | 46 | <div id="main_grid"> |
48 | 47 | ', template_show_week_grid('main'), ' |
49 | 48 | </div> |
50 | 49 | '; |
51 | - } |
|
52 | - else |
|
50 | + } else |
|
53 | 51 | { |
54 | 52 | echo ' |
55 | 53 | <div id="main_grid"> |
@@ -75,8 +73,9 @@ discard block |
||
75 | 73 | global $context, $scripturl, $txt; |
76 | 74 | |
77 | 75 | // Bail out if we have nothing to work with |
78 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
79 | - return false; |
|
76 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
77 | + return false; |
|
78 | + } |
|
80 | 79 | |
81 | 80 | // Protect programmer sanity |
82 | 81 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -113,11 +112,13 @@ discard block |
||
113 | 112 | <li class="windowbg"> |
114 | 113 | <b class="event_title">', $event['link'], '</b>'; |
115 | 114 | |
116 | - if ($event['can_edit']) |
|
117 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
115 | + if ($event['can_edit']) { |
|
116 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
117 | + } |
|
118 | 118 | |
119 | - if ($event['can_export']) |
|
120 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
119 | + if ($event['can_export']) { |
|
120 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
121 | + } |
|
121 | 122 | |
122 | 123 | echo ' |
123 | 124 | <br>'; |
@@ -125,14 +126,14 @@ discard block |
||
125 | 126 | if (!empty($event['allday'])) |
126 | 127 | { |
127 | 128 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
128 | - } |
|
129 | - else |
|
129 | + } else |
|
130 | 130 | { |
131 | 131 | // Display event info relative to user's local timezone |
132 | 132 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
133 | 133 | |
134 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
135 | - echo trim($event['end_date_local']) . ', '; |
|
134 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
135 | + echo trim($event['end_date_local']) . ', '; |
|
136 | + } |
|
136 | 137 | |
137 | 138 | echo trim($event['end_time_local']); |
138 | 139 | |
@@ -141,23 +142,27 @@ discard block |
||
141 | 142 | { |
142 | 143 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
143 | 144 | |
144 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
145 | - echo trim($event['start_date_orig']), ', '; |
|
145 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
146 | + echo trim($event['start_date_orig']), ', '; |
|
147 | + } |
|
146 | 148 | |
147 | 149 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
148 | 150 | |
149 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
150 | - echo trim($event['end_date_orig']) . ', '; |
|
151 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
152 | + echo trim($event['end_date_orig']) . ', '; |
|
153 | + } |
|
151 | 154 | |
152 | 155 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
153 | 156 | } |
154 | 157 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
155 | - else |
|
156 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
158 | + else { |
|
159 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
160 | + } |
|
157 | 161 | } |
158 | 162 | |
159 | - if (!empty($event['location'])) |
|
160 | - echo '<br>', $event['location']; |
|
163 | + if (!empty($event['location'])) { |
|
164 | + echo '<br>', $event['location']; |
|
165 | + } |
|
161 | 166 | |
162 | 167 | echo ' |
163 | 168 | </li>'; |
@@ -189,8 +194,9 @@ discard block |
||
189 | 194 | |
190 | 195 | $birthdays = array(); |
191 | 196 | |
192 | - foreach ($date as $member) |
|
193 | - $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
197 | + foreach ($date as $member) { |
|
198 | + $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
199 | + } |
|
194 | 200 | |
195 | 201 | echo implode(', ', $birthdays); |
196 | 202 | |
@@ -221,8 +227,9 @@ discard block |
||
221 | 227 | $date_local = $date['date_local']; |
222 | 228 | unset($date['date_local']); |
223 | 229 | |
224 | - foreach ($date as $holiday) |
|
225 | - $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
230 | + foreach ($date as $holiday) { |
|
231 | + $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
232 | + } |
|
226 | 233 | } |
227 | 234 | |
228 | 235 | echo implode(', ', $holidays); |
@@ -245,17 +252,19 @@ discard block |
||
245 | 252 | global $context, $txt, $scripturl, $modSettings; |
246 | 253 | |
247 | 254 | // If the grid doesn't exist, no point in proceeding. |
248 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
249 | - return false; |
|
255 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
256 | + return false; |
|
257 | + } |
|
250 | 258 | |
251 | 259 | // A handy little pointer variable. |
252 | 260 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
253 | 261 | |
254 | 262 | // Some conditions for whether or not we should show the week links *here*. |
255 | - if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) |
|
256 | - $show_week_links = true; |
|
257 | - else |
|
258 | - $show_week_links = false; |
|
263 | + if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) { |
|
264 | + $show_week_links = true; |
|
265 | + } else { |
|
266 | + $show_week_links = false; |
|
267 | + } |
|
259 | 268 | |
260 | 269 | // Assuming that we've not disabled it, show the title block! |
261 | 270 | if (empty($calendar_data['disable_title'])) |
@@ -294,8 +303,9 @@ discard block |
||
294 | 303 | } |
295 | 304 | |
296 | 305 | // Show the controls on main grids |
297 | - if ($is_mini === false) |
|
298 | - template_calendar_top($calendar_data); |
|
306 | + if ($is_mini === false) { |
|
307 | + template_calendar_top($calendar_data); |
|
308 | + } |
|
299 | 309 | |
300 | 310 | // Finally, the main calendar table. |
301 | 311 | echo '<table class="calendar_table">'; |
@@ -306,8 +316,9 @@ discard block |
||
306 | 316 | echo '<tr>'; |
307 | 317 | |
308 | 318 | // If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared! |
309 | - if ($show_week_links === true) |
|
310 | - echo '<th> </th>'; |
|
319 | + if ($show_week_links === true) { |
|
320 | + echo '<th> </th>'; |
|
321 | + } |
|
311 | 322 | |
312 | 323 | // Now, loop through each actual day of the week. |
313 | 324 | foreach ($calendar_data['week_days'] as $day) |
@@ -354,27 +365,29 @@ discard block |
||
354 | 365 | // Additional classes are given for events, holidays, and birthdays. |
355 | 366 | if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) |
356 | 367 | { |
357 | - if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) |
|
358 | - $classes[] = 'events'; |
|
359 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) |
|
360 | - $classes[] = 'events'; |
|
368 | + if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) { |
|
369 | + $classes[] = 'events'; |
|
370 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) { |
|
371 | + $classes[] = 'events'; |
|
372 | + } |
|
361 | 373 | } |
362 | 374 | if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) |
363 | 375 | { |
364 | - if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) |
|
365 | - $classes[] = 'holidays'; |
|
366 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) |
|
367 | - $classes[] = 'holidays'; |
|
376 | + if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) { |
|
377 | + $classes[] = 'holidays'; |
|
378 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) { |
|
379 | + $classes[] = 'holidays'; |
|
380 | + } |
|
368 | 381 | } |
369 | 382 | if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) |
370 | 383 | { |
371 | - if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) |
|
372 | - $classes[] = 'birthdays'; |
|
373 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) |
|
374 | - $classes[] = 'birthdays'; |
|
384 | + if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) { |
|
385 | + $classes[] = 'birthdays'; |
|
386 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) { |
|
387 | + $classes[] = 'birthdays'; |
|
388 | + } |
|
375 | 389 | } |
376 | - } |
|
377 | - else |
|
390 | + } else |
|
378 | 391 | { |
379 | 392 | // Default Classes (either compact or comfortable and disabled). |
380 | 393 | $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; |
@@ -392,19 +405,21 @@ discard block |
||
392 | 405 | $title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : ''; |
393 | 406 | |
394 | 407 | // The actual day number - be it a link, or just plain old text! |
395 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
396 | - echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
397 | - elseif ($is_mini) |
|
398 | - echo '<a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
399 | - else |
|
400 | - echo '<span class="day_text">', $title_prefix, $day['day'], '</span>'; |
|
408 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
409 | + echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
410 | + } elseif ($is_mini) { |
|
411 | + echo '<a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
|
412 | + } else { |
|
413 | + echo '<span class="day_text">', $title_prefix, $day['day'], '</span>'; |
|
414 | + } |
|
401 | 415 | |
402 | 416 | // A lot of stuff, we're not showing on mini-calendars to conserve space. |
403 | 417 | if ($is_mini === false) |
404 | 418 | { |
405 | 419 | // Holidays are always fun, let's show them! |
406 | - if (!empty($day['holidays'])) |
|
407 | - echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>'; |
|
420 | + if (!empty($day['holidays'])) { |
|
421 | + echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>'; |
|
422 | + } |
|
408 | 423 | |
409 | 424 | // Happy Birthday Dear, Member! |
410 | 425 | if (!empty($day['birthdays'])) |
@@ -422,14 +437,16 @@ discard block |
||
422 | 437 | echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', '; |
423 | 438 | |
424 | 439 | // 9...10! Let's stop there. |
425 | - if ($birthday_count == 10 && $use_js_hide) |
|
426 | - // !!TODO - Inline CSS and JavaScript should be moved. |
|
440 | + if ($birthday_count == 10 && $use_js_hide) { |
|
441 | + // !!TODO - Inline CSS and JavaScript should be moved. |
|
427 | 442 | echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, '; |
443 | + } |
|
428 | 444 | |
429 | 445 | ++$birthday_count; |
430 | 446 | } |
431 | - if ($use_js_hide) |
|
432 | - echo '</span>'; |
|
447 | + if ($use_js_hide) { |
|
448 | + echo '</span>'; |
|
449 | + } |
|
433 | 450 | |
434 | 451 | echo '</div>'; |
435 | 452 | } |
@@ -439,8 +456,9 @@ discard block |
||
439 | 456 | { |
440 | 457 | // Sort events by start time (all day events will be listed first) |
441 | 458 | uasort($day['events'], function($a, $b) { |
442 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
443 | - return 0; |
|
459 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
460 | + return 0; |
|
461 | + } |
|
444 | 462 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
445 | 463 | }); |
446 | 464 | |
@@ -456,17 +474,19 @@ discard block |
||
456 | 474 | |
457 | 475 | echo '<div class="event_wrapper', $event['starts_today'] == true ? ' event_starts_today' : '', $event['ends_today'] == true ? ' event_ends_today' : '', $event['allday'] == true ? ' allday' : '', $event['is_selected'] ? ' sel_event' : '', '">', $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
458 | 476 | |
459 | - if (!empty($event['start_time_local']) && $event['starts_today'] == true) |
|
460 | - echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
461 | - elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) |
|
462 | - echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
463 | - elseif (!empty($event['allday'])) |
|
464 | - echo $txt['calendar_allday']; |
|
477 | + if (!empty($event['start_time_local']) && $event['starts_today'] == true) { |
|
478 | + echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
479 | + } elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) { |
|
480 | + echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
481 | + } elseif (!empty($event['allday'])) { |
|
482 | + echo $txt['calendar_allday']; |
|
483 | + } |
|
465 | 484 | |
466 | 485 | echo '</span>'; |
467 | 486 | |
468 | - if (!empty($event['location'])) |
|
469 | - echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
487 | + if (!empty($event['location'])) { |
|
488 | + echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
489 | + } |
|
470 | 490 | |
471 | 491 | if ($event['can_edit'] || $event['can_export']) |
472 | 492 | { |
@@ -503,10 +523,11 @@ discard block |
||
503 | 523 | // Otherwise, assuming it's not a mini-calendar, we can show previous / next month days! |
504 | 524 | elseif ($is_mini === false) |
505 | 525 | { |
506 | - if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) |
|
507 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
508 | - elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) |
|
509 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
526 | + if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) { |
|
527 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
528 | + } elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) { |
|
529 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
530 | + } |
|
510 | 531 | } |
511 | 532 | |
512 | 533 | // Close this day and increase var count. |
@@ -532,8 +553,9 @@ discard block |
||
532 | 553 | global $context, $txt, $scripturl, $modSettings; |
533 | 554 | |
534 | 555 | // We might have no reason to proceed, if the variable isn't there. |
535 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
536 | - return false; |
|
556 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
557 | + return false; |
|
558 | + } |
|
537 | 559 | |
538 | 560 | // Handy pointer. |
539 | 561 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -568,8 +590,9 @@ discard block |
||
568 | 590 | } |
569 | 591 | |
570 | 592 | // The Month Title + Week Number... |
571 | - if (!empty($calendar_data['week_title'])) |
|
572 | - echo $calendar_data['week_title']; |
|
593 | + if (!empty($calendar_data['week_title'])) { |
|
594 | + echo $calendar_data['week_title']; |
|
595 | + } |
|
573 | 596 | |
574 | 597 | echo ' |
575 | 598 | </h3> |
@@ -608,10 +631,11 @@ discard block |
||
608 | 631 | <tr class="days_wrapper"> |
609 | 632 | <td class="', implode(' ', $classes), ' act_day">'; |
610 | 633 | // Should the day number be a link? |
611 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
612 | - echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
|
613 | - else |
|
614 | - echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
634 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
635 | + echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
|
636 | + } else { |
|
637 | + echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
638 | + } |
|
615 | 639 | |
616 | 640 | echo '</td> |
617 | 641 | <td class="', implode(' ', $classes), '', empty($day['events']) ? (' disabled' . ($context['can_post'] ? ' week_post' : '')) : ' events', ' event_col" data-css-prefix="' . $txt['events'] . ' ', (empty($day['events']) && empty($context['can_post'])) ? $txt['none'] : '', '">'; |
@@ -620,8 +644,9 @@ discard block |
||
620 | 644 | { |
621 | 645 | // Sort events by start time (all day events will be listed first) |
622 | 646 | uasort($day['events'], function($a, $b) { |
623 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
624 | - return 0; |
|
647 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
648 | + return 0; |
|
649 | + } |
|
625 | 650 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
626 | 651 | }); |
627 | 652 | |
@@ -633,15 +658,17 @@ discard block |
||
633 | 658 | |
634 | 659 | echo $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
635 | 660 | |
636 | - if (!empty($event['start_time_local'])) |
|
637 | - echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
638 | - else |
|
639 | - echo $txt['calendar_allday']; |
|
661 | + if (!empty($event['start_time_local'])) { |
|
662 | + echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
663 | + } else { |
|
664 | + echo $txt['calendar_allday']; |
|
665 | + } |
|
640 | 666 | |
641 | 667 | echo '</span>'; |
642 | 668 | |
643 | - if (!empty($event['location'])) |
|
644 | - echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
669 | + if (!empty($event['location'])) { |
|
670 | + echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
|
671 | + } |
|
645 | 672 | |
646 | 673 | if (!empty($event_icons_needed)) |
647 | 674 | { |
@@ -678,8 +705,7 @@ discard block |
||
678 | 705 | </div> |
679 | 706 | <br class="clear">'; |
680 | 707 | } |
681 | - } |
|
682 | - else |
|
708 | + } else |
|
683 | 709 | { |
684 | 710 | if (!empty($context['can_post'])) |
685 | 711 | { |
@@ -692,8 +718,9 @@ discard block |
||
692 | 718 | echo '</td> |
693 | 719 | <td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col" data-css-prefix="' . $txt['calendar_prompt'] . ' ">'; |
694 | 720 | // Show any holidays! |
695 | - if (!empty($day['holidays'])) |
|
696 | - echo implode('<br>', $day['holidays']); |
|
721 | + if (!empty($day['holidays'])) { |
|
722 | + echo implode('<br>', $day['holidays']); |
|
723 | + } |
|
697 | 724 | |
698 | 725 | echo '</td> |
699 | 726 | <td class="', implode(' ', $classes), '', !empty($day['birthdays']) ? ' birthdays' : ' disabled', ' birthday_col" data-css-prefix="' . $txt['birthdays'] . ' ">'; |
@@ -751,8 +778,7 @@ discard block |
||
751 | 778 | <input type="text" name="end_date" id="end_date" maxlength="10" value="', $calendar_data['end_date'], '" tabindex="', $context['tabindex']++, '" class="input_text date_input end" data-type="date"> |
752 | 779 | <input type="submit" class="button_submit" style="float:none" id="view_button" value="', $txt['view'], '"> |
753 | 780 | </form>'; |
754 | - } |
|
755 | - else |
|
781 | + } else |
|
756 | 782 | { |
757 | 783 | echo' |
758 | 784 | <form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '"> |
@@ -794,8 +820,9 @@ discard block |
||
794 | 820 | echo ' |
795 | 821 | <form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);smc_saveEntities(\'postevent\', [\'evtitle\']);" style="margin: 0;">'; |
796 | 822 | |
797 | - if (!empty($context['event']['new'])) |
|
798 | - echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
|
823 | + if (!empty($context['event']['new'])) { |
|
824 | + echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
|
825 | + } |
|
799 | 826 | |
800 | 827 | // Start the main table. |
801 | 828 | echo ' |
@@ -845,9 +872,10 @@ discard block |
||
845 | 872 | { |
846 | 873 | echo ' |
847 | 874 | <optgroup label="', $category['name'], '">'; |
848 | - foreach ($category['boards'] as $board) |
|
849 | - echo ' |
|
875 | + foreach ($category['boards'] as $board) { |
|
876 | + echo ' |
|
850 | 877 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], ' </option>'; |
878 | + } |
|
851 | 879 | echo ' |
852 | 880 | </optgroup>'; |
853 | 881 | } |
@@ -883,9 +911,10 @@ discard block |
||
883 | 911 | <span class="label">', $txt['calendar_timezone'], '</span> |
884 | 912 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
885 | 913 | |
886 | - foreach ($context['all_timezones'] as $tz => $tzname) |
|
887 | - echo ' |
|
914 | + foreach ($context['all_timezones'] as $tz => $tzname) { |
|
915 | + echo ' |
|
888 | 916 | <option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
917 | + } |
|
889 | 918 | |
890 | 919 | echo ' |
891 | 920 | </select> |
@@ -900,9 +929,10 @@ discard block |
||
900 | 929 | echo ' |
901 | 930 | <input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button_submit">'; |
902 | 931 | // Delete button? |
903 | - if (empty($context['event']['new'])) |
|
904 | - echo ' |
|
932 | + if (empty($context['event']['new'])) { |
|
933 | + echo ' |
|
905 | 934 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button_submit you_sure">'; |
935 | + } |
|
906 | 936 | |
907 | 937 | echo ' |
908 | 938 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -946,9 +976,10 @@ discard block |
||
946 | 976 | |
947 | 977 | foreach ($context['clockicons'] as $t => $v) |
948 | 978 | { |
949 | - foreach ($v as $i) |
|
950 | - echo ' |
|
979 | + foreach ($v as $i) { |
|
980 | + echo ' |
|
951 | 981 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
982 | + } |
|
952 | 983 | } |
953 | 984 | |
954 | 985 | echo ' |
@@ -973,13 +1004,14 @@ discard block |
||
973 | 1004 | |
974 | 1005 | foreach ($context['clockicons'] as $t => $v) |
975 | 1006 | { |
976 | - foreach ($v as $i) |
|
977 | - echo ' |
|
1007 | + foreach ($v as $i) { |
|
1008 | + echo ' |
|
978 | 1009 | if (', $t, ' >= ', $i, ') |
979 | 1010 | { |
980 | 1011 | turnon.push("', $t, '_', $i, '"); |
981 | 1012 | ', $t, ' -= ', $i, '; |
982 | 1013 | }'; |
1014 | + } |
|
983 | 1015 | } |
984 | 1016 | |
985 | 1017 | echo ' |
@@ -1043,9 +1075,10 @@ discard block |
||
1043 | 1075 | |
1044 | 1076 | foreach ($context['clockicons'] as $t => $v) |
1045 | 1077 | { |
1046 | - foreach ($v as $i) |
|
1047 | - echo ' |
|
1078 | + foreach ($v as $i) { |
|
1079 | + echo ' |
|
1048 | 1080 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1081 | + } |
|
1049 | 1082 | } |
1050 | 1083 | |
1051 | 1084 | echo ' |
@@ -1062,13 +1095,14 @@ discard block |
||
1062 | 1095 | |
1063 | 1096 | foreach ($context['clockicons'] as $t => $v) |
1064 | 1097 | { |
1065 | - foreach ($v as $i) |
|
1066 | - echo ' |
|
1098 | + foreach ($v as $i) { |
|
1099 | + echo ' |
|
1067 | 1100 | if (', $t, ' >= ', $i, ') |
1068 | 1101 | { |
1069 | 1102 | turnon.push("', $t, '_', $i, '"); |
1070 | 1103 | ', $t, ' -= ', $i, '; |
1071 | 1104 | }'; |
1105 | + } |
|
1072 | 1106 | } |
1073 | 1107 | |
1074 | 1108 | echo ' |
@@ -1127,9 +1161,10 @@ discard block |
||
1127 | 1161 | |
1128 | 1162 | foreach ($context['clockicons'] as $t => $v) |
1129 | 1163 | { |
1130 | - foreach ($v as $i) |
|
1131 | - echo ' |
|
1164 | + foreach ($v as $i) { |
|
1165 | + echo ' |
|
1132 | 1166 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1167 | + } |
|
1133 | 1168 | } |
1134 | 1169 | |
1135 | 1170 | echo ' |
@@ -1150,13 +1185,14 @@ discard block |
||
1150 | 1185 | |
1151 | 1186 | foreach ($context['clockicons'] as $t => $v) |
1152 | 1187 | { |
1153 | - foreach ($v as $i) |
|
1154 | - echo ' |
|
1188 | + foreach ($v as $i) { |
|
1189 | + echo ' |
|
1155 | 1190 | if (', $t, ' >= ', $i, ') |
1156 | 1191 | { |
1157 | 1192 | turnon.push("', $t, '_', $i, '"); |
1158 | 1193 | ', $t, ' -= ', $i, '; |
1159 | 1194 | }'; |
1195 | + } |
|
1160 | 1196 | } |
1161 | 1197 | |
1162 | 1198 | echo ' |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Our Cache API class |
@@ -27,8 +28,9 @@ discard block |
||
27 | 28 | { |
28 | 29 | $supported = function_exists('zend_shm_cache_fetch') || function_exists('output_cache_get'); |
29 | 30 | |
30 | - if ($test) |
|
31 | - return $supported; |
|
31 | + if ($test) { |
|
32 | + return $supported; |
|
33 | + } |
|
32 | 34 | return parent::isSupported() && $supported; |
33 | 35 | } |
34 | 36 | |
@@ -40,10 +42,11 @@ discard block |
||
40 | 42 | $key = $this->prefix . strtr($key, ':/', '-_'); |
41 | 43 | |
42 | 44 | // Zend's pricey stuff. |
43 | - if (function_exists('zend_shm_cache_fetch')) |
|
44 | - return zend_shm_cache_fetch('SMF::' . $key); |
|
45 | - elseif (function_exists('output_cache_get')) |
|
46 | - return output_cache_get($key, $ttl); |
|
45 | + if (function_exists('zend_shm_cache_fetch')) { |
|
46 | + return zend_shm_cache_fetch('SMF::' . $key); |
|
47 | + } elseif (function_exists('output_cache_get')) { |
|
48 | + return output_cache_get($key, $ttl); |
|
49 | + } |
|
47 | 50 | } |
48 | 51 | |
49 | 52 | /** |
@@ -53,10 +56,11 @@ discard block |
||
53 | 56 | { |
54 | 57 | $key = $this->prefix . strtr($key, ':/', '-_'); |
55 | 58 | |
56 | - if (function_exists('zend_shm_cache_store')) |
|
57 | - return zend_shm_cache_store('SMF::' . $key, $value, $ttl); |
|
58 | - elseif (function_exists('output_cache_put')) |
|
59 | - return output_cache_put($key, $value); |
|
59 | + if (function_exists('zend_shm_cache_store')) { |
|
60 | + return zend_shm_cache_store('SMF::' . $key, $value, $ttl); |
|
61 | + } elseif (function_exists('output_cache_put')) { |
|
62 | + return output_cache_put($key, $value); |
|
63 | + } |
|
60 | 64 | } |
61 | 65 | |
62 | 66 | /** |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Our Cache API class |
@@ -27,8 +28,9 @@ discard block |
||
27 | 28 | { |
28 | 29 | $supported = function_exists('apc_fetch') && function_exists('apc_store'); |
29 | 30 | |
30 | - if ($test) |
|
31 | - return $supported; |
|
31 | + if ($test) { |
|
32 | + return $supported; |
|
33 | + } |
|
32 | 34 | return parent::isSupported() && $supported; |
33 | 35 | } |
34 | 36 | |
@@ -50,10 +52,11 @@ discard block |
||
50 | 52 | $key = $this->prefix . strtr($key, ':/', '-_'); |
51 | 53 | |
52 | 54 | // An extended key is needed to counteract a bug in APC. |
53 | - if ($value === null) |
|
54 | - return apc_delete($key . 'smf'); |
|
55 | - else |
|
56 | - return apc_store($key . 'smf', $value, $ttl); |
|
55 | + if ($value === null) { |
|
56 | + return apc_delete($key . 'smf'); |
|
57 | + } else { |
|
58 | + return apc_store($key . 'smf', $value, $ttl); |
|
59 | + } |
|
57 | 60 | } |
58 | 61 | |
59 | 62 | /** |
@@ -67,9 +70,9 @@ discard block |
||
67 | 70 | // Always returns true. |
68 | 71 | apc_clear_cache('user'); |
69 | 72 | apc_clear_cache('system'); |
73 | + } elseif ($type === 'user') { |
|
74 | + apc_clear_cache('user'); |
|
70 | 75 | } |
71 | - elseif ($type === 'user') |
|
72 | - apc_clear_cache('user'); |
|
73 | 76 | |
74 | 77 | $this->invalidateCache(); |
75 | 78 | return true; |
@@ -13,8 +13,9 @@ discard block |
||
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 | * This is a handling function for all things post moderation. |
@@ -39,8 +40,9 @@ discard block |
||
39 | 40 | ); |
40 | 41 | |
41 | 42 | // Pick something valid... |
42 | - if (!isset($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) |
|
43 | - $_REQUEST['sa'] = 'replies'; |
|
43 | + if (!isset($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) { |
|
44 | + $_REQUEST['sa'] = 'replies'; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | call_integration_hook('integrate_post_moderation', array(&$subActions)); |
46 | 48 | |
@@ -68,13 +70,15 @@ discard block |
||
68 | 70 | $approve_boards = $approve_boards == array(0) ? $filter_board : array_intersect($approve_boards, $filter_board); |
69 | 71 | } |
70 | 72 | |
71 | - if ($approve_boards == array(0)) |
|
72 | - $approve_query = ''; |
|
73 | - elseif (!empty($approve_boards)) |
|
74 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
73 | + if ($approve_boards == array(0)) { |
|
74 | + $approve_query = ''; |
|
75 | + } elseif (!empty($approve_boards)) { |
|
76 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
77 | + } |
|
75 | 78 | // Nada, zip, etc... |
76 | - else |
|
77 | - $approve_query = ' AND 1=0'; |
|
79 | + else { |
|
80 | + $approve_query = ' AND 1=0'; |
|
81 | + } |
|
78 | 82 | |
79 | 83 | // We also need to know where we can delete topics and/or replies to. |
80 | 84 | if ($context['current_view'] == 'topics') |
@@ -82,8 +86,7 @@ discard block |
||
82 | 86 | $delete_own_boards = boardsAllowedTo('remove_own'); |
83 | 87 | $delete_any_boards = boardsAllowedTo('remove_any'); |
84 | 88 | $delete_own_replies = array(); |
85 | - } |
|
86 | - else |
|
89 | + } else |
|
87 | 90 | { |
88 | 91 | $delete_own_boards = boardsAllowedTo('delete_own'); |
89 | 92 | $delete_any_boards = boardsAllowedTo('delete_any'); |
@@ -92,21 +95,25 @@ discard block |
||
92 | 95 | |
93 | 96 | $toAction = array(); |
94 | 97 | // Check if we have something to do? |
95 | - if (isset($_GET['approve'])) |
|
96 | - $toAction[] = (int) $_GET['approve']; |
|
98 | + if (isset($_GET['approve'])) { |
|
99 | + $toAction[] = (int) $_GET['approve']; |
|
100 | + } |
|
97 | 101 | // Just a deletion? |
98 | - elseif (isset($_GET['delete'])) |
|
99 | - $toAction[] = (int) $_GET['delete']; |
|
102 | + elseif (isset($_GET['delete'])) { |
|
103 | + $toAction[] = (int) $_GET['delete']; |
|
104 | + } |
|
100 | 105 | // Lots of approvals? |
101 | - elseif (isset($_POST['item'])) |
|
102 | - foreach ($_POST['item'] as $item) |
|
106 | + elseif (isset($_POST['item'])) { |
|
107 | + foreach ($_POST['item'] as $item) |
|
103 | 108 | $toAction[] = (int) $item; |
109 | + } |
|
104 | 110 | |
105 | 111 | // What are we actually doing. |
106 | - if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve')) |
|
107 | - $curAction = 'approve'; |
|
108 | - elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete')) |
|
109 | - $curAction = 'delete'; |
|
112 | + if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve')) { |
|
113 | + $curAction = 'approve'; |
|
114 | + } elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete')) { |
|
115 | + $curAction = 'delete'; |
|
116 | + } |
|
110 | 117 | |
111 | 118 | // Right, so we have something to do? |
112 | 119 | if (!empty($toAction) && isset($curAction)) |
@@ -135,8 +142,9 @@ discard block |
||
135 | 142 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
136 | 143 | { |
137 | 144 | // If it's not within what our view is ignore it... |
138 | - if (($row['id_msg'] == $row['id_first_msg'] && $context['current_view'] != 'topics') || ($row['id_msg'] != $row['id_first_msg'] && $context['current_view'] != 'replies')) |
|
139 | - continue; |
|
145 | + if (($row['id_msg'] == $row['id_first_msg'] && $context['current_view'] != 'topics') || ($row['id_msg'] != $row['id_first_msg'] && $context['current_view'] != 'replies')) { |
|
146 | + continue; |
|
147 | + } |
|
140 | 148 | |
141 | 149 | $can_add = false; |
142 | 150 | // If we're approving this is simple. |
@@ -148,18 +156,22 @@ discard block |
||
148 | 156 | elseif ($curAction == 'delete') |
149 | 157 | { |
150 | 158 | // Own post is easy! |
151 | - if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) |
|
152 | - $can_add = true; |
|
159 | + if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) { |
|
160 | + $can_add = true; |
|
161 | + } |
|
153 | 162 | // Is it a reply to their own topic? |
154 | - elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) |
|
155 | - $can_add = true; |
|
163 | + elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) { |
|
164 | + $can_add = true; |
|
165 | + } |
|
156 | 166 | // Someone elses? |
157 | - elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) |
|
158 | - $can_add = true; |
|
167 | + elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) { |
|
168 | + $can_add = true; |
|
169 | + } |
|
159 | 170 | } |
160 | 171 | |
161 | - if ($can_add) |
|
162 | - $anItem = $context['current_view'] == 'topics' ? $row['id_topic'] : $row['id_msg']; |
|
172 | + if ($can_add) { |
|
173 | + $anItem = $context['current_view'] == 'topics' ? $row['id_topic'] : $row['id_msg']; |
|
174 | + } |
|
163 | 175 | $toAction[] = $anItem; |
164 | 176 | |
165 | 177 | // All clear. What have we got now, what, what? |
@@ -177,8 +189,7 @@ discard block |
||
177 | 189 | if ($curAction == 'approve') |
178 | 190 | { |
179 | 191 | approveMessages($toAction, $details, $context['current_view']); |
180 | - } |
|
181 | - else |
|
192 | + } else |
|
182 | 193 | { |
183 | 194 | removeMessages($toAction, $details, $context['current_view']); |
184 | 195 | } |
@@ -265,16 +276,19 @@ discard block |
||
265 | 276 | for ($i = 1; $row = $smcFunc['db_fetch_assoc']($request); $i++) |
266 | 277 | { |
267 | 278 | // Can delete is complicated, let's solve it first... is it their own post? |
268 | - if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) |
|
269 | - $can_delete = true; |
|
279 | + if ($row['id_member'] == $user_info['id'] && ($delete_own_boards == array(0) || in_array($row['id_board'], $delete_own_boards))) { |
|
280 | + $can_delete = true; |
|
281 | + } |
|
270 | 282 | // Is it a reply to their own topic? |
271 | - elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) |
|
272 | - $can_delete = true; |
|
283 | + elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($delete_own_replies == array(0) || in_array($row['id_board'], $delete_own_replies))) { |
|
284 | + $can_delete = true; |
|
285 | + } |
|
273 | 286 | // Someone elses? |
274 | - elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) |
|
275 | - $can_delete = true; |
|
276 | - else |
|
277 | - $can_delete = false; |
|
287 | + elseif ($row['id_member'] != $user_info['id'] && ($delete_any_boards == array(0) || in_array($row['id_board'], $delete_any_boards))) { |
|
288 | + $can_delete = true; |
|
289 | + } else { |
|
290 | + $can_delete = false; |
|
291 | + } |
|
278 | 292 | |
279 | 293 | $context['unapproved_items'][] = array( |
280 | 294 | 'id' => $row['id_msg'], |
@@ -323,28 +337,31 @@ discard block |
||
323 | 337 | // Once again, permissions are king! |
324 | 338 | $approve_boards = boardsAllowedTo('approve_posts'); |
325 | 339 | |
326 | - if ($approve_boards == array(0)) |
|
327 | - $approve_query = ''; |
|
328 | - elseif (!empty($approve_boards)) |
|
329 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
330 | - else |
|
331 | - $approve_query = ' AND 1=0'; |
|
340 | + if ($approve_boards == array(0)) { |
|
341 | + $approve_query = ''; |
|
342 | + } elseif (!empty($approve_boards)) { |
|
343 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
344 | + } else { |
|
345 | + $approve_query = ' AND 1=0'; |
|
346 | + } |
|
332 | 347 | |
333 | 348 | // Get together the array of things to act on, if any. |
334 | 349 | $attachments = array(); |
335 | - if (isset($_GET['approve'])) |
|
336 | - $attachments[] = (int) $_GET['approve']; |
|
337 | - elseif (isset($_GET['delete'])) |
|
338 | - $attachments[] = (int) $_GET['delete']; |
|
339 | - elseif (isset($_POST['item'])) |
|
340 | - foreach ($_POST['item'] as $item) |
|
350 | + if (isset($_GET['approve'])) { |
|
351 | + $attachments[] = (int) $_GET['approve']; |
|
352 | + } elseif (isset($_GET['delete'])) { |
|
353 | + $attachments[] = (int) $_GET['delete']; |
|
354 | + } elseif (isset($_POST['item'])) { |
|
355 | + foreach ($_POST['item'] as $item) |
|
341 | 356 | $attachments[] = (int) $item; |
357 | + } |
|
342 | 358 | |
343 | 359 | // Are we approving or deleting? |
344 | - if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve')) |
|
345 | - $curAction = 'approve'; |
|
346 | - elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete')) |
|
347 | - $curAction = 'delete'; |
|
360 | + if (isset($_GET['approve']) || (isset($_POST['do']) && $_POST['do'] == 'approve')) { |
|
361 | + $curAction = 'approve'; |
|
362 | + } elseif (isset($_GET['delete']) || (isset($_POST['do']) && $_POST['do'] == 'delete')) { |
|
363 | + $curAction = 'delete'; |
|
364 | + } |
|
348 | 365 | |
349 | 366 | // Something to do, let's do it! |
350 | 367 | if (!empty($attachments) && isset($curAction)) |
@@ -372,17 +389,19 @@ discard block |
||
372 | 389 | ) |
373 | 390 | ); |
374 | 391 | $attachments = array(); |
375 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
376 | - $attachments[] = $row['id_attach']; |
|
392 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
393 | + $attachments[] = $row['id_attach']; |
|
394 | + } |
|
377 | 395 | $smcFunc['db_free_result']($request); |
378 | 396 | |
379 | 397 | // Assuming it wasn't all like, proper illegal, we can do the approving. |
380 | 398 | if (!empty($attachments)) |
381 | 399 | { |
382 | - if ($curAction == 'approve') |
|
383 | - ApproveAttachments($attachments); |
|
384 | - else |
|
385 | - removeAttachments(array('id_attach' => $attachments, 'do_logging' => true)); |
|
400 | + if ($curAction == 'approve') { |
|
401 | + ApproveAttachments($attachments); |
|
402 | + } else { |
|
403 | + removeAttachments(array('id_attach' => $attachments, 'do_logging' => true)); |
|
404 | + } |
|
386 | 405 | } |
387 | 406 | } |
388 | 407 | |
@@ -682,15 +701,16 @@ discard block |
||
682 | 701 | { |
683 | 702 | approveTopics($topic, !$approved); |
684 | 703 | |
685 | - if ($starter != $user_info['id']) |
|
686 | - logAction(($approved ? 'un' : '') . 'approve_topic', array('topic' => $topic, 'subject' => $subject, 'member' => $starter, 'board' => $board)); |
|
687 | - } |
|
688 | - else |
|
704 | + if ($starter != $user_info['id']) { |
|
705 | + logAction(($approved ? 'un' : '') . 'approve_topic', array('topic' => $topic, 'subject' => $subject, 'member' => $starter, 'board' => $board)); |
|
706 | + } |
|
707 | + } else |
|
689 | 708 | { |
690 | 709 | approvePosts($_REQUEST['msg'], !$approved); |
691 | 710 | |
692 | - if ($poster != $user_info['id']) |
|
693 | - logAction(($approved ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $subject, 'member' => $poster, 'board' => $board)); |
|
711 | + if ($poster != $user_info['id']) { |
|
712 | + logAction(($approved ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $subject, 'member' => $poster, 'board' => $board)); |
|
713 | + } |
|
694 | 714 | } |
695 | 715 | |
696 | 716 | redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']); |
@@ -716,8 +736,7 @@ discard block |
||
716 | 736 | { |
717 | 737 | logAction('approve_topic', array('topic' => $topic, 'subject' => $messageDetails[$topic]['subject'], 'member' => $messageDetails[$topic]['member'], 'board' => $messageDetails[$topic]['board'])); |
718 | 738 | } |
719 | - } |
|
720 | - else |
|
739 | + } else |
|
721 | 740 | { |
722 | 741 | approvePosts($messages); |
723 | 742 | // and tell the world about it again |
@@ -745,8 +764,9 @@ discard block |
||
745 | 764 | ) |
746 | 765 | ); |
747 | 766 | $msgs = array(); |
748 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
749 | - $msgs[] = $row[0]; |
|
767 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
768 | + $msgs[] = $row[0]; |
|
769 | + } |
|
750 | 770 | $smcFunc['db_free_result']($request); |
751 | 771 | |
752 | 772 | if (!empty($msgs)) |
@@ -765,8 +785,9 @@ discard block |
||
765 | 785 | ) |
766 | 786 | ); |
767 | 787 | $attaches = array(); |
768 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
769 | - $attaches[] = $row[0]; |
|
788 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
789 | + $attaches[] = $row[0]; |
|
790 | + } |
|
770 | 791 | $smcFunc['db_free_result']($request); |
771 | 792 | |
772 | 793 | if (!empty($attaches)) |
@@ -794,12 +815,12 @@ discard block |
||
794 | 815 | { |
795 | 816 | removeTopics($messages); |
796 | 817 | // and tell the world about it |
797 | - foreach ($messages as $topic) |
|
798 | - // Note, only log topic ID in native form if it's not gone forever. |
|
818 | + foreach ($messages as $topic) { |
|
819 | + // Note, only log topic ID in native form if it's not gone forever. |
|
799 | 820 | logAction('remove', array( |
800 | 821 | (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $messageDetails[$topic]['board'] ? 'topic' : 'old_topic_id') => $topic, 'subject' => $messageDetails[$topic]['subject'], 'member' => $messageDetails[$topic]['member'], 'board' => $messageDetails[$topic]['board'])); |
801 | - } |
|
802 | - else |
|
822 | + } |
|
823 | + } else |
|
803 | 824 | { |
804 | 825 | foreach ($messages as $post) |
805 | 826 | { |