mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-10 17:29:18 -04:00
Refactor the album, movie and photo handling to remove the REST_Controller. Partial fix for ticket #917
This commit is contained in:
@@ -17,14 +17,16 @@
|
||||
* 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";
|
||||
|
||||
public function _show($item) {
|
||||
class Items_Controller extends Controller {
|
||||
public function __call($function, $args) {
|
||||
$item = ORM::factory("item", (int)$function);
|
||||
if (!$item->loaded) {
|
||||
return Kohana::show_404();
|
||||
}
|
||||
// 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.
|
||||
access::required("view", $item);
|
||||
return url::redirect($item->abs_url());
|
||||
return $this->_show($item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user