Specify who banned a person on the ban list

git-svn-id: file:///home/shish/svn/shimmie2/trunk@910 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-07-17 08:13:52 +00:00
parent 87f99dee99
commit 9b515faf34
2 changed files with 9 additions and 2 deletions

View File

@ -176,7 +176,11 @@ class IPBan extends Extension {
// database {{{ // database {{{
private function get_bans() { private function get_bans() {
global $database; global $database;
$bans = $database->get_all("SELECT * FROM bans ORDER BY end, id"); $bans = $database->get_all("
SELECT bans.*, users.name as banner_name
FROM bans
JOIN users ON banner_id = users.id
ORDER BY end, id");
if($bans) {return $bans;} if($bans) {return $bans;}
else {return array();} else {return array();}
} }

View File

@ -12,6 +12,7 @@ class IPBanTheme extends Themelet {
* ) * )
*/ */
public function display_bans($page, $bans) { public function display_bans($page, $bans) {
global $user;
$h_bans = ""; $h_bans = "";
foreach($bans as $ban) { foreach($bans as $ban) {
$end_human = date('Y-m-d', $ban['end']); $end_human = date('Y-m-d', $ban['end']);
@ -19,6 +20,7 @@ class IPBanTheme extends Themelet {
<tr> <tr>
<td>{$ban['ip']}</td> <td>{$ban['ip']}</td>
<td>{$ban['reason']}</td> <td>{$ban['reason']}</td>
<td>{$ban['banner_name']}</td>
<td>{$end_human}</td> <td>{$end_human}</td>
<td> <td>
<form action='".make_link("ip_ban/remove")."' method='POST'> <form action='".make_link("ip_ban/remove")."' method='POST'>
@ -31,12 +33,13 @@ class IPBanTheme extends Themelet {
} }
$html = " $html = "
<table border='1'> <table border='1'>
<thead><td>IP</td><td>Reason</td><td>Until</td><td>Action</td></thead> <thead><td>IP</td><td>Reason</td><td>By</td><td>Until</td><td>Action</td></thead>
$h_bans $h_bans
<tr> <tr>
<form action='".make_link("ip_ban/add")."' method='POST'> <form action='".make_link("ip_ban/add")."' method='POST'>
<td><input type='text' name='ip'></td> <td><input type='text' name='ip'></td>
<td><input type='text' name='reason'></td> <td><input type='text' name='reason'></td>
<td>{$user->name}</td>
<td><input type='text' name='end'></td> <td><input type='text' name='end'></td>
<td><input type='submit' value='Ban'></td> <td><input type='submit' value='Ban'></td>
</form> </form>