summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2006-06-19 02:35:20 +0000
committerChristian Fowler <spider@viovio.com>2006-06-19 02:35:20 +0000
commit52c3ae75fe0ce196368b98eebb8cb1509eff953b (patch)
tree6a2337da5afbc6d92950dd52bf6d0fe6ee205056
parent5e00826a94b5c5143f481c3a444106243384f6bf (diff)
downloadnewsletters-52c3ae75fe0ce196368b98eebb8cb1509eff953b.tar.gz
newsletters-52c3ae75fe0ce196368b98eebb8cb1509eff953b.tar.bz2
newsletters-52c3ae75fe0ce196368b98eebb8cb1509eff953b.zip
merge all of wolffies changes to HEAD. Now need to work on a few things like user_id in mail_subs table, etc.
-rw-r--r--BitMailer.php19
-rw-r--r--BitNewsletter.php141
-rw-r--r--BitNewsletterEdition.php43
-rw-r--r--admin/admin_newsletter_subscriptions.php85
-rw-r--r--admin/admin_newsletters.php68
-rw-r--r--admin/admin_newsletters_inc.php4
-rw-r--r--admin/schema_inc.php11
-rw-r--r--admin/send.php31
-rw-r--r--admin/tend_mail_queue.php8
-rw-r--r--admin/upgrade_inc.php4
-rw-r--r--bit_setup_inc.php2
-rw-r--r--edition.php6
-rw-r--r--index.php38
-rw-r--r--templates/admin_newsletter_subscriptions.tpl140
-rw-r--r--templates/admin_newsletters.tpl2
-rw-r--r--templates/confirm_newsletter_subscription.tpl13
-rw-r--r--templates/edit_edition.tpl17
-rw-r--r--templates/edit_newsletter.tpl4
-rw-r--r--templates/list_editions_inc.tpl2
-rw-r--r--templates/menu_newsletters.tpl6
-rw-r--r--templates/newsletter_byebye.tpl12
-rw-r--r--templates/newsletter_welcome.tpl15
-rw-r--r--templates/newsletters.tpl110
-rw-r--r--templates/send_newsletters.tpl10
-rw-r--r--templates/unsubscribe_inc.tpl4
-rw-r--r--templates/view_edition.tpl8
26 files changed, 524 insertions, 279 deletions
diff --git a/BitMailer.php b/BitMailer.php
index d15f4df..b292728 100644
--- a/BitMailer.php
+++ b/BitMailer.php
@@ -1,12 +1,12 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_newsletters/Attic/BitMailer.php,v 1.19 2006/04/19 13:48:38 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_newsletters/Attic/BitMailer.php,v 1.20 2006/06/19 02:35:19 spiderr Exp $
*
* Copyright (c) 2004 bitweaver.org
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitMailer.php,v 1.19 2006/04/19 13:48:38 squareing Exp $
+ * $Id: BitMailer.php,v 1.20 2006/06/19 02:35:19 spiderr Exp $
*
* Class that handles editions of newsletters
* @package newsletters
@@ -15,7 +15,7 @@
*
* @author spiderr <spider@steelsun.com>
*
- * @version $Revision: 1.19 $ $Date: 2006/04/19 13:48:38 $ $Author: squareing $
+ * @version $Revision: 1.20 $ $Date: 2006/06/19 02:35:19 $ $Author: spiderr $
*/
/**
@@ -36,7 +36,7 @@ class BitMailer extends phpmailer {
$this->mDb = $gBitDb;
$this->From = $gBitSystem->getConfig( 'bitmailer_sender_email', $gBitSystem->getConfig( 'site_sender_email', $_SERVER['SERVER_ADMIN'] ) );
$this->FromName = $gBitSystem->getConfig( 'bitmailer_from', $gBitSystem->getConfig( 'siteTitle' ) );
- $this->Host = $gBitSystem->getConfig( 'bitmailer_servers', $gBitSystem->getConfig( 'feature_server_name', '127.0.0.1' ) );
+ $this->Host = $gBitSystem->getConfig( 'bitmailer_servers', $gBitSystem->getConfig( 'kernel_server_name', '127.0.0.1' ) );
$this->Mailer = $gBitSystem->getConfig( 'bitmailer_protocol', 'smtp' ); // Alternative to IsSMTP()
$this->WordWrap = $gBitSystem->getConfig( 'bitmailer_word_wrap', 75 );
if( !$this->SetLanguage( $gBitLanguage->getLanguage(), UTIL_PKG_PATH.'phpmailer/language/' ) ) {
@@ -89,6 +89,7 @@ class BitMailer extends phpmailer {
$pick['full_name'] = NULL;
}
if( !isset( $body[$pick['content_id']] ) ) {
+ $gBitSmarty->assign( 'sending', TRUE );
// We only support sending of newsletters currently
$content = new BitNewsletterEdition( NULL, $pick['content_id'] );
if( $content->load() ) {
@@ -107,17 +108,19 @@ class BitMailer extends phpmailer {
$gBitSmarty->assign( 'sending', TRUE );
$unsub = $gBitSmarty->fetch( 'bitpackage:newsletters/unsubscribe_inc.tpl' );
}
- $htmlBody = $unsub . $body[$pick['content_id']]['body'] . $unsub . '<img src="'.NEWSLETTERS_PKG_URI.'track.php?sub='.$pick['url_code'].'" alt="" />';
-
+ $gBitSystem->preDisplay('');
+ $header = $gBitSmarty->fetch( 'bitpackage:themes/header_inc.tpl' );
+ $htmlBody = $header . "<div id='bitmain'><small>". tra("If this newsletter is not displaying correctly, please click here: ") . "<a href='".$content->getDisplayUrl()."'>".$content->getDisplayUrl()."</a></small><br />" . $body[$pick['content_id']]['body'] . $unsub . '<img src="'.NEWSLETTERS_PKG_URI.'track.php?sub='.$pick['url_code'].'" alt="" /></div>';
+ $this->ClearReplyTos();
$this->AddReplyTo( $body[$pick['content_id']]['reply_to'], $gBitSystem->getConfig( 'bitmailer_from' ) );
print "TO: $pick[email]\t";
if( $this->sendMail( $pick, $body[$pick['content_id']]['subject'], $htmlBody ) ) {
print "SENT\n";
+ $updateQuery = "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `sent_date`=?,`url_code`=? WHERE `content_id`=? AND `email`=?";
+ $this->mDb->query( $updateQuery, array( time(), $pick['url_code'], $pick['content_id'], $pick['email'] ) );
} else {
$this->logError( $pick );
}
- $updateQuery = "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `sent_date`=?,`url_code`=? WHERE `content_id`=? AND `email`=?";
- $this->mDb->query( $updateQuery, array( time(), $pick['url_code'], $pick['content_id'], $pick['email'] ) );
$this->mDb->CompleteTrans();
$this->mDb->StartTrans();
}
diff --git a/BitNewsletter.php b/BitNewsletter.php
index e878481..5b42eac 100644
--- a/BitNewsletter.php
+++ b/BitNewsletter.php
@@ -1,12 +1,12 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_newsletters/BitNewsletter.php,v 1.17 2006/04/19 13:48:38 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_newsletters/BitNewsletter.php,v 1.18 2006/06/19 02:35:19 spiderr Exp $
*
* Copyright (c) 2004 bitweaver.org
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitNewsletter.php,v 1.17 2006/04/19 13:48:38 squareing Exp $
+ * $Id: BitNewsletter.php,v 1.18 2006/06/19 02:35:19 spiderr Exp $
*
* Virtual base class (as much as one can have such things in PHP) for all
* derived tikiwiki classes that require database access.
@@ -16,7 +16,7 @@
*
* @author drewslater <andrew@andrewslater.com>, spiderr <spider@steelsun.com>
*
- * @version $Revision: 1.17 $ $Date: 2006/04/19 13:48:38 $ $Author: squareing $
+ * @version $Revision: 1.18 $ $Date: 2006/06/19 02:35:19 $ $Author: spiderr $
*/
/**
@@ -102,74 +102,121 @@ class BitNewsletter extends LibertyContent {
function getSubscribers($nl_id) {
$ret = array();
if( $this->isValid() ) {
- $query = "select email from `".BIT_DB_PREFIX."mail_subscriptions` where `valid`=? and `nl_id`=?";
- if( $result = $this->mDb->query( $query, array( 'y', $this->mNewsletterId ) ) ) {
+ $query = "select * from `".BIT_DB_PREFIX."mail_subscriptions` where `unsubscribe_date` is NULL and `nl_content_id`=?";
+ if( $res = $this->mDb->query( $query, array( $this->mNewsletterId ) ) ) {
$ret = $res->GetRows();
}
}
return $ret;
}
- function remove_newsletter_subscription($nl_id, $email) {
- $valid = $this->mDb->getOne("select `valid` from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=? and `email`=?", array((int)$nl_id,$email));
- $query = "delete from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=? and `email`=?";
- $result = $this->mDb->query($query, array((int)$nl_id,$email));
- $this->update_users($nl_id);
+ function getAllSubscribers() {
+ $ret = array();
+ if( $this->isValid() ) {
+ $query = "select * from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_content_id`=?";
+ if( $res = $this->mDb->query( $query, array( $this->mNewsletterId ) ) ) {
+ $ret = $res->GetRows();
+ }
+ }
+ return $ret;
}
- function subscribe( $email ) {
+ function removeSubscription( $email, $notify = FALSE, $del_record = FALSE ) {
+ if ($del_record) {
+ $this->mDb->query("DELETE FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `nl_content_id`=? AND `email`=?", array($this->mNewsletterId, $email));
+ } else {
+ $sub_code = $this->mDb->getOne("select `sub_code` from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_content_id`=? and `email`=?", array($this->mNewsletterId, $email));
+ $this->unsubscribe($sub_code, $notify);
+ }
+ }
+
+ function subscribe( $email, $notify = FALSE, $remind = FALSE ) {
$ret = FALSE;
if( $this->isValid() ) {
+ global $gBitSystem;
global $gBitSmarty;
global $gBitUser;
- $code = md5( BitUser::genPass() );
+ // Check for duplicates
+ $all_subs = $this->getAllSubscribers();
+ $duplicate = FALSE;
+ foreach($all_subs as $sub) {
+ if ($sub['email'] == $email) {
+ $duplicate = TRUE;
+ $sub_code = $sub['sub_code'];
+ }
+ }
+
+ $sub_code = (!$duplicate) ? md5( BitUser::genPass() ) : $sub_code;
$now = date("U");
- if( $this->getField( 'validate_addr' ) == 'y' ) {
+ // Generate a code and store it and send an email with the
+ // URL to confirm the subscription put valid as 'n'
+ if (!$duplicate) {
+ $query = "insert into `".BIT_DB_PREFIX."mail_subscriptions`(`nl_content_id`,`email`,`sub_code`,`is_valid`,`subscribed_date`) values(?,?,?,?,?)";
+ $result = $this->mDb->query( $query, array( $this->mNewsletterId, $email, $sub_code, 'n', (int)$now ) );
+ }
+ if( ($notify && $this->mInfo['validate_addr'] == 'y') || $remind ) {
// Generate a code and store it and send an email with the
- // URL to confirm the subscription put valid as 'n'
- $query = "delete from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=? and `email`=?";
- $result = $this->mDb->query( $query, array( $this->mNewsletterId, $email ) );
- $query = "insert into `".BIT_DB_PREFIX."mail_subscriptions`(`nl_id`,`email`,`code`,`valid`,`subscribed`) values(?,?,?,?,?)";
- $result = $this->mDb->query( $query, array( $this->mNewsletterId, $email, $code, 'n', (int)$now ) );
- // Now send an email to the address with the confirmation instructions
- $gBitSmarty->assign( 'code', $code );
+ $gBitSmarty->assign( 'sub_code', $sub_code );
$mail_data = $gBitSmarty->fetch('bitpackage:newsletters/confirm_newsletter_subscription.tpl');
- @mail($email, tra('Newsletter subscription information at '). $_SERVER["SERVER_NAME"], $mail_data,
- "From: $site_sender_email\r\nContent-type: text/plain;charset=utf-8\r\n");
- } else {
- $query = "delete from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=? and `email`=?";
- $result = $this->mDb->query( $query, array( $this->mNewsletterId, $email ) );
- $query = "insert into `".BIT_DB_PREFIX."mail_subscriptions`(`nl_id`,`email`,`code`,`valid`,`subscribed`) values(?,?,?,?,?)";
- $result = $this->mDb->query( $query, array( $this->mNewsletterId, $email, $code, 'y', (int)$now ) );
+ @mail($email, tra('Newsletter subscription information at') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data,
+ "From: " . $gBitSystem->getConfig( "sender_email" ) . "\r\nContent-type: text/plain;charset=utf-8\r\n");
}
- $this->updateUsers();
$ret = TRUE;
}
return $ret;
}
- function confirmSubscription($code) {
+ function confirmSubscription($sub_code, $notify = FALSE ) {
+ global $gBitSystem;
global $gBitSmarty;
global $gBitUser;
- global $site_sender_email;
- $query = "select * from `".BIT_DB_PREFIX."mail_subscriptions` where `code`=?";
- $result = $this->mDb->query($query,array($code));
+ $query = "select * from `".BIT_DB_PREFIX."mail_subscriptions` where `sub_code`=?";
+ $result = $this->mDb->query($query,array($sub_code));
if (!$result->numRows()) return false;
$res = $result->fetchRow();
- $info = $this->get_newsletter($res["nl_id"]);
- $gBitSmarty->assign('info', $info);
- $query = "update `".BIT_DB_PREFIX."mail_subscriptions` set `valid`=? where `code`=?";
- $result = $this->mDb->query($query,array('y',$code));
- // Now send a welcome email
- $gBitSmarty->assign('code', $res["code"]);
- $mail_data = $gBitSmarty->fetch('bitpackage:newsletters/newsletter_welcome.tpl');
- @mail($res["email"], tra('Welcome to '). $info["name"] . tra(' at '). $_SERVER["SERVER_NAME"], $mail_data,
- "From: $site_sender_email\r\nContent-type: text/plain;charset=utf-8\r\n");
- return $this->get_newsletter($res["nl_id"]);
+ $this->mNewsletterId = $res['nl_content_id'];
+ $this->load();
+ $query = "update `".BIT_DB_PREFIX."mail_subscriptions` set `is_valid`=?,`unsubscribe_date`=? where `sub_code`=?";
+ $result = $this->mDb->query($query,array('y',NULL,$sub_code));
+
+ if ($notify) {
+ // Now send a welcome email
+ $gBitSmarty->assign( 'sub_code', $res["sub_code"] );
+ $mail_data = $gBitSmarty->fetch('bitpackage:newsletters/newsletter_welcome.tpl');
+ @mail($res["email"], tra('Welcome to') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data,
+ "From: " . $gBitSystem->getConfig( "sender_email" ) . "\r\nContent-type: text/plain;charset=utf-8\r\n");
+ }
+ }
+
+ function unsubscribe($sub_code, $notify = TRUE ) {
+ global $gBitSystem;
+ global $gBitSmarty;
+ global $gBitUser;
+ $now = date("U");
+ $query = "select * from `".BIT_DB_PREFIX."mail_subscriptions` where `sub_code`=?";
+ $result = $this->mDb->query($query,array($sub_code));
+
+ if (!$result->numRows()) return false;
+
+ $res = $result->fetchRow();
+ $this->mNewsletterId = $res['nl_content_id'];
+ $this->load();
+ $query = "update `".BIT_DB_PREFIX."mail_subscriptions` set `unsubscribe_date`=? where `sub_code`=? and `unsubscribe_date` is NULL";
+ $result = $this->mDb->query($query,array($now, $sub_code));
+
+ if ($notify) {
+ // Now send a bye bye email
+ $gBitSmarty->assign('sub_code', $res["sub_code"]);
+ $mail_data = $gBitSmarty->fetch('bitpackage:newsletters/newsletter_byebye.tpl');
+ @mail($res["email"], tra('Thank you from') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data,
+ "From: " . $gBitSystem->getConfig( "sender_email" ) . "\r\nContent-type: text/plain;charset=utf-8\r\n");
+ }
+
}
+
/*
function add_all_users($nl_id) {
$query = "select `email` from `".BIT_DB_PREFIX."users_users`";
@@ -222,14 +269,15 @@ class BitNewsletter extends LibertyContent {
$ret = array();
while( $res = $result->fetchRow() ) {
$res['display_url'] = $this->getDisplayUrl( $res['nl_id'] );
- $res["unsub_count"] = $this->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE (`nl_content_id`=? AND `unsubscribe_date` IS NOT NULL) OR `unsubscribe_all` IS NOT NULL",array( (int)$res["content_id"] ) );
+ $res["confirmed"] = $this->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `unsubscribe_date` IS NULL and `nl_content_id`=?",array( (int)$res["nl_id"] ) );
+ $res["unsub_count"] = $this->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `nl_content_id`=?",array( (int)$res["nl_id"] ) );
$ret[$res['content_id']] = $res;
}
return $ret;
}
- function list_newsletter_subscriptions($nl_id, $offset, $maxRecords, $sort_mode, $find) {
+/* function list_newsletter_subscriptions($nl_id, $offset, $maxRecords, $sort_mode, $find) {
$bindVars = array((int)$nl_id);
if ($find) {
$findesc = '%' . $find . '%';
@@ -255,13 +303,14 @@ class BitNewsletter extends LibertyContent {
return $retval;
}
+*/
function get_unsub_msg($nl_id, $email) {
$foo = parse_url($_SERVER["REQUEST_URI"]);
$foo = str_replace('send_newsletters', 'newsletters', $foo);
$url_subscribe = httpPrefix(). $foo["path"];
- $code = $this->mDb->getOne("select `code` from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=? and `email`=?",array((int)$nl_id,$email));
- $url_unsub = $url_subscribe . '?unsubscribe=' . $code;
+ $sub_code = $this->mDb->getOne("select `sub_code` from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_content_id`=? and `email`=?",array((int)$nl_id,$email));
+ $url_unsub = $url_subscribe . '?unsubscribe=' . $sub_code;
$msg = '<br/><br/>' . tra( 'You can unsubscribe from this newsletter following this link'). ": <a href='$url_unsub'>$url_unsub</a>";
return $msg;
}
diff --git a/BitNewsletterEdition.php b/BitNewsletterEdition.php
index 7760e70..3f8f69a 100644
--- a/BitNewsletterEdition.php
+++ b/BitNewsletterEdition.php
@@ -1,12 +1,12 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_newsletters/BitNewsletterEdition.php,v 1.20 2006/02/08 23:24:28 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_newsletters/BitNewsletterEdition.php,v 1.21 2006/06/19 02:35:19 spiderr Exp $
*
* Copyright (c) 2004 bitweaver.org
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitNewsletterEdition.php,v 1.20 2006/02/08 23:24:28 spiderr Exp $
+ * $Id: BitNewsletterEdition.php,v 1.21 2006/06/19 02:35:19 spiderr Exp $
*
* Class that handles editions of newsletters
* @package newsletters
@@ -15,7 +15,7 @@
*
* @author spiderr <spider@steelsun.com>
*
- * @version $Revision: 1.20 $ $Date: 2006/02/08 23:24:28 $ $Author: spiderr $
+ * @version $Revision: 1.21 $ $Date: 2006/06/19 02:35:19 $ $Author: spiderr $
*/
/**
@@ -31,10 +31,10 @@ class BitNewsletterEdition extends LibertyAttachable {
parent::LibertyContent();
$this->registerContentType( BITNEWSLETTEREDITION_CONTENT_TYPE_GUID, array(
'content_type_guid' => BITNEWSLETTEREDITION_CONTENT_TYPE_GUID,
- 'content_description' => 'Newsletter',
- 'handler_class' => 'BitNewsletter',
+ 'content_description' => 'Edition',
+ 'handler_class' => 'BitNewsletterEdition',
'handler_package' => 'newsletters',
- 'handler_file' => 'BitNewsletter.php',
+ 'handler_file' => 'BitNewsletterEdition.php',
'maintainer_url' => 'http://www.bitweaver.org'
) );
$this->mEditionId = $pEditionId;
@@ -95,6 +95,7 @@ class BitNewsletterEdition extends LibertyAttachable {
$this->mInfo = $result->fetchRow();
$this->mEditionId = $this->mInfo['edition_id'];
$this->mContentId = $this->mInfo['content_id'];
+ LibertyAttachable::load();
$this->mNewsletter = new BitNewsletter( NULL, $this->mInfo['nl_content_id'] );
$this->mNewsletter->load();
} else {
@@ -122,12 +123,12 @@ class BitNewsletterEdition extends LibertyAttachable {
global $gBitSystem;
if( $this->verifyId( $pEditionId ) ) {
if( $gBitSystem->isFeatureActive( 'pretty_urls' ) ) {
- $ret = NEWSLETTERS_PKG_URL.'edition/'.$pEditionId;
+ $ret = NEWSLETTERS_PKG_URI.'edition/'.$pEditionId;
} else {
- $ret = NEWSLETTERS_PKG_URL.'edition.php?edition_id='.$pEditionId;
+ $ret = NEWSLETTERS_PKG_URI.'edition.php?edition_id='.$pEditionId;
}
} else {
- $ret = NEWSLETTERS_PKG_URL.'edition.php';
+ $ret = NEWSLETTERS_PKG_URI.'edition.php';
}
return $ret;
}
@@ -161,6 +162,9 @@ class BitNewsletterEdition extends LibertyAttachable {
$ret = $gBitDb->getAssoc( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] );
foreach( array_keys( $ret ) as $k ) {
$ret[$k]['display_url'] = BitNewsletterEdition::getDisplayUrl( $k );
+ // remove formating tags
+ $data = preg_replace( '/{[^{}]*}/', '', $ret[$k]['data'] );
+ $ret[$k]['parsed'] = BitNewsletterEdition::parseData( $data, $ret[$k]['format_guid'] );
}
$pListHash['total_records'] = $gBitDb->getOne( $query_cant, $bindVars );
$pListHash['block_pages'] = 5;
@@ -190,7 +194,7 @@ class BitNewsletterEdition extends LibertyAttachable {
return( $this->getField( 'is_draft' ) );
}
- function getRecipients( $pGroupArray ) {
+ function getRecipients( $pGroupArray, $validated = TRUE ) {
global $gBitUser;
$ret = array();
if( is_array( $pGroupArray ) ) {
@@ -198,11 +202,22 @@ class BitNewsletterEdition extends LibertyAttachable {
$ret = array_merge( $ret, $gBitUser->getGroupUserData( $groupId, array( 'email', 'uu.user_id', 'login', 'real_name' ) ) );
}
- $query = "SELECT * FROM `".BIT_DB_PREFIX."mail_subscriptions`
- WHERE (`nl_content_id`=? AND `unsubscribe_date` IS NOT NULL) OR `unsubscribe_all` IS NOT NULL";
- if( $unsubs = $this->mDb->getArray( $query, array( $this->mNewsletter->mContentId ) ) ) {
- $ret = array_diff_assoc( $ret, $unsubs );
+ if ( array_search( 'send_subs', $pGroupArray ) !== false ) {
+ $valid = "";
+ $bindvars = array( $this->mNewsletter->mNewsletterId );
+ if ($validated) {
+ $valid = " AND `is_valid`=?";
+ $bindvars[] = 'y';
+ }
+ $query = "SELECT * FROM `".BIT_DB_PREFIX."mail_subscriptions`
+ WHERE `nl_content_id`=? AND `unsubscribe_date` IS NULL AND `unsubscribe_all` IS NULL".$valid;
+ $subs = $this->mDb->getArray( $query, $bindvars );
+ foreach( $subs as $sub) {
+ if (!isset($ret[$sub['email']]))
+ $ret[$sub['email']] = $sub;
+ }
}
+
$query = "SELECT `email`, `user_id` FROM `".BIT_DB_PREFIX."mail_queue` WHERE `content_id`=?";
if( $dupes = $this->mDb->getAssoc( $query, array( $this->mContentId ) ) ) {
$ret = array_diff_keys( $ret, $dupes );
diff --git a/admin/admin_newsletter_subscriptions.php b/admin/admin_newsletter_subscriptions.php
index e9058aa..8c83c16 100644
--- a/admin/admin_newsletter_subscriptions.php
+++ b/admin/admin_newsletter_subscriptions.php
@@ -1,6 +1,6 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/admin_newsletter_subscriptions.php,v 1.4 2006/04/20 16:24:47 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/admin_newsletter_subscriptions.php,v 1.5 2006/06/19 02:35:19 spiderr Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
@@ -36,22 +36,79 @@ if ($userlib->object_has_one_permission($_REQUEST["nl_id"], 'newsletter')) {
}
}
*/
+if( $gContent->isValid() ) {
+ $nl_id = $_REQUEST['nl_id'];
+ $gBitSmarty->assign( 'nl_id', $nl_id );
-if (isset($_REQUEST["remove"])) {
- check_ticket('admin-nl-subsriptions');
- $nllib->remove_newsletter_subscription($_REQUEST["remove"], $_REQUEST["email"]);
-}
-
-if (isset($_REQUEST["add_all"])) {
- check_ticket('admin-nl-subsriptions');
- $nllib->add_all_users($_REQUEST["nl_id"]);
-}
+ /* mass-remove:
+ the checkboxes are sent as the array $_REQUEST["checked[]"], values are the wiki-PageNames,
+ e.g. $_REQUEST["checked"][3]="HomePage"
+ $_REQUEST["submit_mult"] holds the value of the "with selected do..."-option list
+ we look if any page's checkbox is on and if remove_pages is selected.
+ then we check permission to delete pages.
+ if so, we call BitPage::expunge for all the checked pages.
+ */
+ if (isset($_REQUEST["submit_mult"]) && isset($_REQUEST["checked"]) && $_REQUEST["submit_mult"] == "remove") {
+ if( !empty( $_REQUEST['cancel'] ) ) {
+ // user cancelled - just continue on, doing nothing
+ } elseif( empty( $_REQUEST['confirm'] ) ) {
+ $formHash['nl_id'] = $nl_id;
+ $formHash['delete'] = TRUE;
+ $formHash['submit_mult'] = 'remove';
+ foreach( $_REQUEST["checked"] as $del ) {
+ $formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>';
+ }
+ $gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to delete '.count($_REQUEST["checked"]).' subscriptions?', 'error' => 'This cannot be undone!' ) );
+ } else {
+ foreach ($_REQUEST["checked"] as $delete) {
+ $gContent->removeSubscription($delete, FALSE, TRUE );
+ }
+ }
+ } elseif (isset($_REQUEST["submit_mult"]) && isset($_REQUEST["checked"]) && $_REQUEST["submit_mult"] == "unsubscribe") {
+ if( !empty( $_REQUEST['cancel'] ) ) {
+ // user cancelled - just continue on, doing nothing
+ } elseif( empty( $_REQUEST['confirm'] ) ) {
+ $formHash['nl_id'] = $nl_id;
+ $formHash['delete'] = TRUE;
+ $formHash['submit_mult'] = 'unsubscribe';
+ foreach( $_REQUEST["checked"] as $del ) {
+ $formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>';
+ }
+ $gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to unsubscribe '.count($_REQUEST["checked"]).' subscriptions?', 'error' => 'This cannot be undone!' ) );
+ } else {
+ foreach ($_REQUEST["checked"] as $delete) {
+ $gContent->removeSubscription($delete, FALSE, FALSE );
+ }
+ }
+ } elseif (isset($_REQUEST["submit_mult"]) && isset($_REQUEST["checked"]) && $_REQUEST["submit_mult"] == "resubscribe") {
+ if( !empty( $_REQUEST['cancel'] ) ) {
+ // user cancelled - just continue on, doing nothing
+ } elseif( empty( $_REQUEST['confirm'] ) ) {
+ $formHash['nl_id'] = $nl_id;
+ $formHash['delete'] = TRUE;
+ $formHash['submit_mult'] = 'resubscribe';
+ foreach( $_REQUEST["checked"] as $del ) {
+ $formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>';
+ }
+ $gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to resubscribe '.count($_REQUEST["checked"]).' subscriptions?', 'error' => 'This cannot be undone!' ) );
+ } else {
+ foreach ($_REQUEST["checked"] as $delete) {
+ $gContent->subscribe($delete, FALSE, FALSE );
+ }
+ }
+ } elseif (isset($_REQUEST["save"])) {
+ $new_subs = preg_split("/[\s,]+/", $_REQUEST["new_subscribers"]);
+ foreach($new_subs as $sub) {
+ $sub = trim($sub);
+ if (empty($sub))
+ continue;
+ $gContent->subscribe($sub, TRUE );
+ }
+ }
-if (isset($_REQUEST["save"])) {
- check_ticket('admin-nl-subsriptions');
- $sid = $nllib->newsletter_subscribe($_REQUEST["nl_id"], $_REQUEST["email"]);
+ $subscribers = $gContent->getAllSubscribers($nl_id);
+ $gBitSmarty->assign( 'subscribers', $subscribers );
}
-
/*
$cat_type='newsletter';
$cat_objid = $_REQUEST["nl_id"];
diff --git a/admin/admin_newsletters.php b/admin/admin_newsletters.php
new file mode 100644
index 0000000..1a59fa6
--- /dev/null
+++ b/admin/admin_newsletters.php
@@ -0,0 +1,68 @@
+<?php
+
+// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/admin_newsletters.php,v 1.2 2006/06/19 02:35:19 spiderr Exp $
+
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
+// Initialization
+require_once( '../../bit_setup_inc.php' );
+$gBitSystem->verifyPackage( 'newsletters' );
+$gBitSystem->verifyPermission( 'p_newsletters_create' );
+
+require_once( NEWSLETTERS_PKG_PATH.'lookup_newsletter_inc.php' );
+
+if( isset( $_REQUEST["remove"] ) && $gContent->isValid() ) {
+ if( !empty( $_REQUEST['cancel'] ) ) {
+ // user cancelled - just continue on, doing nothing
+ } elseif( empty( $_REQUEST['confirm'] ) ) {
+ $formHash['remove'] = TRUE;
+ $formHash['nl_id'] = $gContent->mNewsletterId;
+ $gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to delete the newsletter '.$gContent->getTitle().'?' ) );
+ } else {
+ if( $gContent->expunge() ) {
+ header( "Location: ".NEWSLETTERS_PKG_URL.'admin/admin_newsletters.php' );
+ die;
+ }
+ }
+} elseif (isset($_REQUEST["save"])) {
+ $sid = $gContent->store( $_REQUEST );
+ header( "Location: ".$_SERVER['PHP_SELF'] );
+ die;
+}
+
+$gContent->invokeServices( 'content_edit_function' );
+
+// Configure quicktags list
+if ($gBitSystem->isPackageActive( 'quicktags' ) ) {
+ include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' );
+}
+
+$newsletters = $gContent->getList( $listHash );
+$gBitSmarty->assign_by_ref( 'newsletters', $newsletters );
+$gBitSmarty->assign_by_ref( 'listInfo', $listHash );
+
+// Fill array with possible number of questions per page
+/*
+$freqs = array();
+
+for ($i = 0; $i < 90; $i++) {
+ $aux["i"] = $i;
+
+ $aux["t"] = $i * 24 * 60 * 60;
+ $freqs[] = $aux;
+}
+
+$gBitSmarty->assign('freqs', $freqs);
+*/
+/*
+$cat_type='newsletter';
+$cat_objid = $_REQUEST["nl_id"];
+include_once( CATEGORIES_PKG_PATH.'categorize_list_inc.php' );
+*/
+
+// Display the template
+$gBitSystem->display( 'bitpackage:newsletters/admin_list_newsletters.tpl');
+
+?>
diff --git a/admin/admin_newsletters_inc.php b/admin/admin_newsletters_inc.php
index 988b420..6d52dc7 100644
--- a/admin/admin_newsletters_inc.php
+++ b/admin/admin_newsletters_inc.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/admin_newsletters_inc.php,v 1.4 2006/04/19 13:48:39 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/admin_newsletters_inc.php,v 1.5 2006/06/19 02:35:19 spiderr Exp $
$formNewsletterFeatures = array(
"bitmailer_sender_email" => array(
@@ -15,7 +15,7 @@ $formNewsletterFeatures = array(
"bitmailer_servers" => array(
'label' => 'Mail Servers',
'note' => '',
- 'default' => $gBitSystem->getConfig( 'feature_server_name', '127.0.0.1' ),
+ 'default' => $gBitSystem->getConfig( 'kernel_server_name', '127.0.0.1' ),
),
"bitmailer_protocol" => array(
'label' => 'Protocol',
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index fd3fc1d..71321ab 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -28,6 +28,9 @@ $tables = array(
email C(160),
user_id I4,
nl_content_id I4,
+ sub_code C(36),
+ is_valid C(1),
+ subscribed_date I8,
response_content_id I4,
unsubscribe_all C(1),
unsubscribe_date I8
@@ -64,13 +67,16 @@ $tables = array(
sent_date I8,
last_read_date I8,
reads I2 NOTNULL DEFAULT '0'
- CONSTRAINT ', CONSTRAINT `mailq_content_ref` FOREIGN KEY (`nl_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )'
+ CONSTRAINT ', CONSTRAINT `mailq_content_ref` FOREIGN KEY (`nl_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )
+ , CONSTRAINT `mailq_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users`( `user_id` )'
"
);
global $gBitInstaller;
+$gBitInstaller->makePackageHomeable(NEWSLETTERS_PKG_NAME);
+
foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerSchemaTable( NEWSLETTERS_PKG_DIR, $tableName, $tables[$tableName] );
}
@@ -78,6 +84,9 @@ foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerPackageInfo( NEWSLETTERS_PKG_NAME, array(
'description' => "Newsletters is for emailing users updates about your site.",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
+ 'version' => '1.0',
+ 'state' => 'R2',
+ 'dependencies' => '',
) );
// ### Indexes
diff --git a/admin/send.php b/admin/send.php
index bb1b50e..6e07d6f 100644
--- a/admin/send.php
+++ b/admin/send.php
@@ -1,6 +1,6 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/send.php,v 1.13 2006/04/20 16:24:47 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/send.php,v 1.14 2006/06/19 02:35:19 spiderr Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
@@ -9,31 +9,35 @@
// Initialization
require_once( '../../bit_setup_inc.php' );
include_once( NEWSLETTERS_PKG_PATH.'BitMailer.php' );
+include_once( NEWSLETTERS_PKG_PATH.'BitNewsletterEdition.php' );
$gBitSystem->verifyPackage( 'newsletters' );
-$gBitSystem->verifyPermission( 'p_admin_newsletters' );
+$gBitSystem->verifyPermission( 'p_send_newsletters' );
require_once( NEWSLETTERS_PKG_PATH.'lookup_newsletter_edition_inc.php' );
$feedback = array();
-if( @BitBase::verifyId( $_REQUEST["template_id"] ) ) {
- $template_data = $tikilib->get_template($_REQUEST["template_id"]);
+if( @BitBase::verifyId( $_REQUEST["edition_id"] ) ) {
+ $gContent->mEditionId = $_REQUEST["edition_id"];
+ $gContent->load();
- $_REQUEST['edit'] = $template_data["content"];
- $_REQUEST["preview"] = 1;
+ $_REQUEST['edit'] = $gContent->mInfo['data'];
+// $_REQUEST["preview"] = 1;
}
$gBitSmarty->assign('preview', 'n');
$gBitSmarty->assign('presend', 'n');
$gBitSmarty->assign('emited', 'n');
+$validated = (isset($_REQUEST["validated"]) && !empty($_REQUEST["validated"])) ? TRUE : FALSE;
-if( $gContent->isValid() && isset( $_REQUEST['preview'] ) ) {
- $recipients = $gContent->getRecipients( $_REQUEST['send_group'] );
+if( $gContent->isValid() && isset( $_REQUEST['preview'] ) && isset( $_REQUEST['send_group'] ) ) {
+ $recipients = $gContent->getRecipients( $_REQUEST['send_group'], $validated );
$gBitSmarty->assign_by_ref( 'recipientList', $recipients );
+ $gBitSmarty->assign( 'validated', $validated );
$gBitSmarty->assign( 'sending', TRUE );
} elseif( $gContent->isValid() && isset( $_REQUEST["send"] ) ) {
- if( $emails = $gContent->getRecipients( $_REQUEST['send_group'] ) ) {
+ if( $emails = $gContent->getRecipients( $_REQUEST['send_group'], $validated ) ) {
global $gBitMailer;
$gBitMailer = new BitMailer();
$gBitMailer->queueRecipients( $gContent->mContentId, $gContent->mNewsletter->mContentId, $emails );
@@ -47,17 +51,22 @@ if( $gContent->isValid() && isset( $_REQUEST['preview'] ) ) {
if( $gContent->isValid() ) {
$groupListHash = array();
$groups = $gBitUser->getAllGroups( $groupListHash );
+ $groups['data']['send_subs']['group_name'] = 'Send to subscribers';
$gBitSmarty->assign_by_ref( 'groupList', $groups['data'] );
} else {
$listHash = array();
$editions = $gContent->getList( $listHash );
$gBitSmarty->assign_by_ref( 'editionList', $editions );
- $gBitSmarty->assign( 'listInfo', $listHash );
+
+/* if( $gBitSystem->isFeatureActive( 'bit_p_use_content_templates' ) ) {
+ $templates = $bitlib->list_templates('newsletters', 0, -1, 'name_asc', '');
+ $gBitSmarty->assign_by_ref('templates', $templates["data"]);
+ }*/
}
$gBitSmarty->assign_by_ref( 'feedback', $feedback );
// Display the template
-$gBitSystem->display( 'bitpackage:newsletters/send_newsletters.tpl');
+$gBitSystem->display( 'bitpackage:newsletters/send_newsletters.tpl' , "Send Newsletters");
?>
diff --git a/admin/tend_mail_queue.php b/admin/tend_mail_queue.php
index e99fdf6..f7bcbd8 100644
--- a/admin/tend_mail_queue.php
+++ b/admin/tend_mail_queue.php
@@ -14,17 +14,11 @@
*/
if( !empty( $argc ) ) {
// reduce feedback for command line to keep log noise way down
-// define( 'BIT_PHP_ERROR_REPORTING', E_ERROR | E_PARSE );
+ define( 'BIT_PHP_ERROR_REPORTING', E_ERROR | E_PARSE );
}
require_once( '../../bit_setup_inc.php' );
- // add some protection for arbitrary thumbail execution.
- // if argc is present, we will trust it was exec'ed command line.
- if( empty( $argc ) && !$gBitUser->isAdmin() ) {
- $gBitSystem->fatalError( 'You cannot run the thumbnailer' );
- }
-
if( $gBitSystem->isPackageActive( 'newsletters' ) ) {
require_once( NEWSLETTERS_PKG_PATH.'BitMailer.php' );
global $gBitMailer;
diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php
index 1e7bd65..a026749 100644
--- a/admin/upgrade_inc.php
+++ b/admin/upgrade_inc.php
@@ -19,6 +19,9 @@ array( 'DATADICT' => array(
'tiki_newsletters' => array( '`validateAddr`' => "`validate_addr` C(1) default 'y'" ),
'tiki_newsletters' => array( '`lastSent`' => '`last_sent` I8' ),
'tiki_newsletters_editions' => array( '`editionId`' => '`edition_id` I4 AUTO' ),
+ 'tiki_newsletter_subscriptions' => array( '`code`' => "`sub_code` C(36)" ),
+ 'tiki_newsletter_subscriptions' => array( '`valid`' => "`is_valid` C(1)" ),
+ 'tiki_newsletter_subscriptions' => array( '`subscribed`' => "`subscribed_date` I8" ),
)),
// ALTER
array( 'ALTER' => array(
@@ -52,7 +55,6 @@ array( 'QUERY' =>
array( 'DATADICT' => array(
array( 'DROPCOLUMN' => array(
'tiki_newsletters' => array( '`name`', '`description`', '`created`', '`users`', '`editions`' ),
- 'tiki_newsletter_subscriptions' => array( '`code`', '`valid`', '`subscribed`' ),
)),
)),
)
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 1f5a9ca..925e4fe 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -8,6 +8,6 @@ $registerHash = array(
$gBitSystem->registerPackage( $registerHash );
if( $gBitSystem->isPackageActive( NEWSLETTERS_PKG_NAME ) ) {
- $gBitSystem->registerAppMenu( NEWSLETTERS_PKG_DIR, 'Newsletters', NEWSLETTERS_PKG_URL.'index.php', 'bitpackage:newsletters/menu_newsletters.tpl', NEWSLETTERS_PKG_NAME );
+ $gBitSystem->registerAppMenu( NEWSLETTERS_PKG_DIR, ucfirst( NEWSLETTERS_PKG_DIR ), NEWSLETTERS_PKG_URL.'index.php', 'bitpackage:newsletters/menu_newsletters.tpl', NEWSLETTERS_PKG_NAME );
}
?>
diff --git a/edition.php b/edition.php
index 385b93e..2e9c2cb 100644
--- a/edition.php
+++ b/edition.php
@@ -37,16 +37,18 @@ if (isset($_REQUEST["remove"] ) && $gContent->isValid() ) {
}
if( $gContent->isValid() ) {
+ $title = $gContent->mInfo['title'];
$mid = 'bitpackage:newsletters/view_edition.tpl';
} else {
$listHash = array();
$editions = $gContent->getList( $listHash );
$gBitSmarty->assign_by_ref( 'editionList', $editions );
$gBitSmarty->assign( 'listInfo', $listHash );
+ $title = tra("List Editions");
$mid = 'bitpackage:newsletters/list_editions.tpl';
}
// Display the template
-$gBitSystem->display( $mid );
+$gBitSystem->display( $mid, $title );
-?> \ No newline at end of file
+?>
diff --git a/index.php b/index.php
index fb62c5c..d5e2e46 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_newsletters/index.php,v 1.18 2006/04/20 16:24:47 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_newsletters/index.php,v 1.19 2006/06/19 02:35:19 spiderr Exp $
// Copyright (c) 2006 - bitweaver.org - Christian Fowler, Max Kremmel, et. al
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
@@ -23,9 +23,31 @@ $feedback = array();
$listHash = array();
if( !empty( $_REQUEST['nl_id'] ) ) {
$listHash['nl_id'] = $_REQUEST['nl_id'];
+ if (isset($_REQUEST['info'])) {
+ $subscribe = true;
+ $gBitSmarty->assign('subscribe', 'y');
+ }
}
$newsletters = $gContent->getList( $listHash );
$gBitSmarty->assign_by_ref('newsletters', $newsletters );
+
+$foo = parse_url($_SERVER["REQUEST_URI"]);
+$gBitSmarty->assign('url_subscribe', httpPrefix(). $foo["path"]);
+
+if (isset($_REQUEST["sub"])) {
+ $gContent->confirmSubscription($_REQUEST["sub"], TRUE );
+ $gBitSmarty->assign('confirm', 'y');
+}
+
+if (isset($_REQUEST["unsubscribe"])) {
+ if (!empty( $_REQUEST["email"] )) {
+ $gContent->removeSubscription($_REQUEST["email"], TRUE );
+ } elseif (!empty( $_REQUEST["unsubscribe"] )) {
+ $gContent->unsubscribe($_REQUEST["unsubscribe"], TRUE );
+ }
+ $feedback['success'] = tra( "Your email address was removed from the list of subscriptors." );
+}
+
if( isset( $_REQUEST["sub"] ) || $gBitUser->isRegistered() ) {
if( isset( $_REQUEST["sub"] ) && strlen( $_REQUEST["sub"] ) == 32 && ($subInfo = BitMailer::lookupSubscription( array( 'url_code' => $_REQUEST["sub"] ) )) ) {
$lookup['email'] = $subInfo['email'];
@@ -79,7 +101,7 @@ $user_email = $gBitUser->isRegistered() ? $gBitUser->mInfo['email'] : '';
$gBitSmarty->assign('email', $user_email);
-if( isset( $_REQUEST["subscribe"] ) ) {
+if( isset( $_REQUEST["subscribe"] ) && !empty( $_REQUEST["email"] ) ) {
$gBitSystem->verifyPermission( 'p_newsletters_subscribe' );
$feedback['success'] = tra( "Thanks for your subscription. You will receive an email soon to confirm your subscription. No newsletters will be sent to you until the subscription is confirmed." );
@@ -88,12 +110,15 @@ if( isset( $_REQUEST["subscribe"] ) ) {
}
// Now subscribe the email address to the newsletter
- $gContent->subscribe( $_REQUEST["email"] );
+ $gContent->subscribe( $_REQUEST["email"], TRUE, TRUE );
}
-if( $gContent->isValid() ) {
+$subscribe = false;
+
+/*if( !$subscribe && $gContent->isValid() ) {
$mid = 'bitpackage:newsletters/view_newsletter.tpl';
-} elseif( empty( $mid ) ) {
+ $title = "View Newsletter";
+} else*/ {
/* List newsletters */
$listHash = array();
$newsletters = $gContent->getList( $listHash );
@@ -118,11 +143,12 @@ if( $gContent->isValid() ) {
}
*/
$mid = 'bitpackage:newsletters/newsletters.tpl';
+ $title = "List Newsletters";
}
$gBitSmarty->assign( 'feedback', $feedback );
// Display the template
-$gBitSystem->display( $mid );
+$gBitSystem->display( $mid, $title );
?>
diff --git a/templates/admin_newsletter_subscriptions.tpl b/templates/admin_newsletter_subscriptions.tpl
index 67c5b80..4baf9e5 100644
--- a/templates/admin_newsletter_subscriptions.tpl
+++ b/templates/admin_newsletter_subscriptions.tpl
@@ -10,96 +10,80 @@
<input type="hidden" name="nl_id" value="{$nl_id|escape}" />
<div class="row">
- {formlabel label="" for=""}
+ {if $gContent->getField('validate_addr') eq 'y'}
+ {formfeedback warning="Validate Email is enabled, a confirmation email will be sent to every subsciber inviting them to the newsletter. <strong>Any duplicate or previously unsubscribed emails will *NOT* be re-subscribed using this method.</strong>"}
+ {else}
+ {formfeedback warning="Validate Email is disabled, emails will be subscribed but not validated by the users. <strong>Any duplicate or previously unsubscribed emails will *NOT* be re-subscribed using this method.</strong>"}
+ {/if}
+ </div>
+
+ <div class="row">
+ {formlabel label="New Subscribers" for=""}
{forminput}
- {formhelp note=""}
+ <textarea cols="50" rows="5" name="new_subscribers" id="new_subscribers"></textarea>
+ {formhelp note="Enter multiple email addresses on separate lines to import into the subscriber list"}
{/forminput}
</div>
<div class="row submit">
+ {forminput}
+ <input type="submit" name="save" value="{tr}Subscribe{/tr}" />
+ {/forminput}
</div>
{/form}
{minifind}
- </div><!-- end .body -->
-</div><!-- end .newsletters -->
-
-<table class="panel">
- <caption>Newsletters</caption>
- <tr>
- <td>{tr}Name{/tr}:</td>
- <td>{$nl_info.name}</td>
- </tr>
- <tr>
- <td>{tr}Description{/tr}:</td>
- <td>{$nl_info.description}</td>
- </tr>
-</table>
-
-{* original code
-<h2>{tr}Add a subscription newsletters{/tr}</h2>
-<form action="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php" method="post">
-<input type="hidden" name="nl_id" value="{$nl_id|escape}" />
-<table class="panel">
-<tr><td>{tr}Email{/tr}:</td><td><input type="text" name="email" /></td></tr>
-<tr class="panelsubmitrow"><td colspan="2"><input type="submit" name="save" value="{tr}Save{/tr}" /></td></tr>
-</table>
-</form>
-
-<h2>{tr}Add all your site users to this newsletter (broadcast){/tr}</h2>
-<a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;offset={$offset}&amp;sort_mode={$sort_mode}&amp;find={$find}&amp;add_all=1">{tr}Add users{/tr}</a>
+ {form id="list"}
+ <input type="hidden" name="nl_id" value="{$nl_id|escape}" />
-<h2>{tr}Subscriptions{/tr}</h2>
-<table class="find">
-<tr><td>{tr}Find{/tr}</td>
- <td>
- <form method="get" action="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php">
- <input type="text" name="find" value="{$find|escape}" />
- <input type="submit" value="{tr}find{/tr}" name="search" />
- <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
- </form>
- </td>
-</tr>
-</table>
+ <table class="data">
+ <caption>{tr}Subscriptions{/tr}</caption>
+ <tr>
+ <th>{smartlink ititle="Email" isort=email offset=$offset idefault=1}</th>
+ <th>{smartlink ititle="Valid" isort=is_valid offset=$offset idefault=1}</th>
+ <th>{smartlink ititle="Subscribed" isort=subscribed_date offset=$offset idefault=1}</th>
+ <th>{smartlink ititle="Unsubscribed" isort=unsubscribe_date offset=$offset idefault=1}</th>
+ <th>{tr}Actions{/tr}</th>
+ </tr>
+ {section name=sb loop=$subscribers}
+ <tr class="{cycle values='odd,even'}">
+ <td>{$subscribers[sb].email}</td>
+ <td>{$subscribers[sb].is_valid}</td>
+ <td>{$subscribers[sb].subscribed_date|bit_short_datetime}</td>
+ <td>{if $subscribers[sb].unsubscribe_date ne NULL}{$subscribers[sb].unsubscribe_date|bit_short_datetime}{/if}</td>
+ <td><input type="checkbox" name="checked[]" value="{$subscribers[sb].email}" /></td>
+ </tr>
+ {sectionelse}
+ <tr class="norecords">
+ <td colspan="2">{tr}No Records Found{/tr}</td>
+ </tr>
+ {/section}
+ </table>
+ <div style="text-align:right;">
+ <script type="text/javascript">//<![CDATA[
+ // check / uncheck all.
+ document.write("<label for=\"switcher\">{tr}Select All{/tr}</label> ");
+ document.write("<input name=\"switcher\" id=\"switcher\" type=\"checkbox\" onclick=\"switchCheckboxes(this.form.id,'checked[]','switcher')\" />");
+ //]]></script>
-<table>
-<tr>
-<th><a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'email_desc'}email_asc{else}email_desc{/if}">{tr}email{/tr}</a></th>
-<th><a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'valid_desc'}valid_asc{else}valid_desc{/if}">{tr}valid{/tr}</a></th>
-<th><a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'subscribed_desc'}subscribed_asc{else}subscribed_desc{/if}">{tr}subscribed{/tr}</a></th>
-<th>{tr}action{/tr}</th>
-</tr>
-{cycle values="even,odd" print=false}
-{section name=user loop=$channels}
-<tr class="{cycle}">
-<td>{$channels[user].email}</td>
-<td>{$channels[user].valid}</td>
-<td>{$channels[user].subscribed|bit_short_datetime}</td>
-<td>
- <a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;offset={$offset}&amp;sort_mode={$sort_mode}&amp;remove={$channels[user].nl_id}&amp;email={$channels[user].email}">{tr}remove{/tr}</a>
-</td>
-</tr>
-{/section}
-</table>
+ <br />
-<div class="pagination">
-{if $prev_offset >= 0}
-[<a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;find={$find}&amp;offset={$prev_offset}&amp;sort_mode={$sort_mode}">{tr}prev{/tr}</a>]&nbsp;
-{/if}
+ <select name="submit_mult" onchange="this.form.submit();">
+ <option value="" selected="selected">{tr}with checked{/tr}:</option>
+ <option value="remove">{tr}remove{/tr}</option>
+ <option value="unsubscribe">{tr}unsubscribe{/tr}</option>
+ <option value="resubscribe">{tr}resubscribe{/tr}</option>
+ </select>
-{tr}Page{/tr}: {$actual_page}/{$cant_pages}
+ <script type="text/javascript">//<![CDATA[
+ // Fake js to allow the use of the <noscript> tag (so non-js-users kenn still submit)
+ //]]></script>
-{if $next_offset >= 0}
-&nbsp;[<a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;find={$find}&amp;offset={$next_offset}&amp;sort_mode={$sort_mode}">{tr}next{/tr}</a>]
-{/if}
-{if $site_direct_pagination eq 'y'}
-<br />
-{section loop=$cant_pages name=foo}
-{assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords}
-<a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nl_id}&amp;find={$find}&amp;offset={$selector_offset}&amp;sort_mode={$sort_mode}">
-{$smarty.section.foo.index_next}</a>&nbsp;
-{/section}
-{/if}
-</div>
-*}
+ <noscript>
+ <div><input type="submit" value="{tr}Submit{/tr}" /></div>
+ </noscript>
+ </div>
+ {/form}
+ </div><!-- end .body -->
+</div><!-- end .newsletters -->
diff --git a/templates/admin_newsletters.tpl b/templates/admin_newsletters.tpl
index 85ed020..da060d6 100644
--- a/templates/admin_newsletters.tpl
+++ b/templates/admin_newsletters.tpl
@@ -2,7 +2,7 @@
{form legend="Newsletter Features"}
<input type="hidden" name="page" value="{$page}" />
- {if !$gBitSystem->getConfig( 'feature_server_name' )}
+ {if !$gBitSystem->getConfig( 'kernel_server_name' )}
{formfeedback error="Server name is not defined!"}
{tr}You must <a href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=server">define the server name</a> for proper background operation of the mail script.{/tr}
{/if}
diff --git a/templates/confirm_newsletter_subscription.tpl b/templates/confirm_newsletter_subscription.tpl
index 6ef9f2e..6b1f848 100644
--- a/templates/confirm_newsletter_subscription.tpl
+++ b/templates/confirm_newsletter_subscription.tpl
@@ -1,10 +1,9 @@
-{tr}Somebody or you tried to subscribe this email address at our site:{/tr} {$server_name}
+{tr}A request has been made to subscribe this email address to the newsletter:{/tr} {$gContent->getTitle()}
-{tr}To the newsletter:{/tr} {$info.title|escape}
+{$gContent->getField('data')}
-{tr}Description:{/tr}
-{$info.description}
+{tr}You can read{/tr} {$gContent->getTitle()} {tr}online by visiting:{/tr}
+{$smarty.const.NEWSLETTERS_PKG_URI}edition.php?nl_id={$gContent->mNewsletterId}
-{tr}In order to confirm your subscription you must access the following URL:{/tr}
-
-{$url_subscribe}?confirm_subscription={$code}
+{tr}To confirm your subscription, please visit the following URL:{/tr}
+{$smarty.const.NEWSLETTERS_PKG_URI}?sub={$sub_code}
diff --git a/templates/edit_edition.tpl b/templates/edit_edition.tpl
index 0c77981..3f71499 100644
--- a/templates/edit_edition.tpl
+++ b/templates/edit_edition.tpl
@@ -34,6 +34,21 @@
{/forminput}
</div>
+ {if $gBitUser->hasPermission('p_use_content_templates') && $templates}
+ <div class="row">
+ {formlabel label="Template" for=""}
+ {forminput}
+ <select name="template_id" onchange="javascript:document.getElementById('editpageform').submit();">
+ <option value="0">{tr}none{/tr}</option>
+ {section name=ix loop=$templates}
+ <option value="{$templates[ix].template_id|escape}">{$templates[ix].name}</option>
+ {/section}
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+
{include file="bitpackage:liberty/edit_services_inc.tpl serviceFile=content_edit_mini_tpl}
<div class="row">
@@ -70,7 +85,7 @@
{include file="bitpackage:quicktags/quicktags_full.tpl"}
{/if}
<div class="row">
- {formlabel label="Body" for="body"}
+ {formlabel label="Body" for=$textarea_id}
{forminput}
<textarea {spellchecker} id="{$textarea_id}" name="edit" rows="{$rows|default:20}" cols="{$cols|default:50}">{$pageInfo.data|escape:html}</textarea>
{/forminput}
diff --git a/templates/edit_newsletter.tpl b/templates/edit_newsletter.tpl
index 2eb4116..affdf5e 100644
--- a/templates/edit_newsletter.tpl
+++ b/templates/edit_newsletter.tpl
@@ -53,7 +53,7 @@
{formhelp note="Append instructions on how to subscribe / unsubscribe to ever outgoing newsletter. This is only useful when users can un / subscribe to the list themselves."}
{/forminput}
</div>
-{*
+
<div class="row">
{formlabel label="Validate e-mail Addresses" for="validate_addr"}
{forminput}
@@ -61,7 +61,7 @@
{formhelp note="Validate all email addresses before they are added to the list. This might result in members not being added despite working email addresses."}
{/forminput}
</div>
-*}
+
<div class="row submit">
<input type="submit" name="cancel" value="{tr}Cancel{/tr}" />
<input type="submit" name="save" value="{tr}Save{/tr}" />
diff --git a/templates/list_editions_inc.tpl b/templates/list_editions_inc.tpl
index ca2c291..721f22a 100644
--- a/templates/list_editions_inc.tpl
+++ b/templates/list_editions_inc.tpl
@@ -9,7 +9,7 @@
<h2><a href="{$ed.display_url}">{$ed.title|escape}</a></h2>
<p>
- {$ed.data|truncate:200:'...'}
+ {$ed.parsed|truncate:200:'...'}
<br />
{tr}in{/tr} <a href="{$smarty.const.NEWSLETTERS_PKG_URL}?nl_content_id={$ed.nl_content_id}">{$ed.newsletter_title}</a>
</p>
diff --git a/templates/menu_newsletters.tpl b/templates/menu_newsletters.tpl
index 2c03b00..7eaf4dc 100644
--- a/templates/menu_newsletters.tpl
+++ b/templates/menu_newsletters.tpl
@@ -1,9 +1,9 @@
{strip}
<ul>
- <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}index.php">{tr}Newsletter Subscriptions{/tr}</a></li>
- <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}newsletters.php">{tr}List Newsletters{/tr}</a></li>
+ <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}index.php">{tr}List Newsletters{/tr}</a></li>
{if $gBitUser->hasPermission( 'p_newsletters_create' )}
- <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}newsletters.php?new=1">{tr}Create Newsletter{/tr}</a></li>
+ <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletters.php">{tr}Admin Newsletters{/tr}</a></li>
+ <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletters.php?new=1">{tr}Create Newsletter{/tr}</a></li>
{/if}
<li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}edition.php">{tr}List Editions{/tr}</a></li>
{if $gBitUser->hasPermission( 'p_newsletters_create_editions' )}
diff --git a/templates/newsletter_byebye.tpl b/templates/newsletter_byebye.tpl
index 244ac9d..845ccb1 100644
--- a/templates/newsletter_byebye.tpl
+++ b/templates/newsletter_byebye.tpl
@@ -1,6 +1,8 @@
-{tr}Bye bye!{/tr}
-{tr}This email address has been removed to the list of subscriptors of:{/tr}
-{tr}Newsletter:{/tr} {$info.name}
+{tr}This email address has been unsubscribed from:{/tr} {$gContent->getTitle()}
-{tr}Description:{/tr}
-{$info.description} \ No newline at end of file
+{tr}You can reply to this email with any feedback you may have regarding this newsletter.{/tr}
+
+{tr}You can read and re-subscribe to{/tr} {$gContent->getTitle()} {tr}online by visiting:{/tr}
+{$smarty.const.NEWSLETTERS_PKG_URI}?nl_id={$gContent->mNewsletterId}
+
+{tr}Thank you{/tr}
diff --git a/templates/newsletter_welcome.tpl b/templates/newsletter_welcome.tpl
index bb87988..f379e09 100644
--- a/templates/newsletter_welcome.tpl
+++ b/templates/newsletter_welcome.tpl
@@ -1,10 +1,11 @@
-{tr}Welcome to our newsletter!{/tr}
-{tr}This email address has been added to the list of subscriptors of:{/tr}
-{tr}Newsletter:{/tr} {$info.name}
+{tr}Welcome to{/tr} {$gContent->getTitle()} {tr}newsletter!{/tr}
-{tr}Description:{/tr}
-{$info.description}
+{$gContent->getField('data')}
-{tr}You can always cancel your subscription using:{/tr}
+{tr}This email address has been added to the list of subscribers.{/tr}
+
+{tr}You can read{/tr} {$gContent->getTitle()} {tr}online by visiting:{/tr}
+{$smarty.const.NEWSLETTERS_PKG_URI}edition.php?nl_id={$gContent->mNewsletterId}
-{$url_subscribe}?unsubscribe={$code} \ No newline at end of file
+{tr}You can always cancel your subscription using:{/tr}
+{$smarty.const.NEWSLETTERS_PKG_URI}?unsubscribe={$sub_code}
diff --git a/templates/newsletters.tpl b/templates/newsletters.tpl
index 52a5893..b5f0f94 100644
--- a/templates/newsletters.tpl
+++ b/templates/newsletters.tpl
@@ -5,72 +5,74 @@
</div>
<div class="body">
+ {if $confirm eq 'y'}
+ {formfeedback success="Subscription Confirmed!"}
+ {/if}
{formfeedback hash=$feedback}
+ {if $subscribe eq 'y'}
+ <h2>{tr}Subscribe to Newsletter{/tr}</h2>
+ <div class="row">
+ {formlabel label="Name" for=""}
+ {forminput}
+ {$gContent->getTitle()}
+ {/forminput}
+ </div>
- {if $gContent->isValid()}
- {if $confirm eq 'y'}
- {formfeedback success="Subscription Confirmed!"}
- {/if}
+ <div class="row">
+ {formlabel label="Description" for=""}
+ {forminput}
+ {$gContent->parseData()}
+ {/forminput}
+ </div>
+ {if ($gContent->getField('allow_user_sub') eq 'y') or $gBitUser->hasPermission( 'p_newsletters_subscribe' )}
+ {form}
+ <input type="hidden" name="nl_id" value="{$gContent->mNewsletterId}" />
<div class="row">
- {formlabel label="Name" for=""}
+ {formlabel label="Email" for=""}
{forminput}
- {$gContent->getTitle()}
+ {if $gBitUser->hasPermission( 'p_newsletters_subscribe_email' )}
+ <input type="text" name="email" value="{$email|escape}" />
+ {else}
+ <input type="hidden" name="email" value="{$email|escape}" />
+ {$email|escape}
+ {/if}
{/forminput}
</div>
-
- <div class="row">
- {formlabel label="Description" for=""}
+ <div class="row submit">
{forminput}
- {$gContent->parseData()}
+ <input type="submit" name="subscribe" value="{tr}Subscribe{/tr}" />
+ <input type="submit" name="unsubscribe" value="{tr}Unsubscribe{/tr}" />
{/forminput}
</div>
+ {/form}
+ {/if}
+ {/if}
- {if ($gContent->mInfo.allow_user_sub eq 'y') or $gBitUser->hasPermission( 'p_newsletters_subscribe' )}
- {form}
- <input type="hidden" name="nl_id" value="{$gContent->mNewsletterId}" />
- <div class="row">
- {formlabel label="Email" for=""}
- {forminput}
- {if $gBitUser->hasPermission( 'p_newsletters_subscribe_email' )}
- <input type="text" name="email" value="{$email|escape}" />
- {else}
- <input type="hidden" name="email" value="{$email|escape}" />
- {$email|escape}
- {/if}
- {/forminput}
- </div>
- <div class="row submit">
- {forminput}
- <input type="submit" name="cancel" value="{tr}Cancel{/tr}" />
- <input type="submit" name="subscribe" value="{tr}Subscribe{/tr}" />
- {/forminput}
- </div>
- {/form}
- {/if}
- {else}
-
- {minifind}
+ {minifind}
- <table class="data">
- <caption>{tr}Newsletters{/tr}</caption>
- <tr>
- <th>{smartlink ititle="Name" isort=name offset=$offset idefault=1}</th>
- <th>{smartlink ititle="Description" isort=descritpion offset=$offset}</th>
- </tr>
- {foreach from=$newsletters item=nl key=nlId}
- {if $newsletters.individual ne 'y' or $newsletters.individual_bit_p_subscribe_newsletters eq 'y'}
- <tr class="{cycle values='odd,even'}">
- <td><a href="{$smarty.const.NEWSLETTERS_PKG_URL}index.php?nl_id={$nl.nl_id}">{$nl.title|escape}</a></td>
- <td>{$nl.data}</td>
- </tr>
- {/if}
- {foreachelse}
- <tr class="norecords">
- <td colspan="2">{tr}No Records Found{/tr}</td>
+ <table class="data">
+ <caption>{tr}Newsletters{/tr}</caption>
+ <tr>
+ <th>{smartlink ititle="Name" isort=name offset=$offset idefault=1}</th>
+ <th>{smartlink ititle="Description" isort=descritpion offset=$offset idefault=1}</th>
+ <th>{tr}Subscribe{/tr}</th>
+ <th>{tr}Editions{/tr}</th>
+ </tr>
+ {foreach from=$newsletters item=nl}
+ {if $newsletters.individual ne 'y' or $newsletters.individual_bit_p_subscribe_newsletters eq 'y'}
+ <tr class="{cycle values='odd,even'}">
+ <td>{$nl.title|escape}</td>
+ <td>{$nl.data}</td>
+ <td><a href="{$smarty.const.NEWSLETTERS_PKG_URL}index.php?nl_id={$nl.nl_id}&amp;info=1">{tr}Subscribe{/tr}</a></td>
+ <td><a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition.php?nl_id={$nl.nl_id}">{tr}Editions{/tr}</a></td>
</tr>
- {/foreach}
- </table>
- {/if}
+ {/if}
+ {foreachelse}
+ <tr class="norecords">
+ <td colspan="2">{tr}No Records Found{/tr}</td>
+ </tr>
+ {/foreach}
+ </table>
{* haven't dealt with pagination yet *}
{pagination}
diff --git a/templates/send_newsletters.tpl b/templates/send_newsletters.tpl
index 4fb40b5..6a320e7 100644
--- a/templates/send_newsletters.tpl
+++ b/templates/send_newsletters.tpl
@@ -20,6 +20,7 @@
{if $smarty.request.emited eq 'y'}
{tr}The newsletter was sent to {$sent} email addresses{/tr}
{elseif $smarty.request.preview}
+ <input type="hidden" name="validated" value="{$validated}" />
{jstabs}
{jstab title="Preview Newsletter"}
{legend legend="Preview Newsletter"}
@@ -38,7 +39,7 @@
{forminput}
<ol>
{foreach from=$recipientList item=recipient key=email}
- <li>{$recipient.login} &nbsp; <small>&lt;{$email}&gt;</small></li>
+ <li>{$recipient.login} &nbsp; &lt;{$email}&gt;</li>
{/foreach}
</ol>
{/forminput}
@@ -63,6 +64,13 @@
{/forminput}
</div>
+ <div class="row">
+ {formlabel label="Only send to validated emails"}
+ {forminput}
+ <input type="checkbox" name="validated" "checked" />
+ {/forminput}
+ </div>
+
<div class="row submit">
<input type="submit" name="preview" value="{tr}Preview{/tr}" />
</div>
diff --git a/templates/unsubscribe_inc.tpl b/templates/unsubscribe_inc.tpl
index 2900d44..b059537 100644
--- a/templates/unsubscribe_inc.tpl
+++ b/templates/unsubscribe_inc.tpl
@@ -1,2 +1,2 @@
-{tr}You have received this message because you are registered at{/tr} <a href="{$smarty.const.BIT_ROOT_URL}">{$gBitSystem->getConfig('siteTitle', $smarty.server.HTTP_HOST)}</a>. {tr}You can always cancel your subscription using:{/tr}<br/>
-<a href="{$smarty.const.NEWSLETTERS_PKG_URI}?unsubscribe={$code}">{$smarty.const.NEWSLETTERS_PKG_URI}?sub={$url_code}</a>
+<small>{tr}You have received this message because you are registered at{/tr} <a href="{$smarty.const.BIT_BASE_URI}">{$gBitSystem->getConfig('siteTitle', $smarty.const.BIT_BASE_URI)}</a>.<br />{tr}You can always cancel your subscription using:{/tr}<br/>
+<a href="{$smarty.const.NEWSLETTERS_PKG_URI}?unsubscribe={$url_code}">{$smarty.const.NEWSLETTERS_PKG_URI}?unsubscribe={$url_code}</a></small>
diff --git a/templates/view_edition.tpl b/templates/view_edition.tpl
index 748af28..a03a463 100644
--- a/templates/view_edition.tpl
+++ b/templates/view_edition.tpl
@@ -3,13 +3,13 @@
<div class="floaticon">
{include file="bitpackage:liberty/services_inc.tpl" serviceLocation='icon'}
- {if $gContent->isOwner() || $gBitUser->hasPermission( 'p_newsletters_admin' )}
- <a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition_edit.php?edition_id={$gContent->mEditionId}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
- <a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition.php?edition_id={$gContent->mEditionId}&amp;remove=1">{biticon ipackage=liberty iname="delete" iexplain="delete"}</a>
- {/if}
{if $gBitUser->hasPermission('p_newsletters_admin')}
<a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/send.php?edition_id={$gContent->mEditionId}">{biticon ipackage=liberty iname="mail_send" iexplain="email this post"}</a>
{/if}
+ {if $gContent->isOwner() || $gBitUser->hasPermission( 'bit_p_admin_newsletters' )}
+ <a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition_edit.php?edition_id={$gContent->mEditionId}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
+ <a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition.php?edition_id={$gContent->mEditionId}&amp;remove=1">{biticon ipackage=liberty iname="delete" iexplain="delete"}</a>
+ {/if}
</div>
{/if}