Пример #1
0
 public function before()
 {
     if (!\CMF\Auth::check(null, 'view', 'admin_site')) {
         \Response::redirect("/admin/login?next=" . \Uri::string(), 'location');
     }
     \Lang::$autosave = false;
     // Find the lang from the session, or from the user
     if ($this->lang_enabled = \Config::get('cmf.languages.enabled', false)) {
         $lang = \Session::get('cmf.admin.language');
         if ($lang === null) {
             $user = \CMF\Auth::current_user();
             $lang = $user->default_language;
         }
         if (!empty($lang) && strlen($lang) !== 0 && $lang !== null) {
             \CMF::setLang($lang);
         }
     }
     // Allows us to set the interface template via an integer
     $this->mode = \Input::param('_mode', 'default');
     $this->interface_template = \Config::get('cmf.admin.interface_templates.' . $this->mode);
     // A unique ID that can be passed through
     $this->cid = \Input::param('_cid', 'none');
     // Lang info
     $this->current_lang = \Lang::get_lang();
     $this->fallback_lang = \Lang::$fallback;
     $this->lang_lines = \Lang::$lines;
 }