@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 4 |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('SMF')) |
|
18 | +if (!defined('SMF')) { |
|
19 | 19 | die('No direct access...'); |
20 | +} |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -246,8 +247,9 @@ discard block |
||
246 | 247 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
247 | 248 | { |
248 | 249 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
249 | - if (!empty($row['private'])) |
|
250 | - $row['subject'] = $txt['personal_message']; |
|
250 | + if (!empty($row['private'])) { |
|
251 | + $row['subject'] = $txt['personal_message']; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | $mails[] = $row; |
253 | 255 | } |
@@ -301,8 +303,9 @@ discard block |
||
301 | 303 | $element = substr($key, strrpos($key, '_') + 1); |
302 | 304 | $processedBirthdayEmails[$index][$element] = $value; |
303 | 305 | } |
304 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
305 | - $emails[$index] = $index; |
|
306 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
307 | + $emails[$index] = $index; |
|
308 | + } |
|
306 | 309 | |
307 | 310 | $config_vars = array( |
308 | 311 | // Mail queue stuff, this rocks ;) |
@@ -323,8 +326,9 @@ discard block |
||
323 | 326 | |
324 | 327 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
325 | 328 | |
326 | - if ($return_config) |
|
327 | - return $config_vars; |
|
329 | + if ($return_config) { |
|
330 | + return $config_vars; |
|
331 | + } |
|
328 | 332 | |
329 | 333 | // Saving? |
330 | 334 | if (isset($_GET['save'])) |
@@ -399,9 +403,9 @@ discard block |
||
399 | 403 | ); |
400 | 404 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
401 | 405 | $smcFunc['db_free_result']($request); |
406 | + } else { |
|
407 | + $_GET['te'] = (int) $_GET['te']; |
|
402 | 408 | } |
403 | - else |
|
404 | - $_GET['te'] = (int) $_GET['te']; |
|
405 | 409 | |
406 | 410 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
407 | 411 | |
@@ -425,12 +429,14 @@ discard block |
||
425 | 429 | |
426 | 430 | // Try get more time... |
427 | 431 | @set_time_limit(600); |
428 | - if (function_exists('apache_reset_timeout')) |
|
429 | - @apache_reset_timeout(); |
|
432 | + if (function_exists('apache_reset_timeout')) { |
|
433 | + @apache_reset_timeout(); |
|
434 | + } |
|
430 | 435 | |
431 | 436 | // Have we already used our maximum time? |
432 | - if ((time() - $time_start) < 5) |
|
433 | - return; |
|
437 | + if ((time() - $time_start) < 5) { |
|
438 | + return; |
|
439 | + } |
|
434 | 440 | |
435 | 441 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
436 | 442 | $context['page_title'] = $txt['not_done_title']; |
@@ -480,9 +486,10 @@ discard block |
||
480 | 486 | } |
481 | 487 | |
482 | 488 | // The result. |
483 | - if (isset($_GET['result'])) |
|
484 | - $context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure'); |
|
485 | -} |
|
489 | + if (isset($_GET['result'])) { |
|
490 | + $context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure'); |
|
491 | + } |
|
492 | + } |
|
486 | 493 | |
487 | 494 | /** |
488 | 495 | * Little utility function to calculate how long ago a time was. |
@@ -494,8 +501,9 @@ discard block |
||
494 | 501 | { |
495 | 502 | global $txt; |
496 | 503 | |
497 | - if ($time_diff < 0) |
|
498 | - $time_diff = 0; |
|
504 | + if ($time_diff < 0) { |
|
505 | + $time_diff = 0; |
|
506 | + } |
|
499 | 507 | |
500 | 508 | // Just do a bit of an if fest... |
501 | 509 | if ($time_diff > 86400) |
@@ -516,8 +524,9 @@ discard block |
||
516 | 524 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
517 | 525 | } |
518 | 526 | // Otherwise must be second |
519 | - else |
|
520 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
521 | -} |
|
527 | + else { |
|
528 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
529 | + } |
|
530 | + } |
|
522 | 531 | |
523 | 532 | ?> |
524 | 533 | \ No newline at end of file |
@@ -48,9 +48,10 @@ |
||
48 | 48 | global $context, $txt; |
49 | 49 | |
50 | 50 | // The results. |
51 | - if (!empty($context['result'])) |
|
52 | - echo ' |
|
51 | + if (!empty($context['result'])) { |
|
52 | + echo ' |
|
53 | 53 | <div class="', $context['result'] == 'success' ? 'infobox' : 'errorbox', '">', $txt['mailtest_result_' . $context['result']], '</div>'; |
54 | + } |
|
54 | 55 | |
55 | 56 | echo ' |
56 | 57 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post"> |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | <div id="personal_messages">'; |
22 | 22 | |
23 | 23 | // Show the capacity bar, if available. |
24 | - if (!empty($context['limit_bar'])) |
|
25 | - echo ' |
|
24 | + if (!empty($context['limit_bar'])) { |
|
25 | + echo ' |
|
26 | 26 | <div class="cat_bar"> |
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['pm_capacity'], ':</span> |
@@ -32,14 +32,16 @@ discard block |
||
32 | 32 | <span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span> |
33 | 33 | </h3> |
34 | 34 | </div>'; |
35 | + } |
|
35 | 36 | |
36 | 37 | // Message sent? Show a small indication. |
37 | - if (isset($context['pm_sent'])) |
|
38 | - echo ' |
|
38 | + if (isset($context['pm_sent'])) { |
|
39 | + echo ' |
|
39 | 40 | <div class="infobox"> |
40 | 41 | ', $txt['pm_sent'], ' |
41 | 42 | </div>'; |
42 | -} |
|
43 | + } |
|
44 | + } |
|
43 | 45 | |
44 | 46 | /** |
45 | 47 | * Just the end of the index bar, nothing special. |
@@ -68,13 +70,13 @@ discard block |
||
68 | 70 | </div> |
69 | 71 | <div class="pm_unread">'; |
70 | 72 | |
71 | - if (empty($context['unread_pms'])) |
|
72 | - echo ' |
|
73 | + if (empty($context['unread_pms'])) { |
|
74 | + echo ' |
|
73 | 75 | <div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
74 | - else |
|
76 | + } else |
|
75 | 77 | { |
76 | - foreach ($context['unread_pms'] as $id_pm => $pm_details) |
|
77 | - echo ' |
|
78 | + foreach ($context['unread_pms'] as $id_pm => $pm_details) { |
|
79 | + echo ' |
|
78 | 80 | <div class="unread"> |
79 | 81 | ', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', ' |
80 | 82 | <div class="details"> |
@@ -85,6 +87,7 @@ discard block |
||
85 | 87 | </div> |
86 | 88 | </div> |
87 | 89 | </div>'; |
90 | + } |
|
88 | 91 | } |
89 | 92 | |
90 | 93 | echo ' |
@@ -193,14 +196,15 @@ discard block |
||
193 | 196 | if ($context['get_pmessage']('message', true)) |
194 | 197 | { |
195 | 198 | // Show the helpful titlebar - generally. |
196 | - if ($context['display_mode'] != 1) |
|
197 | - echo ' |
|
199 | + if ($context['display_mode'] != 1) { |
|
200 | + echo ' |
|
198 | 201 | <div class="cat_bar"> |
199 | 202 | <h3 class="catbg"> |
200 | 203 | <span id="author">', $txt['author'], '</span> |
201 | 204 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
202 | 205 | </h3> |
203 | 206 | </div>'; |
207 | + } |
|
204 | 208 | |
205 | 209 | // Show a few buttons if we are in conversation mode and outputting the first message. |
206 | 210 | if ($context['display_mode'] == 2) |
@@ -228,9 +232,10 @@ discard block |
||
228 | 232 | <div class="custom_fields_above_member"> |
229 | 233 | <ul class="nolist">'; |
230 | 234 | |
231 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
232 | - echo ' |
|
235 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
236 | + echo ' |
|
233 | 237 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
238 | + } |
|
234 | 239 | |
235 | 240 | echo ' |
236 | 241 | </ul> |
@@ -242,25 +247,28 @@ discard block |
||
242 | 247 | <a id="msg', $message['id'], '"></a>'; |
243 | 248 | |
244 | 249 | // Show online and offline buttons? |
245 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
246 | - echo ' |
|
250 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
251 | + echo ' |
|
247 | 252 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
253 | + } |
|
248 | 254 | |
249 | 255 | // Custom fields BEFORE the username? |
250 | - if (!empty($message['custom_fields']['before_member'])) |
|
251 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
256 | + if (!empty($message['custom_fields']['before_member'])) { |
|
257 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
252 | 258 | echo ' |
253 | 259 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
260 | + } |
|
254 | 261 | |
255 | 262 | // Show a link to the member's profile. |
256 | 263 | echo ' |
257 | 264 | ', $message['member']['link']; |
258 | 265 | |
259 | 266 | // Custom fields AFTER the username? |
260 | - if (!empty($message['custom_fields']['after_member'])) |
|
261 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
267 | + if (!empty($message['custom_fields']['after_member'])) { |
|
268 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
262 | 269 | echo ' |
263 | 270 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
271 | + } |
|
264 | 272 | |
265 | 273 | echo ' |
266 | 274 | </h4>'; |
@@ -269,48 +277,56 @@ discard block |
||
269 | 277 | <ul class="user_info">'; |
270 | 278 | |
271 | 279 | // Show the user's avatar. |
272 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
273 | - echo ' |
|
280 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
281 | + echo ' |
|
274 | 282 | <li class="avatar"> |
275 | 283 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
276 | 284 | </li>'; |
285 | + } |
|
277 | 286 | |
278 | 287 | // Are there any custom fields below the avatar? |
279 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
280 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
288 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
289 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
281 | 290 | echo ' |
282 | 291 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
292 | + } |
|
283 | 293 | |
284 | - if (!$message['member']['is_guest']) |
|
285 | - echo ' |
|
294 | + if (!$message['member']['is_guest']) { |
|
295 | + echo ' |
|
286 | 296 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
297 | + } |
|
287 | 298 | // Show the member's primary group (like 'Administrator') if they have one. |
288 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
289 | - echo ' |
|
299 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
300 | + echo ' |
|
290 | 301 | <li class="membergroup">', $message['member']['group'], '</li>'; |
302 | + } |
|
291 | 303 | |
292 | 304 | // Show the member's custom title, if they have one. |
293 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
294 | - echo ' |
|
305 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
306 | + echo ' |
|
295 | 307 | <li class="title">', $message['member']['title'], '</li>'; |
308 | + } |
|
296 | 309 | |
297 | 310 | // Don't show these things for guests. |
298 | 311 | if (!$message['member']['is_guest']) |
299 | 312 | { |
300 | 313 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
301 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
302 | - echo ' |
|
314 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
315 | + echo ' |
|
303 | 316 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
317 | + } |
|
304 | 318 | |
305 | 319 | // Show how many posts they have made. |
306 | - if (!isset($context['disabled_fields']['posts'])) |
|
307 | - echo ' |
|
320 | + if (!isset($context['disabled_fields']['posts'])) { |
|
321 | + echo ' |
|
308 | 322 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
323 | + } |
|
309 | 324 | |
310 | 325 | // Show their personal text? |
311 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
312 | - echo ' |
|
326 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
327 | + echo ' |
|
313 | 328 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
329 | + } |
|
314 | 330 | |
315 | 331 | // Any custom fields to show as icons? |
316 | 332 | if (!empty($message['custom_fields']['icons'])) |
@@ -319,9 +335,10 @@ discard block |
||
319 | 335 | <li class="im_icons"> |
320 | 336 | <ol>'; |
321 | 337 | |
322 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
323 | - echo ' |
|
338 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
339 | + echo ' |
|
324 | 340 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
341 | + } |
|
325 | 342 | |
326 | 343 | echo ' |
327 | 344 | </ol> |
@@ -329,25 +346,28 @@ discard block |
||
329 | 346 | } |
330 | 347 | |
331 | 348 | // Show the IP to this user for this post - because you can moderate? |
332 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
333 | - echo ' |
|
349 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
350 | + echo ' |
|
334 | 351 | <li class="poster_ip"> |
335 | 352 | <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a> |
336 | 353 | </li>'; |
354 | + } |
|
337 | 355 | |
338 | 356 | // Or, should we show it because this is you? |
339 | - elseif ($message['can_see_ip']) |
|
340 | - echo ' |
|
357 | + elseif ($message['can_see_ip']) { |
|
358 | + echo ' |
|
341 | 359 | <li class="poster_ip"> |
342 | 360 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a> |
343 | 361 | </li>'; |
362 | + } |
|
344 | 363 | |
345 | 364 | // Okay, you are logged in, then we can show something about why IPs are logged... |
346 | - else |
|
347 | - echo ' |
|
365 | + else { |
|
366 | + echo ' |
|
348 | 367 | <li class="poster_ip"> |
349 | 368 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a> |
350 | 369 | </li>'; |
370 | + } |
|
351 | 371 | |
352 | 372 | // Show the profile, website, email address, and personal message buttons. |
353 | 373 | if ($message['member']['show_profile_buttons']) |
@@ -357,24 +377,28 @@ discard block |
||
357 | 377 | <ol class="profile_icons">'; |
358 | 378 | |
359 | 379 | // Show the profile button |
360 | - if ($message['member']['can_view_profile']) |
|
361 | - echo ' |
|
380 | + if ($message['member']['can_view_profile']) { |
|
381 | + echo ' |
|
362 | 382 | <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>'; |
383 | + } |
|
363 | 384 | |
364 | 385 | // Don't show an icon if they haven't specified a website. |
365 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
366 | - echo ' |
|
386 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
387 | + echo ' |
|
367 | 388 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
389 | + } |
|
368 | 390 | |
369 | 391 | // Don't show the email address if they want it hidden. |
370 | - if ($message['member']['show_email']) |
|
371 | - echo ' |
|
392 | + if ($message['member']['show_email']) { |
|
393 | + echo ' |
|
372 | 394 | <li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
395 | + } |
|
373 | 396 | |
374 | 397 | // Since we know this person isn't a guest, you *can* message them. |
375 | - if ($context['can_send_pm']) |
|
376 | - echo ' |
|
398 | + if ($context['can_send_pm']) { |
|
399 | + echo ' |
|
377 | 400 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
401 | + } |
|
378 | 402 | |
379 | 403 | echo ' |
380 | 404 | </ol> |
@@ -382,21 +406,24 @@ discard block |
||
382 | 406 | } |
383 | 407 | |
384 | 408 | // Any custom fields for standard placement? |
385 | - if (!empty($message['custom_fields']['standard'])) |
|
386 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
409 | + if (!empty($message['custom_fields']['standard'])) { |
|
410 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
387 | 411 | echo ' |
388 | 412 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
413 | + } |
|
389 | 414 | |
390 | 415 | // Are we showing the warning status? |
391 | - if ($message['member']['can_see_warning']) |
|
392 | - echo ' |
|
416 | + if ($message['member']['can_see_warning']) { |
|
417 | + echo ' |
|
393 | 418 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
419 | + } |
|
394 | 420 | |
395 | 421 | // Are there any custom fields to show at the bottom of the poster info? |
396 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
397 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
422 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
423 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
398 | 424 | echo ' |
399 | 425 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
426 | + } |
|
400 | 427 | } |
401 | 428 | |
402 | 429 | // Done with the information about the poster... on to the post itself. |
@@ -415,25 +442,29 @@ discard block |
||
415 | 442 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
416 | 443 | |
417 | 444 | // People it was sent directly to.... |
418 | - if (!empty($message['recipients']['to'])) |
|
419 | - echo implode(', ', $message['recipients']['to']); |
|
445 | + if (!empty($message['recipients']['to'])) { |
|
446 | + echo implode(', ', $message['recipients']['to']); |
|
447 | + } |
|
420 | 448 | |
421 | 449 | // Otherwise, we're just going to say "some people"... |
422 | - elseif ($context['folder'] != 'sent') |
|
423 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
450 | + elseif ($context['folder'] != 'sent') { |
|
451 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
452 | + } |
|
424 | 453 | |
425 | 454 | echo ' |
426 | 455 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
427 | 456 | </span>'; |
428 | 457 | |
429 | 458 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
430 | - if (!empty($message['recipients']['bcc'])) |
|
431 | - echo '<br> |
|
459 | + if (!empty($message['recipients']['bcc'])) { |
|
460 | + echo '<br> |
|
432 | 461 | <span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
462 | + } |
|
433 | 463 | |
434 | - if (!empty($message['is_replied_to'])) |
|
435 | - echo '<br> |
|
464 | + if (!empty($message['is_replied_to'])) { |
|
465 | + echo '<br> |
|
436 | 466 | <span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
467 | + } |
|
437 | 468 | |
438 | 469 | echo ' |
439 | 470 | </div><!-- .keyinfo --> |
@@ -443,13 +474,15 @@ discard block |
||
443 | 474 | ', $message['body'], ' |
444 | 475 | </div>'; |
445 | 476 | |
446 | - if ($message['can_report'] || $context['can_send_pm']) |
|
447 | - echo ' |
|
477 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
478 | + echo ' |
|
448 | 479 | <div class="under_message">'; |
480 | + } |
|
449 | 481 | |
450 | - if ($message['can_report']) |
|
451 | - echo ' |
|
482 | + if ($message['can_report']) { |
|
483 | + echo ' |
|
452 | 484 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
485 | + } |
|
453 | 486 | |
454 | 487 | echo ' |
455 | 488 | <ul class="quickbuttons">'; |
@@ -461,32 +494,36 @@ discard block |
||
461 | 494 | if (!$message['member']['is_guest']) |
462 | 495 | { |
463 | 496 | // Is there than more than one recipient you can reply to? |
464 | - if ($message['number_recipients'] > 1) |
|
465 | - echo ' |
|
497 | + if ($message['number_recipients'] > 1) { |
|
498 | + echo ' |
|
466 | 499 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>'; |
500 | + } |
|
467 | 501 | |
468 | 502 | echo ' |
469 | 503 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li> |
470 | 504 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
471 | 505 | } |
472 | 506 | // This is for "forwarding" - even if the member is gone. |
473 | - else |
|
474 | - echo ' |
|
507 | + else { |
|
508 | + echo ' |
|
475 | 509 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>'; |
510 | + } |
|
476 | 511 | } |
477 | 512 | echo ' |
478 | 513 | <li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>'; |
479 | 514 | |
480 | - if (empty($context['display_mode'])) |
|
481 | - echo ' |
|
515 | + if (empty($context['display_mode'])) { |
|
516 | + echo ' |
|
482 | 517 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>'; |
518 | + } |
|
483 | 519 | |
484 | 520 | echo ' |
485 | 521 | </ul>'; |
486 | 522 | |
487 | - if ($message['can_report'] || $context['can_send_pm']) |
|
488 | - echo ' |
|
523 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
524 | + echo ' |
|
489 | 525 | </div><!-- .under_message -->'; |
526 | + } |
|
490 | 527 | |
491 | 528 | // Are there any custom profile fields for above the signature? |
492 | 529 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -495,9 +532,10 @@ discard block |
||
495 | 532 | <div class="custom_fields_above_signature"> |
496 | 533 | <ul class="nolist">'; |
497 | 534 | |
498 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
499 | - echo ' |
|
535 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
536 | + echo ' |
|
500 | 537 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
538 | + } |
|
501 | 539 | |
502 | 540 | echo ' |
503 | 541 | </ul> |
@@ -505,11 +543,12 @@ discard block |
||
505 | 543 | } |
506 | 544 | |
507 | 545 | // Show the member's signature? |
508 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
509 | - echo ' |
|
546 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
547 | + echo ' |
|
510 | 548 | <div class="signature"> |
511 | 549 | ', $message['member']['signature'], ' |
512 | 550 | </div>'; |
551 | + } |
|
513 | 552 | |
514 | 553 | // Are there any custom profile fields for below the signature? |
515 | 554 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -518,9 +557,10 @@ discard block |
||
518 | 557 | <div class="custom_fields_below_signature"> |
519 | 558 | <ul class="nolist">'; |
520 | 559 | |
521 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
522 | - echo ' |
|
560 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
561 | + echo ' |
|
523 | 562 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
563 | + } |
|
524 | 564 | |
525 | 565 | echo ' |
526 | 566 | </ul> |
@@ -547,10 +587,11 @@ discard block |
||
547 | 587 | echo ' |
548 | 588 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
549 | 589 | |
550 | - foreach ($context['labels'] as $label) |
|
551 | - if (!isset($message['labels'][$label['id']])) |
|
590 | + foreach ($context['labels'] as $label) { |
|
591 | + if (!isset($message['labels'][$label['id']])) |
|
552 | 592 | echo ' |
553 | 593 | <option value="', $label['id'], '">', $label['name'], '</option>'; |
594 | + } |
|
554 | 595 | } |
555 | 596 | |
556 | 597 | // ... and are there any that can be removed? |
@@ -559,9 +600,10 @@ discard block |
||
559 | 600 | echo ' |
560 | 601 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
561 | 602 | |
562 | - foreach ($message['labels'] as $label) |
|
563 | - echo ' |
|
603 | + foreach ($message['labels'] as $label) { |
|
604 | + echo ' |
|
564 | 605 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
606 | + } |
|
565 | 607 | } |
566 | 608 | echo ' |
567 | 609 | </select> |
@@ -580,14 +622,15 @@ discard block |
||
580 | 622 | </div><!-- .windowbg -->'; |
581 | 623 | } |
582 | 624 | |
583 | - if (empty($context['display_mode'])) |
|
584 | - echo ' |
|
625 | + if (empty($context['display_mode'])) { |
|
626 | + echo ' |
|
585 | 627 | <div class="pagesection"> |
586 | 628 | <div class="floatleft">', $context['page_index'], '</div> |
587 | 629 | <div class="floatright"> |
588 | 630 | <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button"> |
589 | 631 | </div> |
590 | 632 | </div>'; |
633 | + } |
|
591 | 634 | |
592 | 635 | // Show a few buttons if we are in conversation mode and outputting the first message. |
593 | 636 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -647,11 +690,12 @@ discard block |
||
647 | 690 | </thead> |
648 | 691 | <tbody>'; |
649 | 692 | |
650 | - if (!$context['show_delete']) |
|
651 | - echo ' |
|
693 | + if (!$context['show_delete']) { |
|
694 | + echo ' |
|
652 | 695 | <tr class="windowbg"> |
653 | 696 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
654 | 697 | </tr>'; |
698 | + } |
|
655 | 699 | |
656 | 700 | while ($message = $context['get_pmessage']('subject')) |
657 | 701 | { |
@@ -709,17 +753,19 @@ discard block |
||
709 | 753 | |
710 | 754 | foreach ($context['labels'] as $label) |
711 | 755 | { |
712 | - if ($label['id'] != $context['current_label_id']) |
|
713 | - echo ' |
|
756 | + if ($label['id'] != $context['current_label_id']) { |
|
757 | + echo ' |
|
714 | 758 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
759 | + } |
|
715 | 760 | } |
716 | 761 | |
717 | 762 | echo ' |
718 | 763 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
719 | 764 | |
720 | - foreach ($context['labels'] as $label) |
|
721 | - echo ' |
|
765 | + foreach ($context['labels'] as $label) { |
|
766 | + echo ' |
|
722 | 767 | <option value="rem_', $label['id'], '"> ', $label['name'], '</option>'; |
768 | + } |
|
723 | 769 | |
724 | 770 | echo ' |
725 | 771 | </select> |
@@ -744,11 +790,12 @@ discard block |
||
744 | 790 | { |
745 | 791 | global $context, $scripturl, $txt; |
746 | 792 | |
747 | - if (!empty($context['search_errors'])) |
|
748 | - echo ' |
|
793 | + if (!empty($context['search_errors'])) { |
|
794 | + echo ' |
|
749 | 795 | <div class="errorbox"> |
750 | 796 | ', implode('<br>', $context['search_errors']['messages']), ' |
751 | 797 | </div>'; |
798 | + } |
|
752 | 799 | |
753 | 800 | echo ' |
754 | 801 | <form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform"> |
@@ -816,9 +863,10 @@ discard block |
||
816 | 863 | </dd> |
817 | 864 | </dl>'; |
818 | 865 | |
819 | - if (!$context['currently_using_labels']) |
|
820 | - echo ' |
|
866 | + if (!$context['currently_using_labels']) { |
|
867 | + echo ' |
|
821 | 868 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button floatright">'; |
869 | + } |
|
822 | 870 | |
823 | 871 | echo ' |
824 | 872 | </div><!-- .roundframe -->'; |
@@ -837,12 +885,13 @@ discard block |
||
837 | 885 | <div id="advanced_panel_div"> |
838 | 886 | <ul id="searchLabelsExpand">'; |
839 | 887 | |
840 | - foreach ($context['search_labels'] as $label) |
|
841 | - echo ' |
|
888 | + foreach ($context['search_labels'] as $label) { |
|
889 | + echo ' |
|
842 | 890 | <li> |
843 | 891 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '> |
844 | 892 | ', $label['name'], '</label> |
845 | 893 | </li>'; |
894 | + } |
|
846 | 895 | |
847 | 896 | echo ' |
848 | 897 | </ul> |
@@ -904,8 +953,8 @@ discard block |
||
904 | 953 | </div>'; |
905 | 954 | |
906 | 955 | // Complete results? |
907 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
908 | - echo ' |
|
956 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
957 | + echo ' |
|
909 | 958 | <table class="table_grid"> |
910 | 959 | <thead> |
911 | 960 | <tr class="title_bar"> |
@@ -915,6 +964,7 @@ discard block |
||
915 | 964 | </tr> |
916 | 965 | </thead> |
917 | 966 | <tbody>'; |
967 | + } |
|
918 | 968 | |
919 | 969 | // Print each message out... |
920 | 970 | foreach ($context['personal_messages'] as $message) |
@@ -934,12 +984,14 @@ discard block |
||
934 | 984 | |
935 | 985 | // Show the recipients. |
936 | 986 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
937 | - if (!empty($message['recipients']['to'])) |
|
938 | - echo implode(', ', $message['recipients']['to']); |
|
987 | + if (!empty($message['recipients']['to'])) { |
|
988 | + echo implode(', ', $message['recipients']['to']); |
|
989 | + } |
|
939 | 990 | |
940 | 991 | // Otherwise, we're just going to say "some people"... |
941 | - elseif ($context['folder'] != 'sent') |
|
942 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
992 | + elseif ($context['folder'] != 'sent') { |
|
993 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
994 | + } |
|
943 | 995 | |
944 | 996 | echo ' |
945 | 997 | </h3> |
@@ -954,15 +1006,17 @@ discard block |
||
954 | 1006 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
955 | 1007 | |
956 | 1008 | // You can only reply if they are not a guest... |
957 | - if (!$message['member']['is_guest']) |
|
958 | - echo ' |
|
1009 | + if (!$message['member']['is_guest']) { |
|
1010 | + echo ' |
|
959 | 1011 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
960 | 1012 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
1013 | + } |
|
961 | 1014 | |
962 | 1015 | // This is for "forwarding" - even if the member is gone. |
963 | - else |
|
964 | - echo ' |
|
1016 | + else { |
|
1017 | + echo ' |
|
965 | 1018 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
1019 | + } |
|
966 | 1020 | } |
967 | 1021 | |
968 | 1022 | echo ' |
@@ -971,27 +1025,30 @@ discard block |
||
971 | 1025 | } |
972 | 1026 | // Otherwise just a simple list! |
973 | 1027 | // @todo No context at all of the search? |
974 | - else |
|
975 | - echo ' |
|
1028 | + else { |
|
1029 | + echo ' |
|
976 | 1030 | <tr class="windowbg"> |
977 | 1031 | <td>', $message['time'], '</td> |
978 | 1032 | <td>', $message['link'], '</td> |
979 | 1033 | <td>', $message['member']['link'], '</td> |
980 | 1034 | </tr>'; |
1035 | + } |
|
981 | 1036 | } |
982 | 1037 | |
983 | 1038 | // Finish off the page... |
984 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
985 | - echo ' |
|
1039 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
1040 | + echo ' |
|
986 | 1041 | </tbody> |
987 | 1042 | </table>'; |
1043 | + } |
|
988 | 1044 | |
989 | 1045 | // No results? |
990 | - if (empty($context['personal_messages'])) |
|
991 | - echo ' |
|
1046 | + if (empty($context['personal_messages'])) { |
|
1047 | + echo ' |
|
992 | 1048 | <div class="windowbg"> |
993 | 1049 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
994 | 1050 | </div>'; |
1051 | + } |
|
995 | 1052 | |
996 | 1053 | echo ' |
997 | 1054 | <div class="pagesection"> |
@@ -1016,15 +1073,17 @@ discard block |
||
1016 | 1073 | </div> |
1017 | 1074 | <div class="windowbg">'; |
1018 | 1075 | |
1019 | - if (!empty($context['send_log']['sent'])) |
|
1020 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
1076 | + if (!empty($context['send_log']['sent'])) { |
|
1077 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
1021 | 1078 | echo ' |
1022 | 1079 | <span class="error">', $log_entry, '</span><br>'; |
1080 | + } |
|
1023 | 1081 | |
1024 | - if (!empty($context['send_log']['failed'])) |
|
1025 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
1082 | + if (!empty($context['send_log']['failed'])) { |
|
1083 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
1026 | 1084 | echo ' |
1027 | 1085 | <span class="error">', $log_entry, '</span><br>'; |
1086 | + } |
|
1028 | 1087 | |
1029 | 1088 | echo ' |
1030 | 1089 | </div> |
@@ -1070,12 +1129,13 @@ discard block |
||
1070 | 1129 | </dl> |
1071 | 1130 | </div>'; |
1072 | 1131 | |
1073 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
1074 | - echo ' |
|
1132 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
1133 | + echo ' |
|
1075 | 1134 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
1076 | 1135 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
1077 | 1136 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
1078 | 1137 | </div>'; |
1138 | + } |
|
1079 | 1139 | |
1080 | 1140 | echo ' |
1081 | 1141 | <dl id="post_header">'; |
@@ -1141,22 +1201,24 @@ discard block |
||
1141 | 1201 | <dt><strong>', $txt['subject'], '</strong></dt> |
1142 | 1202 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
1143 | 1203 | |
1144 | - foreach ($context['drafts'] as $draft) |
|
1145 | - echo ' |
|
1204 | + foreach ($context['drafts'] as $draft) { |
|
1205 | + echo ' |
|
1146 | 1206 | <dt>', $draft['link'], '</dt> |
1147 | 1207 | <dd>', $draft['poster_time'], '</dd>'; |
1208 | + } |
|
1148 | 1209 | echo ' |
1149 | 1210 | </dl> |
1150 | 1211 | </div>'; |
1151 | 1212 | } |
1152 | 1213 | |
1153 | 1214 | // Require an image to be typed to save spamming? |
1154 | - if ($context['require_verification']) |
|
1155 | - echo ' |
|
1215 | + if ($context['require_verification']) { |
|
1216 | + echo ' |
|
1156 | 1217 | <div class="post_verification"> |
1157 | 1218 | <strong>', $txt['pm_visual_verification_label'], ':</strong> |
1158 | 1219 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
1159 | 1220 | </div>'; |
1221 | + } |
|
1160 | 1222 | |
1161 | 1223 | // Send, Preview, spellcheck buttons. |
1162 | 1224 | echo ' |
@@ -1274,8 +1336,8 @@ discard block |
||
1274 | 1336 | }'; |
1275 | 1337 | |
1276 | 1338 | // Code for showing and hiding drafts |
1277 | - if (!empty($context['drafts'])) |
|
1278 | - echo ' |
|
1339 | + if (!empty($context['drafts'])) { |
|
1340 | + echo ' |
|
1279 | 1341 | var oSwapDraftOptions = new smc_Toggle({ |
1280 | 1342 | bToggleEnabled: true, |
1281 | 1343 | bCurrentlyCollapsed: true, |
@@ -1297,13 +1359,14 @@ discard block |
||
1297 | 1359 | } |
1298 | 1360 | ] |
1299 | 1361 | });'; |
1362 | + } |
|
1300 | 1363 | |
1301 | 1364 | echo ' |
1302 | 1365 | </script>'; |
1303 | 1366 | |
1304 | 1367 | // Show the message you're replying to. |
1305 | - if ($context['reply']) |
|
1306 | - echo ' |
|
1368 | + if ($context['reply']) { |
|
1369 | + echo ' |
|
1307 | 1370 | <br><br> |
1308 | 1371 | <div class="cat_bar"> |
1309 | 1372 | <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
@@ -1317,6 +1380,7 @@ discard block |
||
1317 | 1380 | ', $context['quoted_message']['body'], ' |
1318 | 1381 | </div> |
1319 | 1382 | <br class="clear">'; |
1383 | + } |
|
1320 | 1384 | |
1321 | 1385 | echo ' |
1322 | 1386 | <script> |
@@ -1328,23 +1392,25 @@ discard block |
||
1328 | 1392 | sToControlId: \'to_control\', |
1329 | 1393 | aToRecipients: ['; |
1330 | 1394 | |
1331 | - foreach ($context['recipients']['to'] as $i => $member) |
|
1332 | - echo ' |
|
1395 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
1396 | + echo ' |
|
1333 | 1397 | { |
1334 | 1398 | sItemId: ', JavaScriptEscape($member['id']), ', |
1335 | 1399 | sItemName: ', JavaScriptEscape($member['name']), ' |
1336 | 1400 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
1401 | + } |
|
1337 | 1402 | |
1338 | 1403 | echo ' |
1339 | 1404 | ], |
1340 | 1405 | aBccRecipients: ['; |
1341 | 1406 | |
1342 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
1343 | - echo ' |
|
1407 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
1408 | + echo ' |
|
1344 | 1409 | { |
1345 | 1410 | sItemId: ', JavaScriptEscape($member['id']), ', |
1346 | 1411 | sItemName: ', JavaScriptEscape($member['name']), ' |
1347 | 1412 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
1413 | + } |
|
1348 | 1414 | |
1349 | 1415 | echo ' |
1350 | 1416 | ], |
@@ -1433,26 +1499,28 @@ discard block |
||
1433 | 1499 | </th> |
1434 | 1500 | <th class="centertext table_icon">'; |
1435 | 1501 | |
1436 | - if (count($context['labels']) > 2) |
|
1437 | - echo ' |
|
1502 | + if (count($context['labels']) > 2) { |
|
1503 | + echo ' |
|
1438 | 1504 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1505 | + } |
|
1439 | 1506 | |
1440 | 1507 | echo ' |
1441 | 1508 | </th> |
1442 | 1509 | </tr> |
1443 | 1510 | </thead> |
1444 | 1511 | <tbody>'; |
1445 | - if (count($context['labels']) < 2) |
|
1446 | - echo ' |
|
1512 | + if (count($context['labels']) < 2) { |
|
1513 | + echo ' |
|
1447 | 1514 | <tr class="windowbg"> |
1448 | 1515 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
1449 | 1516 | </tr>'; |
1450 | - else |
|
1517 | + } else |
|
1451 | 1518 | { |
1452 | 1519 | foreach ($context['labels'] as $label) |
1453 | 1520 | { |
1454 | - if ($label['id'] == -1) |
|
1455 | - continue; |
|
1521 | + if ($label['id'] == -1) { |
|
1522 | + continue; |
|
1523 | + } |
|
1456 | 1524 | |
1457 | 1525 | echo ' |
1458 | 1526 | <tr class="windowbg"> |
@@ -1467,12 +1535,13 @@ discard block |
||
1467 | 1535 | </tbody> |
1468 | 1536 | </table>'; |
1469 | 1537 | |
1470 | - if (!count($context['labels']) < 2) |
|
1471 | - echo ' |
|
1538 | + if (!count($context['labels']) < 2) { |
|
1539 | + echo ' |
|
1472 | 1540 | <div class="block righttext"> |
1473 | 1541 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1474 | 1542 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
1475 | 1543 | </div>'; |
1544 | + } |
|
1476 | 1545 | |
1477 | 1546 | echo ' |
1478 | 1547 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1528,9 +1597,10 @@ discard block |
||
1528 | 1597 | <select name="id_admin"> |
1529 | 1598 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
1530 | 1599 | |
1531 | - foreach ($context['admins'] as $id => $name) |
|
1532 | - echo ' |
|
1600 | + foreach ($context['admins'] as $id => $name) { |
|
1601 | + echo ' |
|
1533 | 1602 | <option value="', $id, '">', $name, '</option>'; |
1603 | + } |
|
1534 | 1604 | |
1535 | 1605 | echo ' |
1536 | 1606 | </select> |
@@ -1593,9 +1663,10 @@ discard block |
||
1593 | 1663 | </th> |
1594 | 1664 | <th class="centertext table_icon">'; |
1595 | 1665 | |
1596 | - if (!empty($context['rules'])) |
|
1597 | - echo ' |
|
1666 | + if (!empty($context['rules'])) { |
|
1667 | + echo ' |
|
1598 | 1668 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1669 | + } |
|
1599 | 1670 | |
1600 | 1671 | echo ' |
1601 | 1672 | </th> |
@@ -1603,16 +1674,17 @@ discard block |
||
1603 | 1674 | </thead> |
1604 | 1675 | <tbody>'; |
1605 | 1676 | |
1606 | - if (empty($context['rules'])) |
|
1607 | - echo ' |
|
1677 | + if (empty($context['rules'])) { |
|
1678 | + echo ' |
|
1608 | 1679 | <tr class="windowbg"> |
1609 | 1680 | <td colspan="2"> |
1610 | 1681 | ', $txt['pm_rules_none'], ' |
1611 | 1682 | </td> |
1612 | 1683 | </tr>'; |
1684 | + } |
|
1613 | 1685 | |
1614 | - foreach ($context['rules'] as $rule) |
|
1615 | - echo ' |
|
1686 | + foreach ($context['rules'] as $rule) { |
|
1687 | + echo ' |
|
1616 | 1688 | <tr class="windowbg"> |
1617 | 1689 | <td> |
1618 | 1690 | <a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a> |
@@ -1621,6 +1693,7 @@ discard block |
||
1621 | 1693 | <input type="checkbox" name="delrule[', $rule['id'], ']"> |
1622 | 1694 | </td> |
1623 | 1695 | </tr>'; |
1696 | + } |
|
1624 | 1697 | |
1625 | 1698 | echo ' |
1626 | 1699 | </tbody> |
@@ -1628,14 +1701,16 @@ discard block |
||
1628 | 1701 | <div class="righttext"> |
1629 | 1702 | <a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
1630 | 1703 | |
1631 | - if (!empty($context['rules'])) |
|
1632 | - echo ' |
|
1704 | + if (!empty($context['rules'])) { |
|
1705 | + echo ' |
|
1633 | 1706 | [<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]'; |
1707 | + } |
|
1634 | 1708 | |
1635 | - if (!empty($context['rules'])) |
|
1636 | - echo ' |
|
1709 | + if (!empty($context['rules'])) { |
|
1710 | + echo ' |
|
1637 | 1711 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1638 | 1712 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
1713 | + } |
|
1639 | 1714 | |
1640 | 1715 | echo ' |
1641 | 1716 | </div> |
@@ -1657,14 +1732,16 @@ discard block |
||
1657 | 1732 | var groups = new Array() |
1658 | 1733 | var labels = new Array()'; |
1659 | 1734 | |
1660 | - foreach ($context['groups'] as $id => $title) |
|
1661 | - echo ' |
|
1735 | + foreach ($context['groups'] as $id => $title) { |
|
1736 | + echo ' |
|
1662 | 1737 | groups[', $id, '] = "', addslashes($title), '";'; |
1738 | + } |
|
1663 | 1739 | |
1664 | - foreach ($context['labels'] as $label) |
|
1665 | - if ($label['id'] != -1) |
|
1740 | + foreach ($context['labels'] as $label) { |
|
1741 | + if ($label['id'] != -1) |
|
1666 | 1742 | echo ' |
1667 | 1743 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
1744 | + } |
|
1668 | 1745 | |
1669 | 1746 | echo ' |
1670 | 1747 | function addCriteriaOption() |
@@ -1679,8 +1756,9 @@ discard block |
||
1679 | 1756 | |
1680 | 1757 | setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value=""><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>'; |
1681 | 1758 | |
1682 | - foreach ($context['groups'] as $id => $group) |
|
1683 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1759 | + foreach ($context['groups'] as $id => $group) { |
|
1760 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1761 | + } |
|
1684 | 1762 | |
1685 | 1763 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
1686 | 1764 | } |
@@ -1697,9 +1775,10 @@ discard block |
||
1697 | 1775 | |
1698 | 1776 | setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>'; |
1699 | 1777 | |
1700 | - foreach ($context['labels'] as $label) |
|
1701 | - if ($label['id'] != -1) |
|
1778 | + foreach ($context['labels'] as $label) { |
|
1779 | + if ($label['id'] != -1) |
|
1702 | 1780 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
1781 | + } |
|
1703 | 1782 | |
1704 | 1783 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
1705 | 1784 | } |
@@ -1813,19 +1892,20 @@ discard block |
||
1813 | 1892 | $isFirst = true; |
1814 | 1893 | foreach ($context['rule']['criteria'] as $k => $criteria) |
1815 | 1894 | { |
1816 | - if (!$isFirst && $criteria['t'] == '') |
|
1817 | - echo '<div id="removeonjs1">'; |
|
1818 | - |
|
1819 | - elseif (!$isFirst) |
|
1820 | - echo '<br>'; |
|
1895 | + if (!$isFirst && $criteria['t'] == '') { |
|
1896 | + echo '<div id="removeonjs1">'; |
|
1897 | + } elseif (!$isFirst) { |
|
1898 | + echo '<br>'; |
|
1899 | + } |
|
1821 | 1900 | |
1822 | 1901 | echo ' |
1823 | 1902 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
1824 | 1903 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
1825 | 1904 | |
1826 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
1827 | - echo ' |
|
1905 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
1906 | + echo ' |
|
1828 | 1907 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
1908 | + } |
|
1829 | 1909 | |
1830 | 1910 | echo ' |
1831 | 1911 | </select> |
@@ -1836,19 +1916,20 @@ discard block |
||
1836 | 1916 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
1837 | 1917 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
1838 | 1918 | |
1839 | - foreach ($context['groups'] as $id => $group) |
|
1840 | - echo ' |
|
1919 | + foreach ($context['groups'] as $id => $group) { |
|
1920 | + echo ' |
|
1841 | 1921 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
1922 | + } |
|
1842 | 1923 | echo ' |
1843 | 1924 | </select> |
1844 | 1925 | </span>'; |
1845 | 1926 | |
1846 | 1927 | // If this is the dummy we add a means to hide for non js users. |
1847 | - if ($isFirst) |
|
1848 | - $isFirst = false; |
|
1849 | - |
|
1850 | - elseif ($criteria['t'] == '') |
|
1851 | - echo '</div><!-- .removeonjs1 -->'; |
|
1928 | + if ($isFirst) { |
|
1929 | + $isFirst = false; |
|
1930 | + } elseif ($criteria['t'] == '') { |
|
1931 | + echo '</div><!-- .removeonjs1 -->'; |
|
1932 | + } |
|
1852 | 1933 | } |
1853 | 1934 | |
1854 | 1935 | echo ' |
@@ -1871,10 +1952,11 @@ discard block |
||
1871 | 1952 | $isFirst = true; |
1872 | 1953 | foreach ($context['rule']['actions'] as $k => $action) |
1873 | 1954 | { |
1874 | - if (!$isFirst && $action['t'] == '') |
|
1875 | - echo '<div id="removeonjs2">'; |
|
1876 | - elseif (!$isFirst) |
|
1877 | - echo '<br>'; |
|
1955 | + if (!$isFirst && $action['t'] == '') { |
|
1956 | + echo '<div id="removeonjs2">'; |
|
1957 | + } elseif (!$isFirst) { |
|
1958 | + echo '<br>'; |
|
1959 | + } |
|
1878 | 1960 | |
1879 | 1961 | echo ' |
1880 | 1962 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1886,20 +1968,21 @@ discard block |
||
1886 | 1968 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
1887 | 1969 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
1888 | 1970 | |
1889 | - foreach ($context['labels'] as $label) |
|
1890 | - if ($label['id'] != -1) |
|
1971 | + foreach ($context['labels'] as $label) { |
|
1972 | + if ($label['id'] != -1) |
|
1891 | 1973 | echo ' |
1892 | 1974 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
1975 | + } |
|
1893 | 1976 | |
1894 | 1977 | echo ' |
1895 | 1978 | </select> |
1896 | 1979 | </span>'; |
1897 | 1980 | |
1898 | - if ($isFirst) |
|
1899 | - $isFirst = false; |
|
1900 | - |
|
1901 | - elseif ($action['t'] == '') |
|
1902 | - echo '</div><!-- .removeonjs2 -->'; |
|
1981 | + if ($isFirst) { |
|
1982 | + $isFirst = false; |
|
1983 | + } elseif ($action['t'] == '') { |
|
1984 | + echo '</div><!-- .removeonjs2 -->'; |
|
1985 | + } |
|
1903 | 1986 | } |
1904 | 1987 | |
1905 | 1988 | echo ' |
@@ -1923,22 +2006,25 @@ discard block |
||
1923 | 2006 | echo ' |
1924 | 2007 | <script>'; |
1925 | 2008 | |
1926 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
1927 | - echo ' |
|
2009 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
2010 | + echo ' |
|
1928 | 2011 | updateRuleDef(', $k, ');'; |
2012 | + } |
|
1929 | 2013 | |
1930 | - foreach ($context['rule']['actions'] as $k => $c) |
|
1931 | - echo ' |
|
2014 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
2015 | + echo ' |
|
1932 | 2016 | updateActionDef(', $k, ');'; |
2017 | + } |
|
1933 | 2018 | |
1934 | 2019 | echo ' |
1935 | 2020 | rebuildRuleDesc();'; |
1936 | 2021 | |
1937 | 2022 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
1938 | - if ($context['rid']) |
|
1939 | - echo ' |
|
2023 | + if ($context['rid']) { |
|
2024 | + echo ' |
|
1940 | 2025 | document.getElementById("removeonjs1").style.display = "none"; |
1941 | 2026 | document.getElementById("removeonjs2").style.display = "none";'; |
2027 | + } |
|
1942 | 2028 | |
1943 | 2029 | echo ' |
1944 | 2030 | document.getElementById("addonjs1").style.display = ""; |
@@ -1966,12 +2052,12 @@ discard block |
||
1966 | 2052 | </div>'; |
1967 | 2053 | |
1968 | 2054 | // No drafts? Just show an informative message. |
1969 | - if (empty($context['drafts'])) |
|
1970 | - echo ' |
|
2055 | + if (empty($context['drafts'])) { |
|
2056 | + echo ' |
|
1971 | 2057 | <div class="windowbg centertext"> |
1972 | 2058 | ', $txt['draft_none'], ' |
1973 | 2059 | </div>'; |
1974 | - else |
|
2060 | + } else |
|
1975 | 2061 | { |
1976 | 2062 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
1977 | 2063 | foreach ($context['drafts'] as $draft) |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Turn off/on notification for a particular board. |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | is_not_guest(); |
35 | 36 | |
36 | 37 | // You have to specify a board to turn notifications on! |
37 | - if (empty($board)) |
|
38 | - fatal_lang_error('no_board', false); |
|
38 | + if (empty($board)) { |
|
39 | + fatal_lang_error('no_board', false); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | // No subaction: find out what to do. |
41 | 43 | if (isset($_GET['mode'])) |
@@ -48,16 +50,16 @@ discard block |
||
48 | 50 | require_once($sourcedir . '/Subs-Notify.php'); |
49 | 51 | setNotifyPrefs($user_info['id'], array('board_notify_' . $board => $alertPref)); |
50 | 52 | |
51 | - if ($mode > 1) |
|
52 | - // Turn notification on. (note this just blows smoke if it's already on.) |
|
53 | + if ($mode > 1) { |
|
54 | + // Turn notification on. (note this just blows smoke if it's already on.) |
|
53 | 55 | $smcFunc['db_insert']('ignore', |
54 | 56 | '{db_prefix}log_notify', |
55 | 57 | array('id_member' => 'int', 'id_board' => 'int'), |
56 | 58 | array($user_info['id'], $board), |
57 | 59 | array('id_member', 'id_board') |
58 | 60 | ); |
59 | - else |
|
60 | - $smcFunc['db_query']('', ' |
|
61 | + } else { |
|
62 | + $smcFunc['db_query']('', ' |
|
61 | 63 | DELETE FROM {db_prefix}log_notify |
62 | 64 | WHERE id_member = {int:current_member} |
63 | 65 | AND id_board = {int:current_board}', |
@@ -66,6 +68,7 @@ discard block |
||
66 | 68 | 'current_member' => $user_info['id'], |
67 | 69 | ) |
68 | 70 | ); |
71 | + } |
|
69 | 72 | } |
70 | 73 | |
71 | 74 | // Back to the board! |
@@ -80,10 +83,10 @@ discard block |
||
80 | 83 | ), |
81 | 84 | ); |
82 | 85 | $context['sub_template'] = 'generic_xml'; |
86 | + } else { |
|
87 | + redirectexit('board=' . $board . '.' . $_REQUEST['start']); |
|
88 | + } |
|
83 | 89 | } |
84 | - else |
|
85 | - redirectexit('board=' . $board . '.' . $_REQUEST['start']); |
|
86 | -} |
|
87 | 90 | |
88 | 91 | /** |
89 | 92 | * Turn off/on unread replies subscription for a topic as well as sets individual topic's alert preferences |
@@ -128,8 +131,7 @@ discard block |
||
128 | 131 | 'id_msg' => 0, |
129 | 132 | 'unwatched' => empty($mode) ? 1 : 0, |
130 | 133 | ); |
131 | - } |
|
132 | - else |
|
134 | + } else |
|
133 | 135 | { |
134 | 136 | $insert = false; |
135 | 137 | $log['unwatched'] = empty($mode) ? 1 : 0; |
@@ -156,9 +158,8 @@ discard block |
||
156 | 158 | array($user_info['id'], $log['id_topic']), |
157 | 159 | array('id_member', 'id_board') |
158 | 160 | ); |
159 | - } |
|
160 | - else |
|
161 | - $smcFunc['db_query']('', ' |
|
161 | + } else { |
|
162 | + $smcFunc['db_query']('', ' |
|
162 | 163 | DELETE FROM {db_prefix}log_notify |
163 | 164 | WHERE id_topic = {int:topic} |
164 | 165 | AND id_member = {int:member}', |
@@ -166,6 +167,7 @@ discard block |
||
166 | 167 | 'topic' => $log['id_topic'], |
167 | 168 | 'member' => $user_info['id'], |
168 | 169 | )); |
170 | + } |
|
169 | 171 | } |
170 | 172 | } |
171 | 173 | |
@@ -181,9 +183,9 @@ discard block |
||
181 | 183 | ), |
182 | 184 | ); |
183 | 185 | $context['sub_template'] = 'generic_xml'; |
186 | + } else { |
|
187 | + redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
188 | + } |
|
184 | 189 | } |
185 | - else |
|
186 | - redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
187 | -} |
|
188 | 190 | |
189 | 191 | ?> |
190 | 192 | \ No newline at end of file |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * !!!Compatibility!!! |
@@ -31,8 +32,9 @@ discard block |
||
31 | 32 | { |
32 | 33 | global $modSettings; |
33 | 34 | |
34 | - if (!$compat_mode) |
|
35 | - return $text; |
|
35 | + if (!$compat_mode) { |
|
36 | + return $text; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | // Turn line breaks back into br's. |
38 | 40 | $text = strtr($text, array("\r" => '', "\n" => '<br>')); |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | for ($i = 0, $n = count($parts); $i < $n; $i++) |
50 | 52 | { |
51 | 53 | // Value of 2 means we're inside the tag. |
52 | - if ($i % 4 == 2) |
|
53 | - $parts[$i] = strtr($parts[$i], array('[' => '[', ']' => ']', "'" => "'")); |
|
54 | + if ($i % 4 == 2) { |
|
55 | + $parts[$i] = strtr($parts[$i], array('[' => '[', ']' => ']', "'" => "'")); |
|
56 | + } |
|
54 | 57 | } |
55 | 58 | // Put our humpty dumpty message back together again. |
56 | 59 | $text = implode('', $parts); |
@@ -109,8 +112,9 @@ discard block |
||
109 | 112 | $text = preg_replace('~</p>\s*(?!<)~i', '</p><br>', $text); |
110 | 113 | |
111 | 114 | // Safari/webkit wraps lines in Wysiwyg in <div>'s. |
112 | - if (isBrowser('webkit')) |
|
113 | - $text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text); |
|
115 | + if (isBrowser('webkit')) { |
|
116 | + $text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text); |
|
117 | + } |
|
114 | 118 | |
115 | 119 | // If there's a trailing break get rid of it - Firefox tends to add one. |
116 | 120 | $text = preg_replace('~<br\s?/?' . '>$~i', '', $text); |
@@ -125,8 +129,9 @@ discard block |
||
125 | 129 | for ($i = 0, $n = count($parts); $i < $n; $i++) |
126 | 130 | { |
127 | 131 | // Value of 2 means we're inside the tag. |
128 | - if ($i % 4 == 2) |
|
129 | - $parts[$i] = strip_tags($parts[$i]); |
|
132 | + if ($i % 4 == 2) { |
|
133 | + $parts[$i] = strip_tags($parts[$i]); |
|
134 | + } |
|
130 | 135 | } |
131 | 136 | |
132 | 137 | $text = strtr(implode('', $parts), array('#smf_br_spec_grudge_cool!#' => '<br>')); |
@@ -152,18 +157,19 @@ discard block |
||
152 | 157 | { |
153 | 158 | $found = array_search($file, $smileysto); |
154 | 159 | // Note the weirdness here is to stop double spaces between smileys. |
155 | - if ($found) |
|
156 | - $matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#'; |
|
157 | - else |
|
158 | - $matches[1][$k] = ''; |
|
160 | + if ($found) { |
|
161 | + $matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#'; |
|
162 | + } else { |
|
163 | + $matches[1][$k] = ''; |
|
164 | + } |
|
159 | 165 | } |
160 | - } |
|
161 | - else |
|
166 | + } else |
|
162 | 167 | { |
163 | 168 | // Load all the smileys. |
164 | 169 | $names = array(); |
165 | - foreach ($matches[1] as $file) |
|
166 | - $names[] = $file; |
|
170 | + foreach ($matches[1] as $file) { |
|
171 | + $names[] = $file; |
|
172 | + } |
|
167 | 173 | $names = array_unique($names); |
168 | 174 | |
169 | 175 | if (!empty($names)) |
@@ -177,13 +183,15 @@ discard block |
||
177 | 183 | ) |
178 | 184 | ); |
179 | 185 | $mappings = array(); |
180 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
181 | - $mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']); |
|
186 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
187 | + $mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']); |
|
188 | + } |
|
182 | 189 | $smcFunc['db_free_result']($request); |
183 | 190 | |
184 | - foreach ($matches[1] as $k => $file) |
|
185 | - if (isset($mappings[$file])) |
|
191 | + foreach ($matches[1] as $k => $file) { |
|
192 | + if (isset($mappings[$file])) |
|
186 | 193 | $matches[1][$k] = '-[]-smf_smily_start#|#' . $mappings[$file] . '-[]-smf_smily_end#|#'; |
194 | + } |
|
187 | 195 | } |
188 | 196 | } |
189 | 197 | |
@@ -195,8 +203,9 @@ discard block |
||
195 | 203 | } |
196 | 204 | |
197 | 205 | // Only try to buy more time if the client didn't quit. |
198 | - if (connection_aborted() && $context['server']['is_apache']) |
|
199 | - @apache_reset_timeout(); |
|
206 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
207 | + @apache_reset_timeout(); |
|
208 | + } |
|
200 | 209 | |
201 | 210 | $parts = preg_split('~(<[A-Za-z]+\s*[^<>]*?style="?[^<>"]+"?[^<>]*?(?:/?)>|</[A-Za-z]+>)~', $text, -1, PREG_SPLIT_DELIM_CAPTURE); |
202 | 211 | $replacement = ''; |
@@ -207,9 +216,9 @@ discard block |
||
207 | 216 | if (preg_match('~(<([A-Za-z]+)\s*[^<>]*?)style="?([^<>"]+)"?([^<>]*?(/?)>)~', $part, $matches) === 1) |
208 | 217 | { |
209 | 218 | // If it's being closed instantly, we can't deal with it...yet. |
210 | - if ($matches[5] === '/') |
|
211 | - continue; |
|
212 | - else |
|
219 | + if ($matches[5] === '/') { |
|
220 | + continue; |
|
221 | + } else |
|
213 | 222 | { |
214 | 223 | // Get an array of styles that apply to this element. (The strtr is there to combat HTML generated by Word.) |
215 | 224 | $styles = explode(';', strtr($matches[3], array('"' => ''))); |
@@ -225,8 +234,9 @@ discard block |
||
225 | 234 | $clean_type_value_pair = strtolower(strtr(trim($type_value_pair), '=', ':')); |
226 | 235 | |
227 | 236 | // Something like 'font-weight: bold' is expected here. |
228 | - if (strpos($clean_type_value_pair, ':') === false) |
|
229 | - continue; |
|
237 | + if (strpos($clean_type_value_pair, ':') === false) { |
|
238 | + continue; |
|
239 | + } |
|
230 | 240 | |
231 | 241 | // Capture the elements of a single style item (e.g. 'font-weight' and 'bold'). |
232 | 242 | list ($style_type, $style_value) = explode(':', $type_value_pair); |
@@ -248,8 +258,7 @@ discard block |
||
248 | 258 | { |
249 | 259 | $curCloseTags .= '[/u]'; |
250 | 260 | $replacement .= '[u]'; |
251 | - } |
|
252 | - elseif ($style_value == 'line-through') |
|
261 | + } elseif ($style_value == 'line-through') |
|
253 | 262 | { |
254 | 263 | $curCloseTags .= '[/s]'; |
255 | 264 | $replacement .= '[s]'; |
@@ -261,13 +270,11 @@ discard block |
||
261 | 270 | { |
262 | 271 | $curCloseTags .= '[/left]'; |
263 | 272 | $replacement .= '[left]'; |
264 | - } |
|
265 | - elseif ($style_value == 'center') |
|
273 | + } elseif ($style_value == 'center') |
|
266 | 274 | { |
267 | 275 | $curCloseTags .= '[/center]'; |
268 | 276 | $replacement .= '[center]'; |
269 | - } |
|
270 | - elseif ($style_value == 'right') |
|
277 | + } elseif ($style_value == 'right') |
|
271 | 278 | { |
272 | 279 | $curCloseTags .= '[/right]'; |
273 | 280 | $replacement .= '[right]'; |
@@ -289,8 +296,9 @@ discard block |
||
289 | 296 | |
290 | 297 | case 'font-size': |
291 | 298 | // Sometimes people put decimals where decimals should not be. |
292 | - if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) |
|
293 | - $style_value = $dec_matches[1] . $dec_matches[2]; |
|
299 | + if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) { |
|
300 | + $style_value = $dec_matches[1] . $dec_matches[2]; |
|
301 | + } |
|
294 | 302 | |
295 | 303 | $curCloseTags .= '[/size]'; |
296 | 304 | $replacement .= '[size=' . $style_value . ']'; |
@@ -298,8 +306,9 @@ discard block |
||
298 | 306 | |
299 | 307 | case 'font-family': |
300 | 308 | // Only get the first freaking font if there's a list! |
301 | - if (strpos($style_value, ',') !== false) |
|
302 | - $style_value = substr($style_value, 0, strpos($style_value, ',')); |
|
309 | + if (strpos($style_value, ',') !== false) { |
|
310 | + $style_value = substr($style_value, 0, strpos($style_value, ',')); |
|
311 | + } |
|
303 | 312 | |
304 | 313 | $curCloseTags .= '[/font]'; |
305 | 314 | $replacement .= '[font=' . strtr($style_value, array("'" => '')) . ']'; |
@@ -308,13 +317,15 @@ discard block |
||
308 | 317 | // This is a hack for images with dimensions embedded. |
309 | 318 | case 'width': |
310 | 319 | case 'height': |
311 | - if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) |
|
312 | - $extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"'; |
|
320 | + if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) { |
|
321 | + $extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"'; |
|
322 | + } |
|
313 | 323 | break; |
314 | 324 | |
315 | 325 | case 'list-style-type': |
316 | - if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) |
|
317 | - $extra_attr .= ' listtype="' . $listType[0] . '"'; |
|
326 | + if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) { |
|
327 | + $extra_attr .= ' listtype="' . $listType[0] . '"'; |
|
328 | + } |
|
318 | 329 | break; |
319 | 330 | } |
320 | 331 | } |
@@ -327,18 +338,17 @@ discard block |
||
327 | 338 | } |
328 | 339 | |
329 | 340 | // If there's something that still needs closing, push it to the stack. |
330 | - if (!empty($curCloseTags)) |
|
331 | - array_push($stack, array( |
|
341 | + if (!empty($curCloseTags)) { |
|
342 | + array_push($stack, array( |
|
332 | 343 | 'element' => strtolower($curElement), |
333 | 344 | 'closeTags' => $curCloseTags |
334 | 345 | ) |
335 | 346 | ); |
336 | - elseif (!empty($extra_attr)) |
|
337 | - $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
|
347 | + } elseif (!empty($extra_attr)) { |
|
348 | + $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
|
349 | + } |
|
338 | 350 | } |
339 | - } |
|
340 | - |
|
341 | - elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
|
351 | + } elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
|
342 | 352 | { |
343 | 353 | // Is this the element that we've been waiting for to be closed? |
344 | 354 | if (!empty($stack) && strtolower($matches[1]) === $stack[count($stack) - 1]['element']) |
@@ -348,28 +358,32 @@ discard block |
||
348 | 358 | } |
349 | 359 | |
350 | 360 | // Must've been something else. |
351 | - else |
|
352 | - $replacement .= $part; |
|
361 | + else { |
|
362 | + $replacement .= $part; |
|
363 | + } |
|
353 | 364 | } |
354 | 365 | // In all other cases, just add the part to the replacement. |
355 | - else |
|
356 | - $replacement .= $part; |
|
366 | + else { |
|
367 | + $replacement .= $part; |
|
368 | + } |
|
357 | 369 | } |
358 | 370 | |
359 | 371 | // Now put back the replacement in the text. |
360 | 372 | $text = $replacement; |
361 | 373 | |
362 | 374 | // We are not finished yet, request more time. |
363 | - if (connection_aborted() && $context['server']['is_apache']) |
|
364 | - @apache_reset_timeout(); |
|
375 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
376 | + @apache_reset_timeout(); |
|
377 | + } |
|
365 | 378 | |
366 | 379 | // Let's pull out any legacy alignments. |
367 | 380 | while (preg_match('~<([A-Za-z]+)\s+[^<>]*?(align="*(left|center|right)"*)[^<>]*?(/?)>~i', $text, $matches) === 1) |
368 | 381 | { |
369 | 382 | // Find the position in the text of this tag over again. |
370 | 383 | $start_pos = strpos($text, $matches[0]); |
371 | - if ($start_pos === false) |
|
372 | - break; |
|
384 | + if ($start_pos === false) { |
|
385 | + break; |
|
386 | + } |
|
373 | 387 | |
374 | 388 | // End tag? |
375 | 389 | if ($matches[4] != '/' && strpos($text, '</' . $matches[1] . '>', $start_pos) !== false) |
@@ -383,8 +397,7 @@ discard block |
||
383 | 397 | |
384 | 398 | // Put the tags back into the body. |
385 | 399 | $text = substr($text, 0, $start_pos) . $tag . '[' . $matches[3] . ']' . $content . '[/' . $matches[3] . ']' . substr($text, $end_pos); |
386 | - } |
|
387 | - else |
|
400 | + } else |
|
388 | 401 | { |
389 | 402 | // Just get rid of this evil tag. |
390 | 403 | $text = substr($text, 0, $start_pos) . substr($text, $start_pos + strlen($matches[0])); |
@@ -397,8 +410,9 @@ discard block |
||
397 | 410 | // Find the position of this again. |
398 | 411 | $start_pos = strpos($text, $matches[0]); |
399 | 412 | $end_pos = false; |
400 | - if ($start_pos === false) |
|
401 | - break; |
|
413 | + if ($start_pos === false) { |
|
414 | + break; |
|
415 | + } |
|
402 | 416 | |
403 | 417 | // This must have an end tag - and we must find the right one. |
404 | 418 | $lower_text = strtolower($text); |
@@ -431,8 +445,9 @@ discard block |
||
431 | 445 | break; |
432 | 446 | } |
433 | 447 | } |
434 | - if ($end_pos === false) |
|
435 | - break; |
|
448 | + if ($end_pos === false) { |
|
449 | + break; |
|
450 | + } |
|
436 | 451 | |
437 | 452 | // Now work out what the attributes are. |
438 | 453 | $attribs = fetchTagAttributes($matches[1]); |
@@ -446,11 +461,11 @@ discard block |
||
446 | 461 | $v = (int) trim($v); |
447 | 462 | $v = empty($v) ? 1 : $v; |
448 | 463 | $tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]'); |
464 | + } elseif ($s == 'face') { |
|
465 | + $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); |
|
466 | + } elseif ($s == 'color') { |
|
467 | + $tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]'); |
|
449 | 468 | } |
450 | - elseif ($s == 'face') |
|
451 | - $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); |
|
452 | - elseif ($s == 'color') |
|
453 | - $tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]'); |
|
454 | 469 | } |
455 | 470 | |
456 | 471 | // As before add in our tags. |
@@ -458,8 +473,9 @@ discard block |
||
458 | 473 | foreach ($tags as $tag) |
459 | 474 | { |
460 | 475 | $before .= $tag[0]; |
461 | - if (isset($tag[1])) |
|
462 | - $after = $tag[1] . $after; |
|
476 | + if (isset($tag[1])) { |
|
477 | + $after = $tag[1] . $after; |
|
478 | + } |
|
463 | 479 | } |
464 | 480 | |
465 | 481 | // Remove the tag so it's never checked again. |
@@ -470,8 +486,9 @@ discard block |
||
470 | 486 | } |
471 | 487 | |
472 | 488 | // Almost there, just a little more time. |
473 | - if (connection_aborted() && $context['server']['is_apache']) |
|
474 | - @apache_reset_timeout(); |
|
489 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
490 | + @apache_reset_timeout(); |
|
491 | + } |
|
475 | 492 | |
476 | 493 | if (count($parts = preg_split('~<(/?)(li|ol|ul)([^>]*)>~i', $text, null, PREG_SPLIT_DELIM_CAPTURE)) > 1) |
477 | 494 | { |
@@ -527,12 +544,13 @@ discard block |
||
527 | 544 | { |
528 | 545 | $inList = true; |
529 | 546 | |
530 | - if ($tag === 'ol') |
|
531 | - $listType = 'decimal'; |
|
532 | - elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) |
|
533 | - $listType = $listTypeMapping[$match[1]]; |
|
534 | - else |
|
535 | - $listType = null; |
|
547 | + if ($tag === 'ol') { |
|
548 | + $listType = 'decimal'; |
|
549 | + } elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) { |
|
550 | + $listType = $listTypeMapping[$match[1]]; |
|
551 | + } else { |
|
552 | + $listType = null; |
|
553 | + } |
|
536 | 554 | |
537 | 555 | $listDepth++; |
538 | 556 | |
@@ -596,9 +614,7 @@ discard block |
||
596 | 614 | $parts[$i + 1] = ''; |
597 | 615 | $parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]'; |
598 | 616 | $parts[$i + 3] = ''; |
599 | - } |
|
600 | - |
|
601 | - else |
|
617 | + } else |
|
602 | 618 | { |
603 | 619 | // We're in a list item. |
604 | 620 | if ($listDepth > 0) |
@@ -635,9 +651,7 @@ discard block |
||
635 | 651 | $parts[$i + 1] = ''; |
636 | 652 | $parts[$i + 2] = ''; |
637 | 653 | $parts[$i + 3] = ''; |
638 | - } |
|
639 | - |
|
640 | - else |
|
654 | + } else |
|
641 | 655 | { |
642 | 656 | // Remove the trailing breaks from the list item. |
643 | 657 | $parts[$i] = preg_replace('~\s*<br\s*' . '/?' . '>\s*$~', '', $parts[$i]); |
@@ -675,8 +689,9 @@ discard block |
||
675 | 689 | $text .= str_repeat("\t", $listDepth) . '[/list]'; |
676 | 690 | } |
677 | 691 | |
678 | - for ($i = $listDepth; $i > 0; $i--) |
|
679 | - $text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]'; |
|
692 | + for ($i = $listDepth; $i > 0; $i--) { |
|
693 | + $text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]'; |
|
694 | + } |
|
680 | 695 | } |
681 | 696 | |
682 | 697 | // I love my own image... |
@@ -684,8 +699,9 @@ discard block |
||
684 | 699 | { |
685 | 700 | // Find the position of the image. |
686 | 701 | $start_pos = strpos($text, $matches[0]); |
687 | - if ($start_pos === false) |
|
688 | - break; |
|
702 | + if ($start_pos === false) { |
|
703 | + break; |
|
704 | + } |
|
689 | 705 | $end_pos = $start_pos + strlen($matches[0]); |
690 | 706 | |
691 | 707 | $params = ''; |
@@ -694,12 +710,13 @@ discard block |
||
694 | 710 | $attrs = fetchTagAttributes($matches[1]); |
695 | 711 | foreach ($attrs as $attrib => $value) |
696 | 712 | { |
697 | - if (in_array($attrib, array('width', 'height'))) |
|
698 | - $params .= ' ' . $attrib . '=' . (int) $value; |
|
699 | - elseif ($attrib == 'alt' && trim($value) != '') |
|
700 | - $params .= ' alt=' . trim($value); |
|
701 | - elseif ($attrib == 'src') |
|
702 | - $src = trim($value); |
|
713 | + if (in_array($attrib, array('width', 'height'))) { |
|
714 | + $params .= ' ' . $attrib . '=' . (int) $value; |
|
715 | + } elseif ($attrib == 'alt' && trim($value) != '') { |
|
716 | + $params .= ' alt=' . trim($value); |
|
717 | + } elseif ($attrib == 'src') { |
|
718 | + $src = trim($value); |
|
719 | + } |
|
703 | 720 | } |
704 | 721 | |
705 | 722 | $tag = ''; |
@@ -710,10 +727,11 @@ discard block |
||
710 | 727 | { |
711 | 728 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
712 | 729 | |
713 | - if (substr($src, 0, 1) === '/') |
|
714 | - $src = $baseURL . $src; |
|
715 | - else |
|
716 | - $src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src; |
|
730 | + if (substr($src, 0, 1) === '/') { |
|
731 | + $src = $baseURL . $src; |
|
732 | + } else { |
|
733 | + $src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src; |
|
734 | + } |
|
717 | 735 | } |
718 | 736 | |
719 | 737 | $tag = '[img' . $params . ']' . $src . '[/img]'; |
@@ -891,20 +909,23 @@ discard block |
||
891 | 909 | }, |
892 | 910 | ); |
893 | 911 | |
894 | - foreach ($tags as $tag => $replace) |
|
895 | - $text = preg_replace_callback($tag, $replace, $text); |
|
912 | + foreach ($tags as $tag => $replace) { |
|
913 | + $text = preg_replace_callback($tag, $replace, $text); |
|
914 | + } |
|
896 | 915 | |
897 | 916 | // Please give us just a little more time. |
898 | - if (connection_aborted() && $context['server']['is_apache']) |
|
899 | - @apache_reset_timeout(); |
|
917 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
918 | + @apache_reset_timeout(); |
|
919 | + } |
|
900 | 920 | |
901 | 921 | // What about URL's - the pain in the ass of the tag world. |
902 | 922 | while (preg_match('~<a\s+([^<>]*)>([^<>]*)</a>~i', $text, $matches) === 1) |
903 | 923 | { |
904 | 924 | // Find the position of the URL. |
905 | 925 | $start_pos = strpos($text, $matches[0]); |
906 | - if ($start_pos === false) |
|
907 | - break; |
|
926 | + if ($start_pos === false) { |
|
927 | + break; |
|
928 | + } |
|
908 | 929 | $end_pos = $start_pos + strlen($matches[0]); |
909 | 930 | |
910 | 931 | $tag_type = 'url'; |
@@ -918,8 +939,9 @@ discard block |
||
918 | 939 | $href = trim($value); |
919 | 940 | |
920 | 941 | // Are we dealing with an FTP link? |
921 | - if (preg_match('~^ftps?://~', $href) === 1) |
|
922 | - $tag_type = 'ftp'; |
|
942 | + if (preg_match('~^ftps?://~', $href) === 1) { |
|
943 | + $tag_type = 'ftp'; |
|
944 | + } |
|
923 | 945 | |
924 | 946 | // Or is this a link to an email address? |
925 | 947 | elseif (substr($href, 0, 7) == 'mailto:') |
@@ -933,28 +955,31 @@ discard block |
||
933 | 955 | { |
934 | 956 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
935 | 957 | |
936 | - if (substr($href, 0, 1) === '/') |
|
937 | - $href = $baseURL . $href; |
|
938 | - else |
|
939 | - $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
958 | + if (substr($href, 0, 1) === '/') { |
|
959 | + $href = $baseURL . $href; |
|
960 | + } else { |
|
961 | + $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
962 | + } |
|
940 | 963 | } |
941 | 964 | } |
942 | 965 | |
943 | 966 | // External URL? |
944 | 967 | if ($attrib == 'target' && $tag_type == 'url') |
945 | 968 | { |
946 | - if (trim($value) == '_blank') |
|
947 | - $tag_type == 'iurl'; |
|
969 | + if (trim($value) == '_blank') { |
|
970 | + $tag_type == 'iurl'; |
|
971 | + } |
|
948 | 972 | } |
949 | 973 | } |
950 | 974 | |
951 | 975 | $tag = ''; |
952 | 976 | if ($href != '') |
953 | 977 | { |
954 | - if ($matches[2] == $href) |
|
955 | - $tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']'; |
|
956 | - else |
|
957 | - $tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']'; |
|
978 | + if ($matches[2] == $href) { |
|
979 | + $tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']'; |
|
980 | + } else { |
|
981 | + $tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']'; |
|
982 | + } |
|
958 | 983 | } |
959 | 984 | |
960 | 985 | // Replace the tag |
@@ -994,17 +1019,18 @@ discard block |
||
994 | 1019 | // We're either moving from the key to the attribute or we're in a string and this is fine. |
995 | 1020 | if ($text[$i] == '=') |
996 | 1021 | { |
997 | - if ($tag_state == 0) |
|
998 | - $tag_state = 1; |
|
999 | - elseif ($tag_state == 2) |
|
1000 | - $value .= '='; |
|
1022 | + if ($tag_state == 0) { |
|
1023 | + $tag_state = 1; |
|
1024 | + } elseif ($tag_state == 2) { |
|
1025 | + $value .= '='; |
|
1026 | + } |
|
1001 | 1027 | } |
1002 | 1028 | // A space is either moving from an attribute back to a potential key or in a string is fine. |
1003 | 1029 | elseif ($text[$i] == ' ') |
1004 | 1030 | { |
1005 | - if ($tag_state == 2) |
|
1006 | - $value .= ' '; |
|
1007 | - elseif ($tag_state == 1) |
|
1031 | + if ($tag_state == 2) { |
|
1032 | + $value .= ' '; |
|
1033 | + } elseif ($tag_state == 1) |
|
1008 | 1034 | { |
1009 | 1035 | $attribs[$key] = $value; |
1010 | 1036 | $key = $value = ''; |
@@ -1015,24 +1041,27 @@ discard block |
||
1015 | 1041 | elseif ($text[$i] == '"') |
1016 | 1042 | { |
1017 | 1043 | // Must be either going into or out of a string. |
1018 | - if ($tag_state == 1) |
|
1019 | - $tag_state = 2; |
|
1020 | - else |
|
1021 | - $tag_state = 1; |
|
1044 | + if ($tag_state == 1) { |
|
1045 | + $tag_state = 2; |
|
1046 | + } else { |
|
1047 | + $tag_state = 1; |
|
1048 | + } |
|
1022 | 1049 | } |
1023 | 1050 | // Otherwise it's fine. |
1024 | 1051 | else |
1025 | 1052 | { |
1026 | - if ($tag_state == 0) |
|
1027 | - $key .= $text[$i]; |
|
1028 | - else |
|
1029 | - $value .= $text[$i]; |
|
1053 | + if ($tag_state == 0) { |
|
1054 | + $key .= $text[$i]; |
|
1055 | + } else { |
|
1056 | + $value .= $text[$i]; |
|
1057 | + } |
|
1030 | 1058 | } |
1031 | 1059 | } |
1032 | 1060 | |
1033 | 1061 | // Anything left? |
1034 | - if ($key != '' && $value != '') |
|
1035 | - $attribs[$key] = $value; |
|
1062 | + if ($key != '' && $value != '') { |
|
1063 | + $attribs[$key] = $value; |
|
1064 | + } |
|
1036 | 1065 | |
1037 | 1066 | return $attribs; |
1038 | 1067 | } |
@@ -1050,8 +1079,9 @@ discard block |
||
1050 | 1079 | global $modSettings; |
1051 | 1080 | |
1052 | 1081 | // Don't care about the texts that are too short. |
1053 | - if (strlen($text) < 3) |
|
1054 | - return $text; |
|
1082 | + if (strlen($text) < 3) { |
|
1083 | + return $text; |
|
1084 | + } |
|
1055 | 1085 | |
1056 | 1086 | // A list of tags that's disabled by the admin. |
1057 | 1087 | $disabled = empty($modSettings['disabledBBC']) ? array() : array_flip(explode(',', strtolower($modSettings['disabledBBC']))); |
@@ -1062,10 +1092,12 @@ discard block |
||
1062 | 1092 | $self_closing_tags = array(); |
1063 | 1093 | foreach ($all_tags as $tag) |
1064 | 1094 | { |
1065 | - if (!isset($disabled[$tag['tag']])) |
|
1066 | - $valid_tags[$tag['tag']] = !empty($tag['block_level']); |
|
1067 | - if (isset($tag['type']) && $tag['type'] == 'closed') |
|
1068 | - $self_closing_tags[] = $tag['tag']; |
|
1095 | + if (!isset($disabled[$tag['tag']])) { |
|
1096 | + $valid_tags[$tag['tag']] = !empty($tag['block_level']); |
|
1097 | + } |
|
1098 | + if (isset($tag['type']) && $tag['type'] == 'closed') { |
|
1099 | + $self_closing_tags[] = $tag['tag']; |
|
1100 | + } |
|
1069 | 1101 | } |
1070 | 1102 | |
1071 | 1103 | // Right - we're going to start by going through the whole lot to make sure we don't have align stuff crossed as this happens load and is stupid! |
@@ -1092,16 +1124,19 @@ discard block |
||
1092 | 1124 | $tagName = substr($match, $isClosingTag ? 2 : 1, -1); |
1093 | 1125 | |
1094 | 1126 | // We're closing the exact same tag that we opened. |
1095 | - if ($isClosingTag && $insideTag === $tagName) |
|
1096 | - $insideTag = null; |
|
1127 | + if ($isClosingTag && $insideTag === $tagName) { |
|
1128 | + $insideTag = null; |
|
1129 | + } |
|
1097 | 1130 | |
1098 | 1131 | // We're opening a tag and we're not yet inside one either |
1099 | - elseif (!$isClosingTag && $insideTag === null) |
|
1100 | - $insideTag = $tagName; |
|
1132 | + elseif (!$isClosingTag && $insideTag === null) { |
|
1133 | + $insideTag = $tagName; |
|
1134 | + } |
|
1101 | 1135 | |
1102 | 1136 | // In all other cases, this tag must be invalid |
1103 | - else |
|
1104 | - unset($matches[$i]); |
|
1137 | + else { |
|
1138 | + unset($matches[$i]); |
|
1139 | + } |
|
1105 | 1140 | } |
1106 | 1141 | |
1107 | 1142 | // The next one is gonna be the other one. |
@@ -1109,8 +1144,9 @@ discard block |
||
1109 | 1144 | } |
1110 | 1145 | |
1111 | 1146 | // We're still inside a tag and had no chance for closure? |
1112 | - if ($insideTag !== null) |
|
1113 | - $matches[] = '[/' . $insideTag . ']'; |
|
1147 | + if ($insideTag !== null) { |
|
1148 | + $matches[] = '[/' . $insideTag . ']'; |
|
1149 | + } |
|
1114 | 1150 | |
1115 | 1151 | // And a complete text string again. |
1116 | 1152 | $text = implode('', $matches); |
@@ -1119,8 +1155,9 @@ discard block |
||
1119 | 1155 | // Quickly remove any tags which are back to back. |
1120 | 1156 | $backToBackPattern = '~\\[(' . implode('|', array_diff(array_keys($valid_tags), array('td', 'anchor'))) . ')[^<>\\[\\]]*\\]\s*\\[/\\1\\]~'; |
1121 | 1157 | $lastlen = 0; |
1122 | - while (strlen($text) !== $lastlen) |
|
1123 | - $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1158 | + while (strlen($text) !== $lastlen) { |
|
1159 | + $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1160 | + } |
|
1124 | 1161 | |
1125 | 1162 | // Need to sort the tags my name length. |
1126 | 1163 | uksort($valid_tags, 'sort_array_length'); |
@@ -1157,8 +1194,9 @@ discard block |
||
1157 | 1194 | $isCompetingTag = in_array($tag, $competing_tags); |
1158 | 1195 | |
1159 | 1196 | // Check if this might be one of those cleaned out tags. |
1160 | - if ($tag === '') |
|
1161 | - continue; |
|
1197 | + if ($tag === '') { |
|
1198 | + continue; |
|
1199 | + } |
|
1162 | 1200 | |
1163 | 1201 | // Special case: inside [code] blocks any code is left untouched. |
1164 | 1202 | elseif ($tag === 'code') |
@@ -1169,8 +1207,9 @@ discard block |
||
1169 | 1207 | $inCode = false; |
1170 | 1208 | |
1171 | 1209 | // Reopen tags that were closed before the code block. |
1172 | - if (!empty($inlineElements)) |
|
1173 | - $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1210 | + if (!empty($inlineElements)) { |
|
1211 | + $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1212 | + } |
|
1174 | 1213 | } |
1175 | 1214 | |
1176 | 1215 | // We're outside a coding and nobbc block and opening it. |
@@ -1199,8 +1238,9 @@ discard block |
||
1199 | 1238 | $inNoBbc = false; |
1200 | 1239 | |
1201 | 1240 | // Some inline elements might've been closed that need reopening. |
1202 | - if (!empty($inlineElements)) |
|
1203 | - $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1241 | + if (!empty($inlineElements)) { |
|
1242 | + $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1243 | + } |
|
1204 | 1244 | } |
1205 | 1245 | |
1206 | 1246 | // We're outside a nobbc and coding block and opening it. |
@@ -1220,8 +1260,9 @@ discard block |
||
1220 | 1260 | } |
1221 | 1261 | |
1222 | 1262 | // So, we're inside one of the special blocks: ignore any tag. |
1223 | - elseif ($inCode || $inNoBbc) |
|
1224 | - continue; |
|
1263 | + elseif ($inCode || $inNoBbc) { |
|
1264 | + continue; |
|
1265 | + } |
|
1225 | 1266 | |
1226 | 1267 | // We're dealing with an opening tag. |
1227 | 1268 | if ($isOpeningTag) |
@@ -1262,8 +1303,9 @@ discard block |
||
1262 | 1303 | if ($parts[$j + 3] === $tag) |
1263 | 1304 | { |
1264 | 1305 | // If it's an opening tag, increase the level. |
1265 | - if ($parts[$j + 2] === '') |
|
1266 | - $curLevel++; |
|
1306 | + if ($parts[$j + 2] === '') { |
|
1307 | + $curLevel++; |
|
1308 | + } |
|
1267 | 1309 | |
1268 | 1310 | // A closing tag, decrease the level. |
1269 | 1311 | else |
@@ -1286,13 +1328,15 @@ discard block |
||
1286 | 1328 | { |
1287 | 1329 | if ($isCompetingTag) |
1288 | 1330 | { |
1289 | - if (!isset($competingElements[$tag])) |
|
1290 | - $competingElements[$tag] = array(); |
|
1331 | + if (!isset($competingElements[$tag])) { |
|
1332 | + $competingElements[$tag] = array(); |
|
1333 | + } |
|
1291 | 1334 | |
1292 | 1335 | $competingElements[$tag][] = $parts[$i + 4]; |
1293 | 1336 | |
1294 | - if (count($competingElements[$tag]) > 1) |
|
1295 | - $parts[$i] .= '[/' . $tag . ']'; |
|
1337 | + if (count($competingElements[$tag]) > 1) { |
|
1338 | + $parts[$i] .= '[/' . $tag . ']'; |
|
1339 | + } |
|
1296 | 1340 | } |
1297 | 1341 | |
1298 | 1342 | $inlineElements[$elementContent] = $tag; |
@@ -1312,15 +1356,17 @@ discard block |
||
1312 | 1356 | $addClosingTags = array(); |
1313 | 1357 | while ($element = array_pop($blockElements)) |
1314 | 1358 | { |
1315 | - if ($element === $tag) |
|
1316 | - break; |
|
1359 | + if ($element === $tag) { |
|
1360 | + break; |
|
1361 | + } |
|
1317 | 1362 | |
1318 | 1363 | // Still a block tag was open not equal to this tag. |
1319 | 1364 | $addClosingTags[] = $element['type']; |
1320 | 1365 | } |
1321 | 1366 | |
1322 | - if (!empty($addClosingTags)) |
|
1323 | - $parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1]; |
|
1367 | + if (!empty($addClosingTags)) { |
|
1368 | + $parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1]; |
|
1369 | + } |
|
1324 | 1370 | |
1325 | 1371 | // Apparently the closing tag was not found on the stack. |
1326 | 1372 | if (!is_string($element) || $element !== $tag) |
@@ -1330,8 +1376,7 @@ discard block |
||
1330 | 1376 | $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
1331 | 1377 | continue; |
1332 | 1378 | } |
1333 | - } |
|
1334 | - else |
|
1379 | + } else |
|
1335 | 1380 | { |
1336 | 1381 | // Get rid of this closing tag! |
1337 | 1382 | $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
@@ -1360,53 +1405,62 @@ discard block |
||
1360 | 1405 | unset($inlineElements[$tagContentToBeClosed]); |
1361 | 1406 | |
1362 | 1407 | // Was this the tag we were looking for? |
1363 | - if ($tagToBeClosed === $tag) |
|
1364 | - break; |
|
1408 | + if ($tagToBeClosed === $tag) { |
|
1409 | + break; |
|
1410 | + } |
|
1365 | 1411 | |
1366 | 1412 | // Nope, close it and look further! |
1367 | - else |
|
1368 | - $parts[$i] .= '[/' . $tagToBeClosed . ']'; |
|
1413 | + else { |
|
1414 | + $parts[$i] .= '[/' . $tagToBeClosed . ']'; |
|
1415 | + } |
|
1369 | 1416 | } |
1370 | 1417 | |
1371 | 1418 | if ($isCompetingTag && !empty($competingElements[$tag])) |
1372 | 1419 | { |
1373 | 1420 | array_pop($competingElements[$tag]); |
1374 | 1421 | |
1375 | - if (count($competingElements[$tag]) > 0) |
|
1376 | - $parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5]; |
|
1422 | + if (count($competingElements[$tag]) > 0) { |
|
1423 | + $parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5]; |
|
1424 | + } |
|
1377 | 1425 | } |
1378 | 1426 | } |
1379 | 1427 | |
1380 | 1428 | // Unexpected closing tag, ex-ter-mi-nate. |
1381 | - else |
|
1382 | - $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
|
1429 | + else { |
|
1430 | + $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
|
1431 | + } |
|
1383 | 1432 | } |
1384 | 1433 | } |
1385 | 1434 | } |
1386 | 1435 | |
1387 | 1436 | // Close the code tags. |
1388 | - if ($inCode) |
|
1389 | - $parts[$i] .= '[/code]'; |
|
1437 | + if ($inCode) { |
|
1438 | + $parts[$i] .= '[/code]'; |
|
1439 | + } |
|
1390 | 1440 | |
1391 | 1441 | // The same for nobbc tags. |
1392 | - elseif ($inNoBbc) |
|
1393 | - $parts[$i] .= '[/nobbc]'; |
|
1442 | + elseif ($inNoBbc) { |
|
1443 | + $parts[$i] .= '[/nobbc]'; |
|
1444 | + } |
|
1394 | 1445 | |
1395 | 1446 | // Still inline tags left unclosed? Close them now, better late than never. |
1396 | - elseif (!empty($inlineElements)) |
|
1397 | - $parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']'; |
|
1447 | + elseif (!empty($inlineElements)) { |
|
1448 | + $parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']'; |
|
1449 | + } |
|
1398 | 1450 | |
1399 | 1451 | // Now close the block elements. |
1400 | - if (!empty($blockElements)) |
|
1401 | - $parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']'; |
|
1452 | + if (!empty($blockElements)) { |
|
1453 | + $parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']'; |
|
1454 | + } |
|
1402 | 1455 | |
1403 | 1456 | $text = implode('', $parts); |
1404 | 1457 | } |
1405 | 1458 | |
1406 | 1459 | // Final clean up of back to back tags. |
1407 | 1460 | $lastlen = 0; |
1408 | - while (strlen($text) !== $lastlen) |
|
1409 | - $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1461 | + while (strlen($text) !== $lastlen) { |
|
1462 | + $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1463 | + } |
|
1410 | 1464 | |
1411 | 1465 | return $text; |
1412 | 1466 | } |
@@ -1437,22 +1491,25 @@ discard block |
||
1437 | 1491 | $context['template_layers'] = array(); |
1438 | 1492 | // Lets make sure we aren't going to output anything nasty. |
1439 | 1493 | @ob_end_clean(); |
1440 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
1441 | - @ob_start('ob_gzhandler'); |
|
1442 | - else |
|
1443 | - @ob_start(); |
|
1494 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
1495 | + @ob_start('ob_gzhandler'); |
|
1496 | + } else { |
|
1497 | + @ob_start(); |
|
1498 | + } |
|
1444 | 1499 | |
1445 | 1500 | // If we don't have any locale better avoid broken js |
1446 | - if (empty($txt['lang_locale'])) |
|
1447 | - die(); |
|
1501 | + if (empty($txt['lang_locale'])) { |
|
1502 | + die(); |
|
1503 | + } |
|
1448 | 1504 | |
1449 | 1505 | $file_data = '(function ($) { |
1450 | 1506 | \'use strict\'; |
1451 | 1507 | |
1452 | 1508 | $.sceditor.locale[' . JavaScriptEscape($txt['lang_locale']) . '] = {'; |
1453 | - foreach ($editortxt as $key => $val) |
|
1454 | - $file_data .= ' |
|
1509 | + foreach ($editortxt as $key => $val) { |
|
1510 | + $file_data .= ' |
|
1455 | 1511 | ' . JavaScriptEscape($key) . ': ' . JavaScriptEscape($val) . ','; |
1512 | + } |
|
1456 | 1513 | |
1457 | 1514 | $file_data .= ' |
1458 | 1515 | dateFormat: "day.month.year" |
@@ -1520,8 +1577,9 @@ discard block |
||
1520 | 1577 | ) |
1521 | 1578 | ); |
1522 | 1579 | $icon_data = array(); |
1523 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1524 | - $icon_data[] = $row; |
|
1580 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1581 | + $icon_data[] = $row; |
|
1582 | + } |
|
1525 | 1583 | $smcFunc['db_free_result']($request); |
1526 | 1584 | |
1527 | 1585 | $icons = array(); |
@@ -1536,9 +1594,9 @@ discard block |
||
1536 | 1594 | } |
1537 | 1595 | |
1538 | 1596 | cache_put_data('posting_icons-' . $board_id, $icons, 480); |
1597 | + } else { |
|
1598 | + $icons = $temp; |
|
1539 | 1599 | } |
1540 | - else |
|
1541 | - $icons = $temp; |
|
1542 | 1600 | } |
1543 | 1601 | call_integration_hook('integrate_load_message_icons', array(&$icons)); |
1544 | 1602 | |
@@ -1581,8 +1639,9 @@ discard block |
||
1581 | 1639 | { |
1582 | 1640 | // Some general stuff. |
1583 | 1641 | $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set']; |
1584 | - if (!empty($context['drafts_autosave'])) |
|
1585 | - $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000; |
|
1642 | + if (!empty($context['drafts_autosave'])) { |
|
1643 | + $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000; |
|
1644 | + } |
|
1586 | 1645 | |
1587 | 1646 | // This really has some WYSIWYG stuff. |
1588 | 1647 | loadCSSFile('jquery.sceditor.css', array('force_current' => false, 'validate' => true), 'smf_jquery_sceditor'); |
@@ -1599,8 +1658,9 @@ discard block |
||
1599 | 1658 | var bbc_quote = \'' . addcslashes($txt['quote'], "'") . '\'; |
1600 | 1659 | var bbc_search_on = \'' . addcslashes($txt['search_on'], "'") . '\';'); |
1601 | 1660 | // editor language file |
1602 | - if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') |
|
1603 | - loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language'); |
|
1661 | + if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') { |
|
1662 | + loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language'); |
|
1663 | + } |
|
1604 | 1664 | |
1605 | 1665 | $context['shortcuts_text'] = $txt['shortcuts' . (!empty($context['drafts_save']) ? '_drafts' : '') . (stripos($_SERVER['HTTP_USER_AGENT'], 'Macintosh') !== false ? '_mac' : (isBrowser('is_firefox') ? '_firefox' : ''))]; |
1606 | 1666 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_character_set'] == 'UTF-8' || function_exists('iconv')))); |
@@ -1609,11 +1669,12 @@ discard block |
||
1609 | 1669 | loadJavaScriptFile('spellcheck.js', array('minimize' => true), 'smf_spellcheck'); |
1610 | 1670 | |
1611 | 1671 | // Some hidden information is needed in order to make the spell checking work. |
1612 | - if (!isset($_REQUEST['xml'])) |
|
1613 | - $context['insert_after_template'] .= ' |
|
1672 | + if (!isset($_REQUEST['xml'])) { |
|
1673 | + $context['insert_after_template'] .= ' |
|
1614 | 1674 | <form name="spell_form" id="spell_form" method="post" accept-charset="' . $context['character_set'] . '" target="spellWindow" action="' . $scripturl . '?action=spellcheck"> |
1615 | 1675 | <input type="hidden" name="spellstring" value=""> |
1616 | 1676 | </form>'; |
1677 | + } |
|
1617 | 1678 | } |
1618 | 1679 | } |
1619 | 1680 | |
@@ -1805,8 +1866,9 @@ discard block |
||
1805 | 1866 | |
1806 | 1867 | // Generate a list of buttons that shouldn't be shown - this should be the fastest way to do this. |
1807 | 1868 | $disabled_tags = array(); |
1808 | - if (!empty($modSettings['disabledBBC'])) |
|
1809 | - $disabled_tags = explode(',', $modSettings['disabledBBC']); |
|
1869 | + if (!empty($modSettings['disabledBBC'])) { |
|
1870 | + $disabled_tags = explode(',', $modSettings['disabledBBC']); |
|
1871 | + } |
|
1810 | 1872 | |
1811 | 1873 | foreach ($disabled_tags as $tag) |
1812 | 1874 | { |
@@ -1818,9 +1880,10 @@ discard block |
||
1818 | 1880 | $context['disabled_tags']['orderedlist'] = true; |
1819 | 1881 | } |
1820 | 1882 | |
1821 | - foreach ($editor_tag_map as $thisTag => $tagNameBBC) |
|
1822 | - if ($tag === $thisTag) |
|
1883 | + foreach ($editor_tag_map as $thisTag => $tagNameBBC) { |
|
1884 | + if ($tag === $thisTag) |
|
1823 | 1885 | $context['disabled_tags'][$tagNameBBC] = true; |
1886 | + } |
|
1824 | 1887 | |
1825 | 1888 | $context['disabled_tags'][$tag] = true; |
1826 | 1889 | } |
@@ -1831,8 +1894,9 @@ discard block |
||
1831 | 1894 | |
1832 | 1895 | foreach ($context['bbc_tags'] as $row => $tagRow) |
1833 | 1896 | { |
1834 | - if (!isset($context['bbc_toolbar'][$row])) |
|
1835 | - $context['bbc_toolbar'][$row] = array(); |
|
1897 | + if (!isset($context['bbc_toolbar'][$row])) { |
|
1898 | + $context['bbc_toolbar'][$row] = array(); |
|
1899 | + } |
|
1836 | 1900 | |
1837 | 1901 | $tagsRow = array(); |
1838 | 1902 | |
@@ -1868,20 +1932,21 @@ discard block |
||
1868 | 1932 | |
1869 | 1933 | $context['bbcodes_handlers'] .= ' |
1870 | 1934 | });'; |
1871 | - } |
|
1872 | - else |
|
1935 | + } else |
|
1873 | 1936 | { |
1874 | 1937 | $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
1875 | 1938 | $tagsRow = array(); |
1876 | 1939 | } |
1877 | 1940 | } |
1878 | 1941 | |
1879 | - if (!empty($tagsRow)) |
|
1880 | - $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
|
1942 | + if (!empty($tagsRow)) { |
|
1943 | + $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
|
1944 | + } |
|
1881 | 1945 | } |
1882 | 1946 | |
1883 | - if (!empty($bbcodes_styles)) |
|
1884 | - addInlineCss($bbcodes_styles); |
|
1947 | + if (!empty($bbcodes_styles)) { |
|
1948 | + addInlineCss($bbcodes_styles); |
|
1949 | + } |
|
1885 | 1950 | } |
1886 | 1951 | |
1887 | 1952 | // Initialize smiley array... if not loaded before. |
@@ -1893,8 +1958,8 @@ discard block |
||
1893 | 1958 | ); |
1894 | 1959 | |
1895 | 1960 | // Load smileys - don't bother to run a query if we're not using the database's ones anyhow. |
1896 | - if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') |
|
1897 | - $context['smileys']['postform'][] = array( |
|
1961 | + if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') { |
|
1962 | + $context['smileys']['postform'][] = array( |
|
1898 | 1963 | 'smileys' => array( |
1899 | 1964 | array( |
1900 | 1965 | 'code' => ':)', |
@@ -1980,7 +2045,7 @@ discard block |
||
1980 | 2045 | ), |
1981 | 2046 | 'isLast' => true, |
1982 | 2047 | ); |
1983 | - elseif ($user_info['smiley_set'] != 'none') |
|
2048 | + } elseif ($user_info['smiley_set'] != 'none') |
|
1984 | 2049 | { |
1985 | 2050 | if (($temp = cache_get_data('posting_smileys', 480)) == null) |
1986 | 2051 | { |
@@ -2003,17 +2068,19 @@ discard block |
||
2003 | 2068 | |
2004 | 2069 | foreach ($context['smileys'] as $section => $smileyRows) |
2005 | 2070 | { |
2006 | - foreach ($smileyRows as $rowIndex => $smileys) |
|
2007 | - $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true; |
|
2071 | + foreach ($smileyRows as $rowIndex => $smileys) { |
|
2072 | + $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true; |
|
2073 | + } |
|
2008 | 2074 | |
2009 | - if (!empty($smileyRows)) |
|
2010 | - $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true; |
|
2075 | + if (!empty($smileyRows)) { |
|
2076 | + $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true; |
|
2077 | + } |
|
2011 | 2078 | } |
2012 | 2079 | |
2013 | 2080 | cache_put_data('posting_smileys', $context['smileys'], 480); |
2081 | + } else { |
|
2082 | + $context['smileys'] = $temp; |
|
2014 | 2083 | } |
2015 | - else |
|
2016 | - $context['smileys'] = $temp; |
|
2017 | 2084 | } |
2018 | 2085 | } |
2019 | 2086 | |
@@ -2029,12 +2096,15 @@ discard block |
||
2029 | 2096 | 'plugins' => 'undo', |
2030 | 2097 | 'bbcodeTrim' => true, |
2031 | 2098 | ); |
2032 | - if (!empty($context['controls']['richedit'][$editorOptions['id']]['locale'])) |
|
2033 | - $sce_options['locale'] = $context['controls']['richedit'][$editorOptions['id']]['locale']; |
|
2034 | - if (!empty($context['right_to_left'])) |
|
2035 | - $sce_options['rtl'] = true; |
|
2036 | - if ($editorOptions['id'] != 'quickReply') |
|
2037 | - $sce_options['autofocus'] = true; |
|
2099 | + if (!empty($context['controls']['richedit'][$editorOptions['id']]['locale'])) { |
|
2100 | + $sce_options['locale'] = $context['controls']['richedit'][$editorOptions['id']]['locale']; |
|
2101 | + } |
|
2102 | + if (!empty($context['right_to_left'])) { |
|
2103 | + $sce_options['rtl'] = true; |
|
2104 | + } |
|
2105 | + if ($editorOptions['id'] != 'quickReply') { |
|
2106 | + $sce_options['autofocus'] = true; |
|
2107 | + } |
|
2038 | 2108 | |
2039 | 2109 | $sce_options['emoticons'] = array(); |
2040 | 2110 | $sce_options['emoticonsDescriptions'] = array(); |
@@ -2051,10 +2121,11 @@ discard block |
||
2051 | 2121 | $countLocations--; |
2052 | 2122 | |
2053 | 2123 | unset($smiley_location); |
2054 | - if ($location == 'postform') |
|
2055 | - $smiley_location = &$sce_options['emoticons']['dropdown']; |
|
2056 | - elseif ($location == 'popup') |
|
2057 | - $smiley_location = &$sce_options['emoticons']['popup']; |
|
2124 | + if ($location == 'postform') { |
|
2125 | + $smiley_location = &$sce_options['emoticons']['dropdown']; |
|
2126 | + } elseif ($location == 'popup') { |
|
2127 | + $smiley_location = &$sce_options['emoticons']['popup']; |
|
2128 | + } |
|
2058 | 2129 | |
2059 | 2130 | $numRows = count($smileyRows); |
2060 | 2131 | |
@@ -2068,8 +2139,9 @@ discard block |
||
2068 | 2139 | $sce_options['emoticonsDescriptions'][$smiley['code']] = $smiley['description']; |
2069 | 2140 | } |
2070 | 2141 | |
2071 | - if (empty($smileyRow['isLast']) && $numRows != 1) |
|
2072 | - $smiley_location['-' . $emptyPlaceholder++] = ''; |
|
2142 | + if (empty($smileyRow['isLast']) && $numRows != 1) { |
|
2143 | + $smiley_location['-' . $emptyPlaceholder++] = ''; |
|
2144 | + } |
|
2073 | 2145 | } |
2074 | 2146 | } |
2075 | 2147 | } |
@@ -2084,8 +2156,9 @@ discard block |
||
2084 | 2156 | |
2085 | 2157 | $count_tags--; |
2086 | 2158 | |
2087 | - if (!empty($count_tags)) |
|
2088 | - $sce_options['toolbar'] .= '||'; |
|
2159 | + if (!empty($count_tags)) { |
|
2160 | + $sce_options['toolbar'] .= '||'; |
|
2161 | + } |
|
2089 | 2162 | } |
2090 | 2163 | } |
2091 | 2164 | |
@@ -2113,8 +2186,9 @@ discard block |
||
2113 | 2186 | loadTemplate('GenericControls'); |
2114 | 2187 | |
2115 | 2188 | // Some javascript ma'am? |
2116 | - if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) |
|
2117 | - loadJavaScriptFile('captcha.js', array('minimize' => true), 'smf_captcha'); |
|
2189 | + if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) { |
|
2190 | + loadJavaScriptFile('captcha.js', array('minimize' => true), 'smf_captcha'); |
|
2191 | + } |
|
2118 | 2192 | |
2119 | 2193 | $context['use_graphic_library'] = in_array('gd', get_loaded_extensions()); |
2120 | 2194 | |
@@ -2127,8 +2201,8 @@ discard block |
||
2127 | 2201 | $isNew = !isset($context['controls']['verification'][$verificationOptions['id']]); |
2128 | 2202 | |
2129 | 2203 | // Log this into our collection. |
2130 | - if ($isNew) |
|
2131 | - $context['controls']['verification'][$verificationOptions['id']] = array( |
|
2204 | + if ($isNew) { |
|
2205 | + $context['controls']['verification'][$verificationOptions['id']] = array( |
|
2132 | 2206 | 'id' => $verificationOptions['id'], |
2133 | 2207 | 'empty_field' => empty($verificationOptions['no_empty_field']), |
2134 | 2208 | 'show_visual' => !empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual'])), |
@@ -2139,13 +2213,15 @@ discard block |
||
2139 | 2213 | 'questions' => array(), |
2140 | 2214 | 'can_recaptcha' => !empty($modSettings['recaptcha_enabled']) && !empty($modSettings['recaptcha_site_key']) && !empty($modSettings['recaptcha_secret_key']), |
2141 | 2215 | ); |
2216 | + } |
|
2142 | 2217 | $thisVerification = &$context['controls']['verification'][$verificationOptions['id']]; |
2143 | 2218 | |
2144 | 2219 | // Is there actually going to be anything? |
2145 | - if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) |
|
2146 | - return false; |
|
2147 | - elseif (!$isNew && !$do_test) |
|
2148 | - return true; |
|
2220 | + if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) { |
|
2221 | + return false; |
|
2222 | + } elseif (!$isNew && !$do_test) { |
|
2223 | + return true; |
|
2224 | + } |
|
2149 | 2225 | |
2150 | 2226 | // Sanitize reCAPTCHA fields? |
2151 | 2227 | if ($thisVerification['can_recaptcha']) |
@@ -2158,11 +2234,12 @@ discard block |
||
2158 | 2234 | } |
2159 | 2235 | |
2160 | 2236 | // Add javascript for the object. |
2161 | - if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) |
|
2162 | - $context['insert_after_template'] .= ' |
|
2237 | + if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) { |
|
2238 | + $context['insert_after_template'] .= ' |
|
2163 | 2239 | <script> |
2164 | 2240 | var verification' . $verificationOptions['id'] . 'Handle = new smfCaptcha("' . $thisVerification['image_href'] . '", "' . $verificationOptions['id'] . '", ' . ($context['use_graphic_library'] ? 1 : 0) . '); |
2165 | 2241 | </script>'; |
2242 | + } |
|
2166 | 2243 | |
2167 | 2244 | // If we want questions do we have a cache of all the IDs? |
2168 | 2245 | if (!empty($thisVerification['number_questions']) && empty($modSettings['question_id_cache'])) |
@@ -2185,8 +2262,9 @@ discard block |
||
2185 | 2262 | unset ($row['id_question']); |
2186 | 2263 | // Make them all lowercase. We can't directly use $smcFunc['strtolower'] with array_walk, so do it manually, eh? |
2187 | 2264 | $row['answers'] = $smcFunc['json_decode']($row['answers'], true); |
2188 | - foreach ($row['answers'] as $k => $v) |
|
2189 | - $row['answers'][$k] = $smcFunc['strtolower']($v); |
|
2265 | + foreach ($row['answers'] as $k => $v) { |
|
2266 | + $row['answers'][$k] = $smcFunc['strtolower']($v); |
|
2267 | + } |
|
2190 | 2268 | |
2191 | 2269 | $modSettings['question_id_cache']['questions'][$id_question] = $row; |
2192 | 2270 | $modSettings['question_id_cache']['langs'][$row['lngfile']][] = $id_question; |
@@ -2197,35 +2275,42 @@ discard block |
||
2197 | 2275 | } |
2198 | 2276 | } |
2199 | 2277 | |
2200 | - if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) |
|
2201 | - $_SESSION[$verificationOptions['id'] . '_vv'] = array(); |
|
2278 | + if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) { |
|
2279 | + $_SESSION[$verificationOptions['id'] . '_vv'] = array(); |
|
2280 | + } |
|
2202 | 2281 | |
2203 | 2282 | // Do we need to refresh the verification? |
2204 | - if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) |
|
2205 | - $force_refresh = true; |
|
2206 | - else |
|
2207 | - $force_refresh = false; |
|
2283 | + if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) { |
|
2284 | + $force_refresh = true; |
|
2285 | + } else { |
|
2286 | + $force_refresh = false; |
|
2287 | + } |
|
2208 | 2288 | |
2209 | 2289 | // This can also force a fresh, although unlikely. |
2210 | - if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) |
|
2211 | - $force_refresh = true; |
|
2290 | + if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) { |
|
2291 | + $force_refresh = true; |
|
2292 | + } |
|
2212 | 2293 | |
2213 | 2294 | $verification_errors = array(); |
2214 | 2295 | // Start with any testing. |
2215 | 2296 | if ($do_test) |
2216 | 2297 | { |
2217 | 2298 | // This cannot happen! |
2218 | - if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) |
|
2219 | - fatal_lang_error('no_access', false); |
|
2299 | + if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) { |
|
2300 | + fatal_lang_error('no_access', false); |
|
2301 | + } |
|
2220 | 2302 | // ... nor this! |
2221 | - if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) |
|
2222 | - fatal_lang_error('no_access', false); |
|
2303 | + if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) { |
|
2304 | + fatal_lang_error('no_access', false); |
|
2305 | + } |
|
2223 | 2306 | // Hmm, it's requested but not actually declared. This shouldn't happen. |
2224 | - if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) |
|
2225 | - fatal_lang_error('no_access', false); |
|
2307 | + if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) { |
|
2308 | + fatal_lang_error('no_access', false); |
|
2309 | + } |
|
2226 | 2310 | // While we're here, did the user do something bad? |
2227 | - if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) |
|
2228 | - $verification_errors[] = 'wrong_verification_answer'; |
|
2311 | + if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) { |
|
2312 | + $verification_errors[] = 'wrong_verification_answer'; |
|
2313 | + } |
|
2229 | 2314 | |
2230 | 2315 | if ($thisVerification['can_recaptcha']) |
2231 | 2316 | { |
@@ -2236,22 +2321,25 @@ discard block |
||
2236 | 2321 | { |
2237 | 2322 | $resp = $reCaptcha->verify($_POST['g-recaptcha-response'], $user_info['ip']); |
2238 | 2323 | |
2239 | - if (!$resp->isSuccess()) |
|
2240 | - $verification_errors[] = 'wrong_verification_code'; |
|
2324 | + if (!$resp->isSuccess()) { |
|
2325 | + $verification_errors[] = 'wrong_verification_code'; |
|
2326 | + } |
|
2327 | + } else { |
|
2328 | + $verification_errors[] = 'wrong_verification_code'; |
|
2241 | 2329 | } |
2242 | - else |
|
2243 | - $verification_errors[] = 'wrong_verification_code'; |
|
2244 | 2330 | } |
2245 | - if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) |
|
2246 | - $verification_errors[] = 'wrong_verification_code'; |
|
2331 | + if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) { |
|
2332 | + $verification_errors[] = 'wrong_verification_code'; |
|
2333 | + } |
|
2247 | 2334 | if ($thisVerification['number_questions']) |
2248 | 2335 | { |
2249 | 2336 | $incorrectQuestions = array(); |
2250 | 2337 | foreach ($_SESSION[$verificationOptions['id'] . '_vv']['q'] as $q) |
2251 | 2338 | { |
2252 | 2339 | // We don't have this question any more, thus no answers. |
2253 | - if (!isset($modSettings['question_id_cache']['questions'][$q])) |
|
2254 | - continue; |
|
2340 | + if (!isset($modSettings['question_id_cache']['questions'][$q])) { |
|
2341 | + continue; |
|
2342 | + } |
|
2255 | 2343 | // This is quite complex. We have our question but it might have multiple answers. |
2256 | 2344 | // First, did they actually answer this question? |
2257 | 2345 | if (!isset($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) || trim($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) == '') |
@@ -2263,24 +2351,28 @@ discard block |
||
2263 | 2351 | else |
2264 | 2352 | { |
2265 | 2353 | $given_answer = trim($smcFunc['htmlspecialchars'](strtolower($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]))); |
2266 | - if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) |
|
2267 | - $incorrectQuestions[] = $q; |
|
2354 | + if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) { |
|
2355 | + $incorrectQuestions[] = $q; |
|
2356 | + } |
|
2268 | 2357 | } |
2269 | 2358 | } |
2270 | 2359 | |
2271 | - if (!empty($incorrectQuestions)) |
|
2272 | - $verification_errors[] = 'wrong_verification_answer'; |
|
2360 | + if (!empty($incorrectQuestions)) { |
|
2361 | + $verification_errors[] = 'wrong_verification_answer'; |
|
2362 | + } |
|
2273 | 2363 | } |
2274 | 2364 | } |
2275 | 2365 | |
2276 | 2366 | // Any errors means we refresh potentially. |
2277 | 2367 | if (!empty($verification_errors)) |
2278 | 2368 | { |
2279 | - if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) |
|
2280 | - $_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0; |
|
2369 | + if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) { |
|
2370 | + $_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0; |
|
2371 | + } |
|
2281 | 2372 | // Too many errors? |
2282 | - elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) |
|
2283 | - $force_refresh = true; |
|
2373 | + elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) { |
|
2374 | + $force_refresh = true; |
|
2375 | + } |
|
2284 | 2376 | |
2285 | 2377 | // Keep a track of these. |
2286 | 2378 | $_SESSION[$verificationOptions['id'] . '_vv']['errors']++; |
@@ -2313,8 +2405,9 @@ discard block |
||
2313 | 2405 | // Are we overriding the range? |
2314 | 2406 | $character_range = !empty($verificationOptions['override_range']) ? $verificationOptions['override_range'] : $context['standard_captcha_range']; |
2315 | 2407 | |
2316 | - for ($i = 0; $i < 6; $i++) |
|
2317 | - $_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)]; |
|
2408 | + for ($i = 0; $i < 6; $i++) { |
|
2409 | + $_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)]; |
|
2410 | + } |
|
2318 | 2411 | } |
2319 | 2412 | |
2320 | 2413 | // Getting some new questions? |
@@ -2322,8 +2415,9 @@ discard block |
||
2322 | 2415 | { |
2323 | 2416 | // Attempt to try the current page's language, followed by the user's preference, followed by the site default. |
2324 | 2417 | $possible_langs = array(); |
2325 | - if (isset($_SESSION['language'])) |
|
2326 | - $possible_langs[] = strtr($_SESSION['language'], array('-utf8' => '')); |
|
2418 | + if (isset($_SESSION['language'])) { |
|
2419 | + $possible_langs[] = strtr($_SESSION['language'], array('-utf8' => '')); |
|
2420 | + } |
|
2327 | 2421 | if (!empty($user_info['language'])); |
2328 | 2422 | $possible_langs[] = $user_info['language']; |
2329 | 2423 | $possible_langs[] = $language; |
@@ -2342,8 +2436,7 @@ discard block |
||
2342 | 2436 | } |
2343 | 2437 | } |
2344 | 2438 | } |
2345 | - } |
|
2346 | - else |
|
2439 | + } else |
|
2347 | 2440 | { |
2348 | 2441 | // Same questions as before. |
2349 | 2442 | $questionIDs = !empty($_SESSION[$verificationOptions['id'] . '_vv']['q']) ? $_SESSION[$verificationOptions['id'] . '_vv']['q'] : array(); |
@@ -2353,8 +2446,9 @@ discard block |
||
2353 | 2446 | // If we do have an empty field, it would be nice to hide it from legitimate users who shouldn't be populating it anyway. |
2354 | 2447 | if (!empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) |
2355 | 2448 | { |
2356 | - if (!isset($context['html_headers'])) |
|
2357 | - $context['html_headers'] = ''; |
|
2449 | + if (!isset($context['html_headers'])) { |
|
2450 | + $context['html_headers'] = ''; |
|
2451 | + } |
|
2358 | 2452 | $context['html_headers'] .= '<style>.vv_special { display:none; }</style>'; |
2359 | 2453 | } |
2360 | 2454 | |
@@ -2380,11 +2474,13 @@ discard block |
||
2380 | 2474 | $_SESSION[$verificationOptions['id'] . '_vv']['count'] = empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) ? 1 : $_SESSION[$verificationOptions['id'] . '_vv']['count'] + 1; |
2381 | 2475 | |
2382 | 2476 | // Return errors if we have them. |
2383 | - if (!empty($verification_errors)) |
|
2384 | - return $verification_errors; |
|
2477 | + if (!empty($verification_errors)) { |
|
2478 | + return $verification_errors; |
|
2479 | + } |
|
2385 | 2480 | // If we had a test that one, make a note. |
2386 | - elseif ($do_test) |
|
2387 | - $_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true; |
|
2481 | + elseif ($do_test) { |
|
2482 | + $_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true; |
|
2483 | + } |
|
2388 | 2484 | |
2389 | 2485 | // Say that everything went well chaps. |
2390 | 2486 | return true; |
@@ -2409,8 +2505,9 @@ discard block |
||
2409 | 2505 | call_integration_hook('integrate_autosuggest', array(&$searchTypes)); |
2410 | 2506 | |
2411 | 2507 | // If we're just checking the callback function is registered return true or false. |
2412 | - if ($checkRegistered != null) |
|
2413 | - return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered); |
|
2508 | + if ($checkRegistered != null) { |
|
2509 | + return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered); |
|
2510 | + } |
|
2414 | 2511 | |
2415 | 2512 | checkSession('get'); |
2416 | 2513 | loadTemplate('Xml'); |
@@ -2561,24 +2658,27 @@ discard block |
||
2561 | 2658 | foreach ($possible_versions as $ver) |
2562 | 2659 | { |
2563 | 2660 | $ver = trim($ver); |
2564 | - if (strpos($ver, 'SMF') === 0) |
|
2565 | - $versions[] = $ver; |
|
2661 | + if (strpos($ver, 'SMF') === 0) { |
|
2662 | + $versions[] = $ver; |
|
2663 | + } |
|
2566 | 2664 | } |
2567 | 2665 | } |
2568 | 2666 | $smcFunc['db_free_result']($request); |
2569 | 2667 | |
2570 | 2668 | // Just in case we don't have ANYthing. |
2571 | - if (empty($versions)) |
|
2572 | - $versions = array('SMF 2.0'); |
|
2669 | + if (empty($versions)) { |
|
2670 | + $versions = array('SMF 2.0'); |
|
2671 | + } |
|
2573 | 2672 | |
2574 | - foreach ($versions as $id => $version) |
|
2575 | - if (strpos($version, strtoupper($_REQUEST['search'])) !== false) |
|
2673 | + foreach ($versions as $id => $version) { |
|
2674 | + if (strpos($version, strtoupper($_REQUEST['search'])) !== false) |
|
2576 | 2675 | $xml_data['items']['children'][] = array( |
2577 | 2676 | 'attributes' => array( |
2578 | 2677 | 'id' => $id, |
2579 | 2678 | ), |
2580 | 2679 | 'value' => $version, |
2581 | 2680 | ); |
2681 | + } |
|
2582 | 2682 | |
2583 | 2683 | return $xml_data; |
2584 | 2684 | } |
@@ -18,23 +18,25 @@ discard block |
||
18 | 18 | global $context; |
19 | 19 | |
20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
22 | - echo ' |
|
21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
22 | + echo ' |
|
23 | 23 | <script> |
24 | 24 | disableAutoComplete(); |
25 | 25 | </script>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
28 | 29 | echo ' |
29 | 30 | ', template_error_message(); |
30 | 31 | |
31 | 32 | // If the profile was update successfully, let the user know this. |
32 | - if (!empty($context['profile_updated'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['profile_updated'])) { |
|
34 | + echo ' |
|
34 | 35 | <div class="infobox"> |
35 | 36 | ', $context['profile_updated'], ' |
36 | 37 | </div>'; |
37 | -} |
|
38 | + } |
|
39 | + } |
|
38 | 40 | |
39 | 41 | /** |
40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -99,19 +101,19 @@ discard block |
||
99 | 101 | </div> |
100 | 102 | <div class="alerts_unread">'; |
101 | 103 | |
102 | - if (empty($context['unread_alerts'])) |
|
103 | - template_alerts_all_read(); |
|
104 | - |
|
105 | - else |
|
104 | + if (empty($context['unread_alerts'])) { |
|
105 | + template_alerts_all_read(); |
|
106 | + } else |
|
106 | 107 | { |
107 | - foreach ($context['unread_alerts'] as $id_alert => $details) |
|
108 | - echo ' |
|
108 | + foreach ($context['unread_alerts'] as $id_alert => $details) { |
|
109 | + echo ' |
|
109 | 110 | <div class="unread"> |
110 | 111 | ', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', ' |
111 | 112 | <div class="details"> |
112 | 113 | ', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], ' |
113 | 114 | </div> |
114 | 115 | </div>'; |
116 | + } |
|
115 | 117 | } |
116 | 118 | |
117 | 119 | echo ' |
@@ -158,37 +160,41 @@ discard block |
||
158 | 160 | if (!empty($context['print_custom_fields']['above_member'])) |
159 | 161 | { |
160 | 162 | $fields = ''; |
161 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
162 | - if (!empty($field['output_html'])) |
|
163 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
164 | + if (!empty($field['output_html'])) |
|
163 | 165 | $fields .= ' |
164 | 166 | <li>' . $field['output_html'] . '</li>'; |
167 | + } |
|
165 | 168 | |
166 | - if (!empty($fields)) |
|
167 | - echo ' |
|
169 | + if (!empty($fields)) { |
|
170 | + echo ' |
|
168 | 171 | <div class="custom_fields_above_name"> |
169 | 172 | <ul>', $fields, ' |
170 | 173 | </ul> |
171 | 174 | </div>'; |
175 | + } |
|
172 | 176 | } |
173 | 177 | |
174 | 178 | echo ' |
175 | 179 | <div class="username clear"> |
176 | 180 | <h4>'; |
177 | 181 | |
178 | - if (!empty($context['print_custom_fields']['before_member'])) |
|
179 | - foreach ($context['print_custom_fields']['before_member'] as $field) |
|
182 | + if (!empty($context['print_custom_fields']['before_member'])) { |
|
183 | + foreach ($context['print_custom_fields']['before_member'] as $field) |
|
180 | 184 | if (!empty($field['output_html'])) |
181 | 185 | echo ' |
182 | 186 | <span>', $field['output_html'], '</span>'; |
187 | + } |
|
183 | 188 | |
184 | 189 | echo ' |
185 | 190 | ', $context['member']['name']; |
186 | 191 | |
187 | - if (!empty($context['print_custom_fields']['after_member'])) |
|
188 | - foreach ($context['print_custom_fields']['after_member'] as $field) |
|
192 | + if (!empty($context['print_custom_fields']['after_member'])) { |
|
193 | + foreach ($context['print_custom_fields']['after_member'] as $field) |
|
189 | 194 | if (!empty($field['output_html'])) |
190 | 195 | echo ' |
191 | 196 | <span>', $field['output_html'], '</span>'; |
197 | + } |
|
192 | 198 | |
193 | 199 | |
194 | 200 | echo ' |
@@ -201,39 +207,44 @@ discard block |
||
201 | 207 | if (!empty($context['print_custom_fields']['below_avatar'])) |
202 | 208 | { |
203 | 209 | $fields = ''; |
204 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
205 | - if (!empty($field['output_html'])) |
|
210 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
211 | + if (!empty($field['output_html'])) |
|
206 | 212 | $fields .= ' |
207 | 213 | <li>' . $field['output_html'] . '</li>'; |
214 | + } |
|
208 | 215 | |
209 | - if (!empty($fields)) |
|
210 | - echo ' |
|
216 | + if (!empty($fields)) { |
|
217 | + echo ' |
|
211 | 218 | <div class="custom_fields_below_avatar"> |
212 | 219 | <ul>', $fields, ' |
213 | 220 | </ul> |
214 | 221 | </div>'; |
222 | + } |
|
215 | 223 | } |
216 | 224 | |
217 | 225 | echo ' |
218 | 226 | <ul class="icon_fields clear">'; |
219 | 227 | |
220 | 228 | // Email is only visible if it's your profile or you have the moderate_forum permission |
221 | - if ($context['member']['show_email']) |
|
222 | - echo ' |
|
229 | + if ($context['member']['show_email']) { |
|
230 | + echo ' |
|
223 | 231 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
232 | + } |
|
224 | 233 | |
225 | 234 | // Don't show an icon if they haven't specified a website. |
226 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
227 | - echo ' |
|
235 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
236 | + echo ' |
|
228 | 237 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
238 | + } |
|
229 | 239 | |
230 | 240 | // Are there any custom profile fields as icons? |
231 | 241 | if (!empty($context['print_custom_fields']['icons'])) |
232 | 242 | { |
233 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
234 | - if (!empty($field['output_html'])) |
|
243 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
244 | + if (!empty($field['output_html'])) |
|
235 | 245 | echo ' |
236 | 246 | <li class="custom_field">', $field['output_html'], '</li>'; |
247 | + } |
|
237 | 248 | } |
238 | 249 | |
239 | 250 | echo ' |
@@ -242,24 +253,27 @@ discard block |
||
242 | 253 | ', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
243 | 254 | |
244 | 255 | // Can they add this member as a buddy? |
245 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
246 | - echo ' |
|
256 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
257 | + echo ' |
|
247 | 258 | <br> |
248 | 259 | <a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], '</a>'; |
260 | + } |
|
249 | 261 | |
250 | 262 | echo ' |
251 | 263 | </span>'; |
252 | 264 | |
253 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
254 | - echo ' |
|
265 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
266 | + echo ' |
|
255 | 267 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
268 | + } |
|
256 | 269 | |
257 | 270 | echo ' |
258 | 271 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
259 | 272 | |
260 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
261 | - echo ' |
|
273 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
274 | + echo ' |
|
262 | 275 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
276 | + } |
|
263 | 277 | |
264 | 278 | echo ' |
265 | 279 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -268,17 +282,19 @@ discard block |
||
268 | 282 | if (!empty($context['print_custom_fields']['bottom_poster'])) |
269 | 283 | { |
270 | 284 | $fields = ''; |
271 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
272 | - if (!empty($field['output_html'])) |
|
285 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
286 | + if (!empty($field['output_html'])) |
|
273 | 287 | $fields .= ' |
274 | 288 | <li>' . $field['output_html'] . '</li>'; |
289 | + } |
|
275 | 290 | |
276 | - if (!empty($fields)) |
|
277 | - echo ' |
|
291 | + if (!empty($fields)) { |
|
292 | + echo ' |
|
278 | 293 | <div class="custom_fields_bottom"> |
279 | 294 | <ul class="nolist">', $fields, ' |
280 | 295 | </ul> |
281 | 296 | </div>'; |
297 | + } |
|
282 | 298 | } |
283 | 299 | |
284 | 300 | echo ' |
@@ -287,30 +303,35 @@ discard block |
||
287 | 303 | <div id="detailedinfo"> |
288 | 304 | <dl class="settings">'; |
289 | 305 | |
290 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
291 | - echo ' |
|
306 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
307 | + echo ' |
|
292 | 308 | <dt>', $txt['username'], ': </dt> |
293 | 309 | <dd>', $context['member']['username'], '</dd>'; |
310 | + } |
|
294 | 311 | |
295 | - if (!isset($context['disabled_fields']['posts'])) |
|
296 | - echo ' |
|
312 | + if (!isset($context['disabled_fields']['posts'])) { |
|
313 | + echo ' |
|
297 | 314 | <dt>', $txt['profile_posts'], ': </dt> |
298 | 315 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
316 | + } |
|
299 | 317 | |
300 | - if ($context['member']['show_email']) |
|
301 | - echo ' |
|
318 | + if ($context['member']['show_email']) { |
|
319 | + echo ' |
|
302 | 320 | <dt>', $txt['email'], ': </dt> |
303 | 321 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
322 | + } |
|
304 | 323 | |
305 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
306 | - echo ' |
|
324 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
325 | + echo ' |
|
307 | 326 | <dt>', $txt['custom_title'], ': </dt> |
308 | 327 | <dd>', $context['member']['title'], '</dd>'; |
328 | + } |
|
309 | 329 | |
310 | - if (!empty($context['member']['blurb'])) |
|
311 | - echo ' |
|
330 | + if (!empty($context['member']['blurb'])) { |
|
331 | + echo ' |
|
312 | 332 | <dt>', $txt['personal_text'], ': </dt> |
313 | 333 | <dd>', $context['member']['blurb'], '</dd>'; |
334 | + } |
|
314 | 335 | |
315 | 336 | echo ' |
316 | 337 | <dt>', $txt['age'], ':</dt> |
@@ -324,19 +345,21 @@ discard block |
||
324 | 345 | { |
325 | 346 | $fields = array(); |
326 | 347 | |
327 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
328 | - if (!empty($field['output_html'])) |
|
348 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
349 | + if (!empty($field['output_html'])) |
|
329 | 350 | $fields[] = $field; |
351 | + } |
|
330 | 352 | |
331 | 353 | if (count($fields) > 0) |
332 | 354 | { |
333 | 355 | echo ' |
334 | 356 | <dl class="settings">'; |
335 | 357 | |
336 | - foreach ($fields as $field) |
|
337 | - echo ' |
|
358 | + foreach ($fields as $field) { |
|
359 | + echo ' |
|
338 | 360 | <dt>', $field['name'], ':</dt> |
339 | 361 | <dd>', $field['output_html'], '</dd>'; |
362 | + } |
|
340 | 363 | |
341 | 364 | echo ' |
342 | 365 | </dl>'; |
@@ -355,9 +378,10 @@ discard block |
||
355 | 378 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
356 | 379 | |
357 | 380 | // Can we provide information on what this means? |
358 | - if (!empty($context['warning_status'])) |
|
359 | - echo ' |
|
381 | + if (!empty($context['warning_status'])) { |
|
382 | + echo ' |
|
360 | 383 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
384 | + } |
|
361 | 385 | |
362 | 386 | echo ' |
363 | 387 | </dd>'; |
@@ -367,11 +391,12 @@ discard block |
||
367 | 391 | if (!empty($context['activate_message']) || !empty($context['member']['bans'])) |
368 | 392 | { |
369 | 393 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
370 | - if (!empty($context['activate_message'])) |
|
371 | - echo ' |
|
394 | + if (!empty($context['activate_message'])) { |
|
395 | + echo ' |
|
372 | 396 | <dt class="clear"> |
373 | 397 | <span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>) |
374 | 398 | </dt>'; |
399 | + } |
|
375 | 400 | |
376 | 401 | // If the current member is banned, show a message and possibly a link to the ban. |
377 | 402 | if (!empty($context['member']['bans'])) |
@@ -383,10 +408,11 @@ discard block |
||
383 | 408 | <dt class="clear" id="ban_info" style="display: none;"> |
384 | 409 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
385 | 410 | |
386 | - foreach ($context['member']['bans'] as $ban) |
|
387 | - echo ' |
|
411 | + foreach ($context['member']['bans'] as $ban) { |
|
412 | + echo ' |
|
388 | 413 | <br> |
389 | 414 | <span class="smalltext">', $ban['explanation'], '</span>'; |
415 | + } |
|
390 | 416 | |
391 | 417 | echo ' |
392 | 418 | </dt>'; |
@@ -400,30 +426,34 @@ discard block |
||
400 | 426 | // If the person looking is allowed, they can check the members IP address and hostname. |
401 | 427 | if ($context['can_see_ip']) |
402 | 428 | { |
403 | - if (!empty($context['member']['ip'])) |
|
404 | - echo ' |
|
429 | + if (!empty($context['member']['ip'])) { |
|
430 | + echo ' |
|
405 | 431 | <dt>', $txt['ip'], ': </dt> |
406 | 432 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
433 | + } |
|
407 | 434 | |
408 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
409 | - echo ' |
|
435 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
436 | + echo ' |
|
410 | 437 | <dt>', $txt['hostname'], ': </dt> |
411 | 438 | <dd>', $context['member']['hostname'], '</dd>'; |
439 | + } |
|
412 | 440 | } |
413 | 441 | |
414 | 442 | echo ' |
415 | 443 | <dt>', $txt['local_time'], ':</dt> |
416 | 444 | <dd>', $context['member']['local_time'], '</dd>'; |
417 | 445 | |
418 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
419 | - echo ' |
|
446 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
447 | + echo ' |
|
420 | 448 | <dt>', $txt['language'], ':</dt> |
421 | 449 | <dd>', $context['member']['language'], '</dd>'; |
450 | + } |
|
422 | 451 | |
423 | - if ($context['member']['show_last_login']) |
|
424 | - echo ' |
|
452 | + if ($context['member']['show_last_login']) { |
|
453 | + echo ' |
|
425 | 454 | <dt>', $txt['lastLoggedIn'], ': </dt> |
426 | 455 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
456 | + } |
|
427 | 457 | |
428 | 458 | echo ' |
429 | 459 | </dl>'; |
@@ -432,42 +462,47 @@ discard block |
||
432 | 462 | if (!empty($context['print_custom_fields']['above_signature'])) |
433 | 463 | { |
434 | 464 | $fields = ''; |
435 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
436 | - if (!empty($field['output_html'])) |
|
465 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
466 | + if (!empty($field['output_html'])) |
|
437 | 467 | $fields .= ' |
438 | 468 | <li>' . $field['output_html'] . '</li>'; |
469 | + } |
|
439 | 470 | |
440 | - if (!empty($fields)) |
|
441 | - echo ' |
|
471 | + if (!empty($fields)) { |
|
472 | + echo ' |
|
442 | 473 | <div class="custom_fields_above_signature"> |
443 | 474 | <ul class="nolist">', $fields, ' |
444 | 475 | </ul> |
445 | 476 | </div>'; |
477 | + } |
|
446 | 478 | } |
447 | 479 | |
448 | 480 | // Show the users signature. |
449 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
450 | - echo ' |
|
481 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
482 | + echo ' |
|
451 | 483 | <div class="signature"> |
452 | 484 | <h5>', $txt['signature'], ':</h5> |
453 | 485 | ', $context['member']['signature'], ' |
454 | 486 | </div>'; |
487 | + } |
|
455 | 488 | |
456 | 489 | // Are there any custom profile fields for below the signature? |
457 | 490 | if (!empty($context['print_custom_fields']['below_signature'])) |
458 | 491 | { |
459 | 492 | $fields = ''; |
460 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
461 | - if (!empty($field['output_html'])) |
|
493 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
494 | + if (!empty($field['output_html'])) |
|
462 | 495 | $fields .= ' |
463 | 496 | <li>' . $field['output_html'] . '</li>'; |
497 | + } |
|
464 | 498 | |
465 | - if (!empty($fields)) |
|
466 | - echo ' |
|
499 | + if (!empty($fields)) { |
|
500 | + echo ' |
|
467 | 501 | <div class="custom_fields_below_signature"> |
468 | 502 | <ul class="nolist">', $fields, ' |
469 | 503 | </ul> |
470 | 504 | </div>'; |
505 | + } |
|
471 | 506 | } |
472 | 507 | |
473 | 508 | echo ' |
@@ -509,62 +544,70 @@ discard block |
||
509 | 544 | </div> |
510 | 545 | <div class="list_posts">'; |
511 | 546 | |
512 | - if (!$post['approved']) |
|
513 | - echo ' |
|
547 | + if (!$post['approved']) { |
|
548 | + echo ' |
|
514 | 549 | <div class="approve_post"> |
515 | 550 | <em>', $txt['post_awaiting_approval'], '</em> |
516 | 551 | </div>'; |
552 | + } |
|
517 | 553 | |
518 | 554 | echo ' |
519 | 555 | ', $post['body'], ' |
520 | 556 | </div>'; |
521 | 557 | |
522 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
523 | - echo ' |
|
558 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
559 | + echo ' |
|
524 | 560 | <div class="floatright"> |
525 | 561 | <ul class="quickbuttons">'; |
562 | + } |
|
526 | 563 | |
527 | 564 | // If they *can* reply? |
528 | - if ($post['can_reply']) |
|
529 | - echo ' |
|
565 | + if ($post['can_reply']) { |
|
566 | + echo ' |
|
530 | 567 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
568 | + } |
|
531 | 569 | |
532 | 570 | // If they *can* quote? |
533 | - if ($post['can_quote']) |
|
534 | - echo ' |
|
571 | + if ($post['can_quote']) { |
|
572 | + echo ' |
|
535 | 573 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
574 | + } |
|
536 | 575 | |
537 | 576 | // How about... even... remove it entirely?! |
538 | - if ($post['can_delete']) |
|
539 | - echo ' |
|
577 | + if ($post['can_delete']) { |
|
578 | + echo ' |
|
540 | 579 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
580 | + } |
|
541 | 581 | |
542 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
543 | - echo ' |
|
582 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
583 | + echo ' |
|
544 | 584 | </ul> |
545 | 585 | </div><!-- .floatright -->'; |
586 | + } |
|
546 | 587 | |
547 | 588 | echo ' |
548 | 589 | </div><!-- $post[css_class] -->'; |
549 | 590 | } |
591 | + } else { |
|
592 | + template_show_list('attachments'); |
|
550 | 593 | } |
551 | - else |
|
552 | - template_show_list('attachments'); |
|
553 | 594 | |
554 | 595 | // No posts? Just end with a informative message. |
555 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
556 | - echo ' |
|
596 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
597 | + echo ' |
|
557 | 598 | <div class="windowbg"> |
558 | 599 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
559 | 600 | </div>'; |
601 | + } |
|
560 | 602 | |
561 | 603 | // Show more page numbers. |
562 | - if (!empty($context['page_index'])) |
|
563 | - echo ' |
|
604 | + if (!empty($context['page_index'])) { |
|
605 | + echo ' |
|
564 | 606 | <div class="pagesection"> |
565 | 607 | <div class="pagelinks">', $context['page_index'], '</div> |
566 | 608 | </div>'; |
567 | -} |
|
609 | + } |
|
610 | + } |
|
568 | 611 | |
569 | 612 | /** |
570 | 613 | * Template for showing alerts within the alerts popup |
@@ -574,11 +617,12 @@ discard block |
||
574 | 617 | global $context, $txt, $scripturl; |
575 | 618 | |
576 | 619 | // Do we have an update message? |
577 | - if (!empty($context['update_message'])) |
|
578 | - echo ' |
|
620 | + if (!empty($context['update_message'])) { |
|
621 | + echo ' |
|
579 | 622 | <div class="infobox"> |
580 | 623 | ', $context['update_message'], ' |
581 | 624 | </div>'; |
625 | + } |
|
582 | 626 | |
583 | 627 | echo ' |
584 | 628 | <div class="cat_bar"> |
@@ -587,18 +631,18 @@ discard block |
||
587 | 631 | </h3> |
588 | 632 | </div>'; |
589 | 633 | |
590 | - if (empty($context['alerts'])) |
|
591 | - echo ' |
|
634 | + if (empty($context['alerts'])) { |
|
635 | + echo ' |
|
592 | 636 | <div class="information"> |
593 | 637 | ', $txt['alerts_none'], ' |
594 | 638 | </div>'; |
595 | - |
|
596 | - else |
|
639 | + } else |
|
597 | 640 | { |
598 | 641 | // Start the form if checkboxes are in use |
599 | - if ($context['showCheckboxes']) |
|
600 | - echo ' |
|
642 | + if ($context['showCheckboxes']) { |
|
643 | + echo ' |
|
601 | 644 | <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;save" method="post" accept-charset="', $context['character_set'], '" id="mark_all">'; |
645 | + } |
|
602 | 646 | |
603 | 647 | echo ' |
604 | 648 | <table id="alerts" class="table_grid">'; |
@@ -617,9 +661,10 @@ discard block |
||
617 | 661 | <li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=remove;aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li> |
618 | 662 | <li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=', ($alert['is_read'] != 0 ? 'unread' : 'read'), ';aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons ', $alert['is_read'] != 0 ? 'unread_button' : 'read_button', '"></span>', ($alert['is_read'] != 0 ? $txt['mark_unread'] : $txt['mark_read_short']), '</a></li>'; |
619 | 663 | |
620 | - if ($context['showCheckboxes']) |
|
621 | - echo ' |
|
664 | + if ($context['showCheckboxes']) { |
|
665 | + echo ' |
|
622 | 666 | <li><input type="checkbox" name="mark[', $id, ']" value="', $id, '"></li>'; |
667 | + } |
|
623 | 668 | |
624 | 669 | echo ' |
625 | 670 | </ul> |
@@ -634,8 +679,8 @@ discard block |
||
634 | 679 | ', $context['pagination'], ' |
635 | 680 | </div>'; |
636 | 681 | |
637 | - if ($context['showCheckboxes']) |
|
638 | - echo ' |
|
682 | + if ($context['showCheckboxes']) { |
|
683 | + echo ' |
|
639 | 684 | <div class="floatright"> |
640 | 685 | ', $txt['check_all'], ': <input type="checkbox" name="select_all" id="select_all"> |
641 | 686 | <select name="mark_as"> |
@@ -646,14 +691,16 @@ discard block |
||
646 | 691 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
647 | 692 | <input type="submit" name="req" value="', $txt['quick_mod_go'], '" class="button you_sure"> |
648 | 693 | </div>'; |
694 | + } |
|
649 | 695 | |
650 | 696 | echo ' |
651 | 697 | </div>'; |
652 | 698 | |
653 | - if ($context['showCheckboxes']) |
|
654 | - echo ' |
|
699 | + if ($context['showCheckboxes']) { |
|
700 | + echo ' |
|
655 | 701 | </form>'; |
656 | 702 | } |
703 | + } |
|
657 | 704 | } |
658 | 705 | |
659 | 706 | /** |
@@ -674,12 +721,12 @@ discard block |
||
674 | 721 | </div>' : ''; |
675 | 722 | |
676 | 723 | // No drafts? Just show an informative message. |
677 | - if (empty($context['drafts'])) |
|
678 | - echo ' |
|
724 | + if (empty($context['drafts'])) { |
|
725 | + echo ' |
|
679 | 726 | <div class="windowbg centertext"> |
680 | 727 | ', $txt['draft_none'], ' |
681 | 728 | </div>'; |
682 | - else |
|
729 | + } else |
|
683 | 730 | { |
684 | 731 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
685 | 732 | foreach ($context['drafts'] as $draft) |
@@ -691,13 +738,15 @@ discard block |
||
691 | 738 | <h5> |
692 | 739 | <strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
693 | 740 | |
694 | - if (!empty($draft['sticky'])) |
|
695 | - echo ' |
|
741 | + if (!empty($draft['sticky'])) { |
|
742 | + echo ' |
|
696 | 743 | <span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
744 | + } |
|
697 | 745 | |
698 | - if (!empty($draft['locked'])) |
|
699 | - echo ' |
|
746 | + if (!empty($draft['locked'])) { |
|
747 | + echo ' |
|
700 | 748 | <span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
749 | + } |
|
701 | 750 | |
702 | 751 | echo ' |
703 | 752 | </h5> |
@@ -730,13 +779,13 @@ discard block |
||
730 | 779 | { |
731 | 780 | global $context, $scripturl, $txt; |
732 | 781 | |
733 | - if (!empty($context['saved_successful'])) |
|
734 | - echo ' |
|
782 | + if (!empty($context['saved_successful'])) { |
|
783 | + echo ' |
|
735 | 784 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
736 | - |
|
737 | - elseif (!empty($context['saved_failed'])) |
|
738 | - echo ' |
|
785 | + } elseif (!empty($context['saved_failed'])) { |
|
786 | + echo ' |
|
739 | 787 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
788 | + } |
|
740 | 789 | |
741 | 790 | echo ' |
742 | 791 | <div id="edit_buddies"> |
@@ -751,14 +800,16 @@ discard block |
||
751 | 800 | <th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th> |
752 | 801 | <th scope="col" class="buddy_status">', $txt['status'], '</th>'; |
753 | 802 | |
754 | - if ($context['can_moderate_forum']) |
|
755 | - echo ' |
|
803 | + if ($context['can_moderate_forum']) { |
|
804 | + echo ' |
|
756 | 805 | <th scope="col" class="buddy_email">', $txt['email'], '</th>'; |
806 | + } |
|
757 | 807 | |
758 | - if (!empty($context['custom_pf'])) |
|
759 | - foreach ($context['custom_pf'] as $column) |
|
808 | + if (!empty($context['custom_pf'])) { |
|
809 | + foreach ($context['custom_pf'] as $column) |
|
760 | 810 | echo ' |
761 | 811 | <th scope="col" class="buddy_custom_fields">', $column['label'], '</th>'; |
812 | + } |
|
762 | 813 | |
763 | 814 | echo ' |
764 | 815 | <th scope="col" class="buddy_remove">', $txt['remove'], '</th> |
@@ -767,13 +818,14 @@ discard block |
||
767 | 818 | <tbody>'; |
768 | 819 | |
769 | 820 | // If they don't have any buddies don't list them! |
770 | - if (empty($context['buddies'])) |
|
771 | - echo ' |
|
821 | + if (empty($context['buddies'])) { |
|
822 | + echo ' |
|
772 | 823 | <tr class="windowbg"> |
773 | 824 | <td colspan="', $context['can_moderate_forum'] ? '10' : '9', '"> |
774 | 825 | <strong>', $txt['no_buddies'], '</strong> |
775 | 826 | </td> |
776 | 827 | </tr>'; |
828 | + } |
|
777 | 829 | |
778 | 830 | // Now loop through each buddy showing info on each. |
779 | 831 | else |
@@ -787,17 +839,19 @@ discard block |
||
787 | 839 | <a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
788 | 840 | </td>'; |
789 | 841 | |
790 | - if ($buddy['show_email']) |
|
791 | - echo ' |
|
842 | + if ($buddy['show_email']) { |
|
843 | + echo ' |
|
792 | 844 | <td class="buddy_email centertext"> |
793 | 845 | <a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
794 | 846 | </td>'; |
847 | + } |
|
795 | 848 | |
796 | 849 | // Show the custom profile fields for this user. |
797 | - if (!empty($context['custom_pf'])) |
|
798 | - foreach ($context['custom_pf'] as $key => $column) |
|
850 | + if (!empty($context['custom_pf'])) { |
|
851 | + foreach ($context['custom_pf'] as $key => $column) |
|
799 | 852 | echo ' |
800 | 853 | <td class="lefttext buddy_custom_fields">', $buddy['options'][$key], '</td>'; |
854 | + } |
|
801 | 855 | |
802 | 856 | echo ' |
803 | 857 | <td class="centertext buddy_remove"> |
@@ -830,9 +884,10 @@ discard block |
||
830 | 884 | </dl> |
831 | 885 | </div>'; |
832 | 886 | |
833 | - if (!empty($context['token_check'])) |
|
834 | - echo ' |
|
887 | + if (!empty($context['token_check'])) { |
|
888 | + echo ' |
|
835 | 889 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
890 | + } |
|
836 | 891 | |
837 | 892 | echo ' |
838 | 893 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -858,13 +913,13 @@ discard block |
||
858 | 913 | { |
859 | 914 | global $context, $scripturl, $txt; |
860 | 915 | |
861 | - if (!empty($context['saved_successful'])) |
|
862 | - echo ' |
|
916 | + if (!empty($context['saved_successful'])) { |
|
917 | + echo ' |
|
863 | 918 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
864 | - |
|
865 | - elseif (!empty($context['saved_failed'])) |
|
866 | - echo ' |
|
919 | + } elseif (!empty($context['saved_failed'])) { |
|
920 | + echo ' |
|
867 | 921 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
922 | + } |
|
868 | 923 | |
869 | 924 | echo ' |
870 | 925 | <div id="edit_buddies"> |
@@ -879,9 +934,10 @@ discard block |
||
879 | 934 | <th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th> |
880 | 935 | <th scope="col" class="buddy_status">', $txt['status'], '</th>'; |
881 | 936 | |
882 | - if ($context['can_moderate_forum']) |
|
883 | - echo ' |
|
937 | + if ($context['can_moderate_forum']) { |
|
938 | + echo ' |
|
884 | 939 | <th scope="col" class="buddy_email">', $txt['email'], '</th>'; |
940 | + } |
|
885 | 941 | |
886 | 942 | echo ' |
887 | 943 | <th scope="col" class="buddy_remove">', $txt['ignore_remove'], '</th> |
@@ -890,13 +946,14 @@ discard block |
||
890 | 946 | <tbody>'; |
891 | 947 | |
892 | 948 | // If they don't have anyone on their ignore list, don't list it! |
893 | - if (empty($context['ignore_list'])) |
|
894 | - echo ' |
|
949 | + if (empty($context['ignore_list'])) { |
|
950 | + echo ' |
|
895 | 951 | <tr class="windowbg"> |
896 | 952 | <td colspan="', $context['can_moderate_forum'] ? '4' : '3', '"> |
897 | 953 | <strong>', $txt['no_ignore'], '</strong> |
898 | 954 | </td> |
899 | 955 | </tr>'; |
956 | + } |
|
900 | 957 | |
901 | 958 | // Now loop through each buddy showing info on each. |
902 | 959 | foreach ($context['ignore_list'] as $member) |
@@ -908,11 +965,12 @@ discard block |
||
908 | 965 | <a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
909 | 966 | </td>'; |
910 | 967 | |
911 | - if ($context['can_moderate_forum']) |
|
912 | - echo ' |
|
968 | + if ($context['can_moderate_forum']) { |
|
969 | + echo ' |
|
913 | 970 | <td class="centertext buddy_email"> |
914 | 971 | <a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
915 | 972 | </td>'; |
973 | + } |
|
916 | 974 | echo ' |
917 | 975 | <td class="centertext buddy_remove"> |
918 | 976 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a> |
@@ -943,9 +1001,10 @@ discard block |
||
943 | 1001 | </dl> |
944 | 1002 | </div>'; |
945 | 1003 | |
946 | - if (!empty($context['token_check'])) |
|
947 | - echo ' |
|
1004 | + if (!empty($context['token_check'])) { |
|
1005 | + echo ' |
|
948 | 1006 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1007 | + } |
|
949 | 1008 | |
950 | 1009 | echo ' |
951 | 1010 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -990,9 +1049,10 @@ discard block |
||
990 | 1049 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
991 | 1050 | |
992 | 1051 | // Second address detected? |
993 | - if (!empty($context['last_ip2'])) |
|
994 | - echo ' |
|
1052 | + if (!empty($context['last_ip2'])) { |
|
1053 | + echo ' |
|
995 | 1054 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
1055 | + } |
|
996 | 1056 | |
997 | 1057 | echo ' |
998 | 1058 | </dd>'; |
@@ -1058,9 +1118,10 @@ discard block |
||
1058 | 1118 | </div> |
1059 | 1119 | <div class="windowbg">'; |
1060 | 1120 | |
1061 | - foreach ($context['whois_servers'] as $server) |
|
1062 | - echo ' |
|
1121 | + foreach ($context['whois_servers'] as $server) { |
|
1122 | + echo ' |
|
1063 | 1123 | <a href="', $server['url'], '" target="_blank" rel="noopener"', '>', $server['name'], '</a><br>'; |
1124 | + } |
|
1064 | 1125 | echo ' |
1065 | 1126 | </div> |
1066 | 1127 | <br>'; |
@@ -1072,13 +1133,12 @@ discard block |
||
1072 | 1133 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
1073 | 1134 | </div>'; |
1074 | 1135 | |
1075 | - if (empty($context['ips'])) |
|
1076 | - echo ' |
|
1136 | + if (empty($context['ips'])) { |
|
1137 | + echo ' |
|
1077 | 1138 | <p class="windowbg description"> |
1078 | 1139 | <em>', $txt['no_members_from_ip'], '</em> |
1079 | 1140 | </p>'; |
1080 | - |
|
1081 | - else |
|
1141 | + } else |
|
1082 | 1142 | { |
1083 | 1143 | echo ' |
1084 | 1144 | <table class="table_grid"> |
@@ -1091,12 +1151,13 @@ discard block |
||
1091 | 1151 | <tbody>'; |
1092 | 1152 | |
1093 | 1153 | // Loop through each of the members and display them. |
1094 | - foreach ($context['ips'] as $ip => $memberlist) |
|
1095 | - echo ' |
|
1154 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
1155 | + echo ' |
|
1096 | 1156 | <tr class="windowbg"> |
1097 | 1157 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
1098 | 1158 | <td>', implode(', ', $memberlist), '</td> |
1099 | 1159 | </tr>'; |
1160 | + } |
|
1100 | 1161 | |
1101 | 1162 | echo ' |
1102 | 1163 | </tbody> |
@@ -1138,11 +1199,10 @@ discard block |
||
1138 | 1199 | </h3> |
1139 | 1200 | </div>'; |
1140 | 1201 | |
1141 | - if ($context['member']['has_all_permissions']) |
|
1142 | - echo ' |
|
1202 | + if ($context['member']['has_all_permissions']) { |
|
1203 | + echo ' |
|
1143 | 1204 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
1144 | - |
|
1145 | - else |
|
1205 | + } else |
|
1146 | 1206 | { |
1147 | 1207 | echo ' |
1148 | 1208 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1157,9 +1217,10 @@ discard block |
||
1157 | 1217 | <div class="windowbg smalltext"> |
1158 | 1218 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
1159 | 1219 | |
1160 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
1161 | - echo ' |
|
1220 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
1221 | + echo ' |
|
1162 | 1222 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
1223 | + } |
|
1163 | 1224 | echo ' |
1164 | 1225 | </div>'; |
1165 | 1226 | } |
@@ -1191,12 +1252,13 @@ discard block |
||
1191 | 1252 | </td> |
1192 | 1253 | <td class="smalltext">'; |
1193 | 1254 | |
1194 | - if ($permission['is_denied']) |
|
1195 | - echo ' |
|
1255 | + if ($permission['is_denied']) { |
|
1256 | + echo ' |
|
1196 | 1257 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1197 | - else |
|
1198 | - echo ' |
|
1258 | + } else { |
|
1259 | + echo ' |
|
1199 | 1260 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1261 | + } |
|
1200 | 1262 | |
1201 | 1263 | echo ' |
1202 | 1264 | </td> |
@@ -1207,10 +1269,10 @@ discard block |
||
1207 | 1269 | </table> |
1208 | 1270 | </div><!-- .tborder --> |
1209 | 1271 | <br>'; |
1210 | - } |
|
1211 | - else |
|
1212 | - echo ' |
|
1272 | + } else { |
|
1273 | + echo ' |
|
1213 | 1274 | <p class="windowbg">', $txt['showPermissions_none_general'], '</p>'; |
1275 | + } |
|
1214 | 1276 | |
1215 | 1277 | // Board permission section. |
1216 | 1278 | echo ' |
@@ -1221,14 +1283,16 @@ discard block |
||
1221 | 1283 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
1222 | 1284 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>'; |
1223 | 1285 | |
1224 | - if (!empty($context['boards'])) |
|
1225 | - echo ' |
|
1286 | + if (!empty($context['boards'])) { |
|
1287 | + echo ' |
|
1226 | 1288 | <option value="" disabled>---------------------------</option>'; |
1289 | + } |
|
1227 | 1290 | |
1228 | 1291 | // Fill the box with any local permission boards. |
1229 | - foreach ($context['boards'] as $board) |
|
1230 | - echo ' |
|
1292 | + foreach ($context['boards'] as $board) { |
|
1293 | + echo ' |
|
1231 | 1294 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
1295 | + } |
|
1232 | 1296 | |
1233 | 1297 | echo ' |
1234 | 1298 | </select> |
@@ -1257,13 +1321,13 @@ discard block |
||
1257 | 1321 | </td> |
1258 | 1322 | <td class="smalltext">'; |
1259 | 1323 | |
1260 | - if ($permission['is_denied']) |
|
1261 | - echo ' |
|
1324 | + if ($permission['is_denied']) { |
|
1325 | + echo ' |
|
1262 | 1326 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1263 | - |
|
1264 | - else |
|
1265 | - echo ' |
|
1327 | + } else { |
|
1328 | + echo ' |
|
1266 | 1329 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1330 | + } |
|
1267 | 1331 | |
1268 | 1332 | echo ' |
1269 | 1333 | </td> |
@@ -1272,10 +1336,10 @@ discard block |
||
1272 | 1336 | echo ' |
1273 | 1337 | </tbody> |
1274 | 1338 | </table>'; |
1275 | - } |
|
1276 | - else |
|
1277 | - echo ' |
|
1339 | + } else { |
|
1340 | + echo ' |
|
1278 | 1341 | <p class="windowbg">', $txt['showPermissions_none_board'], '</p>'; |
1342 | + } |
|
1279 | 1343 | echo ' |
1280 | 1344 | </div><!-- #permissions -->'; |
1281 | 1345 | } |
@@ -1299,12 +1363,13 @@ discard block |
||
1299 | 1363 | echo ' |
1300 | 1364 | <dt>', $txt['statPanel_' . $key], '</dt>'; |
1301 | 1365 | |
1302 | - if (!empty($stat['url'])) |
|
1303 | - echo ' |
|
1366 | + if (!empty($stat['url'])) { |
|
1367 | + echo ' |
|
1304 | 1368 | <dd><a href="', $stat['url'], '">', $stat['text'], '</a></dd>'; |
1305 | - else |
|
1306 | - echo ' |
|
1369 | + } else { |
|
1370 | + echo ' |
|
1307 | 1371 | <dd>', $stat['text'], '</dd>'; |
1372 | + } |
|
1308 | 1373 | } |
1309 | 1374 | |
1310 | 1375 | echo ' |
@@ -1321,9 +1386,10 @@ discard block |
||
1321 | 1386 | </div>'; |
1322 | 1387 | |
1323 | 1388 | // If they haven't post at all, don't draw the graph. |
1324 | - if (empty($context['posts_by_time'])) |
|
1325 | - echo ' |
|
1389 | + if (empty($context['posts_by_time'])) { |
|
1390 | + echo ' |
|
1326 | 1391 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1392 | + } |
|
1327 | 1393 | |
1328 | 1394 | // Otherwise do! |
1329 | 1395 | else |
@@ -1332,8 +1398,8 @@ discard block |
||
1332 | 1398 | <ul class="activity_stats flow_hidden">'; |
1333 | 1399 | |
1334 | 1400 | // The labels. |
1335 | - foreach ($context['posts_by_time'] as $time_of_day) |
|
1336 | - echo ' |
|
1401 | + foreach ($context['posts_by_time'] as $time_of_day) { |
|
1402 | + echo ' |
|
1337 | 1403 | <li> |
1338 | 1404 | <div class="generic_bar vertical"> |
1339 | 1405 | <div class="bar" style="height: ', (int) $time_of_day['relative_percent'], '%;"> |
@@ -1342,6 +1408,7 @@ discard block |
||
1342 | 1408 | </div> |
1343 | 1409 | <span class="stats_hour">', $time_of_day['hour_format'], '</span> |
1344 | 1410 | </li>'; |
1411 | + } |
|
1345 | 1412 | |
1346 | 1413 | echo ' |
1347 | 1414 | </ul>'; |
@@ -1360,11 +1427,10 @@ discard block |
||
1360 | 1427 | </h3> |
1361 | 1428 | </div>'; |
1362 | 1429 | |
1363 | - if (empty($context['popular_boards'])) |
|
1364 | - echo ' |
|
1430 | + if (empty($context['popular_boards'])) { |
|
1431 | + echo ' |
|
1365 | 1432 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1366 | - |
|
1367 | - else |
|
1433 | + } else |
|
1368 | 1434 | { |
1369 | 1435 | echo ' |
1370 | 1436 | <dl class="stats">'; |
@@ -1394,10 +1460,10 @@ discard block |
||
1394 | 1460 | </h3> |
1395 | 1461 | </div>'; |
1396 | 1462 | |
1397 | - if (empty($context['board_activity'])) |
|
1398 | - echo ' |
|
1463 | + if (empty($context['board_activity'])) { |
|
1464 | + echo ' |
|
1399 | 1465 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1400 | - else |
|
1466 | + } else |
|
1401 | 1467 | { |
1402 | 1468 | echo ' |
1403 | 1469 | <dl class="stats">'; |
@@ -1448,90 +1514,97 @@ discard block |
||
1448 | 1514 | <h3 class="catbg profile_hd">'; |
1449 | 1515 | |
1450 | 1516 | // Don't say "Profile" if this isn't the profile... |
1451 | - if (!empty($context['profile_header_text'])) |
|
1452 | - echo ' |
|
1517 | + if (!empty($context['profile_header_text'])) { |
|
1518 | + echo ' |
|
1453 | 1519 | ', $context['profile_header_text']; |
1454 | - else |
|
1455 | - echo ' |
|
1520 | + } else { |
|
1521 | + echo ' |
|
1456 | 1522 | ', $txt['profile']; |
1523 | + } |
|
1457 | 1524 | |
1458 | 1525 | echo ' |
1459 | 1526 | </h3> |
1460 | 1527 | </div>'; |
1461 | 1528 | |
1462 | 1529 | // Have we some description? |
1463 | - if ($context['page_desc']) |
|
1464 | - echo ' |
|
1530 | + if ($context['page_desc']) { |
|
1531 | + echo ' |
|
1465 | 1532 | <p class="information">', $context['page_desc'], '</p>'; |
1533 | + } |
|
1466 | 1534 | |
1467 | 1535 | echo ' |
1468 | 1536 | <div class="roundframe">'; |
1469 | 1537 | |
1470 | 1538 | // Any bits at the start? |
1471 | - if (!empty($context['profile_prehtml'])) |
|
1472 | - echo ' |
|
1539 | + if (!empty($context['profile_prehtml'])) { |
|
1540 | + echo ' |
|
1473 | 1541 | <div>', $context['profile_prehtml'], '</div>'; |
1542 | + } |
|
1474 | 1543 | |
1475 | - if (!empty($context['profile_fields'])) |
|
1476 | - echo ' |
|
1544 | + if (!empty($context['profile_fields'])) { |
|
1545 | + echo ' |
|
1477 | 1546 | <dl class="settings">'; |
1547 | + } |
|
1478 | 1548 | |
1479 | 1549 | // Start the big old loop 'of love. |
1480 | 1550 | $lastItem = 'hr'; |
1481 | 1551 | foreach ($context['profile_fields'] as $key => $field) |
1482 | 1552 | { |
1483 | 1553 | // We add a little hack to be sure we never get more than one hr in a row! |
1484 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
1485 | - continue; |
|
1554 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
1555 | + continue; |
|
1556 | + } |
|
1486 | 1557 | |
1487 | 1558 | $lastItem = $field['type']; |
1488 | - if ($field['type'] == 'hr') |
|
1489 | - echo ' |
|
1559 | + if ($field['type'] == 'hr') { |
|
1560 | + echo ' |
|
1490 | 1561 | </dl> |
1491 | 1562 | <hr> |
1492 | 1563 | <dl class="settings">'; |
1493 | - |
|
1494 | - elseif ($field['type'] == 'callback') |
|
1564 | + } elseif ($field['type'] == 'callback') |
|
1495 | 1565 | { |
1496 | 1566 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
1497 | 1567 | { |
1498 | 1568 | $callback_func = 'template_profile_' . $field['callback_func']; |
1499 | 1569 | $callback_func(); |
1500 | 1570 | } |
1501 | - } |
|
1502 | - else |
|
1571 | + } else |
|
1503 | 1572 | { |
1504 | 1573 | echo ' |
1505 | 1574 | <dt> |
1506 | 1575 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
1507 | 1576 | |
1508 | 1577 | // Does it have any subtext to show? |
1509 | - if (!empty($field['subtext'])) |
|
1510 | - echo ' |
|
1578 | + if (!empty($field['subtext'])) { |
|
1579 | + echo ' |
|
1511 | 1580 | <br> |
1512 | 1581 | <span class="smalltext">', $field['subtext'], '</span>'; |
1582 | + } |
|
1513 | 1583 | |
1514 | 1584 | echo ' |
1515 | 1585 | </dt> |
1516 | 1586 | <dd>'; |
1517 | 1587 | |
1518 | 1588 | // Want to put something infront of the box? |
1519 | - if (!empty($field['preinput'])) |
|
1520 | - echo ' |
|
1589 | + if (!empty($field['preinput'])) { |
|
1590 | + echo ' |
|
1521 | 1591 | ', $field['preinput']; |
1592 | + } |
|
1522 | 1593 | |
1523 | 1594 | // What type of data are we showing? |
1524 | - if ($field['type'] == 'label') |
|
1525 | - echo ' |
|
1595 | + if ($field['type'] == 'label') { |
|
1596 | + echo ' |
|
1526 | 1597 | ', $field['value']; |
1598 | + } |
|
1527 | 1599 | |
1528 | 1600 | // Maybe it's a text box - very likely! |
1529 | 1601 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
1530 | 1602 | { |
1531 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
1532 | - $type = 'number'; |
|
1533 | - else |
|
1534 | - $type = $field['type']; |
|
1603 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
1604 | + $type = 'number'; |
|
1605 | + } else { |
|
1606 | + $type = $field['type']; |
|
1607 | + } |
|
1535 | 1608 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
1536 | 1609 | |
1537 | 1610 | |
@@ -1539,10 +1612,11 @@ discard block |
||
1539 | 1612 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
1540 | 1613 | } |
1541 | 1614 | // You "checking" me out? ;) |
1542 | - elseif ($field['type'] == 'check') |
|
1543 | - echo ' |
|
1615 | + elseif ($field['type'] == 'check') { |
|
1616 | + echo ' |
|
1544 | 1617 | <input type="hidden" name="', $key, '" value="0"> |
1545 | 1618 | <input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
1619 | + } |
|
1546 | 1620 | |
1547 | 1621 | // Always fun - select boxes! |
1548 | 1622 | elseif ($field['type'] == 'select') |
@@ -1553,14 +1627,16 @@ discard block |
||
1553 | 1627 | if (isset($field['options'])) |
1554 | 1628 | { |
1555 | 1629 | // Is this some code to generate the options? |
1556 | - if (!is_array($field['options'])) |
|
1557 | - $field['options'] = $field['options'](); |
|
1630 | + if (!is_array($field['options'])) { |
|
1631 | + $field['options'] = $field['options'](); |
|
1632 | + } |
|
1558 | 1633 | |
1559 | 1634 | // Assuming we now have some! |
1560 | - if (is_array($field['options'])) |
|
1561 | - foreach ($field['options'] as $value => $name) |
|
1635 | + if (is_array($field['options'])) { |
|
1636 | + foreach ($field['options'] as $value => $name) |
|
1562 | 1637 | echo ' |
1563 | 1638 | <option', is_numeric($value) ? ' value="" disabled' : ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
1639 | + } |
|
1564 | 1640 | } |
1565 | 1641 | |
1566 | 1642 | echo ' |
@@ -1568,31 +1644,34 @@ discard block |
||
1568 | 1644 | } |
1569 | 1645 | |
1570 | 1646 | // Something to end with? |
1571 | - if (!empty($field['postinput'])) |
|
1572 | - echo ' |
|
1647 | + if (!empty($field['postinput'])) { |
|
1648 | + echo ' |
|
1573 | 1649 | ', $field['postinput']; |
1650 | + } |
|
1574 | 1651 | |
1575 | 1652 | echo ' |
1576 | 1653 | </dd>'; |
1577 | 1654 | } |
1578 | 1655 | } |
1579 | 1656 | |
1580 | - if (!empty($context['profile_fields'])) |
|
1581 | - echo ' |
|
1657 | + if (!empty($context['profile_fields'])) { |
|
1658 | + echo ' |
|
1582 | 1659 | </dl>'; |
1660 | + } |
|
1583 | 1661 | |
1584 | 1662 | // Are there any custom profile fields - if so print them! |
1585 | 1663 | if (!empty($context['custom_fields'])) |
1586 | 1664 | { |
1587 | - if ($lastItem != 'hr') |
|
1588 | - echo ' |
|
1665 | + if ($lastItem != 'hr') { |
|
1666 | + echo ' |
|
1589 | 1667 | <hr>'; |
1668 | + } |
|
1590 | 1669 | |
1591 | 1670 | echo ' |
1592 | 1671 | <dl class="settings">'; |
1593 | 1672 | |
1594 | - foreach ($context['custom_fields'] as $field) |
|
1595 | - echo ' |
|
1673 | + foreach ($context['custom_fields'] as $field) { |
|
1674 | + echo ' |
|
1596 | 1675 | <dt> |
1597 | 1676 | <strong>', $field['name'], ': </strong><br> |
1598 | 1677 | <span class="smalltext">', $field['desc'], '</span> |
@@ -1600,19 +1679,21 @@ discard block |
||
1600 | 1679 | <dd> |
1601 | 1680 | ', $field['input_html'], ' |
1602 | 1681 | </dd>'; |
1682 | + } |
|
1603 | 1683 | |
1604 | 1684 | echo ' |
1605 | 1685 | </dl>'; |
1606 | 1686 | } |
1607 | 1687 | |
1608 | 1688 | // Any closing HTML? |
1609 | - if (!empty($context['profile_posthtml'])) |
|
1610 | - echo ' |
|
1689 | + if (!empty($context['profile_posthtml'])) { |
|
1690 | + echo ' |
|
1611 | 1691 | <div>', $context['profile_posthtml'], '</div>'; |
1692 | + } |
|
1612 | 1693 | |
1613 | 1694 | // Only show the password box if it's actually needed. |
1614 | - if ($context['require_password']) |
|
1615 | - echo ' |
|
1695 | + if ($context['require_password']) { |
|
1696 | + echo ' |
|
1616 | 1697 | <dl class="settings"> |
1617 | 1698 | <dt> |
1618 | 1699 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1622,18 +1703,21 @@ discard block |
||
1622 | 1703 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
1623 | 1704 | </dd> |
1624 | 1705 | </dl>'; |
1706 | + } |
|
1625 | 1707 | |
1626 | 1708 | // The button shouldn't say "Change profile" unless we're changing the profile... |
1627 | - if (!empty($context['submit_button_text'])) |
|
1628 | - echo ' |
|
1709 | + if (!empty($context['submit_button_text'])) { |
|
1710 | + echo ' |
|
1629 | 1711 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">'; |
1630 | - else |
|
1631 | - echo ' |
|
1712 | + } else { |
|
1713 | + echo ' |
|
1632 | 1714 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">'; |
1715 | + } |
|
1633 | 1716 | |
1634 | - if (!empty($context['token_check'])) |
|
1635 | - echo ' |
|
1717 | + if (!empty($context['token_check'])) { |
|
1718 | + echo ' |
|
1636 | 1719 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1720 | + } |
|
1637 | 1721 | |
1638 | 1722 | echo ' |
1639 | 1723 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1643,10 +1727,11 @@ discard block |
||
1643 | 1727 | </form>'; |
1644 | 1728 | |
1645 | 1729 | // Any final spellchecking stuff? |
1646 | - if (!empty($context['show_spellchecking'])) |
|
1647 | - echo ' |
|
1730 | + if (!empty($context['show_spellchecking'])) { |
|
1731 | + echo ' |
|
1648 | 1732 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
1649 | -} |
|
1733 | + } |
|
1734 | + } |
|
1650 | 1735 | |
1651 | 1736 | /** |
1652 | 1737 | * Personal Message settings. |
@@ -1683,10 +1768,11 @@ discard block |
||
1683 | 1768 | <select name="pm_receive_from" id="pm_receive_from"> |
1684 | 1769 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
1685 | 1770 | |
1686 | - if (!empty($modSettings['enable_buddylist'])) |
|
1687 | - echo ' |
|
1771 | + if (!empty($modSettings['enable_buddylist'])) { |
|
1772 | + echo ' |
|
1688 | 1773 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
1689 | 1774 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
1775 | + } |
|
1690 | 1776 | |
1691 | 1777 | echo ' |
1692 | 1778 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1729,11 +1815,12 @@ discard block |
||
1729 | 1815 | if (empty($setting) || !is_array($setting)) |
1730 | 1816 | { |
1731 | 1817 | // Insert a separator (unless this is the first item in the list) |
1732 | - if ($i !== $first_option_key) |
|
1733 | - echo ' |
|
1818 | + if ($i !== $first_option_key) { |
|
1819 | + echo ' |
|
1734 | 1820 | </dl> |
1735 | 1821 | <hr> |
1736 | 1822 | <dl class="settings">'; |
1823 | + } |
|
1737 | 1824 | |
1738 | 1825 | // Should we give a name to this section? |
1739 | 1826 | if (is_string($setting) && !empty($setting)) |
@@ -1742,51 +1829,55 @@ discard block |
||
1742 | 1829 | echo ' |
1743 | 1830 | <dt><strong>' . $setting . '</strong></dt> |
1744 | 1831 | <dd></dd>'; |
1832 | + } else { |
|
1833 | + $titled_section = false; |
|
1745 | 1834 | } |
1746 | - else |
|
1747 | - $titled_section = false; |
|
1748 | 1835 | |
1749 | 1836 | continue; |
1750 | 1837 | } |
1751 | 1838 | |
1752 | 1839 | // Is this disabled? |
1753 | - if (isset($setting['enabled']) && $setting['enabled'] === false) |
|
1754 | - continue; |
|
1840 | + if (isset($setting['enabled']) && $setting['enabled'] === false) { |
|
1841 | + continue; |
|
1842 | + } |
|
1755 | 1843 | |
1756 | 1844 | // Some of these may not be set... Set to defaults here |
1757 | 1845 | $opts = array('calendar_start_day', 'topics_per_page', 'messages_per_page', 'display_quick_mod'); |
1758 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
1759 | - $context['member']['options'][$setting['id']] = 0; |
|
1760 | - |
|
1761 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
1762 | - $setting['type'] = 'checkbox'; |
|
1763 | - |
|
1764 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
1765 | - $setting['type'] = 'number'; |
|
1846 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
1847 | + $context['member']['options'][$setting['id']] = 0; |
|
1848 | + } |
|
1766 | 1849 | |
1767 | - elseif ($setting['type'] == 'string') |
|
1768 | - $setting['type'] = 'text'; |
|
1850 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
1851 | + $setting['type'] = 'checkbox'; |
|
1852 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
1853 | + $setting['type'] = 'number'; |
|
1854 | + } elseif ($setting['type'] == 'string') { |
|
1855 | + $setting['type'] = 'text'; |
|
1856 | + } |
|
1769 | 1857 | |
1770 | - if (isset($setting['options'])) |
|
1771 | - $setting['type'] = 'list'; |
|
1858 | + if (isset($setting['options'])) { |
|
1859 | + $setting['type'] = 'list'; |
|
1860 | + } |
|
1772 | 1861 | |
1773 | 1862 | echo ' |
1774 | 1863 | <dt> |
1775 | 1864 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
1776 | 1865 | |
1777 | - if (isset($setting['description'])) |
|
1778 | - echo ' |
|
1866 | + if (isset($setting['description'])) { |
|
1867 | + echo ' |
|
1779 | 1868 | <br> |
1780 | 1869 | <span class="smalltext">', $setting['description'], '</span>'; |
1870 | + } |
|
1781 | 1871 | echo ' |
1782 | 1872 | </dt> |
1783 | 1873 | <dd>'; |
1784 | 1874 | |
1785 | 1875 | // Display checkbox options |
1786 | - if ($setting['type'] == 'checkbox') |
|
1787 | - echo ' |
|
1876 | + if ($setting['type'] == 'checkbox') { |
|
1877 | + echo ' |
|
1788 | 1878 | <input type="hidden" name="default_options[' . $setting['id'] . ']" value="0"> |
1789 | 1879 | <input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">'; |
1880 | + } |
|
1790 | 1881 | |
1791 | 1882 | // How about selection lists, we all love them |
1792 | 1883 | elseif ($setting['type'] == 'list') |
@@ -1794,9 +1885,10 @@ discard block |
||
1794 | 1885 | echo ' |
1795 | 1886 | <select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>'; |
1796 | 1887 | |
1797 | - foreach ($setting['options'] as $value => $label) |
|
1798 | - echo ' |
|
1888 | + foreach ($setting['options'] as $value => $label) { |
|
1889 | + echo ' |
|
1799 | 1890 | <option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>'; |
1891 | + } |
|
1800 | 1892 | |
1801 | 1893 | echo ' |
1802 | 1894 | </select>'; |
@@ -1812,14 +1904,13 @@ discard block |
||
1812 | 1904 | |
1813 | 1905 | echo ' |
1814 | 1906 | <input type="number"', $min . $max . $step; |
1815 | - } |
|
1816 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
1817 | - echo' |
|
1907 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
1908 | + echo' |
|
1818 | 1909 | <input type="url"'; |
1819 | - |
|
1820 | - else |
|
1821 | - echo ' |
|
1910 | + } else { |
|
1911 | + echo ' |
|
1822 | 1912 | <input type="text"'; |
1913 | + } |
|
1823 | 1914 | |
1824 | 1915 | echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>'; |
1825 | 1916 | } |
@@ -1856,8 +1947,8 @@ discard block |
||
1856 | 1947 | <dl class="settings">'; |
1857 | 1948 | |
1858 | 1949 | // Allow notification on announcements to be disabled? |
1859 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
1860 | - echo ' |
|
1950 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
1951 | + echo ' |
|
1861 | 1952 | <dt> |
1862 | 1953 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
1863 | 1954 | </dt> |
@@ -1865,15 +1956,17 @@ discard block |
||
1865 | 1956 | <input type="hidden" name="notify_announcements" value="0"> |
1866 | 1957 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
1867 | 1958 | </dd>'; |
1959 | + } |
|
1868 | 1960 | |
1869 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
1870 | - echo ' |
|
1961 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
1962 | + echo ' |
|
1871 | 1963 | <dt> |
1872 | 1964 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
1873 | 1965 | </dt> |
1874 | 1966 | <dd> |
1875 | 1967 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
1876 | 1968 | </dd>'; |
1969 | + } |
|
1877 | 1970 | |
1878 | 1971 | echo ' |
1879 | 1972 | </dl> |
@@ -1905,9 +1998,10 @@ discard block |
||
1905 | 1998 | |
1906 | 1999 | $label = $txt['alert_opt_' . $opts[1]]; |
1907 | 2000 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
1908 | - if ($label_pos == 'before') |
|
1909 | - echo ' |
|
2001 | + if ($label_pos == 'before') { |
|
2002 | + echo ' |
|
1910 | 2003 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
2004 | + } |
|
1911 | 2005 | |
1912 | 2006 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
1913 | 2007 | switch ($opts[0]) |
@@ -1921,17 +2015,19 @@ discard block |
||
1921 | 2015 | echo ' |
1922 | 2016 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
1923 | 2017 | |
1924 | - foreach ($opts['opts'] as $k => $v) |
|
1925 | - echo ' |
|
2018 | + foreach ($opts['opts'] as $k => $v) { |
|
2019 | + echo ' |
|
1926 | 2020 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
2021 | + } |
|
1927 | 2022 | echo ' |
1928 | 2023 | </select>'; |
1929 | 2024 | break; |
1930 | 2025 | } |
1931 | 2026 | |
1932 | - if ($label_pos == 'after') |
|
1933 | - echo ' |
|
2027 | + if ($label_pos == 'after') { |
|
2028 | + echo ' |
|
1934 | 2029 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
2030 | + } |
|
1935 | 2031 | |
1936 | 2032 | echo ' |
1937 | 2033 | </td> |
@@ -2048,11 +2144,12 @@ discard block |
||
2048 | 2144 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
2049 | 2145 | |
2050 | 2146 | // Do we have an update message? |
2051 | - if (!empty($context['update_message'])) |
|
2052 | - echo ' |
|
2147 | + if (!empty($context['update_message'])) { |
|
2148 | + echo ' |
|
2053 | 2149 | <div class="infobox"> |
2054 | 2150 | ', $context['update_message'], '. |
2055 | 2151 | </div>'; |
2152 | + } |
|
2056 | 2153 | |
2057 | 2154 | echo ' |
2058 | 2155 | <div id="groups">'; |
@@ -2074,8 +2171,7 @@ discard block |
||
2074 | 2171 | </div> |
2075 | 2172 | </div> |
2076 | 2173 | </div><!-- .groupmembership -->'; |
2077 | - } |
|
2078 | - else |
|
2174 | + } else |
|
2079 | 2175 | { |
2080 | 2176 | echo ' |
2081 | 2177 | <div class="title_bar"> |
@@ -2087,27 +2183,30 @@ discard block |
||
2087 | 2183 | echo ' |
2088 | 2184 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
2089 | 2185 | |
2090 | - if ($context['can_edit_primary']) |
|
2091 | - echo ' |
|
2186 | + if ($context['can_edit_primary']) { |
|
2187 | + echo ' |
|
2092 | 2188 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
2189 | + } |
|
2093 | 2190 | |
2094 | 2191 | echo ' |
2095 | 2192 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
2096 | 2193 | |
2097 | 2194 | // Can they leave their group? |
2098 | - if ($group['can_leave']) |
|
2099 | - echo ' |
|
2195 | + if ($group['can_leave']) { |
|
2196 | + echo ' |
|
2100 | 2197 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
2198 | + } |
|
2101 | 2199 | |
2102 | 2200 | echo ' |
2103 | 2201 | </div><!-- .windowbg -->'; |
2104 | 2202 | } |
2105 | 2203 | |
2106 | - if ($context['can_edit_primary']) |
|
2107 | - echo ' |
|
2204 | + if ($context['can_edit_primary']) { |
|
2205 | + echo ' |
|
2108 | 2206 | <div class="padding righttext"> |
2109 | 2207 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
2110 | 2208 | </div>'; |
2209 | + } |
|
2111 | 2210 | |
2112 | 2211 | // Any groups they can join? |
2113 | 2212 | if (!empty($context['groups']['available'])) |
@@ -2123,17 +2222,16 @@ discard block |
||
2123 | 2222 | <div class="windowbg"> |
2124 | 2223 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
2125 | 2224 | |
2126 | - if ($group['type'] == 3) |
|
2127 | - echo ' |
|
2225 | + if ($group['type'] == 3) { |
|
2226 | + echo ' |
|
2128 | 2227 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
2129 | - |
|
2130 | - elseif ($group['type'] == 2 && $group['pending']) |
|
2131 | - echo ' |
|
2228 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
2229 | + echo ' |
|
2132 | 2230 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
2133 | - |
|
2134 | - elseif ($group['type'] == 2) |
|
2135 | - echo ' |
|
2231 | + } elseif ($group['type'] == 2) { |
|
2232 | + echo ' |
|
2136 | 2233 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
2234 | + } |
|
2137 | 2235 | |
2138 | 2236 | echo ' |
2139 | 2237 | </div><!-- .windowbg -->'; |
@@ -2156,9 +2254,10 @@ discard block |
||
2156 | 2254 | |
2157 | 2255 | prevDiv.className = "windowbg"; |
2158 | 2256 | }'; |
2159 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
2160 | - echo ' |
|
2257 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
2258 | + echo ' |
|
2161 | 2259 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
2260 | + } |
|
2162 | 2261 | |
2163 | 2262 | echo ' |
2164 | 2263 | </script>'; |
@@ -2167,9 +2266,10 @@ discard block |
||
2167 | 2266 | echo ' |
2168 | 2267 | </div><!-- #groups -->'; |
2169 | 2268 | |
2170 | - if (!empty($context['token_check'])) |
|
2171 | - echo ' |
|
2269 | + if (!empty($context['token_check'])) { |
|
2270 | + echo ' |
|
2172 | 2271 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2272 | + } |
|
2173 | 2273 | |
2174 | 2274 | echo ' |
2175 | 2275 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2247,10 +2347,11 @@ discard block |
||
2247 | 2347 | |
2248 | 2348 | // Work out the starting warning. |
2249 | 2349 | $context['current_warning_mode'] = $context['warning_mode'][0]; |
2250 | - foreach ($context['warning_mode'] as $limit => $warning) |
|
2251 | - if ($context['member']['warning'] >= $limit) |
|
2350 | + foreach ($context['warning_mode'] as $limit => $warning) { |
|
2351 | + if ($context['member']['warning'] >= $limit) |
|
2252 | 2352 | $context['current_warning_mode'] = $warning; |
2253 | -} |
|
2353 | + } |
|
2354 | + } |
|
2254 | 2355 | |
2255 | 2356 | // Show all warnings of a user? |
2256 | 2357 | function template_viewWarning() |
@@ -2285,14 +2386,15 @@ discard block |
||
2285 | 2386 | </dd>'; |
2286 | 2387 | |
2287 | 2388 | // There's some impact of this? |
2288 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
2289 | - echo ' |
|
2389 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
2390 | + echo ' |
|
2290 | 2391 | <dt> |
2291 | 2392 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
2292 | 2393 | </dt> |
2293 | 2394 | <dd> |
2294 | 2395 | ', $context['level_effects'][$context['current_level']], ' |
2295 | 2396 | </dd>'; |
2397 | + } |
|
2296 | 2398 | |
2297 | 2399 | echo ' |
2298 | 2400 | </dl> |
@@ -2330,10 +2432,11 @@ discard block |
||
2330 | 2432 | |
2331 | 2433 | // Otherwise see what we can do...'; |
2332 | 2434 | |
2333 | - foreach ($context['notification_templates'] as $k => $type) |
|
2334 | - echo ' |
|
2435 | + foreach ($context['notification_templates'] as $k => $type) { |
|
2436 | + echo ' |
|
2335 | 2437 | if (index == ', $k, ') |
2336 | 2438 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
2439 | + } |
|
2337 | 2440 | |
2338 | 2441 | echo ' |
2339 | 2442 | } |
@@ -2343,10 +2446,11 @@ discard block |
||
2343 | 2446 | // Also set the right effect. |
2344 | 2447 | effectText = "";'; |
2345 | 2448 | |
2346 | - foreach ($context['level_effects'] as $limit => $text) |
|
2347 | - echo ' |
|
2449 | + foreach ($context['level_effects'] as $limit => $text) { |
|
2450 | + echo ' |
|
2348 | 2451 | if (slideAmount >= ', $limit, ') |
2349 | 2452 | effectText = "', $text, '";'; |
2453 | + } |
|
2350 | 2454 | |
2351 | 2455 | echo ' |
2352 | 2456 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2361,32 +2465,35 @@ discard block |
||
2361 | 2465 | </h3> |
2362 | 2466 | </div>'; |
2363 | 2467 | |
2364 | - if (!$context['user']['is_owner']) |
|
2365 | - echo ' |
|
2468 | + if (!$context['user']['is_owner']) { |
|
2469 | + echo ' |
|
2366 | 2470 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
2471 | + } |
|
2367 | 2472 | |
2368 | 2473 | echo ' |
2369 | 2474 | <div class="windowbg"> |
2370 | 2475 | <dl class="settings">'; |
2371 | 2476 | |
2372 | - if (!$context['user']['is_owner']) |
|
2373 | - echo ' |
|
2477 | + if (!$context['user']['is_owner']) { |
|
2478 | + echo ' |
|
2374 | 2479 | <dt> |
2375 | 2480 | <strong>', $txt['profile_warning_name'], ':</strong> |
2376 | 2481 | </dt> |
2377 | 2482 | <dd> |
2378 | 2483 | <strong>', $context['member']['name'], '</strong> |
2379 | 2484 | </dd>'; |
2485 | + } |
|
2380 | 2486 | |
2381 | 2487 | echo ' |
2382 | 2488 | <dt> |
2383 | 2489 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
2384 | 2490 | |
2385 | 2491 | // Is there only so much they can apply? |
2386 | - if ($context['warning_limit']) |
|
2387 | - echo ' |
|
2492 | + if ($context['warning_limit']) { |
|
2493 | + echo ' |
|
2388 | 2494 | <br> |
2389 | 2495 | <span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
2496 | + } |
|
2390 | 2497 | |
2391 | 2498 | echo ' |
2392 | 2499 | </dt> |
@@ -2441,9 +2548,10 @@ discard block |
||
2441 | 2548 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
2442 | 2549 | <option value="-1" disabled>------------------------------</option>'; |
2443 | 2550 | |
2444 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
2445 | - echo ' |
|
2551 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
2552 | + echo ' |
|
2446 | 2553 | <option value="', $id_template, '">', $template['title'], '</option>'; |
2554 | + } |
|
2447 | 2555 | |
2448 | 2556 | echo ' |
2449 | 2557 | </select> |
@@ -2456,9 +2564,10 @@ discard block |
||
2456 | 2564 | </dl> |
2457 | 2565 | <div class="righttext">'; |
2458 | 2566 | |
2459 | - if (!empty($context['token_check'])) |
|
2460 | - echo ' |
|
2567 | + if (!empty($context['token_check'])) { |
|
2568 | + echo ' |
|
2461 | 2569 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2570 | + } |
|
2462 | 2571 | |
2463 | 2572 | echo ' |
2464 | 2573 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2474,8 +2583,8 @@ discard block |
||
2474 | 2583 | echo ' |
2475 | 2584 | <script>'; |
2476 | 2585 | |
2477 | - if (!$context['user']['is_owner']) |
|
2478 | - echo ' |
|
2586 | + if (!$context['user']['is_owner']) { |
|
2587 | + echo ' |
|
2479 | 2588 | modifyWarnNotify(); |
2480 | 2589 | $(document).ready(function() { |
2481 | 2590 | $("#preview_button").click(function() { |
@@ -2514,6 +2623,7 @@ discard block |
||
2514 | 2623 | }); |
2515 | 2624 | return false; |
2516 | 2625 | }'; |
2626 | + } |
|
2517 | 2627 | |
2518 | 2628 | echo ' |
2519 | 2629 | </script>'; |
@@ -2536,17 +2646,19 @@ discard block |
||
2536 | 2646 | </div>'; |
2537 | 2647 | |
2538 | 2648 | // If deleting another account give them a lovely info box. |
2539 | - if (!$context['user']['is_owner']) |
|
2540 | - echo ' |
|
2649 | + if (!$context['user']['is_owner']) { |
|
2650 | + echo ' |
|
2541 | 2651 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
2652 | + } |
|
2542 | 2653 | |
2543 | 2654 | echo ' |
2544 | 2655 | <div class="windowbg">'; |
2545 | 2656 | |
2546 | 2657 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
2547 | - if ($context['needs_approval']) |
|
2548 | - echo ' |
|
2658 | + if ($context['needs_approval']) { |
|
2659 | + echo ' |
|
2549 | 2660 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
2661 | + } |
|
2550 | 2662 | |
2551 | 2663 | // If the user is deleting their own account warn them first - and require a password! |
2552 | 2664 | if ($context['user']['is_owner']) |
@@ -2558,9 +2670,10 @@ discard block |
||
2558 | 2670 | <input type="password" name="oldpasswrd" size="20"> |
2559 | 2671 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
2560 | 2672 | |
2561 | - if (!empty($context['token_check'])) |
|
2562 | - echo ' |
|
2673 | + if (!empty($context['token_check'])) { |
|
2674 | + echo ' |
|
2563 | 2675 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2676 | + } |
|
2564 | 2677 | |
2565 | 2678 | echo ' |
2566 | 2679 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2590,10 +2703,11 @@ discard block |
||
2590 | 2703 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
2591 | 2704 | </select>'; |
2592 | 2705 | |
2593 | - if ($context['show_perma_delete']) |
|
2594 | - echo ' |
|
2706 | + if ($context['show_perma_delete']) { |
|
2707 | + echo ' |
|
2595 | 2708 | <br> |
2596 | 2709 | <label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
2710 | + } |
|
2597 | 2711 | |
2598 | 2712 | echo ' |
2599 | 2713 | </div>'; |
@@ -2606,9 +2720,10 @@ discard block |
||
2606 | 2720 | <div> |
2607 | 2721 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
2608 | 2722 | |
2609 | - if (!empty($context['token_check'])) |
|
2610 | - echo ' |
|
2723 | + if (!empty($context['token_check'])) { |
|
2724 | + echo ' |
|
2611 | 2725 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2726 | + } |
|
2612 | 2727 | |
2613 | 2728 | echo ' |
2614 | 2729 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2634,8 +2749,8 @@ discard block |
||
2634 | 2749 | <hr>'; |
2635 | 2750 | |
2636 | 2751 | // Only show the password box if it's actually needed. |
2637 | - if ($context['require_password']) |
|
2638 | - echo ' |
|
2752 | + if ($context['require_password']) { |
|
2753 | + echo ' |
|
2639 | 2754 | <dl class="settings"> |
2640 | 2755 | <dt> |
2641 | 2756 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2645,13 +2760,15 @@ discard block |
||
2645 | 2760 | <input type="password" name="oldpasswrd" size="20"> |
2646 | 2761 | </dd> |
2647 | 2762 | </dl>'; |
2763 | + } |
|
2648 | 2764 | |
2649 | 2765 | echo ' |
2650 | 2766 | <div class="righttext">'; |
2651 | 2767 | |
2652 | - if (!empty($context['token_check'])) |
|
2653 | - echo ' |
|
2768 | + if (!empty($context['token_check'])) { |
|
2769 | + echo ' |
|
2654 | 2770 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2771 | + } |
|
2655 | 2772 | |
2656 | 2773 | echo ' |
2657 | 2774 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2678,9 +2795,10 @@ discard block |
||
2678 | 2795 | <ul id="list_errors">'; |
2679 | 2796 | |
2680 | 2797 | // Cycle through each error and display an error message. |
2681 | - foreach ($context['post_errors'] as $error) |
|
2682 | - echo ' |
|
2798 | + foreach ($context['post_errors'] as $error) { |
|
2799 | + echo ' |
|
2683 | 2800 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
2801 | + } |
|
2684 | 2802 | |
2685 | 2803 | echo ' |
2686 | 2804 | </ul>'; |
@@ -2706,12 +2824,13 @@ discard block |
||
2706 | 2824 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
2707 | 2825 | |
2708 | 2826 | // Fill the select box with all primary member groups that can be assigned to a member. |
2709 | - foreach ($context['member_groups'] as $member_group) |
|
2710 | - if (!empty($member_group['can_be_primary'])) |
|
2827 | + foreach ($context['member_groups'] as $member_group) { |
|
2828 | + if (!empty($member_group['can_be_primary'])) |
|
2711 | 2829 | echo ' |
2712 | 2830 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
2713 | 2831 | ', $member_group['name'], ' |
2714 | 2832 | </option>'; |
2833 | + } |
|
2715 | 2834 | |
2716 | 2835 | echo ' |
2717 | 2836 | </select> |
@@ -2724,10 +2843,11 @@ discard block |
||
2724 | 2843 | <input type="hidden" name="additional_groups[]" value="0">'; |
2725 | 2844 | |
2726 | 2845 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
2727 | - foreach ($context['member_groups'] as $member_group) |
|
2728 | - if ($member_group['can_be_additional']) |
|
2846 | + foreach ($context['member_groups'] as $member_group) { |
|
2847 | + if ($member_group['can_be_additional']) |
|
2729 | 2848 | echo ' |
2730 | 2849 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
2850 | + } |
|
2731 | 2851 | |
2732 | 2852 | echo ' |
2733 | 2853 | </span> |
@@ -2787,9 +2907,10 @@ discard block |
||
2787 | 2907 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
2788 | 2908 | <br>'; |
2789 | 2909 | |
2790 | - if ($context['show_spellchecking']) |
|
2791 | - echo ' |
|
2910 | + if ($context['show_spellchecking']) { |
|
2911 | + echo ' |
|
2792 | 2912 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
2913 | + } |
|
2793 | 2914 | |
2794 | 2915 | echo ' |
2795 | 2916 | </dt> |
@@ -2797,17 +2918,20 @@ discard block |
||
2797 | 2918 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
2798 | 2919 | |
2799 | 2920 | // If there is a limit at all! |
2800 | - if (!empty($context['signature_limits']['max_length'])) |
|
2801 | - echo ' |
|
2921 | + if (!empty($context['signature_limits']['max_length'])) { |
|
2922 | + echo ' |
|
2802 | 2923 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
2924 | + } |
|
2803 | 2925 | |
2804 | - if (!empty($context['show_preview_button'])) |
|
2805 | - echo ' |
|
2926 | + if (!empty($context['show_preview_button'])) { |
|
2927 | + echo ' |
|
2806 | 2928 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">'; |
2929 | + } |
|
2807 | 2930 | |
2808 | - if ($context['signature_warning']) |
|
2809 | - echo ' |
|
2931 | + if ($context['signature_warning']) { |
|
2932 | + echo ' |
|
2810 | 2933 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
2934 | + } |
|
2811 | 2935 | |
2812 | 2936 | // Some javascript used to count how many characters have been used so far in the signature. |
2813 | 2937 | echo ' |
@@ -2838,38 +2962,43 @@ discard block |
||
2838 | 2962 | <label for="avatar_upload_box">', $txt['personal_picture'], '</label> |
2839 | 2963 | </strong>'; |
2840 | 2964 | |
2841 | - if (empty($modSettings['gravatarOverride'])) |
|
2842 | - echo ' |
|
2965 | + if (empty($modSettings['gravatarOverride'])) { |
|
2966 | + echo ' |
|
2843 | 2967 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . '> |
2844 | 2968 | <label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
2845 | 2969 | ' . $txt['no_avatar'] . ' |
2846 | 2970 | </label><br>'; |
2971 | + } |
|
2847 | 2972 | |
2848 | - if (!empty($context['member']['avatar']['allow_server_stored'])) |
|
2849 | - echo ' |
|
2973 | + if (!empty($context['member']['avatar']['allow_server_stored'])) { |
|
2974 | + echo ' |
|
2850 | 2975 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . '> |
2851 | 2976 | <label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
2852 | 2977 | ', $txt['choose_avatar_gallery'], ' |
2853 | 2978 | </label><br>'; |
2979 | + } |
|
2854 | 2980 | |
2855 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
2856 | - echo ' |
|
2981 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
2982 | + echo ' |
|
2857 | 2983 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . '> |
2858 | 2984 | <label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
2859 | 2985 | ', $txt['my_own_pic'], ' |
2860 | 2986 | </label><br>'; |
2987 | + } |
|
2861 | 2988 | |
2862 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
2863 | - echo ' |
|
2989 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
2990 | + echo ' |
|
2864 | 2991 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . '> |
2865 | 2992 | <label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
2866 | 2993 | ', $txt['avatar_will_upload'], ' |
2867 | 2994 | </label><br>'; |
2995 | + } |
|
2868 | 2996 | |
2869 | - if (!empty($context['member']['avatar']['allow_gravatar'])) |
|
2870 | - echo ' |
|
2997 | + if (!empty($context['member']['avatar']['allow_gravatar'])) { |
|
2998 | + echo ' |
|
2871 | 2999 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_gravatar" value="gravatar"' . ($context['member']['avatar']['choice'] == 'gravatar' ? ' checked="checked"' : '') . '> |
2872 | 3000 | <label for="avatar_choice_gravatar"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['use_gravatar'] . '</label>'; |
3001 | + } |
|
2873 | 3002 | |
2874 | 3003 | echo ' |
2875 | 3004 | </dt> |
@@ -2884,9 +3013,10 @@ discard block |
||
2884 | 3013 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
2885 | 3014 | |
2886 | 3015 | // This lists all the file categories. |
2887 | - foreach ($context['avatars'] as $avatar) |
|
2888 | - echo ' |
|
3016 | + foreach ($context['avatars'] as $avatar) { |
|
3017 | + echo ' |
|
2889 | 3018 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
3019 | + } |
|
2890 | 3020 | |
2891 | 3021 | echo ' |
2892 | 3022 | </select> |
@@ -2918,20 +3048,22 @@ discard block |
||
2918 | 3048 | } |
2919 | 3049 | |
2920 | 3050 | // If the user can link to an off server avatar, show them a box to input the address. |
2921 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
2922 | - echo ' |
|
3051 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
3052 | + echo ' |
|
2923 | 3053 | <div id="avatar_external"> |
2924 | 3054 | <div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', ' |
2925 | 3055 | <input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);"> |
2926 | 3056 | </div>'; |
3057 | + } |
|
2927 | 3058 | |
2928 | 3059 | // If the user is able to upload avatars to the server show them an upload box. |
2929 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
2930 | - echo ' |
|
3060 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
3061 | + echo ' |
|
2931 | 3062 | <div id="avatar_upload"> |
2932 | 3063 | <input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), ' |
2933 | 3064 | ', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), ' |
2934 | 3065 | </div>'; |
3066 | + } |
|
2935 | 3067 | |
2936 | 3068 | // if the user is able to use Gravatar avatars show then the image preview |
2937 | 3069 | if (!empty($context['member']['avatar']['allow_gravatar'])) |
@@ -2940,16 +3072,17 @@ discard block |
||
2940 | 3072 | <div id="avatar_gravatar"> |
2941 | 3073 | <img src="' . $context['member']['avatar']['href'] . '" alt="">'; |
2942 | 3074 | |
2943 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
2944 | - echo ' |
|
3075 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
3076 | + echo ' |
|
2945 | 3077 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
2946 | - else |
|
3078 | + } else |
|
2947 | 3079 | { |
2948 | 3080 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
2949 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
2950 | - $textbox_value = ''; |
|
2951 | - else |
|
2952 | - $textbox_value = $context['member']['avatar']['external']; |
|
3081 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
3082 | + $textbox_value = ''; |
|
3083 | + } else { |
|
3084 | + $textbox_value = $context['member']['avatar']['external']; |
|
3085 | + } |
|
2953 | 3086 | |
2954 | 3087 | echo ' |
2955 | 3088 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -3021,8 +3154,9 @@ discard block |
||
3021 | 3154 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
3022 | 3155 | |
3023 | 3156 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
3024 | - if (empty($suffix)) |
|
3025 | - return; |
|
3157 | + if (empty($suffix)) { |
|
3158 | + return; |
|
3159 | + } |
|
3026 | 3160 | |
3027 | 3161 | echo ' |
3028 | 3162 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -3047,9 +3181,10 @@ discard block |
||
3047 | 3181 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
3048 | 3182 | |
3049 | 3183 | // Help the user by showing a list of common time formats. |
3050 | - foreach ($context['easy_timeformats'] as $time_format) |
|
3051 | - echo ' |
|
3184 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
3185 | + echo ' |
|
3052 | 3186 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
3187 | + } |
|
3053 | 3188 | |
3054 | 3189 | echo ' |
3055 | 3190 | </select> |
@@ -3087,9 +3222,10 @@ discard block |
||
3087 | 3222 | <dd> |
3088 | 3223 | <select name="smiley_set" id="smiley_set">'; |
3089 | 3224 | |
3090 | - foreach ($context['smiley_sets'] as $set) |
|
3091 | - echo ' |
|
3225 | + foreach ($context['smiley_sets'] as $set) { |
|
3226 | + echo ' |
|
3092 | 3227 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
3228 | + } |
|
3093 | 3229 | |
3094 | 3230 | echo ' |
3095 | 3231 | </select> |
@@ -3111,17 +3247,17 @@ discard block |
||
3111 | 3247 | <div class="roundframe"> |
3112 | 3248 | <div>'; |
3113 | 3249 | |
3114 | - if (!empty($context['tfa_backup'])) |
|
3115 | - echo ' |
|
3250 | + if (!empty($context['tfa_backup'])) { |
|
3251 | + echo ' |
|
3116 | 3252 | <div class="smalltext error"> |
3117 | 3253 | ', $txt['tfa_backup_used_desc'], ' |
3118 | 3254 | </div>'; |
3119 | - |
|
3120 | - elseif ($modSettings['tfa_mode'] == 2) |
|
3121 | - echo ' |
|
3255 | + } elseif ($modSettings['tfa_mode'] == 2) { |
|
3256 | + echo ' |
|
3122 | 3257 | <div class="smalltext"> |
3123 | 3258 | <strong>', $txt['tfa_forced_desc'], '</strong> |
3124 | 3259 | </div>'; |
3260 | + } |
|
3125 | 3261 | |
3126 | 3262 | echo ' |
3127 | 3263 | <div class="smalltext"> |
@@ -3132,11 +3268,12 @@ discard block |
||
3132 | 3268 | <div class="block"> |
3133 | 3269 | <strong>', $txt['tfa_step1'], '</strong><br>'; |
3134 | 3270 | |
3135 | - if (!empty($context['tfa_pass_error'])) |
|
3136 | - echo ' |
|
3271 | + if (!empty($context['tfa_pass_error'])) { |
|
3272 | + echo ' |
|
3137 | 3273 | <div class="error smalltext"> |
3138 | 3274 | ', $txt['tfa_pass_invalid'], ' |
3139 | 3275 | </div>'; |
3276 | + } |
|
3140 | 3277 | |
3141 | 3278 | echo ' |
3142 | 3279 | <input type="password" name="passwd" size="25"', !empty($context['tfa_pass_error']) ? ' class="error"' : '', !empty($context['tfa_pass_value']) ? ' value="' . $context['tfa_pass_value'] . '"' : '', '> |
@@ -3149,11 +3286,12 @@ discard block |
||
3149 | 3286 | <div class="block"> |
3150 | 3287 | <strong>', $txt['tfa_step3'], '</strong><br>'; |
3151 | 3288 | |
3152 | - if (!empty($context['tfa_error'])) |
|
3153 | - echo ' |
|
3289 | + if (!empty($context['tfa_error'])) { |
|
3290 | + echo ' |
|
3154 | 3291 | <div class="error smalltext"> |
3155 | 3292 | ', $txt['tfa_code_invalid'], ' |
3156 | 3293 | </div>'; |
3294 | + } |
|
3157 | 3295 | |
3158 | 3296 | echo ' |
3159 | 3297 | <input type="text" name="tfa_code" size="25"', !empty($context['tfa_error']) ? ' class="error"' : '', !empty($context['tfa_value']) ? ' value="' . $context['tfa_value'] . '"' : '', '> |
@@ -3167,10 +3305,11 @@ discard block |
||
3167 | 3305 | <img src="', $context['tfa_qr_url'], '" alt=""> |
3168 | 3306 | </div>'; |
3169 | 3307 | |
3170 | - if (!empty($context['from_ajax'])) |
|
3171 | - echo ' |
|
3308 | + if (!empty($context['from_ajax'])) { |
|
3309 | + echo ' |
|
3172 | 3310 | <br> |
3173 | 3311 | <a href="javascript:self.close();"></a>'; |
3312 | + } |
|
3174 | 3313 | |
3175 | 3314 | echo ' |
3176 | 3315 | </div> |
@@ -3210,17 +3349,16 @@ discard block |
||
3210 | 3349 | </dt> |
3211 | 3350 | <dd>'; |
3212 | 3351 | |
3213 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
3214 | - echo ' |
|
3352 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
3353 | + echo ' |
|
3215 | 3354 | <a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
3216 | - |
|
3217 | - elseif (!$context['tfa_enabled']) |
|
3218 | - echo ' |
|
3355 | + } elseif (!$context['tfa_enabled']) { |
|
3356 | + echo ' |
|
3219 | 3357 | ', $txt['tfa_profile_disabled']; |
3220 | - |
|
3221 | - else |
|
3222 | - echo ' |
|
3358 | + } else { |
|
3359 | + echo ' |
|
3223 | 3360 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
3361 | + } |
|
3224 | 3362 | |
3225 | 3363 | echo ' |
3226 | 3364 | </dd>'; |
@@ -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 | * Finds or repairs errors in the database to fix possible problems. |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | ); |
51 | 52 | |
52 | 53 | // Start displaying errors without fixing them. |
53 | - if (isset($_GET['fixErrors'])) |
|
54 | - checkSession('get'); |
|
54 | + if (isset($_GET['fixErrors'])) { |
|
55 | + checkSession('get'); |
|
56 | + } |
|
55 | 57 | |
56 | 58 | // Will want this. |
57 | 59 | loadForumTests(); |
@@ -69,14 +71,14 @@ discard block |
||
69 | 71 | $_SESSION['repairboards_to_fix'] = $context['to_fix']; |
70 | 72 | $_SESSION['repairboards_to_fix2'] = null; |
71 | 73 | |
72 | - if (empty($context['repair_errors'])) |
|
73 | - $context['repair_errors'][] = '???'; |
|
74 | + if (empty($context['repair_errors'])) { |
|
75 | + $context['repair_errors'][] = '???'; |
|
76 | + } |
|
74 | 77 | } |
75 | 78 | |
76 | 79 | // Need a token here. |
77 | 80 | createToken('admin-repairboards', 'request'); |
78 | - } |
|
79 | - else |
|
81 | + } else |
|
80 | 82 | { |
81 | 83 | // Validate the token, create a new one and tell the not done template. |
82 | 84 | validateToken('admin-repairboards', 'request'); |
@@ -134,16 +136,19 @@ discard block |
||
134 | 136 | |
135 | 137 | // More time, I need more time! |
136 | 138 | @set_time_limit(600); |
137 | - if (function_exists('apache_reset_timeout')) |
|
138 | - @apache_reset_timeout(); |
|
139 | + if (function_exists('apache_reset_timeout')) { |
|
140 | + @apache_reset_timeout(); |
|
141 | + } |
|
139 | 142 | |
140 | 143 | // Errr, wait. How much time has this taken already? |
141 | - if (!$force && (time() - $time_start) < 3) |
|
142 | - return; |
|
144 | + if (!$force && (time() - $time_start) < 3) { |
|
145 | + return; |
|
146 | + } |
|
143 | 147 | |
144 | 148 | // Restore the query cache if interested. |
145 | - if (!empty($db_temp_cache)) |
|
146 | - $db_cache = $db_temp_cache; |
|
149 | + if (!empty($db_temp_cache)) { |
|
150 | + $db_cache = $db_temp_cache; |
|
151 | + } |
|
147 | 152 | |
148 | 153 | $context['continue_get_data'] = '?action=admin;area=repairboards' . (isset($_GET['fixErrors']) ? ';fixErrors' : '') . ';step=' . $_GET['step'] . ';substep=' . $_GET['substep'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
149 | 154 | $context['page_title'] = $txt['not_done_title']; |
@@ -152,10 +157,11 @@ discard block |
||
152 | 157 | $context['sub_template'] = 'not_done'; |
153 | 158 | |
154 | 159 | // Change these two if more steps are added! |
155 | - if (empty($max_substep)) |
|
156 | - $context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']); |
|
157 | - else |
|
158 | - $context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']); |
|
160 | + if (empty($max_substep)) { |
|
161 | + $context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']); |
|
162 | + } else { |
|
163 | + $context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']); |
|
164 | + } |
|
159 | 165 | |
160 | 166 | // Never more than 100%! |
161 | 167 | $context['continue_percent'] = min($context['continue_percent'], 100); |
@@ -624,8 +630,9 @@ discard block |
||
624 | 630 | $row['myid_last_msg'] = (int) $row['myid_last_msg']; |
625 | 631 | |
626 | 632 | // Not really a problem? |
627 | - if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) |
|
628 | - return false; |
|
633 | + if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) { |
|
634 | + return false; |
|
635 | + } |
|
629 | 636 | |
630 | 637 | $memberStartedID = (int) getMsgMemberID($row['myid_first_msg']); |
631 | 638 | $memberUpdatedID = (int) getMsgMemberID($row['myid_last_msg']); |
@@ -649,15 +656,19 @@ discard block |
||
649 | 656 | 'message_function' => function ($row) use ($txt, &$context) |
650 | 657 | { |
651 | 658 | // A pretend error? |
652 | - if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) |
|
653 | - return false; |
|
659 | + if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) { |
|
660 | + return false; |
|
661 | + } |
|
654 | 662 | |
655 | - if ($row['id_first_msg'] != $row['myid_first_msg']) |
|
656 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']); |
|
657 | - if ($row['id_last_msg'] != $row['myid_last_msg']) |
|
658 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']); |
|
659 | - if ($row['approved'] != $row['firstmsg_approved']) |
|
660 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']); |
|
663 | + if ($row['id_first_msg'] != $row['myid_first_msg']) { |
|
664 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']); |
|
665 | + } |
|
666 | + if ($row['id_last_msg'] != $row['myid_last_msg']) { |
|
667 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']); |
|
668 | + } |
|
669 | + if ($row['approved'] != $row['firstmsg_approved']) { |
|
670 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']); |
|
671 | + } |
|
661 | 672 | |
662 | 673 | return true; |
663 | 674 | }, |
@@ -686,8 +697,9 @@ discard block |
||
686 | 697 | $row['my_num_replies'] = (int) $row['my_num_replies']; |
687 | 698 | |
688 | 699 | // Not really a problem? |
689 | - if ($row['my_num_replies'] == $row['num_replies']) |
|
690 | - return false; |
|
700 | + if ($row['my_num_replies'] == $row['num_replies']) { |
|
701 | + return false; |
|
702 | + } |
|
691 | 703 | |
692 | 704 | $smcFunc['db_query']('', ' |
693 | 705 | UPDATE {db_prefix}topics |
@@ -704,11 +716,13 @@ discard block |
||
704 | 716 | global $txt, $context; |
705 | 717 | |
706 | 718 | // Just joking? |
707 | - if ($row['my_num_replies'] == $row['num_replies']) |
|
708 | - return false; |
|
719 | + if ($row['my_num_replies'] == $row['num_replies']) { |
|
720 | + return false; |
|
721 | + } |
|
709 | 722 | |
710 | - if ($row['num_replies'] != $row['my_num_replies']) |
|
711 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']); |
|
723 | + if ($row['num_replies'] != $row['my_num_replies']) { |
|
724 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']); |
|
725 | + } |
|
712 | 726 | |
713 | 727 | return true; |
714 | 728 | }, |
@@ -1280,8 +1294,9 @@ discard block |
||
1280 | 1294 | $inserts = array(); |
1281 | 1295 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
1282 | 1296 | { |
1283 | - foreach (text2words($row['subject']) as $word) |
|
1284 | - $inserts[] = array($word, $row['id_topic']); |
|
1297 | + foreach (text2words($row['subject']) as $word) { |
|
1298 | + $inserts[] = array($word, $row['id_topic']); |
|
1299 | + } |
|
1285 | 1300 | if (count($inserts) > 500) |
1286 | 1301 | { |
1287 | 1302 | $smcFunc['db_insert']('ignore', |
@@ -1294,13 +1309,14 @@ discard block |
||
1294 | 1309 | } |
1295 | 1310 | } |
1296 | 1311 | |
1297 | - if (!empty($inserts)) |
|
1298 | - $smcFunc['db_insert']('ignore', |
|
1312 | + if (!empty($inserts)) { |
|
1313 | + $smcFunc['db_insert']('ignore', |
|
1299 | 1314 | '{db_prefix}log_search_subjects', |
1300 | 1315 | array('word' => 'string', 'id_topic' => 'int'), |
1301 | 1316 | $inserts, |
1302 | 1317 | array('word', 'id_topic') |
1303 | 1318 | ); |
1319 | + } |
|
1304 | 1320 | }, |
1305 | 1321 | 'message_function' => function ($row) |
1306 | 1322 | { |
@@ -1559,8 +1575,9 @@ discard block |
||
1559 | 1575 | $current_step++; |
1560 | 1576 | |
1561 | 1577 | // Already done this? |
1562 | - if ($_GET['step'] > $current_step) |
|
1563 | - continue; |
|
1578 | + if ($_GET['step'] > $current_step) { |
|
1579 | + continue; |
|
1580 | + } |
|
1564 | 1581 | |
1565 | 1582 | // If we're fixing it but it ain't broke why try? |
1566 | 1583 | if ($do_fix && !in_array($error_type, $to_fix)) |
@@ -1589,14 +1606,16 @@ discard block |
||
1589 | 1606 | while (!$done) |
1590 | 1607 | { |
1591 | 1608 | // Make sure there's at least one ID to test. |
1592 | - if (isset($test['substeps']) && empty($step_max)) |
|
1593 | - break; |
|
1609 | + if (isset($test['substeps']) && empty($step_max)) { |
|
1610 | + break; |
|
1611 | + } |
|
1594 | 1612 | |
1595 | 1613 | // What is the testing query (Changes if we are testing or fixing) |
1596 | - if (!$do_fix) |
|
1597 | - $test_query = 'check_query'; |
|
1598 | - else |
|
1599 | - $test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query'; |
|
1614 | + if (!$do_fix) { |
|
1615 | + $test_query = 'check_query'; |
|
1616 | + } else { |
|
1617 | + $test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query'; |
|
1618 | + } |
|
1600 | 1619 | |
1601 | 1620 | // Do the test... |
1602 | 1621 | $request = $smcFunc['db_query']('', |
@@ -1606,10 +1625,11 @@ discard block |
||
1606 | 1625 | ); |
1607 | 1626 | |
1608 | 1627 | // Does it need a fix? |
1609 | - if (!empty($test['check_type']) && $test['check_type'] == 'count') |
|
1610 | - list ($needs_fix) = $smcFunc['db_fetch_row']($request); |
|
1611 | - else |
|
1612 | - $needs_fix = $smcFunc['db_num_rows']($request); |
|
1628 | + if (!empty($test['check_type']) && $test['check_type'] == 'count') { |
|
1629 | + list ($needs_fix) = $smcFunc['db_fetch_row']($request); |
|
1630 | + } else { |
|
1631 | + $needs_fix = $smcFunc['db_num_rows']($request); |
|
1632 | + } |
|
1613 | 1633 | |
1614 | 1634 | $total_queries++; |
1615 | 1635 | |
@@ -1621,8 +1641,9 @@ discard block |
||
1621 | 1641 | // Assume need to fix. |
1622 | 1642 | $found_errors = true; |
1623 | 1643 | |
1624 | - if (isset($test['message'])) |
|
1625 | - $context['repair_errors'][] = $txt[$test['message']]; |
|
1644 | + if (isset($test['message'])) { |
|
1645 | + $context['repair_errors'][] = $txt[$test['message']]; |
|
1646 | + } |
|
1626 | 1647 | |
1627 | 1648 | // One per row! |
1628 | 1649 | elseif (isset($test['messages'])) |
@@ -1632,10 +1653,11 @@ discard block |
||
1632 | 1653 | $variables = $test['messages']; |
1633 | 1654 | foreach ($variables as $k => $v) |
1634 | 1655 | { |
1635 | - if ($k == 0 && isset($txt[$v])) |
|
1636 | - $variables[$k] = $txt[$v]; |
|
1637 | - elseif ($k > 0 && isset($row[$v])) |
|
1638 | - $variables[$k] = $row[$v]; |
|
1656 | + if ($k == 0 && isset($txt[$v])) { |
|
1657 | + $variables[$k] = $txt[$v]; |
|
1658 | + } elseif ($k > 0 && isset($row[$v])) { |
|
1659 | + $variables[$k] = $row[$v]; |
|
1660 | + } |
|
1639 | 1661 | } |
1640 | 1662 | $context['repair_errors'][] = call_user_func_array('sprintf', $variables); |
1641 | 1663 | } |
@@ -1646,13 +1668,15 @@ discard block |
||
1646 | 1668 | { |
1647 | 1669 | // Find out if there are actually errors. |
1648 | 1670 | $found_errors = false; |
1649 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1650 | - $found_errors |= $test['message_function']($row); |
|
1671 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1672 | + $found_errors |= $test['message_function']($row); |
|
1673 | + } |
|
1651 | 1674 | } |
1652 | 1675 | |
1653 | 1676 | // Actually have something to fix? |
1654 | - if ($found_errors) |
|
1655 | - $to_fix[] = $error_type; |
|
1677 | + if ($found_errors) { |
|
1678 | + $to_fix[] = $error_type; |
|
1679 | + } |
|
1656 | 1680 | } |
1657 | 1681 | |
1658 | 1682 | // We want to fix, we need to fix - so work out what exactly to do! |
@@ -1662,8 +1686,9 @@ discard block |
||
1662 | 1686 | if (isset($test['fix_collect'])) |
1663 | 1687 | { |
1664 | 1688 | $ids = array(); |
1665 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1666 | - $ids[] = $row[$test['fix_collect']['index']]; |
|
1689 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1690 | + $ids[] = $row[$test['fix_collect']['index']]; |
|
1691 | + } |
|
1667 | 1692 | if (!empty($ids)) |
1668 | 1693 | { |
1669 | 1694 | // Fix it! |
@@ -1672,30 +1697,34 @@ discard block |
||
1672 | 1697 | } |
1673 | 1698 | |
1674 | 1699 | // Simply executing a fix it query? |
1675 | - elseif (isset($test['fix_it_query'])) |
|
1676 | - $smcFunc['db_query']('', |
|
1700 | + elseif (isset($test['fix_it_query'])) { |
|
1701 | + $smcFunc['db_query']('', |
|
1677 | 1702 | $test['fix_it_query'], |
1678 | 1703 | array( |
1679 | 1704 | ) |
1680 | 1705 | ); |
1706 | + } |
|
1681 | 1707 | |
1682 | 1708 | // Do we have some processing to do? |
1683 | 1709 | elseif (isset($test['fix_processing'])) |
1684 | 1710 | { |
1685 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1686 | - $test['fix_processing']($row); |
|
1711 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1712 | + $test['fix_processing']($row); |
|
1713 | + } |
|
1687 | 1714 | } |
1688 | 1715 | |
1689 | 1716 | // What about the full set of processing? |
1690 | - elseif (isset($test['fix_full_processing'])) |
|
1691 | - $test['fix_full_processing']($request); |
|
1717 | + elseif (isset($test['fix_full_processing'])) { |
|
1718 | + $test['fix_full_processing']($request); |
|
1719 | + } |
|
1692 | 1720 | |
1693 | 1721 | // Do we have other things we need to fix as a result? |
1694 | 1722 | if (!empty($test['force_fix'])) |
1695 | 1723 | { |
1696 | - foreach ($test['force_fix'] as $item) |
|
1697 | - if (!in_array($item, $to_fix)) |
|
1724 | + foreach ($test['force_fix'] as $item) { |
|
1725 | + if (!in_array($item, $to_fix)) |
|
1698 | 1726 | $to_fix[] = $item; |
1727 | + } |
|
1699 | 1728 | } |
1700 | 1729 | } |
1701 | 1730 | } |
@@ -1713,16 +1742,17 @@ discard block |
||
1713 | 1742 | if ($_GET['substep'] <= $step_max) |
1714 | 1743 | { |
1715 | 1744 | pauseRepairProcess($to_fix, $error_type, $step_max); |
1745 | + } else { |
|
1746 | + $done = true; |
|
1716 | 1747 | } |
1717 | - else |
|
1718 | - $done = true; |
|
1748 | + } else { |
|
1749 | + $done = true; |
|
1719 | 1750 | } |
1720 | - else |
|
1721 | - $done = true; |
|
1722 | 1751 | |
1723 | 1752 | // Don't allow more than 1000 queries at a time. |
1724 | - if ($total_queries >= 1000) |
|
1725 | - pauseRepairProcess($to_fix, $error_type, $step_max, true); |
|
1753 | + if ($total_queries >= 1000) { |
|
1754 | + pauseRepairProcess($to_fix, $error_type, $step_max, true); |
|
1755 | + } |
|
1726 | 1756 | } |
1727 | 1757 | |
1728 | 1758 | // Keep going. |
@@ -1735,8 +1765,9 @@ discard block |
||
1735 | 1765 | if ($do_fix) |
1736 | 1766 | { |
1737 | 1767 | $key = array_search($error_type, $to_fix); |
1738 | - if ($key !== false && isset($to_fix[$key])) |
|
1739 | - unset($to_fix[$key]); |
|
1768 | + if ($key !== false && isset($to_fix[$key])) { |
|
1769 | + unset($to_fix[$key]); |
|
1770 | + } |
|
1740 | 1771 | } |
1741 | 1772 | |
1742 | 1773 | // Are we done? |
@@ -1759,10 +1790,11 @@ discard block |
||
1759 | 1790 | static $createOnce = false; |
1760 | 1791 | |
1761 | 1792 | // Have we already created it? |
1762 | - if ($createOnce) |
|
1763 | - return; |
|
1764 | - else |
|
1765 | - $createOnce = true; |
|
1793 | + if ($createOnce) { |
|
1794 | + return; |
|
1795 | + } else { |
|
1796 | + $createOnce = true; |
|
1797 | + } |
|
1766 | 1798 | |
1767 | 1799 | // Back to the forum's default language. |
1768 | 1800 | loadLanguage('Admin', $language); |
@@ -1777,8 +1809,9 @@ discard block |
||
1777 | 1809 | 'cat_name' => $txt['salvaged_category_name'], |
1778 | 1810 | ) |
1779 | 1811 | ); |
1780 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1781 | - list ($salvageCatID) = $smcFunc['db_fetch_row']($result); |
|
1812 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1813 | + list ($salvageCatID) = $smcFunc['db_fetch_row']($result); |
|
1814 | + } |
|
1782 | 1815 | $smcFunc['db_free_result']($result); |
1783 | 1816 | |
1784 | 1817 | if (empty($salvageCatID)) |
@@ -1810,8 +1843,9 @@ discard block |
||
1810 | 1843 | 'board_name' => $txt['salvaged_board_name'], |
1811 | 1844 | ) |
1812 | 1845 | ); |
1813 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1814 | - list ($salvageBoardID) = $smcFunc['db_fetch_row']($result); |
|
1846 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1847 | + list ($salvageBoardID) = $smcFunc['db_fetch_row']($result); |
|
1848 | + } |
|
1815 | 1849 | $smcFunc['db_free_result']($result); |
1816 | 1850 | |
1817 | 1851 | if (empty($salvageBoardID)) |
@@ -61,9 +61,10 @@ discard block |
||
61 | 61 | ', implode(', ', $context['administrators']); |
62 | 62 | |
63 | 63 | // If we have lots of admins... don't show them all. |
64 | - if (!empty($context['more_admins_link'])) |
|
65 | - echo ' |
|
64 | + if (!empty($context['more_admins_link'])) { |
|
65 | + echo ' |
|
66 | 66 | (', $context['more_admins_link'], ')'; |
67 | + } |
|
67 | 68 | |
68 | 69 | echo ' |
69 | 70 | </div><!-- #version_details --> |
@@ -80,17 +81,19 @@ discard block |
||
80 | 81 | foreach ($area['areas'] as $item_id => $item) |
81 | 82 | { |
82 | 83 | // No point showing the 'home' page here, we're already on it! |
83 | - if ($area_id == 'forum' && $item_id == 'index') |
|
84 | - continue; |
|
84 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
85 | + continue; |
|
86 | + } |
|
85 | 87 | |
86 | 88 | $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'] : ''); |
87 | 89 | |
88 | - if (!empty($item['icon_file'])) |
|
89 | - echo ' |
|
90 | + if (!empty($item['icon_file'])) { |
|
91 | + echo ' |
|
90 | 92 | <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>'; |
91 | - else |
|
92 | - echo ' |
|
93 | + } else { |
|
94 | + echo ' |
|
93 | 95 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
96 | + } |
|
94 | 97 | } |
95 | 98 | |
96 | 99 | echo ' |
@@ -98,10 +101,11 @@ discard block |
||
98 | 101 | } |
99 | 102 | |
100 | 103 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
101 | - if (empty($modSettings['disable_smf_js'])) |
|
102 | - echo ' |
|
104 | + if (empty($modSettings['disable_smf_js'])) { |
|
105 | + echo ' |
|
103 | 106 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
104 | 107 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
108 | + } |
|
105 | 109 | |
106 | 110 | // This sets the announcements and current versions themselves ;). |
107 | 111 | echo ' |
@@ -178,9 +182,10 @@ discard block |
||
178 | 182 | <em>', $version['version'], '</em>'; |
179 | 183 | |
180 | 184 | // more details for this item, show them a link |
181 | - if ($context['can_admin'] && isset($version['more'])) |
|
182 | - echo |
|
185 | + if ($context['can_admin'] && isset($version['more'])) { |
|
186 | + echo |
|
183 | 187 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
188 | + } |
|
184 | 189 | echo ' |
185 | 190 | <br>'; |
186 | 191 | } |
@@ -211,21 +216,23 @@ discard block |
||
211 | 216 | |
212 | 217 | foreach ($context['credits'] as $section) |
213 | 218 | { |
214 | - if (isset($section['pretext'])) |
|
215 | - echo ' |
|
219 | + if (isset($section['pretext'])) { |
|
220 | + echo ' |
|
216 | 221 | <p>', $section['pretext'], '</p> |
217 | 222 | <hr>'; |
223 | + } |
|
218 | 224 | |
219 | 225 | echo ' |
220 | 226 | <dl>'; |
221 | 227 | |
222 | 228 | foreach ($section['groups'] as $group) |
223 | 229 | { |
224 | - if (isset($group['title'])) |
|
225 | - echo ' |
|
230 | + if (isset($group['title'])) { |
|
231 | + echo ' |
|
226 | 232 | <dt> |
227 | 233 | <strong>', $group['title'], ':</strong> |
228 | 234 | </dt>'; |
235 | + } |
|
229 | 236 | |
230 | 237 | echo ' |
231 | 238 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -234,10 +241,11 @@ discard block |
||
234 | 241 | echo ' |
235 | 242 | </dl>'; |
236 | 243 | |
237 | - if (isset($section['posttext'])) |
|
238 | - echo ' |
|
244 | + if (isset($section['posttext'])) { |
|
245 | + echo ' |
|
239 | 246 | <hr> |
240 | 247 | <p>', $section['posttext'], '</p>'; |
248 | + } |
|
241 | 249 | } |
242 | 250 | |
243 | 251 | echo ' |
@@ -252,9 +260,10 @@ discard block |
||
252 | 260 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
253 | 261 | |
254 | 262 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
255 | - foreach ($context['current_versions'] as $variable => $version) |
|
256 | - echo ' |
|
263 | + foreach ($context['current_versions'] as $variable => $version) { |
|
264 | + echo ' |
|
257 | 265 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
266 | + } |
|
258 | 267 | |
259 | 268 | // Now we just have to include the script and wait ;). |
260 | 269 | echo ' |
@@ -350,8 +359,8 @@ discard block |
||
350 | 359 | <tbody>'; |
351 | 360 | |
352 | 361 | // Loop through every source file displaying its version - using javascript. |
353 | - foreach ($context['file_versions'] as $filename => $version) |
|
354 | - echo ' |
|
362 | + foreach ($context['file_versions'] as $filename => $version) { |
|
363 | + echo ' |
|
355 | 364 | <tr class="windowbg"> |
356 | 365 | <td class="half_table"> |
357 | 366 | ', $filename, ' |
@@ -363,6 +372,7 @@ discard block |
||
363 | 372 | <em id="currentSources', $filename, '">??</em> |
364 | 373 | </td> |
365 | 374 | </tr>'; |
375 | + } |
|
366 | 376 | |
367 | 377 | // Default template files. |
368 | 378 | echo ' |
@@ -388,8 +398,8 @@ discard block |
||
388 | 398 | <table id="Default" class="table_grid"> |
389 | 399 | <tbody>'; |
390 | 400 | |
391 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
392 | - echo ' |
|
401 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
402 | + echo ' |
|
393 | 403 | <tr class="windowbg"> |
394 | 404 | <td class="half_table"> |
395 | 405 | ', $filename, ' |
@@ -401,6 +411,7 @@ discard block |
||
401 | 411 | <em id="currentDefault', $filename, '">??</em> |
402 | 412 | </td> |
403 | 413 | </tr>'; |
414 | + } |
|
404 | 415 | |
405 | 416 | // Now the language files... |
406 | 417 | echo ' |
@@ -428,8 +439,8 @@ discard block |
||
428 | 439 | |
429 | 440 | foreach ($context['default_language_versions'] as $language => $files) |
430 | 441 | { |
431 | - foreach ($files as $filename => $version) |
|
432 | - echo ' |
|
442 | + foreach ($files as $filename => $version) { |
|
443 | + echo ' |
|
433 | 444 | <tr class="windowbg"> |
434 | 445 | <td class="half_table"> |
435 | 446 | ', $filename, '.<em>', $language, '</em>.php |
@@ -441,6 +452,7 @@ discard block |
||
441 | 452 | <em id="current', $filename, '.', $language, '">??</em> |
442 | 453 | </td> |
443 | 454 | </tr>'; |
455 | + } |
|
444 | 456 | } |
445 | 457 | |
446 | 458 | echo ' |
@@ -470,8 +482,8 @@ discard block |
||
470 | 482 | <table id="Templates" class="table_grid"> |
471 | 483 | <tbody>'; |
472 | 484 | |
473 | - foreach ($context['template_versions'] as $filename => $version) |
|
474 | - echo ' |
|
485 | + foreach ($context['template_versions'] as $filename => $version) { |
|
486 | + echo ' |
|
475 | 487 | <tr class="windowbg"> |
476 | 488 | <td class="half_table"> |
477 | 489 | ', $filename, ' |
@@ -483,6 +495,7 @@ discard block |
||
483 | 495 | <em id="currentTemplates', $filename, '">??</em> |
484 | 496 | </td> |
485 | 497 | </tr>'; |
498 | + } |
|
486 | 499 | |
487 | 500 | echo ' |
488 | 501 | </tbody> |
@@ -512,8 +525,8 @@ discard block |
||
512 | 525 | <table id="Tasks" class="table_grid"> |
513 | 526 | <tbody>'; |
514 | 527 | |
515 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
516 | - echo ' |
|
528 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
529 | + echo ' |
|
517 | 530 | <tr class="windowbg"> |
518 | 531 | <td class="half_table"> |
519 | 532 | ', $filename, ' |
@@ -525,6 +538,7 @@ discard block |
||
525 | 538 | <em id="currentTasks', $filename, '">??</em> |
526 | 539 | </td> |
527 | 540 | </tr>'; |
541 | + } |
|
528 | 542 | |
529 | 543 | echo ' |
530 | 544 | </tbody> |
@@ -565,9 +579,10 @@ discard block |
||
565 | 579 | { |
566 | 580 | global $context, $scripturl, $txt, $modSettings; |
567 | 581 | |
568 | - if (!empty($context['saved_successful'])) |
|
569 | - echo ' |
|
582 | + if (!empty($context['saved_successful'])) { |
|
583 | + echo ' |
|
570 | 584 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
585 | + } |
|
571 | 586 | |
572 | 587 | // First section is for adding/removing words from the censored list. |
573 | 588 | echo ' |
@@ -581,11 +596,12 @@ discard block |
||
581 | 596 | <p>', $txt['admin_censored_where'], '</p>'; |
582 | 597 | |
583 | 598 | // Show text boxes for censoring [bad ] => [good ]. |
584 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
585 | - echo ' |
|
599 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
600 | + echo ' |
|
586 | 601 | <div class="block"> |
587 | 602 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
588 | 603 | </div>'; |
604 | + } |
|
589 | 605 | |
590 | 606 | // Now provide a way to censor more words. |
591 | 607 | echo ' |
@@ -658,27 +674,30 @@ discard block |
||
658 | 674 | <div class="windowbg"> |
659 | 675 | ', $txt['not_done_reason']; |
660 | 676 | |
661 | - if (!empty($context['continue_percent'])) |
|
662 | - echo ' |
|
677 | + if (!empty($context['continue_percent'])) { |
|
678 | + echo ' |
|
663 | 679 | <div class="progress_bar"> |
664 | 680 | <span>', $context['continue_percent'], '%</span> |
665 | 681 | <div class="bar" style="width: ', $context['continue_percent'], '%;"></div> |
666 | 682 | </div>'; |
683 | + } |
|
667 | 684 | |
668 | - if (!empty($context['substep_enabled'])) |
|
669 | - echo ' |
|
685 | + if (!empty($context['substep_enabled'])) { |
|
686 | + echo ' |
|
670 | 687 | <div class="progress_bar progress_blue"> |
671 | 688 | <span>', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</span> |
672 | 689 | <div class="bar" style="width: ', $context['substep_continue_percent'], '%;"></div> |
673 | 690 | </div>'; |
691 | + } |
|
674 | 692 | |
675 | 693 | echo ' |
676 | 694 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">'; |
677 | 695 | |
678 | 696 | // Do we have a token? |
679 | - if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) |
|
680 | - echo ' |
|
697 | + if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) { |
|
698 | + echo ' |
|
681 | 699 | <input type="hidden" name="', $context[$context['not_done_token'] . '_token_var'], '" value="', $context[$context['not_done_token'] . '_token'], '">'; |
700 | + } |
|
682 | 701 | |
683 | 702 | echo ' |
684 | 703 | <input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button"> |
@@ -711,34 +730,39 @@ discard block |
||
711 | 730 | { |
712 | 731 | global $context, $txt, $scripturl; |
713 | 732 | |
714 | - if (!empty($context['saved_successful'])) |
|
715 | - echo ' |
|
733 | + if (!empty($context['saved_successful'])) { |
|
734 | + echo ' |
|
716 | 735 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
717 | - elseif (!empty($context['saved_failed'])) |
|
718 | - echo ' |
|
736 | + } elseif (!empty($context['saved_failed'])) { |
|
737 | + echo ' |
|
719 | 738 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
739 | + } |
|
720 | 740 | |
721 | - if (!empty($context['settings_pre_javascript'])) |
|
722 | - echo ' |
|
741 | + if (!empty($context['settings_pre_javascript'])) { |
|
742 | + echo ' |
|
723 | 743 | <script>', $context['settings_pre_javascript'], '</script>'; |
744 | + } |
|
724 | 745 | |
725 | - if (!empty($context['settings_insert_above'])) |
|
726 | - echo $context['settings_insert_above']; |
|
746 | + if (!empty($context['settings_insert_above'])) { |
|
747 | + echo $context['settings_insert_above']; |
|
748 | + } |
|
727 | 749 | |
728 | 750 | echo ' |
729 | 751 | <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'] . '"' : '', '>'; |
730 | 752 | |
731 | 753 | // Is there a custom title? |
732 | - if (isset($context['settings_title'])) |
|
733 | - echo ' |
|
754 | + if (isset($context['settings_title'])) { |
|
755 | + echo ' |
|
734 | 756 | <div class="cat_bar"> |
735 | 757 | <h3 class="catbg">', $context['settings_title'], '</h3> |
736 | 758 | </div>'; |
759 | + } |
|
737 | 760 | |
738 | 761 | // Have we got a message to display? |
739 | - if (!empty($context['settings_message'])) |
|
740 | - echo ' |
|
762 | + if (!empty($context['settings_message'])) { |
|
763 | + echo ' |
|
741 | 764 | <div class="information">', $context['settings_message'], '</div>'; |
765 | + } |
|
742 | 766 | |
743 | 767 | // Now actually loop through all the variables. |
744 | 768 | $is_open = false; |
@@ -791,8 +815,9 @@ discard block |
||
791 | 815 | // Hang about? Are you pulling my leg - a callback?! |
792 | 816 | if (is_array($config_var) && $config_var['type'] == 'callback') |
793 | 817 | { |
794 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
795 | - call_user_func('template_callback_' . $config_var['name']); |
|
818 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
819 | + call_user_func('template_callback_' . $config_var['name']); |
|
820 | + } |
|
796 | 821 | |
797 | 822 | continue; |
798 | 823 | } |
@@ -822,9 +847,10 @@ discard block |
||
822 | 847 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
823 | 848 | |
824 | 849 | // Show the [?] button. |
825 | - if ($config_var['help']) |
|
826 | - echo ' |
|
850 | + if ($config_var['help']) { |
|
851 | + echo ' |
|
827 | 852 | <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> '; |
853 | + } |
|
828 | 854 | |
829 | 855 | echo ' |
830 | 856 | <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> |
@@ -833,23 +859,26 @@ discard block |
||
833 | 859 | $config_var['preinput']; |
834 | 860 | |
835 | 861 | // Show a check box. |
836 | - if ($config_var['type'] == 'check') |
|
837 | - echo ' |
|
862 | + if ($config_var['type'] == 'check') { |
|
863 | + echo ' |
|
838 | 864 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">'; |
865 | + } |
|
839 | 866 | // Escape (via htmlspecialchars.) the text box. |
840 | - elseif ($config_var['type'] == 'password') |
|
841 | - echo ' |
|
867 | + elseif ($config_var['type'] == 'password') { |
|
868 | + echo ' |
|
842 | 869 | <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;"><br> |
843 | 870 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
871 | + } |
|
844 | 872 | // Show a selection box. |
845 | 873 | elseif ($config_var['type'] == 'select') |
846 | 874 | { |
847 | 875 | echo ' |
848 | 876 | <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'] . '"' : ''), '>'; |
849 | 877 | |
850 | - foreach ($config_var['data'] as $option) |
|
851 | - echo ' |
|
878 | + foreach ($config_var['data'] as $option) { |
|
879 | + echo ' |
|
852 | 880 | <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>'; |
881 | + } |
|
853 | 882 | echo ' |
854 | 883 | </select>'; |
855 | 884 | } |
@@ -866,16 +895,18 @@ discard block |
||
866 | 895 | |
867 | 896 | foreach ($context['board_list'] as $id_cat => $cat) |
868 | 897 | { |
869 | - if (!$first) |
|
870 | - echo ' |
|
898 | + if (!$first) { |
|
899 | + echo ' |
|
871 | 900 | <hr>'; |
901 | + } |
|
872 | 902 | echo ' |
873 | 903 | <strong>', $cat['name'], '</strong> |
874 | 904 | <ul>'; |
875 | 905 | |
876 | - foreach ($cat['boards'] as $id_board => $brd) |
|
877 | - echo ' |
|
906 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
907 | + echo ' |
|
878 | 908 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
909 | + } |
|
879 | 910 | |
880 | 911 | echo ' |
881 | 912 | </ul>'; |
@@ -885,12 +916,14 @@ discard block |
||
885 | 916 | </fieldset>'; |
886 | 917 | } |
887 | 918 | // Text area? |
888 | - elseif ($config_var['type'] == 'large_text') |
|
889 | - echo ' |
|
919 | + elseif ($config_var['type'] == 'large_text') { |
|
920 | + echo ' |
|
890 | 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 | + } |
|
891 | 923 | // Permission group? |
892 | - elseif ($config_var['type'] == 'permissions') |
|
893 | - theme_inline_permissions($config_var['name']); |
|
924 | + elseif ($config_var['type'] == 'permissions') { |
|
925 | + theme_inline_permissions($config_var['name']); |
|
926 | + } |
|
894 | 927 | |
895 | 928 | // BBC selection? |
896 | 929 | elseif ($config_var['type'] == 'bbc') |
@@ -902,22 +935,24 @@ discard block |
||
902 | 935 | |
903 | 936 | foreach ($context['bbc_columns'] as $bbcColumn) |
904 | 937 | { |
905 | - foreach ($bbcColumn as $bbcTag) |
|
906 | - echo ' |
|
938 | + foreach ($bbcColumn as $bbcTag) { |
|
939 | + echo ' |
|
907 | 940 | <li class="list_bbc floatleft"> |
908 | 941 | <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' : '', '> <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 | 942 | </li>'; |
943 | + } |
|
910 | 944 | } |
911 | 945 | echo ' </ul> |
912 | 946 | <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' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
913 | 947 | </fieldset>'; |
914 | 948 | } |
915 | 949 | // A simple message? |
916 | - elseif ($config_var['type'] == 'var_message') |
|
917 | - echo ' |
|
950 | + elseif ($config_var['type'] == 'var_message') { |
|
951 | + echo ' |
|
918 | 952 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '> |
919 | 953 | ', $config_var['var_message'], ' |
920 | 954 | </div>'; |
955 | + } |
|
921 | 956 | // Assume it must be a text box |
922 | 957 | else |
923 | 958 | { |
@@ -942,61 +977,69 @@ discard block |
||
942 | 977 | ' . $config_var['postinput'] : '',' |
943 | 978 | </dd>'; |
944 | 979 | } |
945 | - } |
|
946 | - else |
|
980 | + } else |
|
947 | 981 | { |
948 | 982 | // Just show a separator. |
949 | - if ($config_var == '') |
|
950 | - echo ' |
|
983 | + if ($config_var == '') { |
|
984 | + echo ' |
|
951 | 985 | </dl> |
952 | 986 | <hr> |
953 | 987 | <dl class="settings">'; |
954 | - else |
|
955 | - echo ' |
|
988 | + } else { |
|
989 | + echo ' |
|
956 | 990 | <dd> |
957 | 991 | <strong>' . $config_var . '</strong> |
958 | 992 | </dd>'; |
993 | + } |
|
959 | 994 | } |
960 | 995 | } |
961 | 996 | |
962 | - if ($is_open) |
|
963 | - echo ' |
|
997 | + if ($is_open) { |
|
998 | + echo ' |
|
964 | 999 | </dl>'; |
1000 | + } |
|
965 | 1001 | |
966 | - if (empty($context['settings_save_dont_show'])) |
|
967 | - echo ' |
|
1002 | + if (empty($context['settings_save_dont_show'])) { |
|
1003 | + echo ' |
|
968 | 1004 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">'; |
1005 | + } |
|
969 | 1006 | |
970 | - if ($is_open) |
|
971 | - echo ' |
|
1007 | + if ($is_open) { |
|
1008 | + echo ' |
|
972 | 1009 | </div><!-- .windowbg -->'; |
1010 | + } |
|
973 | 1011 | |
974 | 1012 | |
975 | 1013 | // At least one token has to be used! |
976 | - if (isset($context['admin-ssc_token'])) |
|
977 | - echo ' |
|
1014 | + if (isset($context['admin-ssc_token'])) { |
|
1015 | + echo ' |
|
978 | 1016 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
1017 | + } |
|
979 | 1018 | |
980 | - if (isset($context['admin-dbsc_token'])) |
|
981 | - echo ' |
|
1019 | + if (isset($context['admin-dbsc_token'])) { |
|
1020 | + echo ' |
|
982 | 1021 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
1022 | + } |
|
983 | 1023 | |
984 | - if (isset($context['admin-mp_token'])) |
|
985 | - echo ' |
|
1024 | + if (isset($context['admin-mp_token'])) { |
|
1025 | + echo ' |
|
986 | 1026 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1027 | + } |
|
987 | 1028 | |
988 | 1029 | echo ' |
989 | 1030 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
990 | 1031 | </form>'; |
991 | 1032 | |
992 | - if (!empty($context['settings_post_javascript'])) |
|
993 | - echo ' |
|
1033 | + if (!empty($context['settings_post_javascript'])) { |
|
1034 | + echo ' |
|
994 | 1035 | <script> |
995 | 1036 | ', $context['settings_post_javascript'], ' |
996 | 1037 | </script>'; |
1038 | + } |
|
997 | 1039 | |
998 | - if (!empty($context['settings_insert_below'])) |
|
999 | - echo $context['settings_insert_below']; |
|
1040 | + if (!empty($context['settings_insert_below'])) { |
|
1041 | + echo $context['settings_insert_below']; |
|
1042 | + } |
|
1000 | 1043 | |
1001 | 1044 | // We may have added a board listing. If we did, we need to make it work. |
1002 | 1045 | addInlineJavascript(' |
@@ -1019,9 +1062,10 @@ discard block |
||
1019 | 1062 | { |
1020 | 1063 | global $context, $txt; |
1021 | 1064 | |
1022 | - if (!empty($context['saved_successful'])) |
|
1023 | - echo ' |
|
1065 | + if (!empty($context['saved_successful'])) { |
|
1066 | + echo ' |
|
1024 | 1067 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1068 | + } |
|
1025 | 1069 | |
1026 | 1070 | // Standard fields. |
1027 | 1071 | template_show_list('standard_profile_fields'); |
@@ -1055,11 +1099,12 @@ discard block |
||
1055 | 1099 | { |
1056 | 1100 | loadLanguage('Errors'); |
1057 | 1101 | |
1058 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
1059 | - echo ' |
|
1102 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
1103 | + echo ' |
|
1060 | 1104 | <div class="errorbox">', |
1061 | 1105 | $txt['custom_option_' . $_GET['msg']], ' |
1062 | 1106 | </div>'; |
1107 | + } |
|
1063 | 1108 | } |
1064 | 1109 | |
1065 | 1110 | echo ' |
@@ -1125,9 +1170,10 @@ discard block |
||
1125 | 1170 | <dd> |
1126 | 1171 | <select name="placement" id="placement">'; |
1127 | 1172 | |
1128 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
1129 | - echo ' |
|
1173 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
1174 | + echo ' |
|
1130 | 1175 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1176 | + } |
|
1131 | 1177 | |
1132 | 1178 | echo ' |
1133 | 1179 | </select> |
@@ -1151,9 +1197,10 @@ discard block |
||
1151 | 1197 | <dd> |
1152 | 1198 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1153 | 1199 | |
1154 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
1155 | - echo ' |
|
1200 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
1201 | + echo ' |
|
1156 | 1202 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1203 | + } |
|
1157 | 1204 | |
1158 | 1205 | echo ' |
1159 | 1206 | </select> |
@@ -1185,9 +1232,10 @@ discard block |
||
1185 | 1232 | </dt> |
1186 | 1233 | <dd id="options_dd">'; |
1187 | 1234 | |
1188 | - foreach ($context['field']['options'] as $k => $option) |
|
1189 | - echo ' |
|
1235 | + foreach ($context['field']['options'] as $k => $option) { |
|
1236 | + echo ' |
|
1190 | 1237 | ', $k == 0 ? '' : '<br>', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked' : '', '><input type="text" name="select_option[', $k, ']" value="', $option, '">'; |
1238 | + } |
|
1191 | 1239 | |
1192 | 1240 | echo ' |
1193 | 1241 | <span id="addopt"></span> |
@@ -1251,9 +1299,10 @@ discard block |
||
1251 | 1299 | </fieldset> |
1252 | 1300 | <input type="submit" name="save" value="', $txt['save'], '" class="button">'; |
1253 | 1301 | |
1254 | - if ($context['fid']) |
|
1255 | - echo ' |
|
1302 | + if ($context['fid']) { |
|
1303 | + echo ' |
|
1256 | 1304 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">'; |
1305 | + } |
|
1257 | 1306 | |
1258 | 1307 | echo ' |
1259 | 1308 | </div><!-- .windowbg --> |
@@ -1299,8 +1348,7 @@ discard block |
||
1299 | 1348 | <p class="centertext"> |
1300 | 1349 | <strong>', $txt['admin_search_results_none'], '</strong> |
1301 | 1350 | </p>'; |
1302 | - } |
|
1303 | - else |
|
1351 | + } else |
|
1304 | 1352 | { |
1305 | 1353 | echo ' |
1306 | 1354 | <ol class="search_results">'; |
@@ -1327,9 +1375,10 @@ discard block |
||
1327 | 1375 | <li> |
1328 | 1376 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1329 | 1377 | |
1330 | - if ($result['help']) |
|
1331 | - echo ' |
|
1378 | + if ($result['help']) { |
|
1379 | + echo ' |
|
1332 | 1380 | <p class="double_height">', $result['help'], '</p>'; |
1381 | + } |
|
1333 | 1382 | |
1334 | 1383 | echo ' |
1335 | 1384 | </li>'; |
@@ -1369,10 +1418,11 @@ discard block |
||
1369 | 1418 | <strong>', $txt['setup_verification_answer'], '</strong> |
1370 | 1419 | </dd>'; |
1371 | 1420 | |
1372 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
1373 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1421 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
1422 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1374 | 1423 | { |
1375 | 1424 | $question = $context['question_answers'][$q_id]; |
1425 | + } |
|
1376 | 1426 | |
1377 | 1427 | echo ' |
1378 | 1428 | <dt> |
@@ -1380,9 +1430,10 @@ discard block |
||
1380 | 1430 | </dt> |
1381 | 1431 | <dd>'; |
1382 | 1432 | |
1383 | - foreach ($question['answers'] as $answer) |
|
1384 | - echo ' |
|
1433 | + foreach ($question['answers'] as $answer) { |
|
1434 | + echo ' |
|
1385 | 1435 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">'; |
1436 | + } |
|
1386 | 1437 | |
1387 | 1438 | echo ' |
1388 | 1439 | <div class="qa_add_answer"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1420,11 +1471,12 @@ discard block |
||
1420 | 1471 | ', $txt['errors_found'], ': |
1421 | 1472 | <ul>'; |
1422 | 1473 | |
1423 | - foreach ($context['repair_errors'] as $error) |
|
1424 | - echo ' |
|
1474 | + foreach ($context['repair_errors'] as $error) { |
|
1475 | + echo ' |
|
1425 | 1476 | <li> |
1426 | 1477 | ', $error, ' |
1427 | 1478 | </li>'; |
1479 | + } |
|
1428 | 1480 | |
1429 | 1481 | echo ' |
1430 | 1482 | </ul> |
@@ -1434,15 +1486,14 @@ discard block |
||
1434 | 1486 | <p class="padding"> |
1435 | 1487 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-repairboards_token_var'], '=', $context['admin-repairboards_token'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1436 | 1488 | </p>'; |
1437 | - } |
|
1438 | - else |
|
1439 | - echo ' |
|
1489 | + } else { |
|
1490 | + echo ' |
|
1440 | 1491 | <p>', $txt['maintain_no_errors'], '</p> |
1441 | 1492 | <p class="padding"> |
1442 | 1493 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1443 | 1494 | </p>'; |
1444 | - } |
|
1445 | - else |
|
1495 | + } |
|
1496 | + } else |
|
1446 | 1497 | { |
1447 | 1498 | if (!empty($context['redirect_to_recount'])) |
1448 | 1499 | { |
@@ -1455,8 +1506,7 @@ discard block |
||
1455 | 1506 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1456 | 1507 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1457 | 1508 | </form>'; |
1458 | - } |
|
1459 | - else |
|
1509 | + } else |
|
1460 | 1510 | { |
1461 | 1511 | echo ' |
1462 | 1512 | <p>', $txt['errors_fixed'], '</p> |
@@ -1546,9 +1596,10 @@ discard block |
||
1546 | 1596 | <tr class="windowbg"> |
1547 | 1597 | <td class="equal_table">', $key, '</td>'; |
1548 | 1598 | |
1549 | - foreach ($setting as $key_lm => $value) |
|
1550 | - echo ' |
|
1599 | + foreach ($setting as $key_lm => $value) { |
|
1600 | + echo ' |
|
1551 | 1601 | <td class="equal_table">', $value, '</td>'; |
1602 | + } |
|
1552 | 1603 | |
1553 | 1604 | echo ' |
1554 | 1605 | </tr>'; |
@@ -1608,8 +1659,8 @@ discard block |
||
1608 | 1659 | { |
1609 | 1660 | global $context, $txt; |
1610 | 1661 | |
1611 | - if ($context['user']['is_admin']) |
|
1612 | - echo ' |
|
1662 | + if ($context['user']['is_admin']) { |
|
1663 | + echo ' |
|
1613 | 1664 | <span class="floatright admin_search"> |
1614 | 1665 | <span class="generic_icons filter centericon"></span> |
1615 | 1666 | <input type="search" name="search_term" placeholder="', $txt['admin_search'], '"> |
@@ -1620,6 +1671,7 @@ discard block |
||
1620 | 1671 | </select> |
1621 | 1672 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button"> |
1622 | 1673 | </span>'; |
1623 | -} |
|
1674 | + } |
|
1675 | + } |
|
1624 | 1676 | |
1625 | 1677 | ?> |
1626 | 1678 | \ No newline at end of file |
@@ -18,11 +18,12 @@ discard block |
||
18 | 18 | global $context, $settings, $options, $scripturl, $modSettings, $txt; |
19 | 19 | |
20 | 20 | // Let them know why their message became unapproved. |
21 | - if ($context['becomesUnapproved']) |
|
22 | - echo ' |
|
21 | + if ($context['becomesUnapproved']) { |
|
22 | + echo ' |
|
23 | 23 | <div class="noticebox"> |
24 | 24 | ', $txt['post_becomesUnapproved'], ' |
25 | 25 | </div>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0)) |
28 | 29 | { |
@@ -46,17 +47,19 @@ discard block |
||
46 | 47 | </a>'; |
47 | 48 | |
48 | 49 | // Has it outstanding posts for approval? |
49 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
50 | - echo ' |
|
50 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
51 | + echo ' |
|
51 | 52 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
53 | + } |
|
52 | 54 | |
53 | 55 | echo ' |
54 | 56 | <p class="board_description">', $board['description'], '</p>'; |
55 | 57 | |
56 | 58 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
57 | - if (!empty($board['moderators']) || !empty($board['moderator_groups'])) |
|
58 | - echo ' |
|
59 | + if (!empty($board['moderators']) || !empty($board['moderator_groups'])) { |
|
60 | + echo ' |
|
59 | 61 | <p class="moderators">', count($board['link_moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
62 | + } |
|
60 | 63 | |
61 | 64 | // Show some basic information about the number of posts, etc. |
62 | 65 | echo ' |
@@ -67,9 +70,10 @@ discard block |
||
67 | 70 | </div> |
68 | 71 | <div class="lastpost ', !empty($board['last_post']['id']) ? 'lpr_border' : 'hidden', '">'; |
69 | 72 | |
70 | - if (!empty($board['last_post']['id'])) |
|
71 | - echo ' |
|
73 | + if (!empty($board['last_post']['id'])) { |
|
74 | + echo ' |
|
72 | 75 | <p>', $board['last_post']['last_post_message'], '</p>'; |
76 | + } |
|
73 | 77 | |
74 | 78 | echo ' |
75 | 79 | </div>'; |
@@ -83,14 +87,16 @@ discard block |
||
83 | 87 | id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
84 | 88 | foreach ($board['children'] as $child) |
85 | 89 | { |
86 | - if (!$child['is_redirect']) |
|
87 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
88 | - else |
|
89 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>'; |
|
90 | + if (!$child['is_redirect']) { |
|
91 | + $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
92 | + } else { |
|
93 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>'; |
|
94 | + } |
|
90 | 95 | |
91 | 96 | // Has it posts awaiting approval? |
92 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics'])) |
|
93 | - $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
97 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics'])) { |
|
98 | + $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
99 | + } |
|
94 | 100 | |
95 | 101 | $children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
96 | 102 | } |
@@ -112,11 +118,12 @@ discard block |
||
112 | 118 | if (!$context['no_topic_listing']) |
113 | 119 | { |
114 | 120 | // Mobile action buttons (top) |
115 | - if (!empty($context['normal_buttons'])) |
|
116 | - echo ' |
|
121 | + if (!empty($context['normal_buttons'])) { |
|
122 | + echo ' |
|
117 | 123 | <div class="mobile_buttons floatright"> |
118 | 124 | <a class="button mobile_act">', $txt['mobile_action'], '</a> |
119 | 125 | </div>'; |
126 | + } |
|
120 | 127 | |
121 | 128 | echo ' |
122 | 129 | <div class="pagesection"> |
@@ -135,13 +142,15 @@ discard block |
||
135 | 142 | <h3>', $context['name'], '</h3> |
136 | 143 | <p>'; |
137 | 144 | |
138 | - if ($context['description'] != '') |
|
139 | - echo ' |
|
145 | + if ($context['description'] != '') { |
|
146 | + echo ' |
|
140 | 147 | ', $context['description']; |
148 | + } |
|
141 | 149 | |
142 | - if (!empty($context['moderators'])) |
|
143 | - echo ' |
|
150 | + if (!empty($context['moderators'])) { |
|
151 | + echo ' |
|
144 | 152 | ', count($context['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $context['link_moderators']), '.'; |
153 | + } |
|
145 | 154 | |
146 | 155 | echo ' |
147 | 156 | </p> |
@@ -149,9 +158,10 @@ discard block |
||
149 | 158 | } |
150 | 159 | |
151 | 160 | // If Quick Moderation is enabled start the form. |
152 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) |
|
153 | - echo ' |
|
161 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) { |
|
162 | + echo ' |
|
154 | 163 | <form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">'; |
164 | + } |
|
155 | 165 | |
156 | 166 | echo ' |
157 | 167 | <div id="messageindex">'; |
@@ -161,11 +171,11 @@ discard block |
||
161 | 171 | echo ' |
162 | 172 | <div class="information">'; |
163 | 173 | |
164 | - if ($settings['display_who_viewing'] == 1) |
|
165 | - echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; |
|
166 | - |
|
167 | - else |
|
168 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
174 | + if ($settings['display_who_viewing'] == 1) { |
|
175 | + echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; |
|
176 | + } else { |
|
177 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
178 | + } |
|
169 | 179 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board']; |
170 | 180 | |
171 | 181 | echo ' |
@@ -185,32 +195,36 @@ discard block |
||
185 | 195 | <div class="lastpost">', $context['topics_headers']['last_post'], '</div>'; |
186 | 196 | |
187 | 197 | // Show a "select all" box for quick moderation? |
188 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) |
|
189 | - echo ' |
|
198 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
199 | + echo ' |
|
190 | 200 | <div class="moderation"> |
191 | 201 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
192 | 202 | </div>'; |
203 | + } |
|
193 | 204 | |
194 | 205 | // If it's on in "image" mode, don't show anything but the column. |
195 | - elseif (!empty($context['can_quick_mod'])) |
|
196 | - echo ' |
|
206 | + elseif (!empty($context['can_quick_mod'])) { |
|
207 | + echo ' |
|
197 | 208 | <div class="moderation"></div>'; |
209 | + } |
|
198 | 210 | } |
199 | 211 | |
200 | 212 | // No topics... just say, "sorry bub". |
201 | - else |
|
202 | - echo ' |
|
213 | + else { |
|
214 | + echo ' |
|
203 | 215 | <h3 class="titlebg">', $txt['topic_alert_none'], '</h3>'; |
216 | + } |
|
204 | 217 | |
205 | 218 | echo ' |
206 | 219 | </div><!-- #topic_header -->'; |
207 | 220 | |
208 | 221 | // If this person can approve items and we have some awaiting approval tell them. |
209 | - if (!empty($context['unapproved_posts_message'])) |
|
210 | - echo ' |
|
222 | + if (!empty($context['unapproved_posts_message'])) { |
|
223 | + echo ' |
|
211 | 224 | <div class="information"> |
212 | 225 | <span class="alert">!</span> ', $context['unapproved_posts_message'], ' |
213 | 226 | </div>'; |
227 | + } |
|
214 | 228 | |
215 | 229 | // Contain the topic list |
216 | 230 | echo ' |
@@ -231,25 +245,30 @@ discard block |
||
231 | 245 | echo ' |
232 | 246 | <div class="icons floatright">'; |
233 | 247 | |
234 | - if ($topic['is_watched']) |
|
235 | - echo ' |
|
248 | + if ($topic['is_watched']) { |
|
249 | + echo ' |
|
236 | 250 | <span class="generic_icons watch" title="', $txt['watching_this_topic'], '"></span>'; |
251 | + } |
|
237 | 252 | |
238 | - if ($topic['is_locked']) |
|
239 | - echo ' |
|
253 | + if ($topic['is_locked']) { |
|
254 | + echo ' |
|
240 | 255 | <span class="generic_icons lock"></span>'; |
256 | + } |
|
241 | 257 | |
242 | - if ($topic['is_sticky']) |
|
243 | - echo ' |
|
258 | + if ($topic['is_sticky']) { |
|
259 | + echo ' |
|
244 | 260 | <span class="generic_icons sticky"></span>'; |
261 | + } |
|
245 | 262 | |
246 | - if ($topic['is_redirect']) |
|
247 | - echo ' |
|
263 | + if ($topic['is_redirect']) { |
|
264 | + echo ' |
|
248 | 265 | <span class="generic_icons move"></span>'; |
266 | + } |
|
249 | 267 | |
250 | - if ($topic['is_poll']) |
|
251 | - echo ' |
|
268 | + if ($topic['is_poll']) { |
|
269 | + echo ' |
|
252 | 270 | <span class="generic_icons poll"></span>'; |
271 | + } |
|
253 | 272 | |
254 | 273 | echo ' |
255 | 274 | </div>'; |
@@ -281,26 +300,31 @@ discard block |
||
281 | 300 | echo ' |
282 | 301 | <div class="moderation">'; |
283 | 302 | |
284 | - if ($options['display_quick_mod'] == 1) |
|
285 | - echo ' |
|
303 | + if ($options['display_quick_mod'] == 1) { |
|
304 | + echo ' |
|
286 | 305 | <input type="checkbox" name="topics[]" value="', $topic['id'], '">'; |
287 | - else |
|
306 | + } else |
|
288 | 307 | { |
289 | 308 | // Check permissions on each and show only the ones they are allowed to use. |
290 | - if ($topic['quick_mod']['remove']) |
|
291 | - echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>'; |
|
309 | + if ($topic['quick_mod']['remove']) { |
|
310 | + echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>'; |
|
311 | + } |
|
292 | 312 | |
293 | - if ($topic['quick_mod']['lock']) |
|
294 | - echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>'; |
|
313 | + if ($topic['quick_mod']['lock']) { |
|
314 | + echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>'; |
|
315 | + } |
|
295 | 316 | |
296 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
297 | - echo '<br>'; |
|
317 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
318 | + echo '<br>'; |
|
319 | + } |
|
298 | 320 | |
299 | - if ($topic['quick_mod']['sticky']) |
|
300 | - echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>'; |
|
321 | + if ($topic['quick_mod']['sticky']) { |
|
322 | + echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>'; |
|
323 | + } |
|
301 | 324 | |
302 | - if ($topic['quick_mod']['move']) |
|
303 | - echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
|
325 | + if ($topic['quick_mod']['move']) { |
|
326 | + echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
|
327 | + } |
|
304 | 328 | } |
305 | 329 | echo ' |
306 | 330 | </div><!-- .moderation -->'; |
@@ -318,18 +342,20 @@ discard block |
||
318 | 342 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
319 | 343 | <option value="">--------</option>'; |
320 | 344 | |
321 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
322 | - if ($context['can_' . $qmod_action]) |
|
345 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
346 | + if ($context['can_' . $qmod_action]) |
|
323 | 347 | echo ' |
324 | 348 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
349 | + } |
|
325 | 350 | |
326 | 351 | echo ' |
327 | 352 | </select>'; |
328 | 353 | |
329 | 354 | // Show a list of boards they can move the topic to. |
330 | - if ($context['can_move']) |
|
331 | - echo ' |
|
355 | + if ($context['can_move']) { |
|
356 | + echo ' |
|
332 | 357 | <span id="quick_mod_jump_to"></span>'; |
358 | + } |
|
333 | 359 | |
334 | 360 | echo ' |
335 | 361 | <input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' && confirm(\'', $txt['quickmod_confirm'], '\');" class="button qaction"> |
@@ -340,17 +366,19 @@ discard block |
||
340 | 366 | </div><!-- #messageindex -->'; |
341 | 367 | |
342 | 368 | // Finish off the form - again. |
343 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) |
|
344 | - echo ' |
|
369 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) { |
|
370 | + echo ' |
|
345 | 371 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
346 | 372 | </form>'; |
373 | + } |
|
347 | 374 | |
348 | 375 | // Mobile action buttons (bottom) |
349 | - if (!empty($context['normal_buttons'])) |
|
350 | - echo ' |
|
376 | + if (!empty($context['normal_buttons'])) { |
|
377 | + echo ' |
|
351 | 378 | <div class="mobile_buttons floatright"> |
352 | 379 | <a class="button mobile_act">', $txt['mobile_action'], '</a> |
353 | 380 | </div>'; |
381 | + } |
|
354 | 382 | |
355 | 383 | echo ' |
356 | 384 | <div class="pagesection"> |
@@ -366,8 +394,8 @@ discard block |
||
366 | 394 | // Show breadcrumbs at the bottom too. |
367 | 395 | theme_linktree(); |
368 | 396 | |
369 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
370 | - echo ' |
|
397 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
398 | + echo ' |
|
371 | 399 | <script> |
372 | 400 | if (typeof(window.XMLHttpRequest) != "undefined") |
373 | 401 | aJumpTo[aJumpTo.length] = new JumpTo({ |
@@ -386,6 +414,7 @@ discard block |
||
386 | 414 | sCustomName: "move_to" |
387 | 415 | }); |
388 | 416 | </script>'; |
417 | + } |
|
389 | 418 | |
390 | 419 | // Javascript for inline editing. |
391 | 420 | echo ' |
@@ -422,8 +451,8 @@ discard block |
||
422 | 451 | <div class="information"> |
423 | 452 | <p class="floatright" id="message_index_jump_to"></p>'; |
424 | 453 | |
425 | - if (empty($context['no_topic_listing'])) |
|
426 | - echo ' |
|
454 | + if (empty($context['no_topic_listing'])) { |
|
455 | + echo ' |
|
427 | 456 | <p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? ' |
428 | 457 | <img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="" class="centericon"> ' . $txt['participation_caption'] . '<br>' : '', ' |
429 | 458 | '. ($modSettings['pollMode'] == '1' ? '<span class="generic_icons poll centericon"></span> ' . $txt['poll'] : '') . '<br> |
@@ -433,9 +462,10 @@ discard block |
||
433 | 462 | <span class="generic_icons lock centericon"></span> ' . $txt['locked_topic'] . '<br> |
434 | 463 | <span class="generic_icons sticky centericon"></span> ' . $txt['sticky_topic'] . '<br> |
435 | 464 | </p>'; |
465 | + } |
|
436 | 466 | |
437 | - if (!empty($context['jump_to'])) |
|
438 | - echo ' |
|
467 | + if (!empty($context['jump_to'])) { |
|
468 | + echo ' |
|
439 | 469 | <script> |
440 | 470 | if (typeof(window.XMLHttpRequest) != "undefined") |
441 | 471 | aJumpTo[aJumpTo.length] = new JumpTo({ |
@@ -451,6 +481,7 @@ discard block |
||
451 | 481 | sGoButtonLabel: "', $txt['quick_mod_go'], '" |
452 | 482 | }); |
453 | 483 | </script>'; |
484 | + } |
|
454 | 485 | |
455 | 486 | echo ' |
456 | 487 | <br class="clear"> |