[ Index ] |
|
Code source de PunBB 1.2.16 |
1 <?php 2 /*********************************************************************** 3 4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) 5 6 This file is part of PunBB. 7 8 PunBB is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published 10 by the Free Software Foundation; either version 2 of the License, 11 or (at your option) any later version. 12 13 PunBB is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 MA 02111-1307 USA 22 23 ************************************************************************/ 24 25 26 // Tell header.php to use the admin template 27 define('PUN_ADMIN_CONSOLE', 1); 28 29 define('PUN_ROOT', './'); 30 require PUN_ROOT.'include/common.php'; 31 require PUN_ROOT.'include/common_admin.php'; 32 33 34 if ($pun_user['g_id'] > PUN_MOD) 35 message($lang_common['No permission']); 36 37 38 // Add a censor word 39 if (isset($_POST['add_word'])) 40 { 41 confirm_referrer('admin_censoring.php'); 42 43 $search_for = trim($_POST['new_search_for']); 44 $replace_with = trim($_POST['new_replace_with']); 45 46 if ($search_for == '' || $replace_with == '') 47 message('Vous devez saisir à la fois un mot à censurer et un texte pour le remplacer.'); 48 49 $db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error()); 50 51 redirect('admin_censoring.php', 'Mot à censurer ajouté. Redirection ...'); 52 } 53 54 55 // Update a censor word 56 else if (isset($_POST['update'])) 57 { 58 confirm_referrer('admin_censoring.php'); 59 60 $id = intval(key($_POST['update'])); 61 62 $search_for = trim($_POST['search_for'][$id]); 63 $replace_with = trim($_POST['replace_with'][$id]); 64 65 if ($search_for == '' || $replace_with == '') 66 message('Vous devez saisir à la fois un mot à censurer et un texte pour le remplacer.'); 67 68 $db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.$db->escape($search_for).'\', replace_with=\''.$db->escape($replace_with).'\' WHERE id='.$id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error()); 69 70 redirect('admin_censoring.php', 'Mot à censurer modifié. Redirection ...'); 71 } 72 73 74 // Remove a censor word 75 else if (isset($_POST['remove'])) 76 { 77 confirm_referrer('admin_censoring.php'); 78 79 $id = intval(key($_POST['remove'])); 80 81 $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); 82 83 redirect('admin_censoring.php', 'Mot à censurer supprimé. Redirection ...'); 84 } 85 86 87 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Mots à censurer'; 88 $focus_element = array('censoring', 'new_search_for'); 89 require PUN_ROOT.'header.php'; 90 91 generate_admin_menu('censoring'); 92 93 ?> 94 <div class="blockform"> 95 <h2><span>Mots à censurer</span></h2> 96 <div class="box"> 97 <form id="censoring" method="post" action="admin_censoring.php?action=foo"> 98 <div class="inform"> 99 <fieldset> 100 <legend>Ajouter un mot à censurer</legend> 101 <div class="infldset"> 102 <p>Saisissez le mot que vous voulez censurer ainsi que le texte qui le remplacera. Les caractères joker sont permis (ex: *fleur* vérifiera « fleurette » et « gonfleur »). Les mots censurés affectent également les noms d'utilisateurs. Un nouvel utilisateur ne pourrait s'inscrire avec un nom d'utilisateur qui contiendrait un des mots censurés. La recherche est insensible à la casse. <strong>Les mots censurés doivent êtres activés à la page <a href="admin_options.php#censoring">Options</a> pour qu'ils aient un quelconque effet.</strong></p> 103 <table cellspacing="0"> 104 <thead> 105 <tr> 106 <th class="tcl" scope="col">Mot à censurer</th> 107 <th class="tc2" scope="col">Texte de remplacement</th> 108 <th class="hidehead" scope="col">Action</th> 109 </tr> 110 </thead> 111 <tbody> 112 <tr> 113 <td><input type="text" name="new_search_for" size="24" maxlength="60" tabindex="1" /></td> 114 <td><input type="text" name="new_replace_with" size="24" maxlength="60" tabindex="2" /></td> 115 <td><input type="submit" name="add_word" value=" Ajouter " tabindex="3" /></td> 116 </tr> 117 </tbody> 118 </table> 119 </div> 120 </fieldset> 121 </div> 122 <div class="inform"> 123 <fieldset> 124 <legend>Modifier/supprimer des mots à censurer</legend> 125 <div class="infldset"> 126 <?php 127 128 $result = $db->query('SELECT id, search_for, replace_with FROM '.$db->prefix.'censoring ORDER BY id') or error('Unable to fetch censor word list', __FILE__, __LINE__, $db->error()); 129 if ($db->num_rows($result)) 130 { 131 132 ?> 133 <table cellspacing="0" > 134 <thead> 135 <tr> 136 <th class="tcl" scope="col">Mots à censurer</th> 137 <th class="tc2" scope="col">Texte de remplacement</th> 138 <th class="hidehead" scope="col">Actions</th> 139 </tr> 140 </thead> 141 <tbody> 142 <?php 143 144 while ($cur_word = $db->fetch_assoc($result)) 145 echo "\t\t\t\t\t\t\t\t".'<tr><td><input type="text" name="search_for['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['search_for']).'" size="24" maxlength="60" /></td><td><input type="text" name="replace_with['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['replace_with']).'" size="24" maxlength="60" /></td><td><input type="submit" name="update['.$cur_word['id'].']" value=" Modifier " /> <input type="submit" name="remove['.$cur_word['id'].']" value=" Supprimer " /></td></tr>'."\n"; 146 147 ?> 148 </tbody> 149 </table> 150 <?php 151 152 } 153 else 154 echo "\t\t\t\t\t\t\t".'<p>Aucun mot à censurer dans la liste.</p>'."\n"; 155 156 ?> 157 </div> 158 </fieldset> 159 </div> 160 </form> 161 </div> 162 </div> 163 <div class="clearer"></div> 164 </div> 165 <?php 166 167 require PUN_ROOT.'footer.php';
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 22:44:38 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |