function cw_send_simple_mail($from, $to, $subject, $body, $extra_headers = array(), $files = array()) { global $current_language; if (empty($to)) { return; } $to = cw_real_mail_address($to); $language = $language ? $language : $current_language; $_files = implode(",", $files); cw_array2insert('mail_spool', cw_addslashes(array('mail_from' => $from, 'mail_to' => $to, 'subject' => $subject, 'body' => $body, 'crypted' => false, 'files' => $_files))); return; }
$page = $data['page']; $user_search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys); $users = cw_query($q = "{$user_search_query} LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}"); if ($action == 'export_emails') { $export_columns_names = array('firstname' => 'Firstname', 'lastname' => 'Lastname', 'email' => 'Email'); $delimiter = $config['General']['user_emails_export_delimiter']; header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=customers_emails.csv"); print implode($delimiter, $export_columns_names) . "\n"; $u_keys = array(); $result = mysql_query($user_search_query); while ($row = mysql_fetch_assoc($result)) { $exp_line = array(); $row['email'] = strtolower($row['email']); if (cw_is_anonymous($row['email'])) { $row['email'] = cw_real_mail_address($row['email']); } foreach ($export_columns_names as $colname => $coltitle) { $exp_line[$colname] = $row[$colname]; } $u_key = md5($row['email']); if (!isset($u_keys[$u_key])) { $u_keys[$u_key] = 1; print implode($delimiter, $exp_line) . "\n"; } } exit; } if ($save_search_id > 0) { cw_array2update('saved_search', array("sql_query" => addslashes($user_search_query)), "ss_id = '{$save_search_id}'"); $save_search_id = 0;
function cw_doc_update_user_information($doc_type, $doc_info_id, $userinfo, $is_create_user = false) { global $customer_id, $config; $address_fields = array('company', 'title', 'firstname', 'lastname', 'address', 'address_2', 'city', 'county', 'state', 'country', 'zipcode', 'phone', 'fax', 'region'); foreach (array('main_address', 'current_address') as $address_type) { $address = $userinfo[$address_type]; cw_array2update('customers_addresses', cw_addslashes($address), "address_id='{$address['address_id']}'", $address_fields); if (is_array($address['custom_fields']) && !empty($address['custom_fields'])) { cw_profile_fields_update_type(0, $address['address_id'], 'A', $address['custom_fields']); } } if (!$userinfo['customer_id'] && $is_create_user) { $userinfo['customer_id'] = cw_user_create_profile(array('usertype' => $userinfo['usertype'])); $userinfo['additional_info'] = $userinfo; cw_user_update(cw_addslashes($userinfo), $userinfo['customer_id'], $customer_id); } $userinfo_fields = array('customer_id', 'membership_id', 'company', 'email', 'tax_number', 'tax_exempt', 'ssn', 'company_type', 'usertype'); // Real e-mail for anonymous buyer that will be placed in order $userinfo['email'] = cw_real_mail_address($userinfo['email']); # kornev, 'company_id' ? cw_array2update('docs_user_info', cw_addslashes($userinfo), "doc_info_id='{$doc_info_id}'", $userinfo_fields); }
# kornev, simple subscribers on the first step $tmp = cw_query("SELECT email FROM {$tables['newslist_subscription']} WHERE list_id='{$list_id}' ORDER BY email"); if (is_array($tmp)) { foreach ($tmp as $v) { if (!empty($v['email'])) { $recipients[] = $v['email']; } } } } } // Cleanup or translate anonymous emails foreach ($recipients as $k => $v) { if (cw_is_anonymous($v)) { if (defined('NEWS_SEND_TO_ANONYMOUS') && constant('NEWS_SEND_TO_ANONYMOUS')) { $recipients[$k] = cw_real_mail_address($v); } else { unset($recipients[$k]); } } } $recipients = array_unique($recipients); if (count($recipients) > 0) { cw_call('cw_spam', array($message, $recipients, $list_lng, $list_id)); if (!$do_not_update_status) { db_query("UPDATE {$tables['newsletter']} SET status = 'S', send_date = '" . time() . "' WHERE news_id = '{$message['news_id']}'"); } } if (!empty($limit) && count($recipients) > 0) { $news_send_data[$messageid]['lastpos'] += count($recipients); if ($news_send_data[$messageid]['lastpos'] >= $news_send_data[$messageid]['count']) {