Ejemplo n.º 1
0
 protected function init()
 {
     $module_config = Helper_Module::load_config('blog');
     $helper_acl = new Helper_ACL($this->acl);
     $helper_acl->inject(Arr::get($module_config, 'a2'));
     $this->blog_group = Arr::get($this->params, 'group');
 }
Ejemplo n.º 2
0
 protected function init()
 {
     $request = $this->request->current();
     $this->config = Kohana::$config->load($this->config)->as_array();
     $this->acl_init();
     $this->site_init();
     $helper_acl = new Helper_ACL($this->acl);
     $a2_config = Kohana::$config->load('admin/a2/base')->as_array();
     $helper_acl->inject($a2_config);
     if (Route::name($request->route()) == 'modules') {
         $this->module_page_id = (int) $request->query('page');
         $this->module_config = empty($this->module_config) ? Helper_Module::code_by_controller($request->controller()) : $this->module_config;
         $_pages = $this->get_module_pages($this->module_config);
         if ($_pages->count() > 0) {
             if ($this->module_page_id == 0) {
                 $this->module_page_id = $_pages->rewind()->current()->id;
             }
             foreach ($_pages as $_item) {
                 $_link = URL::base() . Page_Route::dynamic_base_uri($_item->id);
                 $this->module_pages[$_item->id] = $_item->title . " [ {$_link} ]";
             }
         }
         $this->module_config = Helper_Module::load_config($this->module_config);
         if (!Kohana::$is_cli) {
             $config = Arr::get($this->module_config, 'a2');
             $helper_acl->inject($config);
         }
         if (!$this->acl->is_allowed($this->user, $request->controller() . '_controller', 'access')) {
             throw new HTTP_Exception_404();
         }
     }
     $injectors = array();
     foreach ($this->injectors as $_key => $_array) {
         $params = Arr::get($_array, 1);
         if (class_exists($_array[0])) {
             $object = new $_array[0]($request, $this->user, $this->acl, $params);
             $injectors[$_key] = $object;
         }
     }
     $this->injectors = $injectors;
     unset($injectors);
     $this->is_cancel = $request->post('cancel') == 'cancel';
     $this->back_url = $request->query('back_url');
     $this->post_check_empty_files();
     $this->post_check_deleted_fields();
 }