[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/modules/newsletters/ -> affiliate_newsletter.php (source)

   1  <?php
   2  /*

   3    $Id: affiliate_newsletter.php,v 2.00 2003/10/12

   4  

   5    OSC-Affiliate

   6  

   7    Contribution based on:

   8  

   9    osCommerce, Open Source E-Commerce Solutions

  10    http://www.oscommerce.com

  11  

  12    Copyright (c) 2002 - 2003 osCommerce

  13  

  14    Released under the GNU General Public License

  15  */
  16  
  17    class affiliate_newsletter {
  18      var $show_choose_audience, $title, $content;
  19  
  20      function affiliate_newsletter($title, $content) {
  21        $this->show_choose_audience = false;
  22        $this->title = $title;
  23        $this->content = $content;
  24      }
  25  
  26      function choose_audience() {
  27        return false;
  28      }
  29  
  30      function confirm() {
  31        global $HTTP_GET_VARS;
  32  
  33        $mail_query = tep_db_query("select count(*) as count from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");
  34        $mail = tep_db_fetch_array($mail_query);
  35  
  36        $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
  37                          '  <tr>' . "\n" .
  38                          '    <td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_AFFILIATES, $mail['count']) . '</b></font></td>' . "\n" .
  39                          '  </tr>' . "\n" .
  40                          '  <tr>' . "\n" .
  41                          '    <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
  42                          '  </tr>' . "\n" .
  43                          '  <tr>' . "\n" .
  44                          '    <td class="main"><b>' . $this->title . '</b></td>' . "\n" .
  45                          '  </tr>' . "\n" .
  46                          '  <tr>' . "\n" .
  47                          '    <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
  48                          '  </tr>' . "\n" .
  49                          '  <tr>' . "\n" .
  50                          '    <td class="main"><tt>' . nl2br($this->content) . '</tt></td>' . "\n" .
  51                          '  </tr>' . "\n" .
  52                          '  <tr>' . "\n" .
  53                          '    <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
  54                          '  </tr>' . "\n" .
  55                          '  <tr>' . "\n" .
  56                          '    <td align="right"><a href="' . tep_href_link(FILENAME_AFFILIATE_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
  57                          '  </tr>' . "\n" .
  58                          '</table>';
  59  
  60        return $confirm_string;
  61      }
  62  
  63      function send($affiliate_newsletter_id) {
  64        $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");
  65  
  66        $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  67        $mimemessage->add_text($this->content);
  68        $mimemessage->build_message();
  69        while ($mail = tep_db_fetch_array($mail_query)) {
  70          $mimemessage->send($mail['affiliate_firstname'] . ' ' . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', EMAIL_FROM, $this->title);
  71        }
  72  
  73        $affiliate_newsletter_id = tep_db_prepare_input($affiliate_newsletter_id);
  74        tep_db_query("update " . TABLE_AFFILIATE_NEWSLETTERS . " set date_sent = now(), status = '1' where affiliate_newsletters_id = '" . tep_db_input($affiliate_newsletter_id) . "'");
  75      }
  76    }
  77  ?>


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