require_once 'Locale.php'; require_once "DateHelper.php"; require_once "OsPath.php"; require_once "Database.php"; require_once "Timezone.php"; require_once __DIR__ . '/forms/helpers/ValidationTypes.php'; require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php'; require_once APPLICATION_PATH . "/logging/Logging.php"; Logging::setLogPath('/var/log/airtime/zendphp.log'); Config::setAirtimeVersion(); require_once __DIR__ . "/configs/navigation.php"; Zend_Validate::setDefaultNamespaces("Zend"); $front = Zend_Controller_Front::getInstance(); $front->registerPlugin(new RabbitMqPlugin()); //localization configuration Application_Model_Locale::configureLocalization(); /* The bootstrap class should only be used to initialize actions that return a view. Actions that return JSON will not use the bootstrap class! */ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } protected function _initGlobals() { $view = $this->getResource('view'); $baseUrl = Application_Common_OsPath::getBaseDir(); $view->headScript()->appendScript("var baseUrl = '{$baseUrl}'");
public function editUserAction() { $request = $this->getRequest(); $form = new Application_Form_EditUser(); if ($request->isPost()) { $formData = $request->getPost(); if ($form->isValid($formData) && $form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) { $user = new Application_Model_User($formData['cu_user_id']); $user->setFirstName($formData['cu_first_name']); $user->setLastName($formData['cu_last_name']); // We don't allow 6 x's as a password. // The reason is because we use that as a password placeholder // on the client side. if ($formData['cu_password'] != "xxxxxx") { $user->setPassword($formData['cu_password']); } $user->setEmail($formData['cu_email']); $user->setCellPhone($formData['cu_cell_phone']); $user->setSkype($formData['cu_skype']); $user->setJabber($formData['cu_jabber']); $user->save(); Application_Model_Preference::SetUserLocale($formData['cu_locale']); Application_Model_Preference::SetUserTimezone($formData['cu_timezone']); //configure localization with new locale setting Application_Model_Locale::configureLocalization($formData['cu_locale']); //reinitialize form so language gets translated $form = new Application_Form_EditUser(); $this->view->successMessage = "<div class='success'>" . _("Settings updated successfully!") . "</div>"; } $this->view->form = $form; $this->view->html = $this->view->render('user/edit-user.phtml'); } $this->view->form = $form; $this->view->html = $this->view->render('user/edit-user.phtml'); }
public function passwordChangeAction() { //uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); $request = $this->getRequest(); $token = $request->getParam("token", false); $user_id = $request->getParam("user_id", 0); $form = new Application_Form_PasswordChange(); $auth = new Application_Model_Auth(); $user = CcSubjsQuery::create()->findPK($user_id); Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA')); //check validity of token if (!$auth->checkToken($user_id, $token, 'password.restore')) { Logging::debug("token not valid"); $this->_helper->redirector('index', 'login'); } if ($request->isPost() && $form->isValid($request->getPost())) { $user->setDbPass(md5($form->password->getValue())); $user->save(); $auth->invalidateTokens($user, 'password.restore'); $zend_auth = Zend_Auth::getInstance(); $zend_auth->clearIdentity(); $authAdapter = Application_Model_Auth::getAuthAdapter(); $authAdapter->setIdentity($user->getDbLogin())->setCredential($form->password->getValue()); $zend_auth->authenticate($authAdapter); //all info about this user from the login table omit only the password $userInfo = $authAdapter->getResultRowObject(null, 'password'); //the default storage is a session with namespace Zend_Auth $authStorage = $zend_auth->getStorage(); $authStorage->write($userInfo); $this->_helper->redirector('index', 'showbuilder'); } $this->view->form = $form; }