當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::getDefaultManager方法代碼示例

本文整理匯總了PHP中Zend\Session\Container::getDefaultManager方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::getDefaultManager方法的具體用法?PHP Container::getDefaultManager怎麽用?PHP Container::getDefaultManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Session\Container的用法示例。


在下文中一共展示了Container::getDefaultManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onDispatch

 /**
  * @param MvcEvent $e
  * @return mixed|void
  */
 public function onDispatch(MvcEvent $e)
 {
     $this->sessionContainer->getDefaultManager()->forgetMe();
     $this->sessionContainer->getDefaultManager()->expireSessionCookie();
     $this->sessionContainer->getDefaultManager()->destroy();
     $this->redirect()->toRoute('frontend');
 }
開發者ID:spalax,項目名稱:ua-webchalange-instagram-collage,代碼行數:11,代碼來源:LogoutController.php

示例2: testCanDisableContainerDefaultManagerInjectionViaConfiguration

 public function testCanDisableContainerDefaultManagerInjectionViaConfiguration()
 {
     $config = array('session_manager' => array('enable_default_container_manager' => false));
     $this->services->setService('Config', $config);
     $manager = $this->services->get('Zend\\Session\\ManagerInterface');
     $this->assertNotSame($manager, Container::getDefaultManager());
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:7,代碼來源:SessionManagerFactoryTest.php

示例3: getSessionManager

 /**
  * Retrieve the session manager
  *
  * If none composed, lazy-loads a SessionManager instance
  *
  * @return Manager
  */
 public function getSessionManager()
 {
     if (!$this->session instanceof Manager) {
         $this->setSessionManager(Container::getDefaultManager());
     }
     return $this->session;
 }
開發者ID:leonardovn86,項目名稱:zf2_basic2013,代碼行數:14,代碼來源:FlashMessenger.php

示例4: loginAction

 public function loginAction()
 {
     $redirect = $this->getRequest()->getQuery('redirect', false);
     $errors = [];
     if ($this->authentication->hasIdentity()) {
         return $this->redirect()->toRoute('dotuser');
     }
     if ($this->getRequest()->isPost()) {
         $this->loginForm->setData($this->getRequest()->getPost());
         $redirect = $this->getRequest()->getPost()->get('redirect', false);
         if ($this->loginForm->isValid()) {
             $authAdapter = $this->authentication->getAdapter();
             $this->authentication->clearIdentity();
             $params = $this->getRequest()->getPost();
             $identity = $params->get('identity');
             $credential = $params->get('credential');
             $authAdapter->setIdentity($identity);
             $authAdapter->setCredential($credential);
             $result = $this->authentication->authenticate();
             if ($result->isValid()) {
                 $identity = $result->getIdentity();
                 $session = new Container($this->authentication->getStorage()->getNameSpace());
                 $session->getDefaultManager()->regenerateId();
                 if ($redirect) {
                     return $this->redirect()->toUrl($redirect);
                 }
                 return $this->redirect()->toRoute('dotuser');
             } else {
                 $errors = array_merge($errors, $result->getMessages());
             }
         }
     }
     //show login form
     return array('loginForm' => $this->loginForm, 'redirect' => $redirect, 'errors' => $errors);
 }
開發者ID:n3vrax,項目名稱:dotkernel,代碼行數:35,代碼來源:UserController.php

示例5: toCartAction

 public function toCartAction()
 {
     $item_id = $this->getRequest()->getPost()->item_id;
     $item_quantity = $this->getRequest()->getPost()->item_quantity;
     $item_price = $this->getRequest()->getPost()->item_price;
     //die($item_id.'_'.$item_quantity.'_'.$item_price);
     //$item_id = $this->params()->fromRoute('id'); // need if non-ajax request
     $guest_session = new Container();
     $guest_session->sessid = $guest_session->getDefaultManager()->getId();
     $toExchange = $this->getCollectionTable()->fetchById($item_id)->toArray();
     //$toExchange = $this->toArray($details);
     $toExchange[0]['cart_id'] = $guest_session->sessid;
     $toExchange[0]['item_quantity'] = $item_quantity;
     $toExchange[0]['item_price'] = $item_price;
     $cart_item = new Cart();
     $cart_item->exchangeArray($toExchange[0]);
     $this->getCartTable()->insertCart($cart_item);
     /*
             return $this->redirect()->toRoute(NULL , array(
                 'controller' => 'collection',
                 'action' => 'index',
             ));
     */
     /*                                              // just check for workability
             $viewModel = new ViewModel(array(
                 'details' => $details,
                 'guest_session' => $guest_session
             ));
             return $viewModel;
     */
 }
開發者ID:kkorushkin,項目名稱:myzend.local,代碼行數:31,代碼來源:CollectionController.php

示例6: perform

 public function perform(Installer $installer)
 {
     $sessionManager = Container::getDefaultManager();
     $sessionManager->start();
     // Must explicitly clear storage since the session manager will
     // repopulate the session with old storage data.
     $sessionManager->destroy(['clear_storage' => true]);
 }
開發者ID:patrova,項目名稱:omeka-s,代碼行數:8,代碼來源:DestroySessionTask.php

示例7: __invoke

 public function __invoke()
 {
     $user_session = new Container();
     $cart_id = $user_session->getDefaultManager()->getId();
     $result = $this->getServiceLocator()->getServiceLocator()->get('CartTable')->selectCartItemById($cart_id, $item_id = null, 'item_id');
     $result = $this->toArray($result);
     return !is_null($result) ? 'img/cart-header-full.png' : 'img/cart-header-empty.png';
 }
開發者ID:kkorushkin,項目名稱:myzend.local,代碼行數:8,代碼來源:CollectionLayoutViewHelperCartIndicator.php

示例8: deconnexionAction

 public function deconnexionAction()
 {
     $auth = new AuthenticationService();
     $auth->clearIdentity();
     $sessionManager = Container::getDefaultManager();
     $sessionManager->destroy();
     $this->flashMessenger()->addSuccessMessage('Vous avez bien été déconnecté(e).');
     return $this->redirect()->toRoute('accueil');
 }
開發者ID:baptcomet,項目名稱:weprono,代碼行數:9,代碼來源:ConnexionController.php

示例9: getSession

 public static function getSession($namespase = false)
 {
     $sessionContainer = Container::getDefaultManager();
     $sessionStorage = $sessionContainer->getStorage();
     if ($namespase) {
         return $sessionStorage->{$namespase};
     }
     return $sessionStorage;
 }
開發者ID:arbi,項目名稱:MyCode,代碼行數:9,代碼來源:Helper.php

示例10: logoutAction

 public function logoutAction()
 {
     $auth = $this->getServiceLocator()->get('Omeka\\AuthenticationService');
     $auth->clearIdentity();
     $sessionManager = Container::getDefaultManager();
     $sessionManager->destroy();
     $this->messenger()->addSuccess('Successfully logged out');
     return $this->redirect()->toRoute('login');
 }
開發者ID:patrova,項目名稱:omeka-s,代碼行數:9,代碼來源:LoginController.php

示例11: getCsrfValidator

 /**
  * Get CSRF validator
  *
  * @return  \Zend\Validator\Csrf
  */
 public function getCsrfValidator()
 {
     if (null === $this->csrfValidator) {
         $serviceLocator = $this->getServiceLocator();
         if ($serviceLocator && $serviceLocator->has('Zend\\Session\\ManagerInterface')) {
             $defaultManager = SessionContainer::getDefaultManager();
             $serviceManager = $serviceLocator->get('Zend\\Session\\ManagerInterface');
             if ($defaultManager !== $serviceManager) {
                 SessionContainer::setDefaultManager($serviceManager);
             }
         }
     }
     return parent::getCsrfValidator();
 }
開發者ID:gridguyz,項目名稱:zork,代碼行數:19,代碼來源:Csrf.php

示例12: getCaptcha

 /**
  * Retrieve captcha (if any)
  *
  * @return null|ZendCaptcha\AdapterInterface
  */
 public function getCaptcha()
 {
     if (null === $this->captcha) {
         $serviceLocator = $this->getServiceLocator();
         if ($serviceLocator && $serviceLocator->has('Zend\\Session\\ManagerInterface')) {
             $defaultManager = SessionContainer::getDefaultManager();
             $serviceManager = $serviceLocator->get('Zend\\Session\\ManagerInterface');
             if ($defaultManager !== $serviceManager) {
                 SessionContainer::setDefaultManager($serviceManager);
             }
         }
         if ($this->defaultCaptcha instanceof AdapterInterface) {
             $captcha = clone $this->defaultCaptcha;
         } else {
             $captcha = $this->defaultCaptcha;
         }
         $this->setCaptcha($captcha);
     }
     return parent::getCaptcha();
 }
開發者ID:gridguyz,項目名稱:zork,代碼行數:25,代碼來源:Captcha.php

示例13: indexAction

 public function indexAction()
 {
     $sessStore = Container::getDefaultManager()->getStorage();
     $key = md5($sessStore['c_secred'] . $sessStore['s_secred']);
     ob_start();
     $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
     $ciphertext_base64 = $this->request->getContent();
     $ciphertext_dec = base64_decode($ciphertext_base64);
     # retrieves the IV, iv_size should be created using mcrypt_get_iv_size()
     $iv_dec = substr($ciphertext_dec, 0, $iv_size);
     # retrieves the cipher text (everything except the $iv_size in the front)
     $ciphertext_dec = substr($ciphertext_dec, $iv_size);
     # may remove 00h valued characters from end of plain text
     $plaintext_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec);
     $plaintext_dec = '2' . $plaintext_dec . '2';
     $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $plaintext_dec, MCRYPT_MODE_CBC, $iv_dec);
     $ciphertext = base64_encode($iv_dec . $ciphertext);
     echo $ciphertext;
     $this->response->setContent(ob_get_clean());
     return $this->response;
 }
開發者ID:phiKremer,項目名稱:WebDoc,代碼行數:21,代碼來源:IndexController.php

示例14: logoutAction

 /**
  * Metodo para cerrar la sesion 
  * @return \Zend\View\Model\ViewModel
  */
 public function logoutAction()
 {
     $content = new Container("cbol");
     $content->getDefaultManager()->getStorage()->clear();
     $this->layout('layout/login');
     $auth = new \Zend\Authentication\AuthenticationService();
     $auth->getStorage()->clear();
     return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/login');
 }
開發者ID:nathalysalamanca,項目名稱:Observatorio,代碼行數:13,代碼來源:LoginController.php

示例15: processloginAction

 /**
  * @return \Zend\Http\Response
  */
 public function processloginAction()
 {
     $this->getView()->setTemplate('application/login/index');
     /** @var \Zend\Http\Request $request */
     $request = $this->getRequest();
     if (!$request->isPost()) {
         return $this->redirect()->toUrl('/login');
     }
     /*
      * @var LoginForm
      */
     $form = $this->loginForm;
     $form->setInputFilter($form->getInputFilter());
     $form->setData($request->getPost());
     /*
      * See if form is valid
      */
     if (!$form->isValid()) {
         $this->setLayoutMessages($form->getMessages(), 'error');
         return $this->redirect()->toUrl('/login');
     }
     $formData = $form->getData();
     $adapter = $this->getAuthAdapter($formData);
     $auth = new AuthenticationService();
     $result = $auth->authenticate($adapter);
     /*
      * See if authentication is valid
      */
     if (!$result->isValid()) {
         $this->setLayoutMessages($result->getMessages(), 'error');
         return $this->redirect()->toUrl('/login');
     }
     $user = $result->getIdentity();
     /*
      * If account is disabled/banned (call it w/e you like) clear user data and redirect
      */
     if ((int) $user->isDisabled() === 1) {
         $this->setLayoutMessages($this->translate('LOGIN_ERROR'), 'error');
         return $this->redirect()->toUrl('/login');
     }
     $remote = new RemoteAddress();
     $user->setLastLogin(date('Y-m-d H:i:s', time()));
     $user->setIp($remote->getIpAddress());
     $this->getTable('SD\\Admin\\Model\\UserTable')->saveUser($user);
     $manager = Container::getDefaultManager();
     if ($formData['rememberme'] == 1) {
         $manager->rememberMe(864000);
         //10 days
         $manager->getConfig()->setRememberMeSeconds(864000);
     }
     $manager->regenerateId();
     $this->authService->getStorage()->write($user);
     // puts only id in session!
     return $this->redirect()->toUrl('/');
 }
開發者ID:samsonasik,項目名稱:unnamed,代碼行數:58,代碼來源:LoginController.php


注:本文中的Zend\Session\Container::getDefaultManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。