本文整理汇总了PHP中ACL::required方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::required方法的具体用法?PHP ACL::required怎么用?PHP ACL::required使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::required方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
/**
* The before() method is called before controller action
*
* @uses ACL::required
*/
public function before()
{
ACL::required('access comment');
// Disable sidebars on comments page
$this->_sidebars = FALSE;
parent::before();
}
示例2: before
/**
* The before() method is called before controller action
*
* @uses ACL::required
*/
public function before()
{
ACL::required('administer comment');
$this->_destination = '?destination=' . Route::get('admin/comment')->uri(array('action' => $this->request->action()));
$this->_form_action = Route::get('admin/comment')->uri(array('action' => 'process')) . $this->_destination;
parent::before();
}
示例3: before
public function before()
{
// Internal request only!
if ($this->request->is_initial()) {
throw HTTP_Exception::factory(404, 'Access denied!', array(':type' => '<small>' . $this->request->uri() . '</small>'));
}
ACL::required('access content');
parent::before();
}
示例4: before
public function before()
{
// Ajax request only!
if (!$this->request->is_ajax()) {
throw HTTP_Exception::factory(404, 'Accessing an ajax request :type externally', array(':type' => '<small>' . $this->request->uri() . '</small>'));
}
ACL::required('access content');
parent::before();
}
示例5: action_links
/**
* Retrieve a JSON object containing autocomplete suggestions for existing aliases
*
* @uses ACL::required
* @uses DB::select
* @uses Text::plain
* @uses JSON::encode
*/
public function action_links()
{
ACL::required('administer menu');
$string = $this->request->param('string', FALSE);
$matches = array();
if ($string) {
$result = DB::select('alias')->from('paths')->where('alias', 'LIKE', $string . '%')->limit('10')->execute();
foreach ($result as $link) {
$matches[$link['alias']] = Text::plain($link['alias']);
}
}
$this->response->body(JSON::encode($matches));
}
示例6: before
/**
* The before() method is called before controller action
*
* @uses ACL::required
*/
public function before()
{
ACL::required('administer users');
parent::before();
}
示例7: action_add
/**
* Creates blog post
*
* @uses ACL::required
* @uses Config::load
* @uses Config_Group::get
* @uses Request::query
* @uses Route::get
* @uses Route::uri
* @uses URL::query
* @uses ORM::select_list
* @uses Log::add
* @uses Message::success
*/
public function action_add()
{
ACL::required('create blog');
$this->title = __('Add Blog');
$config = Config::load('blog');
// Set form destination
$destination = !is_null($this->request->query('destination')) ? array('destination' => $this->request->query('destination')) : array();
// Set form action
$action = Route::get('blog')->uri(array('action' => 'add')) . URL::query($destination);
$view = View::factory('blog/form')->set('destination', $destination)->set('action', $action)->set('config', $config)->set('created', FALSE)->set('author', FALSE)->set('path', FALSE)->set('tags', isset($_POST['ftags']) ? $_POST['ftags'] : FALSE)->set('image', FALSE)->bind('errors', $this->_errors)->bind('terms', $terms)->bind('blog', $post);
$post = ORM::factory('blog');
$post->status = $config->get('default_status', 'draft');
if ($config->get('use_category', FALSE)) {
$terms = ORM::factory('term', array('type' => 'blog', 'lvl' => 1))->select_list('id', 'name', '--');
}
if ($config->get('use_captcha', FALSE)) {
$captcha = Captcha::instance();
$view->set('captcha', $captcha);
}
if ($this->valid_post('blog')) {
try {
$post->values($_POST)->save();
Log::info('Blog :title created.', array(':title' => $post->title));
Message::success(__('Blog %title created', array('%title' => $post->title)));
$this->request->redirect($post->url);
} catch (ORM_Validation_Exception $e) {
// @todo Added messages
$this->_errors = $e->errors('models', TRUE);
}
}
$this->response->body($view);
}
示例8: before
/**
* The before() method is called before controller action
*
* @uses ACL::required
*/
public function before()
{
ACL::required('access content');
parent::before();
}