From 78a0f0a00650c9a5e3c4d4cadcacc409919067ea Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 26 Feb 2010 16:12:36 +0000 Subject: Add pressrelease module. Make lots of codesharing with the newsletter module. --- utils/modules/newsletter.php | 66 +++----------------------------------------- 1 file changed, 4 insertions(+), 62 deletions(-) (limited to 'utils/modules/newsletter.php') diff --git a/utils/modules/newsletter.php b/utils/modules/newsletter.php index ef172e0..5ca19bf 100644 --- a/utils/modules/newsletter.php +++ b/utils/modules/newsletter.php @@ -4,30 +4,10 @@ global $UTIL_DIR; include_once($UTIL_DIR . "/mail.php"); -class Mailinglist { +class Mailinglist extends _Mailinglist { private $file; - private $mailinglist = array(); - public $subj_prefix; - public $sender; - public $replyto; - public $footer; public $unsubscribe_url; - public function add($email) { - $key = $email->email; - if(array_key_exists($key, $this->mailinglist)) return false; - $this->mailinglist[$key] = $email; - return true; - } - - public function remove($email) { - if(array_key_exists($email, $this->mailinglist)) { - unset($this->mailinglist[$email]); - return true; - } - return false; - } - public function write() { $fp = fopen($this->file, "w"); @@ -103,6 +83,9 @@ class Mailinglist { return $str; } + /** + * Overrides the postSingle method in the _Mailinglist class. + */ public function postSingle($email, $subject, $message) { $subject = "[".$this->subj_prefix."] " . $subject; @@ -114,47 +97,6 @@ class Mailinglist { $email->send($subject, $message, $this->sender, $this->replyto); } - public function post($subject, $message) - { - $subject = "[".$this->subject_prefix."] " . $subject; - - $message .= "\n\n".$this->footer; - $message .= "\n\nTo stop receiving this newsletter, click the following link: ". - $this->unsubscribe_url."&action=unsubscribe&email=". $this->email . "\n"; - - - $sz = sizeof($this->mailinglist); - - echo "
Sending ". $sz ." mails
\n<"; - ob_flush(); - flush(); - - $num = 0; - $lvl = 0; - $steps = floor($sz / 10) + 1; - - foreach($this->mailinglist as $email) { - - $this->postSingle($email, $ubject, $message); - - $pct = $num / $sz * 100; - if($pct >= $lvl) { - printf("%.0f%%", $lvl); - $lvl += 100/$steps; - } else { - echo "."; - } - ob_flush(); - flush(); - $num++; - } - echo "[100%]>\n
done
\n"; - echo "[CLOSE]"; - echo "
\n"; - ob_flush(); - flush(); - } - public function Mailinglist($file) { $this->file = $file; -- cgit v1.2.3