Пример #1
0
 public function loginAction()
 {
     try {
         $this->_helper->layout->disableLayout();
         $request = $this->getRequest();
         $sessionNamespace = new Zend_Session_Namespace();
         if ($sessionNamespace->loginAuth == true) {
             $this->_helper->redirector('index', 'index', 'gyuser');
         }
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_OperatorDataMapper();
             $Obj = new Gyuser_Model_Operator();
             if ($request->user_name) {
                 $Obj->setEmail($request->user_name);
             }
             if ($request->password) {
                 $Obj->setPassword($request->password);
             }
             $result = $mapper->LoginAuth($Obj);
             if ($result->getId()) {
                 $sessionNamespace = new Zend_Session_Namespace();
                 $sessionNamespace->loginAuth = true;
                 $sessionNamespace->authDetail = $result;
                 $sessionNamespace->setExpirationSeconds(7 * 24 * 60 * 60, 'a');
                 $this->_helper->redirector('dashboard', 'index', 'gyuser');
             } else {
                 $this->view->invalid = true;
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
Пример #2
0
 function clearSessionBYStep($step)
 {
     $session_step = new Zend_Session_Namespace('bookcitytour');
     if ($step == 1) {
         $session_step->unsetAll();
         // 			$session_step->pickup_date =null;
         // 			$session_step->pickup_time = null;
         // 			$session_step->pickup_mins = null;
         // 			$session_step->step2 =0;
         // 			$session_step->return_date = null;
         // 			$session_step->return_time =null;
         // 			$session_step->return_mins =null;
         // 			$session_step->vehiclevaliable = null;
     } elseif ($step == 2) {
         $session_step->step3 = 0;
         $session_step->vehicle_id = null;
         //$data get parram store value only not array
         $session_step->price = 0;
         $session_step->guideavaliable = null;
         $session_step->vehicle_name = null;
         $session_step->guide_id = null;
         $session_step->step4 = 0;
         $session_step->guidename = null;
         $session_step->guideprice = null;
     } elseif ($step == 3) {
         $session_step->guide_id = null;
         $session_step->step4 = 0;
         $session_step->guidename = null;
         $session_step->guideprice = null;
     }
 }
 public function indexAction()
 {
     $this->view->headTitle("uiwiki-登陆");
     if ($this->getRequest()->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $filter = new Zend_Filter_StripTags();
         //表单的post值
         $name = $filter->filter($this->_request->getPost('name'));
         $password = $filter->filter($this->_request->getPost('password'));
         if (!empty($name)) {
             $authAdapter = new Zend_Auth_Adapter_DbTable();
             $authAdapter->setTableName('ui_project')->setIdentityColumn('name')->setCredentialColumn('password')->setIdentity($name)->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             // 执行认证查询,并保存结果
             if ($result->isValid()) {
                 $data = $authAdapter->getResultRowObject(array('name', 'id'));
                 if ($auth->hasIdentity()) {
                     //auth之后写入session
                     $user = new Zend_Session_Namespace('user');
                     $user->name = $data->name;
                     $user->id = $data->id;
                     $user->setExpirationSeconds(6000);
                     //命名空间 "user" 将在第一次访问后 6000 秒过期
                     //echo '<h3><font color=red> 登录成功!</font></h3>';
                     $this->_redirect('/' . $name);
                 }
             } else {
                 echo '<h3><font color=red> 登录失败,请重新登录!</font></h3>';
             }
         }
     }
 }
Пример #4
0
 public function logoutAction()
 {
     Zend_Auth::getInstance()->clearIdentity();
     $session = new Zend_Session_Namespace('userSession');
     $session->unsetAll();
     $this->_redirect("/giris/index");
 }
Пример #5
0
 /**
  * Constructor
  *
  * @param string $sessionId
  */
 public function __construct($sessionId)
 {
     // session storage
     $this->_session = new \Zend_Session_Namespace(__CLASS__ . $sessionId);
     $this->_session->setExpirationSeconds($this->_expiration);
     // 3 hours
 }
Пример #6
0
 public function _initSession()
 {
     Zend_Session::start();
     $defaultNameSpace = new Zend_Session_Namespace("defaultsession");
     $defaultNameSpace->setExpirationSeconds(7200);
     Zend_Registry::set("defaultsession", $defaultNameSpace);
 }
Пример #7
0
 public function indexAction()
 {
     $this->_helper->layout()->setLayout("blank");
     $auth = new Zend_Session_Namespace('Zend_Auth');
     $auth->unsetAll();
     return $this->_redirect('/index');
 }
Пример #8
0
 /**
  * Checks whether the user is authorized to use a specific module
  * @param \Zend_Session_Namespace $session The session namespace
  * @param string $url The URL to check against
  * @return boolean
  */
 public static function isAuthorized(\Zend_Session_Namespace $session, $url)
 {
     $authorized = false;
     $module = Functions::getModuleNameFromURL($url);
     switch ($session->getNamespace()) {
         case 'internal':
             $visitor_ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?: $_SERVER['REMOTE_ADDR'];
             $authorized = static::cidrCheck($visitor_ip, unserialize(ALLOWED_IPS)) && static::checkUserPrivileges($session->user_name, $module);
             break;
         case 'student':
             $authorized = $module === 'student';
             break;
         case 'faculty':
             $authorized = $module === 'faculty';
             break;
         case 'professor':
             $authorized = $module === 'professor';
             break;
         case 'cron':
             $authorized = true;
             break;
         default:
             throw new \InvalidArgumentException('Invalid user class.');
     }
     // @TODO Move to a callback function
     if (!$authorized) {
         header('Location: https://' . URL_CUSTOM_HANDLERS . '/403.php');
         exit;
     }
     return $authorized;
 }
Пример #9
0
 protected function autenticacao($isAjax = false)
 {
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         if ($isAjax) {
             // if is ajax request, let js handle redirect properly ;)
             $session = new Zend_Session_Namespace();
             if (isset($session->url)) {
                 unset($session->url);
             }
             $this->view->error = _("Permission denied.");
             $this->_response->setHttpResponseCode(403);
             return false;
         } else {
             $session = new Zend_Session_Namespace();
             $session->setExpirationSeconds(60 * 60 * 1);
             // 1 minuto
             $session->url = $_SERVER['REQUEST_URI'];
             return $this->_helper->redirector->goToRoute(array(), 'login', true);
         }
     }
     $sessao = Zend_Auth::getInstance()->getIdentity();
     if (!$sessao["administrador"]) {
         if ($this->getRequest()->isXmlHttpRequest()) {
             $this->view->error = _("Unauthorized.");
             $this->_response->setHttpResponseCode(401);
             return false;
         } else {
             return $this->_helper->redirector->goToRoute(array('controller' => 'participante', 'action' => 'index'), 'default', true);
         }
     }
     return true;
 }
 /**
  * Initialize session
  */
 protected function _initSes()
 {
     $ses = new \Zend_Session_Namespace(self::SESSION_NAMESPACE, true);
     $ses->setExpirationHops(5, null, true);
     $ses->setExpirationSeconds(60 * 60 * 24);
     $this->_ses = $ses;
 }
Пример #11
0
 public function logarAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $resposta = array();
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('sca_usuario')->setIdentityColumn('login_usuario')->setCredentialColumn('password_usuario')->getDbSelect()->join(array('g' => 'sca_grupo'), 'g.id_grupo = sca_usuario.id_grupo', array('nm_grupo', 'is_root'));
     $authAdapter->setIdentity($this->getRequest()->getParam('login_usuario'))->setCredential($this->getRequest()->getParam('password_usuario'))->setCredentialTreatment('MD5(?) and st_usuario = 1');
     //Realiza autenticacao
     $result = $authAdapter->authenticate();
     //Verifica se a autenticacao foi validada
     if ($result->isValid()) {
         //obtem os dados do usuario
         $usuario = $authAdapter->getResultRowObject();
         //Armazena seus dados na sessao
         $storage = Zend_Auth::getInstance()->getStorage();
         $storage->write($usuario);
         // se não for para lembrar os dados expira a sessao em 30 minutos
         if (!$this->getRequest()->getParam('lembrar')) {
             $session = new Zend_Session_Namespace('Zend_Auth');
             $session->setExpirationSeconds(1800);
         }
         //Redireciona para o Index
         $resposta['situacao'] = "success";
         $resposta['msg'] = "Logando aguarde...";
     } else {
         $resposta['situacao'] = "error";
         $resposta['msg'] = "Usuário inativo ou senha incorreta.";
     }
     echo json_encode($resposta);
 }
Пример #12
0
 public function init()
 {
     $langNamespace = new Zend_Session_Namespace('Lang');
     $config = Zend_Registry::get('config');
     if ($langNamespace->lang == null) {
         //$config = Zend_Registry::get('config');
         $defaultLanguage = strval($config->framework->language->default);
         $langNamespace->lang = $defaultLanguage;
     }
     $this->view->home = $config->app->home;
     $this->view->joomlahome = $config->joomla->home;
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $authNamespace = new Zend_Session_Namespace('Zend_Auth');
         $this->_currentUser = $authNamespace->user;
         //2011-04-08 ham.bao separate the sessions with admin
         $this->_currentAdmin = $authNamespace->admin;
         $this->_currentClient = $authNamespace->client;
         $this->view->currentUser = $this->_currentUser;
         $authNamespace->setExpirationSeconds(12 * 60 * 60);
     }
     $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('adminajax', 'json')->initContext();
     $this->initView();
 }
Пример #13
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'));
     }
 }
Пример #14
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $params = $request->getParams();
     $auth = Zend_Auth::getInstance();
     Zend_Registry::set('Zend_Auth', $auth);
     if ($auth->hasIdentity()) {
         $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
         $identity = $auth->getIdentity();
         $userDb = new Users_Model_DbTable_User();
         $user = array('id' => $identity->id, 'username' => $identity->username, 'name' => $identity->name, 'email' => $identity->email, 'clientid' => $identity->clientid);
         $authNamespace = new Zend_Session_Namespace('Zend_Auth');
         $authNamespace->user = $user['username'];
         if ($_SESSION['__ZF']['Zend_Auth']['ENT'] - time() < 3600) {
             $authNamespace->setExpirationSeconds(3600);
         }
         Zend_Registry::set('User', $user);
         $view->user = $user;
         $clientDb = new Application_Model_DbTable_Client();
         $client = $clientDb->getClient($user['clientid']);
         Zend_Registry::set('Client', $client);
     } elseif ($params['module'] != 'users' && $params['action'] != 'login') {
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
         if (isset($params['id']) && $params['id']) {
             $redirector->gotoSimple('login', 'user', 'users', array('url' => $params['module'] . '|' . $params['controller'] . '|' . $params['action'] . '|' . $params['id']));
         } else {
             $redirector->gotoSimple('login', 'user', 'users', array('url' => $params['module'] . '|' . $params['controller'] . '|' . $params['action']));
         }
     }
 }
Пример #15
0
 public function loginAction()
 {
     if (!$this->getRequest()->isPost()) {
         return $this->_forward('index');
     }
     $form = $this->getForm();
     if (!$form->isValid($_POST)) {
         // Falla la validación; Se vuelve a mostrar el formulario
         $this->view->form = $form;
         return $this->render('form');
     }
     $username = $form->getValue('username');
     $password = $form->getValue('password');
     $remember = $form->getValue('remember');
     $usuario = new Application_Model_Usuario();
     $result = $usuario->validarLogin($username, $password);
     if (!$result->isValid()) {
         // Autenticación fallida, imprime el porque
         return $this->_redirect('/');
     } else {
         $usuario->setIdUsuario($result->getIdentity());
         $mysession = new Zend_Session_Namespace('sesion');
         $mysession->actividad = 'SI';
         $mysession->setExpirationSeconds(60 * 5, 'actividad');
         //$mysession->usuario_id =  $usuario->getIdUsuario();
         $mysession->usuario_nombre = $result->getIdentity();
         $_SESSION['username'] = strtoupper($mysession->usuario_nombre);
         $aux = $usuario->getUsuariobyNombreUsuario($mysession->usuario_nombre);
         $mysession->usuario_id = $aux[0]['iUsuIdUsuario'];
         $mysession->tipo_usuario = $aux[0]['TipoUsuario_iTiUsuarioIdTipoUsuario'];
         $log = new Application_Model_Logs();
         $log->crearLog('A');
         $this->redireccionar();
     }
 }
Пример #16
0
 /**
  * Test if login passes with user not logged it
  */
 public function testLoginWithoutSession()
 {
     $this->setExpectedException('Phprojekt_Auth_UserNotLoggedInException');
     $authNamespace = new Zend_Session_Namespace('Phprojekt_Auth-login');
     $authNamespace->unsetAll();
     Phprojekt_Auth::isLoggedIn();
 }
 public function init()
 {
     $this->verificarInactividad();
     $mysession = new Zend_Session_Namespace('sesion');
     $mysession->setExpirationSeconds(60 * 3, 'actividad');
     /* Initialize action controller here */
 }
Пример #18
0
 /**
  * Renders the first form:
  * a list of available document types (that can be configured in config.ini
  * and different upload fields
  *
  * @return void
  *
  */
 public function indexAction()
 {
     $session = new Zend_Session_Namespace('Publish');
     //unset all possible session content
     $session->unsetAll();
     $this->view->title = 'publish_controller_index';
     $form = new Publish_Form_PublishingFirst();
     $this->view->action_url = $this->view->url(array('controller' => 'form', 'action' => 'upload'));
     $this->view->showBib = $form->bibliographie;
     $this->view->showRights = $form->showRights;
     $this->view->enableUpload = $form->enableUpload;
     if (!$form->enableUpload) {
         $this->view->subtitle = 'publish_controller_index_sub_without_file';
     } else {
         $this->view->subtitle = 'publish_controller_index_sub';
     }
     //initialize session variables
     // TODO hide initialization routine
     $session->documentType = "";
     $session->documentId = "";
     $session->additionalFields = array();
     $config = $this->getConfig();
     if (isset($config->publish->filetypes->allowed)) {
         $this->view->extensions = $config->publish->filetypes->allowed;
     }
     // Quick bug fix for OPUSVIER-3564
     $translate = Zend_Registry::get('Zend_Translate');
     if ($translate->isTranslated('tooltip_documentType')) {
         $this->view->documentType['hint'] = 'tooltip_documentType';
     }
 }
Пример #19
0
 public function indexAction()
 {
     $ns = new Zend_Session_Namespace('login');
     $ns->unsetAll();
     $this->_redirect('manager');
     $this->_helper->viewRenderer->setNoRender();
 }
Пример #20
0
 public function init()
 {
     //set timeout
     $this->_sessionAdmin = new Zend_Session_Namespace(Zend_Auth_Storage_Session::NAMESPACE_DEFAULT);
     $this->_sessionAdmin->setExpirationSeconds(30 * 60);
     //load acl
     $aclLoader = HCMS_Acl_Loader::getInstance();
     $aclLoader->load();
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         $this->_admin = null;
     } else {
         $this->_admin = Zend_Auth::getInstance()->getIdentity();
         $aclLoader->setCurrentRoleCode($aclLoader->getRoleCode($this->_admin->get_role_id()));
     }
     $this->view->admin = $this->_admin;
     if ($this->_checkAuth) {
         $this->_checkAuthorization();
     }
     $this->_redirect_to_ssl();
     $this->_checkIP();
     //set ACL object for Zend_Navigation
     Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($aclLoader->getAcl());
     Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole($aclLoader->getCurrentRoleCode());
     $this->_initVersionInfo();
     $this->_module = new Application_Model_Module();
     if (Application_Model_ModuleMapper::getInstance()->findByCode($this->getRequest()->getModuleName(), $this->_module)) {
         $this->view->moduleSettings = $this->_module->get_settings();
     }
     parent::init();
 }
Пример #21
0
    public function loginAction()
    {
        // Don't allow logged in people here
        $user = Zend_Auth::getInstance()->getIdentity();
        if ($user !== null) {
            $this->_redirect('/');
        }

        $this->view->title = 'Log in';
        if ($this->_request->isPost()) {
            // collect the data from the user
            $f = new Zend_Filter_StripTags();
            $username = $f->filter($this->_request->getPost('handle'));
            $password = $f->filter($this->_request->getPost('password'));

            if (empty($username) || empty($password)) {
                $this->addErrorMessage('Please provide a username and password.');
            } else {
                // do the authentication
                $authAdapter = $this->_getAuthAdapter($username, $password);
                $auth   = Zend_Auth::getInstance();
                $result = $auth->authenticate($authAdapter);

                if ($result->isValid()) {
                    $auth->getStorage()->write($authAdapter->getResult());

                    // Receive Zend_Session_Namespace object
                    $session = new Zend_Session_Namespace('Zend_Auth');
                    // Set the time of user logged in
                    $session->setExpirationSeconds(24*3600);

                    // If "remember" was marked
                    if ($this->getRequest()->getParam('rememberme') !== null) {
                        // remember the session for 604800s = 7 days
                        Zend_Session::rememberMe(604800);
                    }

                    $ns = new Zend_Session_Namespace('lastUrl');
                    $lastUrl = $ns->value;
                    if ($lastUrl !== '') {
                        $ns->value = '';

                        // If our last request was an tester ajax request just
                        // go back to /tester
                        $lastUrl = (strpos($lastUrl,'/tester/ajax') === false) ? $lastUrl : '/tester';

                        $this->_redirect($lastUrl);
                    }

                    $this->_redirect('/');
                } else {
                    // failure: clear database row from session
                    $this->addErrorMessage('Login failed.');
                }
            }
        } else {
            $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden');
        }
    }
Пример #22
0
 /**
  * Setzt alle Daten des Layouts aus den Einstellungsdateien
  * @throw Zend_Controller_Dispatcher_Exception
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $modulename = $this->getRequest()->getModuleName();
     $this->view->modulename = $modulename;
     $controllername = $this->getRequest()->getControllerName();
     $this->view->controllername = $controllername;
     $actionname = $this->getRequest()->getActionName();
     $recordAccount = null;
     if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') && Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) {
         $sessionNamespace = new Zend_Session_Namespace();
         if (isset($sessionNamespace->sessionhash)) {
             $logicSession = new DragonX_Account_Logic_Session();
             try {
                 $recordAccount = $logicSession->getAccount($sessionNamespace->sessionhash);
                 $this->view->sessionhash = $sessionNamespace->sessionhash;
                 Zend_Registry::set('recordAccount', $recordAccount);
                 $this->view->recordAccount = $recordAccount;
                 $logicEmailaddress = new DragonX_Emailaddress_Logic_Emailaddress();
                 $this->view->recordEmailaddress = $logicEmailaddress->getEmailaddress($recordAccount);
                 $logicDeletion = new DragonX_Account_Logic_Deletion();
                 $recordDeletion = $logicDeletion->getDeletion($recordAccount);
                 if (isset($recordDeletion)) {
                     $this->view->recordDeletion = $recordDeletion;
                 }
             } catch (Exception $exception) {
                 $sessionNamespace->unsetAll();
                 if ($modulename == 'homepage' && $controllername == 'account' && $actionname == 'logout') {
                     $this->_helper->FlashMessenger('<div class="alert alert-success">Abmeldung erfolgreich</div>');
                 } else {
                     $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session ist abgelaufen. Profil muss neu angemeldet werden</div>');
                 }
             }
         }
     }
     $this->view->configApplication = new Dragon_Application_Config('dragon/application/application');
     $modulenamearray = explode('_', $modulename);
     $controllerarea = end($modulenamearray);
     $this->view->controllerarea = $controllerarea;
     switch ($controllerarea) {
         case 'homepage':
             $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/homepage');
             break;
         case 'administration':
             if (!Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') || !Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) {
                 throw new Dragon_Application_Exception_User('incorrect controller', array('controllername' => $controllername));
             }
             if (!isset($recordAccount)) {
                 $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session wurde noch nicht gestartet oder ist abgelaufen. Profil muss angemeldet werden</div>');
                 $this->_redirect('account/showlogin?' . http_build_query(array('redirect' => $modulename . '/' . $controllername . '/' . $actionname)));
             }
             if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Acl')) {
                 $logicAcl = new DragonX_Acl_Logic_Acl();
                 $this->view->resources = $logicAcl->getResources($recordAccount);
             }
             $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/administration');
             break;
     }
 }
Пример #23
0
 public function unsetSession($name = null)
 {
     $ynblog_search = new Zend_Session_Namespace($name);
     // Search field
     if (isset($ynblog_search->session_array)) {
         $ynblog_search->__unset('session_array');
     }
 }
Пример #24
0
 public function createRole($option = null)
 {
     $ns = new Zend_Session_Namespace('info');
     $nsInfo = $ns->getIterator();
     $info = $nsInfo['group'];
     $group_name = $info['group_name'];
     $ns->acl['role'] = $group_name;
 }
Пример #25
0
 public function logoutAction()
 {
     $this->getHelper('viewRenderer')->setNoRender();
     //remove other display
     $ud = new Zend_Session_Namespace("visitor");
     $ud->unsetAll();
     $this->_helper->redirector("index", "index", "default");
 }
Пример #26
0
 public function logout()
 {
     $userProfileNamespace = new Zend_Session_Namespace('sesion');
     $userProfileNamespace->unLock();
     $log = new Application_Model_Logs();
     $log->crearLog('B');
     Zend_Session::destroy(true);
 }
 public function logoutAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $authNamespace = new Zend_Session_Namespace('identify');
     $authNamespace->unsetAll();
     $this->_redirect('/');
 }
 /**
  * Only page user sees, sets up the component and stores in session
  * 
  * @return void
  */
 public function index()
 {
     $ns = new Zend_Session_Namespace('quiz');
     $ns->unsetAll();
     $quiz = new MowattMedia_Components_Quiz();
     $values = $quiz->populate();
     $ns->quiz = serialize($quiz);
 }
Пример #29
0
 public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_user = new Zend_Session_Namespace('search_user');
     if (empty($session_search_user->limit)) {
         $session_search_user->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_user->active = -1;
         $session_search_user->user_type = -1;
         $session_search_user->txtsearch = '';
         $session_search_user->lock();
     }
     //start page nevigation
     $limit = $session_search_user->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $db_user = new Application_Model_DbTable_DbUsers();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_user->active;
     $this->view->user_typelist = $this->user_typelist;
     $this->view->user_type = $session_search_user->user_type;
     if ($this->getRequest()->isPost()) {
         $user_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_user->unlock();
         $session_search_user->limit = $user_seach_data['rows_per_page'];
         $session_search_user->active = $user_seach_data['active'];
         $session_search_user->user_type = $user_seach_data['user_type'];
         $session_search_user->txtsearch = $user_seach_data['txtsearch'];
         $session_search_user->lock();
         //set value for display
         $this->view->txtsearch = $user_seach_data['txtsearch'];
         $this->view->active = $user_seach_data['active'];
         $this->view->user_type = $user_seach_data['user_type'];
         $limit = $user_seach_data['rows_per_page'];
         $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
         $record_count = $db_user->getUserListTotal($user_seach_data);
     } else {
         if ($session_search_user->active > -1 || $session_search_user->user_type > -1 || !empty($session_search_user->txtsearch)) {
             $user_seach_data = array('active' => $session_search_user->active, 'user_type' => $session_search_user->user_type, 'txtsearch' => $session_search_user->txtsearch);
             $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
             $record_count = $db_user->getUserListTotal($user_seach_data);
         } else {
             $users = $db_user->getUserList($start, $limit);
             $record_count = $db_user->getUserListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($users as $i => $user) {
         $result[$i] = array('num' => ++$row_num, 'name' => $user['name'], 'id' => $user['id'], 'user_name' => $user['user_name'], 'active' => $this->activelist[$user['active']], 'user_type' => $this->user_typelist[$user['user_type']]);
     }
     $this->view->userlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_users');
     $this->view->result_row = $page->getResultRows();
 }
Пример #30
0
 public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_agent = new Zend_Session_Namespace('search_agent');
     if (empty($session_search_agent->limit)) {
         $session_search_agent->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_agent->active = -1;
         $session_search_agent->province = -1;
         $session_search_agent->txtsearch = '';
         $session_search_agent->lock();
     }
     //start page nevigation
     $limit = $session_search_agent->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $pro = new Application_Model_DbTable_DbProvinces();
     $this->view->provincelist = $pro->getProvinceList();
     $this->view->province = $session_search_agent->province;
     $db_agent = new Application_Model_DbTable_DbAgents();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_agent->active;
     if ($this->getRequest()->isPost()) {
         $agent_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_agent->unlock();
         $session_search_agent->limit = $agent_seach_data['rows_per_page'];
         $session_search_agent->active = $agent_seach_data['active'];
         $session_search_agent->province = $agent_seach_data['province'];
         $session_search_agent->txtsearch = $agent_seach_data['txtsearch'];
         $session_search_agent->lock();
         $this->view->province = $agent_seach_data['province'];
         $this->view->txtsearch = $agent_seach_data['txtsearch'];
         $this->view->active = $agent_seach_data['active'];
         $limit = $session_search_agent->limit;
         $agents = $db_agent->getAgentListBy($agent_seach_data, $start, $limit);
         $record_count = $db_agent->getAgentListTotal($agent_seach_data);
     } else {
         if (!empty($session_search_agent->txtsearch) || $session_search_agent->active > -1 || $session_search_agent->province > -1) {
             $agent_seach_data = array('active' => $session_search_agent->active, 'province' => $session_search_agent->province, 'txtsearch' => $session_search_agent->txtsearch);
             $agents = $db_agent->getAgentListBy($agent_seach_data, $start, $limit);
             $record_count = $db_agent->getAgentListTotal($agent_seach_data);
         } else {
             $agents = $db_agent->getAgentList($start, $limit);
             $record_count = $db_agent->getAgentListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($agents as $i => $agent) {
         $result[$i] = array('num' => ++$row_num, 'id' => $agent['id'], 'tel' => $agent['tel'], 'name' => $agent['name'], 'proname' => $agent['proname'], 'khan' => $agent['khan'], 'sangkat' => $agent['sangkat'], 'block' => $agent['block']);
     }
     $this->view->agentlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_agent');
     $this->view->result_row = $page->getResultRows();
 }