* @since     Available since 0.7dev - 2011-08-28
 */
use Analog\Analog;
use Galette\Core\Mailing;
use Galette\Core\MailingHistory;
require_once 'includes/galette.inc.php';
if (!$login->isLogged() || !$login->isAdmin() && !$login->isStaff()) {
    Analog::log('Trying to display ajax_mailing_preview.php without appropriate permissions', Analog::INFO);
    die;
}
// check for ajax mode
$ajax = isset($_POST['ajax']) && $_POST['ajax'] == 'true' ? true : false;
$mailing = null;
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $mailing = new Mailing(null);
    MailingHistory::loadFrom((int) $_GET['id'], $mailing, false);
    $tpl->assign('attachments_files', $mailing->attachments);
} else {
    $mailing = unserialize($session['mailing']);
    $mailing->subject = $_POST['subject'];
    $mailing->message = $_POST['body'];
    $mailing->html = $_POST['html'] === 'true';
    $tpl->assign('attachments', $_POST['attachments']);
}
$tpl->assign('mailing_sender', $preferences->pref_email_nom . ' <' . $preferences->pref_email . '>');
//Set the path to the current plugin's templates,
//but backup main Galette's template path before
$tpl->assign('ajax', $ajax);
$tpl->assign('mailing', $mailing);
$tpl->assign('recipients', $mailing->recipients);
if ($ajax) {
Beispiel #2
0
 */
require_once 'includes/galette.inc.php';
if (!$login->isLogged()) {
    header('location: index.php');
    die;
}
if (!$login->isAdmin() && !$login->isStaff()) {
    header('location: voir_adherent.php');
    die;
}
use Galette\Core;
$mailhist = new Core\MailingHistory();
if (isset($_GET['reset']) && $_GET['reset'] == 1) {
    $mailhist->clean();
    //reinitialize object after flush
    $mailhist = new Core\MailingHistory();
}
//delete mailings
if (isset($_GET['sup']) || isset($_POST['delete'])) {
    if (isset($_GET['sup'])) {
        $mailhist->removeEntries($_GET['sup']);
    } else {
        if (isset($_POST['member_sel'])) {
            $mailhist->removeEntries($_POST['member_sel']);
        }
    }
}
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $mailhist->current_page = (int) $_GET['page'];
}
if (isset($_GET['nbshow']) && is_numeric($_GET['nbshow'])) {
     }
 }
 if (isset($_GET['remove_attachment'])) {
     $mailing->removeAttachment($_GET['remove_attachment']);
 }
 if ($mailing->current_step !== Core\Mailing::STEP_SENT) {
     $session['mailing'] = serialize($mailing);
 }
 /** TODO: replace that... */
 $session['labels'] = $mailing->unreachables;
 if (!isset($_POST['html_editor_active']) || trim($_POST['html_editor_active']) == '') {
     $_POST['html_editor_active'] = $preferences->pref_editor_enabled;
 }
 if (isset($_POST['mailing_save'])) {
     //user requested to save the mailing
     $histo = new Core\MailingHistory($mailing);
     if ($histo->storeMailing() !== false) {
         $success_detected[] = _T("Mailing has been successfully saved.");
         $tpl->assign('mailing_saved', true);
         $session['mailing'] = null;
         unset($session['mailing']);
         $head_redirect = array('timeout' => 30, 'url' => 'gestion_mailings.php');
         $tpl->assign('head_redirect', $head_redirect);
     }
 }
 $tpl->assign('success_detected', $success_detected);
 $tpl->assign('warning_detected', $warning_detected);
 $tpl->assign('error_detected', $error_detected);
 $tpl->assign('mailing', $mailing);
 $tpl->assign('html_editor', true);
 $tpl->assign('html_editor_active', $_POST['html_editor_active']);