diff options
Diffstat (limited to 'modules/digibug')
-rw-r--r-- | modules/digibug/controllers/digibug.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php index 1bb2691b..03f9e812 100644 --- a/modules/digibug/controllers/digibug.php +++ b/modules/digibug/controllers/digibug.php @@ -61,7 +61,7 @@ class Digibug_Controller extends Controller { if ($type == "full") { $remote_addr = ip2long($this->input->server("REMOTE_ADDR")); if ($remote_addr === false) { - Kohana::show_404(); + throw new Kohana_404_Exception(); } $config = Kohana::config("digibug"); @@ -76,13 +76,13 @@ class Digibug_Controller extends Controller { } } if (!$authorized) { - Kohana::show_404(); + throw new Kohana_404_Exception(); } } $proxy = ORM::factory("digibug_proxy", array("uuid" => $id)); - if (!$proxy->loaded || !$proxy->item->loaded) { - Kohana::show_404(); + if (!$proxy->loaded() || !$proxy->item->loaded()) { + throw new Kohana_404_Exception(); } $file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path(); @@ -115,9 +115,10 @@ class Digibug_Controller extends Controller { } private function _clean_expired() { - Database::instance()->query( - "DELETE FROM {digibug_proxies} " . - "WHERE request_date <= (CURDATE() - INTERVAL 10 DAY) " . - "LIMIT 20"); + db::build() + ->delete("digibug_proxies") + ->where("request_date", "<=", new Database_Expression("(CURDATE() - INTERVAL 10 DAY)")) + ->limit(20) + ->execute(); } }
\ No newline at end of file |