diff -r d5474f54a525 -r 71cb87b7dc3f plugins/admin/UserManager.php --- a/plugins/admin/UserManager.php Thu Dec 17 04:29:55 2009 -0500 +++ b/plugins/admin/UserManager.php Thu Dec 17 04:31:55 2009 -0500 @@ -590,10 +590,12 @@ '; } echo ''; + echo ''; } $db->free_result(); } + acp_usermanager_lockouts(); } /** @@ -1221,4 +1223,81 @@ } -?> +function acp_usermanager_lockouts($homewrap = false) +{ + global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; + + // Locked out users + + if ( !empty($_GET['clear_lockout']) && is_valid_ip($_GET['clear_lockout']) ) + { + $ip = $db->escape($_GET['clear_lockout']); + $q = $db->sql_query('DELETE FROM ' . table_prefix . "lockout WHERE ipaddr = '$ip' AND timestamp > ( " . time() . " - (" . getConfig('lockout_duration', 15) . "*60) );"); + if ( !$q ) + $db->_die(); + + echo '
' . $lang->get('acphome_msg_users_locked_out_hint') . '
'; + + ?> +get('acphome_th_locked_out_ip'); ?> | +get('acphome_th_locked_out_username'); ?> | +get('acphome_th_locked_out_status'); ?> | +get('acphome_th_locked_out_time'); ?> | ++ | |
---|---|---|---|---|---|
' . htmlspecialchars($row['ipaddr']) . ' | '; + echo '' . htmlspecialchars($row['username']) . ' | '; + // status + echo '' . + ( $row['fail_count'] >= getConfig('lockout_threshold', 5) + ? '' . $lang->get('acphome_lbl_locked_out_banned') . '' + : $lang->get('acphome_lbl_locked_out_warned', array('fail_count' => $row['fail_count'])) + ) + . ' | '; + // time left + if ( $row['fail_count'] >= getConfig('lockout_threshold', 5) ) + { + $expire_time = $row['timestamp'] + ( getConfig('lockout_duration', 15) * 60 ); + $time_left = round(($expire_time - time()) / 60); + $minutes = $time_left == 1 ? $lang->get('etc_unit_minute') : $lang->get('etc_unit_minutes'); + echo '' . "$time_left $minutes" . ' | '; + } + else + { + echo '– | '; + } + // action + $btn_text = $row['fail_count'] >= getConfig('lockout_threshold', 5) ? $lang->get('acphome_btn_lockout_unblock') : $lang->get('acphome_btn_lockout_clear'); + echo '' . $btn_text . ' | '; + echo '