[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

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

   1  <?php
   2  /*
   3    $Id: newsletter.php,v 1.1 2002/03/08 18:38:18 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 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        $mimemessage->add_text($this->content);
  64        $mimemessage->build_message();
  65        while ($mail = tep_db_fetch_array($mail_query)) {
  66          $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
  67        }
  68  
  69        $newsletter_id = tep_db_prepare_input($newsletter_id);
  70        tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
  71      }
  72    }
  73  ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics