public function getUserParam($nId) { $oModelUser = new Admin_Model_User(); $oRow = $this->find($nId)->current(); if ($oRow instanceof Zend_Db_Table_Row_Abstract) { $aRow = $oModelUser->findUser($oRow->user_id); return $aRow; } return null; }
public function delAction() { $userModel = new Admin_Model_User(); $user_id = intval($_POST['delusrid']); $userModel->removeID($user_id); $userRolesModel = new Admin_Model_UserRole(); $userRolesModel->remove(K_Db_Select::create()->where(array('usrol_user_id' => $user_id))); $returnJson = array('error' => false, 'msg' => '<strong>OK:</strong>Пользователь удалён'); $this->putJSON($returnJson); }
function indexAction() { $captcha = new Zend_Captcha_Image(); $vi = new Zend_View(); $base = $vi->baseurl(); if (!$this->_request->isPost()) { $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../public_html/captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../public_html/font/AHGBold.ttf'); $captcha->generate(); $this->view->captcha = $captcha->render($this->view); $this->view->captchaID = $captcha->getId(); // Dua chuoi Captcha vao session $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId()); $captchaSession->word = $captcha->getWord(); } else { $captchaID = $this->_request->captcha_id; $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID); $captchaIterator = $captchaSession->getIterator(); $captchaWord = $captchaIterator['word']; if ($this->_request->captcha == $captchaWord) { $system = new Default_Model_User(); $exist = new Admin_Model_User(); $user = $this->_request->getParam('username'); $pass1 = $this->_request->getParam('password'); $pass2 = $this->_request->getParam('re_password'); $ex = $exist->list_user_2($user); if ($ex == 2) { if ($pass1 == $pass2) { $this->view->purifier = Zend_Registry::get('purifier'); $conf = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($conf); $username = $purifier->purify($this->_request->getParam('username')); $password = $purifier->purify(md5($this->_request->getParam('password'))); $email = $purifier->purify($this->_request->getParam('email')); $full_name = $purifier->purify($this->_request->getParam('full_name')); $phone = $purifier->purify($this->_request->getParam('phone')); $birth = $purifier->purify($this->_request->getParam('birth')); $sex = $purifier->purify($this->_request->getParam('sex')); $address = $purifier->purify($this->_request->getParam('address')); $system->add_User($username, $password, $email, $full_name, 0, 3, $phone, $birth, $sex, $address); thongbao('Chúc mừng bạn đã đăng ký thành công'); chuyen_trang($base); } } else { thongbao("User này đã tồn tại"); trang_truoc(); } } else { thongbao('Ban nhap sai chuoi Captcha'); //trangtruoc(); } $this->_helper->viewRenderer->setNoRender(); $mask = APPLICATION_PATH . "/../public_html/captcha/images/*.png"; array_map("unlink", glob($mask)); } }
public function __construct($options = null) { $oModelUser = new Admin_Model_User(); $oEmailAddress = $oModelUser->findAdminRecipients(); if (count($oEmailAddress)) { foreach ($oEmailAddress as $oValue) { $this->_aEmailAddress[$oValue->id] = $oValue->email_address; } } parent::__construct($options); }
public function isValid($nValue) { $nValue = (int) $nValue; if (is_numeric($nValue) && $nValue > 0) { $oModelUser = new Admin_Model_User(); $nIsOnline = $oModelUser->getAskOnline($nValue); if ($nIsOnline == 1) { return true; } } $this->_error(self::IS_EXIST); return false; }
public function isValid($sValue, $mContext = null) { $sValue = (string) $sValue; if (isset($sValue)) { $oModelUser = new Admin_Model_User(); $nUserId = $oModelUser->findUserByEmailAddress($sValue); if (!is_numeric($nUserId)) { return true; } } $this->_error(self::IS_EXIST); return false; }
public function __construct($options = null) { $this->_oAuth = AppCms2_Controller_Plugin_ModuleAuth::getInstance(); if ($this->_oAuth->hasIdentity()) { $this->_nUserId = $this->_oAuth->getStorage()->read()->user_id; } $oModelUser = new Admin_Model_User(); $oAllUser = $oModelUser->findUsers(array(3, 4)); if (isset($oAllUser)) { $this->_aAllUser[0] = "-"; foreach ($oAllUser as $oValue) { $this->_aAllUser[$oValue->id] = trim($oValue->first_name . " " . $oValue->last_name); } } parent::__construct($options); }
public function isValid($sValue, $mContext = null) { $oModelUser = new Admin_Model_User(); $sValue = (string) $sValue; if (is_array($mContext)) { if (isset($sValue)) { $sEmailAddress = $mContext["user_email_address"]; $sPassword = $sValue; if ($oModelUser->ajaxLogin($sEmailAddress, $sPassword)) { $this->_error(self::NOT_MATCH); return false; } } } return true; }
public function changepasswordAction() { $oModelUser = new Admin_Model_User(); $oFormChangePassword = new Admin_Form_ChangePassword(); $aPostData = array(); $sSuccess = ""; if ($this->_request->isPost()) { $sSuccess = "NO OK"; $aPostData = $this->_request->getPost(); if ($oModelUser->updatePassword($aPostData["old_password"], $aPostData["new_password"])) { $sSuccess = "OK"; } } $this->view->oFormChangePassword = $oFormChangePassword; $this->view->sSuccess = $sSuccess; }
public function __construct($options = null) { $oModelUser = new Admin_Model_User(); $oChatUserRecipients = $oModelUser->findAskRecipients(); if (isset($oChatUserRecipients)) { foreach ($oChatUserRecipients as $oRow) { $this->_aChatUserRecipients[$oRow->id] = trim($oRow->first_name . " " . $oRow->last_name); } } $oOnlineChatUserRecipients = $oModelUser->findAskOnline(); if (isset($oOnlineChatUserRecipients)) { foreach ($oOnlineChatUserRecipients as $oRow) { $this->_aOnlineChatUserRecipients[$oRow->id] = $oRow->id; } } parent::__construct($options); }
public function contactAction() { $oFormContact = new Admin_Form_Contact(); $oModelUser = new Admin_Model_User(); $sEmailAddress = $oModelUser->findEmailAddress($this->_nUserId); $oFormContact->populate(array("email_address" => $sEmailAddress)); if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); $oMail = new AppCms2_Controller_Plugin_Mail(); $sEmailAddress = $oModelUser->findEmailAddress($this->_nUserId); if ($oFormContact->isValid($aPostData)) { $oMail->sendEmail(array("subject" => trim($sStr = "Kontakt z systemu zamawiania kopii - " . $aPostData["subject"]), "email_address" => $sEmailAddress, "user_name" => $this->_sUserName), $aPostData["message"]); } $oFormContact->clearForm(); } $this->view->oFormContact = $oFormContact; }
public function indexAction() { $auth_error = false; //Если авторизован отпровляем в админку if (K_Access::acl()->isAllowed(K_Auth::getRoles(), 'admin')) { K_Request::redirect("/admin"); } if (isset($_POST['btnauth'])) { $login = K_Arr::get($_POST, 'login', false); if ($login and strlen($login) < 100) { $password = K_Arr::get($_POST, 'password', false); if ($password) { $password_hash = md5(md5($password . K_Registry::get('Configure.salt'))); $user_model = new Admin_Model_User(); $user_arr = $user_model->find(K_Db_Select::create()->fields('user_id, user_name, user_login , user_email')->where(array('and' => array('user_login' => $login, "user_password" => $password_hash)))->limit(1)); if (is_array($user_arr) && count($user_arr)) { $user = $user_arr[0]->toArray(); $user_role = new Admin_Model_UserRole(); // находим все роли пользователя $user_roles_arr = $user_role->fetchAssoc('role_acl_key', 'SELECT r.role_acl_key FROM (`users_roles`)inner join `role` as r on usrol_role_id=r.role_id WHERE usrol_user_id = "' . $user['user_id'] . '"'); foreach ($user_roles_arr as $v) { $user_roles[] = $v["role_acl_key"]; } //Загружаем роли в класc авторизации // var_dump ($user); //даже если у пользователя нет ролей даём ему роль guests if (!isset($user_roles)) { $user_roles = array('guests'); } K_Auth::authorize($user, $user_roles); K_Request::redirect("/admin"); } else { $auth_error = true; } } else { $auth_error = true; } } else { $auth_error = true; } } $this->view->error_msg = ''; if ($auth_error) { $this->view->error_msg = "Ошибка авторизации, неверный логин или пароль"; } }
public function __construct($options = null) { $this->_oAuth = AppCms2_Controller_Plugin_ModuleAuth::getInstance(); if ($this->_oAuth->hasIdentity()) { $this->_nUserId = $this->_oAuth->getStorage()->read()->user_id; } $oModelUser = new Admin_Model_User(); $oAllUser = $oModelUser->findUsers(array(3, 4)); if (isset($oAllUser)) { $this->_aAllUser[0] = "-"; foreach ($oAllUser as $oValue) { $this->_aAllUser[$oValue->id] = trim($oValue->first_name . " " . $oValue->last_name); } } $oModelNotificationType = new Admin_Model_NotificationType(); $oAllNotificationType = $oModelNotificationType->getAll(); if (isset($oAllNotificationType)) { foreach ($oAllNotificationType as $oValue) { $this->_aAllNotificationType[$oValue->id] = stripcslashes($oValue->name); } } $oModelNotificationPriority = new Admin_Model_NotificationPriority(); $oAllNotificationPriority = $oModelNotificationPriority->getAll(); if (isset($oAllNotificationPriority)) { foreach ($oAllNotificationPriority as $oValue) { $this->_aAllNotificationPriority[$oValue->id] = stripcslashes($oValue->name); } } $oModelNotificationStatus = new Admin_Model_NotificationStatus(); $oAllNotificationStatus = $oModelNotificationStatus->getAll(); if (isset($oAllNotificationStatus)) { foreach ($oAllNotificationStatus as $oValue) { $this->_aAllNotificationStatus[$oValue->id] = stripcslashes($oValue->name); } } $oModelNotificationCategory = new Admin_Model_NotificationCategory(); $oAllNotificationCategory = $oModelNotificationCategory->getAll(); if (isset($oAllNotificationCategory)) { foreach ($oAllNotificationCategory as $oValue) { $this->_aAllNotificationCategory[0] = "-"; $this->_aAllNotificationCategory[$oValue->id] = stripcslashes($oValue->name); } } parent::__construct($options); }
public function indexAction() { $params = Jos::getParams(); if (Jos::isPost()) { if ($this->checkForm($params)) { $objUser = new Admin_Model_User(); $username = $params['name']; $password = $params['password']; $check = $objUser->checkLogin($username, $password); if ($check > 0) { $_SESSION['name'] = $username; redirect('admin/home'); } else { $this->view->errorLogin = "******"; } } } $this->view->layout(); }
public function __construct($options = null) { $this->_oAuth = AppCms2_Controller_Plugin_ModuleAuth::getInstance(); $oModelUser = new Admin_Model_User(); $oModelUserCategory = new Admin_Model_UserCategory(); if ($this->_oAuth->hasIdentity()) { $this->_aUser = $oModelUser->findUser($this->_oAuth->getStorage()->read()->user_id); } $oChatUserRecipients = $oModelUser->findAskOnline(); if (isset($oChatUserRecipients)) { foreach ($oChatUserRecipients as $oRow) { $aUserParam = $oModelUser->findUser($oRow->id); $this->_aChatUserRecipients[$oRow->id] = trim($aUserParam["first_name"] . " " . $aUserParam["last_name"]); } } $oAllCategory = $oModelUserCategory->getAll(); if (isset($oAllCategory)) { foreach ($oAllCategory as $oRow) { $this->_aCategory[$oRow->id] = trim($oRow->name); } } parent::__construct($options); }
public function deleteuserAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $this->getFileUploadScript(); $aInputFilters = array("*" => array(new Zend_Filter_StringTrim())); $aInputValidators = array("id" => array(new Zend_Validate_Digits())); $bJson = false; $oInput = new Zend_Filter_Input($aInputFilters, $aInputValidators, $_POST); $nId = $oInput->getUnescaped("id"); $oModelUser = new Admin_Model_User(); if ($oModelUser->deleteRow($nId)) { $bJson = true; } header("Content-type: application/json"); echo Zend_Json::encode($bJson); exit; }
public function confirmchangepasswordAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $oModelUser = new Admin_Model_User(); $oModelUserNewPassword = new Admin_Model_UserNewPassword(); $oModelVUser = new Admin_Model_VUser(); $sActivatingCode = $this->_request->getParam("code"); if (isset($sActivatingCode) && is_string($sActivatingCode) && strlen($sActivatingCode) == 32) { $oRow = $oModelUserNewPassword->confirmNewPassword($sActivatingCode); if (!isset($oRow) && is_string($oRow->new_password) && strlen($oRow->new_password) == 32) { $this->_redirect("user/login"); } if ($oModelUser->activatingNewPassword($oRow->user_id, $oRow->new_password)) { $oModelUserNewPassword->deleteConfirmCode($sActivatingCode); $sEmailAddress = $oModelUser->findEmailAddress($oRow->user_id); $aParam = $oModelVUser->getUserParam($oRow->user_id)->toArray(); $oMail = new AppCms2_Controller_Plugin_Mail(); $oMail->sendNewPasswordConfirmation($sEmailAddress, $aParam); } } $this->_redirect("admin/user/login"); }
public function indexAction() { $objUser = new Admin_Model_User(); $this->view->user = $objUser->getOrderBy(); $this->view->layout(); }
/** * Get logged user * * @param no parameters * @return Game_Model_User $user Currently logged in user */ public static function getLoggedUser() { $userID = $this->getLoggedUserID(); $_user = new Admin_Model_User(); return $_user->getUserByID($userID); }
/** * Record the user last login informartion * * @param Admin_Model_User $user * @return type */ public function recordLogin(Admin_Model_User $user) { return $this->_getWriteAdapter()->query("UPDATE " . $this->tbl_user . " SET logdate='" . now() . "', lognum=lognum+1 WHERE user_id='" . $user->getUserId() . "'"); }
function useractiveAction() { $del = new Admin_Model_User(); $id = $this->_request->getParam('id'); $active = $this->_request->getParam('active'); $del->update_user_active($active, $id); }
public function ordernumberAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $oMail = new AppCms2_Controller_Plugin_Mail(); if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); $sHash = md5($aPostData["merchant_id"] . $aPostData["amount"] . $aPostData["descr"] . $aPostData["order_id"] . $aPostData["product_id"] . $aPostData["user_id"] . $aPostData["url"] . $aPostData["restricted"] . $aPostData["time"] . $this->_sAuthKey2); if ($sHash === $aPostData["hash"]) { $oModelVOrderJournal = new Borrower_Model_VOrderJournal(); $oModelOrderCart = new Borrower_Model_OrderCart(); $oModelOrderJournalOrderCart = new Borrower_Model_OrderJournalOrderCart(); $oModelOrderPayment = new User_Model_OrderPayment(); $oModelOrderPaymentHistory = new User_Model_OrderPaymentHistory(); $oModelOrderJournal = new User_Model_OrderJournal(); $oGenereteSessionId = new AppCms2_GenereteSessionId(); $oModelUser = new Admin_Model_User(); $oDb = Zend_Db_Table::getDefaultAdapter(); try { $oDb->beginTransaction(); $nUserId = (int) $aPostData["user_id"]; $nAmount = (int) $aPostData["amount"]; $oUserOrderJournal = $oModelVOrderJournal->getUserOrderJournal($nUserId); $nOrderCartId = $oModelOrderCart->getOrderCartId($nUserId); //pobiera id koszyka użytkownika foreach ($oUserOrderJournal as $oValue) { //sprawdza czy na pewno wszystkie zamówienia znajdują się w koszyku $bIsExists = $oModelOrderJournalOrderCart->findOrderJournal($oValue->id, $nOrderCartId); if (!$bIsExists) { $oModelOrderJournalOrderCart->addOrderJournalOrderCart(array("order_journal_id" => $oValue->id, "order_cart_id" => $nOrderCartId)); } } $oCart = $oModelOrderJournalOrderCart->getCartJournals($nOrderCartId); //pobiera id czasopism znajdujących się w koszyku $nCartCount = $oCart->count(); foreach ($oCart as $oValue) { $sPaymentDescr .= $oValue->order_journal_id; if ($nCartCount > 1) { $sPaymentDescr .= "; "; } } $sPaymentDescr = trim($sPaymentDescr); $aUserParam = $oModelUser->findUser($nUserId); $aPaymentParam = $oGenereteSessionId->generatePaymentParam(); $aPaymentParam["user_id"] = $nUserId; $aPaymentParam["amount"] = $nAmount; $aPaymentParam["descr"] = "Zamówienie nr " . $sPaymentDescr; $aPaymentParam["first_name"] = $aUserParam["first_name"]; $aPaymentParam["last_name"] = $aUserParam["last_name"]; $aPaymentParam["email_address"] = $aUserParam["email_address"]; $aPaymentParam["is_starting"] = 1; $aPaymentParam["date_is_starting"] = time(); $aPaymentParam["payment_type"] = 2; $nOrderPaymentId = $oModelOrderPayment->addRow($aPaymentParam); //tworzy nowy rekord w tabeli płatności i zwraca jego id $oModelOrderJournal->setOrderPaymentId($oCart, $nOrderPaymentId); //łączy czasopismo z płatnością $oModelOrderPaymentHistory->setOrderPaymentHistory($oCart, $nOrderPaymentId); //dodaje informacje do tabeli z historią płatności echo $nOrderPaymentId; $oDb->commit(); } catch (Zend_Exception $e) { $oDb->rollBack(); } } } exit; }
public function renderinvoiceformAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $oModelVOrderPaymentHistory = new Borrower_Model_VOrderPaymentHistory(); $oFormOrderInvoice = new Borrower_Form_OrderInvoice(); $oUser = new Admin_Model_User(); $aJson = null; if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); if ($aPostData["module"] == "borrower" && is_numeric($aPostData["order_payment_id"]) && isset($oFormOrderInvoice)) { $oRowset = $oModelVOrderPaymentHistory->getUserPaymentDetails($this->_nUserId, $aPostData["order_payment_id"]); if ($oRowset->count()) { $aParam["id"] = $aPostData["order_payment_id"]; $aParam["user_email_address"] = $oUser->findEmailAddress($this->_nUserId); $aParam["user_name"] = $this->_sUserName; foreach ($oRowset->toArray() as $nKey => $aValue) { $aParam["amount"] = $aValue["order_payment_total_amount"] / 100 . " PLN"; $aParam["order_id"] .= $aValue["order_journal_id"] . "; "; } } $oFormOrderInvoice->populate($aParam); $aJson = $oFormOrderInvoice->render(); } } header("Content-type: application/json"); echo Zend_Json::encode($aJson); exit; }
private function setUserParam() { $oModelUser = new Admin_Model_User(); $this->_aUserParam = $oModelUser->findUser($this->_nUserId); }
public function editbasicAction() { $do = 'editbasic'; $message = ''; if ($this->getRequest()->getParam('do')) { $do = $this->getRequest()->getParam('do'); } $id = $this->_getParam('id', 0); $u = new Application_Model_DbTable_Mstuser(); $user = $u->getBasicInfo($id); $this->view->u = $user; $this->view->id = $id; $form = new Admin_Form_User_EditBasic(); $form->setName('edituserbasic'); $htmlStringBg = ''; if ($do == 'editbasic') { $form->getElement('id')->setValue($id); $form->getElement('userId')->setValue($user['login']); $form->getElement('role')->setValue($user['role_id']); $form->getElement('email')->setValue($user['email']); $form->getElement('country')->setValue($user['country_id']); $form->getElement('mobile')->setValue($user['mobile']); $form->getElement('active')->setValue($user['is_active']); $form->getElement('temporaryPwd')->setValue($user['is_temporary_pwd']); $form->getElement('blocked')->setValue($user['is_blocked']); $form->getElement('blockedReason')->setValue($user['blocked_reason']); $form->getElement('remarks')->setValue($user['remarks']); } else { if ($do == 'savebasic') { if ($form->isValid($this->getRequest()->getPost())) { /*Save the info*/ $data = array('login' => $this->getRequest()->getPost('userId'), 'role_id' => $this->getRequest()->getPost('role'), 'email' => $this->getRequest()->getPost('email'), 'mobile' => $this->getRequest()->getPost('mobile'), 'is_temporary_pwd' => $this->getRequest()->getPost('temporaryPwd'), 'country_id' => $this->getRequest()->getPost('country'), 'remarks' => $this->getRequest()->getPost('remarks'), 'is_active' => $this->getRequest()->getPost('active'), 'is_blocked' => $this->getRequest()->getPost('blocked'), 'blocked_reason' => $this->getRequest()->getPost('blockedReason')); $id = $this->getRequest()->getParam('id'); $userModel = new Admin_Model_User(); $message = $userModel->updateBasicInfo($id, $data); if ($message == '') { //Successfull $message = 'Successfully updated.'; $user = $u->getBasicInfo($id); //Refresh the background page $this->view->u = $user; $htmlStringBg = $this->view->render('user/viewbasic.ajax.phtml'); } } } } $this->view->form = $form; $htmlString = $this->view->render('user/editbasic.phtml'); $rs = new stdClass(); $rs->do = $do; $rs->debug = $this->getRequest()->getPost(); $rs->message = $message; $rs->htmlBody = $htmlString; $rs->htmlBodyBg = $htmlStringBg; $this->_helper->json($rs); }
public function fetchAll() { // get all users from the login app $userlist = Zend_Json::decode($this->getApiHelper()->direct(array('admin_id' => $this->getSession()->userid, 'token' => uniqid(), 'app' => $this->getApiHelper()->name('login'), 'key' => $this->getApiHelper()->key('login')), $this->getApiHelper()->endpoint('login') . 'getuserlist')); if ($userlist['error'] == 1) { throw new Exception('1 - Failed to load userlist.'); } // get all auditors from the review app $review = Zend_Json::decode($this->getApiHelper()->direct(array('api_key' => $this->getApiHelper()->key('review'), 'action' => 'getUsers'), $this->getApiHelper()->endpoint('review'))); if ($review['success'] == false) { throw new Exception('2 - Failed to load userlist.'); } // get picture, team and skill from love app $love = Zend_Json::decode($this->getApiHelper()->direct(array('action' => 'getUserlist', 'api_key' => $this->getApiHelper()->key('love')), $this->getApiHelper()->endpoint('love'))); if ($love['success'] == false) { throw new Exception('3 - Failed to load userlist.'); } foreach ($userlist as $user) { if (is_array($user)) { $newUser = new Admin_Model_User($user); if (isset($review['userlist']) && isset($review['userlist'][$newUser->getId()])) { $newUser->setAuditor($review['userlist'][$newUser->getId()]['is_auditor'])->setGiver($review['userlist'][$newUser->getId()]['is_giver'])->setReceiver($review['userlist'][$newUser->getId()]['is_receiver']); } if (isset($love['userlist']) && isset($love['userlist'][$newUser->getId()])) { $newUser->setPicture($love['userlist'][$newUser->getId()]['picture'])->setTeam($love['userlist'][$newUser->getId()]['team'])->setSkill($love['userlist'][$newUser->getId()]['skill']); } $users[] = $newUser; } } return $users; }
public function logoutAction() { $this->_user->logout(); // Redirect to the public index page $this->redirect("index/home/"); }