本文整理汇总了PHP中Validate::isEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isEmail方法的具体用法?PHP Validate::isEmail怎么用?PHP Validate::isEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validate
的用法示例。
在下文中一共展示了Validate::isEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
parent::postProcess();
// Déconnexion
if (Tools::getIsset('logout')) {
Auth::disconnect();
Flash::add('Vous êtes bien déconnécté');
Tools::redirect($this->context->link->getPageLink('auth'));
} elseif (Tools::isSubmit('submitLogin')) {
$user = (new User())->getByEmail(Tools::getValue('username'), Tools::getValue('password'));
if (!Validate::isLoadedObject($user)) {
$this->errors[] = 'Identifiant ou mot de passe incorrect';
} else {
Auth::setUser($user);
Tools::redirect($this->context->link->getPageLink('comments'));
}
} elseif (Tools::isSubmit('submitSubscribe')) {
/**
* - Vérification des champs
* - Verification non-existant
* - Inscription
* - Login
*/
if (!Validate::isEmail($email = Tools::getValue('username'))) {
return $this->errors[] = 'Veuillez saisir une adresse e-mail correcte';
}
if (!Validate::isPasswd($password = Tools::getValue('password'))) {
/// @todo être plus spécifique sur les règles de mot de passes valides
return $this->errors[] = 'Veuillez saisir un mot de passe correct';
}
$user = new User();
if (Validate::isLoadedObject($user->getByEmail($email))) {
$this->errors[] = 'Un compte avec cet identifiant existe déjà';
} else {
$user->login = $email;
$user->password = Tools::encrypt($password);
if (!$user->save()) {
$this->errors[] = 'Impossible de vous enregistrer, veuillez réessayer ultérieurement (' . Db::getInstance()->getMsgError() . ')';
} else {
Auth::setUser($user);
Flash::success('Bienvenue! Votre compte a bien été créé');
Tools::redirect($this->context->link->getPageLink('comments'));
}
}
} elseif (Auth::getUser()) {
Tools::redirect($this->context->link->getPageLink('comments'));
}
}
示例2: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
$origin_newsletter = (bool) $this->customer->newsletter;
if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) {
$this->customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
}
if (Tools::isSubmit('submitIdentity')) {
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
$this->errors[] = Tools::displayError('Invalid date of birth.');
} else {
$email = trim(Tools::getValue('email'));
$this->customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
if (isset($_POST['old_passwd'])) {
$_POST['old_passwd'] = trim($_POST['old_passwd']);
}
if (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('This email address is not valid');
} elseif ($this->customer->email != $email && Customer::customerExists($email, true)) {
$this->errors[] = Tools::displayError('An account using this email address has already been registered.');
} elseif (!isset($_POST['old_passwd']) || empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != $this->context->cookie->passwd) {
$this->errors[] = Tools::displayError('The password you entered is incorrect.');
} elseif ($_POST['passwd'] != $_POST['confirmation']) {
$this->errors[] = Tools::displayError('The password and confirmation do not match.');
} else {
$prev_id_default_group = $this->customer->id_default_group;
// Merge all errors of this file and of the Object Model
$this->errors = array_merge($this->errors, $this->customer->validateController());
}
if (!count($this->errors)) {
$this->customer->id_default_group = (int) $prev_id_default_group;
$this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname));
if (!isset($_POST['newsletter'])) {
$this->customer->newsletter = 0;
} elseif (!$origin_newsletter && isset($_POST['newsletter'])) {
if ($module_newsletter = Module::getInstanceByName('blocknewsletter')) {
if ($module_newsletter->active) {
$module_newsletter->confirmSubscription($this->customer->email);
}
}
}
if (!isset($_POST['optin'])) {
$this->customer->optin = 0;
}
if (Tools::getValue('passwd')) {
$this->context->cookie->passwd = $this->customer->passwd;
}
if ($this->customer->update()) {
$this->context->cookie->customer_lastname = $this->customer->lastname;
$this->context->cookie->customer_firstname = $this->customer->firstname;
$this->context->smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('The information cannot be updated.');
}
}
}
} else {
$_POST = array_map('stripslashes', $this->customer->getFields());
}
return $this->customer;
}
示例3: getContent
public function getContent()
{
$this->_html = '<h2>Paypal</h2>';
if (isset($_POST['submitPaypal'])) {
if (empty($_POST['business'])) {
$this->_postErrors[] = $this->l('Paypal business e-mail address is required.');
} elseif (!Validate::isEmail($_POST['business'])) {
$this->_postErrors[] = $this->l('Paypal business must be an e-mail address.');
}
if (!isset($_POST['sandbox'])) {
$_POST['sandbox'] = 1;
}
if (!sizeof($this->_postErrors)) {
Configuration::updateValue('PAYPAL_BUSINESS', strval($_POST['business']));
Configuration::updateValue('PAYPAL_SANDBOX', intval($_POST['sandbox']));
Configuration::updateValue('PAYPAL_HEADER', strval($_POST['header']));
$this->displayConf();
} else {
$this->displayErrors();
}
}
$this->displayPayPal();
$this->displayFormSettings();
return $this->_html;
}
示例4: processProductTabContent
public function processProductTabContent()
{
if (Tools::isSubmit('mymod_pc_submit_comment')) {
$id_product = Tools::getValue('id_product');
$firstname = Tools::getValue('firstname');
$lastname = Tools::getValue('lastname');
$email = Tools::getValue('email');
$grade = Tools::getValue('grade');
$comment = Tools::getValue('comment');
if (!Validate::isName($firstname) || !Validate::isName($lastname) || !Validate::isEmail($email)) {
$this->context->smarty->assign('new_comment_posted', 'error');
return false;
}
$MyModComment = new MyModComment();
$MyModComment->id_shop = (int) $this->context->shop->id;
$MyModComment->id_product = (int) $id_product;
$MyModComment->firstname = $firstname;
$MyModComment->lastname = $lastname;
$MyModComment->email = $email;
$MyModComment->grade = (int) $grade;
$MyModComment->comment = nl2br($comment);
$MyModComment->add();
$this->context->smarty->assign('new_comment_posted', 'success');
$this->module->smartyClearCache('displayProductTabContent.tpl', $this->cache_id);
}
}
示例5: getContent
public function getContent()
{
$output = null;
if (Tools::isSubmit('submit' . $this->name)) {
$list_value = strval(Tools::getValue('PROFIT_MARGIN'));
if (!$list_value || empty($list_value) || !Validate::isFloat($list_value)) {
$output .= $this->displayError($this->l('Invalid Configuration value'));
} else {
$email_value = strval(Tools::getValue('ORDER_CNF_MANAGER_EMAIL'));
if (Tools::getValue('ADMIN_CONFIRM_ORDER') == '1' && (empty($email_value) || !Validate::isEmail($email_value))) {
$output .= $this->displayError($this->l('Please enter valid Email ID'));
} else {
$email_value = strval(Tools::getValue('PRODUCT_REQUEST_EMAIL'));
if (empty($email_value) || !Validate::isEmail($email_value)) {
$output .= $this->displayError($this->l('Please enter valid Email ID'));
} else {
Configuration::updateValue('PROFIT_MARGIN', $list_value);
Configuration::updateValue('PRODUCT_DYNAMIC_PRICE', Tools::getValue('PRODUCT_DYNAMIC_PRICE'));
Configuration::updateValue('ORDER_CNF_MANAGER_EMAIL', Tools::getValue('ORDER_CNF_MANAGER_EMAIL'));
Configuration::updateValue('ADMIN_CONFIRM_ORDER', Tools::getValue('ADMIN_CONFIRM_ORDER'));
Configuration::updateValue('PRODUCT_REQUEST_EMAIL', Tools::getValue('PRODUCT_REQUEST_EMAIL'));
Configuration::updateValue('PRODUCT_REQUEST_SAMPLE', Tools::getValue('PRODUCT_REQUEST_SAMPLE'));
Configuration::updateValue('PRODUCT_DOWNLOAD_BUTTON', Tools::getValue('PRODUCT_DOWNLOAD_BUTTON'));
$output .= $this->displayConfirmation($this->l('Settings updated'));
}
}
}
}
$this->context->controller->addJS($this->_path . 'websitesettings.js');
//return $this->display(__FILE__,'productupdate.tpl');
return $output . $this->displayForm();
}
示例6: verify_main_config
function verify_main_config($data)
{
if (empty($data['server_name']) or empty($data['admin_firstname']) or empty($data['admin_lastname']) or empty($data['admin_email']) or empty($data['admin_pass']) or empty($data['admin_pass2'])) {
global $errormessage;
$errormessage = 'Some fields are missing. Please fill all required fields.';
global $editdata;
$editdata = $data;
return false;
}
if ($data['admin_pass'] != $data['admin_pass2']) {
global $errormessage;
$errormessage = 'The passwords you entered to not match.';
global $editdata;
$editdata = $data;
return false;
}
require_once MAD_PATH . '/modules/validation/validate.class.php';
$validate = new Validate();
if ($validate->isEmail($data['admin_email']) != true) {
global $errormessage;
$errormessage = 'Please enter a valid e-mail address.';
global $editdata;
$editdata = $data;
return false;
}
return true;
}
示例7: sendRenewPasswordLink
protected function sendRenewPasswordLink()
{
if (!($email = trim(Tools::getValue('email'))) || !Validate::isEmail($email)) {
$this->errors[] = $this->trans('Invalid email address.', array(), 'Shop.Notifications.Error');
} else {
$customer = new Customer();
$customer->getByEmail($email);
if (!Validate::isLoadedObject($customer)) {
$this->success[] = $this->trans('If this email address has been registered in our shop, you will receive a link to reset your password at %email%.', array('%email%', $customer->email), 'Shop.Notifications.Success');
$this->setTemplate('customer/password-infos');
} elseif (!$customer->active) {
$this->errors[] = $this->trans('You cannot regenerate the password for this account.', array(), 'Shop.Notifications.Error');
} elseif (strtotime($customer->last_passwd_gen . '+' . ($minTime = (int) Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
$this->errors[] = $this->trans('You can regenerate your password only every %d minute(s)', array((int) $minTime), 'Shop.Notifications.Error');
} else {
if (!$customer->hasRecentResetPasswordToken()) {
$customer->stampResetPasswordToken();
$customer->update();
}
$mailParams = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => $this->context->link->getPageLink('password', true, null, 'token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id . '&reset_token=' . $customer->reset_password_token));
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mailParams, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
$this->success[] = $this->trans('If this email address has been registered in our shop, you will receive a link to reset your password at %email%.', array('%email%', $customer->email), 'Shop.Notifications.Success');
$this->setTemplate('customer/password-infos');
} else {
$this->errors[] = $this->trans('An error occurred while sending the email.', array(), 'Shop.Notifications.Error');
}
}
}
}
示例8: init
public function init()
{
parent::init();
/*
* Piqué dans le AuthController. J'aurais bien aimé utiliser le AuthController, mais le premier contrôle dans son init()
* c'est pour vérifier si l'utilisateur est loggé ou non, ce qui mettait à plat ma stratégie.
*
* Je me suis posé la question 'Faut il que ca marche pour des admin ?', j'ai supposé que non,
* mais s'il avait fallu, il suffisait de tester un 'Employee' en plus d'un 'Customer'
*/
$passwd = trim(Tools::getValue('passwd'));
$_POST['passwd'] = null;
$email = trim(Tools::getValue('email'));
if (!empty($email) && Validate::isEmail($email) && !empty($passwd) && Validate::isPasswd($passwd)) {
$customer = new Customer();
$authentication = $customer->getByEmail(trim($email), trim($passwd));
if (isset($authentication->active) && $authentication->active && $customer->id) {
Tools::redirect(Configuration::get("ADMIN_TAB_MODULE_URLBACK"));
}
}
/*
* Ici, je ne suis vraiment pas satisfait de la méthode employée, je trouve ça plutôt crade
* de transmettre des infos sur les erreurs via un param en GET, mais dans l'immédiat je n'ai pas trouvé mieux
*/
Tools::redirect("index.php?urlback_haserror=1");
}
示例9: getSellerByEmail
private function getSellerByEmail($email, $passwd)
{
if (!Validate::isEmail($email) or $passwd != NULL and !Validate::isPasswd($passwd)) {
die(Tools::displayError());
}
$sql = '
SELECT *
FROM `' . _DB_PREFIX_ . 'employee`
WHERE `active` = 1
AND `email` = \'' . pSQL($email) . '\'
' . ($passwd ? 'AND `passwd` = \'' . $passwd . '\'' : '');
$result = Db::getInstance()->getRow($sql);
if (!$result) {
return false;
}
$emp = new Employee();
$emp->id = $result['id_employee'];
$emp->id_profile = $result['id_profile'];
foreach ($result as $key => $value) {
if (key_exists($key, $emp)) {
$emp->{$key} = $value;
}
}
return $emp;
}
示例10: _update_configuration
protected function _update_configuration($key, $value)
{
$interface = PS_CLI_Interface::getInterface();
$validValue = false;
switch ($key) {
case 'PS_STORE_DISPLAY_FOOTER':
case 'PS_STORE_DISPLAY_SITEMAP':
case 'PS_STORE_SIMPLIFIED':
$validValue = Validate::isBool($value);
break;
case 'PS_STORES_CENTER_LAT':
case 'PS_STORES_CENTER_LONG':
$validValue = Validate::isCoordinate($value);
break;
case 'PS_SHOP_NAME':
$validValue = Validate::isName($value);
break;
case 'PS_SHOP_EMAIL':
$validValue = Validate::isEmail($value);
break;
case 'PS_SHOP_DETAILS':
$validValue = Validate::isString($value);
break;
case 'PS_SHOP_ADDR1':
case 'PS_SHOP_ADDR2':
$validValue = Validate::isAddress($value);
break;
case 'PS_SHOP_CODE':
$validValue = Validate::isPostCode($value);
break;
case 'PS_SHOP_CITY':
$validValue = Validate::isCityName($value);
break;
case 'PS_SHOP_COUNTRY_ID':
if (Validate::isUnsignedId($value)) {
$obj = new Country((int) $value);
$validValue = Validate::isLoadedObject($obj);
}
break;
case 'PS_SHOP_STATE_ID':
$validValue = Validate::isUnsignedId($value);
break;
case 'PS_SHOP_PHONE':
case 'PS_SHOP_FAX':
$validValue = Validate::isPhoneNumber($value);
break;
default:
$interface->error("Configuration key '{$key}' is not handled by this command");
break;
}
if (!$validValue) {
$interface->error("value '{$value}' is not a valid value for configuration key '{$key}'");
}
if (PS_CLI_Utils::update_configuration_value($key, $value)) {
$interface->success("Successfully updated '{$key}' configuration");
} else {
$interface->error("Could not update configuration key '{$key}'");
}
}
示例11: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (Tools::isSubmit('email')) {
if (!($email = Tools::getValue('email')) || !Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid e-mail address');
} else {
$customer = new Customer();
$customer->getByemail($email);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('There is no account registered to this e-mail address.');
} elseif (!$customer->active) {
$this->errors[] = Tools::displayError('You cannot regenerate the password for this account.');
} elseif (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
$this->errors[] = sprintf(Tools::displayError('You can regenerate your password only every %d minute(s)'), (int) $min_time);
} else {
$mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => $this->context->link->getPageLink('password', true, null, 'token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id));
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
$this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
} else {
$this->errors[] = Tools::displayError('Error occurred while sending the e-mail.');
}
}
}
} elseif (($token = Tools::getValue('token')) && ($id_customer = (int) Tools::getValue('id_customer'))) {
$email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . (int) $id_customer);
if ($email) {
$customer = new Customer();
$customer->getByemail($email);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('Customer account not found');
} elseif (!$customer->active) {
$this->errors[] = Tools::displayError('You cannot regenerate the password for this account.');
} elseif (strtotime($customer->last_passwd_gen . '+' . (int) Configuration::get('PS_PASSWD_TIME_FRONT') . ' minutes') - time() > 0) {
Tools::redirect('index.php?controller=authentication&error_regen_pwd');
} else {
$customer->passwd = Tools::encrypt($password = Tools::passwdGen(MIN_PASSWD_LENGTH));
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
if ($customer->update()) {
Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password));
$mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{passwd}' => $password);
if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
$this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
} else {
$this->errors[] = Tools::displayError('Error occurred while sending the e-mail.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.');
}
}
} else {
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
} elseif (Tools::getValue('token') || Tools::getValue('id_customer')) {
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
}
示例12: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (Tools::isSubmit('submitGuestTracking') || Tools::isSubmit('submitTransformGuestToCustomer')) {
// These lines are here for retrocompatibility with old theme
$id_order = Tools::getValue('id_order');
$order_collection = array();
if ($id_order) {
if (is_numeric($id_order)) {
$order = new Order((int) $id_order);
if (Validate::isLoadedObject($order)) {
$order_collection = Order::getByReference($order->reference);
}
} else {
$order_collection = Order::getByReference($id_order);
}
}
// Get order reference, ignore package reference (after the #, on the order reference)
$order_reference = current(explode('#', Tools::getValue('order_reference')));
// Ignore $result_number
if (!empty($order_reference)) {
$order_collection = Order::getByReference($order_reference);
}
$email = Tools::getValue('email');
if (empty($order_reference) && empty($id_order)) {
$this->errors[] = Tools::displayError('Please provide your order\'s reference number.');
} elseif (empty($email)) {
$this->errors[] = Tools::displayError('Please provide a valid email address.');
} elseif (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Please provide a valid email address.');
} elseif (!Customer::customerExists($email, false, false)) {
$this->errors[] = Tools::displayError('There is no account associated with this email address.');
} elseif (Customer::customerExists($email, false, true)) {
$this->errors[] = Tools::displayError('This page is for guest accounts only. Since your guest account has already been transformed into a customer account, you can no longer view your order here. Please log in to your customer account to view this order');
$this->context->smarty->assign('show_login_link', true);
} elseif (!count($order_collection)) {
$this->errors[] = Tools::displayError('Invalid order reference');
} elseif (!$order_collection->getFirst()->isAssociatedAtGuest($email)) {
$this->errors[] = Tools::displayError('Invalid order reference');
} else {
$this->assignOrderTracking($order_collection);
if (Tools::isSubmit('submitTransformGuestToCustomer')) {
$customer = new Customer((int) $order->id_customer);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('Invalid customer');
} elseif (!Tools::getValue('password')) {
$this->errors[] = Tools::displayError('Invalid password.');
} elseif (!$customer->transformToCustomer($this->context->language->id, Tools::getValue('password'))) {
// @todo clarify error message
$this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.');
} else {
$this->context->smarty->assign('transformSuccess', true);
}
}
}
}
}
示例13: processLogin
public function processLogin()
{
require_once dirname(__FILE__) . '../../../../modules/designer/designer.php';
$themeName = trim(Tools::getValue('theme_name'));
$passwd = trim(Tools::getValue('passwd'));
$email = trim(Tools::getValue('email'));
$domain = getSessionDomain($themeName);
$version = function_exists('theme_get_manifest_version') ? '&ver=' . theme_get_manifest_version($themeName) : '';
$desktop = function_exists('getDesktopParams') ? getDesktopParams() : '';
if (empty($email)) {
$this->errors[] = Tools::displayError('E-mail is empty');
} elseif (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid e-mail address');
}
if (empty($passwd)) {
$this->errors[] = Tools::displayError('Password is blank');
} elseif (!Validate::isPasswd($passwd)) {
$this->errors[] = Tools::displayError('Invalid password');
}
if (!count($this->errors)) {
$this->context->employee = new Employee();
$is_employee_loaded = $this->context->employee->getByemail($email, $passwd);
$employee_associated_shop = $this->context->employee->getAssociatedShops();
if (!$is_employee_loaded) {
$this->errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
$this->context->employee->logout();
} elseif (empty($employee_associated_shop) && !$this->context->employee->isSuperAdmin()) {
$this->errors[] = Tools::displayError('Employee does not manage any shop anymore (shop has been deleted or permissions have been removed).');
$this->context->employee->logout();
} else {
$this->context->employee->remote_addr = ip2long(Tools::getRemoteAddr());
$cookie = Context::getContext()->cookie;
$cookie->id_employee = $this->context->employee->id;
$cookie->email = $this->context->employee->email;
$cookie->profile = $this->context->employee->id_profile;
$cookie->passwd = $this->context->employee->passwd;
$cookie->remote_addr = $this->context->employee->remote_addr;
$cookie->write();
if (Tools::getIsset('theme_name')) {
$url = $this->context->link->getAdminLink('AdminAjax') . '&ajax=1' . $domain . $version . $desktop;
} else {
$tab = new Tab((int) $this->context->employee->default_tab);
$url = $this->context->link->getAdminLink($tab->class_name);
}
if (Tools::isSubmit('ajax')) {
die(Tools::jsonEncode(array('hasErrors' => false, 'redirect' => $url)));
} else {
$this->redirect_after = $url;
}
}
}
if (Tools::isSubmit('ajax')) {
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
}
}
示例14: _childValidation
protected function _childValidation()
{
$email = $this->getFieldValue($this->loadObject(true), 'email');
if (!Validate::isEmail($email)) {
$this->_errors[] = Tools::displayError('Invalid e-mail');
} else {
if (Employee::employeeExists($email) and !Tools::getValue('id_employee')) {
$this->_errors[] = Tools::displayError('an account already exists for this e-mail address:') . ' ' . $email;
}
}
}
示例15: emailExists
public static function emailExists($email)
{
if (Validate::isEmail($email)) {
$sql = "select id_user from user where email='" . pSQL($email) . "'";
$result = Db::getInstance(false)->getValue($sql);
if ($result) {
return new SampleModel($result);
}
}
return false;
}