@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * The main entrance point for the Manage Members screen. |
@@ -138,8 +139,9 @@ discard block |
||
138 | 139 | foreach ($_POST['delete'] as $key => $value) |
139 | 140 | { |
140 | 141 | // Don't delete yourself, idiot. |
141 | - if ($value != $user_info['id']) |
|
142 | - $delete[$key] = (int) $value; |
|
142 | + if ($value != $user_info['id']) { |
|
143 | + $delete[$key] = (int) $value; |
|
144 | + } |
|
143 | 145 | } |
144 | 146 | |
145 | 147 | if (!empty($delete)) |
@@ -175,17 +177,18 @@ discard block |
||
175 | 177 | ); |
176 | 178 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
177 | 179 | { |
178 | - if ($row['min_posts'] == -1) |
|
179 | - $context['membergroups'][] = array( |
|
180 | + if ($row['min_posts'] == -1) { |
|
181 | + $context['membergroups'][] = array( |
|
180 | 182 | 'id' => $row['id_group'], |
181 | 183 | 'name' => $row['group_name'], |
182 | 184 | 'can_be_additional' => true |
183 | 185 | ); |
184 | - else |
|
185 | - $context['postgroups'][] = array( |
|
186 | + } else { |
|
187 | + $context['postgroups'][] = array( |
|
186 | 188 | 'id' => $row['id_group'], |
187 | 189 | 'name' => $row['group_name'] |
188 | 190 | ); |
191 | + } |
|
189 | 192 | } |
190 | 193 | $smcFunc['db_free_result']($request); |
191 | 194 | |
@@ -257,14 +260,15 @@ discard block |
||
257 | 260 | call_integration_hook('integrate_view_members_params', array(&$params)); |
258 | 261 | |
259 | 262 | $search_params = array(); |
260 | - if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) |
|
261 | - $search_params = $smcFunc['json_decode'](base64_decode($_REQUEST['params']), true); |
|
262 | - elseif (!empty($_POST)) |
|
263 | + if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) { |
|
264 | + $search_params = $smcFunc['json_decode'](base64_decode($_REQUEST['params']), true); |
|
265 | + } elseif (!empty($_POST)) |
|
263 | 266 | { |
264 | 267 | $search_params['types'] = $_POST['types']; |
265 | - foreach ($params as $param_name => $param_info) |
|
266 | - if (isset($_POST[$param_name])) |
|
268 | + foreach ($params as $param_name => $param_info) { |
|
269 | + if (isset($_POST[$param_name])) |
|
267 | 270 | $search_params[$param_name] = $_POST[$param_name]; |
271 | + } |
|
268 | 272 | } |
269 | 273 | |
270 | 274 | $search_url_params = isset($search_params) ? base64_encode($smcFunc['json_encode']($search_params)) : null; |
@@ -277,34 +281,38 @@ discard block |
||
277 | 281 | foreach ($params as $param_name => $param_info) |
278 | 282 | { |
279 | 283 | // Not filled in? |
280 | - if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') |
|
281 | - continue; |
|
284 | + if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') { |
|
285 | + continue; |
|
286 | + } |
|
282 | 287 | |
283 | 288 | // Make sure numeric values are really numeric. |
284 | - if (in_array($param_info['type'], array('int', 'age'))) |
|
285 | - $search_params[$param_name] = (int) $search_params[$param_name]; |
|
289 | + if (in_array($param_info['type'], array('int', 'age'))) { |
|
290 | + $search_params[$param_name] = (int) $search_params[$param_name]; |
|
291 | + } |
|
286 | 292 | // Date values have to match the specified format. |
287 | 293 | elseif ($param_info['type'] == 'date') |
288 | 294 | { |
289 | 295 | // Check if this date format is valid. |
290 | - if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) |
|
291 | - continue; |
|
296 | + if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) { |
|
297 | + continue; |
|
298 | + } |
|
292 | 299 | |
293 | 300 | $search_params[$param_name] = strtotime($search_params[$param_name]); |
294 | - } |
|
295 | - elseif ($param_info['type'] == 'inet') |
|
301 | + } elseif ($param_info['type'] == 'inet') |
|
296 | 302 | { |
297 | 303 | $search_params[$param_name] = ip2range($search_params[$param_name]); |
298 | - if (empty($search_params[$param_name])) |
|
299 | - continue; |
|
304 | + if (empty($search_params[$param_name])) { |
|
305 | + continue; |
|
306 | + } |
|
300 | 307 | } |
301 | 308 | |
302 | 309 | // Those values that are in some kind of range (<, <=, =, >=, >). |
303 | 310 | if (!empty($param_info['range'])) |
304 | 311 | { |
305 | 312 | // Default to '=', just in case... |
306 | - if (empty($range_trans[$search_params['types'][$param_name]])) |
|
307 | - $search_params['types'][$param_name] = '='; |
|
313 | + if (empty($range_trans[$search_params['types'][$param_name]])) { |
|
314 | + $search_params['types'][$param_name] = '='; |
|
315 | + } |
|
308 | 316 | |
309 | 317 | // Handle special case 'age'. |
310 | 318 | if ($param_info['type'] == 'age') |
@@ -332,16 +340,17 @@ discard block |
||
332 | 340 | elseif ($param_info['type'] == 'date' && $search_params['types'][$param_name] == '=') |
333 | 341 | { |
334 | 342 | $query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400); |
343 | + } else { |
|
344 | + $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
335 | 345 | } |
336 | - else |
|
337 | - $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
338 | 346 | } |
339 | 347 | // Checkboxes. |
340 | 348 | elseif ($param_info['type'] == 'checkbox') |
341 | 349 | { |
342 | 350 | // Each checkbox or no checkbox at all is checked -> ignore. |
343 | - if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) |
|
344 | - continue; |
|
351 | + if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) { |
|
352 | + continue; |
|
353 | + } |
|
345 | 354 | |
346 | 355 | $query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})'; |
347 | 356 | $where_params[$param_name . '_check'] = $search_params[$param_name]; |
@@ -353,24 +362,23 @@ discard block |
||
353 | 362 | { |
354 | 363 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' = {inet:' . $param_name . '})'; |
355 | 364 | $where_params[$param_name] = $search_params[$param_name][0]; |
356 | - } |
|
357 | - elseif (count($search_params[$param_name]) === 2) |
|
365 | + } elseif (count($search_params[$param_name]) === 2) |
|
358 | 366 | { |
359 | 367 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' <= {inet:' . $param_name . '_high} and ' . $param_info['db_fields'][0] . ' >= {inet:' . $param_name . '_low})'; |
360 | 368 | $where_params[$param_name.'_low'] = $search_params[$param_name]['low']; |
361 | 369 | $where_params[$param_name.'_high'] = $search_params[$param_name]['high']; |
362 | 370 | } |
363 | 371 | |
364 | - } |
|
365 | - elseif ($param_info['type'] != 'groups') |
|
372 | + } elseif ($param_info['type'] != 'groups') |
|
366 | 373 | { |
367 | 374 | // Replace the wildcard characters ('*' and '?') into MySQL ones. |
368 | 375 | $parameter = strtolower(strtr($smcFunc['htmlspecialchars']($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_'))); |
369 | 376 | |
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})'; |
|
377 | + if ($smcFunc['db_case_sensitive']) { |
|
378 | + $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
379 | + } else { |
|
380 | + $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
381 | + } |
|
374 | 382 | $where_params[$param_name . '_normal'] = '%' . $parameter . '%'; |
375 | 383 | } |
376 | 384 | } |
@@ -386,16 +394,18 @@ discard block |
||
386 | 394 | } |
387 | 395 | |
388 | 396 | // Additional membergroups (these are only relevant if not all primary groups where selected!). |
389 | - if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) |
|
390 | - foreach ($search_params['membergroups'][2] as $mg) |
|
397 | + if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) { |
|
398 | + foreach ($search_params['membergroups'][2] as $mg) |
|
391 | 399 | { |
392 | 400 | $mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0'; |
401 | + } |
|
393 | 402 | $where_params['add_group_' . $mg] = $mg; |
394 | 403 | } |
395 | 404 | |
396 | 405 | // Combine the one or two membergroup parts into one query part linked with an OR. |
397 | - if (!empty($mg_query_parts)) |
|
398 | - $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
406 | + if (!empty($mg_query_parts)) { |
|
407 | + $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
408 | + } |
|
399 | 409 | |
400 | 410 | // Get all selected post count related membergroups. |
401 | 411 | if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups'])) |
@@ -407,9 +417,9 @@ discard block |
||
407 | 417 | // Construct the where part of the query. |
408 | 418 | $where = empty($query_parts) ? '1=1' : implode(' |
409 | 419 | AND ', $query_parts); |
420 | + } else { |
|
421 | + $search_url_params = null; |
|
410 | 422 | } |
411 | - else |
|
412 | - $search_url_params = null; |
|
413 | 423 | |
414 | 424 | // Construct the additional URL part with the query info in it. |
415 | 425 | $context['params_url'] = $context['sub_action'] == 'query' ? ';sa=query;params=' . $search_url_params : ''; |
@@ -532,28 +542,32 @@ discard block |
||
532 | 542 | 'function' => function($rowData) use ($txt) |
533 | 543 | { |
534 | 544 | // Calculate number of days since last online. |
535 | - if (empty($rowData['last_login'])) |
|
536 | - $difference = $txt['never']; |
|
537 | - else |
|
545 | + if (empty($rowData['last_login'])) { |
|
546 | + $difference = $txt['never']; |
|
547 | + } else |
|
538 | 548 | { |
539 | 549 | $num_days_difference = jeffsdatediff($rowData['last_login']); |
540 | 550 | |
541 | 551 | // Today. |
542 | - if (empty($num_days_difference)) |
|
543 | - $difference = $txt['viewmembers_today']; |
|
552 | + if (empty($num_days_difference)) { |
|
553 | + $difference = $txt['viewmembers_today']; |
|
554 | + } |
|
544 | 555 | |
545 | 556 | // Yesterday. |
546 | - elseif ($num_days_difference == 1) |
|
547 | - $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
557 | + elseif ($num_days_difference == 1) { |
|
558 | + $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
559 | + } |
|
548 | 560 | |
549 | 561 | // X days ago. |
550 | - else |
|
551 | - $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
562 | + else { |
|
563 | + $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
564 | + } |
|
552 | 565 | } |
553 | 566 | |
554 | 567 | // Show it in italics if they're not activated... |
555 | - if ($rowData['is_activated'] % 10 != 1) |
|
556 | - $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
568 | + if ($rowData['is_activated'] % 10 != 1) { |
|
569 | + $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
570 | + } |
|
557 | 571 | |
558 | 572 | return $difference; |
559 | 573 | }, |
@@ -605,8 +619,9 @@ discard block |
||
605 | 619 | ); |
606 | 620 | |
607 | 621 | // Without enough permissions, don't show 'delete members' checkboxes. |
608 | - if (!allowedTo('profile_remove_any')) |
|
609 | - unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
622 | + if (!allowedTo('profile_remove_any')) { |
|
623 | + unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
624 | + } |
|
610 | 625 | |
611 | 626 | require_once($sourcedir . '/Subs-List.php'); |
612 | 627 | createList($listOptions); |
@@ -649,17 +664,18 @@ discard block |
||
649 | 664 | ); |
650 | 665 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
651 | 666 | { |
652 | - if ($row['min_posts'] == -1) |
|
653 | - $context['membergroups'][] = array( |
|
667 | + if ($row['min_posts'] == -1) { |
|
668 | + $context['membergroups'][] = array( |
|
654 | 669 | 'id' => $row['id_group'], |
655 | 670 | 'name' => $row['group_name'], |
656 | 671 | 'can_be_additional' => true |
657 | 672 | ); |
658 | - else |
|
659 | - $context['postgroups'][] = array( |
|
673 | + } else { |
|
674 | + $context['postgroups'][] = array( |
|
660 | 675 | 'id' => $row['id_group'], |
661 | 676 | 'name' => $row['group_name'] |
662 | 677 | ); |
678 | + } |
|
663 | 679 | } |
664 | 680 | $smcFunc['db_free_result']($request); |
665 | 681 | |
@@ -686,8 +702,9 @@ discard block |
||
686 | 702 | $context['page_title'] = $txt['admin_members']; |
687 | 703 | $context['sub_template'] = 'admin_browse'; |
688 | 704 | $context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve'); |
689 | - if (isset($context['tabs'][$context['browse_type']])) |
|
690 | - $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
705 | + if (isset($context['tabs'][$context['browse_type']])) { |
|
706 | + $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
707 | + } |
|
691 | 708 | |
692 | 709 | // Allowed filters are those we can have, in theory. |
693 | 710 | $context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2); |
@@ -698,18 +715,20 @@ discard block |
||
698 | 715 | foreach ($context['activation_numbers'] as $type => $amount) |
699 | 716 | { |
700 | 717 | // We have some of these... |
701 | - if (in_array($type, $context['allowed_filters']) && $amount > 0) |
|
702 | - $context['available_filters'][] = array( |
|
718 | + if (in_array($type, $context['allowed_filters']) && $amount > 0) { |
|
719 | + $context['available_filters'][] = array( |
|
703 | 720 | 'type' => $type, |
704 | 721 | 'amount' => $amount, |
705 | 722 | 'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?', |
706 | 723 | 'selected' => $type == $context['current_filter'] |
707 | 724 | ); |
725 | + } |
|
708 | 726 | } |
709 | 727 | |
710 | 728 | // If the filter was not sent, set it to whatever has people in it! |
711 | - if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) |
|
712 | - $context['current_filter'] = $context['available_filters'][0]['type']; |
|
729 | + if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) { |
|
730 | + $context['current_filter'] = $context['available_filters'][0]['type']; |
|
731 | + } |
|
713 | 732 | |
714 | 733 | // This little variable is used to determine if we should flag where we are looking. |
715 | 734 | $context['show_filter'] = ($context['current_filter'] != 0 && $context['current_filter'] != 3) || count($context['available_filters']) > 1; |
@@ -724,44 +743,47 @@ discard block |
||
724 | 743 | ); |
725 | 744 | |
726 | 745 | // Are we showing duplicate information? |
727 | - if (isset($_GET['showdupes'])) |
|
728 | - $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
746 | + if (isset($_GET['showdupes'])) { |
|
747 | + $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
748 | + } |
|
729 | 749 | $context['show_duplicates'] = !empty($_SESSION['showdupes']); |
730 | 750 | |
731 | 751 | // Determine which actions we should allow on this page. |
732 | 752 | if ($context['browse_type'] == 'approve') |
733 | 753 | { |
734 | 754 | // If we are approving deleted accounts we have a slightly different list... actually a mirror ;) |
735 | - if ($context['current_filter'] == 4) |
|
736 | - $context['allowed_actions'] = array( |
|
755 | + if ($context['current_filter'] == 4) { |
|
756 | + $context['allowed_actions'] = array( |
|
737 | 757 | 'reject' => $txt['admin_browse_w_approve_deletion'], |
738 | 758 | 'ok' => $txt['admin_browse_w_reject'], |
739 | 759 | ); |
740 | - else |
|
741 | - $context['allowed_actions'] = array( |
|
760 | + } else { |
|
761 | + $context['allowed_actions'] = array( |
|
742 | 762 | 'ok' => $txt['admin_browse_w_approve'], |
743 | 763 | 'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'], |
744 | 764 | 'require_activation' => $txt['admin_browse_w_approve_require_activate'], |
745 | 765 | 'reject' => $txt['admin_browse_w_reject'], |
746 | 766 | 'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'], |
747 | 767 | ); |
748 | - } |
|
749 | - elseif ($context['browse_type'] == 'activate') |
|
750 | - $context['allowed_actions'] = array( |
|
768 | + } |
|
769 | + } elseif ($context['browse_type'] == 'activate') { |
|
770 | + $context['allowed_actions'] = array( |
|
751 | 771 | 'ok' => $txt['admin_browse_w_activate'], |
752 | 772 | 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], |
753 | 773 | 'delete' => $txt['admin_browse_w_delete'], |
754 | 774 | 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], |
755 | 775 | 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'], |
756 | 776 | ); |
777 | + } |
|
757 | 778 | |
758 | 779 | // Create an option list for actions allowed to be done with selected members. |
759 | 780 | $allowed_actions = ' |
760 | 781 | <option selected value="">' . $txt['admin_browse_with_selected'] . ':</option> |
761 | 782 | <option value="" disabled>-----------------------------</option>'; |
762 | - foreach ($context['allowed_actions'] as $key => $desc) |
|
763 | - $allowed_actions .= ' |
|
783 | + foreach ($context['allowed_actions'] as $key => $desc) { |
|
784 | + $allowed_actions .= ' |
|
764 | 785 | <option value="' . $key . '">' . $desc . '</option>'; |
786 | + } |
|
765 | 787 | |
766 | 788 | // Setup the Javascript function for selecting an action for the list. |
767 | 789 | $javascript = ' |
@@ -773,15 +795,16 @@ discard block |
||
773 | 795 | var message = "";'; |
774 | 796 | |
775 | 797 | // We have special messages for approving deletion of accounts - it's surprisingly logical - honest. |
776 | - if ($context['current_filter'] == 4) |
|
777 | - $javascript .= ' |
|
798 | + if ($context['current_filter'] == 4) { |
|
799 | + $javascript .= ' |
|
778 | 800 | if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
779 | 801 | message = "' . $txt['admin_browse_w_delete'] . '"; |
780 | 802 | else |
781 | 803 | message = "' . $txt['admin_browse_w_reject'] . '";'; |
804 | + } |
|
782 | 805 | // Otherwise a nice standard message. |
783 | - else |
|
784 | - $javascript .= ' |
|
806 | + else { |
|
807 | + $javascript .= ' |
|
785 | 808 | if (document.forms.postForm.todo.value.indexOf("delete") != -1) |
786 | 809 | message = "' . $txt['admin_browse_w_delete'] . '"; |
787 | 810 | else if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
@@ -790,6 +813,7 @@ discard block |
||
790 | 813 | message = "' . $txt['admin_browse_w_remind'] . '"; |
791 | 814 | else |
792 | 815 | message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";'; |
816 | + } |
|
793 | 817 | $javascript .= ' |
794 | 818 | if (confirm(message + " ' . $txt['admin_browse_warn'] . '")) |
795 | 819 | document.forms.postForm.submit(); |
@@ -922,10 +946,11 @@ discard block |
||
922 | 946 | $member_links = array(); |
923 | 947 | foreach ($rowData['duplicate_members'] as $member) |
924 | 948 | { |
925 | - if ($member['id']) |
|
926 | - $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
927 | - else |
|
928 | - $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
949 | + if ($member['id']) { |
|
950 | + $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
951 | + } else { |
|
952 | + $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
953 | + } |
|
929 | 954 | } |
930 | 955 | return implode(', ', $member_links); |
931 | 956 | }, |
@@ -974,14 +999,16 @@ discard block |
||
974 | 999 | ); |
975 | 1000 | |
976 | 1001 | // Pick what column to actually include if we're showing duplicates. |
977 | - if ($context['show_duplicates']) |
|
978 | - unset($listOptions['columns']['email']); |
|
979 | - else |
|
980 | - unset($listOptions['columns']['duplicates']); |
|
1002 | + if ($context['show_duplicates']) { |
|
1003 | + unset($listOptions['columns']['email']); |
|
1004 | + } else { |
|
1005 | + unset($listOptions['columns']['duplicates']); |
|
1006 | + } |
|
981 | 1007 | |
982 | 1008 | // Only show hostname on duplicates as it takes a lot of time. |
983 | - if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) |
|
984 | - unset($listOptions['columns']['hostname']); |
|
1009 | + if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) { |
|
1010 | + unset($listOptions['columns']['hostname']); |
|
1011 | + } |
|
985 | 1012 | |
986 | 1013 | // Is there any need to show filters? |
987 | 1014 | if (isset($context['available_filters']) && count($context['available_filters']) > 1) |
@@ -989,9 +1016,10 @@ discard block |
||
989 | 1016 | $filterOptions = ' |
990 | 1017 | <strong>' . $txt['admin_browse_filter_by'] . ':</strong> |
991 | 1018 | <select name="filter" onchange="this.form.submit();">'; |
992 | - foreach ($context['available_filters'] as $filter) |
|
993 | - $filterOptions .= ' |
|
1019 | + foreach ($context['available_filters'] as $filter) { |
|
1020 | + $filterOptions .= ' |
|
994 | 1021 | <option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>'; |
1022 | + } |
|
995 | 1023 | $filterOptions .= ' |
996 | 1024 | </select> |
997 | 1025 | <noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button"></noscript>'; |
@@ -1003,12 +1031,13 @@ discard block |
||
1003 | 1031 | } |
1004 | 1032 | |
1005 | 1033 | // What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at. |
1006 | - if (!empty($context['show_filter']) && !empty($context['available_filters'])) |
|
1007 | - $listOptions['additional_rows'][] = array( |
|
1034 | + if (!empty($context['show_filter']) && !empty($context['available_filters'])) { |
|
1035 | + $listOptions['additional_rows'][] = array( |
|
1008 | 1036 | 'position' => 'above_column_headers', |
1009 | 1037 | 'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'], |
1010 | 1038 | 'class' => 'smalltext floatright', |
1011 | 1039 | ); |
1040 | + } |
|
1012 | 1041 | |
1013 | 1042 | // Now that we have all the options, create the list. |
1014 | 1043 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1038,12 +1067,14 @@ discard block |
||
1038 | 1067 | $current_filter = (int) $_REQUEST['orig_filter']; |
1039 | 1068 | |
1040 | 1069 | // If we are applying a filter do just that - then redirect. |
1041 | - if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) |
|
1042 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
1070 | + if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) { |
|
1071 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
1072 | + } |
|
1043 | 1073 | |
1044 | 1074 | // Nothing to do? |
1045 | - if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) |
|
1046 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1075 | + if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) { |
|
1076 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1077 | + } |
|
1047 | 1078 | |
1048 | 1079 | // Are we dealing with members who have been waiting for > set amount of time? |
1049 | 1080 | if (isset($_POST['time_passed'])) |
@@ -1056,8 +1087,9 @@ discard block |
||
1056 | 1087 | else |
1057 | 1088 | { |
1058 | 1089 | $members = array(); |
1059 | - foreach ($_POST['todoAction'] as $id) |
|
1060 | - $members[] = (int) $id; |
|
1090 | + foreach ($_POST['todoAction'] as $id) { |
|
1091 | + $members[] = (int) $id; |
|
1092 | + } |
|
1061 | 1093 | $condition = ' |
1062 | 1094 | AND id_member IN ({array_int:members})'; |
1063 | 1095 | } |
@@ -1078,8 +1110,9 @@ discard block |
||
1078 | 1110 | $member_count = $smcFunc['db_num_rows']($request); |
1079 | 1111 | |
1080 | 1112 | // If no results then just return! |
1081 | - if ($member_count == 0) |
|
1082 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1113 | + if ($member_count == 0) { |
|
1114 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1115 | + } |
|
1083 | 1116 | |
1084 | 1117 | $member_info = array(); |
1085 | 1118 | $members = array(); |
@@ -1118,8 +1151,9 @@ discard block |
||
1118 | 1151 | // Do we have to let the integration code know about the activations? |
1119 | 1152 | if (!empty($modSettings['integrate_activate'])) |
1120 | 1153 | { |
1121 | - foreach ($member_info as $member) |
|
1122 | - call_integration_hook('integrate_activate', array($member['username'])); |
|
1154 | + foreach ($member_info as $member) { |
|
1155 | + call_integration_hook('integrate_activate', array($member['username'])); |
|
1156 | + } |
|
1123 | 1157 | } |
1124 | 1158 | |
1125 | 1159 | // Check for email. |
@@ -1249,20 +1283,23 @@ discard block |
||
1249 | 1283 | $log_action = $_POST['todo'] == 'remind' ? 'remind_member' : 'approve_member'; |
1250 | 1284 | |
1251 | 1285 | require_once($sourcedir . '/Logging.php'); |
1252 | - foreach ($member_info as $member) |
|
1253 | - logAction($log_action, array('member' => $member['id']), 'admin'); |
|
1286 | + foreach ($member_info as $member) { |
|
1287 | + logAction($log_action, array('member' => $member['id']), 'admin'); |
|
1288 | + } |
|
1254 | 1289 | } |
1255 | 1290 | |
1256 | 1291 | // Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers). |
1257 | - if (in_array($current_filter, array(3, 4, 5))) |
|
1258 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
1292 | + if (in_array($current_filter, array(3, 4, 5))) { |
|
1293 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
1294 | + } |
|
1259 | 1295 | |
1260 | 1296 | // Update the member's stats. (but, we know the member didn't change their name.) |
1261 | 1297 | updateStats('member', false); |
1262 | 1298 | |
1263 | 1299 | // If they haven't been deleted, update the post group statistics on them... |
1264 | - if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) |
|
1265 | - updateStats('postgroups', $members); |
|
1300 | + if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) { |
|
1301 | + updateStats('postgroups', $members); |
|
1302 | + } |
|
1266 | 1303 | |
1267 | 1304 | redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
1268 | 1305 | } |
@@ -1287,10 +1324,11 @@ discard block |
||
1287 | 1324 | $dis = time() - $old; |
1288 | 1325 | |
1289 | 1326 | // Before midnight? |
1290 | - if ($dis < $sinceMidnight) |
|
1291 | - return 0; |
|
1292 | - else |
|
1293 | - $dis -= $sinceMidnight; |
|
1327 | + if ($dis < $sinceMidnight) { |
|
1328 | + return 0; |
|
1329 | + } else { |
|
1330 | + $dis -= $sinceMidnight; |
|
1331 | + } |
|
1294 | 1332 | |
1295 | 1333 | // Divide out the seconds in a day to get the number of days. |
1296 | 1334 | return ceil($dis / (24 * 60 * 60)); |
@@ -1317,16 +1355,18 @@ discard block |
||
1317 | 1355 | $context['activation_numbers'] = array(); |
1318 | 1356 | $context['awaiting_activation'] = 0; |
1319 | 1357 | $context['awaiting_approval'] = 0; |
1320 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1321 | - $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
1358 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1359 | + $context['activation_numbers'][$row['is_activated']] = $row['total_members']; |
|
1360 | + } |
|
1322 | 1361 | $smcFunc['db_free_result']($request); |
1323 | 1362 | |
1324 | 1363 | foreach ($context['activation_numbers'] as $activation_type => $total_members) |
1325 | 1364 | { |
1326 | - if (in_array($activation_type, array(0, 2))) |
|
1327 | - $context['awaiting_activation'] += $total_members; |
|
1328 | - elseif (in_array($activation_type, array(3, 4, 5))) |
|
1329 | - $context['awaiting_approval'] += $total_members; |
|
1365 | + if (in_array($activation_type, array(0, 2))) { |
|
1366 | + $context['awaiting_activation'] += $total_members; |
|
1367 | + } elseif (in_array($activation_type, array(3, 4, 5))) { |
|
1368 | + $context['awaiting_approval'] += $total_members; |
|
1369 | + } |
|
1330 | 1370 | } |
1331 | 1371 | |
1332 | 1372 | } |