summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/albums.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-11-30 11:10:58 -0800
committerBharat Mediratta <bharat@menalto.com>2009-11-30 13:57:50 -0800
commit852653ef2415dc070c27ce151ed399525ddfa5a0 (patch)
tree1e1e081e27fd5e3cbe0b867449332d289abdde44 /modules/gallery/controllers/albums.php
parent299da7b54f17408a53f7771305bcdd22ef94ec36 (diff)
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.
Diffstat (limited to 'modules/gallery/controllers/albums.php')
-rw-r--r--modules/gallery/controllers/albums.php11
1 files changed, 10 insertions, 1 deletions
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) {