- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rsr.v5.1.dev/web/punbb/admin_censoring.php
r1 r3 1 1 <?php 2 /***********************************************************************3 2 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 3 /** 4 * Copyright (C) 2008-2011 FluxBB 5 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB 6 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher 7 */ 25 8 26 9 // Tell header.php to use the admin template 27 10 define('PUN_ADMIN_CONSOLE', 1); 28 11 29 define('PUN_ROOT', './');12 define('PUN_ROOT', dirname(__FILE__).'/'); 30 13 require PUN_ROOT.'include/common.php'; 31 14 require PUN_ROOT.'include/common_admin.php'; 32 15 33 16 34 if ($pun_user['g_id'] > PUN_MOD)17 if ($pun_user['g_id'] != PUN_ADMIN) 35 18 message($lang_common['No permission']); 36 19 20 // Load the admin_censoring.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_censoring.php'; 37 22 38 23 // Add a censor word … … 41 26 confirm_referrer('admin_censoring.php'); 42 27 43 $search_for = trim($_POST['new_search_for']);44 $replace_with = trim($_POST['new_replace_with']);28 $search_for = pun_trim($_POST['new_search_for']); 29 $replace_with = pun_trim($_POST['new_replace_with']); 45 30 46 if ($search_for == '' || $replace_with == '')47 message( 'Vous devez saisir à la fois un mot à censurer et un texte pour le remplacer.');31 if ($search_for == '') 32 message($lang_admin_censoring['Must enter word message']); 48 33 49 $db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error(' Impossible d\'ajouter un mot à censurer', __FILE__, __LINE__, $db->error());34 $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 35 51 redirect('admin_censoring.php', 'Mot à censurer ajouté. Redirection ...'); 36 // Regenerate the censoring cache 37 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 38 require PUN_ROOT.'include/cache.php'; 39 40 generate_censoring_cache(); 41 42 redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']); 52 43 } 53 54 44 55 45 // Update a censor word … … 60 50 $id = intval(key($_POST['update'])); 61 51 62 $search_for = trim($_POST['search_for'][$id]);63 $replace_with = trim($_POST['replace_with'][$id]);52 $search_for = pun_trim($_POST['search_for'][$id]); 53 $replace_with = pun_trim($_POST['replace_with'][$id]); 64 54 65 if ($search_for == '' || $replace_with == '')66 message( 'Vous devez saisir à la fois un mot à censurer et un texte pour le remplacer.');55 if ($search_for == '') 56 message($lang_admin_censoring['Must enter word message']); 67 57 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(' Impossible de mettre à jour le mot à censurer', __FILE__, __LINE__, $db->error());58 $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 59 70 redirect('admin_censoring.php', 'Mot à censurer modifié. Redirection ...'); 60 // Regenerate the censoring cache 61 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 62 require PUN_ROOT.'include/cache.php'; 63 64 generate_censoring_cache(); 65 66 redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']); 71 67 } 72 73 68 74 69 // Remove a censor word … … 79 74 $id = intval(key($_POST['remove'])); 80 75 81 $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error(' Impossible de supprimer le mot à censurer', __FILE__, __LINE__, $db->error());76 $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); 82 77 83 redirect('admin_censoring.php', 'Mot à censurer supprimé. Redirection ...'); 78 // Regenerate the censoring cache 79 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 80 require PUN_ROOT.'include/cache.php'; 81 82 generate_censoring_cache(); 83 84 redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']); 84 85 } 85 86 86 87 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Mots à censurer'; 87 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Censoring']); 88 88 $focus_element = array('censoring', 'new_search_for'); 89 define('PUN_ACTIVE_PAGE', 'admin'); 89 90 require PUN_ROOT.'header.php'; 90 91 … … 93 94 ?> 94 95 <div class="blockform"> 95 <h2><span> Mots à censurer</span></h2>96 <h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2> 96 97 <div class="box"> 97 <form id="censoring" method="post" action="admin_censoring.php ?action=foo">98 <form id="censoring" method="post" action="admin_censoring.php"> 98 99 <div class="inform"> 99 100 <fieldset> 100 <legend> Ajouter un mot à censurer</legend>101 <legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend> 101 102 <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 103 <p><?php echo $lang_admin_censoring['Add word info'].' '.($pun_config['o_censoring'] == '1' ? sprintf($lang_admin_censoring['Censoring enabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>') : sprintf($lang_admin_censoring['Censoring disabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>')) ?></p> 104 <table cellspacing="0"> 104 105 <thead> 105 106 <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>107 <th class="tcl" scope="col"><?php echo $lang_admin_censoring['Censored word label'] ?></th> 108 <th class="tc2" scope="col"><?php echo $lang_admin_censoring['Replacement label'] ?></th> 109 <th class="hidehead" scope="col"><?php echo $lang_admin_censoring['Action label'] ?></th> 109 110 </tr> 110 111 </thead> 111 112 <tbody> 112 113 <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=" Add" tabindex="3" /></td>114 <td class="tcl"><input type="text" name="new_search_for" size="24" maxlength="60" tabindex="1" /></td> 115 <td class="tc2"><input type="text" name="new_replace_with" size="24" maxlength="60" tabindex="2" /></td> 116 <td><input type="submit" name="add_word" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="3" /></td> 116 117 </tr> 117 118 </tbody> … … 122 123 <div class="inform"> 123 124 <fieldset> 124 <legend> Modifier/supprimer des mots à censurer</legend>125 <legend><?php echo $lang_admin_censoring['Edit remove subhead'] ?></legend> 125 126 <div class="infldset"> 126 127 <?php 127 128 128 $result = $db->query('SELECT id, search_for, replace_with FROM '.$db->prefix.'censoring ORDER BY id') or error(' Impossible de retrouver la liste des mots à censurer', __FILE__, __LINE__, $db->error());129 $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 130 if ($db->num_rows($result)) 130 131 { … … 134 135 <thead> 135 136 <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>137 <th class="tcl" scope="col"><?php echo $lang_admin_censoring['Censored word label'] ?></th> 138 <th class="tc2" scope="col"><?php echo $lang_admin_censoring['Replacement label'] ?></th> 139 <th class="hidehead" scope="col"><?php echo $lang_admin_censoring['Action label'] ?></th> 139 140 </tr> 140 141 </thead> … … 143 144 144 145 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 echo "\t\t\t\t\t\t\t\t".'<tr><td class="tcl"><input type="text" name="search_for['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['search_for']).'" size="24" maxlength="60" /></td><td class="tc2"><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="'.$lang_admin_common['Update'].'" /> <input type="submit" name="remove['.$cur_word['id'].']" value="'.$lang_admin_common['Remove'].'" /></td></tr>'."\n"; 146 147 147 148 ?> … … 152 153 } 153 154 else 154 echo "\t\t\t\t\t\t\t".'<p> Aucun mot à censurer dans la liste.</p>'."\n";155 echo "\t\t\t\t\t\t\t".'<p>'.$lang_admin_censoring['No words in list'].'</p>'."\n"; 155 156 156 157 ?>
Note: See TracChangeset
for help on using the changeset viewer.