示例#1
0
 public function before()
 {
     parent::before();
     // detecting language, setting it
     $this->detect_language();
     $this->set('_language', $this->language);
     // creating and attaching page metadata
     $this->metadata = new Model_Metadata();
     $this->metadata->title(__(Application::instance()->get('title')), false);
     $this->set('_metadata', $this->metadata);
     //TODO: token auth
     /*
             if ($this->request->method() == Request::POST && Arr::get($_POST, 'token', '') !== Security::token())
             {
        throw new HTTP_Exception_403('Wrong token data');
             }
     */
     $this->set('_token', Security::token());
     // Handles return urls, cropping language out of it (will be appended by url.site at redirect time)
     $rr = Request::initial()->uri();
     $rr = trim($rr, '/');
     $rr = explode('/', $rr);
     if (in_array($rr[0], Application::instance()->get('language.list'))) {
         array_shift($rr);
     }
     $rr = implode('/', $rr);
     $this->set('_return', $rr);
     // detecting if user is logged in
     if (method_exists(Auth::instance(), 'auto_login')) {
         Auth::instance()->auto_login();
     }
     $this->user = Auth::instance()->get_user();
     $this->set('_user', $this->user);
 }
示例#2
0
 public function before()
 {
     parent::before();
     $this->metadata = Model::factory('Metadata');
     $this->set('_metadata', $this->metadata);
     Auth::instance()->auto_login();
     $this->set('_language', i18n::lang());
     $this->metadata->title('Вход в панель управления', false);
 }
示例#3
0
 public function add_cumb($title, $url)
 {
     $this->metadata->title($title);
     $this->breadcumbs[] = array('title' => $title, 'url' => $url);
     return $this;
 }