public function executeSignout($request) { /* We need to be sure that user is authenticated because it can have more * sessions opened in several browsers ot browsers tabs */ if ($this->getUser()->isAuthenticated()) { $idUser = $this->getUser()->getGuardUser()->getId(); $this->getUser()->signOut(); $operation = $request->getParameter('lang') . $request->getParameter('page'); semaphore::deleteOperation($idUser, $operation); } $oPage = W3sPagePeer::retrieveByPk($this->getRequestParameter('page')); $oLanguage = W3sLanguagePeer::retrieveByPk($this->getRequestParameter('lang')); $this->getResponse()->setHttpHeader('X-JSON', '([["sPageUrl", "/' . strtolower($oLanguage->getLanguage()) . '/' . strtolower($oPage->getPageName()) . '.html"]])'); return sfView::HEADER_ONLY; }
/** * Checks if the requested page is not in use from another user, and free the * previous page used by current user. * * @param int The previous page id * */ public function isPageFree($prevPage) { $operation = $this->idLanguage . $this->idPage; $prevOperation = $this->idLanguage . $prevPage; return semaphore::setRequestedOperation(sfContext::getInstance()->getUser()->getGuardUser()->getId(), $operation, $prevOperation); }