diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-12-26 11:24:50 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-12-26 11:24:50 -0800 |
commit | 3060a6f662da66008d57a461bf1c9b5b4aa2b002 (patch) | |
tree | 442fd290505817efc0324f2af6e01805cb7396aa /modules/digibug/controllers | |
parent | 1cd6a615bb47a33794e4a4f690c87a348ab752d7 (diff) | |
parent | 32d25dafd5b033338b6a9bb8c7c53edab462543a (diff) |
Merge branch 'master' into talmdal_dev
Conflicts:
modules/gallery/controllers/albums.php
modules/gallery/controllers/movies.php
modules/gallery/controllers/photos.php
Diffstat (limited to 'modules/digibug/controllers')
-rw-r--r-- | modules/digibug/controllers/digibug.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php index 1bb2691b..6e6009db 100644 --- a/modules/digibug/controllers/digibug.php +++ b/modules/digibug/controllers/digibug.php @@ -55,13 +55,13 @@ class Digibug_Controller extends Controller { print $v; } - public function print_proxy($type, $id) { + public function print_proxy($type, $uuid) { // If its a request for the full size then make sure we are coming from an // authorized address if ($type == "full") { - $remote_addr = ip2long($this->input->server("REMOTE_ADDR")); + $remote_addr = ip2long(Input::instance()->server("REMOTE_ADDR")); if ($remote_addr === false) { - Kohana::show_404(); + throw new Kohana_404_Exception(); } $config = Kohana::config("digibug"); @@ -76,18 +76,18 @@ 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(); + $proxy = ORM::factory("digibug_proxy")->where("uuid", "=", $uuid)->find(); + if (!$proxy->loaded() || !$proxy->item->loaded()) { + throw new Kohana_404_Exception(); } $file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path(); if (!file_exists($file)) { - kohana::show_404(); + throw new Kohana_404_Exception(); } // We don't need to save the session for this request @@ -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 |