better sorting

git-svn-id: file:///home/shish/svn/shimmie2/trunk@472 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish
2007-08-24 13:41:43 +00:00
parent 2240262205
commit e98e4e31d5
2 changed files with 23 additions and 5 deletions

View File

@@ -33,11 +33,17 @@ class EventLog extends Extension {
if(isset($_GET['sort']) && in_array($_GET['sort'], array("name", "date", "ip", "event"))) {
$sort = $_GET['sort'];
}
$order = "DESC";
if(isset($_GET['order']) && in_array($_GET['order'], array("ASC", "DESC"))) {
$order = $_GET['order'];
}
$events = $database->db->GetAll("
SELECT event_log.*,users.name FROM event_log
JOIN users ON event_log.owner_id = users.id
WHERE date > date_sub(now(), interval 1 day)
ORDER BY $sort DESC
ORDER BY $sort $order
");
$this->theme->display_page($event->page, $events);
}