<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
require_once 'newsletter.inc.php';
- $nl = new NewsLetter($nid);
- 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')) {
- $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'),
- S::v('mail_fmt') != 'texte',
- $res->fetchOneCell());
+ try {
+ $nl = new NewsLetter($nid);
+ $user =& S::user();
+ if (Get::has('text')) {
+ $nl->toText($page, $user);
+ } else {
+ $nl->toHtml($page, $user);
+ }
+ if (Post::has('send')) {
+ $nl->sendTo($user);
+ }
+ } catch (MailNotFound $e) {
+ return PL_NOT_FOUND;
}
}
$page->assign('art', $art);
} elseif (Post::has('valid')) {
require_once('validations.inc.php');
- $art = new NLReq(S::v('uid'), Post::v('title'),
+ $art = new NLReq(S::user(), Post::v('title'),
Post::v('body'), Post::v('append'));
$art->submit();
$page->assign('submited', true);