- Files:
-
- 159 added
- 2 deleted
- 133 edited
Legend:
- Unmodified
- Added
- Removed
-
/branches/rsr.v5.1.dev/web/app/data/modules/data_users.php
r1 r3 99 99 'username=\''.$db->escape($form_username).'\'' 100 100 :'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')'; 101 $_sql = 102 'SELECT id, group_id, password' 103 .' FROM '.$db->prefix.'users' 104 .' WHERE '.$username_sql; 101 105 $result = $db->query 102 ( 'SELECT id, group_id, password, save_pass' 103 .' FROM '.$db->prefix.'users' 104 .' WHERE '.$username_sql 106 ( $_sql 105 107 ) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); 106 list($user_id, $group_id, $db_password_hash, $save_pass) = $db->fetch_row($result); 108 list($user_id, $group_id, $db_password_hash) = $db->fetch_row($result); 109 $save_pass = 1; 107 110 $authorized = false; 108 111 if(!empty($db_password_hash)) -
/branches/rsr.v5.1.dev/web/app/out/dist/content/set_artistes/e_add_user_artiste.php
r1 r3 32 32 </td> 33 33 </tr> 34 < tr>34 <!-- tr> 35 35 <td> 36 36 <p><strong>dossier personnel</p></strong> … … 38 38 <input type="text" name="dossier_personnel" size="50" value="" /> 39 39 </td> 40 </tr >40 </tr --> 41 41 <tr> 42 42 <td colspan="2" align="right"> -
/branches/rsr.v5.1.dev/web/app/out/dist/content/set_artistes/e_set_user_artiste.php
r1 r3 36 36 </td> 37 37 </tr> 38 < tr>38 <!-- tr> 39 39 <td> 40 40 <p><strong>dossier personnel</p></strong> … … 42 42 <input type="text" name="dossier_personnel" size="50" value="<?= $env->out["artiste"]["dossier_personnel"] ?>" /> 43 43 </td> 44 </tr >44 </tr --> 45 45 <tr> 46 46 <td colspan="2" align="right"> -
/branches/rsr.v5.1.dev/web/app/out/dist/views/footer.php
r1 r3 42 42 <ul> 43 43 <li><a href="<?= $env->url(array("e" => "contact")) ?>">Contactez-nous</a></li> 44 <li><a href="http://w iki.rsr.free.fr/wiki">rsr - v.5</a></li>44 <li><a href="http://www.revolutionsoundrecords.org/trac">rsr - v.5 (trac)</a></li> 45 45 </ul> 46 46 </div> -
/branches/rsr.v5.1.dev/web/install/app/01_utils.php
r1 r3 13 13 } 14 14 15 function error($message) {} 16 15 17 ?> -
/branches/rsr.v5.1.dev/web/install/dist/sql/content.sql
r1 r3 11 11 (143, 'news', 'accueil_droite_bas', 'Les autres news', 'news.php', '', 186, '2009-09-01 19:57:51', 186, '2010-08-05 01:48:55', '2009-09-06 17:16:52', 1, 2), 12 12 (152, 'forum_interne', 'interne_gauche', 'Forum', 'accueil_forum.php', '<p>Ce bloc affiche les 7 derniers messages du forum.</p>', 186, '2009-09-06 19:46:30', 186, '2011-11-12 15:52:34', '2009-09-06 19:48:57', 0, 4), 13 (149, '', 'accueil_footer', 'Bloc en bas de la page d''accueil', '', '<p>Plus de docs sur <a href="http://w iki.rsr.free.fr/wiki">le wiki</a>.</p>\r\n<ul>\r\n</ul>\r\n<p>Pour les questions, les retours (...) vous êtes invités à venir en parler sur le <a href="http://www.revolutionsoundrecords.org/punbb">forum de l''association Revolution Sound Records</a>.</p>', 186, '2009-09-06 16:41:15', 186, '2011-11-12 22:36:42', '2009-09-06 19:07:34', 1, 6),13 (149, '', 'accueil_footer', 'Bloc en bas de la page d''accueil', '', '<p>Plus de docs sur <a href="http://www.revolutionsoundrecords.org/trac">le trac</a>.</p>\r\n<ul>\r\n</ul>\r\n<p>Pour les questions, les retours (...) vous êtes invités à venir en parler sur le <a href="http://www.revolutionsoundrecords.org/punbb">forum de l''association Revolution Sound Records</a>.</p>', 186, '2009-09-06 16:41:15', 186, '2011-11-12 22:36:42', '2009-09-06 19:07:34', 1, 6), 14 14 (128, 'administration', NULL, 'Administration', 'admin.php', '', 186, '2009-08-10 10:27:12', 186, '2009-09-06 00:13:40', '2009-09-06 00:13:40', 1, 4), 15 15 (155, '', 'interne_gauche', 'News', 'menu_news.php', '<p>Affiche les 2 dernières news et un menu pour accéder aux autres news.</p>', 186, '2010-01-15 22:39:32', 186, '2011-11-12 16:10:38', NULL, 1, 1), … … 88 88 INSERT INTO `[prefix]contenus` (`id`, `nom`, `categorie`, `titre`, `description`, `contenu`, `auteur_creation`, `date_creation`, `auteur_modification`, `date_modification`, `date_publication`, `public`, `ordre`) VALUES 89 89 (919, '', 1, 'Nouvelle installation', '', '<p>Bienvenue sur votre installation de rsr v.5.</p>\r\n<p>Pensez à effacer le dossier <strong>install</strong></p>\r\n<p> </p>\r\n<p>Bonnes publications !</p>', 186, '2011-09-04 15:03:09', 186, '2011-11-12 22:07:24', '2011-09-04 00:00:00', 1, NULL); 90 91 90 # -- 92 91 INSERT INTO `[prefix]formats` (`id`, `nom`, `content_type`) VALUES … … 120 119 # -- 121 120 INSERT INTO `[prefix]pun_config` (`conf_name`, `conf_value`) VALUES 122 ('o_cur_version', '1. 2.10'),121 ('o_cur_version', '1.4.7'), 123 122 ('o_cur_version_fr', '1.2.10'), 124 123 ('o_board_title', 'Forums'), 125 124 ('o_board_desc', NULL), 126 ('o_ server_timezone', '0'),125 ('o_default_timezone', '0'), 127 126 ('o_time_format', 'H:i:s'), 128 127 ('o_date_format', 'd-m-Y'), 129 ('o_timeout_visit', ' 600'),128 ('o_timeout_visit', '1800'), 130 129 ('o_timeout_online', '300'), 131 130 ('o_redirect_delay', '1'), … … 163 162 ('o_admin_email', '[email_admin]'), 164 163 ('o_webmaster_email', '[email_admin]'), 165 ('o_ subscriptions', '1'),164 ('o_topic_subscriptions', '1'), 166 165 ('o_smtp_host', NULL), 167 166 ('o_smtp_user', NULL), … … 177 176 ('o_maintenance', '0'), 178 177 ('o_maintenance_message', 'Les forums sont temporairement fermés pour des raisons de maintenance. Nous vous prions de bien vouloir nous excuser pour cette gÚne. Veuillez essayer à nouveau d''ici quelques minutes.<br />\n<br />\nRevolution Sound Records'), 179 ('p_mod_edit_users', '1'), 180 ('p_mod_rename_users', '0'), 181 ('p_mod_change_passwords', '0'), 182 ('p_mod_ban_users', '0'), 178 ('o_forum_subscriptions', '1'), 183 179 ('p_message_bbcode', '1'), 184 180 ('p_message_img_tag', '1'), … … 192 188 ('p_allow_banned_email', '1'), 193 189 ('p_allow_dupe_email', '0'), 194 ('p_force_guest_email', '1'); 190 ('p_force_guest_email', '1'), 191 ('o_database_revision', '15'), 192 ('o_searchindex_revision', '2'), 193 ('o_parser_revision', '2'), 194 ('o_default_email_setting', '1'), 195 ('o_topic_views', '1'), 196 ('o_signatures', '1'), 197 ('o_smtp_ssl', '0'), 198 ('o_default_dst', '0'), 199 ('o_quote_depth', '3'), 200 ('o_feed_type', '2'), 201 ('o_feed_ttl', '0'); 195 202 # -- 196 203 INSERT INTO `[prefix]pun_forum_perms` (`group_id`, `forum_id`, `read_forum`, `post_replies`, `post_topics`) VALUES … … 220 227 (6, 80, 0, 0, 0); 221 228 # -- 222 INSERT INTO `[prefix]pun_groups` (`g_id`, `g_title`, `g_user_title`, `g_ read_board`, `g_post_replies`, `g_post_topics`, `g_post_polls`, `g_edit_posts`, `g_delete_posts`, `g_delete_topics`, `g_set_title`, `g_search`, `g_search_users`, `g_edit_subjects_interval`, `g_post_flood`, `g_search_flood`) VALUES223 (1, 'Admin', 'Admin', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0),224 (2, 'Modérateurs', 'Modérateur', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0),225 (3, 'Touriste', NULL, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0),226 (4, 'Membres', NULL, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 300, 60, 30),227 (5, 'Artiste', 'Artiste', 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 10, 10),228 (6, '100 eme Membre', '100 eme Membre', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 300, 60, 30);229 # -- 230 INSERT INTO `[prefix]pun_online` (`user_id`, `ident`, `logged`, `idle` ) VALUES231 (1, '192.168.10.13', 1321 118546, 0);229 INSERT INTO `[prefix]pun_groups` (`g_id`, `g_title`, `g_user_title`, `g_moderator`, `g_mod_edit_users`, `g_mod_rename_users`, `g_mod_change_passwords`, `g_mod_ban_users`, `g_read_board`, `g_view_users`, `g_post_replies`, `g_post_topics`, `g_edit_posts`, `g_delete_posts`, `g_delete_topics`, `g_set_title`, `g_search`, `g_search_users`, `g_send_email`, `g_post_flood`, `g_search_flood`, `g_email_flood`, `g_report_flood`) VALUES 230 (1, 'Admin', 'Admin', 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0), 231 (2, 'Modérateurs', 'Modérateur', 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0), 232 (3, 'Touriste', NULL, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0), 233 (4, 'Membres', NULL, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60, 60), 234 (5, 'Artiste', 'Artiste', 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 10, 10, 60, 60), 235 (6, '100 eme Membre', '100 eme Membre', 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60, 60); 236 # -- 237 INSERT INTO `[prefix]pun_online` (`user_id`, `ident`, `logged`, `idle`, `last_post`, `last_search`) VALUES 238 (1, '192.168.10.13', 1321306351, 0, NULL, NULL); 232 239 # -- 233 240 INSERT INTO `[prefix]pun_ranks` (`id`, `rank`, `min_posts`) VALUES … … 254 261 (87, 'terminator.png', ':terminator:', 0); 255 262 # -- 256 INSERT INTO `[prefix]pun_users` (`id`, `group_id`, `username`, `password`, `email`, `title`, `realname`, `url`, `jabber`, `icq`, `msn`, `aim`, `yahoo`, `location`, ` use_avatar`, `signature`, `disp_topics`, `disp_posts`, `email_setting`, `save_pass`, `notify_with_post`, `show_smilies`, `show_img`, `show_img_sig`, `show_avatars`, `show_sig`, `timezone`, `language`, `style`, `num_posts`, `last_post`, `registered`, `registration_ip`, `last_visit`, `admin_note`, `activate_string`, `activate_key`) VALUES257 (186, 1, 'admin', '90f1b3c6cf62b05606b215265803f553e22bc657', '[email_admin]', NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 1, 1, 0, 1, 1, 1, 1, 1, 0, 'French', 'Rsr', 1382, 1321043538, 1156702867, '82.243.194.97', 1321118443, NULL, NULL, NULL),258 (1, 3, 'Invité', 'Invité', 'Invité', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 1, 1, 0, 1, 1, 1, 1, 1, 0, 'English', 'Oxygen', 0, NULL, 0, '0.0.0.0', 0, NULL, NULL, NULL);263 INSERT INTO `[prefix]pun_users` (`id`, `group_id`, `username`, `password`, `email`, `title`, `realname`, `url`, `jabber`, `icq`, `msn`, `aim`, `yahoo`, `location`, `signature`, `disp_topics`, `disp_posts`, `email_setting`, `notify_with_post`, `auto_notify`, `show_smilies`, `show_img`, `show_img_sig`, `show_avatars`, `show_sig`, `timezone`, `dst`, `date_format`, `time_format`, `language`, `style`, `num_posts`, `last_post`, `last_search`, `last_email_sent`, `last_report_sent`, `registered`, `registration_ip`, `last_visit`, `admin_note`, `activate_string`, `activate_key`) VALUES 264 (186, 1, 'admin', '90f1b3c6cf62b05606b215265803f553e22bc657', '[email_admin]', NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 'French', 'Rsr', 1382, 1321043538, NULL, NULL, NULL, 1156702867, '82.243.194.97', 1321305012, NULL, NULL, NULL), 265 (1, 3, 'Invité', 'Invité', 'Invité', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 'English', 'Oxygen', 0, NULL, NULL, NULL, NULL, 0, '0.0.0.0', 0, NULL, NULL, NULL); -
/branches/rsr.v5.1.dev/web/install/dist/sql/raz.sql
r1 r3 27 27 DROP TABLE IF EXISTS `[prefix]playlists`; 28 28 # -- 29 DROP TABLE IF EXISTS `[prefix]playlis [prefix]download`;29 DROP TABLE IF EXISTS `[prefix]playlist_download`; 30 30 # -- 31 31 DROP TABLE IF EXISTS `[prefix]pun_bans`; … … 40 40 # -- 41 41 DROP TABLE IF EXISTS `[prefix]pun_forum_perms`; 42 # -- 43 DROP TABLE IF EXISTS `[prefix]pun_forum_subscriptions`; 42 44 # -- 43 45 DROP TABLE IF EXISTS `[prefix]pun_groups`; … … 59 61 DROP TABLE IF EXISTS `[prefix]pun_smilies`; 60 62 # -- 61 DROP TABLE IF EXISTS `[prefix]pun_ subscriptions`;63 DROP TABLE IF EXISTS `[prefix]pun_topics`; 62 64 # -- 63 DROP TABLE IF EXISTS `[prefix]pun_topic s`;65 DROP TABLE IF EXISTS `[prefix]pun_topic_subscriptions`; 64 66 # -- 65 67 DROP TABLE IF EXISTS `[prefix]pun_users`; -
/branches/rsr.v5.1.dev/web/install/dist/sql/tables.sql
r1 r3 1 CREATE TABLE IF NOT EXISTS`[prefix]albums` (1 CREATE TABLE `[prefix]albums` ( 2 2 `id` int(11) NOT NULL AUTO_INCREMENT, 3 3 `id_artiste` int(11) NOT NULL, … … 16 16 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 17 17 # -- 18 CREATE TABLE IF NOT EXISTS`[prefix]artistes` (18 CREATE TABLE `[prefix]artistes` ( 19 19 `id` int(11) NOT NULL AUTO_INCREMENT, 20 20 `nom` varchar(255) DEFAULT NULL, … … 40 40 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 41 41 # -- 42 CREATE TABLE IF NOT EXISTS`[prefix]artistes_admins` (42 CREATE TABLE `[prefix]artistes_admins` ( 43 43 `id_artiste` int(11) NOT NULL, 44 44 `pun_user` int(11) NOT NULL, … … 46 46 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 47 47 # -- 48 CREATE TABLE IF NOT EXISTS`[prefix]boxes` (48 CREATE TABLE `[prefix]boxes` ( 49 49 `id` int(11) NOT NULL AUTO_INCREMENT, 50 50 `nom` varchar(64) DEFAULT NULL, … … 63 63 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=162 ; 64 64 # -- 65 CREATE TABLE IF NOT EXISTS`[prefix]categories` (65 CREATE TABLE `[prefix]categories` ( 66 66 `id` int(11) NOT NULL AUTO_INCREMENT, 67 67 `nom` varchar(64) DEFAULT NULL, … … 74 74 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=103 ; 75 75 # -- 76 CREATE TABLE IF NOT EXISTS`[prefix]categories_tree` (76 CREATE TABLE `[prefix]categories_tree` ( 77 77 `parent` int(11) NOT NULL, 78 78 `child` int(11) NOT NULL, … … 80 80 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 81 81 # -- 82 CREATE TABLE IF NOT EXISTS`[prefix]concerts` (82 CREATE TABLE `[prefix]concerts` ( 83 83 `id` int(11) NOT NULL AUTO_INCREMENT, 84 84 `id_artiste` int(11) DEFAULT NULL, … … 94 94 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 95 95 # -- 96 CREATE TABLE IF NOT EXISTS`[prefix]configuration` (96 CREATE TABLE `[prefix]configuration` ( 97 97 `key` varchar(255) NOT NULL, 98 98 `value` text NOT NULL, … … 100 100 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 101 101 # -- 102 CREATE TABLE IF NOT EXISTS`[prefix]contenus` (102 CREATE TABLE `[prefix]contenus` ( 103 103 `id` int(11) NOT NULL AUTO_INCREMENT, 104 104 `nom` varchar(64) DEFAULT NULL, … … 117 117 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=935 ; 118 118 # -- 119 CREATE TABLE IF NOT EXISTS`[prefix]downloads` (119 CREATE TABLE `[prefix]downloads` ( 120 120 `id` int(11) NOT NULL AUTO_INCREMENT, 121 121 `id_artiste` int(11) DEFAULT NULL, … … 131 131 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 132 132 # -- 133 CREATE TABLE IF NOT EXISTS`[prefix]download_urls` (133 CREATE TABLE `[prefix]download_urls` ( 134 134 `id` int(11) NOT NULL AUTO_INCREMENT, 135 135 `id_download` int(11) DEFAULT NULL, … … 143 143 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 144 144 # -- 145 CREATE TABLE IF NOT EXISTS`[prefix]formats` (145 CREATE TABLE `[prefix]formats` ( 146 146 `id` int(11) NOT NULL AUTO_INCREMENT, 147 147 `nom` varchar(32) DEFAULT NULL, … … 150 150 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ; 151 151 # -- 152 CREATE TABLE IF NOT EXISTS`[prefix]licences` (152 CREATE TABLE `[prefix]licences` ( 153 153 `id` int(11) NOT NULL AUTO_INCREMENT, 154 154 `nom` varchar(255) NOT NULL DEFAULT '', … … 158 158 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ; 159 159 # -- 160 CREATE TABLE IF NOT EXISTS`[prefix]playlists` (160 CREATE TABLE `[prefix]playlists` ( 161 161 `id` int(11) NOT NULL AUTO_INCREMENT, 162 162 `pun_user` int(11) NOT NULL, … … 167 167 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 168 168 # -- 169 CREATE TABLE IF NOT EXISTS`[prefix]playlist_download` (169 CREATE TABLE `[prefix]playlist_download` ( 170 170 `id` int(11) NOT NULL, 171 171 `id_download` int(11) NOT NULL, … … 173 173 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 174 174 # -- 175 CREATE TABLE IF NOT EXISTS`[prefix]pun_bans` (175 CREATE TABLE `[prefix]pun_bans` ( 176 176 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 177 177 `username` varchar(200) DEFAULT NULL, 178 178 `ip` varchar(255) DEFAULT NULL, 179 `email` varchar( 50) DEFAULT NULL,179 `email` varchar(80) DEFAULT NULL, 180 180 `message` varchar(255) DEFAULT NULL, 181 181 `expire` int(10) unsigned DEFAULT NULL, 182 PRIMARY KEY (`id`) 182 `ban_creator` int(10) unsigned NOT NULL DEFAULT '0', 183 PRIMARY KEY (`id`), 184 KEY `[prefix]pun_bans_username_idx` (`username`(25)) 183 185 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ; 184 186 # -- 185 CREATE TABLE IF NOT EXISTS`[prefix]pun_categories` (187 CREATE TABLE `[prefix]pun_categories` ( 186 188 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 187 189 `cat_name` varchar(80) NOT NULL DEFAULT 'New Category', … … 190 192 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=22 ; 191 193 # -- 192 CREATE TABLE IF NOT EXISTS`[prefix]pun_censoring` (194 CREATE TABLE `[prefix]pun_censoring` ( 193 195 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 194 196 `search_for` varchar(60) NOT NULL DEFAULT '', … … 197 199 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 198 200 # -- 199 CREATE TABLE IF NOT EXISTS`[prefix]pun_config` (201 CREATE TABLE `[prefix]pun_config` ( 200 202 `conf_name` varchar(255) NOT NULL DEFAULT '', 201 203 `conf_value` text, … … 203 205 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 204 206 # -- 205 CREATE TABLE IF NOT EXISTS`[prefix]pun_forums` (207 CREATE TABLE `[prefix]pun_forums` ( 206 208 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 207 209 `forum_name` varchar(80) NOT NULL DEFAULT 'New forum', … … 220 222 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=103 ; 221 223 # -- 222 CREATE TABLE IF NOT EXISTS`[prefix]pun_forum_perms` (224 CREATE TABLE `[prefix]pun_forum_perms` ( 223 225 `group_id` int(10) NOT NULL DEFAULT '0', 224 226 `forum_id` int(10) NOT NULL DEFAULT '0', … … 229 231 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 230 232 # -- 231 CREATE TABLE IF NOT EXISTS `[prefix]pun_groups` ( 233 CREATE TABLE `[prefix]pun_forum_subscriptions` ( 234 `user_id` int(10) unsigned NOT NULL DEFAULT '0', 235 `forum_id` int(10) unsigned NOT NULL DEFAULT '0', 236 PRIMARY KEY (`user_id`,`forum_id`) 237 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 238 # -- 239 CREATE TABLE `[prefix]pun_groups` ( 232 240 `g_id` int(10) unsigned NOT NULL AUTO_INCREMENT, 233 241 `g_title` varchar(50) NOT NULL DEFAULT '', 234 242 `g_user_title` varchar(50) DEFAULT NULL, 243 `g_moderator` tinyint(1) NOT NULL DEFAULT '0', 244 `g_mod_edit_users` tinyint(1) NOT NULL DEFAULT '0', 245 `g_mod_rename_users` tinyint(1) NOT NULL DEFAULT '0', 246 `g_mod_change_passwords` tinyint(1) NOT NULL DEFAULT '0', 247 `g_mod_ban_users` tinyint(1) NOT NULL DEFAULT '0', 235 248 `g_read_board` tinyint(1) NOT NULL DEFAULT '1', 249 `g_view_users` tinyint(1) NOT NULL DEFAULT '1', 236 250 `g_post_replies` tinyint(1) NOT NULL DEFAULT '1', 237 251 `g_post_topics` tinyint(1) NOT NULL DEFAULT '1', 238 `g_post_polls` tinyint(1) NOT NULL DEFAULT '1',239 252 `g_edit_posts` tinyint(1) NOT NULL DEFAULT '1', 240 253 `g_delete_posts` tinyint(1) NOT NULL DEFAULT '1', … … 243 256 `g_search` tinyint(1) NOT NULL DEFAULT '1', 244 257 `g_search_users` tinyint(1) NOT NULL DEFAULT '1', 245 `g_ edit_subjects_interval` smallint(6) NOT NULL DEFAULT '300',258 `g_send_email` tinyint(1) NOT NULL DEFAULT '1', 246 259 `g_post_flood` smallint(6) NOT NULL DEFAULT '30', 247 260 `g_search_flood` smallint(6) NOT NULL DEFAULT '30', 261 `g_email_flood` smallint(6) NOT NULL DEFAULT '60', 262 `g_report_flood` smallint(6) NOT NULL DEFAULT '60', 248 263 PRIMARY KEY (`g_id`) 249 264 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ; 250 265 # -- 251 CREATE TABLE IF NOT EXISTS`[prefix]pun_online` (266 CREATE TABLE `[prefix]pun_online` ( 252 267 `user_id` int(10) unsigned NOT NULL DEFAULT '1', 253 268 `ident` varchar(200) NOT NULL DEFAULT '', 254 269 `logged` int(10) unsigned NOT NULL DEFAULT '0', 255 270 `idle` tinyint(1) NOT NULL DEFAULT '0', 256 KEY `pun_online_user_id_idx` (`user_id`) 257 ) ENGINE=MEMORY DEFAULT CHARSET=utf8; 258 # -- 259 CREATE TABLE IF NOT EXISTS `[prefix]pun_posts` ( 271 `last_post` int(10) unsigned DEFAULT NULL, 272 `last_search` int(10) unsigned DEFAULT NULL, 273 UNIQUE KEY `[prefix]pun_online_user_id_ident_idx` (`user_id`,`ident`(25)), 274 KEY `pun_online_user_id_idx` (`user_id`), 275 KEY `[prefix]pun_online_ident_idx` (`ident`(25)), 276 KEY `[prefix]pun_online_logged_idx` (`logged`) 277 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 278 # -- 279 CREATE TABLE `[prefix]pun_posts` ( 260 280 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 261 281 `poster` varchar(200) NOT NULL DEFAULT '', 262 282 `poster_id` int(10) unsigned NOT NULL DEFAULT '1', 263 `poster_ip` varchar( 15) DEFAULT NULL,264 `poster_email` varchar( 50) DEFAULT NULL,265 `message` text NOT NULL,283 `poster_ip` varchar(39) DEFAULT NULL, 284 `poster_email` varchar(80) DEFAULT NULL, 285 `message` mediumtext, 266 286 `hide_smilies` tinyint(1) NOT NULL DEFAULT '0', 267 287 `posted` int(10) unsigned NOT NULL DEFAULT '0', … … 274 294 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=21233 ; 275 295 # -- 276 CREATE TABLE IF NOT EXISTS`[prefix]pun_ranks` (296 CREATE TABLE `[prefix]pun_ranks` ( 277 297 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 278 298 `rank` varchar(50) NOT NULL DEFAULT '', … … 281 301 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ; 282 302 # -- 283 CREATE TABLE IF NOT EXISTS`[prefix]pun_reports` (303 CREATE TABLE `[prefix]pun_reports` ( 284 304 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 285 305 `post_id` int(10) unsigned NOT NULL DEFAULT '0', … … 295 315 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; 296 316 # -- 297 CREATE TABLE IF NOT EXISTS`[prefix]pun_search_cache` (317 CREATE TABLE `[prefix]pun_search_cache` ( 298 318 `id` int(10) unsigned NOT NULL DEFAULT '0', 299 319 `ident` varchar(200) NOT NULL DEFAULT '', 300 `search_data` text NOT NULL,320 `search_data` mediumtext, 301 321 PRIMARY KEY (`id`), 302 322 KEY `pun_search_cache_ident_idx` (`ident`(8)) 303 323 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 304 324 # -- 305 CREATE TABLE IF NOT EXISTS`[prefix]pun_search_matches` (325 CREATE TABLE `[prefix]pun_search_matches` ( 306 326 `post_id` int(10) unsigned NOT NULL DEFAULT '0', 307 327 `word_id` mediumint(8) unsigned NOT NULL DEFAULT '0', … … 311 331 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 312 332 # -- 313 CREATE TABLE IF NOT EXISTS`[prefix]pun_search_words` (333 CREATE TABLE `[prefix]pun_search_words` ( 314 334 `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, 315 335 `word` varchar(20) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', … … 318 338 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 319 339 # -- 320 CREATE TABLE IF NOT EXISTS`[prefix]pun_smilies` (340 CREATE TABLE `[prefix]pun_smilies` ( 321 341 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 322 342 `image` varchar(60) NOT NULL DEFAULT '', … … 326 346 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=89 ; 327 347 # -- 328 CREATE TABLE IF NOT EXISTS `[prefix]pun_subscriptions` ( 329 `user_id` int(10) unsigned NOT NULL DEFAULT '0', 330 `topic_id` int(10) unsigned NOT NULL DEFAULT '0', 331 PRIMARY KEY (`user_id`,`topic_id`) 332 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 333 # -- 334 CREATE TABLE IF NOT EXISTS `[prefix]pun_topics` ( 348 CREATE TABLE `[prefix]pun_topics` ( 335 349 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 336 350 `poster` varchar(200) NOT NULL DEFAULT '', 337 351 `subject` varchar(255) NOT NULL DEFAULT '', 338 352 `posted` int(10) unsigned NOT NULL DEFAULT '0', 353 `first_post_id` int(10) unsigned NOT NULL DEFAULT '0', 339 354 `last_post` int(10) unsigned NOT NULL DEFAULT '0', 340 355 `last_post_id` int(10) unsigned NOT NULL DEFAULT '0', … … 348 363 PRIMARY KEY (`id`), 349 364 KEY `pun_topics_forum_id_idx` (`forum_id`), 350 KEY `pun_topics_moved_to_idx` (`moved_to`) 365 KEY `pun_topics_moved_to_idx` (`moved_to`), 366 KEY `[prefix]pun_topics_last_post_idx` (`last_post`), 367 KEY `[prefix]pun_topics_first_post_id_idx` (`first_post_id`) 351 368 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2441 ; 352 369 # -- 353 CREATE TABLE IF NOT EXISTS `[prefix]pun_users` ( 370 CREATE TABLE `[prefix]pun_topic_subscriptions` ( 371 `user_id` int(10) unsigned NOT NULL DEFAULT '0', 372 `topic_id` int(10) unsigned NOT NULL DEFAULT '0', 373 PRIMARY KEY (`user_id`,`topic_id`) 374 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 375 # -- 376 CREATE TABLE `[prefix]pun_users` ( 354 377 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 355 378 `group_id` int(10) unsigned NOT NULL DEFAULT '4', 356 379 `username` varchar(200) NOT NULL DEFAULT '', 357 380 `password` varchar(40) NOT NULL DEFAULT '', 358 `email` varchar( 50) NOT NULL DEFAULT '',381 `email` varchar(80) NOT NULL DEFAULT '', 359 382 `title` varchar(50) DEFAULT NULL, 360 383 `realname` varchar(40) DEFAULT NULL, 361 384 `url` varchar(100) DEFAULT NULL, 362 `jabber` varchar( 75) DEFAULT NULL,385 `jabber` varchar(80) DEFAULT NULL, 363 386 `icq` varchar(12) DEFAULT NULL, 364 `msn` varchar( 50) DEFAULT NULL,387 `msn` varchar(80) DEFAULT NULL, 365 388 `aim` varchar(30) DEFAULT NULL, 366 389 `yahoo` varchar(30) DEFAULT NULL, 367 390 `location` varchar(30) DEFAULT NULL, 368 `use_avatar` tinyint(1) NOT NULL DEFAULT '0',369 391 `signature` text, 370 392 `disp_topics` tinyint(3) unsigned DEFAULT NULL, 371 393 `disp_posts` tinyint(3) unsigned DEFAULT NULL, 372 394 `email_setting` tinyint(1) NOT NULL DEFAULT '1', 373 `save_pass` tinyint(1) NOT NULL DEFAULT '1',374 395 `notify_with_post` tinyint(1) NOT NULL DEFAULT '0', 396 `auto_notify` tinyint(1) NOT NULL DEFAULT '0', 375 397 `show_smilies` tinyint(1) NOT NULL DEFAULT '1', 376 398 `show_img` tinyint(1) NOT NULL DEFAULT '1', … … 379 401 `show_sig` tinyint(1) NOT NULL DEFAULT '1', 380 402 `timezone` float NOT NULL DEFAULT '0', 403 `dst` tinyint(1) NOT NULL DEFAULT '0', 404 `date_format` tinyint(1) NOT NULL DEFAULT '0', 405 `time_format` tinyint(1) NOT NULL DEFAULT '0', 381 406 `language` varchar(25) NOT NULL DEFAULT 'English', 382 407 `style` varchar(25) NOT NULL DEFAULT 'Oxygen', 383 408 `num_posts` int(10) unsigned NOT NULL DEFAULT '0', 384 409 `last_post` int(10) unsigned DEFAULT NULL, 410 `last_search` int(10) unsigned DEFAULT NULL, 411 `last_email_sent` int(10) unsigned DEFAULT NULL, 412 `last_report_sent` int(10) unsigned DEFAULT NULL, 385 413 `registered` int(10) unsigned NOT NULL DEFAULT '0', 386 `registration_ip` varchar( 15) NOT NULL DEFAULT '0.0.0.0',414 `registration_ip` varchar(39) NOT NULL DEFAULT '0.0.0.0', 387 415 `last_visit` int(10) unsigned NOT NULL DEFAULT '0', 388 416 `admin_note` varchar(30) DEFAULT NULL, 389 `activate_string` varchar( 50) DEFAULT NULL,417 `activate_string` varchar(80) DEFAULT NULL, 390 418 `activate_key` varchar(8) DEFAULT NULL, 391 419 PRIMARY KEY (`id`), 420 UNIQUE KEY `[prefix]_pun_users_username_idx` (`username`(25)), 392 421 KEY `pun_users_registered_idx` (`registered`), 393 422 KEY `pun_users_username_idx` (`username`(8)) 394 423 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1559 ; 395 424 # -- 396 CREATE TABLE IF NOT EXISTS`[prefix]super_admins` (425 CREATE TABLE `[prefix]super_admins` ( 397 426 `id_pun_user` int(11) NOT NULL, 398 427 PRIMARY KEY (`id_pun_user`) 399 428 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 400 429 # -- 401 CREATE TABLE IF NOT EXISTS`[prefix]thumbs` (430 CREATE TABLE `[prefix]thumbs` ( 402 431 `id` int(11) NOT NULL AUTO_INCREMENT, 403 432 `src` varchar(255) NOT NULL DEFAULT '', … … 413 442 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 414 443 # -- 415 CREATE TABLE IF NOT EXISTS`[prefix]videos` (444 CREATE TABLE `[prefix]videos` ( 416 445 `id` int(11) NOT NULL AUTO_INCREMENT, 417 446 `id_artiste` int(11) DEFAULT NULL, -
/branches/rsr.v5.1.dev/web/install/mods/e_install.php
r1 r3 123 123 124 124 function install_db($env) 125 { try 126 { if(($sql = file_get_contents("dist/sql/init.sql")) !== false) 127 { if($sql) try 128 { $env->data->sql->query($sql); 125 { $flag = 0; 126 try 127 { $env->data->sql->query("USE ".$_POST["db_base"]); 128 if(($sql = file_get_contents("dist/sql/init.sql")) !== false) 129 { $flag = 1; 130 if($sql) try 131 { $flag = 2; 132 $env->data->sql->query($sql); 133 $flag = 3; 129 134 if(($sql = file_get_contents("dist/sql/raz.sql")) !== false) 130 { if($sql) try 131 { $sql = str_replace("[prefix]", $_POST["db_prefix"], $sql); 135 { $flag = 4; 136 if($sql) try 137 { $flag = 5; 138 $sql = str_replace("[prefix]", $_POST["db_prefix"], $sql); 132 139 $v_sql = explode("# --", $sql); 133 140 foreach($v_sql as $_sql) if($_sql) $env->data->sql->query($_sql); 141 $flag = 6; 134 142 if(($sql = file_get_contents("dist/sql/tables.sql")) !== false) 135 { if($sql) try 136 { $sql = str_replace("[prefix]", $_POST["db_prefix"], $sql); 143 { $flag = 7; 144 if($sql) try 145 { $flag = 8; 146 $sql = str_replace("[prefix]", $_POST["db_prefix"], $sql); 137 147 $v_sql = explode("# --", $sql); 138 148 foreach($v_sql as $_sql) if($_sql) $env->data->sql->query($_sql); 149 $flag = 9; 139 150 if(($sql = file_get_contents("dist/sql/content.sql")) !== false) 140 { if($sql) try 141 { $punbb_url = "http://".$_SERVER["SERVER_NAME"]; 151 { $flag = 10; 152 if($sql) try 153 { $flag = 11; 154 $punbb_url = "http://".$_SERVER["SERVER_NAME"]; 142 155 $v_path = explode("/", $_SERVER["SCRIPT_NAME"]); 143 156 $path = ""; … … 161 174 $v_sql = explode("# --", $sql); 162 175 foreach($v_sql as $_sql) if($_sql) $env->data->sql->query($_sql); 176 $flag = 12; 163 177 } 164 178 catch(Exception $_e) … … 173 187 ."<br/>vérifiez que vous avez bien uploadé tous les fichiers"; 174 188 } 175 catch(Exception $_e) { $env->message = "Impossible d'executer les requetes du fichier tables.sql"; return; } 189 catch(Exception $_e) 190 { $env->message = 191 "Impossible d'executer les requetes du fichier tables.sql" 192 ."<br/>erreur dans la requete sql:<br/>".$_sql; 193 return; 194 } 176 195 } 177 196 else $env->message .= … … 185 204 ."<br/>vérifiez que vous avez bien uploadé tous les fichiers"; 186 205 } 187 catch(Exception $_e) { $env->message = "Impossible d'executer les requetes du fichier init.sql"; return; } 206 catch(Exception $_e) 207 { $env->message = 208 "Impossible d'executer les requetes du fichier init.sql (flag ".$flag.")" 209 ."<br>Vérifiez que vous avez indiqué les bon paramètres de connection à la base de données"; 210 return; 211 } 188 212 } 189 213 else $env->message .= … … 191 215 ."<br/>vérifiez que vous avez bien uploadé tous les fichiers"; 192 216 } 193 catch(Exception $_e) { $env->message .= " <br/>impossible d'accéder à la base de données"; }217 catch(Exception $_e) { $env->message .= "impossible d'accéder à la base de données"; } 194 218 } 195 219 196 220 function clear_pun_cache() 197 221 { if(is_dir("../punbb/cache/") && ($dh = opendir("../punbb/cache/"))) 198 { while(($file = readdir($dh)) !== false) if(strpos($file, "cache_") === 0 && $file !== "cache_smilies.php") @unlink("../punbb/cache/".$file);222 { while(($file = readdir($dh)) !== false) if(strpos($file, "cache_") === 0) @unlink("../punbb/cache/".$file); 199 223 closedir($dh); 200 224 } -
/branches/rsr.v5.1.dev/web/punbb/admin_bans.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_MOD || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '0'))17 if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) 35 18 message($lang_common['No permission']); 36 19 20 // Load the admin_bans.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_bans.php'; 37 22 38 23 // Add/edit a ban (stage 1) … … 41 26 if (isset($_GET['add_ban']) || isset($_POST['add_ban'])) 42 27 { 43 // If the idof the user to ban was provided through GET (a link from profile.php)28 // If the ID of the user to ban was provided through GET (a link from profile.php) 44 29 if (isset($_GET['add_ban'])) 45 30 { 46 $ add_ban= intval($_GET['add_ban']);47 if ($ add_ban< 2)31 $user_id = intval($_GET['add_ban']); 32 if ($user_id < 2) 48 33 message($lang_common['Bad request']); 49 34 50 $user_id = $add_ban; 51 52 $result = $db->query('SELECT group_id, username, email FROM '.$db->prefix.'users WHERE id='.$user_id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); 35 $result = $db->query('SELECT group_id, username, email FROM '.$db->prefix.'users WHERE id='.$user_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 53 36 if ($db->num_rows($result)) 54 37 list($group_id, $ban_user, $ban_email) = $db->fetch_row($result); 55 38 else 56 message( 'Aucun utilisateur enregistré sous cet identifiant (ID).');57 } 58 else 59 { 60 $ban_user = trim($_POST['new_ban_user']);39 message($lang_admin_bans['No user ID message']); 40 } 41 else // Otherwise the username is in POST 42 { 43 $ban_user = pun_trim($_POST['new_ban_user']); 61 44 62 45 if ($ban_user != '') 63 46 { 64 $result = $db->query('SELECT id, group_id, username, email FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error(' Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error());47 $result = $db->query('SELECT id, group_id, username, email FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 65 48 if ($db->num_rows($result)) 66 49 list($user_id, $group_id, $ban_user, $ban_email) = $db->fetch_row($result); 67 50 else 68 message( 'Aucun utilisateur enregistré sous ce nom d\'utilisateur. Si vous souhaitez ajouter un bannissement qui ne soit pas lié à un nom d\'utilisateur particulier, laissez la case vide.');51 message($lang_admin_bans['No user message']); 69 52 } 70 53 } 71 54 72 // Make sure we're not banning an admin 73 if (isset($group_id) && $group_id == PUN_ADMIN) 74 message('L\'utilisateur '.pun_htmlspecialchars($ban_user).' est un administrateur, il ne peut être bannis. Si vous souhaitez bannir un administrateur, vous devez d\'abord le rétrograder soit modérateur soit utilisateur.'); 55 // Make sure we're not banning an admin or moderator 56 if (isset($group_id)) 57 { 58 if ($group_id == PUN_ADMIN) 59 message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); 60 61 $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); 62 $is_moderator_group = $db->result($result); 63 64 if ($is_moderator_group) 65 message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); 66 } 75 67 76 68 // If we have a $user_id, we can try to find the last known IP of that user 77 69 if (isset($user_id)) 78 70 { 79 $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE poster_id='.$user_id.' ORDER BY posted DESC LIMIT 1') or error(' Impossible de retrouver les informations des messages', __FILE__, __LINE__, $db->error());71 $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE poster_id='.$user_id.' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 80 72 $ban_ip = ($db->num_rows($result)) ? $db->result($result) : ''; 73 74 if ($ban_ip == '') 75 { 76 $result = $db->query('SELECT registration_ip FROM '.$db->prefix.'users WHERE id='.$user_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 77 $ban_ip = ($db->num_rows($result)) ? $db->result($result) : ''; 78 } 81 79 } 82 80 83 81 $mode = 'add'; 84 82 } 85 else 83 else // We are editing a ban 86 84 { 87 85 $ban_id = intval($_GET['edit_ban']); … … 89 87 message($lang_common['Bad request']); 90 88 91 $result = $db->query('SELECT username, ip, email, message, expire FROM '.$db->prefix.'bans WHERE id='.$ban_id) or error(' Impossible de retrouver les informations de bannissement', __FILE__, __LINE__, $db->error());89 $result = $db->query('SELECT username, ip, email, message, expire FROM '.$db->prefix.'bans WHERE id='.$ban_id) or error('Unable to fetch ban info', __FILE__, __LINE__, $db->error()); 92 90 if ($db->num_rows($result)) 93 91 list($ban_user, $ban_ip, $ban_email, $ban_message, $ban_expire) = $db->fetch_row($result); … … 95 93 message($lang_common['Bad request']); 96 94 97 $ban_expire = ($ban_expire != '') ? date('Y-m-d', $ban_expire) : ''; 95 $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; 96 $ban_expire = ($ban_expire != '') ? gmdate('Y-m-d', $ban_expire + $diff) : ''; 98 97 99 98 $mode = 'edit'; 100 99 } 101 100 102 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Bannissements';101 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); 103 102 $focus_element = array('bans2', 'ban_user'); 103 define('PUN_ACTIVE_PAGE', 'admin'); 104 104 require PUN_ROOT.'header.php'; 105 105 106 106 generate_admin_menu('bans'); 107 108 107 109 108 ?> 110 109 <div class="blockform"> 111 <h2><span> Réglages de bannissement avancés</span></h2>110 <h2><span><?php echo $lang_admin_bans['Ban advanced head'] ?></span></h2> 112 111 <div class="box"> 113 112 <form id="bans2" method="post" action="admin_bans.php"> … … 116 115 <?php if ($mode == 'edit'): ?> <input type="hidden" name="ban_id" value="<?php echo $ban_id ?>" /> 117 116 <?php endif; ?> <fieldset> 118 <legend> Bannissement supplémentaire avec <acronym title="Internet Protocol" lang="en">IP</acronym> est adresse e-mail</legend>117 <legend><?php echo $lang_admin_bans['Ban advanced subhead'] ?></legend> 119 118 <div class="infldset"> 120 119 <table class="aligntop" cellspacing="0"> 121 120 <tr> 122 <th scope="row"> Nom d'utilisateur</th>121 <th scope="row"><?php echo $lang_admin_bans['Username label'] ?></th> 123 122 <td> 124 123 <input type="text" name="ban_user" size="25" maxlength="25" value="<?php if (isset($ban_user)) echo pun_htmlspecialchars($ban_user); ?>" tabindex="1" /> 125 <span> Le nom d'utilisateur à bannir.</span>126 </td> 127 </tr> 128 <tr> 129 <th scope="row"> Adresses <acronym title="Internet Protocol" lang="en">IP</acronym></th>124 <span><?php echo $lang_admin_bans['Username help'] ?></span> 125 </td> 126 </tr> 127 <tr> 128 <th scope="row"><?php echo $lang_admin_bans['IP label'] ?></th> 130 129 <td> 131 130 <input type="text" name="ban_ip" size="45" maxlength="255" value="<?php if (isset($ban_ip)) echo $ban_ip; ?>" tabindex="2" /> 132 <span> Une adresse <acronym title="Internet Protocol" lang="en">IP</acronym> ou une plage d'adresses <acronym title="Internet Protocol" lang="en">IP</acronym> que vous souhaitez bannir (<abbr title="exemple">ex.</abbr> 150.11.110.1 ou 150.11.110). Séparez les adresses par des espaces. Si une adresse <acronym title="Internet Protocol" lang="en">IP</acronym> apparaît déjà , il s'agit de la derniÚre adresse IP connue de l'utilisateur dans la base de données.<?php if ($ban_user != '' && isset($user_id)) echo ' <a href="admin_users.php?ip_stats='.$user_id.'">Cliquez ici</a> pour voir les statistiques <acronym title="Internet Protocol" lang="en">IP</acronym> de cet utilisateur.'?></span>133 </td> 134 </tr> 135 <tr> 136 <th scope="row"> E-mail/domaine</th>137 <td> 138 <input type="text" name="ban_email" size="40" maxlength=" 50" value="<?php if (isset($ban_email)) echo strtolower($ban_email); ?>" tabindex="3" />139 <span> L'adresse e-mail ou le domaine e-mail que vous souhaitez bannir (<abbr title="exemple">ex.</abbr> utilisateur@domaine.com ou domaine.com). Pour plus d'informations, voir "Autoriser les adresses e-mail bannies" à la page des Permissions.</span>131 <span><?php echo $lang_admin_bans['IP help'] ?><?php if ($ban_user != '' && isset($user_id)) printf(' '.$lang_admin_bans['IP help link'], '<a href="admin_users.php?ip_stats='.$user_id.'">'.$lang_admin_common['here'].'</a>') ?></span> 132 </td> 133 </tr> 134 <tr> 135 <th scope="row"><?php echo $lang_admin_bans['E-mail label'] ?></th> 136 <td> 137 <input type="text" name="ban_email" size="40" maxlength="80" value="<?php if (isset($ban_email)) echo $ban_email; ?>" tabindex="3" /> 138 <span><?php echo $lang_admin_bans['E-mail help'] ?></span> 140 139 </td> 141 140 </tr> 142 141 </table> 143 <p class="topspace"><strong class="warntext"> Vous devez êtres trÚs vigilant lorsque vous bannissez une plage d'<acronym title="Internet Protocol" lang="en">IP</acronym> car il y a fort probablement plusieurs utilisateurs qui correspondent à la même <acronym title="Internet Protocol" lang="en">IP</acronym> partielle.</strong></p>142 <p class="topspace"><strong class="warntext"><?php echo $lang_admin_bans['Ban IP range info'] ?></strong></p> 144 143 </div> 145 144 </fieldset> … … 147 146 <div class="inform"> 148 147 <fieldset> 149 <legend> Message et échéance d'interdiction</legend>148 <legend><?php echo $lang_admin_bans['Message expiry subhead'] ?></legend> 150 149 <div class="infldset"> 151 150 <table class="aligntop" cellspacing="0"> 152 151 <tr> 153 <th scope="row"> Message d'interdiction</th>152 <th scope="row"><?php echo $lang_admin_bans['Ban message label'] ?></th> 154 153 <td> 155 154 <input type="text" name="ban_message" size="50" maxlength="255" value="<?php if (isset($ban_message)) echo pun_htmlspecialchars($ban_message); ?>" tabindex="4" /> 156 <span> Le message qui sera affiché à l'utilisateur banni lorsqu'il visitera les forums.</span>157 </td> 158 </tr> 159 <tr> 160 <th scope="row"> Ãchéance d'interdiction</th>155 <span><?php echo $lang_admin_bans['Ban message help'] ?></span> 156 </td> 157 </tr> 158 <tr> 159 <th scope="row"><?php echo $lang_admin_bans['Expire date label'] ?></th> 161 160 <td> 162 161 <input type="text" name="ban_expire" size="17" maxlength="10" value="<?php if (isset($ban_expire)) echo $ban_expire; ?>" tabindex="5" /> 163 <span> La date à laquelle ce bannissement sera automatiquement supprimé (format: AAAA-MM-JJ). Pour supprimer manuellement, laissez ce champ vide.</span>162 <span><?php echo $lang_admin_bans['Expire date help'] ?></span> 164 163 </td> 165 164 </tr> … … 168 167 </fieldset> 169 168 </div> 170 <p class="submitend"><input type="submit" name="add_edit_ban" value=" Enregistrer" tabindex="6" /></p>169 <p class="submitend"><input type="submit" name="add_edit_ban" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="6" /></p> 171 170 </form> 172 171 </div> … … 179 178 } 180 179 181 182 180 // Add/edit a ban (stage 2) 183 181 else if (isset($_POST['add_edit_ban'])) … … 185 183 confirm_referrer('admin_bans.php'); 186 184 187 $ban_user = trim($_POST['ban_user']);185 $ban_user = pun_trim($_POST['ban_user']); 188 186 $ban_ip = trim($_POST['ban_ip']); 189 187 $ban_email = strtolower(trim($_POST['ban_email'])); 190 $ban_message = trim($_POST['ban_message']);188 $ban_message = pun_trim($_POST['ban_message']); 191 189 $ban_expire = trim($_POST['ban_expire']); 192 190 193 191 if ($ban_user == '' && $ban_ip == '' && $ban_email == '') 194 message('Vous devez saisir au moins soit un nom d\'utilisateur, soit une adresse <acronym title="Internet Protocol" lang="en">IP</acronym> ou une adresse e-mail.'); 192 message($lang_admin_bans['Must enter message']); 193 else if (strtolower($ban_user) == 'guest') 194 message($lang_admin_bans['Cannot ban guest message']); 195 196 // Make sure we're not banning an admin or moderator 197 if (!empty($ban_user)) 198 { 199 $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 200 if ($db->num_rows($result)) 201 { 202 $group_id = $db->result($result); 203 204 if ($group_id == PUN_ADMIN) 205 message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); 206 207 $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); 208 $is_moderator_group = $db->result($result); 209 210 if ($is_moderator_group) 211 message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); 212 } 213 } 195 214 196 215 // Validate IP/IP range (it's overkill, I know) 197 216 if ($ban_ip != '') 198 217 { 199 $ban_ip = preg_replace(' /[\s]{2,}/', ' ', $ban_ip);218 $ban_ip = preg_replace('%\s{2,}%S', ' ', $ban_ip); 200 219 $addresses = explode(' ', $ban_ip); 201 $addresses = array_map(' trim', $addresses);220 $addresses = array_map('pun_trim', $addresses); 202 221 203 222 for ($i = 0; $i < count($addresses); ++$i) 204 223 { 205 $octets = explode('.', $addresses[$i]); 206 207 for ($c = 0; $c < count($octets); ++$c) 224 if (strpos($addresses[$i], ':') !== false) 208 225 { 209 $octets[$c] = (strlen($octets[$c]) > 1) ? ltrim($octets[$c], "0") : $octets[$c]; 210 211 if ($c > 3 || preg_match('/[^0-9]/', $octets[$c]) || intval($octets[$c]) > 255) 212 message('Vous avez saisi une <acronym title="Internet Protocol" lang="en">IP</acronym>/plage d\'<acronym title="Internet Protocol" lang="en">IP</acronym> incorrecte.'); 226 $octets = explode(':', $addresses[$i]); 227 228 for ($c = 0; $c < count($octets); ++$c) 229 { 230 $octets[$c] = ltrim($octets[$c], "0"); 231 232 if ($c > 7 || (!empty($octets[$c]) && !ctype_xdigit($octets[$c])) || intval($octets[$c], 16) > 65535) 233 message($lang_admin_bans['Invalid IP message']); 234 } 235 236 $cur_address = implode(':', $octets); 237 $addresses[$i] = $cur_address; 213 238 } 214 215 $cur_address = implode('.', $octets); 216 $addresses[$i] = $cur_address; 239 else 240 { 241 $octets = explode('.', $addresses[$i]); 242 243 for ($c = 0; $c < count($octets); ++$c) 244 { 245 $octets[$c] = (strlen($octets[$c]) > 1) ? ltrim($octets[$c], "0") : $octets[$c]; 246 247 if ($c > 3 || preg_match('%[^0-9]%', $octets[$c]) || intval($octets[$c]) > 255) 248 message($lang_admin_bans['Invalid IP message']); 249 } 250 251 $cur_address = implode('.', $octets); 252 $addresses[$i] = $cur_address; 253 } 217 254 } 218 255 … … 223 260 if ($ban_email != '' && !is_valid_email($ban_email)) 224 261 { 225 if (!preg_match(' /^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email))226 message( 'L\'adresse e-mail (<abbr title="exemple">ex.</abbr> utilisateur@domaine.com) ou le domaine d\'adresse e-mail (<abbr title="exemple">ex.</abbr> domaine.com) que vous avez saisi est incorrect.');262 if (!preg_match('%^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$%', $ban_email)) 263 message($lang_admin_bans['Invalid e-mail message']); 227 264 } 228 265 229 266 if ($ban_expire != '' && $ban_expire != 'Never') 230 267 { 231 $ban_expire = strtotime($ban_expire); 232 233 if ($ban_expire == -1 || $ban_expire <= time()) 234 message('Vous avez saisi une date d\'échéance incorrecte. Le format doit être AAAA-MM-JJ et la date doit-être d\'au moins un jour dans le futur.'); 268 $ban_expire = strtotime($ban_expire.' GMT'); 269 270 if ($ban_expire == -1 || !$ban_expire) 271 message($lang_admin_bans['Invalid date message'].' '.$lang_admin_bans['Invalid date reasons']); 272 273 $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; 274 $ban_expire -= $diff; 275 276 if ($ban_expire <= time()) 277 message($lang_admin_bans['Invalid date message'].' '.$lang_admin_bans['Invalid date reasons']); 235 278 } 236 279 else … … 243 286 244 287 if ($_POST['mode'] == 'add') 245 $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire ) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.')') or error('Impossible d\'ajouter le bannissement', __FILE__, __LINE__, $db->error());288 $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire, ban_creator) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.', '.$pun_user['id'].')') or error('Unable to add ban', __FILE__, __LINE__, $db->error()); 246 289 else 247 $db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', message='.$ban_message.', expire='.$ban_expire.' WHERE id='.intval($_POST['ban_id'])) or error(' Impossible de modifier le bannissement', __FILE__, __LINE__, $db->error());290 $db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', message='.$ban_message.', expire='.$ban_expire.' WHERE id='.intval($_POST['ban_id'])) or error('Unable to update ban', __FILE__, __LINE__, $db->error()); 248 291 249 292 // Regenerate the bans cache 250 require_once PUN_ROOT.'include/cache.php'; 293 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 294 require PUN_ROOT.'include/cache.php'; 295 251 296 generate_bans_cache(); 252 297 253 redirect('admin_bans.php', 'Bannissement '.(($_POST['mode'] == 'edit') ? 'modifié' : 'ajouté').'. Redirection ...'); 298 if ($_POST['mode'] == 'edit') 299 redirect('admin_bans.php', $lang_admin_bans['Ban edited redirect']); 300 else 301 redirect('admin_bans.php', $lang_admin_bans['Ban added redirect']); 254 302 } 255 256 303 257 304 // Remove a ban … … 264 311 message($lang_common['Bad request']); 265 312 266 $db->query('DELETE FROM '.$db->prefix.'bans WHERE id='.$ban_id) or error(' Impossible de supprimer le bannissement', __FILE__, __LINE__, $db->error());313 $db->query('DELETE FROM '.$db->prefix.'bans WHERE id='.$ban_id) or error('Unable to delete ban', __FILE__, __LINE__, $db->error()); 267 314 268 315 // Regenerate the bans cache 269 require_once PUN_ROOT.'include/cache.php'; 316 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 317 require PUN_ROOT.'include/cache.php'; 318 270 319 generate_bans_cache(); 271 320 272 redirect('admin_bans.php', 'Bannissement supprimé. Redirection ...');321 redirect('admin_bans.php', $lang_admin_bans['Ban removed redirect']); 273 322 } 274 323 275 276 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Bannissement'; 324 // Find bans 325 else if (isset($_GET['find_ban'])) 326 { 327 $form = isset($_GET['form']) ? $_GET['form'] : array(); 328 329 // trim() all elements in $form 330 $form = array_map('pun_trim', $form); 331 $conditions = $query_str = array(); 332 333 $expire_after = isset($_GET['expire_after']) ? trim($_GET['expire_after']) : ''; 334 $expire_before = isset($_GET['expire_before']) ? trim($_GET['expire_before']) : ''; 335 $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? 'b.'.$_GET['order_by'] : 'b.username'; 336 $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; 337 338 $query_str[] = 'order_by='.$order_by; 339 $query_str[] = 'direction='.$direction; 340 341 // Try to convert date/time to timestamps 342 if ($expire_after != '') 343 { 344 $query_str[] = 'expire_after='.$expire_after; 345 346 $expire_after = strtotime($expire_after); 347 if ($expire_after === false || $expire_after == -1) 348 message($lang_admin_bans['Invalid date message']); 349 350 $conditions[] = 'b.expire>'.$expire_after; 351 } 352 if ($expire_before != '') 353 { 354 $query_str[] = 'expire_before='.$expire_before; 355 356 $expire_before = strtotime($expire_before); 357 if ($expire_before === false || $expire_before == -1) 358 message($lang_admin_bans['Invalid date message']); 359 360 $conditions[] = 'b.expire<'.$expire_before; 361 } 362 363 $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; 364 foreach ($form as $key => $input) 365 { 366 if ($input != '' && in_array($key, array('username', 'ip', 'email', 'message'))) 367 { 368 $conditions[] = 'b.'.$db->escape($key).' '.$like_command.' \''.$db->escape(str_replace('*', '%', $input)).'\''; 369 $query_str[] = 'form%5B'.$key.'%5D='.urlencode($input); 370 } 371 } 372 373 // Fetch ban count 374 $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'bans as b WHERE b.id>0'.(!empty($conditions) ? ' AND '.implode(' AND ', $conditions) : '')) or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error()); 375 $num_bans = $db->result($result); 376 377 // Determine the ban offset (based on $_GET['p']) 378 $num_pages = ceil($num_bans / 50); 379 380 $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']); 381 $start_from = 50 * ($p - 1); 382 383 // Generate paging links 384 $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_bans.php?find_ban=&'.implode('&', $query_str)); 385 386 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans'], $lang_admin_bans['Results head']); 387 define('PUN_ACTIVE_PAGE', 'admin'); 388 require PUN_ROOT.'header.php'; 389 390 ?> 391 <div class="linkst"> 392 <div class="inbox crumbsplus"> 393 <ul class="crumbs"> 394 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 395 <li><span>» </span><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li> 396 <li><span>» </span><strong><?php echo $lang_admin_bans['Results head'] ?></strong></li> 397 </ul> 398 <div class="pagepost"> 399 <p class="pagelink"><?php echo $paging_links ?></p> 400 </div> 401 <div class="clearer"></div> 402 </div> 403 </div> 404 405 406 <div id="bans1" class="blocktable"> 407 <h2><span><?php echo $lang_admin_bans['Results head'] ?></span></h2> 408 <div class="box"> 409 <div class="inbox"> 410 <table cellspacing="0"> 411 <thead> 412 <tr> 413 <th class="tcl" scope="col"><?php echo $lang_admin_bans['Results username head'] ?></th> 414 <th class="tc2" scope="col"><?php echo $lang_admin_bans['Results e-mail head'] ?></th> 415 <th class="tc3" scope="col"><?php echo $lang_admin_bans['Results IP address head'] ?></th> 416 <th class="tc4" scope="col"><?php echo $lang_admin_bans['Results expire head'] ?></th> 417 <th class="tc5" scope="col"><?php echo $lang_admin_bans['Results message head'] ?></th> 418 <th class="tc6" scope="col"><?php echo $lang_admin_bans['Results banned by head'] ?></th> 419 <th class="tcr" scope="col"><?php echo $lang_admin_bans['Results actions head'] ?></th> 420 </tr> 421 </thead> 422 <tbody> 423 <?php 424 425 $result = $db->query('SELECT b.id, b.username, b.ip, b.email, b.message, b.expire, b.ban_creator, u.username AS ban_creator_username FROM '.$db->prefix.'bans AS b LEFT JOIN '.$db->prefix.'users AS u ON b.ban_creator=u.id WHERE b.id>0'.(!empty($conditions) ? ' AND '.implode(' AND ', $conditions) : '').' ORDER BY '.$db->escape($order_by).' '.$db->escape($direction).' LIMIT '.$start_from.', 50') or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error()); 426 if ($db->num_rows($result)) 427 { 428 while ($ban_data = $db->fetch_assoc($result)) 429 { 430 431 $actions = '<a href="admin_bans.php?edit_ban='.$ban_data['id'].'">'.$lang_admin_common['Edit'].'</a> | <a href="admin_bans.php?del_ban='.$ban_data['id'].'">'.$lang_admin_common['Remove'].'</a>'; 432 $expire = format_time($ban_data['expire'], true); 433 434 ?> 435 <tr> 436 <td class="tcl"><?php echo ($ban_data['username'] != '') ? pun_htmlspecialchars($ban_data['username']) : ' ' ?></td> 437 <td class="tc2"><?php echo ($ban_data['email'] != '') ? $ban_data['email'] : ' ' ?></td> 438 <td class="tc3"><?php echo ($ban_data['ip'] != '') ? $ban_data['ip'] : ' ' ?></td> 439 <td class="tc4"><?php echo $expire ?></td> 440 <td class="tc5"><?php echo ($ban_data['message'] != '') ? pun_htmlspecialchars($ban_data['message']) : ' ' ?></td> 441 <td class="tc6"><?php echo ($ban_data['ban_creator_username'] != '') ? '<a href="profile.php?id='.$ban_data['ban_creator'].'">'.pun_htmlspecialchars($ban_data['ban_creator_username']).'</a>' : $lang_admin_bans['Unknown'] ?></td> 442 <td class="tcr"><?php echo $actions ?></td> 443 </tr> 444 <?php 445 446 } 447 } 448 else 449 echo "\t\t\t\t".'<tr><td class="tcl" colspan="7">'.$lang_admin_bans['No match'].'</td></tr>'."\n"; 450 451 ?> 452 </tbody> 453 </table> 454 </div> 455 </div> 456 </div> 457 458 <div class="linksb"> 459 <div class="inbox crumbsplus"> 460 <div class="pagepost"> 461 <p class="pagelink"><?php echo $paging_links ?></p> 462 </div> 463 <ul class="crumbs"> 464 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 465 <li><span>» </span><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li> 466 <li><span>» </span><strong><?php echo $lang_admin_bans['Results head'] ?></strong></li> 467 </ul> 468 <div class="clearer"></div> 469 </div> 470 </div> 471 <?php 472 473 require PUN_ROOT.'footer.php'; 474 } 475 476 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); 277 477 $focus_element = array('bans', 'new_ban_user'); 478 define('PUN_ACTIVE_PAGE', 'admin'); 278 479 require PUN_ROOT.'header.php'; 279 480 … … 282 483 ?> 283 484 <div class="blockform"> 284 <h2><span> Nouveau bannissement</span></h2>485 <h2><span><?php echo $lang_admin_bans['New ban head'] ?></span></h2> 285 486 <div class="box"> 286 487 <form id="bans" method="post" action="admin_bans.php?action=more"> 287 488 <div class="inform"> 288 489 <fieldset> 289 <legend> Ajouter un bannissement</legend>490 <legend><?php echo $lang_admin_bans['Add ban subhead'] ?></legend> 290 491 <div class="infldset"> 291 492 <table class="aligntop" cellspacing="0"> 292 493 <tr> 293 <th scope="row"> Nom d'utilisateur<div><input type="submit" name="add_ban" value=" Ajouter" tabindex="2" /></div></th>494 <th scope="row"><?php echo $lang_admin_bans['Username label'] ?><div><input type="submit" name="add_ban" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="2" /></div></th> 294 495 <td> 295 496 <input type="text" name="new_ban_user" size="25" maxlength="25" tabindex="1" /> 296 <span> Le nom d'utilisateur à bannir (insensible à la casse). La page suivante vous permettra d'entrer une adresse <acronym title="Internet Protocol" lang="en">IP</acronym> et/ou une adresse e-mail de votre choix. Si vous souhaitez bannir une adresse <acronym title="Internet Protocol" lang="en">IP</acronym>, une plage d'adresses <acronym title="Internet Protocol" lang="en">IP</acronym> ou une adresse e-mail, laissez simplement ce champ vide.</span>497 <span><?php echo $lang_admin_bans['Username advanced help'] ?></span> 297 498 </td> 298 499 </tr> … … 304 505 </div> 305 506 306 <h2 class="block2"><span> Bannissements actuels</span></h2>507 <h2 class="block2"><span><?php echo $lang_admin_bans['Ban search head'] ?></span></h2> 307 508 <div class="box"> 308 <div class="fakeform"> 309 <?php 310 311 $result = $db->query('SELECT id, username, ip, email, message, expire FROM '.$db->prefix.'bans ORDER BY id') or error('Impossible de retrouver la liste des bannissements', __FILE__, __LINE__, $db->error()); 312 if ($db->num_rows($result)) 313 { 314 while ($cur_ban = $db->fetch_assoc($result)) 315 { 316 $expire = format_time($cur_ban['expire'], true); 317 318 ?> 509 <form id="find_band" method="get" action="admin_bans.php"> 510 <p class="submittop"><input type="submit" name="find_ban" value="<?php echo $lang_admin_bans['Submit search'] ?>" tabindex="3" /></p> 319 511 <div class="inform"> 320 512 <fieldset> 321 <legend> Date d'échéance : <?php echo $expire?></legend>513 <legend><?php echo $lang_admin_bans['Ban search subhead'] ?></legend> 322 514 <div class="infldset"> 323 <table cellspacing="0"> 324 <?php if ($cur_ban['username'] != ''): ?> <tr> 325 <th>Nom d'utilisateur</th> 326 <td><?php echo pun_htmlspecialchars($cur_ban['username']) ?></td> 327 </tr> 328 <?php endif; ?><?php if ($cur_ban['email'] != ''): ?> <tr> 329 <th>E-mail</th> 330 <td><?php echo $cur_ban['email'] ?></td> 331 </tr> 332 <?php endif; ?><?php if ($cur_ban['ip'] != ''): ?> <tr> 333 <th><acronym title="Internet Protocol" lang="en">IP</acronym>/plage d'<acronym title="Internet Protocol" lang="en">IP</acronym></th> 334 <td><?php echo $cur_ban['ip'] ?></td> 335 </tr> 336 <?php endif; ?><?php if ($cur_ban['message'] != ''): ?> <tr> 337 <th>Motif</th> 338 <td><?php echo pun_htmlspecialchars($cur_ban['message']) ?></td> 339 </tr> 340 <?php endif; ?> </table> 341 <p class="linkactions"><a href="admin_bans.php?edit_ban=<?php echo $cur_ban['id'] ?>">Modifier</a> - <a href="admin_bans.php?del_ban=<?php echo $cur_ban['id'] ?>">Supprimer</a></p> 515 <p><?php echo $lang_admin_bans['Ban search info'] ?></p> 516 <table class="aligntop" cellspacing="0"> 517 <tr> 518 <th scope="row"><?php echo $lang_admin_bans['Username label'] ?></th> 519 <td><input type="text" name="form[username]" size="25" maxlength="25" tabindex="4" /></td> 520 </tr> 521 <tr> 522 <th scope="row"><?php echo $lang_admin_bans['IP label'] ?></th> 523 <td><input type="text" name="form[ip]" size="30" maxlength="255" tabindex="5" /></td> 524 </tr> 525 <tr> 526 <th scope="row"><?php echo $lang_admin_bans['E-mail label'] ?></th> 527 <td><input type="text" name="form[email]" size="30" maxlength="80" tabindex="6" /></td> 528 </tr> 529 <tr> 530 <th scope="row"><?php echo $lang_admin_bans['Message label'] ?></th> 531 <td><input type="text" name="form[message]" size="30" maxlength="255" tabindex="7" /></td> 532 </tr> 533 <tr> 534 <th scope="row"><?php echo $lang_admin_bans['Expire after label'] ?></th> 535 <td><input type="text" name="expire_after" size="10" maxlength="10" tabindex="8" /> 536 <span><?php echo $lang_admin_bans['Date help'] ?></span></td> 537 </tr> 538 <tr> 539 <th scope="row"><?php echo $lang_admin_bans['Expire before label'] ?></th> 540 <td><input type="text" name="expire_before" size="10" maxlength="10" tabindex="9" /> 541 <span><?php echo $lang_admin_bans['Date help'] ?></span></td> 542 </tr> 543 <tr> 544 <th scope="row"><?php echo $lang_admin_bans['Order by label'] ?></th> 545 <td> 546 <select name="order_by" tabindex="10"> 547 <option value="username" selected="selected"><?php echo $lang_admin_bans['Order by username'] ?></option> 548 <option value="ip"><?php echo $lang_admin_bans['Order by ip'] ?></option> 549 <option value="email"><?php echo $lang_admin_bans['Order by e-mail'] ?></option> 550 <option value="expire"><?php echo $lang_admin_bans['Order by expire'] ?></option> 551 </select>   <select name="direction" tabindex="11"> 552 <option value="ASC" selected="selected"><?php echo $lang_admin_bans['Ascending'] ?></option> 553 <option value="DESC"><?php echo $lang_admin_bans['Descending'] ?></option> 554 </select> 555 </td> 556 </tr> 557 </table> 342 558 </div> 343 559 </fieldset> 344 560 </div> 345 <?php 346 347 } 348 } 349 else 350 echo "\t\t\t\t".'<p>Aucun bannissement à lister.</p>'."\n"; 351 352 ?> 353 </div> 561 <p class="submitend"><input type="submit" name="find_ban" value="<?php echo $lang_admin_bans['Submit search'] ?>" tabindex="12" /></p> 562 </form> 354 563 </div> 355 564 </div> -
/branches/rsr.v5.1.dev/web/punbb/admin_categories.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_categories.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_categories.php'; 37 22 38 23 // Add a new category … … 41 26 confirm_referrer('admin_categories.php'); 42 27 43 $new_cat_name = trim($_POST['new_cat_name']);28 $new_cat_name = pun_trim($_POST['new_cat_name']); 44 29 if ($new_cat_name == '') 45 message( 'Vous devez saisir un nom pour la nouvelle catégorie.');46 47 $db->query('INSERT INTO '.$db->prefix.'categories (cat_name) VALUES(\''.$db->escape($new_cat_name).'\')') or error(' Impossible de créer la catégorie', __FILE__, __LINE__, $db->error());48 49 redirect('admin_categories.php', 'Catégorie ajoutée. Redirection ...');30 message($lang_admin_categories['Must enter name message']); 31 32 $db->query('INSERT INTO '.$db->prefix.'categories (cat_name) VALUES(\''.$db->escape($new_cat_name).'\')') or error('Unable to create category', __FILE__, __LINE__, $db->error()); 33 34 redirect('admin_categories.php', $lang_admin_categories['Category added redirect']); 50 35 } 51 52 36 53 37 // Delete a category … … 60 44 message($lang_common['Bad request']); 61 45 62 if (isset($_POST['del_cat_comply'])) 46 if (isset($_POST['del_cat_comply'])) // Delete a category with all forums and posts 63 47 { 64 48 @set_time_limit(0); 65 49 66 $result = $db->query('SELECT id FROM '.$db->prefix.'forums WHERE cat_id='.$cat_to_delete) or error(' Impossible de retrouver la liste des forums', __FILE__, __LINE__, $db->error());50 $result = $db->query('SELECT id FROM '.$db->prefix.'forums WHERE cat_id='.$cat_to_delete) or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); 67 51 $num_forums = $db->num_rows($result); 68 52 … … 75 59 76 60 // Delete the forum 77 $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$cur_forum) or error(' Impossible de supprimer le forum', __FILE__, __LINE__, $db->error());61 $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$cur_forum) or error('Unable to delete forum', __FILE__, __LINE__, $db->error()); 78 62 } 79 63 80 64 // Locate any "orphaned redirect topics" and delete them 81 $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());65 $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()); 82 66 $num_orphans = $db->num_rows($result); 83 67 … … 87 71 $orphans[] = $db->result($result, $i); 88 72 89 $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());73 $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); 90 74 } 91 75 92 76 // Delete the category 93 $db->query('DELETE FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Impossible de supprimer la catégorie', __FILE__, __LINE__, $db->error()); 94 95 // Regenerate the quickjump cache 96 require_once PUN_ROOT.'include/cache.php'; 77 $db->query('DELETE FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to delete category', __FILE__, __LINE__, $db->error()); 78 79 // Regenerate the quick jump cache 80 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 81 require PUN_ROOT.'include/cache.php'; 82 97 83 generate_quickjump_cache(); 98 84 99 redirect('admin_categories.php', 'Catégorie supprimée. Redirection ...');100 } 101 else 102 { 103 $result = $db->query('SELECT cat_name FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error(' Impossible de retrouver les informations de la catégorie', __FILE__, __LINE__, $db->error());85 redirect('admin_categories.php', $lang_admin_categories['Category deleted redirect']); 86 } 87 else // If the user hasn't comfirmed the delete 88 { 89 $result = $db->query('SELECT cat_name FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to fetch category info', __FILE__, __LINE__, $db->error()); 104 90 $cat_name = $db->result($result); 105 91 106 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Catégories'; 92 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']); 93 define('PUN_ACTIVE_PAGE', 'admin'); 107 94 require PUN_ROOT.'header.php'; 108 95 … … 111 98 ?> 112 99 <div class="blockform"> 113 <h2><span> Supprimer une catégorie</span></h2>100 <h2><span><?php echo $lang_admin_categories['Delete category head'] ?></span></h2> 114 101 <div class="box"> 115 102 <form method="post" action="admin_categories.php"> … … 117 104 <input type="hidden" name="cat_to_delete" value="<?php echo $cat_to_delete ?>" /> 118 105 <fieldset> 119 <legend> Confirmez la supression de la catégorie</legend>120 <div class="infldset"> 121 <p> Ãtes vous sûr de vouloir supprimer la catégorie "<?php echo $cat_name ?>" ?</p>122 <p >ATTENTION ! Supprimer cette catégorie supprimera en même temps tous les forums et messages (s'il y en a) présents dans cette catégorie !</p>123 </div> 124 </fieldset> 125 </div> 126 <p ><input type="submit" name="del_cat_comply" value=" Supprimer " /><a href="javascript:history.go(-1)">Retour</a></p>106 <legend><?php echo $lang_admin_categories['Confirm delete subhead'] ?></legend> 107 <div class="infldset"> 108 <p><?php printf($lang_admin_categories['Confirm delete info'], pun_htmlspecialchars($cat_name)) ?></p> 109 <p class="warntext"><?php echo $lang_admin_categories['Delete category warn'] ?></p> 110 </div> 111 </fieldset> 112 </div> 113 <p class="buttons"><input type="submit" name="del_cat_comply" value="<?php echo $lang_admin_common['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> 127 114 </form> 128 115 </div> … … 136 123 } 137 124 138 139 else if (isset($_POST['update'])) // Change position and name of the categories 125 else if (isset($_POST['update'])) // Change position and name of the categories 140 126 { 141 127 confirm_referrer('admin_categories.php'); 142 128 143 $cat_order = $_POST['cat_order']; 144 $cat_name = $_POST['cat_name']; 145 146 $result = $db->query('SELECT id, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Impossible de retrouver la liste des catégories', __FILE__, __LINE__, $db->error()); 147 $num_cats = $db->num_rows($result); 148 149 for ($i = 0; $i < $num_cats; ++$i) 150 { 151 if ($cat_name[$i] == '') 152 message('Vous devez saisir un nom de catégorie.'); 153 154 if (!preg_match('#^\d+$#', $cat_order[$i])) 155 message('La position doit être un nombre entier.'); 156 157 list($cat_id, $position) = $db->fetch_row($result); 158 159 $db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cat_name[$i]).'\', disp_position='.$cat_order[$i].' WHERE id='.$cat_id) or error('Impossible de modifier les catégories', __FILE__, __LINE__, $db->error()); 160 } 161 162 // Regenerate the quickjump cache 163 require_once PUN_ROOT.'include/cache.php'; 129 $categories = $_POST['cat']; 130 if (empty($categories)) 131 message($lang_common['Bad request']); 132 133 foreach ($categories as $cat_id => $cur_cat) 134 { 135 $cur_cat['name'] = pun_trim($cur_cat['name']); 136 $cur_cat['order'] = trim($cur_cat['order']); 137 138 if ($cur_cat['name'] == '') 139 message($lang_admin_categories['Must enter name message']); 140 141 if ($cur_cat['order'] == '' || preg_match('%[^0-9]%', $cur_cat['order'])) 142 message($lang_admin_categories['Must enter integer message']); 143 144 $db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cur_cat['name']).'\', disp_position='.$cur_cat['order'].' WHERE id='.intval($cat_id)) or error('Unable to update category', __FILE__, __LINE__, $db->error()); 145 } 146 147 // Regenerate the quick jump cache 148 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 149 require PUN_ROOT.'include/cache.php'; 150 164 151 generate_quickjump_cache(); 165 152 166 redirect('admin_categories.php', 'Catégories modifiées. Redirection ...');153 redirect('admin_categories.php', $lang_admin_categories['Categories updated redirect']); 167 154 } 168 155 169 170 156 // Generate an array with all categories 171 $result = $db->query('SELECT id, cat_name, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error(' Impossible de retrouver la liste des catégories', __FILE__, __LINE__, $db->error());157 $result = $db->query('SELECT id, cat_name, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error()); 172 158 $num_cats = $db->num_rows($result); 173 159 174 160 for ($i = 0; $i < $num_cats; ++$i) 175 $cat_list[] = $db->fetch_ row($result);176 177 178 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Catégories';161 $cat_list[] = $db->fetch_assoc($result); 162 163 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']); 164 define('PUN_ACTIVE_PAGE', 'admin'); 179 165 require PUN_ROOT.'header.php'; 180 166 … … 183 169 ?> 184 170 <div class="blockform"> 185 <h2><span>Ajouter/supprimer/modifier les catégories</span></h2> 186 <div class="box"> 187 <form method="post" action="admin_categories.php?action=foo"> 188 <div class="inform"> 189 <fieldset> 190 <legend>Ajouter/supprimer une catégorie</legend> 191 <div class="infldset"> 192 <table class="aligntop" cellspacing="0"> 193 <tr> 194 <th scope="row">Ajouter une catégorie<div><input type="submit" name="add_cat" value=" Ajouter " tabindex="2" /></div></th> 195 <td> 196 <input type="text" name="new_cat_name" size="35" maxlength="80" tabindex="1" /> 197 <span>Saisissez le nom de la catégorie que vous souhaitez ajouter. Vous pourrez modifier ce nom plus tard (voir ci-dessous). Pour ajouter des forums à une nouvelle catégorie, allez à la page de gestion des <a href="admin_forums.php">Forums</a>.</span> 198 </td> 199 </tr> 200 <?php if ($num_cats): ?> <tr> 201 <th scope="row">Supprimer une catégorie<div><input type="submit" name="del_cat" value=" Supprimer " tabindex="4" /></div></th> 202 <td> 203 <select name="cat_to_delete" tabindex="3"> 204 <?php 205 206 while (list(, list($cat_id, $cat_name, ,)) = @each($cat_list)) 207 echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cat_id.'">'.pun_htmlspecialchars($cat_name).'</option>'."\n"; 208 209 ?> 210 </select> 211 <span>Choisissez le nom de la catégorie que vous souhaitez supprimer. Vous serez invités à confirmer votre choix de catégorie à supprimer avant qu'elle ne soit effectivement supprimée.</span> 212 </td> 213 </tr> 214 <?php endif; ?> </table> 215 </div> 216 </fieldset> 217 </div> 218 <?php if ($num_cats): ?> <div class="inform"> 219 <fieldset> 220 <legend>Modifier les catégories</legend> 221 <div class="infldset"> 222 <table id="categoryedit" cellspacing="0" > 223 <thead> 224 <tr> 225 <th class="tcl" scope="col">Nom</th> 226 <th scope="col">Position</th> 227 <th> </th> 228 </tr> 229 </thead> 230 <tbody> 231 <?php 232 233 @reset($cat_list); 234 for ($i = 0; $i < $num_cats; ++$i) 235 { 236 list(, list($cat_id, $cat_name, $position)) = @each($cat_list); 237 238 ?> 239 <tr><td><input type="text" name="cat_name[<?php echo $i ?>]" value="<?php echo pun_htmlspecialchars($cat_name) ?>" size="35" maxlength="80" /></td><td><input type="text" name="cat_order[<?php echo $i ?>]" value="<?php echo $position ?>" size="3" maxlength="3" /></td><td> </td></tr> 240 <?php 241 242 } 243 244 ?> 245 </tbody> 246 </table> 247 <div class="fsetsubmit"><input type="submit" name="update" value=" Modifier " /></div> 248 </div> 249 </fieldset> 250 </div> 251 <?php endif; ?> </form> 252 </div> 253 </div> 171 <h2><span><?php echo $lang_admin_categories['Add categories head'] ?></span></h2> 172 <div class="box"> 173 <form method="post" action="admin_categories.php"> 174 <div class="inform"> 175 <fieldset> 176 <legend><?php echo $lang_admin_categories['Add categories subhead'] ?></legend> 177 <div class="infldset"> 178 <table class="aligntop" cellspacing="0"> 179 <tr> 180 <th scope="row"><?php echo $lang_admin_categories['Add category label'] ?><div><input type="submit" name="add_cat" value="<?php echo $lang_admin_categories['Add new submit'] ?>" tabindex="2" /></div></th> 181 <td> 182 <input type="text" name="new_cat_name" size="35" maxlength="80" tabindex="1" /> 183 <span><?php printf($lang_admin_categories['Add category help'], '<a href="admin_forums.php">'.$lang_admin_common['Forums'].'</a>') ?></span> 184 </td> 185 </tr> 186 </table> 187 </div> 188 </fieldset> 189 </div> 190 </form> 191 </div> 192 193 <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Delete categories head'] ?></span></h2> 194 <div class="box"> 195 <form method="post" action="admin_categories.php"> 196 <div class="inform"> 197 <fieldset> 198 <legend><?php echo $lang_admin_categories['Delete categories subhead'] ?></legend> 199 <div class="infldset"> 200 <table class="aligntop" cellspacing="0"> 201 <tr> 202 <th scope="row"><?php echo $lang_admin_categories['Delete category label'] ?><div><input type="submit" name="del_cat" value="<?php echo $lang_admin_common['Delete'] ?>" tabindex="4" /></div></th> 203 <td> 204 <select name="cat_to_delete" tabindex="3"> 205 <?php 206 207 foreach ($cat_list as $cur_cat) 208 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"; 209 210 ?> 211 </select> 212 <span><?php echo $lang_admin_categories['Delete category help'] ?></span> 213 </td> 214 </tr> 215 </table> 216 </div> 217 </fieldset> 218 </div> 219 </form> 220 </div> 221 <?php endif; ?> 222 223 <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Edit categories head'] ?></span></h2> 224 <div class="box"> 225 <form method="post" action="admin_categories.php"> 226 <div class="inform"> 227 <fieldset> 228 <legend><?php echo $lang_admin_categories['Edit categories subhead'] ?></legend> 229 <div class="infldset"> 230 <table id="categoryedit" cellspacing="0" > 231 <thead> 232 <tr> 233 <th class="tcl" scope="col"><?php echo $lang_admin_categories['Category name label'] ?></th> 234 <th scope="col"><?php echo $lang_admin_categories['Category position label'] ?></th> 235 </tr> 236 </thead> 237 <tbody> 238 <?php 239 240 foreach ($cat_list as $cur_cat) 241 { 242 243 ?> 244 <tr> 245 <td class="tcl"><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][name]" value="<?php echo pun_htmlspecialchars($cur_cat['cat_name']) ?>" size="35" maxlength="80" /></td> 246 <td><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][order]" value="<?php echo $cur_cat['disp_position'] ?>" size="3" maxlength="3" /></td> 247 </tr> 248 <?php 249 250 } 251 252 ?> 253 </tbody> 254 </table> 255 <div class="fsetsubmit"><input type="submit" name="update" value="<?php echo $lang_admin_common['Update'] ?>" /></div> 256 </div> 257 </fieldset> 258 </div> 259 </form> 260 </div> 261 <?php endif; ?> </div> 254 262 <div class="clearer"></div> 255 263 </div> -
/branches/rsr.v5.1.dev/web/punbb/admin_censoring.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 ************************************************************************/ 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 */ 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_MOD)17 if ($pun_user['g_id'] != PUN_ADMIN) 35 18 message($lang_common['No permission']); 36 19 20 // Load the admin_censoring.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_censoring.php'; 37 22 38 23 // Add a censor word … … 41 26 confirm_referrer('admin_censoring.php'); 42 27 43 $search_for = trim($_POST['new_search_for']);44 $replace_with = trim($_POST['new_replace_with']);28 $search_for = pun_trim($_POST['new_search_for']); 29 $replace_with = pun_trim($_POST['new_replace_with']); 45 30 46 if ($search_for == '' || $replace_with == '')47 message( 'Vous devez saisir à la fois un mot à censurer et un texte pour le remplacer.');31 if ($search_for == '') 32 message($lang_admin_censoring['Must enter word message']); 48 33 49 $db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error(' Impossible d\'ajouter un mot à censurer', __FILE__, __LINE__, $db->error());34 $db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error()); 50 35 51 redirect('admin_censoring.php', 'Mot à censurer ajouté. Redirection ...'); 36 // Regenerate the censoring cache 37 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 38 require PUN_ROOT.'include/cache.php'; 39 40 generate_censoring_cache(); 41 42 redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']); 52 43 } 53 54 44 55 45 // Update a censor word … … 60 50 $id = intval(key($_POST['update'])); 61 51 62 $search_for = trim($_POST['search_for'][$id]);63 $replace_with = trim($_POST['replace_with'][$id]);52 $search_for = pun_trim($_POST['search_for'][$id]); 53 $replace_with = pun_trim($_POST['replace_with'][$id]); 64 54 65 if ($search_for == '' || $replace_with == '')66 message( 'Vous devez saisir à la fois un mot à censurer et un texte pour le remplacer.');55 if ($search_for == '') 56 message($lang_admin_censoring['Must enter word message']); 67 57 68 $db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.$db->escape($search_for).'\', replace_with=\''.$db->escape($replace_with).'\' WHERE id='.$id) or error(' Impossible de mettre à jour le mot à censurer', __FILE__, __LINE__, $db->error());58 $db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.$db->escape($search_for).'\', replace_with=\''.$db->escape($replace_with).'\' WHERE id='.$id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error()); 69 59 70 redirect('admin_censoring.php', 'Mot à censurer modifié. Redirection ...'); 60 // Regenerate the censoring cache 61 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 62 require PUN_ROOT.'include/cache.php'; 63 64 generate_censoring_cache(); 65 66 redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']); 71 67 } 72 73 68 74 69 // Remove a censor word … … 79 74 $id = intval(key($_POST['remove'])); 80 75 81 $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error(' Impossible de supprimer le mot à censurer', __FILE__, __LINE__, $db->error());76 $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); 82 77 83 redirect('admin_censoring.php', 'Mot à censurer supprimé. Redirection ...'); 78 // Regenerate the censoring cache 79 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 80 require PUN_ROOT.'include/cache.php'; 81 82 generate_censoring_cache(); 83 84 redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']); 84 85 } 85 86 86 87 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Mots à censurer'; 87 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Censoring']); 88 88 $focus_element = array('censoring', 'new_search_for'); 89 define('PUN_ACTIVE_PAGE', 'admin'); 89 90 require PUN_ROOT.'header.php'; 90 91 … … 93 94 ?> 94 95 <div class="blockform"> 95 <h2><span> Mots à censurer</span></h2>96 <h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2> 96 97 <div class="box"> 97 <form id="censoring" method="post" action="admin_censoring.php ?action=foo">98 <form id="censoring" method="post" action="admin_censoring.php"> 98 99 <div class="inform"> 99 100 <fieldset> 100 <legend> Ajouter un mot à censurer</legend>101 <legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend> 101 102 <div class="infldset"> 102 <p> Saisissez le mot que vous voulez censurer ainsi que le texte qui le remplacera. Les caractÚres joker sont permis (ex: *fleur* vérifiera « fleurette Â» et « gonfleur Â» ). Les mots censurés affectent également les noms d'utilisateurs. Un nouvel utilisateur ne pourrait s'inscrire avec un nom d'utilisateur qui contiendrait un des mots censurés. La recherche est insensible à la casse. <strong>Les mots censurés doivent êtres activés à la page <a href="admin_options.php#censoring">Options</a> pour qu'ils aient un quelconque effet.</strong></p>103 <table 103 <p><?php echo $lang_admin_censoring['Add word info'].' '.($pun_config['o_censoring'] == '1' ? sprintf($lang_admin_censoring['Censoring enabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>') : sprintf($lang_admin_censoring['Censoring disabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>')) ?></p> 104 <table cellspacing="0"> 104 105 <thead> 105 106 <tr> 106 <th class="tcl" scope="col"> Mot à censurer</th>107 <th class="tc2" scope="col"> Texte de remplacement</th>108 <th class="hidehead" scope="col"> Action</th>107 <th class="tcl" scope="col"><?php echo $lang_admin_censoring['Censored word label'] ?></th> 108 <th class="tc2" scope="col"><?php echo $lang_admin_censoring['Replacement label'] ?></th> 109 <th class="hidehead" scope="col"><?php echo $lang_admin_censoring['Action label'] ?></th> 109 110 </tr> 110 111 </thead> 111 112 <tbody> 112 113 <tr> 113 <td ><input type="text" name="new_search_for" size="24" maxlength="60" tabindex="1" /></td>114 <td ><input type="text" name="new_replace_with" size="24" maxlength="60" tabindex="2" /></td>115 <td><input type="submit" name="add_word" value=" Add" tabindex="3" /></td>114 <td class="tcl"><input type="text" name="new_search_for" size="24" maxlength="60" tabindex="1" /></td> 115 <td class="tc2"><input type="text" name="new_replace_with" size="24" maxlength="60" tabindex="2" /></td> 116 <td><input type="submit" name="add_word" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="3" /></td> 116 117 </tr> 117 118 </tbody> … … 122 123 <div class="inform"> 123 124 <fieldset> 124 <legend> Modifier/supprimer des mots à censurer</legend>125 <legend><?php echo $lang_admin_censoring['Edit remove subhead'] ?></legend> 125 126 <div class="infldset"> 126 127 <?php 127 128 128 $result = $db->query('SELECT id, search_for, replace_with FROM '.$db->prefix.'censoring ORDER BY id') or error(' Impossible de retrouver la liste des mots à censurer', __FILE__, __LINE__, $db->error());129 $result = $db->query('SELECT id, search_for, replace_with FROM '.$db->prefix.'censoring ORDER BY id') or error('Unable to fetch censor word list', __FILE__, __LINE__, $db->error()); 129 130 if ($db->num_rows($result)) 130 131 { … … 134 135 <thead> 135 136 <tr> 136 <th class="tcl" scope="col"> Mots à censurer</th>137 <th class="tc2" scope="col"> Texte de remplacement</th>138 <th class="hidehead" scope="col"> Actions</th>137 <th class="tcl" scope="col"><?php echo $lang_admin_censoring['Censored word label'] ?></th> 138 <th class="tc2" scope="col"><?php echo $lang_admin_censoring['Replacement label'] ?></th> 139 <th class="hidehead" scope="col"><?php echo $lang_admin_censoring['Action label'] ?></th> 139 140 </tr> 140 141 </thead> … … 143 144 144 145 while ($cur_word = $db->fetch_assoc($result)) 145 echo "\t\t\t\t\t\t\t\t".'<tr><td ><input type="text" name="search_for['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['search_for']).'" size="24" maxlength="60" /></td><td><input type="text" name="replace_with['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['replace_with']).'" size="24" maxlength="60" /></td><td><input type="submit" name="update['.$cur_word['id'].']" value=" Modifier " /> <input type="submit" name="remove['.$cur_word['id'].']" value=" Supprimer" /></td></tr>'."\n";146 echo "\t\t\t\t\t\t\t\t".'<tr><td class="tcl"><input type="text" name="search_for['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['search_for']).'" size="24" maxlength="60" /></td><td class="tc2"><input type="text" name="replace_with['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['replace_with']).'" size="24" maxlength="60" /></td><td><input type="submit" name="update['.$cur_word['id'].']" value="'.$lang_admin_common['Update'].'" /> <input type="submit" name="remove['.$cur_word['id'].']" value="'.$lang_admin_common['Remove'].'" /></td></tr>'."\n"; 146 147 147 148 ?> … … 152 153 } 153 154 else 154 echo "\t\t\t\t\t\t\t".'<p> Aucun mot à censurer dans la liste.</p>'."\n";155 echo "\t\t\t\t\t\t\t".'<p>'.$lang_admin_censoring['No words in list'].'</p>'."\n"; 155 156 156 157 ?> -
/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> -
/branches/rsr.v5.1.dev/web/punbb/admin_groups.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_censoring.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_groups.php'; 37 22 38 23 // Add/edit a group (stage 1) … … 43 28 $base_group = intval($_POST['base_group']); 44 29 45 $result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$base_group) or error(' Impossible de retrouver les informations de groupes utilisateurs', __FILE__, __LINE__, $db->error());30 $result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$base_group) or error('Unable to fetch user group info', __FILE__, __LINE__, $db->error()); 46 31 $group = $db->fetch_assoc($result); 47 32 48 33 $mode = 'add'; 49 34 } 50 else 35 else // We are editing a group 51 36 { 52 37 $group_id = intval($_GET['edit_group']); … … 54 39 message($lang_common['Bad request']); 55 40 56 $result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error(' Impossible de retrouver les informations de groupes utilisateurs', __FILE__, __LINE__, $db->error());41 $result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch user group info', __FILE__, __LINE__, $db->error()); 57 42 if (!$db->num_rows($result)) 58 43 message($lang_common['Bad request']); … … 64 49 65 50 66 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Groupes';67 $required_fields = array('req_title' => 'Nom groupe');51 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']); 52 $required_fields = array('req_title' => $lang_admin_groups['Group title label']); 68 53 $focus_element = array('groups2', 'req_title'); 54 define('PUN_ACTIVE_PAGE', 'admin'); 69 55 require PUN_ROOT.'header.php'; 70 56 … … 73 59 ?> 74 60 <div class="blockform"> 75 <h2><span> Réglages du groupe</span></h2>61 <h2><span><?php echo $lang_admin_groups['Group settings head'] ?></span></h2> 76 62 <div class="box"> 77 63 <form id="groups2" method="post" action="admin_groups.php" onsubmit="return process_form(this)"> 78 <p class="submittop"><input type="submit" name="add_edit_group" value=" Enregistrer" /></p>64 <p class="submittop"><input type="submit" name="add_edit_group" value="<?php echo $lang_admin_common['Save'] ?>" /></p> 79 65 <div class="inform"> 80 66 <input type="hidden" name="mode" value="<?php echo $mode ?>" /> 81 <?php if ($mode == 'edit'): ?> <input type="hidden" name="group_id" value="<?php echo $group_id ?>" />82 <?php endif; ?><?php if ($mode == 'add'): ?> <input type="hidden" name="base_group" value="<?php echo $base_group ?>" />67 <?php if ($mode == 'edit'): ?> <input type="hidden" name="group_id" value="<?php echo $group_id ?>" /> 68 <?php endif; ?><?php if ($mode == 'add'): ?> <input type="hidden" name="base_group" value="<?php echo $base_group ?>" /> 83 69 <?php endif; ?> <fieldset> 84 <legend> Réglages des options et des permissions de groupe</legend>70 <legend><?php echo $lang_admin_groups['Group settings subhead'] ?></legend> 85 71 <div class="infldset"> 86 <p> Les options et permissions ci-dessous sont les permissions par défaut pour le groupe. Ces options s'appliquent s'il n'y a pas de réglages de permissions spécifiques à un forum.</p>72 <p><?php echo $lang_admin_groups['Group settings info'] ?></p> 87 73 <table class="aligntop" cellspacing="0"> 88 74 <tr> 89 <th scope="row"> Nom groupe</th>75 <th scope="row"><?php echo $lang_admin_groups['Group title label'] ?></th> 90 76 <td> 91 77 <input type="text" name="req_title" size="25" maxlength="50" value="<?php if ($mode == 'edit') echo pun_htmlspecialchars($group['g_title']); ?>" tabindex="1" /> … … 93 79 </tr> 94 80 <tr> 95 <th scope="row"> Titre utilisateur</th>81 <th scope="row"><?php echo $lang_admin_groups['User title label'] ?></th> 96 82 <td> 97 83 <input type="text" name="user_title" size="25" maxlength="50" value="<?php echo pun_htmlspecialchars($group['g_user_title']) ?>" tabindex="2" /> 98 <span>Ce titre remplacera n'importe quel nom de rang que les utilisateurs de ce groupe auront atteint. Laissez vide pour utiliser le titre par défaut ou le rang.</span> 99 </td> 100 </tr> 101 <?php if ($group['g_id'] != PUN_ADMIN): ?> <tr> 102 <th scope="row">Lire forums</th> 103 <td> 104 <input type="radio" name="read_board" value="1"<?php if ($group['g_read_board'] == '1') echo ' checked="checked"' ?> tabindex="3" /> <strong>Oui</strong>   <input type="radio" name="read_board" value="0"<?php if ($group['g_read_board'] == '0') echo ' checked="checked"' ?> tabindex="4" /> <strong>Non</strong> 105 <span>Autoriser les utilisateurs de ce groupe à voir les forums. Ce réglage s'applique à tous les aspects des forums et ne peut être outrepassé par les permissions spécifiques aux forums. Avec cette option à non les utilisateurs de ce groupe ne pourront que s'identifier/se déconnecter.</span> 106 </td> 107 </tr> 108 <tr> 109 <th scope="row">Ãcrire des réponses</th> 110 <td> 111 <input type="radio" name="post_replies" value="1"<?php if ($group['g_post_replies'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong>Oui</strong>   <input type="radio" name="post_replies" value="0"<?php if ($group['g_post_replies'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong>Non</strong> 112 <span>Autoriser les utilisateurs de ce groupe à écrire des réponses aux discussions.</span> 113 </td> 114 </tr> 115 <tr> 116 <th scope="row">Lancer des discussions</th> 117 <td> 118 <input type="radio" name="post_topics" value="1"<?php if ($group['g_post_topics'] == '1') echo ' checked="checked"' ?> tabindex="7" /> <strong>Oui</strong>   <input type="radio" name="post_topics" value="0"<?php if ($group['g_post_topics'] == '0') echo ' checked="checked"' ?> tabindex="8" /> <strong>Non</strong> 119 <span>Autoriser les utilisateurs de ce groupe à lancer des nouveaux sujets.</span> 84 <span><?php echo $lang_admin_groups['User title help'] ?></span> 85 </td> 86 </tr> 87 <?php if ($group['g_id'] != PUN_ADMIN): if ($group['g_id'] != PUN_GUEST): if ($mode != 'edit' || $pun_config['o_default_user_group'] != $group['g_id']): ?> <tr> 88 <th scope="row"> <?php echo $lang_admin_groups['Mod privileges label'] ?></th> 89 <td> 90 <input type="radio" name="moderator" value="1"<?php if ($group['g_moderator'] == '1') echo ' checked="checked"' ?> tabindex="3" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="moderator" value="0"<?php if ($group['g_moderator'] == '0') echo ' checked="checked"' ?> tabindex="4" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 91 <span><?php echo $lang_admin_groups['Mod privileges help'] ?></span> 92 </td> 93 </tr> 94 <tr> 95 <th scope="row"><?php echo $lang_admin_groups['Edit profile label'] ?></th> 96 <td> 97 <input type="radio" name="mod_edit_users" value="1"<?php if ($group['g_mod_edit_users'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_edit_users" value="0"<?php if ($group['g_mod_edit_users'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 98 <span><?php echo $lang_admin_groups['Edit profile help'] ?></span> 99 </td> 100 </tr> 101 <tr> 102 <th scope="row"><?php echo $lang_admin_groups['Rename users label'] ?></th> 103 <td> 104 <input type="radio" name="mod_rename_users" value="1"<?php if ($group['g_mod_rename_users'] == '1') echo ' checked="checked"' ?> tabindex="7" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_rename_users" value="0"<?php if ($group['g_mod_rename_users'] == '0') echo ' checked="checked"' ?> tabindex="8" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 105 <span><?php echo $lang_admin_groups['Rename users help'] ?></span> 106 </td> 107 </tr> 108 <tr> 109 <th scope="row"><?php echo $lang_admin_groups['Change passwords label'] ?></th> 110 <td> 111 <input type="radio" name="mod_change_passwords" value="1"<?php if ($group['g_mod_change_passwords'] == '1') echo ' checked="checked"' ?> tabindex="9" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_change_passwords" value="0"<?php if ($group['g_mod_change_passwords'] == '0') echo ' checked="checked"' ?> tabindex="10" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 112 <span><?php echo $lang_admin_groups['Change passwords help'] ?></span> 113 </td> 114 </tr> 115 <tr> 116 <th scope="row"><?php echo $lang_admin_groups['Ban users label'] ?></th> 117 <td> 118 <input type="radio" name="mod_ban_users" value="1"<?php if ($group['g_mod_ban_users'] == '1') echo ' checked="checked"' ?> tabindex="11" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_ban_users" value="0"<?php if ($group['g_mod_ban_users'] == '0') echo ' checked="checked"' ?> tabindex="12" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 119 <span><?php echo $lang_admin_groups['Ban users help'] ?></span> 120 </td> 121 </tr> 122 <?php endif; endif; ?> <tr> 123 <th scope="row"><?php echo $lang_admin_groups['Read board label'] ?></th> 124 <td> 125 <input type="radio" name="read_board" value="1"<?php if ($group['g_read_board'] == '1') echo ' checked="checked"' ?> tabindex="13" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="read_board" value="0"<?php if ($group['g_read_board'] == '0') echo ' checked="checked"' ?> tabindex="14" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 126 <span><?php echo $lang_admin_groups['Read board help'] ?></span> 127 </td> 128 </tr> 129 <tr> 130 <th scope="row"><?php echo $lang_admin_groups['View user info label'] ?></th> 131 <td> 132 <input type="radio" name="view_users" value="1"<?php if ($group['g_view_users'] == '1') echo ' checked="checked"' ?> tabindex="15" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="view_users" value="0"<?php if ($group['g_view_users'] == '0') echo ' checked="checked"' ?> tabindex="16" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 133 <span><?php echo $lang_admin_groups['View user info help'] ?></span> 134 </td> 135 </tr> 136 <tr> 137 <th scope="row"><?php echo $lang_admin_groups['Post replies label'] ?></th> 138 <td> 139 <input type="radio" name="post_replies" value="1"<?php if ($group['g_post_replies'] == '1') echo ' checked="checked"' ?> tabindex="17" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="post_replies" value="0"<?php if ($group['g_post_replies'] == '0') echo ' checked="checked"' ?> tabindex="18" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 140 <span><?php echo $lang_admin_groups['Post replies help'] ?></span> 141 </td> 142 </tr> 143 <tr> 144 <th scope="row"><?php echo $lang_admin_groups['Post topics label'] ?></th> 145 <td> 146 <input type="radio" name="post_topics" value="1"<?php if ($group['g_post_topics'] == '1') echo ' checked="checked"' ?> tabindex="19" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="post_topics" value="0"<?php if ($group['g_post_topics'] == '0') echo ' checked="checked"' ?> tabindex="20" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 147 <span><?php echo $lang_admin_groups['Post topics help'] ?></span> 120 148 </td> 121 149 </tr> 122 150 <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> 123 <th scope="row">Modifier messages</th> 124 <td> 125 <input type="radio" name="edit_posts" value="1"<?php if ($group['g_edit_posts'] == '1') echo ' checked="checked"' ?> tabindex="11" /> <strong>Oui</strong>   <input type="radio" name="edit_posts" value="0"<?php if ($group['g_edit_posts'] == '0') echo ' checked="checked"' ?> tabindex="12" /> <strong>Non</strong> 126 <span>Autoriser les utilisateurs de ce groupe à modifier leurs propres messages.</span> 127 </td> 128 </tr> 129 <tr> 130 <th scope="row">Effacer les messages</th> 131 <td> 132 <input type="radio" name="delete_posts" value="1"<?php if ($group['g_delete_posts'] == '1') echo ' checked="checked"' ?> tabindex="13" /> <strong>Oui</strong>   <input type="radio" name="delete_posts" value="0"<?php if ($group['g_delete_posts'] == '0') echo ' checked="checked"' ?> tabindex="14" /> <strong>Non</strong> 133 <span>Autoriser les utilisateurs de ce groupe à effacer leurs propres messages.</span> 134 </td> 135 </tr> 136 <tr> 137 <th scope="row">Effacer les discussions</th> 138 <td> 139 <input type="radio" name="delete_topics" value="1"<?php if ($group['g_delete_topics'] == '1') echo ' checked="checked"' ?> tabindex="15" /> <strong>Oui</strong>   <input type="radio" name="delete_topics" value="0"<?php if ($group['g_delete_topics'] == '0') echo ' checked="checked"' ?> tabindex="16" /> <strong>Non</strong> 140 <span>Autoriser les utilisateurs de ce groupe à effacer leurs propres sujets (y compris toutes les réponses).</span> 141 </td> 142 </tr> 143 <tr> 144 <th scope="row">Titre personnalisé</th> 145 <td> 146 <input type="radio" name="set_title" value="1"<?php if ($group['g_set_title'] == '1') echo ' checked="checked"' ?> tabindex="17" /> <strong>Oui</strong>   <input type="radio" name="set_title" value="0"<?php if ($group['g_set_title'] == '0') echo ' checked="checked"' ?> tabindex="18" /> 147  <strong>Non</strong> 148 <span>Autoriser les utilisateurs de ce groupe à modifier leur propre titre utilisateur.</span> 151 <th scope="row"><?php echo $lang_admin_groups['Edit posts label'] ?></th> 152 <td> 153 <input type="radio" name="edit_posts" value="1"<?php if ($group['g_edit_posts'] == '1') echo ' checked="checked"' ?> tabindex="21" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="edit_posts" value="0"<?php if ($group['g_edit_posts'] == '0') echo ' checked="checked"' ?> tabindex="22" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 154 <span><?php echo $lang_admin_groups['Edit posts help'] ?></span> 155 </td> 156 </tr> 157 <tr> 158 <th scope="row"><?php echo $lang_admin_groups['Delete posts label'] ?></th> 159 <td> 160 <input type="radio" name="delete_posts" value="1"<?php if ($group['g_delete_posts'] == '1') echo ' checked="checked"' ?> tabindex="23" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="delete_posts" value="0"<?php if ($group['g_delete_posts'] == '0') echo ' checked="checked"' ?> tabindex="24" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 161 <span><?php echo $lang_admin_groups['Delete posts help'] ?></span> 162 </td> 163 </tr> 164 <tr> 165 <th scope="row"><?php echo $lang_admin_groups['Delete topics label'] ?></th> 166 <td> 167 <input type="radio" name="delete_topics" value="1"<?php if ($group['g_delete_topics'] == '1') echo ' checked="checked"' ?> tabindex="25" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="delete_topics" value="0"<?php if ($group['g_delete_topics'] == '0') echo ' checked="checked"' ?> tabindex="26" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 168 <span><?php echo $lang_admin_groups['Delete topics help'] ?></span> 169 </td> 170 </tr> 171 <tr> 172 <th scope="row"><?php echo $lang_admin_groups['Set own title label'] ?></th> 173 <td> 174 <input type="radio" name="set_title" value="1"<?php if ($group['g_set_title'] == '1') echo ' checked="checked"' ?> tabindex="27" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="set_title" value="0"<?php if ($group['g_set_title'] == '0') echo ' checked="checked"' ?> tabindex="28" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 175 <span><?php echo $lang_admin_groups['Set own title help'] ?></span> 149 176 </td> 150 177 </tr> 151 178 <?php endif; ?> <tr> 152 <th scope="row"> Utiliser la recherche</th>153 <td> 154 <input type="radio" name="search" value="1"<?php if ($group['g_search'] == '1') echo ' checked="checked"' ?> tabindex=" 19" /> <strong>Oui</strong>   <input type="radio" name="search" value="0"<?php if ($group['g_search'] == '0') echo ' checked="checked"' ?> tabindex="20" /> <strong>Non</strong>155 <span> Autoriser les utilisateurs de ce groupe à utiliser la fonction de recherche sur les forums.</span>156 </td> 157 </tr> 158 <tr> 159 <th scope="row"> Recherche d'utilisateur</th>160 <td> 161 <input type="radio" name="search_users" value="1"<?php if ($group['g_search_users'] == '1') echo ' checked="checked"' ?> tabindex=" 21" /> <strong>Oui</strong>   <input type="radio" name="search_users" value="0"<?php if ($group['g_search_users'] == '0') echo ' checked="checked"' ?> tabindex="22" /> <strong>Non</strong>162 <span> Autoriser les utilisateurs de ce groupe à utiliser un texte libre pour rechercher dans la liste des utilisateurs.</span>179 <th scope="row"><?php echo $lang_admin_groups['User search label'] ?></th> 180 <td> 181 <input type="radio" name="search" value="1"<?php if ($group['g_search'] == '1') echo ' checked="checked"' ?> tabindex="29" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="search" value="0"<?php if ($group['g_search'] == '0') echo ' checked="checked"' ?> tabindex="30" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 182 <span><?php echo $lang_admin_groups['User search help'] ?></span> 183 </td> 184 </tr> 185 <tr> 186 <th scope="row"><?php echo $lang_admin_groups['User list search label'] ?></th> 187 <td> 188 <input type="radio" name="search_users" value="1"<?php if ($group['g_search_users'] == '1') echo ' checked="checked"' ?> tabindex="31" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="search_users" value="0"<?php if ($group['g_search_users'] == '0') echo ' checked="checked"' ?> tabindex="32" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 189 <span><?php echo $lang_admin_groups['User list search help'] ?></span> 163 190 </td> 164 191 </tr> 165 192 <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> 166 <th scope="row">Intervalle pour modifier le sujet d'une discussion</th> 167 <td> 168 <input type="text" name="edit_subjects_interval" size="5" maxlength="5" value="<?php echo $group['g_edit_subjects_interval'] ?>" tabindex="23" /> 169 <span>Nombre de secondes aprÚs que le message ait été envoyé pendant lesquelles les utilisateurs de ce groupe pourront modifier le sujet d'une discussion qu'ils viennent de lancer. Mettre à 0 pour permettre la modification du sujet des discussions sans restriction dans le temps.</span> 170 </td> 171 </tr> 172 <tr> 173 <th scope="row">Intervalle de contrÃŽle de flood sur les messages</th> 174 <td> 175 <input type="text" name="post_flood" size="5" maxlength="4" value="<?php echo $group['g_post_flood'] ?>" tabindex="24" /> 176 <span>Nombre de secondes pendant lesquelles les utilisateurs de ce groupe devront patienter entre deux messages. Mettre à 0 pour désactiver le contrÃŽle de flood sur les messages.</span> 177 </td> 178 </tr> 179 <tr> 180 <th scope="row">Intervalle de contrÃŽle de flood sur les recherches</th> 181 <td> 182 <input type="text" name="search_flood" size="5" maxlength="4" value="<?php echo $group['g_search_flood'] ?>" tabindex="25" /> 183 <span>Nombre de secondes pendant lesquelles les utilisateurs de ce groupe devront patienter entre deux recherches. Mettre à 0 pour désactiver le contrÃŽle de flood sur les recherches.</span> 184 </td> 185 </tr> 186 <?php endif; ?><?php endif; ?> </table> 187 <?php if ($group['g_id'] == PUN_MOD ): ?> <p class="warntext">Pour qu'un utilisateur de ce groupe acquiÚre les compétences de modérateur, il devra nécessairement être désigné comme modérateur d'un ou de plusieurs forums. Ceci est possible depuis la page d'administration du profil de l'utilisateur.</p> 193 <th scope="row"><?php echo $lang_admin_groups['Send e-mails label'] ?></th> 194 <td> 195 <input type="radio" name="send_email" value="1"<?php if ($group['g_send_email'] == '1') echo ' checked="checked"' ?> tabindex="33" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="send_email" value="0"<?php if ($group['g_send_email'] == '0') echo ' checked="checked"' ?> tabindex="34" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 196 <span><?php echo $lang_admin_groups['Send e-mails help'] ?></span> 197 </td> 198 </tr> 199 <?php endif; ?> <tr> 200 <th scope="row"><?php echo $lang_admin_groups['Post flood label'] ?></th> 201 <td> 202 <input type="text" name="post_flood" size="5" maxlength="4" value="<?php echo $group['g_post_flood'] ?>" tabindex="35" /> 203 <span><?php echo $lang_admin_groups['Post flood help'] ?></span> 204 </td> 205 </tr> 206 <tr> 207 <th scope="row"><?php echo $lang_admin_groups['Search flood label'] ?></th> 208 <td> 209 <input type="text" name="search_flood" size="5" maxlength="4" value="<?php echo $group['g_search_flood'] ?>" tabindex="36" /> 210 <span><?php echo $lang_admin_groups['Search flood help'] ?></span> 211 </td> 212 </tr> 213 <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> 214 <th scope="row"><?php echo $lang_admin_groups['E-mail flood label'] ?></th> 215 <td> 216 <input type="text" name="email_flood" size="5" maxlength="4" value="<?php echo $group['g_email_flood'] ?>" tabindex="37" /> 217 <span><?php echo $lang_admin_groups['E-mail flood help'] ?></span> 218 </td> 219 </tr> 220 <tr> 221 <th scope="row"><?php echo $lang_admin_groups['Report flood label'] ?></th> 222 <td> 223 <input type="text" name="report_flood" size="5" maxlength="4" value="<?php echo $group['g_report_flood'] ?>" tabindex="38" /> 224 <span><?php echo $lang_admin_groups['Report flood help'] ?></span> 225 </td> 226 </tr> 227 <?php endif; endif; ?> </table> 228 <?php if ($group['g_moderator'] == '1' ): ?> <p class="warntext"><?php echo $lang_admin_groups['Moderator info'] ?></p> 188 229 <?php endif; ?> </div> 189 230 </fieldset> 190 231 </div> 191 <p class="submitend"><input type="submit" name="add_edit_group" value=" Enregistrer " tabindex="26" /></p>232 <p class="submitend"><input type="submit" name="add_edit_group" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="39" /></p> 192 233 </form> 193 234 </div> … … 209 250 $is_admin_group = (isset($_POST['group_id']) && $_POST['group_id'] == PUN_ADMIN) ? true : false; 210 251 211 $title = trim($_POST['req_title']); 212 $user_title = trim($_POST['user_title']); 252 $title = pun_trim($_POST['req_title']); 253 $user_title = pun_trim($_POST['user_title']); 254 $moderator = isset($_POST['moderator']) && $_POST['moderator'] == '1' ? '1' : '0'; 255 $mod_edit_users = $moderator == '1' && isset($_POST['mod_edit_users']) && $_POST['mod_edit_users'] == '1' ? '1' : '0'; 256 $mod_rename_users = $moderator == '1' && isset($_POST['mod_rename_users']) && $_POST['mod_rename_users'] == '1' ? '1' : '0'; 257 $mod_change_passwords = $moderator == '1' && isset($_POST['mod_change_passwords']) && $_POST['mod_change_passwords'] == '1' ? '1' : '0'; 258 $mod_ban_users = $moderator == '1' && isset($_POST['mod_ban_users']) && $_POST['mod_ban_users'] == '1' ? '1' : '0'; 213 259 $read_board = isset($_POST['read_board']) ? intval($_POST['read_board']) : '1'; 260 $view_users = (isset($_POST['view_users']) && $_POST['view_users'] == '1') || $is_admin_group ? '1' : '0'; 214 261 $post_replies = isset($_POST['post_replies']) ? intval($_POST['post_replies']) : '1'; 215 262 $post_topics = isset($_POST['post_topics']) ? intval($_POST['post_topics']) : '1'; … … 220 267 $search = isset($_POST['search']) ? intval($_POST['search']) : '1'; 221 268 $search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1'; 222 $ edit_subjects_interval = isset($_POST['edit_subjects_interval']) ? intval($_POST['edit_subjects_interval']): '0';269 $send_email = (isset($_POST['send_email']) && $_POST['send_email'] == '1') || $is_admin_group ? '1' : '0'; 223 270 $post_flood = isset($_POST['post_flood']) ? intval($_POST['post_flood']) : '0'; 224 271 $search_flood = isset($_POST['search_flood']) ? intval($_POST['search_flood']) : '0'; 272 $email_flood = isset($_POST['email_flood']) ? intval($_POST['email_flood']) : '0'; 273 $report_flood = isset($_POST['report_flood']) ? intval($_POST['report_flood']) : '0'; 225 274 226 275 if ($title == '') 227 message( 'Vous devez saisir un nom de groupe.');276 message($lang_admin_groups['Must enter title message']); 228 277 229 278 $user_title = ($user_title != '') ? '\''.$db->escape($user_title).'\'' : 'NULL'; … … 231 280 if ($_POST['mode'] == 'add') 232 281 { 233 $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error(' Impossible de vérifier si un groupe porte déjà ce nom', __FILE__, __LINE__, $db->error());282 $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $db->error()); 234 283 if ($db->num_rows($result)) 235 message( 'Il existe déjà un groupe nommé \''.pun_htmlspecialchars($title).'\'.');236 237 $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_ read_board, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$read_board.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$edit_subjects_interval.', '.$post_flood.', '.$search_flood.')') or error('Impossible d\'ajouter le groupe', __FILE__, __LINE__, $db->error());284 message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title))); 285 286 $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$moderator.', '.$mod_edit_users.', '.$mod_rename_users.', '.$mod_change_passwords.', '.$mod_ban_users.', '.$read_board.', '.$view_users.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$send_email.', '.$post_flood.', '.$search_flood.', '.$email_flood.', '.$report_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error()); 238 287 $new_group_id = $db->insert_id(); 239 288 240 289 // Now lets copy the forum specific permissions from the group which this group is based on 241 $result = $db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error(' Impossible de retrouver la liste des permissions de groupes du forum', __FILE__, __LINE__, $db->error());290 $result = $db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error()); 242 291 while ($cur_forum_perm = $db->fetch_assoc($result)) 243 $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error(' Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());292 $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error()); 244 293 } 245 294 else 246 295 { 247 $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error(' impossible de vérifier une éventuelle collision des titres de groupes', __FILE__, __LINE__, $db->error());296 $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error('Unable to check group title collision', __FILE__, __LINE__, $db->error()); 248 297 if ($db->num_rows($result)) 249 message( 'Il existe déjà un groupe nommé \''.pun_htmlspecialchars($title).'\'.');250 251 $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_ read_board='.$read_board.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_edit_subjects_interval='.$edit_subjects_interval.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Impossible de modifier le groupe', __FILE__, __LINE__, $db->error());298 message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title))); 299 300 $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_moderator='.$moderator.', g_mod_edit_users='.$mod_edit_users.', g_mod_rename_users='.$mod_rename_users.', g_mod_change_passwords='.$mod_change_passwords.', g_mod_ban_users='.$mod_ban_users.', g_read_board='.$read_board.', g_view_users='.$view_users.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_send_email='.$send_email.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.', g_email_flood='.$email_flood.', g_report_flood='.$report_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error()); 252 301 } 253 302 254 // Regenerate the quickjump cache 255 require_once PUN_ROOT.'include/cache.php'; 256 generate_quickjump_cache(); 257 258 redirect('admin_groups.php', 'Groupe '.(($_POST['mode'] == 'edit') ? 'modifié' : 'ajouté').'. Redirection ...'); 303 // Regenerate the quick jump cache 304 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 305 require PUN_ROOT.'include/cache.php'; 306 307 $group_id = $_POST['mode'] == 'add' ? $new_group_id : intval($_POST['group_id']); 308 generate_quickjump_cache($group_id); 309 310 if ($_POST['mode'] == 'edit') 311 redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']); 312 else 313 redirect('admin_groups.php', $lang_admin_groups['Group added redirect']); 259 314 } 260 315 … … 266 321 267 322 $group_id = intval($_POST['default_group']); 268 if ($group_id < 1) 323 324 // Make sure it's not the admin or guest groups 325 if ($group_id == PUN_ADMIN || $group_id == PUN_GUEST) 269 326 message($lang_common['Bad request']); 270 327 271 $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Impossible de modifier la configuration des forums', __FILE__, __LINE__, $db->error()); 328 // Make sure it's not a moderator group 329 $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_id='.$group_id.' AND g_moderator=0') or error('Unable to check group moderator status', __FILE__, __LINE__, $db->error()); 330 if (!$db->num_rows($result)) 331 message($lang_common['Bad request']); 332 333 $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error()); 272 334 273 335 // Regenerate the config cache 274 require_once PUN_ROOT.'include/cache.php'; 336 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 337 require PUN_ROOT.'include/cache.php'; 338 275 339 generate_config_cache(); 276 340 277 redirect('admin_groups.php', 'Groupe par défaut réglé. Redirection ...');341 redirect('admin_groups.php', $lang_admin_groups['Default group redirect']); 278 342 } 279 343 … … 284 348 confirm_referrer('admin_groups.php'); 285 349 286 $group_id = i ntval($_GET['del_group']);350 $group_id = isset($_POST['group_to_delete']) ? intval($_POST['group_to_delete']) : intval($_GET['del_group']); 287 351 if ($group_id < 5) 288 352 message($lang_common['Bad request']); … … 290 354 // Make sure we don't remove the default group 291 355 if ($group_id == $pun_config['o_default_user_group']) 292 message('Le groupe par défaut ne peut être supprimé. Vous devez d\'abord définir un groupe par défaut différent.'); 293 356 message($lang_admin_groups['Cannot remove default message']); 294 357 295 358 // Check if this group has any members 296 $result = $db->query('SELECT g.g_title, COUNT(u.id) FROM '.$db->prefix.'groups AS g INNER JOIN '.$db->prefix.'users AS u ON g.g_id=u.group_id WHERE g.g_id='.$group_id.' GROUP BY g.g_id, g_title') or error(' Impossible de retrouver les informations du groupe', __FILE__, __LINE__, $db->error());359 $result = $db->query('SELECT g.g_title, COUNT(u.id) FROM '.$db->prefix.'groups AS g INNER JOIN '.$db->prefix.'users AS u ON g.g_id=u.group_id WHERE g.g_id='.$group_id.' GROUP BY g.g_id, g_title') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); 297 360 298 361 // If the group doesn't have any members or if we've already selected a group to move the members to 299 362 if (!$db->num_rows($result) || isset($_POST['del_group'])) 300 363 { 301 if (isset($_POST['del_group ']))364 if (isset($_POST['del_group_comply']) || isset($_POST['del_group'])) 302 365 { 303 $move_to_group = intval($_POST['move_to_group']); 304 $db->query('UPDATE '.$db->prefix.'users SET group_id='.$move_to_group.' WHERE group_id='.$group_id) or error('Impossible de déplacer les utilisateurs dans le groupe', __FILE__, __LINE__, $db->error()); 366 if (isset($_POST['del_group'])) 367 { 368 $move_to_group = intval($_POST['move_to_group']); 369 $db->query('UPDATE '.$db->prefix.'users SET group_id='.$move_to_group.' WHERE group_id='.$group_id) or error('Unable to move users into group', __FILE__, __LINE__, $db->error()); 370 } 371 372 // Delete the group and any forum specific permissions 373 $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error()); 374 $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); 375 376 redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']); 305 377 } 306 307 // Delete the group and any forum specific permissions 308 $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Impossible de supprimer le groupe', __FILE__, __LINE__, $db->error()); 309 $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Impossible de supprimer les permissions de groupe du forum', __FILE__, __LINE__, $db->error()); 310 311 // Regenerate the quickjump cache 312 require_once PUN_ROOT.'include/cache.php'; 313 generate_quickjump_cache(); 314 315 redirect('admin_groups.php', 'Groupe supprimé. Redirection ...'); 316 } 317 318 319 list($group_title, $group_members) = $db->fetch_row($result); 320 321 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Groupes'; 322 require PUN_ROOT.'header.php'; 323 324 generate_admin_menu('groups'); 378 else 379 { 380 $result = $db->query('SELECT g_title FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group title', __FILE__, __LINE__, $db->error()); 381 $group_title = $db->result($result); 382 383 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']); 384 define('PUN_ACTIVE_PAGE', 'admin'); 385 require PUN_ROOT.'header.php'; 386 387 generate_admin_menu('groups'); 325 388 326 389 ?> 327 390 <div class="blockform"> 328 <h2><span> Supprimer groupe</span></h2>391 <h2><span><?php echo $lang_admin_groups['Group delete head'] ?></span></h2> 329 392 <div class="box"> 330 <form id="groups"method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>">393 <form method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>"> 331 394 <div class="inform"> 395 <input type="hidden" name="group_to_delete" value="<?php echo $group_id ?>" /> 332 396 <fieldset> 333 <legend> Déplacer les utilisateur de ce groupe</legend>397 <legend><?php echo $lang_admin_groups['Confirm delete subhead'] ?></legend> 334 398 <div class="infldset"> 335 <p>Il y a actuellement <?php echo $group_members ?> membres dans le groupe "<?php echo pun_htmlspecialchars($group_title) ?>". Veuillez sélectionner un groupe dans lequel ces utilisateurs seront déplacés.</p> 336 <label>Déplacer les utilisateurs dans 337 <select name="move_to_group"> 338 <?php 339 340 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' AND g_id!='.$group_id.' ORDER BY g_title') or error('Impossible de retrouver la liste des groupes', __FILE__, __LINE__, $db->error()); 341 342 while ($cur_group = $db->fetch_assoc($result)) 343 { 344 if ($cur_group['g_id'] == PUN_MEMBER) // Pre-select the pre-defined Members group 345 echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n"; 346 else 347 echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n"; 348 } 349 350 ?> 351 </select> 352 </br></label> 399 <p><?php printf($lang_admin_groups['Confirm delete info'], pun_htmlspecialchars($group_title)) ?></p> 400 <p class="warntext"><?php echo $lang_admin_groups['Confirm delete warn'] ?></p> 353 401 </div> 354 402 </fieldset> 355 403 </div> 356 <p ><input type="submit" name="del_group" value=" Supprimer groupe " /></p>404 <p class="buttons"><input type="submit" name="del_group_comply" value="<?php echo $lang_admin_common['Delete'] ?>" tabindex="1" /><a href="javascript:history.go(-1)" tabindex="2"><?php echo $lang_admin_common['Go back'] ?></a></p> 357 405 </form> 358 406 </div> … … 362 410 <?php 363 411 412 require PUN_ROOT.'footer.php'; 413 } 414 } 415 416 list($group_title, $group_members) = $db->fetch_row($result); 417 418 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']); 419 define('PUN_ACTIVE_PAGE', 'admin'); 420 require PUN_ROOT.'header.php'; 421 422 generate_admin_menu('groups'); 423 424 ?> 425 <div class="blockform"> 426 <h2><span><?php echo $lang_admin_groups['Delete group head'] ?></span></h2> 427 <div class="box"> 428 <form id="groups" method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>"> 429 <div class="inform"> 430 <fieldset> 431 <legend><?php echo $lang_admin_groups['Move users subhead'] ?></legend> 432 <div class="infldset"> 433 <p><?php printf($lang_admin_groups['Move users info'], pun_htmlspecialchars($group_title), forum_number_format($group_members)) ?></p> 434 <label><?php echo $lang_admin_groups['Move users label'] ?> 435 <select name="move_to_group"> 436 <?php 437 438 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' AND g_id!='.$group_id.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); 439 440 while ($cur_group = $db->fetch_assoc($result)) 441 { 442 if ($cur_group['g_id'] == PUN_MEMBER) // Pre-select the pre-defined Members group 443 echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n"; 444 else 445 echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n"; 446 } 447 448 ?> 449 </select> 450 <br /></label> 451 </div> 452 </fieldset> 453 </div> 454 <p class="buttons"><input type="submit" name="del_group" value="<?php echo $lang_admin_groups['Delete group'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> 455 </form> 456 </div> 457 </div> 458 <div class="clearer"></div> 459 </div> 460 <?php 461 364 462 require PUN_ROOT.'footer.php'; 365 463 } 366 464 367 465 368 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Groupes'; 466 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']); 467 define('PUN_ACTIVE_PAGE', 'admin'); 369 468 require PUN_ROOT.'header.php'; 370 469 … … 373 472 ?> 374 473 <div class="blockform"> 375 <h2><span> Ajouter/régler groupes</span></h2>474 <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> 376 475 <div class="box"> 377 <form id="groups" method="post" action="admin_groups.php ?action=foo">476 <form id="groups" method="post" action="admin_groups.php"> 378 477 <div class="inform"> 379 478 <fieldset> 380 <legend> Ajouter un groupe</legend>479 <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> 381 480 <div class="infldset"> 382 481 <table class="aligntop" cellspacing="0"> 383 482 <tr> 384 <th scope="row"> Nouveau groupe basé sur le groupe<div><input type="submit" name="add_group" value=" Ajouter" tabindex="2" /></div></th>483 <th scope="row"><?php echo $lang_admin_groups['New group label'] ?><div><input type="submit" name="add_group" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="2" /></div></th> 385 484 <td> 386 485 <select id="base_group" name="base_group" tabindex="1"> 387 486 <?php 388 487 389 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id >'.PUN_GUEST.' ORDER BY g_title') or error('Impossible de retrouver la liste des groupes', __FILE__, __LINE__, $db->error());488 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN.' AND g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); 390 489 391 490 while ($cur_group = $db->fetch_assoc($result)) … … 399 498 ?> 400 499 </select> 401 <span> Choisissez un groupe d'utilisateurs duquel le nouveau groupe héritera les propriétés. La page suivante vous permettra d'affiner ces réglages.</span>500 <span><?php echo $lang_admin_groups['New group help'] ?></span> 402 501 </td> 403 502 </tr> … … 408 507 <div class="inform"> 409 508 <fieldset> 410 <legend> Définir le groupe par défaut</legend>509 <legend><?php echo $lang_admin_groups['Default group subhead'] ?></legend> 411 510 <div class="infldset"> 412 511 <table class="aligntop" cellspacing="0"> 413 512 <tr> 414 <th scope="row"> Groupe par défaut<div><input type="submit" name="set_default_group" value=" Enregistrer" tabindex="4" /></div></th>513 <th scope="row"><?php echo $lang_admin_groups['Default group label'] ?><div><input type="submit" name="set_default_group" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="4" /></div></th> 415 514 <td> 416 515 <select id="default_group" name="default_group" tabindex="3"> 417 516 <?php 418 517 419 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id>'.PUN_GUEST.' ORDER BY g_title') or error('Impossible de retrouver la liste des groupes', __FILE__, __LINE__, $db->error());518 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id>'.PUN_GUEST.' AND g_moderator=0 ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); 420 519 421 520 while ($cur_group = $db->fetch_assoc($result)) … … 429 528 ?> 430 529 </select> 431 <span> Choisissez le groupe que vous voulez définir par défaut. C'est à dire le groupe où les utilisateurs seront placés quand ils s'inscriront. Pour des raisons de sécurité, par défaut les utilisateurs ne peuvent être mis ni dans le groupe modérateur ni dans le groupe administrateur.</span>530 <span><?php echo $lang_admin_groups['Default group help'] ?></span> 432 531 </td> 433 532 </tr> … … 439 538 </div> 440 539 441 <h2 class="block2"><span> Groupes existants</span></h2>540 <h2 class="block2"><span><?php echo $lang_admin_groups['Existing groups head'] ?></span></h2> 442 541 <div class="box"> 443 542 <div class="fakeform"> 444 543 <div class="inform"> 445 544 <fieldset> 446 <legend> Modifier/supprimer les groupes</legend>545 <legend><?php echo $lang_admin_groups['Edit groups subhead'] ?></legend> 447 546 <div class="infldset"> 448 <p> Les groupes pré-définis Invités, Administrateurs, Modérateurs et Membres ne peuvent être supprimés. Il peuvent par contre être modifiés. Mais suivant le groupe certaines options ne sont pas disponibles (<abbr title="exemple">ex.</abbr> la permission <em>modifier messages</em> pour les invités). Les Administrateurs ont toujours toutes les permisssions.</p>547 <p><?php echo $lang_admin_groups['Edit groups info'] ?></p> 449 548 <table cellspacing="0"> 450 549 <?php 451 550 452 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups ORDER BY g_id') or error('Impossible de retrouver la liste des groupes', __FILE__, __LINE__, $db->error()); 551 $cur_index = 5; 552 553 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); 453 554 454 555 while ($cur_group = $db->fetch_assoc($result)) 455 echo "\t\t\t\t\t\t\t\t".'<tr><th scope="row"><a href="admin_groups.php?edit_group='.$cur_group['g_id'].'" >Modifier</a>'.(($cur_group['g_id'] > PUN_MEMBER) ? ' - <a href="admin_groups.php?del_group='.$cur_group['g_id'].'">Supprimer</a>' : '').'</th><td>'.pun_htmlspecialchars($cur_group['g_title']).'</td></tr>'."\n";556 echo "\t\t\t\t\t\t\t\t".'<tr><th scope="row"><a href="admin_groups.php?edit_group='.$cur_group['g_id'].'" tabindex="'.$cur_index++.'">'.$lang_admin_groups['Edit link'].'</a>'.(($cur_group['g_id'] > PUN_MEMBER) ? ' | <a href="admin_groups.php?del_group='.$cur_group['g_id'].'" tabindex="'.$cur_index++.'">'.$lang_admin_groups['Delete link'].'</a>' : '').'</th><td>'.pun_htmlspecialchars($cur_group['g_title']).'</td></tr>'."\n"; 456 557 457 558 ?> -
/branches/rsr.v5.1.dev/web/punbb/admin_index.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 ************************************************************************/ 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 */ 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_MOD)17 if (!$pun_user['is_admmod']) 35 18 message($lang_common['No permission']); 36 19 20 // Load the admin_index.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_index.php'; 37 22 38 23 $action = isset($_GET['action']) ? $_GET['action'] : null; … … 42 27 { 43 28 if (!ini_get('allow_url_fopen')) 44 message( 'Impossible de vérifier les mises à jour tant que \'allow_url_fopen\' est désactivé sur ce systÚme.');29 message($lang_admin_index['fopen disabled message']); 45 30 46 $ fp = @fopen('http://www.punbb.org/latest_version', 'r');47 $latest_version = trim(@fread($fp, 16));48 @fclose($fp);31 $latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version')); 32 if (empty($latest_version)) 33 message($lang_admin_index['Upgrade check failed message']); 49 34 50 if ($latest_version == '') 51 message('La vérification de mise à jour a échouée pour une raison inconnue.'); 52 53 $cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version'])); 54 $cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version); 55 56 $latest_version = str_replace('.', '', strtolower($latest_version)); 57 $latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version); 58 59 if ($cur_version >= $latest_version) 60 message('Vous utilisez la derniÚre version de PunBB.'); 35 if (version_compare($pun_config['o_cur_version'], $latest_version, '>=')) 36 message($lang_admin_index['Running latest version message']); 61 37 else 62 message('Une nouvelle version de PunBB est sortie ! Vous pouvez télécharger cette derniÚre version sur <a href="http://www.punbb.org/">PunBB.org</a>.'); 63 } 64 65 // Check for french upgrade 66 if ($action == 'check_upgrade_fr') 67 { 68 if (!ini_get('allow_url_fopen')) 69 message('Impossible de vérifier les mises à jour tant que \'allow_url_fopen\' est désactivé sur ce systÚme.'); 70 71 $fp = @fopen('http://www.punbb.fr/latest_version', 'r'); 72 $latest_version = trim(@fread($fp, 16)); 73 @fclose($fp); 74 75 if ($latest_version == '') 76 message('La vérification de mise à jour a échouée pour une raison inconnue.'); 77 78 $cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version_fr'])); 79 $cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version); 80 81 $latest_version = str_replace('.', '', strtolower($latest_version)); 82 $latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version); 83 84 if ($cur_version >= $latest_version) 85 message('Vous utilisez la derniÚre version de PunBB en français.'); 86 else 87 message('Une nouvelle version de PunBB en français est sortie ! Vous pouvez télécharger cette derniÚre version sur <a href="http://www.punbb.fr/">PunBB.fr</a>.'); 38 message(sprintf($lang_admin_index['New version available message'], '<a href="http://fluxbb.org/">FluxBB.org</a>')); 88 39 } 89 40 … … 93 44 { 94 45 // Is phpinfo() a disabled function? 95 if (strpos(strtolower((string) @ini_get('disable_functions')), 'phpinfo') !== false)96 message( 'La fonction phpinfo() de PHP est désactivée sur ce serveur.');46 if (strpos(strtolower((string) ini_get('disable_functions')), 'phpinfo') !== false) 47 message($lang_admin_index['PHPinfo disabled message']); 97 48 98 49 phpinfo(); … … 109 60 @fclose($fh); 110 61 62 if (($fh = @fopen('/proc/loadavg', 'r'))) 63 { 64 $load_averages = fread($fh, 64); 65 fclose($fh); 66 } 67 else 68 $load_averages = ''; 69 111 70 $load_averages = @explode(' ', $load_averages); 112 $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Indisponible';71 $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : $lang_admin_index['Not available']; 113 72 } 114 else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match(' /averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', @exec('uptime'), $load_averages))73 else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('%averages?: ([0-9\.]+),?\s+([0-9\.]+),?\s+([0-9\.]+)%i', @exec('uptime'), $load_averages)) 115 74 $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3]; 116 75 else 117 $server_load = 'Indisponible';76 $server_load = $lang_admin_index['Not available']; 118 77 119 78 120 79 // Get number of current visitors 121 $result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error(' Impossible de retrouver le total d\'utilisateurs en ligne', __FILE__, __LINE__, $db->error());80 $result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error()); 122 81 $num_online = $db->result($result); 123 82 124 83 125 // Get the database system version126 switch ($db_type)84 // Collect some additional info about MySQL 85 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 127 86 { 128 case 'sqlite':129 $db_version = 'SQLite '.sqlite_libversion();130 break;131 132 default:133 $result = $db->query('SELECT VERSION()') or error('Impossible de retrouver les informations utilisateurs', __FILE__, __LINE__, $db->error());134 $db_version = $db->result($result);135 break;136 }137 138 139 // Collect some additional info about MySQL140 if ($db_type == 'mysql' || $db_type == 'mysqli')141 {142 $db_version = 'MySQL '.$db_version;143 144 87 // Calculate total db size/row count 145 $result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Impossible de retrouver le statut des tables', __FILE__, __LINE__, $db->error());88 $result = $db->query('SHOW TABLE STATUS LIKE \''.$db->prefix.'%\'') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error()); 146 89 147 90 $total_records = $total_size = 0; … … 152 95 } 153 96 154 $total_size = $total_size / 1024; 155 156 if ($total_size > 1024) 157 $total_size = round($total_size / 1024, 2).' MB'; 158 else 159 $total_size = round($total_size, 2).' KB'; 97 $total_size = file_size($total_size); 160 98 } 161 99 162 100 163 // See if MMCache or PHPA is loaded101 // Check for the existence of various PHP opcode caches/optimizers 164 102 if (function_exists('mmcache')) 165 $php_accelerator = '<a href="http:// turck-mmcache.sourceforge.net/">Turck MMCache</a>';103 $php_accelerator = '<a href="http://'.$lang_admin_index['Turck MMCache link'].'">'.$lang_admin_index['Turck MMCache'].'</a>'; 166 104 else if (isset($_PHPA)) 167 $php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>'; 105 $php_accelerator = '<a href="http://'.$lang_admin_index['ionCube PHP Accelerator link'].'">'.$lang_admin_index['ionCube PHP Accelerator'].'</a>'; 106 else if (ini_get('apc.enabled')) 107 $php_accelerator ='<a href="http://'.$lang_admin_index['Alternative PHP Cache (APC) link'].'">'.$lang_admin_index['Alternative PHP Cache (APC)'].'</a>'; 108 else if (ini_get('zend_optimizer.optimization_level')) 109 $php_accelerator = '<a href="http://'.$lang_admin_index['Zend Optimizer link'].'">'.$lang_admin_index['Zend Optimizer'].'</a>'; 110 else if (ini_get('eaccelerator.enable')) 111 $php_accelerator = '<a href="http://'.$lang_admin_index['eAccelerator link'].'">'.$lang_admin_index['eAccelerator'].'</a>'; 112 else if (ini_get('xcache.cacher')) 113 $php_accelerator = '<a href="http://'.$lang_admin_index['XCache link'].'">'.$lang_admin_index['XCache'].'</a>'; 168 114 else 169 $php_accelerator = 'N/A';115 $php_accelerator = $lang_admin_index['NA']; 170 116 171 117 172 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin'; 118 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Index']); 119 define('PUN_ACTIVE_PAGE', 'admin'); 173 120 require PUN_ROOT.'header.php'; 174 121 … … 177 124 ?> 178 125 <div class="block"> 179 <h2> Administration Forum</h2>126 <h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2> 180 127 <div id="adintro" class="box"> 181 128 <div class="inbox"> 182 <p>Bienvenue sur le panneau de contrÃŽles de PunBB. Depuis cet espace vous pouvez contrÃŽler les points essentiels de votre forum. Selon que vous êtes un administrateur ou un modérateur vous pouvez :<br /><br /> 183  - organiser les catégories et les forums.<br /> 184  - régler les principales options et préférences.<br /> 185  - contrÃŽler les permissions pour les utilisateurs et les visiteurs.<br /> 186  - voir les statistiques des IP pour les utilisateurs.<br /> 187  - bannir des utilisateurs.<br /> 188  - censurer des mots.<br /> 189  - régler les rangs des utilisateurs.<br /> 190  - élaguer les anciens messages.<br /> 191  - traiter les messages signalés. 192 </p> 129 <p><?php echo $lang_admin_index['Welcome to admin'] ?></p> 130 <ul> 131 <li><span><?php echo $lang_admin_index['Welcome 1'] ?></span></li> 132 <li><span><?php echo $lang_admin_index['Welcome 2'] ?></span></li> 133 <li><span><?php echo $lang_admin_index['Welcome 3'] ?></span></li> 134 <li><span><?php echo $lang_admin_index['Welcome 4'] ?></span></li> 135 <li><span><?php echo $lang_admin_index['Welcome 5'] ?></span></li> 136 <li><span><?php echo $lang_admin_index['Welcome 6'] ?></span></li> 137 <li><span><?php echo $lang_admin_index['Welcome 7'] ?></span></li> 138 <li><span><?php echo $lang_admin_index['Welcome 8'] ?></span></li> 139