$top_message['content'] = cw_get_langvar_by_name("msg_adm_err_news_subscriber_add"); $top_message['type'] = "E"; } } elseif ($action == "delete" && is_array($to_delete)) { foreach ($to_delete as $email => $flag) { db_query("DELETE FROM {$tables['newslist_subscription']} WHERE list_id='{$list_id}' AND email='{$email}'"); } $top_message['content'] = cw_get_langvar_by_name("msg_adm_news_subscribers_del"); } elseif ($action == "import" && !empty($userfile)) { cw_load("mail"); $userfile = cw_move_uploaded_file("userfile"); $fp = cw_fopen($userfile, "r", true); if ($fp) { while ($line = fgets($fp, 255)) { $new_email = trim($line); if (!cw_check_email($new_email)) { continue; } $new_email = addslashes($new_email); $count = cw_query_first_cell("SELECT COUNT(*) FROM {$tables['newslist_subscription']} WHERE list_id='{$list_id}' AND email='{$new_email}'"); if ($count < 1) { db_query("INSERT INTO {$tables['newslist_subscription']} (list_id, email, since_date) VALUES ('{$list_id}','{$new_email}','" . time() . "')"); } } fclose($fp); $top_message['content'] = cw_get_langvar_by_name("msg_adm_news_subscribers_imp"); } @unlink($userfile); } elseif ($action == "export" && !empty($to_delete)) { header("Content-type: application/force-download"); header("Content-disposition: attachment; filename=subscribers.txt");
function cw_check_user_field_email($customer_id, $email, $sections, &$full) { return !cw_check_email($email); }
function cw_check_unique_email($email, $survey_id) { global $tables; cw_load("mail"); if (!cw_check_email($email)) { return false; } return cw_query_first_cell("SELECT COUNT(*) FROM {$tables['survey_maillist']} WHERE survey_id = '{$survey_id}' AND email = '{$email}'") == 0; }
<?php cw_load('mail'); if (empty($mode)) { if ($REQUEST_METHOD == "GET") { $mode = "archive"; } else { $mode = "view"; } } if ($REQUEST_METHOD == "POST") { $email = trim($newsemail); if (!cw_check_email($email)) { cw_add_top_message(cw_get_langvar_by_name("err_subscribe_email_invalid"), 'E'); cw_header_location("index.php?target=news"); } $c = cw_query_first_cell("\nSELECT COUNT(DISTINCT({$tables['newslists']}.list_id))\nFROM {$tables['newslists']}, {$tables['newslist_subscription']}\nWHERE\n{$tables['newslists']}.list_id={$tables['newslist_subscription']}.list_id AND\n{$tables['newslists']}.lngcode='{$subscribe_lng}' AND\n{$tables['newslist_subscription']}.email='{$email}'"); if ($c > 0) { cw_add_top_message(cw_get_langvar_by_name("err_subscribed_already"), 'W'); cw_header_location("index.php?target=news"); } if ($action == "subscribe") { if ($target_newslist_id) { $lists = cw_query("SELECT * FROM {$tables['newslists']} WHERE list_id='{$target_newslist_id}'"); } else { $lists = cw_query("SELECT * FROM {$tables['newslists']} WHERE avail=1 AND subscribe=1 AND lngcode='{$subscribe_lng}'"); } if (!is_array($lists) || empty($lists)) { $top_message['type'] = "W"; $top_message['content'] = cw_get_langvar_by_name('lbl_no_newslists_for_sbuscription'); cw_header_location("index.php?target=news");
function cw_ebay_check_fields($fields) { cw_load('mail'); $errors = array(); if (empty($fields['ebay_duration']) || !is_numeric($fields['ebay_duration']) || strlen($fields['ebay_duration']) > 3) { $errors[] = 'Error in field "Duration".'; } if (empty($fields['ebay_location']) || strlen($fields['ebay_location']) > 45) { $errors[] = 'Error in field "Location".'; } if ($fields['ebay_paypal_accepted'] == 'Y' && !cw_check_email($fields['ebay_paypal_email_address'])) { $errors[] = 'Error in field "PayPal Email address".'; } return $errors; }
$profile_fields = array('email' => array('avail' => 'Y', 'required' => 'Y'), 'subject' => array('avail' => 'Y', 'required' => 'Y'), 'body' => array('avail' => 'Y', 'required' => 'Y'), 'firstname' => array('avail' => 'Y'), 'lastname' => array('avail' => 'Y'), 'daytime_phone' => array('avail' => 'Y')); foreach ($profile_fields as $k => $v) { if ($k == "b_county" && $v['avail'] == 'Y' && ($v['required'] == 'Y' || !empty($contact['b_county']))) { if ($config['General']['use_counties'] != "Y") { continue; } if (!cw_check_county($contact[$k], stripslashes($contact['b_state']), $contact['b_country'])) { $fillerror = true; } } elseif ($k == "b_state" && $v['avail'] == 'Y' && ($v['required'] == 'Y' || !empty($contact['b_state']))) { $has_states = cw_query_first_cell("SELECT display_states FROM {$tables['map_countries']} WHERE code = '" . $contact['b_country'] . "'") == 'Y'; if (is_array($states) && $has_states && !cw_check_state($states, stripslashes($contact['b_state']), $contact['b_country'])) { $fillerror = true; } } elseif ($k == "email" && $v['avail'] == 'Y' && ($v['required'] == 'Y' || !empty($contact['email']))) { if (!cw_check_email($contact['email'])) { $fillerror = true; } } elseif (empty($contact[$k]) && $v['required'] == 'Y' && $v['avail'] == 'Y') { $fillerror = true; } } if (!$fillerror && is_array($additional_fields)) { foreach ($additional_fields as $k => $v) { $additional_fields[$k]['value'] = stripslashes($_POST['additional_values'][$v['field_id']]); if (empty($_POST['additional_values'][$v['field_id']]) && $v['required'] == 'Y' && $v['avail'] == 'Y') { $fillerror = true; } } } if (!$fillerror) {