From 852653ef2415dc070c27ce151ed399525ddfa5a0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 30 Nov 2009 11:10:58 -0800 Subject: Clean up item routing a bit. 1) The new default route is "albums", and Albums_Controller::index() does the right thing 2) Items_Controller redirects to the appropriate specific controller 3) All item controllers now have show() instead of _show(), so that the routing code in url::parse_url() can get to it. But that code is protected against receiving bogus requests. --- modules/gallery/controllers/albums.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modules/gallery/controllers/albums.php') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 43040b67..0cfee7cd 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -18,7 +18,16 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Albums_Controller extends Items_Controller { - public function _show($album) { + public function index() { + $this->_show(ORM::factory("item", 1)); + } + + public function show($album) { + if (!is_object($album)) { + // show() must be public because we route to it in url::parse_url(), so make + // sure that we're actually receiving an object + Kohana::show_404(); + } $page_size = module::get_var("gallery", "page_size", 9); if (!access::can("view", $album)) { if ($album->id == 1) { -- cgit v1.2.3 From 883fda313d3d7e76ae98cba7735c4c474b6f517c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 1 Dec 2009 00:08:12 -0800 Subject: Fix a typo that was breaking the home page (doh!) $this->_show() -> $this->show() --- modules/gallery/controllers/albums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/controllers/albums.php') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 0cfee7cd..3c1a0adf 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -19,7 +19,7 @@ */ class Albums_Controller extends Items_Controller { public function index() { - $this->_show(ORM::factory("item", 1)); + $this->show(ORM::factory("item", 1)); } public function show($album) { -- cgit v1.2.3