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