@@ -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,22 +74,24 @@ 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;"' : '', '>', $group['num_permissions']['allowed'], '</td> |
89 | 93 | <td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>', $group['num_permissions']['denied'], '</td>'; |
94 | + } |
|
90 | 95 | |
91 | 96 | echo ' |
92 | 97 | <td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '</td> |
@@ -133,9 +138,10 @@ discard block |
||
133 | 138 | <option value="empty">(', $txt['permissions_select_membergroup'], ')</option>'; |
134 | 139 | foreach ($context['groups'] as $group) |
135 | 140 | { |
136 | - if ($group['id'] != 1) |
|
137 | - echo ' |
|
141 | + if ($group['id'] != 1) { |
|
142 | + echo ' |
|
138 | 143 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
144 | + } |
|
139 | 145 | } |
140 | 146 | |
141 | 147 | echo ' |
@@ -145,9 +151,10 @@ discard block |
||
145 | 151 | <select name="add_remove"> |
146 | 152 | <option value="add">', $txt['permissions_add'], '...</option> |
147 | 153 | <option value="clear">', $txt['permissions_remove'], '...</option>'; |
148 | - if (!empty($modSettings['permission_enable_deny'])) |
|
149 | - echo ' |
|
154 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
155 | + echo ' |
|
150 | 156 | <option value="deny">', $txt['permissions_deny'], '...</option>'; |
157 | + } |
|
151 | 158 | echo ' |
152 | 159 | </select> |
153 | 160 | </dt> |
@@ -156,30 +163,34 @@ discard block |
||
156 | 163 | <option value="">(', $txt['permissions_select_permission'], ')</option>'; |
157 | 164 | foreach ($context['permissions'] as $permissionType) |
158 | 165 | { |
159 | - if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) |
|
160 | - continue; |
|
166 | + if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) { |
|
167 | + continue; |
|
168 | + } |
|
161 | 169 | |
162 | 170 | foreach ($permissionType['columns'] as $column) |
163 | 171 | { |
164 | 172 | foreach ($column as $permissionGroup) |
165 | 173 | { |
166 | - if ($permissionGroup['hidden']) |
|
167 | - continue; |
|
174 | + if ($permissionGroup['hidden']) { |
|
175 | + continue; |
|
176 | + } |
|
168 | 177 | |
169 | 178 | echo ' |
170 | 179 | <option value="" disabled>[', $permissionGroup['name'], ']</option>'; |
171 | 180 | foreach ($permissionGroup['permissions'] as $perm) |
172 | 181 | { |
173 | - if ($perm['hidden']) |
|
174 | - continue; |
|
182 | + if ($perm['hidden']) { |
|
183 | + continue; |
|
184 | + } |
|
175 | 185 | |
176 | - if ($perm['has_own_any']) |
|
177 | - echo ' |
|
186 | + if ($perm['has_own_any']) { |
|
187 | + echo ' |
|
178 | 188 | <option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option> |
179 | 189 | <option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>'; |
180 | - else |
|
181 | - echo ' |
|
190 | + } else { |
|
191 | + echo ' |
|
182 | 192 | <option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>'; |
193 | + } |
|
183 | 194 | } |
184 | 195 | } |
185 | 196 | } |
@@ -246,17 +257,18 @@ discard block |
||
246 | 257 | } |
247 | 258 | </script>'; |
248 | 259 | |
249 | - if (!empty($context['profile'])) |
|
250 | - echo ' |
|
260 | + if (!empty($context['profile'])) { |
|
261 | + echo ' |
|
251 | 262 | <input type="hidden" name="pid" value="', $context['profile']['id'], '">'; |
263 | + } |
|
252 | 264 | |
253 | 265 | echo ' |
254 | 266 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
255 | 267 | <input type="hidden" name="', $context['admin-mpq_token_var'], '" value="', $context['admin-mpq_token'], '">'; |
256 | - } |
|
257 | - else |
|
258 | - echo ' |
|
268 | + } else { |
|
269 | + echo ' |
|
259 | 270 | </table>'; |
271 | + } |
|
260 | 272 | |
261 | 273 | echo ' |
262 | 274 | </form> |
@@ -296,9 +308,10 @@ discard block |
||
296 | 308 | <h3 class="subbg">', $category['name'], '</h3> |
297 | 309 | </div>'; |
298 | 310 | |
299 | - if (!empty($category['boards'])) |
|
300 | - echo ' |
|
311 | + if (!empty($category['boards'])) { |
|
312 | + echo ' |
|
301 | 313 | <ul class="perm_boards flow_hidden">'; |
314 | + } |
|
302 | 315 | |
303 | 316 | foreach ($category['boards'] as $board) |
304 | 317 | { |
@@ -315,33 +328,36 @@ discard block |
||
315 | 328 | echo ' |
316 | 329 | <select name="boardprofile[', $board['id'], ']">'; |
317 | 330 | |
318 | - foreach ($context['profiles'] as $id => $profile) |
|
319 | - echo ' |
|
331 | + foreach ($context['profiles'] as $id => $profile) { |
|
332 | + echo ' |
|
320 | 333 | <option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
334 | + } |
|
321 | 335 | |
322 | 336 | echo ' |
323 | 337 | </select>'; |
324 | - } |
|
325 | - else |
|
326 | - echo ' |
|
338 | + } else { |
|
339 | + echo ' |
|
327 | 340 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>'; |
341 | + } |
|
328 | 342 | |
329 | 343 | echo ' |
330 | 344 | </span> |
331 | 345 | </li>'; |
332 | 346 | } |
333 | 347 | |
334 | - if (!empty($category['boards'])) |
|
335 | - echo ' |
|
348 | + if (!empty($category['boards'])) { |
|
349 | + echo ' |
|
336 | 350 | </ul>'; |
351 | + } |
|
337 | 352 | } |
338 | 353 | |
339 | - if ($context['edit_all']) |
|
340 | - echo ' |
|
354 | + if ($context['edit_all']) { |
|
355 | + echo ' |
|
341 | 356 | <input type="submit" name="save_changes" value="', $txt['save'], '" class="button_submit">'; |
342 | - else |
|
343 | - echo ' |
|
357 | + } else { |
|
358 | + echo ' |
|
344 | 359 | <a class="button_link" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>'; |
360 | + } |
|
345 | 361 | |
346 | 362 | echo ' |
347 | 363 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -381,12 +397,13 @@ discard block |
||
381 | 397 | <tr class="windowbg"> |
382 | 398 | <td>'; |
383 | 399 | |
384 | - if (!empty($context['show_rename_boxes']) && $profile['can_edit']) |
|
385 | - echo ' |
|
400 | + if (!empty($context['show_rename_boxes']) && $profile['can_edit']) { |
|
401 | + echo ' |
|
386 | 402 | <input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '" class="input_text">'; |
387 | - else |
|
388 | - echo ' |
|
403 | + } else { |
|
404 | + echo ' |
|
389 | 405 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>'; |
406 | + } |
|
390 | 407 | |
391 | 408 | echo ' |
392 | 409 | </td> |
@@ -406,9 +423,10 @@ discard block |
||
406 | 423 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
407 | 424 | <input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">'; |
408 | 425 | |
409 | - if ($context['can_edit_something']) |
|
410 | - echo ' |
|
426 | + if ($context['can_edit_something']) { |
|
427 | + echo ' |
|
411 | 428 | <input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button_submit">'; |
429 | + } |
|
412 | 430 | |
413 | 431 | echo ' |
414 | 432 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button_submit" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '/> |
@@ -433,9 +451,10 @@ discard block |
||
433 | 451 | <dd> |
434 | 452 | <select name="copy_from">'; |
435 | 453 | |
436 | - foreach ($context['profiles'] as $id => $profile) |
|
437 | - echo ' |
|
454 | + foreach ($context['profiles'] as $id => $profile) { |
|
455 | + echo ' |
|
438 | 456 | <option value="', $id, '">', $profile['name'], '</option>'; |
457 | + } |
|
439 | 458 | |
440 | 459 | echo ' |
441 | 460 | </select> |
@@ -463,8 +482,7 @@ discard block |
||
463 | 482 | <div class="errorbox"> |
464 | 483 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
465 | 484 | </div>'; |
466 | - } |
|
467 | - else |
|
485 | + } else |
|
468 | 486 | { |
469 | 487 | echo ' |
470 | 488 | <script> |
@@ -484,21 +502,23 @@ discard block |
||
484 | 502 | <div id="admincenter"> |
485 | 503 | <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();">'; |
486 | 504 | |
487 | - if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) |
|
488 | - echo ' |
|
505 | + if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) { |
|
506 | + echo ' |
|
489 | 507 | <div class="information"> |
490 | 508 | ', $txt['permissions_option_desc'], ' |
491 | 509 | </div>'; |
510 | + } |
|
492 | 511 | |
493 | 512 | echo ' |
494 | 513 | <div class="cat_bar"> |
495 | 514 | <h3 class="catbg">'; |
496 | - if ($context['permission_type'] == 'board') |
|
497 | - echo ' |
|
515 | + if ($context['permission_type'] == 'board') { |
|
516 | + echo ' |
|
498 | 517 | ', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"'; |
499 | - else |
|
500 | - echo ' |
|
518 | + } else { |
|
519 | + echo ' |
|
501 | 520 | ', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"'; |
521 | + } |
|
502 | 522 | echo ' |
503 | 523 | </h3> |
504 | 524 | </div>'; |
@@ -521,15 +541,17 @@ discard block |
||
521 | 541 | template_modify_group_display('board'); |
522 | 542 | } |
523 | 543 | |
524 | - if ($context['profile']['can_modify']) |
|
525 | - echo ' |
|
544 | + if ($context['profile']['can_modify']) { |
|
545 | + echo ' |
|
526 | 546 | <div class="padding"> |
527 | 547 | <input type="submit" value="', $txt['permissions_commit'], '" class="button_submit"> |
528 | 548 | </div>'; |
549 | + } |
|
529 | 550 | |
530 | - foreach ($context['hidden_perms'] as $hidden_perm) |
|
531 | - echo ' |
|
551 | + foreach ($context['hidden_perms'] as $hidden_perm) { |
|
552 | + echo ' |
|
532 | 553 | <input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">'; |
554 | + } |
|
533 | 555 | |
534 | 556 | echo ' |
535 | 557 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -557,17 +579,19 @@ discard block |
||
557 | 579 | |
558 | 580 | foreach ($column as $permissionGroup) |
559 | 581 | { |
560 | - if (empty($permissionGroup['permissions'])) |
|
561 | - continue; |
|
582 | + if (empty($permissionGroup['permissions'])) { |
|
583 | + continue; |
|
584 | + } |
|
562 | 585 | |
563 | 586 | // Are we likely to have something in this group to display or is it all hidden? |
564 | 587 | $has_display_content = false; |
565 | 588 | if (!$permissionGroup['hidden']) |
566 | 589 | { |
567 | 590 | // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. |
568 | - foreach ($permissionGroup['permissions'] as $permission) |
|
569 | - if (!$permission['hidden']) |
|
591 | + foreach ($permissionGroup['permissions'] as $permission) { |
|
592 | + if (!$permission['hidden']) |
|
570 | 593 | $has_display_content = true; |
594 | + } |
|
571 | 595 | |
572 | 596 | if ($has_display_content) |
573 | 597 | { |
@@ -576,10 +600,11 @@ discard block |
||
576 | 600 | <th></th> |
577 | 601 | <th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>'; |
578 | 602 | |
579 | - if ($context['group']['id'] != -1) |
|
580 | - echo ' |
|
603 | + if ($context['group']['id'] != -1) { |
|
604 | + echo ' |
|
581 | 605 | <th>', $txt['permissions_option_own'], '</th> |
582 | 606 | <th>', $txt['permissions_option_any'], '</th>'; |
607 | + } |
|
583 | 608 | |
584 | 609 | echo ' |
585 | 610 | </tr>'; |
@@ -602,17 +627,18 @@ discard block |
||
602 | 627 | // Guests can't do their own thing. |
603 | 628 | if ($context['group']['id'] != -1) |
604 | 629 | { |
605 | - if (empty($modSettings['permission_enable_deny'])) |
|
606 | - echo ' |
|
630 | + if (empty($modSettings['permission_enable_deny'])) { |
|
631 | + echo ' |
|
607 | 632 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_check" ', $disable_field, '/>'; |
608 | - else |
|
633 | + } else |
|
609 | 634 | { |
610 | 635 | echo ' |
611 | 636 | <select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>'; |
612 | 637 | |
613 | - foreach (array('on', 'off', 'deny') as $c) |
|
614 | - echo ' |
|
638 | + foreach (array('on', 'off', 'deny') as $c) { |
|
639 | + echo ' |
|
615 | 640 | <option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
641 | + } |
|
616 | 642 | echo ' |
617 | 643 | </select>'; |
618 | 644 | } |
@@ -622,39 +648,41 @@ discard block |
||
622 | 648 | <td>'; |
623 | 649 | } |
624 | 650 | |
625 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
626 | - echo ' |
|
651 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
652 | + echo ' |
|
627 | 653 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/>'; |
628 | - else |
|
654 | + } else |
|
629 | 655 | { |
630 | 656 | echo ' |
631 | 657 | <select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>'; |
632 | 658 | |
633 | - foreach (array('on', 'off', 'deny') as $c) |
|
634 | - echo ' |
|
659 | + foreach (array('on', 'off', 'deny') as $c) { |
|
660 | + echo ' |
|
635 | 661 | <option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
662 | + } |
|
636 | 663 | echo ' |
637 | 664 | </select>'; |
638 | 665 | } |
639 | - } |
|
640 | - else |
|
666 | + } else |
|
641 | 667 | { |
642 | - if ($context['group']['id'] != -1) |
|
643 | - echo ' |
|
668 | + if ($context['group']['id'] != -1) { |
|
669 | + echo ' |
|
644 | 670 | </td> |
645 | 671 | <td>'; |
672 | + } |
|
646 | 673 | |
647 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
648 | - echo ' |
|
674 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
675 | + echo ' |
|
649 | 676 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/>'; |
650 | - else |
|
677 | + } else |
|
651 | 678 | { |
652 | 679 | echo ' |
653 | 680 | <select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>'; |
654 | 681 | |
655 | - foreach (array('on', 'off', 'deny') as $c) |
|
656 | - echo ' |
|
682 | + foreach (array('on', 'off', 'deny') as $c) { |
|
683 | + echo ' |
|
657 | 684 | <option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
685 | + } |
|
658 | 686 | echo ' |
659 | 687 | </select>'; |
660 | 688 | } |
@@ -684,11 +712,11 @@ discard block |
||
684 | 712 | echo ' |
685 | 713 | <fieldset id="', $context['current_permission'], '"> |
686 | 714 | <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>'; |
687 | - if (empty($modSettings['permission_enable_deny'])) |
|
688 | - echo ' |
|
715 | + if (empty($modSettings['permission_enable_deny'])) { |
|
716 | + echo ' |
|
689 | 717 | <ul>'; |
690 | - else |
|
691 | - echo ' |
|
718 | + } else { |
|
719 | + echo ' |
|
692 | 720 | <div class="information">', $txt['permissions_option_desc'], '</div> |
693 | 721 | <dl class="settings"> |
694 | 722 | <dt> |
@@ -698,46 +726,51 @@ discard block |
||
698 | 726 | </dt> |
699 | 727 | <dd> |
700 | 728 | </dd>'; |
729 | + } |
|
701 | 730 | foreach ($context['member_groups'] as $group) |
702 | 731 | { |
703 | - if (!empty($modSettings['permission_enable_deny'])) |
|
704 | - echo ' |
|
732 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
733 | + echo ' |
|
705 | 734 | <dt>'; |
706 | - else |
|
707 | - echo ' |
|
735 | + } else { |
|
736 | + echo ' |
|
708 | 737 | <li>'; |
738 | + } |
|
709 | 739 | |
710 | - if (empty($modSettings['permission_enable_deny'])) |
|
711 | - echo ' |
|
740 | + if (empty($modSettings['permission_enable_deny'])) { |
|
741 | + echo ' |
|
712 | 742 | <input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', ' class="input_check">'; |
713 | - else |
|
714 | - echo ' |
|
743 | + } else { |
|
744 | + echo ' |
|
715 | 745 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', ' class="input_radio"></span> |
716 | 746 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', ' class="input_radio"></span> |
717 | 747 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', ' class="input_radio"></span>'; |
748 | + } |
|
718 | 749 | |
719 | - if (!empty($modSettings['permission_enable_deny'])) |
|
720 | - echo ' |
|
750 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
751 | + echo ' |
|
721 | 752 | </dt> |
722 | 753 | <dd> |
723 | 754 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
724 | 755 | </dd>'; |
725 | - else |
|
726 | - echo ' |
|
756 | + } else { |
|
757 | + echo ' |
|
727 | 758 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
728 | 759 | </li>'; |
760 | + } |
|
729 | 761 | } |
730 | 762 | |
731 | - if (empty($modSettings['permission_enable_deny'])) |
|
732 | - echo ' |
|
763 | + if (empty($modSettings['permission_enable_deny'])) { |
|
764 | + echo ' |
|
733 | 765 | <li> |
734 | 766 | <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');"> |
735 | 767 | <span>', $txt['check_all'], '</span> |
736 | 768 | </li> |
737 | 769 | </ul>'; |
738 | - else |
|
739 | - echo ' |
|
770 | + } else { |
|
771 | + echo ' |
|
740 | 772 | </dl>'; |
773 | + } |
|
741 | 774 | |
742 | 775 | echo ' |
743 | 776 | </fieldset> |
@@ -777,9 +810,10 @@ discard block |
||
777 | 810 | if (!empty($modSettings['postmod_active'])) |
778 | 811 | { |
779 | 812 | // Got advanced permissions - if so warn! |
780 | - if (!empty($modSettings['permission_enable_deny'])) |
|
781 | - echo ' |
|
813 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
814 | + echo ' |
|
782 | 815 | <div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>'; |
816 | + } |
|
783 | 817 | |
784 | 818 | echo ' |
785 | 819 | <div class="padding"> |
@@ -794,10 +828,11 @@ discard block |
||
794 | 828 | ', $txt['permissions_post_moderation_select'], ': |
795 | 829 | <select name="pid" onchange="document.forms.postmodForm.submit();">'; |
796 | 830 | |
797 | - foreach ($context['profiles'] as $profile) |
|
798 | - if ($profile['can_modify']) |
|
831 | + foreach ($context['profiles'] as $profile) { |
|
832 | + if ($profile['can_modify']) |
|
799 | 833 | echo ' |
800 | 834 | <option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
835 | + } |
|
801 | 836 | |
802 | 837 | echo ' |
803 | 838 | </select> |
@@ -818,11 +853,12 @@ discard block |
||
818 | 853 | ', $txt['permissions_post_moderation_replies_any'], ' |
819 | 854 | </th>'; |
820 | 855 | |
821 | - if ($modSettings['attachmentEnable'] == 1) |
|
822 | - echo ' |
|
856 | + if ($modSettings['attachmentEnable'] == 1) { |
|
857 | + echo ' |
|
823 | 858 | <th class="centercol" colspan="3"> |
824 | 859 | ', $txt['permissions_post_moderation_attachments'], ' |
825 | 860 | </th>'; |
861 | + } |
|
826 | 862 | |
827 | 863 | echo ' |
828 | 864 | </tr> |
@@ -840,11 +876,12 @@ discard block |
||
840 | 876 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
841 | 877 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
842 | 878 | |
843 | - if ($modSettings['attachmentEnable'] == 1) |
|
844 | - echo ' |
|
879 | + if ($modSettings['attachmentEnable'] == 1) { |
|
880 | + echo ' |
|
845 | 881 | <th><span class="generic_icons post_moderation_allow"></span></th> |
846 | 882 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
847 | 883 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
884 | + } |
|
848 | 885 | |
849 | 886 | echo ' |
850 | 887 | </tr> |
@@ -857,9 +894,10 @@ discard block |
||
857 | 894 | <tr class="windowbg"> |
858 | 895 | <td class="half_table"> |
859 | 896 | <span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>'; |
860 | - if (!empty($group['children'])) |
|
861 | - echo ' |
|
897 | + if (!empty($group['children'])) { |
|
898 | + echo ' |
|
862 | 899 | <br><span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
900 | + } |
|
863 | 901 | |
864 | 902 | echo ' |
865 | 903 | </td> |
@@ -872,8 +910,7 @@ discard block |
||
872 | 910 | { |
873 | 911 | echo ' |
874 | 912 | <td colspan="3"></td>'; |
875 | - } |
|
876 | - else |
|
913 | + } else |
|
877 | 914 | { |
878 | 915 | echo ' |
879 | 916 | <td class="centercol"><input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', ' class="input_radio"></td> |
@@ -1,9 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
6 | -else |
|
6 | +} else { |
|
7 | 7 | exit; |
8 | +} |
|
8 | 9 | |
9 | 10 | ?> |
10 | 11 | \ No newline at end of file |
@@ -52,9 +52,10 @@ discard block |
||
52 | 52 | <legend>', $txt['membergroups_edit_select_group_type'], '</legend> |
53 | 53 | <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>'; |
54 | 54 | |
55 | - if ($context['allow_protected']) |
|
56 | - echo ' |
|
55 | + if ($context['allow_protected']) { |
|
56 | + echo ' |
|
57 | 57 | <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>'; |
58 | + } |
|
58 | 59 | |
59 | 60 | echo ' |
60 | 61 | <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br> |
@@ -64,14 +65,15 @@ discard block |
||
64 | 65 | </dd>'; |
65 | 66 | } |
66 | 67 | |
67 | - if ($context['post_group'] || $context['undefined_group']) |
|
68 | - echo ' |
|
68 | + if ($context['post_group'] || $context['undefined_group']) { |
|
69 | + echo ' |
|
69 | 70 | <dt id="min_posts_text"> |
70 | 71 | <strong>', $txt['membergroups_min_posts'], ':</strong> |
71 | 72 | </dt> |
72 | 73 | <dd> |
73 | 74 | <input type="number" name="min_posts" id="min_posts_input" size="5" class="input_text"> |
74 | 75 | </dd>'; |
76 | + } |
|
75 | 77 | if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups'])) |
76 | 78 | { |
77 | 79 | echo ' |
@@ -87,9 +89,10 @@ discard block |
||
87 | 89 | <select name="inheritperm" id="inheritperm_select" onclick="document.getElementById(\'perm_type_inherit\').checked = true;"> |
88 | 90 | <option value="-1">', $txt['membergroups_guests'], '</option> |
89 | 91 | <option value="0" selected>', $txt['membergroups_members'], '</option>'; |
90 | - foreach ($context['groups'] as $group) |
|
91 | - echo ' |
|
92 | + foreach ($context['groups'] as $group) { |
|
93 | + echo ' |
|
92 | 94 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
95 | + } |
|
93 | 96 | echo ' |
94 | 97 | </select> |
95 | 98 | <br> |
@@ -98,9 +101,10 @@ discard block |
||
98 | 101 | <select name="copyperm" id="copyperm_select" onclick="document.getElementById(\'perm_type_copy\').checked = true;"> |
99 | 102 | <option value="-1">', $txt['membergroups_guests'], '</option> |
100 | 103 | <option value="0" selected>', $txt['membergroups_members'], '</option>'; |
101 | - foreach ($context['groups'] as $group) |
|
102 | - echo ' |
|
104 | + foreach ($context['groups'] as $group) { |
|
105 | + echo ' |
|
103 | 106 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
107 | + } |
|
104 | 108 | echo ' |
105 | 109 | </select> |
106 | 110 | <br> |
@@ -173,8 +177,8 @@ discard block |
||
173 | 177 | <input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30" class="input_text"> |
174 | 178 | </dd>'; |
175 | 179 | |
176 | - if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
|
177 | - echo ' |
|
180 | + if ($context['group']['id'] != 3 && $context['group']['id'] != 4) { |
|
181 | + echo ' |
|
178 | 182 | |
179 | 183 | <dt id="group_desc_text"> |
180 | 184 | <label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label> |
@@ -182,6 +186,7 @@ discard block |
||
182 | 186 | <dd> |
183 | 187 | <textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea> |
184 | 188 | </dd>'; |
189 | + } |
|
185 | 190 | |
186 | 191 | // Group type... |
187 | 192 | if ($context['group']['allow_post_group']) |
@@ -195,9 +200,10 @@ discard block |
||
195 | 200 | <legend>', $txt['membergroups_edit_select_group_type'], '</legend> |
196 | 201 | <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>'; |
197 | 202 | |
198 | - if ($context['group']['allow_protected']) |
|
199 | - echo ' |
|
203 | + if ($context['group']['allow_protected']) { |
|
204 | + echo ' |
|
200 | 205 | <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>'; |
206 | + } |
|
201 | 207 | |
202 | 208 | echo ' |
203 | 209 | <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br> |
@@ -207,8 +213,8 @@ discard block |
||
207 | 213 | </dd>'; |
208 | 214 | } |
209 | 215 | |
210 | - if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
|
211 | - echo ' |
|
216 | + if ($context['group']['id'] != 3 && $context['group']['id'] != 4) { |
|
217 | + echo ' |
|
212 | 218 | <dt id="group_moderators_text"> |
213 | 219 | <label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label> |
214 | 220 | </dt> |
@@ -226,6 +232,7 @@ discard block |
||
226 | 232 | <option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option> |
227 | 233 | </select> |
228 | 234 | </dd>'; |
235 | + } |
|
229 | 236 | |
230 | 237 | // Can they inherit permissions? |
231 | 238 | if ($context['group']['id'] > 1 && $context['group']['id'] != 3) |
@@ -242,9 +249,10 @@ discard block |
||
242 | 249 | <option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>'; |
243 | 250 | |
244 | 251 | // For all the inheritable groups show an option. |
245 | - foreach ($context['inheritable_groups'] as $id => $group) |
|
246 | - echo ' |
|
252 | + foreach ($context['inheritable_groups'] as $id => $group) { |
|
253 | + echo ' |
|
247 | 254 | <option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>'; |
255 | + } |
|
248 | 256 | |
249 | 257 | echo ' |
250 | 258 | </select> |
@@ -252,8 +260,8 @@ discard block |
||
252 | 260 | </dd>'; |
253 | 261 | } |
254 | 262 | |
255 | - if ($context['group']['allow_post_group']) |
|
256 | - echo ' |
|
263 | + if ($context['group']['allow_post_group']) { |
|
264 | + echo ' |
|
257 | 265 | |
258 | 266 | <dt id="min_posts_text"> |
259 | 267 | <label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label> |
@@ -261,6 +269,7 @@ discard block |
||
261 | 269 | <dd> |
262 | 270 | <input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6" class="input_text"> |
263 | 271 | </dd>'; |
272 | + } |
|
264 | 273 | echo ' |
265 | 274 | <dt> |
266 | 275 | <label for="online_color_input"><strong>', $txt['membergroups_online_color'], ':</strong></label> |
@@ -301,9 +310,10 @@ discard block |
||
301 | 310 | } |
302 | 311 | |
303 | 312 | // No? Hide the entire control. |
304 | - else |
|
305 | - echo ' |
|
313 | + else { |
|
314 | + echo ' |
|
306 | 315 | <input type="hidden" name="icon_image" value="">'; |
316 | + } |
|
307 | 317 | |
308 | 318 | echo ' |
309 | 319 | <dt> |
@@ -314,8 +324,8 @@ discard block |
||
314 | 324 | <input type="text" name="max_messages" id="max_messages_input" value="', $context['group']['id'] == 1 ? 0 : $context['group']['max_messages'], '" size="6"', $context['group']['id'] == 1 ? ' disabled' : '', ' class="input_text"> |
315 | 325 | </dd>'; |
316 | 326 | //Force 2FA for this membergroup? |
317 | - if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) |
|
318 | - echo ' |
|
327 | + if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) { |
|
328 | + echo ' |
|
319 | 329 | <dt> |
320 | 330 | <label for="group_tfa_force_input"><strong>', $txt['membergroups_tfa_force'], ':</strong></label><br> |
321 | 331 | <span class="smalltext">', $txt['membergroups_tfa_force_note'], '</span> |
@@ -323,6 +333,7 @@ discard block |
||
323 | 333 | <dd> |
324 | 334 | <input type="checkbox" name="group_tfa_force"', $context['group']['tfa_required'] ? ' checked' : '', ' class="input_check"> |
325 | 335 | </dd>'; |
336 | + } |
|
326 | 337 | |
327 | 338 | if (!empty($context['categories'])) |
328 | 339 | { |
@@ -332,10 +343,11 @@ discard block |
||
332 | 343 | <span class="smalltext">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', ' |
333 | 344 | </dt> |
334 | 345 | <dd>'; |
335 | - if (!empty($context['can_manage_boards'])) |
|
336 | - echo $txt['membergroups_can_manage_access']; |
|
337 | - else |
|
338 | - template_add_edit_group_boards_list(); |
|
346 | + if (!empty($context['can_manage_boards'])) { |
|
347 | + echo $txt['membergroups_can_manage_access']; |
|
348 | + } else { |
|
349 | + template_add_edit_group_boards_list(); |
|
350 | + } |
|
339 | 351 | |
340 | 352 | echo ' |
341 | 353 | </dd>'; |
@@ -364,20 +376,21 @@ discard block |
||
364 | 376 | sItemListContainerId: \'moderator_container\', |
365 | 377 | aListItems: ['; |
366 | 378 | |
367 | - foreach ($context['group']['moderators'] as $id_member => $member_name) |
|
368 | - echo ' |
|
379 | + foreach ($context['group']['moderators'] as $id_member => $member_name) { |
|
380 | + echo ' |
|
369 | 381 | { |
370 | 382 | sItemId: ', JavaScriptEscape($id_member), ', |
371 | 383 | sItemName: ', JavaScriptEscape($member_name), ' |
372 | 384 | }', $id_member == $context['group']['last_moderator_id'] ? '' : ','; |
385 | + } |
|
373 | 386 | |
374 | 387 | echo ' |
375 | 388 | ] |
376 | 389 | }); |
377 | 390 | </script>'; |
378 | 391 | |
379 | - if ($context['group']['allow_post_group']) |
|
380 | - echo ' |
|
392 | + if ($context['group']['allow_post_group']) { |
|
393 | + echo ' |
|
381 | 394 | <script> |
382 | 395 | function swapPostGroup(isChecked) |
383 | 396 | { |
@@ -425,7 +438,8 @@ discard block |
||
425 | 438 | |
426 | 439 | swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', '); |
427 | 440 | </script>'; |
428 | -} |
|
441 | + } |
|
442 | + } |
|
429 | 443 | |
430 | 444 | /** |
431 | 445 | * The template for determining which boards a group has access to. |
@@ -442,13 +456,13 @@ discard block |
||
442 | 456 | |
443 | 457 | foreach ($context['categories'] as $category) |
444 | 458 | { |
445 | - if (empty($modSettings['deny_boards_access'])) |
|
446 | - echo ' |
|
459 | + if (empty($modSettings['deny_boards_access'])) { |
|
460 | + echo ' |
|
447 | 461 | <li class="category"> |
448 | 462 | <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a> |
449 | 463 | <ul style="width:100%">'; |
450 | - else |
|
451 | - echo ' |
|
464 | + } else { |
|
465 | + echo ' |
|
452 | 466 | <li class="category"> |
453 | 467 | <strong>', $category['name'], '</strong> |
454 | 468 | <span class="select_all_box"> |
@@ -461,16 +475,17 @@ discard block |
||
461 | 475 | </select> |
462 | 476 | </span> |
463 | 477 | <ul style="width:100%" id="boards_list_', $category['id'], '">'; |
478 | + } |
|
464 | 479 | |
465 | 480 | foreach ($category['boards'] as $board) |
466 | 481 | { |
467 | - if (empty($modSettings['deny_boards_access'])) |
|
468 | - echo ' |
|
482 | + if (empty($modSettings['deny_boards_access'])) { |
|
483 | + echo ' |
|
469 | 484 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
470 | 485 | <input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', ' class="input_check"> <label for="brd', $board['id'], '">', $board['name'], '</label> |
471 | 486 | </li>'; |
472 | - else |
|
473 | - echo ' |
|
487 | + } else { |
|
488 | + echo ' |
|
474 | 489 | <li class="board" style="width:100%"> |
475 | 490 | <span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span> |
476 | 491 | <span style="width:50%;float:right"> |
@@ -479,6 +494,7 @@ discard block |
||
479 | 494 | <input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', ' class="input_check"> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label> |
480 | 495 | </span> |
481 | 496 | </li>'; |
497 | + } |
|
482 | 498 | } |
483 | 499 | |
484 | 500 | echo ' |
@@ -489,13 +505,13 @@ discard block |
||
489 | 505 | echo ' |
490 | 506 | </ul>'; |
491 | 507 | |
492 | - if (empty($modSettings['deny_boards_access'])) |
|
493 | - echo ' |
|
508 | + if (empty($modSettings['deny_boards_access'])) { |
|
509 | + echo ' |
|
494 | 510 | <br class="clear"><br> |
495 | 511 | <input type="checkbox" id="checkall_check" class="input_check" onclick="invertAll(this, this.form, \'boardaccess\');"> <label for="checkall_check"><em>', $txt['check_all'], '</em></label> |
496 | 512 | </fieldset>'; |
497 | - else |
|
498 | - echo ' |
|
513 | + } else { |
|
514 | + echo ' |
|
499 | 515 | <br class="clear"> |
500 | 516 | <span class="select_all_box"> |
501 | 517 | <em>', $txt['all'], ': </em> |
@@ -511,15 +527,17 @@ discard block |
||
511 | 527 | }); |
512 | 528 | }); |
513 | 529 | </script>'; |
530 | + } |
|
514 | 531 | |
515 | - if ($collapse) |
|
516 | - echo ' |
|
532 | + if ($collapse) { |
|
533 | + echo ' |
|
517 | 534 | <a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a> |
518 | 535 | <script> |
519 | 536 | document.getElementById("visible_boards_link").style.display = ""; |
520 | 537 | document.getElementById("visible_boards").style.display = "none"; |
521 | 538 | </script>'; |
522 | -} |
|
539 | + } |
|
540 | + } |
|
523 | 541 | |
524 | 542 | /** |
525 | 543 | * Templatine for viewing the members of a group. |
@@ -543,14 +561,15 @@ discard block |
||
543 | 561 | <span ', $context['group']['online_color'] ? 'style="color: ' . $context['group']['online_color'] . ';"' : '', '>', $context['group']['name'], '</span> ', $context['group']['icons'], ' |
544 | 562 | </dd>'; |
545 | 563 | //Any description to show? |
546 | - if (!empty($context['group']['description'])) |
|
547 | - echo ' |
|
564 | + if (!empty($context['group']['description'])) { |
|
565 | + echo ' |
|
548 | 566 | <dt> |
549 | 567 | <strong>' . $txt['membergroups_members_description'] . ':</strong> |
550 | 568 | </dt> |
551 | 569 | <dd> |
552 | 570 | ', $context['group']['description'], ' |
553 | 571 | </dd>'; |
572 | + } |
|
554 | 573 | |
555 | 574 | echo ' |
556 | 575 | <dt> |
@@ -563,8 +582,9 @@ discard block |
||
563 | 582 | if (!empty($context['group']['moderators'])) |
564 | 583 | { |
565 | 584 | $moderators = array(); |
566 | - foreach ($context['group']['moderators'] as $moderator) |
|
567 | - $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; |
|
585 | + foreach ($context['group']['moderators'] as $moderator) { |
|
586 | + $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; |
|
587 | + } |
|
568 | 588 | |
569 | 589 | echo ' |
570 | 590 | <dt> |
@@ -590,27 +610,30 @@ discard block |
||
590 | 610 | <tr class="title_bar"> |
591 | 611 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
592 | 612 | |
593 | - if ($context['can_send_email']) |
|
594 | - echo ' |
|
613 | + if ($context['can_send_email']) { |
|
614 | + echo ' |
|
595 | 615 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
616 | + } |
|
596 | 617 | |
597 | 618 | echo ' |
598 | 619 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th> |
599 | 620 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=registered', $context['sort_by'] == 'registered' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['date_registered'], $context['sort_by'] == 'registered' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th> |
600 | 621 | <th ', empty($context['group']['assignable']) ? ' colspan="2"' : '', '><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
601 | - if (!empty($context['group']['assignable'])) |
|
602 | - echo ' |
|
622 | + if (!empty($context['group']['assignable'])) { |
|
623 | + echo ' |
|
603 | 624 | <th style="width: 4%"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);"></th>'; |
625 | + } |
|
604 | 626 | echo ' |
605 | 627 | </tr> |
606 | 628 | </thead> |
607 | 629 | <tbody>'; |
608 | 630 | |
609 | - if (empty($context['members'])) |
|
610 | - echo ' |
|
631 | + if (empty($context['members'])) { |
|
632 | + echo ' |
|
611 | 633 | <tr class="windowbg"> |
612 | 634 | <td colspan="6">', $txt['membergroups_members_no_members'], '</td> |
613 | 635 | </tr>'; |
636 | + } |
|
614 | 637 | |
615 | 638 | foreach ($context['members'] as $member) |
616 | 639 | { |
@@ -629,9 +652,10 @@ discard block |
||
629 | 652 | <td>', $member['last_online'], '</td> |
630 | 653 | <td>', $member['registered'], '</td> |
631 | 654 | <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>'; |
632 | - if (!empty($context['group']['assignable'])) |
|
633 | - echo ' |
|
655 | + if (!empty($context['group']['assignable'])) { |
|
656 | + echo ' |
|
634 | 657 | <td style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" class="input_check" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>'; |
658 | + } |
|
635 | 659 | echo ' |
636 | 660 | </tr>'; |
637 | 661 | } |
@@ -640,11 +664,12 @@ discard block |
||
640 | 664 | </tbody> |
641 | 665 | </table>'; |
642 | 666 | |
643 | - if (!empty($context['group']['assignable'])) |
|
644 | - echo ' |
|
667 | + if (!empty($context['group']['assignable'])) { |
|
668 | + echo ' |
|
645 | 669 | <div class="floatright"> |
646 | 670 | <input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button_submit "> |
647 | 671 | </div>'; |
672 | + } |
|
648 | 673 | |
649 | 674 | echo ' |
650 | 675 | <div class="pagesection flow_hidden"> |
@@ -678,8 +703,8 @@ discard block |
||
678 | 703 | </form> |
679 | 704 | </div>'; |
680 | 705 | |
681 | - if (!empty($context['group']['assignable'])) |
|
682 | - echo ' |
|
706 | + if (!empty($context['group']['assignable'])) { |
|
707 | + echo ' |
|
683 | 708 | <script> |
684 | 709 | var oAddMemberSuggest = new smc_AutoSuggest({ |
685 | 710 | sSelf: \'oAddMemberSuggest\', |
@@ -695,7 +720,8 @@ discard block |
||
695 | 720 | sItemListContainerId: \'toAddItemContainer\' |
696 | 721 | }); |
697 | 722 | </script>'; |
698 | -} |
|
723 | + } |
|
724 | + } |
|
699 | 725 | |
700 | 726 | /** |
701 | 727 | * Allow the moderator to enter a reason to each user being rejected. |
@@ -715,8 +741,8 @@ discard block |
||
715 | 741 | <dl class="settings">'; |
716 | 742 | |
717 | 743 | // Loop through and print out a reason box for each... |
718 | - foreach ($context['group_requests'] as $request) |
|
719 | - echo ' |
|
744 | + foreach ($context['group_requests'] as $request) { |
|
745 | + echo ' |
|
720 | 746 | <dt> |
721 | 747 | <strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong> |
722 | 748 | </dt> |
@@ -724,6 +750,7 @@ discard block |
||
724 | 750 | <input type="hidden" name="groupr[]" value="', $request['id'], '"> |
725 | 751 | <textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="min-width: 80%; max-width: 99%;"></textarea> |
726 | 752 | </dd>'; |
753 | + } |
|
727 | 754 | |
728 | 755 | echo ' |
729 | 756 | </dl> |
@@ -28,13 +28,14 @@ discard block |
||
28 | 28 | <div id="confirm_buttons">'; |
29 | 29 | |
30 | 30 | // Age restriction in effect? |
31 | - if ($context['show_coppa']) |
|
32 | - echo ' |
|
31 | + if ($context['show_coppa']) { |
|
32 | + echo ' |
|
33 | 33 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit"><br><br> |
34 | 34 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit">'; |
35 | - else |
|
36 | - echo ' |
|
35 | + } else { |
|
36 | + echo ' |
|
37 | 37 | <input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button_submit">'; |
38 | + } |
|
38 | 39 | |
39 | 40 | echo ' |
40 | 41 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -77,9 +78,10 @@ discard block |
||
77 | 78 | <ul>'; |
78 | 79 | |
79 | 80 | // Cycle through each error and display an error message. |
80 | - foreach ($context['registration_errors'] as $error) |
|
81 | - echo ' |
|
81 | + foreach ($context['registration_errors'] as $error) { |
|
82 | + echo ' |
|
82 | 83 | <li>', $error, '</li>'; |
84 | + } |
|
83 | 85 | |
84 | 86 | echo ' |
85 | 87 | </ul> |
@@ -143,14 +145,15 @@ discard block |
||
143 | 145 | |
144 | 146 | <dl class="register_form">'; |
145 | 147 | |
146 | - foreach ($context['custom_fields'] as $field) |
|
147 | - if ($field['show_reg'] > 1) |
|
148 | + foreach ($context['custom_fields'] as $field) { |
|
149 | + if ($field['show_reg'] > 1) |
|
148 | 150 | echo ' |
149 | 151 | <dt> |
150 | 152 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
151 | 153 | <span class="smalltext">', $field['desc'], '</span> |
152 | 154 | </dt> |
153 | 155 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
156 | + } |
|
154 | 157 | |
155 | 158 | echo ' |
156 | 159 | </dl>'; |
@@ -184,41 +187,45 @@ discard block |
||
184 | 187 | $callback_func = 'template_profile_' . $field['callback_func']; |
185 | 188 | $callback_func(); |
186 | 189 | } |
187 | - } |
|
188 | - else |
|
190 | + } else |
|
189 | 191 | { |
190 | 192 | echo ' |
191 | 193 | <dt> |
192 | 194 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>'; |
193 | 195 | |
194 | 196 | // Does it have any subtext to show? |
195 | - if (!empty($field['subtext'])) |
|
196 | - echo ' |
|
197 | + if (!empty($field['subtext'])) { |
|
198 | + echo ' |
|
197 | 199 | <span class="smalltext">', $field['subtext'], '</span>'; |
200 | + } |
|
198 | 201 | |
199 | 202 | echo ' |
200 | 203 | </dt> |
201 | 204 | <dd>'; |
202 | 205 | |
203 | 206 | // Want to put something infront of the box? |
204 | - if (!empty($field['preinput'])) |
|
205 | - echo ' |
|
207 | + if (!empty($field['preinput'])) { |
|
208 | + echo ' |
|
206 | 209 | ', $field['preinput']; |
210 | + } |
|
207 | 211 | |
208 | 212 | // What type of data are we showing? |
209 | - if ($field['type'] == 'label') |
|
210 | - echo ' |
|
213 | + if ($field['type'] == 'label') { |
|
214 | + echo ' |
|
211 | 215 | ', $field['value']; |
216 | + } |
|
212 | 217 | |
213 | 218 | // Maybe it's a text box - very likely! |
214 | - elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) |
|
215 | - echo ' |
|
219 | + elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) { |
|
220 | + echo ' |
|
216 | 221 | <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '">'; |
222 | + } |
|
217 | 223 | |
218 | 224 | // You "checking" me out? ;) |
219 | - elseif ($field['type'] == 'check') |
|
220 | - echo ' |
|
225 | + elseif ($field['type'] == 'check') { |
|
226 | + echo ' |
|
221 | 227 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" class="input_check" ', $field['input_attr'], '>'; |
228 | + } |
|
222 | 229 | |
223 | 230 | // Always fun - select boxes! |
224 | 231 | elseif ($field['type'] == 'select') |
@@ -229,13 +236,15 @@ discard block |
||
229 | 236 | if (isset($field['options'])) |
230 | 237 | { |
231 | 238 | // Is this some code to generate the options? |
232 | - if (!is_array($field['options'])) |
|
233 | - $field['options'] = eval($field['options']); |
|
239 | + if (!is_array($field['options'])) { |
|
240 | + $field['options'] = eval($field['options']); |
|
241 | + } |
|
234 | 242 | // Assuming we now have some! |
235 | - if (is_array($field['options'])) |
|
236 | - foreach ($field['options'] as $value => $name) |
|
243 | + if (is_array($field['options'])) { |
|
244 | + foreach ($field['options'] as $value => $name) |
|
237 | 245 | echo ' |
238 | 246 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
247 | + } |
|
239 | 248 | } |
240 | 249 | |
241 | 250 | echo ' |
@@ -243,9 +252,10 @@ discard block |
||
243 | 252 | } |
244 | 253 | |
245 | 254 | // Something to end with? |
246 | - if (!empty($field['postinput'])) |
|
247 | - echo ' |
|
255 | + if (!empty($field['postinput'])) { |
|
256 | + echo ' |
|
248 | 257 | ', $field['postinput']; |
258 | + } |
|
249 | 259 | |
250 | 260 | echo ' |
251 | 261 | </dd>'; |
@@ -258,13 +268,14 @@ discard block |
||
258 | 268 | { |
259 | 269 | foreach ($context['custom_fields'] as $field) |
260 | 270 | { |
261 | - if ($field['show_reg'] < 2) |
|
262 | - echo ' |
|
271 | + if ($field['show_reg'] < 2) { |
|
272 | + echo ' |
|
263 | 273 | <dt> |
264 | 274 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
265 | 275 | <span class="smalltext">', $field['desc'], '</span> |
266 | 276 | </dt> |
267 | 277 | <dd>', $field['input_html'], '</dd>'; |
278 | + } |
|
268 | 279 | } |
269 | 280 | } |
270 | 281 | |
@@ -294,13 +305,14 @@ discard block |
||
294 | 305 | <div id="confirm_buttons" class="flow_auto">'; |
295 | 306 | |
296 | 307 | // Age restriction in effect? |
297 | - if (!$context['require_agreement'] && $context['show_coppa']) |
|
298 | - echo ' |
|
308 | + if (!$context['require_agreement'] && $context['show_coppa']) { |
|
309 | + echo ' |
|
299 | 310 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit"><br><br> |
300 | 311 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit">'; |
301 | - else |
|
302 | - echo ' |
|
312 | + } else { |
|
313 | + echo ' |
|
303 | 314 | <input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button_submit">'; |
315 | + } |
|
304 | 316 | echo ' |
305 | 317 | </div> |
306 | 318 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -445,19 +457,20 @@ discard block |
||
445 | 457 | </head> |
446 | 458 | <body style="margin: 1ex;"> |
447 | 459 | <div class="windowbg description" style="text-align: center;">'; |
448 | - if (isBrowser('is_ie') || isBrowser('is_ie11')) |
|
449 | - echo ' |
|
460 | + if (isBrowser('is_ie') || isBrowser('is_ie11')) { |
|
461 | + echo ' |
|
450 | 462 | <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav"> |
451 | 463 | <param name="AutoStart" value="1"> |
452 | 464 | <param name="FileName" value="', $context['verification_sound_href'], '"> |
453 | 465 | </object>'; |
454 | - else |
|
455 | - echo ' |
|
466 | + } else { |
|
467 | + echo ' |
|
456 | 468 | <audio src="', $context['verification_sound_href'], '" controls> |
457 | 469 | <object type="audio/x-wav" data="', $context['verification_sound_href'], '"> |
458 | 470 | <a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a> |
459 | 471 | </object> |
460 | 472 | </audio>'; |
473 | + } |
|
461 | 474 | echo ' |
462 | 475 | <br> |
463 | 476 | <a href="', $context['verification_sound_href'], ';sound" rel="nofollow">', $txt['visual_verification_sound_again'], '</a><br> |
@@ -484,11 +497,12 @@ discard block |
||
484 | 497 | </div> |
485 | 498 | <div id="register_screen" class="windowbg2 noup">'; |
486 | 499 | |
487 | - if (!empty($context['registration_done'])) |
|
488 | - echo ' |
|
500 | + if (!empty($context['registration_done'])) { |
|
501 | + echo ' |
|
489 | 502 | <div class="infobox"> |
490 | 503 | ', $context['registration_done'], ' |
491 | 504 | </div>'; |
505 | + } |
|
492 | 506 | |
493 | 507 | echo ' |
494 | 508 | <dl class="register_form" id="admin_register_form"> |
@@ -524,9 +538,10 @@ discard block |
||
524 | 538 | <dd> |
525 | 539 | <select name="group" id="group_select" tabindex="', $context['tabindex']++, '">'; |
526 | 540 | |
527 | - foreach ($context['member_groups'] as $id => $name) |
|
528 | - echo ' |
|
541 | + foreach ($context['member_groups'] as $id => $name) { |
|
542 | + echo ' |
|
529 | 543 | <option value="', $id, '">', $name, '</option>'; |
544 | + } |
|
530 | 545 | |
531 | 546 | echo ' |
532 | 547 | </select> |
@@ -534,8 +549,8 @@ discard block |
||
534 | 549 | } |
535 | 550 | |
536 | 551 | // If there is any field marked as required, show it here! |
537 | - if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) |
|
538 | - foreach ($context['custom_fields'] as $field) |
|
552 | + if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) { |
|
553 | + foreach ($context['custom_fields'] as $field) |
|
539 | 554 | if ($field['show_reg'] > 1) |
540 | 555 | echo ' |
541 | 556 | <dt> |
@@ -543,6 +558,7 @@ discard block |
||
543 | 558 | <span class="smalltext">', $field['desc'], '</span> |
544 | 559 | </dt> |
545 | 560 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
561 | + } |
|
546 | 562 | |
547 | 563 | echo ' |
548 | 564 | <dt> |
@@ -579,12 +595,13 @@ discard block |
||
579 | 595 | { |
580 | 596 | global $context, $scripturl, $txt; |
581 | 597 | |
582 | - if (!empty($context['saved_successful'])) |
|
583 | - echo ' |
|
598 | + if (!empty($context['saved_successful'])) { |
|
599 | + echo ' |
|
584 | 600 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
585 | - elseif (!empty($context['could_not_save'])) |
|
586 | - echo ' |
|
601 | + } elseif (!empty($context['could_not_save'])) { |
|
602 | + echo ' |
|
587 | 603 | <div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>'; |
604 | + } |
|
588 | 605 | |
589 | 606 | // Just a big box to edit the text file ;). |
590 | 607 | echo ' |
@@ -594,9 +611,10 @@ discard block |
||
594 | 611 | </div>'; |
595 | 612 | |
596 | 613 | // Warning for if the file isn't writable. |
597 | - if (!empty($context['warning'])) |
|
598 | - echo ' |
|
614 | + if (!empty($context['warning'])) { |
|
615 | + echo ' |
|
599 | 616 | <p class="error">', $context['warning'], '</p>'; |
617 | + } |
|
600 | 618 | |
601 | 619 | echo ' |
602 | 620 | <div class="windowbg2 noup" id="registration_agreement">'; |
@@ -613,9 +631,10 @@ discard block |
||
613 | 631 | <strong>', $txt['admin_agreement_select_language'], ':</strong> |
614 | 632 | <select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">'; |
615 | 633 | |
616 | - foreach ($context['editable_agreements'] as $file => $name) |
|
617 | - echo ' |
|
634 | + foreach ($context['editable_agreements'] as $file => $name) { |
|
635 | + echo ' |
|
618 | 636 | <option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>'; |
637 | + } |
|
619 | 638 | |
620 | 639 | echo ' |
621 | 640 | </select> |
@@ -655,9 +674,10 @@ discard block |
||
655 | 674 | { |
656 | 675 | global $context, $scripturl, $txt; |
657 | 676 | |
658 | - if (!empty($context['saved_successful'])) |
|
659 | - echo ' |
|
677 | + if (!empty($context['saved_successful'])) { |
|
678 | + echo ' |
|
660 | 679 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
680 | + } |
|
661 | 681 | |
662 | 682 | echo ' |
663 | 683 | <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '"> |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | <div class="windowbg2 noup"> |
112 | 112 | <dl class="settings">'; |
113 | 113 | |
114 | - if (!empty($context['table_info'])) |
|
115 | - echo ' |
|
114 | + if (!empty($context['table_info'])) { |
|
115 | + echo ' |
|
116 | 116 | <dt> |
117 | 117 | <strong>', $txt['search_method_messages_table_space'], ':</strong> |
118 | 118 | </dt> |
@@ -125,6 +125,7 @@ discard block |
||
125 | 125 | <dd> |
126 | 126 | ', $context['table_info']['index_length'], ' |
127 | 127 | </dd>'; |
128 | + } |
|
128 | 129 | echo ' |
129 | 130 | </dl> |
130 | 131 | ', $context['double_index'] ? '<div class="noticebox"> |
@@ -146,16 +147,17 @@ discard block |
||
146 | 147 | <dd> |
147 | 148 | |
148 | 149 | <span class="smalltext">'; |
149 | - if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) |
|
150 | - echo ' |
|
150 | + if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) { |
|
151 | + echo ' |
|
151 | 152 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]'; |
152 | - elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) |
|
153 | - echo ' |
|
153 | + } elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) { |
|
154 | + echo ' |
|
154 | 155 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create']; |
155 | - else |
|
156 | - echo ' |
|
156 | + } else { |
|
157 | + echo ' |
|
157 | 158 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br> |
158 | 159 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length']; |
160 | + } |
|
159 | 161 | echo ' |
160 | 162 | </span> |
161 | 163 | </dd>'; |
@@ -168,25 +170,27 @@ discard block |
||
168 | 170 | </dt> |
169 | 171 | <dd> |
170 | 172 | <span class="smalltext">'; |
171 | - if ($context['custom_index']) |
|
172 | - echo ' |
|
173 | + if ($context['custom_index']) { |
|
174 | + echo ' |
|
173 | 175 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br> |
174 | 176 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
175 | - elseif ($context['partial_custom_index']) |
|
176 | - echo ' |
|
177 | + } elseif ($context['partial_custom_index']) { |
|
178 | + echo ' |
|
177 | 179 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br> |
178 | 180 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
179 | - else |
|
180 | - echo ' |
|
181 | + } else { |
|
182 | + echo ' |
|
181 | 183 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]'; |
184 | + } |
|
182 | 185 | echo ' |
183 | 186 | </span> |
184 | 187 | </dd>'; |
185 | 188 | |
186 | 189 | foreach ($context['search_apis'] as $api) |
187 | 190 | { |
188 | - if (empty($api['label']) || $api['has_template']) |
|
189 | - continue; |
|
191 | + if (empty($api['label']) || $api['has_template']) { |
|
192 | + continue; |
|
193 | + } |
|
190 | 194 | |
191 | 195 | echo ' |
192 | 196 | <dt> |
@@ -194,12 +198,13 @@ discard block |
||
194 | 198 | ', $api['label'], ' |
195 | 199 | </dt>'; |
196 | 200 | |
197 | - if ($api['desc']) |
|
198 | - echo ' |
|
201 | + if ($api['desc']) { |
|
202 | + echo ' |
|
199 | 203 | <dd> |
200 | 204 | <span class="smalltext">', $api['desc'], '</span> |
201 | 205 | </dd>'; |
202 | 206 | } |
207 | + } |
|
203 | 208 | |
204 | 209 | echo ' |
205 | 210 | </dl> |
@@ -25,13 +25,15 @@ discard block |
||
25 | 25 | </h3> |
26 | 26 | </div>'; |
27 | 27 | |
28 | - if (!empty($context['search_errors'])) |
|
29 | - echo ' |
|
28 | + if (!empty($context['search_errors'])) { |
|
29 | + echo ' |
|
30 | 30 | <div class="errorbox">', implode('<br>', $context['search_errors']['messages']), '</div>'; |
31 | + } |
|
31 | 32 | |
32 | - if (!empty($context['search_ignored'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['search_ignored'])) { |
|
34 | + echo ' |
|
34 | 35 | <p class="noticebox">', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>'; |
36 | + } |
|
35 | 37 | |
36 | 38 | echo ' |
37 | 39 | <div id="advanced_search" class="roundframe"> |
@@ -42,9 +44,10 @@ discard block |
||
42 | 44 | <dd> |
43 | 45 | <input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text">'; |
44 | 46 | |
45 | - if (empty($modSettings['search_simple_fulltext'])) |
|
46 | - echo ' |
|
47 | + if (empty($modSettings['search_simple_fulltext'])) { |
|
48 | + echo ' |
|
47 | 49 | <br><em class="smalltext">', $txt['search_example'], '</em>'; |
50 | + } |
|
48 | 51 | |
49 | 52 | echo ' |
50 | 53 | </dd> |
@@ -115,11 +118,12 @@ discard block |
||
115 | 118 | } |
116 | 119 | |
117 | 120 | // If $context['search_params']['topic'] is set, that means we're searching just one topic. |
118 | - if (!empty($context['search_params']['topic'])) |
|
119 | - echo ' |
|
121 | + if (!empty($context['search_params']['topic'])) { |
|
122 | + echo ' |
|
120 | 123 | <p>', $txt['search_specific_topic'], ' "', $context['search_topic']['link'], '".</p> |
121 | 124 | <input type="hidden" name="topic" value="', $context['search_topic']['id'], '"> |
122 | 125 | <input type="submit" name="b_search" value="', $txt['search'], '" class="button_submit">'; |
126 | + } |
|
123 | 127 | |
124 | 128 | echo ' |
125 | 129 | </div> |
@@ -150,14 +154,15 @@ discard block |
||
150 | 154 | |
151 | 155 | foreach ($category['boards'] as $board) |
152 | 156 | { |
153 | - if ($i == $limit) |
|
154 | - echo ' |
|
157 | + if ($i == $limit) { |
|
158 | + echo ' |
|
155 | 159 | </ul> |
156 | 160 | </li> |
157 | 161 | </ul> |
158 | 162 | <ul class="ignoreboards floatright"> |
159 | 163 | <li class="category"> |
160 | 164 | <ul>'; |
165 | + } |
|
161 | 166 | |
162 | 167 | echo ' |
163 | 168 | <li class="board"> |
@@ -245,13 +250,15 @@ discard block |
||
245 | 250 | <div class="roundframe">'; |
246 | 251 | |
247 | 252 | // Did they make any typos or mistakes, perhaps? |
248 | - if (isset($context['did_you_mean'])) |
|
249 | - echo ' |
|
253 | + if (isset($context['did_you_mean'])) { |
|
254 | + echo ' |
|
250 | 255 | <p>', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>.</p>'; |
256 | + } |
|
251 | 257 | |
252 | - if (!empty($context['search_ignored'])) |
|
253 | - echo ' |
|
258 | + if (!empty($context['search_ignored'])) { |
|
259 | + echo ' |
|
254 | 260 | <p>', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>'; |
261 | + } |
|
255 | 262 | |
256 | 263 | echo ' |
257 | 264 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -273,10 +280,11 @@ discard block |
||
273 | 280 | <input type="hidden" name="maxage" value="', !empty($context['search_params']['maxage']) ? $context['search_params']['maxage'] : '9999', '"> |
274 | 281 | <input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '"> |
275 | 282 | </div>'; |
276 | - if (!empty($context['search_params']['brd'])) |
|
277 | - foreach ($context['search_params']['brd'] as $board_id) |
|
283 | + if (!empty($context['search_params']['brd'])) { |
|
284 | + foreach ($context['search_params']['brd'] as $board_id) |
|
278 | 285 | echo ' |
279 | 286 | <input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">'; |
287 | + } |
|
280 | 288 | |
281 | 289 | echo ' |
282 | 290 | </form> |
@@ -287,17 +295,19 @@ discard block |
||
287 | 295 | if ($context['compact']) |
288 | 296 | { |
289 | 297 | // Quick moderation set to checkboxes? Oh, how fun :/. |
290 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
291 | - echo ' |
|
298 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
299 | + echo ' |
|
292 | 300 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">'; |
301 | + } |
|
293 | 302 | |
294 | 303 | echo ' |
295 | 304 | <div class="cat_bar"> |
296 | 305 | <h3 class="catbg"> |
297 | 306 | <span class="floatright">'; |
298 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
299 | - echo ' |
|
307 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
308 | + echo ' |
|
300 | 309 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check">'; |
310 | + } |
|
301 | 311 | echo ' |
302 | 312 | </span> |
303 | 313 | <span class="generic_icons filter"></span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], ' |
@@ -305,14 +315,15 @@ discard block |
||
305 | 315 | </div>'; |
306 | 316 | |
307 | 317 | // was anything even found? |
308 | - if (!empty($context['topics'])) |
|
309 | - echo' |
|
318 | + if (!empty($context['topics'])) { |
|
319 | + echo' |
|
310 | 320 | <div class="pagesection"> |
311 | 321 | <span>', $context['page_index'], '</span> |
312 | 322 | </div>'; |
313 | - else |
|
314 | - echo ' |
|
323 | + } else { |
|
324 | + echo ' |
|
315 | 325 | <div class="roundframe">', $txt['find_no_results'], '</div>'; |
326 | + } |
|
316 | 327 | |
317 | 328 | // while we have results to show ... |
318 | 329 | while ($topic = $context['get_topics']()) |
@@ -340,38 +351,43 @@ discard block |
||
340 | 351 | { |
341 | 352 | echo ' |
342 | 353 | <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check">'; |
343 | - } |
|
344 | - else |
|
354 | + } else |
|
345 | 355 | { |
346 | - if ($topic['quick_mod']['remove']) |
|
347 | - echo ' |
|
356 | + if ($topic['quick_mod']['remove']) { |
|
357 | + echo ' |
|
348 | 358 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>'; |
359 | + } |
|
349 | 360 | |
350 | - if ($topic['quick_mod']['lock']) |
|
351 | - echo ' |
|
361 | + if ($topic['quick_mod']['lock']) { |
|
362 | + echo ' |
|
352 | 363 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>'; |
364 | + } |
|
353 | 365 | |
354 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
355 | - echo ' |
|
366 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
367 | + echo ' |
|
356 | 368 | <br>'; |
369 | + } |
|
357 | 370 | |
358 | - if ($topic['quick_mod']['sticky']) |
|
359 | - echo ' |
|
371 | + if ($topic['quick_mod']['sticky']) { |
|
372 | + echo ' |
|
360 | 373 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>'; |
374 | + } |
|
361 | 375 | |
362 | - if ($topic['quick_mod']['move']) |
|
363 | - echo ' |
|
376 | + if ($topic['quick_mod']['move']) { |
|
377 | + echo ' |
|
364 | 378 | <a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
379 | + } |
|
365 | 380 | } |
366 | 381 | |
367 | 382 | echo ' |
368 | 383 | </div>'; |
369 | 384 | } |
370 | 385 | |
371 | - if ($message['body_highlighted'] != '') |
|
372 | - echo ' |
|
386 | + if ($message['body_highlighted'] != '') { |
|
387 | + echo ' |
|
373 | 388 | <br class="clear"> |
374 | 389 | <div class="list_posts double_height">', $message['body_highlighted'], '</div>'; |
390 | + } |
|
375 | 391 | } |
376 | 392 | |
377 | 393 | echo ' |
@@ -379,11 +395,12 @@ discard block |
||
379 | 395 | </div>'; |
380 | 396 | |
381 | 397 | } |
382 | - if (!empty($context['topics'])) |
|
383 | - echo ' |
|
398 | + if (!empty($context['topics'])) { |
|
399 | + echo ' |
|
384 | 400 | <div class="pagesection"> |
385 | 401 | <span>', $context['page_index'], '</span> |
386 | 402 | </div>'; |
403 | + } |
|
387 | 404 | |
388 | 405 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
389 | 406 | { |
@@ -393,17 +410,19 @@ discard block |
||
393 | 410 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
394 | 411 | <option value="">--------</option>'; |
395 | 412 | |
396 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
397 | - if ($context['can_' . $qmod_action]) |
|
413 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
414 | + if ($context['can_' . $qmod_action]) |
|
398 | 415 | echo ' |
399 | 416 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
417 | + } |
|
400 | 418 | |
401 | 419 | echo ' |
402 | 420 | </select>'; |
403 | 421 | |
404 | - if ($context['can_move']) |
|
405 | - echo ' |
|
422 | + if ($context['can_move']) { |
|
423 | + echo ' |
|
406 | 424 | <span id="quick_mod_jump_to"> </span>'; |
425 | + } |
|
407 | 426 | |
408 | 427 | echo ' |
409 | 428 | <input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '"> |
@@ -413,13 +432,13 @@ discard block |
||
413 | 432 | } |
414 | 433 | |
415 | 434 | |
416 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
|
417 | - echo ' |
|
435 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) { |
|
436 | + echo ' |
|
418 | 437 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
419 | 438 | </form>'; |
439 | + } |
|
420 | 440 | |
421 | - } |
|
422 | - else |
|
441 | + } else |
|
423 | 442 | { |
424 | 443 | echo ' |
425 | 444 | <div class="cat_bar"> |
@@ -431,9 +450,10 @@ discard block |
||
431 | 450 | <span>', $context['page_index'], '</span> |
432 | 451 | </div>'; |
433 | 452 | |
434 | - if (empty($context['topics'])) |
|
435 | - echo ' |
|
453 | + if (empty($context['topics'])) { |
|
454 | + echo ' |
|
436 | 455 | <div class="information">(', $txt['search_no_results'], ')</div>'; |
456 | + } |
|
437 | 457 | |
438 | 458 | while ($topic = $context['get_topics']()) |
439 | 459 | { |
@@ -448,23 +468,27 @@ discard block |
||
448 | 468 | </div> |
449 | 469 | <div class="list_posts">', $message['body_highlighted'], '</div>'; |
450 | 470 | |
451 | - if ($topic['can_reply']) |
|
452 | - echo ' |
|
471 | + if ($topic['can_reply']) { |
|
472 | + echo ' |
|
453 | 473 | <ul class="quickbuttons">'; |
474 | + } |
|
454 | 475 | |
455 | 476 | // If they *can* reply? |
456 | - if ($topic['can_reply']) |
|
457 | - echo ' |
|
477 | + if ($topic['can_reply']) { |
|
478 | + echo ' |
|
458 | 479 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
480 | + } |
|
459 | 481 | |
460 | 482 | // If they *can* quote? |
461 | - if ($topic['can_quote']) |
|
462 | - echo ' |
|
483 | + if ($topic['can_quote']) { |
|
484 | + echo ' |
|
463 | 485 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'] . ';quote=' . $message['id'] . '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
486 | + } |
|
464 | 487 | |
465 | - if ($topic['can_reply']) |
|
466 | - echo ' |
|
488 | + if ($topic['can_reply']) { |
|
489 | + echo ' |
|
467 | 490 | </ul>'; |
491 | + } |
|
468 | 492 | echo ' |
469 | 493 | <br class="clear"> |
470 | 494 | </div>'; |
@@ -483,8 +507,8 @@ discard block |
||
483 | 507 | <div class="smalltext righttext" id="search_jump_to"> </div> |
484 | 508 | <script>'; |
485 | 509 | |
486 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
487 | - echo ' |
|
510 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
511 | + echo ' |
|
488 | 512 | if (typeof(window.XMLHttpRequest) != "undefined") |
489 | 513 | aJumpTo[aJumpTo.length] = new JumpTo({ |
490 | 514 | sContainerId: "quick_mod_jump_to", |
@@ -499,6 +523,7 @@ discard block |
||
499 | 523 | bDisabled: true, |
500 | 524 | sCustomName: "move_to" |
501 | 525 | });'; |
526 | + } |
|
502 | 527 | |
503 | 528 | echo ' |
504 | 529 | if (typeof(window.XMLHttpRequest) != "undefined") |
@@ -12,7 +12,8 @@ |
||
12 | 12 | header('Location: ' . $boardurl); |
13 | 13 | } |
14 | 14 | // Can't find it... just forget it. |
15 | -else |
|
15 | +else { |
|
16 | 16 | exit; |
17 | +} |
|
17 | 18 | |
18 | 19 | ?> |
19 | 20 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 3 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Main entry point for the admin search settings screen. |
@@ -107,11 +108,13 @@ discard block |
||
107 | 108 | // Perhaps the search method wants to add some settings? |
108 | 109 | require_once($sourcedir . '/Search.php'); |
109 | 110 | $searchAPI = findSearchAPI(); |
110 | - if (is_callable(array($searchAPI, 'searchSettings'))) |
|
111 | - call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars)); |
|
111 | + if (is_callable(array($searchAPI, 'searchSettings'))) { |
|
112 | + call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars)); |
|
113 | + } |
|
112 | 114 | |
113 | - if ($return_config) |
|
114 | - return $config_vars; |
|
115 | + if ($return_config) { |
|
116 | + return $config_vars; |
|
117 | + } |
|
115 | 118 | |
116 | 119 | $context['page_title'] = $txt['search_settings_title']; |
117 | 120 | $context['sub_template'] = 'show_settings'; |
@@ -126,8 +129,9 @@ discard block |
||
126 | 129 | |
127 | 130 | call_integration_hook('integrate_save_search_settings'); |
128 | 131 | |
129 | - if (empty($_POST['search_results_per_page'])) |
|
130 | - $_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages']; |
|
132 | + if (empty($_POST['search_results_per_page'])) { |
|
133 | + $_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages']; |
|
134 | + } |
|
131 | 135 | saveDBSettings($config_vars); |
132 | 136 | $_SESSION['adm-save'] = true; |
133 | 137 | redirectexit('action=admin;area=managesearch;sa=settings;' . $context['session_var'] . '=' . $context['session_id']); |
@@ -177,17 +181,20 @@ discard block |
||
177 | 181 | call_integration_hook('integrate_save_search_weights'); |
178 | 182 | |
179 | 183 | $changes = array(); |
180 | - foreach ($factors as $factor) |
|
181 | - $changes[$factor] = (int) $_POST[$factor]; |
|
184 | + foreach ($factors as $factor) { |
|
185 | + $changes[$factor] = (int) $_POST[$factor]; |
|
186 | + } |
|
182 | 187 | updateSettings($changes); |
183 | 188 | } |
184 | 189 | |
185 | 190 | $context['relative_weights'] = array('total' => 0); |
186 | - foreach ($factors as $factor) |
|
187 | - $context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0; |
|
191 | + foreach ($factors as $factor) { |
|
192 | + $context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0; |
|
193 | + } |
|
188 | 194 | |
189 | - foreach ($factors as $factor) |
|
190 | - $context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1); |
|
195 | + foreach ($factors as $factor) { |
|
196 | + $context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1); |
|
197 | + } |
|
191 | 198 | |
192 | 199 | createToken('admin-msw'); |
193 | 200 | } |
@@ -215,8 +222,9 @@ discard block |
||
215 | 222 | $context['search_apis'] = loadSearchAPIs(); |
216 | 223 | |
217 | 224 | // Detect whether a fulltext index is set. |
218 | - if ($context['supports_fulltext']) |
|
219 | - detectFulltextIndex(); |
|
225 | + if ($context['supports_fulltext']) { |
|
226 | + detectFulltextIndex(); |
|
227 | + } |
|
220 | 228 | |
221 | 229 | if (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'createfulltext') |
222 | 230 | { |
@@ -252,8 +260,7 @@ discard block |
||
252 | 260 | 'language' => $language_ftx |
253 | 261 | ) |
254 | 262 | ); |
255 | - } |
|
256 | - else |
|
263 | + } else |
|
257 | 264 | { |
258 | 265 | // Make sure it's gone before creating it. |
259 | 266 | $smcFunc['db_query']('', ' |
@@ -273,8 +280,7 @@ discard block |
||
273 | 280 | } |
274 | 281 | |
275 | 282 | $context['fulltext_index'] = 'body'; |
276 | - } |
|
277 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
283 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
278 | 284 | { |
279 | 285 | checkSession('get'); |
280 | 286 | validateToken('admin-msm', 'get'); |
@@ -291,12 +297,12 @@ discard block |
||
291 | 297 | $context['fulltext_index'] = ''; |
292 | 298 | |
293 | 299 | // Go back to the default search method. |
294 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') |
|
295 | - updateSettings(array( |
|
300 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') { |
|
301 | + updateSettings(array( |
|
296 | 302 | 'search_index' => '', |
297 | 303 | )); |
298 | - } |
|
299 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
304 | + } |
|
305 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
300 | 306 | { |
301 | 307 | checkSession('get'); |
302 | 308 | validateToken('admin-msm', 'get'); |
@@ -318,12 +324,12 @@ discard block |
||
318 | 324 | )); |
319 | 325 | |
320 | 326 | // Go back to the default search method. |
321 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
322 | - updateSettings(array( |
|
327 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
328 | + updateSettings(array( |
|
323 | 329 | 'search_index' => '', |
324 | 330 | )); |
325 | - } |
|
326 | - elseif (isset($_POST['save'])) |
|
331 | + } |
|
332 | + } elseif (isset($_POST['save'])) |
|
327 | 333 | { |
328 | 334 | checkSession(); |
329 | 335 | validateToken('admin-msmpost'); |
@@ -345,8 +351,8 @@ discard block |
||
345 | 351 | // Get some info about the messages table, to show its size and index size. |
346 | 352 | if ($db_type == 'mysql') |
347 | 353 | { |
348 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
349 | - $request = $smcFunc['db_query']('', ' |
|
354 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
355 | + $request = $smcFunc['db_query']('', ' |
|
350 | 356 | SHOW TABLE STATUS |
351 | 357 | FROM {string:database_name} |
352 | 358 | LIKE {string:table_name}', |
@@ -355,14 +361,15 @@ discard block |
||
355 | 361 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
356 | 362 | ) |
357 | 363 | ); |
358 | - else |
|
359 | - $request = $smcFunc['db_query']('', ' |
|
364 | + } else { |
|
365 | + $request = $smcFunc['db_query']('', ' |
|
360 | 366 | SHOW TABLE STATUS |
361 | 367 | LIKE {string:table_name}', |
362 | 368 | array( |
363 | 369 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
364 | 370 | ) |
365 | 371 | ); |
372 | + } |
|
366 | 373 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
367 | 374 | { |
368 | 375 | // Only do this if the user has permission to execute this query. |
@@ -374,8 +381,8 @@ discard block |
||
374 | 381 | } |
375 | 382 | |
376 | 383 | // Now check the custom index table, if it exists at all. |
377 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
378 | - $request = $smcFunc['db_query']('', ' |
|
384 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
385 | + $request = $smcFunc['db_query']('', ' |
|
379 | 386 | SHOW TABLE STATUS |
380 | 387 | FROM {string:database_name} |
381 | 388 | LIKE {string:table_name}', |
@@ -384,14 +391,15 @@ discard block |
||
384 | 391 | 'table_name' => str_replace('_', '\_', $match[2]) . 'log_search_words', |
385 | 392 | ) |
386 | 393 | ); |
387 | - else |
|
388 | - $request = $smcFunc['db_query']('', ' |
|
394 | + } else { |
|
395 | + $request = $smcFunc['db_query']('', ' |
|
389 | 396 | SHOW TABLE STATUS |
390 | 397 | LIKE {string:table_name}', |
391 | 398 | array( |
392 | 399 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'log_search_words', |
393 | 400 | ) |
394 | 401 | ); |
402 | + } |
|
395 | 403 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
396 | 404 | { |
397 | 405 | // Only do this if the user has permission to execute this query. |
@@ -400,8 +408,7 @@ discard block |
||
400 | 408 | $context['table_info']['custom_index_length'] = $row['Data_length'] + $row['Index_length']; |
401 | 409 | $smcFunc['db_free_result']($request); |
402 | 410 | } |
403 | - } |
|
404 | - elseif ($db_type == 'postgresql') |
|
411 | + } elseif ($db_type == 'postgresql') |
|
405 | 412 | { |
406 | 413 | // In order to report the sizes correctly we need to perform vacuum (optimize) on the tables we will be using. |
407 | 414 | //db_extend(); |
@@ -443,38 +450,38 @@ discard block |
||
443 | 450 | $context['table_info']['data_length'] = (int) $row['table_size']; |
444 | 451 | $context['table_info']['index_length'] = (int) $row['index_size']; |
445 | 452 | $context['table_info']['fulltext_length'] = (int) $row['index_size']; |
446 | - } |
|
447 | - elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
453 | + } elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
448 | 454 | { |
449 | 455 | $context['table_info']['index_length'] = (int) $row['index_size']; |
450 | 456 | $context['table_info']['custom_index_length'] = (int) $row['index_size']; |
451 | 457 | } |
452 | 458 | } |
453 | 459 | $smcFunc['db_free_result']($request); |
454 | - } |
|
455 | - else |
|
456 | - // Didn't work for some reason... |
|
460 | + } else { |
|
461 | + // Didn't work for some reason... |
|
457 | 462 | $context['table_info'] = array( |
458 | 463 | 'data_length' => $txt['not_applicable'], |
459 | 464 | 'index_length' => $txt['not_applicable'], |
460 | 465 | 'fulltext_length' => $txt['not_applicable'], |
461 | 466 | 'custom_index_length' => $txt['not_applicable'], |
462 | 467 | ); |
463 | - } |
|
464 | - else |
|
465 | - $context['table_info'] = array( |
|
468 | + } |
|
469 | + } else { |
|
470 | + $context['table_info'] = array( |
|
466 | 471 | 'data_length' => $txt['not_applicable'], |
467 | 472 | 'index_length' => $txt['not_applicable'], |
468 | 473 | 'fulltext_length' => $txt['not_applicable'], |
469 | 474 | 'custom_index_length' => $txt['not_applicable'], |
470 | 475 | ); |
476 | + } |
|
471 | 477 | |
472 | 478 | // Format the data and index length in kilobytes. |
473 | 479 | foreach ($context['table_info'] as $type => $size) |
474 | 480 | { |
475 | 481 | // If it's not numeric then just break. This database engine doesn't support size. |
476 | - if (!is_numeric($size)) |
|
477 | - break; |
|
482 | + if (!is_numeric($size)) { |
|
483 | + break; |
|
484 | + } |
|
478 | 485 | |
479 | 486 | $context['table_info'][$type] = comma_format($context['table_info'][$type] / 1024) . ' ' . $txt['search_method_kilobytes']; |
480 | 487 | } |
@@ -503,8 +510,9 @@ discard block |
||
503 | 510 | |
504 | 511 | // Scotty, we need more time... |
505 | 512 | @set_time_limit(600); |
506 | - if (function_exists('apache_reset_timeout')) |
|
507 | - @apache_reset_timeout(); |
|
513 | + if (function_exists('apache_reset_timeout')) { |
|
514 | + @apache_reset_timeout(); |
|
515 | + } |
|
508 | 516 | |
509 | 517 | $context[$context['admin_menu_name']]['current_subsection'] = 'method'; |
510 | 518 | $context['page_title'] = $txt['search_index_custom']; |
@@ -534,8 +542,7 @@ discard block |
||
534 | 542 | $context['start'] = (int) $context['index_settings']['resume_at']; |
535 | 543 | unset($context['index_settings']['resume_at']); |
536 | 544 | $context['step'] = 1; |
537 | - } |
|
538 | - else |
|
545 | + } else |
|
539 | 546 | { |
540 | 547 | $context['index_settings'] = array( |
541 | 548 | 'bytes_per_word' => isset($_REQUEST['bytes_per_word']) && isset($index_properties[$_REQUEST['bytes_per_word']]) ? (int) $_REQUEST['bytes_per_word'] : 2, |
@@ -544,12 +551,14 @@ discard block |
||
544 | 551 | $context['step'] = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0; |
545 | 552 | |
546 | 553 | // admin timeouts are painful when building these long indexes - but only if we actually have such things enabled |
547 | - if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) |
|
548 | - $_SESSION['admin_time'] = time(); |
|
554 | + if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) { |
|
555 | + $_SESSION['admin_time'] = time(); |
|
556 | + } |
|
549 | 557 | } |
550 | 558 | |
551 | - if ($context['step'] !== 0) |
|
552 | - checkSession('request'); |
|
559 | + if ($context['step'] !== 0) { |
|
560 | + checkSession('request'); |
|
561 | + } |
|
553 | 562 | |
554 | 563 | // Step 0: let the user determine how they like their index. |
555 | 564 | if ($context['step'] === 0) |
@@ -578,12 +587,14 @@ discard block |
||
578 | 587 | $smcFunc['db_create_word_search']($index_properties[$context['index_settings']['bytes_per_word']]['column_definition']); |
579 | 588 | |
580 | 589 | // Temporarily switch back to not using a search index. |
581 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
582 | - updateSettings(array('search_index' => '')); |
|
590 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
591 | + updateSettings(array('search_index' => '')); |
|
592 | + } |
|
583 | 593 | |
584 | 594 | // Don't let simultanious processes be updating the search index. |
585 | - if (!empty($modSettings['search_custom_index_config'])) |
|
586 | - updateSettings(array('search_custom_index_config' => '')); |
|
595 | + if (!empty($modSettings['search_custom_index_config'])) { |
|
596 | + updateSettings(array('search_custom_index_config' => '')); |
|
597 | + } |
|
587 | 598 | } |
588 | 599 | |
589 | 600 | $num_messages = array( |
@@ -599,16 +610,16 @@ discard block |
||
599 | 610 | 'starting_id' => $context['start'], |
600 | 611 | ) |
601 | 612 | ); |
602 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
603 | - $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
613 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
614 | + $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
615 | + } |
|
604 | 616 | |
605 | 617 | if (empty($num_messages['todo'])) |
606 | 618 | { |
607 | 619 | $context['step'] = 2; |
608 | 620 | $context['percentage'] = 80; |
609 | 621 | $context['start'] = 0; |
610 | - } |
|
611 | - else |
|
622 | + } else |
|
612 | 623 | { |
613 | 624 | // Number of seconds before the next step. |
614 | 625 | $stop = time() + 3; |
@@ -649,21 +660,22 @@ discard block |
||
649 | 660 | |
650 | 661 | $context['start'] += $forced_break ? $number_processed : $messages_per_batch; |
651 | 662 | |
652 | - if (!empty($inserts)) |
|
653 | - $smcFunc['db_insert']('ignore', |
|
663 | + if (!empty($inserts)) { |
|
664 | + $smcFunc['db_insert']('ignore', |
|
654 | 665 | '{db_prefix}log_search_words', |
655 | 666 | array('id_word' => 'int', 'id_msg' => 'int'), |
656 | 667 | $inserts, |
657 | 668 | array('id_word', 'id_msg') |
658 | 669 | ); |
670 | + } |
|
659 | 671 | if ($num_messages['todo'] === 0) |
660 | 672 | { |
661 | 673 | $context['step'] = 2; |
662 | 674 | $context['start'] = 0; |
663 | 675 | break; |
676 | + } else { |
|
677 | + updateSettings(array('search_custom_index_resume' => json_encode(array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
664 | 678 | } |
665 | - else |
|
666 | - updateSettings(array('search_custom_index_resume' => json_encode(array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
667 | 679 | } |
668 | 680 | |
669 | 681 | // Since there are still two steps to go, 80% is the maximum here. |
@@ -674,9 +686,9 @@ discard block |
||
674 | 686 | // Step 2: removing the words that occur too often and are of no use. |
675 | 687 | elseif ($context['step'] === 2) |
676 | 688 | { |
677 | - if ($context['index_settings']['bytes_per_word'] < 4) |
|
678 | - $context['step'] = 3; |
|
679 | - else |
|
689 | + if ($context['index_settings']['bytes_per_word'] < 4) { |
|
690 | + $context['step'] = 3; |
|
691 | + } else |
|
680 | 692 | { |
681 | 693 | $stop_words = $context['start'] === 0 || empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']); |
682 | 694 | $stop = time() + 3; |
@@ -697,20 +709,22 @@ discard block |
||
697 | 709 | 'minimum_messages' => $max_messages, |
698 | 710 | ) |
699 | 711 | ); |
700 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
701 | - $stop_words[] = $row['id_word']; |
|
712 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
713 | + $stop_words[] = $row['id_word']; |
|
714 | + } |
|
702 | 715 | $smcFunc['db_free_result']($request); |
703 | 716 | |
704 | 717 | updateSettings(array('search_stopwords' => implode(',', $stop_words))); |
705 | 718 | |
706 | - if (!empty($stop_words)) |
|
707 | - $smcFunc['db_query']('', ' |
|
719 | + if (!empty($stop_words)) { |
|
720 | + $smcFunc['db_query']('', ' |
|
708 | 721 | DELETE FROM {db_prefix}log_search_words |
709 | 722 | WHERE id_word in ({array_int:stop_words})', |
710 | 723 | array( |
711 | 724 | 'stop_words' => $stop_words, |
712 | 725 | ) |
713 | 726 | ); |
727 | + } |
|
714 | 728 | |
715 | 729 | $context['start'] += $index_properties[$context['index_settings']['bytes_per_word']]['step_size']; |
716 | 730 | if ($context['start'] > $index_properties[$context['index_settings']['bytes_per_word']]['max_size']) |
@@ -771,8 +785,9 @@ discard block |
||
771 | 785 | $searchAPI = new $search_class_name(); |
772 | 786 | |
773 | 787 | // No Support? NEXT! |
774 | - if (!$searchAPI->is_supported) |
|
775 | - continue; |
|
788 | + if (!$searchAPI->is_supported) { |
|
789 | + continue; |
|
790 | + } |
|
776 | 791 | |
777 | 792 | $apis[$index_name] = array( |
778 | 793 | 'filename' => $file, |
@@ -819,10 +834,10 @@ discard block |
||
819 | 834 | 'messages_ftx' => $db_prefix . 'messages_ftx', |
820 | 835 | ) |
821 | 836 | ); |
822 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
823 | - $context['fulltext_index'][] = $row['indexname']; |
|
824 | - } |
|
825 | - else |
|
837 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
838 | + $context['fulltext_index'][] = $row['indexname']; |
|
839 | + } |
|
840 | + } else |
|
826 | 841 | { |
827 | 842 | $request = $smcFunc['db_query']('', ' |
828 | 843 | SHOW INDEX |
@@ -833,17 +848,19 @@ discard block |
||
833 | 848 | $context['fulltext_index'] = ''; |
834 | 849 | if ($request !== false || $smcFunc['db_num_rows']($request) != 0) |
835 | 850 | { |
836 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
837 | - if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
851 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
852 | + if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
838 | 853 | $context['fulltext_index'][] = $row['Key_name']; |
854 | + } |
|
839 | 855 | $smcFunc['db_free_result']($request); |
840 | 856 | |
841 | - if (is_array($context['fulltext_index'])) |
|
842 | - $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
857 | + if (is_array($context['fulltext_index'])) { |
|
858 | + $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
859 | + } |
|
843 | 860 | } |
844 | 861 | |
845 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
846 | - $request = $smcFunc['db_query']('', ' |
|
862 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
863 | + $request = $smcFunc['db_query']('', ' |
|
847 | 864 | SHOW TABLE STATUS |
848 | 865 | FROM {string:database_name} |
849 | 866 | LIKE {string:table_name}', |
@@ -852,20 +869,22 @@ discard block |
||
852 | 869 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
853 | 870 | ) |
854 | 871 | ); |
855 | - else |
|
856 | - $request = $smcFunc['db_query']('', ' |
|
872 | + } else { |
|
873 | + $request = $smcFunc['db_query']('', ' |
|
857 | 874 | SHOW TABLE STATUS |
858 | 875 | LIKE {string:table_name}', |
859 | 876 | array( |
860 | 877 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
861 | 878 | ) |
862 | 879 | ); |
880 | + } |
|
863 | 881 | |
864 | 882 | if ($request !== false) |
865 | 883 | { |
866 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
867 | - if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'], '5.6.4', '>='))) |
|
884 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
885 | + if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'], '5.6.4', '>='))) |
|
868 | 886 | $context['cannot_create_fulltext'] = true; |
887 | + } |
|
869 | 888 | $smcFunc['db_free_result']($request); |
870 | 889 | } |
871 | 890 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 3 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * The main entrance point for the Manage Members screen. |
@@ -62,16 +63,18 @@ discard block |
||
62 | 63 | $context['activation_numbers'] = array(); |
63 | 64 | $context['awaiting_activation'] = 0; |
64 | 65 | $context['awaiting_approval'] = 0; |
65 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
66 | - $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
66 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
67 | + $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
68 | + } |
|
67 | 69 | $smcFunc['db_free_result']($request); |
68 | 70 | |
69 | 71 | foreach ($context['activation_numbers'] as $activation_type => $total_members) |
70 | 72 | { |
71 | - if (in_array($activation_type, array(0, 2))) |
|
72 | - $context['awaiting_activation'] += $total_members; |
|
73 | - elseif (in_array($activation_type, array(3, 4, 5))) |
|
74 | - $context['awaiting_approval'] += $total_members; |
|
73 | + if (in_array($activation_type, array(0, 2))) { |
|
74 | + $context['awaiting_activation'] += $total_members; |
|
75 | + } elseif (in_array($activation_type, array(3, 4, 5))) { |
|
76 | + $context['awaiting_approval'] += $total_members; |
|
77 | + } |
|
75 | 78 | } |
76 | 79 | |
77 | 80 | // For the page header... do we show activation? |
@@ -124,8 +127,9 @@ discard block |
||
124 | 127 | } |
125 | 128 | if (!$context['show_approve'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'approve')) |
126 | 129 | { |
127 | - if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) |
|
128 | - $context['tabs']['search']['is_last'] = true; |
|
130 | + if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) { |
|
131 | + $context['tabs']['search']['is_last'] = true; |
|
132 | + } |
|
129 | 133 | unset($context['tabs']['approve']); |
130 | 134 | } |
131 | 135 | |
@@ -157,8 +161,9 @@ discard block |
||
157 | 161 | foreach ($_POST['delete'] as $key => $value) |
158 | 162 | { |
159 | 163 | // Don't delete yourself, idiot. |
160 | - if ($value != $user_info['id']) |
|
161 | - $delete[$key] = (int) $value; |
|
164 | + if ($value != $user_info['id']) { |
|
165 | + $delete[$key] = (int) $value; |
|
166 | + } |
|
162 | 167 | } |
163 | 168 | |
164 | 169 | if (!empty($delete)) |
@@ -194,17 +199,18 @@ discard block |
||
194 | 199 | ); |
195 | 200 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
196 | 201 | { |
197 | - if ($row['min_posts'] == -1) |
|
198 | - $context['membergroups'][] = array( |
|
202 | + if ($row['min_posts'] == -1) { |
|
203 | + $context['membergroups'][] = array( |
|
199 | 204 | 'id' => $row['id_group'], |
200 | 205 | 'name' => $row['group_name'], |
201 | 206 | 'can_be_additional' => true |
202 | 207 | ); |
203 | - else |
|
204 | - $context['postgroups'][] = array( |
|
208 | + } else { |
|
209 | + $context['postgroups'][] = array( |
|
205 | 210 | 'id' => $row['id_group'], |
206 | 211 | 'name' => $row['group_name'] |
207 | 212 | ); |
213 | + } |
|
208 | 214 | } |
209 | 215 | $smcFunc['db_free_result']($request); |
210 | 216 | |
@@ -268,14 +274,15 @@ discard block |
||
268 | 274 | call_integration_hook('integrate_view_members_params', array(&$params)); |
269 | 275 | |
270 | 276 | $search_params = array(); |
271 | - if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) |
|
272 | - $search_params = smf_json_decode(base64_decode($_REQUEST['params']), true); |
|
273 | - elseif (!empty($_POST)) |
|
277 | + if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) { |
|
278 | + $search_params = smf_json_decode(base64_decode($_REQUEST['params']), true); |
|
279 | + } elseif (!empty($_POST)) |
|
274 | 280 | { |
275 | 281 | $search_params['types'] = $_POST['types']; |
276 | - foreach ($params as $param_name => $param_info) |
|
277 | - if (isset($_POST[$param_name])) |
|
282 | + foreach ($params as $param_name => $param_info) { |
|
283 | + if (isset($_POST[$param_name])) |
|
278 | 284 | $search_params[$param_name] = $_POST[$param_name]; |
285 | + } |
|
279 | 286 | } |
280 | 287 | |
281 | 288 | $search_url_params = isset($search_params) ? base64_encode(json_encode($search_params)) : null; |
@@ -288,18 +295,21 @@ discard block |
||
288 | 295 | foreach ($params as $param_name => $param_info) |
289 | 296 | { |
290 | 297 | // Not filled in? |
291 | - if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') |
|
292 | - continue; |
|
298 | + if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') { |
|
299 | + continue; |
|
300 | + } |
|
293 | 301 | |
294 | 302 | // Make sure numeric values are really numeric. |
295 | - if (in_array($param_info['type'], array('int', 'age'))) |
|
296 | - $search_params[$param_name] = (int) $search_params[$param_name]; |
|
303 | + if (in_array($param_info['type'], array('int', 'age'))) { |
|
304 | + $search_params[$param_name] = (int) $search_params[$param_name]; |
|
305 | + } |
|
297 | 306 | // Date values have to match the specified format. |
298 | 307 | elseif ($param_info['type'] == 'date') |
299 | 308 | { |
300 | 309 | // Check if this date format is valid. |
301 | - if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) |
|
302 | - continue; |
|
310 | + if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) { |
|
311 | + continue; |
|
312 | + } |
|
303 | 313 | |
304 | 314 | $search_params[$param_name] = strtotime($search_params[$param_name]); |
305 | 315 | } |
@@ -308,8 +318,9 @@ discard block |
||
308 | 318 | if (!empty($param_info['range'])) |
309 | 319 | { |
310 | 320 | // Default to '=', just in case... |
311 | - if (empty($range_trans[$search_params['types'][$param_name]])) |
|
312 | - $search_params['types'][$param_name] = '='; |
|
321 | + if (empty($range_trans[$search_params['types'][$param_name]])) { |
|
322 | + $search_params['types'][$param_name] = '='; |
|
323 | + } |
|
313 | 324 | |
314 | 325 | // Handle special case 'age'. |
315 | 326 | if ($param_info['type'] == 'age') |
@@ -337,29 +348,30 @@ discard block |
||
337 | 348 | elseif ($param_info['type'] == 'date' && $search_params['types'][$param_name] == '=') |
338 | 349 | { |
339 | 350 | $query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400); |
351 | + } else { |
|
352 | + $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
340 | 353 | } |
341 | - else |
|
342 | - $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
343 | 354 | } |
344 | 355 | // Checkboxes. |
345 | 356 | elseif ($param_info['type'] == 'checkbox') |
346 | 357 | { |
347 | 358 | // Each checkbox or no checkbox at all is checked -> ignore. |
348 | - if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) |
|
349 | - continue; |
|
359 | + if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) { |
|
360 | + continue; |
|
361 | + } |
|
350 | 362 | |
351 | 363 | $query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})'; |
352 | 364 | $where_params[$param_name . '_check'] = $search_params[$param_name]; |
353 | - } |
|
354 | - else |
|
365 | + } else |
|
355 | 366 | { |
356 | 367 | // Replace the wildcard characters ('*' and '?') into MySQL ones. |
357 | 368 | $parameter = strtolower(strtr($smcFunc['htmlspecialchars']($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_'))); |
358 | 369 | |
359 | - if ($smcFunc['db_case_sensitive']) |
|
360 | - $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
361 | - else |
|
362 | - $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
370 | + if ($smcFunc['db_case_sensitive']) { |
|
371 | + $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
372 | + } else { |
|
373 | + $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
374 | + } |
|
363 | 375 | $where_params[$param_name . '_normal'] = '%' . $parameter . '%'; |
364 | 376 | } |
365 | 377 | } |
@@ -375,16 +387,18 @@ discard block |
||
375 | 387 | } |
376 | 388 | |
377 | 389 | // Additional membergroups (these are only relevant if not all primary groups where selected!). |
378 | - if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) |
|
379 | - foreach ($search_params['membergroups'][2] as $mg) |
|
390 | + if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) { |
|
391 | + foreach ($search_params['membergroups'][2] as $mg) |
|
380 | 392 | { |
381 | 393 | $mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0'; |
394 | + } |
|
382 | 395 | $where_params['add_group_' . $mg] = $mg; |
383 | 396 | } |
384 | 397 | |
385 | 398 | // Combine the one or two membergroup parts into one query part linked with an OR. |
386 | - if (!empty($mg_query_parts)) |
|
387 | - $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
399 | + if (!empty($mg_query_parts)) { |
|
400 | + $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
401 | + } |
|
388 | 402 | |
389 | 403 | // Get all selected post count related membergroups. |
390 | 404 | if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups'])) |
@@ -396,9 +410,9 @@ discard block |
||
396 | 410 | // Construct the where part of the query. |
397 | 411 | $where = empty($query_parts) ? '1=1' : implode(' |
398 | 412 | AND ', $query_parts); |
413 | + } else { |
|
414 | + $search_url_params = null; |
|
399 | 415 | } |
400 | - else |
|
401 | - $search_url_params = null; |
|
402 | 416 | |
403 | 417 | // Construct the additional URL part with the query info in it. |
404 | 418 | $context['params_url'] = $context['sub_action'] == 'query' ? ';sa=query;params=' . $search_url_params : ''; |
@@ -521,28 +535,32 @@ discard block |
||
521 | 535 | 'function' => function($rowData) use ($txt) |
522 | 536 | { |
523 | 537 | // Calculate number of days since last online. |
524 | - if (empty($rowData['last_login'])) |
|
525 | - $difference = $txt['never']; |
|
526 | - else |
|
538 | + if (empty($rowData['last_login'])) { |
|
539 | + $difference = $txt['never']; |
|
540 | + } else |
|
527 | 541 | { |
528 | 542 | $num_days_difference = jeffsdatediff($rowData['last_login']); |
529 | 543 | |
530 | 544 | // Today. |
531 | - if (empty($num_days_difference)) |
|
532 | - $difference = $txt['viewmembers_today']; |
|
545 | + if (empty($num_days_difference)) { |
|
546 | + $difference = $txt['viewmembers_today']; |
|
547 | + } |
|
533 | 548 | |
534 | 549 | // Yesterday. |
535 | - elseif ($num_days_difference == 1) |
|
536 | - $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
550 | + elseif ($num_days_difference == 1) { |
|
551 | + $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
552 | + } |
|
537 | 553 | |
538 | 554 | // X days ago. |
539 | - else |
|
540 | - $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
555 | + else { |
|
556 | + $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
557 | + } |
|
541 | 558 | } |
542 | 559 | |
543 | 560 | // Show it in italics if they're not activated... |
544 | - if ($rowData['is_activated'] % 10 != 1) |
|
545 | - $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
561 | + if ($rowData['is_activated'] % 10 != 1) { |
|
562 | + $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
563 | + } |
|
546 | 564 | |
547 | 565 | return $difference; |
548 | 566 | }, |
@@ -594,8 +612,9 @@ discard block |
||
594 | 612 | ); |
595 | 613 | |
596 | 614 | // Without enough permissions, don't show 'delete members' checkboxes. |
597 | - if (!allowedTo('profile_remove_any')) |
|
598 | - unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
615 | + if (!allowedTo('profile_remove_any')) { |
|
616 | + unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
617 | + } |
|
599 | 618 | |
600 | 619 | require_once($sourcedir . '/Subs-List.php'); |
601 | 620 | createList($listOptions); |
@@ -638,17 +657,18 @@ discard block |
||
638 | 657 | ); |
639 | 658 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
640 | 659 | { |
641 | - if ($row['min_posts'] == -1) |
|
642 | - $context['membergroups'][] = array( |
|
660 | + if ($row['min_posts'] == -1) { |
|
661 | + $context['membergroups'][] = array( |
|
643 | 662 | 'id' => $row['id_group'], |
644 | 663 | 'name' => $row['group_name'], |
645 | 664 | 'can_be_additional' => true |
646 | 665 | ); |
647 | - else |
|
648 | - $context['postgroups'][] = array( |
|
666 | + } else { |
|
667 | + $context['postgroups'][] = array( |
|
649 | 668 | 'id' => $row['id_group'], |
650 | 669 | 'name' => $row['group_name'] |
651 | 670 | ); |
671 | + } |
|
652 | 672 | } |
653 | 673 | $smcFunc['db_free_result']($request); |
654 | 674 | |
@@ -675,8 +695,9 @@ discard block |
||
675 | 695 | $context['page_title'] = $txt['admin_members']; |
676 | 696 | $context['sub_template'] = 'admin_browse'; |
677 | 697 | $context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve'); |
678 | - if (isset($context['tabs'][$context['browse_type']])) |
|
679 | - $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
698 | + if (isset($context['tabs'][$context['browse_type']])) { |
|
699 | + $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
700 | + } |
|
680 | 701 | |
681 | 702 | // Allowed filters are those we can have, in theory. |
682 | 703 | $context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2); |
@@ -687,18 +708,20 @@ discard block |
||
687 | 708 | foreach ($context['activation_numbers'] as $type => $amount) |
688 | 709 | { |
689 | 710 | // We have some of these... |
690 | - if (in_array($type, $context['allowed_filters']) && $amount > 0) |
|
691 | - $context['available_filters'][] = array( |
|
711 | + if (in_array($type, $context['allowed_filters']) && $amount > 0) { |
|
712 | + $context['available_filters'][] = array( |
|
692 | 713 | 'type' => $type, |
693 | 714 | 'amount' => $amount, |
694 | 715 | 'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?', |
695 | 716 | 'selected' => $type == $context['current_filter'] |
696 | 717 | ); |
718 | + } |
|
697 | 719 | } |
698 | 720 | |
699 | 721 | // If the filter was not sent, set it to whatever has people in it! |
700 | - if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) |
|
701 | - $context['current_filter'] = $context['available_filters'][0]['type']; |
|
722 | + if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) { |
|
723 | + $context['current_filter'] = $context['available_filters'][0]['type']; |
|
724 | + } |
|
702 | 725 | |
703 | 726 | // This little variable is used to determine if we should flag where we are looking. |
704 | 727 | $context['show_filter'] = ($context['current_filter'] != 0 && $context['current_filter'] != 3) || count($context['available_filters']) > 1; |
@@ -713,44 +736,47 @@ discard block |
||
713 | 736 | ); |
714 | 737 | |
715 | 738 | // Are we showing duplicate information? |
716 | - if (isset($_GET['showdupes'])) |
|
717 | - $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
739 | + if (isset($_GET['showdupes'])) { |
|
740 | + $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
741 | + } |
|
718 | 742 | $context['show_duplicates'] = !empty($_SESSION['showdupes']); |
719 | 743 | |
720 | 744 | // Determine which actions we should allow on this page. |
721 | 745 | if ($context['browse_type'] == 'approve') |
722 | 746 | { |
723 | 747 | // If we are approving deleted accounts we have a slightly different list... actually a mirror ;) |
724 | - if ($context['current_filter'] == 4) |
|
725 | - $context['allowed_actions'] = array( |
|
748 | + if ($context['current_filter'] == 4) { |
|
749 | + $context['allowed_actions'] = array( |
|
726 | 750 | 'reject' => $txt['admin_browse_w_approve_deletion'], |
727 | 751 | 'ok' => $txt['admin_browse_w_reject'], |
728 | 752 | ); |
729 | - else |
|
730 | - $context['allowed_actions'] = array( |
|
753 | + } else { |
|
754 | + $context['allowed_actions'] = array( |
|
731 | 755 | 'ok' => $txt['admin_browse_w_approve'], |
732 | 756 | 'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'], |
733 | 757 | 'require_activation' => $txt['admin_browse_w_approve_require_activate'], |
734 | 758 | 'reject' => $txt['admin_browse_w_reject'], |
735 | 759 | 'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'], |
736 | 760 | ); |
737 | - } |
|
738 | - elseif ($context['browse_type'] == 'activate') |
|
739 | - $context['allowed_actions'] = array( |
|
761 | + } |
|
762 | + } elseif ($context['browse_type'] == 'activate') { |
|
763 | + $context['allowed_actions'] = array( |
|
740 | 764 | 'ok' => $txt['admin_browse_w_activate'], |
741 | 765 | 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], |
742 | 766 | 'delete' => $txt['admin_browse_w_delete'], |
743 | 767 | 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], |
744 | 768 | 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'], |
745 | 769 | ); |
770 | + } |
|
746 | 771 | |
747 | 772 | // Create an option list for actions allowed to be done with selected members. |
748 | 773 | $allowed_actions = ' |
749 | 774 | <option selected value="">' . $txt['admin_browse_with_selected'] . ':</option> |
750 | 775 | <option value="" disabled>-----------------------------</option>'; |
751 | - foreach ($context['allowed_actions'] as $key => $desc) |
|
752 | - $allowed_actions .= ' |
|
776 | + foreach ($context['allowed_actions'] as $key => $desc) { |
|
777 | + $allowed_actions .= ' |
|
753 | 778 | <option value="' . $key . '">' . $desc . '</option>'; |
779 | + } |
|
754 | 780 | |
755 | 781 | // Setup the Javascript function for selecting an action for the list. |
756 | 782 | $javascript = ' |
@@ -762,15 +788,16 @@ discard block |
||
762 | 788 | var message = "";'; |
763 | 789 | |
764 | 790 | // We have special messages for approving deletion of accounts - it's surprisingly logical - honest. |
765 | - if ($context['current_filter'] == 4) |
|
766 | - $javascript .= ' |
|
791 | + if ($context['current_filter'] == 4) { |
|
792 | + $javascript .= ' |
|
767 | 793 | if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
768 | 794 | message = "' . $txt['admin_browse_w_delete'] . '"; |
769 | 795 | else |
770 | 796 | message = "' . $txt['admin_browse_w_reject'] . '";'; |
797 | + } |
|
771 | 798 | // Otherwise a nice standard message. |
772 | - else |
|
773 | - $javascript .= ' |
|
799 | + else { |
|
800 | + $javascript .= ' |
|
774 | 801 | if (document.forms.postForm.todo.value.indexOf("delete") != -1) |
775 | 802 | message = "' . $txt['admin_browse_w_delete'] . '"; |
776 | 803 | else if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
@@ -779,6 +806,7 @@ discard block |
||
779 | 806 | message = "' . $txt['admin_browse_w_remind'] . '"; |
780 | 807 | else |
781 | 808 | message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";'; |
809 | + } |
|
782 | 810 | $javascript .= ' |
783 | 811 | if (confirm(message + " ' . $txt['admin_browse_warn'] . '")) |
784 | 812 | document.forms.postForm.submit(); |
@@ -911,10 +939,11 @@ discard block |
||
911 | 939 | $member_links = array(); |
912 | 940 | foreach ($rowData['duplicate_members'] as $member) |
913 | 941 | { |
914 | - if ($member['id']) |
|
915 | - $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
916 | - else |
|
917 | - $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
942 | + if ($member['id']) { |
|
943 | + $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
944 | + } else { |
|
945 | + $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
946 | + } |
|
918 | 947 | } |
919 | 948 | return implode(', ', $member_links); |
920 | 949 | }, |
@@ -963,14 +992,16 @@ discard block |
||
963 | 992 | ); |
964 | 993 | |
965 | 994 | // Pick what column to actually include if we're showing duplicates. |
966 | - if ($context['show_duplicates']) |
|
967 | - unset($listOptions['columns']['email']); |
|
968 | - else |
|
969 | - unset($listOptions['columns']['duplicates']); |
|
995 | + if ($context['show_duplicates']) { |
|
996 | + unset($listOptions['columns']['email']); |
|
997 | + } else { |
|
998 | + unset($listOptions['columns']['duplicates']); |
|
999 | + } |
|
970 | 1000 | |
971 | 1001 | // Only show hostname on duplicates as it takes a lot of time. |
972 | - if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) |
|
973 | - unset($listOptions['columns']['hostname']); |
|
1002 | + if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) { |
|
1003 | + unset($listOptions['columns']['hostname']); |
|
1004 | + } |
|
974 | 1005 | |
975 | 1006 | // Is there any need to show filters? |
976 | 1007 | if (isset($context['available_filters']) && count($context['available_filters']) > 1) |
@@ -978,9 +1009,10 @@ discard block |
||
978 | 1009 | $filterOptions = ' |
979 | 1010 | <strong>' . $txt['admin_browse_filter_by'] . ':</strong> |
980 | 1011 | <select name="filter" onchange="this.form.submit();">'; |
981 | - foreach ($context['available_filters'] as $filter) |
|
982 | - $filterOptions .= ' |
|
1012 | + foreach ($context['available_filters'] as $filter) { |
|
1013 | + $filterOptions .= ' |
|
983 | 1014 | <option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>'; |
1015 | + } |
|
984 | 1016 | $filterOptions .= ' |
985 | 1017 | </select> |
986 | 1018 | <noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button_submit"></noscript>'; |
@@ -992,12 +1024,13 @@ discard block |
||
992 | 1024 | } |
993 | 1025 | |
994 | 1026 | // What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at. |
995 | - if (!empty($context['show_filter']) && !empty($context['available_filters'])) |
|
996 | - $listOptions['additional_rows'][] = array( |
|
1027 | + if (!empty($context['show_filter']) && !empty($context['available_filters'])) { |
|
1028 | + $listOptions['additional_rows'][] = array( |
|
997 | 1029 | 'position' => 'above_column_headers', |
998 | 1030 | 'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'], |
999 | 1031 | 'class' => 'smalltext floatright', |
1000 | 1032 | ); |
1033 | + } |
|
1001 | 1034 | |
1002 | 1035 | // Now that we have all the options, create the list. |
1003 | 1036 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1027,12 +1060,14 @@ discard block |
||
1027 | 1060 | $current_filter = (int) $_REQUEST['orig_filter']; |
1028 | 1061 | |
1029 | 1062 | // If we are applying a filter do just that - then redirect. |
1030 | - if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) |
|
1031 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
1063 | + if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) { |
|
1064 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
1065 | + } |
|
1032 | 1066 | |
1033 | 1067 | // Nothing to do? |
1034 | - if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) |
|
1035 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1068 | + if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) { |
|
1069 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1070 | + } |
|
1036 | 1071 | |
1037 | 1072 | // Are we dealing with members who have been waiting for > set amount of time? |
1038 | 1073 | if (isset($_POST['time_passed'])) |
@@ -1045,8 +1080,9 @@ discard block |
||
1045 | 1080 | else |
1046 | 1081 | { |
1047 | 1082 | $members = array(); |
1048 | - foreach ($_POST['todoAction'] as $id) |
|
1049 | - $members[] = (int) $id; |
|
1083 | + foreach ($_POST['todoAction'] as $id) { |
|
1084 | + $members[] = (int) $id; |
|
1085 | + } |
|
1050 | 1086 | $condition = ' |
1051 | 1087 | AND id_member IN ({array_int:members})'; |
1052 | 1088 | } |
@@ -1067,8 +1103,9 @@ discard block |
||
1067 | 1103 | $member_count = $smcFunc['db_num_rows']($request); |
1068 | 1104 | |
1069 | 1105 | // If no results then just return! |
1070 | - if ($member_count == 0) |
|
1071 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1106 | + if ($member_count == 0) { |
|
1107 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1108 | + } |
|
1072 | 1109 | |
1073 | 1110 | $member_info = array(); |
1074 | 1111 | $members = array(); |
@@ -1107,8 +1144,9 @@ discard block |
||
1107 | 1144 | // Do we have to let the integration code know about the activations? |
1108 | 1145 | if (!empty($modSettings['integrate_activate'])) |
1109 | 1146 | { |
1110 | - foreach ($member_info as $member) |
|
1111 | - call_integration_hook('integrate_activate', array($member['username'])); |
|
1147 | + foreach ($member_info as $member) { |
|
1148 | + call_integration_hook('integrate_activate', array($member['username'])); |
|
1149 | + } |
|
1112 | 1150 | } |
1113 | 1151 | |
1114 | 1152 | // Check for email. |
@@ -1238,20 +1276,23 @@ discard block |
||
1238 | 1276 | $log_action = $_POST['todo'] == 'remind' ? 'remind_member' : 'approve_member'; |
1239 | 1277 | |
1240 | 1278 | require_once($sourcedir . '/Logging.php'); |
1241 | - foreach ($member_info as $member) |
|
1242 | - logAction($log_action, array('member' => $member['id']), 'admin'); |
|
1279 | + foreach ($member_info as $member) { |
|
1280 | + logAction($log_action, array('member' => $member['id']), 'admin'); |
|
1281 | + } |
|
1243 | 1282 | } |
1244 | 1283 | |
1245 | 1284 | // Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers). |
1246 | - if (in_array($current_filter, array(3, 4, 5))) |
|
1247 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
1285 | + if (in_array($current_filter, array(3, 4, 5))) { |
|
1286 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
1287 | + } |
|
1248 | 1288 | |
1249 | 1289 | // Update the member's stats. (but, we know the member didn't change their name.) |
1250 | 1290 | updateStats('member', false); |
1251 | 1291 | |
1252 | 1292 | // If they haven't been deleted, update the post group statistics on them... |
1253 | - if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) |
|
1254 | - updateStats('postgroups', $members); |
|
1293 | + if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) { |
|
1294 | + updateStats('postgroups', $members); |
|
1295 | + } |
|
1255 | 1296 | |
1256 | 1297 | redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
1257 | 1298 | } |
@@ -1276,10 +1317,11 @@ discard block |
||
1276 | 1317 | $dis = time() - $old; |
1277 | 1318 | |
1278 | 1319 | // Before midnight? |
1279 | - if ($dis < $sinceMidnight) |
|
1280 | - return 0; |
|
1281 | - else |
|
1282 | - $dis -= $sinceMidnight; |
|
1320 | + if ($dis < $sinceMidnight) { |
|
1321 | + return 0; |
|
1322 | + } else { |
|
1323 | + $dis -= $sinceMidnight; |
|
1324 | + } |
|
1283 | 1325 | |
1284 | 1326 | // Divide out the seconds in a day to get the number of days. |
1285 | 1327 | return ceil($dis / (24 * 60 * 60)); |