Ignore:
Timestamp:
Nov 14, 2011, 11:17:15 PM (12 years ago)
Author:
dj3c1t
Message:

passage a Fluxbb 1.4.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rsr.v5.1.dev/web/punbb/admin_censoring.php

    r1 r3  
    11<?php
    2 /***********************************************************************
    32
    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 */
    258
    269// Tell header.php to use the admin template
    2710define('PUN_ADMIN_CONSOLE', 1);
    2811
    29 define('PUN_ROOT', './');
     12define('PUN_ROOT', dirname(__FILE__).'/');
    3013require PUN_ROOT.'include/common.php';
    3114require PUN_ROOT.'include/common_admin.php';
    3215
    3316
    34 if ($pun_user['g_id'] > PUN_MOD)
     17if ($pun_user['g_id'] != PUN_ADMIN)
    3518        message($lang_common['No permission']);
    3619
     20// Load the admin_censoring.php language file
     21require PUN_ROOT.'lang/'.$admin_language.'/admin_censoring.php';
    3722
    3823// Add a censor word
     
    4126        confirm_referrer('admin_censoring.php');
    4227
    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']);
    4530
    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']);
    4833
    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());
    5035
    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']);
    5243}
    53 
    5444
    5545// Update a censor word
     
    6050        $id = intval(key($_POST['update']));
    6151
    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]);
    6454
    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']);
    6757
    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());
    6959
    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']);
    7167}
    72 
    7368
    7469// Remove a censor word
     
    7974        $id = intval(key($_POST['remove']));
    8075
    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());
    8277
    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']);
    8485}
    8586
    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']);
    8888$focus_element = array('censoring', 'new_search_for');
     89define('PUN_ACTIVE_PAGE', 'admin');
    8990require PUN_ROOT.'header.php';
    9091
     
    9394?>
    9495        <div class="blockform">
    95                 <h2><span>Mots à censurer</span></h2>
     96                <h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2>
    9697                <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">
    9899                                <div class="inform">
    99100                                        <fieldset>
    100                                                 <legend>Ajouter un mot à censurer</legend>
     101                                                <legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend>
    101102                                                <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 «&#160;fleurette&#160;» et «&#160;gonfleur&#160;» ). 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">
     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">
    104105                                                        <thead>
    105106                                                                <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>
    109110                                                                </tr>
    110111                                                        </thead>
    111112                                                        <tbody>
    112113                                                                <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>
    116117                                                                </tr>
    117118                                                        </tbody>
     
    122123                                <div class="inform">
    123124                                        <fieldset>
    124                                                 <legend>Modifier/supprimer des mots à censurer</legend>
     125                                                <legend><?php echo $lang_admin_censoring['Edit remove subhead'] ?></legend>
    125126                                                <div class="infldset">
    126127<?php
    127128
    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());
    129130if ($db->num_rows($result))
    130131{
     
    134135                                                        <thead>
    135136                                                                <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>
    139140                                                                </tr>
    140141                                                        </thead>
     
    143144
    144145        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 " />&#160;<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'].'" />&#160;<input type="submit" name="remove['.$cur_word['id'].']" value="'.$lang_admin_common['Remove'].'" /></td></tr>'."\n";
    146147
    147148?>
     
    152153}
    153154else
    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";
    155156
    156157?>
Note: See TracChangeset for help on using the changeset viewer.