[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: mail.php,v 1.31 2003/06/20 00:37:51 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 require ('includes/application_top.php'); 14 15 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); 16 17 if ( ($action == 'send_email_to_user') && isset($HTTP_POST_VARS['customers_email_address']) && !isset($HTTP_POST_VARS['back_x']) ) { 18 switch ($HTTP_POST_VARS['customers_email_address']) { 19 case '***': 20 $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS); 21 $mail_sent_to = TEXT_ALL_CUSTOMERS; 22 break; 23 case '**D': 24 $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); 25 $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS; 26 break; 27 default: 28 $customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']); 29 30 $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "'"); 31 $mail_sent_to = $HTTP_POST_VARS['customers_email_address']; 32 break; 33 } 34 35 $from = tep_db_prepare_input($HTTP_POST_VARS['from']); 36 $subject = tep_db_prepare_input($HTTP_POST_VARS['subject']); 37 $message = tep_db_prepare_input($HTTP_POST_VARS['message']); 38 39 //Let's build a message object using the email class 40 $mimemessage = new email(array('X-Mailer: osCommerce')); 41 // add the message to the object 42 $mimemessage->add_text($message); 43 $mimemessage->build_message(); 44 while ($mail = tep_db_fetch_array($mail_query)) { 45 $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject); 46 } 47 48 tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to))); 49 } 50 51 if ( ($action == 'preview') && !isset($HTTP_POST_VARS['customers_email_address']) ) { 52 $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); 53 } 54 55 if (isset($HTTP_GET_VARS['mail_sent_to'])) { 56 $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $HTTP_GET_VARS['mail_sent_to']), 'success'); 57 } 58 ?> 59 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 60 <html <?php echo HTML_PARAMS; ?>> 61 <head> 62 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 63 <title><?php echo TITLE; ?></title> 64 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 65 </head> 66 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 67 <!-- header //--> 68 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 69 <!-- header_eof //--> 70 71 <!-- body //--> 72 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 73 <tr> 74 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 75 <!-- left_navigation //--> 76 <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> 77 <!-- left_navigation_eof //--> 78 </table></td> 79 <!-- body_text //--> 80 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 81 <tr> 82 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 83 <tr> 84 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 85 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 86 </tr> 87 </table></td> 88 </tr> 89 <tr> 90 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 91 <?php 92 if ( ($action == 'preview') && isset($HTTP_POST_VARS['customers_email_address']) ) { 93 switch ($HTTP_POST_VARS['customers_email_address']) { 94 case '***': 95 $mail_sent_to = TEXT_ALL_CUSTOMERS; 96 break; 97 case '**D': 98 $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS; 99 break; 100 default: 101 $mail_sent_to = $HTTP_POST_VARS['customers_email_address']; 102 break; 103 } 104 ?> 105 <tr><?php echo tep_draw_form('mail', FILENAME_MAIL, 'action=send_email_to_user'); ?> 106 <td><table border="0" width="100%" cellpadding="0" cellspacing="2"> 107 <tr> 108 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 109 </tr> 110 <tr> 111 <td class="smallText"><b><?php echo TEXT_CUSTOMER; ?></b><br><?php echo $mail_sent_to; ?></td> 112 </tr> 113 <tr> 114 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 115 </tr> 116 <tr> 117 <td class="smallText"><b><?php echo TEXT_FROM; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td> 118 </tr> 119 <tr> 120 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 121 </tr> 122 <tr> 123 <td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td> 124 </tr> 125 <tr> 126 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 127 </tr> 128 <tr> 129 <td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td> 130 </tr> 131 <tr> 132 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 133 </tr> 134 <tr> 135 <td> 136 <?php 137 /* Re-Post all POST'ed variables */ 138 reset($HTTP_POST_VARS); 139 while (list($key, $value) = each($HTTP_POST_VARS)) { 140 if (!is_array($HTTP_POST_VARS[$key])) { 141 echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value))); 142 } 143 } 144 ?> 145 <table border="0" width="100%" cellpadding="0" cellspacing="2"> 146 <tr> 147 <td><?php echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="back"'); ?></td> 148 <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_MAIL) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a> ' . tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td> 149 </tr> 150 </table></td> 151 </tr> 152 </table></td> 153 </form></tr> 154 <?php 155 } else { 156 ?> 157 <tr><?php echo tep_draw_form('mail', FILENAME_MAIL, 'action=preview'); ?> 158 <td><table border="0" cellpadding="0" cellspacing="2"> 159 <tr> 160 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 161 </tr> 162 <?php 163 $customers = array(); 164 $customers[] = array('id' => '', 'text' => TEXT_SELECT_CUSTOMER); 165 $customers[] = array('id' => '***', 'text' => TEXT_ALL_CUSTOMERS); 166 $customers[] = array('id' => '**D', 'text' => TEXT_NEWSLETTER_CUSTOMERS); 167 $mail_query = tep_db_query("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " order by customers_lastname"); 168 while($customers_values = tep_db_fetch_array($mail_query)) { 169 $customers[] = array('id' => $customers_values['customers_email_address'], 170 'text' => $customers_values['customers_lastname'] . ', ' . $customers_values['customers_firstname'] . ' (' . $customers_values['customers_email_address'] . ')'); 171 } 172 ?> 173 <tr> 174 <td class="main"><?php echo TEXT_CUSTOMER; ?></td> 175 <td><?php echo tep_draw_pull_down_menu('customers_email_address', $customers, (isset($HTTP_GET_VARS['customer']) ? $HTTP_GET_VARS['customer'] : ''));?></td> 176 </tr> 177 <tr> 178 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 179 </tr> 180 <tr> 181 <td class="main"><?php echo TEXT_FROM; ?></td> 182 <td><?php echo tep_draw_input_field('from', EMAIL_FROM); ?></td> 183 </tr> 184 <tr> 185 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 186 </tr> 187 <tr> 188 <td class="main"><?php echo TEXT_SUBJECT; ?></td> 189 <td><?php echo tep_draw_input_field('subject'); ?></td> 190 </tr> 191 <tr> 192 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 193 </tr> 194 <tr> 195 <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?></td> 196 <td><?php echo tep_draw_textarea_field('message', 'soft', '60', '15'); ?></td> 197 </tr> 198 <tr> 199 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 200 </tr> 201 <tr> 202 <td colspan="2" align="right"><?php echo tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td> 203 </tr> 204 </table></td> 205 </form></tr> 206 <?php 207 } 208 ?> 209 <!-- body_text_eof //--> 210 </table></td> 211 </tr> 212 </table></td> 213 </tr> 214 </table> 215 <!-- body_eof //--> 216 217 <!-- footer //--> 218 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 219 <!-- footer_eof //--> 220 <br> 221 </body> 222 </html> 223 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |