public function indexAction() { Kwf_Auth::getInstance()->clearIdentity(); Kwf_User_Autologin::clearCookies(); Kwf_Session::destroy(); Kwf_Util_Redirect::redirect($this->_getParam('redirect')); }
public function requestAction() { $backend = $this->_getBackend(); if ($backend->isAuthed()) { throw new Kwf_Exception("Already Authenticated"); } Kwf_Util_Redirect::redirect($backend->getAuthUrl()); }
public function indexAction() { $location = $this->getRequest()->getBaseUrl() . '/'; if ($this->getFrontController()->getRouter()->hasRoute('admin')) { $location = $this->getRequest()->getBaseUrl() . '/admin'; } Kwf_Util_Redirect::redirect($location); }
public function sendContent($includeMaster) { $session = new Kwf_Session_Namespace('kwcShopCart'); if ($session->wirecardCartId) { Kwc_Shop_Cart_Orders::setCartOrderId($session->wirecardCartId); $order = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->_data->parent->parent->parent->componentClass, 'childModel'))->getReferencedModel('Order')->getCartOrder(); $db = Kwf_Registry::get('db'); $db->query("UPDATE `kwc_shop_orders` SET `status` = 'cart' WHERE `id` = {$db->quote($order->id)} AND `status` = 'processing'"); unset($session->wirecardCartId); } Kwf_Util_Redirect::redirect($this->_data->parent->parent->parent->getUrl()); }
public function processInput($input) { if (isset($input['read'])) { $article = Kwf_Model_Abstract::getInstance('Kwc_Articles_Directory_Model')->getRow($input['read']); if ($article) { $article->markRead(); } } if ($this->_getRequiredArticles()->count() == 0) { Kwf_Util_Redirect::redirect('/'); } }
public function sendContent($includeMaster) { $session = new Kwf_Session_Namespace('kwcShopCart'); if ($session->wirecardCartId) { Kwc_Shop_Cart_Orders::setCartOrderId($session->wirecardCartId); $order = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->_data->parent->parent->parent->componentClass, 'childModel'))->getReferencedModel('Order')->getCartOrder(); if ($order) { $order->status = 'cart'; $order->save(); } unset($session->wirecardCartId); } Kwf_Util_Redirect::redirect($this->_data->parent->parent->parent->getUrl()); }
public function preProcessInput($postData) { if (isset($postData['redirectAuth'])) { $authMethods = Kwf_Registry::get('userModel')->getAuthMethods(); if (!isset($authMethods[$postData['redirectAuth']])) { throw new Kwf_Exception_NotFound(); } $auth = $authMethods[$postData['redirectAuth']]; if (!$auth instanceof Kwf_User_Auth_Interface_Redirect) { throw new Kwf_Exception_NotFound(); } $redirectBackUrl = $_GET['redirect']; $formValues = array(); foreach ($auth->getLoginRedirectFormOptions() as $option) { if ($option['type'] == 'select') { $formValues[$option['name']] = $postData[$option['name']]; } } $f = new Kwf_Filter_StrongRandom(); $state = 'login.' . $postData['redirectAuth'] . '.' . $f->filter(null) . '.' . $redirectBackUrl; //save state in namespace to validate it later $ns = new Kwf_Session_Namespace('kwf-login-redirect'); $ns->state = $state; $url = $auth->getLoginRedirectUrl($this->_getRedirectBackUrl(), $state, $formValues); if ($url) { header("Location: " . $url); exit; } else { echo $auth->getLoginRedirectHtml($this->_getRedirectBackUrl(), $state, $formValues); exit; } } if ($postData != array() && array_keys($postData) != array('redirect')) { $user = null; foreach (Kwf_Registry::get('userModel')->getAuthMethods() as $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect) { $user = $auth->getUserToLoginByParams($postData); if ($user) { break; } } } if ($user) { Kwf_Registry::get('userModel')->loginUserRow($user, true); $url = $this->_getUrlForRedirect($postData, $user); Kwf_Util_Redirect::redirect($url); } } }
public function processInput(array $postData) { $emailField = $this->getForm()->getByName('email')->getFieldName(); if (!empty($postData[$this->getData()->componentId]) && !empty($postData[$emailField])) { if (!$this->getForm()) { return; } $model = $this->getForm()->getModel(); //TODO: don't poke into $postData directly, get value from field instead $s = $model->select(); $s->whereEquals('newsletter_component_id', $this->getSubscribeToNewsletterComponent()->dbId); $s->whereEquals('email', $postData[$emailField]); $s->whereEquals('unsubscribed', false); $exists = $model->getRow($s); if ($exists) { //already subscribed $categories = $this->getForm()->getCategories(); if (count($categories) == 1) { $catKeys = array_keys($categories); $toModel = Kwf_Model_Abstract::getInstance('Kwc_NewsletterCategory_Subscribe_SubscriberToCategory'); $toRow = $toModel->getRow($toModel->select()->whereEquals('subscriber_id', $exists->id)->whereEquals('category_id', $catKeys[0])); if ($toRow) { parent::processInput($postData); } else { $this->_setProcessed(); $this->getForm()->addCategoryIfOnlyOne($exists); //TODO the following code is copied from Kwc_Form, why not make a protected method or something? if ($this->getSuccessComponent() && $this->getSuccessComponent()->isPage && (!isset($postData['doNotRelocate']) || !$postData['doNotRelocate'])) { Kwf_Util_Redirect::redirect($this->getSuccessComponent()->url); } } } else { // if more than one category: anything special neccessary here? //TODO: implement "neccessary special" parent::processInput($postData); } } else { //not yet subscribed, form inserts new row plus category parent::processInput($postData); } } else { //no post parent::processInput($postData); } }
public function isLoggedIn() { $pw = $this->_getPassword(); if (!$pw) { return false; } //no password defined if (!is_array($pw)) { $pw = array($pw); } if (isset($_COOKIE[get_class($this)])) { foreach ($pw as $p) { if (sha1($p) == $_COOKIE[get_class($this)]) { $this->_saveCookie(); return true; } } } $session = new Kwf_Session_Namespace('login_password'); if (!$session->passwords) { $session->passwords = array(); } if (array_intersect($session->passwords, $pw)) { return true; } if (!is_null($this->_getLoginPassword()) && in_array($this->_getLoginPassword(), $pw)) { //this should not happen in herer (we are in isLoggedIn) //instead this should be in processInput of the LoginForm, just as Plugin_Login does it $session->passwords[] = $this->_getLoginPassword(); $this->_afterLogin($session); $currentPageUrl = Kwf_Component_Data_Root::getInstance()->getComponentById($this->_componentId)->url; if ($_SERVER['QUERY_STRING'] && isset($_SERVER['QUERY_STRING'])) { $currentPageUrl .= '?' . $_SERVER['QUERY_STRING']; } if (isset($_POST['save_cookie']) && $_POST['save_cookie']) { $this->_saveCookie(); } Kwf_Util_Redirect::redirect($currentPageUrl); } return false; }
public function authAction() { $state = $this->_getParam('state'); if ($state) { //we got a state, validate it like it is a redirect-callback $this->forward('redirect-callback'); return; } $users = Zend_Registry::get('userModel'); foreach ($users->getAuthMethods() as $authMethod) { if ($authMethod instanceof Kwf_User_Auth_Interface_Redirect) { $user = $authMethod->getUserToLoginByParams($this->getRequest()->getParams()); if ($user) { break; } } } if ($user) { $users->loginUserRow($user, true); $redirect = $this->_getParam('redirect'); if (!$redirect) { $redirect = Kwf_Setup::getBaseUrl() . '/'; } Kwf_Util_Redirect::redirect($redirect); } else { throw new Kwf_Exception_AccessDenied(); } }
public function redirectAction() { Kwf_Util_Redirect::redirect($this->_getParam('url')); }
protected function _processInput($postData) { if ($this->_processed) { return; } $this->_setProcessed(); $this->_postData = $postData; if (!isset($postData[$this->getData()->componentId . '-post']) && !isset($postData[$this->getData()->componentId])) { $this->_postData = array(); $this->_posted = false; return; } else { $this->_posted = true; } if (!$this->getForm()) { return; } if ($this->_getIdFromPostData($postData)) { $this->getForm()->setId($this->_getIdFromPostData($postData)); } $m = $this->getForm()->getModel(); while ($m instanceof Kwf_Model_Proxy) { $m = $m->getProxyModel(); } if ($this->_posted && Kwf_Registry::get('db') && $m instanceof Kwf_Model_Db) { Kwf_Registry::get('db')->beginTransaction(); } $postData = $this->_form->processInput(null, $postData); $this->_postData = $postData; if (isset($postData[$this->getData()->componentId])) { ignore_user_abort(true); $this->_errors = array_merge($this->_errors, $this->_validate($postData)); if (!$this->_errors) { try { $this->_form->prepareSave(null, $postData); $isInsert = false; if (!$this->_form->getRow()->{$this->_form->getModel()->getPrimaryKey()}) { $isInsert = true; $this->_beforeInsert($this->_form->getRow()); } else { $this->_beforeUpdate($this->_form->getRow()); } $this->_beforeSave($this->_form->getRow()); $this->_form->save(null, $postData); if ($isInsert) { $this->_afterInsert($this->_form->getRow()); } else { $this->_afterUpdate($this->_form->getRow()); } $this->_form->afterSave(null, $postData); $this->_afterSave($this->_form->getRow()); $this->_isSaved = true; } catch (Exception $e) { $this->_handleProcessException($e); } } } if ($this->_posted && Kwf_Registry::get('db') && $m instanceof Kwf_Model_Db) { Kwf_Registry::get('db')->commit(); } if ($this->isSaved() && !$this->_errors && (!isset($postData['doNotRelocate']) || !$postData['doNotRelocate'])) { $success = $this->getSuccessComponent(); $url = null; if ($success instanceof Kwf_Component_Data && $success->isPage) { $url = $this->getSuccessComponent()->url; } else { if (is_string($success)) { $url = $success; } } if ($url) { Kwf_Util_Redirect::redirect($url); } } }
public function sendContent($includeMaster) { Kwf_Util_Redirect::redirect('/'); }
public function indexAction() { Kwf_Util_Redirect::redirect('/kwf/debug/benchmark'); }
public function indexAction() { Zend_Session::start(); Zend_Session::destroy(); Kwf_Util_Redirect::redirect('/'); }