public function indexAction() { // get user session $session = new Zend_Session_Namespace('user'); // check for non guest users if (!$session->valid) { $this->_redirect(''); } // get user $user = new Knowledgeroot_User($session->id); // check for post if ($this->getRequest()->getMethod() == 'POST') { $user->setFirstName($this->_getParam('first_name')); $user->setLastName($this->_getParam('last_name')); $user->setEmail($this->_getParam('email')); $user->setLanguage($this->_getParam('language')); $user->setTimezone($this->_getParam('timezone')); // check for password change if ($this->_getParam('password') != '') { if ($this->_getParam('password') == $this->_getParam('password1')) { // save password $user->setPassword($this->_getParam('password')); // display success message Knowledgeroot_Message::success("Password changed", "Your password was changed!"); } else { Knowledgeroot_Message::error("Password", "Your password could not changed!"); } } // save user $user->save(); // save settings also to session $session->language = $this->_getParam('language'); $session->timezone = $this->_getParam('timezone'); // display message // TODO: translate text to new language here! Knowledgeroot_Message::success("Settings", "Your settings were saved"); // redirect to this page again $this->_redirect('settings'); } // prepare view vars $this->view->id = $user->getId(); $this->view->login = $user->getLogin(); $this->view->first_name = $user->getFirstName(); $this->view->last_name = $user->getLastName(); $this->view->email = $user->getEmail(); $this->view->language = $user->getLanguage(); $this->view->timezone = $user->getTimezone(); // get translations $translation = Knowledgeroot_Registry::get('translate'); $this->view->translations = $translation->getTranslations(); // get timezones $this->view->timezones = Knowledgeroot_Timezone::getTimezones(); }
public function loginAction() { $form = new Knowledgeroot_Form_Login(); if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { // create auth object $auth = new Knowledgeroot_Auth($this->getRequest()->getParam('user'), $this->getRequest()->getParam('password')); // check auth if ($auth->isValid()) { $auth->saveSession(); Knowledgeroot_Message::success("Login", "Login successfull"); $this->_redirect('./'); } } Knowledgeroot_Message::error("Could not Login", "Could not Login"); } }
public function restoreAction() { // acl checks if (!Knowledgeroot_Acl::iAmAllowed('content_' . $this->_getParam('id'), 'edit')) { $this->_redirect(''); } // get content and restore version $content = new Knowledgeroot_Content($this->_getParam('id'), $this->_getParam('version')); $content->restore(); $parent = $content->getParent(); // show success message Knowledgeroot_Message::success("Content restored", "Content was restored to version " . $this->_getParam('version')); // redirect to page $this->_redirect('page/' . $parent); }
public function restoreAction() { // acl checks if (!Knowledgeroot_Acl::iAmAllowed('page_' . $this->_getParam('id'), 'edit')) { $this->_redirect(''); } // get page and restore version $page = new Knowledgeroot_Page($this->_getParam('id'), $this->_getParam('version')); $page->restore(); // show success message Knowledgeroot_Message::success("Page restored", "Page was restored to version " . $this->_getParam('version')); // redirect to page $this->_redirect('page/' . $page->getId()); }