if (strlen($links_url) < ENTRY_LINKS_URL_MIN_LENGTH) { $error = true; $messageStack->add('submit_link', ENTRY_LINKS_URL_ERROR); } if (strlen($links_description) < ENTRY_LINKS_DESCRIPTION_MIN_LENGTH) { $error = true; $messageStack->add('submit_link', ENTRY_LINKS_DESCRIPTION_ERROR); } if (strlen($links_contact_name) < ENTRY_LINKS_CONTACT_NAME_MIN_LENGTH) { $error = true; $messageStack->add('submit_link', ENTRY_LINKS_CONTACT_NAME_ERROR); } if (strlen($links_contact_email) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('submit_link', ENTRY_EMAIL_ADDRESS_ERROR); } elseif (zen_validate_email($links_contact_email) == false) { $error = true; $messageStack->add('submit_link', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } if (SUBMIT_LINK_REQUIRE_RECIPROCAL == 'true') { if (strlen($links_reciprocal_url) < ENTRY_LINKS_URL_MIN_LENGTH) { $error = true; $messageStack->add('submit_link', ENTRY_LINKS_RECIPROCAL_URL_ERROR); } } if ($error == false) { // default values $links_date_added = 'now()'; $links_status = '0'; // Pending approval $sql_data_array = array('links_url' => $links_url, 'links_contact_name' => $links_contact_name, 'links_contact_email' => $links_contact_email, 'links_reciprocal_url' => $links_reciprocal_url, 'links_date_added' => $links_date_added, 'links_status' => $links_status);
* @package page * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: header_php.php 6202 2007-04-12 22:56:10Z drbyte $ */ require DIR_WS_MODULES . zen_get_module_directory('require_languages.php'); $error = false; if (isset($_GET['action']) && $_GET['action'] == 'send') { $IMGVER_EnteredText = $_POST["txtCode"]; $IMGVER_RandomText = $_SESSION["IMGVER_RndText"]; if (strtolower($IMGVER_EnteredText) == strtolower($IMGVER_RandomText)) { $name = zen_db_prepare_input($_POST['contactname']); $email_address = zen_db_prepare_input($_POST['email']); $enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry'])); $zc_validate_email = zen_validate_email($email_address); if ($zc_validate_email and !empty($enquiry) and !empty($name)) { // auto complete when logged in if ($_SESSION['customer_id']) { $sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id \n FROM " . TABLE_CUSTOMERS . " \n WHERE customers_id = :customersID"; $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer'); $check_customer = $db->Execute($sql); $customer_email = $check_customer->fields['customers_email_address']; $customer_name = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname']; } else { $customer_email = NOT_LOGGED_IN_TEXT; $customer_name = NOT_LOGGED_IN_TEXT; } // use contact us dropdown if defined if (CONTACT_US_LIST != '') { $send_to_array = explode(",", CONTACT_US_LIST);
/** * Send email (text/html) using MIME. This is the central mail function. * If using "PHP" transport method, the SMTP Server or other mail application should be configured correctly in server's php.ini * * @param string $to_name The name of the recipient, e.g. "Jim Johanssen" * @param string $to_email_address The email address of the recipient, e.g. john.smith@hzq.com * @param string $email_subject The subject of the eMail * @param string $email_text The text of the email, may contain HTML entities * @param string $from_email_name The name of the sender, e.g. Shop Administration * @param string $from_email_adrdess The email address of the sender, e.g. info@myzenshop.com * @param array $block Array containing values to be inserted into HTML-based email template * @param string $module The module name of the routine calling zen_mail. Used for HTML template selection and email archiving. * This is passed to the archive function denoting what module initiated the sending of the email * @param array $attachments_list Array of attachment names/mime-types to be included (this portion still in testing, and not fully reliable) **/ function zen_mail_org($to_name, $to_address, $email_subject, $email_text, $from_email_name, $from_email_address, $block = array(), $module = 'default', $attachments_list = '') { global $db, $messageStack, $zco_notifier; if (!defined('DEVELOPER_OVERRIDE_EMAIL_STATUS') || defined('DEVELOPER_OVERRIDE_EMAIL_STATUS') && DEVELOPER_OVERRIDE_EMAIL_STATUS == 'site') { if (SEND_EMAILS != 'true') { return false; } } // if sending email is disabled in Admin, just exit if (defined('DEVELOPER_OVERRIDE_EMAIL_ADDRESS') && DEVELOPER_OVERRIDE_EMAIL_ADDRESS != '') { $to_address = DEVELOPER_OVERRIDE_EMAIL_ADDRESS; } // ignore sending emails for any of the following pages // (The EMAIL_MODULES_TO_SKIP constant can be defined in a new file in the "extra_configures" folder) if (defined('EMAIL_MODULES_TO_SKIP') && in_array($module, explode(",", constant('EMAIL_MODULES_TO_SKIP')))) { return false; } // check for injection attempts. If new-line characters found in header fields, simply fail to send the message foreach (array($from_email_address, $to_address, $from_email_name, $to_name, $email_subject) as $key => $value) { if (preg_match("/\r/i", $value) || preg_match("/\n/i", $value)) { return false; } } // if no text or html-msg supplied, exit if (trim($email_text) == '' && (!zen_not_null($block) || isset($block['EMAIL_MESSAGE_HTML']) && $block['EMAIL_MESSAGE_HTML'] == '')) { return false; } // Parse "from" addresses for "name" <*****@*****.**> structure, and supply name/address info from it. if (preg_match("/ *([^<]*) *<([^>]*)> */i", $from_email_address, $regs)) { $from_email_name = trim($regs[1]); $from_email_address = $regs[2]; } // if email name is same as email address, use the Store Name as the senders 'Name' if ($from_email_name == $from_email_address) { $from_email_name = STORE_NAME; } // loop thru multiple email recipients if more than one listed --- (esp for the admin's "Extra" emails)... foreach (explode(',', $to_address) as $key => $value) { if (preg_match("/ *([^<]*) *<([^>]*)> */i", $value, $regs)) { $to_name = str_replace('"', '', trim($regs[1])); $to_email_address = $regs[2]; } elseif (preg_match("/ *([^ ]*) */i", $value, $regs)) { $to_email_address = trim($regs[1]); } if (!isset($to_email_address)) { $to_email_address = trim($to_address); } //if not more than one, just use the main one. // ensure the address is valid, to prevent unnecessary delivery failures if (!zen_validate_email($to_email_address)) { @error_log(sprintf(EMAIL_SEND_FAILED . ' (failed validation)', $to_name, $to_email_address, $email_subject)); continue; } //define some additional html message blocks available to templates, then build the html portion. if (!isset($block['EMAIL_TO_NAME']) || $block['EMAIL_TO_NAME'] == '') { $block['EMAIL_TO_NAME'] = $to_name; } if (!isset($block['EMAIL_TO_ADDRESS']) || $block['EMAIL_TO_ADDRESS'] == '') { $block['EMAIL_TO_ADDRESS'] = $to_email_address; } if (!isset($block['EMAIL_SUBJECT']) || $block['EMAIL_SUBJECT'] == '') { $block['EMAIL_SUBJECT'] = $email_subject; } if (!isset($block['EMAIL_FROM_NAME']) || $block['EMAIL_FROM_NAME'] == '') { $block['EMAIL_FROM_NAME'] = $from_email_name; } if (!isset($block['EMAIL_FROM_ADDRESS']) || $block['EMAIL_FROM_ADDRESS'] == '') { $block['EMAIL_FROM_ADDRESS'] = $from_email_address; } $email_html = !is_array($block) && substr($block, 0, 6) == '<html>' ? $block : zen_build_html_email_from_template($module, $block); if (!is_array($block) && $block == '' || $block == 'none') { $email_html = ''; } // Build the email based on whether customer has selected HTML or TEXT, and whether we have supplied HTML or TEXT-only components // special handling for XML content if ($email_text == '') { $email_text = str_replace(array('<br>', '<br />'), "<br />\n", $block['EMAIL_MESSAGE_HTML']); $email_text = str_replace('</p>', "</p>\n", $email_text); $email_text = $module != 'xml_record' ? htmlspecialchars(stripslashes(strip_tags($email_text)), ENT_COMPAT, CHARSET, TRUE) : $email_text; } else { $email_text = $module != 'xml_record' ? strip_tags($email_text) : $email_text; } if ($module != 'xml_record') { if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '' && !strstr($email_text, sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS)) && $to_email_address != STORE_OWNER_EMAIL_ADDRESS && !defined('EMAIL_DISCLAIMER_NEW_CUSTOMER')) { $email_text .= "\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS); } if (defined('EMAIL_SPAM_DISCLAIMER') && EMAIL_SPAM_DISCLAIMER != '' && !strstr($email_text, EMAIL_SPAM_DISCLAIMER) && $to_email_address != STORE_OWNER_EMAIL_ADDRESS) { $email_text .= "\n\n" . EMAIL_SPAM_DISCLAIMER; } } // bof: body of the email clean-up // clean up & and && from email text while (strstr($email_text, '&&')) { $email_text = str_replace('&&', '&', $email_text); } while (strstr($email_text, '&')) { $email_text = str_replace('&', '&', $email_text); } while (strstr($email_text, '&&')) { $email_text = str_replace('&&', '&', $email_text); } // clean up currencies for text emails $zen_fix_currencies = preg_split("/[:,]/", CURRENCIES_TRANSLATIONS); $size = sizeof($zen_fix_currencies); for ($i = 0, $n = $size; $i < $n; $i += 2) { $zen_fix_current = $zen_fix_currencies[$i]; $zen_fix_replace = $zen_fix_currencies[$i + 1]; if (strlen($zen_fix_current) > 0) { while (strpos($email_text, $zen_fix_current)) { $email_text = str_replace($zen_fix_current, $zen_fix_replace, $email_text); } } } // fix double quotes while (strstr($email_text, '"')) { $email_text = str_replace('"', '"', $email_text); } // prevent null characters while (strstr($email_text, chr(0))) { $email_text = str_replace(chr(0), ' ', $email_text); } // fix slashes $text = stripslashes($email_text); $email_html = stripslashes($email_html); // eof: body of the email clean-up //determine customer's email preference type: HTML or TEXT-ONLY (HTML assumed if not specified) $sql = "select customers_email_format from " . TABLE_CUSTOMERS . " where customers_email_address= :custEmailAddress:"; $sql = $db->bindVars($sql, ':custEmailAddress:', $to_email_address, 'string'); $result = $db->Execute($sql); $customers_email_format = $result->RecordCount() > 0 ? $result->fields['customers_email_format'] : ''; if ($customers_email_format == 'NONE' || $customers_email_format == 'OUT') { return; } //if requested no mail, then don't send. // if ($customers_email_format == 'HTML') $customers_email_format = 'HTML'; // if they opted-in to HTML messages, then send HTML format // handling admin/"extra"/copy emails: if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module, -6) == '_extra') { $email_html = ''; // just blank out the html portion if admin has selected text-only } //determine what format to send messages in if this is an admin email for newsletters: if ($customers_email_format == '' && ADMIN_EXTRA_EMAIL_FORMAT == 'HTML' && in_array($module, array('newsletters', 'product_notification')) && isset($_SESSION['admin_id'])) { $customers_email_format = 'HTML'; } // special handling for XML content if ($module == 'xml_record') { $email_html = ''; $customers_email_format = 'TEXT'; } //notifier intercept option $zco_notifier->notify('NOTIFY_EMAIL_AFTER_EMAIL_FORMAT_DETERMINED'); // now lets build the mail object with the phpmailer class $mail = new PHPMailer(); $lang_code = strtolower($_SESSION['languages_code'] == '' ? 'en' : $_SESSION['languages_code']); $mail->SetLanguage($lang_code, DIR_FS_CATALOG . DIR_WS_CLASSES . 'support/'); $mail->CharSet = defined('CHARSET') ? CHARSET : "iso-8859-1"; $mail->Encoding = defined('EMAIL_ENCODING_METHOD') ? EMAIL_ENCODING_METHOD : "7bit"; if ((int) EMAIL_SYSTEM_DEBUG > 0) { $mail->SMTPDebug = (int) EMAIL_SYSTEM_DEBUG; } $mail->WordWrap = 76; // set word wrap to 76 characters // set proper line-endings based on switch ... important for windows vs linux hosts: $mail->LE = EMAIL_LINEFEED == 'CRLF' ? "\r\n" : "\n"; switch (EMAIL_TRANSPORT) { case 'smtp': $mail->IsSMTP(); $mail->Host = trim(EMAIL_SMTPAUTH_MAIL_SERVER); if (EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '25' && EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '') { $mail->Port = trim(EMAIL_SMTPAUTH_MAIL_SERVER_PORT); } $mail->LE = "\r\n"; break; case 'smtpauth': $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Username = zen_not_null(EMAIL_SMTPAUTH_MAILBOX) ? trim(EMAIL_SMTPAUTH_MAILBOX) : EMAIL_FROM; $mail->Password = trim(EMAIL_SMTPAUTH_PASSWORD); $mail->Host = trim(EMAIL_SMTPAUTH_MAIL_SERVER); if (EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '25' && EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '') { $mail->Port = trim(EMAIL_SMTPAUTH_MAIL_SERVER_PORT); } $mail->LE = "\r\n"; //set encryption protocol to allow support for Gmail or other secured email protocols if (EMAIL_SMTPAUTH_MAIL_SERVER_PORT == '465' || EMAIL_SMTPAUTH_MAIL_SERVER_PORT == '587' || EMAIL_SMTPAUTH_MAIL_SERVER == 'smtp.gmail.com') { $mail->Protocol = 'ssl'; } if (defined('SMTPAUTH_EMAIL_PROTOCOL') && SMTPAUTH_EMAIL_PROTOCOL != 'none') { $mail->Protocol = SMTPAUTH_EMAIL_PROTOCOL; if (SMTPAUTH_EMAIL_PROTOCOL == 'starttls' && defined('SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT')) { $mail->Starttls = true; $mail->Context = SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT; } } break; case 'PHP': $mail->IsMail(); break; case 'Qmail': $mail->IsQmail(); break; case 'sendmail': case 'sendmail-f': $mail->LE = "\n"; default: $mail->IsSendmail(); if (defined('EMAIL_SENDMAIL_PATH')) { $mail->Sendmail = trim(EMAIL_SENDMAIL_PATH); } break; } $mail->Subject = $email_subject; $mail->From = $from_email_address; $mail->FromName = $from_email_name; $mail->AddAddress($to_email_address, $to_name); //$mail->AddAddress($to_email_address); // (alternate format if no name, since name is optional) //$mail->AddBCC(STORE_OWNER_EMAIL_ADDRESS, STORE_NAME); // set the reply-to address. If none set yet, then use Store's default email name/address. // If sending from contact-us or tell-a-friend page, use the supplied info $email_reply_to_address = isset($email_reply_to_address) && $email_reply_to_address != '' ? $email_reply_to_address : (in_array($module, array('contact_us')) ? $from_email_address : EMAIL_FROM); $email_reply_to_name = isset($email_reply_to_name) && $email_reply_to_name != '' ? $email_reply_to_name : (in_array($module, array('contact_us')) ? $from_email_name : STORE_NAME); $mail->AddReplyTo($email_reply_to_address, $email_reply_to_name); // if mailserver requires that all outgoing mail must go "from" an email address matching domain on server, set it to store address if (EMAIL_SEND_MUST_BE_STORE == 'Yes') { $mail->From = EMAIL_FROM; } if (EMAIL_TRANSPORT == 'sendmail-f' || EMAIL_SEND_MUST_BE_STORE == 'Yes') { $mail->Sender = EMAIL_FROM; } if (EMAIL_USE_HTML == 'true') { $email_html = processEmbeddedImages($email_html, $mail); } // PROCESS FILE ATTACHMENTS if ($attachments_list == '') { $attachments_list = array(); } if (is_string($attachments_list)) { if (file_exists($attachments_list)) { $attachments_list = array(array('file' => $attachments_list)); } elseif (file_exists(DIR_FS_CATALOG . $attachments_list)) { $attachments_list = array(array('file' => DIR_FS_CATALOG . $attachments_list)); } else { $attachments_list = array(); } } global $newAttachmentsList; $zco_notifier->notify('NOTIFY_EMAIL_BEFORE_PROCESS_ATTACHMENTS', array('attachments' => $attachments_list, 'module' => $module)); if (isset($newAttachmentsList) && is_array($newAttachmentsList)) { $attachments_list = $newAttachmentsList; } if (defined('EMAIL_ATTACHMENTS_ENABLED') && EMAIL_ATTACHMENTS_ENABLED && is_array($attachments_list) && sizeof($attachments_list) > 0) { foreach ($attachments_list as $key => $val) { $fname = isset($val['name']) ? $val['name'] : null; $mimeType = isset($val['mime_type']) && $val['mime_type'] != '' && $val['mime_type'] != 'application/octet-stream' ? $val['mime_type'] : ''; switch (true) { case isset($val['raw_data']) && $val['raw_data'] != '': $fdata = $val['raw_data']; if ($mimeType != '') { $mail->AddStringAttachment($fdata, $fname, "base64", $mimeType); } else { $mail->AddStringAttachment($fdata, $fname); } break; case isset($val['file']) && file_exists($val['file']): //'file' portion must contain the full path to the file to be attached $fdata = $val['file']; if ($mimeType != '') { $mail->AddAttachment($fdata, $fname, "base64", $mimeType); } else { $mail->AddAttachment($fdata, $fname); } break; } // end switch } //end foreach attachments_list } //endif attachments_enabled $zco_notifier->notify('NOTIFY_EMAIL_AFTER_PROCESS_ATTACHMENTS', sizeof($attachments_list)); // prepare content sections: if (EMAIL_USE_HTML == 'true' && trim($email_html) != '' && ($customers_email_format == 'HTML' || ADMIN_EXTRA_EMAIL_FORMAT != 'TEXT' && substr($module, -6) == '_extra')) { $mail->IsHTML(true); // set email format to HTML $mail->Body = $email_html; // HTML-content of message $mail->AltBody = $text; // text-only content of message } else { // use only text portion if not HTML-formatted $mail->Body = $text; // text-only content of message } $oldVars = array(); $tmpVars = array('REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR', 'PHP_SELF', 'SERVER_NAME'); foreach ($tmpVars as $key) { if (isset($_SERVER[$key])) { $oldVars[$key] = $_SERVER[$key]; $_SERVER[$key] = ''; } if ($key == 'REMOTE_ADDR') { $_SERVER[$key] = HTTP_SERVER; } if ($key == 'PHP_SELF') { $_SERVER[$key] = '/obf' . 'us' . 'cated'; } } /** * Send the email. If an error occurs, trap it and display it in the messageStack */ $ErrorInfo = ''; $zco_notifier->notify('NOTIFY_EMAIL_READY_TO_SEND', $mail); if (!($result = $mail->Send())) { if (IS_ADMIN_FLAG === true) { $messageStack->add_session(sprintf(EMAIL_SEND_FAILED . ' ' . $mail->ErrorInfo, $to_name, $to_email_address, $email_subject), 'error'); } else { $messageStack->add('header', sprintf(EMAIL_SEND_FAILED . ' ' . $mail->ErrorInfo, $to_name, $to_email_address, $email_subject), 'error'); } $ErrorInfo .= $mail->ErrorInfo != '' ? $mail->ErrorInfo . '<br />' : ''; } $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND'); foreach ($oldVars as $key => $val) { $_SERVER[$key] = $val; } $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND_WITH_ALL_PARAMS', array($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $module, $ErrorInfo)); // Archive this message to storage log // don't archive pwd-resets and CC numbers if (EMAIL_ARCHIVE == 'true' && $module != 'password_forgotten_admin' && $module != 'cc_middle_digs' && $module != 'no_archive') { zen_mail_archive_write($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $module, $ErrorInfo); } // endif archiving } // end foreach loop thru possible multiple email addresses $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND_ALL_SPECIFIED_ADDRESSES'); if (EMAIL_FRIENDLY_ERRORS == 'false' && $ErrorInfo != '') { die('<br /><br />Email Error: ' . $ErrorInfo); } return $ErrorInfo; }
* * @package page * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @copyright Portions Copyright 2007 J_Schilz * @copyright Portions Copyright 2010 JT of GTI Custom * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: header_php.php for COWOA 2.0 ZC139 2010-11-22 10:19:00 webchills */ // This should be first line of the script: $zco_notifier->notify('NOTIFY_HEADER_START_ORDER_STATUS'); if (!isset($_POST['order_id']) || isset($_POST['order_id']) && !is_numeric($_POST['order_id'])) { $errorInvalidID = TRUE; } if (!isset($_POST['query_email_address']) || zen_validate_email($_POST['query_email_address']) == false) { $errorInvalidEmail = TRUE; } if (!$errorInvalidID && !$errorInvalidEmail) { $customer_info_query = "SELECT customers_email_address, customers_id\n FROM " . TABLE_ORDERS . "\n WHERE orders_id = :ordersID"; $customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_POST['order_id'], 'integer'); $customer_info = $db->Execute($customer_info_query); if (isset($_POST['query_email_address']) && $customer_info->fields['customers_email_address'] != $_POST['query_email_address']) { $errorNoMatch = TRUE; } else { $_SESSION['email_address'] = $_POST['query_email_address']; $_SESSION['customer_id'] = $customer_info->fields['customers_id']; $_SESSION['COWOA'] = 'True'; $_SESSION['ORDER_STATUS'] = 'True'; $statuses_query = "SELECT os.orders_status_name, osh.date_added, osh.comments, osh.customer_notified \n FROM " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh\n WHERE osh.orders_id = :ordersID\n AND osh.orders_status_id = os.orders_status_id\n AND os.language_id = :languagesID\n AND osh.customer_notified >= 0\n ORDER BY osh.date_added"; $statuses_query = $db->bindVars($statuses_query, ':ordersID', $_POST['order_id'], 'integer');
$entry_date_of_birth_error = false; } else { $error = true; $entry_date_of_birth_error = true; } } } else { $customers_dob = '0001-01-01 00:00:00'; } if (strlen($customers_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $entry_email_address_error = true; } else { $entry_email_address_error = false; } if (!zen_validate_email($customers_email_address)) { $error = true; $entry_email_address_check_error = true; } else { $entry_email_address_check_error = false; } if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { $error = true; $entry_street_address_error = true; } else { $entry_street_address_error = false; } if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) { $error = true; $entry_post_code_error = true; } else {
function isEmail($zp_param, $zp_error_text, $zp_error_code) { if (zen_validate_email($zp_param) == false) { $this->setError($zp_error_text, $zp_error_code, true); } }
function validation_is_email($email) { return zen_validate_email($email); }
/** * * @package page * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: J_Schilz for Integrated COWOA - 14 April 2007 */ // This should be first line of the script: $zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_HISTORY_INFO'); if (!isset($_REQUEST['order_id']) || isset($_REQUEST['order_id']) && !is_numeric($_REQUEST['order_id'])) { $errorInvalidID = TRUE; } $query_email_address = trim($_REQUEST['query_email_address']); if (!isset($query_email_address) || zen_validate_email($query_email_address) == false) { $errorInvalidEmail = TRUE; } if (!$errorInvalidID && !$errorInvalidEmail) { $customer_info_query = "SELECT customers_email_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country,\n billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country \n FROM " . TABLE_ORDERS . "\n WHERE orders_id = :ordersID"; $customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_REQUEST['order_id'], 'integer'); $customer_info = $db->Execute($customer_info_query); if (isset($query_email_address) && $customer_info->fields['customers_email_address'] != $query_email_address && $customer_info->fields['customers_email_address'] != $query_email_address . '.') { $errorNoMatch = TRUE; } else { $statuses_query = "SELECT os.orders_status_name, osh.date_added, osh.comments\n FROM " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh\n WHERE osh.orders_id = :ordersID\n AND osh.orders_status_id = os.orders_status_id\n AND os.language_id = :languagesID\n AND osh.customer_notified >= 0\n ORDER BY osh.date_added"; $statuses_query = $db->bindVars($statuses_query, ':ordersID', $_REQUEST['order_id'], 'integer'); $statuses_query = $db->bindVars($statuses_query, ':languagesID', $_SESSION['languages_id'], 'integer'); $statuses = $db->Execute($statuses_query); while (!$statuses->EOF) { $statusArray[] = array('date_added' => $statuses->fields['date_added'], 'orders_status_name' => $statuses->fields['orders_status_name'], 'comments' => $statuses->fields['comments']);
} else { $entry_links_description_error = false; } if (strlen($links_contact_name) < ENTRY_LINKS_CONTACT_NAME_MIN_LENGTH) { $error = true; $entry_links_contact_name_error = true; } else { $entry_links_contact_name_error = false; } if (strlen($links_contact_email) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $entry_links_contact_email_error = true; } else { $entry_links_contact_email_error = false; } if (!zen_validate_email($links_contact_email)) { $error = true; $entry_links_contact_email_check_error = true; } else { $entry_links_contact_email_check_error = false; } if (SUBMIT_LINK_REQUIRE_RECIPROCAL == 'true') { if (strlen($links_reciprocal_url) < ENTRY_LINKS_URL_MIN_LENGTH) { $error = true; $entry_links_reciprocal_url_error = true; } else { $entry_links_reciprocal_url_error = false; } } if ($error == false) { if (!zen_not_null($links_image_url) || $links_image_url == 'http://') {
function zen_update_user($name, $email, $id, $profile) { global $db; $errors = array(); if ($name !== FALSE) { if (strlen($name) >= ((int) ADMIN_NAME_MINIMUM_LENGTH < 4 ? 4 : (int) ADMIN_NAME_MINIMUM_LENGTH)) { $name = zen_db_prepare_input($name); } else { $errors[] = sprintf(ERROR_ADMIN_NAME_TOO_SHORT, (int) ADMIN_NAME_MINIMUM_LENGTH < 4 ? 4 : (int) ADMIN_NAME_MINIMUM_LENGTH); } if (zen_check_for_invalid_admin_chars($name) == FALSE) { $errors[] = ERROR_ADMIN_INVALID_CHARS_IN_USERNAME; } } $email = zen_db_prepare_input($email); if (zen_validate_email($email) == FALSE) { $errors[] = ERROR_ADMIN_INVALID_EMAIL_ADDRESS; } if (sizeof($errors) == 0) { $oldData = zen_read_user(zen_get_admin_name($id)); $id = (int) $id; $sql = "UPDATE " . TABLE_ADMIN . "\n SET admin_email = :email:, "; if (isset($name) && $name !== FALSE && $name != $oldData['admin_name']) { $sql .= "admin_name = :name:, "; } if (isset($profile) && $profile > 0 && $profile != $oldData['admin_profile']) { $sql .= "admin_profile = :profile:, "; } $sql .= "last_modified = NOW()\n WHERE admin_id=" . $id; $sql = $db->bindVars($sql, ':name:', $name, 'string'); $sql = $db->bindVars($sql, ':email:', $email, 'string'); $sql = $db->bindVars($sql, ':profile:', $profile, 'integer'); $db->Execute($sql); // Now notify admin and user of changes $newData = zen_read_user(zen_get_admin_name($id)); $admname = preg_replace('/[^\\d\\w._-]/', '*', zen_get_admin_name()) . '[' . (int) $_SESSION['admin_id'] . ']'; $changes = array(); if ($oldData['admin_email'] != $newData['admin_email']) { $changes['email'] = array('old' => $oldData['admin_email'], 'new' => $newData['admin_email']); } if ($oldData['admin_name'] != $newData['admin_name']) { $changes['name'] = array('old' => $oldData['admin_name'], 'new' => $newData['admin_name']); } if ($oldData['admin_profile'] != $newData['admin_profile']) { $changes['profile'] = array('old' => zen_get_profile_name($oldData['admin_profile']) . '(' . $oldData['admin_profile'] . ')', 'new' => zen_get_profile_name($newData['admin_profile']) . '(' . $newData['admin_profile'] . ')'); } $alertText = ''; if (isset($changes['email'])) { $alertText .= sprintf(TEXT_EMAIL_ALERT_ADM_EMAIL_CHANGED, $oldData['admin_name'], $changes['email']['old'], $changes['email']['new'], $admname) . "\n"; } if (isset($changes['name'])) { $alertText .= sprintf(TEXT_EMAIL_ALERT_ADM_NAME_CHANGED, $oldData['admin_name'], $changes['name']['old'], $changes['name']['new'], $admname) . "\n"; } if (isset($changes['profile'])) { $alertText .= sprintf(TEXT_EMAIL_ALERT_ADM_PROFILE_CHANGED, $oldData['admin_name'], $changes['profile']['old'], $changes['profile']['new'], $admname) . "\n"; } if ($alertText != '') { zen_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER_EMAIL_ADDRESS, TEXT_EMAIL_SUBJECT_ADMIN_USER_CHANGED, $alertText, STORE_NAME, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => $alertText, 'EMAIL_SPAM_DISCLAIMER' => ' ', 'EMAIL_DISCLAIMER' => ' '), 'admin_settings_changed'); } if ($alertText != '') { zen_mail($oldData['admin_email'], $oldData['admin_email'], TEXT_EMAIL_SUBJECT_ADMIN_USER_CHANGED, $alertText, STORE_NAME, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => $alertText, 'EMAIL_SPAM_DISCLAIMER' => ' ', 'EMAIL_DISCLAIMER' => ' '), 'admin_settings_changed'); } if ($alertText != '') { zen_record_admin_activity(TEXT_EMAIL_SUBJECT_ADMIN_USER_CHANGED . ' ' . $alertText, 'warning'); } } return $errors; }
/** * Send the collected information via email to the store owner, storing outer digits and emailing middle digits * */ function after_process() { global $insert_id; $message = sprintf(MODULE_PAYMENT_CC_TEXT_MIDDLE_DIGITS_MESSAGE, $insert_id, $this->cc_middle); $html_msg['EMAIL_MESSAGE_HTML'] = str_replace("\n\n", '<br />', $message); if (defined('MODULE_PAYMENT_CC_EMAIL') && zen_validate_email(MODULE_PAYMENT_CC_EMAIL)) { zen_mail(MODULE_PAYMENT_CC_EMAIL, MODULE_PAYMENT_CC_EMAIL, SEND_EXTRA_CC_EMAILS_TO_SUBJECT . $insert_id, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'cc_middle_digs'); } else { $message = MODULE_PAYMENT_CC_TEXT_EMAIL_WARNING . $message; $html_msg['EMAIL_MESSAGE_HTML'] = str_replace("\n\n", '<br />', $message); zen_mail(EMAIL_FROM, EMAIL_FROM, MODULE_PAYMENT_CC_TEXT_EMAIL_ERROR . SEND_EXTRA_CC_EMAILS_TO_SUBJECT . $insert_id, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'cc_middle_digs'); } }
function jsend_mail($to_name, $to_address, $email_subject, $email_text, $from_email_name, $from_email_address, $block = array(), $attachments_list = '') { global $db, $messageStack, $zco_notifier; foreach (array($from_email_address, $to_address, $from_email_name, $to_name, $email_subject) as $key => $value) { if (preg_match("/\r/i", $value) || preg_match("/\n/i", $value)) { return false; } } // if no text or html-msg supplied, exit if (trim($email_text) == '') { return false; } // Parse "from" addresses for "name" <*****@*****.**> structure, and supply name/address info from it. if (preg_match("/ *([^<]*) *<([^>]*)> */i", $from_email_address, $regs)) { $from_email_name = trim($regs[1]); $from_email_address = $regs[2]; } // if email name is same as email address, use the Store Name as the senders 'Name' if ($from_email_name == $from_email_address) { $from_email_name = STORE_NAME; } // loop thru multiple email recipients if more than one listed --- (esp for the admin's "Extra" emails)... foreach (explode(',', $to_address) as $key => $value) { if (preg_match("/ *([^<]*) *<([^>]*)> */i", $value, $regs)) { $to_name = str_replace('"', '', trim($regs[1])); $to_email_address = $regs[2]; } elseif (preg_match("/ *([^ ]*) */i", $value, $regs)) { $to_email_address = trim($regs[1]); } if (!isset($to_email_address)) { $to_email_address = trim($to_address); } // if not more than one, just use the main one. // ensure the address is valid, to prevent unnecessary delivery failures if (!zen_validate_email($to_email_address)) { @error_log(sprintf(EMAIL_SEND_FAILED . ' (failed validation)', $to_name, $to_email_address, $email_subject)); continue; } // define some additional html message blocks available to templates, then build the html portion. if (!isset($block['EMAIL_TO_NAME']) || $block['EMAIL_TO_NAME'] == '') { $block['EMAIL_TO_NAME'] = $to_name; } if (!isset($block['EMAIL_TO_ADDRESS']) || $block['EMAIL_TO_ADDRESS'] == '') { $block['EMAIL_TO_ADDRESS'] = $to_email_address; } if (!isset($block['EMAIL_SUBJECT']) || $block['EMAIL_SUBJECT'] == '') { $block['EMAIL_SUBJECT'] = $email_subject; } if (!isset($block['EMAIL_FROM_NAME']) || $block['EMAIL_FROM_NAME'] == '') { $block['EMAIL_FROM_NAME'] = $from_email_name; } if (!isset($block['EMAIL_FROM_ADDRESS']) || $block['EMAIL_FROM_ADDRESS'] == '') { $block['EMAIL_FROM_ADDRESS'] = $from_email_address; } if (!is_array($block) && $block == '' || $block == 'none') { $email_html = ''; } $email_text = strip_tags($email_text); // bof: body of the email clean-up // clean up & and && from email text while (strstr($email_text, '&&')) { $email_text = str_replace('&&', '&', $email_text); } while (strstr($email_text, '&')) { $email_text = str_replace('&', '&', $email_text); } while (strstr($email_text, '&&')) { $email_text = str_replace('&&', '&', $email_text); } // clean up currencies for text emails $zen_fix_currencies = preg_split("/[:,]/", CURRENCIES_TRANSLATIONS); $size = sizeof($zen_fix_currencies); for ($i = 0, $n = $size; $i < $n; $i += 2) { $zen_fix_current = $zen_fix_currencies[$i]; $zen_fix_replace = $zen_fix_currencies[$i + 1]; if (strlen($zen_fix_current) > 0) { while (strpos($email_text, $zen_fix_current)) { $email_text = str_replace($zen_fix_current, $zen_fix_replace, $email_text); } } } // fix double quotes while (strstr($email_text, '"')) { $email_text = str_replace('"', '"', $email_text); } // prevent null characters while (strstr($email_text, chr(0))) { $email_text = str_replace(chr(0), ' ', $email_text); } // fix slashes $text = stripslashes($email_text); $email_html = stripslashes($email_html); $mail = new PHPMailer(); $lang_code = strtolower($_SESSION['languages_code'] == '' ? 'en' : $_SESSION['languages_code']); $mail->SetLanguage($lang_code, DIR_FS_CATALOG . DIR_WS_CLASSES . 'support/'); $mail->CharSet = defined('CHARSET') ? CHARSET : "iso-8859-1"; $mail->Encoding = defined('EMAIL_ENCODING_METHOD') ? EMAIL_ENCODING_METHOD : "7bit"; if ((int) EMAIL_SYSTEM_DEBUG > 0) { $mail->SMTPDebug = (int) EMAIL_SYSTEM_DEBUG; } $mail->WordWrap = 76; // set word wrap to 76 characters // set proper line-endings based on switch ... important for windows vs linux hosts: $mail->LE = EMAIL_LINEFEED == 'CRLF' ? "\r\n" : "\n"; switch (EMAIL_TRANSPORT) { case 'smtp': $mail->IsSMTP(); $mail->Host = trim($block['smtp_addr']); if ($block['smtp_port'] != '25' && $block['smtp_port'] != '') { $mail->Port = trim($block['smtp_port']); } $mail->LE = "\r\n"; break; case 'smtpauth': $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Username = zen_not_null($block['smtp_user']) ? trim($block['smtp_user']) : EMAIL_FROM; $mail->Password = trim($block['smtp_pwd']); $mail->Host = trim($block['smtp_addr']); if ($block['smtp_port'] != '25' && $block['smtp_port'] != '') { $mail->Port = trim($block['smtp_port']); } $mail->LE = "\r\n"; // set encryption protocol to allow support for Gmail or other secured email protocols if ($block['smtp_port'] == '465' || $block['smtp_port'] == '587' || $block['smtp_addr'] == 'smtp.gmail.com') { $mail->Protocol = 'ssl'; } if (defined('SMTPAUTH_EMAIL_PROTOCOL') && SMTPAUTH_EMAIL_PROTOCOL != 'none') { $mail->Protocol = SMTPAUTH_EMAIL_PROTOCOL; if (SMTPAUTH_EMAIL_PROTOCOL == 'starttls' && defined('SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT')) { $mail->Starttls = true; $mail->Context = SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT; } } break; case 'PHP': $mail->IsMail(); break; case 'Qmail': $mail->IsQmail(); break; case 'sendmail': case 'sendmail-f': $mail->LE = "\n"; default: $mail->IsSendmail(); if (defined('EMAIL_SENDMAIL_PATH')) { $mail->Sendmail = trim(EMAIL_SENDMAIL_PATH); } break; } $mail->Subject = $email_subject; $mail->From = $from_email_address; $mail->FromName = $from_email_name; $mail->AddAddress($to_email_address, $to_name); // $mail->AddAddress($to_email_address); // (alternate format if no name, since name is optional) // $mail->AddBCC(STORE_OWNER_EMAIL_ADDRESS, STORE_NAME); // set the reply-to address. If none set yet, then use Store's default email name/address. // If sending from contact-us or tell-a-friend page, use the supplied info $email_reply_to_address = isset($email_reply_to_address) && $email_reply_to_address != '' ? $email_reply_to_address : (in_array($module, array('contact_us', 'tell_a_friend')) ? $from_email_address : EMAIL_FROM); $email_reply_to_name = isset($email_reply_to_name) && $email_reply_to_name != '' ? $email_reply_to_name : (in_array($module, array('contact_us', 'tell_a_friend')) ? $from_email_name : STORE_NAME); $mail->AddReplyTo($email_reply_to_address, $email_reply_to_name); // if mailserver requires that all outgoing mail must go "from" an email address matching domain on server, set it to store address if (EMAIL_SEND_MUST_BE_STORE == 'Yes') { $mail->From = EMAIL_FROM; } if (EMAIL_TRANSPORT == 'sendmail-f' || EMAIL_SEND_MUST_BE_STORE == 'Yes') { $mail->Sender = EMAIL_FROM; } if (EMAIL_USE_HTML == 'true') { $email_html = processEmbeddedImages($email_html, $mail); } // PROCESS FILE ATTACHMENTS if ($attachments_list == '') { $attachments_list = array(); } if (is_string($attachments_list)) { if (file_exists($attachments_list)) { $attachments_list = array(array('file' => $attachments_list)); } elseif (file_exists(DIR_FS_CATALOG . $attachments_list)) { $attachments_list = array(array('file' => DIR_FS_CATALOG . $attachments_list)); } else { $attachments_list = array(); } } global $newAttachmentsList; $zco_notifier->notify('NOTIFY_EMAIL_BEFORE_PROCESS_ATTACHMENTS', array('attachments' => $attachments_list, 'module' => '')); if (isset($newAttachmentsList) && is_array($newAttachmentsList)) { $attachments_list = $newAttachmentsList; } if (defined('EMAIL_ATTACHMENTS_ENABLED') && EMAIL_ATTACHMENTS_ENABLED && is_array($attachments_list) && sizeof($attachments_list) > 0) { foreach ($attachments_list as $key => $val) { $fname = isset($val['name']) ? $val['name'] : null; $mimeType = isset($val['mime_type']) && $val['mime_type'] != '' && $val['mime_type'] != 'application/octet-stream' ? $val['mime_type'] : ''; switch (true) { case isset($val['raw_data']) && $val['raw_data'] != '': $fdata = $val['raw_data']; if ($mimeType != '') { $mail->AddStringAttachment($fdata, $fname, "base64", $mimeType); } else { $mail->AddStringAttachment($fdata, $fname); } break; case isset($val['file']) && file_exists($val['file']): // 'file' portion must contain the full path to the file to be attached $fdata = $val['file']; if ($mimeType != '') { $mail->AddAttachment($fdata, $fname, "base64", $mimeType); } else { $mail->AddAttachment($fdata, $fname); } break; } // end switch } // end foreach attachments_list } // endif attachments_enabled $mail->Body = $text; // text-only content of message $oldVars = array(); $tmpVars = array('REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR', 'PHP_SELF', 'SERVER_NAME'); foreach ($tmpVars as $key) { if (isset($_SERVER[$key])) { $oldVars[$key] = $_SERVER[$key]; $_SERVER[$key] = ''; } if ($key == 'REMOTE_ADDR') { $_SERVER[$key] = HTTP_SERVER; } if ($key == 'PHP_SELF') { $_SERVER[$key] = '/obf' . 'us' . 'cated'; } } /** * Send the email. * If an error occurs, trap it and display it in the messageStack */ $ErrorInfo = ''; $zco_notifier->notify('NOTIFY_EMAIL_READY_TO_SEND', $mail); if (!($result = $mail->Send())) { if (IS_ADMIN_FLAG === true) { $messageStack->add_session(sprintf(EMAIL_SEND_FAILED . ' ' . $mail->ErrorInfo, $to_name, $to_email_address, $email_subject), 'error'); } else { $messageStack->add('header', sprintf(EMAIL_SEND_FAILED . ' ' . $mail->ErrorInfo, $to_name, $to_email_address, $email_subject), 'error'); } $ErrorInfo .= $mail->ErrorInfo != '' ? $mail->ErrorInfo . '<br />' : ''; } $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND'); foreach ($oldVars as $key => $val) { $_SERVER[$key] = $val; } $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND_WITH_ALL_PARAMS', array($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $ErrorInfo)); // Archive this message to storage log // don't archive pwd-resets and CC numbers if (EMAIL_ARCHIVE == 'true') { zen_mail_archive_write($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $module, $ErrorInfo); } // endif archiving } // end foreach loop thru possible multiple email addresses $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND_ALL_SPECIFIED_ADDRESSES'); // if(EMAIL_FRIENDLY_ERRORS == 'false' && $ErrorInfo != '') // die('<br /><br />Email Error: ' . $ErrorInfo); return $ErrorInfo; }
function after_process() { global $insert_id; if (defined('MODULE_PAYMENT_CC_EMAIL') && zen_validate_email(MODULE_PAYMENT_CC_EMAIL)) { $message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n"; $html_msg['EMAIL_MESSAGE_HTML'] = str_replace("\n\n", '<br />', $message); zen_mail(MODULE_PAYMENT_CC_EMAIL, MODULE_PAYMENT_CC_EMAIL, SEND_EXTRA_CC_EMAILS_TO_SUBJECT . $insert_id, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'cc_middle_digs'); } }
if (substr_count($dob, '/') > 2 || checkdate((int) substr(zen_date_raw($dob), 4, 2), (int) substr(zen_date_raw($dob), 6, 2), (int) substr(zen_date_raw($dob), 0, 4)) == false) { $error = true; $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR); } } } if (ACCOUNT_COMPANY == 'true') { if ((int) ENTRY_COMPANY_MIN_LENGTH > 0 && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_COMPANY_ERROR); } } if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR); } elseif (zen_validate_email($email_address) == false) { $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } else { $check_email_query = "select count(*) as total\n from " . TABLE_CUSTOMERS . "\n where customers_email_address = '" . zen_db_input($email_address) . "'\n and COWOA_account != 1"; $check_email = $db->Execute($check_email_query); if ($check_email->fields['total'] > 0) { $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS); } } if ($phpBB->phpBB['installed'] == true) { if (strlen($nick) < ENTRY_NICK_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_NICK_LENGTH_ERROR); } else {
// $local_customer_gv = $currencies->value($gv_result->fields['amount']); // $base_customer_gv = $gv_result->fields['amount']; // Now let's get the amount that the customer wants to send. // $local_customer_send = $_POST['amount']; // $base_customer_send = $currencies->value($_POST['amount'], true, DEFAULT_CURRENCY); if ($_GET['action'] == 'send') { $_SESSION['complete'] = ''; $error = false; if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) { $error = true; } if (!isset($_POST['to_name']) || trim($_POST['to_name'] == '')) { $error = true; $messageStack->add('gv_send', ERROR_ENTRY_TO_NAME_CHECK, 'error'); } if (!zen_validate_email(trim($_POST['email']))) { $error = true; $messageStack->add('gv_send', ERROR_ENTRY_EMAIL_ADDRESS_CHECK, 'error'); } $customer_amount = $gv_result->fields['amount']; $_POST['amount'] = str_replace('$', '', $_POST['amount']); $gv_amount = trim($_POST['amount']); if (preg_match('/[^0-9\\.]/', $gv_amount)) { $error = true; $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error'); } if ($currencies->value($gv_amount, true, DEFAULT_CURRENCY) > $customer_amount || $gv_amount == 0) { //echo $currencies->value($customer_amount, true,DEFAULT_CURRENCY); $error = true; $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error'); }
} } // <-furikana if (ACCOUNT_DOB == 'true') { if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) { if (substr_count($dob, '/') > 2 || checkdate((int) substr(zen_date_raw($dob), 4, 2), (int) substr(zen_date_raw($dob), 6, 2), (int) substr(zen_date_raw($dob), 0, 4)) == false) { $error = true; $messageStack->add('account_edit', ENTRY_DATE_OF_BIRTH_ERROR); } } } if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR); } if (!zen_validate_email($email_address)) { $error = true; $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } $check_email_query = "SELECT count(*) AS total\r\n FROM " . TABLE_CUSTOMERS . "\r\n WHERE customers_email_address = :emailAddress\r\n AND customers_id != :customersID"; $check_email_query = $db->bindVars($check_email_query, ':emailAddress', $email_address, 'string'); $check_email_query = $db->bindVars($check_email_query, ':customersID', $_SESSION['customer_id'], 'integer'); $check_email = $db->Execute($check_email_query); if ($check_email->fields['total'] > 0) { $error = true; $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS); // check phpBB for duplicate email address if ($phpBB->phpbb_check_for_duplicate_email(zen_db_input($email_address)) == 'already_exists') { $error = true; $messageStack->add('account_edit', 'phpBB-' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS); }
function processEmailAddress($return = array()) { global $db; $email_address = zen_db_prepare_input($_POST['email_address']); if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $return['error'] = true; $return['error_messages'][] = array('message' => ENTRY_EMAIL_ADDRESS_ERROR, 'type' => 'error'); } elseif (zen_validate_email($email_address) == false) { $return['error'] = true; $return['error_messages'][] = array('message' => ENTRY_EMAIL_ADDRESS_CHECK_ERROR, 'type' => 'error'); } else { if (!$_SESSION['customer_id']) { $check_email_query = "\r\n SELECT count(*) as total\r\n FROM " . TABLE_CUSTOMERS . " c\r\n LEFT JOIN " . TABLE_VISITORS . " v ON c.customers_id = v.visitors_id\r\n WHERE c.customers_email_address = '" . zen_db_input($email_address) . "'\r\n AND v.visitors_email_address is null\r\n ;"; } else { $check_email_query = "\r\n SELECT count(*) as total\r\n FROM " . TABLE_CUSTOMERS . " c\r\n LEFT JOIN " . TABLE_VISITORS . " v ON c.customers_id = v.visitors_id\r\n WHERE c.customers_email_address = '" . zen_db_input($email_address) . "'\r\n AND customers_id != '" . (int) $_SESSION['customer_id'] . "'\r\n ;"; } $check_email = $db->Execute($check_email_query); if ($check_email->fields['total'] > 0) { $return['error'] = true; $return['error_messages'][] = array('message' => ENTRY_EMAIL_ADDRESS_ERROR_EXISTS, 'type' => 'error'); } } $return['email_address'] = $email_address; return $return; }