/** * 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(); }
/** * 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(); }
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(); }
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(); }
/** * 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)); }
/** * The before() method is called before controller action * * @uses ACL::required */ public function before() { ACL::required('administer users'); parent::before(); }
/** * 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); }
/** * The before() method is called before controller action * * @uses ACL::required */ public function before() { ACL::required('access content'); parent::before(); }
/** * The before() method is called before controller action * * @uses ACL::required */ public function before() { ACL::required('sending mail'); parent::before(); }