Exemplo n.º 1
0
 public function before()
 {
     parent::before();
     if (!$this->request->current()->is_ajax()) {
         throw new HTTP_Exception_404();
     }
 }
Exemplo n.º 2
0
 public function before()
 {
     parent::before();
     // в конфиг a2 нельзя, т.к. используются константы SITE_ID и SITE_ID_MASTER,
     // которые определяются после подключения всех конфигов
     $inject_config = array('rules' => array('allow' => array('pages_can_hide' => array('role' => 'base', 'resource' => 'page', 'privilege' => 'can_hide', 'assertion' => array('Acl_Assert_Page', array('site_id' => SITE_ID, 'site_id_master' => SITE_ID_MASTER))))));
     $helper_acl = new Helper_ACL($this->acl);
     $helper_acl->inject($inject_config);
 }
Exemplo n.º 3
0
 public function before()
 {
     parent::before();
     // 		if ( ! IS_SUPER_USER) {
     // 			$this->back_url = Route::url('admin', array(
     // 				'controller' => 'sites'
     // 			));
     // 			$this->request->redirect($this->back_url);
     // 		}
 }
Exemplo n.º 4
0
 public function before()
 {
     parent::before();
     if (IS_SUPER_USER) {
         ORM_Base::$site_id = NULL;
     } else {
         $this->request->current()->set_param('id', SITE_ID);
         $this->request->current()->action('edit');
     }
 }
Exemplo n.º 5
0
 public function before()
 {
     parent::before();
     $request = $this->request;
     $query_controller = $request->query('controller');
     if (!empty($query_controller) and is_array($query_controller)) {
         $this->controller_name = $request->query('controller');
     }
     $this->template->bind_global('CONTROLLER_NAME', $this->controller_name);
     $this->title = __($this->title);
     $this->sub_title = __($this->sub_title);
 }
Exemplo n.º 6
0
 public function before()
 {
     parent::before();
     $this->category_id = (int) Request::current()->query('category');
     $this->template->bind_global('CATEGORY_ID', $this->category_id);
     $query_controller = $this->request->query('controller');
     if (!empty($query_controller) and is_array($query_controller)) {
         $this->controller_name = $this->request->query('controller');
     }
     $this->template->bind_global('CONTROLLER_NAME', $this->controller_name);
     $this->title = __($this->title);
     $this->sub_title = __($this->sub_title);
 }
Exemplo n.º 7
0
 public function before()
 {
     parent::before();
     $this->owner_list = $this->get_owner_list();
     $this->template->bind_global('OWNER_LIST', $this->owner_list);
     $this->owner = Request::current()->query('owner');
     if (empty($this->owner)) {
         $this->owner = (string) key($this->owner_list);
     }
     $this->template->bind_global('OWNER', $this->owner);
     $this->not_deleted_owner = Kohana::$config->load('forms.not_deleted_owner');
     $this->template->bind_global('NOT_DELETED_OWNER', $this->not_deleted_owner);
     $query_controller = $this->request->query('controller');
     if (!empty($query_controller) and is_array($query_controller)) {
         $this->controller_name = $this->request->query('controller');
     }
     $this->template->bind_global('CONTROLLER_NAME', $this->controller_name);
     $this->title = __($this->title);
     $this->sub_title = __($this->sub_title);
 }
Exemplo n.º 8
0
 public function before()
 {
     parent::before();
     $this->blog_id = (int) Request::current()->query('blog');
     $this->template->bind_global('BLOG_ID', $this->blog_id);
     $this->group_options = Kohana::$config->load('_blog.groups');
     $this->_sort_group_options($this->group_options);
     $this->template->bind_global('GROUP_OPTIONS', $this->group_options);
     $this->group_key = Request::current()->query('group');
     if (empty($this->group_key)) {
         $this->group_key = 'common';
     }
     $this->template->bind_global('GROUP_KEY', $this->group_key);
     $query_controller = $this->request->query('controller');
     if (!empty($query_controller) and is_array($query_controller)) {
         $this->controller_name = $this->request->query('controller');
     }
     $this->template->bind_global('CONTROLLER_NAME', $this->controller_name);
     $this->title = __($this->title);
     $this->sub_title = __($this->sub_title);
 }
Exemplo n.º 9
0
 public function before()
 {
     $request = $this->request->current();
     if (!$request->initial()->response()) {
         $request->initial()->response($request->response());
     }
     $this->ttl = 0;
     parent::before();
     $this->template->page = URL::site(rawurldecode($request->initial()->uri()));
     $this->template->code = $request->action();
     $this->template->message = '';
     // Internal request only!
     if ($request->initial() !== Request::$current) {
         if ($message = rawurldecode($request->param('message'))) {
             $this->template->message = $message;
         }
     } else {
         $request->action(404);
     }
     $this->response->status((int) $request->action());
 }
Exemplo n.º 10
0
 public function before()
 {
     parent::before();
     $request = $this->request;
     $query_controller = $request->query('controller');
     if (!empty($query_controller) and is_array($query_controller)) {
         $this->controller_name = $request->query('controller');
     }
     $this->template->bind_global('CONTROLLER_NAME', $this->controller_name);
     $this->title = __($this->title);
     $this->sub_title = __($this->sub_title);
     $this->config_orm = ORM::factory($this->controller_name['config']);
     $this->config_orm->where('site_id', '=', SITE_ID)->find();
     if (!$this->config_orm->loaded()) {
         $values = array('site_id' => SITE_ID, 'mode' => 'inherit', 'creator_id' => $this->user->id);
         if (IS_MASTER_SITE) {
             $values['mode'] = 'internal';
         }
         $this->config_orm->values($values, array_keys($values))->save();
         unset($values);
     }
 }
Exemplo n.º 11
0
 public function before()
 {
     parent::before();
     $this->import_config = Kohana::$config->load($this->import_config);
 }