Esempio n. 1
0
 * @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) {
Esempio n. 2
0
}
$data = array();
if ($preferences->pref_mail_method == Core\Mailing::METHOD_DISABLED && !GALETTE_MODE === 'DEMO') {
    $hist->add(_T("Trying to load mailing while mail is disabled in preferences."));
} else {
    if (isset($session['filters']['members'])) {
        $filters = unserialize($session['filters']['members']);
    } else {
        $filters = new MembersList();
    }
    if (isset($session['mailing']) && !isset($_POST['mailing_cancel']) && !isset($_GET['from']) && !isset($_GET['reset'])) {
        $mailing = unserialize($session['mailing']);
    } else {
        if (isset($_GET['from']) && is_numeric($_GET['from'])) {
            $mailing = new Core\Mailing(null, $_GET['from']);
            Core\MailingHistory::loadFrom((int) $_GET['from'], $mailing);
        } else {
            if (isset($_GET['reminder'])) {
                //FIXME: use a constant!
                $filters->reinit();
                $filters->membership_filter = Members::MEMBERSHIP_LATE;
                $filters->account_status_filter = Members::ACTIVE_ACCOUNT;
                $m = new Members($filters);
                $members = $m->getList(true);
                $mailing = new Core\Mailing($members !== false ? $members : null);
            } else {
                if (count($filters->selected) == 0 && !isset($_GET['mailing_new']) && !isset($_GET['reminder'])) {
                    Analog::log('[mailing_adherents.php] No member selected for mailing', Analog::WARNING);
                    if (isset($profiler)) {
                        $profiler->stop();
                    }