Пример #1
0
 * @subpackage modules
 * @filesource
 */
include_once 'kernel/common/template.php';
$module = $Params["Module"];
$http = eZHTTPTool::instance();
$editionSendHash = $Params['EditionSendHash'];
$outputFormatId = 0;
$subscriptionHash = false;
$newsletterUser = null;
if ($Params['OutputFormatId']) {
    $outputFormatId = (int) $Params['OutputFormatId'];
}
if ($Params['SubscriptionHash']) {
    $subscriptionHash = $Params['SubscriptionHash'];
    $subscription = CjwNewsletterSubscription::fetchByHash($subscriptionHash);
    if ($subscription) {
        $newsletterUser = CjwNewsletterUser::fetch($subscription->attribute('newsletter_user_id'));
    }
}
$editionSendObject = CjwNewsletterEditionSend::fetchByHash($editionSendHash);
if (!is_object($editionSendObject)) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$newsletterDataArray = $editionSendObject->getParsedOutputXml();
$newsletterContent = false;
if (isset($newsletterDataArray[$outputFormatId])) {
    $newsletterContentArray = $newsletterDataArray[$outputFormatId];
}
switch ($outputFormatId) {
    // html
Пример #2
0
/**
 * File unsubscribe.php
 *
 * @copyright Copyright (C) 2007-2012 CJW Network - Coolscreen.de, JAC Systeme GmbH, Webmanufaktur. All rights reserved.
 * @license http://ez.no/licenses/gnu_gpl GNU GPL v2
 * @version //autogentag//
 * @package cjw_newsletter
 * @subpackage modules
 * @filesource
 */
require_once 'kernel/common/i18n.php';
include_once 'kernel/common/template.php';
$module = $Params['Module'];
$http = eZHTTPTool::instance();
$tpl = templateInit();
$subscription = CjwNewsletterSubscription::fetchByHash($Params['Hash']);
if (!$subscription) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$newsletterUser = $subscription->attribute('newsletter_user');
if (!is_object($newsletterUser)) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($newsletterUser->isOnBlacklist()) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($subscription->isRemoved()) {
    $tplTemplate = 'design:newsletter/unsubscribe_already_done.tpl';
} elseif ($module->isCurrentAction('Unsubscribe')) {
    $unsubscribeResult = $subscription->unsubscribe();
    $tpl->setVariable('unsubscribe_result', $unsubscribeResult);