Changeset 3 for branches/rsr.v5.1.dev/web/punbb/include/common_admin.php
- Timestamp:
- Nov 14, 2011, 11:17:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rsr.v5.1.dev/web/punbb/include/common_admin.php
r1 r3 1 1 <?php 2 /***********************************************************************3 2 4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) 5 6 This file is part of PunBB. 7 8 PunBB is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published 10 by the Free Software Foundation; either version 2 of the License, 11 or (at your option) any later version. 12 13 PunBB is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 MA 02111-1307 USA 22 23 ************************************************************************/ 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 */ 24 8 25 9 // Make sure no one attempts to run this script "directly" … … 27 11 exit; 28 12 13 // Make sure we have a usable language pack for admin. 14 if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/admin_common.php')) 15 $admin_language = $pun_user['language']; 16 else if (file_exists(PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/admin_common.php')) 17 $admin_language = $pun_config['o_default_lang']; 18 else 19 $admin_language = 'English'; 20 21 // Attempt to load the admin_common language file 22 require PUN_ROOT.'lang/'.$admin_language.'/admin_common.php'; 29 23 30 24 // … … 33 27 function generate_admin_menu($page = '') 34 28 { 35 global $pun_config, $pun_user ;29 global $pun_config, $pun_user, $lang_admin_common; 36 30 37 31 $is_admin = $pun_user['g_id'] == PUN_ADMIN ? true : false; … … 40 34 <div id="adminconsole" class="block2col"> 41 35 <div id="adminmenu" class="blockmenu"> 42 <h2><span> Menu <?php echo ($is_admin) ? 'Admin' : 'Modérateur'?></span></h2>36 <h2><span><?php echo $lang_admin_common['Moderator menu'] ?></span></h2> 43 37 <div class="box"> 44 38 <div class="inbox"> 45 39 <ul> 46 <li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php">Index</a></li> 47 <?php if ($is_admin): ?> <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="admin_categories.php">Catégories</a></li> 48 <?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="admin_forums.php">Forums</a></li> 49 <?php endif; ?> <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php">Utilisateurs</a></li> 50 <?php if ($is_admin): ?> <li<?php if ($page == 'groups') echo ' class="isactive"'; ?>><a href="admin_groups.php">Groupes</a></li> 51 <?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'options') echo ' class="isactive"'; ?>><a href="admin_options.php">Options</a></li> 52 <?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'permissions') echo ' class="isactive"'; ?>><a href="admin_permissions.php">Permissions</a></li> 53 <?php endif; ?> <li<?php if ($page == 'censoring') echo ' class="isactive"'; ?>><a href="admin_censoring.php">Mots censurés</a></li> 54 <?php if ($is_admin): ?> <li<?php if ($page == 'ranks') echo ' class="isactive"'; ?>><a href="admin_ranks.php">Rangs utilisateurs</a></li> 55 <?php endif; ?><?php if ($is_admin || $pun_config['p_mod_ban_users'] == '1'): ?> <li<?php if ($page == 'bans') echo ' class="isactive"'; ?>><a href="admin_bans.php">Bannissements</a></li> 56 <?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'prune') echo ' class="isactive"'; ?>><a href="admin_prune.php">Ãlaguage</a></li> 57 <?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'maintenance') echo ' class="isactive"'; ?>><a href="admin_maintenance.php">Maintenance</a></li> 58 <?php endif; ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php">Signalements</a></li> 40 <li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php"><?php echo $lang_admin_common['Index'] ?></a></li> 41 <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 42 <?php if ($is_admin || $pun_user['g_mod_ban_users'] == '1'): ?> <li<?php if ($page == 'bans') echo ' class="isactive"'; ?>><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li> 43 <?php endif; if ($is_admin || $pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2'): ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php"><?php echo $lang_admin_common['Reports'] ?></a></li> 44 <?php endif; ?> </ul> 45 </div> 46 </div> 47 <?php 48 49 if ($is_admin) 50 { 51 52 ?> 53 <h2 class="block2"><span><?php echo $lang_admin_common['Admin menu'] ?></span></h2> 54 <div class="box"> 55 <div class="inbox"> 56 <ul> 57 <li<?php if ($page == 'options') echo ' class="isactive"'; ?>><a href="admin_options.php"><?php echo $lang_admin_common['Options'] ?></a></li> 58 <li<?php if ($page == 'permissions') echo ' class="isactive"'; ?>><a href="admin_permissions.php"><?php echo $lang_admin_common['Permissions'] ?></a></li> 59 <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="admin_categories.php"><?php echo $lang_admin_common['Categories'] ?></a></li> 60 <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="admin_forums.php"><?php echo $lang_admin_common['Forums'] ?></a></li> 61 <li<?php if ($page == 'groups') echo ' class="isactive"'; ?>><a href="admin_groups.php"><?php echo $lang_admin_common['User groups'] ?></a></li> 62 <li<?php if ($page == 'censoring') echo ' class="isactive"'; ?>><a href="admin_censoring.php"><?php echo $lang_admin_common['Censoring'] ?></a></li> 63 <li<?php if ($page == 'ranks') echo ' class="isactive"'; ?>><a href="admin_ranks.php"><?php echo $lang_admin_common['Ranks'] ?></a></li> 64 <li<?php if ($page == 'maintenance') echo ' class="isactive"'; ?>><a href="admin_maintenance.php"><?php echo $lang_admin_common['Maintenance'] ?></a></li> 59 65 </ul> 60 66 </div> … … 62 68 <?php 63 69 70 } 71 64 72 // See if there are any plugins 65 $plugins = array(); 66 $d = dir(PUN_ROOT.'plugins'); 67 while (($entry = $d->read()) !== false) 68 { 69 $prefix = substr($entry, 0, strpos($entry, '_')); 70 $suffix = substr($entry, strlen($entry) - 4); 71 72 if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP')))) 73 $plugins[] = array(substr(substr($entry, strpos($entry, '_') + 1), 0, -4), $entry); 74 } 75 $d->close(); 73 $plugins = forum_list_plugins($is_admin); 76 74 77 75 // Did we find any plugins? … … 80 78 81 79 ?> 82 <h2 class="block2"><span> Plugins</span></h2>80 <h2 class="block2"><span><?php echo $lang_admin_common['Plugins menu'] ?></span></h2> 83 81 <div class="box"> 84 82 <div class="inbox"> … … 86 84 <?php 87 85 88 while (list(, $cur_plugin) = @each($plugins))89 echo "\t\t\t\t\t".'<li'.(($page == $ cur_plugin[1]) ? ' class="isactive"' : '').'><a href="admin_loader.php?plugin='.$cur_plugin[1].'">'.str_replace('_', ' ', $cur_plugin[0]).'</a></li>'."\n";86 foreach ($plugins as $plugin_name => $plugin) 87 echo "\t\t\t\t\t".'<li'.(($page == $plugin_name) ? ' class="isactive"' : '').'><a href="admin_loader.php?plugin='.$plugin_name.'">'.str_replace('_', ' ', $plugin).'</a></li>'."\n"; 90 88 91 89 ?> … … 118 116 119 117 // Fetch topics to prune 120 $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.$extra_sql, true) or error(' Impossible de retrouver la liste des discussions', __FILE__, __LINE__, $db->error());118 $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.$extra_sql, true) or error('Unable to fetch topics', __FILE__, __LINE__, $db->error()); 121 119 122 120 $topic_ids = ''; … … 127 125 { 128 126 // Fetch posts to prune 129 $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topic_ids.')', true) or error(' Impossible de retrouver les messages', __FILE__, __LINE__, $db->error());127 $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topic_ids.')', true) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); 130 128 131 129 $post_ids = ''; … … 136 134 { 137 135 // Delete topics 138 $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error(' Impossible d\'élaguer les discussions', __FILE__, __LINE__, $db->error());136 $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error()); 139 137 // Delete subscriptions 140 $db->query('DELETE FROM '.$db->prefix.' subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Impossible d\'élaguer les abonnements', __FILE__, __LINE__, $db->error());138 $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error()); 141 139 // Delete posts 142 $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error(' Impossible d\'élaguer les messages', __FILE__, __LINE__, $db->error());140 $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error()); 143 141 144 142 // We removed a bunch of posts, so now we have to update the search index
Note: See TracChangeset
for help on using the changeset viewer.