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_forums.php

    r1 r3  
    11<?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 
     2
     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_ADMIN)
     17if ($pun_user['g_id'] != PUN_ADMIN)
    3518        message($lang_common['No permission']);
    3619
     20// Load the admin_forums.php language file
     21require PUN_ROOT.'lang/'.$admin_language.'/admin_forums.php';
    3722
    3823// Add a "default" forum
     
    4530                message($lang_common['Bad request']);
    4631
    47         $db->query('INSERT INTO '.$db->prefix.'forums (cat_id) VALUES('.$add_to_cat.')') or error('Impossible de créer un nouveau forum', __FILE__, __LINE__, $db->error());
    48 
    49         // Regenerate the quickjump cache
    50         require_once PUN_ROOT.'include/cache.php';
     32        $db->query('INSERT INTO '.$db->prefix.'forums (forum_name, cat_id) VALUES(\''.$db->escape($lang_admin_forums['New forum']).'\', '.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error());
     33
     34        // Regenerate the quick jump cache
     35        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
     36                require PUN_ROOT.'include/cache.php';
     37
    5138        generate_quickjump_cache();
    5239
    53         redirect('admin_forums.php', 'Forum ajouté. Redirection ...');
    54 }
    55 
     40        redirect('admin_forums.php', $lang_admin_forums['Forum added redirect']);
     41}
    5642
    5743// Delete a forum
     
    6450                message($lang_common['Bad request']);
    6551
    66         if (isset($_POST['del_forum_comply']))  // Delete a forum with all posts
     52        if (isset($_POST['del_forum_comply'])) // Delete a forum with all posts
    6753        {
    6854                @set_time_limit(0);
     
    7258
    7359                // Locate any "orphaned redirect topics" and delete them
    74                 $result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Impossible de retrouver les sujets de redirection', __FILE__, __LINE__, $db->error());
     60                $result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
    7561                $num_orphans = $db->num_rows($result);
    7662
     
    8066                                $orphans[] = $db->result($result, $i);
    8167
    82                         $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Impossible de supprimer les sujets de redirection', __FILE__, __LINE__, $db->error());
     68                        $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
    8369                }
    8470
    8571                // Delete the forum and any forum specific group permissions
    86                 $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Impossible de supprimer un forum', __FILE__, __LINE__, $db->error());
    87                 $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Impossible de supprimer les permissions de groupe du forum', __FILE__, __LINE__, $db->error());
    88 
    89                 // Regenerate the quickjump cache
    90                 require_once PUN_ROOT.'include/cache.php';
     72                $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
     73                $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
     74
     75                // Delete any subscriptions for this forum
     76                $db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE forum_id='.$forum_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
     77
     78                // Regenerate the quick jump cache
     79                if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
     80                        require PUN_ROOT.'include/cache.php';
     81
    9182                generate_quickjump_cache();
    9283
    93                 redirect('admin_forums.php', 'Forum supprimé. Redirection ...');
    94         }
    95         else    // If the user hasn't confirmed the delete
    96         {
    97                 $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Impossible de retrouver les informations du forum', __FILE__, __LINE__, $db->error());
     84                redirect('admin_forums.php', $lang_admin_forums['Forum deleted redirect']);
     85        }
     86        else // If the user hasn't confirmed the delete
     87        {
     88                $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
    9889                $forum_name = pun_htmlspecialchars($db->result($result));
    9990
    100 
    101                 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Forums';
     91                $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
     92                define('PUN_ACTIVE_PAGE', 'admin');
    10293                require PUN_ROOT.'header.php';
    10394
     
    10697?>
    10798        <div class="blockform">
    108                 <h2><span>Confirmez la suppresion du forum</span></h2>
     99                <h2><span><?php echo $lang_admin_forums['Confirm delete head'] ?></span></h2>
    109100                <div class="box">
    110101                        <form method="post" action="admin_forums.php?del_forum=<?php echo $forum_id ?>">
    111102                                <div class="inform">
    112103                                        <fieldset>
    113                                                 <legend>Important ! Lire attentivement avant de procéder à la suppression.</legend>
     104                                                <legend><?php echo $lang_admin_forums['Confirm delete subhead'] ?></legend>
    114105                                                <div class="infldset">
    115                                                         <p>Êtes vous sûr de vouloir supprimer le forum "<?php echo $forum_name ?>"&#160;?</p>
    116                                                         <p>ATTENTION ! Supprimer un forum effacera tous les messages (s'il y en a) présent dans ce forum&#160;!</p>
     106                                                        <p><?php printf($lang_admin_forums['Confirm delete info'], $forum_name) ?></p>
     107                                                        <p class="warntext"><?php echo $lang_admin_forums['Confirm delete warn'] ?></p>
    117108                                                </div>
    118109                                        </fieldset>
    119110                                </div>
    120                                 <p><input type="submit" name="del_forum_comply" value=" Supprimer " /><a href="javascript:history.go(-1)">Retour</a></p>
     111                                <p class="buttons"><input type="submit" name="del_forum_comply" value="<?php echo $lang_admin_common['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p>
    121112                        </form>
    122113                </div>
     
    130121}
    131122
    132 
    133123// Update forum positions
    134124else if (isset($_POST['update_positions']))
     
    136126        confirm_referrer('admin_forums.php');
    137127
    138         while (list($forum_id, $disp_position) = @each($_POST['position']))
    139         {
    140                 if (!preg_match('#^\d+$#', $disp_position))
    141                         message('La position doit être un nombre entier.');
    142 
    143                 $db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.$forum_id) or error('Impossible de mettre à jour les forums', __FILE__, __LINE__, $db->error());
    144         }
    145 
    146         // Regenerate the quickjump cache
    147         require_once PUN_ROOT.'include/cache.php';
     128        foreach ($_POST['position'] as $forum_id => $disp_position)
     129        {
     130                $disp_position = trim($disp_position);
     131                if ($disp_position == '' || preg_match('%[^0-9]%', $disp_position))
     132                        message($lang_admin_forums['Must be integer message']);
     133
     134                $db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.intval($forum_id)) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
     135        }
     136
     137        // Regenerate the quick jump cache
     138        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
     139                require PUN_ROOT.'include/cache.php';
     140
    148141        generate_quickjump_cache();
    149142
    150         redirect('admin_forums.php', 'Forums modifiés. Redirection ...');
    151 }
    152 
     143        redirect('admin_forums.php', $lang_admin_forums['Forums updated redirect']);
     144}
    153145
    154146else if (isset($_GET['edit_forum']))
     
    164156
    165157                // Start with the forum details
    166                 $forum_name = trim($_POST['forum_name']);
    167                 $forum_desc = pun_linebreaks(trim($_POST['forum_desc']));
     158                $forum_name = pun_trim($_POST['forum_name']);
     159                $forum_desc = pun_linebreaks(pun_trim($_POST['forum_desc']));
    168160                $cat_id = intval($_POST['cat_id']);
    169161                $sort_by = intval($_POST['sort_by']);
     
    171163
    172164                if ($forum_name == '')
    173                         message('Vous devez saisir un nom de forum.');
     165                        message($lang_admin_forums['Must enter name message']);
    174166
    175167                if ($cat_id < 1)
     
    179171                $redirect_url = ($redirect_url != '') ? '\''.$db->escape($redirect_url).'\'' : 'NULL';
    180172
    181                 $db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.' WHERE id='.$forum_id) or error('Impossible de modifier le forum', __FILE__, __LINE__, $db->error());
     173                $db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
    182174
    183175                // Now let's deal with the permissions
    184176                if (isset($_POST['read_forum_old']))
    185177                {
    186                         $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Impossible de retrouver la liste des groupes d\'utilisateurs', __FILE__, __LINE__, $db->error());
     178                        $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
    187179                        while ($cur_group = $db->fetch_assoc($result))
    188180                        {
    189                                 $read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? $_POST['read_forum_new'][$cur_group['g_id']] : '0' : $_POST['read_forum_old'][$cur_group['g_id']];
    190                                 $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? $_POST['post_replies_new'][$cur_group['g_id']] : '0';
    191                                 $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? $_POST['post_topics_new'][$cur_group['g_id']] : '0';
     181                                $read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? '1' : '0' : intval($_POST['read_forum_old'][$cur_group['g_id']]);
     182                                $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? '1' : '0';
     183                                $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? '1' : '0';
    192184
    193185                                // Check if the new settings differ from the old
     
    196188                                        // If the new settings are identical to the default settings for this group, delete it's row in forum_perms
    197189                                        if ($read_forum_new == '1' && $post_replies_new == $cur_group['g_post_replies'] && $post_topics_new == $cur_group['g_post_topics'])
    198                                                 $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Impossible de supprimer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
     190                                                $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
    199191                                        else
    200192                                        {
    201193                                                // Run an UPDATE and see if it affected a row, if not, INSERT
    202                                                 $db->query('UPDATE '.$db->prefix.'forum_perms SET read_forum='.$read_forum_new.', post_replies='.$post_replies_new.', post_topics='.$post_topics_new.' WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
     194                                                $db->query('UPDATE '.$db->prefix.'forum_perms SET read_forum='.$read_forum_new.', post_replies='.$post_replies_new.', post_topics='.$post_topics_new.' WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
    203195                                                if (!$db->affected_rows())
    204                                                         $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$cur_group['g_id'].', '.$forum_id.', '.$read_forum_new.', '.$post_replies_new.', '.$post_topics_new.')') or error('Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
     196                                                        $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$cur_group['g_id'].', '.$forum_id.', '.$read_forum_new.', '.$post_replies_new.', '.$post_topics_new.')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
    205197                                        }
    206198                                }
     
    208200                }
    209201
    210                 // Regenerate the quickjump cache
    211                 require_once PUN_ROOT.'include/cache.php';
     202                // Regenerate the quick jump cache
     203                if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
     204                        require PUN_ROOT.'include/cache.php';
     205
    212206                generate_quickjump_cache();
    213207
    214                 redirect('admin_forums.php', 'Forum modifié. Redirection ...');
     208                redirect('admin_forums.php', $lang_admin_forums['Forum updated redirect']);
    215209        }
    216210        else if (isset($_POST['revert_perms']))
     
    218212                confirm_referrer('admin_forums.php');
    219213
    220                 $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Impossible de supprimer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
    221 
    222                 // Regenerate the quickjump cache
    223                 require_once PUN_ROOT.'include/cache.php';
     214                $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
     215
     216                // Regenerate the quick jump cache
     217                if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
     218                        require PUN_ROOT.'include/cache.php';
     219
    224220                generate_quickjump_cache();
    225221
    226                 redirect('admin_forums.php?edit_forum='.$forum_id, 'Permissions remises à leurs valeurs par défaut. Redirection ...');
    227         }
    228 
     222                redirect('admin_forums.php?edit_forum='.$forum_id, $lang_admin_forums['Perms reverted redirect']);
     223        }
    229224
    230225        // Fetch forum info
    231         $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Impossible de retrouver les informations du forum', __FILE__, __LINE__, $db->error());
     226        $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
    232227        if (!$db->num_rows($result))
    233228                message($lang_common['Bad request']);
     
    235230        $cur_forum = $db->fetch_assoc($result);
    236231
    237 
    238         $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Forums';
     232        $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
     233        define('PUN_ACTIVE_PAGE', 'admin');
    239234        require PUN_ROOT.'header.php';
    240235
     
    243238?>
    244239        <div class="blockform">
    245                 <h2><span>Modifier forum</span></h2>
     240                <h2><span><?php echo $lang_admin_forums['Edit forum head'] ?></span></h2>
    246241                <div class="box">
    247242                        <form id="edit_forum" method="post" action="admin_forums.php?edit_forum=<?php echo $forum_id ?>">
    248                                 <p class="submittop"><input type="submit" name="save" value=" Enregistrer modifications " tabindex="6" /></p>
     243                                <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" tabindex="6" /></p>
    249244                                <div class="inform">
    250245                                        <fieldset>
    251                                                 <legend>Modifier les détails du forum</legend>
     246                                                <legend><?php echo $lang_admin_forums['Edit details subhead'] ?></legend>
    252247                                                <div class="infldset">
    253248                                                        <table class="aligntop" cellspacing="0">
    254249                                                                <tr>
    255                                                                         <th scope="row">Nom du forum</th>
     250                                                                        <th scope="row"><?php echo $lang_admin_forums['Forum name label'] ?></th>
    256251                                                                        <td><input type="text" name="forum_name" size="35" maxlength="80" value="<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?>" tabindex="1" /></td>
    257252                                                                </tr>
    258253                                                                <tr>
    259                                                                         <th scope="row">Description (<acronym title="HyperText Markup Language" lang="en">HTML</acronym>)</th>
     254                                                                        <th scope="row"><?php echo $lang_admin_forums['Forum description label'] ?></th>
    260255                                                                        <td><textarea name="forum_desc" rows="3" cols="50" tabindex="2"><?php echo pun_htmlspecialchars($cur_forum['forum_desc']) ?></textarea></td>
    261256                                                                </tr>
    262257                                                                <tr>
    263                                                                         <th scope="row">Catégorie</th>
     258                                                                        <th scope="row"><?php echo $lang_admin_forums['Category label'] ?></th>
    264259                                                                        <td>
    265260                                                                                <select name="cat_id" tabindex="3">
    266261<?php
    267262
    268         $result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Impossible de retrouver la liste des catégories', __FILE__, __LINE__, $db->error());
     263        $result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
    269264        while ($cur_cat = $db->fetch_assoc($result))
    270265        {
     
    278273                                                                </tr>
    279274                                                                <tr>
    280                                                                         <th scope="row">Trier les discussions par</th>
     275                                                                        <th scope="row"><?php echo $lang_admin_forums['Sort by label'] ?></th>
    281276                                                                        <td>
    282277                                                                                <select name="sort_by" tabindex="4">
    283                                                                                         <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>>Derniers messages</option>
    284                                                                                         <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>>Dates des discussions</option>
     278                                                                                        <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Last post'] ?></option>
     279                                                                                        <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Topic start'] ?></option>
     280                                                                                        <option value="2"<?php if ($cur_forum['sort_by'] == '2') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Subject'] ?></option>
    285281                                                                                </select>
    286282                                                                        </td>
    287283                                                                </tr>
    288284                                                                <tr>
    289                                                                         <th scope="row"><acronym title="Uniform Resource Locator" lang="en">URL</acronym> de redirection</th>
    290                                                                         <td><?php echo ($cur_forum['num_topics']) ? 'Disponible uniquement pour les forums vides' : '<input type="text" name="redirect_url" size="45" maxlength="100" value="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" tabindex="5" />'; ?></td>
     285                                                                        <th scope="row"><?php echo $lang_admin_forums['Redirect label'] ?></th>
     286                                                                        <td><?php echo ($cur_forum['num_topics']) ? $lang_admin_forums['Redirect help'] : '<input type="text" name="redirect_url" size="45" maxlength="100" value="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" tabindex="5" />'; ?></td>
    291287                                                                </tr>
    292288                                                        </table>
     
    296292                                <div class="inform">
    297293                                        <fieldset>
    298                                                 <legend>Modifier les permissions de groupes de ce forum</legend>
     294                                                <legend><?php echo $lang_admin_forums['Group permissions subhead'] ?></legend>
    299295                                                <div class="infldset">
    300                                                         <p>Avec ce formulaire vous pouvez régler les permissions de ce forum spécifiques aux différents groupes d'utilisateurs. Si vous n'avez effectué aucune modification à ces permissions de groupes, ce que vous voyez ci-dessous sont les permissions par défaut basées sur les paramÚtres des <a href="admin_groups.php">Groupes d'utilisateurs</a>. Les administrateurs ont toujours toutes les permissions et sont donc écartés. Les paramÚtres de permission qui diffÚrent des permissions par défaut pour le groupe d'utilisateur sont signalés en rouge. La permission «&#160;Lire&#160;» pourra être désactivée si le groupe en question ne possÚde pas la permission globale «&#160;Lire forums&#160;». Pour les forums de redirection seule la permission «&#160;Lire&#160;» est modifiable.</p>
     296                                                        <p><?php printf($lang_admin_forums['Group permissions info'], '<a href="admin_groups.php">'.$lang_admin_common['User groups'].'</a>') ?></p>
    301297                                                        <table id="forumperms" cellspacing="0">
    302298                                                        <thead>
    303299                                                                <tr>
    304300                                                                        <th class="atcl">&#160;</th>
    305                                                                         <th>Lire le forum</th>
    306                                                                         <th>Écrire des réponses</th>
    307                                                                         <th>Lancer des discussions</th>
     301                                                                        <th><?php echo $lang_admin_forums['Read forum label'] ?></th>
     302                                                                        <th><?php echo $lang_admin_forums['Post replies label'] ?></th>
     303                                                                        <th><?php echo $lang_admin_forums['Post topics label'] ?></th>
    308304                                                                </tr>
    309305                                                        </thead>
     
    311307<?php
    312308
    313         $result = $db->query('SELECT g.g_id, g.g_title, g.g_read_board, g.g_post_replies, g.g_post_topics, fp.read_forum, fp.post_replies, fp.post_topics FROM '.$db->prefix.'groups AS g LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (g.g_id=fp.group_id AND fp.forum_id='.$forum_id.') WHERE g.g_id!='.PUN_ADMIN.' ORDER BY g.g_id') or error('Impossible de retrouver la liste des permissions de groupe du forum', __FILE__, __LINE__, $db->error());
     309        $result = $db->query('SELECT g.g_id, g.g_title, g.g_read_board, g.g_post_replies, g.g_post_topics, fp.read_forum, fp.post_replies, fp.post_topics FROM '.$db->prefix.'groups AS g LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (g.g_id=fp.group_id AND fp.forum_id='.$forum_id.') WHERE g.g_id!='.PUN_ADMIN.' ORDER BY g.g_id') or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
     310
     311        $cur_index = 7;
    314312
    315313        while ($cur_perm = $db->fetch_assoc($result))
     
    319317                $post_topics = (($cur_perm['g_post_topics'] == '0' && $cur_perm['post_topics'] == '1') || ($cur_perm['g_post_topics'] == '1' && $cur_perm['post_topics'] != '0')) ? true : false;
    320318
    321                 // Determine if the current sittings differ from the default or not
     319                // Determine if the current settings differ from the default or not
    322320                $read_forum_def = ($cur_perm['read_forum'] == '0') ? false : true;
    323321                $post_replies_def = (($post_replies && $cur_perm['g_post_replies'] == '0') || (!$post_replies && ($cur_perm['g_post_replies'] == '' || $cur_perm['g_post_replies'] == '1'))) ? false : true;
     
    329327                                                                        <td<?php if (!$read_forum_def) echo ' class="nodefault"'; ?>>
    330328                                                                                <input type="hidden" name="read_forum_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($read_forum) ? '1' : '0'; ?>" />
    331                                                                                 <input type="checkbox" name="read_forum_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($read_forum) ? ' checked="checked"' : ''; ?><?php echo ($cur_perm['g_read_board'] == '0') ? ' disabled="disabled"' : ''; ?> />
     329                                                                                <input type="checkbox" name="read_forum_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($read_forum) ? ' checked="checked"' : ''; ?><?php echo ($cur_perm['g_read_board'] == '0') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
    332330                                                                        </td>
    333331                                                                        <td<?php if (!$post_replies_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>>
    334332                                                                                <input type="hidden" name="post_replies_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($post_replies) ? '1' : '0'; ?>" />
    335                                                                                 <input type="checkbox" name="post_replies_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_replies) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> />
     333                                                                                <input type="checkbox" name="post_replies_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_replies) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
    336334                                                                        </td>
    337335                                                                        <td<?php if (!$post_topics_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>>
    338336                                                                                <input type="hidden" name="post_topics_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($post_topics) ? '1' : '0'; ?>" />
    339                                                                                 <input type="checkbox" name="post_topics_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_topics) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> />
     337                                                                                <input type="checkbox" name="post_topics_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_topics) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
    340338                                                                        </td>
    341339                                                                </tr>
     
    347345                                                        </tbody>
    348346                                                        </table>
    349                                                         <div class="fsetsubmit"><input type="submit" name="revert_perms" value=" Rétablir les permissions par défaut " /></div>
     347                                                        <div class="fsetsubmit"><input type="submit" name="revert_perms" value="<?php echo $lang_admin_forums['Revert to default'] ?>" tabindex="<?php echo $cur_index++ ?>" /></div>
    350348                                                </div>
    351349                                        </fieldset>
    352350                                </div>
    353                                 <p class="submitend"><input type="submit" name="save" value=" Enregistrer modifications " /></p>
     351                                <p class="submitend"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" tabindex="<?php echo $cur_index++ ?>" /></p>
    354352                        </form>
    355353                </div>
     
    363361}
    364362
    365 
    366 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Forums';
     363$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
     364define('PUN_ACTIVE_PAGE', 'admin');
    367365require PUN_ROOT.'header.php';
    368366
     
    371369?>
    372370        <div class="blockform">
    373                 <h2><span>Ajouter forum</span></h2>
     371                <h2><span><?php echo $lang_admin_forums['Add forum head'] ?></span></h2>
    374372                <div class="box">
    375373                        <form method="post" action="admin_forums.php?action=adddel">
    376374                                <div class="inform">
    377375                                        <fieldset>
    378                                                 <legend>Créer un forum</legend>
     376                                                <legend><?php echo $lang_admin_forums['Create new subhead'] ?></legend>
    379377                                                <div class="infldset">
    380378                                                        <table class="aligntop" cellspacing="0">
    381379                                                                <tr>
    382                                                                         <th scope="row">Ajouter un forum à la catégorie<div><input type="submit" name="add_forum" value=" Ajouter " tabindex="2" /></div></th>
     380                                                                        <th scope="row"><?php echo $lang_admin_forums['Add forum label'] ?><div><input type="submit" name="add_forum" value="<?php echo $lang_admin_forums['Add forum'] ?>" tabindex="2" /></div></th>
    383381                                                                        <td>
    384382                                                                                <select name="add_to_cat" tabindex="1">
    385383<?php
    386384
    387         $result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Impossible de retrouver la liste des catégories', __FILE__, __LINE__, $db->error());
    388         while ($cur_cat = $db->fetch_assoc($result))
    389                 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
     385        $result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
     386        if ($db->num_rows($result) > 0)
     387        {
     388                while ($cur_cat = $db->fetch_assoc($result))
     389                        echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
     390        }
     391        else
     392                echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="0" disabled="disabled">'.$lang_admin_forums['No categories exist'].'</option>'."\n";
    390393
    391394?>
    392395                                                                                </select>
    393                                                                                 <span>Choisissez la catégorie dans laquelle vous souhaitez ajouter un nouveau forum.</span>
     396                                                                                <span><?php echo $lang_admin_forums['Add forum help'] ?></span>
    394397                                                                        </td>
    395398                                                                </tr>
     
    400403                        </form>
    401404                </div>
    402 
    403                 <h2 class="block2"><span>Modifier les forums</span></h2>
     405<?php
     406
     407// Display all the categories and forums
     408$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.disp_position FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
     409
     410if ($db->num_rows($result) > 0)
     411{
     412
     413?>
     414                <h2 class="block2"><span><?php echo $lang_admin_forums['Edit forums head'] ?></span></h2>
    404415                <div class="box">
    405416                        <form id="edforum" method="post" action="admin_forums.php?action=edit">
    406                                 <p class="submittop"><input type="submit" name="update_positions" value=" Modifier positions " tabindex="3" /></p>
    407 <?php
    408 
    409 $tabindex_count = 4;
    410 
    411 // Display all the categories and forums
    412 $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.disp_position FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Impossible de retrouver la liste des catégories et des forums', __FILE__, __LINE__, $db->error());
    413 
    414 if($db->num_rows($result)) :
     417                                <p class="submittop"><input type="submit" name="update_positions" value="<?php echo $lang_admin_forums['Update positions'] ?>" tabindex="3" /></p>
     418<?php
     419
     420$cur_index = 4;
     421
    415422$cur_category = 0;
    416423while ($cur_forum = $db->fetch_assoc($result))
    417424{
    418         if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
     425        if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
    419426        {
    420427                if ($cur_category != 0)
    421                         echo "\t\t\t\t\t\t\t".'</table>'."\n\t\t\t\t\t\t".'</div>'."\n\t\t\t\t\t".'</fieldset>'."\n\t\t\t\t".'</div>'."\n";
     428                        echo "\t\t\t\t\t\t\t".'</tbody>'."\n\t\t\t\t\t\t\t".'</table>'."\n\t\t\t\t\t\t".'</div>'."\n\t\t\t\t\t".'</fieldset>'."\n\t\t\t\t".'</div>'."\n";
    422429
    423430?>
    424431                                <div class="inform">
    425432                                        <fieldset>
    426                                                 <legend>Catégorie&#160;: <?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></legend>
     433                                                <legend><?php echo $lang_admin_forums['Category subhead'] ?> <?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></legend>
    427434                                                <div class="infldset">
    428435                                                        <table cellspacing="0">
     436                                                        <thead>
     437                                                                <tr>
     438                                                                        <th class="tcl"><?php echo $lang_admin_common['Action'] ?></th>
     439                                                                        <th class="tc2"><?php echo $lang_admin_forums['Position label'] ?></th>
     440                                                                        <th class="tcr"><?php echo $lang_admin_forums['Forum label'] ?></th>
     441                                                                </tr>
     442                                                        </thead>
     443                                                        <tbody>
    429444<?php
    430445
     
    434449?>
    435450                                                                <tr>
    436                                                                         <th><a href="admin_forums.php?edit_forum=<?php echo $cur_forum['fid'] ?>">Modifier</a> - <a href="admin_forums.php?del_forum=<?php echo $cur_forum['fid'] ?>">Supprimer</a></th>
    437                                                                         <td>Position&#160;&#160;<input type="text" name="position[<?php echo $cur_forum['fid'] ?>]" size="3" maxlength="3" value="<?php echo $cur_forum['disp_position'] ?>" tabindex="<?php echo $tabindex_count ?>" />
    438                                                                         &#160;&#160;<strong><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></strong></td>
    439                                                                 </tr>
    440 <?php
    441 
    442         $tabindex_count += 2;
    443 }
    444 
    445 ?>
     451                                                                        <td class="tcl"><a href="admin_forums.php?edit_forum=<?php echo $cur_forum['fid'] ?>" tabindex="<?php echo $cur_index++ ?>"><?php echo $lang_admin_forums['Edit link'] ?></a> | <a href="admin_forums.php?del_forum=<?php echo $cur_forum['fid'] ?>" tabindex="<?php echo $cur_index++ ?>"><?php echo $lang_admin_forums['Delete link'] ?></a></td>
     452                                                                        <td class="tc2"><input type="text" name="position[<?php echo $cur_forum['fid'] ?>]" size="3" maxlength="3" value="<?php echo $cur_forum['disp_position'] ?>" tabindex="<?php echo $cur_index++ ?>" /></td>
     453                                                                        <td class="tcr"><strong><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></strong></td>
     454                                                                </tr>
     455<?php
     456
     457}
     458
     459?>
     460                                                        </tbody>
    446461                                                        </table>
    447462                                                </div>
    448463                                        </fieldset>
    449464                                </div>
    450 <?php endif; ?>
    451                                 <p class="submitend"><input type="submit" name="update_positions" value=" Modifier positions " tabindex="<?php echo $tabindex_count ?>" /></p>
     465                                <p class="submitend"><input type="submit" name="update_positions" value="<?php echo $lang_admin_forums['Update positions'] ?>" tabindex="<?php echo $cur_index++ ?>" /></p>
    452466                        </form>
    453467                </div>
     468<?php
     469
     470}
     471
     472?>
    454473        </div>
    455474        <div class="clearer"></div>
Note: See TracChangeset for help on using the changeset viewer.