diff options
| author | Christian Fowler <spider@viovio.com> | 2006-06-19 02:35:20 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2006-06-19 02:35:20 +0000 |
| commit | 52c3ae75fe0ce196368b98eebb8cb1509eff953b (patch) | |
| tree | 6a2337da5afbc6d92950dd52bf6d0fe6ee205056 /index.php | |
| parent | 5e00826a94b5c5143f481c3a444106243384f6bf (diff) | |
| download | newsletters-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.
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 38 |
1 files changed, 32 insertions, 6 deletions
@@ -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 ); ?> |
