summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/items.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-12-04 11:42:37 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-12-04 11:42:37 -0800
commit8ca69cffbba70fe22e19478f742a37bdbd758d83 (patch)
tree712a69eef7d134d7ad2ea2668d30fda44914beff /modules/gallery/controllers/items.php
parent5743b159c28888f2165cc4269d3302fea24fde7a (diff)
parent5c107be9033ae48f781c8430702458f613e791ee (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/controllers/items.php')
-rw-r--r--modules/gallery/controllers/items.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/gallery/controllers/items.php b/modules/gallery/controllers/items.php
index 7f60f2b7..b350c5a2 100644
--- a/modules/gallery/controllers/items.php
+++ b/modules/gallery/controllers/items.php
@@ -17,14 +17,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Items_Controller extends REST_Controller {
- protected $resource_type = "item";
+class Items_Controller extends Controller {
+ public function __call($function, $args) {
+ $item = ORM::factory("item", (int)$function);
+ if (!$item->loaded) {
+ return Kohana::show_404();
+ }
- public function _show($item) {
// Redirect to the more specific resource type, since it will render
- // differently. We could also just delegate here, but it feels more appropriate
- // to have a single canonical resource mapping.
+ // differently. We can't delegate here because we may have gotten to this
+ // page via /items/<id> which means that we don't have a type-specific controller. Also, we
+ // want to drive a single canonical resource mapping where possible.
access::required("view", $item);
- return url::redirect($item->abs_url());
+ url::redirect($item->abs_url());
}
}