pull a couple of mostly cosmetic changes into stable

git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@741 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-03-31 03:01:35 +00:00
parent 6c53088929
commit 47361369ff
3 changed files with 27 additions and 13 deletions

View File

@ -40,7 +40,9 @@ class AliasEditor extends Extension {
} }
else if($event->get_arg(0) == "list") { else if($event->get_arg(0) == "list") {
global $database; global $database;
$this->theme->display_aliases($event->page, $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"), $event->user->is_admin()); $this->theme->display_aliases($event->page,
$database->db->GetAssoc("SELECT oldtag, newtag FROM aliases ORDER BY newtag"),
$event->user->is_admin());
} }
else if($event->get_arg(0) == "export") { else if($event->get_arg(0) == "export") {
global $database; global $database;
@ -71,7 +73,8 @@ class AliasEditor extends Extension {
if(is_a($event, 'AddAliasEvent')) { if(is_a($event, 'AddAliasEvent')) {
global $database; global $database;
$database->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)", array($event->oldtag, $event->newtag)); $database->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)",
array($event->oldtag, $event->newtag));
} }
if(is_a($event, 'UserBlockBuildingEvent')) { if(is_a($event, 'UserBlockBuildingEvent')) {

View File

@ -45,6 +45,7 @@ class AliasEditorTheme extends Themelet {
$html = " $html = "
<table border='1'> <table border='1'>
<thead><td>From</td><td>To</td>$action</thead> <thead><td>From</td><td>To</td>$action</thead>
$add
$h_aliases $h_aliases
$add $add
</table> </table>

View File

@ -91,10 +91,12 @@ class IPBan extends Extension {
// }}} // }}}
// deal with banned person {{{ // deal with banned person {{{
private function check_ip_ban() { private function check_ip_ban() {
$row = $this->get_ip_ban($_SERVER['REMOTE_ADDR']);
if($row) {
global $config; global $config;
global $database; global $database;
$bans = $this->get_active_bans();
foreach($bans as $row) {
if($row['ip'] == $_SERVER['REMOTE_ADDR']) {
$admin = $database->get_user_by_id($row['banner_id']); $admin = $database->get_user_by_id($row['banner_id']);
print "IP <b>{$row['ip']}</b> has been banned by <b>{$admin->name}</b> because of <b>{$row['reason']}</b>"; print "IP <b>{$row['ip']}</b> has been banned by <b>{$admin->name}</b> because of <b>{$row['reason']}</b>";
@ -105,11 +107,19 @@ class IPBan extends Extension {
exit; exit;
} }
} }
}
// }}} // }}}
// database {{{ // database {{{
private function get_bans() { private function get_bans() {
global $database; global $database;
$bans = $database->get_all("SELECT * FROM bans"); $bans = $database->get_all("SELECT * FROM bans ORDER BY date");
if($bans) {return $bans;}
else {return array();}
}
private function get_active_bans() {
global $database;
$bans = $database->get_all("SELECT * FROM bans WHERE (date < now()) AND (end > now() OR isnull(end))");
if($bans) {return $bans;} if($bans) {return $bans;}
else {return array();} else {return array();}
} }