本文整理汇总了PHP中valid_email_address函数的典型用法代码示例。如果您正苦于以下问题:PHP valid_email_address函数的具体用法?PHP valid_email_address怎么用?PHP valid_email_address使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了valid_email_address函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validateForm
/**
* Implements \Drupal\Core\Form\FormInterface::validateForm().
*/
public function validateForm(array &$form, FormStateInterface $form_state)
{
$form_state->set('notify_emails', []);
if (!$form_state->isValueEmpty('update_notify_emails')) {
$valid = array();
$invalid = array();
foreach (explode("\n", trim($form_state->getValue('update_notify_emails'))) as $email) {
$email = trim($email);
if (!empty($email)) {
if (valid_email_address($email)) {
$valid[] = $email;
} else {
$invalid[] = $email;
}
}
}
if (empty($invalid)) {
$form_state->set('notify_emails', $valid);
} elseif (count($invalid) == 1) {
$form_state->setErrorByName('update_notify_emails', $this->t('%email is not a valid email address.', array('%email' => reset($invalid))));
} else {
$form_state->setErrorByName('update_notify_emails', $this->t('%emails are not valid email addresses.', array('%emails' => implode(', ', $invalid))));
}
}
parent::validateForm($form, $form_state);
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:29,代码来源:UpdateSettingsForm.php
示例2: validateForm
/**
* Implements \Drupal\Core\Form\FormInterface::validateForm().
*/
public function validateForm(array &$form, array &$form_state)
{
$form_state['notify_emails'] = array();
if (!empty($form_state['values']['update_notify_emails'])) {
$valid = array();
$invalid = array();
foreach (explode("\n", trim($form_state['values']['update_notify_emails'])) as $email) {
$email = trim($email);
if (!empty($email)) {
if (valid_email_address($email)) {
$valid[] = $email;
} else {
$invalid[] = $email;
}
}
}
if (empty($invalid)) {
$form_state['notify_emails'] = $valid;
} elseif (count($invalid) == 1) {
$this->setFormError('update_notify_emails', $form_state, $this->t('%email is not a valid email address.', array('%email' => reset($invalid))));
} else {
$this->setFormError('update_notify_emails', $form_state, $this->t('%emails are not valid email addresses.', array('%emails' => implode(', ', $invalid))));
}
}
parent::validateForm($form, $form_state);
}
开发者ID:alnutile,项目名称:drunatra,代码行数:29,代码来源:UpdateSettingsForm.php
示例3: validateEmail
/**
* Form element validation handler for #type 'email'.
*
* Note that #maxlength and #required is validated by _form_validate() already.
*/
public static function validateEmail(&$element, FormStateInterface $form_state, &$complete_form)
{
$value = trim($element['#value']);
$form_state->setValueForElement($element, $value);
if ($value !== '' && !valid_email_address($value)) {
$form_state->setError($element, t('The email address %mail is not valid.', array('%mail' => $value)));
}
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:13,代码来源:Email.php
示例4: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$added = array();
$invalid = array();
$unsubscribed = array();
$checked_newsletters = array_keys(array_filter($form_state->getValue('newsletters')));
$langcode = $form_state->getValue('language');
$emails = preg_split("/[\\s,]+/", $form_state->getValue('emails'));
foreach ($emails as $email) {
$email = trim($email);
if ($email == '') {
continue;
}
if (valid_email_address($email)) {
$subscriber = simplenews_subscriber_load_by_mail($email);
/** @var \Drupal\simplenews\Subscription\SubscriptionManagerInterface $subscription_manager */
$subscription_manager = \Drupal::service('simplenews.subscription_manager');
foreach (simplenews_newsletter_load_multiple($checked_newsletters) as $newsletter) {
// If there is a valid subscriber, check if there is a subscription for
// the current newsletter and if this subscription has the status
// unsubscribed.
$is_unsubscribed = $subscriber ? $subscriber->isUnsubscribed($newsletter->id()) : FALSE;
if (!$is_unsubscribed || $form_state->getValue('resubscribe') == TRUE) {
$subscription_manager->subscribe($email, $newsletter->id(), FALSE, 'mass subscribe', $langcode);
$added[] = $email;
} else {
$unsubscribed[$newsletter->label()][] = $email;
}
}
} else {
$invalid[] = $email;
}
}
if ($added) {
$added = implode(", ", $added);
drupal_set_message(t('The following addresses were added or updated: %added.', array('%added' => $added)));
$list_names = array();
foreach (simplenews_newsletter_load_multiple($checked_newsletters) as $newsletter) {
$list_names[] = $newsletter->label();
}
drupal_set_message(t('The addresses were subscribed to the following newsletters: %newsletters.', array('%newsletters' => implode(', ', $list_names))));
} else {
drupal_set_message(t('No addresses were added.'));
}
if ($invalid) {
$invalid = implode(", ", $invalid);
drupal_set_message(t('The following addresses were invalid: %invalid.', array('%invalid' => $invalid)), 'error');
}
foreach ($unsubscribed as $name => $subscribers) {
$subscribers = implode(", ", $subscribers);
drupal_set_message(t('The following addresses were skipped because they have previously unsubscribed from %name: %unsubscribed.', array('%name' => $name, '%unsubscribed' => $subscribers)), 'warning');
}
if (!empty($unsubscribed)) {
drupal_set_message(t("If you would like to resubscribe them, use the 'Force resubscription' option."), 'warning');
}
// Return to the parent page.
$form_state->setRedirect('view.simplenews_subscribers.page_1');
}
开发者ID:aritnath1990,项目名称:simplenewslatest,代码行数:61,代码来源:SubscriberMassSubscribeForm.php
示例5: os_poker_admin_form_validate
function os_poker_admin_form_validate($from, &$form_state)
{
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
if ($op != t('Reset to defaults')) {
if (!valid_email_address($form_state['values']['os_poker_abuse_mail_to'])) {
form_set_error('os_poker_abuse_mail_to', t('The e-mail address you specified is not valid.'));
}
}
}
开发者ID:jakob-stoeck,项目名称:os_poker,代码行数:9,代码来源:os_poker.admin.php
示例6: entityValidate
/**
* Validates a user account.
*/
public function entityValidate($account)
{
if (empty($account->name->value) || empty($account->mail->value) || !valid_email_address($account->mail->value)) {
throw new ValidationException('User name missing or email not valid.');
}
if ($this->configuration['defuse_mail']) {
$account->mail = $account->mail->value . '_test';
}
// Remove pass from $account if the password is unchanged.
if (isset($account->feeds_original_pass) && $account->pass == $account->feeds_original_pass) {
unset($account->pass);
}
}
开发者ID:alnutile,项目名称:drunatra,代码行数:16,代码来源:UserHandler.php
示例7: validate
/**
* {@inheritdoc}
*/
public function validate(array $form, FormStateInterface $form_state)
{
parent::validate($form, $form_state);
// Validate and each email recipient.
$recipients = explode(',', $form_state['values']['recipients']);
foreach ($recipients as &$recipient) {
$recipient = trim($recipient);
if (!valid_email_address($recipient)) {
$form_state->setErrorByName('recipients', $this->t('%recipient is an invalid email address.', array('%recipient' => $recipient)));
}
}
$form_state['values']['recipients'] = $recipients;
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:16,代码来源:CategoryForm.php
示例8: validateForm
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state)
{
$values = $form_state->getValues();
if ($values['smtp_on'] == 1 && $values['smtp_host'] == '') {
$form_state->setErrorByName('smtp_host', $this->t('You must enter an SMTP server address.'));
}
if ($values['smtp_on'] == 1 && $values['smtp_port'] == '') {
$form_state->setErrorByName('smtp_port', $this->t('You must enter an SMTP port number.'));
}
if ($values['smtp_from'] && !valid_email_address($values['smtp_from'])) {
$form_state->setErrorByName('smtp_from', $this->t('The provided from e-mail address is not valid.'));
}
if ($values['smtp_test_address'] && !valid_email_address($values['smtp_test_address'])) {
$form_state->setErrorByName('smtp_test_address', $this->t('The provided test e-mail address is not valid.'));
}
// If username is set empty, we must set both username/password empty as well.
if (empty($values['smtp_username'])) {
$values['smtp_password'] = '';
} elseif (empty($values['smtp_password'])) {
$form_state->unsetValue('smtp_password');
}
}
开发者ID:neeravbm,项目名称:shippi,代码行数:25,代码来源:SMTPConfigForm.php
示例9: mailer
/**
* Mailer.
*/
public function mailer(Request $request)
{
$content = $request->getContent();
if (empty($content)) {
return new JsonResponse(['status' => 'error']);
}
$params = Json::decode($content);
$email = $params['email'];
$result = $params['selection'];
$progress = $params['progress'];
// Handle errors.
if (!valid_email_address($email) || strlen($result) < 2) {
return new JsonResponse(['status' => 'error']);
}
// Prepare email.
$to = [$email];
$view = views_embed_view('answer', 'rest_export_1', $result);
$content = \Drupal::service('renderer')->render($view);
$nodes = Json::decode($content);
// Get the hidden fields
$view = views_embed_view('hideanswers', 'rest_export_1', $result);
$content = \Drupal::service('renderer')->render($view);
$hidden = Json::decode($content);
$hidden = array_map(function ($item) {
return $item['nid'];
}, $hidden);
$view = views_embed_view('disclaimer', 'rest_export_1', $result);
$content = \Drupal::service('renderer')->render($view);
$disclaimer = Json::decode($content);
$view = views_embed_view('intro_email', 'rest_export_1', $result);
$content = \Drupal::service('renderer')->render($view);
$intro = Json::decode($content);
$result = \Drupal::service('plugin.manager.mail')->mail('angapp', 'results', implode(', ', $to), \Drupal::currentUser()->getPreferredLangcode(), ['progress' => $progress, 'intro' => $intro, 'disclaimer' => $disclaimer, 'nodes' => $nodes, 'hidden' => $hidden]);
if ($result['result'] === TRUE) {
return new JsonResponse(['status' => 'ok']);
} else {
return new JsonResponse(['status' => 'error']);
}
}
开发者ID:UniversityofHelsinki,项目名称:Arrival-App,代码行数:42,代码来源:AppContainerController.php
示例10: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$removed = array();
$invalid = array();
$checked_lists = array_keys(array_filter($form_state->getValue('newsletters')));
/** @var \Drupal\simplenews\Subscription\SubscriptionManagerInterface $subscription_manager */
$subscription_manager = \Drupal::service('simplenews.subscription_manager');
$emails = preg_split("/[\\s,]+/", $form_state->getValue('emails'));
foreach ($emails as $email) {
$email = trim($email);
if (valid_email_address($email)) {
foreach ($checked_lists as $newsletter_id) {
$subscription_manager->unsubscribe($email, $newsletter_id, FALSE, 'mass unsubscribe');
$removed[] = $email;
}
} else {
$invalid[] = $email;
}
}
if ($removed) {
$removed = implode(", ", $removed);
drupal_set_message(t('The following addresses were unsubscribed: %removed.', array('%removed' => $removed)));
$newsletters = simplenews_newsletter_get_all();
$list_names = array();
foreach ($checked_lists as $newsletter_id) {
$list_names[] = $newsletters[$newsletter_id]->label();
}
drupal_set_message(t('The addresses were unsubscribed from the following newsletters: %newsletters.', array('%newsletters' => implode(', ', $list_names))));
} else {
drupal_set_message(t('No addresses were removed.'));
}
if ($invalid) {
$invalid = implode(", ", $invalid);
drupal_set_message(t('The following addresses were invalid: %invalid.', array('%invalid' => $invalid)), 'error');
}
// Return to the parent page.
$form_state->setRedirect('view.simplenews_subscribers.page_1');
}
开发者ID:aritnath1990,项目名称:simplenewslatest,代码行数:41,代码来源:SubscriberMassUnsubscribeForm.php
示例11: checkValue
public function checkValue($value, $type) {
$min_length = 0;
$max_length = 0;
$regexp = false;
$optional = false;
if (is_array($type)) {
$min_length = isset($type['min_length']) ? (int) $type['min_length'] : 0;
$max_length = isset($type['max_length']) ? (int) $type['max_length'] : 0;
$regexp = isset($type['regexp']) ? $type['regexp'] : false;
$optional = isset($type['*']) ? true : false;
$type = $type['type'];
}
switch ($type) {
case 'email':
if (!valid_email_address($value))
return false;
break;
case 'string':
if (!$value && $optional)
return '';
if (!$value)
return false;
if ($min_length)
if (mb_strlen(trim($value), 'UTF-8') < $min_length)
return false;
if ($max_length)
if (mb_strlen(trim($value), 'UTF-8') > $max_length)
return false;
if ($regexp)
if (!preg_match($regexp, $value))
return false;
break;
case 'int':
if ($value == null) {
if ($optional)
return false;
}
if (!is_numeric($value)) {
$value = (int) $value;
}
break;
case '':
break;
}
return $value;
}
开发者ID:rasstroen,项目名称:audio,代码行数:46,代码来源:Request.php
示例12: validateForm
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state)
{
if (!valid_email_address($form_state->getValue('email'))) {
$form_state->setErrorByName('email', t('That e-mail address is not valid.'));
}
}
开发者ID:ns-oxit-study,项目名称:drupal-8-training,代码行数:9,代码来源:EmailExampleGetFormPage.php
示例13: _email_verify_check
/**
* Primary function for validating email addresses.
*
* @param string $mail
* An email address to check, such as [email protected].
*
* @return
* Empty if address is valid, a text error string if it's invalid.
*/
function _email_verify_check($mail)
{
if (!valid_email_address($mail)) {
// The address is syntactically incorrect.
// The problem will be caught by the 'user' module anyway, so we avoid
// duplicating the error reporting here, just return.
return;
}
// Only add include if we are running Windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
include_once dirname(__FILE__) . '/windows_compat.inc';
}
$host = substr(strchr($mail, '@'), 1);
// If the domain is not cached, perform tests
if (!_email_verify_checkdb($host)) {
// Let's see if we can find anything about this host in the DNS
if (!checkdnsrr($host, 'ANY')) {
return t('Email host %host invalid, please retry.', array('%host' => "{$host}"));
}
if ($whitelist = variable_get('email_verify_whitelist', FALSE)) {
$whitelist = explode("\n", $whitelist);
if (in_array($host, $whitelist)) {
return;
}
}
// What SMTP servers should we contact?
$mx_hosts = array();
if (!getmxrr($host, $mx_hosts)) {
// When there is no MX record, the host itself should be used
$mx_hosts[] = $host;
}
// Try to connect to one SMTP server
foreach ($mx_hosts as $smtp) {
$connect = @fsockopen($smtp, 25, $errno, $errstr, 15);
if (!$connect) {
continue;
}
if (ereg("^220", $out = fgets($connect, 1024))) {
// OK, we have a SMTP connection
break;
} else {
// The SMTP server probably does not like us
// (dynamic/residential IP for aol.com for instance)
// Be on the safe side and accept the address, at least it has a valid
// domain part...
watchdog('email_verify', "Could not verify email address at host {$host}: {$out} for {$mail}");
return;
}
}
if (!$connect) {
return t('Email host %host is invalid, please contact us for clarification.', array('%host' => "{$host}"));
}
$from = variable_get('site_mail', ini_get('sendmail_from'));
// Extract the <...> part if there is one
if (preg_match('/\\<(.*)\\>/', $from, $match) > 0) {
$from = $match[1];
}
$localhost = $_SERVER["HTTP_HOST"];
if (!$localhost) {
// Happens with HTTP/1.0
// should be good enough for RFC compliant SMTP servers
$localhost = 'localhost';
}
fputs($connect, "HELO {$localhost}\r\n");
$out = fgets($connect, 1024);
fputs($connect, "MAIL FROM: <{$from}>\r\n");
$from = fgets($connect, 1024);
fputs($connect, "RCPT TO: <{$mail}>\r\n");
$to = fgets($connect, 1024);
fputs($connect, "QUIT\r\n");
fclose($connect);
if (!ereg("^250", $from)) {
// Again, something went wrong before we could really test the address,
// be on the safe side and accept it.
watchdog('email_verify', "Could not verify email address at host {$host}: {$from}");
return;
}
if (ereg("(Client host|Helo command) rejected", $to) || ereg("^4", $to) && !ereg("^450", $to)) {
// In those cases, accept the email, but log a warning
watchdog('email_verify', "Could not verify email address at host {$host}: {$to}");
return;
}
if (!ereg("^250", $to)) {
watchdog('email_verify', "Rejected email address: {$mail}. Reason: {$to}");
return t('%mail is invalid, please contact us for clarification.', array('%mail' => "{$mail}"));
}
// If the previous checks pass, save the valid domain to the DB table.
_email_verify_updatedb($host);
}
// Everything OK
return;
//.........这里部分代码省略.........
开发者ID:rjbrown99,项目名称:email_verify,代码行数:101,代码来源:email_verify.inc.php
示例14: libya_quick_subscribe_form_validate
function libya_quick_subscribe_form_validate($form, &$form_state)
{
$mail = $form_state['values']['mail'];
$obj = subscriptionData('read', $mail);
if (gettype($obj) == 'object' && $obj->mail) {
$resend = '';
if ($obj->confirm == 0) {
$resend = '<a class="my-btn" href="#" data-mail="' . $obj->mail . '" data-key="' . $obj->code . '" id="resend">resend confirmation mail</a>';
}
form_set_error('subscribe][mail', t('This email is already subscribed. ') . $resend);
}
if (!valid_email_address($mail)) {
form_set_error('mail', t('Email address did not validate: please check'));
}
}
开发者ID:vishacc,项目名称:libyanwarthetruth,代码行数:15,代码来源:forms.php
示例15: validateForm
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValues();
if ($values['smtp_on'] == 1 && $values['smtp_host'] == '') {
$form_state->setErrorByName('smtp_host', $this->t('You must enter an SMTP server address.'));
}
if ($values['smtp_on'] == 1 && $values['smtp_port'] == '') {
$form_state->setErrorByName('smtp_port', $this->t('You must enter an SMTP port number.'));
}
if ($values['smtp_from'] && !valid_email_address($values['smtp_from'])) {
$form_state->setErrorByName('smtp_from', $this->t('The provided from e-mail address is not valid.'));
}
if ($values['smtp_test_address'] && !valid_email_address($values['smtp_test_address'])) {
$form_state->setErrorByName('smtp_test_address', $this->t('The provided test e-mail address is not valid.'));
}
// If username is set empty, we must set both username/password empty as well.
if (empty($values['smtp_username'])) {
$values['smtp_password'] = '';
}
// A little hack. When form is presented, the password is not shown (Drupal way of doing).
// So, if user submits the form without changing the password, we must prevent it from being reset.
elseif (empty($values['smtp_password'])) {
$form_state->unsetValue('smtp_password');
}
}
开发者ID:ashzadeh,项目名称:afbs-ang,代码行数:32,代码来源:SMTPConfigForm.php
示例16: swiftmailer_is_path_header
/**
* Checks whether a header is a path header.
*
* It is difficult to distinguish id, mailbox and path headers from each other
* as they all may very well contain the exact same value. This public static function simply
* checks whether the header key equals to 'Message-ID' to determine if the
* header is a path header.
*
* @see http://swift_mailer.org/docs/header-path
*
* @param string $key
* The header key.
* @param string $value
* The header value.
*
* @return boolean
* TRUE if the provided header is a path header, and otherwise FALSE.
*/
public static function swiftmailer_is_path_header($key, $value)
{
if (valid_email_address($value) && $key == 'Return-Path') {
return TRUE;
} else {
return FALSE;
}
}
开发者ID:aritnath1990,项目名称:swiftmailer,代码行数:26,代码来源:Conversion.php
示例17: setUpdateAkteur
/**
* Method to write or update an akteur to database
* @param $data : akteure-object
* @param $defaultAID : integer [optional, required for update-action]
* @return $akteurId : integer || $this->fehler : array
*
* TODO: Remove $_POST's
*/
public function setUpdateAkteur($data, $defaultAID = NULL)
{
$this->__setSingleAkteurVars($data);
// Validate inputs, abort & return $this->fehler if necessary
if (empty($this->name)) {
$this->fehler['name'] = t('Bitte einen Organisationsnamen eingeben!');
}
if (empty($this->email) || !valid_email_address($this->email)) {
$this->fehler['email'] = t('Bitte eine (gültige) Emailadresse eingeben!');
}
if (empty($this->adresse->bezirk)) {
$this->fehler['ort'] = t('Bitte einen Bezirk auswählen!');
}
if (strlen($this->name) > 64) {
$this->fehler['name'] = t('Bitte geben Sie einen kürzeren Namen an oder verwenden Sie ein Kürzel.');
}
if (strlen($this->email) > 100) {
$this->fehler['email'] = t('Bitte geben Sie eine kürzere Emailadresse an.');
}
if (strlen($this->telefon) > 100) {
$this->fehler['telefon'] = t('Bitte geben Sie eine kürzere Telefonnummer an.');
}
if (strlen($this->url) > 100) {
$this->fehler['url'] = t('Bitte geben Sie eine kürzere URL an.');
}
if (!empty($this->url) && preg_match('/\\A(http:\\/\\/|https:\\/\\/)(\\w*[.|-]\\w*)*\\w+\\.[a-z]{2,3}(\\/.*)*\\z/', $this->url) == 0) {
$this->fehler['url'] = t('Bitte eine gültige URL zur Akteurswebseite eingeben! (z.B. <i>http://meinakteur.de</i>)');
}
if (strlen($this->ansprechpartner) > 100) {
$this->fehler['ansprechpartner'] = t('Bitte geben Sie einen kürzeren Ansprechpartner an.');
}
if (strlen($this->funktion) > 100) {
$this->fehler['funktion'] = t('Bitte geben Sie eine kürzere Funktion an.');
}
if (strlen($this->beschreibung) > 65000) {
$this->fehler['beschreibung'] = t('Bitte geben Sie eine kürzere Beschreibung an.');
}
if (strlen($this->oeffnungszeiten) > 200) {
$this->fehler['oeffnungszeiten'] = t('Bitte geben Sie kürzere Öffnungszeiten an.');
}
if (strlen($this->adresse->strasse) > 100) {
$this->fehler['strasse'] = t('Bitte geben Sie einen kürzeren Strassennamen an.');
}
if (strlen($this->adresse->nr) > 100) {
$this->fehler['nr'] = t('Bitte geben Sie eine kürzere Hausnummer an.');
}
if (strlen($this->adresse->adresszusatz) > 100) {
$this->fehler['adresszusatz'] = t('Bitte geben Sie einen kürzeren Adresszusatz an.');
}
if (strlen($this->adresse->plz) > 100) {
$this->fehler['plz'] = t('Bitte geben Sie eine kürzere PLZ an.');
}
if (strlen($this->adresse->gps) > 100) {
$this->fehler['gps'] = t('Bitte geben Sie kürzere GPS-Daten an.');
}
if (strlen($this->rssFeed) > 400 || preg_match('/\\A(http:\\/\\/|https:\\/\\/)(\\w*[.|-]\\w*)*\\w+\\.[a-z]{2,3}(\\/.*)*\\z/', $this->rssFeed) == 0) {
# $this->fehler['rssFeed'] = t('Die URL zum RSS-Feed ist zu lang oder ungültig...');
}
if ($this->gps == 'Ermittle Geo-Koordinaten...') {
$this->gps = '';
}
if (!empty($this->fehler)) {
return $this->fehler;
}
// ----- INSERT- or UPDATE-Actions --------
// Wenn Bilddatei ausgewählt wurde...
if (isset($_FILES['bild']['name']) && !empty($_FILES['bild']['name'])) {
$this->bild = $this->upload_image($_FILES['bild']);
} else {
if (isset($_POST['oldPic'])) {
$this->bild = $this->clearContent($_POST['oldPic']);
}
}
if ($defaultAID) {
// = Prepare UPDATE-Action
$akteurAdress = db_select($this->tbl_akteur, 'a')->fields('a', array('adresse'))->condition('AID', $defaultAID)->execute()->fetchObject();
$this->adresse->ADID = $akteurAdress->adresse;
// remove current picture manually
if (!empty($this->removedPic)) {
$b = end(explode('/', $this->removedPic));
if (file_exists($this->short_bildpfad . $b)) {
unlink($this->short_bildpfad . $b);
}
if ($_POST['oldPic'] == $this->removedPic) {
$this->bild = '';
}
}
}
$this->adresse = $this->adressHelper->setUpdateAdresse($this->adresse);
$this->akteur_id = $this->__db_action($this->tbl_akteur, array('name' => $this->name, 'adresse' => $this->adresse, 'email' => $this->email, 'telefon' => $this->telefon, 'url' => $this->url, 'ansprechpartner' => $this->ansprechpartner, 'funktion' => $this->funktion, 'bild' => $this->bild, 'beschreibung' => $this->beschreibung, 'oeffnungszeiten' => $this->oeffnungszeiten, 'barrierefrei' => !empty($this->barrierefrei) && ($this->barrierefrei || $this->barrierefrei == 'on') ? 1 : 0), $defaultAID ? array('AID', $defaultAID) : NULL, true);
if (!$defaultAID) {
$userHasAkteur = $this->__db_action($this->tbl_hat_user, array('hat_UID' => $this->user_id, 'hat_AID' => $this->akteur_id));
//.........这里部分代码省略.........
开发者ID:JuliAne,项目名称:easteasteast,代码行数:101,代码来源:akteure.php
示例18: guifi_tools_mail_update_form_validate
/**
* It checks if the given e-mails are valid, otherwise it shows an error.
*
* @todo
* Unused function?
*/
function guifi_tools_mail_update_form_validate($form, &$form_state)
{
if (!valid_email_address($form_state['values']['mail_replacewith'])) {
form_set_error('mail_replacewith', t('%email is not valid', array('%email' => $form_state['values']['mail_replacewith'])));
}
if ($form_state['values']['mail_search'] == $form_state['values']['mail_replacewith']) {
form_set_error('mail_replacewith', t('%email is equal to current value', array('%email' => $form_state['values']['mail_replacewith'])));
}
}
开发者ID:itorres,项目名称:drupal-guifi,代码行数:15,代码来源:guifi_tools.inc.php
示例19: _connect_valid_email_strict
/**
* validation wrapper that tests for existing FQDN
*/
function _connect_valid_email_strict($address)
{
$FQDN = '/^(?:[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])+(?:\\.(?:[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])+)*(?:\\.[a-zA-Z]{2,})$/';
list($mailbox, $domain) = split('@', $address);
if (!preg_match($FQDN, $domain) || !checkdnsrr($domain . '.', 'MX')) {
return FALSE;
}
return valid_email_address($address);
}
开发者ID:sebsebseb123,项目名称:Connect,代码行数:12,代码来源:connect_actions.php
示例20: _email_verify_check
/**
* Checks the email address for validity.
*/
function _email_verify_check($mail)
{
if (!valid_email_address($mail)) {
// The address is syntactically incorrect.
// The problem will be caught by the 'user' module anyway, so we avoid
// duplicating the error reporting here, just return.
return;
}
module_load_include('inc', 'email_verify', 'windows_compat');
$host = drupal_substr(strchr($mail, '@'), 1);
// Let's see if we can find anything about this host in the DNS.
if (!checkdnsrr($host . '.', 'ANY')) {
return t('%host is not a valid email host. Please check the spelling and try again.', array('%host' => "{$host}"));
}
// If install found port 25 closed or fsockopen() disabled, we can't test
// mailboxes.
if (variable_get('email_verify_skip_mailbox', FALSE)) {
return;
}
// What SMTP servers should we contact?
$mx_hosts = array();
if (!getmxrr($host, $mx_hosts)) {
// When there is no MX record, the host itself should be used.
$mx_hosts[] = $host;
}
// Try to connect to one SMTP server.
foreach ($mx_hosts as $smtp) {
$connect = @fsockopen($smtp, 25, $errno, $errstr, 15);
if (!$connect) {
continue;
}
if (preg_match("/^220/", $out = fgets($connect, 1024))) {
// An SMTP connection was made.
break;
} else {
// The SMTP server probably does not like us (dynamic/residential IP for
// aol.com for instance).
// Be on the safe side and accept the address, at least it has a valid
// domain part.
watchdog('email_verify', 'Could not verify email address at host @host: @out', array('@host' => $host, '@out' => $out));
return;
}
}
if (!$connect) {
return t('%host is not a valid email host. Please check the spelling and try again or contact us for clarification.', array('%host' => "{$host}"));
}
$from = variable_get('site_mail', ini_get('sendmail_from'));
// Extract the <...> part, if there is one.
if (preg_match('/\\<(.*)\\>/', $from, $match) > 0) {
$from = $match[1];
}
// Should be good enough for RFC compliant SMTP servers.
$localhost = $_SERVER["HTTP_HOST"];
if (!$localhost) {
$localhost = 'localhost';
}
fputs($connect, "HELO {$localhost}\r\n");
$out = fgets($connect, 1024);
fputs($connect, "MAIL FROM: <{$from}>\r\n");
$from = fgets($connect, 1024);
fputs($connect, "RCPT TO: <{$mail}>\r\n");
$to = fgets($connect, 1024);
fputs($connect, "QUIT\r\n");
fclose($connect);
if (!preg_match("/^250/", $from)) {
// Again, something went wrong before we could really test the address.
// Be on the safe side and accept it.
watchdog('email_verify', 'Could not verify email address at host @host: @from', array('@host' => $host, '@from' => $from));
return;
}
if (preg_match("/(Client host|Helo command) rejected/", $to) || preg_match("/^4/", $to) && !preg_match("/^450/", $to)) {
// In those cases, accept the email, but log a warning.
watchdog('email_verify', 'Could not verify email address at host @host: @to', array('@host' => $host, '@to' => $to));
return;
}
if (!preg_match("/^250/", $to)) {
watchdog('email_verify', 'Rejected email address: @mail. Reason: @to', array('@mail' => $mail, '@to' => $to));
return t('%mail is not a valid email address. Please check the spelling and try again or contact us for clarification.', array('%mail' => "{$mail}"));
}
// Everything is OK, so don't return anything.
return;
}
开发者ID:josemrc,项目名称:ae2web,代码行数:85,代码来源:email_verify.inc.php
注:本文中的valid_email_address函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论