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") {
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") {
global $database;
@ -71,7 +73,8 @@ class AliasEditor extends Extension {
if(is_a($event, 'AddAliasEvent')) {
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')) {

View File

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

View File

@ -91,25 +91,35 @@ class IPBan extends Extension {
// }}}
// deal with banned person {{{
private function check_ip_ban() {
$row = $this->get_ip_ban($_SERVER['REMOTE_ADDR']);
if($row) {
global $config;
global $database;
$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>";
global $config;
global $database;
$contact_link = $config->get_string("contact_link");
if(!empty($contact_link)) {
print "<p><a href='$contact_link'>Contact The Admin</a>";
$bans = $this->get_active_bans();
foreach($bans as $row) {
if($row['ip'] == $_SERVER['REMOTE_ADDR']) {
$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>";
$contact_link = $config->get_string("contact_link");
if(!empty($contact_link)) {
print "<p><a href='$contact_link'>Contact The Admin</a>";
}
exit;
}
exit;
}
}
// }}}
// database {{{
private function get_bans() {
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;}
else {return array();}
}