[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> mail.php (source)

   1  <?php
   2  /*

   3  $Id: mail.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  // LINE ADDED: WYSIWYG FCKEditor

  15    require (DIR_FCKEDITOR . 'fckeditor.php');
  16    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  17  
  18    if ( ($action == 'send_email_to_user') && isset($HTTP_POST_VARS['customers_email_address']) && !isset($HTTP_POST_VARS['back_x']) ) {
  19      switch ($HTTP_POST_VARS['customers_email_address']) {
  20        case '***':
  21          $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS);
  22          $mail_sent_to = TEXT_ALL_CUSTOMERS;
  23          break;
  24        case '**D':
  25          $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
  26          $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;
  27          break;
  28        default:
  29          $customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);
  30  
  31          $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) . "'");
  32          $mail_sent_to = $HTTP_POST_VARS['customers_email_address'];
  33          break;
  34      }
  35  
  36      $from = tep_db_prepare_input($HTTP_POST_VARS['from']);
  37      $subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
  38      $message = tep_db_prepare_input($HTTP_POST_VARS['message']);
  39  
  40      //Let's build a message object using the email class

  41      $mimemessage = new email(array('X-Mailer: osCommerce'));
  42      // add the message to the object

  43      
  44  // BOF: MOD - WYSIWYG HTML Area (Send TEXT Email when WYSIWYG Disabled)

  45      if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Disable') {
  46      $mimemessage->add_text($message);
  47      } else {
  48      $mimemessage->add_html($message);
  49      }
  50  // EOF: MOD - WYSIWYG HTML Area (Send TEXT Email when WYSIWYG Disabled)

  51  
  52      $mimemessage->build_message();
  53      while ($mail = tep_db_fetch_array($mail_query)) {
  54        $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
  55      }
  56  
  57      tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
  58    }
  59  
  60    if ( ($action == 'preview') && !isset($HTTP_POST_VARS['customers_email_address']) ) {
  61      $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
  62    }
  63  
  64    if (isset($HTTP_GET_VARS['mail_sent_to'])) {
  65      $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $HTTP_GET_VARS['mail_sent_to']), 'success');
  66    }
  67  ?>
  68  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  69  <html <?php echo HTML_PARAMS; ?>>
  70  <head>
  71  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  72  <title><?php echo TITLE; ?></title>
  73  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  74  <script language="JavaScript">
  75  <!-- Begin
  76         function init() {
  77  define('customers_email_address', 'string', 'Customer or Newsletter Group');
  78  }
  79  //  End -->

  80  </script>
  81  </head>
  82  <body OnLoad="init()" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  83  <!-- header //-->
  84  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  85  <!-- header_eof //-->
  86  
  87  <!-- body //-->
  88  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  89    <tr>
  90      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  91  <!-- left_navigation //-->
  92  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  93  <!-- left_navigation_eof //-->
  94      </table></td>
  95  <!-- body_text //-->
  96      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  97        <tr>
  98          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  99            <tr>
 100              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 101              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 102            </tr>
 103          </table></td>
 104        </tr>
 105        <tr>
 106          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 107  <?php
 108    if ( ($action == 'preview') && isset($HTTP_POST_VARS['customers_email_address']) ) {
 109      switch ($HTTP_POST_VARS['customers_email_address']) {
 110        case '***':
 111          $mail_sent_to = TEXT_ALL_CUSTOMERS;
 112          break;
 113        case '**D':
 114          $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;
 115          break;
 116        default:
 117          $mail_sent_to = $HTTP_POST_VARS['customers_email_address'];
 118          break;
 119      }
 120  ?>
 121            <tr><?php echo tep_draw_form('mail', FILENAME_MAIL, 'action=send_email_to_user'); ?>
 122              <td><table border="0" width="100%" cellpadding="0" cellspacing="2">
 123                <tr>
 124                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 125                </tr>
 126                <tr>
 127                  <td class="smallText"><b><?php echo TEXT_CUSTOMER; ?></b><br><?php echo $mail_sent_to; ?></td>
 128                </tr>
 129                <tr>
 130                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 131                </tr>
 132                <tr>
 133                  <td class="smallText"><b><?php echo TEXT_FROM; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td>
 134                </tr>
 135                <tr>
 136                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 137                </tr>
 138                <tr>
 139                  <td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
 140                </tr>
 141                <tr>
 142                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 143                </tr>
 144                <tr>
 145                  <td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Enable') { echo (stripslashes($HTTP_POST_VARS['message'])); } else { echo htmlspecialchars(stripslashes($HTTP_POST_VARS['message'])); } ?></td>
 146                </tr>
 147                <tr>
 148                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 149                </tr>
 150                <tr>
 151                  <td>
 152  <?php
 153  /* Re-Post all POST'ed variables */

 154      reset($HTTP_POST_VARS);
 155      while (list($key, $value) = each($HTTP_POST_VARS)) {
 156        if (!is_array($HTTP_POST_VARS[$key])) {
 157          echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
 158        }
 159      }
 160  ?>
 161                      <tr>
 162                      <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>
 163                      </tr>
 164                      <td class="smallText">
 165                  <?php if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Disable'){echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="back"');
 166                  } ?><?php if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Disable') {echo(TEXT_EMAIL_BUTTON_HTML);
 167                   } else { echo(TEXT_EMAIL_BUTTON_TEXT); } ?>
 168                      </td>
 169                    </tr>
 170                  </table></td>
 171                </tr>
 172              </table></td>
 173            </form></tr>
 174  
 175  <?php
 176    } else {
 177  ?>
 178            <tr><?php echo tep_draw_form('mail', FILENAME_MAIL, 'action=preview'); ?>
 179              <td><table border="0" cellpadding="0" cellspacing="2">
 180                <tr>
 181                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 182                </tr>
 183  <?php
 184      $customers = array();
 185      $customers[] = array('id' => '', 'text' => TEXT_SELECT_CUSTOMER);
 186      $customers[] = array('id' => '***', 'text' => TEXT_ALL_CUSTOMERS);
 187      $customers[] = array('id' => '**D', 'text' => TEXT_NEWSLETTER_CUSTOMERS);
 188      $mail_query = tep_db_query("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " order by customers_lastname");
 189      while($customers_values = tep_db_fetch_array($mail_query)) {
 190        $customers[] = array('id' => $customers_values['customers_email_address'],
 191                             'text' => $customers_values['customers_lastname'] . ', ' . $customers_values['customers_firstname'] . ' (' . $customers_values['customers_email_address'] . ')');
 192      }
 193  ?>
 194                <tr>
 195                  <td class="main"><?php echo TEXT_CUSTOMER; ?></td>
 196                  <td><?php echo tep_draw_pull_down_menu('customers_email_address', $customers, (isset($HTTP_GET_VARS['customer']) ? $HTTP_GET_VARS['customer'] : ''));?></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 class="main"><?php echo TEXT_FROM; ?></td>
 203                  <td><?php echo tep_draw_input_field('from', EMAIL_FROM); ?></td>
 204                </tr>
 205                <tr>
 206                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 207                </tr>
 208                <tr>
 209                  <td class="main"><?php echo TEXT_SUBJECT; ?></td>
 210                  <td><?php echo tep_draw_input_field('subject'); ?></td>
 211                </tr>
 212                <tr>
 213                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 214                </tr>
 215                <tr>
 216                  <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?></td>
 217                  <td><?php if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Enable') {
 218  // Line Changed - MOD: Ajustable Editor Window

 219                      echo tep_draw_fckeditor('message', HTML_AREA_WYSIWYG_EDITOR_WIDTH, HTML_AREA_WYSIWYG_EDITOR_HEIGHT, ' ') .'</td>';
 220                  } else { echo tep_draw_textarea_field('message', 'soft', '60', '15') .'</td>';
 221                  }
 222                  ?>
 223                </tr>
 224                <tr>
 225                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 226                </tr>
 227                <tr>
 228                  <td colspan="2" align="right">
 229                   <?php if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Enable'){ echo tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL, 'onClick="validate();return returnVal;"');
 230                     } else {
 231                  echo tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); }?>
 232                  </td>
 233  
 234                </tr>
 235              </table></td>
 236            </form></tr>
 237  <?php
 238    }
 239  ?>
 240  <!-- body_text_eof //-->
 241          </table></td>
 242        </tr>
 243      </table></td>
 244    </tr>
 245  </table>
 246  <!-- body_eof //-->
 247  <!-- footer //-->
 248  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 249  <!-- footer_eof //-->
 250  <br>
 251  </body>
 252  </html>
 253  <?php require (DIR_WS_INCLUDES . 'application_bottom.php');
 254  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7