コード例 #1
0
 function send($affiliate_newsletter_id)
 {
     $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: osCmax Mailer'));
     $mimemessage->add_text($this->content);
     $mimemessage->build_message();
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['affiliate_firstname'] . ' ' . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', EMAIL_FROM, $this->title);
     }
     $affiliate_newsletter_id = tep_db_prepare_input($affiliate_newsletter_id);
     tep_db_query("update " . TABLE_AFFILIATE_NEWSLETTERS . " set date_sent = now(), status = '1' where affiliate_newsletters_id = '" . tep_db_input($affiliate_newsletter_id) . "'");
 }
コード例 #2
0
 function send($newsletter_id)
 {
     $mail_query = smn_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: oscMall bulk mailer'));
     $mimemessage->add_html($this->content);
     $mimemessage->build_message();
     while ($mail = smn_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = smn_db_prepare_input($newsletter_id);
     smn_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . smn_db_input($newsletter_id) . "'");
 }
コード例 #3
0
ファイル: newsletter.php プロジェクト: eosc/EosC-2.3
 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
         // Préparation de l'envoie du mail en HTML
         $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);
         $mimemessage->build_message();
         // ################# END - Contribution Newsletter v050 ##############
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
コード例 #4
0
ファイル: general.php プロジェクト: rongandat/ookcart-project
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $html_email = false)
{
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: E-goldexJp Mailer'));
    // Build the text version
    $text = strip_tags($email_text);
    // edit by donghp 27/03/2012
    if ($html_email) {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
コード例 #5
0
ファイル: newsletter.php プロジェクト: wrtcoder/mini_isp
 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: osCommerce'));
     // Build the text version
     $text = strip_tags($this->content);
     if (EMAIL_USE_HTML == 'true') {
         $mimemessage->add_html($this->content, $text);
     } else {
         $mimemessage->add_text($text);
     }
     $mimemessage->build_message();
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
コード例 #6
0
ファイル: newsletter.php プロジェクト: digideskio/oscmax2
 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: osCmax Mailer'));
     // BOF: MOD - WYSIWYG HTML Area (Send TEXT Newsletter v1.7 when WYSIWYG Disabled)
     if (HTML_AREA_WYSIWYG_DISABLE_NEWSLETTER == 'Disable') {
         $mimemessage->add_text($this->content);
         // orginal OSC line
     } else {
         $mimemessage->add_html($this->content);
     }
     // EOF: MOD - WYSIWYG HTML Area (Send TEXT Newsletter v1.7 when WYSIWYG Disabled)
     $mimemessage->build_message();
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
コード例 #7
0
ファイル: email_now.php プロジェクト: rrecurse/IntenseCart
function email_now($t_key, $tpl, $extra, $lang = NULL)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    if (!isset($lang) || !$lang) {
        $lang = $language;
    }
    $tpquery = tep_db_query("SELECT * FROM email_now_templates WHERE email_template_key='{$t_key}' ORDER BY language_id!='{$lang}',language_id LIMIT 1");
    if ($tpinfo = tep_db_fetch_array($tpquery)) {
        $message = new email(array('X-Mailer: IntenseCart'));
        if (EMAIL_USE_HTML == 'true' && $tpinfo['send_mode'] == 'html') {
            $message->add_html(email_now_expand($tpinfo['email_template_html'], $tpl, 'html', ' '), email_now_expand($tpinfo['email_template_text'], $tpl));
        } else {
            $message->add_text(email_now_expand($tpinfo['email_template_text'], $tpl));
        }
        // # Send message
        $message->build_message();
        $to_name = email_now_expand($tpinfo['to_name'], $tpl, 'text', ' ');
        $to_email = email_now_expand($tpinfo['to_email'], $tpl, 'text', ' ');
        $from_name = email_now_expand($tpinfo['from_name'], $tpl, 'text', ' ');
        $from_email = email_now_expand($tpinfo['from_email'], $tpl, 'text', ' ');
        $subj = email_now_expand($tpinfo['email_subject'], $tpl, 'text', ' ');
        if (!empty($to_name)) {
            $message->send($to_name, $to_email, $from_name, $from_email, $subj);
            if (is_array($extra)) {
                foreach ($extra as $cc) {
                    $ar = array();
                    if (preg_match('/^\\s*(.*?)\\s*<\\s*(.*?)\\s*>/', $cc, $ar)) {
                        $cc_name = $ar[1];
                        $cc_email = $ar[2];
                    } else {
                        $cc_name = '';
                        $cc_email = $cc;
                    }
                    $message->send($cc_name, $cc_email, $from_name, $from_email, $subj . " [Fwd: {$to_name} <{$to_email}>]");
                }
            }
        }
    } else {
        return false;
    }
}
コード例 #8
0
 function sendEmail()
 {
     if (PHP_VERSION < 4.1) {
         global $_GET;
     }
     global $osC_Database;
     $max_execution_time = 0.8 * (int) ini_get('max_execution_time');
     $time_start = explode(' ', PAGE_PARSE_START_TIME);
     $Qrecipients = $osC_Database->query('select c.customers_firstname, c.customers_lastname, c.customers_email_address from :table_customers c left join :table_newsletters_log nl on (c.customers_email_address = nl.email_address and nl.newsletters_id = :newsletters_id) where c.customers_newsletter = 1 and nl.email_address is null');
     $Qrecipients->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qrecipients->bindTable(':table_newsletters_log', TABLE_NEWSLETTERS_LOG);
     $Qrecipients->bindInt(':newsletters_id', $this->_newsletter_id);
     $Qrecipients->execute();
     if ($Qrecipients->numberOfRows() > 0) {
         $mimemessage = new email(array(base64_decode('WC1NYWlsZXI6IG9zQ29tbWVyY2UgKGh0dHA6Ly93d3cub3Njb21tZXJjZS5jb20p')));
         $mimemessage->add_text($this->_newsletter_content);
         $mimemessage->build_message();
         while ($Qrecipients->next()) {
             $mimemessage->send($Qrecipients->value('customers_firstname') . ' ' . $Qrecipients->value('customers_lastname'), $Qrecipients->value('customers_email_address'), '', EMAIL_FROM, $this->_newsletter_title);
             $Qlog = $osC_Database->query('insert into :table_newsletters_log (newsletters_id, email_address, date_sent) values (:newsletters_id, :email_address, now())');
             $Qlog->bindTable(':table_newsletters_log', TABLE_NEWSLETTERS_LOG);
             $Qlog->bindInt(':newsletters_id', $this->_newsletter_id);
             $Qlog->bindValue(':email_address', $Qrecipients->value('customers_email_address'));
             $Qlog->execute();
             $time_end = explode(' ', microtime());
             $timer_total = number_format($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0]), 3);
             if ($timer_total > $max_execution_time) {
                 echo '<p><font color="#38BB68"><b>' . TEXT_REFRESHING_PAGE . '</b></font></p>' . '<p><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nmID=' . $this->_newsletter_id . '&action=nmSendConfirm') . '">' . TEXT_CONTINUE_MANUALLY . '</a></p>' . '<META HTTP-EQUIV="refresh" content="2; URL=' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nmID=' . $this->_newsletter_id . '&action=nmSendConfirm') . '">';
                 exit;
             }
         }
         $Qrecipients->freeResult();
     }
     $Qupdate = $osC_Database->query('update :table_newsletters set date_sent = now(), status = 1 where newsletters_id = :newsletters_id');
     $Qupdate->bindTable(':table_newsletters', TABLE_NEWSLETTERS);
     $Qupdate->bindInt(':newsletters_id', $this->_newsletter_id);
     $Qupdate->execute();
 }
コード例 #9
0
ファイル: general.php プロジェクト: tapwag/oscommerce_deutsch
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: osCommerce'));
    // Build the text version
    $text = strip_tags($email_text);
    if (EMAIL_USE_HTML == 'true') {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
コード例 #10
0
                $mail_sent_to = $sent_to['customers_status_name'];
            } else {
                $customers_email_address = olc_db_prepare_input($_POST['customers_email_address']);
                $mail_query = olc_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . olc_db_input($customers_email_address) . APOS);
                $mail_sent_to = $_POST['customers_email_address'];
            }
            break;
    }
    $from = olc_db_prepare_input($_POST['from']);
    $subject = olc_db_prepare_input($_POST['subject']);
    $message = olc_db_prepare_input($_POST['message']);
    //Let's build a message object using the email class
    $mimemessage = new email(array('X-Mailer: OL-Commerce bulk mailer'));
    // add the message to the object
    $mimemessage->add_text($message);
    $mimemessage->build_message();
    while ($mail = olc_db_fetch_array($mail_query)) {
        $mimemessage->send($mail['customers_firstname'] . BLANK . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
    }
    olc_redirect(olc_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview' && !$_POST['customers_email_address']) {
    $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}
if ($_GET['mail_sent_to']) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
コード例 #11
0
function zen_mail($to_name, $to_address, $email_subject, $email_text, $from_email_name, $from_email_address, $block = array(), $module = 'default', $attachments_list = '')
{
    global $db, $messageStack;
    if (SEND_EMAILS != 'true') {
        return false;
    }
    // if sending email is disabled in Admin, just exit
    if (!zen_not_null($email_text) && !zen_not_null($block['EMAIL_MESSAGE_HTML'])) {
        return false;
    }
    // if no text or html-msg supplied, exit
    // Parse "from" addresses for "name" <*****@*****.**> structure, and supply name/address info from it.
    if (eregi(" *([^<]*) *<([^>]*)> *", $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 (eregi(" *([^<]*) *<([^>]*)> *", $value, $regs)) {
            $to_name = str_replace('"', '', trim($regs[1]));
            $to_email_address = $regs[2];
        } elseif (eregi(" *([^ ]*) *", $value, $regs)) {
            $to_email_address = trim($regs[1]);
        }
        if (!isset($to_email_address)) {
            $to_email_address = $to_address;
        }
        //if not more than one, just use the main one.
        //define some additional html message blocks available to templates, then build the html portion.
        if ($block['EMAIL_TO_NAME'] == '') {
            $block['EMAIL_TO_NAME'] = $to_name;
        }
        if ($block['EMAIL_TO_ADDRESS'] == '') {
            $block['EMAIL_TO_ADDRESS'] = $to_email_address;
        }
        if ($block['EMAIL_SUBJECT'] == '') {
            $block['EMAIL_SUBJECT'] = $email_subject;
        }
        if ($block['EMAIL_FROM_NAME'] == '') {
            $block['EMAIL_FROM_NAME'] = $from_email_name;
        }
        if ($block['EMAIL_FROM_ADDRESS'] == '') {
            $block['EMAIL_FROM_ADDRESS'] = $from_email_address;
        }
        $email_html = zen_build_html_email_from_template($module, $block);
        //  if ($attachments_list == '') $attachments_list= array();
        // Instantiate a new mail object
        $message = new email(array('X-Mailer: Zen Cart Mailer'));
        // bof: body of the email clean-up
        // clean up &amp; and && from email text
        while (strstr($email_text, '&amp;&amp;')) {
            $email_text = str_replace('&amp;&amp;', '&amp;', $email_text);
        }
        while (strstr($email_text, '&amp;')) {
            $email_text = str_replace('&amp;', '&', $email_text);
        }
        while (strstr($email_text, '&&')) {
            $email_text = str_replace('&&', '&', $email_text);
        }
        // clean up money &euro; to e
        while (strstr($email_text, '&euro;')) {
            $email_text = str_replace('&euro;', 'e', $email_text);
        }
        // fix double quotes
        while (strstr($email_text, '&quot;')) {
            $email_text = str_replace('&quot;', '"', $email_text);
        }
        // fix slashes
        $email_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)
        $customers_email_format_read = $db->Execute("select customers_email_format from " . TABLE_CUSTOMERS . " where customers_email_address= '" . $to_email_address . "'");
        $customers_email_format = $customers_email_format_read->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
        //determine what format to send messages in if this is an "extra"/admin-copy email:
        if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module, -6) == '_extra') {
            $email_html = '';
            // just blank out the html portion if admin has selected text-only
        }
        // Build the email based on whether customer has selected HTML or TEXT, and whether we have supplied HTML or TEXT-only components
        if (!zen_not_null($email_text)) {
            $text = str_replace('<br[[:space:]]*/?[[:space:]]*>', "@CRLF", $block['EMAIL_MESSAGE_HTML']);
            $text = str_replace('</p>', '</p>@CRLF', $text);
            $text = htmlspecialchars(stripslashes(strip_tags($text)));
        } else {
            $text = strip_tags($email_text);
        }
        if (EMAIL_USE_HTML == 'true' && trim($email_html) != '' && ($customers_email_format == 'HTML' || ADMIN_EXTRA_EMAIL_FORMAT != 'TEXT' && substr($module, -6) == '_extra')) {
            $message->add_html($email_html, $text);
        } else {
            $message->add_text($text);
            $email_html = '';
            // since sending a text-only message, empty the HTML portion so it's not archived either.
        }
        // process attachments
        if (EMAIL_ATTACHMENTS_ENABLED && zen_not_null($attachments_list)) {
            //    while ( list($key, $value) = each($attachments_list)) {
            $fileraw = $message->get_file(DIR_FS_ADMIN . 'attachments/' . $attachments_list['file']);
            $filemime = zen_not_null($attachments_list['file_type']) ? $attachments_list['file_type'] : $message->findMime($attachments_list);
            //findMime determines what type this attachment is (XLS, PDF, etc) and sends proper vendor c_type.
            $message->add_attachment($fileraw, $attachments_list['file'], $filemime);
            //     } //endwhile attach_list
        }
        //endif attachments
        // Prepare message
        $message->build_message();
        // send the actual email
        $result = $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
        if (!$result) {
            $messageStack->add(sprintf(EMAIL_SEND_FAILED, $to_name, $to_email_address, $email_subject), 'error');
        }
        // Archive this message to storage log
        if (EMAIL_ARCHIVE == 'true' && $module != 'password_forgotten_admin' && $module != 'cc_middle_digs') {
            // don't archive pwd-resets and CC numbers
            zen_mail_archive_write($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $module);
        }
        // endif archiving
    }
    // end foreach loop thru possible multiple email addresses
}
コード例 #12
0
 function send($newsletter_id)
 {
     $audience = array();
     if ($_POST['global'] == TRUE_STRING_S) {
         $products_query = olc_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id");
         while ($products = olc_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = olc_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = olc_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     } else {
         $chosen = $_POST['chosen'];
         $ids = implode(',', $chosen);
         $products_query = olc_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in (" . $ids . RPAREN);
         while ($products = olc_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = olc_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = olc_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     }
     $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
     $mimemessage->add_text($this->content);
     $mimemessage->build_message();
     reset($audience);
     while (list($key, $value) = each($audience)) {
         $mimemessage->send($value['firstname'] . BLANK . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = olc_db_prepare_input($newsletter_id);
     olc_db_query(SQL_UPDATE . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . olc_db_input($newsletter_id) . APOS);
 }
コード例 #13
0
ファイル: general.php プロジェクト: rabbit-source/setbook.ru
function tep_update_all_shops($products_types_id = '')
{
    global $temp_tables, $in_shops, $currencies, $languages_id;
    $products_types_default_status = $products_types_id == 1 ? 1 : 0;
    if (!is_array($in_shops)) {
        $in_shops = array();
    }
    $temp_currencies = array();
    $filename_currencies_gz = UPLOAD_DIR . 'CSV/kurs.csv.gz';
    $filename_currencies = str_replace('.gz', '', $filename_currencies_gz);
    if (file_exists($filename_currencies_gz)) {
        $gz = @gzopen($filename_currencies_gz, 'r');
        $ff = @fopen($filename_currencies, 'w');
        if ($gz && $ff) {
            while ($string = gzgets($gz, 1024)) {
                fwrite($ff, $string);
            }
            fclose($ff);
            gzclose($gz);
        } elseif (file_exists($filename_currencies)) {
            @unlink($filename_currencies);
        }
    }
    if (file_exists($filename_currencies)) {
        $fp = fopen($filename_currencies, 'r');
        while ((list($currency_code, $currency_value) = fgetcsv($fp, 64, ';')) !== FALSE) {
            if ((double) $currency_value > 0) {
                $temp_currencies[$currency_code] = str_replace(',', '.', trim($currency_value));
            }
        }
        fclose($fp);
        unlink($filename_currencies);
    }
    if (sizeof($temp_currencies) == 0) {
        reset($currencies);
        while (list($currency_code, $currency_info) = each($currencies)) {
            $temp_currencies[$currency_code] = $currency_info['value'];
        }
    }
    $deleted_products = array();
    $filename_deleted_gz = UPLOAD_DIR . 'CSV/Deleted.csv.gz';
    $filename_deleted = str_replace('.gz', '', $filename_deleted_gz);
    if (file_exists($filename_deleted_gz)) {
        $gz = @gzopen($filename_deleted_gz, 'r');
        $ff = @fopen($filename_deleted, 'w');
        if ($gz && $ff) {
            while ($string = gzgets($gz, 1024)) {
                fwrite($ff, $string);
            }
            fclose($ff);
            gzclose($gz);
        } elseif (file_exists($filename_deleted)) {
            @unlink($filename_deleted);
        }
    }
    if (file_exists($filename_deleted)) {
        $fp = fopen($filename_deleted, 'r');
        while ((list($deleted_code, $deleted_type_id) = fgetcsv($fp, 64, ';')) !== FALSE) {
            if ((int) $deleted_code > 0) {
                $deleted_product_info_query = tep_db_query("select products_id from " . TABLE_TEMP_PRODUCTS . " where products_code = 'bbk" . sprintf('%010d', $deleted_code) . "' and products_types_id = '" . (int) $deleted_type_id . "'");
                $deleted_product_info = tep_db_fetch_array($deleted_product_info_query);
                $deleted_products[] = $deleted_product_info['products_id'];
            }
        }
        fclose($fp);
        unlink($filename_deleted);
    }
    $shops_query = tep_db_query("select * from " . TABLE_SHOPS . " where shops_database <> ''" . (sizeof($in_shops) > 0 ? " and (shops_default_status = '1' or shops_id in ('" . implode("', '", $in_shops) . "'))" : "") . " order by shops_default_status");
    while ($shops = tep_db_fetch_array($shops_query)) {
        list($shop_currency) = explode(',', $shops['shops_currency']);
        $shop_db = tep_db_input($shops['shops_database']);
        if (tep_not_null($shop_db)) {
            tep_db_select_db($shop_db);
            reset($temp_tables);
            while (list($step, $temp_table) = each($temp_tables)) {
                if ($shops['shops_default_status'] == '0') {
                    tep_db_query("drop table if exists " . $shop_db . ".temp_" . $temp_table);
                    if (tep_db_table_exists(DB_DATABASE, 'temp_' . $temp_table)) {
                        tep_db_query("create table " . $shop_db . ".temp_" . $temp_table . " like " . DB_DATABASE . ".temp_" . $temp_table);
                        tep_db_query("insert into " . $shop_db . ".temp_" . $temp_table . " select * from " . DB_DATABASE . ".temp_" . $temp_table);
                    } else {
                        tep_db_query("create table " . $shop_db . "." . $temp_table . " like " . DB_DATABASE . "." . $temp_table);
                        tep_db_query("insert into " . $shop_db . "." . $temp_table . " select * from " . DB_DATABASE . "." . $temp_table);
                    }
                }
            }
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_status = '1' where products_types_id > '1' and products_id in (select products_id from " . DB_DATABASE . "." . TABLE_PRODUCTS_TO_SHOPS . " where shops_id = '" . (int) $shops['shops_id'] . "' and products_status = '1')");
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_status = '0' where products_id in (select products_id from " . DB_DATABASE . "." . TABLE_PRODUCTS_TO_SHOPS . " where shops_id = '" . (int) $shops['shops_id'] . "' and products_status = '0')");
            /*
            		if ((int)$products_types_default_status==0) {
            		  $unused_categories_array = array();
            		  $unused_categories_query = tep_db_query("select categories_id from " . $shop_db . "." . TABLE_CATEGORIES . " where products_types_id = '" . (int)$products_types_id . "' and categories_status = '1'");
            	 	  while ($unused_categories = tep_db_fetch_array($unused_categories_query)) {
            			$subcategories_array = $unused_categories['categories_id'];
            			tep_get_subcategories($subcategories_array, $unused_categories['categories_id']);
            			$products_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " p where p.products_types_id = '" . (int)$products_types_id . "' and p2c.products_id = p.products_id and p.products_status = '1'");
            			$products_check = tep_db_fetch_array($products_check_query);
            			if ($products_check['total']==0) $unused_categories_array[] = (int)$unused_categories['categories_id'];
            		  }
            		  if (sizeof($unused_categories_array) > 0) tep_db_query("update " . $shop_db . "." . TABLE_CATEGORIES . " set categories_status = '0' where categories_id in ('" . implode("', '", $unused_categories_array) . "'))");
            		}
            */
            $unused_categories_array = array();
            $unused_categories_query = tep_db_query("select categories_id from " . $shop_db . "." . TABLE_CATEGORIES . " where categories_status = '0' and products_types_id in (select products_types_id from " . $shop_db . "." . TABLE_PRODUCTS_TYPES . " where products_types_status = '1')");
            while ($unused_categories = tep_db_fetch_array($unused_categories_query)) {
                $unused_categories_array[] = $unused_categories['categories_id'];
                tep_get_subcategories($unused_categories_array, $unused_categories['categories_id']);
            }
            if (sizeof($unused_categories_array) > 0) {
                tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_status = '0' where products_id in (select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id in ('" . implode("', '", $unused_categories_array) . "'))");
            }
            tep_update_shops_prices($shops['shops_id'], '', 'temp');
            reset($deleted_products);
            while (list(, $deleted_product_id) = each($deleted_products)) {
                tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_status = '0' where products_id = '" . (int) $deleted_product_id . "'");
            }
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_listing_status = '0', products_xml_status = '0' where products_price = '0'");
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_price = '0' where products_listing_status = '0'");
            if ($shops['shops_default_status'] == '0') {
                tep_db_query("delete from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where specials_types_id = '5'");
            } else {
                tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_available_in = '1' where products_id in (select products_id from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where specials_types_id = '5' and status = '1')");
            }
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " set products_available_in = '0' where products_filename is not null");
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_SPECIALS . " s, " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " p set s.status = p.products_status, s.products_image_exists = p.products_image_exists, s.specials_first_page = if((p.products_image_exists and p.products_listing_status), '1', '0') where s.products_id = p.products_id");
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_SPECIALS . " set specials_first_page = if((products_image_exists and status), '1', '0') where specials_types_id = '4'");
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " p, " . $shop_db . "." . TABLE_TEMP_PRODUCTS_INFO . " pi set pi.products_code = p.products_code, pi.products_model = p.products_model, pi.products_image = p.products_image, pi.products_filename = p.products_filename, pi.products_price = p.products_price, pi.products_last_modified = p.products_last_modified, pi.products_available_in = p.products_available_in, pi.products_weight = p.products_weight, pi.products_year = p.products_year, pi.products_pages_count = p.products_pages_count, pi.products_copies = p.products_copies, pi.products_status = p.products_status, pi.products_listing_status = p.products_listing_status, pi.products_types_id = p.products_types_id where pi.products_id = p.products_id");
            //		tep_db_query("delete from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
            $specials_query = tep_db_query("select specials_id, products_id, specials_new_products_price from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where specials_new_products_price > '0'");
            while ($specials = tep_db_fetch_array($specials_query)) {
                $product_info_query = tep_db_query("select products_price, products_status from " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " where products_id = '" . (int) $specials['products_id'] . "'");
                $product_info = tep_db_fetch_array($product_info_query);
                if ($product_info['products_price'] <= $specials['specials_new_products_price'] || $product_info['products_status'] == '0') {
                    tep_db_query("delete from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where specials_id = '" . (int) $specials['specials_id'] . "'");
                }
            }
            $specials_query = tep_db_query("select specials_id, products_id from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where specials_types_id = '4'");
            while ($specials = tep_db_fetch_array($specials_query)) {
                $product_info_query = tep_db_query("select products_listing_status, products_price from " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " where products_id = '" . (int) $specials['products_id'] . "'");
                $product_info = tep_db_fetch_array($product_info_query);
                if ($product_info['products_price'] > '0' && $product_info['products_listing_status'] == '1') {
                    tep_db_query("delete from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where specials_id = '" . (int) $specials['specials_id'] . "'");
                }
            }
            // сортировка по умолчанию (сначала спецпредложения с картинками, потом спецпредложения без картинок, потом книги с картинками, потом все остальное)
            $max_specials_date_query = tep_db_query("select max(specials_date_added) as specials_date_added from " . $shop_db . "." . TABLE_TEMP_SPECIALS . " where status = '1'");
            $max_specials_date_row = tep_db_fetch_array($max_specials_date_query);
            $max_specials_date = strtotime($max_specials_date_row['specials_date_added']);
            $min_specials_date_added = date('Y-m-d', $max_specials_date - 60 * 60 * 24 * 7);
            tep_db_query("update " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " p left join " . $shop_db . "." . TABLE_TEMP_SPECIALS . " s on (s.products_id = p.products_id and s.specials_types_id in ('1', '2') and s.specials_date_added >= '" . tep_db_input($min_specials_date_added) . "') set p.sort_order = (if(p.products_listing_status=1, 8, 0) + if(s.specials_types_id, if(s.specials_types_id=1, 4, if(s.specials_types_id=2, 3, 0)), 0) + if(p.products_image_exists=1, 2, 0))");
            reset($temp_tables);
            while (list($step, $temp_table) = each($temp_tables)) {
                if (tep_db_table_exists($shop_db, 'temp_' . $temp_table)) {
                    if ($temp_table == TABLE_PRODUCTS && $products_types_default_status == 1) {
                        /*
                        			  $basket_products_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where shops_id = '" . (int)$shops['shops_id'] . "'");
                        			  while ($basket_products = tep_db_fetch_array($basket_products_query)) {
                        				$check_old_status_query = tep_db_query("slect products_status, products_listing_status from " . $shop_db . "." . TABLE_PRODUCTS . " where products_id = '" . (int)$basket_products['products_id'] . "'");
                        				$check_old_status = tep_db_fetch_array($check_old_status_query);
                        
                        				$check_new_status_query = tep_db_query("slect products_status, products_listing_status from " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " where products_id = '" . (int)$basket_products['products_id'] . "'");
                        				$check_new_status = tep_db_fetch_array($check_new_status_query);
                        
                        				if ($check_new_status['products_status'] == '0') {
                        				  // удаляем из корзин товары, которых нет на сайте
                        				  tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where shops_id = '" . (int)$shops['shops_id'] . "' and products_id = '" . (int)$basket_products['products_id'] . "'");
                        				} elseif ($check_old_status['products_listing_status'] == '1' && $check_new_status['products_listing_status'] == '0') {
                        				  // переносим из корзин в отложенные товары
                        				  tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '1', customers_basket_type = 'postpone' where shops_id = '" . (int)$shops['shops_id'] . "' and products_id = '" . (int)$basket_products['products_id'] . "'");
                        				}
                        			  }
                        */
                        $lang_id = $languages_id;
                        if ($shop_db == 'setbook_org' || $shop_db == 'easternowl' || $shop_db == 'insellbooks') {
                            $lang_id = 1;
                        }
                        $shop_name_info_query = tep_db_query("select configuration_value from " . $shop_db . "." . TABLE_CONFIGURATION . " where configuration_key = 'STORE_NAME'");
                        $shop_name_info = tep_db_fetch_array($shop_name_info_query);
                        $shop_name = $shop_name_info['configuration_value'];
                        $shop_email_info_query = tep_db_query("select configuration_value from " . $shop_db . "." . TABLE_CONFIGURATION . " where configuration_key = 'STORE_OWNER_EMAIL_ADDRESS'");
                        $shop_email_info = tep_db_fetch_array($shop_email_info_query);
                        $shop_email = $shop_email_info['configuration_value'];
                        $shop_phone_info_query = tep_db_query("select configuration_value from " . $shop_db . "." . TABLE_CONFIGURATION . " where configuration_key = 'STORE_OWNER_PHONE_NUMBER'");
                        $shop_phone_info = tep_db_fetch_array($shop_phone_info_query);
                        $shop_phone = $shop_phone_info['configuration_value'];
                        $notify_products_query = tep_db_query("select customers_basket_id, products_id, customers_id, customers_basket_notify_url, customers_basket_notify from " . TABLE_CUSTOMERS_BASKET . " where shops_id = '" . (int) $shops['shops_id'] . "' and customers_basket_notify > '0'");
                        while ($notify_products = tep_db_fetch_array($notify_products_query)) {
                            $new_info_query = tep_db_query("select products_status, products_listing_status, products_price, authors_id from " . $shop_db . "." . TABLE_TEMP_PRODUCTS . " where products_id = '" . (int) $notify_products['products_id'] . "'");
                            $new_info = tep_db_fetch_array($new_info_query);
                            $old_info_query = tep_db_query("select products_status, products_listing_status, products_price, authors_id from " . $shop_db . "." . TABLE_PRODUCTS . " where products_id = '" . (int) $notify_products['products_id'] . "'");
                            $old_info = tep_db_fetch_array($old_info_query);
                            $product_name_info_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int) $notify_products['products_id'] . "' and language_id = '" . (int) $lang_id . "'");
                            $product_name_info = tep_db_fetch_array($product_name_info_query);
                            if (!is_array($product_name_info)) {
                                $product_name_info = array();
                            }
                            $author_info_query = tep_db_query("select authors_name from " . TABLE_AUTHORS . " where authors_id = '" . (int) $new_info['authors_id'] . "' and language_id = '" . (int) $lang_id . "'");
                            $author_info = tep_db_fetch_array($author_info_query);
                            if (!is_array($author_info)) {
                                $author_info = array();
                            }
                            if ($lang_id == 1) {
                                $product_email_name = $product_name_info['products_name'] . (tep_not_null($author_info['authors_name']) ? ' by ' . $author_info['authors_name'] : '');
                            } else {
                                $product_email_name = (tep_not_null($author_info['authors_name']) ? $author_info['authors_name'] . ': ' : '') . $product_name_info['products_name'];
                            }
                            $new_status = $new_info['products_listing_status'];
                            $new_price = $new_info['products_price'];
                            $old_status = $old_info['products_listing_status'];
                            $old_price = $old_info['products_price'];
                            $customer_info_query = tep_db_query("select customers_firstname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $notify_products['customers_id'] . "'");
                            $customer_info = tep_db_fetch_array($customer_info_query);
                            $notification_body = '';
                            $notification_subject = '';
                            $notification_warning = '';
                            if ($notify_products['customers_basket_notify'] == '1') {
                                // о появлении в продаже
                                if ($new_status == '1') {
                                    if ($lang_id == 1) {
                                        $notification_body = EMAIL_NOTIFICATION_BODY_EN_1;
                                        $notification_subject = EMAIL_NOTIFICATION_SUBJECT_EN_1;
                                        $notification_warning = EMAIL_NOTIFICATION_WARNING_EN_1;
                                    } else {
                                        $notification_body = EMAIL_NOTIFICATION_BODY_1;
                                        $notification_subject = EMAIL_NOTIFICATION_SUBJECT_1;
                                        $notification_warning = EMAIL_NOTIFICATION_WARNING_1;
                                    }
                                }
                            } elseif ($notify_products['customers_basket_notify'] == '2') {
                                // о снижении цены
                                if ($new_price > 0 && $new_price < $old_price) {
                                    if ($lang_id == 1) {
                                        $notification_body = EMAIL_NOTIFICATION_BODY_EN_2;
                                        $notification_subject = EMAIL_NOTIFICATION_SUBJECT_EN_2;
                                        $notification_warning = EMAIL_NOTIFICATION_WARNING_EN_2;
                                    } else {
                                        $notification_body = EMAIL_NOTIFICATION_BODY_2;
                                        $notification_subject = EMAIL_NOTIFICATION_SUBJECT_2;
                                        $notification_warning = EMAIL_NOTIFICATION_WARNING_2;
                                    }
                                }
                            }
                            if (tep_not_null($notification_body)) {
                                $email_notification_body = str_replace('{{product_link}}', $notify_products['customers_basket_notify_url'], sprintf($notification_body, $customer_info['customers_firstname'], $product_email_name)) . "\n\n" . EMAIL_NOTIFICATION_SEPARATOR . "\n" . sprintf($notification_warning, $shop_name);
                                $message = new email(array('X-Mailer: ' . $shop_name));
                                $text = strip_tags($email_notification_body);
                                if ($shops['shops_email_use_html'] < 1) {
                                    $message->add_text($text);
                                } else {
                                    ob_start();
                                    include DIR_FS_CATALOG . 'images/mail/email_header_1.php';
                                    echo trim($email_notification_body);
                                    include DIR_FS_CATALOG . 'images/mail/email_footer_1.php';
                                    $email_text_html = ob_get_clean();
                                    $email_text_html = str_replace(array('<title></title>', '{{HTTP_SERVER}}', '{{STORE_NAME}}', '{{STORE_OWNER_PHONE_NUMBER}}'), array('<title>' . sprintf($notification_subject, $shop_name) . '</title>', $shops['shops_url'], $shop_name, $shop_phone), $email_text_html);
                                    $message->add_html($email_text_html, $text);
                                }
                                $message->build_message();
                                $message->send($customer_info['customers_firstname'], $customer_info['customers_email_address'], $shop_name, $shop_email, sprintf($notification_subject, $shop_name));
                                tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_notify = '0', customers_basket_notify_url = null where customers_basket_id = '" . (int) $notify_products['customers_basket_id'] . "'");
                            }
                        }
                    }
                    tep_db_query("drop table " . $shop_db . "." . $temp_table . "");
                    tep_db_query("alter table " . $shop_db . ".temp_" . $temp_table . " rename as " . $shop_db . "." . $temp_table . "");
                    if ($shop_db == 'setbook_ua') {
                        tep_db_query("update " . $shop_db . "." . TABLE_CURRENCIES . " set value = '" . tep_db_input($temp_currencies[$shop_currency]) . "', last_updated = now() where code = '" . tep_db_input($shop_currency) . "'");
                    }
                }
            }
            if ($shops['shops_default_status'] == '1') {
                tep_db_query("delete from " . TABLE_SEARCH_KEYWORDS_TO_PRODUCTS . "");
                tep_db_query("delete from " . TABLE_SEARCH_KEYWORDS . "");
                tep_db_query("update " . TABLE_SPECIALS_TYPES . " set specials_last_modified = now()");
            }
            if ($products_types_default_status == 1) {
                tep_db_query("update " . $shop_db . "." . TABLE_PRODUCTS_TYPES . " set products_last_modified = now() where products_types_id = '1'");
            } else {
                tep_db_query("update " . $shop_db . "." . TABLE_PRODUCTS_TYPES . " set products_last_modified = now() where products_types_id > '1'");
            }
            if ($shop_db == 'setbook_us' || $shop_db == 'setbook_biz') {
                tep_db_query("replace into " . $shop_db . "." . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) select concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_page_title, ' Russian books.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_title, '. Russian books.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_keywords, ' Russian books.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_description, ' Russian books.'), " . DB_DATABASE . "." . TABLE_METATAGS . ".language_id, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_id from " . DB_DATABASE . "." . TABLE_METATAGS . " where " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type in ('author', 'category', 'manufacturer',  'product', 'serie', 'type');");
                tep_db_query("update " . $shop_db . "." . TABLE_METATAGS . " mt, " . $shop_db . "." . TABLE_PRODUCTS . " p set mt.metatags_page_title = replace(mt.metatags_page_title, 'Russian books', 'Russian magazines'), mt.metatags_title = replace(mt.metatags_title, 'Russian books', 'Russian magazines'), mt.metatags_keywords = replace(mt.metatags_keywords, 'Russian books', 'Russian magazines'), mt.metatags_description = replace(mt.metatags_description, 'Russian books', 'Russian magazines') where mt.content_type = 'product' and mt.content_id = p.products_id and p.products_types_id = '2'");
                tep_db_query("update " . $shop_db . "." . TABLE_METATAGS . " mt, " . $shop_db . "." . TABLE_PRODUCTS . " p set mt.metatags_page_title = replace(mt.metatags_page_title, 'Russian books', 'Russian magazines'), mt.metatags_title = replace(mt.metatags_title, 'Russian books', 'Russian souvenirs. Matreshka'), mt.metatags_keywords = replace(mt.metatags_keywords, 'Russian books', 'Russian magazines'), mt.metatags_description = replace(mt.metatags_description, 'Russian books', 'Russian souvenirs') where mt.content_type = 'product' and mt.content_id = p.products_id and p.products_types_id = '5'");
            } elseif ($shop_db == 'setbook_eu' || $shop_db == 'setbook_net') {
                tep_db_query("replace into " . $shop_db . "." . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) select concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_page_title, ' Russian books. Russische b&uuml;cher'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_title, '. Russian books.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_keywords, ' Russian books. Russische b&uuml;cher'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_description, ' Russian books. Russische b&uuml;cher'), " . DB_DATABASE . "." . TABLE_METATAGS . ".language_id, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_id from " . DB_DATABASE . "." . TABLE_METATAGS . " where " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type in ('author', 'category', 'manufacturer',  'product', 'serie', 'type');");
                tep_db_query("update " . $shop_db . "." . TABLE_METATAGS . " mt, " . $shop_db . "." . TABLE_PRODUCTS . " p set mt.metatags_page_title = replace(mt.metatags_page_title, 'Russian books. Russische b&uuml;cher', 'Russian magazines. Russische Zeitschriften'), mt.metatags_title = replace(mt.metatags_title, 'Russian books', 'Russian magazines'), mt.metatags_keywords = replace(mt.metatags_keywords, 'Russian books', 'Russian magazines'), mt.metatags_description = replace(mt.metatags_description, 'Russian books', 'Russian magazines') where mt.content_type = 'product' and mt.content_id = p.products_id and p.products_types_id = '2'");
            } elseif ($shop_db == 'setbook_ua') {
                tep_db_query("replace into " . $shop_db . "." . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) select replace(" . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_page_title, 'Интернет-магазин Setbook', 'Книжный интернет-магазин в Украине Setbook'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_title, '. Книжный интернет-магазин в Украине Setbook.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_keywords, ' Украина, книги в Киеве.'),\nconcat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_description, ' Украина, книги в Киеве.'), " . DB_DATABASE . "." . TABLE_METATAGS . ".language_id, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_id from " . DB_DATABASE . "." . TABLE_METATAGS . " where " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type in ('author', 'category', 'manufacturer',  'product', 'serie', 'type');");
                //		  tep_db_query("update " . $shop_db . "." . TABLE_METATAGS . " mt, " . $shop_db . "." . TABLE_PRODUCTS . " p set mt.metatags_page_title = replace(mt.metatags_page_title, 'Russian books', ''), mt.metatags_title = replace(mt.metatags_title, '', ''), mt.metatags_keywords = replace(mt.metatags_keywords, '', ''), mt.metatags_description = replace(mt.metatags_description, '', '') where mt.content_type = 'product' and mt.content_id = p.products_id and p.products_types_id = '2'");
            } elseif ($shop_db == 'setbook_kz') {
                tep_db_query("replace into " . $shop_db . "." . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) select replace(" . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_page_title, 'Интернет-магазин Setbook', 'Книжный интернет-магазин в Казахстане Setbook'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_title, '. Книжный интернет-магазин в Казахстане Setbook.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_keywords, ' Казахстан, книги в Алматы, Астане, Караганде.'),\nconcat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_description, ' Казахстан, книги в Алматы, Астане, Караганде.'), " . DB_DATABASE . "." . TABLE_METATAGS . ".language_id, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_id from " . DB_DATABASE . "." . TABLE_METATAGS . " where " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type in ('author', 'category', 'manufacturer',  'product', 'serie', 'type');");
                //		  tep_db_query("update " . $shop_db . "." . TABLE_METATAGS . " mt, " . $shop_db . "." . TABLE_PRODUCTS . " p set mt.metatags_page_title = replace(mt.metatags_page_title, 'Russian books', ''), mt.metatags_title = replace(mt.metatags_title, '', ''), mt.metatags_keywords = replace(mt.metatags_keywords, '', ''), mt.metatags_description = replace(mt.metatags_description, '', '') where mt.content_type = 'product' and mt.content_id = p.products_id and p.products_types_id = '2'");
            } elseif ($shop_db == 'setbook_by' || $shop_db == 'bookva_by') {
                if ($shop_db == 'setbook_by') {
                    tep_db_query("replace into " . $shop_db . "." . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) select replace(" . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_page_title, 'Интернет-магазин Setbook', 'Интернет-магазин книг в Белоруссии Setbook'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_title, '. Интернет-магазин книг Белоруссии Setbook.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_keywords, ' Белоруссия, книги в Минске.'), concat_ws('', " . DB_DATABASE . "." . TABLE_METATAGS . ".metatags_description, ' Белоруссия, книги в Минске.'), " . DB_DATABASE . "." . TABLE_METATAGS . ".language_id, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type, " . DB_DATABASE . "." . TABLE_METATAGS . ".content_id from " . DB_DATABASE . "." . TABLE_METATAGS . " where " . DB_DATABASE . "." . TABLE_METATAGS . ".content_type in ('author', 'category', 'manufacturer',  'product', 'serie', 'type');");
                    //			tep_db_query("update " . $shop_db . "." . TABLE_METATAGS . " mt, " . $shop_db . "." . TABLE_PRODUCTS . " p set mt.metatags_page_title = replace(mt.metatags_page_title, 'Russian books', ''), mt.metatags_title = replace(mt.metatags_title, '', ''), mt.metatags_keywords = replace(mt.metatags_keywords, '', ''), mt.metatags_description = replace(mt.metatags_description, '', '') where mt.content_type = 'product' and mt.content_id = p.products_id and p.products_types_id = '2'");
                }
            }
        }
    }
    tep_db_select_db(DB_DATABASE);
}
コード例 #14
0
 function sendEmail()
 {
     if (PHP_VERSION < 4.1) {
         global $_GET, $_POST;
     }
     global $osC_Database;
     $max_execution_time = 0.8 * (int) ini_get('max_execution_time');
     $time_start = explode(' ', PAGE_PARSE_START_TIME);
     if (isset($_POST['chosen'])) {
         $chosen = $_POST['chosen'];
     } elseif (isset($_GET['chosen'])) {
         $chosen = $_GET['chosen'];
     } elseif (isset($_POST['global'])) {
         $global = $_POST['global'];
     } elseif (isset($_GET['global'])) {
         $global = $_GET['global'];
     }
     $chosen_get_string = '';
     if (isset($chosen) && !empty($chosen)) {
         foreach ($chosen as $id) {
             $chosen_get_string .= 'chosen[]=' . $id . '&';
         }
     }
     $audience = array();
     $Qcustomers = $osC_Database->query('select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from :table_customers c, :table_customers_info ci where ci.global_product_notifications = 1 and ci.customers_info_id = c.customers_id');
     $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomers->bindTable(':table_customers_info', TABLE_CUSTOMERS_INFO);
     $Qcustomers->execute();
     while ($Qcustomers->next()) {
         if (!isset($audience[$Qcustomers->valueInt('customers_id')])) {
             $audience[$Qcustomers->valueInt('customers_id')] = array('firstname' => $Qcustomers->value('customers_firstname'), 'lastname' => $Qcustomers->value('customers_lastname'), 'email_address' => $Qcustomers->value('customers_email_address'));
         }
     }
     $Qcustomers = $osC_Database->query('select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from :table_products_notifications pn, :table_customers c left join :table_newsletters_log nl on (c.customers_email_address = nl.email_address and nl.newsletters_id = :newsletters_id) where pn.customers_id = c.customers_id and nl.email_address is null');
     $Qcustomers->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
     $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomers->bindTable(':table_newsletters_log', TABLE_NEWSLETTERS_LOG);
     $Qcustomers->bindInt(':newsletters_id', $this->_newsletter_id);
     if (isset($chosen) && !empty($chosen)) {
         $Qcustomers->appendQuery('and pn.products_id in (:products_id)');
         $Qcustomers->bindRaw(':products_id', implode(', ', $chosen));
     }
     $Qcustomers->execute();
     while ($Qcustomers->next()) {
         if (!isset($audience[$Qcustomers->valueInt('customers_id')])) {
             $audience[$Qcustomers->valueInt('customers_id')] = array('firstname' => $Qcustomers->value('customers_firstname'), 'lastname' => $Qcustomers->value('customers_lastname'), 'email_address' => $Qcustomers->value('customers_email_address'));
         }
     }
     if (sizeof($audience) > 0) {
         $mimemessage = new email(array(base64_decode('WC1NYWlsZXI6IG9zQ29tbWVyY2UgKGh0dHA6Ly93d3cub3Njb21tZXJjZS5jb20p')));
         $mimemessage->add_text($this->_newsletter_content);
         $mimemessage->build_message();
         foreach ($audience as $key => $value) {
             $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->_newsletter_title);
             $Qlog = $osC_Database->query('insert into :table_newsletters_log (newsletters_id, email_address, date_sent) values (:newsletters_id, :email_address, now())');
             $Qlog->bindTable(':table_newsletters_log', TABLE_NEWSLETTERS_LOG);
             $Qlog->bindInt(':newsletters_id', $this->_newsletter_id);
             $Qlog->bindValue(':email_address', $value['email_address']);
             $Qlog->execute();
             $time_end = explode(' ', microtime());
             $timer_total = number_format($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0]), 3);
             if ($timer_total > $max_execution_time) {
                 echo '<p><font color="#38BB68"><b>' . TEXT_REFRESHING_PAGE . '</b></font></p>' . '<p><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nmID=' . $this->_newsletter_id . '&action=nmSendConfirm&' . (isset($global) && $global == 'true' ? 'global=true' : $chosen_get_string)) . '">' . TEXT_CONTINUE_MANUALLY . '</a></p>' . '<META HTTP-EQUIV="refresh" content="2; URL=' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nmID=' . $this->_newsletter_id . '&action=nmSendConfirm&' . (isset($global) && $global == 'true' ? 'global=true' : $chosen_get_string)) . '">';
                 exit;
             }
         }
     }
     $Qupdate = $osC_Database->query('update :table_newsletters set date_sent = now(), status = 1 where newsletters_id = :newsletters_id');
     $Qupdate->bindTable(':table_newsletters', TABLE_NEWSLETTERS);
     $Qupdate->bindInt(':newsletters_id', $this->_newsletter_id);
     $Qupdate->execute();
 }
コード例 #15
0
 function send($newsletter_id)
 {
     global $HTTP_POST_VARS;
     $audience = array();
     if (isset($HTTP_POST_VARS['global']) && $HTTP_POST_VARS['global'] == 'true') {
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     } else {
         $chosen = $HTTP_POST_VARS['chosen'];
         $ids = implode(',', $chosen);
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in (" . $ids . ")");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     }
     $mimemessage = new email(array('X-Mailer: osCommerce'));
     // Build the text version
     $text = strip_tags($this->content);
     if (EMAIL_USE_HTML == 'true') {
         $mimemessage->add_html($this->content, $text);
     } else {
         $mimemessage->add_text($text);
     }
     $mimemessage->build_message();
     reset($audience);
     while (list($key, $value) = each($audience)) {
         $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
コード例 #16
0
ファイル: email_invoice.php プロジェクト: eosc/EosC-2.3
    $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
    for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
        $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
    }
    if ($order->content_type != 'virtual') {
        $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
    }
    $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
    if (is_object(${$payment})) {
        $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
        $payment_class = ${$payment};
        $email_order .= $payment_class->title . "\n\n";
        if ($payment_class->email_footer) {
            $email_order .= $payment_class->email_footer . "\n\n";
        }
    }
    // Add both versions to the email to accomodate people who see html and those that don't
    $ei_message = new email(array('X-Mailer: osCommerce Mailer'));
    // Build the text version
    $ei_text = strip_tags($email_order);
    if (!empty($ei_html_email)) {
        $ei_message->add_html($ei_html_email, $ei_text);
    } else {
        $ei_message->add_text($ei_text);
    }
    $ei_message->build_message();
    $ei_message->send($order->customer['name'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT);
    if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
        $ei_message->send('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT);
    }
}
コード例 #17
0
 function send($newsletter_id)
 {
     global $_POST;
     $audience = array();
     if (isset($_POST['global']) && $_POST['global'] == 'true') {
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     } else {
         $chosen = $_POST['chosen'];
         $ids = implode(',', $chosen);
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in (" . $ids . ")");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     }
     $mimemessage = new email(array('X-Mailer: osCmax Mailer'));
     // BOF: MOD - WYSIWYG HTML Area (Send TEXT Product Notifications v1.7 when WYSIWYG Disabled)
     if (HTML_AREA_WYSIWYG_DISABLE_NEWSLETTER == 'Disable') {
         $mimemessage->add_text($this->content);
         // Orginal OSC line
     } else {
         $mimemessage->add_html($this->content);
     }
     // EOF: MOD - WYSIWYG HTML Area (Send TEXT Product Notifications v1.7 when WYSIWYG Disabled)
     $mimemessage->build_message();
     reset($audience);
     while (list($key, $value) = each($audience)) {
         $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
コード例 #18
0
ファイル: general.php プロジェクト: rongandat/scalaprj
function tep_mail_string_attachment($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $string, $filename)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: osCommerce'));
    // Build the text version
    $text = strip_tags($email_text);
    if (EMAIL_USE_HTML == 'true') {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Now add string attachment - new method of email.php
    $message->add_string_attachment($string, $filename, 'application/pdf');
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
コード例 #19
0
ファイル: general.php プロジェクト: stanislauslive/StanMarket
function smn_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    //Remove any newline and anything after it on the header fields of the mail.
    //$to_email_address and $from_email_address are checked with smn_validate_email().
    $to_name = preg_replace('/[\\n|\\r].*/', '', $to_name);
    $email_subject = preg_replace('/[\\n|\\r].*/', '', $email_subject);
    $from_name = preg_replace('/[\\n|\\r].*/', '', $from_name);
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: oscMall Mailer'));
    // Build the text version
    $text = strip_tags($email_text);
    if (EMAIL_USE_HTML == 'true') {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
コード例 #20
0
 function send($newsletter_id)
 {
     global $_POST;
     $audience = array();
     if (isset($_POST['global']) && $_POST['global'] == 'true') {
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     } else {
         $chosen = $_POST['chosen'];
         $ids = implode(',', $chosen);
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in (" . $ids . ")");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     }
     $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
     // ################# Contribution Newsletter v050 ##############
     $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . HTTP_SERVER . DIR_WS_CATALOG . " " . $this->unsubscribeb . " " . $customers['customers_email_address']);
     // ################# END - Contribution Newsletter v050 ##############
     $mimemessage->build_message();
     reset($audience);
     while (list($key, $value) = each($audience)) {
         $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
コード例 #21
0
ファイル: general.php プロジェクト: digideskio/oscmax2
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    //Dont send any injection type mails.
    if (preg_match('/Content-Type:/i', $to_name)) {
        return false;
    }
    if (preg_match('/Content-Type:/i', $email_subject)) {
        return false;
    }
    if (preg_match('/Content-Type:/i', $from_email_name)) {
        return false;
    }
    if (preg_match('/Content-Type:/i', $email_text)) {
        return false;
    }
    //Remove any newline and anything after it on the header fields of the mail.
    //$to_email_address and $from_email_address are checked with tep_validate_email().
    $to_name = preg_replace('/[\\n|\\r].*/', '', $to_name);
    $email_subject = preg_replace('/[\\n|\\r].*/', '', $email_subject);
    $from_email_name = preg_replace('/[\\n|\\r].*/', '', $from_email_name);
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: osCmax Mailer'));
    // Build the text version
    $text = strip_tags($email_text);
    if (EMAIL_USE_HTML == 'true') {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
    if (SEND_ALL_EMAIL_COPY_TO != '') {
        $message->send($to_name, SEND_ALL_EMAIL_COPY_TO, $from_email_name, $from_email_address, $email_subject);
    }
}
コード例 #22
0
 function send_mail($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $html)
 {
     $from_email_address = trim(implode('', array_map('trim', explode("\n", $from_email_address))));
     $from_email_name = trim(implode('', array_map('trim', explode("\n", $from_email_name))));
     $text = tep_html_entity_decode($text);
     $html = $this->get_template_params(trim($html));
     if ($this->debug) {
         echo $email_subject;
         echo $html;
     }
     if (tep_not_null($to_email_address)) {
         // Instantiate a new mail object
         $message = new email();
         // Build the text version
         $text = strip_tags($html);
         $message->add_html($html, $text);
         // Send message
         $message->build_message();
         if ($this->send) {
             $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
         }
     }
 }
コード例 #23
0
function legacy_zen_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: Zen Cart Mailer'));
    // bof: body of the email clean-up
    // clean up &amp; and && from email text
    while (strstr($email_text, '&amp;&amp;')) {
        $email_text = str_replace('&amp;&amp;', '&amp;', $email_text);
    }
    while (strstr($email_text, '&amp;')) {
        $email_text = str_replace('&amp;', '&', $email_text);
    }
    while (strstr($email_text, '&&')) {
        $email_text = str_replace('&&', '&', $email_text);
    }
    // clean up money &euro; to e
    while (strstr($email_text, '&euro;')) {
        $email_text = str_replace('&euro;', 'e', $email_text);
    }
    // fix double quotes
    while (strstr($email_text, '&quot;')) {
        $email_text = str_replace('&quot;', '"', $email_text);
    }
    // fix slashes
    $email_text = stripslashes($email_text);
    // eof: body of the email clean-up
    // Build the text version
    $text = strip_tags($email_text);
    if (EMAIL_USE_HTML == 'true') {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
コード例 #24
0
ファイル: feedback.php プロジェクト: severnaya99/Sg-2010
$text = isset($_REQUEST['text']) ? $_REQUEST['text'] : '';
$shop = isset($_REQUEST['shop']) ? $_REQUEST['shop'] : '';
$url = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
$name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$mail = isset($_REQUEST['mail']) ? $_REQUEST['mail'] : '';
$to = '*****@*****.**';
$subject = 'Feedback Elm@r-Modul osCommerce v' . MODUL_VERSION . '.' . MODUL_SUBVERSION;
if (SEND_EMAILS != 'true' || !class_exists('email')) {
    $email = $to;
}
$isForm = isset($_REQUEST['isForm']);
if ($isForm) {
    $message = 'Version:   ' . MODUL_VERSION . '.' . MODUL_SUBVERSION . "\r\nShop:      {$shop}\r\nURL:       {$url}\r\nName:      {$name}\r\nE-Mail:    {$mail}\r\nBewertung: {$rating}\r\nNachricht: {$text}\r\n";
    $omail = new email(array('X-Mailer: osCommerce Mailer'));
    $omail->text = $message;
    $omail->build_message();
    if ($omail->send('Stefan Kuhlins', $to, $name, $mail, $subject)) {
        $msg = '<strong style="color:green">Vielen Dank, Ihr Feedback wurde per E-Mail verschickt.</strong>';
    } else {
        $msg = '<strong style="color:red">Oops, Ihr Feedback konnte nicht automatisch per E-Mail verschickt werden.<br>Bitte dr&uuml;cken Sie den Button nochmals, um es per E-Mail-Programm zu schicken.</strong>';
        $email = $to;
    }
} else {
    $shop = STORE_NAME;
    $url = ELMAR_SHOP_ROOT_DIR;
    $name = STORE_OWNER;
    $mail = STORE_OWNER_EMAIL_ADDRESS;
}
if (!empty($msg)) {
    ?>
  <h1>Status</h1>