@@ -28,13 +28,14 @@ discard block |
||
| 28 | 28 | <div id="confirm_buttons">'; |
| 29 | 29 | |
| 30 | 30 | // Age restriction in effect? |
| 31 | - if ($context['show_coppa']) |
|
| 32 | - echo ' |
|
| 31 | + if ($context['show_coppa']) { |
|
| 32 | + echo ' |
|
| 33 | 33 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit"><br><br> |
| 34 | 34 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit">'; |
| 35 | - else |
|
| 36 | - echo ' |
|
| 35 | + } else { |
|
| 36 | + echo ' |
|
| 37 | 37 | <input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button_submit">'; |
| 38 | + } |
|
| 38 | 39 | |
| 39 | 40 | echo ' |
| 40 | 41 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -77,9 +78,10 @@ discard block |
||
| 77 | 78 | <ul>'; |
| 78 | 79 | |
| 79 | 80 | // Cycle through each error and display an error message. |
| 80 | - foreach ($context['registration_errors'] as $error) |
|
| 81 | - echo ' |
|
| 81 | + foreach ($context['registration_errors'] as $error) { |
|
| 82 | + echo ' |
|
| 82 | 83 | <li>', $error, '</li>'; |
| 84 | + } |
|
| 83 | 85 | |
| 84 | 86 | echo ' |
| 85 | 87 | </ul> |
@@ -143,14 +145,15 @@ discard block |
||
| 143 | 145 | |
| 144 | 146 | <dl class="register_form">'; |
| 145 | 147 | |
| 146 | - foreach ($context['custom_fields'] as $field) |
|
| 147 | - if ($field['show_reg'] > 1) |
|
| 148 | + foreach ($context['custom_fields'] as $field) { |
|
| 149 | + if ($field['show_reg'] > 1) |
|
| 148 | 150 | echo ' |
| 149 | 151 | <dt> |
| 150 | 152 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
| 151 | 153 | <span class="smalltext">', $field['desc'], '</span> |
| 152 | 154 | </dt> |
| 153 | 155 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
| 156 | + } |
|
| 154 | 157 | |
| 155 | 158 | echo ' |
| 156 | 159 | </dl>'; |
@@ -184,41 +187,45 @@ discard block |
||
| 184 | 187 | $callback_func = 'template_profile_' . $field['callback_func']; |
| 185 | 188 | $callback_func(); |
| 186 | 189 | } |
| 187 | - } |
|
| 188 | - else |
|
| 190 | + } else |
|
| 189 | 191 | { |
| 190 | 192 | echo ' |
| 191 | 193 | <dt> |
| 192 | 194 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>'; |
| 193 | 195 | |
| 194 | 196 | // Does it have any subtext to show? |
| 195 | - if (!empty($field['subtext'])) |
|
| 196 | - echo ' |
|
| 197 | + if (!empty($field['subtext'])) { |
|
| 198 | + echo ' |
|
| 197 | 199 | <span class="smalltext">', $field['subtext'], '</span>'; |
| 200 | + } |
|
| 198 | 201 | |
| 199 | 202 | echo ' |
| 200 | 203 | </dt> |
| 201 | 204 | <dd>'; |
| 202 | 205 | |
| 203 | 206 | // Want to put something infront of the box? |
| 204 | - if (!empty($field['preinput'])) |
|
| 205 | - echo ' |
|
| 207 | + if (!empty($field['preinput'])) { |
|
| 208 | + echo ' |
|
| 206 | 209 | ', $field['preinput']; |
| 210 | + } |
|
| 207 | 211 | |
| 208 | 212 | // What type of data are we showing? |
| 209 | - if ($field['type'] == 'label') |
|
| 210 | - echo ' |
|
| 213 | + if ($field['type'] == 'label') { |
|
| 214 | + echo ' |
|
| 211 | 215 | ', $field['value']; |
| 216 | + } |
|
| 212 | 217 | |
| 213 | 218 | // Maybe it's a text box - very likely! |
| 214 | - elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) |
|
| 215 | - echo ' |
|
| 219 | + elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) { |
|
| 220 | + echo ' |
|
| 216 | 221 | <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '">'; |
| 222 | + } |
|
| 217 | 223 | |
| 218 | 224 | // You "checking" me out? ;) |
| 219 | - elseif ($field['type'] == 'check') |
|
| 220 | - echo ' |
|
| 225 | + elseif ($field['type'] == 'check') { |
|
| 226 | + echo ' |
|
| 221 | 227 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" class="input_check" ', $field['input_attr'], '>'; |
| 228 | + } |
|
| 222 | 229 | |
| 223 | 230 | // Always fun - select boxes! |
| 224 | 231 | elseif ($field['type'] == 'select') |
@@ -229,13 +236,15 @@ discard block |
||
| 229 | 236 | if (isset($field['options'])) |
| 230 | 237 | { |
| 231 | 238 | // Is this some code to generate the options? |
| 232 | - if (!is_array($field['options'])) |
|
| 233 | - $field['options'] = eval($field['options']); |
|
| 239 | + if (!is_array($field['options'])) { |
|
| 240 | + $field['options'] = eval($field['options']); |
|
| 241 | + } |
|
| 234 | 242 | // Assuming we now have some! |
| 235 | - if (is_array($field['options'])) |
|
| 236 | - foreach ($field['options'] as $value => $name) |
|
| 243 | + if (is_array($field['options'])) { |
|
| 244 | + foreach ($field['options'] as $value => $name) |
|
| 237 | 245 | echo ' |
| 238 | 246 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
| 247 | + } |
|
| 239 | 248 | } |
| 240 | 249 | |
| 241 | 250 | echo ' |
@@ -243,9 +252,10 @@ discard block |
||
| 243 | 252 | } |
| 244 | 253 | |
| 245 | 254 | // Something to end with? |
| 246 | - if (!empty($field['postinput'])) |
|
| 247 | - echo ' |
|
| 255 | + if (!empty($field['postinput'])) { |
|
| 256 | + echo ' |
|
| 248 | 257 | ', $field['postinput']; |
| 258 | + } |
|
| 249 | 259 | |
| 250 | 260 | echo ' |
| 251 | 261 | </dd>'; |
@@ -258,13 +268,14 @@ discard block |
||
| 258 | 268 | { |
| 259 | 269 | foreach ($context['custom_fields'] as $field) |
| 260 | 270 | { |
| 261 | - if ($field['show_reg'] < 2) |
|
| 262 | - echo ' |
|
| 271 | + if ($field['show_reg'] < 2) { |
|
| 272 | + echo ' |
|
| 263 | 273 | <dt> |
| 264 | 274 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
| 265 | 275 | <span class="smalltext">', $field['desc'], '</span> |
| 266 | 276 | </dt> |
| 267 | 277 | <dd>', $field['input_html'], '</dd>'; |
| 278 | + } |
|
| 268 | 279 | } |
| 269 | 280 | } |
| 270 | 281 | |
@@ -294,13 +305,14 @@ discard block |
||
| 294 | 305 | <div id="confirm_buttons" class="flow_auto">'; |
| 295 | 306 | |
| 296 | 307 | // Age restriction in effect? |
| 297 | - if (!$context['require_agreement'] && $context['show_coppa']) |
|
| 298 | - echo ' |
|
| 308 | + if (!$context['require_agreement'] && $context['show_coppa']) { |
|
| 309 | + echo ' |
|
| 299 | 310 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit"><br><br> |
| 300 | 311 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit">'; |
| 301 | - else |
|
| 302 | - echo ' |
|
| 312 | + } else { |
|
| 313 | + echo ' |
|
| 303 | 314 | <input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button_submit">'; |
| 315 | + } |
|
| 304 | 316 | echo ' |
| 305 | 317 | </div> |
| 306 | 318 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -445,19 +457,20 @@ discard block |
||
| 445 | 457 | </head> |
| 446 | 458 | <body style="margin: 1ex;"> |
| 447 | 459 | <div class="windowbg description" style="text-align: center;">'; |
| 448 | - if (isBrowser('is_ie') || isBrowser('is_ie11')) |
|
| 449 | - echo ' |
|
| 460 | + if (isBrowser('is_ie') || isBrowser('is_ie11')) { |
|
| 461 | + echo ' |
|
| 450 | 462 | <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav"> |
| 451 | 463 | <param name="AutoStart" value="1"> |
| 452 | 464 | <param name="FileName" value="', $context['verification_sound_href'], '"> |
| 453 | 465 | </object>'; |
| 454 | - else |
|
| 455 | - echo ' |
|
| 466 | + } else { |
|
| 467 | + echo ' |
|
| 456 | 468 | <audio src="', $context['verification_sound_href'], '" controls> |
| 457 | 469 | <object type="audio/x-wav" data="', $context['verification_sound_href'], '"> |
| 458 | 470 | <a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a> |
| 459 | 471 | </object> |
| 460 | 472 | </audio>'; |
| 473 | + } |
|
| 461 | 474 | echo ' |
| 462 | 475 | <br> |
| 463 | 476 | <a href="', $context['verification_sound_href'], ';sound" rel="nofollow">', $txt['visual_verification_sound_again'], '</a><br> |
@@ -484,11 +497,12 @@ discard block |
||
| 484 | 497 | </div> |
| 485 | 498 | <div id="register_screen" class="windowbg2 noup">'; |
| 486 | 499 | |
| 487 | - if (!empty($context['registration_done'])) |
|
| 488 | - echo ' |
|
| 500 | + if (!empty($context['registration_done'])) { |
|
| 501 | + echo ' |
|
| 489 | 502 | <div class="infobox"> |
| 490 | 503 | ', $context['registration_done'], ' |
| 491 | 504 | </div>'; |
| 505 | + } |
|
| 492 | 506 | |
| 493 | 507 | echo ' |
| 494 | 508 | <dl class="register_form" id="admin_register_form"> |
@@ -524,9 +538,10 @@ discard block |
||
| 524 | 538 | <dd> |
| 525 | 539 | <select name="group" id="group_select" tabindex="', $context['tabindex']++, '">'; |
| 526 | 540 | |
| 527 | - foreach ($context['member_groups'] as $id => $name) |
|
| 528 | - echo ' |
|
| 541 | + foreach ($context['member_groups'] as $id => $name) { |
|
| 542 | + echo ' |
|
| 529 | 543 | <option value="', $id, '">', $name, '</option>'; |
| 544 | + } |
|
| 530 | 545 | |
| 531 | 546 | echo ' |
| 532 | 547 | </select> |
@@ -534,8 +549,8 @@ discard block |
||
| 534 | 549 | } |
| 535 | 550 | |
| 536 | 551 | // If there is any field marked as required, show it here! |
| 537 | - if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) |
|
| 538 | - foreach ($context['custom_fields'] as $field) |
|
| 552 | + if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) { |
|
| 553 | + foreach ($context['custom_fields'] as $field) |
|
| 539 | 554 | if ($field['show_reg'] > 1) |
| 540 | 555 | echo ' |
| 541 | 556 | <dt> |
@@ -543,6 +558,7 @@ discard block |
||
| 543 | 558 | <span class="smalltext">', $field['desc'], '</span> |
| 544 | 559 | </dt> |
| 545 | 560 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
| 561 | + } |
|
| 546 | 562 | |
| 547 | 563 | echo ' |
| 548 | 564 | <dt> |
@@ -579,12 +595,13 @@ discard block |
||
| 579 | 595 | { |
| 580 | 596 | global $context, $scripturl, $txt; |
| 581 | 597 | |
| 582 | - if (!empty($context['saved_successful'])) |
|
| 583 | - echo ' |
|
| 598 | + if (!empty($context['saved_successful'])) { |
|
| 599 | + echo ' |
|
| 584 | 600 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 585 | - elseif (!empty($context['could_not_save'])) |
|
| 586 | - echo ' |
|
| 601 | + } elseif (!empty($context['could_not_save'])) { |
|
| 602 | + echo ' |
|
| 587 | 603 | <div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>'; |
| 604 | + } |
|
| 588 | 605 | |
| 589 | 606 | // Just a big box to edit the text file ;). |
| 590 | 607 | echo ' |
@@ -594,9 +611,10 @@ discard block |
||
| 594 | 611 | </div>'; |
| 595 | 612 | |
| 596 | 613 | // Warning for if the file isn't writable. |
| 597 | - if (!empty($context['warning'])) |
|
| 598 | - echo ' |
|
| 614 | + if (!empty($context['warning'])) { |
|
| 615 | + echo ' |
|
| 599 | 616 | <p class="error">', $context['warning'], '</p>'; |
| 617 | + } |
|
| 600 | 618 | |
| 601 | 619 | echo ' |
| 602 | 620 | <div class="windowbg2 noup" id="registration_agreement">'; |
@@ -613,9 +631,10 @@ discard block |
||
| 613 | 631 | <strong>', $txt['admin_agreement_select_language'], ':</strong> |
| 614 | 632 | <select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">'; |
| 615 | 633 | |
| 616 | - foreach ($context['editable_agreements'] as $file => $name) |
|
| 617 | - echo ' |
|
| 634 | + foreach ($context['editable_agreements'] as $file => $name) { |
|
| 635 | + echo ' |
|
| 618 | 636 | <option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>'; |
| 637 | + } |
|
| 619 | 638 | |
| 620 | 639 | echo ' |
| 621 | 640 | </select> |
@@ -655,9 +674,10 @@ discard block |
||
| 655 | 674 | { |
| 656 | 675 | global $context, $scripturl, $txt; |
| 657 | 676 | |
| 658 | - if (!empty($context['saved_successful'])) |
|
| 659 | - echo ' |
|
| 677 | + if (!empty($context['saved_successful'])) { |
|
| 678 | + echo ' |
|
| 660 | 679 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 680 | + } |
|
| 661 | 681 | |
| 662 | 682 | echo ' |
| 663 | 683 | <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '"> |
@@ -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 | { |
@@ -193,14 +194,15 @@ discard block |
||
| 193 | 194 | if ($context['get_pmessage']('message', true)) |
| 194 | 195 | { |
| 195 | 196 | // Show the helpful titlebar - generally. |
| 196 | - if ($context['display_mode'] != 1) |
|
| 197 | - echo ' |
|
| 197 | + if ($context['display_mode'] != 1) { |
|
| 198 | + echo ' |
|
| 198 | 199 | <div class="cat_bar"> |
| 199 | 200 | <h3 class="catbg"> |
| 200 | 201 | <span id="author">', $txt['author'], '</span> |
| 201 | 202 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
| 202 | 203 | </h3> |
| 203 | 204 | </div>'; |
| 205 | + } |
|
| 204 | 206 | |
| 205 | 207 | // Show a few buttons if we are in conversation mode and outputting the first message. |
| 206 | 208 | if ($context['display_mode'] == 2) |
@@ -229,9 +231,10 @@ discard block |
||
| 229 | 231 | <div class="custom_fields_above_member"> |
| 230 | 232 | <ul class="nolist">'; |
| 231 | 233 | |
| 232 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 233 | - echo ' |
|
| 234 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 235 | + echo ' |
|
| 234 | 236 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 237 | + } |
|
| 235 | 238 | |
| 236 | 239 | echo ' |
| 237 | 240 | </ul> |
@@ -243,9 +246,10 @@ discard block |
||
| 243 | 246 | <a id="msg', $message['id'], '"></a>'; |
| 244 | 247 | |
| 245 | 248 | // Show online and offline buttons? |
| 246 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 247 | - echo ' |
|
| 249 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 250 | + echo ' |
|
| 248 | 251 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
| 252 | + } |
|
| 249 | 253 | |
| 250 | 254 | // Show a link to the member's profile (but only if the sender isn't a guest). |
| 251 | 255 | echo ' |
@@ -258,48 +262,56 @@ discard block |
||
| 258 | 262 | <ul class="user_info">'; |
| 259 | 263 | |
| 260 | 264 | // Show the user's avatar. |
| 261 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 262 | - echo ' |
|
| 265 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 266 | + echo ' |
|
| 263 | 267 | <li class="avatar"> |
| 264 | 268 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
| 265 | 269 | </li>'; |
| 270 | + } |
|
| 266 | 271 | |
| 267 | 272 | // Are there any custom fields below the avatar? |
| 268 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 269 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 273 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 274 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 270 | 275 | echo ' |
| 271 | 276 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 277 | + } |
|
| 272 | 278 | |
| 273 | - if (!$message['member']['is_guest']) |
|
| 274 | - echo ' |
|
| 279 | + if (!$message['member']['is_guest']) { |
|
| 280 | + echo ' |
|
| 275 | 281 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 282 | + } |
|
| 276 | 283 | // Show the member's primary group (like 'Administrator') if they have one. |
| 277 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
| 278 | - echo ' |
|
| 284 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
| 285 | + echo ' |
|
| 279 | 286 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 287 | + } |
|
| 280 | 288 | |
| 281 | 289 | // Show the member's custom title, if they have one. |
| 282 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
| 283 | - echo ' |
|
| 290 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
| 291 | + echo ' |
|
| 284 | 292 | <li class="title">', $message['member']['title'], '</li>'; |
| 293 | + } |
|
| 285 | 294 | |
| 286 | 295 | // Don't show these things for guests. |
| 287 | 296 | if (!$message['member']['is_guest']) |
| 288 | 297 | { |
| 289 | 298 | // 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. |
| 290 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
| 291 | - echo ' |
|
| 299 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
| 300 | + echo ' |
|
| 292 | 301 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 302 | + } |
|
| 293 | 303 | |
| 294 | 304 | // Show how many posts they have made. |
| 295 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 296 | - echo ' |
|
| 305 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 306 | + echo ' |
|
| 297 | 307 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 308 | + } |
|
| 298 | 309 | |
| 299 | 310 | // Show their personal text? |
| 300 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
| 301 | - echo ' |
|
| 311 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
| 312 | + echo ' |
|
| 302 | 313 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 314 | + } |
|
| 303 | 315 | |
| 304 | 316 | // Any custom fields to show as icons? |
| 305 | 317 | if (!empty($message['custom_fields']['icons'])) |
@@ -308,9 +320,10 @@ discard block |
||
| 308 | 320 | <li class="im_icons"> |
| 309 | 321 | <ol>'; |
| 310 | 322 | |
| 311 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 312 | - echo ' |
|
| 323 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 324 | + echo ' |
|
| 313 | 325 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 326 | + } |
|
| 314 | 327 | |
| 315 | 328 | echo ' |
| 316 | 329 | </ol> |
@@ -318,19 +331,22 @@ discard block |
||
| 318 | 331 | } |
| 319 | 332 | |
| 320 | 333 | // Show the IP to this user for this post - because you can moderate? |
| 321 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 322 | - echo ' |
|
| 334 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 335 | + echo ' |
|
| 323 | 336 | <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>'; |
| 337 | + } |
|
| 324 | 338 | |
| 325 | 339 | // Or, should we show it because this is you? |
| 326 | - elseif ($message['can_see_ip']) |
|
| 327 | - echo ' |
|
| 340 | + elseif ($message['can_see_ip']) { |
|
| 341 | + echo ' |
|
| 328 | 342 | <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>'; |
| 343 | + } |
|
| 329 | 344 | |
| 330 | 345 | // Okay, you are logged in, then we can show something about why IPs are logged... |
| 331 | - else |
|
| 332 | - echo ' |
|
| 346 | + else { |
|
| 347 | + echo ' |
|
| 333 | 348 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
| 349 | + } |
|
| 334 | 350 | |
| 335 | 351 | // Show the profile, website, email address, and personal message buttons. |
| 336 | 352 | if ($message['member']['show_profile_buttons']) |
@@ -340,24 +356,28 @@ discard block |
||
| 340 | 356 | <ol class="profile_icons">'; |
| 341 | 357 | |
| 342 | 358 | // Show the profile button |
| 343 | - if ($message['member']['can_view_profile']) |
|
| 344 | - echo ' |
|
| 359 | + if ($message['member']['can_view_profile']) { |
|
| 360 | + echo ' |
|
| 345 | 361 | <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>'; |
| 362 | + } |
|
| 346 | 363 | |
| 347 | 364 | // Don't show an icon if they haven't specified a website. |
| 348 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
| 349 | - echo ' |
|
| 365 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
| 366 | + echo ' |
|
| 350 | 367 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 368 | + } |
|
| 351 | 369 | |
| 352 | 370 | // Don't show the email address if they want it hidden. |
| 353 | - if ($message['member']['show_email']) |
|
| 354 | - echo ' |
|
| 371 | + if ($message['member']['show_email']) { |
|
| 372 | + echo ' |
|
| 355 | 373 | <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>'; |
| 374 | + } |
|
| 356 | 375 | |
| 357 | 376 | // Since we know this person isn't a guest, you *can* message them. |
| 358 | - if ($context['can_send_pm']) |
|
| 359 | - echo ' |
|
| 377 | + if ($context['can_send_pm']) { |
|
| 378 | + echo ' |
|
| 360 | 379 | <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>'; |
| 380 | + } |
|
| 361 | 381 | |
| 362 | 382 | echo ' |
| 363 | 383 | </ol> |
@@ -365,21 +385,24 @@ discard block |
||
| 365 | 385 | } |
| 366 | 386 | |
| 367 | 387 | // Any custom fields for standard placement? |
| 368 | - if (!empty($message['custom_fields']['standard'])) |
|
| 369 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 388 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 389 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 370 | 390 | echo ' |
| 371 | 391 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 392 | + } |
|
| 372 | 393 | |
| 373 | 394 | // Are we showing the warning status? |
| 374 | - if ($message['member']['can_see_warning']) |
|
| 375 | - echo ' |
|
| 395 | + if ($message['member']['can_see_warning']) { |
|
| 396 | + echo ' |
|
| 376 | 397 | <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>'; |
| 398 | + } |
|
| 377 | 399 | |
| 378 | 400 | // Are there any custom fields to show at the bottom of the poster info? |
| 379 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 380 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 401 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 402 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 381 | 403 | echo ' |
| 382 | 404 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 405 | + } |
|
| 383 | 406 | } |
| 384 | 407 | |
| 385 | 408 | // Done with the information about the poster... on to the post itself. |
@@ -398,25 +421,29 @@ discard block |
||
| 398 | 421 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
| 399 | 422 | |
| 400 | 423 | // People it was sent directly to.... |
| 401 | - if (!empty($message['recipients']['to'])) |
|
| 402 | - echo implode(', ', $message['recipients']['to']); |
|
| 424 | + if (!empty($message['recipients']['to'])) { |
|
| 425 | + echo implode(', ', $message['recipients']['to']); |
|
| 426 | + } |
|
| 403 | 427 | // Otherwise, we're just going to say "some people"... |
| 404 | - elseif ($context['folder'] != 'sent') |
|
| 405 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 428 | + elseif ($context['folder'] != 'sent') { |
|
| 429 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 430 | + } |
|
| 406 | 431 | |
| 407 | 432 | echo ' |
| 408 | 433 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
| 409 | 434 | </span>'; |
| 410 | 435 | |
| 411 | 436 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
| 412 | - if (!empty($message['recipients']['bcc'])) |
|
| 413 | - echo ' |
|
| 437 | + if (!empty($message['recipients']['bcc'])) { |
|
| 438 | + echo ' |
|
| 414 | 439 | <br><span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
| 440 | + } |
|
| 415 | 441 | |
| 416 | - if (!empty($message['is_replied_to'])) |
|
| 417 | - echo ' |
|
| 442 | + if (!empty($message['is_replied_to'])) { |
|
| 443 | + echo ' |
|
| 418 | 444 | <br><span class="smalltext">« ', $txt['pm_is_replied_to'], ' »</span> |
| 419 | 445 | <br><span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
| 446 | + } |
|
| 420 | 447 | |
| 421 | 448 | echo ' |
| 422 | 449 | </div> |
@@ -424,13 +451,15 @@ discard block |
||
| 424 | 451 | <div class="post"> |
| 425 | 452 | <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>'; |
| 426 | 453 | |
| 427 | - if ($message['can_report'] || $context['can_send_pm']) |
|
| 428 | - echo ' |
|
| 454 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
| 455 | + echo ' |
|
| 429 | 456 | <div class="under_message">'; |
| 457 | + } |
|
| 430 | 458 | |
| 431 | - if ($message['can_report']) |
|
| 432 | - echo ' |
|
| 459 | + if ($message['can_report']) { |
|
| 460 | + echo ' |
|
| 433 | 461 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
| 462 | + } |
|
| 434 | 463 | |
| 435 | 464 | echo ' |
| 436 | 465 | <ul class="quickbuttons">'; |
@@ -442,32 +471,36 @@ discard block |
||
| 442 | 471 | if (!$message['member']['is_guest']) |
| 443 | 472 | { |
| 444 | 473 | // Is there than more than one recipient you can reply to? |
| 445 | - if ($message['number_recipients'] > 1) |
|
| 446 | - echo ' |
|
| 474 | + if ($message['number_recipients'] > 1) { |
|
| 475 | + echo ' |
|
| 447 | 476 | <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>'; |
| 477 | + } |
|
| 448 | 478 | |
| 449 | 479 | echo ' |
| 450 | 480 | <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> |
| 451 | 481 | <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>'; |
| 452 | 482 | } |
| 453 | 483 | // This is for "forwarding" - even if the member is gone. |
| 454 | - else |
|
| 455 | - echo ' |
|
| 484 | + else { |
|
| 485 | + echo ' |
|
| 456 | 486 | <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>'; |
| 487 | + } |
|
| 457 | 488 | } |
| 458 | 489 | echo ' |
| 459 | 490 | <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>'; |
| 460 | 491 | |
| 461 | - if (empty($context['display_mode'])) |
|
| 462 | - echo ' |
|
| 492 | + if (empty($context['display_mode'])) { |
|
| 493 | + echo ' |
|
| 463 | 494 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;" class="input_check"></li>'; |
| 495 | + } |
|
| 464 | 496 | |
| 465 | 497 | echo ' |
| 466 | 498 | </ul>'; |
| 467 | 499 | |
| 468 | - if ($message['can_report'] || $context['can_send_pm']) |
|
| 469 | - echo ' |
|
| 500 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
| 501 | + echo ' |
|
| 470 | 502 | </div>'; |
| 503 | + } |
|
| 471 | 504 | |
| 472 | 505 | // Are there any custom profile fields for above the signature? |
| 473 | 506 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -476,9 +509,10 @@ discard block |
||
| 476 | 509 | <div class="custom_fields_above_signature"> |
| 477 | 510 | <ul class="nolist">'; |
| 478 | 511 | |
| 479 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 480 | - echo ' |
|
| 512 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 513 | + echo ' |
|
| 481 | 514 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 515 | + } |
|
| 482 | 516 | |
| 483 | 517 | echo ' |
| 484 | 518 | </ul> |
@@ -486,9 +520,10 @@ discard block |
||
| 486 | 520 | } |
| 487 | 521 | |
| 488 | 522 | // Show the member's signature? |
| 489 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 490 | - echo ' |
|
| 523 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 524 | + echo ' |
|
| 491 | 525 | <div class="signature">', $message['member']['signature'], '</div>'; |
| 526 | + } |
|
| 492 | 527 | |
| 493 | 528 | // Are there any custom profile fields for below the signature? |
| 494 | 529 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -497,9 +532,10 @@ discard block |
||
| 497 | 532 | <div class="custom_fields_below_signature"> |
| 498 | 533 | <ul class="nolist">'; |
| 499 | 534 | |
| 500 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 501 | - echo ' |
|
| 535 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 536 | + echo ' |
|
| 502 | 537 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 538 | + } |
|
| 503 | 539 | |
| 504 | 540 | echo ' |
| 505 | 541 | </ul> |
@@ -524,19 +560,21 @@ discard block |
||
| 524 | 560 | { |
| 525 | 561 | echo ' |
| 526 | 562 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
| 527 | - foreach ($context['labels'] as $label) |
|
| 528 | - if (!isset($message['labels'][$label['id']])) |
|
| 563 | + foreach ($context['labels'] as $label) { |
|
| 564 | + if (!isset($message['labels'][$label['id']])) |
|
| 529 | 565 | echo ' |
| 530 | 566 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
| 567 | + } |
|
| 531 | 568 | } |
| 532 | 569 | // ... and are there any that can be removed? |
| 533 | 570 | if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1]))) |
| 534 | 571 | { |
| 535 | 572 | echo ' |
| 536 | 573 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
| 537 | - foreach ($message['labels'] as $label) |
|
| 538 | - echo ' |
|
| 574 | + foreach ($message['labels'] as $label) { |
|
| 575 | + echo ' |
|
| 539 | 576 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
| 577 | + } |
|
| 540 | 578 | } |
| 541 | 579 | echo ' |
| 542 | 580 | </select> |
@@ -556,13 +594,14 @@ discard block |
||
| 556 | 594 | </div>'; |
| 557 | 595 | } |
| 558 | 596 | |
| 559 | - if (empty($context['display_mode'])) |
|
| 560 | - echo ' |
|
| 597 | + if (empty($context['display_mode'])) { |
|
| 598 | + echo ' |
|
| 561 | 599 | |
| 562 | 600 | <div class="pagesection"> |
| 563 | 601 | <div class="floatleft">', $context['page_index'], '</div> |
| 564 | 602 | <div class="floatright"><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_submit"></div> |
| 565 | 603 | </div>'; |
| 604 | + } |
|
| 566 | 605 | |
| 567 | 606 | // Show a few buttons if we are in conversation mode and outputting the first message. |
| 568 | 607 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -622,11 +661,12 @@ discard block |
||
| 622 | 661 | </tr> |
| 623 | 662 | </thead> |
| 624 | 663 | <tbody>'; |
| 625 | - if (!$context['show_delete']) |
|
| 626 | - echo ' |
|
| 664 | + if (!$context['show_delete']) { |
|
| 665 | + echo ' |
|
| 627 | 666 | <tr class="windowbg"> |
| 628 | 667 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
| 629 | 668 | </tr>'; |
| 669 | + } |
|
| 630 | 670 | |
| 631 | 671 | while ($message = $context['get_pmessage']('subject')) |
| 632 | 672 | { |
@@ -679,9 +719,10 @@ discard block |
||
| 679 | 719 | |
| 680 | 720 | foreach ($context['labels'] as $label) |
| 681 | 721 | { |
| 682 | - if ($label['id'] != $context['current_label_id']) |
|
| 683 | - echo ' |
|
| 722 | + if ($label['id'] != $context['current_label_id']) { |
|
| 723 | + echo ' |
|
| 684 | 724 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
| 725 | + } |
|
| 685 | 726 | } |
| 686 | 727 | |
| 687 | 728 | echo ' |
@@ -766,9 +807,10 @@ discard block |
||
| 766 | 807 | <dt class="between">', $txt['pm_search_post_age'], ':</dt> |
| 767 | 808 | <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" class="input_text" 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" class="input_text" min="0" max="9999"> ', $txt['pm_search_between_days'], '</dd> |
| 768 | 809 | </dl>'; |
| 769 | - if (!$context['currently_using_labels']) |
|
| 770 | - echo ' |
|
| 810 | + if (!$context['currently_using_labels']) { |
|
| 811 | + echo ' |
|
| 771 | 812 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button_submit">'; |
| 813 | + } |
|
| 772 | 814 | echo ' |
| 773 | 815 | <br class="clear_right"> |
| 774 | 816 | </div> |
@@ -788,12 +830,13 @@ discard block |
||
| 788 | 830 | <div id="advanced_panel_div"> |
| 789 | 831 | <ul id="searchLabelsExpand">'; |
| 790 | 832 | |
| 791 | - foreach ($context['search_labels'] as $label) |
|
| 792 | - echo ' |
|
| 833 | + foreach ($context['search_labels'] as $label) { |
|
| 834 | + echo ' |
|
| 793 | 835 | <li> |
| 794 | 836 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', ' class="input_check"> |
| 795 | 837 | ', $label['name'], '</label> |
| 796 | 838 | </li>'; |
| 839 | + } |
|
| 797 | 840 | |
| 798 | 841 | echo ' |
| 799 | 842 | </ul> |
@@ -853,8 +896,8 @@ discard block |
||
| 853 | 896 | </div>'; |
| 854 | 897 | |
| 855 | 898 | // complete results ? |
| 856 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
| 857 | - echo ' |
|
| 899 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
| 900 | + echo ' |
|
| 858 | 901 | <table class="table_grid"> |
| 859 | 902 | <thead> |
| 860 | 903 | <tr class="title_bar"> |
@@ -864,6 +907,7 @@ discard block |
||
| 864 | 907 | </tr> |
| 865 | 908 | </thead> |
| 866 | 909 | <tbody>'; |
| 910 | + } |
|
| 867 | 911 | |
| 868 | 912 | // Print each message out... |
| 869 | 913 | foreach ($context['personal_messages'] as $message) |
@@ -883,11 +927,13 @@ discard block |
||
| 883 | 927 | |
| 884 | 928 | // Show the recipients. |
| 885 | 929 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
| 886 | - if (!empty($message['recipients']['to'])) |
|
| 887 | - echo implode(', ', $message['recipients']['to']); |
|
| 930 | + if (!empty($message['recipients']['to'])) { |
|
| 931 | + echo implode(', ', $message['recipients']['to']); |
|
| 932 | + } |
|
| 888 | 933 | // Otherwise, we're just going to say "some people"... |
| 889 | - elseif ($context['folder'] != 'sent') |
|
| 890 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 934 | + elseif ($context['folder'] != 'sent') { |
|
| 935 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
| 936 | + } |
|
| 891 | 937 | |
| 892 | 938 | echo ' |
| 893 | 939 | </h3> |
@@ -901,14 +947,16 @@ discard block |
||
| 901 | 947 | $quote_button = create_button('quote.png', 'reply_quote', 'reply_quote', 'class="centericon"'); |
| 902 | 948 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
| 903 | 949 | // You can only reply if they are not a guest... |
| 904 | - if (!$message['member']['is_guest']) |
|
| 905 | - echo ' |
|
| 950 | + if (!$message['member']['is_guest']) { |
|
| 951 | + echo ' |
|
| 906 | 952 | <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'], ' |
| 907 | 953 | <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']; |
| 954 | + } |
|
| 908 | 955 | // This is for "forwarding" - even if the member is gone. |
| 909 | - else |
|
| 910 | - echo ' |
|
| 956 | + else { |
|
| 957 | + echo ' |
|
| 911 | 958 | <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']; |
| 959 | + } |
|
| 912 | 960 | } |
| 913 | 961 | |
| 914 | 962 | echo ' |
@@ -929,17 +977,19 @@ discard block |
||
| 929 | 977 | } |
| 930 | 978 | |
| 931 | 979 | // Finish off the page... |
| 932 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
| 933 | - echo ' |
|
| 980 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
| 981 | + echo ' |
|
| 934 | 982 | </tbody> |
| 935 | 983 | </table>'; |
| 984 | + } |
|
| 936 | 985 | |
| 937 | 986 | // No results? |
| 938 | - if (empty($context['personal_messages'])) |
|
| 939 | - echo ' |
|
| 987 | + if (empty($context['personal_messages'])) { |
|
| 988 | + echo ' |
|
| 940 | 989 | <div class="windowbg"> |
| 941 | 990 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
| 942 | 991 | </div>'; |
| 992 | + } |
|
| 943 | 993 | |
| 944 | 994 | echo ' |
| 945 | 995 | <div class="pagesection"> |
@@ -963,12 +1013,14 @@ discard block |
||
| 963 | 1013 | <h3 class="catbg">', $txt['pm_send_report'], '</h3> |
| 964 | 1014 | </div> |
| 965 | 1015 | <div class="windowbg">'; |
| 966 | - if (!empty($context['send_log']['sent'])) |
|
| 967 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
| 1016 | + if (!empty($context['send_log']['sent'])) { |
|
| 1017 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
| 968 | 1018 | echo '<span class="error">', $log_entry, '</span><br>'; |
| 969 | - if (!empty($context['send_log']['failed'])) |
|
| 970 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
| 1019 | + } |
|
| 1020 | + if (!empty($context['send_log']['failed'])) { |
|
| 1021 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
| 971 | 1022 | echo '<span class="error">', $log_entry, '</span><br>'; |
| 1023 | + } |
|
| 972 | 1024 | echo ' |
| 973 | 1025 | </div> |
| 974 | 1026 | <br>'; |
@@ -1016,12 +1068,13 @@ discard block |
||
| 1016 | 1068 | </dl> |
| 1017 | 1069 | </div>'; |
| 1018 | 1070 | |
| 1019 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
| 1020 | - echo ' |
|
| 1071 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
| 1072 | + echo ' |
|
| 1021 | 1073 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
| 1022 | 1074 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
| 1023 | 1075 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
| 1024 | 1076 | </div>'; |
| 1077 | + } |
|
| 1025 | 1078 | |
| 1026 | 1079 | echo ' |
| 1027 | 1080 | <dl id="post_header">'; |
@@ -1076,9 +1129,10 @@ discard block |
||
| 1076 | 1129 | } |
| 1077 | 1130 | |
| 1078 | 1131 | // What about smileys? |
| 1079 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
| 1080 | - echo ' |
|
| 1132 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
| 1133 | + echo ' |
|
| 1081 | 1134 | <div id="smileyBox_message"></div>'; |
| 1135 | + } |
|
| 1082 | 1136 | |
| 1083 | 1137 | // Show BBC buttons, smileys and textbox. |
| 1084 | 1138 | echo ' |
@@ -1125,10 +1179,11 @@ discard block |
||
| 1125 | 1179 | <dt><strong>', $txt['subject'], '</strong></dt> |
| 1126 | 1180 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
| 1127 | 1181 | |
| 1128 | - foreach ($context['drafts'] as $draft) |
|
| 1129 | - echo ' |
|
| 1182 | + foreach ($context['drafts'] as $draft) { |
|
| 1183 | + echo ' |
|
| 1130 | 1184 | <dt>', $draft['link'], '</dt> |
| 1131 | 1185 | <dd>', $draft['poster_time'], '</dd>'; |
| 1186 | + } |
|
| 1132 | 1187 | echo ' |
| 1133 | 1188 | </dl> |
| 1134 | 1189 | </div>'; |
@@ -1234,8 +1289,8 @@ discard block |
||
| 1234 | 1289 | }'; |
| 1235 | 1290 | |
| 1236 | 1291 | // Code for showing and hiding drafts |
| 1237 | - if (!empty($context['drafts'])) |
|
| 1238 | - echo ' |
|
| 1292 | + if (!empty($context['drafts'])) { |
|
| 1293 | + echo ' |
|
| 1239 | 1294 | var oSwapDraftOptions = new smc_Toggle({ |
| 1240 | 1295 | bToggleEnabled: true, |
| 1241 | 1296 | bCurrentlyCollapsed: true, |
@@ -1257,13 +1312,14 @@ discard block |
||
| 1257 | 1312 | } |
| 1258 | 1313 | ] |
| 1259 | 1314 | });'; |
| 1315 | + } |
|
| 1260 | 1316 | |
| 1261 | 1317 | echo ' |
| 1262 | 1318 | </script>'; |
| 1263 | 1319 | |
| 1264 | 1320 | // Show the message you're replying to. |
| 1265 | - if ($context['reply']) |
|
| 1266 | - echo ' |
|
| 1321 | + if ($context['reply']) { |
|
| 1322 | + echo ' |
|
| 1267 | 1323 | <br> |
| 1268 | 1324 | <br> |
| 1269 | 1325 | <div class="cat_bar"> |
@@ -1277,6 +1333,7 @@ discard block |
||
| 1277 | 1333 | <hr> |
| 1278 | 1334 | ', $context['quoted_message']['body'], ' |
| 1279 | 1335 | </div><br class="clear">'; |
| 1336 | + } |
|
| 1280 | 1337 | |
| 1281 | 1338 | echo ' |
| 1282 | 1339 | <script> |
@@ -1287,22 +1344,24 @@ discard block |
||
| 1287 | 1344 | sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', |
| 1288 | 1345 | sToControlId: \'to_control\', |
| 1289 | 1346 | aToRecipients: ['; |
| 1290 | - foreach ($context['recipients']['to'] as $i => $member) |
|
| 1291 | - echo ' |
|
| 1347 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
| 1348 | + echo ' |
|
| 1292 | 1349 | { |
| 1293 | 1350 | sItemId: ', JavaScriptEscape($member['id']), ', |
| 1294 | 1351 | sItemName: ', JavaScriptEscape($member['name']), ' |
| 1295 | 1352 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
| 1353 | + } |
|
| 1296 | 1354 | |
| 1297 | 1355 | echo ' |
| 1298 | 1356 | ], |
| 1299 | 1357 | aBccRecipients: ['; |
| 1300 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
| 1301 | - echo ' |
|
| 1358 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
| 1359 | + echo ' |
|
| 1302 | 1360 | { |
| 1303 | 1361 | sItemId: ', JavaScriptEscape($member['id']), ', |
| 1304 | 1362 | sItemName: ', JavaScriptEscape($member['name']), ' |
| 1305 | 1363 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
| 1364 | + } |
|
| 1306 | 1365 | |
| 1307 | 1366 | echo ' |
| 1308 | 1367 | ], |
@@ -1389,26 +1448,28 @@ discard block |
||
| 1389 | 1448 | </th> |
| 1390 | 1449 | <th class="centertext table_icon">'; |
| 1391 | 1450 | |
| 1392 | - if (count($context['labels']) > 2) |
|
| 1393 | - echo ' |
|
| 1451 | + if (count($context['labels']) > 2) { |
|
| 1452 | + echo ' |
|
| 1394 | 1453 | <input type="checkbox" class="input_check" onclick="invertAll(this, this.form);">'; |
| 1454 | + } |
|
| 1395 | 1455 | |
| 1396 | 1456 | echo ' |
| 1397 | 1457 | </th> |
| 1398 | 1458 | </tr> |
| 1399 | 1459 | </thead> |
| 1400 | 1460 | <tbody>'; |
| 1401 | - if (count($context['labels']) < 2) |
|
| 1402 | - echo ' |
|
| 1461 | + if (count($context['labels']) < 2) { |
|
| 1462 | + echo ' |
|
| 1403 | 1463 | <tr class="windowbg"> |
| 1404 | 1464 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
| 1405 | 1465 | </tr>'; |
| 1406 | - else |
|
| 1466 | + } else |
|
| 1407 | 1467 | { |
| 1408 | 1468 | foreach ($context['labels'] as $label) |
| 1409 | 1469 | { |
| 1410 | - if ($label['id'] == -1) |
|
| 1411 | - continue; |
|
| 1470 | + if ($label['id'] == -1) { |
|
| 1471 | + continue; |
|
| 1472 | + } |
|
| 1412 | 1473 | |
| 1413 | 1474 | echo ' |
| 1414 | 1475 | <tr class="windowbg"> |
@@ -1423,12 +1484,13 @@ discard block |
||
| 1423 | 1484 | </tbody> |
| 1424 | 1485 | </table>'; |
| 1425 | 1486 | |
| 1426 | - if (!count($context['labels']) < 2) |
|
| 1427 | - echo ' |
|
| 1487 | + if (!count($context['labels']) < 2) { |
|
| 1488 | + echo ' |
|
| 1428 | 1489 | <div class="padding"> |
| 1429 | 1490 | <input type="submit" name="save" value="', $txt['save'], '" class="button_submit"> |
| 1430 | 1491 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button_submit you_sure"> |
| 1431 | 1492 | </div>'; |
| 1493 | + } |
|
| 1432 | 1494 | |
| 1433 | 1495 | echo ' |
| 1434 | 1496 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1483,9 +1545,10 @@ discard block |
||
| 1483 | 1545 | <dd> |
| 1484 | 1546 | <select name="id_admin"> |
| 1485 | 1547 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
| 1486 | - foreach ($context['admins'] as $id => $name) |
|
| 1487 | - echo ' |
|
| 1548 | + foreach ($context['admins'] as $id => $name) { |
|
| 1549 | + echo ' |
|
| 1488 | 1550 | <option value="', $id, '">', $name, '</option>'; |
| 1551 | + } |
|
| 1489 | 1552 | echo ' |
| 1490 | 1553 | </select> |
| 1491 | 1554 | </dd>'; |
@@ -1547,9 +1610,10 @@ discard block |
||
| 1547 | 1610 | </th> |
| 1548 | 1611 | <th class="centertext table_icon">'; |
| 1549 | 1612 | |
| 1550 | - if (!empty($context['rules'])) |
|
| 1551 | - echo ' |
|
| 1613 | + if (!empty($context['rules'])) { |
|
| 1614 | + echo ' |
|
| 1552 | 1615 | <input type="checkbox" onclick="invertAll(this, this.form);" class="input_check">'; |
| 1616 | + } |
|
| 1553 | 1617 | |
| 1554 | 1618 | echo ' |
| 1555 | 1619 | </th> |
@@ -1557,13 +1621,14 @@ discard block |
||
| 1557 | 1621 | </thead> |
| 1558 | 1622 | <tbody>'; |
| 1559 | 1623 | |
| 1560 | - if (empty($context['rules'])) |
|
| 1561 | - echo ' |
|
| 1624 | + if (empty($context['rules'])) { |
|
| 1625 | + echo ' |
|
| 1562 | 1626 | <tr class="windowbg"> |
| 1563 | 1627 | <td colspan="2"> |
| 1564 | 1628 | ', $txt['pm_rules_none'], ' |
| 1565 | 1629 | </td> |
| 1566 | 1630 | </tr>'; |
| 1631 | + } |
|
| 1567 | 1632 | |
| 1568 | 1633 | foreach ($context['rules'] as $rule) |
| 1569 | 1634 | { |
@@ -1584,14 +1649,16 @@ discard block |
||
| 1584 | 1649 | <div class="righttext"> |
| 1585 | 1650 | <a class="button_link" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
| 1586 | 1651 | |
| 1587 | - if (!empty($context['rules'])) |
|
| 1588 | - echo ' |
|
| 1652 | + if (!empty($context['rules'])) { |
|
| 1653 | + echo ' |
|
| 1589 | 1654 | [<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>]'; |
| 1655 | + } |
|
| 1590 | 1656 | |
| 1591 | - if (!empty($context['rules'])) |
|
| 1592 | - echo ' |
|
| 1657 | + if (!empty($context['rules'])) { |
|
| 1658 | + echo ' |
|
| 1593 | 1659 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1594 | 1660 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button_submit smalltext you_sure">'; |
| 1661 | + } |
|
| 1595 | 1662 | |
| 1596 | 1663 | echo ' |
| 1597 | 1664 | </div> |
@@ -1613,14 +1680,16 @@ discard block |
||
| 1613 | 1680 | var groups = new Array() |
| 1614 | 1681 | var labels = new Array()'; |
| 1615 | 1682 | |
| 1616 | - foreach ($context['groups'] as $id => $title) |
|
| 1617 | - echo ' |
|
| 1683 | + foreach ($context['groups'] as $id => $title) { |
|
| 1684 | + echo ' |
|
| 1618 | 1685 | groups[', $id, '] = "', addslashes($title), '";'; |
| 1686 | + } |
|
| 1619 | 1687 | |
| 1620 | - foreach ($context['labels'] as $label) |
|
| 1621 | - if ($label['id'] != -1) |
|
| 1688 | + foreach ($context['labels'] as $label) { |
|
| 1689 | + if ($label['id'] != -1) |
|
| 1622 | 1690 | echo ' |
| 1623 | 1691 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
| 1692 | + } |
|
| 1624 | 1693 | |
| 1625 | 1694 | echo ' |
| 1626 | 1695 | function addCriteriaOption() |
@@ -1635,8 +1704,9 @@ discard block |
||
| 1635 | 1704 | |
| 1636 | 1705 | 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="" class="input_text"><\' + \'/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>'; |
| 1637 | 1706 | |
| 1638 | - foreach ($context['groups'] as $id => $group) |
|
| 1639 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
| 1707 | + foreach ($context['groups'] as $id => $group) { |
|
| 1708 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
| 1709 | + } |
|
| 1640 | 1710 | |
| 1641 | 1711 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
| 1642 | 1712 | } |
@@ -1653,9 +1723,10 @@ discard block |
||
| 1653 | 1723 | |
| 1654 | 1724 | 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>'; |
| 1655 | 1725 | |
| 1656 | - foreach ($context['labels'] as $label) |
|
| 1657 | - if ($label['id'] != -1) |
|
| 1726 | + foreach ($context['labels'] as $label) { |
|
| 1727 | + if ($label['id'] != -1) |
|
| 1658 | 1728 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
| 1729 | + } |
|
| 1659 | 1730 | |
| 1660 | 1731 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
| 1661 | 1732 | } |
@@ -1769,18 +1840,20 @@ discard block |
||
| 1769 | 1840 | $isFirst = true; |
| 1770 | 1841 | foreach ($context['rule']['criteria'] as $k => $criteria) |
| 1771 | 1842 | { |
| 1772 | - if (!$isFirst && $criteria['t'] == '') |
|
| 1773 | - echo '<div id="removeonjs1">'; |
|
| 1774 | - elseif (!$isFirst) |
|
| 1775 | - echo '<br>'; |
|
| 1843 | + if (!$isFirst && $criteria['t'] == '') { |
|
| 1844 | + echo '<div id="removeonjs1">'; |
|
| 1845 | + } elseif (!$isFirst) { |
|
| 1846 | + echo '<br>'; |
|
| 1847 | + } |
|
| 1776 | 1848 | |
| 1777 | 1849 | echo ' |
| 1778 | 1850 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
| 1779 | 1851 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
| 1780 | 1852 | |
| 1781 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
| 1782 | - echo ' |
|
| 1853 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
| 1854 | + echo ' |
|
| 1783 | 1855 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
| 1856 | + } |
|
| 1784 | 1857 | |
| 1785 | 1858 | echo ' |
| 1786 | 1859 | </select> |
@@ -1791,18 +1864,20 @@ discard block |
||
| 1791 | 1864 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
| 1792 | 1865 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
| 1793 | 1866 | |
| 1794 | - foreach ($context['groups'] as $id => $group) |
|
| 1795 | - echo ' |
|
| 1867 | + foreach ($context['groups'] as $id => $group) { |
|
| 1868 | + echo ' |
|
| 1796 | 1869 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
| 1870 | + } |
|
| 1797 | 1871 | echo ' |
| 1798 | 1872 | </select> |
| 1799 | 1873 | </span>'; |
| 1800 | 1874 | |
| 1801 | 1875 | // If this is the dummy we add a means to hide for non js users. |
| 1802 | - if ($isFirst) |
|
| 1803 | - $isFirst = false; |
|
| 1804 | - elseif ($criteria['t'] == '') |
|
| 1805 | - echo '</div>'; |
|
| 1876 | + if ($isFirst) { |
|
| 1877 | + $isFirst = false; |
|
| 1878 | + } elseif ($criteria['t'] == '') { |
|
| 1879 | + echo '</div>'; |
|
| 1880 | + } |
|
| 1806 | 1881 | } |
| 1807 | 1882 | |
| 1808 | 1883 | echo ' |
@@ -1825,10 +1900,11 @@ discard block |
||
| 1825 | 1900 | $isFirst = true; |
| 1826 | 1901 | foreach ($context['rule']['actions'] as $k => $action) |
| 1827 | 1902 | { |
| 1828 | - if (!$isFirst && $action['t'] == '') |
|
| 1829 | - echo '<div id="removeonjs2">'; |
|
| 1830 | - elseif (!$isFirst) |
|
| 1831 | - echo '<br>'; |
|
| 1903 | + if (!$isFirst && $action['t'] == '') { |
|
| 1904 | + echo '<div id="removeonjs2">'; |
|
| 1905 | + } elseif (!$isFirst) { |
|
| 1906 | + echo '<br>'; |
|
| 1907 | + } |
|
| 1832 | 1908 | |
| 1833 | 1909 | echo ' |
| 1834 | 1910 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1839,20 +1915,22 @@ discard block |
||
| 1839 | 1915 | <span id="labdiv', $k, '"> |
| 1840 | 1916 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
| 1841 | 1917 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
| 1842 | - foreach ($context['labels'] as $label) |
|
| 1843 | - if ($label['id'] != -1) |
|
| 1918 | + foreach ($context['labels'] as $label) { |
|
| 1919 | + if ($label['id'] != -1) |
|
| 1844 | 1920 | echo ' |
| 1845 | 1921 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
| 1922 | + } |
|
| 1846 | 1923 | |
| 1847 | 1924 | echo ' |
| 1848 | 1925 | </select> |
| 1849 | 1926 | </span>'; |
| 1850 | 1927 | |
| 1851 | - if ($isFirst) |
|
| 1852 | - $isFirst = false; |
|
| 1853 | - elseif ($action['t'] == '') |
|
| 1854 | - echo ' |
|
| 1928 | + if ($isFirst) { |
|
| 1929 | + $isFirst = false; |
|
| 1930 | + } elseif ($action['t'] == '') { |
|
| 1931 | + echo ' |
|
| 1855 | 1932 | </div>'; |
| 1933 | + } |
|
| 1856 | 1934 | } |
| 1857 | 1935 | |
| 1858 | 1936 | echo ' |
@@ -1876,22 +1954,25 @@ discard block |
||
| 1876 | 1954 | echo ' |
| 1877 | 1955 | <script>'; |
| 1878 | 1956 | |
| 1879 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
| 1880 | - echo ' |
|
| 1957 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
| 1958 | + echo ' |
|
| 1881 | 1959 | updateRuleDef(', $k, ');'; |
| 1960 | + } |
|
| 1882 | 1961 | |
| 1883 | - foreach ($context['rule']['actions'] as $k => $c) |
|
| 1884 | - echo ' |
|
| 1962 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
| 1963 | + echo ' |
|
| 1885 | 1964 | updateActionDef(', $k, ');'; |
| 1965 | + } |
|
| 1886 | 1966 | |
| 1887 | 1967 | echo ' |
| 1888 | 1968 | rebuildRuleDesc();'; |
| 1889 | 1969 | |
| 1890 | 1970 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
| 1891 | - if ($context['rid']) |
|
| 1892 | - echo ' |
|
| 1971 | + if ($context['rid']) { |
|
| 1972 | + echo ' |
|
| 1893 | 1973 | document.getElementById("removeonjs1").style.display = "none"; |
| 1894 | 1974 | document.getElementById("removeonjs2").style.display = "none";'; |
| 1975 | + } |
|
| 1895 | 1976 | |
| 1896 | 1977 | echo ' |
| 1897 | 1978 | document.getElementById("addonjs1").style.display = ""; |
@@ -1919,12 +2000,12 @@ discard block |
||
| 1919 | 2000 | </div>'; |
| 1920 | 2001 | |
| 1921 | 2002 | // No drafts? Just show an informative message. |
| 1922 | - if (empty($context['drafts'])) |
|
| 1923 | - echo ' |
|
| 2003 | + if (empty($context['drafts'])) { |
|
| 2004 | + echo ' |
|
| 1924 | 2005 | <div class="windowbg2 centertext"> |
| 1925 | 2006 | ', $txt['draft_none'], ' |
| 1926 | 2007 | </div>'; |
| 1927 | - else |
|
| 2008 | + } else |
|
| 1928 | 2009 | { |
| 1929 | 2010 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
| 1930 | 2011 | foreach ($context['drafts'] as $draft) |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | <div class="windowbg2 noup"> |
| 112 | 112 | <dl class="settings">'; |
| 113 | 113 | |
| 114 | - if (!empty($context['table_info'])) |
|
| 115 | - echo ' |
|
| 114 | + if (!empty($context['table_info'])) { |
|
| 115 | + echo ' |
|
| 116 | 116 | <dt> |
| 117 | 117 | <strong>', $txt['search_method_messages_table_space'], ':</strong> |
| 118 | 118 | </dt> |
@@ -125,6 +125,7 @@ discard block |
||
| 125 | 125 | <dd> |
| 126 | 126 | ', $context['table_info']['index_length'], ' |
| 127 | 127 | </dd>'; |
| 128 | + } |
|
| 128 | 129 | echo ' |
| 129 | 130 | </dl> |
| 130 | 131 | ', $context['double_index'] ? '<div class="noticebox"> |
@@ -146,16 +147,17 @@ discard block |
||
| 146 | 147 | <dd> |
| 147 | 148 | |
| 148 | 149 | <span class="smalltext">'; |
| 149 | - if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) |
|
| 150 | - echo ' |
|
| 150 | + if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) { |
|
| 151 | + echo ' |
|
| 151 | 152 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]'; |
| 152 | - elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) |
|
| 153 | - echo ' |
|
| 153 | + } elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) { |
|
| 154 | + echo ' |
|
| 154 | 155 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create']; |
| 155 | - else |
|
| 156 | - echo ' |
|
| 156 | + } else { |
|
| 157 | + echo ' |
|
| 157 | 158 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br> |
| 158 | 159 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length']; |
| 160 | + } |
|
| 159 | 161 | echo ' |
| 160 | 162 | </span> |
| 161 | 163 | </dd>'; |
@@ -168,25 +170,27 @@ discard block |
||
| 168 | 170 | </dt> |
| 169 | 171 | <dd> |
| 170 | 172 | <span class="smalltext">'; |
| 171 | - if ($context['custom_index']) |
|
| 172 | - echo ' |
|
| 173 | + if ($context['custom_index']) { |
|
| 174 | + echo ' |
|
| 173 | 175 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br> |
| 174 | 176 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
| 175 | - elseif ($context['partial_custom_index']) |
|
| 176 | - echo ' |
|
| 177 | + } elseif ($context['partial_custom_index']) { |
|
| 178 | + echo ' |
|
| 177 | 179 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br> |
| 178 | 180 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
| 179 | - else |
|
| 180 | - echo ' |
|
| 181 | + } else { |
|
| 182 | + echo ' |
|
| 181 | 183 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]'; |
| 184 | + } |
|
| 182 | 185 | echo ' |
| 183 | 186 | </span> |
| 184 | 187 | </dd>'; |
| 185 | 188 | |
| 186 | 189 | foreach ($context['search_apis'] as $api) |
| 187 | 190 | { |
| 188 | - if (empty($api['label']) || $api['has_template']) |
|
| 189 | - continue; |
|
| 191 | + if (empty($api['label']) || $api['has_template']) { |
|
| 192 | + continue; |
|
| 193 | + } |
|
| 190 | 194 | |
| 191 | 195 | echo ' |
| 192 | 196 | <dt> |
@@ -194,12 +198,13 @@ discard block |
||
| 194 | 198 | ', $api['label'], ' |
| 195 | 199 | </dt>'; |
| 196 | 200 | |
| 197 | - if ($api['desc']) |
|
| 198 | - echo ' |
|
| 201 | + if ($api['desc']) { |
|
| 202 | + echo ' |
|
| 199 | 203 | <dd> |
| 200 | 204 | <span class="smalltext">', $api['desc'], '</span> |
| 201 | 205 | </dd>'; |
| 202 | 206 | } |
| 207 | + } |
|
| 203 | 208 | |
| 204 | 209 | echo ' |
| 205 | 210 | </dl> |
@@ -43,28 +43,33 @@ discard block |
||
| 43 | 43 | </div> |
| 44 | 44 | <div class="list_posts">', $post['message'], '</div>'; |
| 45 | 45 | |
| 46 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 47 | - echo ' |
|
| 46 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 47 | + echo ' |
|
| 48 | 48 | <ul class="quickbuttons">'; |
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | // If they *can* reply? |
| 51 | - if ($post['can_reply']) |
|
| 52 | - echo ' |
|
| 52 | + if ($post['can_reply']) { |
|
| 53 | + echo ' |
|
| 53 | 54 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | // If they *can* quote? |
| 56 | - if ($post['can_quote']) |
|
| 57 | - echo ' |
|
| 58 | + if ($post['can_quote']) { |
|
| 59 | + echo ' |
|
| 58 | 60 | <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>'; |
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | // How about... even... remove it entirely?! |
| 61 | - if ($post['can_delete']) |
|
| 62 | - echo ' |
|
| 64 | + if ($post['can_delete']) { |
|
| 65 | + echo ' |
|
| 63 | 66 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';recent;', $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>'; |
| 67 | + } |
|
| 64 | 68 | |
| 65 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 66 | - echo ' |
|
| 69 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 70 | + echo ' |
|
| 67 | 71 | </ul>'; |
| 72 | + } |
|
| 68 | 73 | |
| 69 | 74 | echo ' |
| 70 | 75 | </div>'; |
@@ -86,12 +91,13 @@ discard block |
||
| 86 | 91 | echo ' |
| 87 | 92 | <div id="recent" class="main_content">'; |
| 88 | 93 | |
| 89 | - if ($context['showCheckboxes']) |
|
| 90 | - echo ' |
|
| 94 | + if ($context['showCheckboxes']) { |
|
| 95 | + echo ' |
|
| 91 | 96 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;"> |
| 92 | 97 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 93 | 98 | <input type="hidden" name="qaction" value="markread"> |
| 94 | 99 | <input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
| 100 | + } |
|
| 95 | 101 | |
| 96 | 102 | if (!empty($context['topics'])) |
| 97 | 103 | { |
@@ -117,11 +123,12 @@ discard block |
||
| 117 | 123 | </div>'; |
| 118 | 124 | |
| 119 | 125 | // Show a "select all" box for quick moderation? |
| 120 | - if ($context['showCheckboxes']) |
|
| 121 | - echo ' |
|
| 126 | + if ($context['showCheckboxes']) { |
|
| 127 | + echo ' |
|
| 122 | 128 | <div class="moderation"> |
| 123 | 129 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check"> |
| 124 | 130 | </div>'; |
| 131 | + } |
|
| 125 | 132 | |
| 126 | 133 | echo ' |
| 127 | 134 | </div> |
@@ -140,15 +147,18 @@ discard block |
||
| 140 | 147 | // Now we handle the icons |
| 141 | 148 | echo ' |
| 142 | 149 | <div class="icons floatright">'; |
| 143 | - if ($topic['is_locked']) |
|
| 144 | - echo ' |
|
| 150 | + if ($topic['is_locked']) { |
|
| 151 | + echo ' |
|
| 145 | 152 | <span class="generic_icons lock"></span>'; |
| 146 | - if ($topic['is_sticky']) |
|
| 147 | - echo ' |
|
| 153 | + } |
|
| 154 | + if ($topic['is_sticky']) { |
|
| 155 | + echo ' |
|
| 148 | 156 | <span class="generic_icons sticky"></span>'; |
| 149 | - if ($topic['is_poll']) |
|
| 150 | - echo ' |
|
| 157 | + } |
|
| 158 | + if ($topic['is_poll']) { |
|
| 159 | + echo ' |
|
| 151 | 160 | <span class="generic_icons poll"></span>'; |
| 161 | + } |
|
| 152 | 162 | echo ' |
| 153 | 163 | </div>'; |
| 154 | 164 | |
@@ -173,19 +183,21 @@ discard block |
||
| 173 | 183 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
| 174 | 184 | </div>'; |
| 175 | 185 | |
| 176 | - if ($context['showCheckboxes']) |
|
| 177 | - echo ' |
|
| 186 | + if ($context['showCheckboxes']) { |
|
| 187 | + echo ' |
|
| 178 | 188 | <div class="moderation"> |
| 179 | 189 | <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check"> |
| 180 | 190 | </div>'; |
| 191 | + } |
|
| 181 | 192 | |
| 182 | 193 | echo ' |
| 183 | 194 | </div>'; |
| 184 | 195 | } |
| 185 | 196 | |
| 186 | - if (empty($context['topics'])) |
|
| 187 | - echo ' |
|
| 197 | + if (empty($context['topics'])) { |
|
| 198 | + echo ' |
|
| 188 | 199 | <div style="display: none;"></div>'; |
| 200 | + } |
|
| 189 | 201 | |
| 190 | 202 | echo ' |
| 191 | 203 | </div> |
@@ -197,25 +209,27 @@ discard block |
||
| 197 | 209 | ', $context['menu_separator'], '<a href="#recent" class="topbottom floatleft">', $txt['go_up'], '</a> |
| 198 | 210 | <div class="pagelinks">', $context['page_index'], '</div> |
| 199 | 211 | </div>'; |
| 200 | - } |
|
| 201 | - else |
|
| 202 | - echo ' |
|
| 212 | + } else { |
|
| 213 | + echo ' |
|
| 203 | 214 | <div class="cat_bar"> |
| 204 | 215 | <h3 class="catbg centertext"> |
| 205 | 216 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
| 206 | 217 | </h3> |
| 207 | 218 | </div>'; |
| 219 | + } |
|
| 208 | 220 | |
| 209 | - if ($context['showCheckboxes']) |
|
| 210 | - echo ' |
|
| 221 | + if ($context['showCheckboxes']) { |
|
| 222 | + echo ' |
|
| 211 | 223 | </form>'; |
| 224 | + } |
|
| 212 | 225 | |
| 213 | 226 | echo ' |
| 214 | 227 | </div>'; |
| 215 | 228 | |
| 216 | - if (empty($context['no_topic_listing'])) |
|
| 217 | - template_topic_legend(); |
|
| 218 | -} |
|
| 229 | + if (empty($context['no_topic_listing'])) { |
|
| 230 | + template_topic_legend(); |
|
| 231 | + } |
|
| 232 | + } |
|
| 219 | 233 | |
| 220 | 234 | /** |
| 221 | 235 | * Template for showing unread replies (eg new replies to topics you've posted in) |
@@ -227,12 +241,13 @@ discard block |
||
| 227 | 241 | echo ' |
| 228 | 242 | <div id="recent">'; |
| 229 | 243 | |
| 230 | - if ($context['showCheckboxes']) |
|
| 231 | - echo ' |
|
| 244 | + if ($context['showCheckboxes']) { |
|
| 245 | + echo ' |
|
| 232 | 246 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;"> |
| 233 | 247 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 234 | 248 | <input type="hidden" name="qaction" value="markread"> |
| 235 | 249 | <input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
| 250 | + } |
|
| 236 | 251 | |
| 237 | 252 | if (!empty($context['topics'])) |
| 238 | 253 | { |
@@ -258,11 +273,12 @@ discard block |
||
| 258 | 273 | </div>'; |
| 259 | 274 | |
| 260 | 275 | // Show a "select all" box for quick moderation? |
| 261 | - if ($context['showCheckboxes']) |
|
| 262 | - echo ' |
|
| 276 | + if ($context['showCheckboxes']) { |
|
| 277 | + echo ' |
|
| 263 | 278 | <div class="moderation"> |
| 264 | 279 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check"> |
| 265 | 280 | </div>'; |
| 281 | + } |
|
| 266 | 282 | |
| 267 | 283 | echo ' |
| 268 | 284 | </div> |
@@ -281,15 +297,18 @@ discard block |
||
| 281 | 297 | // Now we handle the icons |
| 282 | 298 | echo ' |
| 283 | 299 | <div class="icons floatright">'; |
| 284 | - if ($topic['is_locked']) |
|
| 285 | - echo ' |
|
| 300 | + if ($topic['is_locked']) { |
|
| 301 | + echo ' |
|
| 286 | 302 | <span class="generic_icons lock"></span>'; |
| 287 | - if ($topic['is_sticky']) |
|
| 288 | - echo ' |
|
| 303 | + } |
|
| 304 | + if ($topic['is_sticky']) { |
|
| 305 | + echo ' |
|
| 289 | 306 | <span class="generic_icons sticky"></span>'; |
| 290 | - if ($topic['is_poll']) |
|
| 291 | - echo ' |
|
| 307 | + } |
|
| 308 | + if ($topic['is_poll']) { |
|
| 309 | + echo ' |
|
| 292 | 310 | <span class="generic_icons poll"></span>'; |
| 311 | + } |
|
| 293 | 312 | echo ' |
| 294 | 313 | </div>'; |
| 295 | 314 | |
@@ -314,11 +333,12 @@ discard block |
||
| 314 | 333 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
| 315 | 334 | </div>'; |
| 316 | 335 | |
| 317 | - if ($context['showCheckboxes']) |
|
| 318 | - echo ' |
|
| 336 | + if ($context['showCheckboxes']) { |
|
| 337 | + echo ' |
|
| 319 | 338 | <div class="moderation"> |
| 320 | 339 | <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check"> |
| 321 | 340 | </div>'; |
| 341 | + } |
|
| 322 | 342 | echo ' |
| 323 | 343 | </div>'; |
| 324 | 344 | } |
@@ -331,24 +351,26 @@ discard block |
||
| 331 | 351 | ', $context['menu_separator'], '<a href="#recent" class="topbottom floatleft">', $txt['go_up'], '</a> |
| 332 | 352 | <div class="pagelinks">', $context['page_index'], '</div> |
| 333 | 353 | </div>'; |
| 334 | - } |
|
| 335 | - else |
|
| 336 | - echo ' |
|
| 354 | + } else { |
|
| 355 | + echo ' |
|
| 337 | 356 | <div class="cat_bar"> |
| 338 | 357 | <h3 class="catbg centertext"> |
| 339 | 358 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
| 340 | 359 | </h3> |
| 341 | 360 | </div>'; |
| 361 | + } |
|
| 342 | 362 | |
| 343 | - if ($context['showCheckboxes']) |
|
| 344 | - echo ' |
|
| 363 | + if ($context['showCheckboxes']) { |
|
| 364 | + echo ' |
|
| 345 | 365 | </form>'; |
| 366 | + } |
|
| 346 | 367 | |
| 347 | 368 | echo ' |
| 348 | 369 | </div>'; |
| 349 | 370 | |
| 350 | - if (empty($context['no_topic_listing'])) |
|
| 351 | - template_topic_legend(); |
|
| 352 | -} |
|
| 371 | + if (empty($context['no_topic_listing'])) { |
|
| 372 | + template_topic_legend(); |
|
| 373 | + } |
|
| 374 | + } |
|
| 353 | 375 | |
| 354 | 376 | ?> |
| 355 | 377 | \ No newline at end of file |
@@ -25,13 +25,15 @@ discard block |
||
| 25 | 25 | </h3> |
| 26 | 26 | </div>'; |
| 27 | 27 | |
| 28 | - if (!empty($context['search_errors'])) |
|
| 29 | - echo ' |
|
| 28 | + if (!empty($context['search_errors'])) { |
|
| 29 | + echo ' |
|
| 30 | 30 | <div class="errorbox">', implode('<br>', $context['search_errors']['messages']), '</div>'; |
| 31 | + } |
|
| 31 | 32 | |
| 32 | - if (!empty($context['search_ignored'])) |
|
| 33 | - echo ' |
|
| 33 | + if (!empty($context['search_ignored'])) { |
|
| 34 | + echo ' |
|
| 34 | 35 | <p class="noticebox">', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>'; |
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | echo ' |
| 37 | 39 | <div id="advanced_search" class="roundframe"> |
@@ -42,9 +44,10 @@ discard block |
||
| 42 | 44 | <dd> |
| 43 | 45 | <input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text">'; |
| 44 | 46 | |
| 45 | - if (empty($modSettings['search_simple_fulltext'])) |
|
| 46 | - echo ' |
|
| 47 | + if (empty($modSettings['search_simple_fulltext'])) { |
|
| 48 | + echo ' |
|
| 47 | 49 | <br><em class="smalltext">', $txt['search_example'], '</em>'; |
| 50 | + } |
|
| 48 | 51 | |
| 49 | 52 | echo ' |
| 50 | 53 | </dd> |
@@ -115,11 +118,12 @@ discard block |
||
| 115 | 118 | } |
| 116 | 119 | |
| 117 | 120 | // If $context['search_params']['topic'] is set, that means we're searching just one topic. |
| 118 | - if (!empty($context['search_params']['topic'])) |
|
| 119 | - echo ' |
|
| 121 | + if (!empty($context['search_params']['topic'])) { |
|
| 122 | + echo ' |
|
| 120 | 123 | <p>', $txt['search_specific_topic'], ' "', $context['search_topic']['link'], '".</p> |
| 121 | 124 | <input type="hidden" name="topic" value="', $context['search_topic']['id'], '"> |
| 122 | 125 | <input type="submit" name="b_search" value="', $txt['search'], '" class="button_submit">'; |
| 126 | + } |
|
| 123 | 127 | |
| 124 | 128 | echo ' |
| 125 | 129 | </div> |
@@ -150,14 +154,15 @@ discard block |
||
| 150 | 154 | |
| 151 | 155 | foreach ($category['boards'] as $board) |
| 152 | 156 | { |
| 153 | - if ($i == $limit) |
|
| 154 | - echo ' |
|
| 157 | + if ($i == $limit) { |
|
| 158 | + echo ' |
|
| 155 | 159 | </ul> |
| 156 | 160 | </li> |
| 157 | 161 | </ul> |
| 158 | 162 | <ul class="ignoreboards floatright"> |
| 159 | 163 | <li class="category"> |
| 160 | 164 | <ul>'; |
| 165 | + } |
|
| 161 | 166 | |
| 162 | 167 | echo ' |
| 163 | 168 | <li class="board"> |
@@ -245,13 +250,15 @@ discard block |
||
| 245 | 250 | <div class="roundframe">'; |
| 246 | 251 | |
| 247 | 252 | // Did they make any typos or mistakes, perhaps? |
| 248 | - if (isset($context['did_you_mean'])) |
|
| 249 | - echo ' |
|
| 253 | + if (isset($context['did_you_mean'])) { |
|
| 254 | + echo ' |
|
| 250 | 255 | <p>', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>.</p>'; |
| 256 | + } |
|
| 251 | 257 | |
| 252 | - if (!empty($context['search_ignored'])) |
|
| 253 | - echo ' |
|
| 258 | + if (!empty($context['search_ignored'])) { |
|
| 259 | + echo ' |
|
| 254 | 260 | <p>', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>'; |
| 261 | + } |
|
| 255 | 262 | |
| 256 | 263 | echo ' |
| 257 | 264 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -273,10 +280,11 @@ discard block |
||
| 273 | 280 | <input type="hidden" name="maxage" value="', !empty($context['search_params']['maxage']) ? $context['search_params']['maxage'] : '9999', '"> |
| 274 | 281 | <input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '"> |
| 275 | 282 | </div>'; |
| 276 | - if (!empty($context['search_params']['brd'])) |
|
| 277 | - foreach ($context['search_params']['brd'] as $board_id) |
|
| 283 | + if (!empty($context['search_params']['brd'])) { |
|
| 284 | + foreach ($context['search_params']['brd'] as $board_id) |
|
| 278 | 285 | echo ' |
| 279 | 286 | <input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">'; |
| 287 | + } |
|
| 280 | 288 | |
| 281 | 289 | echo ' |
| 282 | 290 | </form> |
@@ -287,17 +295,19 @@ discard block |
||
| 287 | 295 | if ($context['compact']) |
| 288 | 296 | { |
| 289 | 297 | // Quick moderation set to checkboxes? Oh, how fun :/. |
| 290 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
| 291 | - echo ' |
|
| 298 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
| 299 | + echo ' |
|
| 292 | 300 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">'; |
| 301 | + } |
|
| 293 | 302 | |
| 294 | 303 | echo ' |
| 295 | 304 | <div class="cat_bar"> |
| 296 | 305 | <h3 class="catbg"> |
| 297 | 306 | <span class="floatright">'; |
| 298 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
| 299 | - echo ' |
|
| 307 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
| 308 | + echo ' |
|
| 300 | 309 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check">'; |
| 310 | + } |
|
| 301 | 311 | echo ' |
| 302 | 312 | </span> |
| 303 | 313 | <span class="generic_icons filter"></span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], ' |
@@ -305,14 +315,15 @@ discard block |
||
| 305 | 315 | </div>'; |
| 306 | 316 | |
| 307 | 317 | // was anything even found? |
| 308 | - if (!empty($context['topics'])) |
|
| 309 | - echo' |
|
| 318 | + if (!empty($context['topics'])) { |
|
| 319 | + echo' |
|
| 310 | 320 | <div class="pagesection"> |
| 311 | 321 | <span>', $context['page_index'], '</span> |
| 312 | 322 | </div>'; |
| 313 | - else |
|
| 314 | - echo ' |
|
| 323 | + } else { |
|
| 324 | + echo ' |
|
| 315 | 325 | <div class="roundframe">', $txt['find_no_results'], '</div>'; |
| 326 | + } |
|
| 316 | 327 | |
| 317 | 328 | // while we have results to show ... |
| 318 | 329 | while ($topic = $context['get_topics']()) |
@@ -340,38 +351,43 @@ discard block |
||
| 340 | 351 | { |
| 341 | 352 | echo ' |
| 342 | 353 | <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check">'; |
| 343 | - } |
|
| 344 | - else |
|
| 354 | + } else |
|
| 345 | 355 | { |
| 346 | - if ($topic['quick_mod']['remove']) |
|
| 347 | - echo ' |
|
| 356 | + if ($topic['quick_mod']['remove']) { |
|
| 357 | + echo ' |
|
| 348 | 358 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>'; |
| 359 | + } |
|
| 349 | 360 | |
| 350 | - if ($topic['quick_mod']['lock']) |
|
| 351 | - echo ' |
|
| 361 | + if ($topic['quick_mod']['lock']) { |
|
| 362 | + echo ' |
|
| 352 | 363 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>'; |
| 364 | + } |
|
| 353 | 365 | |
| 354 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
| 355 | - echo ' |
|
| 366 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
| 367 | + echo ' |
|
| 356 | 368 | <br>'; |
| 369 | + } |
|
| 357 | 370 | |
| 358 | - if ($topic['quick_mod']['sticky']) |
|
| 359 | - echo ' |
|
| 371 | + if ($topic['quick_mod']['sticky']) { |
|
| 372 | + echo ' |
|
| 360 | 373 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>'; |
| 374 | + } |
|
| 361 | 375 | |
| 362 | - if ($topic['quick_mod']['move']) |
|
| 363 | - echo ' |
|
| 376 | + if ($topic['quick_mod']['move']) { |
|
| 377 | + echo ' |
|
| 364 | 378 | <a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
| 379 | + } |
|
| 365 | 380 | } |
| 366 | 381 | |
| 367 | 382 | echo ' |
| 368 | 383 | </div>'; |
| 369 | 384 | } |
| 370 | 385 | |
| 371 | - if ($message['body_highlighted'] != '') |
|
| 372 | - echo ' |
|
| 386 | + if ($message['body_highlighted'] != '') { |
|
| 387 | + echo ' |
|
| 373 | 388 | <br class="clear"> |
| 374 | 389 | <div class="list_posts double_height">', $message['body_highlighted'], '</div>'; |
| 390 | + } |
|
| 375 | 391 | } |
| 376 | 392 | |
| 377 | 393 | echo ' |
@@ -379,11 +395,12 @@ discard block |
||
| 379 | 395 | </div>'; |
| 380 | 396 | |
| 381 | 397 | } |
| 382 | - if (!empty($context['topics'])) |
|
| 383 | - echo ' |
|
| 398 | + if (!empty($context['topics'])) { |
|
| 399 | + echo ' |
|
| 384 | 400 | <div class="pagesection"> |
| 385 | 401 | <span>', $context['page_index'], '</span> |
| 386 | 402 | </div>'; |
| 403 | + } |
|
| 387 | 404 | |
| 388 | 405 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
| 389 | 406 | { |
@@ -393,17 +410,19 @@ discard block |
||
| 393 | 410 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
| 394 | 411 | <option value="">--------</option>'; |
| 395 | 412 | |
| 396 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
| 397 | - if ($context['can_' . $qmod_action]) |
|
| 413 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
| 414 | + if ($context['can_' . $qmod_action]) |
|
| 398 | 415 | echo ' |
| 399 | 416 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
| 417 | + } |
|
| 400 | 418 | |
| 401 | 419 | echo ' |
| 402 | 420 | </select>'; |
| 403 | 421 | |
| 404 | - if ($context['can_move']) |
|
| 405 | - echo ' |
|
| 422 | + if ($context['can_move']) { |
|
| 423 | + echo ' |
|
| 406 | 424 | <span id="quick_mod_jump_to"> </span>'; |
| 425 | + } |
|
| 407 | 426 | |
| 408 | 427 | echo ' |
| 409 | 428 | <input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '"> |
@@ -413,13 +432,13 @@ discard block |
||
| 413 | 432 | } |
| 414 | 433 | |
| 415 | 434 | |
| 416 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
|
| 417 | - echo ' |
|
| 435 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) { |
|
| 436 | + echo ' |
|
| 418 | 437 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
| 419 | 438 | </form>'; |
| 439 | + } |
|
| 420 | 440 | |
| 421 | - } |
|
| 422 | - else |
|
| 441 | + } else |
|
| 423 | 442 | { |
| 424 | 443 | echo ' |
| 425 | 444 | <div class="cat_bar"> |
@@ -431,9 +450,10 @@ discard block |
||
| 431 | 450 | <span>', $context['page_index'], '</span> |
| 432 | 451 | </div>'; |
| 433 | 452 | |
| 434 | - if (empty($context['topics'])) |
|
| 435 | - echo ' |
|
| 453 | + if (empty($context['topics'])) { |
|
| 454 | + echo ' |
|
| 436 | 455 | <div class="information">(', $txt['search_no_results'], ')</div>'; |
| 456 | + } |
|
| 437 | 457 | |
| 438 | 458 | while ($topic = $context['get_topics']()) |
| 439 | 459 | { |
@@ -448,23 +468,27 @@ discard block |
||
| 448 | 468 | </div> |
| 449 | 469 | <div class="list_posts">', $message['body_highlighted'], '</div>'; |
| 450 | 470 | |
| 451 | - if ($topic['can_reply']) |
|
| 452 | - echo ' |
|
| 471 | + if ($topic['can_reply']) { |
|
| 472 | + echo ' |
|
| 453 | 473 | <ul class="quickbuttons">'; |
| 474 | + } |
|
| 454 | 475 | |
| 455 | 476 | // If they *can* reply? |
| 456 | - if ($topic['can_reply']) |
|
| 457 | - echo ' |
|
| 477 | + if ($topic['can_reply']) { |
|
| 478 | + echo ' |
|
| 458 | 479 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 480 | + } |
|
| 459 | 481 | |
| 460 | 482 | // If they *can* quote? |
| 461 | - if ($topic['can_quote']) |
|
| 462 | - echo ' |
|
| 483 | + if ($topic['can_quote']) { |
|
| 484 | + echo ' |
|
| 463 | 485 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'] . ';quote=' . $message['id'] . '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 486 | + } |
|
| 464 | 487 | |
| 465 | - if ($topic['can_reply']) |
|
| 466 | - echo ' |
|
| 488 | + if ($topic['can_reply']) { |
|
| 489 | + echo ' |
|
| 467 | 490 | </ul>'; |
| 491 | + } |
|
| 468 | 492 | echo ' |
| 469 | 493 | <br class="clear"> |
| 470 | 494 | </div>'; |
@@ -483,8 +507,8 @@ discard block |
||
| 483 | 507 | <div class="smalltext righttext" id="search_jump_to"> </div> |
| 484 | 508 | <script>'; |
| 485 | 509 | |
| 486 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
| 487 | - echo ' |
|
| 510 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
| 511 | + echo ' |
|
| 488 | 512 | if (typeof(window.XMLHttpRequest) != "undefined") |
| 489 | 513 | aJumpTo[aJumpTo.length] = new JumpTo({ |
| 490 | 514 | sContainerId: "quick_mod_jump_to", |
@@ -499,6 +523,7 @@ discard block |
||
| 499 | 523 | bDisabled: true, |
| 500 | 524 | sCustomName: "move_to" |
| 501 | 525 | });'; |
| 526 | + } |
|
| 502 | 527 | |
| 503 | 528 | echo ' |
| 504 | 529 | if (typeof(window.XMLHttpRequest) != "undefined") |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Main entry point for the admin search settings screen. |
@@ -107,11 +108,13 @@ discard block |
||
| 107 | 108 | // Perhaps the search method wants to add some settings? |
| 108 | 109 | require_once($sourcedir . '/Search.php'); |
| 109 | 110 | $searchAPI = findSearchAPI(); |
| 110 | - if (is_callable(array($searchAPI, 'searchSettings'))) |
|
| 111 | - call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars)); |
|
| 111 | + if (is_callable(array($searchAPI, 'searchSettings'))) { |
|
| 112 | + call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars)); |
|
| 113 | + } |
|
| 112 | 114 | |
| 113 | - if ($return_config) |
|
| 114 | - return $config_vars; |
|
| 115 | + if ($return_config) { |
|
| 116 | + return $config_vars; |
|
| 117 | + } |
|
| 115 | 118 | |
| 116 | 119 | $context['page_title'] = $txt['search_settings_title']; |
| 117 | 120 | $context['sub_template'] = 'show_settings'; |
@@ -126,8 +129,9 @@ discard block |
||
| 126 | 129 | |
| 127 | 130 | call_integration_hook('integrate_save_search_settings'); |
| 128 | 131 | |
| 129 | - if (empty($_POST['search_results_per_page'])) |
|
| 130 | - $_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages']; |
|
| 132 | + if (empty($_POST['search_results_per_page'])) { |
|
| 133 | + $_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages']; |
|
| 134 | + } |
|
| 131 | 135 | saveDBSettings($config_vars); |
| 132 | 136 | $_SESSION['adm-save'] = true; |
| 133 | 137 | redirectexit('action=admin;area=managesearch;sa=settings;' . $context['session_var'] . '=' . $context['session_id']); |
@@ -177,17 +181,20 @@ discard block |
||
| 177 | 181 | call_integration_hook('integrate_save_search_weights'); |
| 178 | 182 | |
| 179 | 183 | $changes = array(); |
| 180 | - foreach ($factors as $factor) |
|
| 181 | - $changes[$factor] = (int) $_POST[$factor]; |
|
| 184 | + foreach ($factors as $factor) { |
|
| 185 | + $changes[$factor] = (int) $_POST[$factor]; |
|
| 186 | + } |
|
| 182 | 187 | updateSettings($changes); |
| 183 | 188 | } |
| 184 | 189 | |
| 185 | 190 | $context['relative_weights'] = array('total' => 0); |
| 186 | - foreach ($factors as $factor) |
|
| 187 | - $context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0; |
|
| 191 | + foreach ($factors as $factor) { |
|
| 192 | + $context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0; |
|
| 193 | + } |
|
| 188 | 194 | |
| 189 | - foreach ($factors as $factor) |
|
| 190 | - $context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1); |
|
| 195 | + foreach ($factors as $factor) { |
|
| 196 | + $context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1); |
|
| 197 | + } |
|
| 191 | 198 | |
| 192 | 199 | createToken('admin-msw'); |
| 193 | 200 | } |
@@ -215,8 +222,9 @@ discard block |
||
| 215 | 222 | $context['search_apis'] = loadSearchAPIs(); |
| 216 | 223 | |
| 217 | 224 | // Detect whether a fulltext index is set. |
| 218 | - if ($context['supports_fulltext']) |
|
| 219 | - detectFulltextIndex(); |
|
| 225 | + if ($context['supports_fulltext']) { |
|
| 226 | + detectFulltextIndex(); |
|
| 227 | + } |
|
| 220 | 228 | |
| 221 | 229 | if (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'createfulltext') |
| 222 | 230 | { |
@@ -252,8 +260,7 @@ discard block |
||
| 252 | 260 | 'language' => $language_ftx |
| 253 | 261 | ) |
| 254 | 262 | ); |
| 255 | - } |
|
| 256 | - else |
|
| 263 | + } else |
|
| 257 | 264 | { |
| 258 | 265 | // Make sure it's gone before creating it. |
| 259 | 266 | $smcFunc['db_query']('', ' |
@@ -273,8 +280,7 @@ discard block |
||
| 273 | 280 | } |
| 274 | 281 | |
| 275 | 282 | $context['fulltext_index'] = 'body'; |
| 276 | - } |
|
| 277 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
| 283 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
| 278 | 284 | { |
| 279 | 285 | checkSession('get'); |
| 280 | 286 | validateToken('admin-msm', 'get'); |
@@ -291,12 +297,12 @@ discard block |
||
| 291 | 297 | $context['fulltext_index'] = ''; |
| 292 | 298 | |
| 293 | 299 | // Go back to the default search method. |
| 294 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') |
|
| 295 | - updateSettings(array( |
|
| 300 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') { |
|
| 301 | + updateSettings(array( |
|
| 296 | 302 | 'search_index' => '', |
| 297 | 303 | )); |
| 298 | - } |
|
| 299 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
| 304 | + } |
|
| 305 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
| 300 | 306 | { |
| 301 | 307 | checkSession('get'); |
| 302 | 308 | validateToken('admin-msm', 'get'); |
@@ -318,12 +324,12 @@ discard block |
||
| 318 | 324 | )); |
| 319 | 325 | |
| 320 | 326 | // Go back to the default search method. |
| 321 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
| 322 | - updateSettings(array( |
|
| 327 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
| 328 | + updateSettings(array( |
|
| 323 | 329 | 'search_index' => '', |
| 324 | 330 | )); |
| 325 | - } |
|
| 326 | - elseif (isset($_POST['save'])) |
|
| 331 | + } |
|
| 332 | + } elseif (isset($_POST['save'])) |
|
| 327 | 333 | { |
| 328 | 334 | checkSession(); |
| 329 | 335 | validateToken('admin-msmpost'); |
@@ -345,8 +351,8 @@ discard block |
||
| 345 | 351 | // Get some info about the messages table, to show its size and index size. |
| 346 | 352 | if ($db_type == 'mysql') |
| 347 | 353 | { |
| 348 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
| 349 | - $request = $smcFunc['db_query']('', ' |
|
| 354 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
| 355 | + $request = $smcFunc['db_query']('', ' |
|
| 350 | 356 | SHOW TABLE STATUS |
| 351 | 357 | FROM {string:database_name} |
| 352 | 358 | LIKE {string:table_name}', |
@@ -355,14 +361,15 @@ discard block |
||
| 355 | 361 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
| 356 | 362 | ) |
| 357 | 363 | ); |
| 358 | - else |
|
| 359 | - $request = $smcFunc['db_query']('', ' |
|
| 364 | + } else { |
|
| 365 | + $request = $smcFunc['db_query']('', ' |
|
| 360 | 366 | SHOW TABLE STATUS |
| 361 | 367 | LIKE {string:table_name}', |
| 362 | 368 | array( |
| 363 | 369 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
| 364 | 370 | ) |
| 365 | 371 | ); |
| 372 | + } |
|
| 366 | 373 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
| 367 | 374 | { |
| 368 | 375 | // Only do this if the user has permission to execute this query. |
@@ -374,8 +381,8 @@ discard block |
||
| 374 | 381 | } |
| 375 | 382 | |
| 376 | 383 | // Now check the custom index table, if it exists at all. |
| 377 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
| 378 | - $request = $smcFunc['db_query']('', ' |
|
| 384 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
| 385 | + $request = $smcFunc['db_query']('', ' |
|
| 379 | 386 | SHOW TABLE STATUS |
| 380 | 387 | FROM {string:database_name} |
| 381 | 388 | LIKE {string:table_name}', |
@@ -384,14 +391,15 @@ discard block |
||
| 384 | 391 | 'table_name' => str_replace('_', '\_', $match[2]) . 'log_search_words', |
| 385 | 392 | ) |
| 386 | 393 | ); |
| 387 | - else |
|
| 388 | - $request = $smcFunc['db_query']('', ' |
|
| 394 | + } else { |
|
| 395 | + $request = $smcFunc['db_query']('', ' |
|
| 389 | 396 | SHOW TABLE STATUS |
| 390 | 397 | LIKE {string:table_name}', |
| 391 | 398 | array( |
| 392 | 399 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'log_search_words', |
| 393 | 400 | ) |
| 394 | 401 | ); |
| 402 | + } |
|
| 395 | 403 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
| 396 | 404 | { |
| 397 | 405 | // Only do this if the user has permission to execute this query. |
@@ -400,8 +408,7 @@ discard block |
||
| 400 | 408 | $context['table_info']['custom_index_length'] = $row['Data_length'] + $row['Index_length']; |
| 401 | 409 | $smcFunc['db_free_result']($request); |
| 402 | 410 | } |
| 403 | - } |
|
| 404 | - elseif ($db_type == 'postgresql') |
|
| 411 | + } elseif ($db_type == 'postgresql') |
|
| 405 | 412 | { |
| 406 | 413 | // In order to report the sizes correctly we need to perform vacuum (optimize) on the tables we will be using. |
| 407 | 414 | //db_extend(); |
@@ -443,38 +450,38 @@ discard block |
||
| 443 | 450 | $context['table_info']['data_length'] = (int) $row['table_size']; |
| 444 | 451 | $context['table_info']['index_length'] = (int) $row['index_size']; |
| 445 | 452 | $context['table_info']['fulltext_length'] = (int) $row['index_size']; |
| 446 | - } |
|
| 447 | - elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
| 453 | + } elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
| 448 | 454 | { |
| 449 | 455 | $context['table_info']['index_length'] = (int) $row['index_size']; |
| 450 | 456 | $context['table_info']['custom_index_length'] = (int) $row['index_size']; |
| 451 | 457 | } |
| 452 | 458 | } |
| 453 | 459 | $smcFunc['db_free_result']($request); |
| 454 | - } |
|
| 455 | - else |
|
| 456 | - // Didn't work for some reason... |
|
| 460 | + } else { |
|
| 461 | + // Didn't work for some reason... |
|
| 457 | 462 | $context['table_info'] = array( |
| 458 | 463 | 'data_length' => $txt['not_applicable'], |
| 459 | 464 | 'index_length' => $txt['not_applicable'], |
| 460 | 465 | 'fulltext_length' => $txt['not_applicable'], |
| 461 | 466 | 'custom_index_length' => $txt['not_applicable'], |
| 462 | 467 | ); |
| 463 | - } |
|
| 464 | - else |
|
| 465 | - $context['table_info'] = array( |
|
| 468 | + } |
|
| 469 | + } else { |
|
| 470 | + $context['table_info'] = array( |
|
| 466 | 471 | 'data_length' => $txt['not_applicable'], |
| 467 | 472 | 'index_length' => $txt['not_applicable'], |
| 468 | 473 | 'fulltext_length' => $txt['not_applicable'], |
| 469 | 474 | 'custom_index_length' => $txt['not_applicable'], |
| 470 | 475 | ); |
| 476 | + } |
|
| 471 | 477 | |
| 472 | 478 | // Format the data and index length in kilobytes. |
| 473 | 479 | foreach ($context['table_info'] as $type => $size) |
| 474 | 480 | { |
| 475 | 481 | // If it's not numeric then just break. This database engine doesn't support size. |
| 476 | - if (!is_numeric($size)) |
|
| 477 | - break; |
|
| 482 | + if (!is_numeric($size)) { |
|
| 483 | + break; |
|
| 484 | + } |
|
| 478 | 485 | |
| 479 | 486 | $context['table_info'][$type] = comma_format($context['table_info'][$type] / 1024) . ' ' . $txt['search_method_kilobytes']; |
| 480 | 487 | } |
@@ -503,8 +510,9 @@ discard block |
||
| 503 | 510 | |
| 504 | 511 | // Scotty, we need more time... |
| 505 | 512 | @set_time_limit(600); |
| 506 | - if (function_exists('apache_reset_timeout')) |
|
| 507 | - @apache_reset_timeout(); |
|
| 513 | + if (function_exists('apache_reset_timeout')) { |
|
| 514 | + @apache_reset_timeout(); |
|
| 515 | + } |
|
| 508 | 516 | |
| 509 | 517 | $context[$context['admin_menu_name']]['current_subsection'] = 'method'; |
| 510 | 518 | $context['page_title'] = $txt['search_index_custom']; |
@@ -534,8 +542,7 @@ discard block |
||
| 534 | 542 | $context['start'] = (int) $context['index_settings']['resume_at']; |
| 535 | 543 | unset($context['index_settings']['resume_at']); |
| 536 | 544 | $context['step'] = 1; |
| 537 | - } |
|
| 538 | - else |
|
| 545 | + } else |
|
| 539 | 546 | { |
| 540 | 547 | $context['index_settings'] = array( |
| 541 | 548 | 'bytes_per_word' => isset($_REQUEST['bytes_per_word']) && isset($index_properties[$_REQUEST['bytes_per_word']]) ? (int) $_REQUEST['bytes_per_word'] : 2, |
@@ -544,12 +551,14 @@ discard block |
||
| 544 | 551 | $context['step'] = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0; |
| 545 | 552 | |
| 546 | 553 | // admin timeouts are painful when building these long indexes - but only if we actually have such things enabled |
| 547 | - if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) |
|
| 548 | - $_SESSION['admin_time'] = time(); |
|
| 554 | + if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) { |
|
| 555 | + $_SESSION['admin_time'] = time(); |
|
| 556 | + } |
|
| 549 | 557 | } |
| 550 | 558 | |
| 551 | - if ($context['step'] !== 0) |
|
| 552 | - checkSession('request'); |
|
| 559 | + if ($context['step'] !== 0) { |
|
| 560 | + checkSession('request'); |
|
| 561 | + } |
|
| 553 | 562 | |
| 554 | 563 | // Step 0: let the user determine how they like their index. |
| 555 | 564 | if ($context['step'] === 0) |
@@ -578,12 +587,14 @@ discard block |
||
| 578 | 587 | $smcFunc['db_create_word_search']($index_properties[$context['index_settings']['bytes_per_word']]['column_definition']); |
| 579 | 588 | |
| 580 | 589 | // Temporarily switch back to not using a search index. |
| 581 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
| 582 | - updateSettings(array('search_index' => '')); |
|
| 590 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
| 591 | + updateSettings(array('search_index' => '')); |
|
| 592 | + } |
|
| 583 | 593 | |
| 584 | 594 | // Don't let simultanious processes be updating the search index. |
| 585 | - if (!empty($modSettings['search_custom_index_config'])) |
|
| 586 | - updateSettings(array('search_custom_index_config' => '')); |
|
| 595 | + if (!empty($modSettings['search_custom_index_config'])) { |
|
| 596 | + updateSettings(array('search_custom_index_config' => '')); |
|
| 597 | + } |
|
| 587 | 598 | } |
| 588 | 599 | |
| 589 | 600 | $num_messages = array( |
@@ -599,16 +610,16 @@ discard block |
||
| 599 | 610 | 'starting_id' => $context['start'], |
| 600 | 611 | ) |
| 601 | 612 | ); |
| 602 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 603 | - $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
| 613 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 614 | + $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
| 615 | + } |
|
| 604 | 616 | |
| 605 | 617 | if (empty($num_messages['todo'])) |
| 606 | 618 | { |
| 607 | 619 | $context['step'] = 2; |
| 608 | 620 | $context['percentage'] = 80; |
| 609 | 621 | $context['start'] = 0; |
| 610 | - } |
|
| 611 | - else |
|
| 622 | + } else |
|
| 612 | 623 | { |
| 613 | 624 | // Number of seconds before the next step. |
| 614 | 625 | $stop = time() + 3; |
@@ -649,21 +660,22 @@ discard block |
||
| 649 | 660 | |
| 650 | 661 | $context['start'] += $forced_break ? $number_processed : $messages_per_batch; |
| 651 | 662 | |
| 652 | - if (!empty($inserts)) |
|
| 653 | - $smcFunc['db_insert']('ignore', |
|
| 663 | + if (!empty($inserts)) { |
|
| 664 | + $smcFunc['db_insert']('ignore', |
|
| 654 | 665 | '{db_prefix}log_search_words', |
| 655 | 666 | array('id_word' => 'int', 'id_msg' => 'int'), |
| 656 | 667 | $inserts, |
| 657 | 668 | array('id_word', 'id_msg') |
| 658 | 669 | ); |
| 670 | + } |
|
| 659 | 671 | if ($num_messages['todo'] === 0) |
| 660 | 672 | { |
| 661 | 673 | $context['step'] = 2; |
| 662 | 674 | $context['start'] = 0; |
| 663 | 675 | break; |
| 676 | + } else { |
|
| 677 | + updateSettings(array('search_custom_index_resume' => json_encode(array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
| 664 | 678 | } |
| 665 | - else |
|
| 666 | - updateSettings(array('search_custom_index_resume' => json_encode(array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
| 667 | 679 | } |
| 668 | 680 | |
| 669 | 681 | // Since there are still two steps to go, 80% is the maximum here. |
@@ -674,9 +686,9 @@ discard block |
||
| 674 | 686 | // Step 2: removing the words that occur too often and are of no use. |
| 675 | 687 | elseif ($context['step'] === 2) |
| 676 | 688 | { |
| 677 | - if ($context['index_settings']['bytes_per_word'] < 4) |
|
| 678 | - $context['step'] = 3; |
|
| 679 | - else |
|
| 689 | + if ($context['index_settings']['bytes_per_word'] < 4) { |
|
| 690 | + $context['step'] = 3; |
|
| 691 | + } else |
|
| 680 | 692 | { |
| 681 | 693 | $stop_words = $context['start'] === 0 || empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']); |
| 682 | 694 | $stop = time() + 3; |
@@ -697,20 +709,22 @@ discard block |
||
| 697 | 709 | 'minimum_messages' => $max_messages, |
| 698 | 710 | ) |
| 699 | 711 | ); |
| 700 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 701 | - $stop_words[] = $row['id_word']; |
|
| 712 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 713 | + $stop_words[] = $row['id_word']; |
|
| 714 | + } |
|
| 702 | 715 | $smcFunc['db_free_result']($request); |
| 703 | 716 | |
| 704 | 717 | updateSettings(array('search_stopwords' => implode(',', $stop_words))); |
| 705 | 718 | |
| 706 | - if (!empty($stop_words)) |
|
| 707 | - $smcFunc['db_query']('', ' |
|
| 719 | + if (!empty($stop_words)) { |
|
| 720 | + $smcFunc['db_query']('', ' |
|
| 708 | 721 | DELETE FROM {db_prefix}log_search_words |
| 709 | 722 | WHERE id_word in ({array_int:stop_words})', |
| 710 | 723 | array( |
| 711 | 724 | 'stop_words' => $stop_words, |
| 712 | 725 | ) |
| 713 | 726 | ); |
| 727 | + } |
|
| 714 | 728 | |
| 715 | 729 | $context['start'] += $index_properties[$context['index_settings']['bytes_per_word']]['step_size']; |
| 716 | 730 | if ($context['start'] > $index_properties[$context['index_settings']['bytes_per_word']]['max_size']) |
@@ -771,8 +785,9 @@ discard block |
||
| 771 | 785 | $searchAPI = new $search_class_name(); |
| 772 | 786 | |
| 773 | 787 | // No Support? NEXT! |
| 774 | - if (!$searchAPI->is_supported) |
|
| 775 | - continue; |
|
| 788 | + if (!$searchAPI->is_supported) { |
|
| 789 | + continue; |
|
| 790 | + } |
|
| 776 | 791 | |
| 777 | 792 | $apis[$index_name] = array( |
| 778 | 793 | 'filename' => $file, |
@@ -819,10 +834,10 @@ discard block |
||
| 819 | 834 | 'messages_ftx' => $db_prefix . 'messages_ftx', |
| 820 | 835 | ) |
| 821 | 836 | ); |
| 822 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 823 | - $context['fulltext_index'][] = $row['indexname']; |
|
| 824 | - } |
|
| 825 | - else |
|
| 837 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 838 | + $context['fulltext_index'][] = $row['indexname']; |
|
| 839 | + } |
|
| 840 | + } else |
|
| 826 | 841 | { |
| 827 | 842 | $request = $smcFunc['db_query']('', ' |
| 828 | 843 | SHOW INDEX |
@@ -833,17 +848,19 @@ discard block |
||
| 833 | 848 | $context['fulltext_index'] = ''; |
| 834 | 849 | if ($request !== false || $smcFunc['db_num_rows']($request) != 0) |
| 835 | 850 | { |
| 836 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 837 | - if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
| 851 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 852 | + if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
| 838 | 853 | $context['fulltext_index'][] = $row['Key_name']; |
| 854 | + } |
|
| 839 | 855 | $smcFunc['db_free_result']($request); |
| 840 | 856 | |
| 841 | - if (is_array($context['fulltext_index'])) |
|
| 842 | - $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
| 857 | + if (is_array($context['fulltext_index'])) { |
|
| 858 | + $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
| 859 | + } |
|
| 843 | 860 | } |
| 844 | 861 | |
| 845 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
| 846 | - $request = $smcFunc['db_query']('', ' |
|
| 862 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
| 863 | + $request = $smcFunc['db_query']('', ' |
|
| 847 | 864 | SHOW TABLE STATUS |
| 848 | 865 | FROM {string:database_name} |
| 849 | 866 | LIKE {string:table_name}', |
@@ -852,20 +869,22 @@ discard block |
||
| 852 | 869 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
| 853 | 870 | ) |
| 854 | 871 | ); |
| 855 | - else |
|
| 856 | - $request = $smcFunc['db_query']('', ' |
|
| 872 | + } else { |
|
| 873 | + $request = $smcFunc['db_query']('', ' |
|
| 857 | 874 | SHOW TABLE STATUS |
| 858 | 875 | LIKE {string:table_name}', |
| 859 | 876 | array( |
| 860 | 877 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
| 861 | 878 | ) |
| 862 | 879 | ); |
| 880 | + } |
|
| 863 | 881 | |
| 864 | 882 | if ($request !== false) |
| 865 | 883 | { |
| 866 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 867 | - if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'], '5.6.4', '>='))) |
|
| 884 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 885 | + if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'], '5.6.4', '>='))) |
|
| 868 | 886 | $context['cannot_create_fulltext'] = true; |
| 887 | + } |
|
| 869 | 888 | $smcFunc['db_free_result']($request); |
| 870 | 889 | } |
| 871 | 890 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * The main entrance point for the Manage Members screen. |
@@ -62,16 +63,18 @@ discard block |
||
| 62 | 63 | $context['activation_numbers'] = array(); |
| 63 | 64 | $context['awaiting_activation'] = 0; |
| 64 | 65 | $context['awaiting_approval'] = 0; |
| 65 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 66 | - $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
| 66 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 67 | + $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
| 68 | + } |
|
| 67 | 69 | $smcFunc['db_free_result']($request); |
| 68 | 70 | |
| 69 | 71 | foreach ($context['activation_numbers'] as $activation_type => $total_members) |
| 70 | 72 | { |
| 71 | - if (in_array($activation_type, array(0, 2))) |
|
| 72 | - $context['awaiting_activation'] += $total_members; |
|
| 73 | - elseif (in_array($activation_type, array(3, 4, 5))) |
|
| 74 | - $context['awaiting_approval'] += $total_members; |
|
| 73 | + if (in_array($activation_type, array(0, 2))) { |
|
| 74 | + $context['awaiting_activation'] += $total_members; |
|
| 75 | + } elseif (in_array($activation_type, array(3, 4, 5))) { |
|
| 76 | + $context['awaiting_approval'] += $total_members; |
|
| 77 | + } |
|
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | // For the page header... do we show activation? |
@@ -124,8 +127,9 @@ discard block |
||
| 124 | 127 | } |
| 125 | 128 | if (!$context['show_approve'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'approve')) |
| 126 | 129 | { |
| 127 | - if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) |
|
| 128 | - $context['tabs']['search']['is_last'] = true; |
|
| 130 | + if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) { |
|
| 131 | + $context['tabs']['search']['is_last'] = true; |
|
| 132 | + } |
|
| 129 | 133 | unset($context['tabs']['approve']); |
| 130 | 134 | } |
| 131 | 135 | |
@@ -157,8 +161,9 @@ discard block |
||
| 157 | 161 | foreach ($_POST['delete'] as $key => $value) |
| 158 | 162 | { |
| 159 | 163 | // Don't delete yourself, idiot. |
| 160 | - if ($value != $user_info['id']) |
|
| 161 | - $delete[$key] = (int) $value; |
|
| 164 | + if ($value != $user_info['id']) { |
|
| 165 | + $delete[$key] = (int) $value; |
|
| 166 | + } |
|
| 162 | 167 | } |
| 163 | 168 | |
| 164 | 169 | if (!empty($delete)) |
@@ -194,17 +199,18 @@ discard block |
||
| 194 | 199 | ); |
| 195 | 200 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 196 | 201 | { |
| 197 | - if ($row['min_posts'] == -1) |
|
| 198 | - $context['membergroups'][] = array( |
|
| 202 | + if ($row['min_posts'] == -1) { |
|
| 203 | + $context['membergroups'][] = array( |
|
| 199 | 204 | 'id' => $row['id_group'], |
| 200 | 205 | 'name' => $row['group_name'], |
| 201 | 206 | 'can_be_additional' => true |
| 202 | 207 | ); |
| 203 | - else |
|
| 204 | - $context['postgroups'][] = array( |
|
| 208 | + } else { |
|
| 209 | + $context['postgroups'][] = array( |
|
| 205 | 210 | 'id' => $row['id_group'], |
| 206 | 211 | 'name' => $row['group_name'] |
| 207 | 212 | ); |
| 213 | + } |
|
| 208 | 214 | } |
| 209 | 215 | $smcFunc['db_free_result']($request); |
| 210 | 216 | |
@@ -268,14 +274,15 @@ discard block |
||
| 268 | 274 | call_integration_hook('integrate_view_members_params', array(&$params)); |
| 269 | 275 | |
| 270 | 276 | $search_params = array(); |
| 271 | - if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) |
|
| 272 | - $search_params = smf_json_decode(base64_decode($_REQUEST['params']), true); |
|
| 273 | - elseif (!empty($_POST)) |
|
| 277 | + if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) { |
|
| 278 | + $search_params = smf_json_decode(base64_decode($_REQUEST['params']), true); |
|
| 279 | + } elseif (!empty($_POST)) |
|
| 274 | 280 | { |
| 275 | 281 | $search_params['types'] = $_POST['types']; |
| 276 | - foreach ($params as $param_name => $param_info) |
|
| 277 | - if (isset($_POST[$param_name])) |
|
| 282 | + foreach ($params as $param_name => $param_info) { |
|
| 283 | + if (isset($_POST[$param_name])) |
|
| 278 | 284 | $search_params[$param_name] = $_POST[$param_name]; |
| 285 | + } |
|
| 279 | 286 | } |
| 280 | 287 | |
| 281 | 288 | $search_url_params = isset($search_params) ? base64_encode(json_encode($search_params)) : null; |
@@ -288,18 +295,21 @@ discard block |
||
| 288 | 295 | foreach ($params as $param_name => $param_info) |
| 289 | 296 | { |
| 290 | 297 | // Not filled in? |
| 291 | - if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') |
|
| 292 | - continue; |
|
| 298 | + if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') { |
|
| 299 | + continue; |
|
| 300 | + } |
|
| 293 | 301 | |
| 294 | 302 | // Make sure numeric values are really numeric. |
| 295 | - if (in_array($param_info['type'], array('int', 'age'))) |
|
| 296 | - $search_params[$param_name] = (int) $search_params[$param_name]; |
|
| 303 | + if (in_array($param_info['type'], array('int', 'age'))) { |
|
| 304 | + $search_params[$param_name] = (int) $search_params[$param_name]; |
|
| 305 | + } |
|
| 297 | 306 | // Date values have to match the specified format. |
| 298 | 307 | elseif ($param_info['type'] == 'date') |
| 299 | 308 | { |
| 300 | 309 | // Check if this date format is valid. |
| 301 | - if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) |
|
| 302 | - continue; |
|
| 310 | + if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) { |
|
| 311 | + continue; |
|
| 312 | + } |
|
| 303 | 313 | |
| 304 | 314 | $search_params[$param_name] = strtotime($search_params[$param_name]); |
| 305 | 315 | } |
@@ -308,8 +318,9 @@ discard block |
||
| 308 | 318 | if (!empty($param_info['range'])) |
| 309 | 319 | { |
| 310 | 320 | // Default to '=', just in case... |
| 311 | - if (empty($range_trans[$search_params['types'][$param_name]])) |
|
| 312 | - $search_params['types'][$param_name] = '='; |
|
| 321 | + if (empty($range_trans[$search_params['types'][$param_name]])) { |
|
| 322 | + $search_params['types'][$param_name] = '='; |
|
| 323 | + } |
|
| 313 | 324 | |
| 314 | 325 | // Handle special case 'age'. |
| 315 | 326 | if ($param_info['type'] == 'age') |
@@ -337,29 +348,30 @@ discard block |
||
| 337 | 348 | elseif ($param_info['type'] == 'date' && $search_params['types'][$param_name] == '=') |
| 338 | 349 | { |
| 339 | 350 | $query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400); |
| 351 | + } else { |
|
| 352 | + $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
| 340 | 353 | } |
| 341 | - else |
|
| 342 | - $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
| 343 | 354 | } |
| 344 | 355 | // Checkboxes. |
| 345 | 356 | elseif ($param_info['type'] == 'checkbox') |
| 346 | 357 | { |
| 347 | 358 | // Each checkbox or no checkbox at all is checked -> ignore. |
| 348 | - if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) |
|
| 349 | - continue; |
|
| 359 | + if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) { |
|
| 360 | + continue; |
|
| 361 | + } |
|
| 350 | 362 | |
| 351 | 363 | $query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})'; |
| 352 | 364 | $where_params[$param_name . '_check'] = $search_params[$param_name]; |
| 353 | - } |
|
| 354 | - else |
|
| 365 | + } else |
|
| 355 | 366 | { |
| 356 | 367 | // Replace the wildcard characters ('*' and '?') into MySQL ones. |
| 357 | 368 | $parameter = strtolower(strtr($smcFunc['htmlspecialchars']($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_'))); |
| 358 | 369 | |
| 359 | - if ($smcFunc['db_case_sensitive']) |
|
| 360 | - $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
| 361 | - else |
|
| 362 | - $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
| 370 | + if ($smcFunc['db_case_sensitive']) { |
|
| 371 | + $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
| 372 | + } else { |
|
| 373 | + $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
| 374 | + } |
|
| 363 | 375 | $where_params[$param_name . '_normal'] = '%' . $parameter . '%'; |
| 364 | 376 | } |
| 365 | 377 | } |
@@ -375,16 +387,18 @@ discard block |
||
| 375 | 387 | } |
| 376 | 388 | |
| 377 | 389 | // Additional membergroups (these are only relevant if not all primary groups where selected!). |
| 378 | - if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) |
|
| 379 | - foreach ($search_params['membergroups'][2] as $mg) |
|
| 390 | + if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) { |
|
| 391 | + foreach ($search_params['membergroups'][2] as $mg) |
|
| 380 | 392 | { |
| 381 | 393 | $mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0'; |
| 394 | + } |
|
| 382 | 395 | $where_params['add_group_' . $mg] = $mg; |
| 383 | 396 | } |
| 384 | 397 | |
| 385 | 398 | // Combine the one or two membergroup parts into one query part linked with an OR. |
| 386 | - if (!empty($mg_query_parts)) |
|
| 387 | - $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
| 399 | + if (!empty($mg_query_parts)) { |
|
| 400 | + $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
| 401 | + } |
|
| 388 | 402 | |
| 389 | 403 | // Get all selected post count related membergroups. |
| 390 | 404 | if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups'])) |
@@ -396,9 +410,9 @@ discard block |
||
| 396 | 410 | // Construct the where part of the query. |
| 397 | 411 | $where = empty($query_parts) ? '1=1' : implode(' |
| 398 | 412 | AND ', $query_parts); |
| 413 | + } else { |
|
| 414 | + $search_url_params = null; |
|
| 399 | 415 | } |
| 400 | - else |
|
| 401 | - $search_url_params = null; |
|
| 402 | 416 | |
| 403 | 417 | // Construct the additional URL part with the query info in it. |
| 404 | 418 | $context['params_url'] = $context['sub_action'] == 'query' ? ';sa=query;params=' . $search_url_params : ''; |
@@ -521,28 +535,32 @@ discard block |
||
| 521 | 535 | 'function' => function($rowData) use ($txt) |
| 522 | 536 | { |
| 523 | 537 | // Calculate number of days since last online. |
| 524 | - if (empty($rowData['last_login'])) |
|
| 525 | - $difference = $txt['never']; |
|
| 526 | - else |
|
| 538 | + if (empty($rowData['last_login'])) { |
|
| 539 | + $difference = $txt['never']; |
|
| 540 | + } else |
|
| 527 | 541 | { |
| 528 | 542 | $num_days_difference = jeffsdatediff($rowData['last_login']); |
| 529 | 543 | |
| 530 | 544 | // Today. |
| 531 | - if (empty($num_days_difference)) |
|
| 532 | - $difference = $txt['viewmembers_today']; |
|
| 545 | + if (empty($num_days_difference)) { |
|
| 546 | + $difference = $txt['viewmembers_today']; |
|
| 547 | + } |
|
| 533 | 548 | |
| 534 | 549 | // Yesterday. |
| 535 | - elseif ($num_days_difference == 1) |
|
| 536 | - $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
| 550 | + elseif ($num_days_difference == 1) { |
|
| 551 | + $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
| 552 | + } |
|
| 537 | 553 | |
| 538 | 554 | // X days ago. |
| 539 | - else |
|
| 540 | - $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
| 555 | + else { |
|
| 556 | + $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
| 557 | + } |
|
| 541 | 558 | } |
| 542 | 559 | |
| 543 | 560 | // Show it in italics if they're not activated... |
| 544 | - if ($rowData['is_activated'] % 10 != 1) |
|
| 545 | - $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
| 561 | + if ($rowData['is_activated'] % 10 != 1) { |
|
| 562 | + $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
| 563 | + } |
|
| 546 | 564 | |
| 547 | 565 | return $difference; |
| 548 | 566 | }, |
@@ -594,8 +612,9 @@ discard block |
||
| 594 | 612 | ); |
| 595 | 613 | |
| 596 | 614 | // Without enough permissions, don't show 'delete members' checkboxes. |
| 597 | - if (!allowedTo('profile_remove_any')) |
|
| 598 | - unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
| 615 | + if (!allowedTo('profile_remove_any')) { |
|
| 616 | + unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
| 617 | + } |
|
| 599 | 618 | |
| 600 | 619 | require_once($sourcedir . '/Subs-List.php'); |
| 601 | 620 | createList($listOptions); |
@@ -638,17 +657,18 @@ discard block |
||
| 638 | 657 | ); |
| 639 | 658 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 640 | 659 | { |
| 641 | - if ($row['min_posts'] == -1) |
|
| 642 | - $context['membergroups'][] = array( |
|
| 660 | + if ($row['min_posts'] == -1) { |
|
| 661 | + $context['membergroups'][] = array( |
|
| 643 | 662 | 'id' => $row['id_group'], |
| 644 | 663 | 'name' => $row['group_name'], |
| 645 | 664 | 'can_be_additional' => true |
| 646 | 665 | ); |
| 647 | - else |
|
| 648 | - $context['postgroups'][] = array( |
|
| 666 | + } else { |
|
| 667 | + $context['postgroups'][] = array( |
|
| 649 | 668 | 'id' => $row['id_group'], |
| 650 | 669 | 'name' => $row['group_name'] |
| 651 | 670 | ); |
| 671 | + } |
|
| 652 | 672 | } |
| 653 | 673 | $smcFunc['db_free_result']($request); |
| 654 | 674 | |
@@ -675,8 +695,9 @@ discard block |
||
| 675 | 695 | $context['page_title'] = $txt['admin_members']; |
| 676 | 696 | $context['sub_template'] = 'admin_browse'; |
| 677 | 697 | $context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve'); |
| 678 | - if (isset($context['tabs'][$context['browse_type']])) |
|
| 679 | - $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
| 698 | + if (isset($context['tabs'][$context['browse_type']])) { |
|
| 699 | + $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
| 700 | + } |
|
| 680 | 701 | |
| 681 | 702 | // Allowed filters are those we can have, in theory. |
| 682 | 703 | $context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2); |
@@ -687,18 +708,20 @@ discard block |
||
| 687 | 708 | foreach ($context['activation_numbers'] as $type => $amount) |
| 688 | 709 | { |
| 689 | 710 | // We have some of these... |
| 690 | - if (in_array($type, $context['allowed_filters']) && $amount > 0) |
|
| 691 | - $context['available_filters'][] = array( |
|
| 711 | + if (in_array($type, $context['allowed_filters']) && $amount > 0) { |
|
| 712 | + $context['available_filters'][] = array( |
|
| 692 | 713 | 'type' => $type, |
| 693 | 714 | 'amount' => $amount, |
| 694 | 715 | 'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?', |
| 695 | 716 | 'selected' => $type == $context['current_filter'] |
| 696 | 717 | ); |
| 718 | + } |
|
| 697 | 719 | } |
| 698 | 720 | |
| 699 | 721 | // If the filter was not sent, set it to whatever has people in it! |
| 700 | - if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) |
|
| 701 | - $context['current_filter'] = $context['available_filters'][0]['type']; |
|
| 722 | + if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) { |
|
| 723 | + $context['current_filter'] = $context['available_filters'][0]['type']; |
|
| 724 | + } |
|
| 702 | 725 | |
| 703 | 726 | // This little variable is used to determine if we should flag where we are looking. |
| 704 | 727 | $context['show_filter'] = ($context['current_filter'] != 0 && $context['current_filter'] != 3) || count($context['available_filters']) > 1; |
@@ -713,44 +736,47 @@ discard block |
||
| 713 | 736 | ); |
| 714 | 737 | |
| 715 | 738 | // Are we showing duplicate information? |
| 716 | - if (isset($_GET['showdupes'])) |
|
| 717 | - $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
| 739 | + if (isset($_GET['showdupes'])) { |
|
| 740 | + $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
| 741 | + } |
|
| 718 | 742 | $context['show_duplicates'] = !empty($_SESSION['showdupes']); |
| 719 | 743 | |
| 720 | 744 | // Determine which actions we should allow on this page. |
| 721 | 745 | if ($context['browse_type'] == 'approve') |
| 722 | 746 | { |
| 723 | 747 | // If we are approving deleted accounts we have a slightly different list... actually a mirror ;) |
| 724 | - if ($context['current_filter'] == 4) |
|
| 725 | - $context['allowed_actions'] = array( |
|
| 748 | + if ($context['current_filter'] == 4) { |
|
| 749 | + $context['allowed_actions'] = array( |
|
| 726 | 750 | 'reject' => $txt['admin_browse_w_approve_deletion'], |
| 727 | 751 | 'ok' => $txt['admin_browse_w_reject'], |
| 728 | 752 | ); |
| 729 | - else |
|
| 730 | - $context['allowed_actions'] = array( |
|
| 753 | + } else { |
|
| 754 | + $context['allowed_actions'] = array( |
|
| 731 | 755 | 'ok' => $txt['admin_browse_w_approve'], |
| 732 | 756 | 'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'], |
| 733 | 757 | 'require_activation' => $txt['admin_browse_w_approve_require_activate'], |
| 734 | 758 | 'reject' => $txt['admin_browse_w_reject'], |
| 735 | 759 | 'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'], |
| 736 | 760 | ); |
| 737 | - } |
|
| 738 | - elseif ($context['browse_type'] == 'activate') |
|
| 739 | - $context['allowed_actions'] = array( |
|
| 761 | + } |
|
| 762 | + } elseif ($context['browse_type'] == 'activate') { |
|
| 763 | + $context['allowed_actions'] = array( |
|
| 740 | 764 | 'ok' => $txt['admin_browse_w_activate'], |
| 741 | 765 | 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], |
| 742 | 766 | 'delete' => $txt['admin_browse_w_delete'], |
| 743 | 767 | 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], |
| 744 | 768 | 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'], |
| 745 | 769 | ); |
| 770 | + } |
|
| 746 | 771 | |
| 747 | 772 | // Create an option list for actions allowed to be done with selected members. |
| 748 | 773 | $allowed_actions = ' |
| 749 | 774 | <option selected value="">' . $txt['admin_browse_with_selected'] . ':</option> |
| 750 | 775 | <option value="" disabled>-----------------------------</option>'; |
| 751 | - foreach ($context['allowed_actions'] as $key => $desc) |
|
| 752 | - $allowed_actions .= ' |
|
| 776 | + foreach ($context['allowed_actions'] as $key => $desc) { |
|
| 777 | + $allowed_actions .= ' |
|
| 753 | 778 | <option value="' . $key . '">' . $desc . '</option>'; |
| 779 | + } |
|
| 754 | 780 | |
| 755 | 781 | // Setup the Javascript function for selecting an action for the list. |
| 756 | 782 | $javascript = ' |
@@ -762,15 +788,16 @@ discard block |
||
| 762 | 788 | var message = "";'; |
| 763 | 789 | |
| 764 | 790 | // We have special messages for approving deletion of accounts - it's surprisingly logical - honest. |
| 765 | - if ($context['current_filter'] == 4) |
|
| 766 | - $javascript .= ' |
|
| 791 | + if ($context['current_filter'] == 4) { |
|
| 792 | + $javascript .= ' |
|
| 767 | 793 | if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
| 768 | 794 | message = "' . $txt['admin_browse_w_delete'] . '"; |
| 769 | 795 | else |
| 770 | 796 | message = "' . $txt['admin_browse_w_reject'] . '";'; |
| 797 | + } |
|
| 771 | 798 | // Otherwise a nice standard message. |
| 772 | - else |
|
| 773 | - $javascript .= ' |
|
| 799 | + else { |
|
| 800 | + $javascript .= ' |
|
| 774 | 801 | if (document.forms.postForm.todo.value.indexOf("delete") != -1) |
| 775 | 802 | message = "' . $txt['admin_browse_w_delete'] . '"; |
| 776 | 803 | else if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
@@ -779,6 +806,7 @@ discard block |
||
| 779 | 806 | message = "' . $txt['admin_browse_w_remind'] . '"; |
| 780 | 807 | else |
| 781 | 808 | message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";'; |
| 809 | + } |
|
| 782 | 810 | $javascript .= ' |
| 783 | 811 | if (confirm(message + " ' . $txt['admin_browse_warn'] . '")) |
| 784 | 812 | document.forms.postForm.submit(); |
@@ -911,10 +939,11 @@ discard block |
||
| 911 | 939 | $member_links = array(); |
| 912 | 940 | foreach ($rowData['duplicate_members'] as $member) |
| 913 | 941 | { |
| 914 | - if ($member['id']) |
|
| 915 | - $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
| 916 | - else |
|
| 917 | - $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
| 942 | + if ($member['id']) { |
|
| 943 | + $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
| 944 | + } else { |
|
| 945 | + $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
| 946 | + } |
|
| 918 | 947 | } |
| 919 | 948 | return implode(', ', $member_links); |
| 920 | 949 | }, |
@@ -963,14 +992,16 @@ discard block |
||
| 963 | 992 | ); |
| 964 | 993 | |
| 965 | 994 | // Pick what column to actually include if we're showing duplicates. |
| 966 | - if ($context['show_duplicates']) |
|
| 967 | - unset($listOptions['columns']['email']); |
|
| 968 | - else |
|
| 969 | - unset($listOptions['columns']['duplicates']); |
|
| 995 | + if ($context['show_duplicates']) { |
|
| 996 | + unset($listOptions['columns']['email']); |
|
| 997 | + } else { |
|
| 998 | + unset($listOptions['columns']['duplicates']); |
|
| 999 | + } |
|
| 970 | 1000 | |
| 971 | 1001 | // Only show hostname on duplicates as it takes a lot of time. |
| 972 | - if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) |
|
| 973 | - unset($listOptions['columns']['hostname']); |
|
| 1002 | + if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) { |
|
| 1003 | + unset($listOptions['columns']['hostname']); |
|
| 1004 | + } |
|
| 974 | 1005 | |
| 975 | 1006 | // Is there any need to show filters? |
| 976 | 1007 | if (isset($context['available_filters']) && count($context['available_filters']) > 1) |
@@ -978,9 +1009,10 @@ discard block |
||
| 978 | 1009 | $filterOptions = ' |
| 979 | 1010 | <strong>' . $txt['admin_browse_filter_by'] . ':</strong> |
| 980 | 1011 | <select name="filter" onchange="this.form.submit();">'; |
| 981 | - foreach ($context['available_filters'] as $filter) |
|
| 982 | - $filterOptions .= ' |
|
| 1012 | + foreach ($context['available_filters'] as $filter) { |
|
| 1013 | + $filterOptions .= ' |
|
| 983 | 1014 | <option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>'; |
| 1015 | + } |
|
| 984 | 1016 | $filterOptions .= ' |
| 985 | 1017 | </select> |
| 986 | 1018 | <noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button_submit"></noscript>'; |
@@ -992,12 +1024,13 @@ discard block |
||
| 992 | 1024 | } |
| 993 | 1025 | |
| 994 | 1026 | // What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at. |
| 995 | - if (!empty($context['show_filter']) && !empty($context['available_filters'])) |
|
| 996 | - $listOptions['additional_rows'][] = array( |
|
| 1027 | + if (!empty($context['show_filter']) && !empty($context['available_filters'])) { |
|
| 1028 | + $listOptions['additional_rows'][] = array( |
|
| 997 | 1029 | 'position' => 'above_column_headers', |
| 998 | 1030 | 'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'], |
| 999 | 1031 | 'class' => 'smalltext floatright', |
| 1000 | 1032 | ); |
| 1033 | + } |
|
| 1001 | 1034 | |
| 1002 | 1035 | // Now that we have all the options, create the list. |
| 1003 | 1036 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1027,12 +1060,14 @@ discard block |
||
| 1027 | 1060 | $current_filter = (int) $_REQUEST['orig_filter']; |
| 1028 | 1061 | |
| 1029 | 1062 | // If we are applying a filter do just that - then redirect. |
| 1030 | - if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) |
|
| 1031 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
| 1063 | + if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) { |
|
| 1064 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
| 1065 | + } |
|
| 1032 | 1066 | |
| 1033 | 1067 | // Nothing to do? |
| 1034 | - if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) |
|
| 1035 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1068 | + if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) { |
|
| 1069 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1070 | + } |
|
| 1036 | 1071 | |
| 1037 | 1072 | // Are we dealing with members who have been waiting for > set amount of time? |
| 1038 | 1073 | if (isset($_POST['time_passed'])) |
@@ -1045,8 +1080,9 @@ discard block |
||
| 1045 | 1080 | else |
| 1046 | 1081 | { |
| 1047 | 1082 | $members = array(); |
| 1048 | - foreach ($_POST['todoAction'] as $id) |
|
| 1049 | - $members[] = (int) $id; |
|
| 1083 | + foreach ($_POST['todoAction'] as $id) { |
|
| 1084 | + $members[] = (int) $id; |
|
| 1085 | + } |
|
| 1050 | 1086 | $condition = ' |
| 1051 | 1087 | AND id_member IN ({array_int:members})'; |
| 1052 | 1088 | } |
@@ -1067,8 +1103,9 @@ discard block |
||
| 1067 | 1103 | $member_count = $smcFunc['db_num_rows']($request); |
| 1068 | 1104 | |
| 1069 | 1105 | // If no results then just return! |
| 1070 | - if ($member_count == 0) |
|
| 1071 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1106 | + if ($member_count == 0) { |
|
| 1107 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
| 1108 | + } |
|
| 1072 | 1109 | |
| 1073 | 1110 | $member_info = array(); |
| 1074 | 1111 | $members = array(); |
@@ -1107,8 +1144,9 @@ discard block |
||
| 1107 | 1144 | // Do we have to let the integration code know about the activations? |
| 1108 | 1145 | if (!empty($modSettings['integrate_activate'])) |
| 1109 | 1146 | { |
| 1110 | - foreach ($member_info as $member) |
|
| 1111 | - call_integration_hook('integrate_activate', array($member['username'])); |
|
| 1147 | + foreach ($member_info as $member) { |
|
| 1148 | + call_integration_hook('integrate_activate', array($member['username'])); |
|
| 1149 | + } |
|
| 1112 | 1150 | } |
| 1113 | 1151 | |
| 1114 | 1152 | // Check for email. |
@@ -1238,20 +1276,23 @@ discard block |
||
| 1238 | 1276 | $log_action = $_POST['todo'] == 'remind' ? 'remind_member' : 'approve_member'; |
| 1239 | 1277 | |
| 1240 | 1278 | require_once($sourcedir . '/Logging.php'); |
| 1241 | - foreach ($member_info as $member) |
|
| 1242 | - logAction($log_action, array('member' => $member['id']), 'admin'); |
|
| 1279 | + foreach ($member_info as $member) { |
|
| 1280 | + logAction($log_action, array('member' => $member['id']), 'admin'); |
|
| 1281 | + } |
|
| 1243 | 1282 | } |
| 1244 | 1283 | |
| 1245 | 1284 | // Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers). |
| 1246 | - if (in_array($current_filter, array(3, 4, 5))) |
|
| 1247 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
| 1285 | + if (in_array($current_filter, array(3, 4, 5))) { |
|
| 1286 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
| 1287 | + } |
|
| 1248 | 1288 | |
| 1249 | 1289 | // Update the member's stats. (but, we know the member didn't change their name.) |
| 1250 | 1290 | updateStats('member', false); |
| 1251 | 1291 | |
| 1252 | 1292 | // If they haven't been deleted, update the post group statistics on them... |
| 1253 | - if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) |
|
| 1254 | - updateStats('postgroups', $members); |
|
| 1293 | + if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) { |
|
| 1294 | + updateStats('postgroups', $members); |
|
| 1295 | + } |
|
| 1255 | 1296 | |
| 1256 | 1297 | redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
| 1257 | 1298 | } |
@@ -1276,10 +1317,11 @@ discard block |
||
| 1276 | 1317 | $dis = time() - $old; |
| 1277 | 1318 | |
| 1278 | 1319 | // Before midnight? |
| 1279 | - if ($dis < $sinceMidnight) |
|
| 1280 | - return 0; |
|
| 1281 | - else |
|
| 1282 | - $dis -= $sinceMidnight; |
|
| 1320 | + if ($dis < $sinceMidnight) { |
|
| 1321 | + return 0; |
|
| 1322 | + } else { |
|
| 1323 | + $dis -= $sinceMidnight; |
|
| 1324 | + } |
|
| 1283 | 1325 | |
| 1284 | 1326 | // Divide out the seconds in a day to get the number of days. |
| 1285 | 1327 | return ceil($dis / (24 * 60 * 60)); |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * Original module by Mach8 - We'll never forget you. |
| 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 | * splits a topic into two topics. |
@@ -30,15 +31,17 @@ discard block |
||
| 30 | 31 | global $topic, $sourcedir; |
| 31 | 32 | |
| 32 | 33 | // And... which topic were you splitting, again? |
| 33 | - if (empty($topic)) |
|
| 34 | - fatal_lang_error('numbers_one_to_nine', false); |
|
| 34 | + if (empty($topic)) { |
|
| 35 | + fatal_lang_error('numbers_one_to_nine', false); |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | // Are you allowed to split topics? |
| 37 | 39 | isAllowedTo('split_any'); |
| 38 | 40 | |
| 39 | 41 | // Load up the "dependencies" - the template, getMsgMemberID(), and sendNotifications(). |
| 40 | - if (!isset($_REQUEST['xml'])) |
|
| 41 | - loadTemplate('SplitTopics'); |
|
| 42 | + if (!isset($_REQUEST['xml'])) { |
|
| 43 | + loadTemplate('SplitTopics'); |
|
| 44 | + } |
|
| 42 | 45 | require_once($sourcedir . '/Subs-Boards.php'); |
| 43 | 46 | require_once($sourcedir . '/Subs-Post.php'); |
| 44 | 47 | |
@@ -50,12 +53,12 @@ discard block |
||
| 50 | 53 | ); |
| 51 | 54 | |
| 52 | 55 | // ?action=splittopics;sa=LETSBREAKIT won't work, sorry. |
| 53 | - if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) |
|
| 54 | - SplitIndex(); |
|
| 55 | - |
|
| 56 | - else |
|
| 57 | - call_helper($subActions[$_REQUEST['sa']]); |
|
| 58 | -} |
|
| 56 | + if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) { |
|
| 57 | + SplitIndex(); |
|
| 58 | + } else { |
|
| 59 | + call_helper($subActions[$_REQUEST['sa']]); |
|
| 60 | + } |
|
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | /** |
| 61 | 64 | * screen shown before the actual split. |
@@ -71,8 +74,9 @@ discard block |
||
| 71 | 74 | global $txt, $topic, $context, $smcFunc, $modSettings; |
| 72 | 75 | |
| 73 | 76 | // Validate "at". |
| 74 | - if (empty($_GET['at'])) |
|
| 75 | - fatal_lang_error('numbers_one_to_nine', false); |
|
| 77 | + if (empty($_GET['at'])) { |
|
| 78 | + fatal_lang_error('numbers_one_to_nine', false); |
|
| 79 | + } |
|
| 76 | 80 | $_GET['at'] = (int) $_GET['at']; |
| 77 | 81 | |
| 78 | 82 | // Retrieve the subject and stuff of the specific topic/message. |
@@ -89,26 +93,31 @@ discard block |
||
| 89 | 93 | 'split_at' => $_GET['at'], |
| 90 | 94 | ) |
| 91 | 95 | ); |
| 92 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 93 | - fatal_lang_error('cant_find_messages'); |
|
| 96 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 97 | + fatal_lang_error('cant_find_messages'); |
|
| 98 | + } |
|
| 94 | 99 | list ($_REQUEST['subname'], $num_replies, $unapproved_posts, $id_first_msg, $approved) = $smcFunc['db_fetch_row']($request); |
| 95 | 100 | $smcFunc['db_free_result']($request); |
| 96 | 101 | |
| 97 | 102 | // If not approved validate they can see it. |
| 98 | - if ($modSettings['postmod_active'] && !$approved) |
|
| 99 | - isAllowedTo('approve_posts'); |
|
| 103 | + if ($modSettings['postmod_active'] && !$approved) { |
|
| 104 | + isAllowedTo('approve_posts'); |
|
| 105 | + } |
|
| 100 | 106 | |
| 101 | 107 | // If this topic has unapproved posts, we need to count them too... |
| 102 | - if ($modSettings['postmod_active'] && allowedTo('approve_posts')) |
|
| 103 | - $num_replies += $unapproved_posts - ($approved ? 0 : 1); |
|
| 108 | + if ($modSettings['postmod_active'] && allowedTo('approve_posts')) { |
|
| 109 | + $num_replies += $unapproved_posts - ($approved ? 0 : 1); |
|
| 110 | + } |
|
| 104 | 111 | |
| 105 | 112 | // Check if there is more than one message in the topic. (there should be.) |
| 106 | - if ($num_replies < 1) |
|
| 107 | - fatal_lang_error('topic_one_post', false); |
|
| 113 | + if ($num_replies < 1) { |
|
| 114 | + fatal_lang_error('topic_one_post', false); |
|
| 115 | + } |
|
| 108 | 116 | |
| 109 | 117 | // Check if this is the first message in the topic (if so, the first and second option won't be available) |
| 110 | - if ($id_first_msg == $_GET['at']) |
|
| 111 | - return SplitSelectTopics(); |
|
| 118 | + if ($id_first_msg == $_GET['at']) { |
|
| 119 | + return SplitSelectTopics(); |
|
| 120 | + } |
|
| 112 | 121 | |
| 113 | 122 | // Basic template information.... |
| 114 | 123 | $context['message'] = array( |
@@ -137,8 +146,9 @@ discard block |
||
| 137 | 146 | checkSession(); |
| 138 | 147 | |
| 139 | 148 | // Clean up the subject. |
| 140 | - if (!isset($_POST['subname']) || $_POST['subname'] == '') |
|
| 141 | - $_POST['subname'] = $txt['new_topic']; |
|
| 149 | + if (!isset($_POST['subname']) || $_POST['subname'] == '') { |
|
| 150 | + $_POST['subname'] = $txt['new_topic']; |
|
| 151 | + } |
|
| 142 | 152 | |
| 143 | 153 | // Redirect to the selector if they chose selective. |
| 144 | 154 | if ($_POST['step2'] == 'selective') |
@@ -163,16 +173,19 @@ discard block |
||
| 163 | 173 | 'split_at' => $_POST['at'], |
| 164 | 174 | ) |
| 165 | 175 | ); |
| 166 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 167 | - $messagesToBeSplit[] = $row['id_msg']; |
|
| 176 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 177 | + $messagesToBeSplit[] = $row['id_msg']; |
|
| 178 | + } |
|
| 168 | 179 | $smcFunc['db_free_result']($request); |
| 169 | 180 | } |
| 170 | 181 | // Only the selected message has to be split. That should be easy. |
| 171 | - elseif ($_POST['step2'] == 'onlythis') |
|
| 172 | - $messagesToBeSplit[] = $_POST['at']; |
|
| 182 | + elseif ($_POST['step2'] == 'onlythis') { |
|
| 183 | + $messagesToBeSplit[] = $_POST['at']; |
|
| 184 | + } |
|
| 173 | 185 | // There's another action?! |
| 174 | - else |
|
| 175 | - fatal_lang_error('no_access', false); |
|
| 186 | + else { |
|
| 187 | + fatal_lang_error('no_access', false); |
|
| 188 | + } |
|
| 176 | 189 | |
| 177 | 190 | $context['old_topic'] = $topic; |
| 178 | 191 | $context['new_topic'] = splitTopic($topic, $messagesToBeSplit, $_POST['subname']); |
@@ -199,8 +212,9 @@ discard block |
||
| 199 | 212 | $_SESSION['split_selection'][$topic] = empty($_SESSION['split_selection'][$topic]) ? array() : $_SESSION['split_selection'][$topic]; |
| 200 | 213 | |
| 201 | 214 | // This is a special case for split topics from quick-moderation checkboxes |
| 202 | - if (isset($_REQUEST['subname_enc'])) |
|
| 203 | - $_REQUEST['subname'] = urldecode($_REQUEST['subname_enc']); |
|
| 215 | + if (isset($_REQUEST['subname_enc'])) { |
|
| 216 | + $_REQUEST['subname'] = urldecode($_REQUEST['subname_enc']); |
|
| 217 | + } |
|
| 204 | 218 | |
| 205 | 219 | $context['not_selected'] = array( |
| 206 | 220 | 'num_messages' => 0, |
@@ -252,10 +266,12 @@ discard block |
||
| 252 | 266 | ) |
| 253 | 267 | ); |
| 254 | 268 | // You can't split the last message off. |
| 255 | - if (empty($context['not_selected']['start']) && $smcFunc['db_num_rows']($request) <= 1 && $_REQUEST['move'] == 'down') |
|
| 256 | - $_REQUEST['move'] = ''; |
|
| 257 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 258 | - $original_msgs['not_selected'][] = $row['id_msg']; |
|
| 269 | + if (empty($context['not_selected']['start']) && $smcFunc['db_num_rows']($request) <= 1 && $_REQUEST['move'] == 'down') { |
|
| 270 | + $_REQUEST['move'] = ''; |
|
| 271 | + } |
|
| 272 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 273 | + $original_msgs['not_selected'][] = $row['id_msg']; |
|
| 274 | + } |
|
| 259 | 275 | $smcFunc['db_free_result']($request); |
| 260 | 276 | if (!empty($_SESSION['split_selection'][$topic])) |
| 261 | 277 | { |
@@ -275,8 +291,9 @@ discard block |
||
| 275 | 291 | 'messages_per_page' => $context['messages_per_page'], |
| 276 | 292 | ) |
| 277 | 293 | ); |
| 278 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 279 | - $original_msgs['selected'][] = $row['id_msg']; |
|
| 294 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 295 | + $original_msgs['selected'][] = $row['id_msg']; |
|
| 296 | + } |
|
| 280 | 297 | $smcFunc['db_free_result']($request); |
| 281 | 298 | } |
| 282 | 299 | } |
@@ -286,12 +303,13 @@ discard block |
||
| 286 | 303 | { |
| 287 | 304 | $_REQUEST['msg'] = (int) $_REQUEST['msg']; |
| 288 | 305 | |
| 289 | - if ($_REQUEST['move'] == 'reset') |
|
| 290 | - $_SESSION['split_selection'][$topic] = array(); |
|
| 291 | - elseif ($_REQUEST['move'] == 'up') |
|
| 292 | - $_SESSION['split_selection'][$topic] = array_diff($_SESSION['split_selection'][$topic], array($_REQUEST['msg'])); |
|
| 293 | - else |
|
| 294 | - $_SESSION['split_selection'][$topic][] = $_REQUEST['msg']; |
|
| 306 | + if ($_REQUEST['move'] == 'reset') { |
|
| 307 | + $_SESSION['split_selection'][$topic] = array(); |
|
| 308 | + } elseif ($_REQUEST['move'] == 'up') { |
|
| 309 | + $_SESSION['split_selection'][$topic] = array_diff($_SESSION['split_selection'][$topic], array($_REQUEST['msg'])); |
|
| 310 | + } else { |
|
| 311 | + $_SESSION['split_selection'][$topic][] = $_REQUEST['msg']; |
|
| 312 | + } |
|
| 295 | 313 | } |
| 296 | 314 | |
| 297 | 315 | // Make sure the selection is still accurate. |
@@ -310,8 +328,9 @@ discard block |
||
| 310 | 328 | ) |
| 311 | 329 | ); |
| 312 | 330 | $_SESSION['split_selection'][$topic] = array(); |
| 313 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 314 | - $_SESSION['split_selection'][$topic][] = $row['id_msg']; |
|
| 331 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 332 | + $_SESSION['split_selection'][$topic][] = $row['id_msg']; |
|
| 333 | + } |
|
| 315 | 334 | $smcFunc['db_free_result']($request); |
| 316 | 335 | } |
| 317 | 336 | |
@@ -328,13 +347,15 @@ discard block |
||
| 328 | 347 | 'is_approved' => 1, |
| 329 | 348 | ) |
| 330 | 349 | ); |
| 331 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 332 | - $context[empty($row['is_selected']) || $row['is_selected'] == 'f' ? 'not_selected' : 'selected']['num_messages'] = $row['num_messages']; |
|
| 350 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 351 | + $context[empty($row['is_selected']) || $row['is_selected'] == 'f' ? 'not_selected' : 'selected']['num_messages'] = $row['num_messages']; |
|
| 352 | + } |
|
| 333 | 353 | $smcFunc['db_free_result']($request); |
| 334 | 354 | |
| 335 | 355 | // Fix an oversized starting page (to make sure both pageindexes are properly set). |
| 336 | - if ($context['selected']['start'] >= $context['selected']['num_messages']) |
|
| 337 | - $context['selected']['start'] = $context['selected']['num_messages'] <= $context['messages_per_page'] ? 0 : ($context['selected']['num_messages'] - (($context['selected']['num_messages'] % $context['messages_per_page']) == 0 ? $context['messages_per_page'] : ($context['selected']['num_messages'] % $context['messages_per_page']))); |
|
| 356 | + if ($context['selected']['start'] >= $context['selected']['num_messages']) { |
|
| 357 | + $context['selected']['start'] = $context['selected']['num_messages'] <= $context['messages_per_page'] ? 0 : ($context['selected']['num_messages'] - (($context['selected']['num_messages'] % $context['messages_per_page']) == 0 ? $context['messages_per_page'] : ($context['selected']['num_messages'] % $context['messages_per_page']))); |
|
| 358 | + } |
|
| 338 | 359 | |
| 339 | 360 | // Build a page list of the not-selected topics... |
| 340 | 361 | $context['not_selected']['page_index'] = constructPageIndex($scripturl . '?action=splittopics;sa=selectTopics;subname=' . strtr(urlencode($_REQUEST['subname']), array('%' => '%%')) . ';topic=' . $topic . '.%1$d;start2=' . $context['selected']['start'], $context['not_selected']['start'], $context['not_selected']['num_messages'], $context['messages_per_page'], true); |
@@ -434,11 +455,12 @@ discard block |
||
| 434 | 455 | ); |
| 435 | 456 | |
| 436 | 457 | $context['changes'] = array(); |
| 437 | - foreach ($changes as $change_type => $change_array) |
|
| 438 | - foreach ($change_array as $section => $msg_array) |
|
| 458 | + foreach ($changes as $change_type => $change_array) { |
|
| 459 | + foreach ($change_array as $section => $msg_array) |
|
| 439 | 460 | { |
| 440 | 461 | if (empty($msg_array)) |
| 441 | 462 | continue; |
| 463 | + } |
|
| 442 | 464 | |
| 443 | 465 | foreach ($msg_array as $id_msg) |
| 444 | 466 | { |
@@ -447,8 +469,9 @@ discard block |
||
| 447 | 469 | 'type' => $change_type, |
| 448 | 470 | 'section' => $section, |
| 449 | 471 | ); |
| 450 | - if ($change_type == 'insert') |
|
| 451 | - $context['changes']['insert' . $id_msg]['insert_value'] = $context[$section]['messages'][$id_msg]; |
|
| 472 | + if ($change_type == 'insert') { |
|
| 473 | + $context['changes']['insert' . $id_msg]['insert_value'] = $context[$section]['messages'][$id_msg]; |
|
| 474 | + } |
|
| 452 | 475 | } |
| 453 | 476 | } |
| 454 | 477 | } |
@@ -468,12 +491,14 @@ discard block |
||
| 468 | 491 | checkSession(); |
| 469 | 492 | |
| 470 | 493 | // Default the subject in case it's blank. |
| 471 | - if (!isset($_POST['subname']) || $_POST['subname'] == '') |
|
| 472 | - $_POST['subname'] = $txt['new_topic']; |
|
| 494 | + if (!isset($_POST['subname']) || $_POST['subname'] == '') { |
|
| 495 | + $_POST['subname'] = $txt['new_topic']; |
|
| 496 | + } |
|
| 473 | 497 | |
| 474 | 498 | // You must've selected some messages! Can't split out none! |
| 475 | - if (empty($_SESSION['split_selection'][$topic])) |
|
| 476 | - fatal_lang_error('no_posts_selected', false); |
|
| 499 | + if (empty($_SESSION['split_selection'][$topic])) { |
|
| 500 | + fatal_lang_error('no_posts_selected', false); |
|
| 501 | + } |
|
| 477 | 502 | |
| 478 | 503 | $context['old_topic'] = $topic; |
| 479 | 504 | $context['new_topic'] = splitTopic($topic, $_SESSION['split_selection'][$topic], $_POST['subname']); |
@@ -499,8 +524,9 @@ discard block |
||
| 499 | 524 | global $smcFunc, $txt, $sourcedir; |
| 500 | 525 | |
| 501 | 526 | // Nothing to split? |
| 502 | - if (empty($splitMessages)) |
|
| 503 | - fatal_lang_error('no_posts_selected', false); |
|
| 527 | + if (empty($splitMessages)) { |
|
| 528 | + fatal_lang_error('no_posts_selected', false); |
|
| 529 | + } |
|
| 504 | 530 | |
| 505 | 531 | // Get some board info. |
| 506 | 532 | $request = $smcFunc['db_query']('', ' |
@@ -532,8 +558,9 @@ discard block |
||
| 532 | 558 | ) |
| 533 | 559 | ); |
| 534 | 560 | // You can't select ALL the messages! |
| 535 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 536 | - fatal_lang_error('selected_all_posts', false); |
|
| 561 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 562 | + fatal_lang_error('selected_all_posts', false); |
|
| 563 | + } |
|
| 537 | 564 | |
| 538 | 565 | $split1_first_msg = null; |
| 539 | 566 | $split1_last_msg = null; |
@@ -541,24 +568,27 @@ discard block |
||
| 541 | 568 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 542 | 569 | { |
| 543 | 570 | // Get the right first and last message dependant on approved state... |
| 544 | - if (empty($split1_first_msg) || $row['myid_first_msg'] < $split1_first_msg) |
|
| 545 | - $split1_first_msg = $row['myid_first_msg']; |
|
| 546 | - if (empty($split1_last_msg) || $row['approved']) |
|
| 547 | - $split1_last_msg = $row['myid_last_msg']; |
|
| 571 | + if (empty($split1_first_msg) || $row['myid_first_msg'] < $split1_first_msg) { |
|
| 572 | + $split1_first_msg = $row['myid_first_msg']; |
|
| 573 | + } |
|
| 574 | + if (empty($split1_last_msg) || $row['approved']) { |
|
| 575 | + $split1_last_msg = $row['myid_last_msg']; |
|
| 576 | + } |
|
| 548 | 577 | |
| 549 | 578 | // Get the counts correct... |
| 550 | 579 | if ($row['approved']) |
| 551 | 580 | { |
| 552 | 581 | $split1_replies = $row['message_count'] - 1; |
| 553 | 582 | $split1_unapprovedposts = 0; |
| 554 | - } |
|
| 555 | - else |
|
| 583 | + } else |
|
| 556 | 584 | { |
| 557 | - if (!isset($split1_replies)) |
|
| 558 | - $split1_replies = 0; |
|
| 585 | + if (!isset($split1_replies)) { |
|
| 586 | + $split1_replies = 0; |
|
| 587 | + } |
|
| 559 | 588 | // If the topic isn't approved then num replies must go up by one... as first post wouldn't be counted. |
| 560 | - elseif (!$split1_approved) |
|
| 561 | - $split1_replies++; |
|
| 589 | + elseif (!$split1_approved) { |
|
| 590 | + $split1_replies++; |
|
| 591 | + } |
|
| 562 | 592 | |
| 563 | 593 | $split1_unapprovedposts = $row['message_count']; |
| 564 | 594 | } |
@@ -584,10 +614,12 @@ discard block |
||
| 584 | 614 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 585 | 615 | { |
| 586 | 616 | // As before get the right first and last message dependant on approved state... |
| 587 | - if (empty($split2_first_msg) || $row['myid_first_msg'] < $split2_first_msg) |
|
| 588 | - $split2_first_msg = $row['myid_first_msg']; |
|
| 589 | - if (empty($split2_last_msg) || $row['approved']) |
|
| 590 | - $split2_last_msg = $row['myid_last_msg']; |
|
| 617 | + if (empty($split2_first_msg) || $row['myid_first_msg'] < $split2_first_msg) { |
|
| 618 | + $split2_first_msg = $row['myid_first_msg']; |
|
| 619 | + } |
|
| 620 | + if (empty($split2_last_msg) || $row['approved']) { |
|
| 621 | + $split2_last_msg = $row['myid_last_msg']; |
|
| 622 | + } |
|
| 591 | 623 | |
| 592 | 624 | // Then do the counts again... |
| 593 | 625 | if ($row['approved']) |
@@ -595,18 +627,20 @@ discard block |
||
| 595 | 627 | $split2_approved = true; |
| 596 | 628 | $split2_replies = $row['message_count'] - 1; |
| 597 | 629 | $split2_unapprovedposts = 0; |
| 598 | - } |
|
| 599 | - else |
|
| 630 | + } else |
|
| 600 | 631 | { |
| 601 | 632 | // Should this one be approved?? |
| 602 | - if ($split2_first_msg == $row['myid_first_msg']) |
|
| 603 | - $split2_approved = false; |
|
| 633 | + if ($split2_first_msg == $row['myid_first_msg']) { |
|
| 634 | + $split2_approved = false; |
|
| 635 | + } |
|
| 604 | 636 | |
| 605 | - if (!isset($split2_replies)) |
|
| 606 | - $split2_replies = 0; |
|
| 637 | + if (!isset($split2_replies)) { |
|
| 638 | + $split2_replies = 0; |
|
| 639 | + } |
|
| 607 | 640 | // As before, fix number of replies. |
| 608 | - elseif (!$split2_approved) |
|
| 609 | - $split2_replies++; |
|
| 641 | + elseif (!$split2_approved) { |
|
| 642 | + $split2_replies++; |
|
| 643 | + } |
|
| 610 | 644 | |
| 611 | 645 | $split2_unapprovedposts = $row['message_count']; |
| 612 | 646 | } |
@@ -616,12 +650,14 @@ discard block |
||
| 616 | 650 | $split2_lastMem = getMsgMemberID($split2_last_msg); |
| 617 | 651 | |
| 618 | 652 | // No database changes yet, so let's double check to see if everything makes at least a little sense. |
| 619 | - if ($split1_first_msg <= 0 || $split1_last_msg <= 0 || $split2_first_msg <= 0 || $split2_last_msg <= 0 || $split1_replies < 0 || $split2_replies < 0 || $split1_unapprovedposts < 0 || $split2_unapprovedposts < 0 || !isset($split1_approved) || !isset($split2_approved)) |
|
| 620 | - fatal_lang_error('cant_find_messages'); |
|
| 653 | + if ($split1_first_msg <= 0 || $split1_last_msg <= 0 || $split2_first_msg <= 0 || $split2_last_msg <= 0 || $split1_replies < 0 || $split2_replies < 0 || $split1_unapprovedposts < 0 || $split2_unapprovedposts < 0 || !isset($split1_approved) || !isset($split2_approved)) { |
|
| 654 | + fatal_lang_error('cant_find_messages'); |
|
| 655 | + } |
|
| 621 | 656 | |
| 622 | 657 | // You cannot split off the first message of a topic. |
| 623 | - if ($split1_first_msg > $split2_first_msg) |
|
| 624 | - fatal_lang_error('split_first_post', false); |
|
| 658 | + if ($split1_first_msg > $split2_first_msg) { |
|
| 659 | + fatal_lang_error('split_first_post', false); |
|
| 660 | + } |
|
| 625 | 661 | |
| 626 | 662 | // We're off to insert the new topic! Use 0 for now to avoid UNIQUE errors. |
| 627 | 663 | $split2_ID_TOPIC = $smcFunc['db_insert']('', |
@@ -644,14 +680,16 @@ discard block |
||
| 644 | 680 | array('id_topic'), |
| 645 | 681 | 1 |
| 646 | 682 | ); |
| 647 | - if ($split2_ID_TOPIC <= 0) |
|
| 648 | - fatal_lang_error('cant_insert_topic'); |
|
| 683 | + if ($split2_ID_TOPIC <= 0) { |
|
| 684 | + fatal_lang_error('cant_insert_topic'); |
|
| 685 | + } |
|
| 649 | 686 | |
| 650 | 687 | // Move the messages over to the other topic. |
| 651 | 688 | $new_subject = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($new_subject)), array("\r" => '', "\n" => '', "\t" => '')); |
| 652 | 689 | // Check the subject length. |
| 653 | - if ($smcFunc['strlen']($new_subject) > 100) |
|
| 654 | - $new_subject = $smcFunc['substr']($new_subject, 0, 100); |
|
| 690 | + if ($smcFunc['strlen']($new_subject) > 100) { |
|
| 691 | + $new_subject = $smcFunc['substr']($new_subject, 0, 100); |
|
| 692 | + } |
|
| 655 | 693 | // Valid subject? |
| 656 | 694 | if ($new_subject != '') |
| 657 | 695 | { |
@@ -722,8 +760,8 @@ discard block |
||
| 722 | 760 | ); |
| 723 | 761 | |
| 724 | 762 | // If the new topic isn't approved ensure the first message flags this just in case. |
| 725 | - if (!$split2_approved) |
|
| 726 | - $smcFunc['db_query']('', ' |
|
| 763 | + if (!$split2_approved) { |
|
| 764 | + $smcFunc['db_query']('', ' |
|
| 727 | 765 | UPDATE {db_prefix}messages |
| 728 | 766 | SET approved = {int:approved} |
| 729 | 767 | WHERE id_msg = {int:id_msg} |
@@ -734,6 +772,7 @@ discard block |
||
| 734 | 772 | 'id_topic' => $split2_ID_TOPIC, |
| 735 | 773 | ) |
| 736 | 774 | ); |
| 775 | + } |
|
| 737 | 776 | |
| 738 | 777 | // The board has more topics now (Or more unapproved ones!). |
| 739 | 778 | $smcFunc['db_query']('', ' |
@@ -760,8 +799,9 @@ discard block |
||
| 760 | 799 | if ($smcFunc['db_num_rows']($request) > 0) |
| 761 | 800 | { |
| 762 | 801 | $replaceEntries = array(); |
| 763 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 764 | - $replaceEntries[] = array($row['id_member'], $split2_ID_TOPIC, $row['id_msg'], $row['unwatched']); |
|
| 802 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 803 | + $replaceEntries[] = array($row['id_member'], $split2_ID_TOPIC, $row['id_msg'], $row['unwatched']); |
|
| 804 | + } |
|
| 765 | 805 | |
| 766 | 806 | $smcFunc['db_insert']('ignore', |
| 767 | 807 | '{db_prefix}log_topics', |
@@ -785,8 +825,9 @@ discard block |
||
| 785 | 825 | // If there's a search index that needs updating, update it... |
| 786 | 826 | require_once($sourcedir . '/Search.php'); |
| 787 | 827 | $searchAPI = findSearchAPI(); |
| 788 | - if (is_callable(array($searchAPI, 'topicSplit'))) |
|
| 789 | - $searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages); |
|
| 828 | + if (is_callable(array($searchAPI, 'topicSplit'))) { |
|
| 829 | + $searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages); |
|
| 830 | + } |
|
| 790 | 831 | |
| 791 | 832 | // Maybe we want to let an external CMS know about this split |
| 792 | 833 | $split1 = array( |
@@ -833,12 +874,12 @@ discard block |
||
| 833 | 874 | ); |
| 834 | 875 | |
| 835 | 876 | // ?action=mergetopics;sa=LETSBREAKIT won't work, sorry. |
| 836 | - if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) |
|
| 837 | - MergeIndex(); |
|
| 838 | - |
|
| 839 | - else |
|
| 840 | - call_helper($subActions[$_REQUEST['sa']]); |
|
| 841 | -} |
|
| 877 | + if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) { |
|
| 878 | + MergeIndex(); |
|
| 879 | + } else { |
|
| 880 | + call_helper($subActions[$_REQUEST['sa']]); |
|
| 881 | + } |
|
| 882 | + } |
|
| 842 | 883 | |
| 843 | 884 | /** |
| 844 | 885 | * allows to pick a topic to merge the current topic with. |
@@ -852,8 +893,9 @@ discard block |
||
| 852 | 893 | global $txt, $board, $context, $smcFunc, $sourcedir; |
| 853 | 894 | global $scripturl, $modSettings; |
| 854 | 895 | |
| 855 | - if (!isset($_GET['from'])) |
|
| 856 | - fatal_lang_error('no_access', false); |
|
| 896 | + if (!isset($_GET['from'])) { |
|
| 897 | + fatal_lang_error('no_access', false); |
|
| 898 | + } |
|
| 857 | 899 | $_GET['from'] = (int) $_GET['from']; |
| 858 | 900 | |
| 859 | 901 | $_REQUEST['targetboard'] = isset($_REQUEST['targetboard']) ? (int) $_REQUEST['targetboard'] : $board; |
@@ -864,9 +906,9 @@ discard block |
||
| 864 | 906 | { |
| 865 | 907 | $can_approve_boards = boardsAllowedTo('approve_posts'); |
| 866 | 908 | $onlyApproved = $can_approve_boards !== array(0) && !in_array($_REQUEST['targetboard'], $can_approve_boards); |
| 909 | + } else { |
|
| 910 | + $onlyApproved = false; |
|
| 867 | 911 | } |
| 868 | - else |
|
| 869 | - $onlyApproved = false; |
|
| 870 | 912 | |
| 871 | 913 | // How many topics are on this board? (used for paging.) |
| 872 | 914 | $request = $smcFunc['db_query']('', ' |
@@ -900,8 +942,9 @@ discard block |
||
| 900 | 942 | 'is_approved' => 1, |
| 901 | 943 | ) |
| 902 | 944 | ); |
| 903 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 904 | - fatal_lang_error('no_board'); |
|
| 945 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 946 | + fatal_lang_error('no_board'); |
|
| 947 | + } |
|
| 905 | 948 | list ($subject) = $smcFunc['db_fetch_row']($request); |
| 906 | 949 | $smcFunc['db_free_result']($request); |
| 907 | 950 | |
@@ -914,8 +957,9 @@ discard block |
||
| 914 | 957 | // Check which boards you have merge permissions on. |
| 915 | 958 | $merge_boards = boardsAllowedTo('merge_any'); |
| 916 | 959 | |
| 917 | - if (empty($merge_boards)) |
|
| 918 | - fatal_lang_error('cannot_merge_any', 'user'); |
|
| 960 | + if (empty($merge_boards)) { |
|
| 961 | + fatal_lang_error('cannot_merge_any', 'user'); |
|
| 962 | + } |
|
| 919 | 963 | |
| 920 | 964 | // No sense in loading this if you can only merge on this board |
| 921 | 965 | if (count($merge_boards) > 1 || in_array(0, $merge_boards)) |
@@ -929,8 +973,9 @@ discard block |
||
| 929 | 973 | ); |
| 930 | 974 | |
| 931 | 975 | // Only include these boards in the list (0 means you're an admin') |
| 932 | - if (!in_array(0, $merge_boards)) |
|
| 933 | - $options['included_boards'] = $merge_boards; |
|
| 976 | + if (!in_array(0, $merge_boards)) { |
|
| 977 | + $options['included_boards'] = $merge_boards; |
|
| 978 | + } |
|
| 934 | 979 | |
| 935 | 980 | $context['merge_categories'] = getBoardList($options); |
| 936 | 981 | } |
@@ -976,8 +1021,9 @@ discard block |
||
| 976 | 1021 | } |
| 977 | 1022 | $smcFunc['db_free_result']($request); |
| 978 | 1023 | |
| 979 | - if (empty($context['topics']) && count($merge_boards) <= 1 && !in_array(0, $merge_boards)) |
|
| 980 | - fatal_lang_error('merge_need_more_topics'); |
|
| 1024 | + if (empty($context['topics']) && count($merge_boards) <= 1 && !in_array(0, $merge_boards)) { |
|
| 1025 | + fatal_lang_error('merge_need_more_topics'); |
|
| 1026 | + } |
|
| 981 | 1027 | |
| 982 | 1028 | $context['sub_template'] = 'merge'; |
| 983 | 1029 | } |
@@ -1007,24 +1053,29 @@ discard block |
||
| 1007 | 1053 | checkSession('request'); |
| 1008 | 1054 | |
| 1009 | 1055 | // Handle URLs from MergeIndex. |
| 1010 | - if (!empty($_GET['from']) && !empty($_GET['to'])) |
|
| 1011 | - $topics = array((int) $_GET['from'], (int) $_GET['to']); |
|
| 1056 | + if (!empty($_GET['from']) && !empty($_GET['to'])) { |
|
| 1057 | + $topics = array((int) $_GET['from'], (int) $_GET['to']); |
|
| 1058 | + } |
|
| 1012 | 1059 | |
| 1013 | 1060 | // If we came from a form, the topic IDs came by post. |
| 1014 | - if (!empty($_POST['topics']) && is_array($_POST['topics'])) |
|
| 1015 | - $topics = $_POST['topics']; |
|
| 1061 | + if (!empty($_POST['topics']) && is_array($_POST['topics'])) { |
|
| 1062 | + $topics = $_POST['topics']; |
|
| 1063 | + } |
|
| 1016 | 1064 | |
| 1017 | 1065 | // There's nothing to merge with just one topic... |
| 1018 | - if (empty($topics) || !is_array($topics) || count($topics) == 1) |
|
| 1019 | - fatal_lang_error('merge_need_more_topics'); |
|
| 1066 | + if (empty($topics) || !is_array($topics) || count($topics) == 1) { |
|
| 1067 | + fatal_lang_error('merge_need_more_topics'); |
|
| 1068 | + } |
|
| 1020 | 1069 | |
| 1021 | 1070 | // Make sure every topic is numeric, or some nasty things could be done with the DB. |
| 1022 | - foreach ($topics as $id => $topic) |
|
| 1023 | - $topics[$id] = (int) $topic; |
|
| 1071 | + foreach ($topics as $id => $topic) { |
|
| 1072 | + $topics[$id] = (int) $topic; |
|
| 1073 | + } |
|
| 1024 | 1074 | |
| 1025 | 1075 | // Joy of all joys, make sure they're not messing about with unapproved topics they can't see :P |
| 1026 | - if ($modSettings['postmod_active']) |
|
| 1027 | - $can_approve_boards = boardsAllowedTo('approve_posts'); |
|
| 1076 | + if ($modSettings['postmod_active']) { |
|
| 1077 | + $can_approve_boards = boardsAllowedTo('approve_posts'); |
|
| 1078 | + } |
|
| 1028 | 1079 | |
| 1029 | 1080 | // Get info about the topics and polls that will be merged. |
| 1030 | 1081 | $request = $smcFunc['db_query']('', ' |
@@ -1045,8 +1096,9 @@ discard block |
||
| 1045 | 1096 | 'limit' => count($topics), |
| 1046 | 1097 | ) |
| 1047 | 1098 | ); |
| 1048 | - if ($smcFunc['db_num_rows']($request) < 2) |
|
| 1049 | - fatal_lang_error('no_topic_id'); |
|
| 1099 | + if ($smcFunc['db_num_rows']($request) < 2) { |
|
| 1100 | + fatal_lang_error('no_topic_id'); |
|
| 1101 | + } |
|
| 1050 | 1102 | $num_views = 0; |
| 1051 | 1103 | $is_sticky = 0; |
| 1052 | 1104 | $boardTotals = array(); |
@@ -1059,34 +1111,38 @@ discard block |
||
| 1059 | 1111 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1060 | 1112 | { |
| 1061 | 1113 | // Sorry, redirection topics can't be merged |
| 1062 | - if (!empty($row['id_redirect_topic'])) |
|
| 1063 | - fatal_lang_error('cannot_merge_redirect', false); |
|
| 1114 | + if (!empty($row['id_redirect_topic'])) { |
|
| 1115 | + fatal_lang_error('cannot_merge_redirect', false); |
|
| 1116 | + } |
|
| 1064 | 1117 | |
| 1065 | 1118 | // Make a note for the board counts... |
| 1066 | - if (!isset($boardTotals[$row['id_board']])) |
|
| 1067 | - $boardTotals[$row['id_board']] = array( |
|
| 1119 | + if (!isset($boardTotals[$row['id_board']])) { |
|
| 1120 | + $boardTotals[$row['id_board']] = array( |
|
| 1068 | 1121 | 'posts' => 0, |
| 1069 | 1122 | 'topics' => 0, |
| 1070 | 1123 | 'unapproved_posts' => 0, |
| 1071 | 1124 | 'unapproved_topics' => 0 |
| 1072 | 1125 | ); |
| 1126 | + } |
|
| 1073 | 1127 | |
| 1074 | 1128 | // We can't see unapproved topics here? |
| 1075 | 1129 | if ($modSettings['postmod_active'] && !$row['approved'] && $can_approve_boards != array(0) && in_array($row['id_board'], $can_approve_boards)) |
| 1076 | 1130 | { |
| 1077 | 1131 | unset($topics[$row['id_topic']]); // If we can't see it, we should not merge it and not adjust counts! Instead skip it. |
| 1078 | 1132 | continue; |
| 1079 | - }elseif (!$row['approved']) |
|
| 1080 | - $boardTotals[$row['id_board']]['unapproved_topics']++; |
|
| 1081 | - else |
|
| 1082 | - $boardTotals[$row['id_board']]['topics']++; |
|
| 1133 | + } elseif (!$row['approved']) { |
|
| 1134 | + $boardTotals[$row['id_board']]['unapproved_topics']++; |
|
| 1135 | + } else { |
|
| 1136 | + $boardTotals[$row['id_board']]['topics']++; |
|
| 1137 | + } |
|
| 1083 | 1138 | |
| 1084 | 1139 | $boardTotals[$row['id_board']]['unapproved_posts'] += $row['unapproved_posts']; |
| 1085 | 1140 | $boardTotals[$row['id_board']]['posts'] += $row['num_replies'] + ($row['approved'] ? 1 : 0); |
| 1086 | 1141 | |
| 1087 | 1142 | // In the case of making a redirect, the topic count goes up by one due to the redirect topic. |
| 1088 | - if (isset($_POST['postRedirect'])) |
|
| 1089 | - $boardTotals[$row['id_board']]['topics']--; |
|
| 1143 | + if (isset($_POST['postRedirect'])) { |
|
| 1144 | + $boardTotals[$row['id_board']]['topics']--; |
|
| 1145 | + } |
|
| 1090 | 1146 | |
| 1091 | 1147 | $topic_data[$row['id_topic']] = array( |
| 1092 | 1148 | 'id' => $row['id_topic'], |
@@ -1112,11 +1168,13 @@ discard block |
||
| 1112 | 1168 | $boards[] = $row['id_board']; |
| 1113 | 1169 | |
| 1114 | 1170 | // If there's no poll, id_poll == 0... |
| 1115 | - if ($row['id_poll'] > 0) |
|
| 1116 | - $polls[] = $row['id_poll']; |
|
| 1171 | + if ($row['id_poll'] > 0) { |
|
| 1172 | + $polls[] = $row['id_poll']; |
|
| 1173 | + } |
|
| 1117 | 1174 | // Store the id_topic with the lowest id_first_msg. |
| 1118 | - if (empty($firstTopic)) |
|
| 1119 | - $firstTopic = $row['id_topic']; |
|
| 1175 | + if (empty($firstTopic)) { |
|
| 1176 | + $firstTopic = $row['id_topic']; |
|
| 1177 | + } |
|
| 1120 | 1178 | |
| 1121 | 1179 | // Lowest topic id gets selected as surviving topic id. We need to store this board so we can adjust the topic count (This one will not have a redirect topic) |
| 1122 | 1180 | if ($row['id_topic'] < $lowestTopicId || empty($lowestTopicId)) |
@@ -1130,11 +1188,13 @@ discard block |
||
| 1130 | 1188 | $smcFunc['db_free_result']($request); |
| 1131 | 1189 | |
| 1132 | 1190 | // If we didn't get any topics then they've been messing with unapproved stuff. |
| 1133 | - if (empty($topic_data)) |
|
| 1134 | - fatal_lang_error('no_topic_id'); |
|
| 1191 | + if (empty($topic_data)) { |
|
| 1192 | + fatal_lang_error('no_topic_id'); |
|
| 1193 | + } |
|
| 1135 | 1194 | |
| 1136 | - if (isset($_POST['postRedirect']) && !empty($lowestTopicBoard)) |
|
| 1137 | - $boardTotals[$lowestTopicBoard]['topics']++; |
|
| 1195 | + if (isset($_POST['postRedirect']) && !empty($lowestTopicBoard)) { |
|
| 1196 | + $boardTotals[$lowestTopicBoard]['topics']++; |
|
| 1197 | + } |
|
| 1138 | 1198 | |
| 1139 | 1199 | // Will this be approved? |
| 1140 | 1200 | $context['is_approved'] = $topic_data[$firstTopic]['approved']; |
@@ -1150,8 +1210,9 @@ discard block |
||
| 1150 | 1210 | |
| 1151 | 1211 | // Get the boards a user is allowed to merge in. |
| 1152 | 1212 | $merge_boards = boardsAllowedTo('merge_any'); |
| 1153 | - if (empty($merge_boards)) |
|
| 1154 | - fatal_lang_error('cannot_merge_any', 'user'); |
|
| 1213 | + if (empty($merge_boards)) { |
|
| 1214 | + fatal_lang_error('cannot_merge_any', 'user'); |
|
| 1215 | + } |
|
| 1155 | 1216 | |
| 1156 | 1217 | // Make sure they can see all boards.... |
| 1157 | 1218 | $request = $smcFunc['db_query']('', ' |
@@ -1168,8 +1229,9 @@ discard block |
||
| 1168 | 1229 | ) |
| 1169 | 1230 | ); |
| 1170 | 1231 | // If the number of boards that's in the output isn't exactly the same as we've put in there, you're in trouble. |
| 1171 | - if ($smcFunc['db_num_rows']($request) != count($boards)) |
|
| 1172 | - fatal_lang_error('no_board'); |
|
| 1232 | + if ($smcFunc['db_num_rows']($request) != count($boards)) { |
|
| 1233 | + fatal_lang_error('no_board'); |
|
| 1234 | + } |
|
| 1173 | 1235 | $smcFunc['db_free_result']($request); |
| 1174 | 1236 | |
| 1175 | 1237 | if (empty($_REQUEST['sa']) || $_REQUEST['sa'] == 'options') |
@@ -1188,8 +1250,8 @@ discard block |
||
| 1188 | 1250 | 'limit' => count($polls), |
| 1189 | 1251 | ) |
| 1190 | 1252 | ); |
| 1191 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1192 | - $context['polls'][] = array( |
|
| 1253 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1254 | + $context['polls'][] = array( |
|
| 1193 | 1255 | 'id' => $row['id_poll'], |
| 1194 | 1256 | 'topic' => array( |
| 1195 | 1257 | 'id' => $row['id_topic'], |
@@ -1198,6 +1260,7 @@ discard block |
||
| 1198 | 1260 | 'question' => $row['question'], |
| 1199 | 1261 | 'selected' => $row['id_topic'] == $firstTopic |
| 1200 | 1262 | ); |
| 1263 | + } |
|
| 1201 | 1264 | $smcFunc['db_free_result']($request); |
| 1202 | 1265 | } |
| 1203 | 1266 | if (count($boards) > 1) |
@@ -1213,18 +1276,20 @@ discard block |
||
| 1213 | 1276 | 'limit' => count($boards), |
| 1214 | 1277 | ) |
| 1215 | 1278 | ); |
| 1216 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1217 | - $context['boards'][] = array( |
|
| 1279 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1280 | + $context['boards'][] = array( |
|
| 1218 | 1281 | 'id' => $row['id_board'], |
| 1219 | 1282 | 'name' => $row['name'], |
| 1220 | 1283 | 'selected' => $row['id_board'] == $topic_data[$firstTopic]['board'] |
| 1221 | 1284 | ); |
| 1285 | + } |
|
| 1222 | 1286 | $smcFunc['db_free_result']($request); |
| 1223 | 1287 | } |
| 1224 | 1288 | |
| 1225 | 1289 | $context['topics'] = $topic_data; |
| 1226 | - foreach ($topic_data as $id => $topic) |
|
| 1227 | - $context['topics'][$id]['selected'] = $topic['id'] == $firstTopic; |
|
| 1290 | + foreach ($topic_data as $id => $topic) { |
|
| 1291 | + $context['topics'][$id]['selected'] = $topic['id'] == $firstTopic; |
|
| 1292 | + } |
|
| 1228 | 1293 | |
| 1229 | 1294 | $context['page_title'] = $txt['merge']; |
| 1230 | 1295 | $context['sub_template'] = 'merge_extra_options'; |
@@ -1233,13 +1298,15 @@ discard block |
||
| 1233 | 1298 | |
| 1234 | 1299 | // Determine target board. |
| 1235 | 1300 | $target_board = count($boards) > 1 ? (int) $_REQUEST['board'] : $boards[0]; |
| 1236 | - if (!in_array($target_board, $boards)) |
|
| 1237 | - fatal_lang_error('no_board'); |
|
| 1301 | + if (!in_array($target_board, $boards)) { |
|
| 1302 | + fatal_lang_error('no_board'); |
|
| 1303 | + } |
|
| 1238 | 1304 | |
| 1239 | 1305 | // Determine which poll will survive and which polls won't. |
| 1240 | 1306 | $target_poll = count($polls) > 1 ? (int) $_POST['poll'] : (count($polls) == 1 ? $polls[0] : 0); |
| 1241 | - if ($target_poll > 0 && !in_array($target_poll, $polls)) |
|
| 1242 | - fatal_lang_error('no_access', false); |
|
| 1307 | + if ($target_poll > 0 && !in_array($target_poll, $polls)) { |
|
| 1308 | + fatal_lang_error('no_access', false); |
|
| 1309 | + } |
|
| 1243 | 1310 | $deleted_polls = empty($target_poll) ? $polls : array_diff($polls, array($target_poll)); |
| 1244 | 1311 | |
| 1245 | 1312 | // Determine the subject of the newly merged topic - was a custom subject specified? |
@@ -1247,19 +1314,23 @@ discard block |
||
| 1247 | 1314 | { |
| 1248 | 1315 | $target_subject = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['custom_subject'])), array("\r" => '', "\n" => '', "\t" => '')); |
| 1249 | 1316 | // Keep checking the length. |
| 1250 | - if ($smcFunc['strlen']($target_subject) > 100) |
|
| 1251 | - $target_subject = $smcFunc['substr']($target_subject, 0, 100); |
|
| 1317 | + if ($smcFunc['strlen']($target_subject) > 100) { |
|
| 1318 | + $target_subject = $smcFunc['substr']($target_subject, 0, 100); |
|
| 1319 | + } |
|
| 1252 | 1320 | |
| 1253 | 1321 | // Nothing left - odd but pick the first topics subject. |
| 1254 | - if ($target_subject == '') |
|
| 1255 | - $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1322 | + if ($target_subject == '') { |
|
| 1323 | + $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1324 | + } |
|
| 1256 | 1325 | } |
| 1257 | 1326 | // A subject was selected from the list. |
| 1258 | - elseif (!empty($topic_data[(int) $_POST['subject']]['subject'])) |
|
| 1259 | - $target_subject = $topic_data[(int) $_POST['subject']]['subject']; |
|
| 1327 | + elseif (!empty($topic_data[(int) $_POST['subject']]['subject'])) { |
|
| 1328 | + $target_subject = $topic_data[(int) $_POST['subject']]['subject']; |
|
| 1329 | + } |
|
| 1260 | 1330 | // Nothing worked? Just take the subject of the first message. |
| 1261 | - else |
|
| 1262 | - $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1331 | + else { |
|
| 1332 | + $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1333 | + } |
|
| 1263 | 1334 | |
| 1264 | 1335 | // Get the first and last message and the number of messages.... |
| 1265 | 1336 | $request = $smcFunc['db_query']('', ' |
@@ -1285,15 +1356,13 @@ discard block |
||
| 1285 | 1356 | { |
| 1286 | 1357 | $num_replies = $row['message_count'] - 1; |
| 1287 | 1358 | $num_unapproved = 0; |
| 1288 | - } |
|
| 1289 | - else |
|
| 1359 | + } else |
|
| 1290 | 1360 | { |
| 1291 | 1361 | $topic_approved = 0; |
| 1292 | 1362 | $num_replies = 0; |
| 1293 | 1363 | $num_unapproved = $row['message_count']; |
| 1294 | 1364 | } |
| 1295 | - } |
|
| 1296 | - else |
|
| 1365 | + } else |
|
| 1297 | 1366 | { |
| 1298 | 1367 | // If this has a lower first_msg then the first post is not approved and hence the number of replies was wrong! |
| 1299 | 1368 | if ($first_msg > $row['first_msg']) |
@@ -1339,8 +1408,9 @@ discard block |
||
| 1339 | 1408 | list ($member_started) = $smcFunc['db_fetch_row']($request); |
| 1340 | 1409 | list ($member_updated) = $smcFunc['db_fetch_row']($request); |
| 1341 | 1410 | // First and last message are the same, so only row was returned. |
| 1342 | - if ($member_updated === NULL) |
|
| 1343 | - $member_updated = $member_started; |
|
| 1411 | + if ($member_updated === NULL) { |
|
| 1412 | + $member_updated = $member_started; |
|
| 1413 | + } |
|
| 1344 | 1414 | |
| 1345 | 1415 | $smcFunc['db_free_result']($request); |
| 1346 | 1416 | |
@@ -1353,8 +1423,9 @@ discard block |
||
| 1353 | 1423 | array( |
| 1354 | 1424 | 'topic_list' => $topics, |
| 1355 | 1425 | )); |
| 1356 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1357 | - $affected_msgs[] = $row[0]; |
|
| 1426 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1427 | + $affected_msgs[] = $row[0]; |
|
| 1428 | + } |
|
| 1358 | 1429 | $smcFunc['db_free_result']($request); |
| 1359 | 1430 | |
| 1360 | 1431 | // Assign the first topic ID to be the merged topic. |
@@ -1432,9 +1503,9 @@ discard block |
||
| 1432 | 1503 | // Grab the response prefix (like 'Re: ') in the default forum language. |
| 1433 | 1504 | if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) |
| 1434 | 1505 | { |
| 1435 | - if ($language === $user_info['language']) |
|
| 1436 | - $context['response_prefix'] = $txt['response_prefix']; |
|
| 1437 | - else |
|
| 1506 | + if ($language === $user_info['language']) { |
|
| 1507 | + $context['response_prefix'] = $txt['response_prefix']; |
|
| 1508 | + } else |
|
| 1438 | 1509 | { |
| 1439 | 1510 | loadLanguage('index', $language, false); |
| 1440 | 1511 | $context['response_prefix'] = $txt['response_prefix']; |
@@ -1514,8 +1585,9 @@ discard block |
||
| 1514 | 1585 | if ($smcFunc['db_num_rows']($request) > 0) |
| 1515 | 1586 | { |
| 1516 | 1587 | $replaceEntries = array(); |
| 1517 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1518 | - $replaceEntries[] = array($row['id_member'], $id_topic, $row['new_id_msg'], $row['unwatched']); |
|
| 1588 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1589 | + $replaceEntries[] = array($row['id_member'], $id_topic, $row['new_id_msg'], $row['unwatched']); |
|
| 1590 | + } |
|
| 1519 | 1591 | |
| 1520 | 1592 | $smcFunc['db_insert']('replace', |
| 1521 | 1593 | '{db_prefix}log_topics', |
@@ -1552,8 +1624,9 @@ discard block |
||
| 1552 | 1624 | if ($smcFunc['db_num_rows']($request) > 0) |
| 1553 | 1625 | { |
| 1554 | 1626 | $replaceEntries = array(); |
| 1555 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1556 | - $replaceEntries[] = array($row['id_member'], $id_topic, 0, $row['sent']); |
|
| 1627 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1628 | + $replaceEntries[] = array($row['id_member'], $id_topic, 0, $row['sent']); |
|
| 1629 | + } |
|
| 1557 | 1630 | |
| 1558 | 1631 | $smcFunc['db_insert']('replace', |
| 1559 | 1632 | '{db_prefix}log_notify', |
@@ -1728,8 +1801,9 @@ discard block |
||
| 1728 | 1801 | // If there's a search index that needs updating, update it... |
| 1729 | 1802 | require_once($sourcedir . '/Search.php'); |
| 1730 | 1803 | $searchAPI = findSearchAPI(); |
| 1731 | - if (is_callable(array($searchAPI, 'topicMerge'))) |
|
| 1732 | - $searchAPI->topicMerge($id_topic, $topics, $affected_msgs, empty($_POST['enforce_subject']) ? null : array($context['response_prefix'], $target_subject)); |
|
| 1804 | + if (is_callable(array($searchAPI, 'topicMerge'))) { |
|
| 1805 | + $searchAPI->topicMerge($id_topic, $topics, $affected_msgs, empty($_POST['enforce_subject']) ? null : array($context['response_prefix'], $target_subject)); |
|
| 1806 | + } |
|
| 1733 | 1807 | |
| 1734 | 1808 | // Merging is the sort of thing an external CMS might want to know about |
| 1735 | 1809 | $merged_topic = array( |