public function indexAction()
 {
     Kwf_Auth::getInstance()->clearIdentity();
     Kwf_User_Autologin::clearCookies();
     Kwf_Session::destroy();
     Kwf_Util_Redirect::redirect($this->_getParam('redirect'));
 }
 protected function _afterSave(Kwf_Model_Row_Interface $row)
 {
     parent::_afterSave($row);
     $user = Kwf_Registry::get('userModel')->getAuthedUser();
     $user->deleted = 1;
     $user->save();
     Kwf_Auth::getInstance()->clearIdentity();
     Kwf_User_Autologin::clearCookies();
     Kwf_Session::destroy();
 }
 protected function _afterSave(Kwf_Model_Row_Interface $row)
 {
     $result = $this->_getAuthenticateResult($row->email, $row->password);
     if ($result->isValid()) {
         $authedUser = Kwf_Registry::get('userModel')->getAuthedUser();
         if ($row->auto_login) {
             Kwf_User_Autologin::setCookies($authedUser);
         } else {
             //user logged in without autologin activated, clear the autologin token
             Kwf_User_Autologin::clearToken($authedUser);
         }
         $this->_afterLogin($authedUser);
     } else {
         $this->_errors[] = array('message' => $this->getData()->trlKwf('Invalid E-Mail or password, please try again.'));
     }
 }
 public static function dispatchKwc()
 {
     $requestPath = self::getRequestPath();
     if ($requestPath === false) {
         return;
     }
     $fullRequestPath = $requestPath;
     $data = null;
     $baseUrl = Kwf_Setup::getBaseUrl();
     if ($baseUrl) {
         if (substr($requestPath, 0, strlen($baseUrl)) != $baseUrl) {
             throw new Kwf_Exception_NotFound();
         }
         $requestPath = substr($requestPath, strlen($baseUrl));
     }
     $uri = substr($requestPath, 1);
     $i = strpos($uri, '/');
     if ($i) {
         $uri = substr($uri, 0, $i);
     }
     if ($uri == 'robots.txt') {
         Kwf_Util_RobotsTxt::output();
     }
     if ($uri == 'sitemap.xml') {
         $data = Kwf_Component_Data_Root::getInstance()->getPageByUrl('http://' . $_SERVER['HTTP_HOST'] . Kwf_Setup::getBaseUrl() . '/', null);
         Kwf_Component_Sitemap::output($data->getDomainComponent());
     }
     if (!in_array($uri, array('media', 'kwf', 'admin', 'assets', 'vkwf', 'api'))) {
         if (!isset($_SERVER['HTTP_HOST'])) {
             $requestUrl = 'http://' . Kwf_Config::getValue('server.domain') . $fullRequestPath;
         } else {
             $requestUrl = 'http://' . $_SERVER['HTTP_HOST'] . $fullRequestPath;
         }
         Kwf_Trl::getInstance()->setUseUserLanguage(false);
         $root = Kwf_Component_Data_Root::getInstance();
         foreach ($root->getPlugins('Kwf_Component_PluginRoot_Interface_PreDispatch') as $p) {
             $p->preDispatch($requestUrl);
         }
         $acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
         $exactMatch = true;
         $data = $root->getPageByUrl($requestUrl, $acceptLanguage, $exactMatch);
         Kwf_Benchmark::checkpoint('getPageByUrl');
         if (!$data) {
             throw new Kwf_Exception_NotFound();
         }
         if (!$exactMatch) {
             if (rawurldecode($data->url) == $fullRequestPath) {
                 throw new Kwf_Exception("getPageByUrl reported this isn't an exact match, but the urls are equal. wtf.");
             }
             $url = $data->url;
             if (!$url) {
                 // e.g. firstChildPageData without child pages
                 throw new Kwf_Exception_NotFound();
             }
             foreach ($root->getPlugins('Kwf_Component_PluginRoot_Interface_PostRender') as $p) {
                 $url = $p->processUrl($url);
             }
             if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
                 $url .= '?' . $_SERVER['QUERY_STRING'];
             }
             header('Location: ' . $url, true, 301);
             exit;
         }
         $root->setCurrentPage($data);
         Kwf_User_Autologin::processCookies();
         $contentSender = Kwf_Component_Settings::getSetting($data->componentClass, 'contentSender');
         $contentSender = new $contentSender($data);
         $contentSender->sendContent(true);
         Kwf_Benchmark::shutDown();
         //TODO: ein flag oder sowas ähnliches stattdessen verwenden
         if ($data instanceof Kwc_Abstract_Feed_Component || $data instanceof Kwc_Export_Xml_Component || $data instanceof Kwc_Export_Xml_Trl_Component) {
             echo "<!--";
         }
         Kwf_Benchmark::output();
         if ($data instanceof Kwc_Abstract_Feed_Component || $data instanceof Kwc_Export_Xml_Component || $data instanceof Kwc_Export_Xml_Trl_Component) {
             echo "-->";
         }
         exit;
     } else {
         if ($requestPath == '/kwf/util/kwc/render') {
             Kwf_User_Autologin::processCookies();
             Kwf_Util_Component::dispatchRender();
         }
     }
 }