summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-12-09 15:55:46 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-12-09 15:55:46 +0000
commit8b0ca62c70b5de9c9d3040990c5e33116c38a287 (patch)
tree3306584a25fcfb6cd1326a127ecee1bd773d920d /index.php
parent3cece5f0ebd513efdd16c7255c8c5ff1fb1714e1 (diff)
downloadnewsletters-8b0ca62c70b5de9c9d3040990c5e33116c38a287.tar.gz
newsletters-8b0ca62c70b5de9c9d3040990c5e33116c38a287.tar.bz2
newsletters-8b0ca62c70b5de9c9d3040990c5e33116c38a287.zip
first crack at cleaning up some tw code
Diffstat (limited to 'index.php')
-rw-r--r--index.php38
1 files changed, 15 insertions, 23 deletions
diff --git a/index.php b/index.php
index e1c1be3..26b8cd7 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_newsletters/index.php,v 1.2 2005/12/09 07:04:16 spiderr Exp $
+// $Header: /cvsroot/bitweaver/_bit_newsletters/index.php,v 1.3 2005/12/09 15:55:45 squareing 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.
@@ -16,23 +16,16 @@ if( $gBitSystem->isPackageActive( 'webmail' ) ) {
$gBitSystem->verifyPackage( 'newsletters' );
$gBitSmarty->assign('confirm', 'n');
-if (isset($_REQUEST["confirm_subscription"])) {
- $conf = $nllib->confirm_subscription($_REQUEST["confirm_subscription"]);
-
- if ($conf) {
- $gBitSmarty->assign('confirm', 'y');
- $gBitSmarty->assign('nl_info', $conf);
+if( isset( $_REQUEST["confirm_subscription"] ) ) {
+ if( $conf = $nllib->confirm_subscription( $_REQUEST["confirm_subscription"] ) ) {
+ $gBitSmarty->assign( 'confirm', 'y' );
+ $gBitSmarty->assign( 'nl_info', $conf );
}
}
-$gBitSmarty->assign('unsub', 'n');
-
-if (isset($_REQUEST["unsubscribe"])) {
- $conf = $nllib->unsubscribe($_REQUEST["unsubscribe"]);
-
- if ($conf) {
- $gBitSmarty->assign('unsub', 'y');
-
+if( isset( $_REQUEST["unsubscribe"] ) ) {
+ if( $conf = $nllib->unsubscribe( $_REQUEST["unsubscribe"] ) ) {
+ $feedback['success'] = tra( "Your email address was removed from the list of subscriptors." );
$gBitSmarty->assign('nl_info', $conf);
}
}
@@ -42,9 +35,7 @@ if( !$gBitUser->isRegistered() && !$gBitUser->hasPermission( 'bit_p_subscribe_ne
}
require_once( NEWSLETTERS_PKG_PATH.'lookup_newsletter_inc.php' );
-
-$gBitSmarty->assign('subscribe', 'n');
-$gBitSmarty->assign('subscribed', 'n');
+$feedback = array();
$foo = parse_url($_SERVER["REQUEST_URI"]);
$gBitSmarty->assign('url_subscribe', httpPrefix(). $foo["path"]);
@@ -55,8 +46,8 @@ $gBitSmarty->assign('email', $user_email);
if( isset( $_REQUEST["subscribe"] ) ) {
$gBitSystem->verifyPermission( 'bit_p_subscribe_newsletters' );
- $gBitSmarty->assign('subscribed', 'y');
-
+ $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." );
+
if( !$gBitUser->hasPermission( 'tiki_p_subscribe_email' ) ) {
$_REQUEST["email"] = $gBitUser->mInfo['email'];
}
@@ -65,11 +56,11 @@ if( isset( $_REQUEST["subscribe"] ) ) {
$nllib->newsletter_subscribe( $_REQUEST["nl_id"], $_REQUEST["email"] );
}
-if (isset($_REQUEST["info"])) {
+if( isset( $_REQUEST["info"] ) ) {
$nl_info = $nllib->get_newsletter($_REQUEST["nl_id"]);
- $gBitSmarty->assign('nl_info', $nl_info);
- $gBitSmarty->assign('subscribe', 'y');
+ $gBitSmarty->assign( 'nl_info', $nl_info );
+ $gBitSmarty->assign( 'subscribe', 'y' );
}
/* List newsletters */
$listHash = array();
@@ -114,6 +105,7 @@ if( $listHash['offset'] > 0) {
}
$gBitSmarty->assign_by_ref('channels', $channels["data"]);
+$gBitSmarty->assign( 'feedback', $feedback);
// Display the template
$gBitSystem->display( 'bitpackage:newsletters/newsletters.tpl');