Example #1
0
 /**
  * set common data to template
  * 
  * @author Luvina
  * @access public
  * 
  * @return void
  */
 public function before()
 {
     parent::before();
     $aryMenuList = Model_Category::find('all');
     $this->template->menu = $aryMenuList;
     $this->template->base_url = Config::get('base_url');
 }
Example #2
0
 public function before()
 {
     parent::before();
     \Asset::add_path('assets/news');
     $manager = new StoryManager();
     $this->side_data['SectionList'] = $manager->sideData;
 }
Example #3
0
 public function before()
 {
     parent::before();
     if (Session::get('user_token')) {
         Response::redirect('fanpage/index');
     }
     $this->facebook = new Libs\Facebook();
 }
Example #4
0
 /**
  *
  */
 public function before()
 {
     View::set_global('BASE_URL', Config::get('base_url'));
     // Check if is in maintenance mode
     if (Config::get('global.MAINTENANCE_MODE')) {
         // Open maintenance page
         return Response::redirect('page/maintenance');
     }
     return parent::before();
 }
 public function before()
 {
     // Lets render the template
     parent::before();
     // Check to see if the config exsists
     if (file_exists(APPPATH . 'config/production/db.php') === false) {
         Response::Redirect('install');
     }
     if (DBUtil::field_exists('urls', array('cached_preview')) === false && file_exists(APPPATH . 'classes/controller/upgrade.php')) {
         Response::Redirect(Uri::Create('upgrade'));
     }
     $real_base_url = Config::get('base_url');
     Config::set('base_url', str_replace('public/', '', $real_base_url));
     $base_url = Settings::get('different_short_url');
     if (empty($base_url) === false) {
         View::set_global(array('base_url' => $base_url), false, false);
     }
     if (trim(Uri::Base(), '/') == Settings::get('different_short_url')) {
         if (count(Uri::Segments()) == 2) {
             $route = Uri::to_assoc();
             if (isset($route) === true && $route['core'] == '404') {
                 // We are good!
             } else {
                 Response::Redirect(Settings::Get('base_url'));
             }
         } else {
             Response::Redirect(Settings::Get('base_url'));
         }
     }
     $data = null;
     if (Auth::Check()) {
         $user_id = Auth::get_user_id();
         static::$user_id = $user_id[1];
         $data['api_key'] = Auth::get('api_key');
         if (empty($data['api_key']) === true) {
             if (empty($data['api_key']) === true) {
                 $data['api_key'] = preg_replace('/\\+|\\/|\\=|\\?/', '', \Auth::instance()->hash_password(\Str::random()) . static::$user_id);
                 // invalidate the hash
                 \Auth::update_user(array('api_key' => $data['api_key']), Auth::get('username'));
             }
         }
     }
     // Lets set the default title , you can change it when calling the view
     $this->template->title = ucwords(str_replace('controller_', '', strtolower($this->request->route->controller)));
     try {
         Module::load('image');
         $this->template->image_js = true;
     } catch (Exception $e) {
     }
     // Lets get the header and footer and set a variable to use within the template
     $this->template->footer = View::forge('core/footer', $data);
     $this->template->header = View::forge('core/header');
 }
Example #6
0
 public function before()
 {
     parent::before();
     $client_type = false;
     $ua = \Input::user_agent();
     if (preg_match('/MicroMessenger/i', $ua)) {
         //加载微信公众号信息
         $this->load_wx_account();
         //加载微信粉丝OPENID信息
         $this->load_wechat();
         $client_type = 'wechat';
     }
     $this->load_seller();
     $this->getToken();
     \View::set_global(['client_type' => $client_type]);
 }
Example #7
0
 public function before()
 {
     $parentReturn = parent::before();
     \Fuel\Core\Lang::load("global");
     \Fuel\Core\Lang::load("share");
     $this->template->jsVars = new JsVars();
     $this->template->jsVars->addVar("wsUrl", rtrim(Router::get("ws_" . $this->lang), "/") . "/");
     $this->template->jsVars->addVar("baseUrl", \Fuel\Core\Uri::base(FALSE));
     $this->template->css = array("fonts.css", "normalize.css", "definitions.css", "template.css", "sprites/generic.css");
     $this->template->js = array("libs/jquery-2.1.3.min.js", "libs/jquery-ui.min.js", "libs/mustache.js", "template.js");
     $this->template->header = "front_header";
     $this->template->set_global(array("menu_selected" => ""));
     $this->template->footer = "front_footer";
     $this->template->footer_options = array();
     $fbShare = array("share" => FALSE, "siteName" => '', "title" => '', "description" => '', "image" => '');
     $this->template->fbShare = $fbShare;
     return $parentReturn;
 }
Example #8
0
 public function before()
 {
     parent::before();
     \Asset::add_path('assets/admin');
 }
Example #9
0
 public function before()
 {
     parent::before();
 }