controller
<?php defined('SYSPATH') or die('No direct script access.');
if ( ! $this->_auth->logged_in('login'))
{
throw new Kohana_Exception('You are not allowed to view this resource.');
}
Kohana Framework, kohana 3 tutorial , kohana hmvc
<?php defined('SYSPATH') or die('No direct script access.');
if ( ! $this->_auth->logged_in('login'))
{
throw new Kohana_Exception('You are not allowed to view this resource.');
}
$this
->request->action;
Request::instance()->action;
$this
->request->param(
'key_name'
);
/*
* Authentication shortcuts
*/
Route::set(
'auth'
,
'<action>'
,
array
(
'action'
=>
'(login|logout)'
))
->defaults(
array
(
'controller'
=>
'auth'
));
/*
* Multi-format feeds
* 452346/comments.rss
* 5373.json
*/
Route::set(
'feeds'
,
'<user_id>(/<action>).<format>'
,
array
(
'user_id'
=>
'\d+'
,
'format'
=>
'(rss|atom|json)'
,
))
->defaults(
array
(
'controller'
=>
'feeds'
,
'action'
=>
'status'
,
));
/*
* Static pages
*/
Route::set(
'static'
,
'<path>.html'
,
array
(
'path'
=>
'[a-zA-Z0-9_/]+'
,
))
->defaults(
array
(
'controller'
=>
'static'
,
'action'
=>
'index'
,
));
/*
* You don't like slashes?
* EditGallery:bahamas
* Watch:wakeboarding
*/
Route::set(
'gallery'
,
'<action>(<controller>):<id>'
,
array
(
'controller'
=>
'[A-Z][a-z]++'
,
'action'
=>
'[A-Z][a-z]++'
,
))
->defaults(
array
(
'controller'
=>
'Slideshow'
,
));
/*
* Quick search
*/
Route::set(
'search'
,
':<query>'
,
array
(
'query'
=>
'.*'
))
->defaults(
array
(
'controller'
=>
'search'
,
'action'
=>
'index'
,
));