Improved logging of email validation function
This commit is contained in:
@@ -6,18 +6,23 @@
|
|||||||
*/
|
*/
|
||||||
function _valid_email_address($email) {
|
function _valid_email_address($email) {
|
||||||
//firstly use the built-in function to validate the format
|
//firstly use the built-in function to validate the format
|
||||||
if (! valid_email_address($email))
|
if (! valid_email_address($email)) {
|
||||||
|
watchdog('booking', "Drupal validation of email address '!email' returns false.", array('!email' => $email));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
//now check the domain exists
|
//now check the domain exists
|
||||||
|
|
||||||
if (preg_match('/^(.*?)\@(.*)/', $email, $matches)) {
|
if (preg_match('/^(.*?)\@(.*)/', $email, $matches)) {
|
||||||
//watchdog('booking', 'Email address checking: @info', array('@info' => var_export($matches, TRUE)));
|
//watchdog('booking', 'Email address checking: @info', array('@info' => var_export($matches, TRUE)));
|
||||||
if (! checkdnsrr($matches[2], "MX"))
|
if (! checkdnsrr($matches[2], "MX")) {
|
||||||
return 0;
|
watchdog('booking', "No valid MX record found for email address '!email' with domain name !domain", array('!email' => $email, '!domain' => $matches[2]));
|
||||||
return 1;
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
watchdog('booking', "Regular expression failed to detect domain portion of email address '!email'", array('!email' => $email));
|
||||||
//watchdog('booking', 'Email address checking doesnt match');
|
//watchdog('booking', 'Email address checking doesnt match');
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -14,7 +14,7 @@ function _booking_paypal_post($data = array()) {
|
|||||||
function _booking_paypal_ipn_verify($vars = array()) {
|
function _booking_paypal_ipn_verify($vars = array()) {
|
||||||
|
|
||||||
if (variable_get('booking_paypal_sandbox', 0)) {
|
if (variable_get('booking_paypal_sandbox', 0)) {
|
||||||
watchdog('booking', 'Setting IPN verify to true, running in sandbox mode');
|
watchdog('booking', 'Setting IPN verify to true, running in sandbox mode');
|
||||||
// PayPal sandbox requires login in order to even access, so for sandbox mode, simply return true.
|
// PayPal sandbox requires login in order to even access, so for sandbox mode, simply return true.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user