Changeset 3 for branches/rsr.v5.1.dev/web/punbb/admin_forums.php
- Timestamp:
- Nov 14, 2011, 11:17:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rsr.v5.1.dev/web/punbb/admin_forums.php
r1 r3 1 1 <?php 2 /*********************************************************************** 3 4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) 5 6 This file is part of PunBB. 7 8 PunBB is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published 10 by the Free Software Foundation; either version 2 of the License, 11 or (at your option) any later version. 12 13 PunBB is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 MA 02111-1307 USA 22 23 ************************************************************************/ 24 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 */ 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_ADMIN)17 if ($pun_user['g_id'] != PUN_ADMIN) 35 18 message($lang_common['No permission']); 36 19 20 // Load the admin_forums.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_forums.php'; 37 22 38 23 // Add a "default" forum … … 45 30 message($lang_common['Bad request']); 46 31 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 51 38 generate_quickjump_cache(); 52 39 53 redirect('admin_forums.php', 'Forum ajouté. Redirection ...'); 54 } 55 40 redirect('admin_forums.php', $lang_admin_forums['Forum added redirect']); 41 } 56 42 57 43 // Delete a forum … … 64 50 message($lang_common['Bad request']); 65 51 66 if (isset($_POST['del_forum_comply'])) 52 if (isset($_POST['del_forum_comply'])) // Delete a forum with all posts 67 53 { 68 54 @set_time_limit(0); … … 72 58 73 59 // 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()); 75 61 $num_orphans = $db->num_rows($result); 76 62 … … 80 66 $orphans[] = $db->result($result, $i); 81 67 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()); 83 69 } 84 70 85 71 // 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 91 82 generate_quickjump_cache(); 92 83 93 redirect('admin_forums.php', 'Forum supprimé. Redirection ...');94 } 95 else 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()); 98 89 $forum_name = pun_htmlspecialchars($db->result($result)); 99 90 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'); 102 93 require PUN_ROOT.'header.php'; 103 94 … … 106 97 ?> 107 98 <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> 109 100 <div class="box"> 110 101 <form method="post" action="admin_forums.php?del_forum=<?php echo $forum_id ?>"> 111 102 <div class="inform"> 112 103 <fieldset> 113 <legend> Important ! Lire attentivement avant de procéder à la suppression.</legend>104 <legend><?php echo $lang_admin_forums['Confirm delete subhead'] ?></legend> 114 105 <div class="infldset"> 115 <p> Ãtes vous sûr de vouloir supprimer le forum "<?php echo $forum_name ?>" ?</p>116 <p >ATTENTION ! Supprimer un forum effacera tous les messages (s'il y en a) présent dans ce forum !</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> 117 108 </div> 118 109 </fieldset> 119 110 </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> 121 112 </form> 122 113 </div> … … 130 121 } 131 122 132 133 123 // Update forum positions 134 124 else if (isset($_POST['update_positions'])) … … 136 126 confirm_referrer('admin_forums.php'); 137 127 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 148 141 generate_quickjump_cache(); 149 142 150 redirect('admin_forums.php', 'Forums modifiés. Redirection ...'); 151 } 152 143 redirect('admin_forums.php', $lang_admin_forums['Forums updated redirect']); 144 } 153 145 154 146 else if (isset($_GET['edit_forum'])) … … 164 156 165 157 // 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'])); 168 160 $cat_id = intval($_POST['cat_id']); 169 161 $sort_by = intval($_POST['sort_by']); … … 171 163 172 164 if ($forum_name == '') 173 message( 'Vous devez saisir un nom de forum.');165 message($lang_admin_forums['Must enter name message']); 174 166 175 167 if ($cat_id < 1) … … 179 171 $redirect_url = ($redirect_url != '') ? '\''.$db->escape($redirect_url).'\'' : 'NULL'; 180 172 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()); 182 174 183 175 // Now let's deal with the permissions 184 176 if (isset($_POST['read_forum_old'])) 185 177 { 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()); 187 179 while ($cur_group = $db->fetch_assoc($result)) 188 180 { 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'; 192 184 193 185 // Check if the new settings differ from the old … … 196 188 // If the new settings are identical to the default settings for this group, delete it's row in forum_perms 197 189 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()); 199 191 else 200 192 { 201 193 // 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()); 203 195 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()); 205 197 } 206 198 } … … 208 200 } 209 201 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 212 206 generate_quickjump_cache(); 213 207 214 redirect('admin_forums.php', 'Forum modifié. Redirection ...');208 redirect('admin_forums.php', $lang_admin_forums['Forum updated redirect']); 215 209 } 216 210 else if (isset($_POST['revert_perms'])) … … 218 212 confirm_referrer('admin_forums.php'); 219 213 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 224 220 generate_quickjump_cache(); 225 221 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 } 229 224 230 225 // 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()); 232 227 if (!$db->num_rows($result)) 233 228 message($lang_common['Bad request']); … … 235 230 $cur_forum = $db->fetch_assoc($result); 236 231 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'); 239 234 require PUN_ROOT.'header.php'; 240 235 … … 243 238 ?> 244 239 <div class="blockform"> 245 <h2><span> Modifier forum</span></h2>240 <h2><span><?php echo $lang_admin_forums['Edit forum head'] ?></span></h2> 246 241 <div class="box"> 247 242 <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> 249 244 <div class="inform"> 250 245 <fieldset> 251 <legend> Modifier les détails du forum</legend>246 <legend><?php echo $lang_admin_forums['Edit details subhead'] ?></legend> 252 247 <div class="infldset"> 253 248 <table class="aligntop" cellspacing="0"> 254 249 <tr> 255 <th scope="row"> Nom du forum</th>250 <th scope="row"><?php echo $lang_admin_forums['Forum name label'] ?></th> 256 251 <td><input type="text" name="forum_name" size="35" maxlength="80" value="<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?>" tabindex="1" /></td> 257 252 </tr> 258 253 <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> 260 255 <td><textarea name="forum_desc" rows="3" cols="50" tabindex="2"><?php echo pun_htmlspecialchars($cur_forum['forum_desc']) ?></textarea></td> 261 256 </tr> 262 257 <tr> 263 <th scope="row"> Catégorie</th>258 <th scope="row"><?php echo $lang_admin_forums['Category label'] ?></th> 264 259 <td> 265 260 <select name="cat_id" tabindex="3"> 266 261 <?php 267 262 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()); 269 264 while ($cur_cat = $db->fetch_assoc($result)) 270 265 { … … 278 273 </tr> 279 274 <tr> 280 <th scope="row"> Trier les discussions par</th>275 <th scope="row"><?php echo $lang_admin_forums['Sort by label'] ?></th> 281 276 <td> 282 277 <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> 285 281 </select> 286 282 </td> 287 283 </tr> 288 284 <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> 291 287 </tr> 292 288 </table> … … 296 292 <div class="inform"> 297 293 <fieldset> 298 <legend> Modifier les permissions de groupes de ce forum</legend>294 <legend><?php echo $lang_admin_forums['Group permissions subhead'] ?></legend> 299 295 <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 « Lire Â» pourra être désactivée si le groupe en question ne possÚde pas la permission globale « Lire forums Â». Pour les forums de redirection seule la permission « Lire Â» 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> 301 297 <table id="forumperms" cellspacing="0"> 302 298 <thead> 303 299 <tr> 304 300 <th class="atcl"> </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> 308 304 </tr> 309 305 </thead> … … 311 307 <?php 312 308 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; 314 312 315 313 while ($cur_perm = $db->fetch_assoc($result)) … … 319 317 $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; 320 318 321 // Determine if the current s ittings differ from the default or not319 // Determine if the current settings differ from the default or not 322 320 $read_forum_def = ($cur_perm['read_forum'] == '0') ? false : true; 323 321 $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; … … 329 327 <td<?php if (!$read_forum_def) echo ' class="nodefault"'; ?>> 330 328 <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++ ?>" /> 332 330 </td> 333 331 <td<?php if (!$post_replies_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>> 334 332 <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++ ?>" /> 336 334 </td> 337 335 <td<?php if (!$post_topics_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>> 338 336 <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++ ?>" /> 340 338 </td> 341 339 </tr> … … 347 345 </tbody> 348 346 </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> 350 348 </div> 351 349 </fieldset> 352 350 </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> 354 352 </form> 355 353 </div> … … 363 361 } 364 362 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']); 364 define('PUN_ACTIVE_PAGE', 'admin'); 367 365 require PUN_ROOT.'header.php'; 368 366 … … 371 369 ?> 372 370 <div class="blockform"> 373 <h2><span> Ajouter forum</span></h2>371 <h2><span><?php echo $lang_admin_forums['Add forum head'] ?></span></h2> 374 372 <div class="box"> 375 373 <form method="post" action="admin_forums.php?action=adddel"> 376 374 <div class="inform"> 377 375 <fieldset> 378 <legend> Créer un forum</legend>376 <legend><?php echo $lang_admin_forums['Create new subhead'] ?></legend> 379 377 <div class="infldset"> 380 378 <table class="aligntop" cellspacing="0"> 381 379 <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> 383 381 <td> 384 382 <select name="add_to_cat" tabindex="1"> 385 383 <?php 386 384 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"; 390 393 391 394 ?> 392 395 </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> 394 397 </td> 395 398 </tr> … … 400 403 </form> 401 404 </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 410 if ($db->num_rows($result) > 0) 411 { 412 413 ?> 414 <h2 class="block2"><span><?php echo $lang_admin_forums['Edit forums head'] ?></span></h2> 404 415 <div class="box"> 405 416 <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 415 422 $cur_category = 0; 416 423 while ($cur_forum = $db->fetch_assoc($result)) 417 424 { 418 if ($cur_forum['cid'] != $cur_category) 425 if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? 419 426 { 420 427 if ($cur_category != 0) 421 echo "\t\t\t\t\t\t\t".'</t able>'."\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"; 422 429 423 430 ?> 424 431 <div class="inform"> 425 432 <fieldset> 426 <legend> Catégorie :<?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> 427 434 <div class="infldset"> 428 435 <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> 429 444 <?php 430 445 … … 434 449 ?> 435 450 <tr> 436 <t h><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  <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   <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> 446 461 </table> 447 462 </div> 448 463 </fieldset> 449 464 </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> 452 466 </form> 453 467 </div> 468 <?php 469 470 } 471 472 ?> 454 473 </div> 455 474 <div class="clearer"></div>
Note: See TracChangeset
for help on using the changeset viewer.