Ejemplo n.º 1
0
 public function __construct()
 {
     $request = JO_Request::getInstance();
     parent::__construct();
     if (Model_Allowips::getTotalWords()) {
         if (!Model_Allowips::getTotalWords(array('filete_ip' => $request->getClientIp()))) {
             if (!in_array($request->getController(), array('login', 'error'))) {
                 $this->forward('error', 'noPermission');
             }
         }
     }
     //set default timezone if is not set
     if (!ini_get('date.timezone')) {
         ini_set('date.timezone', 'UTC');
     }
     WM_Users::initSession(JO_Session::get('user[user_id]'));
     if (!JO_Session::get('user[user_id]')) {
         JO_Session::set('user', array('user_id' => 0));
     }
     //admin check login
     $login_page = $request->getController() != 'login';
     if (JO_Session::get('user[is_developer]')) {
         $login_page = false;
     } else {
         if (JO_Session::get('user[is_admin]')) {
             $login_page = false;
         }
     }
     if (in_array($request->getController(), array('login', 'error'))) {
         $login_page = false;
     }
     if ($login_page) {
         $this->forward('login', 'index');
     }
     //admin top menu
     Helper_Config::set('adminmenupermisions', WM_Users::initPermision());
     //no permisions
     $controller_name = JO_Front::getInstance()->formatControllerName($request->getController());
     if (!class_exists($controller_name, false)) {
         JO_Loader::loadFile(APPLICATION_PATH . '/modules/' . $request->getModule() . '/controllers/' . JO_Front::getInstance()->classToFilename($controller_name));
     }
     if (method_exists($controller_name, 'config')) {
         $data = call_user_func(array($controller_name, 'config'));
         if (isset($data['has_permision']) && $data['has_permision'] && !WM_Users::allow('read', $request->getController())) {
             $this->forward('error', 'noPermission');
         }
     }
     WM_Rebuild::getInformation();
     WM_Licensecheck::checkIt();
 }
Ejemplo n.º 2
0
 public function _initPinitPoweredAndLicence()
 {
     WM_Licensecheck::checkIt();
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $request = JO_Request::getInstance();
     parent::__construct();
     //set default timezone if is not set
     if (!ini_get('date.timezone')) {
         ini_set('date.timezone', 'UTC');
     }
     WM_Users::initSession(JO_Session::get('user[user_id]'));
     if (!JO_Session::get('user[user_id]')) {
         JO_Session::set('user', array('user_id' => 0));
     }
     //mobile version
     if ($request->issetParam('full_version')) {
         $re = $request->setCookie('full_version', 1, 86400, '/', '.' . $request->getDomain());
         $this->redirect($request->getBaseUrl());
     } else {
         if ($request->issetParam('remove_full_version')) {
             $re = $request->setCookie('full_version', 0, 86400, '/', '.' . $request->getDomain());
             $this->redirect($request->getBaseUrl());
         }
     }
     $mobile_detect = new JO_Mobile_Detect();
     JO_Registry::set('isMobile', false);
     if ($mobile_detect->isMobile() && !$mobile_detect->isTablet() && in_array('mobile', WM_Modules::getTemplates())) {
         if (!$request->getCookie('full_version')) {
             JO_Registry::set('template', 'mobile');
             Helper_Config::set('config_disable_js', 0);
             if (Helper_Config::get('site_logo_mobile')) {
                 Helper_Config::set('site_logo', Helper_Config::get('site_logo_mobile'));
             }
         }
         JO_Registry::set('isMobile', true);
     }
     //is not ajax
     if (!$request->isXmlHttpRequest()) {
         WM_Licensecheck::checkIt();
         if (Helper_Config::get('config_maintenance')) {
             if ($request->getController() != 'error' && $request->getAction() != 'maintenance') {
                 $this->forward('error', 'maintenance');
             }
         }
         ////first login
         if (JO_Session::get('user[user_id]')) {
             if (JO_Session::get('user[first_login]')) {
                 if (!in_array($request->getController(), array('pages', 'smuk', 'crons', 'pin', 'boards', 'js', 'json', 'cache', 'data'))) {
                     if ($request->getParam('direct_path') != 'true') {
                         if ($request->getController() != 'welcome') {
                             if ($request->getController() == 'users' && $request->getAction() == 'logout') {
                             } else {
                                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=welcome'));
                             }
                         }
                     }
                 }
             } else {
                 if ($request->getController() == 'welcome') {
                     JO_Action::getInstance()->redirect($request->getBaseUrl());
                 }
             }
         } elseif ($request->getController() == 'welcome') {
             JO_Action::getInstance()->redirect($request->getBaseUrl());
         }
     }
     Helper_Config::check();
     WM_Licensecheck::checkIt();
 }