From 23026641de4ecfaa978485b1a6d808bd12f0e791 Mon Sep 17 00:00:00 2001 From: Christian Fowler Date: Tue, 20 Dec 2005 22:05:07 +0000 Subject: clean up sending so it acutally works now --- admin/send.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'admin') diff --git a/admin/send.php b/admin/send.php index d455a55..58dedcd 100644 --- a/admin/send.php +++ b/admin/send.php @@ -1,6 +1,6 @@ verifyPackage( 'newsletters' ); require_once( NEWSLETTERS_PKG_PATH.'lookup_newsletter_edition_inc.php' ); -if (isset($_REQUEST["template_id"]) && $_REQUEST["template_id"] > 0) { +$feedback = array(); + +if( @BitBase::verifyId( $_REQUEST["template_id"] ) ) { $template_data = $tikilib->get_template($_REQUEST["template_id"]); $_REQUEST['edit'] = $template_data["content"]; @@ -30,9 +31,15 @@ if( $gContent->isValid() && isset( $_REQUEST['preview'] ) ) { $recipients = $gContent->getRecipients( $_REQUEST['send_group'] ); $gBitSmarty->assign_by_ref( 'recipientList', $recipients ); } elseif( $gContent->isValid() && isset( $_REQUEST["send"] ) ) { - $emails = $gContent->getRecipients( $_REQUEST['send_group'] ); - $gContent->queueRecipients( $emails ); -die; + if( $emails = $gContent->getRecipients( $_REQUEST['send_group'] ) ) { + global $gBitMailer; + $gBitMailer = new BitMailer(); + $gBitMailer->queueRecipients( $gContent->mContentId, $emails ); + $feedback['success'] = count( $emails ).' '.tra( 'emails were queued to be sent:' ).' '.$gContent->getTitle(); + $gContent->mEditionId = NULL; + } else { + $feedback['error'] = tra( 'No emails were queued.' ); + } } if( $gContent->isValid() ) { @@ -51,6 +58,7 @@ if( $gContent->isValid() ) { } } +$gBitSmarty->assign_by_ref( 'feedback', $feedback ); // Display the template $gBitSystem->display( 'bitpackage:newsletters/send_newsletters.tpl'); -- cgit v1.3