@@ -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. |
@@ -72,8 +74,7 @@ discard block |
||
72 | 74 | { |
73 | 75 | echo ' |
74 | 76 | <div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
75 | - } |
|
76 | - else |
|
77 | + } else |
|
77 | 78 | { |
78 | 79 | foreach ($context['unread_pms'] as $id_pm => $pm_details) |
79 | 80 | { |
@@ -194,14 +195,15 @@ discard block |
||
194 | 195 | if ($context['get_pmessage']('message', true)) |
195 | 196 | { |
196 | 197 | // Show the helpful titlebar - generally. |
197 | - if ($context['display_mode'] != 1) |
|
198 | - echo ' |
|
198 | + if ($context['display_mode'] != 1) { |
|
199 | + echo ' |
|
199 | 200 | <div class="cat_bar"> |
200 | 201 | <h3 class="catbg"> |
201 | 202 | <span id="author">', $txt['author'], '</span> |
202 | 203 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
203 | 204 | </h3> |
204 | 205 | </div>'; |
206 | + } |
|
205 | 207 | |
206 | 208 | // Show a few buttons if we are in conversation mode and outputting the first message. |
207 | 209 | if ($context['display_mode'] == 2) |
@@ -230,9 +232,10 @@ discard block |
||
230 | 232 | <div class="custom_fields_above_member"> |
231 | 233 | <ul class="nolist">'; |
232 | 234 | |
233 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
234 | - echo ' |
|
235 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
236 | + echo ' |
|
235 | 237 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
238 | + } |
|
236 | 239 | |
237 | 240 | echo ' |
238 | 241 | </ul> |
@@ -244,25 +247,28 @@ discard block |
||
244 | 247 | <a id="msg', $message['id'], '"></a>'; |
245 | 248 | |
246 | 249 | // Show online and offline buttons? |
247 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
248 | - echo ' |
|
250 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
251 | + echo ' |
|
249 | 252 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
253 | + } |
|
250 | 254 | |
251 | 255 | // Custom fields BEFORE the username? |
252 | - if (!empty($message['custom_fields']['before_member'])) |
|
253 | - 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) |
|
254 | 258 | echo ' |
255 | 259 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
260 | + } |
|
256 | 261 | |
257 | 262 | // Show a link to the member's profile. |
258 | 263 | echo ' |
259 | 264 | ', $message['member']['link']; |
260 | 265 | |
261 | 266 | // Custom fields AFTER the username? |
262 | - if (!empty($message['custom_fields']['after_member'])) |
|
263 | - 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) |
|
264 | 269 | echo ' |
265 | 270 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
271 | + } |
|
266 | 272 | |
267 | 273 | echo ' |
268 | 274 | </h4>'; |
@@ -271,48 +277,56 @@ discard block |
||
271 | 277 | <ul class="user_info">'; |
272 | 278 | |
273 | 279 | // Show the user's avatar. |
274 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
275 | - echo ' |
|
280 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
281 | + echo ' |
|
276 | 282 | <li class="avatar"> |
277 | 283 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
278 | 284 | </li>'; |
285 | + } |
|
279 | 286 | |
280 | 287 | // Are there any custom fields below the avatar? |
281 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
282 | - 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) |
|
283 | 290 | echo ' |
284 | 291 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
292 | + } |
|
285 | 293 | |
286 | - if (!$message['member']['is_guest']) |
|
287 | - echo ' |
|
294 | + if (!$message['member']['is_guest']) { |
|
295 | + echo ' |
|
288 | 296 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
297 | + } |
|
289 | 298 | // Show the member's primary group (like 'Administrator') if they have one. |
290 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
291 | - echo ' |
|
299 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
300 | + echo ' |
|
292 | 301 | <li class="membergroup">', $message['member']['group'], '</li>'; |
302 | + } |
|
293 | 303 | |
294 | 304 | // Show the member's custom title, if they have one. |
295 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
296 | - echo ' |
|
305 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
306 | + echo ' |
|
297 | 307 | <li class="title">', $message['member']['title'], '</li>'; |
308 | + } |
|
298 | 309 | |
299 | 310 | // Don't show these things for guests. |
300 | 311 | if (!$message['member']['is_guest']) |
301 | 312 | { |
302 | 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. |
303 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
304 | - echo ' |
|
314 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
315 | + echo ' |
|
305 | 316 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
317 | + } |
|
306 | 318 | |
307 | 319 | // Show how many posts they have made. |
308 | - if (!isset($context['disabled_fields']['posts'])) |
|
309 | - echo ' |
|
320 | + if (!isset($context['disabled_fields']['posts'])) { |
|
321 | + echo ' |
|
310 | 322 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
323 | + } |
|
311 | 324 | |
312 | 325 | // Show their personal text? |
313 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
314 | - echo ' |
|
326 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
327 | + echo ' |
|
315 | 328 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
329 | + } |
|
316 | 330 | |
317 | 331 | // Any custom fields to show as icons? |
318 | 332 | if (!empty($message['custom_fields']['icons'])) |
@@ -321,9 +335,10 @@ discard block |
||
321 | 335 | <li class="im_icons"> |
322 | 336 | <ol>'; |
323 | 337 | |
324 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
325 | - echo ' |
|
338 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
339 | + echo ' |
|
326 | 340 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
341 | + } |
|
327 | 342 | |
328 | 343 | echo ' |
329 | 344 | </ol> |
@@ -331,19 +346,22 @@ discard block |
||
331 | 346 | } |
332 | 347 | |
333 | 348 | // Show the IP to this user for this post - because you can moderate? |
334 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
335 | - echo ' |
|
349 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
350 | + echo ' |
|
336 | 351 | <li class="poster_ip"><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></li>'; |
352 | + } |
|
337 | 353 | |
338 | 354 | // Or, should we show it because this is you? |
339 | - elseif ($message['can_see_ip']) |
|
340 | - echo ' |
|
355 | + elseif ($message['can_see_ip']) { |
|
356 | + echo ' |
|
341 | 357 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
358 | + } |
|
342 | 359 | |
343 | 360 | // Okay, you are logged in, then we can show something about why IPs are logged... |
344 | - else |
|
345 | - echo ' |
|
361 | + else { |
|
362 | + echo ' |
|
346 | 363 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
364 | + } |
|
347 | 365 | |
348 | 366 | // Show the profile, website, email address, and personal message buttons. |
349 | 367 | if ($message['member']['show_profile_buttons']) |
@@ -353,24 +371,28 @@ discard block |
||
353 | 371 | <ol class="profile_icons">'; |
354 | 372 | |
355 | 373 | // Show the profile button |
356 | - if ($message['member']['can_view_profile']) |
|
357 | - echo ' |
|
374 | + if ($message['member']['can_view_profile']) { |
|
375 | + echo ' |
|
358 | 376 | <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>'; |
377 | + } |
|
359 | 378 | |
360 | 379 | // Don't show an icon if they haven't specified a website. |
361 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
362 | - echo ' |
|
380 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
381 | + echo ' |
|
363 | 382 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
383 | + } |
|
364 | 384 | |
365 | 385 | // Don't show the email address if they want it hidden. |
366 | - if ($message['member']['show_email']) |
|
367 | - echo ' |
|
386 | + if ($message['member']['show_email']) { |
|
387 | + echo ' |
|
368 | 388 | <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>'; |
389 | + } |
|
369 | 390 | |
370 | 391 | // Since we know this person isn't a guest, you *can* message them. |
371 | - if ($context['can_send_pm']) |
|
372 | - echo ' |
|
392 | + if ($context['can_send_pm']) { |
|
393 | + echo ' |
|
373 | 394 | <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>'; |
395 | + } |
|
374 | 396 | |
375 | 397 | echo ' |
376 | 398 | </ol> |
@@ -378,21 +400,24 @@ discard block |
||
378 | 400 | } |
379 | 401 | |
380 | 402 | // Any custom fields for standard placement? |
381 | - if (!empty($message['custom_fields']['standard'])) |
|
382 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
403 | + if (!empty($message['custom_fields']['standard'])) { |
|
404 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
383 | 405 | echo ' |
384 | 406 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
407 | + } |
|
385 | 408 | |
386 | 409 | // Are we showing the warning status? |
387 | - if ($message['member']['can_see_warning']) |
|
388 | - echo ' |
|
410 | + if ($message['member']['can_see_warning']) { |
|
411 | + echo ' |
|
389 | 412 | <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>'; |
413 | + } |
|
390 | 414 | |
391 | 415 | // Are there any custom fields to show at the bottom of the poster info? |
392 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
393 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
416 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
417 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
394 | 418 | echo ' |
395 | 419 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
420 | + } |
|
396 | 421 | } |
397 | 422 | |
398 | 423 | // Done with the information about the poster... on to the post itself. |
@@ -411,25 +436,29 @@ discard block |
||
411 | 436 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
412 | 437 | |
413 | 438 | // People it was sent directly to.... |
414 | - if (!empty($message['recipients']['to'])) |
|
415 | - echo implode(', ', $message['recipients']['to']); |
|
439 | + if (!empty($message['recipients']['to'])) { |
|
440 | + echo implode(', ', $message['recipients']['to']); |
|
441 | + } |
|
416 | 442 | |
417 | 443 | // Otherwise, we're just going to say "some people"... |
418 | - elseif ($context['folder'] != 'sent') |
|
419 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
444 | + elseif ($context['folder'] != 'sent') { |
|
445 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
446 | + } |
|
420 | 447 | |
421 | 448 | echo ' |
422 | 449 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
423 | 450 | </span>'; |
424 | 451 | |
425 | 452 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
426 | - if (!empty($message['recipients']['bcc'])) |
|
427 | - echo ' |
|
453 | + if (!empty($message['recipients']['bcc'])) { |
|
454 | + echo ' |
|
428 | 455 | <br><span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
456 | + } |
|
429 | 457 | |
430 | - if (!empty($message['is_replied_to'])) |
|
431 | - echo ' |
|
458 | + if (!empty($message['is_replied_to'])) { |
|
459 | + echo ' |
|
432 | 460 | <br><span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
461 | + } |
|
433 | 462 | |
434 | 463 | echo ' |
435 | 464 | </div><!-- .keyinfo --> |
@@ -437,13 +466,15 @@ discard block |
||
437 | 466 | <div class="post"> |
438 | 467 | <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>'; |
439 | 468 | |
440 | - if ($message['can_report'] || $context['can_send_pm']) |
|
441 | - echo ' |
|
469 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
470 | + echo ' |
|
442 | 471 | <div class="under_message">'; |
472 | + } |
|
443 | 473 | |
444 | - if ($message['can_report']) |
|
445 | - echo ' |
|
474 | + if ($message['can_report']) { |
|
475 | + echo ' |
|
446 | 476 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
477 | + } |
|
447 | 478 | |
448 | 479 | echo ' |
449 | 480 | <ul class="quickbuttons">'; |
@@ -455,32 +486,36 @@ discard block |
||
455 | 486 | if (!$message['member']['is_guest']) |
456 | 487 | { |
457 | 488 | // Is there than more than one recipient you can reply to? |
458 | - if ($message['number_recipients'] > 1) |
|
459 | - echo ' |
|
489 | + if ($message['number_recipients'] > 1) { |
|
490 | + echo ' |
|
460 | 491 | <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>'; |
492 | + } |
|
461 | 493 | |
462 | 494 | echo ' |
463 | 495 | <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> |
464 | 496 | <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>'; |
465 | 497 | } |
466 | 498 | // This is for "forwarding" - even if the member is gone. |
467 | - else |
|
468 | - echo ' |
|
499 | + else { |
|
500 | + echo ' |
|
469 | 501 | <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>'; |
502 | + } |
|
470 | 503 | } |
471 | 504 | echo ' |
472 | 505 | <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>'; |
473 | 506 | |
474 | - if (empty($context['display_mode'])) |
|
475 | - echo ' |
|
507 | + if (empty($context['display_mode'])) { |
|
508 | + echo ' |
|
476 | 509 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>'; |
510 | + } |
|
477 | 511 | |
478 | 512 | echo ' |
479 | 513 | </ul>'; |
480 | 514 | |
481 | - if ($message['can_report'] || $context['can_send_pm']) |
|
482 | - echo ' |
|
515 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
516 | + echo ' |
|
483 | 517 | </div><!-- .under_message -->'; |
518 | + } |
|
484 | 519 | |
485 | 520 | // Are there any custom profile fields for above the signature? |
486 | 521 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -489,9 +524,10 @@ discard block |
||
489 | 524 | <div class="custom_fields_above_signature"> |
490 | 525 | <ul class="nolist">'; |
491 | 526 | |
492 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
493 | - echo ' |
|
527 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
528 | + echo ' |
|
494 | 529 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
530 | + } |
|
495 | 531 | |
496 | 532 | echo ' |
497 | 533 | </ul> |
@@ -499,9 +535,10 @@ discard block |
||
499 | 535 | } |
500 | 536 | |
501 | 537 | // Show the member's signature? |
502 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
503 | - echo ' |
|
538 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
539 | + echo ' |
|
504 | 540 | <div class="signature">', $message['member']['signature'], '</div>'; |
541 | + } |
|
505 | 542 | |
506 | 543 | // Are there any custom profile fields for below the signature? |
507 | 544 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -510,9 +547,10 @@ discard block |
||
510 | 547 | <div class="custom_fields_below_signature"> |
511 | 548 | <ul class="nolist">'; |
512 | 549 | |
513 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
514 | - echo ' |
|
550 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
551 | + echo ' |
|
515 | 552 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
553 | + } |
|
516 | 554 | |
517 | 555 | echo ' |
518 | 556 | </ul> |
@@ -539,10 +577,11 @@ discard block |
||
539 | 577 | echo ' |
540 | 578 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
541 | 579 | |
542 | - foreach ($context['labels'] as $label) |
|
543 | - if (!isset($message['labels'][$label['id']])) |
|
580 | + foreach ($context['labels'] as $label) { |
|
581 | + if (!isset($message['labels'][$label['id']])) |
|
544 | 582 | echo ' |
545 | 583 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
584 | + } |
|
546 | 585 | } |
547 | 586 | |
548 | 587 | // ... and are there any that can be removed? |
@@ -551,9 +590,10 @@ discard block |
||
551 | 590 | echo ' |
552 | 591 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
553 | 592 | |
554 | - foreach ($message['labels'] as $label) |
|
555 | - echo ' |
|
593 | + foreach ($message['labels'] as $label) { |
|
594 | + echo ' |
|
556 | 595 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
596 | + } |
|
557 | 597 | } |
558 | 598 | echo ' |
559 | 599 | </select> |
@@ -572,8 +612,8 @@ discard block |
||
572 | 612 | </div><!-- .windowbg -->'; |
573 | 613 | } |
574 | 614 | |
575 | - if (empty($context['display_mode'])) |
|
576 | - echo ' |
|
615 | + if (empty($context['display_mode'])) { |
|
616 | + echo ' |
|
577 | 617 | |
578 | 618 | <div class="pagesection"> |
579 | 619 | <div class="floatleft">', $context['page_index'], '</div> |
@@ -581,6 +621,7 @@ discard block |
||
581 | 621 | <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button"> |
582 | 622 | </div> |
583 | 623 | </div>'; |
624 | + } |
|
584 | 625 | |
585 | 626 | // Show a few buttons if we are in conversation mode and outputting the first message. |
586 | 627 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -641,11 +682,12 @@ discard block |
||
641 | 682 | </thead> |
642 | 683 | <tbody>'; |
643 | 684 | |
644 | - if (!$context['show_delete']) |
|
645 | - echo ' |
|
685 | + if (!$context['show_delete']) { |
|
686 | + echo ' |
|
646 | 687 | <tr class="windowbg"> |
647 | 688 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
648 | 689 | </tr>'; |
690 | + } |
|
649 | 691 | |
650 | 692 | while ($message = $context['get_pmessage']('subject')) |
651 | 693 | { |
@@ -705,9 +747,10 @@ discard block |
||
705 | 747 | |
706 | 748 | foreach ($context['labels'] as $label) |
707 | 749 | { |
708 | - if ($label['id'] != $context['current_label_id']) |
|
709 | - echo ' |
|
750 | + if ($label['id'] != $context['current_label_id']) { |
|
751 | + echo ' |
|
710 | 752 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
753 | + } |
|
711 | 754 | } |
712 | 755 | |
713 | 756 | echo ' |
@@ -793,9 +836,10 @@ discard block |
||
793 | 836 | <dd>', $txt['pm_search_between'], ' <input type="number" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" min="0" max="9999"> ', $txt['pm_search_between_and'], ' <input type="number" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" min="0" max="9999"> ', $txt['pm_search_between_days'], '</dd> |
794 | 837 | </dl>'; |
795 | 838 | |
796 | - if (!$context['currently_using_labels']) |
|
797 | - echo ' |
|
839 | + if (!$context['currently_using_labels']) { |
|
840 | + echo ' |
|
798 | 841 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button">'; |
842 | + } |
|
799 | 843 | |
800 | 844 | echo ' |
801 | 845 | <br class="clear_right"> |
@@ -816,12 +860,13 @@ discard block |
||
816 | 860 | <div id="advanced_panel_div"> |
817 | 861 | <ul id="searchLabelsExpand">'; |
818 | 862 | |
819 | - foreach ($context['search_labels'] as $label) |
|
820 | - echo ' |
|
863 | + foreach ($context['search_labels'] as $label) { |
|
864 | + echo ' |
|
821 | 865 | <li> |
822 | 866 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '> |
823 | 867 | ', $label['name'], '</label> |
824 | 868 | </li>'; |
869 | + } |
|
825 | 870 | |
826 | 871 | echo ' |
827 | 872 | </ul> |
@@ -883,8 +928,8 @@ discard block |
||
883 | 928 | </div>'; |
884 | 929 | |
885 | 930 | // complete results ? |
886 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
887 | - echo ' |
|
931 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
932 | + echo ' |
|
888 | 933 | <table class="table_grid"> |
889 | 934 | <thead> |
890 | 935 | <tr class="title_bar"> |
@@ -894,6 +939,7 @@ discard block |
||
894 | 939 | </tr> |
895 | 940 | </thead> |
896 | 941 | <tbody>'; |
942 | + } |
|
897 | 943 | |
898 | 944 | // Print each message out... |
899 | 945 | foreach ($context['personal_messages'] as $message) |
@@ -913,12 +959,14 @@ discard block |
||
913 | 959 | |
914 | 960 | // Show the recipients. |
915 | 961 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
916 | - if (!empty($message['recipients']['to'])) |
|
917 | - echo implode(', ', $message['recipients']['to']); |
|
962 | + if (!empty($message['recipients']['to'])) { |
|
963 | + echo implode(', ', $message['recipients']['to']); |
|
964 | + } |
|
918 | 965 | |
919 | 966 | // Otherwise, we're just going to say "some people"... |
920 | - elseif ($context['folder'] != 'sent') |
|
921 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
967 | + elseif ($context['folder'] != 'sent') { |
|
968 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
969 | + } |
|
922 | 970 | |
923 | 971 | echo ' |
924 | 972 | </h3> |
@@ -933,15 +981,17 @@ discard block |
||
933 | 981 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
934 | 982 | |
935 | 983 | // You can only reply if they are not a guest... |
936 | - if (!$message['member']['is_guest']) |
|
937 | - echo ' |
|
984 | + if (!$message['member']['is_guest']) { |
|
985 | + echo ' |
|
938 | 986 | <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'], ' |
939 | 987 | <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']; |
988 | + } |
|
940 | 989 | |
941 | 990 | // This is for "forwarding" - even if the member is gone. |
942 | - else |
|
943 | - echo ' |
|
991 | + else { |
|
992 | + echo ' |
|
944 | 993 | <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']; |
994 | + } |
|
945 | 995 | } |
946 | 996 | |
947 | 997 | echo ' |
@@ -962,17 +1012,19 @@ discard block |
||
962 | 1012 | } |
963 | 1013 | |
964 | 1014 | // Finish off the page... |
965 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
966 | - echo ' |
|
1015 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
1016 | + echo ' |
|
967 | 1017 | </tbody> |
968 | 1018 | </table>'; |
1019 | + } |
|
969 | 1020 | |
970 | 1021 | // No results? |
971 | - if (empty($context['personal_messages'])) |
|
972 | - echo ' |
|
1022 | + if (empty($context['personal_messages'])) { |
|
1023 | + echo ' |
|
973 | 1024 | <div class="windowbg"> |
974 | 1025 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
975 | 1026 | </div>'; |
1027 | + } |
|
976 | 1028 | |
977 | 1029 | echo ' |
978 | 1030 | <div class="pagesection"> |
@@ -997,15 +1049,17 @@ discard block |
||
997 | 1049 | </div> |
998 | 1050 | <div class="windowbg">'; |
999 | 1051 | |
1000 | - if (!empty($context['send_log']['sent'])) |
|
1001 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
1052 | + if (!empty($context['send_log']['sent'])) { |
|
1053 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
1002 | 1054 | echo ' |
1003 | 1055 | <span class="error">', $log_entry, '</span><br>'; |
1056 | + } |
|
1004 | 1057 | |
1005 | - if (!empty($context['send_log']['failed'])) |
|
1006 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
1058 | + if (!empty($context['send_log']['failed'])) { |
|
1059 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
1007 | 1060 | echo ' |
1008 | 1061 | <span class="error">', $log_entry, '</span><br>'; |
1062 | + } |
|
1009 | 1063 | |
1010 | 1064 | echo ' |
1011 | 1065 | </div> |
@@ -1054,12 +1108,13 @@ discard block |
||
1054 | 1108 | </dl> |
1055 | 1109 | </div>'; |
1056 | 1110 | |
1057 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
1058 | - echo ' |
|
1111 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
1112 | + echo ' |
|
1059 | 1113 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
1060 | 1114 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
1061 | 1115 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
1062 | 1116 | </div>'; |
1117 | + } |
|
1063 | 1118 | |
1064 | 1119 | echo ' |
1065 | 1120 | <dl id="post_header">'; |
@@ -1115,9 +1170,10 @@ discard block |
||
1115 | 1170 | } |
1116 | 1171 | |
1117 | 1172 | // What about smileys? |
1118 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
1119 | - echo ' |
|
1173 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
1174 | + echo ' |
|
1120 | 1175 | <div id="smileyBox_message"></div>'; |
1176 | + } |
|
1121 | 1177 | |
1122 | 1178 | // Show BBC buttons, smileys and textbox. |
1123 | 1179 | echo ' |
@@ -1164,10 +1220,11 @@ discard block |
||
1164 | 1220 | <dt><strong>', $txt['subject'], '</strong></dt> |
1165 | 1221 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
1166 | 1222 | |
1167 | - foreach ($context['drafts'] as $draft) |
|
1168 | - echo ' |
|
1223 | + foreach ($context['drafts'] as $draft) { |
|
1224 | + echo ' |
|
1169 | 1225 | <dt>', $draft['link'], '</dt> |
1170 | 1226 | <dd>', $draft['poster_time'], '</dd>'; |
1227 | + } |
|
1171 | 1228 | echo ' |
1172 | 1229 | </dl> |
1173 | 1230 | </div>'; |
@@ -1274,8 +1331,8 @@ discard block |
||
1274 | 1331 | }'; |
1275 | 1332 | |
1276 | 1333 | // Code for showing and hiding drafts |
1277 | - if (!empty($context['drafts'])) |
|
1278 | - echo ' |
|
1334 | + if (!empty($context['drafts'])) { |
|
1335 | + echo ' |
|
1279 | 1336 | var oSwapDraftOptions = new smc_Toggle({ |
1280 | 1337 | bToggleEnabled: true, |
1281 | 1338 | bCurrentlyCollapsed: true, |
@@ -1297,13 +1354,14 @@ discard block |
||
1297 | 1354 | } |
1298 | 1355 | ] |
1299 | 1356 | });'; |
1357 | + } |
|
1300 | 1358 | |
1301 | 1359 | echo ' |
1302 | 1360 | </script>'; |
1303 | 1361 | |
1304 | 1362 | // Show the message you're replying to. |
1305 | - if ($context['reply']) |
|
1306 | - echo ' |
|
1363 | + if ($context['reply']) { |
|
1364 | + echo ' |
|
1307 | 1365 | <br><br> |
1308 | 1366 | <div class="cat_bar"> |
1309 | 1367 | <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
@@ -1317,6 +1375,7 @@ discard block |
||
1317 | 1375 | ', $context['quoted_message']['body'], ' |
1318 | 1376 | </div> |
1319 | 1377 | <br class="clear">'; |
1378 | + } |
|
1320 | 1379 | |
1321 | 1380 | echo ' |
1322 | 1381 | <script> |
@@ -1328,23 +1387,25 @@ discard block |
||
1328 | 1387 | sToControlId: \'to_control\', |
1329 | 1388 | aToRecipients: ['; |
1330 | 1389 | |
1331 | - foreach ($context['recipients']['to'] as $i => $member) |
|
1332 | - echo ' |
|
1390 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
1391 | + echo ' |
|
1333 | 1392 | { |
1334 | 1393 | sItemId: ', JavaScriptEscape($member['id']), ', |
1335 | 1394 | sItemName: ', JavaScriptEscape($member['name']), ' |
1336 | 1395 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
1396 | + } |
|
1337 | 1397 | |
1338 | 1398 | echo ' |
1339 | 1399 | ], |
1340 | 1400 | aBccRecipients: ['; |
1341 | 1401 | |
1342 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
1343 | - echo ' |
|
1402 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
1403 | + echo ' |
|
1344 | 1404 | { |
1345 | 1405 | sItemId: ', JavaScriptEscape($member['id']), ', |
1346 | 1406 | sItemName: ', JavaScriptEscape($member['name']), ' |
1347 | 1407 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
1408 | + } |
|
1348 | 1409 | |
1349 | 1410 | echo ' |
1350 | 1411 | ], |
@@ -1433,26 +1494,28 @@ discard block |
||
1433 | 1494 | </th> |
1434 | 1495 | <th class="centertext table_icon">'; |
1435 | 1496 | |
1436 | - if (count($context['labels']) > 2) |
|
1437 | - echo ' |
|
1497 | + if (count($context['labels']) > 2) { |
|
1498 | + echo ' |
|
1438 | 1499 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1500 | + } |
|
1439 | 1501 | |
1440 | 1502 | echo ' |
1441 | 1503 | </th> |
1442 | 1504 | </tr> |
1443 | 1505 | </thead> |
1444 | 1506 | <tbody>'; |
1445 | - if (count($context['labels']) < 2) |
|
1446 | - echo ' |
|
1507 | + if (count($context['labels']) < 2) { |
|
1508 | + echo ' |
|
1447 | 1509 | <tr class="windowbg"> |
1448 | 1510 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
1449 | 1511 | </tr>'; |
1450 | - else |
|
1512 | + } else |
|
1451 | 1513 | { |
1452 | 1514 | foreach ($context['labels'] as $label) |
1453 | 1515 | { |
1454 | - if ($label['id'] == -1) |
|
1455 | - continue; |
|
1516 | + if ($label['id'] == -1) { |
|
1517 | + continue; |
|
1518 | + } |
|
1456 | 1519 | |
1457 | 1520 | echo ' |
1458 | 1521 | <tr class="windowbg"> |
@@ -1467,12 +1530,13 @@ discard block |
||
1467 | 1530 | </tbody> |
1468 | 1531 | </table>'; |
1469 | 1532 | |
1470 | - if (!count($context['labels']) < 2) |
|
1471 | - echo ' |
|
1533 | + if (!count($context['labels']) < 2) { |
|
1534 | + echo ' |
|
1472 | 1535 | <div class="padding"> |
1473 | 1536 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1474 | 1537 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
1475 | 1538 | </div>'; |
1539 | + } |
|
1476 | 1540 | |
1477 | 1541 | echo ' |
1478 | 1542 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1528,9 +1592,10 @@ discard block |
||
1528 | 1592 | <dd> |
1529 | 1593 | <select name="id_admin"> |
1530 | 1594 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
1531 | - foreach ($context['admins'] as $id => $name) |
|
1532 | - echo ' |
|
1595 | + foreach ($context['admins'] as $id => $name) { |
|
1596 | + echo ' |
|
1533 | 1597 | <option value="', $id, '">', $name, '</option>'; |
1598 | + } |
|
1534 | 1599 | echo ' |
1535 | 1600 | </select> |
1536 | 1601 | </dd>'; |
@@ -1592,9 +1657,10 @@ discard block |
||
1592 | 1657 | </th> |
1593 | 1658 | <th class="centertext table_icon">'; |
1594 | 1659 | |
1595 | - if (!empty($context['rules'])) |
|
1596 | - echo ' |
|
1660 | + if (!empty($context['rules'])) { |
|
1661 | + echo ' |
|
1597 | 1662 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1663 | + } |
|
1598 | 1664 | |
1599 | 1665 | echo ' |
1600 | 1666 | </th> |
@@ -1602,13 +1668,14 @@ discard block |
||
1602 | 1668 | </thead> |
1603 | 1669 | <tbody>'; |
1604 | 1670 | |
1605 | - if (empty($context['rules'])) |
|
1606 | - echo ' |
|
1671 | + if (empty($context['rules'])) { |
|
1672 | + echo ' |
|
1607 | 1673 | <tr class="windowbg"> |
1608 | 1674 | <td colspan="2"> |
1609 | 1675 | ', $txt['pm_rules_none'], ' |
1610 | 1676 | </td> |
1611 | 1677 | </tr>'; |
1678 | + } |
|
1612 | 1679 | |
1613 | 1680 | foreach ($context['rules'] as $rule) |
1614 | 1681 | { |
@@ -1629,14 +1696,16 @@ discard block |
||
1629 | 1696 | <div class="righttext"> |
1630 | 1697 | <a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
1631 | 1698 | |
1632 | - if (!empty($context['rules'])) |
|
1633 | - echo ' |
|
1699 | + if (!empty($context['rules'])) { |
|
1700 | + echo ' |
|
1634 | 1701 | [<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>]'; |
1702 | + } |
|
1635 | 1703 | |
1636 | - if (!empty($context['rules'])) |
|
1637 | - echo ' |
|
1704 | + if (!empty($context['rules'])) { |
|
1705 | + echo ' |
|
1638 | 1706 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1639 | 1707 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
1708 | + } |
|
1640 | 1709 | |
1641 | 1710 | echo ' |
1642 | 1711 | </div> |
@@ -1658,14 +1727,16 @@ discard block |
||
1658 | 1727 | var groups = new Array() |
1659 | 1728 | var labels = new Array()'; |
1660 | 1729 | |
1661 | - foreach ($context['groups'] as $id => $title) |
|
1662 | - echo ' |
|
1730 | + foreach ($context['groups'] as $id => $title) { |
|
1731 | + echo ' |
|
1663 | 1732 | groups[', $id, '] = "', addslashes($title), '";'; |
1733 | + } |
|
1664 | 1734 | |
1665 | - foreach ($context['labels'] as $label) |
|
1666 | - if ($label['id'] != -1) |
|
1735 | + foreach ($context['labels'] as $label) { |
|
1736 | + if ($label['id'] != -1) |
|
1667 | 1737 | echo ' |
1668 | 1738 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
1739 | + } |
|
1669 | 1740 | |
1670 | 1741 | echo ' |
1671 | 1742 | function addCriteriaOption() |
@@ -1680,8 +1751,9 @@ discard block |
||
1680 | 1751 | |
1681 | 1752 | 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>'; |
1682 | 1753 | |
1683 | - foreach ($context['groups'] as $id => $group) |
|
1684 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1754 | + foreach ($context['groups'] as $id => $group) { |
|
1755 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1756 | + } |
|
1685 | 1757 | |
1686 | 1758 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
1687 | 1759 | } |
@@ -1698,9 +1770,10 @@ discard block |
||
1698 | 1770 | |
1699 | 1771 | 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>'; |
1700 | 1772 | |
1701 | - foreach ($context['labels'] as $label) |
|
1702 | - if ($label['id'] != -1) |
|
1773 | + foreach ($context['labels'] as $label) { |
|
1774 | + if ($label['id'] != -1) |
|
1703 | 1775 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
1776 | + } |
|
1704 | 1777 | |
1705 | 1778 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
1706 | 1779 | } |
@@ -1814,19 +1887,20 @@ discard block |
||
1814 | 1887 | $isFirst = true; |
1815 | 1888 | foreach ($context['rule']['criteria'] as $k => $criteria) |
1816 | 1889 | { |
1817 | - if (!$isFirst && $criteria['t'] == '') |
|
1818 | - echo '<div id="removeonjs1">'; |
|
1819 | - |
|
1820 | - elseif (!$isFirst) |
|
1821 | - echo '<br>'; |
|
1890 | + if (!$isFirst && $criteria['t'] == '') { |
|
1891 | + echo '<div id="removeonjs1">'; |
|
1892 | + } elseif (!$isFirst) { |
|
1893 | + echo '<br>'; |
|
1894 | + } |
|
1822 | 1895 | |
1823 | 1896 | echo ' |
1824 | 1897 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
1825 | 1898 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
1826 | 1899 | |
1827 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
1828 | - echo ' |
|
1900 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
1901 | + echo ' |
|
1829 | 1902 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
1903 | + } |
|
1830 | 1904 | |
1831 | 1905 | echo ' |
1832 | 1906 | </select> |
@@ -1837,19 +1911,20 @@ discard block |
||
1837 | 1911 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
1838 | 1912 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
1839 | 1913 | |
1840 | - foreach ($context['groups'] as $id => $group) |
|
1841 | - echo ' |
|
1914 | + foreach ($context['groups'] as $id => $group) { |
|
1915 | + echo ' |
|
1842 | 1916 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
1917 | + } |
|
1843 | 1918 | echo ' |
1844 | 1919 | </select> |
1845 | 1920 | </span>'; |
1846 | 1921 | |
1847 | 1922 | // If this is the dummy we add a means to hide for non js users. |
1848 | - if ($isFirst) |
|
1849 | - $isFirst = false; |
|
1850 | - |
|
1851 | - elseif ($criteria['t'] == '') |
|
1852 | - echo '</div><!-- .removeonjs1 -->'; |
|
1923 | + if ($isFirst) { |
|
1924 | + $isFirst = false; |
|
1925 | + } elseif ($criteria['t'] == '') { |
|
1926 | + echo '</div><!-- .removeonjs1 -->'; |
|
1927 | + } |
|
1853 | 1928 | } |
1854 | 1929 | |
1855 | 1930 | echo ' |
@@ -1872,10 +1947,11 @@ discard block |
||
1872 | 1947 | $isFirst = true; |
1873 | 1948 | foreach ($context['rule']['actions'] as $k => $action) |
1874 | 1949 | { |
1875 | - if (!$isFirst && $action['t'] == '') |
|
1876 | - echo '<div id="removeonjs2">'; |
|
1877 | - elseif (!$isFirst) |
|
1878 | - echo '<br>'; |
|
1950 | + if (!$isFirst && $action['t'] == '') { |
|
1951 | + echo '<div id="removeonjs2">'; |
|
1952 | + } elseif (!$isFirst) { |
|
1953 | + echo '<br>'; |
|
1954 | + } |
|
1879 | 1955 | |
1880 | 1956 | echo ' |
1881 | 1957 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1887,19 +1963,21 @@ discard block |
||
1887 | 1963 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
1888 | 1964 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
1889 | 1965 | |
1890 | - foreach ($context['labels'] as $label) |
|
1891 | - if ($label['id'] != -1) |
|
1966 | + foreach ($context['labels'] as $label) { |
|
1967 | + if ($label['id'] != -1) |
|
1892 | 1968 | echo ' |
1893 | 1969 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
1970 | + } |
|
1894 | 1971 | |
1895 | 1972 | echo ' |
1896 | 1973 | </select> |
1897 | 1974 | </span>'; |
1898 | 1975 | |
1899 | - if ($isFirst) |
|
1900 | - $isFirst = false; |
|
1901 | - elseif ($action['t'] == '') |
|
1902 | - echo '</div><!-- .removeonjs2 -->'; |
|
1976 | + if ($isFirst) { |
|
1977 | + $isFirst = false; |
|
1978 | + } elseif ($action['t'] == '') { |
|
1979 | + echo '</div><!-- .removeonjs2 -->'; |
|
1980 | + } |
|
1903 | 1981 | } |
1904 | 1982 | |
1905 | 1983 | echo ' |
@@ -1923,22 +2001,25 @@ discard block |
||
1923 | 2001 | echo ' |
1924 | 2002 | <script>'; |
1925 | 2003 | |
1926 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
1927 | - echo ' |
|
2004 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
2005 | + echo ' |
|
1928 | 2006 | updateRuleDef(', $k, ');'; |
2007 | + } |
|
1929 | 2008 | |
1930 | - foreach ($context['rule']['actions'] as $k => $c) |
|
1931 | - echo ' |
|
2009 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
2010 | + echo ' |
|
1932 | 2011 | updateActionDef(', $k, ');'; |
2012 | + } |
|
1933 | 2013 | |
1934 | 2014 | echo ' |
1935 | 2015 | rebuildRuleDesc();'; |
1936 | 2016 | |
1937 | 2017 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
1938 | - if ($context['rid']) |
|
1939 | - echo ' |
|
2018 | + if ($context['rid']) { |
|
2019 | + echo ' |
|
1940 | 2020 | document.getElementById("removeonjs1").style.display = "none"; |
1941 | 2021 | document.getElementById("removeonjs2").style.display = "none";'; |
2022 | + } |
|
1942 | 2023 | |
1943 | 2024 | echo ' |
1944 | 2025 | document.getElementById("addonjs1").style.display = ""; |
@@ -1966,12 +2047,12 @@ discard block |
||
1966 | 2047 | </div>'; |
1967 | 2048 | |
1968 | 2049 | // No drafts? Just show an informative message. |
1969 | - if (empty($context['drafts'])) |
|
1970 | - echo ' |
|
2050 | + if (empty($context['drafts'])) { |
|
2051 | + echo ' |
|
1971 | 2052 | <div class="windowbg2 centertext"> |
1972 | 2053 | ', $txt['draft_none'], ' |
1973 | 2054 | </div>'; |
1974 | - else |
|
2055 | + } else |
|
1975 | 2056 | { |
1976 | 2057 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
1977 | 2058 | foreach ($context['drafts'] as $draft) |
@@ -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.) |
@@ -102,8 +104,7 @@ discard block |
||
102 | 104 | if (empty($context['unread_alerts'])) |
103 | 105 | { |
104 | 106 | template_alerts_all_read(); |
105 | - } |
|
106 | - else |
|
107 | + } else |
|
107 | 108 | { |
108 | 109 | foreach ($context['unread_alerts'] as $id_alert => $details) |
109 | 110 | { |
@@ -164,10 +165,11 @@ discard block |
||
164 | 165 | <div class="custom_fields_above_name"> |
165 | 166 | <ul>'; |
166 | 167 | |
167 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
168 | - if (!empty($field['output_html'])) |
|
168 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
169 | + if (!empty($field['output_html'])) |
|
169 | 170 | echo ' |
170 | 171 | <li>', $field['output_html'], '</li>'; |
172 | + } |
|
171 | 173 | |
172 | 174 | echo ' |
173 | 175 | </ul> |
@@ -179,20 +181,22 @@ discard block |
||
179 | 181 | <div class="username clear"> |
180 | 182 | <h4>'; |
181 | 183 | |
182 | - if (!empty($context['print_custom_fields']['before_member'])) |
|
183 | - foreach ($context['print_custom_fields']['before_member'] as $field) |
|
184 | + if (!empty($context['print_custom_fields']['before_member'])) { |
|
185 | + foreach ($context['print_custom_fields']['before_member'] as $field) |
|
184 | 186 | if (!empty($field['output_html'])) |
185 | 187 | echo ' |
186 | 188 | <span>', $field['output_html'], '</span>'; |
189 | + } |
|
187 | 190 | |
188 | 191 | echo ' |
189 | 192 | ', $context['member']['name']; |
190 | 193 | |
191 | - if (!empty($context['print_custom_fields']['after_member'])) |
|
192 | - foreach ($context['print_custom_fields']['after_member'] as $field) |
|
194 | + if (!empty($context['print_custom_fields']['after_member'])) { |
|
195 | + foreach ($context['print_custom_fields']['after_member'] as $field) |
|
193 | 196 | if (!empty($field['output_html'])) |
194 | 197 | echo ' |
195 | 198 | <span>', $field['output_html'], '</span>'; |
199 | + } |
|
196 | 200 | |
197 | 201 | |
198 | 202 | echo ' |
@@ -208,10 +212,11 @@ discard block |
||
208 | 212 | <div class="custom_fields_below_avatar"> |
209 | 213 | <ul>'; |
210 | 214 | |
211 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
212 | - if (!empty($field['output_html'])) |
|
215 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
216 | + if (!empty($field['output_html'])) |
|
213 | 217 | echo ' |
214 | 218 | <li>', $field['output_html'], '</li>'; |
219 | + } |
|
215 | 220 | |
216 | 221 | echo ' |
217 | 222 | </ul> |
@@ -223,22 +228,25 @@ discard block |
||
223 | 228 | <ul class="clear">'; |
224 | 229 | |
225 | 230 | // Email is only visible if it's your profile or you have the moderate_forum permission |
226 | - if ($context['member']['show_email']) |
|
227 | - echo ' |
|
231 | + if ($context['member']['show_email']) { |
|
232 | + echo ' |
|
228 | 233 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
234 | + } |
|
229 | 235 | |
230 | 236 | // Don't show an icon if they haven't specified a website. |
231 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
232 | - echo ' |
|
237 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
238 | + echo ' |
|
233 | 239 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
240 | + } |
|
234 | 241 | |
235 | 242 | // Are there any custom profile fields as icons? |
236 | 243 | if (!empty($context['print_custom_fields']['icons'])) |
237 | 244 | { |
238 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
239 | - if (!empty($field['output_html'])) |
|
245 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
246 | + if (!empty($field['output_html'])) |
|
240 | 247 | echo ' |
241 | 248 | <li class="custom_field">', $field['output_html'], '</li>'; |
249 | + } |
|
242 | 250 | } |
243 | 251 | |
244 | 252 | echo ' |
@@ -247,24 +255,27 @@ discard block |
||
247 | 255 | ', $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>' : ''; |
248 | 256 | |
249 | 257 | // Can they add this member as a buddy? |
250 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
251 | - echo ' |
|
258 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
259 | + echo ' |
|
252 | 260 | <br> |
253 | 261 | <a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
262 | + } |
|
254 | 263 | |
255 | 264 | echo ' |
256 | 265 | </span>'; |
257 | 266 | |
258 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
259 | - echo ' |
|
267 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
268 | + echo ' |
|
260 | 269 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
270 | + } |
|
261 | 271 | |
262 | 272 | echo ' |
263 | 273 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
264 | 274 | |
265 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
266 | - echo ' |
|
275 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
276 | + echo ' |
|
267 | 277 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
278 | + } |
|
268 | 279 | |
269 | 280 | echo ' |
270 | 281 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -276,10 +287,11 @@ discard block |
||
276 | 287 | <div class="custom_fields_bottom"> |
277 | 288 | <ul class="nolist">'; |
278 | 289 | |
279 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
280 | - if (!empty($field['output_html'])) |
|
290 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
291 | + if (!empty($field['output_html'])) |
|
281 | 292 | echo ' |
282 | 293 | <li>', $field['output_html'], '</li>'; |
294 | + } |
|
283 | 295 | |
284 | 296 | echo ' |
285 | 297 | </ul> |
@@ -292,15 +304,17 @@ discard block |
||
292 | 304 | <div id="detailedinfo"> |
293 | 305 | <dl class="settings">'; |
294 | 306 | |
295 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
296 | - echo ' |
|
307 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
308 | + echo ' |
|
297 | 309 | <dt>', $txt['username'], ': </dt> |
298 | 310 | <dd>', $context['member']['username'], '</dd>'; |
311 | + } |
|
299 | 312 | |
300 | - if (!isset($context['disabled_fields']['posts'])) |
|
301 | - echo ' |
|
313 | + if (!isset($context['disabled_fields']['posts'])) { |
|
314 | + echo ' |
|
302 | 315 | <dt>', $txt['profile_posts'], ': </dt> |
303 | 316 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
317 | + } |
|
304 | 318 | |
305 | 319 | if ($context['member']['show_email']) |
306 | 320 | { |
@@ -309,15 +323,17 @@ discard block |
||
309 | 323 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
310 | 324 | } |
311 | 325 | |
312 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
313 | - echo ' |
|
326 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
327 | + echo ' |
|
314 | 328 | <dt>', $txt['custom_title'], ': </dt> |
315 | 329 | <dd>', $context['member']['title'], '</dd>'; |
330 | + } |
|
316 | 331 | |
317 | - if (!empty($context['member']['blurb'])) |
|
318 | - echo ' |
|
332 | + if (!empty($context['member']['blurb'])) { |
|
333 | + echo ' |
|
319 | 334 | <dt>', $txt['personal_text'], ': </dt> |
320 | 335 | <dd>', $context['member']['blurb'], '</dd>'; |
336 | + } |
|
321 | 337 | |
322 | 338 | echo ' |
323 | 339 | <dt>', $txt['age'], ':</dt> |
@@ -331,19 +347,21 @@ discard block |
||
331 | 347 | { |
332 | 348 | $fields = array(); |
333 | 349 | |
334 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
335 | - if (!empty($field['output_html'])) |
|
350 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
351 | + if (!empty($field['output_html'])) |
|
336 | 352 | $fields[] = $field; |
353 | + } |
|
337 | 354 | |
338 | 355 | if (count($fields) > 0) |
339 | 356 | { |
340 | 357 | echo ' |
341 | 358 | <dl class="settings">'; |
342 | 359 | |
343 | - foreach ($fields as $field) |
|
344 | - echo ' |
|
360 | + foreach ($fields as $field) { |
|
361 | + echo ' |
|
345 | 362 | <dt>', $field['name'], ':</dt> |
346 | 363 | <dd>', $field['output_html'], '</dd>'; |
364 | + } |
|
347 | 365 | |
348 | 366 | echo ' |
349 | 367 | </dl>'; |
@@ -363,9 +381,10 @@ discard block |
||
363 | 381 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
364 | 382 | |
365 | 383 | // Can we provide information on what this means? |
366 | - if (!empty($context['warning_status'])) |
|
367 | - echo ' |
|
384 | + if (!empty($context['warning_status'])) { |
|
385 | + echo ' |
|
368 | 386 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
387 | + } |
|
369 | 388 | |
370 | 389 | echo ' |
371 | 390 | </dd>'; |
@@ -376,9 +395,10 @@ discard block |
||
376 | 395 | { |
377 | 396 | |
378 | 397 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
379 | - if (!empty($context['activate_message'])) |
|
380 | - echo ' |
|
398 | + if (!empty($context['activate_message'])) { |
|
399 | + echo ' |
|
381 | 400 | <dt class="clear"><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>)</dt>'; |
401 | + } |
|
382 | 402 | |
383 | 403 | // If the current member is banned, show a message and possibly a link to the ban. |
384 | 404 | if (!empty($context['member']['bans'])) |
@@ -390,10 +410,11 @@ discard block |
||
390 | 410 | <dt class="clear" id="ban_info" style="display: none;"> |
391 | 411 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
392 | 412 | |
393 | - foreach ($context['member']['bans'] as $ban) |
|
394 | - echo ' |
|
413 | + foreach ($context['member']['bans'] as $ban) { |
|
414 | + echo ' |
|
395 | 415 | <br> |
396 | 416 | <span class="smalltext">', $ban['explanation'], '</span>'; |
417 | + } |
|
397 | 418 | |
398 | 419 | echo ' |
399 | 420 | </dt>'; |
@@ -407,30 +428,34 @@ discard block |
||
407 | 428 | // If the person looking is allowed, they can check the members IP address and hostname. |
408 | 429 | if ($context['can_see_ip']) |
409 | 430 | { |
410 | - if (!empty($context['member']['ip'])) |
|
411 | - echo ' |
|
431 | + if (!empty($context['member']['ip'])) { |
|
432 | + echo ' |
|
412 | 433 | <dt>', $txt['ip'], ': </dt> |
413 | 434 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
435 | + } |
|
414 | 436 | |
415 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
416 | - echo ' |
|
437 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
438 | + echo ' |
|
417 | 439 | <dt>', $txt['hostname'], ': </dt> |
418 | 440 | <dd>', $context['member']['hostname'], '</dd>'; |
441 | + } |
|
419 | 442 | } |
420 | 443 | |
421 | 444 | echo ' |
422 | 445 | <dt>', $txt['local_time'], ':</dt> |
423 | 446 | <dd>', $context['member']['local_time'], '</dd>'; |
424 | 447 | |
425 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
426 | - echo ' |
|
448 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
449 | + echo ' |
|
427 | 450 | <dt>', $txt['language'], ':</dt> |
428 | 451 | <dd>', $context['member']['language'], '</dd>'; |
452 | + } |
|
429 | 453 | |
430 | - if ($context['member']['show_last_login']) |
|
431 | - echo ' |
|
454 | + if ($context['member']['show_last_login']) { |
|
455 | + echo ' |
|
432 | 456 | <dt>', $txt['lastLoggedIn'], ': </dt> |
433 | 457 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
458 | + } |
|
434 | 459 | |
435 | 460 | echo ' |
436 | 461 | </dl>'; |
@@ -442,10 +467,11 @@ discard block |
||
442 | 467 | <div class="custom_fields_above_signature"> |
443 | 468 | <ul class="nolist">'; |
444 | 469 | |
445 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
446 | - if (!empty($field['output_html'])) |
|
470 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
471 | + if (!empty($field['output_html'])) |
|
447 | 472 | echo ' |
448 | 473 | <li>', $field['output_html'], '</li>'; |
474 | + } |
|
449 | 475 | |
450 | 476 | echo ' |
451 | 477 | </ul> |
@@ -453,12 +479,13 @@ discard block |
||
453 | 479 | } |
454 | 480 | |
455 | 481 | // Show the users signature. |
456 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
457 | - echo ' |
|
482 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
483 | + echo ' |
|
458 | 484 | <div class="signature"> |
459 | 485 | <h5>', $txt['signature'], ':</h5> |
460 | 486 | ', $context['member']['signature'], ' |
461 | 487 | </div>'; |
488 | + } |
|
462 | 489 | |
463 | 490 | // Are there any custom profile fields for below the signature? |
464 | 491 | if (!empty($context['print_custom_fields']['below_signature'])) |
@@ -467,10 +494,11 @@ discard block |
||
467 | 494 | <div class="custom_fields_below_signature"> |
468 | 495 | <ul class="nolist">'; |
469 | 496 | |
470 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
471 | - if (!empty($field['output_html'])) |
|
497 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
498 | + if (!empty($field['output_html'])) |
|
472 | 499 | echo ' |
473 | 500 | <li>', $field['output_html'], '</li>'; |
501 | + } |
|
474 | 502 | |
475 | 503 | echo ' |
476 | 504 | </ul> |
@@ -516,62 +544,70 @@ discard block |
||
516 | 544 | </div> |
517 | 545 | <div class="list_posts">'; |
518 | 546 | |
519 | - if (!$post['approved']) |
|
520 | - echo ' |
|
547 | + if (!$post['approved']) { |
|
548 | + echo ' |
|
521 | 549 | <div class="approve_post"> |
522 | 550 | <em>', $txt['post_awaiting_approval'], '</em> |
523 | 551 | </div>'; |
552 | + } |
|
524 | 553 | |
525 | 554 | echo ' |
526 | 555 | ', $post['body'], ' |
527 | 556 | </div>'; |
528 | 557 | |
529 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
530 | - echo ' |
|
558 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
559 | + echo ' |
|
531 | 560 | <div class="floatright"> |
532 | 561 | <ul class="quickbuttons">'; |
562 | + } |
|
533 | 563 | |
534 | 564 | // If they *can* reply? |
535 | - if ($post['can_reply']) |
|
536 | - echo ' |
|
565 | + if ($post['can_reply']) { |
|
566 | + echo ' |
|
537 | 567 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
568 | + } |
|
538 | 569 | |
539 | 570 | // If they *can* quote? |
540 | - if ($post['can_quote']) |
|
541 | - echo ' |
|
571 | + if ($post['can_quote']) { |
|
572 | + echo ' |
|
542 | 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 | + } |
|
543 | 575 | |
544 | 576 | // How about... even... remove it entirely?! |
545 | - if ($post['can_delete']) |
|
546 | - echo ' |
|
577 | + if ($post['can_delete']) { |
|
578 | + echo ' |
|
547 | 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 | + } |
|
548 | 581 | |
549 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
550 | - echo ' |
|
582 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
583 | + echo ' |
|
551 | 584 | </ul> |
552 | 585 | </div><!-- .floatright -->'; |
586 | + } |
|
553 | 587 | |
554 | 588 | echo ' |
555 | 589 | </div><!-- $post[css_class] -->'; |
556 | 590 | } |
591 | + } else { |
|
592 | + template_show_list('attachments'); |
|
557 | 593 | } |
558 | - else |
|
559 | - template_show_list('attachments'); |
|
560 | 594 | |
561 | 595 | // No posts? Just end with a informative message. |
562 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
563 | - echo ' |
|
596 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
597 | + echo ' |
|
564 | 598 | <div class="windowbg2"> |
565 | 599 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
566 | 600 | </div>'; |
601 | + } |
|
567 | 602 | |
568 | 603 | // Show more page numbers. |
569 | - if (!empty($context['page_index'])) |
|
570 | - echo ' |
|
604 | + if (!empty($context['page_index'])) { |
|
605 | + echo ' |
|
571 | 606 | <div class="pagesection"> |
572 | 607 | <div class="pagelinks">', $context['page_index'], '</div> |
573 | 608 | </div>'; |
574 | -} |
|
609 | + } |
|
610 | + } |
|
575 | 611 | |
576 | 612 | /** |
577 | 613 | * Template for showing alerts within the alerts popup |
@@ -581,11 +617,12 @@ discard block |
||
581 | 617 | global $context, $txt, $scripturl; |
582 | 618 | |
583 | 619 | // Do we have an update message? |
584 | - if (!empty($context['update_message'])) |
|
585 | - echo ' |
|
620 | + if (!empty($context['update_message'])) { |
|
621 | + echo ' |
|
586 | 622 | <div class="infobox"> |
587 | 623 | ', $context['update_message'], '. |
588 | 624 | </div>'; |
625 | + } |
|
589 | 626 | |
590 | 627 | echo ' |
591 | 628 | <div class="cat_bar"> |
@@ -594,13 +631,12 @@ discard block |
||
594 | 631 | </h3> |
595 | 632 | </div>'; |
596 | 633 | |
597 | - if (empty($context['alerts'])) |
|
598 | - echo ' |
|
634 | + if (empty($context['alerts'])) { |
|
635 | + echo ' |
|
599 | 636 | <div class="information"> |
600 | 637 | ', $txt['alerts_none'], ' |
601 | 638 | </div>'; |
602 | - |
|
603 | - else |
|
639 | + } else |
|
604 | 640 | { |
605 | 641 | // Start the form. |
606 | 642 | echo ' |
@@ -662,12 +698,12 @@ discard block |
||
662 | 698 | </div>' : ''; |
663 | 699 | |
664 | 700 | // No drafts? Just show an informative message. |
665 | - if (empty($context['drafts'])) |
|
666 | - echo ' |
|
701 | + if (empty($context['drafts'])) { |
|
702 | + echo ' |
|
667 | 703 | <div class="windowbg2 centertext"> |
668 | 704 | ', $txt['draft_none'], ' |
669 | 705 | </div>'; |
670 | - else |
|
706 | + } else |
|
671 | 707 | { |
672 | 708 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
673 | 709 | foreach ($context['drafts'] as $draft) |
@@ -679,13 +715,15 @@ discard block |
||
679 | 715 | <h5> |
680 | 716 | <strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
681 | 717 | |
682 | - if (!empty($draft['sticky'])) |
|
683 | - echo ' |
|
718 | + if (!empty($draft['sticky'])) { |
|
719 | + echo ' |
|
684 | 720 | <span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
721 | + } |
|
685 | 722 | |
686 | - if (!empty($draft['locked'])) |
|
687 | - echo ' |
|
723 | + if (!empty($draft['locked'])) { |
|
724 | + echo ' |
|
688 | 725 | <span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
726 | + } |
|
689 | 727 | |
690 | 728 | echo ' |
691 | 729 | </h5> |
@@ -718,13 +756,13 @@ discard block |
||
718 | 756 | { |
719 | 757 | global $context, $scripturl, $txt; |
720 | 758 | |
721 | - if (!empty($context['saved_successful'])) |
|
722 | - echo ' |
|
759 | + if (!empty($context['saved_successful'])) { |
|
760 | + echo ' |
|
723 | 761 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
724 | - |
|
725 | - elseif (!empty($context['saved_failed'])) |
|
726 | - echo ' |
|
762 | + } elseif (!empty($context['saved_failed'])) { |
|
763 | + echo ' |
|
727 | 764 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
765 | + } |
|
728 | 766 | |
729 | 767 | echo ' |
730 | 768 | <div id="edit_buddies"> |
@@ -739,14 +777,16 @@ discard block |
||
739 | 777 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
740 | 778 | <th scope="col">', $txt['status'], '</th>'; |
741 | 779 | |
742 | - if (allowedTo('moderate_forum')) |
|
743 | - echo ' |
|
780 | + if (allowedTo('moderate_forum')) { |
|
781 | + echo ' |
|
744 | 782 | <th scope="col">', $txt['email'], '</th>'; |
783 | + } |
|
745 | 784 | |
746 | - if (!empty($context['custom_pf'])) |
|
747 | - foreach ($context['custom_pf'] as $column) |
|
785 | + if (!empty($context['custom_pf'])) { |
|
786 | + foreach ($context['custom_pf'] as $column) |
|
748 | 787 | echo ' |
749 | 788 | <th scope="col">', $column['label'], '</th>'; |
789 | + } |
|
750 | 790 | |
751 | 791 | echo ' |
752 | 792 | <th scope="col">', $txt['remove'], '</th> |
@@ -755,13 +795,14 @@ discard block |
||
755 | 795 | <tbody>'; |
756 | 796 | |
757 | 797 | // If they don't have any buddies don't list them! |
758 | - if (empty($context['buddies'])) |
|
759 | - echo ' |
|
798 | + if (empty($context['buddies'])) { |
|
799 | + echo ' |
|
760 | 800 | <tr class="windowbg"> |
761 | 801 | <td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"> |
762 | 802 | <strong>', $txt['no_buddies'], '</strong> |
763 | 803 | </td> |
764 | 804 | </tr>'; |
805 | + } |
|
765 | 806 | |
766 | 807 | // Now loop through each buddy showing info on each. |
767 | 808 | else |
@@ -775,17 +816,19 @@ discard block |
||
775 | 816 | <a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
776 | 817 | </td>'; |
777 | 818 | |
778 | - if ($buddy['show_email']) |
|
779 | - echo ' |
|
819 | + if ($buddy['show_email']) { |
|
820 | + echo ' |
|
780 | 821 | <td> |
781 | 822 | <a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
782 | 823 | </td>'; |
824 | + } |
|
783 | 825 | |
784 | 826 | // Show the custom profile fields for this user. |
785 | - if (!empty($context['custom_pf'])) |
|
786 | - foreach ($context['custom_pf'] as $key => $column) |
|
827 | + if (!empty($context['custom_pf'])) { |
|
828 | + foreach ($context['custom_pf'] as $key => $column) |
|
787 | 829 | echo ' |
788 | 830 | <td class="lefttext">', $buddy['options'][$key], '</td>'; |
831 | + } |
|
789 | 832 | |
790 | 833 | echo ' |
791 | 834 | <td> |
@@ -818,9 +861,10 @@ discard block |
||
818 | 861 | </dl> |
819 | 862 | </div>'; |
820 | 863 | |
821 | - if (!empty($context['token_check'])) |
|
822 | - echo ' |
|
864 | + if (!empty($context['token_check'])) { |
|
865 | + echo ' |
|
823 | 866 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
867 | + } |
|
824 | 868 | |
825 | 869 | echo ' |
826 | 870 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -846,12 +890,13 @@ discard block |
||
846 | 890 | { |
847 | 891 | global $context, $scripturl, $txt; |
848 | 892 | |
849 | - if (!empty($context['saved_successful'])) |
|
850 | - echo ' |
|
893 | + if (!empty($context['saved_successful'])) { |
|
894 | + echo ' |
|
851 | 895 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
852 | - elseif (!empty($context['saved_failed'])) |
|
853 | - echo ' |
|
896 | + } elseif (!empty($context['saved_failed'])) { |
|
897 | + echo ' |
|
854 | 898 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
899 | + } |
|
855 | 900 | |
856 | 901 | echo ' |
857 | 902 | <div id="edit_buddies"> |
@@ -866,9 +911,10 @@ discard block |
||
866 | 911 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
867 | 912 | <th scope="col">', $txt['status'], '</th>'; |
868 | 913 | |
869 | - if (allowedTo('moderate_forum')) |
|
870 | - echo ' |
|
914 | + if (allowedTo('moderate_forum')) { |
|
915 | + echo ' |
|
871 | 916 | <th scope="col">', $txt['email'], '</th>'; |
917 | + } |
|
872 | 918 | |
873 | 919 | echo ' |
874 | 920 | <th scope="col">', $txt['ignore_remove'], '</th> |
@@ -877,13 +923,14 @@ discard block |
||
877 | 923 | <tbody>'; |
878 | 924 | |
879 | 925 | // If they don't have anyone on their ignore list, don't list it! |
880 | - if (empty($context['ignore_list'])) |
|
881 | - echo ' |
|
926 | + if (empty($context['ignore_list'])) { |
|
927 | + echo ' |
|
882 | 928 | <tr class="windowbg"> |
883 | 929 | <td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"> |
884 | 930 | <strong>', $txt['no_ignore'], '</strong> |
885 | 931 | </td> |
886 | 932 | </tr>'; |
933 | + } |
|
887 | 934 | |
888 | 935 | // Now loop through each buddy showing info on each. |
889 | 936 | foreach ($context['ignore_list'] as $member) |
@@ -895,11 +942,12 @@ discard block |
||
895 | 942 | <a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
896 | 943 | </td>'; |
897 | 944 | |
898 | - if ($member['show_email']) |
|
899 | - echo ' |
|
945 | + if ($member['show_email']) { |
|
946 | + echo ' |
|
900 | 947 | <td> |
901 | 948 | <a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
902 | 949 | </td>'; |
950 | + } |
|
903 | 951 | echo ' |
904 | 952 | <td> |
905 | 953 | <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> |
@@ -929,9 +977,10 @@ discard block |
||
929 | 977 | </dl> |
930 | 978 | </div>'; |
931 | 979 | |
932 | - if (!empty($context['token_check'])) |
|
933 | - echo ' |
|
980 | + if (!empty($context['token_check'])) { |
|
981 | + echo ' |
|
934 | 982 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
983 | + } |
|
935 | 984 | |
936 | 985 | echo ' |
937 | 986 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -977,9 +1026,10 @@ discard block |
||
977 | 1026 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
978 | 1027 | |
979 | 1028 | // Second address detected? |
980 | - if (!empty($context['last_ip2'])) |
|
981 | - echo ' |
|
1029 | + if (!empty($context['last_ip2'])) { |
|
1030 | + echo ' |
|
982 | 1031 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
1032 | + } |
|
983 | 1033 | |
984 | 1034 | echo ' |
985 | 1035 | </dd>'; |
@@ -1045,9 +1095,10 @@ discard block |
||
1045 | 1095 | </div> |
1046 | 1096 | <div class="windowbg2 noup">'; |
1047 | 1097 | |
1048 | - foreach ($context['whois_servers'] as $server) |
|
1049 | - echo ' |
|
1098 | + foreach ($context['whois_servers'] as $server) { |
|
1099 | + echo ' |
|
1050 | 1100 | <a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>'; |
1101 | + } |
|
1051 | 1102 | echo ' |
1052 | 1103 | </div> |
1053 | 1104 | <br>'; |
@@ -1058,10 +1109,10 @@ discard block |
||
1058 | 1109 | <div class="cat_bar"> |
1059 | 1110 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
1060 | 1111 | </div>'; |
1061 | - if (empty($context['ips'])) |
|
1062 | - echo ' |
|
1112 | + if (empty($context['ips'])) { |
|
1113 | + echo ' |
|
1063 | 1114 | <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>'; |
1064 | - else |
|
1115 | + } else |
|
1065 | 1116 | { |
1066 | 1117 | echo ' |
1067 | 1118 | <table class="table_grid"> |
@@ -1074,12 +1125,13 @@ discard block |
||
1074 | 1125 | <tbody>'; |
1075 | 1126 | |
1076 | 1127 | // Loop through each of the members and display them. |
1077 | - foreach ($context['ips'] as $ip => $memberlist) |
|
1078 | - echo ' |
|
1128 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
1129 | + echo ' |
|
1079 | 1130 | <tr class="windowbg"> |
1080 | 1131 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
1081 | 1132 | <td>', implode(', ', $memberlist), '</td> |
1082 | 1133 | </tr>'; |
1134 | + } |
|
1083 | 1135 | |
1084 | 1136 | echo ' |
1085 | 1137 | </tbody> |
@@ -1125,8 +1177,7 @@ discard block |
||
1125 | 1177 | { |
1126 | 1178 | echo ' |
1127 | 1179 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
1128 | - } |
|
1129 | - else |
|
1180 | + } else |
|
1130 | 1181 | { |
1131 | 1182 | echo ' |
1132 | 1183 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1141,9 +1192,10 @@ discard block |
||
1141 | 1192 | <div class="windowbg smalltext"> |
1142 | 1193 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
1143 | 1194 | |
1144 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
1145 | - echo ' |
|
1195 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
1196 | + echo ' |
|
1146 | 1197 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
1198 | + } |
|
1147 | 1199 | echo ' |
1148 | 1200 | </div>'; |
1149 | 1201 | } |
@@ -1175,12 +1227,13 @@ discard block |
||
1175 | 1227 | </td> |
1176 | 1228 | <td class="smalltext">'; |
1177 | 1229 | |
1178 | - if ($permission['is_denied']) |
|
1179 | - echo ' |
|
1230 | + if ($permission['is_denied']) { |
|
1231 | + echo ' |
|
1180 | 1232 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1181 | - else |
|
1182 | - echo ' |
|
1233 | + } else { |
|
1234 | + echo ' |
|
1183 | 1235 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1236 | + } |
|
1184 | 1237 | |
1185 | 1238 | echo ' |
1186 | 1239 | </td> |
@@ -1191,10 +1244,10 @@ discard block |
||
1191 | 1244 | </table> |
1192 | 1245 | </div><!-- .tborder --> |
1193 | 1246 | <br>'; |
1194 | - } |
|
1195 | - else |
|
1196 | - echo ' |
|
1247 | + } else { |
|
1248 | + echo ' |
|
1197 | 1249 | <p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
1250 | + } |
|
1198 | 1251 | |
1199 | 1252 | // Board permission section. |
1200 | 1253 | echo ' |
@@ -1204,14 +1257,16 @@ discard block |
||
1204 | 1257 | <a id="board_permissions"></a>', $txt['showPermissions_select'], ': |
1205 | 1258 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
1206 | 1259 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], ' </option>'; |
1207 | - if (!empty($context['boards'])) |
|
1208 | - echo ' |
|
1260 | + if (!empty($context['boards'])) { |
|
1261 | + echo ' |
|
1209 | 1262 | <option value="" disabled>---------------------------</option>'; |
1263 | + } |
|
1210 | 1264 | |
1211 | 1265 | // Fill the box with any local permission boards. |
1212 | - foreach ($context['boards'] as $board) |
|
1213 | - echo ' |
|
1266 | + foreach ($context['boards'] as $board) { |
|
1267 | + echo ' |
|
1214 | 1268 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
1269 | + } |
|
1215 | 1270 | |
1216 | 1271 | echo ' |
1217 | 1272 | </select> |
@@ -1242,8 +1297,7 @@ discard block |
||
1242 | 1297 | { |
1243 | 1298 | echo ' |
1244 | 1299 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1245 | - } |
|
1246 | - else |
|
1300 | + } else |
|
1247 | 1301 | { |
1248 | 1302 | echo ' |
1249 | 1303 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
@@ -1255,10 +1309,10 @@ discard block |
||
1255 | 1309 | echo ' |
1256 | 1310 | </tbody> |
1257 | 1311 | </table>'; |
1258 | - } |
|
1259 | - else |
|
1260 | - echo ' |
|
1312 | + } else { |
|
1313 | + echo ' |
|
1261 | 1314 | <p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
1315 | + } |
|
1262 | 1316 | echo ' |
1263 | 1317 | </div><!-- #permissions -->'; |
1264 | 1318 | } |
@@ -1299,9 +1353,10 @@ discard block |
||
1299 | 1353 | </div>'; |
1300 | 1354 | |
1301 | 1355 | // If they haven't post at all, don't draw the graph. |
1302 | - if (empty($context['posts_by_time'])) |
|
1303 | - echo ' |
|
1356 | + if (empty($context['posts_by_time'])) { |
|
1357 | + echo ' |
|
1304 | 1358 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1359 | + } |
|
1305 | 1360 | // Otherwise do! |
1306 | 1361 | else |
1307 | 1362 | { |
@@ -1339,11 +1394,10 @@ discard block |
||
1339 | 1394 | </h3> |
1340 | 1395 | </div>'; |
1341 | 1396 | |
1342 | - if (empty($context['popular_boards'])) |
|
1343 | - echo ' |
|
1397 | + if (empty($context['popular_boards'])) { |
|
1398 | + echo ' |
|
1344 | 1399 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1345 | - |
|
1346 | - else |
|
1400 | + } else |
|
1347 | 1401 | { |
1348 | 1402 | echo ' |
1349 | 1403 | <dl class="stats">'; |
@@ -1373,10 +1427,10 @@ discard block |
||
1373 | 1427 | </h3> |
1374 | 1428 | </div>'; |
1375 | 1429 | |
1376 | - if (empty($context['board_activity'])) |
|
1377 | - echo ' |
|
1430 | + if (empty($context['board_activity'])) { |
|
1431 | + echo ' |
|
1378 | 1432 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1379 | - else |
|
1433 | + } else |
|
1380 | 1434 | { |
1381 | 1435 | echo ' |
1382 | 1436 | <dl class="stats">'; |
@@ -1427,41 +1481,46 @@ discard block |
||
1427 | 1481 | <h3 class="catbg profile_hd">'; |
1428 | 1482 | |
1429 | 1483 | // Don't say "Profile" if this isn't the profile... |
1430 | - if (!empty($context['profile_header_text'])) |
|
1431 | - echo ' |
|
1484 | + if (!empty($context['profile_header_text'])) { |
|
1485 | + echo ' |
|
1432 | 1486 | ', $context['profile_header_text']; |
1433 | - else |
|
1434 | - echo ' |
|
1487 | + } else { |
|
1488 | + echo ' |
|
1435 | 1489 | ', $txt['profile']; |
1490 | + } |
|
1436 | 1491 | |
1437 | 1492 | echo ' |
1438 | 1493 | </h3> |
1439 | 1494 | </div>'; |
1440 | 1495 | |
1441 | 1496 | // Have we some description? |
1442 | - if ($context['page_desc']) |
|
1443 | - echo ' |
|
1497 | + if ($context['page_desc']) { |
|
1498 | + echo ' |
|
1444 | 1499 | <p class="information">', $context['page_desc'], '</p>'; |
1500 | + } |
|
1445 | 1501 | |
1446 | 1502 | echo ' |
1447 | 1503 | <div class="roundframe">'; |
1448 | 1504 | |
1449 | 1505 | // Any bits at the start? |
1450 | - if (!empty($context['profile_prehtml'])) |
|
1451 | - echo ' |
|
1506 | + if (!empty($context['profile_prehtml'])) { |
|
1507 | + echo ' |
|
1452 | 1508 | <div>', $context['profile_prehtml'], '</div>'; |
1509 | + } |
|
1453 | 1510 | |
1454 | - if (!empty($context['profile_fields'])) |
|
1455 | - echo ' |
|
1511 | + if (!empty($context['profile_fields'])) { |
|
1512 | + echo ' |
|
1456 | 1513 | <dl class="settings">'; |
1514 | + } |
|
1457 | 1515 | |
1458 | 1516 | // Start the big old loop 'of love. |
1459 | 1517 | $lastItem = 'hr'; |
1460 | 1518 | foreach ($context['profile_fields'] as $key => $field) |
1461 | 1519 | { |
1462 | 1520 | // We add a little hack to be sure we never get more than one hr in a row! |
1463 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
1464 | - continue; |
|
1521 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
1522 | + continue; |
|
1523 | + } |
|
1465 | 1524 | |
1466 | 1525 | $lastItem = $field['type']; |
1467 | 1526 | if ($field['type'] == 'hr') |
@@ -1470,48 +1529,50 @@ discard block |
||
1470 | 1529 | </dl> |
1471 | 1530 | <hr> |
1472 | 1531 | <dl class="settings">'; |
1473 | - } |
|
1474 | - elseif ($field['type'] == 'callback') |
|
1532 | + } elseif ($field['type'] == 'callback') |
|
1475 | 1533 | { |
1476 | 1534 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
1477 | 1535 | { |
1478 | 1536 | $callback_func = 'template_profile_' . $field['callback_func']; |
1479 | 1537 | $callback_func(); |
1480 | 1538 | } |
1481 | - } |
|
1482 | - else |
|
1539 | + } else |
|
1483 | 1540 | { |
1484 | 1541 | echo ' |
1485 | 1542 | <dt> |
1486 | 1543 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
1487 | 1544 | |
1488 | 1545 | // Does it have any subtext to show? |
1489 | - if (!empty($field['subtext'])) |
|
1490 | - echo ' |
|
1546 | + if (!empty($field['subtext'])) { |
|
1547 | + echo ' |
|
1491 | 1548 | <br> |
1492 | 1549 | <span class="smalltext">', $field['subtext'], '</span>'; |
1550 | + } |
|
1493 | 1551 | |
1494 | 1552 | echo ' |
1495 | 1553 | </dt> |
1496 | 1554 | <dd>'; |
1497 | 1555 | |
1498 | 1556 | // Want to put something infront of the box? |
1499 | - if (!empty($field['preinput'])) |
|
1500 | - echo ' |
|
1557 | + if (!empty($field['preinput'])) { |
|
1558 | + echo ' |
|
1501 | 1559 | ', $field['preinput']; |
1560 | + } |
|
1502 | 1561 | |
1503 | 1562 | // What type of data are we showing? |
1504 | - if ($field['type'] == 'label') |
|
1505 | - echo ' |
|
1563 | + if ($field['type'] == 'label') { |
|
1564 | + echo ' |
|
1506 | 1565 | ', $field['value']; |
1566 | + } |
|
1507 | 1567 | |
1508 | 1568 | // Maybe it's a text box - very likely! |
1509 | 1569 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
1510 | 1570 | { |
1511 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
1512 | - $type = 'number'; |
|
1513 | - else |
|
1514 | - $type = $field['type']; |
|
1571 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
1572 | + $type = 'number'; |
|
1573 | + } else { |
|
1574 | + $type = $field['type']; |
|
1575 | + } |
|
1515 | 1576 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
1516 | 1577 | |
1517 | 1578 | |
@@ -1519,10 +1580,11 @@ discard block |
||
1519 | 1580 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
1520 | 1581 | } |
1521 | 1582 | // You "checking" me out? ;) |
1522 | - elseif ($field['type'] == 'check') |
|
1523 | - echo ' |
|
1583 | + elseif ($field['type'] == 'check') { |
|
1584 | + echo ' |
|
1524 | 1585 | <input type="hidden" name="', $key, '" value="0"> |
1525 | 1586 | <input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
1587 | + } |
|
1526 | 1588 | |
1527 | 1589 | // Always fun - select boxes! |
1528 | 1590 | elseif ($field['type'] == 'select') |
@@ -1533,14 +1595,16 @@ discard block |
||
1533 | 1595 | if (isset($field['options'])) |
1534 | 1596 | { |
1535 | 1597 | // Is this some code to generate the options? |
1536 | - if (!is_array($field['options'])) |
|
1537 | - $field['options'] = $field['options'](); |
|
1598 | + if (!is_array($field['options'])) { |
|
1599 | + $field['options'] = $field['options'](); |
|
1600 | + } |
|
1538 | 1601 | |
1539 | 1602 | // Assuming we now have some! |
1540 | - if (is_array($field['options'])) |
|
1541 | - foreach ($field['options'] as $value => $name) |
|
1603 | + if (is_array($field['options'])) { |
|
1604 | + foreach ($field['options'] as $value => $name) |
|
1542 | 1605 | echo ' |
1543 | 1606 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
1607 | + } |
|
1544 | 1608 | } |
1545 | 1609 | |
1546 | 1610 | echo ' |
@@ -1548,25 +1612,28 @@ discard block |
||
1548 | 1612 | } |
1549 | 1613 | |
1550 | 1614 | // Something to end with? |
1551 | - if (!empty($field['postinput'])) |
|
1552 | - echo ' |
|
1615 | + if (!empty($field['postinput'])) { |
|
1616 | + echo ' |
|
1553 | 1617 | ', $field['postinput']; |
1618 | + } |
|
1554 | 1619 | |
1555 | 1620 | echo ' |
1556 | 1621 | </dd>'; |
1557 | 1622 | } |
1558 | 1623 | } |
1559 | 1624 | |
1560 | - if (!empty($context['profile_fields'])) |
|
1561 | - echo ' |
|
1625 | + if (!empty($context['profile_fields'])) { |
|
1626 | + echo ' |
|
1562 | 1627 | </dl>'; |
1628 | + } |
|
1563 | 1629 | |
1564 | 1630 | // Are there any custom profile fields - if so print them! |
1565 | 1631 | if (!empty($context['custom_fields'])) |
1566 | 1632 | { |
1567 | - if ($lastItem != 'hr') |
|
1568 | - echo ' |
|
1633 | + if ($lastItem != 'hr') { |
|
1634 | + echo ' |
|
1569 | 1635 | <hr>'; |
1636 | + } |
|
1570 | 1637 | |
1571 | 1638 | echo ' |
1572 | 1639 | <dl class="settings">'; |
@@ -1589,13 +1656,14 @@ discard block |
||
1589 | 1656 | } |
1590 | 1657 | |
1591 | 1658 | // Any closing HTML? |
1592 | - if (!empty($context['profile_posthtml'])) |
|
1593 | - echo ' |
|
1659 | + if (!empty($context['profile_posthtml'])) { |
|
1660 | + echo ' |
|
1594 | 1661 | <div>', $context['profile_posthtml'], '</div>'; |
1662 | + } |
|
1595 | 1663 | |
1596 | 1664 | // Only show the password box if it's actually needed. |
1597 | - if ($context['require_password']) |
|
1598 | - echo ' |
|
1665 | + if ($context['require_password']) { |
|
1666 | + echo ' |
|
1599 | 1667 | <dl class="settings"> |
1600 | 1668 | <dt> |
1601 | 1669 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1605,18 +1673,21 @@ discard block |
||
1605 | 1673 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
1606 | 1674 | </dd> |
1607 | 1675 | </dl>'; |
1676 | + } |
|
1608 | 1677 | |
1609 | 1678 | // The button shouldn't say "Change profile" unless we're changing the profile... |
1610 | - if (!empty($context['submit_button_text'])) |
|
1611 | - echo ' |
|
1679 | + if (!empty($context['submit_button_text'])) { |
|
1680 | + echo ' |
|
1612 | 1681 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">'; |
1613 | - else |
|
1614 | - echo ' |
|
1682 | + } else { |
|
1683 | + echo ' |
|
1615 | 1684 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button">'; |
1685 | + } |
|
1616 | 1686 | |
1617 | - if (!empty($context['token_check'])) |
|
1618 | - echo ' |
|
1687 | + if (!empty($context['token_check'])) { |
|
1688 | + echo ' |
|
1619 | 1689 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1690 | + } |
|
1620 | 1691 | |
1621 | 1692 | echo ' |
1622 | 1693 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1626,10 +1697,11 @@ discard block |
||
1626 | 1697 | </form>'; |
1627 | 1698 | |
1628 | 1699 | // Any final spellchecking stuff? |
1629 | - if (!empty($context['show_spellchecking'])) |
|
1630 | - echo ' |
|
1700 | + if (!empty($context['show_spellchecking'])) { |
|
1701 | + echo ' |
|
1631 | 1702 | <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>'; |
1632 | -} |
|
1703 | + } |
|
1704 | + } |
|
1633 | 1705 | |
1634 | 1706 | /** |
1635 | 1707 | * Personal Message settings. |
@@ -1666,10 +1738,11 @@ discard block |
||
1666 | 1738 | <select name="pm_receive_from" id="pm_receive_from"> |
1667 | 1739 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
1668 | 1740 | |
1669 | - if (!empty($modSettings['enable_buddylist'])) |
|
1670 | - echo ' |
|
1741 | + if (!empty($modSettings['enable_buddylist'])) { |
|
1742 | + echo ' |
|
1671 | 1743 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
1672 | 1744 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
1745 | + } |
|
1673 | 1746 | |
1674 | 1747 | echo ' |
1675 | 1748 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1712,11 +1785,12 @@ discard block |
||
1712 | 1785 | if (empty($setting) || !is_array($setting)) |
1713 | 1786 | { |
1714 | 1787 | // Insert a separator (unless this is the first item in the list) |
1715 | - if ($i !== $first_option_key) |
|
1716 | - echo ' |
|
1788 | + if ($i !== $first_option_key) { |
|
1789 | + echo ' |
|
1717 | 1790 | </dl> |
1718 | 1791 | <hr> |
1719 | 1792 | <dl class="settings">'; |
1793 | + } |
|
1720 | 1794 | |
1721 | 1795 | // Should we give a name to this section? |
1722 | 1796 | if (is_string($setting) && !empty($setting)) |
@@ -1725,52 +1799,57 @@ discard block |
||
1725 | 1799 | echo ' |
1726 | 1800 | <dt><strong>' . $setting . '</strong></dt> |
1727 | 1801 | <dd></dd>'; |
1802 | + } else { |
|
1803 | + $titled_section = false; |
|
1728 | 1804 | } |
1729 | - else |
|
1730 | - $titled_section = false; |
|
1731 | 1805 | |
1732 | 1806 | continue; |
1733 | 1807 | } |
1734 | 1808 | |
1735 | 1809 | // Is this disabled? |
1736 | - if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
|
1737 | - continue; |
|
1738 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
1739 | - continue; |
|
1740 | - elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
|
1741 | - continue; |
|
1742 | - elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
|
1743 | - continue; |
|
1744 | - elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
|
1745 | - continue; |
|
1746 | - elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1747 | - continue; |
|
1748 | - elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1749 | - continue; |
|
1810 | + if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) { |
|
1811 | + continue; |
|
1812 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) { |
|
1813 | + continue; |
|
1814 | + } elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) { |
|
1815 | + continue; |
|
1816 | + } elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) { |
|
1817 | + continue; |
|
1818 | + } elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) { |
|
1819 | + continue; |
|
1820 | + } elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1821 | + continue; |
|
1822 | + } elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1823 | + continue; |
|
1824 | + } |
|
1750 | 1825 | |
1751 | 1826 | // Some of these may not be set... Set to defaults here |
1752 | 1827 | $opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod'); |
1753 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
1754 | - $context['member']['options'][$setting['id']] = 0; |
|
1828 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
1829 | + $context['member']['options'][$setting['id']] = 0; |
|
1830 | + } |
|
1755 | 1831 | |
1756 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
1757 | - $setting['type'] = 'checkbox'; |
|
1758 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
1759 | - $setting['type'] = 'number'; |
|
1760 | - elseif ($setting['type'] == 'string') |
|
1761 | - $setting['type'] = 'text'; |
|
1832 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
1833 | + $setting['type'] = 'checkbox'; |
|
1834 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
1835 | + $setting['type'] = 'number'; |
|
1836 | + } elseif ($setting['type'] == 'string') { |
|
1837 | + $setting['type'] = 'text'; |
|
1838 | + } |
|
1762 | 1839 | |
1763 | - if (isset($setting['options'])) |
|
1764 | - $setting['type'] = 'list'; |
|
1840 | + if (isset($setting['options'])) { |
|
1841 | + $setting['type'] = 'list'; |
|
1842 | + } |
|
1765 | 1843 | |
1766 | 1844 | echo ' |
1767 | 1845 | <dt> |
1768 | 1846 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
1769 | 1847 | |
1770 | - if (isset($setting['description'])) |
|
1771 | - echo ' |
|
1848 | + if (isset($setting['description'])) { |
|
1849 | + echo ' |
|
1772 | 1850 | <br> |
1773 | 1851 | <span class="smalltext">', $setting['description'], '</span>'; |
1852 | + } |
|
1774 | 1853 | echo ' |
1775 | 1854 | </dt> |
1776 | 1855 | <dd>'; |
@@ -1808,13 +1887,11 @@ discard block |
||
1808 | 1887 | |
1809 | 1888 | echo ' |
1810 | 1889 | <input type="number"', $min . $max . $step; |
1811 | - } |
|
1812 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
1890 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
1813 | 1891 | { |
1814 | 1892 | echo' |
1815 | 1893 | <input type="url"'; |
1816 | - } |
|
1817 | - else |
|
1894 | + } else |
|
1818 | 1895 | { |
1819 | 1896 | echo ' |
1820 | 1897 | <input type="text"'; |
@@ -1855,8 +1932,8 @@ discard block |
||
1855 | 1932 | <dl class="settings">'; |
1856 | 1933 | |
1857 | 1934 | // Allow notification on announcements to be disabled? |
1858 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
1859 | - echo ' |
|
1935 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
1936 | + echo ' |
|
1860 | 1937 | <dt> |
1861 | 1938 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
1862 | 1939 | </dt> |
@@ -1864,15 +1941,17 @@ discard block |
||
1864 | 1941 | <input type="hidden" name="notify_announcements" value="0"> |
1865 | 1942 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
1866 | 1943 | </dd>'; |
1944 | + } |
|
1867 | 1945 | |
1868 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
1869 | - echo ' |
|
1946 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
1947 | + echo ' |
|
1870 | 1948 | <dt> |
1871 | 1949 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
1872 | 1950 | </dt> |
1873 | 1951 | <dd> |
1874 | 1952 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
1875 | 1953 | </dd>'; |
1954 | + } |
|
1876 | 1955 | |
1877 | 1956 | echo ' |
1878 | 1957 | </dl> |
@@ -1902,9 +1981,10 @@ discard block |
||
1902 | 1981 | <td colspan="3">'; |
1903 | 1982 | $label = $txt['alert_opt_' . $opts[1]]; |
1904 | 1983 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
1905 | - if ($label_pos == 'before') |
|
1906 | - echo ' |
|
1984 | + if ($label_pos == 'before') { |
|
1985 | + echo ' |
|
1907 | 1986 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
1987 | + } |
|
1908 | 1988 | |
1909 | 1989 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
1910 | 1990 | switch ($opts[0]) |
@@ -1916,17 +1996,19 @@ discard block |
||
1916 | 1996 | case 'select': |
1917 | 1997 | echo ' |
1918 | 1998 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
1919 | - foreach ($opts['opts'] as $k => $v) |
|
1920 | - echo ' |
|
1999 | + foreach ($opts['opts'] as $k => $v) { |
|
2000 | + echo ' |
|
1921 | 2001 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
2002 | + } |
|
1922 | 2003 | echo ' |
1923 | 2004 | </select>'; |
1924 | 2005 | break; |
1925 | 2006 | } |
1926 | 2007 | |
1927 | - if ($label_pos == 'after') |
|
1928 | - echo ' |
|
2008 | + if ($label_pos == 'after') { |
|
2009 | + echo ' |
|
1929 | 2010 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
2011 | + } |
|
1930 | 2012 | |
1931 | 2013 | echo ' |
1932 | 2014 | </td> |
@@ -2042,11 +2124,12 @@ discard block |
||
2042 | 2124 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
2043 | 2125 | |
2044 | 2126 | // Do we have an update message? |
2045 | - if (!empty($context['update_message'])) |
|
2046 | - echo ' |
|
2127 | + if (!empty($context['update_message'])) { |
|
2128 | + echo ' |
|
2047 | 2129 | <div class="infobox"> |
2048 | 2130 | ', $context['update_message'], '. |
2049 | 2131 | </div>'; |
2132 | + } |
|
2050 | 2133 | |
2051 | 2134 | echo ' |
2052 | 2135 | <div id="groups">'; |
@@ -2068,8 +2151,7 @@ discard block |
||
2068 | 2151 | </div> |
2069 | 2152 | </div> |
2070 | 2153 | </div><!-- .groupmembership -->'; |
2071 | - } |
|
2072 | - else |
|
2154 | + } else |
|
2073 | 2155 | { |
2074 | 2156 | echo ' |
2075 | 2157 | <div class="title_bar"> |
@@ -2081,27 +2163,30 @@ discard block |
||
2081 | 2163 | echo ' |
2082 | 2164 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
2083 | 2165 | |
2084 | - if ($context['can_edit_primary']) |
|
2085 | - echo ' |
|
2166 | + if ($context['can_edit_primary']) { |
|
2167 | + echo ' |
|
2086 | 2168 | <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', '>'; |
2169 | + } |
|
2087 | 2170 | |
2088 | 2171 | echo ' |
2089 | 2172 | <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>'; |
2090 | 2173 | |
2091 | 2174 | // Can they leave their group? |
2092 | - if ($group['can_leave']) |
|
2093 | - echo ' |
|
2175 | + if ($group['can_leave']) { |
|
2176 | + echo ' |
|
2094 | 2177 | <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>'; |
2178 | + } |
|
2095 | 2179 | |
2096 | 2180 | echo ' |
2097 | 2181 | </div><!-- .windowbg -->'; |
2098 | 2182 | } |
2099 | 2183 | |
2100 | - if ($context['can_edit_primary']) |
|
2101 | - echo ' |
|
2184 | + if ($context['can_edit_primary']) { |
|
2185 | + echo ' |
|
2102 | 2186 | <div class="padding righttext"> |
2103 | 2187 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
2104 | 2188 | </div>'; |
2189 | + } |
|
2105 | 2190 | |
2106 | 2191 | // Any groups they can join? |
2107 | 2192 | if (!empty($context['groups']['available'])) |
@@ -2117,15 +2202,16 @@ discard block |
||
2117 | 2202 | <div class="windowbg"> |
2118 | 2203 | <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>' : ''), ''; |
2119 | 2204 | |
2120 | - if ($group['type'] == 3) |
|
2121 | - echo ' |
|
2205 | + if ($group['type'] == 3) { |
|
2206 | + echo ' |
|
2122 | 2207 | <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>'; |
2123 | - elseif ($group['type'] == 2 && $group['pending']) |
|
2124 | - echo ' |
|
2208 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
2209 | + echo ' |
|
2125 | 2210 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
2126 | - elseif ($group['type'] == 2) |
|
2127 | - echo ' |
|
2211 | + } elseif ($group['type'] == 2) { |
|
2212 | + echo ' |
|
2128 | 2213 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
2214 | + } |
|
2129 | 2215 | |
2130 | 2216 | echo ' |
2131 | 2217 | </div><!-- .windowbg -->'; |
@@ -2148,9 +2234,10 @@ discard block |
||
2148 | 2234 | |
2149 | 2235 | prevDiv.className = "windowbg"; |
2150 | 2236 | }'; |
2151 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
2152 | - echo ' |
|
2237 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
2238 | + echo ' |
|
2153 | 2239 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
2240 | + } |
|
2154 | 2241 | echo ' |
2155 | 2242 | </script>'; |
2156 | 2243 | } |
@@ -2158,9 +2245,10 @@ discard block |
||
2158 | 2245 | echo ' |
2159 | 2246 | </div><!-- #groups -->'; |
2160 | 2247 | |
2161 | - if (!empty($context['token_check'])) |
|
2162 | - echo ' |
|
2248 | + if (!empty($context['token_check'])) { |
|
2249 | + echo ' |
|
2163 | 2250 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2251 | + } |
|
2164 | 2252 | |
2165 | 2253 | echo ' |
2166 | 2254 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2208,14 +2296,15 @@ discard block |
||
2208 | 2296 | |
2209 | 2297 | foreach ($category['boards'] as $board) |
2210 | 2298 | { |
2211 | - if ($i == $limit) |
|
2212 | - echo ' |
|
2299 | + if ($i == $limit) { |
|
2300 | + echo ' |
|
2213 | 2301 | </ul> |
2214 | 2302 | </li> |
2215 | 2303 | </ul> |
2216 | 2304 | <ul class="ignoreboards floatright"> |
2217 | 2305 | <li class="category"> |
2218 | 2306 | <ul>'; |
2307 | + } |
|
2219 | 2308 | |
2220 | 2309 | echo ' |
2221 | 2310 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
@@ -2261,10 +2350,11 @@ discard block |
||
2261 | 2350 | |
2262 | 2351 | // Work out the starting color. |
2263 | 2352 | $context['current_color'] = $context['colors'][0]; |
2264 | - foreach ($context['colors'] as $limit => $color) |
|
2265 | - if ($context['member']['warning'] >= $limit) |
|
2353 | + foreach ($context['colors'] as $limit => $color) { |
|
2354 | + if ($context['member']['warning'] >= $limit) |
|
2266 | 2355 | $context['current_color'] = $color; |
2267 | -} |
|
2356 | + } |
|
2357 | + } |
|
2268 | 2358 | |
2269 | 2359 | // Show all warnings of a user? |
2270 | 2360 | function template_viewWarning() |
@@ -2303,14 +2393,15 @@ discard block |
||
2303 | 2393 | </dd>'; |
2304 | 2394 | |
2305 | 2395 | // There's some impact of this? |
2306 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
2307 | - echo ' |
|
2396 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
2397 | + echo ' |
|
2308 | 2398 | <dt> |
2309 | 2399 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
2310 | 2400 | </dt> |
2311 | 2401 | <dd> |
2312 | 2402 | ', $context['level_effects'][$context['current_level']], ' |
2313 | 2403 | </dd>'; |
2404 | + } |
|
2314 | 2405 | |
2315 | 2406 | echo ' |
2316 | 2407 | </dl> |
@@ -2348,10 +2439,11 @@ discard block |
||
2348 | 2439 | |
2349 | 2440 | // Otherwise see what we can do...'; |
2350 | 2441 | |
2351 | - foreach ($context['notification_templates'] as $k => $type) |
|
2352 | - echo ' |
|
2442 | + foreach ($context['notification_templates'] as $k => $type) { |
|
2443 | + echo ' |
|
2353 | 2444 | if (index == ', $k, ') |
2354 | 2445 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
2446 | + } |
|
2355 | 2447 | |
2356 | 2448 | echo ' |
2357 | 2449 | } |
@@ -2361,10 +2453,11 @@ discard block |
||
2361 | 2453 | // Also set the right effect. |
2362 | 2454 | effectText = "";'; |
2363 | 2455 | |
2364 | - foreach ($context['level_effects'] as $limit => $text) |
|
2365 | - echo ' |
|
2456 | + foreach ($context['level_effects'] as $limit => $text) { |
|
2457 | + echo ' |
|
2366 | 2458 | if (slideAmount >= ', $limit, ') |
2367 | 2459 | effectText = "', $text, '";'; |
2460 | + } |
|
2368 | 2461 | |
2369 | 2462 | echo ' |
2370 | 2463 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2379,32 +2472,35 @@ discard block |
||
2379 | 2472 | </h3> |
2380 | 2473 | </div>'; |
2381 | 2474 | |
2382 | - if (!$context['user']['is_owner']) |
|
2383 | - echo ' |
|
2475 | + if (!$context['user']['is_owner']) { |
|
2476 | + echo ' |
|
2384 | 2477 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
2478 | + } |
|
2385 | 2479 | |
2386 | 2480 | echo ' |
2387 | 2481 | <div class="windowbg"> |
2388 | 2482 | <dl class="settings">'; |
2389 | 2483 | |
2390 | - if (!$context['user']['is_owner']) |
|
2391 | - echo ' |
|
2484 | + if (!$context['user']['is_owner']) { |
|
2485 | + echo ' |
|
2392 | 2486 | <dt> |
2393 | 2487 | <strong>', $txt['profile_warning_name'], ':</strong> |
2394 | 2488 | </dt> |
2395 | 2489 | <dd> |
2396 | 2490 | <strong>', $context['member']['name'], '</strong> |
2397 | 2491 | </dd>'; |
2492 | + } |
|
2398 | 2493 | |
2399 | 2494 | echo ' |
2400 | 2495 | <dt> |
2401 | 2496 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
2402 | 2497 | |
2403 | 2498 | // Is there only so much they can apply? |
2404 | - if ($context['warning_limit']) |
|
2405 | - echo ' |
|
2499 | + if ($context['warning_limit']) { |
|
2500 | + echo ' |
|
2406 | 2501 | <br> |
2407 | 2502 | <span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
2503 | + } |
|
2408 | 2504 | |
2409 | 2505 | echo ' |
2410 | 2506 | </dt> |
@@ -2459,9 +2555,10 @@ discard block |
||
2459 | 2555 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
2460 | 2556 | <option value="-1" disabled>------------------------------</option>'; |
2461 | 2557 | |
2462 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
2463 | - echo ' |
|
2558 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
2559 | + echo ' |
|
2464 | 2560 | <option value="', $id_template, '">', $template['title'], '</option>'; |
2561 | + } |
|
2465 | 2562 | |
2466 | 2563 | echo ' |
2467 | 2564 | </select> |
@@ -2474,9 +2571,10 @@ discard block |
||
2474 | 2571 | </dl> |
2475 | 2572 | <div class="righttext">'; |
2476 | 2573 | |
2477 | - if (!empty($context['token_check'])) |
|
2478 | - echo ' |
|
2574 | + if (!empty($context['token_check'])) { |
|
2575 | + echo ' |
|
2479 | 2576 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2577 | + } |
|
2480 | 2578 | |
2481 | 2579 | echo ' |
2482 | 2580 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2492,8 +2590,8 @@ discard block |
||
2492 | 2590 | echo ' |
2493 | 2591 | <script>'; |
2494 | 2592 | |
2495 | - if (!$context['user']['is_owner']) |
|
2496 | - echo ' |
|
2593 | + if (!$context['user']['is_owner']) { |
|
2594 | + echo ' |
|
2497 | 2595 | modifyWarnNotify(); |
2498 | 2596 | $(document).ready(function() { |
2499 | 2597 | $("#preview_button").click(function() { |
@@ -2532,6 +2630,7 @@ discard block |
||
2532 | 2630 | }); |
2533 | 2631 | return false; |
2534 | 2632 | }'; |
2633 | + } |
|
2535 | 2634 | |
2536 | 2635 | echo ' |
2537 | 2636 | </script>'; |
@@ -2554,16 +2653,18 @@ discard block |
||
2554 | 2653 | </div>'; |
2555 | 2654 | |
2556 | 2655 | // If deleting another account give them a lovely info box. |
2557 | - if (!$context['user']['is_owner']) |
|
2558 | - echo ' |
|
2656 | + if (!$context['user']['is_owner']) { |
|
2657 | + echo ' |
|
2559 | 2658 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
2659 | + } |
|
2560 | 2660 | echo ' |
2561 | 2661 | <div class="windowbg2">'; |
2562 | 2662 | |
2563 | 2663 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
2564 | - if ($context['needs_approval']) |
|
2565 | - echo ' |
|
2664 | + if ($context['needs_approval']) { |
|
2665 | + echo ' |
|
2566 | 2666 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
2667 | + } |
|
2567 | 2668 | |
2568 | 2669 | // If the user is deleting their own account warn them first - and require a password! |
2569 | 2670 | if ($context['user']['is_owner']) |
@@ -2575,9 +2676,10 @@ discard block |
||
2575 | 2676 | <input type="password" name="oldpasswrd" size="20"> |
2576 | 2677 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
2577 | 2678 | |
2578 | - if (!empty($context['token_check'])) |
|
2579 | - echo ' |
|
2679 | + if (!empty($context['token_check'])) { |
|
2680 | + echo ' |
|
2580 | 2681 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2682 | + } |
|
2581 | 2683 | |
2582 | 2684 | echo ' |
2583 | 2685 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2607,10 +2709,11 @@ discard block |
||
2607 | 2709 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
2608 | 2710 | </select>'; |
2609 | 2711 | |
2610 | - if ($context['show_perma_delete']) |
|
2611 | - echo ' |
|
2712 | + if ($context['show_perma_delete']) { |
|
2713 | + echo ' |
|
2612 | 2714 | <br> |
2613 | 2715 | <label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
2716 | + } |
|
2614 | 2717 | |
2615 | 2718 | echo ' |
2616 | 2719 | </div>'; |
@@ -2623,9 +2726,10 @@ discard block |
||
2623 | 2726 | <div> |
2624 | 2727 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
2625 | 2728 | |
2626 | - if (!empty($context['token_check'])) |
|
2627 | - echo ' |
|
2729 | + if (!empty($context['token_check'])) { |
|
2730 | + echo ' |
|
2628 | 2731 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2732 | + } |
|
2629 | 2733 | |
2630 | 2734 | echo ' |
2631 | 2735 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2651,8 +2755,8 @@ discard block |
||
2651 | 2755 | <hr>'; |
2652 | 2756 | |
2653 | 2757 | // Only show the password box if it's actually needed. |
2654 | - if ($context['require_password']) |
|
2655 | - echo ' |
|
2758 | + if ($context['require_password']) { |
|
2759 | + echo ' |
|
2656 | 2760 | <dl class="settings"> |
2657 | 2761 | <dt> |
2658 | 2762 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2662,13 +2766,15 @@ discard block |
||
2662 | 2766 | <input type="password" name="oldpasswrd" size="20"> |
2663 | 2767 | </dd> |
2664 | 2768 | </dl>'; |
2769 | + } |
|
2665 | 2770 | |
2666 | 2771 | echo ' |
2667 | 2772 | <div class="righttext">'; |
2668 | 2773 | |
2669 | - if (!empty($context['token_check'])) |
|
2670 | - echo ' |
|
2774 | + if (!empty($context['token_check'])) { |
|
2775 | + echo ' |
|
2671 | 2776 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2777 | + } |
|
2672 | 2778 | |
2673 | 2779 | echo ' |
2674 | 2780 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2695,9 +2801,10 @@ discard block |
||
2695 | 2801 | <ul id="list_errors">'; |
2696 | 2802 | |
2697 | 2803 | // Cycle through each error and display an error message. |
2698 | - foreach ($context['post_errors'] as $error) |
|
2699 | - echo ' |
|
2804 | + foreach ($context['post_errors'] as $error) { |
|
2805 | + echo ' |
|
2700 | 2806 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
2807 | + } |
|
2701 | 2808 | |
2702 | 2809 | echo ' |
2703 | 2810 | </ul>'; |
@@ -2723,12 +2830,13 @@ discard block |
||
2723 | 2830 | <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;"' : ''), '>'; |
2724 | 2831 | |
2725 | 2832 | // Fill the select box with all primary member groups that can be assigned to a member. |
2726 | - foreach ($context['member_groups'] as $member_group) |
|
2727 | - if (!empty($member_group['can_be_primary'])) |
|
2833 | + foreach ($context['member_groups'] as $member_group) { |
|
2834 | + if (!empty($member_group['can_be_primary'])) |
|
2728 | 2835 | echo ' |
2729 | 2836 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
2730 | 2837 | ', $member_group['name'], ' |
2731 | 2838 | </option>'; |
2839 | + } |
|
2732 | 2840 | echo ' |
2733 | 2841 | </select> |
2734 | 2842 | </dd> |
@@ -2740,10 +2848,11 @@ discard block |
||
2740 | 2848 | <input type="hidden" name="additional_groups[]" value="0">'; |
2741 | 2849 | |
2742 | 2850 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
2743 | - foreach ($context['member_groups'] as $member_group) |
|
2744 | - if ($member_group['can_be_additional']) |
|
2851 | + foreach ($context['member_groups'] as $member_group) { |
|
2852 | + if ($member_group['can_be_additional']) |
|
2745 | 2853 | echo ' |
2746 | 2854 | <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>'; |
2855 | + } |
|
2747 | 2856 | echo ' |
2748 | 2857 | </span> |
2749 | 2858 | <a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a> |
@@ -2803,9 +2912,10 @@ discard block |
||
2803 | 2912 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
2804 | 2913 | <br>'; |
2805 | 2914 | |
2806 | - if ($context['show_spellchecking']) |
|
2807 | - echo ' |
|
2915 | + if ($context['show_spellchecking']) { |
|
2916 | + echo ' |
|
2808 | 2917 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
2918 | + } |
|
2809 | 2919 | |
2810 | 2920 | echo ' |
2811 | 2921 | </dt> |
@@ -2813,17 +2923,20 @@ discard block |
||
2813 | 2923 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
2814 | 2924 | |
2815 | 2925 | // If there is a limit at all! |
2816 | - if (!empty($context['signature_limits']['max_length'])) |
|
2817 | - echo ' |
|
2926 | + if (!empty($context['signature_limits']['max_length'])) { |
|
2927 | + echo ' |
|
2818 | 2928 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
2929 | + } |
|
2819 | 2930 | |
2820 | - if (!empty($context['show_preview_button'])) |
|
2821 | - echo ' |
|
2931 | + if (!empty($context['show_preview_button'])) { |
|
2932 | + echo ' |
|
2822 | 2933 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">'; |
2934 | + } |
|
2823 | 2935 | |
2824 | - if ($context['signature_warning']) |
|
2825 | - echo ' |
|
2936 | + if ($context['signature_warning']) { |
|
2937 | + echo ' |
|
2826 | 2938 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
2939 | + } |
|
2827 | 2940 | |
2828 | 2941 | // Some javascript used to count how many characters have been used so far in the signature. |
2829 | 2942 | echo ' |
@@ -2868,9 +2981,10 @@ discard block |
||
2868 | 2981 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
2869 | 2982 | |
2870 | 2983 | // This lists all the file categories. |
2871 | - foreach ($context['avatars'] as $avatar) |
|
2872 | - echo ' |
|
2984 | + foreach ($context['avatars'] as $avatar) { |
|
2985 | + echo ' |
|
2873 | 2986 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
2987 | + } |
|
2874 | 2988 | echo ' |
2875 | 2989 | </select> |
2876 | 2990 | </div> |
@@ -2927,16 +3041,17 @@ discard block |
||
2927 | 3041 | <div id="avatar_gravatar"> |
2928 | 3042 | <img src="' . $context['member']['avatar']['href'] . '" alt="" />'; |
2929 | 3043 | |
2930 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
2931 | - echo ' |
|
3044 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
3045 | + echo ' |
|
2932 | 3046 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
2933 | - else |
|
3047 | + } else |
|
2934 | 3048 | { |
2935 | 3049 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
2936 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
2937 | - $textbox_value = ''; |
|
2938 | - else |
|
2939 | - $textbox_value = $context['member']['avatar']['external']; |
|
3050 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
3051 | + $textbox_value = ''; |
|
3052 | + } else { |
|
3053 | + $textbox_value = $context['member']['avatar']['external']; |
|
3054 | + } |
|
2940 | 3055 | |
2941 | 3056 | echo ' |
2942 | 3057 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -3008,8 +3123,9 @@ discard block |
||
3008 | 3123 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
3009 | 3124 | |
3010 | 3125 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
3011 | - if (empty($suffix)) |
|
3012 | - return; |
|
3126 | + if (empty($suffix)) { |
|
3127 | + return; |
|
3128 | + } |
|
3013 | 3129 | |
3014 | 3130 | echo ' |
3015 | 3131 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -3034,9 +3150,10 @@ discard block |
||
3034 | 3150 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
3035 | 3151 | |
3036 | 3152 | // Help the user by showing a list of common time formats. |
3037 | - foreach ($context['easy_timeformats'] as $time_format) |
|
3038 | - echo ' |
|
3153 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
3154 | + echo ' |
|
3039 | 3155 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
3156 | + } |
|
3040 | 3157 | echo ' |
3041 | 3158 | </select><br> |
3042 | 3159 | <input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30"> |
@@ -3073,9 +3190,10 @@ discard block |
||
3073 | 3190 | <dd> |
3074 | 3191 | <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">'; |
3075 | 3192 | |
3076 | - foreach ($context['smiley_sets'] as $set) |
|
3077 | - echo ' |
|
3193 | + foreach ($context['smiley_sets'] as $set) { |
|
3194 | + echo ' |
|
3078 | 3195 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
3196 | + } |
|
3079 | 3197 | echo ' |
3080 | 3198 | </select> |
3081 | 3199 | <img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)"> |
@@ -3126,10 +3244,11 @@ discard block |
||
3126 | 3244 | <img src="', $context['tfa_qr_url'], '" alt=""> |
3127 | 3245 | </div>'; |
3128 | 3246 | |
3129 | - if (!empty($context['from_ajax'])) |
|
3130 | - echo ' |
|
3247 | + if (!empty($context['from_ajax'])) { |
|
3248 | + echo ' |
|
3131 | 3249 | <br> |
3132 | 3250 | <a href="javascript:self.close();"></a>'; |
3251 | + } |
|
3133 | 3252 | |
3134 | 3253 | echo ' |
3135 | 3254 | </div> |
@@ -3168,15 +3287,16 @@ discard block |
||
3168 | 3287 | <div class="smalltext">', $txt['tfa_profile_desc'], '</div> |
3169 | 3288 | </dt> |
3170 | 3289 | <dd>'; |
3171 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
3172 | - echo ' |
|
3290 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
3291 | + echo ' |
|
3173 | 3292 | <a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
3174 | - elseif (!$context['tfa_enabled']) |
|
3175 | - echo ' |
|
3293 | + } elseif (!$context['tfa_enabled']) { |
|
3294 | + echo ' |
|
3176 | 3295 | ', $txt['tfa_profile_disabled']; |
3177 | - else |
|
3178 | - echo ' |
|
3296 | + } else { |
|
3297 | + echo ' |
|
3179 | 3298 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
3299 | + } |
|
3180 | 3300 | echo ' |
3181 | 3301 | </dd>'; |
3182 | 3302 | } |
@@ -53,11 +53,13 @@ discard block |
||
53 | 53 | <p>'; |
54 | 54 | |
55 | 55 | // Show just numbers...? |
56 | - if ($settings['display_who_viewing'] == 1) |
|
57 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
56 | + if ($settings['display_who_viewing'] == 1) { |
|
57 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
58 | + } |
|
58 | 59 | // Or show the actual people viewing the topic? |
59 | - else |
|
60 | - 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'] . ')'); |
|
60 | + else { |
|
61 | + 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'] . ')'); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | // Now show how many guests are here too. |
63 | 65 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -95,10 +97,11 @@ discard block |
||
95 | 97 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
96 | 98 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
97 | 99 | |
98 | - if ($context['allow_results_view']) |
|
99 | - echo ' |
|
100 | + if ($context['allow_results_view']) { |
|
101 | + echo ' |
|
100 | 102 | ', $option['bar_ndt'], ' |
101 | 103 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
104 | + } |
|
102 | 105 | |
103 | 106 | echo ' |
104 | 107 | </dd>'; |
@@ -107,9 +110,10 @@ discard block |
||
107 | 110 | echo ' |
108 | 111 | </dl>'; |
109 | 112 | |
110 | - if ($context['allow_results_view']) |
|
111 | - echo ' |
|
113 | + if ($context['allow_results_view']) { |
|
114 | + echo ' |
|
112 | 115 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
116 | + } |
|
113 | 117 | } |
114 | 118 | // They are allowed to vote! Go to it! |
115 | 119 | else |
@@ -118,17 +122,19 @@ discard block |
||
118 | 122 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
119 | 123 | |
120 | 124 | // Show a warning if they are allowed more than one option. |
121 | - if ($context['poll']['allowed_warning']) |
|
122 | - echo ' |
|
125 | + if ($context['poll']['allowed_warning']) { |
|
126 | + echo ' |
|
123 | 127 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
128 | + } |
|
124 | 129 | |
125 | 130 | echo ' |
126 | 131 | <ul class="options">'; |
127 | 132 | |
128 | 133 | // Show each option with its button - a radio likely. |
129 | - foreach ($context['poll']['options'] as $option) |
|
130 | - echo ' |
|
134 | + foreach ($context['poll']['options'] as $option) { |
|
135 | + echo ' |
|
131 | 136 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
137 | + } |
|
132 | 138 | |
133 | 139 | echo ' |
134 | 140 | </ul> |
@@ -140,9 +146,10 @@ discard block |
||
140 | 146 | } |
141 | 147 | |
142 | 148 | // Is the clock ticking? |
143 | - if (!empty($context['poll']['expire_time'])) |
|
144 | - echo ' |
|
149 | + if (!empty($context['poll']['expire_time'])) { |
|
150 | + echo ' |
|
145 | 151 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
152 | + } |
|
146 | 153 | |
147 | 154 | echo ' |
148 | 155 | </div><!-- #poll_options --> |
@@ -172,11 +179,13 @@ discard block |
||
172 | 179 | <li> |
173 | 180 | <strong class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></strong>'; |
174 | 181 | |
175 | - if ($event['can_edit']) |
|
176 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
182 | + if ($event['can_edit']) { |
|
183 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
184 | + } |
|
177 | 185 | |
178 | - if ($event['can_export']) |
|
179 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
186 | + if ($event['can_export']) { |
|
187 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
188 | + } |
|
180 | 189 | |
181 | 190 | echo ' |
182 | 191 | <br>'; |
@@ -184,14 +193,14 @@ discard block |
||
184 | 193 | if (!empty($event['allday'])) |
185 | 194 | { |
186 | 195 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
187 | - } |
|
188 | - else |
|
196 | + } else |
|
189 | 197 | { |
190 | 198 | // Display event info relative to user's local timezone |
191 | 199 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
192 | 200 | |
193 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
194 | - echo trim($event['end_date_local']) . ', '; |
|
201 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
202 | + echo trim($event['end_date_local']) . ', '; |
|
203 | + } |
|
195 | 204 | |
196 | 205 | echo trim($event['end_time_local']); |
197 | 206 | |
@@ -200,24 +209,28 @@ discard block |
||
200 | 209 | { |
201 | 210 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
202 | 211 | |
203 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
204 | - echo trim($event['start_date_orig']), ', '; |
|
212 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
213 | + echo trim($event['start_date_orig']), ', '; |
|
214 | + } |
|
205 | 215 | |
206 | 216 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
207 | 217 | |
208 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
209 | - echo trim($event['end_date_orig']) . ', '; |
|
218 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
219 | + echo trim($event['end_date_orig']) . ', '; |
|
220 | + } |
|
210 | 221 | |
211 | 222 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
212 | 223 | } |
213 | 224 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
214 | - else |
|
215 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
225 | + else { |
|
226 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
227 | + } |
|
216 | 228 | } |
217 | 229 | |
218 | - if (!empty($event['location'])) |
|
219 | - echo ' |
|
230 | + if (!empty($event['location'])) { |
|
231 | + echo ' |
|
220 | 232 | <br>', $event['location']; |
233 | + } |
|
221 | 234 | |
222 | 235 | echo ' |
223 | 236 | </li>'; |
@@ -256,8 +269,9 @@ discard block |
||
256 | 269 | $context['removableMessageIDs'] = array(); |
257 | 270 | |
258 | 271 | // Get all the messages... |
259 | - while ($message = $context['get_message']()) |
|
260 | - template_single_post($message); |
|
272 | + while ($message = $context['get_message']()) { |
|
273 | + template_single_post($message); |
|
274 | + } |
|
261 | 275 | |
262 | 276 | echo ' |
263 | 277 | </form> |
@@ -295,8 +309,9 @@ discard block |
||
295 | 309 | <div id="display_jump_to"> </div>'; |
296 | 310 | |
297 | 311 | // Show quickreply |
298 | - if ($context['can_reply']) |
|
299 | - template_quickreply(); |
|
312 | + if ($context['can_reply']) { |
|
313 | + template_quickreply(); |
|
314 | + } |
|
300 | 315 | |
301 | 316 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
302 | 317 | echo ' |
@@ -311,8 +326,8 @@ discard block |
||
311 | 326 | </div>'; |
312 | 327 | |
313 | 328 | // Show the moderation button & pop only if user can moderate |
314 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
315 | - echo ' |
|
329 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
330 | + echo ' |
|
316 | 331 | <div id="mobile_moderation" class="popup_container"> |
317 | 332 | <div class="popup_window description"> |
318 | 333 | <div class="popup_heading"> |
@@ -324,6 +339,7 @@ discard block |
||
324 | 339 | </div> |
325 | 340 | </div> |
326 | 341 | </div>'; |
342 | + } |
|
327 | 343 | |
328 | 344 | echo ' |
329 | 345 | <script>'; |
@@ -447,9 +463,10 @@ discard block |
||
447 | 463 | }); |
448 | 464 | }'; |
449 | 465 | |
450 | - if (!empty($context['ignoredMsgs'])) |
|
451 | - echo ' |
|
466 | + if (!empty($context['ignoredMsgs'])) { |
|
467 | + echo ' |
|
452 | 468 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
469 | + } |
|
453 | 470 | |
454 | 471 | echo ' |
455 | 472 | </script>'; |
@@ -466,8 +483,9 @@ discard block |
||
466 | 483 | |
467 | 484 | $ignoring = false; |
468 | 485 | |
469 | - if ($message['can_remove']) |
|
470 | - $context['removableMessageIDs'][] = $message['id']; |
|
486 | + if ($message['can_remove']) { |
|
487 | + $context['removableMessageIDs'][] = $message['id']; |
|
488 | + } |
|
471 | 489 | |
472 | 490 | // Are we ignoring this message? |
473 | 491 | if (!empty($message['is_ignored'])) |
@@ -494,9 +512,10 @@ discard block |
||
494 | 512 | <div class="custom_fields_above_member"> |
495 | 513 | <ul class="nolist">'; |
496 | 514 | |
497 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
498 | - echo ' |
|
515 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
516 | + echo ' |
|
499 | 517 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
518 | + } |
|
500 | 519 | |
501 | 520 | echo ' |
502 | 521 | </ul> |
@@ -507,76 +526,87 @@ discard block |
||
507 | 526 | <h4>'; |
508 | 527 | |
509 | 528 | // Show online and offline buttons? |
510 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
511 | - echo ' |
|
529 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
530 | + echo ' |
|
512 | 531 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
532 | + } |
|
513 | 533 | |
514 | 534 | // Custom fields BEFORE the username? |
515 | - if (!empty($message['custom_fields']['before_member'])) |
|
516 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
535 | + if (!empty($message['custom_fields']['before_member'])) { |
|
536 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
517 | 537 | echo ' |
518 | 538 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
539 | + } |
|
519 | 540 | |
520 | 541 | // Show a link to the member's profile. |
521 | 542 | echo ' |
522 | 543 | ', $message['member']['link']; |
523 | 544 | |
524 | 545 | // Custom fields AFTER the username? |
525 | - if (!empty($message['custom_fields']['after_member'])) |
|
526 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
546 | + if (!empty($message['custom_fields']['after_member'])) { |
|
547 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
527 | 548 | echo ' |
528 | 549 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
550 | + } |
|
529 | 551 | |
530 | 552 | echo ' |
531 | 553 | </h4> |
532 | 554 | <ul class="user_info">'; |
533 | 555 | |
534 | 556 | // Show the user's avatar. |
535 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
536 | - echo ' |
|
557 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
558 | + echo ' |
|
537 | 559 | <li class="avatar"> |
538 | 560 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
539 | 561 | </li>'; |
562 | + } |
|
540 | 563 | |
541 | 564 | // Are there any custom fields below the avatar? |
542 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
543 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
565 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
566 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
544 | 567 | echo ' |
545 | 568 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
569 | + } |
|
546 | 570 | |
547 | 571 | // Show the post group icons, but not for guests. |
548 | - if (!$message['member']['is_guest']) |
|
549 | - echo ' |
|
572 | + if (!$message['member']['is_guest']) { |
|
573 | + echo ' |
|
550 | 574 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
575 | + } |
|
551 | 576 | |
552 | 577 | // Show the member's primary group (like 'Administrator') if they have one. |
553 | - if (!empty($message['member']['group'])) |
|
554 | - echo ' |
|
578 | + if (!empty($message['member']['group'])) { |
|
579 | + echo ' |
|
555 | 580 | <li class="membergroup">', $message['member']['group'], '</li>'; |
581 | + } |
|
556 | 582 | |
557 | 583 | // Show the member's custom title, if they have one. |
558 | - if (!empty($message['member']['title'])) |
|
559 | - echo ' |
|
584 | + if (!empty($message['member']['title'])) { |
|
585 | + echo ' |
|
560 | 586 | <li class="title">', $message['member']['title'], '</li>'; |
587 | + } |
|
561 | 588 | |
562 | 589 | // Don't show these things for guests. |
563 | 590 | if (!$message['member']['is_guest']) |
564 | 591 | { |
565 | 592 | |
566 | 593 | // 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. |
567 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
568 | - echo ' |
|
594 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
595 | + echo ' |
|
569 | 596 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
597 | + } |
|
570 | 598 | |
571 | 599 | // Show how many posts they have made. |
572 | - if (!isset($context['disabled_fields']['posts'])) |
|
573 | - echo ' |
|
600 | + if (!isset($context['disabled_fields']['posts'])) { |
|
601 | + echo ' |
|
574 | 602 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
603 | + } |
|
575 | 604 | |
576 | 605 | // Show their personal text? |
577 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
578 | - echo ' |
|
606 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
607 | + echo ' |
|
579 | 608 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
609 | + } |
|
580 | 610 | |
581 | 611 | // Any custom fields to show as icons? |
582 | 612 | if (!empty($message['custom_fields']['icons'])) |
@@ -585,9 +615,10 @@ discard block |
||
585 | 615 | <li class="im_icons"> |
586 | 616 | <ol>'; |
587 | 617 | |
588 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
589 | - echo ' |
|
618 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
619 | + echo ' |
|
590 | 620 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
621 | + } |
|
591 | 622 | |
592 | 623 | echo ' |
593 | 624 | </ol> |
@@ -602,19 +633,22 @@ discard block |
||
602 | 633 | <ol class="profile_icons">'; |
603 | 634 | |
604 | 635 | // Don't show an icon if they haven't specified a website. |
605 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
606 | - echo ' |
|
636 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
637 | + echo ' |
|
607 | 638 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
639 | + } |
|
608 | 640 | |
609 | 641 | // Since we know this person isn't a guest, you *can* message them. |
610 | - if ($context['can_send_pm']) |
|
611 | - echo ' |
|
642 | + if ($context['can_send_pm']) { |
|
643 | + echo ' |
|
612 | 644 | <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>'; |
645 | + } |
|
613 | 646 | |
614 | 647 | // Show the email if necessary |
615 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
616 | - echo ' |
|
648 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
649 | + echo ' |
|
617 | 650 | <li class="email"><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>'; |
651 | + } |
|
618 | 652 | |
619 | 653 | echo ' |
620 | 654 | </ol> |
@@ -622,48 +656,56 @@ discard block |
||
622 | 656 | } |
623 | 657 | |
624 | 658 | // Any custom fields for standard placement? |
625 | - if (!empty($message['custom_fields']['standard'])) |
|
626 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
659 | + if (!empty($message['custom_fields']['standard'])) { |
|
660 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
627 | 661 | echo ' |
628 | 662 | <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
663 | + } |
|
629 | 664 | |
630 | 665 | } |
631 | 666 | // Otherwise, show the guest's email. |
632 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
633 | - echo ' |
|
667 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
668 | + echo ' |
|
634 | 669 | <li class="email"><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>'; |
670 | + } |
|
635 | 671 | |
636 | 672 | // Show the IP to this user for this post - because you can moderate? |
637 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
638 | - echo ' |
|
673 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
674 | + echo ' |
|
639 | 675 | <li class="poster_ip"><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></li>'; |
676 | + } |
|
640 | 677 | |
641 | 678 | // Or, should we show it because this is you? |
642 | - elseif ($message['can_see_ip']) |
|
643 | - echo ' |
|
679 | + elseif ($message['can_see_ip']) { |
|
680 | + echo ' |
|
644 | 681 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
682 | + } |
|
645 | 683 | |
646 | 684 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
647 | - elseif (!$context['user']['is_guest']) |
|
648 | - echo ' |
|
685 | + elseif (!$context['user']['is_guest']) { |
|
686 | + echo ' |
|
649 | 687 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
688 | + } |
|
650 | 689 | |
651 | 690 | // Otherwise, you see NOTHING! |
652 | - else |
|
653 | - echo ' |
|
691 | + else { |
|
692 | + echo ' |
|
654 | 693 | <li class="poster_ip">', $txt['logged'], '</li>'; |
694 | + } |
|
655 | 695 | |
656 | 696 | // Are we showing the warning status? |
657 | 697 | // Don't show these things for guests. |
658 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
659 | - echo ' |
|
698 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
699 | + echo ' |
|
660 | 700 | <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>'; |
701 | + } |
|
661 | 702 | |
662 | 703 | // Are there any custom fields to show at the bottom of the poster info? |
663 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
664 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
704 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
705 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
665 | 706 | echo ' |
666 | 707 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
708 | + } |
|
667 | 709 | |
668 | 710 | // Poster info ends. |
669 | 711 | echo ' |
@@ -692,9 +734,10 @@ discard block |
||
692 | 734 | echo ' |
693 | 735 | <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
694 | 736 | |
695 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
696 | - echo |
|
737 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
738 | + echo |
|
697 | 739 | $message['modified']['last_edit_text']; |
740 | + } |
|
698 | 741 | |
699 | 742 | echo ' |
700 | 743 | </span> |
@@ -703,22 +746,24 @@ discard block |
||
703 | 746 | </div><!-- .keyinfo -->'; |
704 | 747 | |
705 | 748 | // Ignoring this user? Hide the post. |
706 | - if ($ignoring) |
|
707 | - echo ' |
|
749 | + if ($ignoring) { |
|
750 | + echo ' |
|
708 | 751 | <div id="msg_', $message['id'], '_ignored_prompt"> |
709 | 752 | ', $txt['ignoring_user'], ' |
710 | 753 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
711 | 754 | </div>'; |
755 | + } |
|
712 | 756 | |
713 | 757 | // Show the post itself, finally! |
714 | 758 | echo ' |
715 | 759 | <div class="post">'; |
716 | 760 | |
717 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
718 | - echo ' |
|
761 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
762 | + echo ' |
|
719 | 763 | <div class="approve_post"> |
720 | 764 | ', $txt['post_awaiting_approval'], ' |
721 | 765 | </div>'; |
766 | + } |
|
722 | 767 | echo ' |
723 | 768 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '> |
724 | 769 | ', $message['body'], ' |
@@ -737,9 +782,9 @@ discard block |
||
737 | 782 | foreach ($message['attachment'] as $attachment) |
738 | 783 | { |
739 | 784 | // Do we want this attachment to not be showed here? |
740 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
741 | - continue; |
|
742 | - elseif (!$div_output) |
|
785 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
786 | + continue; |
|
787 | + } elseif (!$div_output) |
|
743 | 788 | { |
744 | 789 | $div_output = true; |
745 | 790 | |
@@ -755,9 +800,10 @@ discard block |
||
755 | 800 | <fieldset> |
756 | 801 | <legend>', $txt['attach_awaiting_approve']; |
757 | 802 | |
758 | - if ($context['can_approve']) |
|
759 | - echo ' |
|
803 | + if ($context['can_approve']) { |
|
804 | + echo ' |
|
760 | 805 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
806 | + } |
|
761 | 807 | |
762 | 808 | echo ' |
763 | 809 | </legend>'; |
@@ -771,12 +817,13 @@ discard block |
||
771 | 817 | echo ' |
772 | 818 | <div class="attachments_top">'; |
773 | 819 | |
774 | - if ($attachment['thumbnail']['has_thumb']) |
|
775 | - echo ' |
|
820 | + if ($attachment['thumbnail']['has_thumb']) { |
|
821 | + echo ' |
|
776 | 822 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
777 | - else |
|
778 | - echo ' |
|
823 | + } else { |
|
824 | + echo ' |
|
779 | 825 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
826 | + } |
|
780 | 827 | |
781 | 828 | echo ' |
782 | 829 | </div><!-- .attachments_top -->'; |
@@ -786,9 +833,10 @@ discard block |
||
786 | 833 | <div class="attachments_bot"> |
787 | 834 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
788 | 835 | |
789 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
790 | - echo ' |
|
836 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
837 | + echo ' |
|
791 | 838 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] | [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
839 | + } |
|
792 | 840 | echo ' |
793 | 841 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
794 | 842 | </div><!-- .attachments_bot -->'; |
@@ -797,35 +845,40 @@ discard block |
||
797 | 845 | </div><!-- .attached -->'; |
798 | 846 | |
799 | 847 | // Next attachment line ? |
800 | - if (++$i % $attachments_per_line === 0) |
|
801 | - echo ' |
|
848 | + if (++$i % $attachments_per_line === 0) { |
|
849 | + echo ' |
|
802 | 850 | <br>'; |
851 | + } |
|
803 | 852 | } |
804 | 853 | |
805 | 854 | // If we had unapproved attachments clean up. |
806 | - if ($last_approved_state == 0) |
|
807 | - echo ' |
|
855 | + if ($last_approved_state == 0) { |
|
856 | + echo ' |
|
808 | 857 | </fieldset>'; |
858 | + } |
|
809 | 859 | |
810 | 860 | // Only do this if we output a div above - otherwise it'll break things |
811 | - if ($div_output) |
|
812 | - echo ' |
|
861 | + if ($div_output) { |
|
862 | + echo ' |
|
813 | 863 | </div><!-- #msg_[id]_footer -->'; |
864 | + } |
|
814 | 865 | } |
815 | 866 | |
816 | 867 | // And stuff below the attachments. |
817 | - if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
818 | - echo ' |
|
868 | + if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
869 | + echo ' |
|
819 | 870 | <div class="under_message">'; |
871 | + } |
|
820 | 872 | |
821 | 873 | // Maybe they want to report this post to the moderator(s)? |
822 | - if ($context['can_report_moderator']) |
|
823 | - echo ' |
|
874 | + if ($context['can_report_moderator']) { |
|
875 | + echo ' |
|
824 | 876 | <ul class="floatright smalltext"> |
825 | 877 | <li class="report_link"> |
826 | 878 | <a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> |
827 | 879 | </li> |
828 | 880 | </ul>'; |
881 | + } |
|
829 | 882 | |
830 | 883 | // What about likes? |
831 | 884 | if (!empty($modSettings['enable_likes'])) |
@@ -872,78 +925,91 @@ discard block |
||
872 | 925 | <ul class="quickbuttons">'; |
873 | 926 | |
874 | 927 | // Can they quote? if so they can select and quote as well! |
875 | - if ($context['can_quote']) |
|
876 | - echo ' |
|
928 | + if ($context['can_quote']) { |
|
929 | + echo ' |
|
877 | 930 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
878 | 931 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li>'; |
932 | + } |
|
879 | 933 | |
880 | 934 | // Can the user modify the contents of this post? Show the modify inline image. |
881 | - if ($message['can_modify']) |
|
882 | - echo ' |
|
935 | + if ($message['can_modify']) { |
|
936 | + echo ' |
|
883 | 937 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
938 | + } |
|
884 | 939 | |
885 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
886 | - echo ' |
|
940 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
941 | + echo ' |
|
887 | 942 | <li class="post_options">', $txt['post_options']; |
943 | + } |
|
888 | 944 | |
889 | 945 | echo ' |
890 | 946 | <ul>'; |
891 | 947 | |
892 | 948 | // Can the user modify the contents of this post? |
893 | - if ($message['can_modify']) |
|
894 | - echo ' |
|
949 | + if ($message['can_modify']) { |
|
950 | + echo ' |
|
895 | 951 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
952 | + } |
|
896 | 953 | |
897 | 954 | // How about... even... remove it entirely?! |
898 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
899 | - echo ' |
|
955 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
956 | + echo ' |
|
900 | 957 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>'; |
901 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
902 | - echo ' |
|
958 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
959 | + echo ' |
|
903 | 960 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
961 | + } |
|
904 | 962 | |
905 | 963 | // What about splitting it off the rest of the topic? |
906 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
907 | - echo ' |
|
964 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
965 | + echo ' |
|
908 | 966 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
967 | + } |
|
909 | 968 | |
910 | 969 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
911 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
912 | - echo ' |
|
970 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
971 | + echo ' |
|
913 | 972 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
973 | + } |
|
914 | 974 | |
915 | 975 | // Can we restore topics? |
916 | - if ($context['can_restore_msg']) |
|
917 | - echo ' |
|
976 | + if ($context['can_restore_msg']) { |
|
977 | + echo ' |
|
918 | 978 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
979 | + } |
|
919 | 980 | |
920 | 981 | // Maybe we can approve it, maybe we should? |
921 | - if ($message['can_approve']) |
|
922 | - echo ' |
|
982 | + if ($message['can_approve']) { |
|
983 | + echo ' |
|
923 | 984 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
985 | + } |
|
924 | 986 | |
925 | 987 | // Maybe we can unapprove it? |
926 | - if ($message['can_unapprove']) |
|
927 | - echo ' |
|
988 | + if ($message['can_unapprove']) { |
|
989 | + echo ' |
|
928 | 990 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
991 | + } |
|
929 | 992 | |
930 | 993 | echo ' |
931 | 994 | </ul> |
932 | 995 | </li>'; |
933 | 996 | |
934 | 997 | // Show a checkbox for quick moderation? |
935 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
936 | - echo ' |
|
998 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
999 | + echo ' |
|
937 | 1000 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
1001 | + } |
|
938 | 1002 | |
939 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
940 | - echo ' |
|
1003 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
1004 | + echo ' |
|
941 | 1005 | </ul><!-- .quickbuttons -->'; |
1006 | + } |
|
942 | 1007 | } |
943 | 1008 | |
944 | - if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
945 | - echo ' |
|
1009 | + if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
1010 | + echo ' |
|
946 | 1011 | </div><!-- .under_message -->'; |
1012 | + } |
|
947 | 1013 | |
948 | 1014 | echo ' |
949 | 1015 | </div><!-- .postarea --> |
@@ -956,9 +1022,10 @@ discard block |
||
956 | 1022 | <div class="custom_fields_above_signature"> |
957 | 1023 | <ul class="nolist">'; |
958 | 1024 | |
959 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
960 | - echo ' |
|
1025 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
1026 | + echo ' |
|
961 | 1027 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
1028 | + } |
|
962 | 1029 | |
963 | 1030 | echo ' |
964 | 1031 | </ul> |
@@ -966,11 +1033,12 @@ discard block |
||
966 | 1033 | } |
967 | 1034 | |
968 | 1035 | // Show the member's signature? |
969 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
970 | - echo ' |
|
1036 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
1037 | + echo ' |
|
971 | 1038 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '> |
972 | 1039 | ', $message['member']['signature'], ' |
973 | 1040 | </div>'; |
1041 | + } |
|
974 | 1042 | |
975 | 1043 | |
976 | 1044 | // Are there any custom profile fields for below the signature? |
@@ -980,9 +1048,10 @@ discard block |
||
980 | 1048 | <div class="custom_fields_below_signature"> |
981 | 1049 | <ul class="nolist">'; |
982 | 1050 | |
983 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
984 | - echo ' |
|
1051 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
1052 | + echo ' |
|
985 | 1053 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
1054 | + } |
|
986 | 1055 | |
987 | 1056 | echo ' |
988 | 1057 | </ul> |
@@ -1032,8 +1101,8 @@ discard block |
||
1032 | 1101 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
1033 | 1102 | |
1034 | 1103 | // Guests just need more. |
1035 | - if ($context['user']['is_guest']) |
|
1036 | - echo ' |
|
1104 | + if ($context['user']['is_guest']) { |
|
1105 | + echo ' |
|
1037 | 1106 | <dl id="post_header"> |
1038 | 1107 | <dt> |
1039 | 1108 | ', $txt['name'], ': |
@@ -1048,6 +1117,7 @@ discard block |
||
1048 | 1117 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" required> |
1049 | 1118 | </dd> |
1050 | 1119 | </dl>'; |
1120 | + } |
|
1051 | 1121 | |
1052 | 1122 | echo ' |
1053 | 1123 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1095,8 +1165,8 @@ discard block |
||
1095 | 1165 | <br class="clear">'; |
1096 | 1166 | |
1097 | 1167 | // draft autosave available and the user has it enabled? |
1098 | - if (!empty($context['drafts_autosave'])) |
|
1099 | - echo ' |
|
1168 | + if (!empty($context['drafts_autosave'])) { |
|
1169 | + echo ' |
|
1100 | 1170 | <script> |
1101 | 1171 | var oDraftAutoSave = new smf_DraftAutoSave({ |
1102 | 1172 | sSelf: \'oDraftAutoSave\', |
@@ -1108,12 +1178,14 @@ discard block |
||
1108 | 1178 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
1109 | 1179 | }); |
1110 | 1180 | </script>'; |
1181 | + } |
|
1111 | 1182 | |
1112 | - if ($context['show_spellchecking']) |
|
1113 | - echo ' |
|
1183 | + if ($context['show_spellchecking']) { |
|
1184 | + echo ' |
|
1114 | 1185 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"> |
1115 | 1186 | <input type="hidden" name="spellstring" value=""> |
1116 | 1187 | </form>'; |
1188 | + } |
|
1117 | 1189 | |
1118 | 1190 | echo ' |
1119 | 1191 | <script> |
@@ -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 | * This helps organize things... |
@@ -37,13 +38,14 @@ discard block |
||
37 | 38 | |
38 | 39 | loadLanguage('PersonalMessage+Drafts'); |
39 | 40 | |
40 | - if (!isset($_REQUEST['xml'])) |
|
41 | - loadTemplate('PersonalMessage'); |
|
41 | + if (!isset($_REQUEST['xml'])) { |
|
42 | + loadTemplate('PersonalMessage'); |
|
43 | + } |
|
42 | 44 | |
43 | 45 | // Load up the members maximum message capacity. |
44 | - if ($user_info['is_admin']) |
|
45 | - $context['message_limit'] = 0; |
|
46 | - elseif (($context['message_limit'] = cache_get_data('msgLimit:' . $user_info['id'], 360)) === null) |
|
46 | + if ($user_info['is_admin']) { |
|
47 | + $context['message_limit'] = 0; |
|
48 | + } elseif (($context['message_limit'] = cache_get_data('msgLimit:' . $user_info['id'], 360)) === null) |
|
47 | 49 | { |
48 | 50 | // @todo Why do we do this? It seems like if they have any limit we should use it. |
49 | 51 | $request = $smcFunc['db_query']('', ' |
@@ -78,8 +80,9 @@ discard block |
||
78 | 80 | } |
79 | 81 | |
80 | 82 | // a previous message was sent successfully? show a small indication. |
81 | - if (isset($_GET['done']) && ($_GET['done'] == 'sent')) |
|
82 | - $context['pm_sent'] = true; |
|
83 | + if (isset($_GET['done']) && ($_GET['done'] == 'sent')) { |
|
84 | + $context['pm_sent'] = true; |
|
85 | + } |
|
83 | 86 | |
84 | 87 | $context['labels'] = array(); |
85 | 88 | |
@@ -210,11 +213,11 @@ discard block |
||
210 | 213 | { |
211 | 214 | $_REQUEST['sa'] = ''; |
212 | 215 | MessageFolder(); |
213 | - } |
|
214 | - else |
|
216 | + } else |
|
215 | 217 | { |
216 | - if (!isset($_REQUEST['xml']) && $_REQUEST['sa'] != 'popup') |
|
217 | - messageIndexBar($_REQUEST['sa']); |
|
218 | + if (!isset($_REQUEST['xml']) && $_REQUEST['sa'] != 'popup') { |
|
219 | + messageIndexBar($_REQUEST['sa']); |
|
220 | + } |
|
218 | 221 | |
219 | 222 | call_helper($subActions[$_REQUEST['sa']]); |
220 | 223 | } |
@@ -291,16 +294,17 @@ discard block |
||
291 | 294 | ); |
292 | 295 | |
293 | 296 | // Handle labels. |
294 | - if (empty($context['currently_using_labels'])) |
|
295 | - unset($pm_areas['labels']); |
|
296 | - else |
|
297 | + if (empty($context['currently_using_labels'])) { |
|
298 | + unset($pm_areas['labels']); |
|
299 | + } else |
|
297 | 300 | { |
298 | 301 | // Note we send labels by id as it will have less problems in the querystring. |
299 | 302 | $unread_in_labels = 0; |
300 | 303 | foreach ($context['labels'] as $label) |
301 | 304 | { |
302 | - if ($label['id'] == -1) |
|
303 | - continue; |
|
305 | + if ($label['id'] == -1) { |
|
306 | + continue; |
|
307 | + } |
|
304 | 308 | |
305 | 309 | // Count the amount of unread items in labels. |
306 | 310 | $unread_in_labels += $label['unread_messages']; |
@@ -314,8 +318,9 @@ discard block |
||
314 | 318 | ); |
315 | 319 | } |
316 | 320 | |
317 | - if (!empty($unread_in_labels)) |
|
318 | - $pm_areas['labels']['title'] .= ' <span class="amt">' . $unread_in_labels . '</span>'; |
|
321 | + if (!empty($unread_in_labels)) { |
|
322 | + $pm_areas['labels']['title'] .= ' <span class="amt">' . $unread_in_labels . '</span>'; |
|
323 | + } |
|
319 | 324 | } |
320 | 325 | |
321 | 326 | $pm_areas['folders']['areas']['inbox']['unread_messages'] = &$context['labels'][-1]['unread_messages']; |
@@ -353,8 +358,9 @@ discard block |
||
353 | 358 | unset($pm_areas); |
354 | 359 | |
355 | 360 | // No menu means no access. |
356 | - if (!$pm_include_data && (!$user_info['is_guest'] || validateSession())) |
|
357 | - fatal_lang_error('no_access', false); |
|
361 | + if (!$pm_include_data && (!$user_info['is_guest'] || validateSession())) { |
|
362 | + fatal_lang_error('no_access', false); |
|
363 | + } |
|
358 | 364 | |
359 | 365 | // Make a note of the Unique ID for this menu. |
360 | 366 | $context['pm_menu_id'] = $context['max_menu_id']; |
@@ -365,9 +371,10 @@ discard block |
||
365 | 371 | $context['menu_item_selected'] = $current_area; |
366 | 372 | |
367 | 373 | // Set the template for this area and add the profile layer. |
368 | - if (!isset($_REQUEST['xml'])) |
|
369 | - $context['template_layers'][] = 'pm'; |
|
370 | -} |
|
374 | + if (!isset($_REQUEST['xml'])) { |
|
375 | + $context['template_layers'][] = 'pm'; |
|
376 | + } |
|
377 | + } |
|
371 | 378 | |
372 | 379 | /** |
373 | 380 | * The popup for when we ask for the popup from the user. |
@@ -399,8 +406,9 @@ discard block |
||
399 | 406 | ) |
400 | 407 | ); |
401 | 408 | $pms = array(); |
402 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
403 | - $pms[] = $row[0]; |
|
409 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
410 | + $pms[] = $row[0]; |
|
411 | + } |
|
404 | 412 | $smcFunc['db_free_result']($request); |
405 | 413 | |
406 | 414 | if (!empty($pms)) |
@@ -428,8 +436,9 @@ discard block |
||
428 | 436 | ); |
429 | 437 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
430 | 438 | { |
431 | - if (!empty($row['id_member_from'])) |
|
432 | - $senders[] = $row['id_member_from']; |
|
439 | + if (!empty($row['id_member_from'])) { |
|
440 | + $senders[] = $row['id_member_from']; |
|
441 | + } |
|
433 | 442 | |
434 | 443 | $row['replied_to_you'] = $row['id_pm'] != $row['id_pm_head']; |
435 | 444 | $row['time'] = timeformat($row['timestamp']); |
@@ -439,13 +448,15 @@ discard block |
||
439 | 448 | $smcFunc['db_free_result']($request); |
440 | 449 | |
441 | 450 | $senders = loadMemberData($senders); |
442 | - foreach ($senders as $member) |
|
443 | - loadMemberContext($member); |
|
451 | + foreach ($senders as $member) { |
|
452 | + loadMemberContext($member); |
|
453 | + } |
|
444 | 454 | |
445 | 455 | // Having loaded everyone, attach them to the PMs. |
446 | - foreach ($context['unread_pms'] as $id_pm => $details) |
|
447 | - if (!empty($memberContext[$details['id_member_from']])) |
|
456 | + foreach ($context['unread_pms'] as $id_pm => $details) { |
|
457 | + if (!empty($memberContext[$details['id_member_from']])) |
|
448 | 458 | $context['unread_pms'][$id_pm]['member'] = &$memberContext[$details['id_member_from']]; |
459 | + } |
|
449 | 460 | } |
450 | 461 | } |
451 | 462 | |
@@ -465,12 +476,13 @@ discard block |
||
465 | 476 | } |
466 | 477 | |
467 | 478 | // Make sure the starting location is valid. |
468 | - if (isset($_GET['start']) && $_GET['start'] != 'new') |
|
469 | - $_GET['start'] = (int) $_GET['start']; |
|
470 | - elseif (!isset($_GET['start']) && !empty($options['view_newest_pm_first'])) |
|
471 | - $_GET['start'] = 0; |
|
472 | - else |
|
473 | - $_GET['start'] = 'new'; |
|
479 | + if (isset($_GET['start']) && $_GET['start'] != 'new') { |
|
480 | + $_GET['start'] = (int) $_GET['start']; |
|
481 | + } elseif (!isset($_GET['start']) && !empty($options['view_newest_pm_first'])) { |
|
482 | + $_GET['start'] = 0; |
|
483 | + } else { |
|
484 | + $_GET['start'] = 'new'; |
|
485 | + } |
|
474 | 486 | |
475 | 487 | // Set up some basic theme stuff. |
476 | 488 | $context['from_or_to'] = $context['folder'] != 'sent' ? 'from' : 'to'; |
@@ -487,8 +499,7 @@ discard block |
||
487 | 499 | { |
488 | 500 | $labelQuery = ' |
489 | 501 | AND pmr.in_inbox = 1'; |
490 | - } |
|
491 | - elseif ($context['folder'] != 'sent') |
|
502 | + } elseif ($context['folder'] != 'sent') |
|
492 | 503 | { |
493 | 504 | $labelJoin = ' |
494 | 505 | INNER JOIN {db_prefix}pm_labeled_messages AS pl ON (pl.id_pm = pmr.id_pm)'; |
@@ -530,22 +541,24 @@ discard block |
||
530 | 541 | $txt['delete_all'] = str_replace('PMBOX', $pmbox, $txt['delete_all']); |
531 | 542 | |
532 | 543 | // Now, build the link tree! |
533 | - if ($context['current_label_id'] == -1) |
|
534 | - $context['linktree'][] = array( |
|
544 | + if ($context['current_label_id'] == -1) { |
|
545 | + $context['linktree'][] = array( |
|
535 | 546 | 'url' => $scripturl . '?action=pm;f=' . $context['folder'], |
536 | 547 | 'name' => $pmbox |
537 | 548 | ); |
549 | + } |
|
538 | 550 | |
539 | 551 | // Build it further for a label. |
540 | - if ($context['current_label_id'] != -1) |
|
541 | - $context['linktree'][] = array( |
|
552 | + if ($context['current_label_id'] != -1) { |
|
553 | + $context['linktree'][] = array( |
|
542 | 554 | 'url' => $scripturl . '?action=pm;f=' . $context['folder'] . ';l=' . $context['current_label_id'], |
543 | 555 | 'name' => $txt['pm_current_label'] . ': ' . $context['current_label'] |
544 | 556 | ); |
557 | + } |
|
545 | 558 | |
546 | 559 | // Figure out how many messages there are. |
547 | - if ($context['folder'] == 'sent') |
|
548 | - $request = $smcFunc['db_query']('', ' |
|
560 | + if ($context['folder'] == 'sent') { |
|
561 | + $request = $smcFunc['db_query']('', ' |
|
549 | 562 | SELECT COUNT(' . ($context['display_mode'] == 2 ? 'DISTINCT pm.id_pm_head' : '*') . ') |
550 | 563 | FROM {db_prefix}personal_messages AS pm |
551 | 564 | WHERE pm.id_member_from = {int:current_member} |
@@ -555,8 +568,8 @@ discard block |
||
555 | 568 | 'not_deleted' => 0, |
556 | 569 | ) |
557 | 570 | ); |
558 | - else |
|
559 | - $request = $smcFunc['db_query']('', ' |
|
571 | + } else { |
|
572 | + $request = $smcFunc['db_query']('', ' |
|
560 | 573 | SELECT COUNT(' . ($context['display_mode'] == 2 ? 'DISTINCT pm.id_pm_head' : '*') . ') |
561 | 574 | FROM {db_prefix}pm_recipients AS pmr' . ($context['display_mode'] == 2 ? ' |
562 | 575 | INNER JOIN {db_prefix}personal_messages AS pm ON (pm.id_pm = pmr.id_pm)' : '') . $labelJoin . ' |
@@ -567,6 +580,7 @@ discard block |
||
567 | 580 | 'not_deleted' => 0, |
568 | 581 | ) |
569 | 582 | ); |
583 | + } |
|
570 | 584 | list ($max_messages) = $smcFunc['db_fetch_row']($request); |
571 | 585 | $smcFunc['db_free_result']($request); |
572 | 586 | |
@@ -575,10 +589,11 @@ discard block |
||
575 | 589 | $maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages']; |
576 | 590 | |
577 | 591 | // Start on the last page. |
578 | - if (!is_numeric($_GET['start']) || $_GET['start'] >= $max_messages) |
|
579 | - $_GET['start'] = ($max_messages - 1) - (($max_messages - 1) % $maxPerPage); |
|
580 | - elseif ($_GET['start'] < 0) |
|
581 | - $_GET['start'] = 0; |
|
592 | + if (!is_numeric($_GET['start']) || $_GET['start'] >= $max_messages) { |
|
593 | + $_GET['start'] = ($max_messages - 1) - (($max_messages - 1) % $maxPerPage); |
|
594 | + } elseif ($_GET['start'] < 0) { |
|
595 | + $_GET['start'] = 0; |
|
596 | + } |
|
582 | 597 | |
583 | 598 | // ... but wait - what if we want to start from a specific message? |
584 | 599 | if (isset($_GET['pmid'])) |
@@ -586,19 +601,21 @@ discard block |
||
586 | 601 | $pmID = (int) $_GET['pmid']; |
587 | 602 | |
588 | 603 | // Make sure you have access to this PM. |
589 | - if (!isAccessiblePM($pmID, $context['folder'] == 'sent' ? 'outbox' : 'inbox')) |
|
590 | - fatal_lang_error('no_access', false); |
|
604 | + if (!isAccessiblePM($pmID, $context['folder'] == 'sent' ? 'outbox' : 'inbox')) { |
|
605 | + fatal_lang_error('no_access', false); |
|
606 | + } |
|
591 | 607 | |
592 | 608 | $context['current_pm'] = $pmID; |
593 | 609 | |
594 | 610 | // With only one page of PM's we're gonna want page 1. |
595 | - if ($max_messages <= $maxPerPage) |
|
596 | - $_GET['start'] = 0; |
|
611 | + if ($max_messages <= $maxPerPage) { |
|
612 | + $_GET['start'] = 0; |
|
613 | + } |
|
597 | 614 | // If we pass kstart we assume we're in the right place. |
598 | 615 | elseif (!isset($_GET['kstart'])) |
599 | 616 | { |
600 | - if ($context['folder'] == 'sent') |
|
601 | - $request = $smcFunc['db_query']('', ' |
|
617 | + if ($context['folder'] == 'sent') { |
|
618 | + $request = $smcFunc['db_query']('', ' |
|
602 | 619 | SELECT COUNT(' . ($context['display_mode'] == 2 ? 'DISTINCT pm.id_pm_head' : '*') . ') |
603 | 620 | FROM {db_prefix}personal_messages |
604 | 621 | WHERE id_member_from = {int:current_member} |
@@ -610,8 +627,8 @@ discard block |
||
610 | 627 | 'id_pm' => $pmID, |
611 | 628 | ) |
612 | 629 | ); |
613 | - else |
|
614 | - $request = $smcFunc['db_query']('', ' |
|
630 | + } else { |
|
631 | + $request = $smcFunc['db_query']('', ' |
|
615 | 632 | SELECT COUNT(' . ($context['display_mode'] == 2 ? 'DISTINCT pm.id_pm_head' : '*') . ') |
616 | 633 | FROM {db_prefix}pm_recipients AS pmr' . ($context['display_mode'] == 2 ? ' |
617 | 634 | INNER JOIN {db_prefix}personal_messages AS pm ON (pm.id_pm = pmr.id_pm)' : '') . $labelJoin . ' |
@@ -624,6 +641,7 @@ discard block |
||
624 | 641 | 'id_pm' => $pmID, |
625 | 642 | ) |
626 | 643 | ); |
644 | + } |
|
627 | 645 | |
628 | 646 | list ($_GET['start']) = $smcFunc['db_fetch_row']($request); |
629 | 647 | $smcFunc['db_free_result']($request); |
@@ -638,8 +656,9 @@ discard block |
||
638 | 656 | { |
639 | 657 | $pmsg = (int) $_GET['pmsg']; |
640 | 658 | |
641 | - if (!isAccessiblePM($pmsg, $context['folder'] == 'sent' ? 'outbox' : 'inbox')) |
|
642 | - fatal_lang_error('no_access', false); |
|
659 | + if (!isAccessiblePM($pmsg, $context['folder'] == 'sent' ? 'outbox' : 'inbox')) { |
|
660 | + fatal_lang_error('no_access', false); |
|
661 | + } |
|
643 | 662 | } |
644 | 663 | |
645 | 664 | // Set up the page index. |
@@ -734,8 +753,9 @@ discard block |
||
734 | 753 | { |
735 | 754 | if (!isset($recipients[$row['id_pm']])) |
736 | 755 | { |
737 | - if (isset($row['id_member_from'])) |
|
738 | - $posters[$row['id_pm']] = $row['id_member_from']; |
|
756 | + if (isset($row['id_member_from'])) { |
|
757 | + $posters[$row['id_pm']] = $row['id_member_from']; |
|
758 | + } |
|
739 | 759 | $pms[$row['id_pm']] = $row['id_pm']; |
740 | 760 | $recipients[$row['id_pm']] = array( |
741 | 761 | 'to' => array(), |
@@ -744,29 +764,33 @@ discard block |
||
744 | 764 | } |
745 | 765 | |
746 | 766 | // Keep track of the last message so we know what the head is without another query! |
747 | - if ((empty($pmID) && (empty($options['view_newest_pm_first']) || !isset($lastData))) || empty($lastData) || (!empty($pmID) && $pmID == $row['id_pm'])) |
|
748 | - $lastData = array( |
|
767 | + if ((empty($pmID) && (empty($options['view_newest_pm_first']) || !isset($lastData))) || empty($lastData) || (!empty($pmID) && $pmID == $row['id_pm'])) { |
|
768 | + $lastData = array( |
|
749 | 769 | 'id' => $row['id_pm'], |
750 | 770 | 'head' => $row['id_pm_head'], |
751 | 771 | ); |
772 | + } |
|
752 | 773 | } |
753 | 774 | $smcFunc['db_free_result']($request); |
754 | 775 | |
755 | 776 | // Make sure that we have been given a correct head pm id! |
756 | - if ($context['display_mode'] == 2 && !empty($pmID) && $pmID != $lastData['id']) |
|
757 | - fatal_lang_error('no_access', false); |
|
777 | + if ($context['display_mode'] == 2 && !empty($pmID) && $pmID != $lastData['id']) { |
|
778 | + fatal_lang_error('no_access', false); |
|
779 | + } |
|
758 | 780 | |
759 | 781 | if (!empty($pms)) |
760 | 782 | { |
761 | 783 | // Select the correct current message. |
762 | - if (empty($pmID)) |
|
763 | - $context['current_pm'] = $lastData['id']; |
|
784 | + if (empty($pmID)) { |
|
785 | + $context['current_pm'] = $lastData['id']; |
|
786 | + } |
|
764 | 787 | |
765 | 788 | // This is a list of the pm's that are used for "full" display. |
766 | - if ($context['display_mode'] == 0) |
|
767 | - $display_pms = $pms; |
|
768 | - else |
|
769 | - $display_pms = array($context['current_pm']); |
|
789 | + if ($context['display_mode'] == 0) { |
|
790 | + $display_pms = $pms; |
|
791 | + } else { |
|
792 | + $display_pms = array($context['current_pm']); |
|
793 | + } |
|
770 | 794 | |
771 | 795 | // At this point we know the main id_pm's. But - if we are looking at conversations we need the others! |
772 | 796 | if ($context['display_mode'] == 2) |
@@ -788,16 +812,18 @@ discard block |
||
788 | 812 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
789 | 813 | { |
790 | 814 | // This is, frankly, a joke. We will put in a workaround for people sending to themselves - yawn! |
791 | - if ($context['folder'] == 'sent' && $row['id_member_from'] == $user_info['id'] && $row['deleted_by_sender'] == 1) |
|
792 | - continue; |
|
793 | - elseif ($row['id_member'] == $user_info['id'] & $row['deleted'] == 1) |
|
794 | - continue; |
|
815 | + if ($context['folder'] == 'sent' && $row['id_member_from'] == $user_info['id'] && $row['deleted_by_sender'] == 1) { |
|
816 | + continue; |
|
817 | + } elseif ($row['id_member'] == $user_info['id'] & $row['deleted'] == 1) { |
|
818 | + continue; |
|
819 | + } |
|
795 | 820 | |
796 | - if (!isset($recipients[$row['id_pm']])) |
|
797 | - $recipients[$row['id_pm']] = array( |
|
821 | + if (!isset($recipients[$row['id_pm']])) { |
|
822 | + $recipients[$row['id_pm']] = array( |
|
798 | 823 | 'to' => array(), |
799 | 824 | 'bcc' => array() |
800 | 825 | ); |
826 | + } |
|
801 | 827 | $display_pms[] = $row['id_pm']; |
802 | 828 | $posters[$row['id_pm']] = $row['id_member_from']; |
803 | 829 | } |
@@ -848,8 +874,9 @@ discard block |
||
848 | 874 | while ($row2 = $smcFunc['db_fetch_assoc']($request2)) |
849 | 875 | { |
850 | 876 | $l_id = $row2['id_label']; |
851 | - if (isset($context['labels'][$l_id])) |
|
852 | - $context['message_labels'][$row['id_pm']][$l_id] = array('id' => $l_id, 'name' => $context['labels'][$l_id]['name']); |
|
877 | + if (isset($context['labels'][$l_id])) { |
|
878 | + $context['message_labels'][$row['id_pm']][$l_id] = array('id' => $l_id, 'name' => $context['labels'][$l_id]['name']); |
|
879 | + } |
|
853 | 880 | } |
854 | 881 | |
855 | 882 | $smcFunc['db_free_result']($request2); |
@@ -866,9 +893,10 @@ discard block |
||
866 | 893 | // Make sure we don't load unnecessary data. |
867 | 894 | if ($context['display_mode'] == 1) |
868 | 895 | { |
869 | - foreach ($posters as $k => $v) |
|
870 | - if (!in_array($k, $display_pms)) |
|
896 | + foreach ($posters as $k => $v) { |
|
897 | + if (!in_array($k, $display_pms)) |
|
871 | 898 | unset($posters[$k]); |
899 | + } |
|
872 | 900 | } |
873 | 901 | |
874 | 902 | // Load any users.... |
@@ -879,8 +907,9 @@ discard block |
||
879 | 907 | { |
880 | 908 | // Get the order right. |
881 | 909 | $orderBy = array(); |
882 | - foreach (array_reverse($pms) as $pm) |
|
883 | - $orderBy[] = 'pm.id_pm = ' . $pm; |
|
910 | + foreach (array_reverse($pms) as $pm) { |
|
911 | + $orderBy[] = 'pm.id_pm = ' . $pm; |
|
912 | + } |
|
884 | 913 | |
885 | 914 | // Seperate query for these bits! |
886 | 915 | $subjects_request = $smcFunc['db_query']('', ' |
@@ -926,9 +955,9 @@ discard block |
||
926 | 955 | // Allow mods to add additional buttons here |
927 | 956 | call_integration_hook('integrate_conversation_buttons'); |
928 | 957 | } |
958 | + } else { |
|
959 | + $messages_request = false; |
|
929 | 960 | } |
930 | - else |
|
931 | - $messages_request = false; |
|
932 | 961 | |
933 | 962 | $context['can_send_pm'] = allowedTo('pm_send'); |
934 | 963 | $context['can_send_email'] = allowedTo('moderate_forum'); |
@@ -939,11 +968,13 @@ discard block |
||
939 | 968 | if ($context['folder'] != 'sent' && !empty($context['labels'][(int) $context['current_label_id']]['unread_messages'])) |
940 | 969 | { |
941 | 970 | // If the display mode is "old sk00l" do them all... |
942 | - if ($context['display_mode'] == 0) |
|
943 | - markMessages(null, $context['current_label_id']); |
|
971 | + if ($context['display_mode'] == 0) { |
|
972 | + markMessages(null, $context['current_label_id']); |
|
973 | + } |
|
944 | 974 | // Otherwise do just the current one! |
945 | - elseif (!empty($context['current_pm'])) |
|
946 | - markMessages($display_pms, $context['current_label_id']); |
|
975 | + elseif (!empty($context['current_pm'])) { |
|
976 | + markMessages($display_pms, $context['current_label_id']); |
|
977 | + } |
|
947 | 978 | } |
948 | 979 | } |
949 | 980 | |
@@ -961,8 +992,9 @@ discard block |
||
961 | 992 | |
962 | 993 | // Count the current message number.... |
963 | 994 | static $counter = null; |
964 | - if ($counter === null || $reset) |
|
965 | - $counter = $context['start']; |
|
995 | + if ($counter === null || $reset) { |
|
996 | + $counter = $context['start']; |
|
997 | + } |
|
966 | 998 | |
967 | 999 | static $temp_pm_selected = null; |
968 | 1000 | if ($temp_pm_selected === null) |
@@ -1007,19 +1039,22 @@ discard block |
||
1007 | 1039 | } |
1008 | 1040 | |
1009 | 1041 | // Bail if it's false, ie. no messages. |
1010 | - if ($messages_request == false) |
|
1011 | - return false; |
|
1042 | + if ($messages_request == false) { |
|
1043 | + return false; |
|
1044 | + } |
|
1012 | 1045 | |
1013 | 1046 | // Reset the data? |
1014 | - if ($reset == true) |
|
1015 | - return @$smcFunc['db_data_seek']($messages_request, 0); |
|
1047 | + if ($reset == true) { |
|
1048 | + return @$smcFunc['db_data_seek']($messages_request, 0); |
|
1049 | + } |
|
1016 | 1050 | |
1017 | 1051 | // Get the next one... bail if anything goes wrong. |
1018 | 1052 | $message = $smcFunc['db_fetch_assoc']($messages_request); |
1019 | 1053 | if (!$message) |
1020 | 1054 | { |
1021 | - if ($type != 'subject') |
|
1022 | - $smcFunc['db_free_result']($messages_request); |
|
1055 | + if ($type != 'subject') { |
|
1056 | + $smcFunc['db_free_result']($messages_request); |
|
1057 | + } |
|
1023 | 1058 | |
1024 | 1059 | return false; |
1025 | 1060 | } |
@@ -1039,8 +1074,7 @@ discard block |
||
1039 | 1074 | $memberContext[$message['id_member_from']]['email'] = ''; |
1040 | 1075 | $memberContext[$message['id_member_from']]['show_email'] = false; |
1041 | 1076 | $memberContext[$message['id_member_from']]['is_guest'] = true; |
1042 | - } |
|
1043 | - else |
|
1077 | + } else |
|
1044 | 1078 | { |
1045 | 1079 | $memberContext[$message['id_member_from']]['can_view_profile'] = allowedTo('profile_view') || ($message['id_member_from'] == $user_info['id'] && !$user_info['is_guest']); |
1046 | 1080 | $memberContext[$message['id_member_from']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member_from']]['warning_status'] && ($context['user']['can_mod'] || (!empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member_from'] == $user_info['id']))); |
@@ -1081,9 +1115,10 @@ discard block |
||
1081 | 1115 | $counter++; |
1082 | 1116 | |
1083 | 1117 | // Any custom profile fields? |
1084 | - if (!empty($memberContext[$message['id_member_from']]['custom_fields'])) |
|
1085 | - foreach ($memberContext[$message['id_member_from']]['custom_fields'] as $custom) |
|
1118 | + if (!empty($memberContext[$message['id_member_from']]['custom_fields'])) { |
|
1119 | + foreach ($memberContext[$message['id_member_from']]['custom_fields'] as $custom) |
|
1086 | 1120 | $output['custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom; |
1121 | + } |
|
1087 | 1122 | |
1088 | 1123 | call_integration_hook('integrate_prepare_pm_context', array(&$output, &$message, $counter)); |
1089 | 1124 | |
@@ -1107,22 +1142,28 @@ discard block |
||
1107 | 1142 | $context['search_params'][$k] = $v; |
1108 | 1143 | } |
1109 | 1144 | } |
1110 | - if (isset($_REQUEST['search'])) |
|
1111 | - $context['search_params']['search'] = un_htmlspecialchars($_REQUEST['search']); |
|
1145 | + if (isset($_REQUEST['search'])) { |
|
1146 | + $context['search_params']['search'] = un_htmlspecialchars($_REQUEST['search']); |
|
1147 | + } |
|
1112 | 1148 | |
1113 | - if (isset($context['search_params']['search'])) |
|
1114 | - $context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']); |
|
1115 | - if (isset($context['search_params']['userspec'])) |
|
1116 | - $context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']); |
|
1149 | + if (isset($context['search_params']['search'])) { |
|
1150 | + $context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']); |
|
1151 | + } |
|
1152 | + if (isset($context['search_params']['userspec'])) { |
|
1153 | + $context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']); |
|
1154 | + } |
|
1117 | 1155 | |
1118 | - if (!empty($context['search_params']['searchtype'])) |
|
1119 | - $context['search_params']['searchtype'] = 2; |
|
1156 | + if (!empty($context['search_params']['searchtype'])) { |
|
1157 | + $context['search_params']['searchtype'] = 2; |
|
1158 | + } |
|
1120 | 1159 | |
1121 | - if (!empty($context['search_params']['minage'])) |
|
1122 | - $context['search_params']['minage'] = (int) $context['search_params']['minage']; |
|
1160 | + if (!empty($context['search_params']['minage'])) { |
|
1161 | + $context['search_params']['minage'] = (int) $context['search_params']['minage']; |
|
1162 | + } |
|
1123 | 1163 | |
1124 | - if (!empty($context['search_params']['maxage'])) |
|
1125 | - $context['search_params']['maxage'] = (int) $context['search_params']['maxage']; |
|
1164 | + if (!empty($context['search_params']['maxage'])) { |
|
1165 | + $context['search_params']['maxage'] = (int) $context['search_params']['maxage']; |
|
1166 | + } |
|
1126 | 1167 | |
1127 | 1168 | $context['search_params']['subject_only'] = !empty($context['search_params']['subject_only']); |
1128 | 1169 | $context['search_params']['show_complete'] = !empty($context['search_params']['show_complete']); |
@@ -1149,8 +1190,9 @@ discard block |
||
1149 | 1190 | $context['search_errors']['messages'] = array(); |
1150 | 1191 | foreach ($context['search_errors'] as $search_error => $dummy) |
1151 | 1192 | { |
1152 | - if ($search_error == 'messages') |
|
1153 | - continue; |
|
1193 | + if ($search_error == 'messages') { |
|
1194 | + continue; |
|
1195 | + } |
|
1154 | 1196 | |
1155 | 1197 | $context['search_errors']['messages'][] = $txt['error_' . $search_error]; |
1156 | 1198 | } |
@@ -1172,8 +1214,9 @@ discard block |
||
1172 | 1214 | global $scripturl, $modSettings, $user_info, $context, $txt; |
1173 | 1215 | global $memberContext, $smcFunc; |
1174 | 1216 | |
1175 | - if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search']) |
|
1176 | - fatal_lang_error('loadavg_search_disabled', false); |
|
1217 | + if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search']) { |
|
1218 | + fatal_lang_error('loadavg_search_disabled', false); |
|
1219 | + } |
|
1177 | 1220 | |
1178 | 1221 | /** |
1179 | 1222 | * @todo For the moment force the folder to the inbox. |
@@ -1202,35 +1245,40 @@ discard block |
||
1202 | 1245 | $context['start'] = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
1203 | 1246 | |
1204 | 1247 | // Store whether simple search was used (needed if the user wants to do another query). |
1205 | - if (!isset($search_params['advanced'])) |
|
1206 | - $search_params['advanced'] = empty($_REQUEST['advanced']) ? 0 : 1; |
|
1248 | + if (!isset($search_params['advanced'])) { |
|
1249 | + $search_params['advanced'] = empty($_REQUEST['advanced']) ? 0 : 1; |
|
1250 | + } |
|
1207 | 1251 | |
1208 | 1252 | // 1 => 'allwords' (default, don't set as param) / 2 => 'anywords'. |
1209 | - if (!empty($search_params['searchtype']) || (!empty($_REQUEST['searchtype']) && $_REQUEST['searchtype'] == 2)) |
|
1210 | - $search_params['searchtype'] = 2; |
|
1253 | + if (!empty($search_params['searchtype']) || (!empty($_REQUEST['searchtype']) && $_REQUEST['searchtype'] == 2)) { |
|
1254 | + $search_params['searchtype'] = 2; |
|
1255 | + } |
|
1211 | 1256 | |
1212 | 1257 | // Minimum age of messages. Default to zero (don't set param in that case). |
1213 | - if (!empty($search_params['minage']) || (!empty($_REQUEST['minage']) && $_REQUEST['minage'] > 0)) |
|
1214 | - $search_params['minage'] = !empty($search_params['minage']) ? (int) $search_params['minage'] : (int) $_REQUEST['minage']; |
|
1258 | + if (!empty($search_params['minage']) || (!empty($_REQUEST['minage']) && $_REQUEST['minage'] > 0)) { |
|
1259 | + $search_params['minage'] = !empty($search_params['minage']) ? (int) $search_params['minage'] : (int) $_REQUEST['minage']; |
|
1260 | + } |
|
1215 | 1261 | |
1216 | 1262 | // Maximum age of messages. Default to infinite (9999 days: param not set). |
1217 | - if (!empty($search_params['maxage']) || (!empty($_REQUEST['maxage']) && $_REQUEST['maxage'] != 9999)) |
|
1218 | - $search_params['maxage'] = !empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage']; |
|
1263 | + if (!empty($search_params['maxage']) || (!empty($_REQUEST['maxage']) && $_REQUEST['maxage'] != 9999)) { |
|
1264 | + $search_params['maxage'] = !empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage']; |
|
1265 | + } |
|
1219 | 1266 | |
1220 | 1267 | $search_params['subject_only'] = !empty($search_params['subject_only']) || !empty($_REQUEST['subject_only']); |
1221 | 1268 | $search_params['show_complete'] = !empty($search_params['show_complete']) || !empty($_REQUEST['show_complete']); |
1222 | 1269 | |
1223 | 1270 | // Default the user name to a wildcard matching every user (*). |
1224 | - if (!empty($search_params['user_spec']) || (!empty($_REQUEST['userspec']) && $_REQUEST['userspec'] != '*')) |
|
1225 | - $search_params['userspec'] = isset($search_params['userspec']) ? $search_params['userspec'] : $_REQUEST['userspec']; |
|
1271 | + if (!empty($search_params['user_spec']) || (!empty($_REQUEST['userspec']) && $_REQUEST['userspec'] != '*')) { |
|
1272 | + $search_params['userspec'] = isset($search_params['userspec']) ? $search_params['userspec'] : $_REQUEST['userspec']; |
|
1273 | + } |
|
1226 | 1274 | |
1227 | 1275 | // This will be full of all kinds of parameters! |
1228 | 1276 | $searchq_parameters = array(); |
1229 | 1277 | |
1230 | 1278 | // If there's no specific user, then don't mention it in the main query. |
1231 | - if (empty($search_params['userspec'])) |
|
1232 | - $userQuery = ''; |
|
1233 | - else |
|
1279 | + if (empty($search_params['userspec'])) { |
|
1280 | + $userQuery = ''; |
|
1281 | + } else |
|
1234 | 1282 | { |
1235 | 1283 | $userString = strtr($smcFunc['htmlspecialchars']($search_params['userspec'], ENT_QUOTES), array('"' => '"')); |
1236 | 1284 | $userString = strtr($userString, array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_')); |
@@ -1242,8 +1290,9 @@ discard block |
||
1242 | 1290 | { |
1243 | 1291 | $possible_users[$k] = trim($possible_users[$k]); |
1244 | 1292 | |
1245 | - if (strlen($possible_users[$k]) == 0) |
|
1246 | - unset($possible_users[$k]); |
|
1293 | + if (strlen($possible_users[$k]) == 0) { |
|
1294 | + unset($possible_users[$k]); |
|
1295 | + } |
|
1247 | 1296 | } |
1248 | 1297 | |
1249 | 1298 | if (!empty($possible_users)) |
@@ -1255,8 +1304,9 @@ discard block |
||
1255 | 1304 | { |
1256 | 1305 | $where_params['name_' . $k] = $v; |
1257 | 1306 | $where_clause[] = '{raw:real_name} LIKE {string:name_' . $k . '}'; |
1258 | - if (!isset($where_params['real_name'])) |
|
1259 | - $where_params['real_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name'; |
|
1307 | + if (!isset($where_params['real_name'])) { |
|
1308 | + $where_params['real_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name'; |
|
1309 | + } |
|
1260 | 1310 | } |
1261 | 1311 | |
1262 | 1312 | // Who matches those criteria? |
@@ -1269,28 +1319,28 @@ discard block |
||
1269 | 1319 | ); |
1270 | 1320 | |
1271 | 1321 | // Simply do nothing if there're too many members matching the criteria. |
1272 | - if ($smcFunc['db_num_rows']($request) > $maxMembersToSearch) |
|
1273 | - $userQuery = ''; |
|
1274 | - elseif ($smcFunc['db_num_rows']($request) == 0) |
|
1322 | + if ($smcFunc['db_num_rows']($request) > $maxMembersToSearch) { |
|
1323 | + $userQuery = ''; |
|
1324 | + } elseif ($smcFunc['db_num_rows']($request) == 0) |
|
1275 | 1325 | { |
1276 | 1326 | $userQuery = 'AND pm.id_member_from = 0 AND ({raw:pm_from_name} LIKE {raw:guest_user_name_implode})'; |
1277 | 1327 | $searchq_parameters['guest_user_name_implode'] = '\'' . implode('\' OR ' . ($smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name') . ' LIKE \'', $possible_users) . '\''; |
1278 | 1328 | $searchq_parameters['pm_from_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name'; |
1279 | - } |
|
1280 | - else |
|
1329 | + } else |
|
1281 | 1330 | { |
1282 | 1331 | $memberlist = array(); |
1283 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1284 | - $memberlist[] = $row['id_member']; |
|
1332 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1333 | + $memberlist[] = $row['id_member']; |
|
1334 | + } |
|
1285 | 1335 | $userQuery = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND ({raw:pm_from_name} LIKE {raw:guest_user_name_implode})))'; |
1286 | 1336 | $searchq_parameters['guest_user_name_implode'] = '\'' . implode('\' OR ' . ($smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name') . ' LIKE \'', $possible_users) . '\''; |
1287 | 1337 | $searchq_parameters['member_list'] = $memberlist; |
1288 | 1338 | $searchq_parameters['pm_from_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name'; |
1289 | 1339 | } |
1290 | 1340 | $smcFunc['db_free_result']($request); |
1341 | + } else { |
|
1342 | + $userQuery = ''; |
|
1291 | 1343 | } |
1292 | - else |
|
1293 | - $userQuery = ''; |
|
1294 | 1344 | } |
1295 | 1345 | |
1296 | 1346 | // Setup the sorting variables... |
@@ -1298,8 +1348,9 @@ discard block |
||
1298 | 1348 | $sort_columns = array( |
1299 | 1349 | 'pm.id_pm', |
1300 | 1350 | ); |
1301 | - if (empty($search_params['sort']) && !empty($_REQUEST['sort'])) |
|
1302 | - list ($search_params['sort'], $search_params['sort_dir']) = array_pad(explode('|', $_REQUEST['sort']), 2, ''); |
|
1351 | + if (empty($search_params['sort']) && !empty($_REQUEST['sort'])) { |
|
1352 | + list ($search_params['sort'], $search_params['sort_dir']) = array_pad(explode('|', $_REQUEST['sort']), 2, ''); |
|
1353 | + } |
|
1303 | 1354 | $search_params['sort'] = !empty($search_params['sort']) && in_array($search_params['sort'], $sort_columns) ? $search_params['sort'] : 'pm.id_pm'; |
1304 | 1355 | $search_params['sort_dir'] = !empty($search_params['sort_dir']) && $search_params['sort_dir'] == 'asc' ? 'asc' : 'desc'; |
1305 | 1356 | |
@@ -1309,24 +1360,27 @@ discard block |
||
1309 | 1360 | if ($context['folder'] == 'inbox' && !empty($search_params['advanced']) && $context['currently_using_labels']) |
1310 | 1361 | { |
1311 | 1362 | // Came here from pagination? Put them back into $_REQUEST for sanitization. |
1312 | - if (isset($search_params['labels'])) |
|
1313 | - $_REQUEST['searchlabel'] = explode(',', $search_params['labels']); |
|
1363 | + if (isset($search_params['labels'])) { |
|
1364 | + $_REQUEST['searchlabel'] = explode(',', $search_params['labels']); |
|
1365 | + } |
|
1314 | 1366 | |
1315 | 1367 | // Assuming we have some labels - make them all integers. |
1316 | 1368 | if (!empty($_REQUEST['searchlabel']) && is_array($_REQUEST['searchlabel'])) |
1317 | 1369 | { |
1318 | - foreach ($_REQUEST['searchlabel'] as $key => $id) |
|
1319 | - $_REQUEST['searchlabel'][$key] = (int) $id; |
|
1370 | + foreach ($_REQUEST['searchlabel'] as $key => $id) { |
|
1371 | + $_REQUEST['searchlabel'][$key] = (int) $id; |
|
1372 | + } |
|
1373 | + } else { |
|
1374 | + $_REQUEST['searchlabel'] = array(); |
|
1320 | 1375 | } |
1321 | - else |
|
1322 | - $_REQUEST['searchlabel'] = array(); |
|
1323 | 1376 | |
1324 | 1377 | // Now that everything is cleaned up a bit, make the labels a param. |
1325 | 1378 | $search_params['labels'] = implode(',', $_REQUEST['searchlabel']); |
1326 | 1379 | |
1327 | 1380 | // No labels selected? That must be an error! |
1328 | - if (empty($_REQUEST['searchlabel'])) |
|
1329 | - $context['search_errors']['no_labels_selected'] = true; |
|
1381 | + if (empty($_REQUEST['searchlabel'])) { |
|
1382 | + $context['search_errors']['no_labels_selected'] = true; |
|
1383 | + } |
|
1330 | 1384 | // Otherwise prepare the query! |
1331 | 1385 | elseif (count($_REQUEST['searchlabel']) != count($context['labels'])) |
1332 | 1386 | { |
@@ -1349,8 +1403,7 @@ discard block |
||
1349 | 1403 | // Not searching the inbox - PM must be labeled |
1350 | 1404 | $labelQuery = ' AND pml.id_label IN ({array_int:labels})'; |
1351 | 1405 | $labelJoin = ' INNER JOIN {db_prefix}pm_labeled_messages AS pml ON (pml.id_pm = pmr.id_pm)'; |
1352 | - } |
|
1353 | - else |
|
1406 | + } else |
|
1354 | 1407 | { |
1355 | 1408 | // Searching the inbox - PM doesn't have to be labeled |
1356 | 1409 | $labelQuery = ' AND (' . substr($labelQuery, 5) . ' OR pml.id_label IN ({array_int:labels}))'; |
@@ -1365,8 +1418,9 @@ discard block |
||
1365 | 1418 | // What are we actually searching for? |
1366 | 1419 | $search_params['search'] = !empty($search_params['search']) ? $search_params['search'] : (isset($_REQUEST['search']) ? $_REQUEST['search'] : ''); |
1367 | 1420 | // If we ain't got nothing - we should error! |
1368 | - if (!isset($search_params['search']) || $search_params['search'] == '') |
|
1369 | - $context['search_errors']['invalid_search_string'] = true; |
|
1421 | + if (!isset($search_params['search']) || $search_params['search'] == '') { |
|
1422 | + $context['search_errors']['invalid_search_string'] = true; |
|
1423 | + } |
|
1370 | 1424 | |
1371 | 1425 | // Extract phrase parts first (e.g. some words "this is a phrase" some more words.) |
1372 | 1426 | preg_match_all('~(?:^|\s)([-]?)"([^"]+)"(?:$|\s)~' . ($context['utf8'] ? 'u' : ''), $search_params['search'], $matches, PREG_PATTERN_ORDER); |
@@ -1379,12 +1433,14 @@ discard block |
||
1379 | 1433 | $excludedWords = array(); |
1380 | 1434 | |
1381 | 1435 | // .. first, we check for things like -"some words", but not "-some words". |
1382 | - foreach ($matches[1] as $index => $word) |
|
1383 | - if ($word == '-') |
|
1436 | + foreach ($matches[1] as $index => $word) { |
|
1437 | + if ($word == '-') |
|
1384 | 1438 | { |
1385 | 1439 | $word = $smcFunc['strtolower'](trim($searchArray[$index])); |
1386 | - if (strlen($word) > 0) |
|
1387 | - $excludedWords[] = $word; |
|
1440 | + } |
|
1441 | + if (strlen($word) > 0) { |
|
1442 | + $excludedWords[] = $word; |
|
1443 | + } |
|
1388 | 1444 | unset($searchArray[$index]); |
1389 | 1445 | } |
1390 | 1446 | |
@@ -1394,8 +1450,9 @@ discard block |
||
1394 | 1450 | if (strpos(trim($word), '-') === 0) |
1395 | 1451 | { |
1396 | 1452 | $word = substr($smcFunc['strtolower']($word), 1); |
1397 | - if (strlen($word) > 0) |
|
1398 | - $excludedWords[] = $word; |
|
1453 | + if (strlen($word) > 0) { |
|
1454 | + $excludedWords[] = $word; |
|
1455 | + } |
|
1399 | 1456 | unset($tempSearch[$index]); |
1400 | 1457 | } |
1401 | 1458 | } |
@@ -1406,9 +1463,9 @@ discard block |
||
1406 | 1463 | foreach ($searchArray as $index => $value) |
1407 | 1464 | { |
1408 | 1465 | $searchArray[$index] = $smcFunc['strtolower'](trim($value)); |
1409 | - if ($searchArray[$index] == '') |
|
1410 | - unset($searchArray[$index]); |
|
1411 | - else |
|
1466 | + if ($searchArray[$index] == '') { |
|
1467 | + unset($searchArray[$index]); |
|
1468 | + } else |
|
1412 | 1469 | { |
1413 | 1470 | // Sort out entities first. |
1414 | 1471 | $searchArray[$index] = $smcFunc['htmlspecialchars']($searchArray[$index]); |
@@ -1418,27 +1475,32 @@ discard block |
||
1418 | 1475 | |
1419 | 1476 | // Create an array of replacements for highlighting. |
1420 | 1477 | $context['mark'] = array(); |
1421 | - foreach ($searchArray as $word) |
|
1422 | - $context['mark'][$word] = '<strong class="highlight">' . $word . '</strong>'; |
|
1478 | + foreach ($searchArray as $word) { |
|
1479 | + $context['mark'][$word] = '<strong class="highlight">' . $word . '</strong>'; |
|
1480 | + } |
|
1423 | 1481 | |
1424 | 1482 | // This contains *everything* |
1425 | 1483 | $searchWords = array_merge($searchArray, $excludedWords); |
1426 | 1484 | |
1427 | 1485 | // Make sure at least one word is being searched for. |
1428 | - if (empty($searchArray)) |
|
1429 | - $context['search_errors']['invalid_search_string'] = true; |
|
1486 | + if (empty($searchArray)) { |
|
1487 | + $context['search_errors']['invalid_search_string'] = true; |
|
1488 | + } |
|
1430 | 1489 | |
1431 | 1490 | // Sort out the search query so the user can edit it - if they want. |
1432 | 1491 | $context['search_params'] = $search_params; |
1433 | - if (isset($context['search_params']['search'])) |
|
1434 | - $context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']); |
|
1435 | - if (isset($context['search_params']['userspec'])) |
|
1436 | - $context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']); |
|
1492 | + if (isset($context['search_params']['search'])) { |
|
1493 | + $context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']); |
|
1494 | + } |
|
1495 | + if (isset($context['search_params']['userspec'])) { |
|
1496 | + $context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']); |
|
1497 | + } |
|
1437 | 1498 | |
1438 | 1499 | // Now we have all the parameters, combine them together for pagination and the like... |
1439 | 1500 | $context['params'] = array(); |
1440 | - foreach ($search_params as $k => $v) |
|
1441 | - $context['params'][] = $k . '|\'|' . $v; |
|
1501 | + foreach ($search_params as $k => $v) { |
|
1502 | + $context['params'][] = $k . '|\'|' . $v; |
|
1503 | + } |
|
1442 | 1504 | $context['params'] = base64_encode(implode('|"|', $context['params'])); |
1443 | 1505 | |
1444 | 1506 | // Compile the subject query part. |
@@ -1446,26 +1508,31 @@ discard block |
||
1446 | 1508 | |
1447 | 1509 | foreach ($searchWords as $index => $word) |
1448 | 1510 | { |
1449 | - if ($word == '') |
|
1450 | - continue; |
|
1511 | + if ($word == '') { |
|
1512 | + continue; |
|
1513 | + } |
|
1451 | 1514 | |
1452 | - if ($search_params['subject_only']) |
|
1453 | - $andQueryParts[] = 'pm.subject' . (in_array($word, $excludedWords) ? ' NOT' : '') . ' LIKE {string:search_' . $index . '}'; |
|
1454 | - else |
|
1455 | - $andQueryParts[] = '(pm.subject' . (in_array($word, $excludedWords) ? ' NOT' : '') . ' LIKE {string:search_' . $index . '} ' . (in_array($word, $excludedWords) ? 'AND pm.body NOT' : 'OR pm.body') . ' LIKE {string:search_' . $index . '})'; |
|
1515 | + if ($search_params['subject_only']) { |
|
1516 | + $andQueryParts[] = 'pm.subject' . (in_array($word, $excludedWords) ? ' NOT' : '') . ' LIKE {string:search_' . $index . '}'; |
|
1517 | + } else { |
|
1518 | + $andQueryParts[] = '(pm.subject' . (in_array($word, $excludedWords) ? ' NOT' : '') . ' LIKE {string:search_' . $index . '} ' . (in_array($word, $excludedWords) ? 'AND pm.body NOT' : 'OR pm.body') . ' LIKE {string:search_' . $index . '})'; |
|
1519 | + } |
|
1456 | 1520 | $searchq_parameters['search_' . $index] = '%' . strtr($word, array('_' => '\\_', '%' => '\\%')) . '%'; |
1457 | 1521 | } |
1458 | 1522 | |
1459 | 1523 | $searchQuery = ' 1=1'; |
1460 | - if (!empty($andQueryParts)) |
|
1461 | - $searchQuery = implode(!empty($search_params['searchtype']) && $search_params['searchtype'] == 2 ? ' OR ' : ' AND ', $andQueryParts); |
|
1524 | + if (!empty($andQueryParts)) { |
|
1525 | + $searchQuery = implode(!empty($search_params['searchtype']) && $search_params['searchtype'] == 2 ? ' OR ' : ' AND ', $andQueryParts); |
|
1526 | + } |
|
1462 | 1527 | |
1463 | 1528 | // Age limits? |
1464 | 1529 | $timeQuery = ''; |
1465 | - if (!empty($search_params['minage'])) |
|
1466 | - $timeQuery .= ' AND pm.msgtime < ' . (time() - $search_params['minage'] * 86400); |
|
1467 | - if (!empty($search_params['maxage'])) |
|
1468 | - $timeQuery .= ' AND pm.msgtime > ' . (time() - $search_params['maxage'] * 86400); |
|
1530 | + if (!empty($search_params['minage'])) { |
|
1531 | + $timeQuery .= ' AND pm.msgtime < ' . (time() - $search_params['minage'] * 86400); |
|
1532 | + } |
|
1533 | + if (!empty($search_params['maxage'])) { |
|
1534 | + $timeQuery .= ' AND pm.msgtime > ' . (time() - $search_params['maxage'] * 86400); |
|
1535 | + } |
|
1469 | 1536 | |
1470 | 1537 | // If we have errors - return back to the first screen... |
1471 | 1538 | if (!empty($context['search_errors'])) |
@@ -1551,8 +1618,9 @@ discard block |
||
1551 | 1618 | ) |
1552 | 1619 | ); |
1553 | 1620 | $real_pm_ids = array(); |
1554 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1555 | - $real_pm_ids[$row['id_pm_head']] = $row['id_pm']; |
|
1621 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1622 | + $real_pm_ids[$row['id_pm_head']] = $row['id_pm']; |
|
1623 | + } |
|
1556 | 1624 | $smcFunc['db_free_result']($request); |
1557 | 1625 | } |
1558 | 1626 | |
@@ -1582,8 +1650,9 @@ discard block |
||
1582 | 1650 | ); |
1583 | 1651 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1584 | 1652 | { |
1585 | - if ($context['folder'] == 'sent' || empty($row['bcc'])) |
|
1586 | - $recipients[$row['id_pm']][empty($row['bcc']) ? 'to' : 'bcc'][] = empty($row['id_member_to']) ? $txt['guest_title'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member_to'] . '">' . $row['to_name'] . '</a>'; |
|
1653 | + if ($context['folder'] == 'sent' || empty($row['bcc'])) { |
|
1654 | + $recipients[$row['id_pm']][empty($row['bcc']) ? 'to' : 'bcc'][] = empty($row['id_member_to']) ? $txt['guest_title'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member_to'] . '">' . $row['to_name'] . '</a>'; |
|
1655 | + } |
|
1587 | 1656 | |
1588 | 1657 | if ($row['id_member_to'] == $user_info['id'] && $context['folder'] != 'sent') |
1589 | 1658 | { |
@@ -1604,12 +1673,14 @@ discard block |
||
1604 | 1673 | while ($row2 = $smcFunc['db_fetch_assoc']($request2)) |
1605 | 1674 | { |
1606 | 1675 | $l_id = $row2['id_label']; |
1607 | - if (isset($context['labels'][$l_id])) |
|
1608 | - $context['message_labels'][$row['id_pm']][$l_id] = array('id' => $l_id, 'name' => $context['labels'][$l_id]['name']); |
|
1676 | + if (isset($context['labels'][$l_id])) { |
|
1677 | + $context['message_labels'][$row['id_pm']][$l_id] = array('id' => $l_id, 'name' => $context['labels'][$l_id]['name']); |
|
1678 | + } |
|
1609 | 1679 | |
1610 | 1680 | // Here we find the first label on a message - for linking to posts in results |
1611 | - if (!isset($context['first_label'][$row['id_pm']]) && $row['in_inbox'] != 1) |
|
1612 | - $context['first_label'][$row['id_pm']] = $l_id; |
|
1681 | + if (!isset($context['first_label'][$row['id_pm']]) && $row['in_inbox'] != 1) { |
|
1682 | + $context['first_label'][$row['id_pm']] = $l_id; |
|
1683 | + } |
|
1613 | 1684 | } |
1614 | 1685 | |
1615 | 1686 | $smcFunc['db_free_result']($request2); |
@@ -1736,8 +1807,9 @@ discard block |
||
1736 | 1807 | list ($postCount) = $smcFunc['db_fetch_row']($request); |
1737 | 1808 | $smcFunc['db_free_result']($request); |
1738 | 1809 | |
1739 | - if (!empty($postCount) && $postCount >= $modSettings['pm_posts_per_hour']) |
|
1740 | - fatal_lang_error('pm_too_many_per_hour', true, array($modSettings['pm_posts_per_hour'])); |
|
1810 | + if (!empty($postCount) && $postCount >= $modSettings['pm_posts_per_hour']) { |
|
1811 | + fatal_lang_error('pm_too_many_per_hour', true, array($modSettings['pm_posts_per_hour'])); |
|
1812 | + } |
|
1741 | 1813 | } |
1742 | 1814 | |
1743 | 1815 | // Quoting/Replying to a message? |
@@ -1746,8 +1818,9 @@ discard block |
||
1746 | 1818 | $pmsg = (int) $_REQUEST['pmsg']; |
1747 | 1819 | |
1748 | 1820 | // Make sure this is yours. |
1749 | - if (!isAccessiblePM($pmsg)) |
|
1750 | - fatal_lang_error('no_access', false); |
|
1821 | + if (!isAccessiblePM($pmsg)) { |
|
1822 | + fatal_lang_error('no_access', false); |
|
1823 | + } |
|
1751 | 1824 | |
1752 | 1825 | // Work out whether this is one you've received? |
1753 | 1826 | $request = $smcFunc['db_query']('', ' |
@@ -1784,8 +1857,9 @@ discard block |
||
1784 | 1857 | 'id_pm' => $pmsg, |
1785 | 1858 | ) |
1786 | 1859 | ); |
1787 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1788 | - fatal_lang_error('pm_not_yours', false); |
|
1860 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1861 | + fatal_lang_error('pm_not_yours', false); |
|
1862 | + } |
|
1789 | 1863 | $row_quoted = $smcFunc['db_fetch_assoc']($request); |
1790 | 1864 | $smcFunc['db_free_result']($request); |
1791 | 1865 | |
@@ -1796,9 +1870,9 @@ discard block |
||
1796 | 1870 | // Add 'Re: ' to it.... |
1797 | 1871 | if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) |
1798 | 1872 | { |
1799 | - if ($language === $user_info['language']) |
|
1800 | - $context['response_prefix'] = $txt['response_prefix']; |
|
1801 | - else |
|
1873 | + if ($language === $user_info['language']) { |
|
1874 | + $context['response_prefix'] = $txt['response_prefix']; |
|
1875 | + } else |
|
1802 | 1876 | { |
1803 | 1877 | loadLanguage('index', $language, false); |
1804 | 1878 | $context['response_prefix'] = $txt['response_prefix']; |
@@ -1807,22 +1881,25 @@ discard block |
||
1807 | 1881 | cache_put_data('response_prefix', $context['response_prefix'], 600); |
1808 | 1882 | } |
1809 | 1883 | $form_subject = $row_quoted['subject']; |
1810 | - if ($context['reply'] && trim($context['response_prefix']) != '' && $smcFunc['strpos']($form_subject, trim($context['response_prefix'])) !== 0) |
|
1811 | - $form_subject = $context['response_prefix'] . $form_subject; |
|
1884 | + if ($context['reply'] && trim($context['response_prefix']) != '' && $smcFunc['strpos']($form_subject, trim($context['response_prefix'])) !== 0) { |
|
1885 | + $form_subject = $context['response_prefix'] . $form_subject; |
|
1886 | + } |
|
1812 | 1887 | |
1813 | 1888 | if (isset($_REQUEST['quote'])) |
1814 | 1889 | { |
1815 | 1890 | // Remove any nested quotes and <br>... |
1816 | 1891 | $form_message = preg_replace('~<br ?/?' . '>~i', "\n", $row_quoted['body']); |
1817 | - if (!empty($modSettings['removeNestedQuotes'])) |
|
1818 | - $form_message = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $form_message); |
|
1819 | - if (empty($row_quoted['id_member'])) |
|
1820 | - $form_message = '[quote author="' . $row_quoted['real_name'] . '"]' . "\n" . $form_message . "\n" . '[/quote]'; |
|
1821 | - else |
|
1822 | - $form_message = '[quote author=' . $row_quoted['real_name'] . ' link=action=profile;u=' . $row_quoted['id_member'] . ' date=' . $row_quoted['msgtime'] . ']' . "\n" . $form_message . "\n" . '[/quote]'; |
|
1892 | + if (!empty($modSettings['removeNestedQuotes'])) { |
|
1893 | + $form_message = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $form_message); |
|
1894 | + } |
|
1895 | + if (empty($row_quoted['id_member'])) { |
|
1896 | + $form_message = '[quote author="' . $row_quoted['real_name'] . '"]' . "\n" . $form_message . "\n" . '[/quote]'; |
|
1897 | + } else { |
|
1898 | + $form_message = '[quote author=' . $row_quoted['real_name'] . ' link=action=profile;u=' . $row_quoted['id_member'] . ' date=' . $row_quoted['msgtime'] . ']' . "\n" . $form_message . "\n" . '[/quote]'; |
|
1899 | + } |
|
1900 | + } else { |
|
1901 | + $form_message = ''; |
|
1823 | 1902 | } |
1824 | - else |
|
1825 | - $form_message = ''; |
|
1826 | 1903 | |
1827 | 1904 | // Do the BBC thang on the message. |
1828 | 1905 | $row_quoted['body'] = parse_bbc($row_quoted['body'], true, 'pm' . $row_quoted['id_pm']); |
@@ -1843,8 +1920,7 @@ discard block |
||
1843 | 1920 | 'timestamp' => forum_time(true, $row_quoted['msgtime']), |
1844 | 1921 | 'body' => $row_quoted['body'] |
1845 | 1922 | ); |
1846 | - } |
|
1847 | - else |
|
1923 | + } else |
|
1848 | 1924 | { |
1849 | 1925 | $context['quoted_message'] = false; |
1850 | 1926 | $form_subject = ''; |
@@ -1863,11 +1939,12 @@ discard block |
||
1863 | 1939 | if ($_REQUEST['u'] == 'all' && isset($row_quoted)) |
1864 | 1940 | { |
1865 | 1941 | // Firstly, to reply to all we clearly already have $row_quoted - so have the original member from. |
1866 | - if ($row_quoted['id_member'] != $user_info['id']) |
|
1867 | - $context['recipients']['to'][] = array( |
|
1942 | + if ($row_quoted['id_member'] != $user_info['id']) { |
|
1943 | + $context['recipients']['to'][] = array( |
|
1868 | 1944 | 'id' => $row_quoted['id_member'], |
1869 | 1945 | 'name' => $smcFunc['htmlspecialchars']($row_quoted['real_name']), |
1870 | 1946 | ); |
1947 | + } |
|
1871 | 1948 | |
1872 | 1949 | // Now to get the others. |
1873 | 1950 | $request = $smcFunc['db_query']('', ' |
@@ -1883,18 +1960,19 @@ discard block |
||
1883 | 1960 | 'not_bcc' => 0, |
1884 | 1961 | ) |
1885 | 1962 | ); |
1886 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1887 | - $context['recipients']['to'][] = array( |
|
1963 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1964 | + $context['recipients']['to'][] = array( |
|
1888 | 1965 | 'id' => $row['id_member'], |
1889 | 1966 | 'name' => $row['real_name'], |
1890 | 1967 | ); |
1968 | + } |
|
1891 | 1969 | $smcFunc['db_free_result']($request); |
1892 | - } |
|
1893 | - else |
|
1970 | + } else |
|
1894 | 1971 | { |
1895 | 1972 | $_REQUEST['u'] = explode(',', $_REQUEST['u']); |
1896 | - foreach ($_REQUEST['u'] as $key => $uID) |
|
1897 | - $_REQUEST['u'][$key] = (int) $uID; |
|
1973 | + foreach ($_REQUEST['u'] as $key => $uID) { |
|
1974 | + $_REQUEST['u'][$key] = (int) $uID; |
|
1975 | + } |
|
1898 | 1976 | |
1899 | 1977 | $_REQUEST['u'] = array_unique($_REQUEST['u']); |
1900 | 1978 | |
@@ -1908,22 +1986,24 @@ discard block |
||
1908 | 1986 | 'limit' => count($_REQUEST['u']), |
1909 | 1987 | ) |
1910 | 1988 | ); |
1911 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1912 | - $context['recipients']['to'][] = array( |
|
1989 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1990 | + $context['recipients']['to'][] = array( |
|
1913 | 1991 | 'id' => $row['id_member'], |
1914 | 1992 | 'name' => $row['real_name'], |
1915 | 1993 | ); |
1994 | + } |
|
1916 | 1995 | $smcFunc['db_free_result']($request); |
1917 | 1996 | } |
1918 | 1997 | |
1919 | 1998 | // Get a literal name list in case the user has JavaScript disabled. |
1920 | 1999 | $names = array(); |
1921 | - foreach ($context['recipients']['to'] as $to) |
|
1922 | - $names[] = $to['name']; |
|
2000 | + foreach ($context['recipients']['to'] as $to) { |
|
2001 | + $names[] = $to['name']; |
|
2002 | + } |
|
1923 | 2003 | $context['to_value'] = empty($names) ? '' : '"' . implode('", "', $names) . '"'; |
2004 | + } else { |
|
2005 | + $context['to_value'] = ''; |
|
1924 | 2006 | } |
1925 | - else |
|
1926 | - $context['to_value'] = ''; |
|
1927 | 2007 | |
1928 | 2008 | // Set the defaults... |
1929 | 2009 | $context['subject'] = $form_subject; |
@@ -1993,8 +2073,9 @@ discard block |
||
1993 | 2073 | |
1994 | 2074 | // validate with loadMemberData() |
1995 | 2075 | $memberResult = loadMemberData($user_info['id'], false); |
1996 | - if (!$memberResult) |
|
1997 | - fatal_lang_error('not_a_user', false); |
|
2076 | + if (!$memberResult) { |
|
2077 | + fatal_lang_error('not_a_user', false); |
|
2078 | + } |
|
1998 | 2079 | list ($memID) = $memberResult; |
1999 | 2080 | |
2000 | 2081 | // drafts is where the functions reside |
@@ -2020,9 +2101,9 @@ discard block |
||
2020 | 2101 | $context['sub_template'] = 'send'; |
2021 | 2102 | loadJavaScriptFile('PersonalMessage.js', array('defer' => false), 'smf_pms'); |
2022 | 2103 | loadJavaScriptFile('suggest.js', array('defer' => false), 'smf_suggest'); |
2104 | + } else { |
|
2105 | + $context['sub_template'] = 'pm'; |
|
2023 | 2106 | } |
2024 | - else |
|
2025 | - $context['sub_template'] = 'pm'; |
|
2026 | 2107 | |
2027 | 2108 | $context['page_title'] = $txt['send_message']; |
2028 | 2109 | |
@@ -2083,10 +2164,11 @@ discard block |
||
2083 | 2164 | ); |
2084 | 2165 | if ($smcFunc['db_num_rows']($request) == 0) |
2085 | 2166 | { |
2086 | - if (!isset($_REQUEST['xml'])) |
|
2087 | - fatal_lang_error('pm_not_yours', false); |
|
2088 | - else |
|
2089 | - $error_types[] = 'pm_not_yours'; |
|
2167 | + if (!isset($_REQUEST['xml'])) { |
|
2168 | + fatal_lang_error('pm_not_yours', false); |
|
2169 | + } else { |
|
2170 | + $error_types[] = 'pm_not_yours'; |
|
2171 | + } |
|
2090 | 2172 | } |
2091 | 2173 | $row_quoted = $smcFunc['db_fetch_assoc']($request); |
2092 | 2174 | $smcFunc['db_free_result']($request); |
@@ -2133,14 +2215,16 @@ discard block |
||
2133 | 2215 | $context['post_error'][$error_type] = true; |
2134 | 2216 | if (isset($txt['error_' . $error_type])) |
2135 | 2217 | { |
2136 | - if ($error_type == 'long_message') |
|
2137 | - $txt['error_' . $error_type] = sprintf($txt['error_' . $error_type], $modSettings['max_messageLength']); |
|
2218 | + if ($error_type == 'long_message') { |
|
2219 | + $txt['error_' . $error_type] = sprintf($txt['error_' . $error_type], $modSettings['max_messageLength']); |
|
2220 | + } |
|
2138 | 2221 | $context['post_error']['messages'][] = $txt['error_' . $error_type]; |
2139 | 2222 | } |
2140 | 2223 | |
2141 | 2224 | // If it's not a minor error flag it as such. |
2142 | - if (!in_array($error_type, array('new_reply', 'not_approved', 'new_replies', 'old_topic', 'need_qr_verification', 'no_subject'))) |
|
2143 | - $context['error_type'] = 'serious'; |
|
2225 | + if (!in_array($error_type, array('new_reply', 'not_approved', 'new_replies', 'old_topic', 'need_qr_verification', 'no_subject'))) { |
|
2226 | + $context['error_type'] = 'serious'; |
|
2227 | + } |
|
2144 | 2228 | } |
2145 | 2229 | |
2146 | 2230 | // We need to load the editor once more. |
@@ -2198,8 +2282,9 @@ discard block |
||
2198 | 2282 | require_once($sourcedir . '/Subs-Auth.php'); |
2199 | 2283 | |
2200 | 2284 | // PM Drafts enabled and needed? |
2201 | - if ($context['drafts_pm_save'] && (isset($_POST['save_draft']) || isset($_POST['id_pm_draft']))) |
|
2202 | - require_once($sourcedir . '/Drafts.php'); |
|
2285 | + if ($context['drafts_pm_save'] && (isset($_POST['save_draft']) || isset($_POST['id_pm_draft']))) { |
|
2286 | + require_once($sourcedir . '/Drafts.php'); |
|
2287 | + } |
|
2203 | 2288 | |
2204 | 2289 | loadLanguage('PersonalMessage', '', false); |
2205 | 2290 | |
@@ -2229,24 +2314,27 @@ discard block |
||
2229 | 2314 | |
2230 | 2315 | if (!empty($postCount) && $postCount >= $modSettings['pm_posts_per_hour']) |
2231 | 2316 | { |
2232 | - if (!isset($_REQUEST['xml'])) |
|
2233 | - fatal_lang_error('pm_too_many_per_hour', true, array($modSettings['pm_posts_per_hour'])); |
|
2234 | - else |
|
2235 | - $post_errors[] = 'pm_too_many_per_hour'; |
|
2317 | + if (!isset($_REQUEST['xml'])) { |
|
2318 | + fatal_lang_error('pm_too_many_per_hour', true, array($modSettings['pm_posts_per_hour'])); |
|
2319 | + } else { |
|
2320 | + $post_errors[] = 'pm_too_many_per_hour'; |
|
2321 | + } |
|
2236 | 2322 | } |
2237 | 2323 | } |
2238 | 2324 | |
2239 | 2325 | // If your session timed out, show an error, but do allow to re-submit. |
2240 | - if (!isset($_REQUEST['xml']) && checkSession('post', '', false) != '') |
|
2241 | - $post_errors[] = 'session_timeout'; |
|
2326 | + if (!isset($_REQUEST['xml']) && checkSession('post', '', false) != '') { |
|
2327 | + $post_errors[] = 'session_timeout'; |
|
2328 | + } |
|
2242 | 2329 | |
2243 | 2330 | $_REQUEST['subject'] = isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : ''; |
2244 | 2331 | $_REQUEST['to'] = empty($_POST['to']) ? (empty($_GET['to']) ? '' : $_GET['to']) : $_POST['to']; |
2245 | 2332 | $_REQUEST['bcc'] = empty($_POST['bcc']) ? (empty($_GET['bcc']) ? '' : $_GET['bcc']) : $_POST['bcc']; |
2246 | 2333 | |
2247 | 2334 | // Route the input from the 'u' parameter to the 'to'-list. |
2248 | - if (!empty($_POST['u'])) |
|
2249 | - $_POST['recipient_to'] = explode(',', $_POST['u']); |
|
2335 | + if (!empty($_POST['u'])) { |
|
2336 | + $_POST['recipient_to'] = explode(',', $_POST['u']); |
|
2337 | + } |
|
2250 | 2338 | |
2251 | 2339 | // Construct the list of recipients. |
2252 | 2340 | $recipientList = array(); |
@@ -2258,8 +2346,9 @@ discard block |
||
2258 | 2346 | $recipientList[$recipientType] = array(); |
2259 | 2347 | if (!empty($_POST['recipient_' . $recipientType]) && is_array($_POST['recipient_' . $recipientType])) |
2260 | 2348 | { |
2261 | - foreach ($_POST['recipient_' . $recipientType] as $recipient) |
|
2262 | - $recipientList[$recipientType][] = (int) $recipient; |
|
2349 | + foreach ($_POST['recipient_' . $recipientType] as $recipient) { |
|
2350 | + $recipientList[$recipientType][] = (int) $recipient; |
|
2351 | + } |
|
2263 | 2352 | } |
2264 | 2353 | |
2265 | 2354 | // Are there also literal names set? |
@@ -2273,10 +2362,11 @@ discard block |
||
2273 | 2362 | |
2274 | 2363 | foreach ($namedRecipientList[$recipientType] as $index => $recipient) |
2275 | 2364 | { |
2276 | - if (strlen(trim($recipient)) > 0) |
|
2277 | - $namedRecipientList[$recipientType][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($recipient))); |
|
2278 | - else |
|
2279 | - unset($namedRecipientList[$recipientType][$index]); |
|
2365 | + if (strlen(trim($recipient)) > 0) { |
|
2366 | + $namedRecipientList[$recipientType][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($recipient))); |
|
2367 | + } else { |
|
2368 | + unset($namedRecipientList[$recipientType][$index]); |
|
2369 | + } |
|
2280 | 2370 | } |
2281 | 2371 | |
2282 | 2372 | if (!empty($namedRecipientList[$recipientType])) |
@@ -2306,8 +2396,9 @@ discard block |
||
2306 | 2396 | } |
2307 | 2397 | |
2308 | 2398 | // Selected a recipient to be deleted? Remove them now. |
2309 | - if (!empty($_POST['delete_recipient'])) |
|
2310 | - $recipientList[$recipientType] = array_diff($recipientList[$recipientType], array((int) $_POST['delete_recipient'])); |
|
2399 | + if (!empty($_POST['delete_recipient'])) { |
|
2400 | + $recipientList[$recipientType] = array_diff($recipientList[$recipientType], array((int) $_POST['delete_recipient'])); |
|
2401 | + } |
|
2311 | 2402 | |
2312 | 2403 | // Make sure we don't include the same name twice |
2313 | 2404 | $recipientList[$recipientType] = array_unique($recipientList[$recipientType]); |
@@ -2317,8 +2408,9 @@ discard block |
||
2317 | 2408 | $is_recipient_change = !empty($_POST['delete_recipient']) || !empty($_POST['to_submit']) || !empty($_POST['bcc_submit']); |
2318 | 2409 | |
2319 | 2410 | // Check if there's at least one recipient. |
2320 | - if (empty($recipientList['to']) && empty($recipientList['bcc'])) |
|
2321 | - $post_errors[] = 'no_to'; |
|
2411 | + if (empty($recipientList['to']) && empty($recipientList['bcc'])) { |
|
2412 | + $post_errors[] = 'no_to'; |
|
2413 | + } |
|
2322 | 2414 | |
2323 | 2415 | // Make sure that we remove the members who did get it from the screen. |
2324 | 2416 | if (!$is_recipient_change) |
@@ -2332,28 +2424,31 @@ discard block |
||
2332 | 2424 | // Since we already have a post error, remove the previous one. |
2333 | 2425 | $post_errors = array_diff($post_errors, array('no_to')); |
2334 | 2426 | |
2335 | - foreach ($namesNotFound[$recipientType] as $name) |
|
2336 | - $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
2427 | + foreach ($namesNotFound[$recipientType] as $name) { |
|
2428 | + $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
2429 | + } |
|
2337 | 2430 | } |
2338 | 2431 | } |
2339 | 2432 | } |
2340 | 2433 | |
2341 | 2434 | // Did they make any mistakes? |
2342 | - if ($_REQUEST['subject'] == '') |
|
2343 | - $post_errors[] = 'no_subject'; |
|
2344 | - if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') |
|
2345 | - $post_errors[] = 'no_message'; |
|
2346 | - elseif (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_REQUEST['message']) > $modSettings['max_messageLength']) |
|
2347 | - $post_errors[] = 'long_message'; |
|
2348 | - else |
|
2435 | + if ($_REQUEST['subject'] == '') { |
|
2436 | + $post_errors[] = 'no_subject'; |
|
2437 | + } |
|
2438 | + if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') { |
|
2439 | + $post_errors[] = 'no_message'; |
|
2440 | + } elseif (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_REQUEST['message']) > $modSettings['max_messageLength']) { |
|
2441 | + $post_errors[] = 'long_message'; |
|
2442 | + } else |
|
2349 | 2443 | { |
2350 | 2444 | // Preparse the message. |
2351 | 2445 | $message = $_REQUEST['message']; |
2352 | 2446 | preparsecode($message); |
2353 | 2447 | |
2354 | 2448 | // Make sure there's still some content left without the tags. |
2355 | - if ($smcFunc['htmltrim'](strip_tags(parse_bbc($smcFunc['htmlspecialchars']($message, ENT_QUOTES), false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($message, '[html]') === false)) |
|
2356 | - $post_errors[] = 'no_message'; |
|
2449 | + if ($smcFunc['htmltrim'](strip_tags(parse_bbc($smcFunc['htmlspecialchars']($message, ENT_QUOTES), false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($message, '[html]') === false)) { |
|
2450 | + $post_errors[] = 'no_message'; |
|
2451 | + } |
|
2357 | 2452 | } |
2358 | 2453 | |
2359 | 2454 | // Wrong verification code? |
@@ -2365,13 +2460,15 @@ discard block |
||
2365 | 2460 | ); |
2366 | 2461 | $context['require_verification'] = create_control_verification($verificationOptions, true); |
2367 | 2462 | |
2368 | - if (is_array($context['require_verification'])) |
|
2369 | - $post_errors = array_merge($post_errors, $context['require_verification']); |
|
2463 | + if (is_array($context['require_verification'])) { |
|
2464 | + $post_errors = array_merge($post_errors, $context['require_verification']); |
|
2465 | + } |
|
2370 | 2466 | } |
2371 | 2467 | |
2372 | 2468 | // If they did, give a chance to make ammends. |
2373 | - if (!empty($post_errors) && !$is_recipient_change && !isset($_REQUEST['preview']) && !isset($_REQUEST['xml'])) |
|
2374 | - return messagePostError($post_errors, $namedRecipientList, $recipientList); |
|
2469 | + if (!empty($post_errors) && !$is_recipient_change && !isset($_REQUEST['preview']) && !isset($_REQUEST['xml'])) { |
|
2470 | + return messagePostError($post_errors, $namedRecipientList, $recipientList); |
|
2471 | + } |
|
2375 | 2472 | |
2376 | 2473 | // Want to take a second glance before you send? |
2377 | 2474 | if (isset($_REQUEST['preview'])) |
@@ -2402,8 +2499,9 @@ discard block |
||
2402 | 2499 | foreach ($namesNotFound as $recipientType => $names) |
2403 | 2500 | { |
2404 | 2501 | $post_errors[] = 'bad_' . $recipientType; |
2405 | - foreach ($names as $name) |
|
2406 | - $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
2502 | + foreach ($names as $name) { |
|
2503 | + $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name); |
|
2504 | + } |
|
2407 | 2505 | } |
2408 | 2506 | |
2409 | 2507 | return messagePostError(array(), $namedRecipientList, $recipientList); |
@@ -2433,13 +2531,14 @@ discard block |
||
2433 | 2531 | checkSubmitOnce('check'); |
2434 | 2532 | |
2435 | 2533 | // Do the actual sending of the PM. |
2436 | - if (!empty($recipientList['to']) || !empty($recipientList['bcc'])) |
|
2437 | - $context['send_log'] = sendpm($recipientList, $_REQUEST['subject'], $_REQUEST['message'], true, null, !empty($_REQUEST['pm_head']) ? (int) $_REQUEST['pm_head'] : 0); |
|
2438 | - else |
|
2439 | - $context['send_log'] = array( |
|
2534 | + if (!empty($recipientList['to']) || !empty($recipientList['bcc'])) { |
|
2535 | + $context['send_log'] = sendpm($recipientList, $_REQUEST['subject'], $_REQUEST['message'], true, null, !empty($_REQUEST['pm_head']) ? (int) $_REQUEST['pm_head'] : 0); |
|
2536 | + } else { |
|
2537 | + $context['send_log'] = array( |
|
2440 | 2538 | 'sent' => array(), |
2441 | 2539 | 'failed' => array() |
2442 | 2540 | ); |
2541 | + } |
|
2443 | 2542 | |
2444 | 2543 | // Mark the message as "replied to". |
2445 | 2544 | if (!empty($context['send_log']['sent']) && !empty($_REQUEST['replied_to']) && isset($_REQUEST['f']) && $_REQUEST['f'] == 'inbox') |
@@ -2457,11 +2556,12 @@ discard block |
||
2457 | 2556 | } |
2458 | 2557 | |
2459 | 2558 | // If one or more of the recipient were invalid, go back to the post screen with the failed usernames. |
2460 | - if (!empty($context['send_log']['failed'])) |
|
2461 | - return messagePostError($post_errors, $namesNotFound, array( |
|
2559 | + if (!empty($context['send_log']['failed'])) { |
|
2560 | + return messagePostError($post_errors, $namesNotFound, array( |
|
2462 | 2561 | 'to' => array_intersect($recipientList['to'], $context['send_log']['failed']), |
2463 | 2562 | 'bcc' => array_intersect($recipientList['bcc'], $context['send_log']['failed']) |
2464 | 2563 | )); |
2564 | + } |
|
2465 | 2565 | |
2466 | 2566 | // Message sent successfully? |
2467 | 2567 | if (!empty($context['send_log']) && empty($context['send_log']['failed'])) |
@@ -2469,8 +2569,9 @@ discard block |
||
2469 | 2569 | $context['current_label_redirect'] = $context['current_label_redirect'] . ';done=sent'; |
2470 | 2570 | |
2471 | 2571 | // If we had a PM draft for this one, then its time to remove it since it was just sent |
2472 | - if ($context['drafts_pm_save'] && !empty($_POST['id_pm_draft'])) |
|
2473 | - DeleteDraft($_POST['id_pm_draft']); |
|
2572 | + if ($context['drafts_pm_save'] && !empty($_POST['id_pm_draft'])) { |
|
2573 | + DeleteDraft($_POST['id_pm_draft']); |
|
2574 | + } |
|
2474 | 2575 | } |
2475 | 2576 | |
2476 | 2577 | // Go back to the where they sent from, if possible... |
@@ -2485,24 +2586,28 @@ discard block |
||
2485 | 2586 | |
2486 | 2587 | checkSession('request'); |
2487 | 2588 | |
2488 | - if (isset($_REQUEST['del_selected'])) |
|
2489 | - $_REQUEST['pm_action'] = 'delete'; |
|
2589 | + if (isset($_REQUEST['del_selected'])) { |
|
2590 | + $_REQUEST['pm_action'] = 'delete'; |
|
2591 | + } |
|
2490 | 2592 | |
2491 | 2593 | if (isset($_REQUEST['pm_action']) && $_REQUEST['pm_action'] != '' && !empty($_REQUEST['pms']) && is_array($_REQUEST['pms'])) |
2492 | 2594 | { |
2493 | - foreach ($_REQUEST['pms'] as $pm) |
|
2494 | - $_REQUEST['pm_actions'][(int) $pm] = $_REQUEST['pm_action']; |
|
2595 | + foreach ($_REQUEST['pms'] as $pm) { |
|
2596 | + $_REQUEST['pm_actions'][(int) $pm] = $_REQUEST['pm_action']; |
|
2597 | + } |
|
2495 | 2598 | } |
2496 | 2599 | |
2497 | - if (empty($_REQUEST['pm_actions'])) |
|
2498 | - redirectexit($context['current_label_redirect']); |
|
2600 | + if (empty($_REQUEST['pm_actions'])) { |
|
2601 | + redirectexit($context['current_label_redirect']); |
|
2602 | + } |
|
2499 | 2603 | |
2500 | 2604 | // If we are in conversation, we may need to apply this to every message in the conversation. |
2501 | 2605 | if ($context['display_mode'] == 2 && isset($_REQUEST['conversation'])) |
2502 | 2606 | { |
2503 | 2607 | $id_pms = array(); |
2504 | - foreach ($_REQUEST['pm_actions'] as $pm => $dummy) |
|
2505 | - $id_pms[] = (int) $pm; |
|
2608 | + foreach ($_REQUEST['pm_actions'] as $pm => $dummy) { |
|
2609 | + $id_pms[] = (int) $pm; |
|
2610 | + } |
|
2506 | 2611 | |
2507 | 2612 | $request = $smcFunc['db_query']('', ' |
2508 | 2613 | SELECT id_pm_head, id_pm |
@@ -2513,8 +2618,9 @@ discard block |
||
2513 | 2618 | ) |
2514 | 2619 | ); |
2515 | 2620 | $pm_heads = array(); |
2516 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2517 | - $pm_heads[$row['id_pm_head']] = $row['id_pm']; |
|
2621 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2622 | + $pm_heads[$row['id_pm_head']] = $row['id_pm']; |
|
2623 | + } |
|
2518 | 2624 | $smcFunc['db_free_result']($request); |
2519 | 2625 | |
2520 | 2626 | $request = $smcFunc['db_query']('', ' |
@@ -2528,8 +2634,9 @@ discard block |
||
2528 | 2634 | // Copy the action from the single to PM to the others. |
2529 | 2635 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2530 | 2636 | { |
2531 | - if (isset($pm_heads[$row['id_pm_head']]) && isset($_REQUEST['pm_actions'][$pm_heads[$row['id_pm_head']]])) |
|
2532 | - $_REQUEST['pm_actions'][$row['id_pm']] = $_REQUEST['pm_actions'][$pm_heads[$row['id_pm_head']]]; |
|
2637 | + if (isset($pm_heads[$row['id_pm_head']]) && isset($_REQUEST['pm_actions'][$pm_heads[$row['id_pm_head']]])) { |
|
2638 | + $_REQUEST['pm_actions'][$row['id_pm']] = $_REQUEST['pm_actions'][$pm_heads[$row['id_pm_head']]]; |
|
2639 | + } |
|
2533 | 2640 | } |
2534 | 2641 | $smcFunc['db_free_result']($request); |
2535 | 2642 | } |
@@ -2540,22 +2647,21 @@ discard block |
||
2540 | 2647 | $labels = array(); |
2541 | 2648 | foreach ($_REQUEST['pm_actions'] as $pm => $action) |
2542 | 2649 | { |
2543 | - if ($action === 'delete') |
|
2544 | - $to_delete[] = (int) $pm; |
|
2545 | - else |
|
2650 | + if ($action === 'delete') { |
|
2651 | + $to_delete[] = (int) $pm; |
|
2652 | + } else |
|
2546 | 2653 | { |
2547 | 2654 | if (substr($action, 0, 4) == 'add_') |
2548 | 2655 | { |
2549 | 2656 | $type = 'add'; |
2550 | 2657 | $action = substr($action, 4); |
2551 | - } |
|
2552 | - elseif (substr($action, 0, 4) == 'rem_') |
|
2658 | + } elseif (substr($action, 0, 4) == 'rem_') |
|
2553 | 2659 | { |
2554 | 2660 | $type = 'rem'; |
2555 | 2661 | $action = substr($action, 4); |
2662 | + } else { |
|
2663 | + $type = 'unk'; |
|
2556 | 2664 | } |
2557 | - else |
|
2558 | - $type = 'unk'; |
|
2559 | 2665 | |
2560 | 2666 | if ($action == '-1' || (int) $action > 0) |
2561 | 2667 | { |
@@ -2566,8 +2672,9 @@ discard block |
||
2566 | 2672 | } |
2567 | 2673 | |
2568 | 2674 | // Deleting, it looks like? |
2569 | - if (!empty($to_delete)) |
|
2570 | - deleteMessages($to_delete, $context['display_mode'] == 2 ? null : $context['folder']); |
|
2675 | + if (!empty($to_delete)) { |
|
2676 | + deleteMessages($to_delete, $context['display_mode'] == 2 ? null : $context['folder']); |
|
2677 | + } |
|
2571 | 2678 | |
2572 | 2679 | // Are we labeling anything? |
2573 | 2680 | if (!empty($to_label) && $context['folder'] == 'inbox') |
@@ -2633,8 +2740,7 @@ discard block |
||
2633 | 2740 | } |
2634 | 2741 | |
2635 | 2742 | $smcFunc['db_free_result']($request2); |
2636 | - } |
|
2637 | - elseif ($type == 'rem') |
|
2743 | + } elseif ($type == 'rem') |
|
2638 | 2744 | { |
2639 | 2745 | // If we're removing from the inbox, see if we have at least one other label. |
2640 | 2746 | // This query is faster than the one above |
@@ -2666,21 +2772,25 @@ discard block |
||
2666 | 2772 | if ($to_label[$row['id_pm']] != '-1') |
2667 | 2773 | { |
2668 | 2774 | // If this label is in the list and we're not adding it, remove it |
2669 | - if (array_key_exists($to_label[$row['id_pm']], $labels) && $type !== 'add') |
|
2670 | - unset($labels[$to_label[$row['id_pm']]]); |
|
2671 | - else if ($type !== 'rem') |
|
2672 | - $labels[$to_label[$row['id_pm']]] = $to_label[$row['id_pm']]; |
|
2775 | + if (array_key_exists($to_label[$row['id_pm']], $labels) && $type !== 'add') { |
|
2776 | + unset($labels[$to_label[$row['id_pm']]]); |
|
2777 | + } else if ($type !== 'rem') { |
|
2778 | + $labels[$to_label[$row['id_pm']]] = $to_label[$row['id_pm']]; |
|
2779 | + } |
|
2673 | 2780 | } |
2674 | 2781 | |
2675 | 2782 | // Removing all labels or just removing the inbox label |
2676 | - if ($type == 'rem' && empty($labels)) |
|
2677 | - $in_inbox = (empty($context['can_remove_inbox']) ? 1 : 0); |
|
2783 | + if ($type == 'rem' && empty($labels)) { |
|
2784 | + $in_inbox = (empty($context['can_remove_inbox']) ? 1 : 0); |
|
2785 | + } |
|
2678 | 2786 | // Adding new labels, but removing inbox and applying new ones |
2679 | - elseif ($type == 'add' && !empty($options['pm_remove_inbox_label']) && !empty($labels)) |
|
2680 | - $in_inbox = 0; |
|
2787 | + elseif ($type == 'add' && !empty($options['pm_remove_inbox_label']) && !empty($labels)) { |
|
2788 | + $in_inbox = 0; |
|
2789 | + } |
|
2681 | 2790 | // Just adding it to the inbox |
2682 | - else |
|
2683 | - $in_inbox = 1; |
|
2791 | + else { |
|
2792 | + $in_inbox = 1; |
|
2793 | + } |
|
2684 | 2794 | |
2685 | 2795 | // Are we adding it to or removing it from the inbox? |
2686 | 2796 | if ($in_inbox != $row['in_inbox']) |
@@ -2722,8 +2832,9 @@ discard block |
||
2722 | 2832 | if (!empty($labels_to_apply)) |
2723 | 2833 | { |
2724 | 2834 | $inserts = array(); |
2725 | - foreach ($labels_to_apply as $label) |
|
2726 | - $inserts[] = array($row['id_pm'], $label); |
|
2835 | + foreach ($labels_to_apply as $label) { |
|
2836 | + $inserts[] = array($row['id_pm'], $label); |
|
2837 | + } |
|
2727 | 2838 | |
2728 | 2839 | $smcFunc['db_insert']('', |
2729 | 2840 | '{db_prefix}pm_labeled_messages', |
@@ -2767,11 +2878,13 @@ discard block |
||
2767 | 2878 | checkSession('get'); |
2768 | 2879 | |
2769 | 2880 | // If all then delete all messages the user has. |
2770 | - if ($_REQUEST['f'] == 'all') |
|
2771 | - deleteMessages(null, null); |
|
2881 | + if ($_REQUEST['f'] == 'all') { |
|
2882 | + deleteMessages(null, null); |
|
2883 | + } |
|
2772 | 2884 | // Otherwise just the selected folder. |
2773 | - else |
|
2774 | - deleteMessages(null, $_REQUEST['f'] != 'sent' ? 'inbox' : 'sent'); |
|
2885 | + else { |
|
2886 | + deleteMessages(null, $_REQUEST['f'] != 'sent' ? 'inbox' : 'sent'); |
|
2887 | + } |
|
2775 | 2888 | |
2776 | 2889 | // Done... all gone. |
2777 | 2890 | redirectexit($context['current_label_redirect']); |
@@ -2808,8 +2921,9 @@ discard block |
||
2808 | 2921 | 'msgtime' => $deleteTime, |
2809 | 2922 | ) |
2810 | 2923 | ); |
2811 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
2812 | - $toDelete[] = $row[0]; |
|
2924 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
2925 | + $toDelete[] = $row[0]; |
|
2926 | + } |
|
2813 | 2927 | $smcFunc['db_free_result']($request); |
2814 | 2928 | |
2815 | 2929 | // Select all messages in their inbox older than $deleteTime. |
@@ -2826,8 +2940,9 @@ discard block |
||
2826 | 2940 | 'msgtime' => $deleteTime, |
2827 | 2941 | ) |
2828 | 2942 | ); |
2829 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2830 | - $toDelete[] = $row['id_pm']; |
|
2943 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2944 | + $toDelete[] = $row['id_pm']; |
|
2945 | + } |
|
2831 | 2946 | $smcFunc['db_free_result']($request); |
2832 | 2947 | |
2833 | 2948 | // Delete the actual messages. |
@@ -2858,26 +2973,29 @@ discard block |
||
2858 | 2973 | { |
2859 | 2974 | global $user_info, $smcFunc; |
2860 | 2975 | |
2861 | - if ($owner === null) |
|
2862 | - $owner = array($user_info['id']); |
|
2863 | - elseif (empty($owner)) |
|
2864 | - return; |
|
2865 | - elseif (!is_array($owner)) |
|
2866 | - $owner = array($owner); |
|
2976 | + if ($owner === null) { |
|
2977 | + $owner = array($user_info['id']); |
|
2978 | + } elseif (empty($owner)) { |
|
2979 | + return; |
|
2980 | + } elseif (!is_array($owner)) { |
|
2981 | + $owner = array($owner); |
|
2982 | + } |
|
2867 | 2983 | |
2868 | 2984 | if ($personal_messages !== null) |
2869 | 2985 | { |
2870 | - if (empty($personal_messages) || !is_array($personal_messages)) |
|
2871 | - return; |
|
2986 | + if (empty($personal_messages) || !is_array($personal_messages)) { |
|
2987 | + return; |
|
2988 | + } |
|
2872 | 2989 | |
2873 | - foreach ($personal_messages as $index => $delete_id) |
|
2874 | - $personal_messages[$index] = (int) $delete_id; |
|
2990 | + foreach ($personal_messages as $index => $delete_id) { |
|
2991 | + $personal_messages[$index] = (int) $delete_id; |
|
2992 | + } |
|
2875 | 2993 | |
2876 | 2994 | $where = ' |
2877 | 2995 | AND id_pm IN ({array_int:pm_list})'; |
2996 | + } else { |
|
2997 | + $where = ''; |
|
2878 | 2998 | } |
2879 | - else |
|
2880 | - $where = ''; |
|
2881 | 2999 | |
2882 | 3000 | if ($folder == 'sent' || $folder === null) |
2883 | 3001 | { |
@@ -2912,17 +3030,19 @@ discard block |
||
2912 | 3030 | // ...And update the statistics accordingly - now including unread messages!. |
2913 | 3031 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2914 | 3032 | { |
2915 | - if ($row['is_read']) |
|
2916 | - updateMemberData($row['id_member'], array('instant_messages' => $where == '' ? 0 : 'instant_messages - ' . $row['num_deleted_messages'])); |
|
2917 | - else |
|
2918 | - updateMemberData($row['id_member'], array('instant_messages' => $where == '' ? 0 : 'instant_messages - ' . $row['num_deleted_messages'], 'unread_messages' => $where == '' ? 0 : 'unread_messages - ' . $row['num_deleted_messages'])); |
|
3033 | + if ($row['is_read']) { |
|
3034 | + updateMemberData($row['id_member'], array('instant_messages' => $where == '' ? 0 : 'instant_messages - ' . $row['num_deleted_messages'])); |
|
3035 | + } else { |
|
3036 | + updateMemberData($row['id_member'], array('instant_messages' => $where == '' ? 0 : 'instant_messages - ' . $row['num_deleted_messages'], 'unread_messages' => $where == '' ? 0 : 'unread_messages - ' . $row['num_deleted_messages'])); |
|
3037 | + } |
|
2919 | 3038 | |
2920 | 3039 | // If this is the current member we need to make their message count correct. |
2921 | 3040 | if ($user_info['id'] == $row['id_member']) |
2922 | 3041 | { |
2923 | 3042 | $user_info['messages'] -= $row['num_deleted_messages']; |
2924 | - if (!($row['is_read'])) |
|
2925 | - $user_info['unread_messages'] -= $row['num_deleted_messages']; |
|
3043 | + if (!($row['is_read'])) { |
|
3044 | + $user_info['unread_messages'] -= $row['num_deleted_messages']; |
|
3045 | + } |
|
2926 | 3046 | } |
2927 | 3047 | } |
2928 | 3048 | $smcFunc['db_free_result']($request); |
@@ -2990,8 +3110,9 @@ discard block |
||
2990 | 3110 | ) |
2991 | 3111 | ); |
2992 | 3112 | $remove_pms = array(); |
2993 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2994 | - $remove_pms[] = $row['sender']; |
|
3113 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
3114 | + $remove_pms[] = $row['sender']; |
|
3115 | + } |
|
2995 | 3116 | $smcFunc['db_free_result']($request); |
2996 | 3117 | |
2997 | 3118 | if (!empty($remove_pms)) |
@@ -3036,8 +3157,9 @@ discard block |
||
3036 | 3157 | { |
3037 | 3158 | global $user_info, $context, $smcFunc; |
3038 | 3159 | |
3039 | - if ($owner === null) |
|
3040 | - $owner = $user_info['id']; |
|
3160 | + if ($owner === null) { |
|
3161 | + $owner = $user_info['id']; |
|
3162 | + } |
|
3041 | 3163 | |
3042 | 3164 | $in_inbox = ''; |
3043 | 3165 | |
@@ -3061,8 +3183,7 @@ discard block |
||
3061 | 3183 | } |
3062 | 3184 | |
3063 | 3185 | $smcFunc['db_free_result']($get_messages); |
3064 | - } |
|
3065 | - elseif ($label = '-1') |
|
3186 | + } elseif ($label = '-1') |
|
3066 | 3187 | { |
3067 | 3188 | // Marking all PMs in your inbox read |
3068 | 3189 | $in_inbox = ' |
@@ -3087,8 +3208,9 @@ discard block |
||
3087 | 3208 | { |
3088 | 3209 | if ($owner == $user_info['id']) |
3089 | 3210 | { |
3090 | - foreach ($context['labels'] as $label) |
|
3091 | - $context['labels'][(int) $label['id']]['unread_messages'] = 0; |
|
3211 | + foreach ($context['labels'] as $label) { |
|
3212 | + $context['labels'][(int) $label['id']]['unread_messages'] = 0; |
|
3213 | + } |
|
3092 | 3214 | } |
3093 | 3215 | |
3094 | 3216 | $result = $smcFunc['db_query']('', ' |
@@ -3108,8 +3230,9 @@ discard block |
||
3108 | 3230 | { |
3109 | 3231 | $total_unread += $row['num']; |
3110 | 3232 | |
3111 | - if ($owner != $user_info['id'] || empty($row['id_pm'])) |
|
3112 | - continue; |
|
3233 | + if ($owner != $user_info['id'] || empty($row['id_pm'])) { |
|
3234 | + continue; |
|
3235 | + } |
|
3113 | 3236 | |
3114 | 3237 | $this_labels = array(); |
3115 | 3238 | |
@@ -3133,11 +3256,13 @@ discard block |
||
3133 | 3256 | |
3134 | 3257 | $smcFunc['db_free_result']($result2); |
3135 | 3258 | |
3136 | - foreach ($this_labels as $this_label) |
|
3137 | - $context['labels'][$this_label]['unread_messages'] += $row['num']; |
|
3259 | + foreach ($this_labels as $this_label) { |
|
3260 | + $context['labels'][$this_label]['unread_messages'] += $row['num']; |
|
3261 | + } |
|
3138 | 3262 | |
3139 | - if ($row['in_inbox'] == 1) |
|
3140 | - $context['labels'][-1]['unread_messages'] += $row['num']; |
|
3263 | + if ($row['in_inbox'] == 1) { |
|
3264 | + $context['labels'][-1]['unread_messages'] += $row['num']; |
|
3265 | + } |
|
3141 | 3266 | } |
3142 | 3267 | $smcFunc['db_free_result']($result); |
3143 | 3268 | |
@@ -3146,8 +3271,9 @@ discard block |
||
3146 | 3271 | updateMemberData($owner, array('unread_messages' => $total_unread)); |
3147 | 3272 | |
3148 | 3273 | // If it was for the current member, reflect this in the $user_info array too. |
3149 | - if ($owner == $user_info['id']) |
|
3150 | - $user_info['unread_messages'] = $total_unread; |
|
3274 | + if ($owner == $user_info['id']) { |
|
3275 | + $user_info['unread_messages'] = $total_unread; |
|
3276 | + } |
|
3151 | 3277 | } |
3152 | 3278 | } |
3153 | 3279 | |
@@ -3175,8 +3301,9 @@ discard block |
||
3175 | 3301 | // Add all existing labels to the array to save, slashing them as necessary... |
3176 | 3302 | foreach ($context['labels'] as $label) |
3177 | 3303 | { |
3178 | - if ($label['id'] != -1) |
|
3179 | - $the_labels[$label['id']] = $label['name']; |
|
3304 | + if ($label['id'] != -1) { |
|
3305 | + $the_labels[$label['id']] = $label['name']; |
|
3306 | + } |
|
3180 | 3307 | } |
3181 | 3308 | |
3182 | 3309 | if (isset($_POST[$context['session_var']])) |
@@ -3195,8 +3322,9 @@ discard block |
||
3195 | 3322 | { |
3196 | 3323 | $_POST['label'] = strtr($smcFunc['htmlspecialchars'](trim($_POST['label'])), array(',' => ',')); |
3197 | 3324 | |
3198 | - if ($smcFunc['strlen']($_POST['label']) > 30) |
|
3199 | - $_POST['label'] = $smcFunc['substr']($_POST['label'], 0, 30); |
|
3325 | + if ($smcFunc['strlen']($_POST['label']) > 30) { |
|
3326 | + $_POST['label'] = $smcFunc['substr']($_POST['label'], 0, 30); |
|
3327 | + } |
|
3200 | 3328 | if ($_POST['label'] != '') |
3201 | 3329 | { |
3202 | 3330 | $the_labels[] = $_POST['label']; |
@@ -3217,24 +3345,25 @@ discard block |
||
3217 | 3345 | { |
3218 | 3346 | foreach ($the_labels as $id => $name) |
3219 | 3347 | { |
3220 | - if ($id == -1) |
|
3221 | - continue; |
|
3222 | - elseif (isset($_POST['label_name'][$id])) |
|
3348 | + if ($id == -1) { |
|
3349 | + continue; |
|
3350 | + } elseif (isset($_POST['label_name'][$id])) |
|
3223 | 3351 | { |
3224 | 3352 | $_POST['label_name'][$id] = trim(strtr($smcFunc['htmlspecialchars']($_POST['label_name'][$id]), array(',' => ','))); |
3225 | 3353 | |
3226 | - if ($smcFunc['strlen']($_POST['label_name'][$id]) > 30) |
|
3227 | - $_POST['label_name'][$id] = $smcFunc['substr']($_POST['label_name'][$id], 0, 30); |
|
3354 | + if ($smcFunc['strlen']($_POST['label_name'][$id]) > 30) { |
|
3355 | + $_POST['label_name'][$id] = $smcFunc['substr']($_POST['label_name'][$id], 0, 30); |
|
3356 | + } |
|
3228 | 3357 | if ($_POST['label_name'][$id] != '') |
3229 | 3358 | { |
3230 | 3359 | // Changing the name of this label? |
3231 | - if ($the_labels[$id] != $_POST['label_name'][$id]) |
|
3232 | - $label_updates[$id] = $_POST['label_name'][$id]; |
|
3360 | + if ($the_labels[$id] != $_POST['label_name'][$id]) { |
|
3361 | + $label_updates[$id] = $_POST['label_name'][$id]; |
|
3362 | + } |
|
3233 | 3363 | |
3234 | 3364 | $the_labels[(int) $id] = $_POST['label_name'][$id]; |
3235 | 3365 | |
3236 | - } |
|
3237 | - else |
|
3366 | + } else |
|
3238 | 3367 | { |
3239 | 3368 | unset($the_labels[(int) $id]); |
3240 | 3369 | $labels_to_remove[] = $id; |
@@ -3248,8 +3377,9 @@ discard block |
||
3248 | 3377 | if (!empty($labels_to_add)) |
3249 | 3378 | { |
3250 | 3379 | $inserts = array(); |
3251 | - foreach ($labels_to_add AS $label) |
|
3252 | - $inserts[] = array($user_info['id'], $label); |
|
3380 | + foreach ($labels_to_add AS $label) { |
|
3381 | + $inserts[] = array($user_info['id'], $label); |
|
3382 | + } |
|
3253 | 3383 | |
3254 | 3384 | $smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array()); |
3255 | 3385 | } |
@@ -3339,8 +3469,9 @@ discard block |
||
3339 | 3469 | // Each action... |
3340 | 3470 | foreach ($rule['actions'] as $k2 => $action) |
3341 | 3471 | { |
3342 | - if ($action['t'] != 'lab' || !in_array($action['v'], $labels_to_remove)) |
|
3343 | - continue; |
|
3472 | + if ($action['t'] != 'lab' || !in_array($action['v'], $labels_to_remove)) { |
|
3473 | + continue; |
|
3474 | + } |
|
3344 | 3475 | |
3345 | 3476 | $rule_changes[] = $rule['id']; |
3346 | 3477 | |
@@ -3355,8 +3486,8 @@ discard block |
||
3355 | 3486 | { |
3356 | 3487 | $rule_changes = array_unique($rule_changes); |
3357 | 3488 | // Update/delete as appropriate. |
3358 | - foreach ($rule_changes as $k => $id) |
|
3359 | - if (!empty($context['rules'][$id]['actions'])) |
|
3489 | + foreach ($rule_changes as $k => $id) { |
|
3490 | + if (!empty($context['rules'][$id]['actions'])) |
|
3360 | 3491 | { |
3361 | 3492 | $smcFunc['db_query']('', ' |
3362 | 3493 | UPDATE {db_prefix}pm_rules |
@@ -3369,12 +3500,13 @@ discard block |
||
3369 | 3500 | 'actions' => $smcFunc['json_encode']($context['rules'][$id]['actions']), |
3370 | 3501 | ) |
3371 | 3502 | ); |
3503 | + } |
|
3372 | 3504 | unset($rule_changes[$k]); |
3373 | 3505 | } |
3374 | 3506 | |
3375 | 3507 | // Anything left here means it's lost all actions... |
3376 | - if (!empty($rule_changes)) |
|
3377 | - $smcFunc['db_query']('', ' |
|
3508 | + if (!empty($rule_changes)) { |
|
3509 | + $smcFunc['db_query']('', ' |
|
3378 | 3510 | DELETE FROM {db_prefix}pm_rules |
3379 | 3511 | WHERE id_rule IN ({array_int:rule_list}) |
3380 | 3512 | AND id_member = {int:current_member}', |
@@ -3383,6 +3515,7 @@ discard block |
||
3383 | 3515 | 'rule_list' => $rule_changes, |
3384 | 3516 | ) |
3385 | 3517 | ); |
3518 | + } |
|
3386 | 3519 | } |
3387 | 3520 | |
3388 | 3521 | // Make sure we're not caching this! |
@@ -3452,8 +3585,9 @@ discard block |
||
3452 | 3585 | // Save the fields. |
3453 | 3586 | saveProfileFields(); |
3454 | 3587 | |
3455 | - if (!empty($profile_vars)) |
|
3456 | - updateMemberData($user_info['id'], $profile_vars); |
|
3588 | + if (!empty($profile_vars)) { |
|
3589 | + updateMemberData($user_info['id'], $profile_vars); |
|
3590 | + } |
|
3457 | 3591 | } |
3458 | 3592 | |
3459 | 3593 | setupProfileContext( |
@@ -3478,13 +3612,15 @@ discard block |
||
3478 | 3612 | global $user_info, $language, $modSettings, $smcFunc; |
3479 | 3613 | |
3480 | 3614 | // Check that this feature is even enabled! |
3481 | - if (empty($modSettings['enableReportPM']) || empty($_REQUEST['pmsg'])) |
|
3482 | - fatal_lang_error('no_access', false); |
|
3615 | + if (empty($modSettings['enableReportPM']) || empty($_REQUEST['pmsg'])) { |
|
3616 | + fatal_lang_error('no_access', false); |
|
3617 | + } |
|
3483 | 3618 | |
3484 | 3619 | $pmsg = (int) $_REQUEST['pmsg']; |
3485 | 3620 | |
3486 | - if (!isAccessiblePM($pmsg, 'inbox')) |
|
3487 | - fatal_lang_error('no_access', false); |
|
3621 | + if (!isAccessiblePM($pmsg, 'inbox')) { |
|
3622 | + fatal_lang_error('no_access', false); |
|
3623 | + } |
|
3488 | 3624 | |
3489 | 3625 | $context['pm_id'] = $pmsg; |
3490 | 3626 | $context['page_title'] = $txt['pm_report_title']; |
@@ -3506,8 +3642,9 @@ discard block |
||
3506 | 3642 | ) |
3507 | 3643 | ); |
3508 | 3644 | $context['admins'] = array(); |
3509 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
3510 | - $context['admins'][$row['id_member']] = $row['real_name']; |
|
3645 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
3646 | + $context['admins'][$row['id_member']] = $row['real_name']; |
|
3647 | + } |
|
3511 | 3648 | $smcFunc['db_free_result']($request); |
3512 | 3649 | |
3513 | 3650 | // How many admins in total? |
@@ -3536,8 +3673,9 @@ discard block |
||
3536 | 3673 | ) |
3537 | 3674 | ); |
3538 | 3675 | // Can only be a hacker here! |
3539 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
3540 | - fatal_lang_error('no_access', false); |
|
3676 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
3677 | + fatal_lang_error('no_access', false); |
|
3678 | + } |
|
3541 | 3679 | list ($subject, $body, $time, $memberFromID, $memberFromName) = $smcFunc['db_fetch_row']($request); |
3542 | 3680 | $smcFunc['db_free_result']($request); |
3543 | 3681 | |
@@ -3561,15 +3699,17 @@ discard block |
||
3561 | 3699 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
3562 | 3700 | { |
3563 | 3701 | // If it's hidden still don't reveal their names - privacy after all ;) |
3564 | - if ($row['bcc']) |
|
3565 | - $hidden_recipients++; |
|
3566 | - else |
|
3567 | - $recipients[] = '[url=' . $scripturl . '?action=profile;u=' . $row['id_member_to'] . ']' . $row['to_name'] . '[/url]'; |
|
3702 | + if ($row['bcc']) { |
|
3703 | + $hidden_recipients++; |
|
3704 | + } else { |
|
3705 | + $recipients[] = '[url=' . $scripturl . '?action=profile;u=' . $row['id_member_to'] . ']' . $row['to_name'] . '[/url]'; |
|
3706 | + } |
|
3568 | 3707 | } |
3569 | 3708 | $smcFunc['db_free_result']($request); |
3570 | 3709 | |
3571 | - if ($hidden_recipients) |
|
3572 | - $recipients[] = sprintf($txt['pm_report_pm_hidden'], $hidden_recipients); |
|
3710 | + if ($hidden_recipients) { |
|
3711 | + $recipients[] = sprintf($txt['pm_report_pm_hidden'], $hidden_recipients); |
|
3712 | + } |
|
3573 | 3713 | |
3574 | 3714 | // Now let's get out and loop through the admins. |
3575 | 3715 | $request = $smcFunc['db_query']('', ' |
@@ -3585,8 +3725,9 @@ discard block |
||
3585 | 3725 | ); |
3586 | 3726 | |
3587 | 3727 | // Maybe we shouldn't advertise this? |
3588 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
3589 | - fatal_lang_error('no_access', false); |
|
3728 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
3729 | + fatal_lang_error('no_access', false); |
|
3730 | + } |
|
3590 | 3731 | |
3591 | 3732 | $memberFromName = un_htmlspecialchars($memberFromName); |
3592 | 3733 | |
@@ -3605,8 +3746,9 @@ discard block |
||
3605 | 3746 | // Make the body. |
3606 | 3747 | $report_body = str_replace(array('{REPORTER}', '{SENDER}'), array(un_htmlspecialchars($user_info['name']), $memberFromName), $txt['pm_report_pm_user_sent']); |
3607 | 3748 | $report_body .= "\n" . '[b]' . $_POST['reason'] . '[/b]' . "\n\n"; |
3608 | - if (!empty($recipients)) |
|
3609 | - $report_body .= $txt['pm_report_pm_other_recipients'] . ' ' . implode(', ', $recipients) . "\n\n"; |
|
3749 | + if (!empty($recipients)) { |
|
3750 | + $report_body .= $txt['pm_report_pm_other_recipients'] . ' ' . implode(', ', $recipients) . "\n\n"; |
|
3751 | + } |
|
3610 | 3752 | $report_body .= $txt['pm_report_pm_unedited_below'] . "\n" . '[quote author=' . (empty($memberFromID) ? '"' . $memberFromName . '"' : $memberFromName . ' link=action=profile;u=' . $memberFromID . ' date=' . $time) . ']' . "\n" . un_htmlspecialchars($body) . '[/quote]'; |
3611 | 3753 | |
3612 | 3754 | // Plonk it in the array ;) |
@@ -3626,12 +3768,14 @@ discard block |
||
3626 | 3768 | $smcFunc['db_free_result']($request); |
3627 | 3769 | |
3628 | 3770 | // Send a different email for each language. |
3629 | - foreach ($messagesToSend as $lang => $message) |
|
3630 | - sendpm($message['recipients'], $message['subject'], $message['body']); |
|
3771 | + foreach ($messagesToSend as $lang => $message) { |
|
3772 | + sendpm($message['recipients'], $message['subject'], $message['body']); |
|
3773 | + } |
|
3631 | 3774 | |
3632 | 3775 | // Give the user their own language back! |
3633 | - if (!empty($modSettings['userLanguage'])) |
|
3634 | - loadLanguage('PersonalMessage', '', false); |
|
3776 | + if (!empty($modSettings['userLanguage'])) { |
|
3777 | + loadLanguage('PersonalMessage', '', false); |
|
3778 | + } |
|
3635 | 3779 | |
3636 | 3780 | // Leave them with a template. |
3637 | 3781 | $context['sub_template'] = 'report_message_complete'; |
@@ -3677,8 +3821,9 @@ discard block |
||
3677 | 3821 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
3678 | 3822 | { |
3679 | 3823 | // Hide hidden groups! |
3680 | - if ($row['hidden'] && !$row['can_moderate'] && !allowedTo('manage_membergroups')) |
|
3681 | - continue; |
|
3824 | + if ($row['hidden'] && !$row['can_moderate'] && !allowedTo('manage_membergroups')) { |
|
3825 | + continue; |
|
3826 | + } |
|
3682 | 3827 | |
3683 | 3828 | $context['groups'][$row['id_group']] = $row['group_name']; |
3684 | 3829 | } |
@@ -3704,9 +3849,10 @@ discard block |
||
3704 | 3849 | $context['rule'] = $context['rules'][$context['rid']]; |
3705 | 3850 | $members = array(); |
3706 | 3851 | // Need to get member names! |
3707 | - foreach ($context['rule']['criteria'] as $k => $criteria) |
|
3708 | - if ($criteria['t'] == 'mid' && !empty($criteria['v'])) |
|
3852 | + foreach ($context['rule']['criteria'] as $k => $criteria) { |
|
3853 | + if ($criteria['t'] == 'mid' && !empty($criteria['v'])) |
|
3709 | 3854 | $members[(int) $criteria['v']] = $k; |
3855 | + } |
|
3710 | 3856 | |
3711 | 3857 | if (!empty($members)) |
3712 | 3858 | { |
@@ -3718,19 +3864,20 @@ discard block |
||
3718 | 3864 | 'member_list' => array_keys($members), |
3719 | 3865 | ) |
3720 | 3866 | ); |
3721 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
3722 | - $context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name']; |
|
3867 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
3868 | + $context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name']; |
|
3869 | + } |
|
3723 | 3870 | $smcFunc['db_free_result']($request); |
3724 | 3871 | } |
3725 | - } |
|
3726 | - else |
|
3727 | - $context['rule'] = array( |
|
3872 | + } else { |
|
3873 | + $context['rule'] = array( |
|
3728 | 3874 | 'id' => '', |
3729 | 3875 | 'name' => '', |
3730 | 3876 | 'criteria' => array(), |
3731 | 3877 | 'actions' => array(), |
3732 | 3878 | 'logic' => 'and', |
3733 | 3879 | ); |
3880 | + } |
|
3734 | 3881 | } |
3735 | 3882 | // Saving? |
3736 | 3883 | elseif (isset($_GET['save'])) |
@@ -3740,22 +3887,25 @@ discard block |
||
3740 | 3887 | |
3741 | 3888 | // Name is easy! |
3742 | 3889 | $ruleName = $smcFunc['htmlspecialchars'](trim($_POST['rule_name'])); |
3743 | - if (empty($ruleName)) |
|
3744 | - fatal_lang_error('pm_rule_no_name', false); |
|
3890 | + if (empty($ruleName)) { |
|
3891 | + fatal_lang_error('pm_rule_no_name', false); |
|
3892 | + } |
|
3745 | 3893 | |
3746 | 3894 | // Sanity check... |
3747 | - if (empty($_POST['ruletype']) || empty($_POST['acttype'])) |
|
3748 | - fatal_lang_error('pm_rule_no_criteria', false); |
|
3895 | + if (empty($_POST['ruletype']) || empty($_POST['acttype'])) { |
|
3896 | + fatal_lang_error('pm_rule_no_criteria', false); |
|
3897 | + } |
|
3749 | 3898 | |
3750 | 3899 | // Let's do the criteria first - it's also hardest! |
3751 | 3900 | $criteria = array(); |
3752 | 3901 | foreach ($_POST['ruletype'] as $ind => $type) |
3753 | 3902 | { |
3754 | 3903 | // Check everything is here... |
3755 | - if ($type == 'gid' && (!isset($_POST['ruledefgroup'][$ind]) || !isset($context['groups'][$_POST['ruledefgroup'][$ind]]))) |
|
3756 | - continue; |
|
3757 | - elseif ($type != 'bud' && !isset($_POST['ruledef'][$ind])) |
|
3758 | - continue; |
|
3904 | + if ($type == 'gid' && (!isset($_POST['ruledefgroup'][$ind]) || !isset($context['groups'][$_POST['ruledefgroup'][$ind]]))) { |
|
3905 | + continue; |
|
3906 | + } elseif ($type != 'bud' && !isset($_POST['ruledef'][$ind])) { |
|
3907 | + continue; |
|
3908 | + } |
|
3759 | 3909 | |
3760 | 3910 | // Members need to be found. |
3761 | 3911 | if ($type == 'mid') |
@@ -3779,13 +3929,13 @@ discard block |
||
3779 | 3929 | $smcFunc['db_free_result']($request); |
3780 | 3930 | |
3781 | 3931 | $criteria[] = array('t' => 'mid', 'v' => $memID); |
3932 | + } elseif ($type == 'bud') { |
|
3933 | + $criteria[] = array('t' => 'bud', 'v' => 1); |
|
3934 | + } elseif ($type == 'gid') { |
|
3935 | + $criteria[] = array('t' => 'gid', 'v' => (int) $_POST['ruledefgroup'][$ind]); |
|
3936 | + } elseif (in_array($type, array('sub', 'msg')) && trim($_POST['ruledef'][$ind]) != '') { |
|
3937 | + $criteria[] = array('t' => $type, 'v' => $smcFunc['htmlspecialchars'](trim($_POST['ruledef'][$ind]))); |
|
3782 | 3938 | } |
3783 | - elseif ($type == 'bud') |
|
3784 | - $criteria[] = array('t' => 'bud', 'v' => 1); |
|
3785 | - elseif ($type == 'gid') |
|
3786 | - $criteria[] = array('t' => 'gid', 'v' => (int) $_POST['ruledefgroup'][$ind]); |
|
3787 | - elseif (in_array($type, array('sub', 'msg')) && trim($_POST['ruledef'][$ind]) != '') |
|
3788 | - $criteria[] = array('t' => $type, 'v' => $smcFunc['htmlspecialchars'](trim($_POST['ruledef'][$ind]))); |
|
3789 | 3939 | } |
3790 | 3940 | |
3791 | 3941 | // Also do the actions! |
@@ -3795,26 +3945,29 @@ discard block |
||
3795 | 3945 | foreach ($_POST['acttype'] as $ind => $type) |
3796 | 3946 | { |
3797 | 3947 | // Picking a valid label? |
3798 | - if ($type == 'lab' && (!isset($_POST['labdef'][$ind]) || !isset($context['labels'][$_POST['labdef'][$ind]]))) |
|
3799 | - continue; |
|
3948 | + if ($type == 'lab' && (!isset($_POST['labdef'][$ind]) || !isset($context['labels'][$_POST['labdef'][$ind]]))) { |
|
3949 | + continue; |
|
3950 | + } |
|
3800 | 3951 | |
3801 | 3952 | // Record what we're doing. |
3802 | - if ($type == 'del') |
|
3803 | - $doDelete = 1; |
|
3804 | - elseif ($type == 'lab') |
|
3805 | - $actions[] = array('t' => 'lab', 'v' => (int) $_POST['labdef'][$ind]); |
|
3953 | + if ($type == 'del') { |
|
3954 | + $doDelete = 1; |
|
3955 | + } elseif ($type == 'lab') { |
|
3956 | + $actions[] = array('t' => 'lab', 'v' => (int) $_POST['labdef'][$ind]); |
|
3957 | + } |
|
3806 | 3958 | } |
3807 | 3959 | |
3808 | - if (empty($criteria) || (empty($actions) && !$doDelete)) |
|
3809 | - fatal_lang_error('pm_rule_no_criteria', false); |
|
3960 | + if (empty($criteria) || (empty($actions) && !$doDelete)) { |
|
3961 | + fatal_lang_error('pm_rule_no_criteria', false); |
|
3962 | + } |
|
3810 | 3963 | |
3811 | 3964 | // What are we storing? |
3812 | 3965 | $criteria = $smcFunc['json_encode']($criteria); |
3813 | 3966 | $actions = $smcFunc['json_encode']($actions); |
3814 | 3967 | |
3815 | 3968 | // Create the rule? |
3816 | - if (empty($context['rid'])) |
|
3817 | - $smcFunc['db_insert']('', |
|
3969 | + if (empty($context['rid'])) { |
|
3970 | + $smcFunc['db_insert']('', |
|
3818 | 3971 | '{db_prefix}pm_rules', |
3819 | 3972 | array( |
3820 | 3973 | 'id_member' => 'int', 'rule_name' => 'string', 'criteria' => 'string', 'actions' => 'string', |
@@ -3825,8 +3978,8 @@ discard block |
||
3825 | 3978 | ), |
3826 | 3979 | array('id_rule') |
3827 | 3980 | ); |
3828 | - else |
|
3829 | - $smcFunc['db_query']('', ' |
|
3981 | + } else { |
|
3982 | + $smcFunc['db_query']('', ' |
|
3830 | 3983 | UPDATE {db_prefix}pm_rules |
3831 | 3984 | SET rule_name = {string:rule_name}, criteria = {string:criteria}, actions = {string:actions}, |
3832 | 3985 | delete_pm = {int:delete_pm}, is_or = {int:is_or} |
@@ -3842,6 +3995,7 @@ discard block |
||
3842 | 3995 | 'actions' => $actions, |
3843 | 3996 | ) |
3844 | 3997 | ); |
3998 | + } |
|
3845 | 3999 | |
3846 | 4000 | redirectexit('action=pm;sa=manrules'); |
3847 | 4001 | } |
@@ -3850,11 +4004,12 @@ discard block |
||
3850 | 4004 | { |
3851 | 4005 | checkSession(); |
3852 | 4006 | $toDelete = array(); |
3853 | - foreach ($_POST['delrule'] as $k => $v) |
|
3854 | - $toDelete[] = (int) $k; |
|
4007 | + foreach ($_POST['delrule'] as $k => $v) { |
|
4008 | + $toDelete[] = (int) $k; |
|
4009 | + } |
|
3855 | 4010 | |
3856 | - if (!empty($toDelete)) |
|
3857 | - $smcFunc['db_query']('', ' |
|
4011 | + if (!empty($toDelete)) { |
|
4012 | + $smcFunc['db_query']('', ' |
|
3858 | 4013 | DELETE FROM {db_prefix}pm_rules |
3859 | 4014 | WHERE id_rule IN ({array_int:delete_list}) |
3860 | 4015 | AND id_member = {int:current_member}', |
@@ -3863,6 +4018,7 @@ discard block |
||
3863 | 4018 | 'delete_list' => $toDelete, |
3864 | 4019 | ) |
3865 | 4020 | ); |
4021 | + } |
|
3866 | 4022 | |
3867 | 4023 | redirectexit('action=pm;sa=manrules'); |
3868 | 4024 | } |
@@ -3881,8 +4037,9 @@ discard block |
||
3881 | 4037 | loadRules(); |
3882 | 4038 | |
3883 | 4039 | // No rules? |
3884 | - if (empty($context['rules'])) |
|
3885 | - return; |
|
4040 | + if (empty($context['rules'])) { |
|
4041 | + return; |
|
4042 | + } |
|
3886 | 4043 | |
3887 | 4044 | // Just unread ones? |
3888 | 4045 | $ruleQuery = $all_messages ? '' : ' AND pmr.is_new = 1'; |
@@ -3912,8 +4069,9 @@ discard block |
||
3912 | 4069 | // Loop through all the criteria hoping to make a match. |
3913 | 4070 | foreach ($rule['criteria'] as $criterium) |
3914 | 4071 | { |
3915 | - if (($criterium['t'] == 'mid' && $criterium['v'] == $row['id_member_from']) || ($criterium['t'] == 'gid' && $criterium['v'] == $row['id_group']) || ($criterium['t'] == 'sub' && strpos($row['subject'], $criterium['v']) !== false) || ($criterium['t'] == 'msg' && strpos($row['body'], $criterium['v']) !== false)) |
|
3916 | - $match = true; |
|
4072 | + if (($criterium['t'] == 'mid' && $criterium['v'] == $row['id_member_from']) || ($criterium['t'] == 'gid' && $criterium['v'] == $row['id_group']) || ($criterium['t'] == 'sub' && strpos($row['subject'], $criterium['v']) !== false) || ($criterium['t'] == 'msg' && strpos($row['body'], $criterium['v']) !== false)) { |
|
4073 | + $match = true; |
|
4074 | + } |
|
3917 | 4075 | // If we're adding and one criteria don't match then we stop! |
3918 | 4076 | elseif ($rule['logic'] == 'and') |
3919 | 4077 | { |
@@ -3925,17 +4083,18 @@ discard block |
||
3925 | 4083 | // If we have a match the rule must be true - act! |
3926 | 4084 | if ($match) |
3927 | 4085 | { |
3928 | - if ($rule['delete']) |
|
3929 | - $actions['deletes'][] = $row['id_pm']; |
|
3930 | - else |
|
4086 | + if ($rule['delete']) { |
|
4087 | + $actions['deletes'][] = $row['id_pm']; |
|
4088 | + } else |
|
3931 | 4089 | { |
3932 | 4090 | foreach ($rule['actions'] as $ruleAction) |
3933 | 4091 | { |
3934 | 4092 | if ($ruleAction['t'] == 'lab') |
3935 | 4093 | { |
3936 | 4094 | // Get a basic pot started! |
3937 | - if (!isset($actions['labels'][$row['id_pm']])) |
|
3938 | - $actions['labels'][$row['id_pm']] = array(); |
|
4095 | + if (!isset($actions['labels'][$row['id_pm']])) { |
|
4096 | + $actions['labels'][$row['id_pm']] = array(); |
|
4097 | + } |
|
3939 | 4098 | $actions['labels'][$row['id_pm']][] = $ruleAction['v']; |
3940 | 4099 | } |
3941 | 4100 | } |
@@ -3946,8 +4105,9 @@ discard block |
||
3946 | 4105 | $smcFunc['db_free_result']($request); |
3947 | 4106 | |
3948 | 4107 | // Deletes are easy! |
3949 | - if (!empty($actions['deletes'])) |
|
3950 | - deleteMessages($actions['deletes']); |
|
4108 | + if (!empty($actions['deletes'])) { |
|
4109 | + deleteMessages($actions['deletes']); |
|
4110 | + } |
|
3951 | 4111 | |
3952 | 4112 | // Relabel? |
3953 | 4113 | if (!empty($actions['labels'])) |
@@ -3974,8 +4134,7 @@ discard block |
||
3974 | 4134 | 'current_member' => $user_info['id'], |
3975 | 4135 | ) |
3976 | 4136 | ); |
3977 | - } |
|
3978 | - else |
|
4137 | + } else |
|
3979 | 4138 | { |
3980 | 4139 | $realLabels[] = $label['id']; |
3981 | 4140 | } |
@@ -3984,8 +4143,9 @@ discard block |
||
3984 | 4143 | |
3985 | 4144 | $inserts = array(); |
3986 | 4145 | // Now we insert the label info |
3987 | - foreach ($realLabels as $a_label) |
|
3988 | - $inserts[] = array($pm, $a_label); |
|
4146 | + foreach ($realLabels as $a_label) { |
|
4147 | + $inserts[] = array($pm, $a_label); |
|
4148 | + } |
|
3989 | 4149 | |
3990 | 4150 | $smcFunc['db_insert']('ignore', |
3991 | 4151 | '{db_prefix}pm_labeled_messages', |
@@ -4006,8 +4166,9 @@ discard block |
||
4006 | 4166 | { |
4007 | 4167 | global $user_info, $context, $smcFunc; |
4008 | 4168 | |
4009 | - if (isset($context['rules']) && !$reload) |
|
4010 | - return; |
|
4169 | + if (isset($context['rules']) && !$reload) { |
|
4170 | + return; |
|
4171 | + } |
|
4011 | 4172 | |
4012 | 4173 | $request = $smcFunc['db_query']('', ' |
4013 | 4174 | SELECT |
@@ -4031,8 +4192,9 @@ discard block |
||
4031 | 4192 | 'logic' => $row['is_or'] ? 'or' : 'and', |
4032 | 4193 | ); |
4033 | 4194 | |
4034 | - if ($row['delete_pm']) |
|
4035 | - $context['rules'][$row['id_rule']]['actions'][] = array('t' => 'del', 'v' => 1); |
|
4195 | + if ($row['delete_pm']) { |
|
4196 | + $context['rules'][$row['id_rule']]['actions'][] = array('t' => 'del', 'v' => 1); |
|
4197 | + } |
|
4036 | 4198 | } |
4037 | 4199 | $smcFunc['db_free_result']($request); |
4038 | 4200 | } |