[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> affiliate_contact.php (source)

   1  <?php
   2  /*

   3  $Id: affiliate_contact.php 14 2006-07-28 17:42:07Z user $

   4  

   5    OSC-Affiliate

   6  

   7    Contribution based on:

   8  

   9    osCMax Power E-Commerce

  10    http://oscdox.com

  11  

  12    Copyright 2006 osCMax

  13  

  14    Released under the GNU General Public License

  15  */
  16  
  17    require ('includes/application_top.php');
  18  //LINE ADDED

  19    require (DIR_FCKEDITOR . 'fckeditor.php');
  20    if ( ($HTTP_GET_VARS['action'] == 'send_email_to_user') && ($HTTP_POST_VARS['affiliate_email_address']) && (!$HTTP_POST_VARS['back_x']) ) {
  21      switch ($HTTP_POST_VARS['affiliate_email_address']) {
  22        case '***':
  23          $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " ");
  24          $mail_sent_to = TEXT_ALL_AFFILIATES;
  25          break;
  26  //      case '**D':

  27  //        $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");

  28  //        $mail_sent_to = TEXT_NEWSLETTER_AFFILIATE;

  29  //        break;

  30        default:
  31          $affiliate_email_address = tep_db_prepare_input($HTTP_POST_VARS['affiliate_email_address']);
  32  
  33          $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_email_address = '" . tep_db_input($affiliate_email_address) . "'");
  34          $mail_sent_to = $HTTP_POST_VARS['affiliate_email_address'];
  35          break;
  36      }
  37  
  38      $from = tep_db_prepare_input($HTTP_POST_VARS['from']);
  39      $subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
  40      $message = tep_db_prepare_input($HTTP_POST_VARS['message']);
  41  
  42      // Instantiate a new mail object

  43      $mimemessage = new email(array('X-Mailer: osCMax v2'));
  44  
  45      // Build the text version

  46      $text = strip_tags($text);
  47      if (EMAIL_USE_HTML == 'true') {
  48        $mimemessage->add_html($message);
  49      } else {
  50        $mimemessage->add_text($message);
  51      }
  52  
  53      // Send message

  54      $mimemessage->build_message();
  55      while ($mail = tep_db_fetch_array($mail_query)) {
  56        $mimemessage->send($mail['affiliate_firstname'] . ' ' . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', $from, $subject);
  57      }
  58  
  59      tep_redirect(tep_href_link(FILENAME_AFFILIATE_CONTACT, 'mail_sent_to=' . urlencode($mail_sent_to)));
  60    }
  61  
  62    if ( ($HTTP_GET_VARS['action'] == 'preview') && (!$HTTP_POST_VARS['affiliate_email_address']) ) {
  63      $messageStack->add(ERROR_NO_AFFILIATE_SELECTED, 'error');
  64    }
  65  
  66    if (tep_not_null($HTTP_GET_VARS['mail_sent_to'])) {
  67      $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $HTTP_GET_VARS['mail_sent_to']), 'notice');
  68    }
  69  ?>
  70  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  71  <html <?php echo HTML_PARAMS; ?>>
  72  <head>
  73  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  74  <title><?php echo TITLE; ?></title>
  75  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  76  </head>
  77  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  78  <!-- header //-->
  79  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  80  <!-- header_eof //-->
  81  
  82  <!-- body //-->
  83  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  84    <tr>
  85      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  86  <!-- left_navigation //-->
  87  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  88  <!-- left_navigation_eof //-->
  89      </table></td>
  90  <!-- body_text //-->
  91      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  92        <tr>
  93          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  94            <tr>
  95              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  96              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  97            </tr>
  98          </table></td>
  99        </tr>
 100        <tr>
 101          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 102  <?php
 103    if ( ($HTTP_GET_VARS['action'] == 'preview') && ($HTTP_POST_VARS['affiliate_email_address']) ) {
 104      switch ($HTTP_POST_VARS['affiliate_email_address']) {
 105        case '***':
 106          $mail_sent_to = TEXT_ALL_AFFILIATES;
 107          break;
 108  //      case '**D':

 109  //        $mail_sent_to = TEXT_NEWSLETTER_AFFILIATES;

 110  //        break;

 111        default:
 112          $mail_sent_to = $HTTP_POST_VARS['affiliate_email_address'];
 113          break;
 114      }
 115  ?>
 116            <tr><?php echo tep_draw_form('mail', FILENAME_AFFILIATE_CONTACT, 'action=send_email_to_user'); ?>
 117              <td><table border="0" width="100%" cellpadding="0" cellspacing="2">
 118                <tr>
 119                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 120                </tr>
 121                <tr>
 122                  <td class="smallText"><b><?php echo TEXT_AFFILIATE; ?></b><br><?php echo $mail_sent_to; ?></td>
 123                </tr>
 124                <tr>
 125                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 126                </tr>
 127                <tr>
 128                  <td class="smallText"><b><?php echo TEXT_FROM; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td>
 129                </tr>
 130                <tr>
 131                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 132                </tr>
 133                <tr>
 134                  <td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
 135                </tr>
 136                <tr>
 137                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 138                </tr>
 139                <tr>
 140                  <td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
 141                </tr>
 142                <tr>
 143                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 144                </tr>
 145                <tr>
 146                  <td>
 147  <?php
 148  /* Re-Post all POST'ed variables */

 149      reset($HTTP_POST_VARS);
 150      while (list($key, $value) = each($HTTP_POST_VARS)) {
 151        if (!is_array($HTTP_POST_VARS[$key])) {
 152          echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
 153        }
 154      }
 155  ?>
 156                  <table border="0" width="100%" cellpadding="0" cellspacing="2">
 157                    <tr>
 158                      <td><?php echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="back"'); ?></td>
 159                      <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_CONTACT) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a> ' . tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td>
 160                    </tr>
 161                  </table></td>
 162                </tr>
 163              </table></td>
 164            </form></tr>
 165  <?php
 166    } else {
 167  ?>
 168            <tr><?php echo tep_draw_form('mail', FILENAME_AFFILIATE_CONTACT, 'action=preview'); ?>
 169              <td><table border="0" cellpadding="0" cellspacing="2">
 170                <tr>
 171                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 172                </tr>
 173  <?php
 174      $affiliate = array();
 175      $affiliate[] = array('id' => '', 'text' => TEXT_SELECT_AFFILIATE);
 176      $affiliate[] = array('id' => '***', 'text' => TEXT_ALL_AFFILIATES);
 177  //    $affiliate[] = array('id' => '**D', 'text' => TEXT_NEWSLETTER_AFFILIATES);

 178      $mail_query = tep_db_query("select affiliate_email_address, affiliate_firstname, affiliate_lastname from " . TABLE_AFFILIATE . " order by affiliate_lastname");
 179      while($affiliate_values = tep_db_fetch_array($mail_query)) {
 180        $affiliate[] = array('id' => $affiliate_values['affiliate_email_address'],
 181                             'text' => $affiliate_values['affiliate_lastname'] . ', ' . $affiliate_values['affiliate_firstname'] . ' (' . $affiliate_values['affiliate_email_address'] . ')');
 182      }
 183  ?>
 184                <tr>
 185                  <td class="main"><?php echo TEXT_AFFILIATE; ?></td>
 186                  <td><?php echo tep_draw_pull_down_menu('affiliate_email_address', $affiliate, $HTTP_GET_VARS['affiliate']);?></td>
 187                </tr>
 188                <tr>
 189                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 190                </tr>
 191                <tr>
 192                  <td class="main"><?php echo TEXT_FROM; ?></td>
 193                  <td><?php echo tep_draw_input_field('from', AFFILIATE_EMAIL_ADDRESS, 'size="60"'); ?></td>
 194                </tr>
 195                <tr>
 196                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 197                </tr>
 198                <tr>
 199                  <td class="main"><?php echo TEXT_SUBJECT; ?></td>
 200                  <td><?php echo tep_draw_input_field('subject', '', 'size="60"'); ?></td>
 201                </tr>
 202                <tr>
 203                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 204                </tr>
 205                <tr>
 206                  <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?></td>
 207  <?php /*old       echo tep_draw_textarea_field('message', 'soft', '60', '15');  */ ?>
 208                  <td><?php if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Enable') {
 209  // Line Changed - MOD: Ajustable Editor Window

 210                      echo (tep_draw_fckeditor('message', HTML_AREA_WYSIWYG_EDITOR_WIDTH, HTML_AREA_WYSIWYG_EDITOR_HEIGHT, '')) . '</td>';
 211                  } else {
 212                      echo (tep_draw_textarea_field('message', 'soft', '70', '15')) . '</td>';
 213                  }
 214                       ?>
 215                </tr>
 216                <tr>
 217                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 218                </tr>
 219                <tr>
 220                  <td colspan="2" align="right"><?php echo tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td>
 221                </tr>
 222              </table></td>
 223            </form></tr>
 224  <?php
 225    }
 226  ?>
 227  <!-- body_text_eof //-->
 228          </table></td>
 229        </tr>
 230      </table></td>
 231    </tr>
 232  </table>
 233  <!-- body_eof //-->
 234  
 235  <!-- footer //-->
 236  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 237  <!-- footer_eof //-->
 238  <br>
 239  </body>
 240  </html>
 241  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


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