function confirm() { $mail_addresses_query = xos_db_query("select s.subscriber_id, s.subscriber_email_address, c.customers_firstname, c.customers_lastname from " . TABLE_NEWSLETTER_SUBSCRIBERS . " s left join " . TABLE_CUSTOMERS . " c on s.customers_id = c.customers_id where s.newsletter_status = '1' " . ($this->language_id > 0 ? 'and s.subscriber_language_id = ' . $this->language_id : '') . " order by s.customers_id"); $count = 0; $costomers_array = array(); while ($mail_addresses = xos_db_fetch_array($mail_addresses_query)) { $count++; $costomers_array[] = array('id' => $mail_addresses['subscriber_id'], 'text' => '<' . $mail_addresses['subscriber_email_address'] . '> ' . $mail_addresses['customers_firstname'] . ' ' . $mail_addresses['customers_lastname']); } $cancel_button = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'document.write(\'<input type="button" value="' . BUTTON_CANCEL . '" style="width: 8em;" onclick="document.location=\\\'' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID']) . '\\\'" />\');' . "\n" . '/* ]]> */' . "\n" . '</script>'; $confirm_string = "\n" . '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'function mover(move) {' . "\n" . ' if (move == \'remove\') {' . "\n" . ' for (x=0; x<(document.notifications.costomers.length); x++) {' . "\n" . ' if (document.notifications.costomers.options[x].selected) {' . "\n" . ' with(document.notifications.elements[\'customers_chosen[]\']) {' . "\n" . ' options[options.length] = new Option(document.notifications.costomers.options[x].text,document.notifications.costomers.options[x].value);' . "\n" . ' }' . "\n" . ' document.notifications.costomers.options[x] = null;' . "\n" . ' x = -1;' . "\n" . ' }' . "\n" . ' }' . "\n" . ' }' . "\n" . ' if (move == \'add\') {' . "\n" . ' for (x=0; x<(document.notifications.elements[\'customers_chosen[]\'].length); x++) {' . "\n" . ' if (document.notifications.elements[\'customers_chosen[]\'].options[x].selected) {' . "\n" . ' with(document.notifications.costomers) {' . "\n" . ' options[options.length] = new Option(document.notifications.elements[\'customers_chosen[]\'].options[x].text,document.notifications.elements[\'customers_chosen[]\'].options[x].value);' . "\n" . ' }' . "\n" . ' document.notifications.elements[\'customers_chosen[]\'].options[x] = null;' . "\n" . ' x = -1;' . "\n" . ' }' . "\n" . ' }' . "\n" . ' }' . "\n" . ' return true;' . "\n" . '}' . "\n\n" . 'function selectAll(FormName, SelectBox) {' . "\n" . ' temp = "document." + FormName + ".elements[\'" + SelectBox + "\']";' . "\n" . ' Source = eval(temp);' . "\n\n" . ' for (x=0; x<(Source.length); x++) {' . "\n" . ' Source.options[x].selected = "true";' . "\n" . ' }' . "\n\n" . ' if (x<1) {' . "\n" . ' alert(\'' . JS_PLEASE_SELECT_CUSTOMERS . '\');' . "\n" . ' return false;' . "\n" . ' } else {' . "\n" . ' return true;' . "\n" . ' }' . "\n" . '}' . "\n" . '/* ]]> */' . "\n" . '</script>' . "\n"; $confirm_string .= '<table width="100%" border="0" cellspacing="0" cellpadding="2">' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td class="main"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $count) . '</b></td>' . "\n" . ' </tr>' . "\n" . ($count > 0 ? ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . ' <form name="notifications" action="' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send') . '" method="post" onsubmit="return selectAll(\'notifications\', \'customers_chosen[]\')"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('costomers', $costomers_array, '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' <td align="center" class="main"><input type="button" value="' . BUTTON_SELECT . '" style="width: 8em;" onclick="mover(\'remove\');" /><br /><br /><input type="button" value="' . htmlspecialchars(BUTTON_UNSELECT) . '" style="width: 8em;" onclick="mover(\'add\');" /><br /><br /><br /><br /><input type="submit" value="' . BUTTON_SEND . '" style="width: 8em;" /><br /><br />' . $cancel_button . '</td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('customers_chosen[]', array(), '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' </tr>' . "\n" . ' </table></form>' . ' </td>' . ' </tr>' . "\n" : ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . ' <form name="notifications" action="' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send') . '" method="post" onsubmit="return selectAll(\'notifications\', \'customers_chosen[]\')"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('costomers', $costomers_array, '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' <td align="center" class="main">' . $cancel_button . '</td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('customers_chosen[]', array(), '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' </tr>' . "\n" . ' </table></form>' . ' </td>' . ' </tr>' . "\n") . ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td class="main"><b>' . $this->title . '</b></td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n"; if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') { $confirm_string .= ' <tr class="dataHeadingRow">' . "\n" . ' <td class="dataHeadingContent" valign="top">' . TEXT_TEXT . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"><pre>' . wordwrap($this->content_text_plain, 100) . '</pre></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataHeadingRow">' . "\n" . ' <td class="dataHeadingContent" valign="top">' . TEXT_HTML . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . $this->content_text_htlm . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n"; } else { $confirm_string .= ' <tr class="dataHeadingRow">' . "\n" . ' <td class="dataHeadingContent" valign="top">' . TEXT_TEXT . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"><pre>' . wordwrap($this->content_text_plain, 100) . '</pre></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n"; } $confirm_string .= '</table>'; return $confirm_string; }
<?php $contents = array(); switch ($action) { case 'confirm': $heading_title = '' . xos_draw_separator('pixel_trans.gif', '11', '12') . ' <br /><b>' . TEXT_INFO_HEADING_DELETE_CUSTOMER . '</b>'; $form_tag = xos_draw_form('customers', FILENAME_CUSTOMERS, xos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=deleteconfirm'); $contents[] = array('text' => TEXT_DELETE_INTRO . '<br /><br /><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'); if (isset($cInfo->number_of_reviews) && $cInfo->number_of_reviews > 0) { $contents[] = array('text' => '<br />' . xos_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews)); } $contents[] = array('text' => '<br /><a href="" onclick="customers.submit(); return false" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_DELETE . ' "><span>' . BUTTON_TEXT_DELETE . '</span></a><a href="' . xos_href_link(FILENAME_CUSTOMERS, xos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id) . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_CANCEL . ' "><span>' . BUTTON_TEXT_CANCEL . '</span></a><br /> '); break; default: if (isset($cInfo) && is_object($cInfo)) { $heading_title = '' . xos_draw_separator('pixel_trans.gif', '11', '12') . ' <br /><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'; $contents[] = array('text' => '<a href="' . xos_href_link(FILENAME_CUSTOMERS, xos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_EDIT . ' "><span>' . BUTTON_TEXT_EDIT . '</span></a><a href="' . xos_href_link(FILENAME_CUSTOMERS, xos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=confirm') . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_DELETE . ' "><span>' . BUTTON_TEXT_DELETE . '</span></a><a href="' . xos_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id) . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_ORDERS . ' "><span>' . BUTTON_TEXT_ORDERS . '</span></a><a href="' . xos_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $cInfo->customers_email_address) . '" class="button-default" style="margin-right: 5px; float: left" title=" ' . BUTTON_TITLE_EMAIL . ' "><span>' . BUTTON_TEXT_EMAIL . '</span></a>'); $contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_CREATED . ' ' . xos_date_short($cInfo->date_account_created)); $contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . xos_date_short($cInfo->date_account_last_modified)); $contents[] = array('text' => '<br />' . TEXT_INFO_DATE_LAST_LOGON . ' ' . xos_date_short($cInfo->date_last_logon)); $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons); $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name); $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews); } break; } $smarty->assign(array('info_box_heading_title' => $heading_title, 'info_box_form_tag' => $form_tag, 'info_box_contents' => $contents)); $output_infobox_customers = $smarty->fetch(ADMIN_TPL . '/includes/boxes/infobox_customers.tpl'); $smarty->clearAssign(array('info_box_heading_title', 'info_box_form_tag', 'info_box_contents')); $smarty->assign('infobox_customers', $output_infobox_customers); return 'overwrite_all';
$country_query = xos_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $customers['entry_country_id'] . "'"); $country = xos_db_fetch_array($country_query); $reviews_query = xos_db_query("select count(*) as number_of_reviews from " . TABLE_REVIEWS . " where customers_id = '" . (int) $customers['customers_id'] . "'"); $reviews = xos_db_fetch_array($reviews_query); $customer_info = array_merge((array) $country, (array) $info, (array) $reviews); $cInfo_array = array_merge((array) $customers, (array) $customer_info); $cInfo = new objectInfo($cInfo_array); } $selected = false; if (isset($cInfo) && is_object($cInfo) && $customers['customers_id'] == $cInfo->customers_id) { $selected = true; $link_filename_customers = xos_href_link(FILENAME_CUSTOMERS, xos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit'); } else { $link_filename_customers = xos_href_link(FILENAME_CUSTOMERS, xos_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']); } $customers_array[] = array('selected' => $selected, 'link_filename_customers' => $link_filename_customers, 'company' => strlen($customers['entry_company']) > 16 ? "<acronym title=\"" . $customers['entry_company'] . "\">" . substr($customers['entry_company'], 0, 16) . " </acronym>" : $customers['entry_company'], 'lastname' => strlen($customers['customers_lastname']) > 15 ? "<acronym title=\"" . $customers['customers_lastname'] . "\">" . substr($customers['customers_lastname'], 0, 15) . " </acronym>" : $customers['customers_lastname'], 'firstname' => strlen($customers['customers_firstname']) > 15 ? "<acronym title=\"" . $customers['customers_firstname'] . "\">" . substr($customers['customers_firstname'], 0, 15) . " </acronym>" : $customers['customers_firstname'], 'group_name' => strlen($customers['customers_group_name']) > 17 ? "<acronym title=\"" . $customers['customers_group_name'] . "\"> " . substr($customers['customers_group_name'], 0, 17) . " </acronym>" : $customers['customers_group_name'], 'date_account_created' => xos_date_short($info['date_account_created']), 'group_ra_status_image' => $customers['customers_group_ra'] == '1' ? xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red.gif', ICON_TITLE_STATUS_GREEN) : xos_draw_separator('pixel_trans.gif', '10', '10')); } $smarty->assign(array('link_self_company_sort_asc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=company'), 'link_self_lastname_sort_asc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=lastname'), 'link_self_firstname_sort_asc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=firstname'), 'link_self_cg_name_sort_asc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=cg_name'), 'link_self_id_sort_asc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=id-asc'), 'link_self_ra_sort_asc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=ra'), 'link_self_company_sort_desc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=company-desc'), 'link_self_lastname_sort_desc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=lastname-desc'), 'link_self_firstname_sort_desc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=firstname-desc'), 'link_self_cg_name_sort_desc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=cg_name-desc'), 'link_self_id_sort_desc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=id-desc'), 'link_self_ra_sort_desc' => xos_href_link(FILENAME_CUSTOMERS, 'listing=ra-desc'), 'text_company_sort_asc' => ICON_TITLE_IC_UP_TEXT_SORT . ' ' . ENTRY_COMPANY . ' ' . ICON_TITLE_IC_UP_TEXT_FROM_TOP_ABC, 'text_lastname_sort_asc' => ICON_TITLE_IC_UP_TEXT_SORT . ' ' . TABLE_HEADING_LASTNAME . ' ' . ICON_TITLE_IC_UP_TEXT_FROM_TOP_ABC, 'text_firstname_sort_asc' => ICON_TITLE_IC_UP_TEXT_SORT . ' ' . TABLE_HEADING_FIRSTNAME . ' ' . ICON_TITLE_IC_UP_TEXT_FROM_TOP_ABC, 'text_cg_name_sort_asc' => ICON_TITLE_IC_UP_TEXT_SORT . ' ' . TABLE_HEADING_CUSTOMERS_GROUPS . ' ' . ICON_TITLE_IC_UP_TEXT_FROM_TOP_ABC, 'text_id_sort_asc' => ICON_TITLE_IC_UP_TEXT_SORT . ' ' . TABLE_HEADING_ACCOUNT_CREATED . ' ' . ICON_TITLE_IC_UP_TEXT_FROM_TOP_ABC, 'text_ra_sort_asc' => ICON_TITLE_IC_UP_TEXT_SORT . ' ' . TABLE_HEADING_REQUEST_AUTHENTICATION . ' ' . ICON_TITLE_IC_UP_TEXT_FROM_TOP_ABC, 'text_company_sort_desc' => ICON_TITLE_IC_DOWN_TEXT_SORT . ' ' . ENTRY_COMPANY . ' ' . ICON_TITLE_IC_DOWN_TEXT_FROM_TOP_ZYX, 'text_lastname_sort_desc' => ICON_TITLE_IC_DOWN_TEXT_SORT . ' ' . TABLE_HEADING_LASTNAME . ' ' . ICON_TITLE_IC_DOWN_TEXT_FROM_TOP_ZYX, 'text_firstname_sort_desc' => ICON_TITLE_IC_DOWN_TEXT_SORT . ' ' . TABLE_HEADING_FIRSTNAME . ' ' . ICON_TITLE_IC_DOWN_TEXT_FROM_TOP_ZYX, 'text_cg_name_sort_desc' => ICON_TITLE_IC_DOWN_TEXT_SORT . ' ' . TABLE_HEADING_CUSTOMERS_GROUPS . ' ' . ICON_TITLE_IC_DOWN_TEXT_FROM_TOP_ZYX, 'text_id_sort_desc' => ICON_TITLE_IC_DOWN_TEXT_SORT . ' ' . TABLE_HEADING_ACCOUNT_CREATED . ' ' . ICON_TITLE_IC_DOWN_TEXT_FROM_TOP_ZYX, 'text_ra_sort_desc' => ICON_TITLE_IC_DOWN_TEXT_SORT . ' ' . TABLE_HEADING_REQUEST_AUTHENTICATION . ' ' . ICON_TITLE_IC_DOWN_TEXT_FROM_TOP_ZYX)); if (SESSID) { $smarty->assign('hidden_field_session', xos_draw_hidden_field(xos_session_name(), xos_session_id())); } $smarty->assign(array('form_begin_search' => xos_draw_form('search', FILENAME_CUSTOMERS, '', 'get'), 'input_search' => xos_draw_input_field('search'), 'form_end' => '</form>', 'customers' => $customers_array, 'nav_bar_number' => $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS), 'nav_bar_result' => $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], xos_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))))); if (isset($_GET['search']) && xos_not_null($_GET['search'])) { $smarty->assign('link_filename_customers_reset', xos_href_link(FILENAME_CUSTOMERS)); } require DIR_WS_BOXES . 'infobox_customers.php'; } $smarty->assign('BODY_TAG_PARAMS', 'onload="SetFocus();"'); $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'customers'); $output_customers = $smarty->fetch(ADMIN_TPL . '/customers.tpl'); $smarty->assign('central_contents', $output_customers);
if ($start_group_id !== false) { session_decode($session_data_group_id); } if ($start_group_show_tax !== false) { session_decode($session_data_group_show_tax); } if ($start_group_tax_exempt !== false) { session_decode($session_data_group_tax_exempt); } if (is_object($_SESSION['cart'])) { $products = $_SESSION['cart']->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $i++) { $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']); } if (sizeof($products) > 0) { $contents[] = array('text' => xos_draw_separator('pixel_black.gif', '100%', '1')); $contents[] = array('text' => '<div style="float: right">' . TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($_SESSION['cart']->show_total($currencies->currencies[$_SESSION['currency']]['value']), 1, $_SESSION['currency']) . '</div>'); } else { $contents[] = array('text' => ' '); } } } unset($_SESSION['customer_id']); unset($_SESSION['cart']); unset($_SESSION['currency']); unset($_SESSION['costom_lang_id']); unset($_SESSION['billto']); unset($_SESSION['sendto']); unset($_SESSION['customer_country_id']); unset($_SESSION['customer_zone_id']); unset($_SESSION['sppc_customer_group_id']);
function confirm() { $audience = array(); if (isset($_GET['global']) && $_GET['global'] == 'true') { $products_query = xos_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 " . ($this->language_id > 0 ? 'and c.customers_language_id = ' . $this->language_id : '') . ""); while ($products = xos_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 = xos_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' " . ($this->language_id > 0 ? 'and c.customers_language_id = ' . $this->language_id : '') . ""); while ($customers = xos_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 = xos_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 " . ($this->language_id > 0 ? 'and c.customers_language_id = ' . $this->language_id : '') . " and pn.products_id in (" . $ids . ")"); while ($products = xos_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 = xos_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' " . ($this->language_id > 0 ? 'and c.customers_language_id = ' . $this->language_id : '') . ""); while ($customers = xos_db_fetch_array($customers_query)) { $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']); } } $count = 0; $costomers_array = array(); reset($audience); while (list($key, $value) = each($audience)) { $count++; $costomers_array[] = array('id' => $key, 'text' => $value['firstname'] . ' ' . $value['lastname'] . ' <' . $value['email_address'] . '>'); } $cancel_button = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'document.write(\'<input type="button" value="' . BUTTON_CANCEL . '" style="width: 8em;" onclick="document.location=\\\'' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID']) . '\\\'" />\');' . "\n" . '/* ]]> */' . "\n" . '</script>'; $return_button = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'document.write(\'<input type="button" value="' . BUTTON_BACK . '" style="width: 8em;" onclick="document.location=\\\'' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID']) . '&action=send \\\'" />\');' . "\n" . '/* ]]> */' . "\n" . '</script>'; $confirm_string = "\n" . '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'function mover(move) {' . "\n" . ' if (move == \'remove\') {' . "\n" . ' for (x=0; x<(document.notifications.costomers.length); x++) {' . "\n" . ' if (document.notifications.costomers.options[x].selected) {' . "\n" . ' with(document.notifications.elements[\'customers_chosen[]\']) {' . "\n" . ' options[options.length] = new Option(document.notifications.costomers.options[x].text,document.notifications.costomers.options[x].value);' . "\n" . ' }' . "\n" . ' document.notifications.costomers.options[x] = null;' . "\n" . ' x = -1;' . "\n" . ' }' . "\n" . ' }' . "\n" . ' }' . "\n" . ' if (move == \'add\') {' . "\n" . ' for (x=0; x<(document.notifications.elements[\'customers_chosen[]\'].length); x++) {' . "\n" . ' if (document.notifications.elements[\'customers_chosen[]\'].options[x].selected) {' . "\n" . ' with(document.notifications.costomers) {' . "\n" . ' options[options.length] = new Option(document.notifications.elements[\'customers_chosen[]\'].options[x].text,document.notifications.elements[\'customers_chosen[]\'].options[x].value);' . "\n" . ' }' . "\n" . ' document.notifications.elements[\'customers_chosen[]\'].options[x] = null;' . "\n" . ' x = -1;' . "\n" . ' }' . "\n" . ' }' . "\n" . ' }' . "\n" . ' return true;' . "\n" . '}' . "\n\n" . 'function selectAll(FormName, SelectBox) {' . "\n" . ' temp = "document." + FormName + ".elements[\'" + SelectBox + "\']";' . "\n" . ' Source = eval(temp);' . "\n\n" . ' for (x=0; x<(Source.length); x++) {' . "\n" . ' Source.options[x].selected = "true";' . "\n" . ' }' . "\n\n" . ' if (x<1) {' . "\n" . ' alert(\'' . JS_PLEASE_SELECT_CUSTOMERS . '\');' . "\n" . ' return false;' . "\n" . ' } else {' . "\n" . ' return true;' . "\n" . ' }' . "\n" . '}' . "\n" . '/* ]]> */' . "\n" . '</script>' . "\n"; $confirm_string .= '<table width="100%" border="0" cellspacing="0" cellpadding="2">' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td class="main"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $count) . '</b></td>' . "\n" . ' </tr>' . "\n" . ($count > 0 ? ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . ' <form name="notifications" action="' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send') . '" method="post" onsubmit="return selectAll(\'notifications\', \'customers_chosen[]\')"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('costomers', $costomers_array, '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' <td align="center" class="main"><input type="button" value="' . BUTTON_SELECT . '" style="width: 8em;" onclick="mover(\'remove\');" /><br /><br /><input type="button" value="' . htmlspecialchars(BUTTON_UNSELECT) . '" style="width: 8em;" onclick="mover(\'add\');" /><br /><br /><br /><br /><input type="submit" value="' . BUTTON_SEND . '" style="width: 8em;" /><br /><br />' . $return_button . '<br /><br />' . $cancel_button . '</td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('customers_chosen[]', array(), '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' </tr>' . "\n" . ' </table></form>' . ' </td>' . ' </tr>' . "\n" : ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . ' <form name="notifications" action="' . xos_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send') . '" method="post" onsubmit="return selectAll(\'notifications\', \'customers_chosen[]\')"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('costomers', $costomers_array, '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' <td align="center" class="main">' . $return_button . '<br /><br />' . $cancel_button . '</td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_CUSTOMERS . '</b><br />' . xos_draw_pull_down_menu('customers_chosen[]', array(), '', 'size="30" style="width: 30em; font-size:9px" multiple="multiple"') . '</td>' . "\n" . ' </tr>' . "\n" . ' </table></form>' . ' </td>' . ' </tr>' . "\n") . ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td class="main"><b>' . $this->title . '</b></td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n"; if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') { $confirm_string .= ' <tr class="dataHeadingRow">' . "\n" . ' <td class="dataHeadingContent" valign="top">' . TEXT_TEXT . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"><pre>' . wordwrap($this->content_text_plain, 100) . '</pre></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataTableRow">' . "\n" . ' <td>' . xos_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="dataHeadingRow">' . "\n" . ' <td class="dataHeadingContent" valign="top">' . TEXT_HTML . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . $this->content_text_htlm . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n"; } else { $confirm_string .= ' <tr class="dataHeadingRow">' . "\n" . ' <td class="dataHeadingContent" valign="top">' . TEXT_TEXT . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"><pre>' . wordwrap($this->content_text_plain, 100) . '</pre></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . xos_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n" . ' </tr>' . "\n"; } $confirm_string .= '</table>'; return $confirm_string; }