[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

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

   1  <?php
   2  /*

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

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax2005 osCMax, 2002 osCommerce

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    class newsletter {
  14      var $show_choose_audience, $title, $content;
  15  
  16      function newsletter($title, $content) {
  17        $this->show_choose_audience = false;
  18        $this->title = $title;
  19        $this->content = $content;
  20      }
  21  
  22      function choose_audience() {
  23        return false;
  24      }
  25  
  26      function confirm() {
  27        global $HTTP_GET_VARS;
  28  
  29        $mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
  30        $mail = tep_db_fetch_array($mail_query);
  31  
  32        $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
  33                          '  <tr>' . "\n" .
  34                          '    <td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</b></font></td>' . "\n" .
  35                          '  </tr>' . "\n" .
  36                          '  <tr>' . "\n" .
  37                          '    <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
  38                          '  </tr>' . "\n" .
  39                          '  <tr>' . "\n" .
  40                          '    <td class="main"><b>' . $this->title . '</b></td>' . "\n" .
  41                          '  </tr>' . "\n" .
  42                          '  <tr>' . "\n" .
  43                          '    <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
  44                          '  </tr>' . "\n" .
  45                          '  <tr>' . "\n" .
  46                          '    <td class="main"><tt>' . nl2br($this->content) . '</tt></td>' . "\n" .
  47                          '  </tr>' . "\n" .
  48                          '  <tr>' . "\n" .
  49                          '    <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
  50                          '  </tr>' . "\n" .
  51                          '  <tr>' . "\n" .
  52                          '    <td align="right"><a href="' . tep_href_link(FILENAME_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_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
  53                          '  </tr>' . "\n" .
  54                          '</table>';
  55  
  56        return $confirm_string;
  57      }
  58  
  59      function send($newsletter_id) {
  60        $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
  61  
  62        $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  63  
  64  // BOF: MOD - WYSIWYG HTML Area (Send TEXT Newsletter v1.7 when WYSIWYG Disabled)

  65        if (HTML_AREA_WYSIWYG_DISABLE_NEWSLETTER == 'Disable') {
  66        $mimemessage->add_text($this->content); // orginal OSC line

  67        } else {
  68        $mimemessage->add_html($this->content);
  69        }
  70  // EOF: MOD - WYSIWYG HTML Area (Send TEXT Newsletter v1.7 when WYSIWYG Disabled)

  71        
  72        $mimemessage->build_message();
  73        while ($mail = tep_db_fetch_array($mail_query)) {
  74          $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
  75        }
  76  
  77        $newsletter_id = tep_db_prepare_input($newsletter_id);
  78        tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
  79      }
  80    }
  81  ?>


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