public function init() { $data = $this->getRequestJson(); if (!$data) { $data = $this->getRequest(); } if (array_key_exists('session_uuid', $data)) { if (!Zend_Session::isStarted()) { Glo_Auth_Storage_Session::setId($data['session_uuid']); $storage = new Glo_Auth_Storage_Session('Glo_Auth'); $sessoinData = $storage->read(); if (!is_object($sessoinData) || !isset($data['user_uuid']) || $sessoinData->user_uuid != $data['user_uuid']) { throw new Glo_Exception_InvalidSession('Your session is invalid.'); } } } /* $this->loggedInUser = App_Model_User::getLoggedIn(); */ return parent::init(); /* // load the logged in user if there is one $this->view->loggedInUser = User::getLoggedIn(); // set the translate adapter $this->registerTranslator(); */ }
public function init() { parent::init(); $this->_model = array('time' => new Application_Model_Time(), 'jogo' => new Application_Model_Jogo(), 'apostador' => new Application_Model_Aposta(), 'resultado' => new Application_Model_Resultado(), 'detalhe_aposta' => new Application_Model_DetalheAposta()); #$this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); }
/** * (non-PHPdoc) * @see Zend_Controller_Action::init() */ public function init() { parent::init(); $this->_bootstrap = $this->getInvokeArg('bootstrap'); $accessToken = $this->_request->getParam('access_token', $this->_request->getHeader('OAuth-AccessToken')); $memcache = $this->_bootstrap->getResource('memcache'); Tudu_User::setMemcache($memcache); $this->_user = Tudu_User::getInstance(); // 提供访问令牌 if (!empty($accessToken)) { $storage = new TuduX_OAuth_Storage_Session(); $storage->setMemcache($memcache); $oauth = new OpenApi_OAuth_OAuth(array(OpenApi_OAuth_OAuth::STORAGE => $storage)); $scope = $this->_request->getParam('client_id', $this->_request->getHeader('OAuth-Scope')); try { $token = $oauth->verifyAccessToken($accessToken, $scope); $this->_user->init($token['auth']); // 用户被禁用或已被退出登录 if (!$this->_user->isLogined()) { $oauth->destroyAccessToken($accessToken); throw new OpenApi_OAuth_Exception("Invalid access token provided", OpenApi_OAuth_OAuth::ERROR_INVALID_ACCESSTOKEN); } // ts服务器 $tsServer = 'ts' . $this->_user->tsId; Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $this->_bootstrap->multidb->getDb($tsServer))); $this->_clientId = $token[OpenApi_OAuth_OAuth::PARAM_CLIENT_ID]; $this->_accessToken = $accessToken; $this->_token = $token; // 验证失败 } catch (OpenApi_OAuth_Exception $e) { throw $e; } } }
public function init() { parent::init(); $config_options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions(); $moduleName = $this->getRequest()->getModuleName(); $controllerName = $this->getRequest()->getControllerName(); $controllerType = $this->controllerType; $themeName = $config_options['awe']['theme'][$this->controllerType]; $namespace = substr($controllerName, 0, strpos('_', $controllerName)); $templatesFolder = APPLICATION_PATH . '/templates'; $paths = array(); // first check admin theme // then check admin default // then frontend theme // then frontend default $paths[] = "/frontend/default/views/scripts/{$moduleName}"; if ($themeName != 'default') { $paths[] = "/frontend/{$themeName}/views/scripts/{$moduleName}"; } $skinPath = "/skin/frontend/{$themeName}"; if ($moduleName == 'admin') { $paths[] = "/admin/default/views/scripts"; if ($themeName != 'default') { $paths[] = "/admin/{$themeName}/views/scripts"; } $skinPath = "/skin/admin/{$themeName}"; } $this->pView = new Zend_View(); $this->pView->addScriptPath($templatesFolder . "/frontend/{$themeName}/layouts/widgets"); \Zend_Registry::set('awe_theme_skinPath', $skinPath); foreach ($paths as $path) { $fullPath = $templatesFolder . $path; $this->view->addScriptPath($fullPath); } }
public function init() { parent::init(); $this->_flashMessenger = new Core_Controller_Action_Helper_FlashMessengerCustom(); $this->_config = $this->getConfig(); $this->_layout = Zend_Layout::getMvcInstance(); }
public function init() { parent::init(); $session = new Zend_Session_Namespace('userSession'); $this->view->hata = $session->hataMesaji; $session->hataMesaji = NULL; }
/** * @inheritdoc */ public function init() { parent::init(); $this->_dtoManager = new Api_Manager_Dto(); $this->_annotationManager = new Api_Manager_Annotation(new Api_Annotation_Reader_Simple(), new Api_Annotation_Injector_Simple()); $this->_helper->viewRenderer->setNoRender(true); }
public function init() { parent::init(); $helper = new vkNgine_View_Helper_PublicUrl(); $this->view->registerHelper($helper, 'publicUrl'); $helper = new vkNgine_View_Helper_Seo(); $this->view->registerHelper($helper, 'seo'); $helper = new vkNgine_View_Helper_AssetUrl(); $this->view->registerHelper($helper, 'assetUrl'); $helper = new vkNgine_View_Helper_Dateformat(); $this->view->registerHelper($helper, 'dateFormat'); $searchForm = new Public_Model_Form_Search(); $this->view->searchForm = $searchForm; $view = Zend_Registry::get('view'); $appTitle = Zend_Registry::get('t')->_('GYM Tracker'); $view->headTitle($appTitle, Zend_View_Helper_Placeholder_Container_Abstract::SET); if (!vkNgine_Auth::isAuthenticated()) { header("location:/auth/login"); exit; } $modelExercises = new Model_Exercises(); $this->view->exercises = $modelExercises; $user = vkNgine_Public_Auth::revalidate(); $this->view->params = $this->getAllParams(); Zend_Registry::set('user', $user); $this->view->assign('user', $user); $this->user = Zend_Registry::get('user'); $this->view->t = Zend_Registry::get('t'); $this->t = Zend_Registry::get('t'); }
public function init() { parent::init(); // just good habit (nothing there currently) // maps to arg 'view' from: $frontController->setParam('view', $view); $this->_view = $this->getInvokeArg('view'); }
public function init() { parent::init(); $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); $this->category = new Application_Model_Category(); $this->rubrique_image = new Application_Model_RubriqueImage(); }
public function init() { parent::init(); $this->registry = Zend_Registry::getInstance(); $this->initView(); //cms $this->view->setScriptPath('./application/views/scripts/'); $this->view->setHelperPath('./application/views/helpers/', 'Helper'); $this->view->addHelperPath('./library/Zcms/View/helper/', 'Zcms_View_Helper'); $this->view->addBasePath('./html/', ''); //Zsurforce $this->view->addHelperPath('./library/Zsurforce/View/Helper/', 'Zsurforce_View_Helper'); $this->view->baseUrl = $this->_request->getBaseUrl(); $this->view->basePath = $this->registry->get('base_path'); Zend_Loader::loadClass('Configuracion'); $this->view->user = Zend_Auth::getInstance()->getIdentity(); $this->info = $this->registry->get('personalizacion'); $this->view->title = $this->info->sitio->index->index->titulo; $this->session = $this->registry->get('session'); $this->view->session = $this->session; $this->debug = $this->registry->get('debug'); $this->view->debug = $this->debug; /* información de sitios y subsitios */ $this->view->sitios = Sitios::getAll(null, null, "orden")->toArray(); if (isset($this->session->sitio->id)) { $this->view->configuracion = Configuracion::getConfiguracion($this->session->sitio->id); } else { $this->view->configuracion = Configuracion::getConfiguracionDefault(); $this->session->sitio = Sitios::getSitioDefault(); } $this->registrarSitio(); $this->cargarMenuHorizontal(); $this->_loadBreadcrumItems(); }
public function init() { set_time_limit(0); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNeverRender(); parent::init(); }
public function init() { $this->noCache(); parent::init(); $this->_helper->layout->setLayout('layout-servicios'); $this->_flashMessage = new App_Controller_Action_Helper_FlashMessengerCustom(); }
public function init() { parent::init(); $this->getResponse()->setHeader("Cache-Control", "no-cache, must-revalidate"); $this->_helper->contextSwitch()->initContext(); $this->_helper->layout->disableLayout(); }
/** * (non-PHPdoc) * @see Zend_Controller_Action::init() */ public function init() { parent::init(); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $this->_config = Zend_Registry::get('config'); }
public function init() { parent::init(); // Wählt Hauptmenueeintrag nach Modul aus // Fuer einige Module muss das ueberschrieben werden (Review, Search). $this->getHelper('MainMenu')->setActive($this->_request->getModuleName()); }
public function init() { parent::init(); $this->getResponse()->setHeader('Content-Type', 'application/xml; charset="UTF-8"'); if (preg_match('/(uploadimage)/', $this->getRequest()->getActionName())) { return $this; } $this->_current_device_id = $this->getRequest()->getParam('device_id'); $this->_current_app = Application_Model_Application::getInstance(); if ($customer_id = $this->getRequest()->getParam('customer_id')) { $customer->find($customer_id); if (!$customer->getId()) { $error = true; } else { $this->_current_customer = $customer; } } else { $this->_current_customer = $customer; } if (!$customer->getId()) { $error = true; } if ($error) { $this->_sendError(); } }
public function init() { parent::init(); /* * Initial instance of social plugin */ $this->_social = HTS_Api::getInstance()->getSocialPlugin(); $this->view->social = $this->_social; /* * Initial layout */ $this->_helper->layout->setLayout('hts_canvas'); /* * Check user authorize apps */ $this->_authenticate(); $this->_authorize(); /* * Get user infomation */ $this->_id_user = $this->_social->getIdUser(); $this->_id_social = $this->_social->getIdSocial(); $this->_user = $this->_social->getUser(); /* * Get all params */ $this->_params = $this->_getAllParams(); $this->_params['id_user'] = $this->_id_user; $this->_params['id_social'] = $this->_id_social; Zend_Registry::set('params', $this->_params); /* * Initial translate language */ $this->_initTranslator(); }
public function init() { parent::init(); $this->view->baseUrl = $this->_request->getBaseUrl(); $this->view->translate = Zend_Registry::get('translate'); $this->view->language = Zend_Registry::get('language'); $this->view->config = Zend_Registry::get('config'); // authentication if ($this->isAuth()) { $this->identity = Zend_Auth::getInstance()->getIdentity(); // for view $this->view->identity = $this->identity; /* * ACLs and cache */ $cache = Zend_Registry::get('cache'); // проверка, есть ли уже запись в кэше: if (!($this->webacula_acl = $cache->load('MyClass_WebaculaAcl'))) { // промах кэша $this->webacula_acl = new MyClass_WebaculaAcl(); $cache->save($this->webacula_acl, 'MyClass_WebaculaAcl'); } $this->view->webacula_acl = $this->webacula_acl; } // для переадресаций $this->_redirector = $this->_helper->getHelper('Redirector'); // acl $this->bacula_acl = new MyClass_BaculaAcl(); }
/** * Initialize the controller */ public function init() { parent::init(); // just good habit (nothing there currently) // make the view available to action controllers for holding presentation model $this->view = $this->getInvokeArg('view'); $this->view->baseUrl = $this->_request->getBaseUrl(); if (!empty($this->view->viewSuffix)) { // i.e. do not alter the view's filename suffix, if specified by the application $this->viewSuffix = $this->view->viewSuffix; } // now give the module a chance to initialize itself and the view used by the module's controllers $moduleName = $this->_request->getModuleName(); $class = 'ZFModule_' . ucfirst($moduleName); if (!class_exists($class)) { $registry = Zend_Registry::getInstance(); $moduleInit = $registry['appDir'] . $moduleName . DIRECTORY_SEPARATOR . $moduleName . '.php'; if (is_readable($moduleInit)) { include_once $moduleInit; } } if (class_exists($class, false) && method_exists($class, 'moduleInit')) { call_user_func(array($class, 'moduleInit'), $this->view); } }
public function init() { parent::init(); $ns = new Zend_Session_Namespace('user'); $general = new Application_Model_General(); $statUser = $general->veriStatUser($ns->data); if (!empty($ns->data)) { $this->view->firstname = $ns->data['firstname_user']; $this->view->lastname = $ns->data['lastname_user']; $this->view->lvl = $ns->data['id_rank']; } if ($statUser == 1 or $statUser == 2) { $this->view->isadmin = $statUser; } else { if ($statUser == 3) { Zend_Session::namespaceUnset("user"); Zend_Session::destroy(true); $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'acces'), null, true)); } } $this->category = new Application_Model_Category(); if ($this->_getParam('message') != null) { $this->view->message = "Modification sauvegarder"; } }
public function init() { parent::init(); // Messages $flashMessenger = new Zend_Controller_Action_Helper_FlashMessenger(); $this->view->messages = $flashMessenger->getMessages(); $flashMessenger->clearMessages(); }
public function init() { parent::init(); $this->setDispatcher(new sfEventDispatcher()); $this->_IDToken = $this->getSysSetting(Ht_Model_SystemSetting::KEY_CRYPT_KEY, $this->_IDToken); $this->_logAccess = (int) $this->getSysSetting(Ht_Model_SystemSetting::KEY_ACCESS_LOGGING, $this->_logAccess); $this->view->tr = Zend_Registry::get("tr"); }
public function init() { parent::init(); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { throw new Zend_Auth_Exception("You're not authorized to see this page"); } }
/** * @inheritdoc */ public function init() { parent::init(); $gateway = new Api_Model_TableGateway_Currency(['db' => Zend_Db_Table::getDefaultAdapter()]); $repository = new Api_Repository_Currency($gateway); $parser = new Api_CurrencyParser_Yahoo(); $this->_service = new Api_Service_Currency($repository, $parser); }
public function init() { parent::init(); $this->_session = new Zend_Session_Namespace('kmComputer'); $this->view->nameController = $this->getRequest()->getControllerName(); $this->view->nameAction = $this->getRequest()->getActionName(); $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); }
public function init() { if (null === $this->_getParam('error_handler')) { // No error parameters means that the controller has been accessed directly, which is disallowed. return $this->_redirect("/"); } parent::init(); }
/** * @throws \Zend_Controller_Response_Exception */ public function init() { parent::init(); $this->view->setRequest($this->getRequest()); // set content type if ($this->getResponse()->canSendHeaders()) { $this->getResponse()->setHeader("Content-Type", "text/html; charset=UTF-8", true); } }
public function init() { $view = Zend_Registry::get('view'); $helper = new vkNgine_View_Helper_PublicUrl(); $this->view->registerHelper($helper, 'publicUrl'); $this->view->t = Zend_Registry::get('t'); $this->t = Zend_Registry::get('t'); parent::init(); }
public function init() { /* Initialize action controller here */ parent::init(); if ($this->getRequest()->getActionName() != 'no-css.css') { $this->getResponse()->setHeader('Content-Type', 'text/css'); $this->_helper->redirector('no-css.css', 'css'); } }