Ignore:
Timestamp:
Nov 14, 2011, 11:17:15 PM (13 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_reports.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['is_admmod'])
    3518        message($lang_common['No permission']);
    3619
     20// Load the admin_reports.php language file
     21require PUN_ROOT.'lang/'.$admin_language.'/admin_reports.php';
    3722
    3823// Zap a report
     
    4328        $zap_id = intval(key($_POST['zap_id']));
    4429
    45         $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Impossible de retrouver les informations de signalements', __FILE__, __LINE__, $db->error());
     30        $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error());
    4631        $zapped = $db->result($result);
    4732
    4833        if ($zapped == '')
    49                 $db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Impossible d\'ignorer le signalement', __FILE__, __LINE__, $db->error());
     34                $db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $db->error());
    5035
    51         redirect('admin_reports.php', 'Signalement ignoré. Redirection ...');
     36        // Delete old reports (which cannot be viewed anyway)
     37        $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10,1') or error('Unable to fetch read reports to delete', __FILE__, __LINE__, $db->error());
     38        if ($db->num_rows($result) > 0)
     39        {
     40                $zapped_threshold = $db->result($result);
     41                $db->query('DELETE FROM '.$db->prefix.'reports WHERE zapped <= '.$zapped_threshold) or error('Unable to delete old read reports', __FILE__, __LINE__, $db->error());
     42        }
     43
     44        redirect('admin_reports.php', $lang_admin_reports['Report zapped redirect']);
    5245}
    5346
    5447
    55 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Signalements';
     48$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Reports']);
     49define('PUN_ACTIVE_PAGE', 'admin');
    5650require PUN_ROOT.'header.php';
    5751
     
    6054?>
    6155        <div class="blockform">
    62                 <h2><span>Nouveaux signalements</span></h2>
     56                <h2><span><?php echo $lang_admin_reports['New reports head'] ?></span></h2>
    6357                <div class="box">
    6458                        <form method="post" action="admin_reports.php?action=zap">
    6559<?php
    6660
    67 $result = $db->query('SELECT r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, t.subject, f.forum_name, u.username AS reporter FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id WHERE r.zapped IS NULL ORDER BY created DESC') or error('Impossible de retrouver la liste des signalements', __FILE__, __LINE__, $db->error());
     61$result = $db->query('SELECT r.id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, p.id AS pid, t.subject, f.forum_name, u.username AS reporter FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'posts AS p ON r.post_id=p.id LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id WHERE r.zapped IS NULL ORDER BY created DESC') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
    6862
    6963if ($db->num_rows($result))
     
    7165        while ($cur_report = $db->fetch_assoc($result))
    7266        {
    73                 $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Utilisateur supprimé';
    74                 $forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Supprimé';
    75                 $topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Supprimé';
    76                 $post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Supprimé';
    77                 $postid = ($cur_report['post_id'] != '') ? '<a href="viewtopic.php?pid='.$cur_report['post_id'].'#p'.$cur_report['post_id'].'">Post #'.$cur_report['post_id'].'</a>' : 'Supprimé';
     67                $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : $lang_admin_reports['Deleted user'];
     68                $forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang_admin_reports['Deleted'].'</span>';
     69                $topic = ($cur_report['subject'] != '') ? '<span>»&#160;<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>»&#160;'.$lang_admin_reports['Deleted'].'</span>';
     70                $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message']));
     71                $post_id = ($cur_report['pid'] != '') ? '<span>»&#160;<a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'</a></span>' : '<span>»&#160;'.$lang_admin_reports['Deleted'].'</span>';
     72                $report_location = array($forum, $topic, $post_id);
    7873
    7974?>
    8075                                <div class="inform">
    8176                                        <fieldset>
    82                                                 <legend>Signalé le <?php echo format_time($cur_report['created']) ?></legend>
     77                                                <legend><?php printf($lang_admin_reports['Report subhead'], format_time($cur_report['created'])) ?></legend>
    8378                                                <div class="infldset">
    84                                                         <table cellspacing="0">
     79                                                        <table class="aligntop" cellspacing="0">
    8580                                                                <tr>
    86                                                                         <th scope="row">Forum&#160;&raquo;&#160;Discussion&#160;&raquo;&#160;Message</th>
    87                                                                         <td><?php echo $forum ?>&#160;&raquo;&#160;<?php echo $topic ?>&#160;&raquo;&#160;<?php echo $postid ?></td>
     81                                                                        <th scope="row"><?php printf($lang_admin_reports['Reported by'], $reporter) ?></th>
     82                                                                        <td class="location"><?php echo implode(' ', $report_location) ?></td>
    8883                                                                </tr>
    8984                                                                <tr>
    90                                                                         <th scope="row">Signalé par <?php echo $reporter ?><div><input type="submit" name="zap_id[<?php echo $cur_report['id'] ?>]" value=" Ignorer " /></div></th>
     85                                                                        <th scope="row"><?php echo $lang_admin_reports['Reason'] ?><div><input type="submit" name="zap_id[<?php echo $cur_report['id'] ?>]" value="<?php echo $lang_admin_reports['Zap'] ?>" /></div></th>
    9186                                                                        <td><?php echo $post ?></td>
    9287                                                                </tr>
     
    10095}
    10196else
    102         echo "\t\t\t\t".'<p>Il n\'y a pas de nouveaux signalements.</p>'."\n";
     97{
     98
     99?>
     100                                <div class="inform">
     101                                        <fieldset>
     102                                                <legend><?php echo $lang_admin_common['None'] ?></legend>
     103                                                <div class="infldset">
     104                                                        <p><?php echo $lang_admin_reports['No new reports'] ?></p>
     105                                                </div>
     106                                        </fieldset>
     107                                </div>
     108<?php
     109
     110}
    103111
    104112?>
     
    108116
    109117        <div class="blockform block2">
    110                 <h2><span>10 derniers signalements ignorés</span></h2>
     118                <h2><span><?php echo $lang_admin_reports['Last 10 head'] ?></span></h2>
    111119                <div class="box">
    112120                        <div class="fakeform">
    113121<?php
    114122
    115 $result = $db->query('SELECT r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, r.message, r.zapped, r.zapped_by AS zapped_by_id, t.subject, f.forum_name, u.username AS reporter, u2.username AS zapped_by FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id LEFT JOIN '.$db->prefix.'users AS u2 ON r.zapped_by=u2.id WHERE r.zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10') or error('Impossible de retrouver la liste des signalements', __FILE__, __LINE__, $db->error());
     123$result = $db->query('SELECT r.id, r.topic_id, r.forum_id, r.reported_by, r.message, r.zapped, r.zapped_by AS zapped_by_id, p.id AS pid, t.subject, f.forum_name, u.username AS reporter, u2.username AS zapped_by FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'posts AS p ON r.post_id=p.id LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id LEFT JOIN '.$db->prefix.'users AS u2 ON r.zapped_by=u2.id WHERE r.zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
    116124
    117125if ($db->num_rows($result))
     
    119127        while ($cur_report = $db->fetch_assoc($result))
    120128        {
    121                 $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Utilisateur supprimé';
    122                 $forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Supprimé';
    123                 $topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Supprimé';
    124                 $post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Supprimé';
    125                 $post_id = ($cur_report['post_id'] != '') ? '<a href="viewtopic.php?pid='.$cur_report['post_id'].'#p'.$cur_report['post_id'].'">Post #'.$cur_report['post_id'].'</a>' : 'Supprimé';
    126                 $zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.pun_htmlspecialchars($cur_report['zapped_by']).'</a>' : 'N/A';
     129                $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : $lang_admin_reports['Deleted user'];
     130                $forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang_admin_reports['Deleted'].'</span>';
     131                $topic = ($cur_report['subject'] != '') ? '<span>»&#160;<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>»&#160;'.$lang_admin_reports['Deleted'].'</span>';
     132                $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message']));
     133                $post_id = ($cur_report['pid'] != '') ? '<span>»&#160;<a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'</a></span>' : '<span>»&#160;'.$lang_admin_reports['Deleted'].'</span>';
     134                $zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.pun_htmlspecialchars($cur_report['zapped_by']).'</a>' : $lang_admin_reports['NA'];
     135                $zapped_by = ($cur_report['zapped_by'] != '') ? '<strong>'.pun_htmlspecialchars($cur_report['zapped_by']).'</strong>' : $lang_admin_reports['NA'];
     136                $report_location = array($forum, $topic, $post_id);
    127137
    128138?>
    129139                                <div class="inform">
    130140                                        <fieldset>
    131                                                 <legend>Zapped <?php echo format_time($cur_report['zapped']) ?></legend>
     141                                                <legend><?php printf($lang_admin_reports['Zapped subhead'], format_time($cur_report['zapped']), $zapped_by) ?></legend>
    132142                                                <div class="infldset">
    133                                                         <table cellspacing="0">
     143                                                        <table class="aligntop" cellspacing="0">
    134144                                                                <tr>
    135                                                                         <th scope="row">Forum&#160;&raquo;&#160;Discussion&#160;&raquo;&#160;Message</th>
    136                                                                         <td><?php echo $forum ?>&#160;&raquo;&#160;<?php echo $topic ?>&#160;&raquo;&#160;<?php echo $post_id ?></td>
     145                                                                        <th scope="row"><?php printf($lang_admin_reports['Reported by'], $reporter) ?></th>
     146                                                                        <td class="location"><?php echo implode(' ', $report_location) ?></td>
    137147                                                                </tr>
    138148                                                                <tr>
    139                                                                         <th scope="row">Signalé par <?php echo $reporter ?><div class="topspace">Ignoré par <?php echo $zapped_by ?></div></th>
     149                                                                        <th scope="row"><?php echo $lang_admin_reports['Reason'] ?></th>
    140150                                                                        <td><?php echo $post ?></td>
    141151                                                                </tr>
     
    149159}
    150160else
    151         echo "\t\t\t\t".'<p>Il n\'y a pas de signalement ignoré.</p>'."\n";
     161{
     162
     163?>
     164                                <div class="inform">
     165                                        <fieldset>
     166                                                <legend><?php echo $lang_admin_common['None'] ?></legend>
     167                                                <div class="infldset">
     168                                                        <p><?php echo $lang_admin_reports['No zapped reports'] ?></p>
     169                                                </div>
     170                                        </fieldset>
     171                                </div>
     172<?php
     173
     174}
    152175
    153176?>
Note: See TracChangeset for help on using the changeset viewer.