[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 require_once 'include/settings.php'; 20 21 if (isset($_POST['pst_subject'])) { 22 $post = $_POST; 23 24 if ($post['pst_subject'] != '') { 25 // add slashes to values before insert or update 26 if (!get_magic_quotes_gpc()) { 27 for (reset($post); list($k, $v) = each($post); $post[$k] = addslashes($v)) 28 ; 29 } 30 // HACK for (reset($post); list($k, $v) = each($post); $post[$k] = addslashes($v)); 31 if ($post['pst_id'] == -1) { 32 $post['pst_id'] = $db->nextId(CM_TABLE_PREFIX . '_posts'); 33 $db->query("INSERT INTO " . CM_TABLE_PREFIX . "_posts 34 (pst_id, lst_id, pst_date_create, pst_subject, pst_html, pst_text) 35 VALUES 36 (" . $post['pst_id']. ", " . $post['lst_id']. ", " . time(). ", '" . $post['pst_subject']. "', '" . $post['pst_html']. "', '" . $post['pst_text']. "')"); 37 } 38 else { 39 $db->query("UPDATE " . CM_TABLE_PREFIX . "_posts 40 SET 41 pst_date_update = " . time(). ", 42 pst_subject = '" . $post['pst_subject']. "', 43 pst_html = '" . $post['pst_html']. "', 44 pst_text = '" . $post['pst_text']. "' 45 WHERE 46 pst_id = " . $post['pst_id']); 47 } 48 } 49 else { 50 define('_ERROR', 'The post must have a subject.'); 51 } 52 if (defined('_ERROR')) { 53 $post = $_POST; 54 } 55 else { 56 header ('Location: posts.php?lst_id=' . $post['lst_id']); 57 exit; 58 } 59 } 60 61 require_once 'design/top.php'; 62 63 // Defines help presented in the right column 64 define('CM_COLUMN_RIGHT', " 65 <h2>Elements</h2> 66 <p>The following elements can be placed in any message in order to personalize 67 it with some subscriber and/or list specific informations.</p> 68 <p>#FORMAT#<br />Replaced by 'HTML' or 'Text'</p> 69 <p>#ADDRESS#<br />Replaced by the subscriber's e-mail address</p> 70 "); 71 ?> 72 73 <div class = "content"> 74 <?php 75 if (isset($_GET['pst_id'])) { 76 if ((int)$_GET['pst_id'] == -1) { 77 $post = array('pst_id' => -1, 'lst_id' => $_GET['lst_id'], 'pst_subject' => '', 'pst_html' => '', 'pst_text' => ''); 78 } 79 else { 80 $post = $db->getRow("SELECT * FROM " . CM_TABLE_PREFIX . "_posts WHERE pst_id = " . $_GET['pst_id']); 81 } 82 } 83 84 if ($post['pst_id'] == -1) { 85 echo '<h1>New post creation</h1>'; 86 } 87 else { 88 echo '<h1>Post edition</h1>'; 89 } 90 91 if (defined('_ERROR')) { 92 echo '<p class="error">' . _ERROR . '</p>'; 93 } 94 95 if (is_array($post)) { 96 ?> 97 98 <table width = "100%" class = "form"> 99 <form action = "post_edit.php" method = "post"> 100 <input type = "hidden" name = "pst_id" value = "<?php echo $post['pst_id']?>"/> 101 102 <input type = "hidden" name = "lst_id" value = "<?php echo $post['lst_id']?>"/> 103 104 <tr> 105 <td class = "label"> 106 Subject:</td> 107 108 <td class = "field"> 109 <input type = "text" name = "pst_subject" value = "<?php echo $post['pst_subject']?>" size = "50" maxlength = "255"/> 110 </td> 111 </tr> 112 113 <tr> 114 <td class = "label"> 115 HTML version:</td> 116 117 <td class = "field"> 118 <textarea name = "pst_html" cols = "50" rows = "10" wrap = "virtual"><?php 119 echo $post['pst_html'] 120 ?></textarea> 121 </td> 122 </tr> 123 124 <tr> 125 <td class = "label"> 126 Text version:</td> 127 128 <td class = "field"> 129 <textarea name = "pst_text" cols = "50" rows = "10" wrap = "virtual"><?php 130 echo $post['pst_text'] 131 ?></textarea> 132 </td> 133 </tr> 134 135 <tr> 136 <td colspan = "2"> 137 <input type = "button" value = "Cancel" onClick = "document.location.href=posts.php;"/> 138 139 <input type = "submit" value = "<?php echo ($post['pst_id'] == -1 ? 'Create' : 'Update')?>"/> 140 </td> 141 </tr> 142 </form> 143 </table> 144 145 <?php 146 } 147 else { 148 echo '<p class="error">Invalid post identifier.</p>'; 149 } 150 ?> 151 152 </div> 153 154 <?php 155 require_once 'design/bottom.php'; 156 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |