static function get_user_id($username) { $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tblUser->fetchRow("username='******'"); return $rowUser->guid; }
public function getMeEmailAction() { $email = $this->_getParam('email') ? $this->_getParam('email') : ''; if ($email == "undefined") { $this->view->success = false; $this->view->message = 'Email is Empty'; } else { $tableUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tableUser->fetchRow("email='" . $email . "'"); if (!empty($rowUser->email)) { $this->view->success = false; $this->view->message = '<i><b>' . $email . '</b></i> is not available'; } else { $this->view->success = true; $this->view->message = '<i><b>' . $email . '</b></i> is available'; } } }
public function save($aData) { $gman = new Pandamp_Core_Guid(); $guid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid(); //if not empty, there are 2 possibilities $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $row = $tblUser->fetchRow("guid='{$guid}'"); if (empty($row)) { if (empty($aData['username'])) { throw new Zend_Exception('Username can not be EMPTY!'); } if (empty($aData['password'])) { throw new Zend_Exception('Password can not be EMPTY!'); } $row = $tblUser->createRow(); if (isset($aData['password']) && !empty($aData['password'])) { $password = $aData['password']; $crypt = new Pandamp_Crypt_Password(); $password = $crypt->encryptPassword($password); $row->password = $password; } } if (isset($aData['username']) && !empty($aData['username'])) { //check if username was already taken $username = $aData['username']; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUsername = $tblUser->fetchRow("username='******'"); if ($rowUsername) { throw new Zend_Exception('Username exists'); } $row->username = $aData['username']; } if (isset($aData['email'])) { $row->email = $aData['email']; } if (isset($aData['fullName'])) { $row->fullName = $aData['fullName']; } if (isset($aData['chkGender'])) { $row->gender = $aData['chkGender'] == 1 ? 'L' : 'P'; } if (isset($aData['year'])) { $row->birthday = $aData['year'] . '-' . $aData['month'] . '-' . $aData['day']; } if (isset($aData['education'])) { $row->educationId = $aData['education']; } if (isset($aData['expense'])) { $row->expenseId = $aData['expense']; } if (isset($aData['company'])) { $row->company = $aData['company']; } if (isset($aData['businessType'])) { $row->businessTypeId = $aData['businessType']; } if (isset($aData['phone'])) { $row->phone = $aData['phone']; } if (isset($aData['fax'])) { $row->phone = $aData['fax']; } if (isset($aData['packageId'])) { $row->packageId = $aData['packageId']; } if (isset($aData['newArtikel']) && $aData['newArtikel'] == 1) { $row->newArticle = 'Y'; } else { if (!isset($aData['email']) && !isset($aData['username'])) { $row->newArticle = 'N'; } } if (isset($aData['newRegulation']) && $aData['newRegulation'] == 1) { $row->monthlyList = 'Y'; } else { if (!isset($aData['email']) && !isset($aData['username'])) { $row->monthlyList = 'N'; } } if (isset($aData['newWeeklyRegulation']) && $aData['newWeeklyRegulation'] == 1) { $row->weeklyList = 'Y'; } else { if (!isset($aData['email']) && !isset($aData['username'])) { $row->weeklyList = 'N'; } } $row->save(); return $row; }
function getMeEmailAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $email = $request->getParam('email') ? $request->getParam('email') : ''; $response = array(); if ($email == "undefined") { $response['failure'] = true; $response['message'] = 'Email is Empty'; } else { $tableUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tableUser->fetchRow("email='" . $email . "'"); if (!empty($rowUser->email)) { $response['failure'] = true; $response['message'] = '<i><b>' . $email . '</b></i> is not available'; } else { $response['success'] = true; $response['message'] = '<i><b>' . $email . '</b></i> is available'; } } echo Zend_Json::encode($response); }