+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2004 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************
- $Id: newsletter_archi.php,v 1.5 2004-08-31 10:03:29 x2000habouzit Exp $
- ***************************************************************************/
-
-require("auto.prepend.inc.php");
-new_admin_table_editor('newsletter','id');
-
-$editor->assign('title', 'Gestion des archives de la newsletter');
-
-$editor->describe('date', 'date', true);
-$editor->describe('titre', 'titre', true);
-$editor->describe('text', 'texte', false, 'textarea');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2004 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************
- $Id: newsletter_prep.php,v 1.4 2004-09-02 23:33:56 x2000bedo Exp $
- ***************************************************************************/
-
-require('auto.prepend.inc.php');
-new_admin_page('admin/newsletter_prep.tpl');
-
-$from = '"Equipe polytechnique.org" <info_newsletter@polytechnique.org>';
-$from_error = 'gld@m4x.org';
-$filename = "/home/web/newsletter/newsletter.cur";
-$lockfile = "/home/web/newsletter/newsletter.lock";
-
-// regarde si le lock est pris ou pas
-$lock = fopen($lockfile,"r+");
-// prend un lock en écriture
-if (!flock($lock, 2)) {
- $page->assign('erreur','Impossible de prendre un lock sur le fichier de lock, pas de fichier ?');
- $page->run('errlock');
-}
-
-$contenu = (isset($_REQUEST['contenu']) ? $_REQUEST['contenu'] : "");
-$sujet = (isset($_REQUEST['sujet']) ? $_REQUEST['sujet'] : "");
-
-$nb = fscanf($lock, "%d %s",$date, $id_lock);
-$is_lock = ($nb != 0);
-$own_lock = false;
-if($is_lock) {
- $own_lock = ($id_lock == $_SESSION['forlife']);
-}
-
-// action si on recoit un formulaire
-$res = true;
-$envoi = false;
-
-if (isset($_REQUEST['submit'])) {
- if($_REQUEST['submit'] == "Prendre un verrou") {
- if($is_lock) {
- $page->assign('action_msg', 'Verrou déjà pris');
- } else {
- fputs($lock,time()." ".$_SESSION['forlife']);
- $is_lock = $own_lock = true;
- } // pas de lock
- } elseif ($_REQUEST['submit'] == "Relacher quand meme"
- || $_REQUEST['submit'] == "Ne pas sauver et relacher le verrou") {
- ftruncate($lock, 0);
- $is_lock = $own_lock = false;
- } elseif ($_REQUEST['submit'] == "Envoi Test") {
- $envoi = true;
- $to = $_REQUEST['test_to'];
- } elseif ($_REQUEST['submit'] == "Envoi Definitif") {
- $envoi = true;
- $to = "newsletter@polytechnique.org";
- } elseif (isset($_REQUEST['contenu'])) {
- $res = false;
- if (!$own_lock) {
- $page->assign('action_msg', 'Pas de verrou, on ne peut pas enregistrer,
- sauvegarde tes modifications avec un copier-coller,
- prends un verrou si possible puis remets tes modifs
- sur la nouvelle version et enregistre');
- } else {
- if (get_magic_quotes_gpc()) {
- $contenu = stripslashes($contenu);
- $contenu = str_replace('\r','',$contenu);
- $sujet = rtrim(stripslashes($sujet));
- }
- if (($fp = fopen($filename, "w")) == -1) {
- $page->assign('action_msg', "Impossible d'ouvrir le fichier $filename");
- } elseif (fwrite($fp, "$sujet\n")) {
- if (fwrite($fp, $contenu)) {
- $res = true;
- } else {
- $page->assign('action_msg', "Impossible d'écrire dans le fichier $filename");
- }
- fclose($fp);
- } else {
- $page->assign('action_msg', "Impossible d'écrire dans le fichier $filename");
- fclose($fp);
- }
- if($_REQUEST['submit'] == "Sauver et relacher le verrou"){
- ftruncate($lock, 0);
- $is_lock = $own_lock = false;
- }
- } // else (!$own_lock)
- }
-} // if ifdef(sumbit)
-
-flock($lock, 3); // relache le verrou
-
-if (!isset($_REQUEST['submit']) or $res) {
- // il n'y a pas eu de submit ou il y a eu un submit et
- // l'ecriture c'est bien passee, on relit le fichier
- $c=file($filename);
- $contenu = '';
- reset($c);
- $sujet = rtrim(current($c));
- while ($line = next($c)) {
- $contenu .= $line;
- }
-}
-
-if ($envoi) {
- require("diogenes.mailer.inc.php");
- $FROM = "From: $from";
- $mymail = new DiogenesMailer($from_error, $to, $sujet, false);
- $mymail->addHeader($FROM);
- $mymail->setBody($contenu);
- $mymail->send();
-}
-
-$page->assign('date_lock',$date);
-$page->assign('own_lock',$own_lock);
-$page->assign('id_lock',$id_lock);
-$page->assign('is_lock',$is_lock);
-
-$page->assign('contenu', $contenu);
-$page->assign('sujet', $sujet);
-$page->run();
-
-?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: index.tpl,v 1.10 2004-10-16 19:54:35 x2000habouzit Exp $
+ $Id: index.tpl,v 1.11 2004-10-16 22:39:35 x2000habouzit Exp $
***************************************************************************}
<strong>Newsletter : </strong>
<a href="newsletter.php">Liste</a> |
<a href="newsletter_cats.php">Catégories</a> |
- <a href="newsletter_prep.php">Préparation</a> |
- <a href="newsletter_archi.php">Archives</a> |
<a href="newsletter_pattecassee.php">Adresses en panne</a>
</td></tr>
<tr class="impair"><td>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: newsletter_edit.tpl,v 1.4 2004-10-16 22:34:09 x2000habouzit Exp $
+ $Id: newsletter_edit.tpl,v 1.5 2004-10-16 22:39:35 x2000habouzit Exp $
***************************************************************************}
{dynamic}
{if !$art}
-<p>[<a href="{"newsletter/show.php"|url}?nid={$nl->_id}">visualiser</a>]</p>
+<p>
+[<a href="{"admin/newsletter.php"|url}">liste</a>]
+[<a href="{"newsletter/show.php"|url}?nid={$nl->_id}">visualiser</a>]
+</p>
<form action='{$smarty.server.PHP_SELF}?nid={$nl->_id}' method='post'>
<table class="bicol" cellpadding="3" cellspacing="0">
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************
- $Id: newsletter_prep.tpl,v 1.8 2004-09-02 23:59:26 x2000habouzit Exp $
- ***************************************************************************}
-
-
-{if $erreur}
-
-<p class="erreur">{$erreur}</p>
-
-{else}
-
-{dynamic}
-
-{if $action_msg}
-<p class="erreur">{$action_msg}</p>
-{/if}
-
-<div class="rubrique">
- Préparer la Newsletter
-</div>
-
-<form action="{$smarty.server.REQUEST_URI}" method="post">
- <p>
- Conseil : enregistre souvent tes modifs pour éviter de les perdre si
- le navigateur plante et pour éviter d'oublier<br />
- Vérifie bien que les lignes ne dépassent pas la largueur du cadre,
- certains navigateurs sautent à la ligne automatiquement
- </p>
-
-{if $own_lock}
- <p>
- Tu possèdes un verrou, tu peux éditer la newsletter.
- </p>
- <p>
- <span class="erreur">Pense à relacher le verrou quand tu as fini.</span>
- </p>
- <div class="center">
- <input type="submit" name="submit" value="Sauver et relacher le verrou" />
- <input type="submit" name="submit" value="Sauver" />
- <br />
- <input type="submit" name="submit" value="Ne pas sauver et relacher le verrou" />
- </div>
-{elseif $is_lock}
- <p>
- <span class="erreur">{$id_lock} est en train d'éditer la newsletter depuis le
- {$date_lock|date_format:"%c"}
- </span>, tu ne peux pas éditer la newsletter ni prendre de verrou. Si l'admin
- précédent a oublié de supprimer (c'est mal) son verrou, tu
- peux le supprimer quand même avec le bouton ci-dessous, mais il faut que tu sois
- vraiment certain qu'il n'est plus en train d'éditer, sinon, il risque d'y
- avoir des pertes dans les modifications faites à la lettre...
- </p>
- <div class="center">
- <input type="submit" name="submit" value="Relacher quand meme" />
- </div>
-{else}
- <div class="ssrubrique">
- Pas de lock sur le fichier, tu peux en prendre un.
- </div>
- <div class="center">
- <input type="submit" name="submit" value="Prendre un verrou" />
- </div>
- <div class="ssrubrique">
- envoyer la newsletter tel qu'elle.
- </div>
- <div class="center">
- <input type="text" name="test_to" size="40" value="{$smarty.session.forlife}@m4x.org" />
- <input type="submit" name="submit" value="Envoi Test" />
- <br />
- <input type="submit" name="submit" value="Envoi Definitif" style="color:red;" />
- </div>
-{/if}
- <table class="bicol" cellpadding="3" summary="Newsletter">
- <tr>
- <th>
- Préparation de la newsletter
- </th>
- </tr>
- <tr>
- <td class="titre">
- Sujet
- </td>
- </tr>
- <tr>
- <td>
- <input type="text" name="sujet" value="{$sujet}" size="55" />
- </td>
- </tr>
- <tr>
- <td class="titre">
- Contenu
- </td>
- </tr>
- <tr>
- <td>
- <textarea name='contenu' rows="100" cols="70" {if !$own_lock}readonly="readonly"{/if}>{$contenu}</textarea>
- </td>
- </tr>
-{if $own_lock}
- <tr>
- <td class="center">
- <input type="submit" name="submit" value="Sauver" />
- </td>
- </tr>
-{/if}
- </table>
-</form>
-{/dynamic}
-{/if}
-
-{* vim:set et sw=2 sts=2 sws=2: *}