forked from Cavemanon/cavepaintings
function for showing IPs with ban button
This commit is contained in:
@@ -180,6 +180,23 @@ function plural($num, $single_form="", $plural_form="s") {
|
||||
return ($num == 1) ? $single_form : $plural_form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give a HTML string which shows an IP (if the user is allowed to see IPs),
|
||||
* and a link to ban that IP (if the user is allowed to ban IPs)
|
||||
*
|
||||
* FIXME: also check that IP ban ext is installed
|
||||
*
|
||||
* @retval string
|
||||
*/
|
||||
function show_ip($ip, $ban_reason) {
|
||||
global $user;
|
||||
$u_reason = url_escape($ban_reason);
|
||||
$u_end = url_escape("+1 week");
|
||||
$ban = $user->can("ban_ip") ? ", <a href='".make_link("ip_ban/list", "ip=$ip&reason=$u_reason&end=$u_end#add")."'>Ban</a>" : "";
|
||||
$ip = $user->can("view_ip") ? $ip.$ban : "";
|
||||
return $ip;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Different databases have different ways to represent booleans; this
|
||||
|
Reference in New Issue
Block a user