示例#1
0
 /**
  * @todo expireSessionCookie()
  * @todo rememberMe(xx)
  * @todo forgetMe()
  * @see Zend_Registry::get('session');
  * @return Zend_Session_Namespace
  */
 protected function _initSession()
 {
     $options = $this->getOption('ca_mgr');
     $db = Zend_Db::factory($options['db']['session']['pdo'], $options['db']['session']);
     /**
      * automatically clean up expired session entries from session cache
      * use the modified and lifetime stamps to calculate expire time
      */
     if ($options['db']['session']['autocleanup'] == '1') {
         $stmt = $db->query('delete from front_session where (modified + lifetime * 2) < unix_timestamp()');
         # $stmt->execute();
     }
     //you can either set the Zend_Db_Table default adapter
     //or you can pass the db connection straight to the save handler $config
     // @see lifetimeColumn / lifetime / overrideLifetime, lifetime defaults to php.ini: session.gc_maxlifetime
     Zend_Db_Table_Abstract::setDefaultAdapter($db);
     $config = array('name' => 'front_session', 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime');
     //create your Zend_Session_SaveHandler_DbTable and
     //set the save handler for Zend_Session
     Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
     // Zend_Session::rememberMe(7200);
     //start your session!
     Zend_Session::start();
     $session = new Zend_Session_Namespace();
     if (!isset($session->started)) {
         $session->started = time();
     }
     if (!isset($session->authdata)) {
         $session->authdata = array('authed' => false);
     }
     Zend_Registry::set('session', $session);
     return $session;
 }
示例#2
0
 /**
  * init session
  */
 protected function _initSession()
 {
     Zend_Session::start();
     $session = new Zend_Session_Namespace();
     $session->lang = isset($session->lang) ? $session->lang : "pt_BR";
     Zend_Registry::set('session', new Zend_Session_Namespace());
 }
示例#3
0
 protected function _initSession()
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/sessions.ini', 'development');
     Zend_Session::setOptions($config->toArray());
     // start session
     Zend_Session::start();
 }
 function preDispatch()
 {
     $this->_helper->layout()->setLayout('layout-nosidebar');
     $saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
     $saveHandlerManager->setSaveHandler();
     Zend_Session::start();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->view->username = $username = "";
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
     }
     $sMenuAboutUs = '<ul class="sf-menu">';
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowset = $tblFolder->fetchChildren('lgs4a1bb86c12807');
     foreach ($rowset as $row) {
         $sMenuAboutUs .= $this->_traverseFolder($row->guid, '', 0);
     }
     $this->view->sMenuAboutUs = $sMenuAboutUs . '</ul>';
     $sMenuPrograms = '<ul class="sf-menu">';
     $rowset = $tblFolder->fetchChildren('lgs4a1c2bf0b0a6a');
     foreach ($rowset as $row) {
         $sMenuPrograms .= $this->_traverseFolder($row->guid, '', 0);
     }
     $this->view->sMenuPrograms = $sMenuPrograms . '</ul>';
     $sMenuMediaRoom = '<ul class="sf-menu">';
     $rowset = $tblFolder->fetchChildren('nlrp4a1c354d26b45');
     foreach ($rowset as $row) {
         $sMenuMediaRoom .= $this->_traverseFolder($row->guid, '', 0);
     }
     $this->view->sMenuMediaRoom = $sMenuMediaRoom . '</ul>';
 }
示例#5
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-store');
     $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/hol-site/layouts'));
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     //$loginUrl = ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn;
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect($loginUrl);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
     }
     $userId = $auth->getIdentity()->guid;
     $this->_userId = $userId;
     $tblUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance();
     $this->_userInfo = $tblUserFinance->find($userId)->current();
     $storeConfig = Pandamp_Application::getOption('store');
     $this->_configStore = $storeConfig;
 }
示例#6
0
 /**
  * Starts the session.
  */
 function start()
 {
     if (!\Zend_Session::isStarted()) {
         \Zend_Session::start();
     }
     // session started already
 }
示例#7
0
 /**
  * Setup db
  *
  */
 public function setup(Zend_Config $config)
 {
     $sessionConfig = $config->get('config');
     $configArray = $sessionConfig->toArray();
     // save_path handler
     $configArray = $this->_prependSavePath($configArray);
     // name handler
     $configArray = $this->_parseName($configArray);
     // Setup config
     Zend_Session::setOptions($configArray);
     // Setup save handling?
     $saveHandlerConfig = $config->get('save_handler');
     if ($className = $saveHandlerConfig->get('class_name')) {
         if ($args = $saveHandlerConfig->get('constructor_args')) {
             if ($args instanceof Zend_Config) {
                 $args = $args->toArray();
             } else {
                 $args = (array) $args;
             }
         } else {
             $args = array();
         }
         require_once 'Zend/Loader.php';
         Zend_Loader::loadClass($className);
         $saveHandler = new ReflectionClass($className);
         $saveHandler = $saveHandler->newInstanceArgs($args);
         Zend_Session::setSaveHandler($saveHandler);
     }
     // Autostart session?
     if ($config->get('auto_start')) {
         // Start session
         Zend_Session::start();
     }
 }
 /**
  *Upload File
  *
  */
 public function uploadAction()
 {
     $this->_loadParams();
     $dir = $this->_fields[$this->_request->getParam('field_id')]['params']['dir'];
     if (!Zend_Session::sessionExists() || !Zend_Session::isStarted()) {
         Zend_Session::start();
     }
     $uniqueName = Zend_Session::getId();
     $this->_genericFileHelper->createFieldDir($dir . DIRECTORY_SEPARATOR . stripcslashes($uniqueName), true);
     $destination = $dir . DIRECTORY_SEPARATOR . stripcslashes($uniqueName);
     $uploadSettings = $this->getParams($this->_request->getParam('field_id'));
     if (!isset($uploadSettings)) {
         //do something bcs there is no file types
     }
     $uploadSettings = array_merge($uploadSettings, array('dir' => $destination, 'field' => $this->_request->getParam('field_id')));
     $result = $this->_genericFileHelper->upload($uploadSettings);
     if ($result === false) {
         $result = array('success' => false, 'files' => array());
         $lastError = $this->_genericFileHelper->getLastErrorMessage();
         if ($lastError != '') {
             $result['error'] = $this->translate($lastError);
         }
         echo json_encode($result);
     } else {
         $result = array('success' => true, 'files' => array($result), 'path' => $result['path']);
         $lastError = $this->_genericFileHelper->getLastErrorMessage();
         if ($lastError != '') {
             $result['error'] = $this->translate($lastError);
         }
         echo json_encode($result);
     }
     die;
 }
示例#9
0
 public function init()
 {
     require_once MODELS_PATH . 'Categories.php';
     require_once MODELS_PATH . 'Users.php';
     require_once MODELS_PATH . 'UsersRights.php';
     require_once MODELS_PATH . 'Sentences.php';
     require_once MODELS_PATH . 'SentencesAlt.php';
     require_once MODELS_PATH . 'Images.php';
     require_once MODELS_PATH . 'Sounds.php';
     require_once MODELS_PATH . 'Videos.php';
     require_once MODELS_PATH . 'Contents.php';
     require_once MODELS_PATH . 'Tasks.php';
     require_once MODELS_PATH . 'Villes.php';
     require_once MODELS_PATH . 'Seo.php';
     require_once MODELS_PATH . 'Sites.php';
     require_once MODELS_PATH . 'Sites_Seo.php';
     require_once 'Custom/Referencement.php';
     Zend_Session::start();
     $this->session = new Zend_Session_Namespace('Authentification');
     $this->checkAuthentification();
     $this->view->controller = $this->getRequest()->getControllerName();
     $this->view->action = $this->getRequest()->getActionName();
     if (isset($this->session->id)) {
         $this->view->rights = $this->session->rights;
     }
     $this->UPLOAD_PATH = realpath(dirname(__FILE__) . '/../../public/images/database/');
     $this->UPLOAD_PATH_2 = realpath(dirname(__FILE__) . '/../../public/sounds/database/');
     $this->BACKUP_PATH = realpath(dirname(__FILE__) . '/../../public/backups/');
 }
 protected function _initSession()
 {
     Zend_Session::start();
     $sessionNamespace = new Zend_Session_Namespace($this->_config->appSettings->appName);
     Zend_Registry::set('sessionNamespace', $sessionNamespace);
     //Zend_Session::rememberMe();
 }
 public function init()
 {
     try {
         Zend_Session::start();
     } catch (Zend_Session_Exception $e) {
         session_start();
     }
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $info = Zend_Auth::getInstance()->getIdentity();
         $model = new Application_Model_DbTable_Usuarios();
         $usser = $model->traerdatoscliente($info);
         $this->view->datosuser = $usser;
         $layout = Zend_Layout::getMvcInstance();
         $view = $layout->getView();
         foreach ($usser as $user) {
             $id_user = $user->id_usuario;
             $tipo_user = $user->tipo_usuario;
             $permisoadmin = $user->permiso;
             $view->apellido = $user->apellido;
             $view->tipo_user = $user->tipo_usuario;
             $view->whatever = $user->foto_perfil;
             $view->name = $user->nombre;
             $view->ultimo = $user->ultimo_acceso;
             $view->permiso = $permisoadmin;
         }
     }
 }
示例#12
0
 protected function _initSession()
 {
     if ($this->hasPluginResource('session') && !Zend_Session::getSaveHandler()) {
         Zend_Session::setSaveHandler($this->getPluginResource('session')->getSaveHandler());
     }
     Zend_Session::start();
 }
示例#13
0
 public function _initSession()
 {
     Zend_Session::start();
     $defaultNameSpace = new Zend_Session_Namespace("defaultsession");
     $defaultNameSpace->setExpirationSeconds(7200);
     Zend_Registry::set("defaultsession", $defaultNameSpace);
 }
示例#14
0
 function preDispatch()
 {
     $this->view->addHelperPath(ROOT_DIR . '/library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
     $this->_helper->layout->setLayout('layout-membership');
     $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/membership/views/layouts'));
     Zend_Session::start();
 }
示例#15
0
 function preDispatch()
 {
     //don't check auth from here because the verificationAction SHOULD NOT USE ANY AUTHENTICATION METHOD
     /*
     - Load Configuration dari tabel kutupaymentSetting
     - set TestMode = True or False 
     */
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $this->_testMode = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where(" settingKey= 'testMode'"));
     $crc = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where("settingKey= 'currency'"));
     $this->_defaultCurrency = $crc[0]->settingValue;
     $usdIdrEx = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where(" settingKey= 'USDIDR'"));
     $this->_currencyValue = $usdIdrEx[0]->settingValue;
     $this->_helper->layout()->setLayout('layout-final-inside');
     $saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
     $saveHandlerManager->setSaveHandler();
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $sReturn = urlencode($sReturn);
     $this->view->returnTo = $sReturn;
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $rowSet = $tblPaymentSetting->fetchAll();
     //var_dump($rowSet);
     for ($iRow = 0; $iRow < count($rowSet); $iRow++) {
         $key = $rowSet[$iRow]->settingKey;
         $this->_paymentVars[$key] = $rowSet[$iRow]->settingValue;
     }
     $tblSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $this->_lgsMail = $tblSetting->fetchAll($tblSetting->select()->where("settingKey = 'paypalBusiness'"));
 }
 /**
  * check if email or password exists in database
  * @param array post data
  */
 protected function _checkAccount($post)
 {
     $login = new User_Model_Login();
     $loginStatus = array();
     $emailStatus = false;
     $passwordStatus = false;
     $adapter = $this->_getAuthAdapter();
     $adapter->setIdentity($post['user-email'])->setCredential($post['password']);
     require_once APPLICATION_PATH . '/../library/Zend/Auth.php';
     $auth = Zend_auth::getInstance();
     $result = $auth->authenticate($adapter);
     if ($result->isValid()) {
         //login successful
         Zend_Session::start();
         $user = $adapter->getResultRowObject();
         $auth->getStorage()->write($user);
         $user_session = new Zend_Session_Namespace('Zend_Auth');
         $user_session->email = Zend_Auth::getInstance()->getStorage()->read()->email;
         Zend_Session::rememberMe();
         $this->redirect('index/index');
     } else {
         if ($result->getCode() == Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND) {
             $this->view->loginStatus = '帳號不存在';
         } else {
             if ($result->getCode() == Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID) {
                 $this->view->loginStatus = '密碼錯誤';
             } else {
                 $this->view->loginStatus = '請重新登入';
             }
         }
     }
 }
示例#17
0
 protected function _initZFDebug()
 {
     if (getenv('APPLICATION_ENV') != 'production' && $this->_config->appSettings->debugMode == 1) {
         $autoloader = Zend_Loader_Autoloader::getInstance();
         $autoloader->registerNamespace('ZFDebug');
         Zend_Session::start();
         $options = array('plugins' => array('Variables', 'File' => array('base_path' => '/path/to/project'), 'Memory', 'Time', 'Registry', 'Exception'));
         # Instantiate the database adapter and setup the plugin.
         # Alternatively just add the plugin like above and rely on the autodiscovery feature.
         if ($this->hasPluginResource('db')) {
             $this->bootstrap('db');
             $db = $this->getPluginResource('db')->getDbAdapter();
             $options['plugins']['Database']['adapter'] = $db;
         }
         # Setup the cache plugin
         if ($this->hasPluginResource('cache')) {
             $this->bootstrap('cache');
             $cache = $this - getPluginResource('cache')->getDbAdapter();
             $options['plugins']['Cache']['backend'] = $cache->getBackend();
         }
         $debug = new ZFDebug_Controller_Plugin_Debug($options);
         $this->bootstrap('frontController');
         $frontController = $this->getResource('frontController');
         $frontController->registerPlugin($debug);
     }
 }
示例#18
0
 protected function _setupEnvironment()
 {
     error_reporting(E_ALL | E_STRICT);
     set_include_path($this->getPath('library') . PATH_SEPARATOR . $this->getPath('models') . PATH_SEPARATOR . $this->getPath('controllers') . PATH_SEPARATOR . get_include_path());
     require_once 'WebVista/Model/ORM.php';
     require_once 'User.php';
     require_once 'Person.php';
     require_once 'Zend/Session.php';
     require_once 'WebVista/Session/SaveHandler.php';
     Zend_Session::setSaveHandler(new WebVista_Session_SaveHandler());
     Zend_Session::start();
     require_once 'Zend/Loader.php';
     Zend_Loader::registerAutoLoad();
     $sessionTimeout = ini_get('session.gc_maxlifetime') - 5 * 60;
     Zend_Registry::set('sessionTimeout', $sessionTimeout);
     $this->_config = new Zend_Config_Ini($this->getPath('application') . "/config/app.ini", APPLICATION_ENVIRONMENT);
     Zend_Registry::set('config', $this->_config);
     Zend_Registry::set('baseUrl', substr($_SERVER['PHP_SELF'], 0, strpos(strtolower($_SERVER['PHP_SELF']), 'index.php')));
     Zend_Registry::set('basePath', $this->getPath('base') . DIRECTORY_SEPARATOR);
     try {
         date_default_timezone_set(Zend_Registry::get('config')->date->timezone);
     } catch (Zend_Exception $e) {
         die($e->getMessage());
     }
     AuditLog::setDbConfig($this->_config->database->toArray());
     // this MUST be required as this is used as DB connection
     // register shutdown function
     register_shutdown_function(array('AuditLog', 'closeConnection'));
     ob_start();
     // this MUST be required after register shutdown
     return $this;
 }
示例#19
0
 public function generateAction()
 {
     $this->_helper->layout->disableLayout();
     $req = $this->getRequest();
     $returnTo = $req->getParam('returnTo') ? $req->getParam('returnTo') : ROOT_URL;
     setcookie('returnMeTo', base64_decode($returnTo), null, '/');
     $flagSessionIdSent = false;
     if (isset($_GET['PHPSESSID']) && !empty($_GET['PHPSESSID'])) {
         $sessid = $_GET['PHPSESSID'];
         Zend_Session::setId($sessid);
         $flagSessionIdSent = true;
     }
     if ($flagSessionIdSent) {
         $saveHandlerManager = new Pandamp_Session_SaveHandler_Manager();
         $saveHandlerManager->setSaveHandler();
         Zend_Session::start();
         if (isset($_COOKIE['returnMeTo']) && !empty($_COOKIE['returnMeTo'])) {
             header("location: " . $_COOKIE['returnMeTo']);
             exit;
         }
     } else {
         $identity = Pandamp_Application::getResource('identity');
         $url = $identity->loginUrl;
         $sReturn = ROOT_URL . '/helper/synclogin/generate';
         $sReturn = base64_encode($sReturn);
         header("location: {$url}/?returnTo=" . $sReturn);
         exit;
     }
 }
示例#20
0
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     $config = $registry->get("config");
     $sessionConfig = $config['resources']['session'];
     $cookieLifetime = $sessionConfig['cookie_lifetime'];
     /* @todo fix issue of system with incoherent behavior when the session
        system has a issue, such as when the savehandler doesn't work as
        expected when it's off-line which results in differents
        catched / uncatched exception when the resource (page) loads
        */
     $saveHandler = new Ml_Session_SaveHandler_PlusCache($registry->get("memCache"), $config['session']['prefix'], $config['lastActivity']['prefix']);
     Zend_Session::setSaveHandler($saveHandler);
     Zend_Session::getSaveHandler()->setLifetime($cookieLifetime, true);
     Zend_Session::start();
     $defaultNamespace = new Zend_Session_Namespace();
     if (!isset($defaultNamespace->initialized)) {
         Zend_Session::regenerateId();
         $defaultNamespace->initialized = true;
     }
     if ($auth->hasIdentity()) {
         $people = Ml_Model_People::getInstance();
         $signedUserInfo = $people->getById($auth->getIdentity());
         $registry->set('signedUserInfo', $signedUserInfo);
     }
     $globalHash = Ml_Model_MagicCookies::getInstance()->getLast(true);
     $registry->set("globalHash", $globalHash);
 }
示例#21
0
 function preDispatch()
 {
     $this->_helper->layout()->setLayout('layout-final-inside');
     $saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
     $saveHandlerManager->setSaveHandler();
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $sReturn = urlencode($sReturn);
     $this->view->returnTo = $sReturn;
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect(KUTU_ROOT_URL . '/helper/sso/login' . '?returnTo=' . $sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
     }
     $userId = $auth->getIdentity()->guid;
     $tblUserFinance = new Kutu_Core_Orm_Table_UserFinance();
     $this->_userInfo = $tblUserFinance->find($userId)->current();
     //$config = new Zend_Config_Ini(CONFIG_PATH.'/store.ini', APPLICATION_ENV);
     $registry = Zend_Registry::getInstance();
     $reg = $registry->get(ZEND_APP_REG_ID);
     $storeConfig = $reg->getOption('store');
     $this->_configStore = $storeConfig;
 }
示例#22
0
 function preDispatch()
 {
     Zend_Session::start();
     $this->_helper->layout->setLayout('layout-store-payment');
     $this->_testMode = false;
     //$this->_testMode=true;
 }
示例#23
0
 /**
  * When the user actually submits their otp, this authenticates it.
  */
 public function submitAction()
 {
     $this->disableLayout();
     $this->disableView();
     Zend_Session::start();
     $mfaSession = new Zend_Session_Namespace('Mfa_Temp_User');
     $user = $mfaSession->Dao;
     if (!isset($user) || !$user) {
         echo JsonComponent::encode(array('status' => 'error', 'message' => 'Session has expired, refresh and try again'));
         return;
     }
     $otpDevice = $this->Mfa_Otpdevice->getByUser($user);
     if (!$otpDevice) {
         throw new Zend_Exception('User does not have an OTP device');
     }
     $token = $this->getParam('token');
     try {
         $valid = $this->ModuleComponent->Otp->authenticate($otpDevice, $token);
     } catch (Zend_Exception $exc) {
         $this->getLogger()->crit($exc->getMessage());
         echo JsonComponent::encode(array('status' => 'error', 'message' => $exc->getMessage()));
         return;
     }
     if ($valid) {
         session_start();
         $authUser = new Zend_Session_Namespace('Auth_User');
         $authUser->setExpirationSeconds(60 * Zend_Registry::get('configGlobal')->session->lifetime);
         $authUser->Dao = $user;
         $authUser->lock();
         $this->getLogger()->debug(__METHOD__ . ' Log in : ' . $user->getFullName());
         echo JsonComponent::encode(array('status' => 'ok'));
     } else {
         echo JsonComponent::encode(array('status' => 'error', 'message' => 'Incorrect token'));
     }
 }
示例#24
0
 public function setUp()
 {
     if (headers_sent()) {
         $this->markTestSkipped('Cannot test: cannot start session because headers already sent');
     }
     Zend_Session::start();
 }
    public function setUp()
    {
        $savePath = ini_get('session.save_path');
        if (strpos($savePath, ';')) {
            $savePath = explode(';', $savePath);
            $savePath = array_pop($savePath);
        }
        if (empty($savePath)) {
            $this->markTestSkipped('Cannot test FlashMessenger due to unavailable session save path');
        }

        if (headers_sent()) {
            $this->markTestSkipped('Cannot test FlashMessenger: cannot start session because headers already sent');
        }
        Zend_Session::start();

        $this->front      = Zend_Controller_Front::getInstance();
        $this->front->resetInstance();
        $this->front->setControllerDirectory(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . '_files');
        $this->front->returnResponse(true);
        $this->request    = new Zend_Controller_Request_Http();
        $this->request->setControllerName('helper-flash-messenger');
        $this->response   = new Zend_Controller_Response_Cli();
        $this->controller = new HelperFlashMessengerController($this->request, $this->response, array());
        $this->helper     = new Zend_Controller_Action_Helper_FlashMessenger($this->controller);
    }
 function preDispatch()
 {
     /*
     - Load Configuration dari tabel kutupaymentSetting
     - set TestMode = True or False 
     */
     $this->_testMode = true;
     $this->_defaultCurrency = 'USD';
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $usdIdrEx = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where(" settingKey= 'USDIDR'"));
     $this->_currencyValue = $usdIdrEx[0]->settingValue;
     $this->_helper->layout()->setLayout('layout-final-inside');
     $saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
     $saveHandlerManager->setSaveHandler();
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $sReturn = urlencode($sReturn);
     $this->view->returnTo = $sReturn;
     $registry = Zend_Registry::getInstance();
     $config = $registry->get('config');
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $rowSet = $tblPaymentSetting->fetchAll();
     //var_dump($rowSet);
     for ($iRow = 0; $iRow < count($rowSet); $iRow++) {
         $key = $rowSet[$iRow]->settingKey;
         $this->_paymentVars[$key] = $rowSet[$iRow]->settingValue;
     }
     $tblSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $this->_lgsMail = $tblSetting->fetchAll($tblSetting->select()->where("settingKey = 'paypalBusiness'"));
 }
示例#27
0
 protected function _initDoctype()
 {
     Zend_Session::start();
     // $this->bootstrap('view');
     // $view = $this->getResource('view');
     // $view->doctype('XHTML1_STRICT');
 }
示例#28
0
 public function createForm($malo)
 {
     Zend_Session::start();
     $mysession = new Zend_Session_Namespace('Zend_Auth');
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formmoi/taotp.phtml')), 'Form'));
     if ($mysession->checked) {
         foreach ($mysession->checked as $key => $item) {
             $edit = $this->createElement('text', $item . '', array('decorators' => array('ViewHelper'), 'label' => 'Chọn'));
             $edit->setAttrib('class', 'thanhpham');
             $this->addElement($edit);
         }
     }
     $data = new My_Data();
     $opTP = $data->getOpKhoWithName("Kho Thành Phẩm");
     $thanhpham = $this->createElement('select', 'khotp', array('multioptions' => $opTP, 'decorators' => array('ViewHelper')));
     $thanhpham->setAttrib('class', 'thanhpham');
     $this->addElement($thanhpham);
     $lonhuom = $this->createElement('hidden', 'malonhuom', array('decorators' => array('ViewHelper')));
     $lonhuom->setValue($malo);
     $this->addElement($lonhuom);
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Thêm'));
     $them->setAttrib('class', 'btn btn-primary');
     $this->addElement($them);
 }
示例#29
0
 public function start()
 {
     Varien_Profiler::start(__METHOD__ . '/setOptions');
     $options = array('save_path' => Mage::getBaseDir('session'), 'use_only_cookies' => 'off', 'throw_startup_exceptions' => E_ALL ^ E_NOTICE);
     if ($this->getCookieDomain()) {
         $options['cookie_domain'] = $this->getCookieDomain();
     }
     if ($this->getCookiePath()) {
         $options['cookie_path'] = $this->getCookiePath();
     }
     if ($this->getCookieLifetime()) {
         $options['cookie_lifetime'] = $this->getCookieLifetime();
     }
     Zend_Session::setOptions($options);
     Varien_Profiler::stop(__METHOD__ . '/setOptions');
     /*
             Varien_Profiler::start(__METHOD__.'/setHandler');
             $sessionResource = Mage::getResourceSingleton('core/session');
             if ($sessionResource->hasConnection()) {
                 Zend_Session::setSaveHandler($sessionResource);
             }
             Varien_Profiler::stop(__METHOD__.'/setHandler');
     */
     Varien_Profiler::start(__METHOD__ . '/start');
     Zend_Session::start();
     Varien_Profiler::stop(__METHOD__ . '/start');
     return $this;
 }
 function start($environment = "dev")
 {
     try {
         require_once 'Zend/Loader/PluginLoader.php';
         Zend_Loader::registerAutoload();
         # Inicializa o Config
         $fConfig = new Zend_Config_Ini($this->_basepath . "/application/config/config.ini", $environment);
         # start a session app
         Zend_Session::start();
         # load env data
         $db = $fConfig->application->db;
         # Register the session
         Zend_Registry::set("db", $db);
         # start the front
         $front = Zend_Controller_Front::getInstance();
         //Set the Layout
         Zend_Layout::startMvc(array("layoutPath" => $this->_basepath . "/application/layout/"));
         $front->throwExceptions(true);
         $front->setParam('noViewRendred', true);
         $front->setParam('noErrorHandler', true);
         $front->setControllerDirectory($this->_basepath . "/application/modules/default/controllers/");
         $front->dispatch();
     } catch (Exception $e) {
         $contentType = "text/html";
         header("Content-Type: {$contentType}; charset=utf-8");
         var_dump($e->getMessage());
     }
 }