예제 #1
0
}
require_once NEWSLETTERS_PKG_PATH . 'lookup_newsletter_inc.php';
$feedback = array();
/* List newsletters */
$listHash = array();
$newsletters = $gContent->getList($listHash);
$gBitSmarty->assignByRef('subs', BitNewsletter::getUserSubscriptions($gBitUser->getField('user_id'), $gBitUser->getField('email')));
$gBitSmarty->assignByRef('newsletters', $newsletters);
$foo = parse_url($_SERVER["REQUEST_URI"]);
$gBitSmarty->assign('url_subscribe', httpPrefix() . $foo["path"]);
$subinfo = array();
$unsubs = array();
// We have a url_code from a clicked link in an email
if (isset($_REQUEST['c']) && strlen($_REQUEST['c']) == 32 && ($subInfo = BitNewsletterMailer::lookupSubscription(array('url_code' => $_REQUEST['c'])))) {
} elseif ($gBitUser->isRegistered()) {
    if (!($subInfo = BitNewsletterMailer::lookupSubscription(array('user_id' => $gBitUser->mUserId)))) {
        $subInfo = $gBitUser->mInfo;
    }
}
if (!empty($subInfo['user_id']) && BitBase::verifyId($subInfo['user_id'])) {
    $lookup['user_id'] = $subInfo['user_id'];
} else {
    $lookup['email'] = $subInfo['email'];
}
$unsubs = BitNewsletterMailer::getUnsubscriptions($lookup);
// Update subscriptions
if (isset($_REQUEST["update"])) {
    $subHash['response_content_id'] = $_REQUEST['response_content_id'];
    $subHash['sub_lookup'] = !empty($subInfo['user_id']) ? array('user_id' => $subInfo['user_id']) : array('email' => $subInfo['email']);
    if (!empty($_REQUEST['unsubscribe_all'])) {
        $subHash['unsubscribe_all'] = 'y';
예제 #2
0
/**
 * Copyright (c) 2005 bitweaver.org
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * created 2005/12/10
 *
 * @package newsletters
 * @author spider <*****@*****.**>
 */
/** 
 * Initialization
 */
require_once '../kernel/setup_inc.php';
include_once NEWSLETTERS_PKG_PATH . 'BitNewsletterMailer.php';
if (isset($_REQUEST["sub"]) || $gBitUser->isRegistered()) {
    if (isset($_REQUEST["sub"]) && strlen($_REQUEST["sub"]) == 32 && ($subInfo = BitNewsletterMailer::lookupSubscription(array('url_code' => $_REQUEST["sub"])))) {
        BitNewsletterMailer::trackMail($subInfo['url_code']);
    }
}
// open the file in a binary mode
$trackImage = $gBitSystem->getConfig('newsletter_tracking_image', NEWSLETTERS_PKG_PATH . 'images/track.gif');
if ($fp = fopen($trackImage, 'rb')) {
    // send the right headers
    header("Content-Type: image/png");
    header("Content-Length: " . filesize($trackImage));
    // dump the picture and stop the script
    fpassthru($fp);
}
exit;