projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updates fusionax scripts for better compliance and to get them working right.
[platal.git]
/
modules
/
newsletter.php
diff --git
a/modules/newsletter.php
b/modules/newsletter.php
index
5cee6b7
..
9dfe318
100644
(file)
--- a/
modules/newsletter.php
+++ b/
modules/newsletter.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-200
6
Polytechnique.org *
+ * Copyright (C) 2003-200
8
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-33,27
+33,21
@@
class NewsletterModule extends PLModule
);
}
);
}
- function on_subscribe($forlife, $uid, $promo, $password)
- {
- require_once 'newsletter.inc.php';
- subscribe_nl($uid);
- }
-
function handler_nl(&$page, $action = null)
{
require_once 'newsletter.inc.php';
$page->changeTpl('newsletter/index.tpl');
function handler_nl(&$page, $action = null)
{
require_once 'newsletter.inc.php';
$page->changeTpl('newsletter/index.tpl');
- $page->
assign('xorg_title','Polytechnique.org -
Lettres mensuelles');
+ $page->
setTitle('
Lettres mensuelles');
switch ($action) {
switch ($action) {
- case 'out':
unsubscribe_nl
(); break;
- case 'in':
subscribe_nl
(); break;
+ case 'out':
Newsletter::unsubscribe
(); break;
+ case 'in':
Newsletter::subscribe
(); break;
default: ;
}
default: ;
}
- $page->assign('nls',
get_nl_s
tate());
- $page->assign('nl_list',
get_nl_lis
t());
+ $page->assign('nls',
Newsletter::subscriptionS
tate());
+ $page->assign('nl_list',
Newsletter::listSen
t());
}
function handler_nl_show(&$page, $nid = 'last')
}
function handler_nl_show(&$page, $nid = 'last')
@@
-63,12
+57,17
@@
class NewsletterModule extends PLModule
require_once 'newsletter.inc.php';
$nl = new NewsLetter($nid);
require_once 'newsletter.inc.php';
$nl = new NewsLetter($nid);
- $page->assign_by_ref('nl', $nl);
-
+ if (Get::has('text')) {
+ $nl->toText($page, S::v('prenom'), S::v('nom'), S::v('femme'));
+ } else {
+ $nl->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme'));
+ }
if (Post::has('send')) {
if (Post::has('send')) {
+ $res = XDB::query("SELECT hash FROM newsletter_ins WHERE user_id = {?}", S::i('uid'));
$nl->sendTo(S::v('prenom'), S::v('nom'),
S::v('bestalias'), S::v('femme'),
$nl->sendTo(S::v('prenom'), S::v('nom'),
S::v('bestalias'), S::v('femme'),
- S::v('mail_fmt') != 'texte');
+ S::v('mail_fmt') != 'texte',
+ $res->fetchOneCell());
}
}
}
}
@@
-77,8
+76,13
@@
class NewsletterModule extends PLModule
$page->changeTpl('newsletter/submit.tpl');
require_once 'newsletter.inc.php';
$page->changeTpl('newsletter/submit.tpl');
require_once 'newsletter.inc.php';
+ $wp = new PlWikiPage('Xorg.LettreMensuelle');
+ $wp->buildCache();
- if (Post::has('see')) {
+ if (Post::has('see') || (Post::has('valid') && (!trim(Post::v('title')) || !trim(Post::v('body'))))) {
+ if (!Post::has('see')) {
+ $page->trigError("L'article doit avoir un titre et un contenu");
+ }
$art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
$page->assign('art', $art);
} elseif (Post::has('valid')) {
$art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
$page->assign('art', $art);
} elseif (Post::has('valid')) {
@@
-88,33
+92,35
@@
class NewsletterModule extends PLModule
$art->submit();
$page->assign('submited', true);
}
$art->submit();
$page->assign('submited', true);
}
+ $page->addCssLink('nl.css');
}
function handler_admin_nl(&$page, $new = false) {
$page->changeTpl('newsletter/admin.tpl');
}
function handler_admin_nl(&$page, $new = false) {
$page->changeTpl('newsletter/admin.tpl');
- $page->
assign('xorg_title','Polytechnique.org -
Administration - Newsletter : liste');
+ $page->
setTitle('
Administration - Newsletter : liste');
require_once("newsletter.inc.php");
require_once("newsletter.inc.php");
-
+
if($new) {
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') {
$page->changeTpl('newsletter/edit.tpl');
function handler_admin_nl_edit(&$page, $nid = 'last', $aid = null, $action = 'edit') {
$page->changeTpl('newsletter/edit.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Edition');
+ $page->addCssLink('nl.css');
+ $page->setTitle('Administration - Newsletter : Edition');
require_once("newsletter.inc.php");
require_once("newsletter.inc.php");
-
+
$nl = new NewsLetter($nid);
$nl = new NewsLetter($nid);
-
+
if($action == 'delete') {
$nl->delArticle($aid);
pl_redirect("admin/newsletter/edit/$nid");
}
if($action == 'delete') {
$nl->delArticle($aid);
pl_redirect("admin/newsletter/edit/$nid");
}
-
+
if($aid == 'update') {
$nl->_title = Post::v('title');
$nl->_title_mail= Post::v('title_mail');
if($aid == 'update') {
$nl->_title = Post::v('title');
$nl->_title_mail= Post::v('title_mail');
@@
-124,18
+130,18
@@
class NewsletterModule extends PLModule
if (preg_match('/^[-a-z0-9]*$/i', $nl->_shortname) && !is_numeric($nl->_shortname)) {
$nl->save();
} else {
if (preg_match('/^[-a-z0-9]*$/i', $nl->_shortname) && !is_numeric($nl->_shortname)) {
$nl->save();
} else {
- $page->trig('Le nom de la NL n\'est pas valide');
+ $page->trig
Error
('Le nom de la NL n\'est pas valide');
pl_redirect('admin/newsletter/edit/' . $nl->_id);
}
}
pl_redirect('admin/newsletter/edit/' . $nl->_id);
}
}
-
+
if(Post::v('save')) {
$art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'),
$aid, Post::v('cid'), Post::v('pos'));
$nl->saveArticle($art);
pl_redirect("admin/newsletter/edit/$nid");
}
if(Post::v('save')) {
$art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'),
$aid, Post::v('cid'), Post::v('pos'));
$nl->saveArticle($art);
pl_redirect("admin/newsletter/edit/$nid");
}
-
+
if($action == 'edit' && $aid != 'update') {
$eaid = $aid;
if(Post::has('title')) {
if($action == 'edit' && $aid != 'update') {
$eaid = $aid;
if(Post::has('title')) {
@@
-146,19
+152,19
@@
class NewsletterModule extends PLModule
}
$page->assign('art', $art);
}
}
$page->assign('art', $art);
}
-
+
$page->assign_by_ref('nl',$nl);
}
function handler_admin_nl_cat(&$page, $action = 'list', $id = null) {
$page->assign_by_ref('nl',$nl);
}
function handler_admin_nl_cat(&$page, $action = 'list', $id = null) {
- $page->
assign('xorg_title','Polytechnique.org - Administration - Newsletter : Caté
gories');
- $page->assign('title', 'Gestion des cat
é
gories de la newsletter');
+ $page->
setTitle('Administration - Newsletter : Caté
gories');
+ $page->assign('title', 'Gestion des cat
é
gories de la newsletter');
$table_editor = new PLTableEditor('admin/newsletter/categories','newsletter_cat','cid');
$table_editor = new PLTableEditor('admin/newsletter/categories','newsletter_cat','cid');
- $table_editor->describe('titre','intitul
é
',true);
+ $table_editor->describe('titre','intitul
é
',true);
$table_editor->describe('pos','position',true);
$table_editor->apply($page, $action, $id);
$table_editor->describe('pos','position',true);
$table_editor->apply($page, $action, $id);
- }
-
+ }
}
}
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
?>