@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | // INET. |
361 | 361 | elseif ($param_info['type'] == 'inet') |
362 | 362 | { |
363 | - if(count($search_params[$param_name]) === 1) |
|
363 | + if (count($search_params[$param_name]) === 1) |
|
364 | 364 | { |
365 | 365 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' = {inet:' . $param_name . '})'; |
366 | 366 | $where_params[$param_name] = $search_params[$param_name][0]; |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | elseif (count($search_params[$param_name]) === 2) |
369 | 369 | { |
370 | 370 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' <= {inet:' . $param_name . '_high} and ' . $param_info['db_fields'][0] . ' >= {inet:' . $param_name . '_low})'; |
371 | - $where_params[$param_name.'_low'] = $search_params[$param_name]['low']; |
|
372 | - $where_params[$param_name.'_high'] = $search_params[$param_name]['high']; |
|
371 | + $where_params[$param_name . '_low'] = $search_params[$param_name]['low']; |
|
372 | + $where_params[$param_name . '_high'] = $search_params[$param_name]['high']; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
@@ -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. |
@@ -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 | |
@@ -276,14 +282,15 @@ discard block |
||
276 | 282 | call_integration_hook('integrate_view_members_params', array(&$params)); |
277 | 283 | |
278 | 284 | $search_params = array(); |
279 | - if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) |
|
280 | - $search_params = $smcFunc['json_decode'](base64_decode($_REQUEST['params']), true); |
|
281 | - elseif (!empty($_POST)) |
|
285 | + if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types'])) { |
|
286 | + $search_params = $smcFunc['json_decode'](base64_decode($_REQUEST['params']), true); |
|
287 | + } elseif (!empty($_POST)) |
|
282 | 288 | { |
283 | 289 | $search_params['types'] = $_POST['types']; |
284 | - foreach ($params as $param_name => $param_info) |
|
285 | - if (isset($_POST[$param_name])) |
|
290 | + foreach ($params as $param_name => $param_info) { |
|
291 | + if (isset($_POST[$param_name])) |
|
286 | 292 | $search_params[$param_name] = $_POST[$param_name]; |
293 | + } |
|
287 | 294 | } |
288 | 295 | |
289 | 296 | $search_url_params = isset($search_params) ? base64_encode($smcFunc['json_encode']($search_params)) : null; |
@@ -296,34 +303,38 @@ discard block |
||
296 | 303 | foreach ($params as $param_name => $param_info) |
297 | 304 | { |
298 | 305 | // Not filled in? |
299 | - if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') |
|
300 | - continue; |
|
306 | + if (!isset($search_params[$param_name]) || $search_params[$param_name] === '') { |
|
307 | + continue; |
|
308 | + } |
|
301 | 309 | |
302 | 310 | // Make sure numeric values are really numeric. |
303 | - if (in_array($param_info['type'], array('int', 'age'))) |
|
304 | - $search_params[$param_name] = (int) $search_params[$param_name]; |
|
311 | + if (in_array($param_info['type'], array('int', 'age'))) { |
|
312 | + $search_params[$param_name] = (int) $search_params[$param_name]; |
|
313 | + } |
|
305 | 314 | // Date values have to match the specified format. |
306 | 315 | elseif ($param_info['type'] == 'date') |
307 | 316 | { |
308 | 317 | // Check if this date format is valid. |
309 | - if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) |
|
310 | - continue; |
|
318 | + if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0) { |
|
319 | + continue; |
|
320 | + } |
|
311 | 321 | |
312 | 322 | $search_params[$param_name] = strtotime($search_params[$param_name]); |
313 | - } |
|
314 | - elseif ($param_info['type'] == 'inet') |
|
323 | + } elseif ($param_info['type'] == 'inet') |
|
315 | 324 | { |
316 | 325 | $search_params[$param_name] = ip2range($search_params[$param_name]); |
317 | - if (empty($search_params[$param_name])) |
|
318 | - continue; |
|
326 | + if (empty($search_params[$param_name])) { |
|
327 | + continue; |
|
328 | + } |
|
319 | 329 | } |
320 | 330 | |
321 | 331 | // Those values that are in some kind of range (<, <=, =, >=, >). |
322 | 332 | if (!empty($param_info['range'])) |
323 | 333 | { |
324 | 334 | // Default to '=', just in case... |
325 | - if (empty($range_trans[$search_params['types'][$param_name]])) |
|
326 | - $search_params['types'][$param_name] = '='; |
|
335 | + if (empty($range_trans[$search_params['types'][$param_name]])) { |
|
336 | + $search_params['types'][$param_name] = '='; |
|
337 | + } |
|
327 | 338 | |
328 | 339 | // Handle special case 'age'. |
329 | 340 | if ($param_info['type'] == 'age') |
@@ -351,16 +362,17 @@ discard block |
||
351 | 362 | elseif ($param_info['type'] == 'date' && $search_params['types'][$param_name] == '=') |
352 | 363 | { |
353 | 364 | $query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400); |
365 | + } else { |
|
366 | + $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
354 | 367 | } |
355 | - else |
|
356 | - $query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name]; |
|
357 | 368 | } |
358 | 369 | // Checkboxes. |
359 | 370 | elseif ($param_info['type'] == 'checkbox') |
360 | 371 | { |
361 | 372 | // Each checkbox or no checkbox at all is checked -> ignore. |
362 | - if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) |
|
363 | - continue; |
|
373 | + if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values'])) { |
|
374 | + continue; |
|
375 | + } |
|
364 | 376 | |
365 | 377 | $query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})'; |
366 | 378 | $where_params[$param_name . '_check'] = $search_params[$param_name]; |
@@ -372,24 +384,23 @@ discard block |
||
372 | 384 | { |
373 | 385 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' = {inet:' . $param_name . '})'; |
374 | 386 | $where_params[$param_name] = $search_params[$param_name][0]; |
375 | - } |
|
376 | - elseif (count($search_params[$param_name]) === 2) |
|
387 | + } elseif (count($search_params[$param_name]) === 2) |
|
377 | 388 | { |
378 | 389 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' <= {inet:' . $param_name . '_high} and ' . $param_info['db_fields'][0] . ' >= {inet:' . $param_name . '_low})'; |
379 | 390 | $where_params[$param_name.'_low'] = $search_params[$param_name]['low']; |
380 | 391 | $where_params[$param_name.'_high'] = $search_params[$param_name]['high']; |
381 | 392 | } |
382 | 393 | |
383 | - } |
|
384 | - elseif ($param_info['type'] != 'groups') |
|
394 | + } elseif ($param_info['type'] != 'groups') |
|
385 | 395 | { |
386 | 396 | // Replace the wildcard characters ('*' and '?') into MySQL ones. |
387 | 397 | $parameter = strtolower(strtr($smcFunc['htmlspecialchars']($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_'))); |
388 | 398 | |
389 | - if ($smcFunc['db_case_sensitive']) |
|
390 | - $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
391 | - else |
|
392 | - $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
399 | + if ($smcFunc['db_case_sensitive']) { |
|
400 | + $query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})'; |
|
401 | + } else { |
|
402 | + $query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})'; |
|
403 | + } |
|
393 | 404 | $where_params[$param_name . '_normal'] = '%' . $parameter . '%'; |
394 | 405 | } |
395 | 406 | } |
@@ -405,16 +416,18 @@ discard block |
||
405 | 416 | } |
406 | 417 | |
407 | 418 | // Additional membergroups (these are only relevant if not all primary groups where selected!). |
408 | - if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) |
|
409 | - foreach ($search_params['membergroups'][2] as $mg) |
|
419 | + if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1]))) { |
|
420 | + foreach ($search_params['membergroups'][2] as $mg) |
|
410 | 421 | { |
411 | 422 | $mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0'; |
423 | + } |
|
412 | 424 | $where_params['add_group_' . $mg] = $mg; |
413 | 425 | } |
414 | 426 | |
415 | 427 | // Combine the one or two membergroup parts into one query part linked with an OR. |
416 | - if (!empty($mg_query_parts)) |
|
417 | - $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
428 | + if (!empty($mg_query_parts)) { |
|
429 | + $query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')'; |
|
430 | + } |
|
418 | 431 | |
419 | 432 | // Get all selected post count related membergroups. |
420 | 433 | if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups'])) |
@@ -426,9 +439,9 @@ discard block |
||
426 | 439 | // Construct the where part of the query. |
427 | 440 | $where = empty($query_parts) ? '1=1' : implode(' |
428 | 441 | AND ', $query_parts); |
442 | + } else { |
|
443 | + $search_url_params = null; |
|
429 | 444 | } |
430 | - else |
|
431 | - $search_url_params = null; |
|
432 | 445 | |
433 | 446 | // Construct the additional URL part with the query info in it. |
434 | 447 | $context['params_url'] = $context['sub_action'] == 'query' ? ';sa=query;params=' . $search_url_params : ''; |
@@ -551,28 +564,32 @@ discard block |
||
551 | 564 | 'function' => function($rowData) use ($txt) |
552 | 565 | { |
553 | 566 | // Calculate number of days since last online. |
554 | - if (empty($rowData['last_login'])) |
|
555 | - $difference = $txt['never']; |
|
556 | - else |
|
567 | + if (empty($rowData['last_login'])) { |
|
568 | + $difference = $txt['never']; |
|
569 | + } else |
|
557 | 570 | { |
558 | 571 | $num_days_difference = jeffsdatediff($rowData['last_login']); |
559 | 572 | |
560 | 573 | // Today. |
561 | - if (empty($num_days_difference)) |
|
562 | - $difference = $txt['viewmembers_today']; |
|
574 | + if (empty($num_days_difference)) { |
|
575 | + $difference = $txt['viewmembers_today']; |
|
576 | + } |
|
563 | 577 | |
564 | 578 | // Yesterday. |
565 | - elseif ($num_days_difference == 1) |
|
566 | - $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
579 | + elseif ($num_days_difference == 1) { |
|
580 | + $difference = sprintf('1 %1$s', $txt['viewmembers_day_ago']); |
|
581 | + } |
|
567 | 582 | |
568 | 583 | // X days ago. |
569 | - else |
|
570 | - $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
584 | + else { |
|
585 | + $difference = sprintf('%1$d %2$s', $num_days_difference, $txt['viewmembers_days_ago']); |
|
586 | + } |
|
571 | 587 | } |
572 | 588 | |
573 | 589 | // Show it in italics if they're not activated... |
574 | - if ($rowData['is_activated'] % 10 != 1) |
|
575 | - $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
590 | + if ($rowData['is_activated'] % 10 != 1) { |
|
591 | + $difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference); |
|
592 | + } |
|
576 | 593 | |
577 | 594 | return $difference; |
578 | 595 | }, |
@@ -624,8 +641,9 @@ discard block |
||
624 | 641 | ); |
625 | 642 | |
626 | 643 | // Without enough permissions, don't show 'delete members' checkboxes. |
627 | - if (!allowedTo('profile_remove_any')) |
|
628 | - unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
644 | + if (!allowedTo('profile_remove_any')) { |
|
645 | + unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']); |
|
646 | + } |
|
629 | 647 | |
630 | 648 | require_once($sourcedir . '/Subs-List.php'); |
631 | 649 | createList($listOptions); |
@@ -668,17 +686,18 @@ discard block |
||
668 | 686 | ); |
669 | 687 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
670 | 688 | { |
671 | - if ($row['min_posts'] == -1) |
|
672 | - $context['membergroups'][] = array( |
|
689 | + if ($row['min_posts'] == -1) { |
|
690 | + $context['membergroups'][] = array( |
|
673 | 691 | 'id' => $row['id_group'], |
674 | 692 | 'name' => $row['group_name'], |
675 | 693 | 'can_be_additional' => true |
676 | 694 | ); |
677 | - else |
|
678 | - $context['postgroups'][] = array( |
|
695 | + } else { |
|
696 | + $context['postgroups'][] = array( |
|
679 | 697 | 'id' => $row['id_group'], |
680 | 698 | 'name' => $row['group_name'] |
681 | 699 | ); |
700 | + } |
|
682 | 701 | } |
683 | 702 | $smcFunc['db_free_result']($request); |
684 | 703 | |
@@ -705,8 +724,9 @@ discard block |
||
705 | 724 | $context['page_title'] = $txt['admin_members']; |
706 | 725 | $context['sub_template'] = 'admin_browse'; |
707 | 726 | $context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve'); |
708 | - if (isset($context['tabs'][$context['browse_type']])) |
|
709 | - $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
727 | + if (isset($context['tabs'][$context['browse_type']])) { |
|
728 | + $context['tabs'][$context['browse_type']]['is_selected'] = true; |
|
729 | + } |
|
710 | 730 | |
711 | 731 | // Allowed filters are those we can have, in theory. |
712 | 732 | $context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2); |
@@ -717,18 +737,20 @@ discard block |
||
717 | 737 | foreach ($context['activation_numbers'] as $type => $amount) |
718 | 738 | { |
719 | 739 | // We have some of these... |
720 | - if (in_array($type, $context['allowed_filters']) && $amount > 0) |
|
721 | - $context['available_filters'][] = array( |
|
740 | + if (in_array($type, $context['allowed_filters']) && $amount > 0) { |
|
741 | + $context['available_filters'][] = array( |
|
722 | 742 | 'type' => $type, |
723 | 743 | 'amount' => $amount, |
724 | 744 | 'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?', |
725 | 745 | 'selected' => $type == $context['current_filter'] |
726 | 746 | ); |
747 | + } |
|
727 | 748 | } |
728 | 749 | |
729 | 750 | // If the filter was not sent, set it to whatever has people in it! |
730 | - if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) |
|
731 | - $context['current_filter'] = $context['available_filters'][0]['type']; |
|
751 | + if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) { |
|
752 | + $context['current_filter'] = $context['available_filters'][0]['type']; |
|
753 | + } |
|
732 | 754 | |
733 | 755 | // This little variable is used to determine if we should flag where we are looking. |
734 | 756 | $context['show_filter'] = ($context['current_filter'] != 0 && $context['current_filter'] != 3) || count($context['available_filters']) > 1; |
@@ -743,44 +765,47 @@ discard block |
||
743 | 765 | ); |
744 | 766 | |
745 | 767 | // Are we showing duplicate information? |
746 | - if (isset($_GET['showdupes'])) |
|
747 | - $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
768 | + if (isset($_GET['showdupes'])) { |
|
769 | + $_SESSION['showdupes'] = (int) $_GET['showdupes']; |
|
770 | + } |
|
748 | 771 | $context['show_duplicates'] = !empty($_SESSION['showdupes']); |
749 | 772 | |
750 | 773 | // Determine which actions we should allow on this page. |
751 | 774 | if ($context['browse_type'] == 'approve') |
752 | 775 | { |
753 | 776 | // If we are approving deleted accounts we have a slightly different list... actually a mirror ;) |
754 | - if ($context['current_filter'] == 4) |
|
755 | - $context['allowed_actions'] = array( |
|
777 | + if ($context['current_filter'] == 4) { |
|
778 | + $context['allowed_actions'] = array( |
|
756 | 779 | 'reject' => $txt['admin_browse_w_approve_deletion'], |
757 | 780 | 'ok' => $txt['admin_browse_w_reject'], |
758 | 781 | ); |
759 | - else |
|
760 | - $context['allowed_actions'] = array( |
|
782 | + } else { |
|
783 | + $context['allowed_actions'] = array( |
|
761 | 784 | 'ok' => $txt['admin_browse_w_approve'], |
762 | 785 | 'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'], |
763 | 786 | 'require_activation' => $txt['admin_browse_w_approve_require_activate'], |
764 | 787 | 'reject' => $txt['admin_browse_w_reject'], |
765 | 788 | 'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'], |
766 | 789 | ); |
767 | - } |
|
768 | - elseif ($context['browse_type'] == 'activate') |
|
769 | - $context['allowed_actions'] = array( |
|
790 | + } |
|
791 | + } elseif ($context['browse_type'] == 'activate') { |
|
792 | + $context['allowed_actions'] = array( |
|
770 | 793 | 'ok' => $txt['admin_browse_w_activate'], |
771 | 794 | 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], |
772 | 795 | 'delete' => $txt['admin_browse_w_delete'], |
773 | 796 | 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], |
774 | 797 | 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'], |
775 | 798 | ); |
799 | + } |
|
776 | 800 | |
777 | 801 | // Create an option list for actions allowed to be done with selected members. |
778 | 802 | $allowed_actions = ' |
779 | 803 | <option selected value="">' . $txt['admin_browse_with_selected'] . ':</option> |
780 | 804 | <option value="" disabled>-----------------------------</option>'; |
781 | - foreach ($context['allowed_actions'] as $key => $desc) |
|
782 | - $allowed_actions .= ' |
|
805 | + foreach ($context['allowed_actions'] as $key => $desc) { |
|
806 | + $allowed_actions .= ' |
|
783 | 807 | <option value="' . $key . '">' . $desc . '</option>'; |
808 | + } |
|
784 | 809 | |
785 | 810 | // Setup the Javascript function for selecting an action for the list. |
786 | 811 | $javascript = ' |
@@ -792,15 +817,16 @@ discard block |
||
792 | 817 | var message = "";'; |
793 | 818 | |
794 | 819 | // We have special messages for approving deletion of accounts - it's surprisingly logical - honest. |
795 | - if ($context['current_filter'] == 4) |
|
796 | - $javascript .= ' |
|
820 | + if ($context['current_filter'] == 4) { |
|
821 | + $javascript .= ' |
|
797 | 822 | if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
798 | 823 | message = "' . $txt['admin_browse_w_delete'] . '"; |
799 | 824 | else |
800 | 825 | message = "' . $txt['admin_browse_w_reject'] . '";'; |
826 | + } |
|
801 | 827 | // Otherwise a nice standard message. |
802 | - else |
|
803 | - $javascript .= ' |
|
828 | + else { |
|
829 | + $javascript .= ' |
|
804 | 830 | if (document.forms.postForm.todo.value.indexOf("delete") != -1) |
805 | 831 | message = "' . $txt['admin_browse_w_delete'] . '"; |
806 | 832 | else if (document.forms.postForm.todo.value.indexOf("reject") != -1) |
@@ -809,6 +835,7 @@ discard block |
||
809 | 835 | message = "' . $txt['admin_browse_w_remind'] . '"; |
810 | 836 | else |
811 | 837 | message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";'; |
838 | + } |
|
812 | 839 | $javascript .= ' |
813 | 840 | if (confirm(message + " ' . $txt['admin_browse_warn'] . '")) |
814 | 841 | document.forms.postForm.submit(); |
@@ -941,10 +968,11 @@ discard block |
||
941 | 968 | $member_links = array(); |
942 | 969 | foreach ($rowData['duplicate_members'] as $member) |
943 | 970 | { |
944 | - if ($member['id']) |
|
945 | - $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
946 | - else |
|
947 | - $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
971 | + if ($member['id']) { |
|
972 | + $member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="red"' : '') . '>' . $member['name'] . '</a>'; |
|
973 | + } else { |
|
974 | + $member_links[] = $member['name'] . ' (' . $txt['guest'] . ')'; |
|
975 | + } |
|
948 | 976 | } |
949 | 977 | return implode(', ', $member_links); |
950 | 978 | }, |
@@ -993,14 +1021,16 @@ discard block |
||
993 | 1021 | ); |
994 | 1022 | |
995 | 1023 | // Pick what column to actually include if we're showing duplicates. |
996 | - if ($context['show_duplicates']) |
|
997 | - unset($listOptions['columns']['email']); |
|
998 | - else |
|
999 | - unset($listOptions['columns']['duplicates']); |
|
1024 | + if ($context['show_duplicates']) { |
|
1025 | + unset($listOptions['columns']['email']); |
|
1026 | + } else { |
|
1027 | + unset($listOptions['columns']['duplicates']); |
|
1028 | + } |
|
1000 | 1029 | |
1001 | 1030 | // Only show hostname on duplicates as it takes a lot of time. |
1002 | - if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) |
|
1003 | - unset($listOptions['columns']['hostname']); |
|
1031 | + if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) { |
|
1032 | + unset($listOptions['columns']['hostname']); |
|
1033 | + } |
|
1004 | 1034 | |
1005 | 1035 | // Is there any need to show filters? |
1006 | 1036 | if (isset($context['available_filters']) && count($context['available_filters']) > 1) |
@@ -1008,9 +1038,10 @@ discard block |
||
1008 | 1038 | $filterOptions = ' |
1009 | 1039 | <strong>' . $txt['admin_browse_filter_by'] . ':</strong> |
1010 | 1040 | <select name="filter" onchange="this.form.submit();">'; |
1011 | - foreach ($context['available_filters'] as $filter) |
|
1012 | - $filterOptions .= ' |
|
1041 | + foreach ($context['available_filters'] as $filter) { |
|
1042 | + $filterOptions .= ' |
|
1013 | 1043 | <option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>'; |
1044 | + } |
|
1014 | 1045 | $filterOptions .= ' |
1015 | 1046 | </select> |
1016 | 1047 | <noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button"></noscript>'; |
@@ -1022,12 +1053,13 @@ discard block |
||
1022 | 1053 | } |
1023 | 1054 | |
1024 | 1055 | // What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at. |
1025 | - if (!empty($context['show_filter']) && !empty($context['available_filters'])) |
|
1026 | - $listOptions['additional_rows'][] = array( |
|
1056 | + if (!empty($context['show_filter']) && !empty($context['available_filters'])) { |
|
1057 | + $listOptions['additional_rows'][] = array( |
|
1027 | 1058 | 'position' => 'above_column_headers', |
1028 | 1059 | 'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'], |
1029 | 1060 | 'class' => 'smalltext floatright', |
1030 | 1061 | ); |
1062 | + } |
|
1031 | 1063 | |
1032 | 1064 | // Now that we have all the options, create the list. |
1033 | 1065 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1057,12 +1089,14 @@ discard block |
||
1057 | 1089 | $current_filter = (int) $_REQUEST['orig_filter']; |
1058 | 1090 | |
1059 | 1091 | // If we are applying a filter do just that - then redirect. |
1060 | - if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) |
|
1061 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
1092 | + if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != $_REQUEST['orig_filter']) { |
|
1093 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $_REQUEST['filter'] . ';start=' . $_REQUEST['start']); |
|
1094 | + } |
|
1062 | 1095 | |
1063 | 1096 | // Nothing to do? |
1064 | - if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) |
|
1065 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1097 | + if (!isset($_POST['todoAction']) && !isset($_POST['time_passed'])) { |
|
1098 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1099 | + } |
|
1066 | 1100 | |
1067 | 1101 | // Are we dealing with members who have been waiting for > set amount of time? |
1068 | 1102 | if (isset($_POST['time_passed'])) |
@@ -1075,8 +1109,9 @@ discard block |
||
1075 | 1109 | else |
1076 | 1110 | { |
1077 | 1111 | $members = array(); |
1078 | - foreach ($_POST['todoAction'] as $id) |
|
1079 | - $members[] = (int) $id; |
|
1112 | + foreach ($_POST['todoAction'] as $id) { |
|
1113 | + $members[] = (int) $id; |
|
1114 | + } |
|
1080 | 1115 | $condition = ' |
1081 | 1116 | AND id_member IN ({array_int:members})'; |
1082 | 1117 | } |
@@ -1097,8 +1132,9 @@ discard block |
||
1097 | 1132 | $member_count = $smcFunc['db_num_rows']($request); |
1098 | 1133 | |
1099 | 1134 | // If no results then just return! |
1100 | - if ($member_count == 0) |
|
1101 | - redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1135 | + if ($member_count == 0) { |
|
1136 | + redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
|
1137 | + } |
|
1102 | 1138 | |
1103 | 1139 | $member_info = array(); |
1104 | 1140 | $members = array(); |
@@ -1137,8 +1173,9 @@ discard block |
||
1137 | 1173 | // Do we have to let the integration code know about the activations? |
1138 | 1174 | if (!empty($modSettings['integrate_activate'])) |
1139 | 1175 | { |
1140 | - foreach ($member_info as $member) |
|
1141 | - call_integration_hook('integrate_activate', array($member['username'])); |
|
1176 | + foreach ($member_info as $member) { |
|
1177 | + call_integration_hook('integrate_activate', array($member['username'])); |
|
1178 | + } |
|
1142 | 1179 | } |
1143 | 1180 | |
1144 | 1181 | // Check for email. |
@@ -1268,20 +1305,23 @@ discard block |
||
1268 | 1305 | $log_action = $_POST['todo'] == 'remind' ? 'remind_member' : 'approve_member'; |
1269 | 1306 | |
1270 | 1307 | require_once($sourcedir . '/Logging.php'); |
1271 | - foreach ($member_info as $member) |
|
1272 | - logAction($log_action, array('member' => $member['id']), 'admin'); |
|
1308 | + foreach ($member_info as $member) { |
|
1309 | + logAction($log_action, array('member' => $member['id']), 'admin'); |
|
1310 | + } |
|
1273 | 1311 | } |
1274 | 1312 | |
1275 | 1313 | // Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers). |
1276 | - if (in_array($current_filter, array(3, 4, 5))) |
|
1277 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
1314 | + if (in_array($current_filter, array(3, 4, 5))) { |
|
1315 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $member_count ? $modSettings['unapprovedMembers'] - $member_count : 0))); |
|
1316 | + } |
|
1278 | 1317 | |
1279 | 1318 | // Update the member's stats. (but, we know the member didn't change their name.) |
1280 | 1319 | updateStats('member', false); |
1281 | 1320 | |
1282 | 1321 | // If they haven't been deleted, update the post group statistics on them... |
1283 | - if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) |
|
1284 | - updateStats('postgroups', $members); |
|
1322 | + if (!in_array($_POST['todo'], array('delete', 'deleteemail', 'reject', 'rejectemail', 'remind'))) { |
|
1323 | + updateStats('postgroups', $members); |
|
1324 | + } |
|
1285 | 1325 | |
1286 | 1326 | redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $_REQUEST['type'] . ';sort=' . $_REQUEST['sort'] . ';filter=' . $current_filter . ';start=' . $_REQUEST['start']); |
1287 | 1327 | } |
@@ -1306,10 +1346,11 @@ discard block |
||
1306 | 1346 | $dis = time() - $old; |
1307 | 1347 | |
1308 | 1348 | // Before midnight? |
1309 | - if ($dis < $sinceMidnight) |
|
1310 | - return 0; |
|
1311 | - else |
|
1312 | - $dis -= $sinceMidnight; |
|
1349 | + if ($dis < $sinceMidnight) { |
|
1350 | + return 0; |
|
1351 | + } else { |
|
1352 | + $dis -= $sinceMidnight; |
|
1353 | + } |
|
1313 | 1354 | |
1314 | 1355 | // Divide out the seconds in a day to get the number of days. |
1315 | 1356 | return ceil($dis / (24 * 60 * 60)); |