<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2007 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
'admin/newsletter' => $this->make_hook('admin_nl', AUTH_MDP, 'admin'),
'admin/newsletter/categories' => $this->make_hook('admin_nl_cat', AUTH_MDP, 'admin'),
'admin/newsletter/edit' => $this->make_hook('admin_nl_edit', AUTH_MDP, 'admin'),
- );
- }
- function on_subscribe($forlife, $uid, $promo, $password)
- {
- require_once 'newsletter.inc.php';
- subscribe_nl($uid);
+ 'ax' => $this->make_hook('ax', AUTH_COOKIE),
+ 'ax/show' => $this->make_hook('ax_show', AUTH_COOKIE),
+ 'ax/submit' => $this->make_hook('ax_submit', AUTH_MDP),
+ 'ax/edit' => $this->make_hook('ax_submit', AUTH_MDP),
+ 'admin/axletter/rights' => $this->make_hook('admin_ax_rights', AUTH_MDP, 'admin'),
+ );
}
function handler_nl(&$page, $action = null)
$page->assign('xorg_title','Polytechnique.org - Lettres mensuelles');
switch ($action) {
- case 'out': unsubscribe_nl(); break;
- case 'in': subscribe_nl(); break;
+ case 'out': Newsletter::unsubscribe(); break;
+ case 'in': Newsletter::subscribe(); break;
default: ;
}
- $page->assign('nls', get_nl_state());
- $page->assign('nl_list', get_nl_list());
+ $page->assign('nls', Newsletter::subscriptionState());
+ $page->assign('nl_list', Newsletter::listSent());
}
function handler_nl_show(&$page, $nid = 'last')
require_once("newsletter.inc.php");
if($new) {
- insert_new_nl();
- pl_redirect("admin/newsletter");
+ Newsletter::create();
+ pl_redirect("admin/newsletter");
}
- $page->assign('nl_list', get_nl_slist());
+ $page->assign('nl_list', Newsletter::listAll());
}
function handler_admin_nl_edit(&$page, $nid = 'last', $aid = null, $action = 'edit') {
$table_editor->describe('titre','intitulé',true);
$table_editor->describe('pos','position',true);
$table_editor->apply($page, $action, $id);
- }
-
+ }
+
+ function handler_ax(&$page, $action = null)
+ {
+ require_once 'newsletter.inc.php';
+
+ $page->changeTpl('newsletter/ax.tpl');
+ $page->assign('xorg_title','Polytechnique.org - Envois de l\'AX');
+
+ switch ($action) {
+ case 'out': AXLetter::unsubscribe(); break;
+ case 'in': AXLetter::subscribe(); break;
+ default: ;
+ }
+
+ $perm = AXLetter::hasPerms();
+ if ($perm) {
+ $waiting = AXLetter::awaiting();
+ if ($waiting) {
+ $new = new AXLetter($waiting);
+ $page->assign('new', $new);
+ }
+ }
+ $page->assign('axs', AXLetter::subscriptionState());
+ $page->assign('ax_list', AXLetter::listSent());
+ $page->assign('ax_rights', AXLetter::hasPerms());
+ }
+
+ function handler_ax_submit(&$page)
+ {
+ require_once('newsletter.inc.php');
+ if (!AXLetter::hasPerms()) {
+ return PL_FORBIDDEN;
+ }
+ }
}
?>