@@ -19,26 +19,28 @@ discard block |
||
| 19 | 19 | global $context, $settings, $scripturl, $txt, $modSettings; |
| 20 | 20 | |
| 21 | 21 | // Not allowed to edit? |
| 22 | - if (!$context['can_modify']) |
|
| 23 | - echo ' |
|
| 22 | + if (!$context['can_modify']) { |
|
| 23 | + echo ' |
|
| 24 | 24 | <div class="errorbox"> |
| 25 | 25 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
| 26 | 26 | </div>'; |
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | echo ' |
| 29 | 30 | <div id="admin_form_wrapper"> |
| 30 | 31 | <form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">'; |
| 31 | 32 | |
| 32 | - if (!empty($context['profile'])) |
|
| 33 | - echo ' |
|
| 33 | + if (!empty($context['profile'])) { |
|
| 34 | + echo ' |
|
| 34 | 35 | <div class="cat_bar"> |
| 35 | 36 | <h3 class="catbg">', $txt['permissions_for_profile'], ': "', $context['profile']['name'], '"</h3> |
| 36 | 37 | </div>'; |
| 37 | - else |
|
| 38 | - echo ' |
|
| 38 | + } else { |
|
| 39 | + echo ' |
|
| 39 | 40 | <div class="cat_bar"> |
| 40 | 41 | <h3 class="catbg">', $txt['permissions_title'], '</h3> |
| 41 | 42 | </div>'; |
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | echo ' |
| 44 | 46 | <table class="table_grid"> |
@@ -47,13 +49,14 @@ discard block |
||
| 47 | 49 | <th>', $txt['membergroups_name'], '</th> |
| 48 | 50 | <th class="small_table">', $txt['membergroups_members_top'], '</th>'; |
| 49 | 51 | |
| 50 | - if (empty($modSettings['permission_enable_deny'])) |
|
| 51 | - echo ' |
|
| 52 | + if (empty($modSettings['permission_enable_deny'])) { |
|
| 53 | + echo ' |
|
| 52 | 54 | <th class="small_table">', $txt['membergroups_permissions'], '</th>'; |
| 53 | - else |
|
| 54 | - echo ' |
|
| 55 | + } else { |
|
| 56 | + echo ' |
|
| 55 | 57 | <th class="small_table">', $txt['permissions_allowed'], '</th> |
| 56 | 58 | <th class="small_table">', $txt['permissions_denied'], '</th>'; |
| 59 | + } |
|
| 57 | 60 | |
| 58 | 61 | echo ' |
| 59 | 62 | <th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th> |
@@ -71,26 +74,28 @@ discard block |
||
| 71 | 74 | <td> |
| 72 | 75 | ', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a> ' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', '<span>', $group['name'], '</span>'; |
| 73 | 76 | |
| 74 | - if (!empty($group['children'])) |
|
| 75 | - echo ' |
|
| 77 | + if (!empty($group['children'])) { |
|
| 78 | + echo ' |
|
| 76 | 79 | <br> |
| 77 | 80 | <span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
| 81 | + } |
|
| 78 | 82 | |
| 79 | 83 | echo ' |
| 80 | 84 | </td> |
| 81 | 85 | <td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>'; |
| 82 | 86 | |
| 83 | - if (empty($modSettings['permission_enable_deny'])) |
|
| 84 | - echo ' |
|
| 87 | + if (empty($modSettings['permission_enable_deny'])) { |
|
| 88 | + echo ' |
|
| 85 | 89 | <td>', $group['num_permissions']['allowed'], '</td>'; |
| 86 | - else |
|
| 87 | - echo ' |
|
| 90 | + } else { |
|
| 91 | + echo ' |
|
| 88 | 92 | <td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '> |
| 89 | 93 | ', $group['num_permissions']['allowed'], ' |
| 90 | 94 | </td> |
| 91 | 95 | <td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '> |
| 92 | 96 | ', $group['num_permissions']['denied'], ' |
| 93 | 97 | </td>'; |
| 98 | + } |
|
| 94 | 99 | |
| 95 | 100 | echo ' |
| 96 | 101 | <td> |
@@ -141,10 +146,11 @@ discard block |
||
| 141 | 146 | <select name="copy_from"> |
| 142 | 147 | <option value="empty">(', $txt['permissions_select_membergroup'], ')</option>'; |
| 143 | 148 | |
| 144 | - foreach ($context['groups'] as $group) |
|
| 145 | - if ($group['id'] != 1) |
|
| 149 | + foreach ($context['groups'] as $group) { |
|
| 150 | + if ($group['id'] != 1) |
|
| 146 | 151 | echo ' |
| 147 | 152 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
| 153 | + } |
|
| 148 | 154 | |
| 149 | 155 | echo ' |
| 150 | 156 | </select> |
@@ -154,9 +160,10 @@ discard block |
||
| 154 | 160 | <option value="add">', $txt['permissions_add'], '...</option> |
| 155 | 161 | <option value="clear">', $txt['permissions_remove'], '...</option>'; |
| 156 | 162 | |
| 157 | - if (!empty($modSettings['permission_enable_deny'])) |
|
| 158 | - echo ' |
|
| 163 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
| 164 | + echo ' |
|
| 159 | 165 | <option value="deny">', $txt['permissions_deny'], '...</option>'; |
| 166 | + } |
|
| 160 | 167 | |
| 161 | 168 | echo ' |
| 162 | 169 | </select> |
@@ -167,31 +174,35 @@ discard block |
||
| 167 | 174 | |
| 168 | 175 | foreach ($context['permissions'] as $permissionType) |
| 169 | 176 | { |
| 170 | - if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) |
|
| 171 | - continue; |
|
| 177 | + if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) { |
|
| 178 | + continue; |
|
| 179 | + } |
|
| 172 | 180 | |
| 173 | 181 | foreach ($permissionType['columns'] as $column) |
| 174 | 182 | { |
| 175 | 183 | foreach ($column as $permissionGroup) |
| 176 | 184 | { |
| 177 | - if ($permissionGroup['hidden']) |
|
| 178 | - continue; |
|
| 185 | + if ($permissionGroup['hidden']) { |
|
| 186 | + continue; |
|
| 187 | + } |
|
| 179 | 188 | |
| 180 | 189 | echo ' |
| 181 | 190 | <option value="" disabled>[', $permissionGroup['name'], ']</option>'; |
| 182 | 191 | |
| 183 | 192 | foreach ($permissionGroup['permissions'] as $perm) |
| 184 | 193 | { |
| 185 | - if ($perm['hidden']) |
|
| 186 | - continue; |
|
| 194 | + if ($perm['hidden']) { |
|
| 195 | + continue; |
|
| 196 | + } |
|
| 187 | 197 | |
| 188 | - if ($perm['has_own_any']) |
|
| 189 | - echo ' |
|
| 198 | + if ($perm['has_own_any']) { |
|
| 199 | + echo ' |
|
| 190 | 200 | <option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option> |
| 191 | 201 | <option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>'; |
| 192 | - else |
|
| 193 | - echo ' |
|
| 202 | + } else { |
|
| 203 | + echo ' |
|
| 194 | 204 | <option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>'; |
| 205 | + } |
|
| 195 | 206 | } |
| 196 | 207 | } |
| 197 | 208 | } |
@@ -256,9 +267,10 @@ discard block |
||
| 256 | 267 | } |
| 257 | 268 | </script>'; |
| 258 | 269 | |
| 259 | - if (!empty($context['profile'])) |
|
| 260 | - echo ' |
|
| 270 | + if (!empty($context['profile'])) { |
|
| 271 | + echo ' |
|
| 261 | 272 | <input type="hidden" name="pid" value="', $context['profile']['id'], '">'; |
| 273 | + } |
|
| 262 | 274 | |
| 263 | 275 | echo ' |
| 264 | 276 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -303,9 +315,10 @@ discard block |
||
| 303 | 315 | <h3 class="subbg">', $category['name'], '</h3> |
| 304 | 316 | </div>'; |
| 305 | 317 | |
| 306 | - if (!empty($category['boards'])) |
|
| 307 | - echo ' |
|
| 318 | + if (!empty($category['boards'])) { |
|
| 319 | + echo ' |
|
| 308 | 320 | <ul class="perm_boards flow_hidden">'; |
| 321 | + } |
|
| 309 | 322 | |
| 310 | 323 | foreach ($category['boards'] as $board) |
| 311 | 324 | { |
@@ -321,33 +334,36 @@ discard block |
||
| 321 | 334 | echo ' |
| 322 | 335 | <select name="boardprofile[', $board['id'], ']">'; |
| 323 | 336 | |
| 324 | - foreach ($context['profiles'] as $id => $profile) |
|
| 325 | - echo ' |
|
| 337 | + foreach ($context['profiles'] as $id => $profile) { |
|
| 338 | + echo ' |
|
| 326 | 339 | <option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
| 340 | + } |
|
| 327 | 341 | |
| 328 | 342 | echo ' |
| 329 | 343 | </select>'; |
| 330 | - } |
|
| 331 | - else |
|
| 332 | - echo ' |
|
| 344 | + } else { |
|
| 345 | + echo ' |
|
| 333 | 346 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>'; |
| 347 | + } |
|
| 334 | 348 | |
| 335 | 349 | echo ' |
| 336 | 350 | </span> |
| 337 | 351 | </li>'; |
| 338 | 352 | } |
| 339 | 353 | |
| 340 | - if (!empty($category['boards'])) |
|
| 341 | - echo ' |
|
| 354 | + if (!empty($category['boards'])) { |
|
| 355 | + echo ' |
|
| 342 | 356 | </ul>'; |
| 357 | + } |
|
| 343 | 358 | } |
| 344 | 359 | |
| 345 | - if ($context['edit_all']) |
|
| 346 | - echo ' |
|
| 360 | + if ($context['edit_all']) { |
|
| 361 | + echo ' |
|
| 347 | 362 | <input type="submit" name="save_changes" value="', $txt['save'], '" class="button">'; |
| 348 | - else |
|
| 349 | - echo ' |
|
| 363 | + } else { |
|
| 364 | + echo ' |
|
| 350 | 365 | <a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>'; |
| 366 | + } |
|
| 351 | 367 | |
| 352 | 368 | echo ' |
| 353 | 369 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -387,12 +403,13 @@ discard block |
||
| 387 | 403 | <tr class="windowbg"> |
| 388 | 404 | <td>'; |
| 389 | 405 | |
| 390 | - if (!empty($context['show_rename_boxes']) && $profile['can_edit']) |
|
| 391 | - echo ' |
|
| 406 | + if (!empty($context['show_rename_boxes']) && $profile['can_edit']) { |
|
| 407 | + echo ' |
|
| 392 | 408 | <input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">'; |
| 393 | - else |
|
| 394 | - echo ' |
|
| 409 | + } else { |
|
| 410 | + echo ' |
|
| 395 | 411 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>'; |
| 412 | + } |
|
| 396 | 413 | |
| 397 | 414 | echo ' |
| 398 | 415 | </td> |
@@ -412,9 +429,10 @@ discard block |
||
| 412 | 429 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 413 | 430 | <input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">'; |
| 414 | 431 | |
| 415 | - if ($context['can_edit_something']) |
|
| 416 | - echo ' |
|
| 432 | + if ($context['can_edit_something']) { |
|
| 433 | + echo ' |
|
| 417 | 434 | <input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">'; |
| 435 | + } |
|
| 418 | 436 | |
| 419 | 437 | echo ' |
| 420 | 438 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '> |
@@ -439,9 +457,10 @@ discard block |
||
| 439 | 457 | <dd> |
| 440 | 458 | <select name="copy_from">'; |
| 441 | 459 | |
| 442 | - foreach ($context['profiles'] as $id => $profile) |
|
| 443 | - echo ' |
|
| 460 | + foreach ($context['profiles'] as $id => $profile) { |
|
| 461 | + echo ' |
|
| 444 | 462 | <option value="', $id, '">', $profile['name'], '</option>'; |
| 463 | + } |
|
| 445 | 464 | |
| 446 | 465 | echo ' |
| 447 | 466 | </select> |
@@ -463,13 +482,13 @@ discard block |
||
| 463 | 482 | global $context, $scripturl, $txt, $modSettings; |
| 464 | 483 | |
| 465 | 484 | // Cannot be edited? |
| 466 | - if (!$context['profile']['can_modify']) |
|
| 467 | - echo ' |
|
| 485 | + if (!$context['profile']['can_modify']) { |
|
| 486 | + echo ' |
|
| 468 | 487 | <div class="errorbox"> |
| 469 | 488 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
| 470 | 489 | </div>'; |
| 471 | - else |
|
| 472 | - echo ' |
|
| 490 | + } else { |
|
| 491 | + echo ' |
|
| 473 | 492 | <script> |
| 474 | 493 | window.smf_usedDeny = false; |
| 475 | 494 | |
@@ -481,27 +500,30 @@ discard block |
||
| 481 | 500 | return true; |
| 482 | 501 | } |
| 483 | 502 | </script>'; |
| 503 | + } |
|
| 484 | 504 | |
| 485 | 505 | echo ' |
| 486 | 506 | <div id="admincenter"> |
| 487 | 507 | <form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">'; |
| 488 | 508 | |
| 489 | - if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) |
|
| 490 | - echo ' |
|
| 509 | + if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) { |
|
| 510 | + echo ' |
|
| 491 | 511 | <div class="information"> |
| 492 | 512 | ', $txt['permissions_option_desc'], ' |
| 493 | 513 | </div>'; |
| 514 | + } |
|
| 494 | 515 | |
| 495 | 516 | echo ' |
| 496 | 517 | <div class="cat_bar"> |
| 497 | 518 | <h3 class="catbg">'; |
| 498 | 519 | |
| 499 | - if ($context['permission_type'] == 'board') |
|
| 500 | - echo ' |
|
| 520 | + if ($context['permission_type'] == 'board') { |
|
| 521 | + echo ' |
|
| 501 | 522 | ', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"'; |
| 502 | - else |
|
| 503 | - echo ' |
|
| 523 | + } else { |
|
| 524 | + echo ' |
|
| 504 | 525 | ', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"'; |
| 526 | + } |
|
| 505 | 527 | echo ' |
| 506 | 528 | </h3> |
| 507 | 529 | </div>'; |
@@ -524,15 +546,17 @@ discard block |
||
| 524 | 546 | template_modify_group_display('board'); |
| 525 | 547 | } |
| 526 | 548 | |
| 527 | - if ($context['profile']['can_modify']) |
|
| 528 | - echo ' |
|
| 549 | + if ($context['profile']['can_modify']) { |
|
| 550 | + echo ' |
|
| 529 | 551 | <div class="padding"> |
| 530 | 552 | <input type="submit" value="', $txt['permissions_commit'], '" class="button"> |
| 531 | 553 | </div>'; |
| 554 | + } |
|
| 532 | 555 | |
| 533 | - foreach ($context['hidden_perms'] as $hidden_perm) |
|
| 534 | - echo ' |
|
| 556 | + foreach ($context['hidden_perms'] as $hidden_perm) { |
|
| 557 | + echo ' |
|
| 535 | 558 | <input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">'; |
| 559 | + } |
|
| 536 | 560 | |
| 537 | 561 | echo ' |
| 538 | 562 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -560,17 +584,19 @@ discard block |
||
| 560 | 584 | |
| 561 | 585 | foreach ($column as $permissionGroup) |
| 562 | 586 | { |
| 563 | - if (empty($permissionGroup['permissions'])) |
|
| 564 | - continue; |
|
| 587 | + if (empty($permissionGroup['permissions'])) { |
|
| 588 | + continue; |
|
| 589 | + } |
|
| 565 | 590 | |
| 566 | 591 | // Are we likely to have something in this group to display or is it all hidden? |
| 567 | 592 | $has_display_content = false; |
| 568 | 593 | if (!$permissionGroup['hidden']) |
| 569 | 594 | { |
| 570 | 595 | // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. |
| 571 | - foreach ($permissionGroup['permissions'] as $permission) |
|
| 572 | - if (!$permission['hidden']) |
|
| 596 | + foreach ($permissionGroup['permissions'] as $permission) { |
|
| 597 | + if (!$permission['hidden']) |
|
| 573 | 598 | $has_display_content = true; |
| 599 | + } |
|
| 574 | 600 | |
| 575 | 601 | if ($has_display_content) |
| 576 | 602 | { |
@@ -579,10 +605,11 @@ discard block |
||
| 579 | 605 | <th></th> |
| 580 | 606 | <th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>'; |
| 581 | 607 | |
| 582 | - if ($context['group']['id'] != -1) |
|
| 583 | - echo ' |
|
| 608 | + if ($context['group']['id'] != -1) { |
|
| 609 | + echo ' |
|
| 584 | 610 | <th>', $txt['permissions_option_own'], '</th> |
| 585 | 611 | <th>', $txt['permissions_option_any'], '</th>'; |
| 612 | + } |
|
| 586 | 613 | |
| 587 | 614 | echo ' |
| 588 | 615 | </tr>'; |
@@ -605,17 +632,18 @@ discard block |
||
| 605 | 632 | // Guests can't do their own thing. |
| 606 | 633 | if ($context['group']['id'] != -1) |
| 607 | 634 | { |
| 608 | - if (empty($modSettings['permission_enable_deny'])) |
|
| 609 | - echo ' |
|
| 635 | + if (empty($modSettings['permission_enable_deny'])) { |
|
| 636 | + echo ' |
|
| 610 | 637 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '>'; |
| 611 | - else |
|
| 638 | + } else |
|
| 612 | 639 | { |
| 613 | 640 | echo ' |
| 614 | 641 | <select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>'; |
| 615 | 642 | |
| 616 | - foreach (array('on', 'off', 'deny') as $c) |
|
| 617 | - echo ' |
|
| 643 | + foreach (array('on', 'off', 'deny') as $c) { |
|
| 644 | + echo ' |
|
| 618 | 645 | <option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
| 646 | + } |
|
| 619 | 647 | echo ' |
| 620 | 648 | </select>'; |
| 621 | 649 | } |
@@ -625,39 +653,41 @@ discard block |
||
| 625 | 653 | <td>'; |
| 626 | 654 | } |
| 627 | 655 | |
| 628 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
| 629 | - echo ' |
|
| 656 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
| 657 | + echo ' |
|
| 630 | 658 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>'; |
| 631 | - else |
|
| 659 | + } else |
|
| 632 | 660 | { |
| 633 | 661 | echo ' |
| 634 | 662 | <select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>'; |
| 635 | 663 | |
| 636 | - foreach (array('on', 'off', 'deny') as $c) |
|
| 637 | - echo ' |
|
| 664 | + foreach (array('on', 'off', 'deny') as $c) { |
|
| 665 | + echo ' |
|
| 638 | 666 | <option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
| 667 | + } |
|
| 639 | 668 | echo ' |
| 640 | 669 | </select>'; |
| 641 | 670 | } |
| 642 | - } |
|
| 643 | - else |
|
| 671 | + } else |
|
| 644 | 672 | { |
| 645 | - if ($context['group']['id'] != -1) |
|
| 646 | - echo ' |
|
| 673 | + if ($context['group']['id'] != -1) { |
|
| 674 | + echo ' |
|
| 647 | 675 | </td> |
| 648 | 676 | <td>'; |
| 677 | + } |
|
| 649 | 678 | |
| 650 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
| 651 | - echo ' |
|
| 679 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
| 680 | + echo ' |
|
| 652 | 681 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>'; |
| 653 | - else |
|
| 682 | + } else |
|
| 654 | 683 | { |
| 655 | 684 | echo ' |
| 656 | 685 | <select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>'; |
| 657 | 686 | |
| 658 | - foreach (array('on', 'off', 'deny') as $c) |
|
| 659 | - echo ' |
|
| 687 | + foreach (array('on', 'off', 'deny') as $c) { |
|
| 688 | + echo ' |
|
| 660 | 689 | <option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
| 690 | + } |
|
| 661 | 691 | echo ' |
| 662 | 692 | </select>'; |
| 663 | 693 | } |
@@ -689,11 +719,11 @@ discard block |
||
| 689 | 719 | <fieldset id="', $context['current_permission'], '"> |
| 690 | 720 | <legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>'; |
| 691 | 721 | |
| 692 | - if (empty($modSettings['permission_enable_deny'])) |
|
| 693 | - echo ' |
|
| 722 | + if (empty($modSettings['permission_enable_deny'])) { |
|
| 723 | + echo ' |
|
| 694 | 724 | <ul>'; |
| 695 | - else |
|
| 696 | - echo ' |
|
| 725 | + } else { |
|
| 726 | + echo ' |
|
| 697 | 727 | <div class="information">', $txt['permissions_option_desc'], '</div> |
| 698 | 728 | <dl class="settings"> |
| 699 | 729 | <dt> |
@@ -703,47 +733,52 @@ discard block |
||
| 703 | 733 | </dt> |
| 704 | 734 | <dd> |
| 705 | 735 | </dd>'; |
| 736 | + } |
|
| 706 | 737 | |
| 707 | 738 | foreach ($context['member_groups'] as $group) |
| 708 | 739 | { |
| 709 | - if (!empty($modSettings['permission_enable_deny'])) |
|
| 710 | - echo ' |
|
| 740 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
| 741 | + echo ' |
|
| 711 | 742 | <dt>'; |
| 712 | - else |
|
| 713 | - echo ' |
|
| 743 | + } else { |
|
| 744 | + echo ' |
|
| 714 | 745 | <li>'; |
| 746 | + } |
|
| 715 | 747 | |
| 716 | - if (empty($modSettings['permission_enable_deny'])) |
|
| 717 | - echo ' |
|
| 748 | + if (empty($modSettings['permission_enable_deny'])) { |
|
| 749 | + echo ' |
|
| 718 | 750 | <input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>'; |
| 719 | - else |
|
| 720 | - echo ' |
|
| 751 | + } else { |
|
| 752 | + echo ' |
|
| 721 | 753 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span> |
| 722 | 754 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span> |
| 723 | 755 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>'; |
| 756 | + } |
|
| 724 | 757 | |
| 725 | - if (!empty($modSettings['permission_enable_deny'])) |
|
| 726 | - echo ' |
|
| 758 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
| 759 | + echo ' |
|
| 727 | 760 | </dt> |
| 728 | 761 | <dd> |
| 729 | 762 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
| 730 | 763 | </dd>'; |
| 731 | - else |
|
| 732 | - echo ' |
|
| 764 | + } else { |
|
| 765 | + echo ' |
|
| 733 | 766 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
| 734 | 767 | </li>'; |
| 768 | + } |
|
| 735 | 769 | } |
| 736 | 770 | |
| 737 | - if (empty($modSettings['permission_enable_deny'])) |
|
| 738 | - echo ' |
|
| 771 | + if (empty($modSettings['permission_enable_deny'])) { |
|
| 772 | + echo ' |
|
| 739 | 773 | <li> |
| 740 | 774 | <input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');"> |
| 741 | 775 | <span>', $txt['check_all'], '</span> |
| 742 | 776 | </li> |
| 743 | 777 | </ul>'; |
| 744 | - else |
|
| 745 | - echo ' |
|
| 778 | + } else { |
|
| 779 | + echo ' |
|
| 746 | 780 | </dl>'; |
| 781 | + } |
|
| 747 | 782 | |
| 748 | 783 | echo ' |
| 749 | 784 | </fieldset> |
@@ -783,9 +818,10 @@ discard block |
||
| 783 | 818 | if (!empty($modSettings['postmod_active'])) |
| 784 | 819 | { |
| 785 | 820 | // Got advanced permissions - if so warn! |
| 786 | - if (!empty($modSettings['permission_enable_deny'])) |
|
| 787 | - echo ' |
|
| 821 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
| 822 | + echo ' |
|
| 788 | 823 | <div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>'; |
| 824 | + } |
|
| 789 | 825 | |
| 790 | 826 | echo ' |
| 791 | 827 | <div class="padding"> |
@@ -800,10 +836,11 @@ discard block |
||
| 800 | 836 | ', $txt['permissions_post_moderation_select'], ': |
| 801 | 837 | <select name="pid" onchange="document.forms.postmodForm.submit();">'; |
| 802 | 838 | |
| 803 | - foreach ($context['profiles'] as $profile) |
|
| 804 | - if ($profile['can_modify']) |
|
| 839 | + foreach ($context['profiles'] as $profile) { |
|
| 840 | + if ($profile['can_modify']) |
|
| 805 | 841 | echo ' |
| 806 | 842 | <option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
| 843 | + } |
|
| 807 | 844 | |
| 808 | 845 | echo ' |
| 809 | 846 | </select> |
@@ -824,11 +861,12 @@ discard block |
||
| 824 | 861 | ', $txt['permissions_post_moderation_replies_any'], ' |
| 825 | 862 | </th>'; |
| 826 | 863 | |
| 827 | - if ($modSettings['attachmentEnable'] == 1) |
|
| 828 | - echo ' |
|
| 864 | + if ($modSettings['attachmentEnable'] == 1) { |
|
| 865 | + echo ' |
|
| 829 | 866 | <th class="centercol" colspan="3"> |
| 830 | 867 | ', $txt['permissions_post_moderation_attachments'], ' |
| 831 | 868 | </th>'; |
| 869 | + } |
|
| 832 | 870 | |
| 833 | 871 | echo ' |
| 834 | 872 | </tr> |
@@ -846,11 +884,12 @@ discard block |
||
| 846 | 884 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
| 847 | 885 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
| 848 | 886 | |
| 849 | - if ($modSettings['attachmentEnable'] == 1) |
|
| 850 | - echo ' |
|
| 887 | + if ($modSettings['attachmentEnable'] == 1) { |
|
| 888 | + echo ' |
|
| 851 | 889 | <th><span class="generic_icons post_moderation_allow"></span></th> |
| 852 | 890 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
| 853 | 891 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
| 892 | + } |
|
| 854 | 893 | |
| 855 | 894 | echo ' |
| 856 | 895 | </tr> |
@@ -864,10 +903,11 @@ discard block |
||
| 864 | 903 | <td class="half_table"> |
| 865 | 904 | <span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>'; |
| 866 | 905 | |
| 867 | - if (!empty($group['children'])) |
|
| 868 | - echo ' |
|
| 906 | + if (!empty($group['children'])) { |
|
| 907 | + echo ' |
|
| 869 | 908 | <br> |
| 870 | 909 | <span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
| 910 | + } |
|
| 871 | 911 | |
| 872 | 912 | echo ' |
| 873 | 913 | </td> |
@@ -882,11 +922,11 @@ discard block |
||
| 882 | 922 | </td>'; |
| 883 | 923 | |
| 884 | 924 | // Guests can't have "own" permissions |
| 885 | - if ($group['id'] == '-1') |
|
| 886 | - echo ' |
|
| 925 | + if ($group['id'] == '-1') { |
|
| 926 | + echo ' |
|
| 887 | 927 | <td colspan="3"></td>'; |
| 888 | - else |
|
| 889 | - echo ' |
|
| 928 | + } else { |
|
| 929 | + echo ' |
|
| 890 | 930 | <td class="centercol"> |
| 891 | 931 | <input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '> |
| 892 | 932 | </td> |
@@ -896,6 +936,7 @@ discard block |
||
| 896 | 936 | <td class="centercol"> |
| 897 | 937 | <input type="radio" name="replies_own[', $group['id'], ']" value="disallow"', $group['replies_own'] == 'disallow' ? ' checked' : '', '> |
| 898 | 938 | </td>'; |
| 939 | + } |
|
| 899 | 940 | |
| 900 | 941 | echo ' |
| 901 | 942 | <td class="centercol"> |
@@ -908,8 +949,8 @@ discard block |
||
| 908 | 949 | <input type="radio" name="replies_any[', $group['id'], ']" value="disallow"', $group['replies_any'] == 'disallow' ? ' checked' : '', '> |
| 909 | 950 | </td>'; |
| 910 | 951 | |
| 911 | - if ($modSettings['attachmentEnable'] == 1) |
|
| 912 | - echo ' |
|
| 952 | + if ($modSettings['attachmentEnable'] == 1) { |
|
| 953 | + echo ' |
|
| 913 | 954 | <td class="centercol"> |
| 914 | 955 | <input type="radio" name="attachment[', $group['id'], ']" value="allow"', $group['attachment'] == 'allow' ? ' checked' : '', '> |
| 915 | 956 | </td> |
@@ -919,6 +960,7 @@ discard block |
||
| 919 | 960 | <td class="centercol"> |
| 920 | 961 | <input type="radio" name="attachment[', $group['id'], ']" value="disallow"', $group['attachment'] == 'disallow' ? ' checked' : '', '> |
| 921 | 962 | </td>'; |
| 963 | + } |
|
| 922 | 964 | |
| 923 | 965 | echo ' |
| 924 | 966 | </tr>'; |
@@ -40,9 +40,10 @@ discard block |
||
| 40 | 40 | <option value="0000"', $context['holiday']['year'] == '0000' ? ' selected' : '', '>', $txt['every_year'], '</option>'; |
| 41 | 41 | |
| 42 | 42 | // Show a list of all the years we allow... |
| 43 | - for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) |
|
| 44 | - echo ' |
|
| 43 | + for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) { |
|
| 44 | + echo ' |
|
| 45 | 45 | <option value="', $year, '"', $year == $context['holiday']['year'] ? ' selected' : '', '>', $year, '</option>'; |
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | echo ' |
| 48 | 49 | </select> |
@@ -50,9 +51,10 @@ discard block |
||
| 50 | 51 | <select name="month" id="month" onchange="generateDays();">'; |
| 51 | 52 | |
| 52 | 53 | // There are 12 months per year - ensure that they all get listed. |
| 53 | - for ($month = 1; $month <= 12; $month++) |
|
| 54 | - echo ' |
|
| 54 | + for ($month = 1; $month <= 12; $month++) { |
|
| 55 | + echo ' |
|
| 55 | 56 | <option value="', $month, '"', $month == $context['holiday']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>'; |
| 57 | + } |
|
| 56 | 58 | |
| 57 | 59 | echo ' |
| 58 | 60 | </select> |
@@ -60,23 +62,25 @@ discard block |
||
| 60 | 62 | <select name="day" id="day" onchange="generateDays();">'; |
| 61 | 63 | |
| 62 | 64 | // This prints out all the days in the current month - this changes dynamically as we switch months. |
| 63 | - for ($day = 1; $day <= $context['holiday']['last_day']; $day++) |
|
| 64 | - echo ' |
|
| 65 | + for ($day = 1; $day <= $context['holiday']['last_day']; $day++) { |
|
| 66 | + echo ' |
|
| 65 | 67 | <option value="', $day, '"', $day == $context['holiday']['day'] ? ' selected' : '', '>', $day, '</option>'; |
| 68 | + } |
|
| 66 | 69 | |
| 67 | 70 | echo ' |
| 68 | 71 | </select> |
| 69 | 72 | </dd> |
| 70 | 73 | </dl>'; |
| 71 | 74 | |
| 72 | - if ($context['is_new']) |
|
| 73 | - echo ' |
|
| 75 | + if ($context['is_new']) { |
|
| 76 | + echo ' |
|
| 74 | 77 | <input type="submit" value="', $txt['holidays_button_add'], '" class="button">'; |
| 75 | - else |
|
| 76 | - echo ' |
|
| 78 | + } else { |
|
| 79 | + echo ' |
|
| 77 | 80 | <input type="submit" name="edit" value="', $txt['holidays_button_edit'], '" class="button"> |
| 78 | 81 | <input type="submit" name="delete" value="', $txt['holidays_button_remove'], '" class="button"> |
| 79 | 82 | <input type="hidden" name="holiday" value="', $context['holiday']['id'], '">'; |
| 83 | + } |
|
| 80 | 84 | echo ' |
| 81 | 85 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 82 | 86 | </div><!-- .windowbg2 --> |
@@ -31,9 +31,10 @@ discard block |
||
| 31 | 31 | echo ' |
| 32 | 32 | <ul id="smf_slider" class="roundframe">'; |
| 33 | 33 | |
| 34 | - foreach ($context['news_lines'] as $news) |
|
| 35 | - echo ' |
|
| 34 | + foreach ($context['news_lines'] as $news) { |
|
| 35 | + echo ' |
|
| 36 | 36 | <li>', $news, '</li>'; |
| 37 | + } |
|
| 37 | 38 | |
| 38 | 39 | echo ' |
| 39 | 40 | </ul> |
@@ -65,8 +66,9 @@ discard block |
||
| 65 | 66 | foreach ($context['categories'] as $category) |
| 66 | 67 | { |
| 67 | 68 | // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed) |
| 68 | - if (empty($category['boards']) && !$category['is_collapsed']) |
|
| 69 | - continue; |
|
| 69 | + if (empty($category['boards']) && !$category['is_collapsed']) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 70 | 72 | |
| 71 | 73 | echo ' |
| 72 | 74 | <div class="main_container"> |
@@ -74,9 +76,10 @@ discard block |
||
| 74 | 76 | <h3 class="catbg">'; |
| 75 | 77 | |
| 76 | 78 | // If this category even can collapse, show a link to collapse it. |
| 77 | - if ($category['can_collapse']) |
|
| 78 | - echo ' |
|
| 79 | + if ($category['can_collapse']) { |
|
| 80 | + echo ' |
|
| 79 | 81 | <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>'; |
| 82 | + } |
|
| 80 | 83 | |
| 81 | 84 | echo ' |
| 82 | 85 | ', $category['link'], ' |
@@ -106,10 +109,11 @@ discard block |
||
| 106 | 109 | </div>'; |
| 107 | 110 | |
| 108 | 111 | // Won't somebody think of the children! |
| 109 | - if (function_exists('template_bi_' . $board['type'] . '_children')) |
|
| 110 | - call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
| 111 | - else |
|
| 112 | - template_bi_board_children($board); |
|
| 112 | + if (function_exists('template_bi_' . $board['type'] . '_children')) { |
|
| 113 | + call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
| 114 | + } else { |
|
| 115 | + template_bi_board_children($board); |
|
| 116 | + } |
|
| 113 | 117 | |
| 114 | 118 | echo ' |
| 115 | 119 | </div><!-- #board_[id] -->'; |
@@ -124,12 +128,13 @@ discard block |
||
| 124 | 128 | </div><!-- #boardindex_table -->'; |
| 125 | 129 | |
| 126 | 130 | // Show the mark all as read button? |
| 127 | - if ($context['user']['is_logged'] && !empty($context['categories'])) |
|
| 128 | - echo ' |
|
| 131 | + if ($context['user']['is_logged'] && !empty($context['categories'])) { |
|
| 132 | + echo ' |
|
| 129 | 133 | <div class="mark_read"> |
| 130 | 134 | ', template_button_strip($context['mark_read_button'], 'right'), ' |
| 131 | 135 | </div>'; |
| 132 | -} |
|
| 136 | + } |
|
| 137 | + } |
|
| 133 | 138 | |
| 134 | 139 | /** |
| 135 | 140 | * Outputs the board icon for a standard board. |
@@ -173,18 +178,20 @@ discard block |
||
| 173 | 178 | </a>'; |
| 174 | 179 | |
| 175 | 180 | // Has it outstanding posts for approval? |
| 176 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
| 177 | - echo ' |
|
| 181 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
| 182 | + echo ' |
|
| 178 | 183 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
| 184 | + } |
|
| 179 | 185 | |
| 180 | 186 | echo ' |
| 181 | 187 | <p class="board_description">', $board['description'], '</p>'; |
| 182 | 188 | |
| 183 | 189 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
| 184 | - if (!empty($board['link_moderators'])) |
|
| 185 | - echo ' |
|
| 190 | + if (!empty($board['link_moderators'])) { |
|
| 191 | + echo ' |
|
| 186 | 192 | <p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
| 187 | -} |
|
| 193 | + } |
|
| 194 | + } |
|
| 188 | 195 | |
| 189 | 196 | /** |
| 190 | 197 | * Outputs the board stats for a standard board. |
@@ -225,10 +232,11 @@ discard block |
||
| 225 | 232 | */ |
| 226 | 233 | function template_bi_board_lastpost($board) |
| 227 | 234 | { |
| 228 | - if (!empty($board['last_post']['id'])) |
|
| 229 | - echo ' |
|
| 235 | + if (!empty($board['last_post']['id'])) { |
|
| 236 | + echo ' |
|
| 230 | 237 | <p>', $board['last_post']['last_post_message'], '</p>'; |
| 231 | -} |
|
| 238 | + } |
|
| 239 | + } |
|
| 232 | 240 | |
| 233 | 241 | /** |
| 234 | 242 | * Outputs the board children for a standard board. |
@@ -248,14 +256,16 @@ discard block |
||
| 248 | 256 | id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
| 249 | 257 | foreach ($board['children'] as $child) |
| 250 | 258 | { |
| 251 | - if (!$child['is_redirect']) |
|
| 252 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
| 253 | - else |
|
| 254 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
| 259 | + if (!$child['is_redirect']) { |
|
| 260 | + $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
| 261 | + } else { |
|
| 262 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
| 263 | + } |
|
| 255 | 264 | |
| 256 | 265 | // Has it posts awaiting approval? |
| 257 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) |
|
| 258 | - $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
| 266 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) { |
|
| 267 | + $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
| 268 | + } |
|
| 259 | 269 | |
| 260 | 270 | $children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
| 261 | 271 | } |
@@ -282,8 +292,9 @@ discard block |
||
| 282 | 292 | { |
| 283 | 293 | global $context, $options, $txt; |
| 284 | 294 | |
| 285 | - if (empty($context['info_center'])) |
|
| 286 | - return; |
|
| 295 | + if (empty($context['info_center'])) { |
|
| 296 | + return; |
|
| 297 | + } |
|
| 287 | 298 | |
| 288 | 299 | // Here's where the "Info Center" starts... |
| 289 | 300 | echo ' |
@@ -383,14 +394,15 @@ discard block |
||
| 383 | 394 | /* Each post in latest_posts has: |
| 384 | 395 | board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.), |
| 385 | 396 | subject, short_subject (shortened with...), time, link, and href. */ |
| 386 | - foreach ($context['latest_posts'] as $post) |
|
| 387 | - echo ' |
|
| 397 | + foreach ($context['latest_posts'] as $post) { |
|
| 398 | + echo ' |
|
| 388 | 399 | <tr class="windowbg"> |
| 389 | 400 | <td class="recentpost"><strong>', $post['link'], '</strong></td> |
| 390 | 401 | <td class="recentposter">', $post['poster']['link'], '</td> |
| 391 | 402 | <td class="recentboard">', $post['board']['link'], '</td> |
| 392 | 403 | <td class="recenttime">', $post['time'], '</td> |
| 393 | 404 | </tr>'; |
| 405 | + } |
|
| 394 | 406 | echo ' |
| 395 | 407 | </table>'; |
| 396 | 408 | } |
@@ -414,11 +426,12 @@ discard block |
||
| 414 | 426 | </div>'; |
| 415 | 427 | |
| 416 | 428 | // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P |
| 417 | - if (!empty($context['calendar_holidays'])) |
|
| 418 | - echo ' |
|
| 429 | + if (!empty($context['calendar_holidays'])) { |
|
| 430 | + echo ' |
|
| 419 | 431 | <p class="inline holiday"> |
| 420 | 432 | <span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), ' |
| 421 | 433 | </p>'; |
| 434 | + } |
|
| 422 | 435 | |
| 423 | 436 | // People's birthdays. Like mine. And yours, I guess. Kidding. |
| 424 | 437 | if (!empty($context['calendar_birthdays'])) |
@@ -428,9 +441,10 @@ discard block |
||
| 428 | 441 | <span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>'; |
| 429 | 442 | |
| 430 | 443 | // Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) |
| 431 | - foreach ($context['calendar_birthdays'] as $member) |
|
| 432 | - echo ' |
|
| 444 | + foreach ($context['calendar_birthdays'] as $member) { |
|
| 445 | + echo ' |
|
| 433 | 446 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', '; |
| 447 | + } |
|
| 434 | 448 | |
| 435 | 449 | echo ' |
| 436 | 450 | </p>'; |
@@ -445,9 +459,10 @@ discard block |
||
| 445 | 459 | |
| 446 | 460 | // Each event in calendar_events should have: |
| 447 | 461 | // title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. |
| 448 | - foreach ($context['calendar_events'] as $event) |
|
| 449 | - echo ' |
|
| 462 | + foreach ($context['calendar_events'] as $event) { |
|
| 463 | + echo ' |
|
| 450 | 464 | ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', '; |
| 465 | + } |
|
| 451 | 466 | echo ' |
| 452 | 467 | </p>'; |
| 453 | 468 | } |
@@ -493,17 +508,21 @@ discard block |
||
| 493 | 508 | // Handle hidden users and buddies. |
| 494 | 509 | $bracketList = array(); |
| 495 | 510 | |
| 496 | - if ($context['show_buddies']) |
|
| 497 | - $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 511 | + if ($context['show_buddies']) { |
|
| 512 | + $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 513 | + } |
|
| 498 | 514 | |
| 499 | - if (!empty($context['num_spiders'])) |
|
| 500 | - $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 515 | + if (!empty($context['num_spiders'])) { |
|
| 516 | + $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 517 | + } |
|
| 501 | 518 | |
| 502 | - if (!empty($context['num_users_hidden'])) |
|
| 503 | - $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
| 519 | + if (!empty($context['num_users_hidden'])) { |
|
| 520 | + $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
| 521 | + } |
|
| 504 | 522 | |
| 505 | - if (!empty($bracketList)) |
|
| 506 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 523 | + if (!empty($bracketList)) { |
|
| 524 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 525 | + } |
|
| 507 | 526 | |
| 508 | 527 | echo $context['show_who'] ? '</a>' : '', ' |
| 509 | 528 | |
@@ -517,9 +536,10 @@ discard block |
||
| 517 | 536 | ', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']); |
| 518 | 537 | |
| 519 | 538 | // Showing membergroups? |
| 520 | - if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
|
| 521 | - echo ' |
|
| 539 | + if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) { |
|
| 540 | + echo ' |
|
| 522 | 541 | <span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>'; |
| 542 | + } |
|
| 523 | 543 | } |
| 524 | 544 | |
| 525 | 545 | echo ' |
@@ -22,27 +22,31 @@ discard block |
||
| 22 | 22 | // Get a shortcut to the current list. |
| 23 | 23 | $list_id = $list_id === null ? (!empty($context['default_list']) ? $context['default_list'] : '') : $list_id; |
| 24 | 24 | |
| 25 | - if (empty($list_id) || empty($context[$list_id])) |
|
| 26 | - return; |
|
| 25 | + if (empty($list_id) || empty($context[$list_id])) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | $cur_list = &$context[$list_id]; |
| 29 | 30 | |
| 30 | 31 | // These are the main tabs that is used all around the template. |
| 31 | - if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top')) |
|
| 32 | - template_create_list_menu($cur_list['list_menu'], 'top'); |
|
| 32 | + if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top')) { |
|
| 33 | + template_create_list_menu($cur_list['list_menu'], 'top'); |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | - if (isset($cur_list['form'])) |
|
| 35 | - echo ' |
|
| 36 | + if (isset($cur_list['form'])) { |
|
| 37 | + echo ' |
|
| 36 | 38 | <form action="', $cur_list['form']['href'], '" method="post"', empty($cur_list['form']['name']) ? '' : ' name="' . $cur_list['form']['name'] . '" id="' . $cur_list['form']['name'] . '"', ' accept-charset="', $context['character_set'], '">'; |
| 39 | + } |
|
| 37 | 40 | |
| 38 | 41 | // Show the title of the table (if any). |
| 39 | - if (!empty($cur_list['title'])) |
|
| 40 | - echo ' |
|
| 42 | + if (!empty($cur_list['title'])) { |
|
| 43 | + echo ' |
|
| 41 | 44 | <div class="cat_bar"> |
| 42 | 45 | <h3 class="catbg"> |
| 43 | 46 | ', $cur_list['title'], ' |
| 44 | 47 | </h3> |
| 45 | 48 | </div>'; |
| 49 | + } |
|
| 46 | 50 | |
| 47 | 51 | if (isset($cur_list['additional_rows']['after_title'])) |
| 48 | 52 | { |
@@ -55,20 +59,23 @@ discard block |
||
| 55 | 59 | </div>'; |
| 56 | 60 | } |
| 57 | 61 | |
| 58 | - if (isset($cur_list['additional_rows']['top_of_list'])) |
|
| 59 | - template_additional_rows('top_of_list', $cur_list); |
|
| 62 | + if (isset($cur_list['additional_rows']['top_of_list'])) { |
|
| 63 | + template_additional_rows('top_of_list', $cur_list); |
|
| 64 | + } |
|
| 60 | 65 | |
| 61 | 66 | if ((!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) || isset($cur_list['additional_rows']['above_column_headers'])) |
| 62 | 67 | { |
| 63 | 68 | // Show the page index (if this list doesn't intend to show all items). |
| 64 | - if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) |
|
| 65 | - echo ' |
|
| 69 | + if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) { |
|
| 70 | + echo ' |
|
| 66 | 71 | <div class="floatleft"> |
| 67 | 72 | <div class="pagesection">', $cur_list['page_index'], '</div> |
| 68 | 73 | </div>'; |
| 74 | + } |
|
| 69 | 75 | |
| 70 | - if (isset($cur_list['additional_rows']['above_column_headers'])) |
|
| 71 | - template_additional_rows('above_column_headers', $cur_list); |
|
| 76 | + if (isset($cur_list['additional_rows']['above_column_headers'])) { |
|
| 77 | + template_additional_rows('above_column_headers', $cur_list); |
|
| 78 | + } |
|
| 72 | 79 | } |
| 73 | 80 | |
| 74 | 81 | echo ' |
@@ -83,11 +90,12 @@ discard block |
||
| 83 | 90 | <tr class="title_bar">'; |
| 84 | 91 | |
| 85 | 92 | // Loop through each column and add a table header. |
| 86 | - foreach ($cur_list['headers'] as $col_header) |
|
| 87 | - echo ' |
|
| 93 | + foreach ($cur_list['headers'] as $col_header) { |
|
| 94 | + echo ' |
|
| 88 | 95 | <th scope="col" id="header_', $list_id, '_', $col_header['id'], '"', empty($col_header['class']) ? '' : ' class="' . $col_header['class'] . '"', empty($col_header['style']) ? '' : ' style="' . $col_header['style'] . '"', empty($col_header['colspan']) ? '' : ' colspan="' . $col_header['colspan'] . '"', '> |
| 89 | 96 | ', empty($col_header['href']) ? '' : '<a href="' . $col_header['href'] . '" rel="nofollow">', empty($col_header['label']) ? '' : $col_header['label'], empty($col_header['href']) ? '' : (empty($col_header['sort_image']) ? '</a>' : ' <span class="generic_icons sort_' . $col_header['sort_image'] . '"></span></a>'), ' |
| 90 | 97 | </th>'; |
| 98 | + } |
|
| 91 | 99 | |
| 92 | 100 | echo ' |
| 93 | 101 | </tr> |
@@ -98,13 +106,14 @@ discard block |
||
| 98 | 106 | <tbody>'; |
| 99 | 107 | |
| 100 | 108 | // Show a nice message informing there are no items in this list. |
| 101 | - if (empty($cur_list['rows']) && !empty($cur_list['no_items_label'])) |
|
| 102 | - echo ' |
|
| 109 | + if (empty($cur_list['rows']) && !empty($cur_list['no_items_label'])) { |
|
| 110 | + echo ' |
|
| 103 | 111 | <tr class="windowbg"> |
| 104 | 112 | <td colspan="', $cur_list['num_columns'], '" class="', !empty($cur_list['no_items_align']) ? $cur_list['no_items_align'] : 'centertext', '"> |
| 105 | 113 | ', $cur_list['no_items_label'], ' |
| 106 | 114 | </td> |
| 107 | 115 | </tr>'; |
| 116 | + } |
|
| 108 | 117 | |
| 109 | 118 | // Show the list rows. |
| 110 | 119 | elseif (!empty($cur_list['rows'])) |
@@ -114,12 +123,13 @@ discard block |
||
| 114 | 123 | echo ' |
| 115 | 124 | <tr class="windowbg', empty($row['class']) ? '' : ' ' . $row['class'], '"', empty($row['style']) ? '' : ' style="' . $row['style'] . '"', ' id="list_', $list_id, '_', $id, '">'; |
| 116 | 125 | |
| 117 | - if (!empty($row['data'])) |
|
| 118 | - foreach ($row['data'] as $row_data) |
|
| 126 | + if (!empty($row['data'])) { |
|
| 127 | + foreach ($row['data'] as $row_data) |
|
| 119 | 128 | echo ' |
| 120 | 129 | <td', empty($row_data['class']) ? '' : ' class="' . $row_data['class'] . '"', empty($row_data['style']) ? '' : ' style="' . $row_data['style'] . '"', '> |
| 121 | 130 | ', $row_data['value'], ' |
| 122 | 131 | </td>'; |
| 132 | + } |
|
| 123 | 133 | |
| 124 | 134 | echo ' |
| 125 | 135 | </tr>'; |
@@ -136,46 +146,53 @@ discard block |
||
| 136 | 146 | <div class="flow_auto">'; |
| 137 | 147 | |
| 138 | 148 | // Show the page index (if this list doesn't intend to show all items). |
| 139 | - if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) |
|
| 140 | - echo ' |
|
| 149 | + if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) { |
|
| 150 | + echo ' |
|
| 141 | 151 | <div class="floatleft"> |
| 142 | 152 | <div class="pagesection">', $cur_list['page_index'], '</div> |
| 143 | 153 | </div>'; |
| 154 | + } |
|
| 144 | 155 | |
| 145 | - if (isset($cur_list['additional_rows']['below_table_data'])) |
|
| 146 | - template_additional_rows('below_table_data', $cur_list); |
|
| 156 | + if (isset($cur_list['additional_rows']['below_table_data'])) { |
|
| 157 | + template_additional_rows('below_table_data', $cur_list); |
|
| 158 | + } |
|
| 147 | 159 | |
| 148 | 160 | echo ' |
| 149 | 161 | </div>'; |
| 150 | 162 | } |
| 151 | 163 | |
| 152 | - if (isset($cur_list['additional_rows']['bottom_of_list'])) |
|
| 153 | - template_additional_rows('bottom_of_list', $cur_list); |
|
| 164 | + if (isset($cur_list['additional_rows']['bottom_of_list'])) { |
|
| 165 | + template_additional_rows('bottom_of_list', $cur_list); |
|
| 166 | + } |
|
| 154 | 167 | |
| 155 | 168 | if (isset($cur_list['form'])) |
| 156 | 169 | { |
| 157 | - foreach ($cur_list['form']['hidden_fields'] as $name => $value) |
|
| 158 | - echo ' |
|
| 170 | + foreach ($cur_list['form']['hidden_fields'] as $name => $value) { |
|
| 171 | + echo ' |
|
| 159 | 172 | <input type="hidden" name="', $name, '" value="', $value, '">'; |
| 173 | + } |
|
| 160 | 174 | |
| 161 | - if (isset($cur_list['form']['token'])) |
|
| 162 | - echo ' |
|
| 175 | + if (isset($cur_list['form']['token'])) { |
|
| 176 | + echo ' |
|
| 163 | 177 | <input type="hidden" name="', $context[$cur_list['form']['token'] . '_token_var'], '" value="', $context[$cur_list['form']['token'] . '_token'], '">'; |
| 178 | + } |
|
| 164 | 179 | |
| 165 | 180 | echo ' |
| 166 | 181 | </form>'; |
| 167 | 182 | } |
| 168 | 183 | |
| 169 | 184 | // Tabs at the bottom. Usually bottom aligned. |
| 170 | - if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom')) |
|
| 171 | - template_create_list_menu($cur_list['list_menu'], 'bottom'); |
|
| 185 | + if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom')) { |
|
| 186 | + template_create_list_menu($cur_list['list_menu'], 'bottom'); |
|
| 187 | + } |
|
| 172 | 188 | |
| 173 | - if (isset($cur_list['javascript'])) |
|
| 174 | - echo ' |
|
| 189 | + if (isset($cur_list['javascript'])) { |
|
| 190 | + echo ' |
|
| 175 | 191 | <script> |
| 176 | 192 | ', $cur_list['javascript'], ' |
| 177 | 193 | </script>'; |
| 178 | -} |
|
| 194 | + } |
|
| 195 | + } |
|
| 179 | 196 | |
| 180 | 197 | /** |
| 181 | 198 | * This template displays additional rows above or below the list. |
@@ -185,12 +202,13 @@ discard block |
||
| 185 | 202 | */ |
| 186 | 203 | function template_additional_rows($row_position, $cur_list) |
| 187 | 204 | { |
| 188 | - foreach ($cur_list['additional_rows'][$row_position] as $row) |
|
| 189 | - echo ' |
|
| 205 | + foreach ($cur_list['additional_rows'][$row_position] as $row) { |
|
| 206 | + echo ' |
|
| 190 | 207 | <div class="additional_row', empty($row['class']) ? '' : ' ' . $row['class'], '"', empty($row['style']) ? '' : ' style="' . $row['style'] . '"', '> |
| 191 | 208 | ', $row['value'], ' |
| 192 | 209 | </div>'; |
| 193 | -} |
|
| 210 | + } |
|
| 211 | + } |
|
| 194 | 212 | |
| 195 | 213 | /** |
| 196 | 214 | * This function creates a menu |
@@ -249,18 +267,19 @@ discard block |
||
| 249 | 267 | |
| 250 | 268 | foreach ($list_menu['links'] as $link) |
| 251 | 269 | { |
| 252 | - if ($link['is_selected']) |
|
| 253 | - echo ' |
|
| 270 | + if ($link['is_selected']) { |
|
| 271 | + echo ' |
|
| 254 | 272 | <td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_active_', $first, '"></td> |
| 255 | 273 | <td class="', $direction == 'top' ? 'mirrortab' : 'maintab', '_active_back"> |
| 256 | 274 | <a href="', $link['href'], '">', $link['label'], '</a> |
| 257 | 275 | </td> |
| 258 | 276 | <td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_active_', $last, '"></td>'; |
| 259 | - else |
|
| 260 | - echo ' |
|
| 277 | + } else { |
|
| 278 | + echo ' |
|
| 261 | 279 | <td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_back"> |
| 262 | 280 | <a href="', $link['href'], '">', $link['label'], '</a> |
| 263 | 281 | </td>'; |
| 282 | + } |
|
| 264 | 283 | } |
| 265 | 284 | |
| 266 | 285 | echo ' |
@@ -271,12 +290,12 @@ discard block |
||
| 271 | 290 | <td></td>' : '', ' |
| 272 | 291 | </tr> |
| 273 | 292 | </table>'; |
| 274 | - } |
|
| 275 | - elseif (isset($list_menu['style']) && $list_menu['style'] == 'buttons') |
|
| 293 | + } elseif (isset($list_menu['style']) && $list_menu['style'] == 'buttons') |
|
| 276 | 294 | { |
| 277 | 295 | $links = array(); |
| 278 | - foreach ($list_menu['links'] as $link) |
|
| 279 | - $links[] = '<a href="' . $link['href'] . '">' . $link['label'] . '</a>'; |
|
| 296 | + foreach ($list_menu['links'] as $link) { |
|
| 297 | + $links[] = '<a href="' . $link['href'] . '">' . $link['label'] . '</a>'; |
|
| 298 | + } |
|
| 280 | 299 | |
| 281 | 300 | echo ' |
| 282 | 301 | <table style="margin-', $list_menu['position'], ': 10px; width: 100%;"> |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 4 |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -if (!defined('SMF')) |
|
| 17 | +if (!defined('SMF')) { |
|
| 18 | 18 | die('No direct access...'); |
| 19 | +} |
|
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Fetches a list of boards and (optional) categories including |
@@ -37,11 +38,12 @@ discard block |
||
| 37 | 38 | require_once($sourcedir . '/Subs-Boards.php'); |
| 38 | 39 | |
| 39 | 40 | // For performance, track the latest post while going through the boards. |
| 40 | - if (!empty($boardIndexOptions['set_latest_post'])) |
|
| 41 | - $latest_post = array( |
|
| 41 | + if (!empty($boardIndexOptions['set_latest_post'])) { |
|
| 42 | + $latest_post = array( |
|
| 42 | 43 | 'timestamp' => 0, |
| 43 | 44 | 'ref' => 0, |
| 44 | 45 | ); |
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | // Find all boards and categories, as well as related information. This will be sorted by the natural order of boards and categories, which we control. |
| 47 | 49 | $result_boards = $smcFunc['db_query']('', ' |
@@ -74,10 +76,11 @@ discard block |
||
| 74 | 76 | ); |
| 75 | 77 | |
| 76 | 78 | // Start with an empty array. |
| 77 | - if ($boardIndexOptions['include_categories']) |
|
| 78 | - $categories = array(); |
|
| 79 | - else |
|
| 80 | - $this_category = array(); |
|
| 79 | + if ($boardIndexOptions['include_categories']) { |
|
| 80 | + $categories = array(); |
|
| 81 | + } else { |
|
| 82 | + $this_category = array(); |
|
| 83 | + } |
|
| 81 | 84 | $boards = array(); |
| 82 | 85 | |
| 83 | 86 | // Run through the categories and boards (or only boards).... |
@@ -88,8 +91,9 @@ discard block |
||
| 88 | 91 | $row_board['is_read'] = !empty($row_board['is_read']) || $ignoreThisBoard ? '1' : '0'; |
| 89 | 92 | |
| 90 | 93 | // Add parent boards to the $boards list later used to fetch moderators |
| 91 | - if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) |
|
| 92 | - $boards[] = $row_board['id_board']; |
|
| 94 | + if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) { |
|
| 95 | + $boards[] = $row_board['id_board']; |
|
| 96 | + } |
|
| 93 | 97 | |
| 94 | 98 | if ($boardIndexOptions['include_categories']) |
| 95 | 99 | { |
@@ -111,8 +115,9 @@ discard block |
||
| 111 | 115 | } |
| 112 | 116 | |
| 113 | 117 | // If this board has new posts in it (and isn't the recycle bin!) then the category is new. |
| 114 | - if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) |
|
| 115 | - $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != ''; |
|
| 118 | + if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) { |
|
| 119 | + $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != ''; |
|
| 120 | + } |
|
| 116 | 121 | |
| 117 | 122 | // Avoid showing category unread link where it only has redirection boards. |
| 118 | 123 | $categories[$row_board['id_cat']]['show_unread'] = !empty($categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect']; |
@@ -161,14 +166,12 @@ discard block |
||
| 161 | 166 | { |
| 162 | 167 | $this_category[$row_board['id_board']]['board_class'] = 'redirect'; |
| 163 | 168 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['redirect_board']; |
| 164 | - } |
|
| 165 | - elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest']) |
|
| 169 | + } elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest']) |
|
| 166 | 170 | { |
| 167 | 171 | // If we're showing to guests, we want to give them the idea that something interesting is going on! |
| 168 | 172 | $this_category[$row_board['id_board']]['board_class'] = 'on'; |
| 169 | 173 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts']; |
| 170 | - } |
|
| 171 | - else |
|
| 174 | + } else |
|
| 172 | 175 | { |
| 173 | 176 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts']; |
| 174 | 177 | } |
@@ -219,14 +222,16 @@ discard block |
||
| 219 | 222 | // Child of a child... just add it on... |
| 220 | 223 | elseif (!empty($boardIndexOptions['countChildPosts'])) |
| 221 | 224 | { |
| 222 | - if (!isset($parent_map)) |
|
| 223 | - $parent_map = array(); |
|
| 225 | + if (!isset($parent_map)) { |
|
| 226 | + $parent_map = array(); |
|
| 227 | + } |
|
| 224 | 228 | |
| 225 | - if (!isset($parent_map[$row_board['id_parent']])) |
|
| 226 | - foreach ($this_category as $id => $board) |
|
| 229 | + if (!isset($parent_map[$row_board['id_parent']])) { |
|
| 230 | + foreach ($this_category as $id => $board) |
|
| 227 | 231 | { |
| 228 | 232 | if (!isset($board['children'][$row_board['id_parent']])) |
| 229 | 233 | continue; |
| 234 | + } |
|
| 230 | 235 | |
| 231 | 236 | $parent_map[$row_board['id_parent']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]); |
| 232 | 237 | $parent_map[$row_board['id_board']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]); |
@@ -247,8 +252,9 @@ discard block |
||
| 247 | 252 | continue; |
| 248 | 253 | } |
| 249 | 254 | // Found a child of a child - skip. |
| 250 | - else |
|
| 251 | - continue; |
|
| 255 | + else { |
|
| 256 | + continue; |
|
| 257 | + } |
|
| 252 | 258 | |
| 253 | 259 | // Prepare the subject, and make sure it's not too long. |
| 254 | 260 | censorText($row_board['subject']); |
@@ -269,12 +275,13 @@ discard block |
||
| 269 | 275 | 'topic' => $row_board['id_topic'] |
| 270 | 276 | ); |
| 271 | 277 | |
| 272 | - if (!empty($settings['avatars_on_boardIndex'])) |
|
| 273 | - $this_last_post['member']['avatar'] = set_avatar_data(array( |
|
| 278 | + if (!empty($settings['avatars_on_boardIndex'])) { |
|
| 279 | + $this_last_post['member']['avatar'] = set_avatar_data(array( |
|
| 274 | 280 | 'avatar' => $row_board['avatar'], |
| 275 | 281 | 'email' => $row_board['email_address'], |
| 276 | 282 | 'filename' => !empty($row_board['member_filename']) ? $row_board['member_filename'] : '', |
| 277 | 283 | )); |
| 284 | + } |
|
| 278 | 285 | |
| 279 | 286 | // Provide the href and link. |
| 280 | 287 | if ($row_board['subject'] != '') |
@@ -286,8 +293,7 @@ discard block |
||
| 286 | 293 | link, href, subject, start (where they should go for the first unread post.), |
| 287 | 294 | and member. (which has id, name, link, href, username in it.) */ |
| 288 | 295 | $this_last_post['last_post_message'] = sprintf($txt['last_post_message'], $this_last_post['member']['link'], $this_last_post['link'], $this_last_post['time']); |
| 289 | - } |
|
| 290 | - else |
|
| 296 | + } else |
|
| 291 | 297 | { |
| 292 | 298 | $this_last_post['href'] = ''; |
| 293 | 299 | $this_last_post['link'] = $txt['not_applicable']; |
@@ -295,8 +301,9 @@ discard block |
||
| 295 | 301 | } |
| 296 | 302 | |
| 297 | 303 | // Set the last post in the parent board. |
| 298 | - if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']))) |
|
| 299 | - $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post; |
|
| 304 | + if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']))) { |
|
| 305 | + $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post; |
|
| 306 | + } |
|
| 300 | 307 | // Just in the child...? |
| 301 | 308 | if ($isChild) |
| 302 | 309 | { |
@@ -306,15 +313,17 @@ discard block |
||
| 306 | 313 | $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['new'] &= $row_board['poster_name'] != ''; |
| 307 | 314 | } |
| 308 | 315 | // No last post for this board? It's not new then, is it..? |
| 309 | - elseif ($row_board['poster_name'] == '') |
|
| 310 | - $this_category[$row_board['id_board']]['new'] = false; |
|
| 316 | + elseif ($row_board['poster_name'] == '') { |
|
| 317 | + $this_category[$row_board['id_board']]['new'] = false; |
|
| 318 | + } |
|
| 311 | 319 | |
| 312 | 320 | // Determine a global most recent topic. |
| 313 | - if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) |
|
| 314 | - $latest_post = array( |
|
| 321 | + if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) { |
|
| 322 | + $latest_post = array( |
|
| 315 | 323 | 'timestamp' => $row_board['poster_time'], |
| 316 | 324 | 'ref' => &$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'], |
| 317 | 325 | ); |
| 326 | + } |
|
| 318 | 327 | } |
| 319 | 328 | $smcFunc['db_free_result']($result_boards); |
| 320 | 329 | |
@@ -331,8 +340,9 @@ discard block |
||
| 331 | 340 | if (!empty($moderators[$board['id']])) |
| 332 | 341 | { |
| 333 | 342 | $categories[$k]['boards'][$j]['moderators'] = $moderators[$board['id']]; |
| 334 | - foreach ($moderators[$board['id']] as $moderator) |
|
| 335 | - $categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link']; |
|
| 343 | + foreach ($moderators[$board['id']] as $moderator) { |
|
| 344 | + $categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link']; |
|
| 345 | + } |
|
| 336 | 346 | } |
| 337 | 347 | if (!empty($groups[$board['id']])) |
| 338 | 348 | { |
@@ -345,16 +355,16 @@ discard block |
||
| 345 | 355 | } |
| 346 | 356 | } |
| 347 | 357 | } |
| 348 | - } |
|
| 349 | - else |
|
| 358 | + } else |
|
| 350 | 359 | { |
| 351 | 360 | foreach ($this_category as $k => $board) |
| 352 | 361 | { |
| 353 | 362 | if (!empty($moderators[$board['id']])) |
| 354 | 363 | { |
| 355 | 364 | $this_category[$k]['moderators'] = $moderators[$board['id']]; |
| 356 | - foreach ($moderators[$board['id']] as $moderator) |
|
| 357 | - $this_category[$k]['link_moderators'][] = $moderator['link']; |
|
| 365 | + foreach ($moderators[$board['id']] as $moderator) { |
|
| 366 | + $this_category[$k]['link_moderators'][] = $moderator['link']; |
|
| 367 | + } |
|
| 358 | 368 | } |
| 359 | 369 | if (!empty($groups[$board['id']])) |
| 360 | 370 | { |
@@ -368,20 +378,23 @@ discard block |
||
| 368 | 378 | } |
| 369 | 379 | } |
| 370 | 380 | |
| 371 | - if ($boardIndexOptions['include_categories']) |
|
| 372 | - sortCategories($categories); |
|
| 373 | - else |
|
| 374 | - sortBoards($this_category); |
|
| 381 | + if ($boardIndexOptions['include_categories']) { |
|
| 382 | + sortCategories($categories); |
|
| 383 | + } else { |
|
| 384 | + sortBoards($this_category); |
|
| 385 | + } |
|
| 375 | 386 | |
| 376 | 387 | // By now we should know the most recent post...if we wanna know it that is. |
| 377 | - if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) |
|
| 378 | - $context['latest_post'] = $latest_post['ref']; |
|
| 388 | + if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) { |
|
| 389 | + $context['latest_post'] = $latest_post['ref']; |
|
| 390 | + } |
|
| 379 | 391 | |
| 380 | 392 | // I can't remember why but trying to make a ternary to get this all in one line is actually a Very Bad Idea. |
| 381 | - if ($boardIndexOptions['include_categories']) |
|
| 382 | - call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories)); |
|
| 383 | - else |
|
| 384 | - call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category)); |
|
| 393 | + if ($boardIndexOptions['include_categories']) { |
|
| 394 | + call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories)); |
|
| 395 | + } else { |
|
| 396 | + call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category)); |
|
| 397 | + } |
|
| 385 | 398 | |
| 386 | 399 | return $boardIndexOptions['include_categories'] ? $categories : $this_category; |
| 387 | 400 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * 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 | { |
@@ -240,8 +248,7 @@ discard block |
||
| 240 | 248 | 'language' => $language_ftx |
| 241 | 249 | ) |
| 242 | 250 | ); |
| 243 | - } |
|
| 244 | - else |
|
| 251 | + } else |
|
| 245 | 252 | { |
| 246 | 253 | // Make sure it's gone before creating it. |
| 247 | 254 | $smcFunc['db_query']('', ' |
@@ -259,8 +266,7 @@ discard block |
||
| 259 | 266 | ) |
| 260 | 267 | ); |
| 261 | 268 | } |
| 262 | - } |
|
| 263 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
| 269 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
| 264 | 270 | { |
| 265 | 271 | checkSession('get'); |
| 266 | 272 | validateToken('admin-msm', 'get'); |
@@ -277,12 +283,12 @@ discard block |
||
| 277 | 283 | $context['fulltext_index'] = array(); |
| 278 | 284 | |
| 279 | 285 | // Go back to the default search method. |
| 280 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') |
|
| 281 | - updateSettings(array( |
|
| 286 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') { |
|
| 287 | + updateSettings(array( |
|
| 282 | 288 | 'search_index' => '', |
| 283 | 289 | )); |
| 284 | - } |
|
| 285 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
| 290 | + } |
|
| 291 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
| 286 | 292 | { |
| 287 | 293 | checkSession('get'); |
| 288 | 294 | validateToken('admin-msm', 'get'); |
@@ -304,12 +310,12 @@ discard block |
||
| 304 | 310 | )); |
| 305 | 311 | |
| 306 | 312 | // Go back to the default search method. |
| 307 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
| 308 | - updateSettings(array( |
|
| 313 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
| 314 | + updateSettings(array( |
|
| 309 | 315 | 'search_index' => '', |
| 310 | 316 | )); |
| 311 | - } |
|
| 312 | - elseif (isset($_POST['save'])) |
|
| 317 | + } |
|
| 318 | + } elseif (isset($_POST['save'])) |
|
| 313 | 319 | { |
| 314 | 320 | checkSession(); |
| 315 | 321 | validateToken('admin-msmpost'); |
@@ -331,8 +337,8 @@ discard block |
||
| 331 | 337 | // Get some info about the messages table, to show its size and index size. |
| 332 | 338 | if ($db_type == 'mysql') |
| 333 | 339 | { |
| 334 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
| 335 | - $request = $smcFunc['db_query']('', ' |
|
| 340 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
| 341 | + $request = $smcFunc['db_query']('', ' |
|
| 336 | 342 | SHOW TABLE STATUS |
| 337 | 343 | FROM {string:database_name} |
| 338 | 344 | LIKE {string:table_name}', |
@@ -341,14 +347,15 @@ discard block |
||
| 341 | 347 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
| 342 | 348 | ) |
| 343 | 349 | ); |
| 344 | - else |
|
| 345 | - $request = $smcFunc['db_query']('', ' |
|
| 350 | + } else { |
|
| 351 | + $request = $smcFunc['db_query']('', ' |
|
| 346 | 352 | SHOW TABLE STATUS |
| 347 | 353 | LIKE {string:table_name}', |
| 348 | 354 | array( |
| 349 | 355 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
| 350 | 356 | ) |
| 351 | 357 | ); |
| 358 | + } |
|
| 352 | 359 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
| 353 | 360 | { |
| 354 | 361 | // Only do this if the user has permission to execute this query. |
@@ -360,8 +367,8 @@ discard block |
||
| 360 | 367 | } |
| 361 | 368 | |
| 362 | 369 | // Now check the custom index table, if it exists at all. |
| 363 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
| 364 | - $request = $smcFunc['db_query']('', ' |
|
| 370 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
| 371 | + $request = $smcFunc['db_query']('', ' |
|
| 365 | 372 | SHOW TABLE STATUS |
| 366 | 373 | FROM {string:database_name} |
| 367 | 374 | LIKE {string:table_name}', |
@@ -370,14 +377,15 @@ discard block |
||
| 370 | 377 | 'table_name' => str_replace('_', '\_', $match[2]) . 'log_search_words', |
| 371 | 378 | ) |
| 372 | 379 | ); |
| 373 | - else |
|
| 374 | - $request = $smcFunc['db_query']('', ' |
|
| 380 | + } else { |
|
| 381 | + $request = $smcFunc['db_query']('', ' |
|
| 375 | 382 | SHOW TABLE STATUS |
| 376 | 383 | LIKE {string:table_name}', |
| 377 | 384 | array( |
| 378 | 385 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'log_search_words', |
| 379 | 386 | ) |
| 380 | 387 | ); |
| 388 | + } |
|
| 381 | 389 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
| 382 | 390 | { |
| 383 | 391 | // Only do this if the user has permission to execute this query. |
@@ -386,8 +394,7 @@ discard block |
||
| 386 | 394 | $context['table_info']['custom_index_length'] = $row['Data_length'] + $row['Index_length']; |
| 387 | 395 | $smcFunc['db_free_result']($request); |
| 388 | 396 | } |
| 389 | - } |
|
| 390 | - elseif ($db_type == 'postgresql') |
|
| 397 | + } elseif ($db_type == 'postgresql') |
|
| 391 | 398 | { |
| 392 | 399 | // In order to report the sizes correctly we need to perform vacuum (optimize) on the tables we will be using. |
| 393 | 400 | //db_extend(); |
@@ -429,38 +436,38 @@ discard block |
||
| 429 | 436 | $context['table_info']['data_length'] = (int) $row['table_size']; |
| 430 | 437 | $context['table_info']['index_length'] = (int) $row['index_size']; |
| 431 | 438 | $context['table_info']['fulltext_length'] = (int) $row['index_size']; |
| 432 | - } |
|
| 433 | - elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
| 439 | + } elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
| 434 | 440 | { |
| 435 | 441 | $context['table_info']['index_length'] = (int) $row['index_size']; |
| 436 | 442 | $context['table_info']['custom_index_length'] = (int) $row['index_size']; |
| 437 | 443 | } |
| 438 | 444 | } |
| 439 | 445 | $smcFunc['db_free_result']($request); |
| 440 | - } |
|
| 441 | - else |
|
| 442 | - // Didn't work for some reason... |
|
| 446 | + } else { |
|
| 447 | + // Didn't work for some reason... |
|
| 443 | 448 | $context['table_info'] = array( |
| 444 | 449 | 'data_length' => $txt['not_applicable'], |
| 445 | 450 | 'index_length' => $txt['not_applicable'], |
| 446 | 451 | 'fulltext_length' => $txt['not_applicable'], |
| 447 | 452 | 'custom_index_length' => $txt['not_applicable'], |
| 448 | 453 | ); |
| 449 | - } |
|
| 450 | - else |
|
| 451 | - $context['table_info'] = array( |
|
| 454 | + } |
|
| 455 | + } else { |
|
| 456 | + $context['table_info'] = array( |
|
| 452 | 457 | 'data_length' => $txt['not_applicable'], |
| 453 | 458 | 'index_length' => $txt['not_applicable'], |
| 454 | 459 | 'fulltext_length' => $txt['not_applicable'], |
| 455 | 460 | 'custom_index_length' => $txt['not_applicable'], |
| 456 | 461 | ); |
| 462 | + } |
|
| 457 | 463 | |
| 458 | 464 | // Format the data and index length in kilobytes. |
| 459 | 465 | foreach ($context['table_info'] as $type => $size) |
| 460 | 466 | { |
| 461 | 467 | // If it's not numeric then just break. This database engine doesn't support size. |
| 462 | - if (!is_numeric($size)) |
|
| 463 | - break; |
|
| 468 | + if (!is_numeric($size)) { |
|
| 469 | + break; |
|
| 470 | + } |
|
| 464 | 471 | |
| 465 | 472 | $context['table_info'][$type] = comma_format($context['table_info'][$type] / 1024) . ' ' . $txt['search_method_kilobytes']; |
| 466 | 473 | } |
@@ -489,8 +496,9 @@ discard block |
||
| 489 | 496 | |
| 490 | 497 | // Scotty, we need more time... |
| 491 | 498 | @set_time_limit(600); |
| 492 | - if (function_exists('apache_reset_timeout')) |
|
| 493 | - @apache_reset_timeout(); |
|
| 499 | + if (function_exists('apache_reset_timeout')) { |
|
| 500 | + @apache_reset_timeout(); |
|
| 501 | + } |
|
| 494 | 502 | |
| 495 | 503 | $context[$context['admin_menu_name']]['current_subsection'] = 'method'; |
| 496 | 504 | $context['page_title'] = $txt['search_index_custom']; |
@@ -520,8 +528,7 @@ discard block |
||
| 520 | 528 | $context['start'] = (int) $context['index_settings']['resume_at']; |
| 521 | 529 | unset($context['index_settings']['resume_at']); |
| 522 | 530 | $context['step'] = 1; |
| 523 | - } |
|
| 524 | - else |
|
| 531 | + } else |
|
| 525 | 532 | { |
| 526 | 533 | $context['index_settings'] = array( |
| 527 | 534 | 'bytes_per_word' => isset($_REQUEST['bytes_per_word']) && isset($index_properties[$_REQUEST['bytes_per_word']]) ? (int) $_REQUEST['bytes_per_word'] : 2, |
@@ -530,12 +537,14 @@ discard block |
||
| 530 | 537 | $context['step'] = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0; |
| 531 | 538 | |
| 532 | 539 | // admin timeouts are painful when building these long indexes - but only if we actually have such things enabled |
| 533 | - if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) |
|
| 534 | - $_SESSION['admin_time'] = time(); |
|
| 540 | + if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) { |
|
| 541 | + $_SESSION['admin_time'] = time(); |
|
| 542 | + } |
|
| 535 | 543 | } |
| 536 | 544 | |
| 537 | - if ($context['step'] !== 0) |
|
| 538 | - checkSession('request'); |
|
| 545 | + if ($context['step'] !== 0) { |
|
| 546 | + checkSession('request'); |
|
| 547 | + } |
|
| 539 | 548 | |
| 540 | 549 | // Step 0: let the user determine how they like their index. |
| 541 | 550 | if ($context['step'] === 0) |
@@ -564,12 +573,14 @@ discard block |
||
| 564 | 573 | $smcFunc['db_create_word_search']($index_properties[$context['index_settings']['bytes_per_word']]['column_definition']); |
| 565 | 574 | |
| 566 | 575 | // Temporarily switch back to not using a search index. |
| 567 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
| 568 | - updateSettings(array('search_index' => '')); |
|
| 576 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
| 577 | + updateSettings(array('search_index' => '')); |
|
| 578 | + } |
|
| 569 | 579 | |
| 570 | 580 | // Don't let simultanious processes be updating the search index. |
| 571 | - if (!empty($modSettings['search_custom_index_config'])) |
|
| 572 | - updateSettings(array('search_custom_index_config' => '')); |
|
| 581 | + if (!empty($modSettings['search_custom_index_config'])) { |
|
| 582 | + updateSettings(array('search_custom_index_config' => '')); |
|
| 583 | + } |
|
| 573 | 584 | } |
| 574 | 585 | |
| 575 | 586 | $num_messages = array( |
@@ -585,16 +596,16 @@ discard block |
||
| 585 | 596 | 'starting_id' => $context['start'], |
| 586 | 597 | ) |
| 587 | 598 | ); |
| 588 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 589 | - $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
| 599 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 600 | + $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
| 601 | + } |
|
| 590 | 602 | |
| 591 | 603 | if (empty($num_messages['todo'])) |
| 592 | 604 | { |
| 593 | 605 | $context['step'] = 2; |
| 594 | 606 | $context['percentage'] = 80; |
| 595 | 607 | $context['start'] = 0; |
| 596 | - } |
|
| 597 | - else |
|
| 608 | + } else |
|
| 598 | 609 | { |
| 599 | 610 | // Number of seconds before the next step. |
| 600 | 611 | $stop = time() + 3; |
@@ -635,21 +646,22 @@ discard block |
||
| 635 | 646 | |
| 636 | 647 | $context['start'] += $forced_break ? $number_processed : $messages_per_batch; |
| 637 | 648 | |
| 638 | - if (!empty($inserts)) |
|
| 639 | - $smcFunc['db_insert']('ignore', |
|
| 649 | + if (!empty($inserts)) { |
|
| 650 | + $smcFunc['db_insert']('ignore', |
|
| 640 | 651 | '{db_prefix}log_search_words', |
| 641 | 652 | array('id_word' => 'int', 'id_msg' => 'int'), |
| 642 | 653 | $inserts, |
| 643 | 654 | array('id_word', 'id_msg') |
| 644 | 655 | ); |
| 656 | + } |
|
| 645 | 657 | if ($num_messages['todo'] === 0) |
| 646 | 658 | { |
| 647 | 659 | $context['step'] = 2; |
| 648 | 660 | $context['start'] = 0; |
| 649 | 661 | break; |
| 662 | + } else { |
|
| 663 | + updateSettings(array('search_custom_index_resume' => $smcFunc['json_encode'](array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
| 650 | 664 | } |
| 651 | - else |
|
| 652 | - updateSettings(array('search_custom_index_resume' => $smcFunc['json_encode'](array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
| 653 | 665 | } |
| 654 | 666 | |
| 655 | 667 | // Since there are still two steps to go, 80% is the maximum here. |
@@ -660,9 +672,9 @@ discard block |
||
| 660 | 672 | // Step 2: removing the words that occur too often and are of no use. |
| 661 | 673 | elseif ($context['step'] === 2) |
| 662 | 674 | { |
| 663 | - if ($context['index_settings']['bytes_per_word'] < 4) |
|
| 664 | - $context['step'] = 3; |
|
| 665 | - else |
|
| 675 | + if ($context['index_settings']['bytes_per_word'] < 4) { |
|
| 676 | + $context['step'] = 3; |
|
| 677 | + } else |
|
| 666 | 678 | { |
| 667 | 679 | $stop_words = $context['start'] === 0 || empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']); |
| 668 | 680 | $stop = time() + 3; |
@@ -683,20 +695,22 @@ discard block |
||
| 683 | 695 | 'minimum_messages' => $max_messages, |
| 684 | 696 | ) |
| 685 | 697 | ); |
| 686 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 687 | - $stop_words[] = $row['id_word']; |
|
| 698 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 699 | + $stop_words[] = $row['id_word']; |
|
| 700 | + } |
|
| 688 | 701 | $smcFunc['db_free_result']($request); |
| 689 | 702 | |
| 690 | 703 | updateSettings(array('search_stopwords' => implode(',', $stop_words))); |
| 691 | 704 | |
| 692 | - if (!empty($stop_words)) |
|
| 693 | - $smcFunc['db_query']('', ' |
|
| 705 | + if (!empty($stop_words)) { |
|
| 706 | + $smcFunc['db_query']('', ' |
|
| 694 | 707 | DELETE FROM {db_prefix}log_search_words |
| 695 | 708 | WHERE id_word in ({array_int:stop_words})', |
| 696 | 709 | array( |
| 697 | 710 | 'stop_words' => $stop_words, |
| 698 | 711 | ) |
| 699 | 712 | ); |
| 713 | + } |
|
| 700 | 714 | |
| 701 | 715 | $context['start'] += $index_properties[$context['index_settings']['bytes_per_word']]['step_size']; |
| 702 | 716 | if ($context['start'] > $index_properties[$context['index_settings']['bytes_per_word']]['max_size']) |
@@ -757,8 +771,9 @@ discard block |
||
| 757 | 771 | $searchAPI = new $search_class_name(); |
| 758 | 772 | |
| 759 | 773 | // No Support? NEXT! |
| 760 | - if (!$searchAPI->is_supported) |
|
| 761 | - continue; |
|
| 774 | + if (!$searchAPI->is_supported) { |
|
| 775 | + continue; |
|
| 776 | + } |
|
| 762 | 777 | |
| 763 | 778 | $apis[$index_name] = array( |
| 764 | 779 | 'filename' => $file, |
@@ -805,10 +820,10 @@ discard block |
||
| 805 | 820 | 'messages_ftx' => $db_prefix . 'messages_ftx', |
| 806 | 821 | ) |
| 807 | 822 | ); |
| 808 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 809 | - $context['fulltext_index'][] = $row['indexname']; |
|
| 810 | - } |
|
| 811 | - else |
|
| 823 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 824 | + $context['fulltext_index'][] = $row['indexname']; |
|
| 825 | + } |
|
| 826 | + } else |
|
| 812 | 827 | { |
| 813 | 828 | $request = $smcFunc['db_query']('', ' |
| 814 | 829 | SHOW INDEX |
@@ -819,17 +834,19 @@ discard block |
||
| 819 | 834 | $context['fulltext_index'] = array(); |
| 820 | 835 | if ($request !== false || $smcFunc['db_num_rows']($request) != 0) |
| 821 | 836 | { |
| 822 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 823 | - if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
| 837 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 838 | + if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
| 824 | 839 | $context['fulltext_index'][] = $row['Key_name']; |
| 840 | + } |
|
| 825 | 841 | $smcFunc['db_free_result']($request); |
| 826 | 842 | |
| 827 | - if (is_array($context['fulltext_index'])) |
|
| 828 | - $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
| 843 | + if (is_array($context['fulltext_index'])) { |
|
| 844 | + $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
| 845 | + } |
|
| 829 | 846 | } |
| 830 | 847 | |
| 831 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
| 832 | - $request = $smcFunc['db_query']('', ' |
|
| 848 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
| 849 | + $request = $smcFunc['db_query']('', ' |
|
| 833 | 850 | SHOW TABLE STATUS |
| 834 | 851 | FROM {string:database_name} |
| 835 | 852 | LIKE {string:table_name}', |
@@ -838,20 +855,22 @@ discard block |
||
| 838 | 855 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
| 839 | 856 | ) |
| 840 | 857 | ); |
| 841 | - else |
|
| 842 | - $request = $smcFunc['db_query']('', ' |
|
| 858 | + } else { |
|
| 859 | + $request = $smcFunc['db_query']('', ' |
|
| 843 | 860 | SHOW TABLE STATUS |
| 844 | 861 | LIKE {string:table_name}', |
| 845 | 862 | array( |
| 846 | 863 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
| 847 | 864 | ) |
| 848 | 865 | ); |
| 866 | + } |
|
| 849 | 867 | |
| 850 | 868 | if ($request !== false) |
| 851 | 869 | { |
| 852 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 853 | - if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'](), '5.6.4', '>='))) |
|
| 870 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 871 | + if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'](), '5.6.4', '>='))) |
|
| 854 | 872 | $context['cannot_create_fulltext'] = true; |
| 873 | + } |
|
| 855 | 874 | $smcFunc['db_free_result']($request); |
| 856 | 875 | } |
| 857 | 876 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Get a list of versions that are currently installed on the server. |
@@ -45,8 +46,7 @@ discard block |
||
| 45 | 46 | $temp2 = $temp->getVersion(); |
| 46 | 47 | $im_version = $temp2['versionString']; |
| 47 | 48 | $extension_version = 'Imagick ' . phpversion('Imagick'); |
| 48 | - } |
|
| 49 | - else |
|
| 49 | + } else |
|
| 50 | 50 | { |
| 51 | 51 | $im_version = MagickGetVersionString(); |
| 52 | 52 | $extension_version = 'MagickWand ' . phpversion('MagickWand'); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | if (in_array('db_server', $checkFor)) |
| 62 | 62 | { |
| 63 | 63 | db_extend(); |
| 64 | - if (!isset($db_connection) || $db_connection === false) |
|
| 65 | - trigger_error('getServerVersions(): you need to be connected to the database in order to get its server version', E_USER_NOTICE); |
|
| 66 | - else |
|
| 64 | + if (!isset($db_connection) || $db_connection === false) { |
|
| 65 | + trigger_error('getServerVersions(): you need to be connected to the database in order to get its server version', E_USER_NOTICE); |
|
| 66 | + } else |
|
| 67 | 67 | { |
| 68 | 68 | $versions['db_engine'] = array('title' => sprintf($txt['support_versions_db_engine'], $smcFunc['db_title']), 'version' => ''); |
| 69 | 69 | $versions['db_engine']['version'] = $smcFunc['db_get_vendor'](); |
@@ -75,24 +75,31 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | // If we're using memcache we need the server info. |
| 77 | 77 | $memcache_version = '???'; |
| 78 | - if (!empty($cache_accelerator) && ($cache_accelerator == 'memcached' || $cache_accelerator == 'memcache') && !empty($cache_memcached) && !empty($cacheAPI)) |
|
| 79 | - $memcache_version = $cacheAPI->getVersion(); |
|
| 78 | + if (!empty($cache_accelerator) && ($cache_accelerator == 'memcached' || $cache_accelerator == 'memcache') && !empty($cache_memcached) && !empty($cacheAPI)) { |
|
| 79 | + $memcache_version = $cacheAPI->getVersion(); |
|
| 80 | + } |
|
| 80 | 81 | |
| 81 | 82 | // Check to see if we have any accelerators installed... |
| 82 | - if (in_array('phpa', $checkFor) && isset($_PHPA)) |
|
| 83 | - $versions['phpa'] = array('title' => 'ionCube PHP-Accelerator', 'version' => $_PHPA['VERSION']); |
|
| 84 | - if (in_array('apc', $checkFor) && extension_loaded('apc')) |
|
| 85 | - $versions['apc'] = array('title' => 'Alternative PHP Cache', 'version' => phpversion('apc')); |
|
| 86 | - if (in_array('memcache', $checkFor) && function_exists('memcache_set')) |
|
| 87 | - $versions['memcache'] = array('title' => 'Memcached', 'version' => $memcache_version); |
|
| 88 | - if (in_array('xcache', $checkFor) && function_exists('xcache_set')) |
|
| 89 | - $versions['xcache'] = array('title' => 'XCache', 'version' => XCACHE_VERSION); |
|
| 83 | + if (in_array('phpa', $checkFor) && isset($_PHPA)) { |
|
| 84 | + $versions['phpa'] = array('title' => 'ionCube PHP-Accelerator', 'version' => $_PHPA['VERSION']); |
|
| 85 | + } |
|
| 86 | + if (in_array('apc', $checkFor) && extension_loaded('apc')) { |
|
| 87 | + $versions['apc'] = array('title' => 'Alternative PHP Cache', 'version' => phpversion('apc')); |
|
| 88 | + } |
|
| 89 | + if (in_array('memcache', $checkFor) && function_exists('memcache_set')) { |
|
| 90 | + $versions['memcache'] = array('title' => 'Memcached', 'version' => $memcache_version); |
|
| 91 | + } |
|
| 92 | + if (in_array('xcache', $checkFor) && function_exists('xcache_set')) { |
|
| 93 | + $versions['xcache'] = array('title' => 'XCache', 'version' => XCACHE_VERSION); |
|
| 94 | + } |
|
| 90 | 95 | |
| 91 | - if (in_array('php', $checkFor)) |
|
| 92 | - $versions['php'] = array('title' => 'PHP', 'version' => PHP_VERSION, 'more' => '?action=admin;area=serversettings;sa=phpinfo'); |
|
| 96 | + if (in_array('php', $checkFor)) { |
|
| 97 | + $versions['php'] = array('title' => 'PHP', 'version' => PHP_VERSION, 'more' => '?action=admin;area=serversettings;sa=phpinfo'); |
|
| 98 | + } |
|
| 93 | 99 | |
| 94 | - if (in_array('server', $checkFor)) |
|
| 95 | - $versions['server'] = array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE']); |
|
| 100 | + if (in_array('server', $checkFor)) { |
|
| 101 | + $versions['server'] = array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE']); |
|
| 102 | + } |
|
| 96 | 103 | |
| 97 | 104 | return $versions; |
| 98 | 105 | } |
@@ -132,11 +139,13 @@ discard block |
||
| 132 | 139 | fclose($fp); |
| 133 | 140 | |
| 134 | 141 | // The comment looks rougly like... that. |
| 135 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 136 | - $version_info['file_versions']['SSI.php'] = $match[1]; |
|
| 142 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 143 | + $version_info['file_versions']['SSI.php'] = $match[1]; |
|
| 144 | + } |
|
| 137 | 145 | // Not found! This is bad. |
| 138 | - else |
|
| 139 | - $version_info['file_versions']['SSI.php'] = '??'; |
|
| 146 | + else { |
|
| 147 | + $version_info['file_versions']['SSI.php'] = '??'; |
|
| 148 | + } |
|
| 140 | 149 | } |
| 141 | 150 | |
| 142 | 151 | // Do the paid subscriptions handler? |
@@ -147,11 +156,13 @@ discard block |
||
| 147 | 156 | fclose($fp); |
| 148 | 157 | |
| 149 | 158 | // Found it? |
| 150 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 151 | - $version_info['file_versions']['subscriptions.php'] = $match[1]; |
|
| 159 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 160 | + $version_info['file_versions']['subscriptions.php'] = $match[1]; |
|
| 161 | + } |
|
| 152 | 162 | // If we haven't how do we all get paid? |
| 153 | - else |
|
| 154 | - $version_info['file_versions']['subscriptions.php'] = '??'; |
|
| 163 | + else { |
|
| 164 | + $version_info['file_versions']['subscriptions.php'] = '??'; |
|
| 165 | + } |
|
| 155 | 166 | } |
| 156 | 167 | |
| 157 | 168 | // Load all the files in the Sources directory, except this file and the redirect. |
@@ -166,11 +177,13 @@ discard block |
||
| 166 | 177 | fclose($fp); |
| 167 | 178 | |
| 168 | 179 | // Look for the version comment in the file header. |
| 169 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 170 | - $version_info['file_versions'][$entry] = $match[1]; |
|
| 180 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 181 | + $version_info['file_versions'][$entry] = $match[1]; |
|
| 182 | + } |
|
| 171 | 183 | // It wasn't found, but the file was... show a '??'. |
| 172 | - else |
|
| 173 | - $version_info['file_versions'][$entry] = '??'; |
|
| 184 | + else { |
|
| 185 | + $version_info['file_versions'][$entry] = '??'; |
|
| 186 | + } |
|
| 174 | 187 | } |
| 175 | 188 | } |
| 176 | 189 | $sources_dir->close(); |
@@ -189,11 +202,13 @@ discard block |
||
| 189 | 202 | fclose($fp); |
| 190 | 203 | |
| 191 | 204 | // Look for the version comment in the file header. |
| 192 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 193 | - $version_info['tasks_versions'][$entry] = $match[1]; |
|
| 205 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 206 | + $version_info['tasks_versions'][$entry] = $match[1]; |
|
| 207 | + } |
|
| 194 | 208 | // It wasn't found, but the file was... show a '??'. |
| 195 | - else |
|
| 196 | - $version_info['tasks_versions'][$entry] = '??'; |
|
| 209 | + else { |
|
| 210 | + $version_info['tasks_versions'][$entry] = '??'; |
|
| 211 | + } |
|
| 197 | 212 | } |
| 198 | 213 | } |
| 199 | 214 | $tasks_dir->close(); |
@@ -201,8 +216,9 @@ discard block |
||
| 201 | 216 | |
| 202 | 217 | // Load all the files in the default template directory - and the current theme if applicable. |
| 203 | 218 | $directories = array('default_template_versions' => $settings['default_theme_dir']); |
| 204 | - if ($settings['theme_id'] != 1) |
|
| 205 | - $directories += array('template_versions' => $settings['theme_dir']); |
|
| 219 | + if ($settings['theme_id'] != 1) { |
|
| 220 | + $directories += array('template_versions' => $settings['theme_dir']); |
|
| 221 | + } |
|
| 206 | 222 | |
| 207 | 223 | foreach ($directories as $type => $dirname) |
| 208 | 224 | { |
@@ -217,11 +233,13 @@ discard block |
||
| 217 | 233 | fclose($fp); |
| 218 | 234 | |
| 219 | 235 | // Look for the version comment in the file header. |
| 220 | - if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) |
|
| 221 | - $version_info[$type][$entry] = $match[1]; |
|
| 236 | + if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1) { |
|
| 237 | + $version_info[$type][$entry] = $match[1]; |
|
| 238 | + } |
|
| 222 | 239 | // It wasn't found, but the file was... show a '??'. |
| 223 | - else |
|
| 224 | - $version_info[$type][$entry] = '??'; |
|
| 240 | + else { |
|
| 241 | + $version_info[$type][$entry] = '??'; |
|
| 242 | + } |
|
| 225 | 243 | } |
| 226 | 244 | } |
| 227 | 245 | $this_dir->close(); |
@@ -242,11 +260,13 @@ discard block |
||
| 242 | 260 | list ($name, $language) = explode('.', $entry); |
| 243 | 261 | |
| 244 | 262 | // Look for the version comment in the file header. |
| 245 | - if (preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*' . preg_quote($name, '~') . '(?:[\s]{2}|\*/)~i', $header, $match) == 1) |
|
| 246 | - $version_info['default_language_versions'][$language][$name] = $match[1]; |
|
| 263 | + if (preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*' . preg_quote($name, '~') . '(?:[\s]{2}|\*/)~i', $header, $match) == 1) { |
|
| 264 | + $version_info['default_language_versions'][$language][$name] = $match[1]; |
|
| 265 | + } |
|
| 247 | 266 | // It wasn't found, but the file was... show a '??'. |
| 248 | - else |
|
| 249 | - $version_info['default_language_versions'][$language][$name] = '??'; |
|
| 267 | + else { |
|
| 268 | + $version_info['default_language_versions'][$language][$name] = '??'; |
|
| 269 | + } |
|
| 250 | 270 | } |
| 251 | 271 | } |
| 252 | 272 | $this_dir->close(); |
@@ -261,8 +281,9 @@ discard block |
||
| 261 | 281 | ksort($version_info['tasks_versions']); |
| 262 | 282 | |
| 263 | 283 | // For languages sort each language too. |
| 264 | - foreach ($version_info['default_language_versions'] as $language => $dummy) |
|
| 265 | - ksort($version_info['default_language_versions'][$language]); |
|
| 284 | + foreach ($version_info['default_language_versions'] as $language => $dummy) { |
|
| 285 | + ksort($version_info['default_language_versions'][$language]); |
|
| 286 | + } |
|
| 266 | 287 | } |
| 267 | 288 | return $version_info; |
| 268 | 289 | } |
@@ -304,27 +325,31 @@ discard block |
||
| 304 | 325 | $settingsArray = trim(file_get_contents($boarddir . '/Settings.php')); |
| 305 | 326 | |
| 306 | 327 | // Break it up based on \r or \n, and then clean out extra characters. |
| 307 | - if (strpos($settingsArray, "\n") !== false) |
|
| 308 | - $settingsArray = explode("\n", $settingsArray); |
|
| 309 | - elseif (strpos($settingsArray, "\r") !== false) |
|
| 310 | - $settingsArray = explode("\r", $settingsArray); |
|
| 311 | - else |
|
| 312 | - return; |
|
| 328 | + if (strpos($settingsArray, "\n") !== false) { |
|
| 329 | + $settingsArray = explode("\n", $settingsArray); |
|
| 330 | + } elseif (strpos($settingsArray, "\r") !== false) { |
|
| 331 | + $settingsArray = explode("\r", $settingsArray); |
|
| 332 | + } else { |
|
| 333 | + return; |
|
| 334 | + } |
|
| 313 | 335 | |
| 314 | 336 | // Presumably, the file has to have stuff in it for this function to be called :P. |
| 315 | - if (count($settingsArray) < 10) |
|
| 316 | - return; |
|
| 337 | + if (count($settingsArray) < 10) { |
|
| 338 | + return; |
|
| 339 | + } |
|
| 317 | 340 | |
| 318 | 341 | // remove any /r's that made there way in here |
| 319 | - foreach ($settingsArray as $k => $dummy) |
|
| 320 | - $settingsArray[$k] = strtr($dummy, array("\r" => '')) . "\n"; |
|
| 342 | + foreach ($settingsArray as $k => $dummy) { |
|
| 343 | + $settingsArray[$k] = strtr($dummy, array("\r" => '')) . "\n"; |
|
| 344 | + } |
|
| 321 | 345 | |
| 322 | 346 | // go line by line and see whats changing |
| 323 | 347 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
| 324 | 348 | { |
| 325 | 349 | // Don't trim or bother with it if it's not a variable. |
| 326 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
| 327 | - continue; |
|
| 350 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
| 351 | + continue; |
|
| 352 | + } |
|
| 328 | 353 | |
| 329 | 354 | $settingsArray[$i] = trim($settingsArray[$i]) . "\n"; |
| 330 | 355 | |
@@ -336,8 +361,7 @@ discard block |
||
| 336 | 361 | { |
| 337 | 362 | updateDbLastError($val); |
| 338 | 363 | unset($config_vars[$var]); |
| 339 | - } |
|
| 340 | - elseif (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 364 | + } elseif (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 341 | 365 | { |
| 342 | 366 | $comment = strstr(substr($settingsArray[$i], strpos($settingsArray[$i], ';')), '#'); |
| 343 | 367 | $settingsArray[$i] = '$' . $var . ' = ' . $val . ';' . ($comment == '' ? '' : "\t\t" . rtrim($comment)) . "\n"; |
@@ -348,34 +372,39 @@ discard block |
||
| 348 | 372 | } |
| 349 | 373 | |
| 350 | 374 | // End of the file ... maybe |
| 351 | - if (substr(trim($settingsArray[$i]), 0, 2) == '?' . '>') |
|
| 352 | - $end = $i; |
|
| 375 | + if (substr(trim($settingsArray[$i]), 0, 2) == '?' . '>') { |
|
| 376 | + $end = $i; |
|
| 377 | + } |
|
| 353 | 378 | } |
| 354 | 379 | |
| 355 | 380 | // This should never happen, but apparently it is happening. |
| 356 | - if (empty($end) || $end < 10) |
|
| 357 | - $end = count($settingsArray) - 1; |
|
| 381 | + if (empty($end) || $end < 10) { |
|
| 382 | + $end = count($settingsArray) - 1; |
|
| 383 | + } |
|
| 358 | 384 | |
| 359 | 385 | // Still more variables to go? Then lets add them at the end. |
| 360 | 386 | if (!empty($config_vars)) |
| 361 | 387 | { |
| 362 | - if (trim($settingsArray[$end]) == '?' . '>') |
|
| 363 | - $settingsArray[$end++] = ''; |
|
| 364 | - else |
|
| 365 | - $end++; |
|
| 388 | + if (trim($settingsArray[$end]) == '?' . '>') { |
|
| 389 | + $settingsArray[$end++] = ''; |
|
| 390 | + } else { |
|
| 391 | + $end++; |
|
| 392 | + } |
|
| 366 | 393 | |
| 367 | 394 | // Add in any newly defined vars that were passed |
| 368 | - foreach ($config_vars as $var => $val) |
|
| 369 | - $settingsArray[$end++] = '$' . $var . ' = ' . $val . ';' . "\n"; |
|
| 395 | + foreach ($config_vars as $var => $val) { |
|
| 396 | + $settingsArray[$end++] = '$' . $var . ' = ' . $val . ';' . "\n"; |
|
| 397 | + } |
|
| 370 | 398 | |
| 371 | 399 | $settingsArray[$end] = '?' . '>'; |
| 400 | + } else { |
|
| 401 | + $settingsArray[$end] = trim($settingsArray[$end]); |
|
| 372 | 402 | } |
| 373 | - else |
|
| 374 | - $settingsArray[$end] = trim($settingsArray[$end]); |
|
| 375 | 403 | |
| 376 | 404 | // Sanity error checking: the file needs to be at least 12 lines. |
| 377 | - if (count($settingsArray) < 12) |
|
| 378 | - return; |
|
| 405 | + if (count($settingsArray) < 12) { |
|
| 406 | + return; |
|
| 407 | + } |
|
| 379 | 408 | |
| 380 | 409 | // Try to avoid a few pitfalls: |
| 381 | 410 | // - like a possible race condition, |
@@ -383,8 +412,9 @@ discard block |
||
| 383 | 412 | // |
| 384 | 413 | // Check before you act: if cache is enabled, we can do a simple write test |
| 385 | 414 | // to validate that we even write things on this filesystem. |
| 386 | - if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
| 387 | - $cachedir = $boarddir . '/cache'; |
|
| 415 | + if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
| 416 | + $cachedir = $boarddir . '/cache'; |
|
| 417 | + } |
|
| 388 | 418 | |
| 389 | 419 | $test_fp = @fopen($cachedir . '/settings_update.tmp', "w+"); |
| 390 | 420 | if ($test_fp) |
@@ -419,16 +449,18 @@ discard block |
||
| 419 | 449 | // Well this is not good at all, lets see if we can save this |
| 420 | 450 | $context['settings_message'] = 'settings_error'; |
| 421 | 451 | |
| 422 | - if (file_exists($boarddir . '/Settings_bak.php')) |
|
| 423 | - @copy($boarddir . '/Settings_bak.php', $boarddir . '/Settings.php'); |
|
| 452 | + if (file_exists($boarddir . '/Settings_bak.php')) { |
|
| 453 | + @copy($boarddir . '/Settings_bak.php', $boarddir . '/Settings.php'); |
|
| 454 | + } |
|
| 424 | 455 | } |
| 425 | 456 | } |
| 426 | 457 | |
| 427 | 458 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
| 428 | 459 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
| 429 | - if (function_exists('opcache_invalidate')) |
|
| 430 | - opcache_invalidate($boarddir . '/Settings.php', true); |
|
| 431 | -} |
|
| 460 | + if (function_exists('opcache_invalidate')) { |
|
| 461 | + opcache_invalidate($boarddir . '/Settings.php', true); |
|
| 462 | + } |
|
| 463 | + } |
|
| 432 | 464 | |
| 433 | 465 | /** |
| 434 | 466 | * Saves the time of the last db error for the error log |
@@ -454,8 +486,9 @@ discard block |
||
| 454 | 486 | global $options, $context, $smcFunc, $settings, $user_info; |
| 455 | 487 | |
| 456 | 488 | // This must exist! |
| 457 | - if (!isset($context['admin_preferences'])) |
|
| 458 | - return false; |
|
| 489 | + if (!isset($context['admin_preferences'])) { |
|
| 490 | + return false; |
|
| 491 | + } |
|
| 459 | 492 | |
| 460 | 493 | // This is what we'll be saving. |
| 461 | 494 | $options['admin_preferences'] = $smcFunc['json_encode']($context['admin_preferences']); |
@@ -519,8 +552,9 @@ discard block |
||
| 519 | 552 | $emails_sent = array(); |
| 520 | 553 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 521 | 554 | { |
| 522 | - if (empty($prefs[$row['id_member']]['announcements'])) |
|
| 523 | - continue; |
|
| 555 | + if (empty($prefs[$row['id_member']]['announcements'])) { |
|
| 556 | + continue; |
|
| 557 | + } |
|
| 524 | 558 | |
| 525 | 559 | // Stick their particulars in the replacement data. |
| 526 | 560 | $replacements['IDMEMBER'] = $row['id_member']; |
@@ -539,11 +573,12 @@ discard block |
||
| 539 | 573 | $smcFunc['db_free_result']($request); |
| 540 | 574 | |
| 541 | 575 | // Any additional users we must email this to? |
| 542 | - if (!empty($additional_recipients)) |
|
| 543 | - foreach ($additional_recipients as $recipient) |
|
| 576 | + if (!empty($additional_recipients)) { |
|
| 577 | + foreach ($additional_recipients as $recipient) |
|
| 544 | 578 | { |
| 545 | 579 | if (in_array($recipient['email'], $emails_sent)) |
| 546 | 580 | continue; |
| 581 | + } |
|
| 547 | 582 | |
| 548 | 583 | $replacements['IDMEMBER'] = $recipient['id']; |
| 549 | 584 | $replacements['REALNAME'] = $recipient['name']; |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * The news dispatcher; doesn't do anything, just delegates. |
@@ -67,8 +68,9 @@ discard block |
||
| 67 | 68 | ); |
| 68 | 69 | |
| 69 | 70 | // Force the right area... |
| 70 | - if (substr($_REQUEST['sa'], 0, 7) == 'mailing') |
|
| 71 | - $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 71 | + if (substr($_REQUEST['sa'], 0, 7) == 'mailing') { |
|
| 72 | + $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 73 | + } |
|
| 72 | 74 | |
| 73 | 75 | call_helper($subActions[$_REQUEST['sa']][0]); |
| 74 | 76 | } |
@@ -99,9 +101,10 @@ discard block |
||
| 99 | 101 | $temp_news = explode("\n", $modSettings['news']); |
| 100 | 102 | |
| 101 | 103 | // Remove the items that were selected. |
| 102 | - foreach ($temp_news as $i => $news) |
|
| 103 | - if (in_array($i, $_POST['remove'])) |
|
| 104 | + foreach ($temp_news as $i => $news) { |
|
| 105 | + if (in_array($i, $_POST['remove'])) |
|
| 104 | 106 | unset($temp_news[$i]); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | // Update the database. |
| 107 | 110 | updateSettings(array('news' => implode("\n", $temp_news))); |
@@ -117,9 +120,9 @@ discard block |
||
| 117 | 120 | |
| 118 | 121 | foreach ($_POST['news'] as $i => $news) |
| 119 | 122 | { |
| 120 | - if (trim($news) == '') |
|
| 121 | - unset($_POST['news'][$i]); |
|
| 122 | - else |
|
| 123 | + if (trim($news) == '') { |
|
| 124 | + unset($_POST['news'][$i]); |
|
| 125 | + } else |
|
| 123 | 126 | { |
| 124 | 127 | $_POST['news'][$i] = $smcFunc['htmlspecialchars']($_POST['news'][$i], ENT_QUOTES); |
| 125 | 128 | preparsecode($_POST['news'][$i]); |
@@ -155,12 +158,13 @@ discard block |
||
| 155 | 158 | 'data' => array( |
| 156 | 159 | 'function' => function($news) |
| 157 | 160 | { |
| 158 | - if (is_numeric($news['id'])) |
|
| 159 | - return ' |
|
| 161 | + if (is_numeric($news['id'])) { |
|
| 162 | + return ' |
|
| 160 | 163 | <textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea> |
| 161 | 164 | <div class="floatleft" id="preview_' . $news['id'] . '"></div>'; |
| 162 | - else |
|
| 163 | - return $news['unparsed']; |
|
| 165 | + } else { |
|
| 166 | + return $news['unparsed']; |
|
| 167 | + } |
|
| 164 | 168 | }, |
| 165 | 169 | 'class' => 'half_table', |
| 166 | 170 | ), |
@@ -186,10 +190,11 @@ discard block |
||
| 186 | 190 | 'data' => array( |
| 187 | 191 | 'function' => function($news) |
| 188 | 192 | { |
| 189 | - if (is_numeric($news['id'])) |
|
| 190 | - return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">'; |
|
| 191 | - else |
|
| 192 | - return ''; |
|
| 193 | + if (is_numeric($news['id'])) { |
|
| 194 | + return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">'; |
|
| 195 | + } else { |
|
| 196 | + return ''; |
|
| 197 | + } |
|
| 193 | 198 | }, |
| 194 | 199 | 'class' => 'centercol icon', |
| 195 | 200 | ), |
@@ -283,12 +288,13 @@ discard block |
||
| 283 | 288 | |
| 284 | 289 | $admin_current_news = array(); |
| 285 | 290 | // Ready the current news. |
| 286 | - foreach (explode("\n", $modSettings['news']) as $id => $line) |
|
| 287 | - $admin_current_news[$id] = array( |
|
| 291 | + foreach (explode("\n", $modSettings['news']) as $id => $line) { |
|
| 292 | + $admin_current_news[$id] = array( |
|
| 288 | 293 | 'id' => $id, |
| 289 | 294 | 'unparsed' => un_preparsecode($line), |
| 290 | 295 | 'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext"><$1form></em>', parse_bbc($line)), |
| 291 | 296 | ); |
| 297 | + } |
|
| 292 | 298 | |
| 293 | 299 | $admin_current_news['last'] = array( |
| 294 | 300 | 'id' => 'last', |
@@ -355,10 +361,11 @@ discard block |
||
| 355 | 361 | 'member_count' => 0, |
| 356 | 362 | ); |
| 357 | 363 | |
| 358 | - if ($row['min_posts'] == -1) |
|
| 359 | - $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 360 | - else |
|
| 361 | - $postGroups[$row['id_group']] = $row['id_group']; |
|
| 364 | + if ($row['min_posts'] == -1) { |
|
| 365 | + $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 366 | + } else { |
|
| 367 | + $postGroups[$row['id_group']] = $row['id_group']; |
|
| 368 | + } |
|
| 362 | 369 | } |
| 363 | 370 | $smcFunc['db_free_result']($request); |
| 364 | 371 | |
@@ -374,8 +381,9 @@ discard block |
||
| 374 | 381 | 'post_group_list' => $postGroups, |
| 375 | 382 | ) |
| 376 | 383 | ); |
| 377 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 378 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 384 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 385 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 386 | + } |
|
| 379 | 387 | $smcFunc['db_free_result']($query); |
| 380 | 388 | } |
| 381 | 389 | |
@@ -391,8 +399,9 @@ discard block |
||
| 391 | 399 | 'normal_group_list' => $normalGroups, |
| 392 | 400 | ) |
| 393 | 401 | ); |
| 394 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 395 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 402 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 403 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 404 | + } |
|
| 396 | 405 | $smcFunc['db_free_result']($query); |
| 397 | 406 | |
| 398 | 407 | // Also do those who have it as an additional membergroup - this ones more yucky... |
@@ -409,8 +418,9 @@ discard block |
||
| 409 | 418 | 'blank_string' => '', |
| 410 | 419 | ) |
| 411 | 420 | ); |
| 412 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 413 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 421 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 422 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 423 | + } |
|
| 414 | 424 | $smcFunc['db_free_result']($query); |
| 415 | 425 | } |
| 416 | 426 | |
@@ -461,10 +471,11 @@ discard block |
||
| 461 | 471 | { |
| 462 | 472 | $context[$key] = !empty($_REQUEST[$post]) ? $_REQUEST[$post] : ''; |
| 463 | 473 | |
| 464 | - if (empty($context[$key]) && empty($_REQUEST['xml'])) |
|
| 465 | - $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 466 | - elseif (!empty($_REQUEST['xml'])) |
|
| 467 | - continue; |
|
| 474 | + if (empty($context[$key]) && empty($_REQUEST['xml'])) { |
|
| 475 | + $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 476 | + } elseif (!empty($_REQUEST['xml'])) { |
|
| 477 | + continue; |
|
| 478 | + } |
|
| 468 | 479 | |
| 469 | 480 | preparsecode($context[$key]); |
| 470 | 481 | if ($html) |
@@ -543,10 +554,12 @@ discard block |
||
| 543 | 554 | |
| 544 | 555 | // Start by finding any members! |
| 545 | 556 | $toClean = array(); |
| 546 | - if (!empty($_POST['members'])) |
|
| 547 | - $toClean[] = 'members'; |
|
| 548 | - if (!empty($_POST['exclude_members'])) |
|
| 549 | - $toClean[] = 'exclude_members'; |
|
| 557 | + if (!empty($_POST['members'])) { |
|
| 558 | + $toClean[] = 'members'; |
|
| 559 | + } |
|
| 560 | + if (!empty($_POST['exclude_members'])) { |
|
| 561 | + $toClean[] = 'exclude_members'; |
|
| 562 | + } |
|
| 550 | 563 | if (!empty($toClean)) |
| 551 | 564 | { |
| 552 | 565 | require_once($sourcedir . '/Subs-Auth.php'); |
@@ -558,11 +571,13 @@ discard block |
||
| 558 | 571 | preg_match_all('~"([^"]+)"~', $_POST[$type], $matches); |
| 559 | 572 | $_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type])))); |
| 560 | 573 | |
| 561 | - foreach ($_POST[$type] as $index => $member) |
|
| 562 | - if (strlen(trim($member)) > 0) |
|
| 574 | + foreach ($_POST[$type] as $index => $member) { |
|
| 575 | + if (strlen(trim($member)) > 0) |
|
| 563 | 576 | $_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member))); |
| 564 | - else |
|
| 565 | - unset($_POST[$type][$index]); |
|
| 577 | + } |
|
| 578 | + else { |
|
| 579 | + unset($_POST[$type][$index]); |
|
| 580 | + } |
|
| 566 | 581 | |
| 567 | 582 | // Find the members |
| 568 | 583 | $_POST[$type] = implode(',', array_keys(findMembers($_POST[$type]))); |
@@ -572,16 +587,18 @@ discard block |
||
| 572 | 587 | if (isset($_POST['member_list']) && is_array($_POST['member_list'])) |
| 573 | 588 | { |
| 574 | 589 | $members = array(); |
| 575 | - foreach ($_POST['member_list'] as $member_id) |
|
| 576 | - $members[] = (int) $member_id; |
|
| 590 | + foreach ($_POST['member_list'] as $member_id) { |
|
| 591 | + $members[] = (int) $member_id; |
|
| 592 | + } |
|
| 577 | 593 | $_POST['members'] = implode(',', $members); |
| 578 | 594 | } |
| 579 | 595 | |
| 580 | 596 | if (isset($_POST['exclude_member_list']) && is_array($_POST['exclude_member_list'])) |
| 581 | 597 | { |
| 582 | 598 | $members = array(); |
| 583 | - foreach ($_POST['exclude_member_list'] as $member_id) |
|
| 584 | - $members[] = (int) $member_id; |
|
| 599 | + foreach ($_POST['exclude_member_list'] as $member_id) { |
|
| 600 | + $members[] = (int) $member_id; |
|
| 601 | + } |
|
| 585 | 602 | $_POST['exclude_members'] = implode(',', $members); |
| 586 | 603 | } |
| 587 | 604 | |
@@ -605,8 +622,9 @@ discard block |
||
| 605 | 622 | 'current_time' => time(), |
| 606 | 623 | ) |
| 607 | 624 | ); |
| 608 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 609 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 625 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 626 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 627 | + } |
|
| 610 | 628 | $smcFunc['db_free_result']($request); |
| 611 | 629 | |
| 612 | 630 | $request = $smcFunc['db_query']('', ' |
@@ -641,8 +659,9 @@ discard block |
||
| 641 | 659 | WHERE email_address IN(' . implode(', ', $condition_array) . ')', |
| 642 | 660 | $condition_array_params |
| 643 | 661 | ); |
| 644 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 645 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 662 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 663 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 664 | + } |
|
| 646 | 665 | $smcFunc['db_free_result']($request); |
| 647 | 666 | } |
| 648 | 667 | |
@@ -660,10 +679,11 @@ discard block |
||
| 660 | 679 | ); |
| 661 | 680 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 662 | 681 | { |
| 663 | - if (in_array(3, $context['recipients'])) |
|
| 664 | - $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 665 | - else |
|
| 666 | - $context['recipients']['members'][] = $row['identifier']; |
|
| 682 | + if (in_array(3, $context['recipients'])) { |
|
| 683 | + $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 684 | + } else { |
|
| 685 | + $context['recipients']['members'][] = $row['identifier']; |
|
| 686 | + } |
|
| 667 | 687 | } |
| 668 | 688 | $smcFunc['db_free_result']($request); |
| 669 | 689 | } |
@@ -710,8 +730,9 @@ discard block |
||
| 710 | 730 | $num_at_once = 1000; |
| 711 | 731 | |
| 712 | 732 | // If by PM's I suggest we half the above number. |
| 713 | - if (!empty($_POST['send_pm'])) |
|
| 714 | - $num_at_once /= 2; |
|
| 733 | + if (!empty($_POST['send_pm'])) { |
|
| 734 | + $num_at_once /= 2; |
|
| 735 | + } |
|
| 715 | 736 | |
| 716 | 737 | checkSession(); |
| 717 | 738 | |
@@ -734,8 +755,7 @@ discard block |
||
| 734 | 755 | ); |
| 735 | 756 | list ($context['total_members']) = $smcFunc['db_fetch_row']($request); |
| 736 | 757 | $smcFunc['db_free_result']($request); |
| 737 | - } |
|
| 738 | - else |
|
| 758 | + } else |
|
| 739 | 759 | { |
| 740 | 760 | $context['total_members'] = (int) $_REQUEST['total_members']; |
| 741 | 761 | } |
@@ -753,32 +773,35 @@ discard block |
||
| 753 | 773 | if (!empty($_POST['exclude_members'])) |
| 754 | 774 | { |
| 755 | 775 | $members = explode(',', $_POST['exclude_members']); |
| 756 | - foreach ($members as $member) |
|
| 757 | - if ($member >= $context['start']) |
|
| 776 | + foreach ($members as $member) { |
|
| 777 | + if ($member >= $context['start']) |
|
| 758 | 778 | $context['recipients']['exclude_members'][] = (int) $member; |
| 779 | + } |
|
| 759 | 780 | } |
| 760 | 781 | |
| 761 | 782 | // What about members we *must* do? |
| 762 | 783 | if (!empty($_POST['members'])) |
| 763 | 784 | { |
| 764 | 785 | $members = explode(',', $_POST['members']); |
| 765 | - foreach ($members as $member) |
|
| 766 | - if ($member >= $context['start']) |
|
| 786 | + foreach ($members as $member) { |
|
| 787 | + if ($member >= $context['start']) |
|
| 767 | 788 | $context['recipients']['members'][] = (int) $member; |
| 789 | + } |
|
| 768 | 790 | } |
| 769 | 791 | // Cleaning groups is simple - although deal with both checkbox and commas. |
| 770 | 792 | if (isset($_POST['groups'])) |
| 771 | 793 | { |
| 772 | 794 | if (is_array($_POST['groups'])) |
| 773 | 795 | { |
| 774 | - foreach ($_POST['groups'] as $group => $dummy) |
|
| 775 | - $context['recipients']['groups'][] = (int) $group; |
|
| 776 | - } |
|
| 777 | - else |
|
| 796 | + foreach ($_POST['groups'] as $group => $dummy) { |
|
| 797 | + $context['recipients']['groups'][] = (int) $group; |
|
| 798 | + } |
|
| 799 | + } else |
|
| 778 | 800 | { |
| 779 | 801 | $groups = explode(',', $_POST['groups']); |
| 780 | - foreach ($groups as $group) |
|
| 781 | - $context['recipients']['groups'][] = (int) $group; |
|
| 802 | + foreach ($groups as $group) { |
|
| 803 | + $context['recipients']['groups'][] = (int) $group; |
|
| 804 | + } |
|
| 782 | 805 | } |
| 783 | 806 | } |
| 784 | 807 | // Same for excluded groups |
@@ -786,15 +809,17 @@ discard block |
||
| 786 | 809 | { |
| 787 | 810 | if (is_array($_POST['exclude_groups'])) |
| 788 | 811 | { |
| 789 | - foreach ($_POST['exclude_groups'] as $group => $dummy) |
|
| 790 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 812 | + foreach ($_POST['exclude_groups'] as $group => $dummy) { |
|
| 813 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 814 | + } |
|
| 791 | 815 | } |
| 792 | 816 | // Ignore an empty string - we don't want to exclude "Regular Members" unless it's specifically selected |
| 793 | 817 | elseif ($_POST['exclude_groups'] != '') |
| 794 | 818 | { |
| 795 | 819 | $groups = explode(',', $_POST['exclude_groups']); |
| 796 | - foreach ($groups as $group) |
|
| 797 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 820 | + foreach ($groups as $group) { |
|
| 821 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 822 | + } |
|
| 798 | 823 | } |
| 799 | 824 | } |
| 800 | 825 | // Finally - emails! |
@@ -804,14 +829,16 @@ discard block |
||
| 804 | 829 | foreach ($addressed as $curmem) |
| 805 | 830 | { |
| 806 | 831 | $curmem = trim($curmem); |
| 807 | - if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) |
|
| 808 | - $context['recipients']['emails'][$curmem] = $curmem; |
|
| 832 | + if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) { |
|
| 833 | + $context['recipients']['emails'][$curmem] = $curmem; |
|
| 834 | + } |
|
| 809 | 835 | } |
| 810 | 836 | } |
| 811 | 837 | |
| 812 | 838 | // If we're only cleaning drop out here. |
| 813 | - if ($clean_only) |
|
| 814 | - return; |
|
| 839 | + if ($clean_only) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 815 | 842 | |
| 816 | 843 | require_once($sourcedir . '/Subs-Post.php'); |
| 817 | 844 | |
@@ -827,16 +854,18 @@ discard block |
||
| 827 | 854 | if (!$context['send_pm'] && !empty($_POST['send_html'])) |
| 828 | 855 | { |
| 829 | 856 | // Prepare the message for HTML. |
| 830 | - if (!empty($_POST['parse_html'])) |
|
| 831 | - $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 857 | + if (!empty($_POST['parse_html'])) { |
|
| 858 | + $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 859 | + } |
|
| 832 | 860 | |
| 833 | 861 | // This is here to prevent spam filters from tagging this as spam. |
| 834 | 862 | if (preg_match('~\<html~i', $_POST['message']) == 0) |
| 835 | 863 | { |
| 836 | - if (preg_match('~\<body~i', $_POST['message']) == 0) |
|
| 837 | - $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 838 | - else |
|
| 839 | - $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 864 | + if (preg_match('~\<body~i', $_POST['message']) == 0) { |
|
| 865 | + $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 866 | + } else { |
|
| 867 | + $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 868 | + } |
|
| 840 | 869 | } |
| 841 | 870 | } |
| 842 | 871 | |
@@ -890,15 +919,17 @@ discard block |
||
| 890 | 919 | foreach ($context['recipients']['emails'] as $k => $email) |
| 891 | 920 | { |
| 892 | 921 | // Done as many as we can? |
| 893 | - if ($i >= $num_at_once) |
|
| 894 | - break; |
|
| 922 | + if ($i >= $num_at_once) { |
|
| 923 | + break; |
|
| 924 | + } |
|
| 895 | 925 | |
| 896 | 926 | // Don't sent it twice! |
| 897 | 927 | unset($context['recipients']['emails'][$k]); |
| 898 | 928 | |
| 899 | 929 | // Dammit - can't PM emails! |
| 900 | - if ($context['send_pm']) |
|
| 901 | - continue; |
|
| 930 | + if ($context['send_pm']) { |
|
| 931 | + continue; |
|
| 932 | + } |
|
| 902 | 933 | |
| 903 | 934 | $to_member = array( |
| 904 | 935 | $email, |
@@ -932,8 +963,9 @@ discard block |
||
| 932 | 963 | $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}'; |
| 933 | 964 | } |
| 934 | 965 | } |
| 935 | - if (!empty($queryBuild)) |
|
| 936 | - $sendQuery .= implode(' OR ', $queryBuild); |
|
| 966 | + if (!empty($queryBuild)) { |
|
| 967 | + $sendQuery .= implode(' OR ', $queryBuild); |
|
| 968 | + } |
|
| 937 | 969 | } |
| 938 | 970 | if (!empty($context['recipients']['members'])) |
| 939 | 971 | { |
@@ -952,8 +984,9 @@ discard block |
||
| 952 | 984 | } |
| 953 | 985 | |
| 954 | 986 | // Anything to exclude? |
| 955 | - if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) |
|
| 956 | - $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 987 | + if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) { |
|
| 988 | + $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 989 | + } |
|
| 957 | 990 | if (!empty($context['recipients']['exclude_members'])) |
| 958 | 991 | { |
| 959 | 992 | $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})'; |
@@ -989,21 +1022,24 @@ discard block |
||
| 989 | 1022 | foreach ($rows as $row) |
| 990 | 1023 | { |
| 991 | 1024 | // Force them to have it? |
| 992 | - if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) |
|
| 993 | - continue; |
|
| 1025 | + if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) { |
|
| 1026 | + continue; |
|
| 1027 | + } |
|
| 994 | 1028 | |
| 995 | 1029 | // What groups are we looking at here? |
| 996 | - if (empty($row['additional_groups'])) |
|
| 997 | - $groups = array($row['id_group'], $row['id_post_group']); |
|
| 998 | - else |
|
| 999 | - $groups = array_merge( |
|
| 1030 | + if (empty($row['additional_groups'])) { |
|
| 1031 | + $groups = array($row['id_group'], $row['id_post_group']); |
|
| 1032 | + } else { |
|
| 1033 | + $groups = array_merge( |
|
| 1000 | 1034 | array($row['id_group'], $row['id_post_group']), |
| 1001 | 1035 | explode(',', $row['additional_groups']) |
| 1002 | 1036 | ); |
| 1037 | + } |
|
| 1003 | 1038 | |
| 1004 | 1039 | // Excluded groups? |
| 1005 | - if (array_intersect($groups, $context['recipients']['exclude_groups'])) |
|
| 1006 | - continue; |
|
| 1040 | + if (array_intersect($groups, $context['recipients']['exclude_groups'])) { |
|
| 1041 | + continue; |
|
| 1042 | + } |
|
| 1007 | 1043 | |
| 1008 | 1044 | // We might need this |
| 1009 | 1045 | $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name']; |
@@ -1026,10 +1062,11 @@ discard block |
||
| 1026 | 1062 | ), $_POST['subject']); |
| 1027 | 1063 | |
| 1028 | 1064 | // Send the actual email - or a PM! |
| 1029 | - if (!$context['send_pm']) |
|
| 1030 | - sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1031 | - else |
|
| 1032 | - sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1065 | + if (!$context['send_pm']) { |
|
| 1066 | + sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1067 | + } else { |
|
| 1068 | + sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1069 | + } |
|
| 1033 | 1070 | } |
| 1034 | 1071 | } |
| 1035 | 1072 | |
@@ -1079,8 +1116,9 @@ discard block |
||
| 1079 | 1116 | |
| 1080 | 1117 | call_integration_hook('integrate_modify_news_settings', array(&$config_vars)); |
| 1081 | 1118 | |
| 1082 | - if ($return_config) |
|
| 1083 | - return $config_vars; |
|
| 1119 | + if ($return_config) { |
|
| 1120 | + return $config_vars; |
|
| 1121 | + } |
|
| 1084 | 1122 | |
| 1085 | 1123 | $context['page_title'] = $txt['admin_edit_news'] . ' - ' . $txt['settings']; |
| 1086 | 1124 | $context['sub_template'] = 'show_settings'; |
@@ -54,18 +54,20 @@ discard block |
||
| 54 | 54 | <div class="windowbg2 noup" id="group_requests_panel"> |
| 55 | 55 | <ul>'; |
| 56 | 56 | |
| 57 | - foreach ($context['group_requests'] as $request) |
|
| 58 | - echo ' |
|
| 57 | + foreach ($context['group_requests'] as $request) { |
|
| 58 | + echo ' |
|
| 59 | 59 | <li class="smalltext"> |
| 60 | 60 | <a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], ' |
| 61 | 61 | </li>'; |
| 62 | + } |
|
| 62 | 63 | |
| 63 | 64 | // Don't have any watched users right now? |
| 64 | - if (empty($context['group_requests'])) |
|
| 65 | - echo ' |
|
| 65 | + if (empty($context['group_requests'])) { |
|
| 66 | + echo ' |
|
| 66 | 67 | <li> |
| 67 | 68 | <strong class="smalltext">', $txt['mc_group_requests_none'], '</strong> |
| 68 | 69 | </li>'; |
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | echo ' |
| 71 | 73 | </ul> |
@@ -121,18 +123,20 @@ discard block |
||
| 121 | 123 | <div class="windowbg2 noup" id="watched_users_panel"> |
| 122 | 124 | <ul>'; |
| 123 | 125 | |
| 124 | - foreach ($context['watched_users'] as $user) |
|
| 125 | - echo ' |
|
| 126 | + foreach ($context['watched_users'] as $user) { |
|
| 127 | + echo ' |
|
| 126 | 128 | <li> |
| 127 | 129 | <span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span> |
| 128 | 130 | </li>'; |
| 131 | + } |
|
| 129 | 132 | |
| 130 | 133 | // Don't have any watched users right now? |
| 131 | - if (empty($context['watched_users'])) |
|
| 132 | - echo ' |
|
| 134 | + if (empty($context['watched_users'])) { |
|
| 135 | + echo ' |
|
| 133 | 136 | <li> |
| 134 | 137 | <strong class="smalltext">', $txt['mc_watched_users_none'], '</strong> |
| 135 | 138 | </li>'; |
| 139 | + } |
|
| 136 | 140 | |
| 137 | 141 | echo ' |
| 138 | 142 | </ul> |
@@ -188,18 +192,20 @@ discard block |
||
| 188 | 192 | <div class="windowbg2 noup" id="reported_posts_panel"> |
| 189 | 193 | <ul>'; |
| 190 | 194 | |
| 191 | - foreach ($context['reported_posts'] as $post) |
|
| 192 | - echo ' |
|
| 195 | + foreach ($context['reported_posts'] as $post) { |
|
| 196 | + echo ' |
|
| 193 | 197 | <li> |
| 194 | 198 | <span class="smalltext">', sprintf($txt['mc_post_report'], $post['report_link'], $post['author']['link']), '</span> |
| 195 | 199 | </li>'; |
| 200 | + } |
|
| 196 | 201 | |
| 197 | 202 | // Don't have any watched users right now? |
| 198 | - if (empty($context['reported_posts'])) |
|
| 199 | - echo ' |
|
| 203 | + if (empty($context['reported_posts'])) { |
|
| 204 | + echo ' |
|
| 200 | 205 | <li> |
| 201 | 206 | <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong> |
| 202 | 207 | </li>'; |
| 208 | + } |
|
| 203 | 209 | |
| 204 | 210 | echo ' |
| 205 | 211 | </ul> |
@@ -255,18 +261,20 @@ discard block |
||
| 255 | 261 | <div class="windowbg2 noup" id="reported_users_panel"> |
| 256 | 262 | <ul>'; |
| 257 | 263 | |
| 258 | - foreach ($context['reported_users'] as $user) |
|
| 259 | - echo ' |
|
| 264 | + foreach ($context['reported_users'] as $user) { |
|
| 265 | + echo ' |
|
| 260 | 266 | <li> |
| 261 | 267 | <span class="smalltext">', $user['user']['link'], '</span> |
| 262 | 268 | </li>'; |
| 269 | + } |
|
| 263 | 270 | |
| 264 | 271 | // Don't have any watched users right now? |
| 265 | - if (empty($context['reported_users'])) |
|
| 266 | - echo ' |
|
| 272 | + if (empty($context['reported_users'])) { |
|
| 273 | + echo ' |
|
| 267 | 274 | <li> |
| 268 | 275 | <strong class="smalltext">', $txt['mc_reported_users_none'], '</strong> |
| 269 | 276 | </li>'; |
| 277 | + } |
|
| 270 | 278 | |
| 271 | 279 | echo ' |
| 272 | 280 | </ul> |
@@ -313,11 +321,12 @@ discard block |
||
| 313 | 321 | global $context, $txt, $scripturl; |
| 314 | 322 | |
| 315 | 323 | // Let them know the action was a success. |
| 316 | - if (!empty($context['report_post_action'])) |
|
| 317 | - echo ' |
|
| 324 | + if (!empty($context['report_post_action'])) { |
|
| 325 | + echo ' |
|
| 318 | 326 | <div class="infobox"> |
| 319 | 327 | ', $txt['report_action_' . $context['report_post_action']], ' |
| 320 | 328 | </div>'; |
| 329 | + } |
|
| 321 | 330 | |
| 322 | 331 | echo ' |
| 323 | 332 | <div id="modnotes"> |
@@ -333,11 +342,12 @@ discard block |
||
| 333 | 342 | <ul class="moderation_notes">'; |
| 334 | 343 | |
| 335 | 344 | // Cycle through the notes. |
| 336 | - foreach ($context['notes'] as $note) |
|
| 337 | - echo ' |
|
| 345 | + foreach ($context['notes'] as $note) { |
|
| 346 | + echo ' |
|
| 338 | 347 | <li class="smalltext"> |
| 339 | 348 | ', ($note['can_delete'] ? '<a href="' . $note['delete_href'] . ';' . $context['mod-modnote-del_token_var'] . '=' . $context['mod-modnote-del_token'] . '" data-confirm="' . $txt['mc_reportedp_delete_confirm'] . '" class="you_sure"><span class="generic_icons delete"></span></a>' : ''), $note['time'], ' <strong>', $note['author']['link'], ':</strong> ', $note['text'], ' |
| 340 | 349 | </li>'; |
| 350 | + } |
|
| 341 | 351 | |
| 342 | 352 | echo ' |
| 343 | 353 | </ul> |
@@ -378,18 +388,19 @@ discard block |
||
| 378 | 388 | $remove_button = create_button('delete', 'remove_message', 'remove'); |
| 379 | 389 | |
| 380 | 390 | // No posts? |
| 381 | - if (empty($context['unapproved_items'])) |
|
| 382 | - echo ' |
|
| 391 | + if (empty($context['unapproved_items'])) { |
|
| 392 | + echo ' |
|
| 383 | 393 | <div class="windowbg2"> |
| 384 | 394 | <p class="centertext"> |
| 385 | 395 | ', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], ' |
| 386 | 396 | </p> |
| 387 | 397 | </div>'; |
| 388 | - else |
|
| 389 | - echo ' |
|
| 398 | + } else { |
|
| 399 | + echo ' |
|
| 390 | 400 | <div class="pagesection floatleft"> |
| 391 | 401 | ', $context['page_index'], ' |
| 392 | 402 | </div>'; |
| 403 | + } |
|
| 393 | 404 | |
| 394 | 405 | foreach ($context['unapproved_items'] as $item) |
| 395 | 406 | { |
@@ -408,14 +419,16 @@ discard block |
||
| 408 | 419 | <span class="floatright"> |
| 409 | 420 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';approve=', $item['id'], '">', $approve_button, '</a>'; |
| 410 | 421 | |
| 411 | - if ($item['can_delete']) |
|
| 412 | - echo ' |
|
| 422 | + if ($item['can_delete']) { |
|
| 423 | + echo ' |
|
| 413 | 424 | ', $context['menu_separator'], ' |
| 414 | 425 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', $context['current_view'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';delete=', $item['id'], '">', $remove_button, '</a>'; |
| 426 | + } |
|
| 415 | 427 | |
| 416 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
| 417 | - echo ' |
|
| 428 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
| 429 | + echo ' |
|
| 418 | 430 | <input type="checkbox" name="item[]" value="', $item['id'], '" checked> '; |
| 431 | + } |
|
| 419 | 432 | |
| 420 | 433 | echo ' |
| 421 | 434 | </span> |
@@ -425,8 +438,8 @@ discard block |
||
| 425 | 438 | echo ' |
| 426 | 439 | <div class="pagesection">'; |
| 427 | 440 | |
| 428 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
| 429 | - echo ' |
|
| 441 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
| 442 | + echo ' |
|
| 430 | 443 | <div class="floatright"> |
| 431 | 444 | <select name="do" onchange="if (this.value != 0 && confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();"> |
| 432 | 445 | <option value="0">', $txt['with_selected'], ':</option> |
@@ -438,12 +451,14 @@ discard block |
||
| 438 | 451 | <input type="submit" name="mc_go" value="', $txt['go'], '" class="button"> |
| 439 | 452 | </noscript> |
| 440 | 453 | </div>'; |
| 454 | + } |
|
| 441 | 455 | |
| 442 | - if (!empty($context['unapproved_items'])) |
|
| 443 | - echo ' |
|
| 456 | + if (!empty($context['unapproved_items'])) { |
|
| 457 | + echo ' |
|
| 444 | 458 | <div class="floatleft"> |
| 445 | 459 | <div class="pagelinks">', $context['page_index'], '</div> |
| 446 | 460 | </div>'; |
| 461 | + } |
|
| 447 | 462 | |
| 448 | 463 | echo ' |
| 449 | 464 | </div><!-- .pagesection --> |
@@ -464,8 +479,9 @@ discard block |
||
| 464 | 479 | |
| 465 | 480 | // We'll have a delete please bob. |
| 466 | 481 | // @todo Discuss this with the team and rewrite if required. |
| 467 | - if (empty($delete_button)) |
|
| 468 | - $delete_button = create_button('delete', 'remove_message', 'remove', 'class="centericon"'); |
|
| 482 | + if (empty($delete_button)) { |
|
| 483 | + $delete_button = create_button('delete', 'remove_message', 'remove', 'class="centericon"'); |
|
| 484 | + } |
|
| 469 | 485 | |
| 470 | 486 | $output_html = ' |
| 471 | 487 | <div> |
@@ -474,10 +490,11 @@ discard block |
||
| 474 | 490 | </div> |
| 475 | 491 | <div class="floatright">'; |
| 476 | 492 | |
| 477 | - if ($post['can_delete']) |
|
| 478 | - $output_html .= ' |
|
| 493 | + if ($post['can_delete']) { |
|
| 494 | + $output_html .= ' |
|
| 479 | 495 | <a href="' . $scripturl . '?action=moderate;area=userwatch;sa=post;delete=' . $post['id'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" data-confirm="' . $txt['mc_watched_users_delete_post'] . '" class="you_sure">' . $delete_button . '</a> |
| 480 | 496 | <input type="checkbox" name="delete[]" value="' . $post['id'] . '">'; |
| 497 | + } |
|
| 481 | 498 | |
| 482 | 499 | $output_html .= ' |
| 483 | 500 | </div> |
@@ -521,12 +538,12 @@ discard block |
||
| 521 | 538 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
| 522 | 539 | </div> |
| 523 | 540 | </form>'; |
| 524 | - } |
|
| 525 | - else |
|
| 526 | - echo ' |
|
| 541 | + } else { |
|
| 542 | + echo ' |
|
| 527 | 543 | <div class="windowbg"> |
| 528 | 544 | <div class="centertext">', $txt['mc_no_settings'], '</div> |
| 529 | 545 | </div>'; |
| 546 | + } |
|
| 530 | 547 | |
| 531 | 548 | echo ' |
| 532 | 549 | </div><!-- #modcenter -->'; |
@@ -622,13 +639,14 @@ discard block |
||
| 622 | 639 | </dd> |
| 623 | 640 | </dl>'; |
| 624 | 641 | |
| 625 | - if ($context['template_data']['can_edit_personal']) |
|
| 626 | - echo ' |
|
| 642 | + if ($context['template_data']['can_edit_personal']) { |
|
| 643 | + echo ' |
|
| 627 | 644 | <input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', '> |
| 628 | 645 | <label for="make_personal"> |
| 629 | 646 | <strong>', $txt['mc_warning_template_personal'], '</strong> |
| 630 | 647 | </label> |
| 631 | 648 | <p class="smalltext">', $txt['mc_warning_template_personal_desc'], '</p>'; |
| 649 | + } |
|
| 632 | 650 | |
| 633 | 651 | echo ' |
| 634 | 652 | <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button"> |