本文整理汇总了PHP中CommonFunctions::isValidEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::isValidEmail方法的具体用法?PHP CommonFunctions::isValidEmail怎么用?PHP CommonFunctions::isValidEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::isValidEmail方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
//=====================START FORM VALIDATION===================================
if (!isset($formData['business_name']) || trim($formData['business_name']) == "") {
$formErrors['business_name'] = "Please enter your business name";
}
if (!isset($formData['contact_name']) || trim($formData['contact_name']) == "") {
$formErrors['contact_name'] = "Please enter contact name";
}
if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
$formErrors['user_name'] = "Please enter username";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter your email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
if (!isset($formData['verify_user_password']) || trim($formData['verify_user_password']) == "") {
$formErrors['verify_user_password'] = "Please enter verify password";
}
if ($formData['user_password'] != $formData['verify_user_password']) {
$formErrors['verify_user_password'] = "Your password does not match";
}
if (!isset($formData['agree']) || trim($formData['agree']) == "") {
$formErrors['agree'] = "Please check agree";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
if ($this->modelCompany->isExist('user_name="' . $formData['user_name'] . '"')) {
if (!array_key_exists('user_name', $formErrors)) {
$formErrors['user_name'] = "Username already exist";
}
}
if ($this->modelCompany->isExist('user_email="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
//=====================END FORM VALIDATION===================================
if (count($formErrors) == 0) {
$sessionPost = new Zend_Session_Namespace('step1Post');
$sessionPost->formData = $formData;
$this->_redirect('company/register/step2');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fieild to register.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例2: addAction
public function addAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
if ($this->getRequest()->isPost() && isset($formData['add_author']) && $formData['add_author'] == 'Add Author') {
$formData = $this->getRequest()->getPost();
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (isset($formData['emailid']) && trim($formData['emailid']) != "") {
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
}
if ($formData['emailid'] != '') {
if ($this->modelAuthor->isExist('emailid="' . $formData['emailid'] . '" and parent_id!="0"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
//$formData['password']=CommonFunctions::getRandomNumberPassword(8);
$enc_password = md5($formData['password']);
$formData['parent_publisher_id'] = !empty($this->sessPublisherInfo->id) ? $this->sessPublisherInfo->id : 0;
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$authorData = array('user_type' => 'author', 'parent_id' => $formData['parent_publisher_id'], 'username' => $formData['username'], 'emailid' => $formData['emailid'], 'password' => $enc_password, 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'add_time' => $add_time);
$lastId = $this->modelAuthor->insert($authorData);
if ($lastId > 0) {
$this->_flashMessenger->addMessage('<div class="div-success">Author Added successfully</div>');
$this->_redirect('publisher/author/index/tab_ajax/author/');
}
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fields to register.</div>';
}
} else {
$formData['user_type'] = "";
$formData['first_name'] = "";
$formData['last_name'] = "";
$formData['emailid'] = "";
$formData['password'] = "";
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例3: profilesettingsAction
public function profilesettingsAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$formData = array();
$formErrors = array();
$UserInfo = $this->modelCompany->fetchRow('id=' . $this->sessUserInfo->id);
$formData = $UserInfo->toArray();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if (!empty($formData['update_profile']) && $formData['update_profile'] == 'Update') {
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['country']) || trim($formData['country']) == "") {
$formErrors['country'] = "Please enter country";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter email address";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
if ($this->modelPublisher->isExist('emailid="' . $formData['user_email'] . '"') || $this->modelUsers->isExist('emailid="' . $formData['user_email'] . '"') || $this->modelCompany->isExist('user_email="' . $formData['user_email'] . '" and id!="' . $this->sessUserInfo->id . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
if (count($formErrors) == 0) {
$userData = array('first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'user_email' => $formData['user_email'], 'user_name' => $formData['user_email'], 'country' => $formData['country'], 'updated_date' => date("Y-m-d H:i:s"));
$result = $this->modelCompany->update($userData, 'id=' . $this->sessUserInfo->id);
$this->_flashMessenger->addMessage('<div class="div-success">Profile updated successfully</div>');
$this->_redirect('user/index/profilesettings/');
}
} else {
$userInfo = $this->modelUsers->fetchRow('id=' . $this->sessUserInfo->id);
$formData = $userInfo->toArray();
//print_r($formData);exit;
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例4: editAction
public function editAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$id = $this->_request->getParam('id', 0);
if ($id > 0 && $this->modelPublisher->isExist($id)) {
$formData = array();
$formErrors = array();
$userInfo = $this->modelPublisher->fetchRow('id=' . $id);
$formData = $userInfo->toArray();
if ($this->getRequest()->isPost() && isset($_REQUEST['edit_group']) && $_REQUEST['edit_group'] == 'Edit Group') {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if (!isset($formData['user_type']) || trim($formData['user_type']) == "") {
$formErrors['user_type'] = "Please select user type ";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['emailid']) || trim($formData['emailid']) == "") {
$formErrors['emailid'] = "Please enter email";
}
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
if ($this->modelPublisher->isExist('emailid="' . $formData['emailid'] . '" AND id<>' . $id) || $this->modelCompany->isExist('user_email="' . $formData['emailid'] . '"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
if (count($formErrors) == 0) {
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$groupUserData = array('user_type' => $formData['user_type'], 'emailid' => $formData['emailid'], 'password' => $formData['password'], 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"));
$result = $this->modelPublisher->update($groupUserData, 'id=' . $id);
$this->_flashMessenger->addMessage('<div class="div-success">Group user updated successfully</div>');
$this->_redirect('publisher/group/index/tab_ajax/group/');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required field properly.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
} else {
$this->_redirect('publisher/group/index/tab_ajax/group/');
}
}
示例5: editAction
public function editAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$id = $this->_request->getParam('id', 0);
if ($id > 0 && $this->modelPublisher->isExist($id)) {
$formData = array();
$formErrors = array();
$userInfo = $this->modelPublisher->fetchRow('id=' . $id);
$formData = $userInfo->toArray();
if ($this->getRequest()->isPost() && isset($_REQUEST['edit_group']) && $_REQUEST['edit_group'] == 'Edit Group') {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if (!isset($formData['user_type']) || trim($formData['user_type']) == "") {
$formErrors['user_type'] = "Please select user type ";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['emailid']) || trim($formData['emailid']) == "") {
$formErrors['emailid'] = "Please enter email";
}
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
if ($this->modelPublisher->isExist('emailid="' . $formData['emailid'] . '" AND id<>' . $id) || $this->modelCompany->isExist('user_email="' . $formData['emailid'] . '"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
if (count($formErrors) == 0) {
if ($formData['password'] != "Please enter new password") {
$enc_password = md5($formData['password']);
} else {
$enc_password = $userInfo['password'];
}
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$implode_module_active = @implode(",", $formData['module_active']);
$groupUserData = array('user_type' => $formData['user_type'], 'emailid' => $formData['emailid'], 'password' => $enc_password, 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'module_active' => $implode_module_active, 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"));
$result = $this->modelPublisher->update($groupUserData, 'id=' . $id);
$publication_active = $formData['publication_activ'];
$publishr_user = $this->modelPublisher->fetchRow('id=' . $id);
$this->modelPublisher->deleteAssignPublication($publishr_user['parent_id'], $id);
if (count($publication_active) > 0) {
foreach ($publication_active as $publications_id) {
$dataArray = array("publisher_id" => $publishr_user['parent_id'], "product_id" => $publications_id, "group_user_id" => $id);
$gg = $this->modelPublisher->insertAssignUserPublication($dataArray);
}
}
$this->_flashMessenger->addMessage('<div class="div-success">Group user updated successfully</div>');
$this->_redirect('publisher/group/index/tab_ajax/group/');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required field properly.</div>';
}
}
#################### get newsletter list #############################
$storage = new Zend_Auth_Storage_Session('publisher_type');
$data = $storage->read();
$this->publicationListObj = new Publisher_Model_DbTable_Issues();
$getNewsLetterData = $this->publicationListObj->getPublicationList($data->id, '1');
$this->publicationListObj = new Publisher_Model_DbTable_Issues();
$getMagazinesData = $this->publicationListObj->getPublicationList($data->id, '2');
$this->publicationListObj = new Publisher_Model_DbTable_Issues();
$getBookData = $this->publicationListObj->getPublicationList($data->id, '3');
########################################################################
$group_user_id = $id;
$assign_publications_ids = $this->modelPublisher->getAssignPublicationsList($group_user_id);
$publication_ids = array();
for ($j = 0; $j < count($assign_publications_ids); $j++) {
$publication_ids[] = $assign_publications_ids[$j]['product_id'];
}
$this->view->assign_publications_ids = $publication_ids;
$this->view->getNewsLetterData = $getNewsLetterData;
$this->view->getMagazinesData = $getMagazinesData;
$this->view->getBookData = $getBookData;
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
} else {
$this->_redirect('publisher/group/index/tab_ajax/group/');
}
}
示例6: indexAction
public function indexAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
//=====================START FORM VALIDATION===================================
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter your first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter your last name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter your email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
/*if(!(isset($formData['verify_user_password'])) || trim($formData['verify_user_password'])=="")
{
$formErrors['verify_user_password']="Please enter verify password";
}
if($formData['user_password']!=$formData['verify_user_password'])
{
$formErrors['verify_user_password']="Your password does not match";
}
*/
if (!isset($formData['agree']) || trim($formData['agree']) == "") {
$formErrors['agree'] = "Please check agree";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
if ($this->modelCompany->isExist('user_email="' . $formData['user_email'] . '"') || $this->modelPublisher->isExist('emailid="' . $formData['user_email'] . '"') || $this->modelGroup->isExist('emailid="' . $formData['user_email'] . '"') || $this->modelMember->isExist('emailid="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
//=====================END FORM VALIDATION===================================
if (count($formErrors) == 0) {
//$sessionPost = new Zend_Session_Namespace('step1Post');
//$sessionPost->formData=$formData;
//$this->_redirect('company/register/step2');
$activationCode = CommonFunctions::generateGUID();
$username_array = explode("@", $formData['user_email']);
$formData['username'] = $username_array[0];
$companyData = array('first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'account_type' => 1, 'user_name' => $formData['username'], 'user_email' => $formData['user_email'], 'user_password' => $formData['user_password'], 'country' => $formData['country'], 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"), 'activation_code' => $activationCode, 'status' => '0');
$lastId = $this->modelCompany->insert($companyData);
if ($lastId > 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Evendor</title>
</head>
<body style="font-family: \'Calibri\', arial;">
<div id="container" style="width:80%; margin:0 auto;">
<header id="heder">
<div style="padding:15px 0px; background:#000000;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"></a></div>
</header>
<div style="background:#656565; padding:15px; min-height:200px;">
<aside>
<p style="color:#FFBF00; font-weight:bold;">User Registration Email</p>
<p style="color:#ffffff; font-weight:bold;">Your login details given below :</p>
<p style="color:#ffffff;"><label style="color:#FFBF00; font-weight:bold; display:inline-block; width:100px;">Username:</label>' . $formData['user_email'] . '</p>
<p style="color:#ffffff;"><label style="color:#FFBF00; font-weight:bold; display:inline-block; width:100px;">Password:</label>' . $formData['user_password'] . '</p>
<BR />
<p style="color:#ffffff;">Activate your account by using given below link :</p>
<BR />
<p style="color:#ffffff;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/company/register/verification/' . $activationCode . '">Account Activation Link</a></p>
<br>
<p> </p>
</aside>
</div>
<div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;">
<br>
© Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd.
</div>
</div>
</body>
</html>';
$mail = new Zend_Mail();
$mail->addTo($formData['user_email']);
$mail->setSubject("Company Registration Email");
$mail->setBodyHtml($message);
//.........这里部分代码省略.........
示例7: addAction
public function addAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
if ($this->getRequest()->isPost() && isset($formData['add_author']) && $formData['add_author'] == 'Add Author') {
$formData = $this->getRequest()->getPost();
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['emailid']) || trim($formData['emailid']) == "") {
$formErrors['emailid'] = "Please enter email";
}
/*if(!(isset($formData['password'])) || trim($formData['password'])=="")
{
$formErrors['password']="Please enter password";
}
*/
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
/*if($this->modelAuthor->isExist('username="'.$formData['username'].'"'))
{
if(!(array_key_exists('username',$formErrors)))
{
$formErrors['username']="Username already exist";
}
}
*/
if ($this->modelAuthor->isExist('emailid="' . $formData['emailid'] . '"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
$formData['password'] = CommonFunctions::getRandomNumberPassword(8);
$formData['parent_publisher_id'] = !empty($this->sessPublisherInfo->id) ? $this->sessPublisherInfo->id : 0;
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$authorData = array('user_type' => 'author', 'parent_id' => $formData['parent_publisher_id'], 'username' => $formData['username'], 'emailid' => $formData['emailid'], 'password' => $formData['password'], 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'add_time' => $add_time);
$lastId = $this->modelAuthor->insert($authorData);
if ($lastId > 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Electronic Vendor Ltd</title>
<style type="text/css">
body{
margin:0;
padding:0px;
}
#container{
width:700px;
margin:0 auto;
}
#header{
width:700px;
float:left;
padding:40px 0 10px 0;
font-family:Arial, Helvetica, sans-serif;
color:#3A3B3F;
text-align:center;
font-size:11px;
}
#header a{
color:#3A3B3F;
font-weight:bold;
text-decoration:none;
}
#header a:hover{
color:#40BBE3;
}
#logopart
{
border:0px solid red;
width:698px;
height:140px;
background-color:#1B75BB;
margin-left:0px;
}
#content{
width:698px;
float:left;
padding:0px 0px 10px 0px;
//.........这里部分代码省略.........
示例8: editAction
public function editAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$id = $this->_request->getParam('id', 0);
if ($id > 0 && $this->modelCompany->isExist($id)) {
$formData = array();
$formErrors = array();
$userInfo = $this->modelCompany->fetchRow('id=' . $id);
$formData = $userInfo->toArray();
$GroupList = $this->modelGroup->getGroupList($this->sessCompanyInfo->id);
$this->view->GroupList = $GroupList;
if ($this->getRequest()->isPost() && isset($_REQUEST['edit_member']) && $_REQUEST['edit_member'] == 'Edit Member') {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if (!isset($formData['group_id']) || empty($formData['group_id'])) {
$formErrors['group_id'] = "Please select a group";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter password";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
/*if($this->modelCompany->isExist('username="'.$formData['username'].'"'))
{
if(!(array_key_exists('username',$formErrors)))
{
$formErrors['username']="Username already exist";
}
}
*/
if ($this->modelCompany->isExist('user_email="' . $formData['user_email'] . '" AND id<>' . $id) || $this->modelPublisher->isExist('emailid="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
if ($formData['user_password'] != "Please enter new password") {
$enc_password = md5($formData['user_password']);
} else {
$enc_password = $userInfo['user_password'];
}
if (count($formErrors) == 0) {
$username_array = explode("@", $formData['user_email']);
$formData['username'] = $username_array[0];
$MemberUserData = array('group_id' => $formData['group_id'], 'user_email' => $formData['user_email'], 'user_password' => $enc_password, 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'status' => '1', 'group_status' => '1', 'updated_date' => date("Y-m-d H:i:s"));
$result = $this->modelCompany->update($MemberUserData, 'id=' . $id);
$this->_flashMessenger->addMessage('<div class="div-success">Member user updated successfully</div>');
$this->_redirect('company/member/');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required field properly.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
} else {
$this->_redirect('company/member/');
}
}
示例9: viewAction
public function viewAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$id = $this->_request->getParam('id', 0);
if ($id > 0 && $this->modelEnquiry->isExist($id)) {
$formData = array();
$formErrors = array();
$userInfo = $this->modelEnquiry->fetchRow('id=' . $id);
$formData = $userInfo->toArray();
if ($this->getRequest()->isPost()) {
$formDataUpdate = $this->getRequest()->getPost();
if (!isset($formDataUpdate['email']) || trim($formDataUpdate['email']) == "") {
$formErrors['email'] = 'Please enter email';
}
if (!isset($formDataUpdate['contact_message']) || trim($formDataUpdate['contact_message']) == "") {
$formErrors['contact_message'] = 'Please enter message';
}
if (!CommonFunctions::isValidEmail($formDataUpdate['email'])) {
if (!array_key_exists('email', $formErrors)) {
$formErrors['email'] = "Please enter valid email";
}
}
if (count($formErrors) == 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Evendor</title>
</head>
<body style="font-family: \'Calibri\', arial;">
<div id="container" style="width:80%; margin:0 auto;">
<header id="heder">
<div style="padding:15px 0px; background:#000000;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"></a></div>
</header>
<div style="background:#656565; padding:15px; min-height:200px;">
<aside>
<p style="color:#FFBF00; font-weight:bold;">Customer Enquiry Reply Email</p>
<p style="color:#ffffff; font-weight:bold;">Message has been sent successfully.</p>
<br />
<p> </p>
</aside>
</div>
<div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;">
<br>
© Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd.
</div>
</div>
</body>
</html>';
$mail = new Zend_Mail();
$mail->addTo($formData['email']);
$mail->setSubject("Customer Reply Email");
$mail->setBodyHtml($message);
$mail->setFrom(SETFROM, SETNAME);
if ($mail->send()) {
$updateData['status'] = 'replied';
$result = $this->modelEnquiry->update($updateData, "id='{$id}'");
if ($result > 0) {
$this->_flashMessenger->addMessage('<div class="div-success">Your message has been sent successfully</div>');
$this->_redirect('admin/enquirys/view/id/' . $id);
} else {
$this->view->errorMessage = '<div class="div-error">Sorry!, unable to update status</div>';
}
} else {
$this->view->errorMessage = '<div class="div-error">Evendor could not sent any confirmation mail</div>';
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required field properly.</div>';
}
$this->view->formDataUpdate = $formDataUpdate;
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
}
示例10: emailsettingAction
public function emailsettingAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$emailConstantList = $this->modelSiteSetting->getList("site_constant='ADMIN_NAME' OR site_constant='ADMIN_EMAIL' OR site_constant='SET_FROM_NAME' OR site_constant='SETFROM'");
$this->view->emailConstantList = $emailConstantList;
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData['constant_value']);exit;
if (isset($formData['constant_value']) && !empty($formData['constant_value'])) {
foreach ($formData['constant_value'] as $cnanme => $constant_value) {
if (!isset($formData['constant_value'][$cnanme]) || trim($formData['constant_value'][$cnanme]) == "") {
$formErrors['constant_value'][$cnanme] = "Please enter constant value";
}
if (($cnanme == 'ADMIN_EMAIL' || $cnanme == 'SETFROM') && !CommonFunctions::isValidEmail($constant_value)) {
$formErrors['constant_value'][$cnanme] = "Please enter valid email";
}
}
}
if (count($formErrors) == 0) {
foreach ($formData['constant_value'] as $ucnanme => $updateconstant_value) {
$result = $this->modelSiteSetting->update(array('constant_value' => $updateconstant_value), 'site_constant="' . $ucnanme . '"');
}
$this->_flashMessenger->addMessage('<div class="div-success">Email settings have been changed successfully</div>');
$this->_redirect('admin/sitesettings/');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fields properly.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例11: indexAction
public function indexAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
//=====================START FORM VALIDATION===================================
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter your first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter your last name";
}
if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
$formErrors['user_name'] = "Please enter user name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter your email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
if (!isset($formData['verify_user_password']) || trim($formData['verify_user_password']) == "") {
$formErrors['verify_user_password'] = "Please enter verify password";
}
if (!isset($formData['agree']) || trim($formData['agree']) == "") {
$formErrors['agree'] = "Please check agree";
}
if ($formData['user_password'] != $formData['verify_user_password']) {
$formErrors['verify_user_password'] = "Your password does not match";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
if ($this->modelCandidates->isExist('user_name="' . $formData['user_name'] . '"')) {
if (!array_key_exists('user_name', $formErrors)) {
$formErrors['user_name'] = "Username already exist";
}
}
if ($this->modelCandidates->isExist('user_email="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
//=====================END FORM VALIDATION===================================
if (count($formErrors) == 0) {
//======inserting data to the candidate table===============
$activationCode = CommonFunctions::generateGUID();
$activationStartTime = strtotime(date('Y-m-d H:i:s'));
$activationExpireTime = strtotime(date('Y-m-d H:i:s', strtotime("+1 days")));
//echo "TIME::::".$activationStartTime."====TIME 2:::".strtotime(date('Y-m-d H:i:s'))."===EXPIRE TIME:::".$activationExpireTime;exit;
$candidateData = array('user_name' => $formData['user_name'], 'user_email' => $formData['user_email'], 'user_password' => $formData['user_password'], 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"), 'status' => 0, 'activation_code' => $activationCode, 'activation_start_time' => $activationStartTime, 'activation_expire_time' => $activationExpireTime);
$lastId = $this->modelCandidates->insert($candidateData);
if ($lastId) {
//======inserting data to the candidate profile table===============
$agree = isset($formData['agree']) && $formData['agree'] != "" ? 1 : 0;
$signup_newsletter = isset($formData['signup_newsletter']) && $formData['signup_newsletter'] != "" ? 1 : 0;
$notify_jobs = isset($formData['notify_jobs']) && $formData['notify_jobs'] != "" ? 1 : 0;
$profileData = array('user_id' => $lastId, 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'agree' => $agree, 'signup_newsletter' => $signup_newsletter, 'notify_jobs' => $notify_jobs, 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"));
$this->modelCandidateProfiles->insert($profileData);
$sessionPost = new Zend_Session_Namespace('step1Post');
$sessionPost->user_id = $lastId;
$this->_redirect('user/register/step2');
} else {
$this->view->errorMessage = '<div class="div-error">Sorry, unable to register, please try later.</div>';
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter email required field to register.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例12: indexAction
public function indexAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$pageTitle = $this->_request->getParam('title', 0);
if ($this->modelPage->isExist($pageTitle)) {
$this->view->pageInfo = $this->modelPage->fetchRow('url_friendly_title="' . $pageTitle . '"');
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost() && $pageTitle == 'contact-us') {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if (isset($formData['cid'])) {
$capId = trim($formData['cid']);
$capSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $capId);
if ($formData['captcha'] == $capSession->word) {
if (!isset($formData['contact_name']) || trim($formData['contact_name']) == "") {
$formErrors['contact_name'] = "Please enter first name";
}
if (!isset($formData['contact_email']) || trim($formData['contact_email']) == "") {
$formErrors['contact_email'] = "Please enter email";
}
if (!isset($formData['contact_message']) || trim($formData['contact_message']) == "") {
$formErrors['contact_message'] = "Please enter your message";
}
if (!CommonFunctions::isValidEmail($formData['contact_email'])) {
if (!array_key_exists('contact_email', $formErrors)) {
$formErrors['contact_email'] = "Please enter valid email";
}
}
} else {
$formErrors['security_code'] = "You have entered wrong security code.";
}
} else {
$formErrors['security_code'] = "Please enter security code properly.";
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$add_time = date('Y-m-d H:i:s');
$user_permission = isset($formData['agree']) && !empty($formData['agree']) && $formData['agree'] == 1 ? 1 : 0;
$enquiryData = array('name' => $formData['contact_name'], 'email' => $formData['contact_email'], 'phone' => $formData['contact_phone'], 'suggestion' => $formData['contact_message'], 'user_permission' => $user_permission, 'status' => 'pending', 'add_time' => $add_time);
$lastId = $this->modelEnquiry->insert($enquiryData);
if ($lastId > 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Evendor</title>
</head>
<body style="font-family: \'Calibri\', arial;">
<div id="container" style="width:80%; margin:0 auto;">
<header id="heder">
<div style="padding:15px 0px; background:#000000;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"></a></div>
</header>
<div style="background:#656565; padding:15px; min-height:200px;">
<aside>
<p style="color:#FFBF00; font-weight:bold;">Customer Enquiry Email</p>
<p style="color:#ffffff; font-weight:bold;">Your enquiry has been sent successfully. Evendor admin will contact you soon</p>
<br />
<p> </p>
</aside>
</div>
<div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;">
<br>
© Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd.
</div>
</div>
</body>
</html>';
$mail = new Zend_Mail();
$mail->addTo($formData['contact_email']);
$mail->setSubject("Customer Enquiry Email");
$mail->setBodyHtml($message);
$mail->setFrom(SETFROM, SETNAME);
if ($mail->send()) {
$this->_flashMessenger->addMessage('<div class="div-success">Your enquiry has been sent successfully. Our representative will get back to you soon.</div>');
//$this->_flashMessenger->addMessage('<div class="div-success">You have an email from Evendor.</div>');
$this->_redirect('page/index/title/contact-us/');
} else {
$this->view->errorMessage = '<div class="div-error">Evendor could not sent any confirmation mail to you but Admin will contact you soon.</div>';
}
}
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fields properly.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
} else {
$this->_redirect('/');
//.........这里部分代码省略.........
示例13: editAction
public function editAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$id = $this->_request->getParam('id', 0);
if ($id > 0 && $this->modelAdminUsers->isExist($id)) {
$formData = array();
$formErrors = array();
$formDataSave = array();
$userInfo = $this->modelAdminUsers->fetchRow('id=' . $id);
$formData = $userInfo->toArray();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
$module = "";
for ($ii = 0; $ii < count($formData['modulename']); $ii++) {
$module .= $formData['modulename'][$ii] . ",";
}
$modules = substr($module, 0, -1);
if (!isset($modules) || trim($modules) == "") {
$formErrors['modulename'] = "Please select atleact one module";
}
if (!isset($formData['firstname']) || trim($formData['firstname']) == "") {
$formErrors['firstname'] = "Please enter first name";
}
if (!isset($formData['lastname']) || trim($formData['lastname']) == "") {
$formErrors['lastname'] = "Please enter last name";
}
if (!isset($formData['username']) || trim($formData['username']) == "") {
$formErrors['username'] = "Please enter username";
}
/*if(!(isset($formData['password'])) || trim($formData['password'])=="")
{
$formErrors['password']="Please enter password";
}
*/
if (!isset($formData['email']) || trim($formData['email']) == "") {
$formErrors['email'] = "Please enter email";
}
if (!CommonFunctions::isValidEmail($formData['email'])) {
if (!array_key_exists('email', $formErrors)) {
$formErrors['email'] = "Please enter valid email";
}
}
if (count($formErrors) == 0) {
$formDataSave['first_name'] = $formData['firstname'];
$formDataSave['last_name'] = $formData['lastname'];
$formDataSave['user_email'] = $formData['email'];
$formDataSave['user_name'] = $formData['username'];
if ($formData['password'] != "Please enter new password") {
$enc_password = md5($formData['password']);
} else {
$enc_password = $userInfo['password'];
}
$formDataSave['user_password'] = $enc_password;
$formDataSave['modules'] = $modules;
$result = $this->modelAdminUsers->update($formDataSave, 'id=' . $id);
$this->_flashMessenger->addMessage('<div class="div-success">Sub-Admin user updated successfully</div>');
$this->_redirect('admin/adminusers/');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fields properly.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
} else {
$this->_redirect('admin/adminusers/');
}
}