newsletter.php

来自「全新且完善的强大网上商店系统」· PHP 代码 · 共 74 行

PHP
74
字号
<?php
/*
  [SOOBIC!] admin/modules/newsletters/newsletters.php 

	Version: 1.5
	Author: Soolan (soolan@qq.com)
	Copyright: soolan (www.soobic.com)

	Last Modified: 2005/4/16 10:00
  
*/

class newsletter {
    var $show_choose_audience, $title, $content;

    function newsletter($title, $content) {
      $this->show_choose_audience = false;
      $this->title = $title;
      $this->content = $content;
    }

    function choose_audience() {
      return false;
    }

    function confirm() {
      global $HTTP_GET_VARS,$db,$table_customers;

      $mail_query = $db->query("select count(*) as count from $table_customers where customers_newsletter = '1'");
      $mail = $db->fetch_array($mail_query);

      $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
                        '  <tr>' . "\n" .
                        '    <td ><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</b></font></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '  <tr>' . "\n" .
                         '    <td><br></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '  <tr>' . "\n" .
                        '    <td ><b>' . $this->title . '</b></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '  <tr>' . "\n" .
                        '    <td><br></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '  <tr>' . "\n" .
                        '    <td "><tt>' . nl2br($this->content) . '</tt></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '  <tr>' . "\n" .
                         '    <td><br></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '  <tr>' . "\n" .
                        '    <td align="right"><a href="' . tep_href_link('admincp.php', 'act=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('admincp.php', 'act=newsletters&page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
                        '  </tr>' . "\n" .
                        '</table>';

      return $confirm_string;
    }

    function send($newsletter_id) {
       global $db,$table_newsletters,$table_customers;
			 $mail_query = $db->query("select customers_firstname, customers_email_address from $table_customers where customers_newsletter = '1'");
       require($soobic.'includes/classes/mime.php');
       require($soobic.'includes/classes/email.php');
       $mimemessage = new email(array('X-Mailer: Soobic! bulk mailer'));
       $mimemessage->add_text($this->content);
       $mimemessage->build_message();
       while ($mail = $db->fetch_array($mail_query)) {
           $mimemessage->send($mail['customers_firstname'] , $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
       }
       $db->query("update $table_newsletters set date_sent = now(), status = '1' where newsletters_id = '" . $newsletter_id. "'");
    }
  }
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?