예제 #1
0
 public function __construct()
 {
     $this->openConnection();
     $this->_userId = 0;
     if (0 !== strpos($_SERVER['REQUEST_URI'], '/cron')) {
         $this->_userId = Application_Service_Session::getInstance()->getSessionId();
     }
 }
예제 #2
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $publicControllers = ['cron', 'index', 'share'];
     if (false !== array_search($request->getControllerName(), $publicControllers)) {
         return;
     }
     $user = Application_Model_UserRepository::getInstance()->get(Application_Service_Session::getInstance()->getSessionId());
     if ($user && 'admin' === $user->getRole()) {
         return;
     }
     $request->setModuleName('default');
     $request->setControllerName('maintenance');
     $request->setActionName('index');
 }
예제 #3
0
 public function init()
 {
     parent::init();
     $this->_acl = Application_Model_Acl::getInstance();
     $isCron = 0 === strpos($_SERVER['REQUEST_URI'], '/cron');
     if (!$isCron) {
         $this->_session = Application_Service_Session::getInstance();
     }
     if ('index' === $this->getParam('controller') && 'unsupported' === $this->getParam('action')) {
         //            $this->redirect('index/unsupported');
     }
     $this->_mail = new Application_Service_Mail();
     $this->_userRepo = Application_Model_UserRepository::getInstance();
     $frontendOptions = ['lifetime' => 60, 'automatic_serialization' => true];
     $backendOptions = ['cache_dir' => substr(APPLICATION_PATH, 0, strrpos(APPLICATION_PATH, '/')) . '/data/cache/'];
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     Zend_Registry::set('Zend_Locale', new Zend_Locale('de'));
     Zend_Locale::setCache($cache);
     if (!$isCron && $this->isLoggedin()) {
         if (is_null($this->_session->getColor())) {
             $this->_session->setColor(Application_Model_UserSettingRepository::getInstance()->getSetting()->getColor());
         }
         if (is_null($this->_session->getMenuStatic())) {
             $this->_session->setMenuStatic(Application_Model_UserSettingRepository::getInstance()->getSetting()->getMenuStatic());
         }
         if (is_null($this->_session->getLanguage())) {
             $this->_session->setLanguage(Application_Model_UserSettingRepository::getInstance()->getSetting()->getLanguage());
         }
     }
     $this->_translate = Application_Service_Language::getInstance();
     Zend_Registry::set('Zend_Translate', $this->_translate);
     $this->view->translate = $this->_translate;
     if (!$isCron) {
         $this->view->staticMenu = intval($this->_session->getMenuStatic());
         $this->view->color = $this->_session->getColor();
     }
 }