Merge lp:~malizor/ubuntu-fr-forum/upgrade_to_1.4.5 into lp:ubuntu-fr-forum
- upgrade_to_1.4.5
- Merge into trunk
Proposed by
Nicolas Delvaux
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 128 | ||||
Proposed branch: | lp:~malizor/ubuntu-fr-forum/upgrade_to_1.4.5 | ||||
Merge into: | lp:ubuntu-fr-forum | ||||
Diff against target: |
14535 lines (+5286/-4909) 110 files modified
BDD_update.sql (+32/-0) BDD_update1.sql (+0/-115) BDD_update2.sql (+0/-95) INSTALL-ufr (+56/-0) README (+31/-93) README-ufr (+93/-0) admin_bans.php (+36/-8) admin_categories.php (+22/-23) admin_censoring.php (+27/-9) admin_forums.php (+6/-2) admin_groups.php (+5/-10) admin_index.php (+16/-16) admin_loader.php (+2/-2) admin_maintenance.php (+188/-8) admin_options.php (+72/-18) admin_permissions.php (+2/-2) admin_prune.php (+0/-217) admin_ranks.php (+3/-3) admin_reports.php (+13/-5) admin_users.php (+432/-5) common.js (+32/-0) db_update.php (+246/-107) delete.php (+8/-4) edit.php (+35/-8) extern.php (+136/-87) footer.php (+27/-65) header.php (+136/-51) help.php (+11/-10) include/cache.php (+163/-37) include/common.php (+19/-10) include/common_admin.php (+29/-15) include/dblayer/common_db.php (+1/-1) include/dblayer/mysql.php (+12/-2) include/dblayer/mysql_innodb.php (+12/-2) include/dblayer/mysqli.php (+12/-2) include/dblayer/mysqli_innodb.php (+12/-2) include/dblayer/pgsql.php (+11/-1) include/dblayer/sqlite.php (+31/-2) include/email.php (+17/-4) include/functions.php (+377/-148) include/functions.php.orig (+0/-1749) include/parser.php (+32/-60) include/parser.php.backup (+0/-969) include/search_idx.php (+17/-16) include/template/admin.tpl (+52/-79) include/template/posts.tpl (+12/-2) include/template/topics.tpl (+17/-2) index.php (+32/-8) install.php (+305/-242) lang/English/admin_bans.php (+3/-2) lang/English/admin_censoring.php (+2/-3) lang/English/admin_forums.php (+1/-0) lang/English/admin_maintenance.php (+17/-0) lang/English/admin_options.php (+14/-3) lang/English/admin_plugin_example.php (+0/-17) lang/English/admin_prune.php (+0/-23) lang/English/admin_reports.php (+7/-6) lang/English/admin_users.php (+37/-0) lang/English/common.php (+10/-6) lang/English/delete.php (+1/-1) lang/English/forum.php (+4/-1) lang/English/help.php (+1/-0) lang/English/install.php (+120/-0) lang/English/mail_templates/new_reply.tpl (+2/-2) lang/English/mail_templates/new_reply_full.tpl (+2/-2) lang/English/mail_templates/new_topic.tpl (+11/-0) lang/English/mail_templates/new_topic_full.tpl (+18/-0) lang/English/misc.php (+5/-3) lang/English/post.php (+3/-0) lang/English/profile.php (+3/-0) lang/English/search.php (+55/-39) lang/English/topic.php (+2/-1) lang/English/update.php (+77/-0) lang/Francais/admin_bans.php (+3/-2) lang/Francais/admin_censoring.php (+1/-2) lang/Francais/admin_forums.php (+2/-0) lang/Francais/admin_maintenance.php (+18/-2) lang/Francais/admin_options.php (+15/-4) lang/Francais/admin_plugin_example.php (+0/-17) lang/Francais/admin_prune.php (+0/-23) lang/Francais/admin_reports.php (+2/-1) lang/Francais/admin_users.php (+37/-0) lang/Francais/common.php (+11/-4) lang/Francais/forum.php (+4/-2) lang/Francais/help.php (+2/-1) lang/Francais/install.php (+120/-0) lang/Francais/mail_templates/new_reply.tpl (+1/-1) lang/Francais/mail_templates/new_reply_full.tpl (+1/-1) lang/Francais/mail_templates/new_topic.tpl (+11/-0) lang/Francais/mail_templates/new_topic_full.tpl (+18/-0) lang/Francais/mail_templates/rename.tpl (+12/-0) lang/Francais/misc.php (+7/-4) lang/Francais/post.php (+4/-1) lang/Francais/prof_reg.php (+4/-3) lang/Francais/profile.php (+7/-3) lang/Francais/search.php (+17/-1) lang/Francais/topic.php (+2/-1) lang/Francais/update.php (+77/-0) login.php (+40/-7) misc.php (+98/-34) moderate.php (+82/-12) plugins/AMP_Example.php (+0/-132) post.php (+152/-29) profile.php (+100/-56) register.php (+14/-8) search.php (+154/-55) search.php.orig (+872/-0) userlist.php (+2/-2) viewforum.php (+80/-26) viewtopic.php (+91/-50) |
||||
To merge this branch: | bzr merge lp:~malizor/ubuntu-fr-forum/upgrade_to_1.4.5 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nicolas Delvaux (community) | Needs Resubmitting | ||
xabilon (community) | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
Et voici la fameuse mise à jour vers fluxbb 1.4.5 !
- Application du diff u-fr sur un 1.4.5 de base par moi même
- MaJ des traductions par xabilon
- "search.php" (&co) optimisé par YoBoY
Pour mettre à jour la BDD, lancez le script "BDD_update.sql" ou encore "db_update.php".
Bonus :
- Ajout d'un tutoriel d'installation pour les contributeurs ("INSTALL-ufr")
- Correction de plusieurs bugs dans le template admin en remplaçant son contenu par un copier/coller de main.tpl (à une id prêt). (sic)
To post a comment you must log in.
- 135. By Nicolas Delvaux
-
Correction de l'affichage "aucun résultat" en bas du formulaire de recherche.
Revision history for this message

Nicolas Delvaux (malizor) wrote : | # |
Corrigé.
review:
Needs Resubmitting
Revision history for this message

YoBoY (yoboy-leguesh) wrote : | # |
c'est pas un bug de sa branche ça c'est aussi comme ça en prod ^^"
Revision history for this message

xabilon (xabilon) wrote : | # |
C'est pas faux :)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'BDD_update.sql' |
2 | --- BDD_update.sql 1970-01-01 00:00:00 +0000 |
3 | +++ BDD_update.sql 2011-04-21 10:05:56 +0000 |
4 | @@ -0,0 +1,32 @@ |
5 | +-- Requêtes pour transformer une BDD de fluxbb 1.4.2 en 1.4.5 |
6 | + |
7 | +CREATE TABLE `forum_topic_subscriptions` SELECT * FROM `forum_subscriptions`; |
8 | + |
9 | +CREATE TABLE IF NOT EXISTS `forum_forum_subscriptions` ( |
10 | + `user_id` int(10) unsigned NOT NULL DEFAULT '0', |
11 | + `forum_id` int(10) unsigned NOT NULL DEFAULT '0', |
12 | + PRIMARY KEY (`user_id`,`forum_id`) |
13 | +) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
14 | + |
15 | +-- MaJ des numéros de version : |
16 | + |
17 | +UPDATE forum_config SET conf_value = '1.4.5' WHERE conf_name = 'o_cur_version'; |
18 | +UPDATE forum_config SET conf_value = '11' WHERE conf_name = 'o_database_revision'; |
19 | +UPDATE forum_config SET conf_value = '2' WHERE conf_name = 'o_searchindex_revision'; |
20 | +UPDATE forum_config SET conf_value = '2' WHERE conf_name = 'o_parser_revision'; |
21 | + |
22 | +INSERT INTO forum_config VALUES ('o_forum_subscriptions', '0'); |
23 | +INSERT INTO forum_config VALUES ('o_topic_subscriptions', '1'); |
24 | + |
25 | +-- C'est tout :-) |
26 | +COMMIT; |
27 | + |
28 | +-- N'oubliez pas de vider le cache de fluxbb ! |
29 | + |
30 | + |
31 | + |
32 | +-- Si la migration s'est bien passée, vous pouvez nettoyer via les requêtes suivantes : |
33 | + |
34 | +-- DROP TABLE `forum_subscriptions`; |
35 | +-- DELETE FROM `forum_config` WHERE `conf_name` = 'o_subscriptions'; |
36 | +-- COMMIT; |
37 | |
38 | === removed file 'BDD_update1.sql' |
39 | --- BDD_update1.sql 2010-10-08 13:18:35 +0000 |
40 | +++ BDD_update1.sql 1970-01-01 00:00:00 +0000 |
41 | @@ -1,115 +0,0 @@ |
42 | -USE ubuntu_fr; |
43 | - |
44 | --- Requêtes données par le script db_update.php |
45 | - |
46 | -ALTER TABLE forum_users ADD dst TINYINT(1) NOT NULL DEFAULT 0 AFTER timezone; |
47 | -ALTER TABLE forum_online ADD last_post INT(10) UNSIGNED; |
48 | -ALTER TABLE forum_online ADD last_search INT(10) UNSIGNED; |
49 | -ALTER TABLE forum_users ADD last_search INT(10) UNSIGNED AFTER last_post; |
50 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_database_revision', '0'); |
51 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_searchindex_revision', '0'); |
52 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_parser_revision', '0'); |
53 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_default_email_setting', '1'); |
54 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_topic_views', '0'); |
55 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_signatures', '1'); |
56 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_smtp_ssl', '0'); |
57 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_default_dst', '0'); |
58 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_quote_depth', '3'); |
59 | -INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_feed_type', '2'); |
60 | -UPDATE forum_config SET conf_name = 'o_default_timezone' WHERE conf_name = 'o_server_timezone'; |
61 | - |
62 | -UPDATE forum_config SET conf_value = '8' WHERE conf_name = 'o_database_revision'; |
63 | -UPDATE forum_config SET conf_value = '1' WHERE conf_name = 'o_searchindex_revision'; |
64 | -UPDATE forum_config SET conf_value = '1' WHERE conf_name = 'o_parser_revision'; |
65 | -UPDATE forum_config SET conf_value = '1.4.2' WHERE conf_name = 'o_cur_version'; |
66 | - |
67 | -ALTER TABLE forum_groups ADD g_moderator TINYINT(1) NOT NULL DEFAULT 0 AFTER g_user_title; |
68 | -UPDATE forum_groups SET g_moderator = 1 WHERE g_id = 2; |
69 | - |
70 | -DELETE FROM forum_config WHERE conf_name = 'p_mod_edit_users'; |
71 | -ALTER TABLE forum_groups ADD g_mod_edit_users TINYINT(1) NOT NULL DEFAULT 0 AFTER g_moderator; |
72 | - |
73 | -DELETE FROM forum_config WHERE conf_name = 'p_mod_rename_users'; |
74 | -ALTER TABLE forum_groups ADD g_mod_rename_users TINYINT(1) NOT NULL DEFAULT 0 AFTER g_mod_edit_users; |
75 | - |
76 | -DELETE FROM forum_config WHERE conf_name = 'p_mod_change_passwords'; |
77 | -ALTER TABLE forum_groups ADD g_mod_change_passwords TINYINT(1) NOT NULL DEFAULT 0 AFTER g_mod_rename_users; |
78 | - |
79 | -DELETE FROM forum_config WHERE conf_name = 'p_mod_ban_users'; |
80 | -ALTER TABLE forum_groups ADD g_mod_ban_users TINYINT(1) NOT NULL DEFAULT 0 AFTER g_mod_change_passwords; |
81 | - |
82 | -TRUNCATE TABLE forum_online; |
83 | -ALTER TABLE forum_online ADD UNIQUE INDEX forum_online_user_id_ident_idx (user_id,ident); |
84 | -ALTER TABLE forum_online ADD INDEX forum_online_ident_idx (ident); |
85 | -ALTER TABLE forum_online ADD INDEX forum_online_logged_idx (logged); |
86 | - |
87 | -ALTER TABLE forum_topics ADD INDEX forum_topics_last_post_idx (last_post); |
88 | -ALTER TABLE forum_bans ADD INDEX forum_bans_username_idx (username); |
89 | -ALTER TABLE forum_users ADD UNIQUE INDEX forum_users_username_idx (username); |
90 | - |
91 | -ALTER TABLE forum_groups ADD g_view_users TINYINT(1) NOT NULL DEFAULT 1 AFTER g_read_board; |
92 | -ALTER TABLE forum_users ADD last_email_sent INT(10) UNSIGNED AFTER last_search; |
93 | -ALTER TABLE forum_groups ADD g_send_email TINYINT(1) NOT NULL DEFAULT 1 AFTER g_search_users; |
94 | -ALTER TABLE forum_groups ADD g_email_flood SMALLINT(6) NOT NULL DEFAULT 60 AFTER g_search_flood; |
95 | -UPDATE forum_groups SET g_send_email = 0 WHERE g_id = 3; |
96 | -UPDATE forum_groups SET g_email_flood = 0 WHERE g_id IN (1,2,3); |
97 | -ALTER TABLE forum_users ADD auto_notify TINYINT(1) NOT NULL DEFAULT 0 AFTER notify_with_post; |
98 | - |
99 | --- Suppression des sujets incohérents |
100 | - |
101 | -DELETE FROM forum_topics WHERE last_poster IS NULL; |
102 | -DELETE FROM forum_topics WHERE last_post_id = 0; |
103 | - |
104 | --- Ajout et remplissage du champ first_post_id |
105 | - |
106 | -ALTER TABLE forum_topics ADD first_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER posted; |
107 | -ALTER TABLE forum_topics ADD INDEX forum_topics_first_post_id_idx (first_post_id); |
108 | -UPDATE forum_topics INNER JOIN (SELECT MIN(id) AS first_post, topic_id FROM forum_posts GROUP BY topic_id) AS tmp ON forum_topics.id = tmp.topic_id SET first_post_id = first_post; |
109 | - |
110 | - |
111 | -ALTER TABLE forum_bans ADD ban_creator INT(10) UNSIGNED NOT NULL DEFAULT 0; |
112 | -ALTER TABLE forum_users ADD time_format TINYINT(1) NOT NULL DEFAULT 0 AFTER dst; |
113 | -ALTER TABLE forum_users ADD date_format TINYINT(1) NOT NULL DEFAULT 0 AFTER time_format; |
114 | - |
115 | - |
116 | --- Requêtes complémentaires |
117 | - |
118 | --- Suppression de champs obsolètes |
119 | - |
120 | -ALTER TABLE forum_forums DROP parent_forum_id; |
121 | -ALTER TABLE forum_users DROP use_avatar; |
122 | -ALTER TABLE forum_users DROP save_pass; |
123 | -ALTER TABLE forum_groups DROP g_post_polls; |
124 | -ALTER TABLE forum_groups DROP g_edit_subjects_interval; |
125 | - |
126 | - |
127 | --- Suppression des users non vérifiés antérieurs au 15 septembre 2010 |
128 | - |
129 | -DELETE FROM forum_users WHERE group_id = 32000 AND registered < 1284501600; |
130 | -OPTIMIZE TABLE forum_users; |
131 | - |
132 | --- Passage des users non-vérifiés restants en groupe 0 |
133 | - |
134 | -UPDATE forum_users SET group_id = 0 WHERE group_id = 32000; |
135 | - |
136 | --- Changement des champs de mail à varchar(80) |
137 | - |
138 | -ALTER TABLE forum_bans CHANGE email email VARCHAR(80); |
139 | -ALTER TABLE forum_posts CHANGE poster_email poster_email VARCHAR(80); |
140 | -ALTER TABLE forum_users CHANGE email email VARCHAR(80); |
141 | -ALTER TABLE forum_users CHANGE msn msn VARCHAR(80); |
142 | - |
143 | --- Changement des champs d'IP à varchar(39) --> IPv6 |
144 | - |
145 | -ALTER TABLE forum_posts CHANGE poster_ip poster_ip VARCHAR(39); |
146 | -ALTER TABLE forum_users CHANGE registration_ip registration_ip VARCHAR(39); |
147 | - |
148 | - |
149 | --- Changement du champ de recherche à mediumtext |
150 | - |
151 | -ALTER TABLE forum_search_cache CHANGE search_data search_data MEDIUMTEXT; |
152 | - |
153 | - |
154 | --- Changement du champ message à mediumtext |
155 | - |
156 | -ALTER TABLE forum_posts CHANGE message message MEDIUMTEXT; |
157 | |
158 | === removed file 'BDD_update2.sql' |
159 | --- BDD_update2.sql 2011-02-12 23:04:19 +0000 |
160 | +++ BDD_update2.sql 1970-01-01 00:00:00 +0000 |
161 | @@ -1,95 +0,0 @@ |
162 | -USE ubuntu_devforum; |
163 | - |
164 | --- phpMyAdmin SQL Dump |
165 | --- version 3.3.2deb1 |
166 | --- http://www.phpmyadmin.net |
167 | --- |
168 | --- Serveur: localhost |
169 | --- Généré le : Ven 08 Octobre 2010 à 15:00 |
170 | --- Version du serveur: 5.1.41 |
171 | --- Version de PHP: 5.3.2-1ubuntu4.5ppa5~lucid1 |
172 | - |
173 | -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
174 | - |
175 | - |
176 | -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
177 | -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
178 | -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
179 | -/*!40101 SET NAMES utf8 */; |
180 | - |
181 | --- |
182 | --- Base de données: `ubuntu_devforum` |
183 | --- |
184 | - |
185 | --- -------------------------------------------------------- |
186 | - |
187 | --- |
188 | --- Structure de la table `forum_toolbar_conf` |
189 | --- |
190 | - |
191 | -CREATE TABLE IF NOT EXISTS `forum_toolbar_conf` ( |
192 | - `conf_name` varchar(40) NOT NULL DEFAULT '', |
193 | - `conf_value` varchar(40) NOT NULL DEFAULT '', |
194 | - PRIMARY KEY (`conf_name`) |
195 | -) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
196 | - |
197 | --- |
198 | --- Contenu de la table `forum_toolbar_conf` |
199 | --- |
200 | - |
201 | -INSERT INTO `forum_toolbar_conf` (`conf_name`, `conf_value`) VALUES |
202 | -('enable_form', '1'), |
203 | -('enable_quickform', '1'), |
204 | -('img_pack', 'smooth'), |
205 | -('nb_smilies', '12'), |
206 | -('pop_up_width', '240'), |
207 | -('pop_up_height', '200'), |
208 | -('button_size', '4096'), |
209 | -('button_width', '32'), |
210 | -('button_height', '32'); |
211 | - |
212 | --- -------------------------------------------------------- |
213 | - |
214 | --- |
215 | --- Structure de la table `forum_toolbar_tags` |
216 | --- |
217 | - |
218 | -CREATE TABLE IF NOT EXISTS `forum_toolbar_tags` ( |
219 | - `name` varchar(20) NOT NULL DEFAULT '', |
220 | - `code` varchar(20) NOT NULL DEFAULT '', |
221 | - `enable_form` tinyint(1) NOT NULL DEFAULT '0', |
222 | - `enable_quick` tinyint(1) NOT NULL DEFAULT '0', |
223 | - `image` varchar(40) NOT NULL DEFAULT '', |
224 | - `func` tinyint(1) NOT NULL DEFAULT '0', |
225 | - `position` tinyint(2) unsigned NOT NULL DEFAULT '1', |
226 | - PRIMARY KEY (`name`) |
227 | -) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
228 | - |
229 | --- |
230 | --- Contenu de la table `forum_toolbar_tags` |
231 | --- |
232 | - |
233 | -INSERT INTO `forum_toolbar_tags` (`name`, `code`, `enable_form`, `enable_quick`, `image`, `func`, `position`) VALUES |
234 | -('smilies', '', 1, 1, 'bt_smilies.png', 0, 0), |
235 | -('bold', 'b', 1, 1, 'bt_bold.png', 0, 1), |
236 | -('italic', 'i', 1, 1, 'bt_italic.png', 0, 2), |
237 | -('underline', 'u', 1, 1, 'bt_underline.png', 0, 3), |
238 | -('strike', 's', 1, 0, 'bt_strike.png', 0, 4), |
239 | -('sup', 'sup', 1, 0, 'bt_sup.png', 0, 5), |
240 | -('sub', 'sub', 1, 0, 'bt_sub.png', 0, 6), |
241 | -('heading', 'h', 0, 0, 'bt_size_plus.png', 0, 7), |
242 | -('left', 'left', 1, 0, 'bt_align_left.png', 0, 8), |
243 | -('right', 'right', 1, 0, 'bt_align_right.png', 0, 9), |
244 | -('center', 'center', 1, 0, 'bt_align_center.png', 0, 10), |
245 | -('justify', 'justify', 1, 0, 'bt_align_justify.png', 0, 11), |
246 | -('color', 'color', 0, 0, 'bt_color.png', 0, 12), |
247 | -('q', 'q', 1, 0, 'bt_quote.png', 0, 13), |
248 | -('acronym', 'acronym', 1, 0, 'bt_acronym.png', 1, 14), |
249 | -('img', 'img', 1, 1, 'bt_img.png', 2, 15), |
250 | -('code', 'code', 1, 1, 'bt_pre.png', 0, 16), |
251 | -('quote', 'quote', 1, 1, 'bt_bquote.png', 1, 17), |
252 | -('link', 'url', 1, 1, 'bt_link.png', 2, 18), |
253 | -('email', 'email', 0, 0, 'bt_email.png', 2, 19), |
254 | -('video', 'video', 1, 1, 'bt_video.png', 3, 20), |
255 | -('li', '*', 1, 0, 'bt_li.png', 0, 21), |
256 | -('list', 'list', 1, 0, 'bt_ul.png', 1, 22); |
257 | |
258 | === added file 'INSTALL-ufr' |
259 | --- INSTALL-ufr 1970-01-01 00:00:00 +0000 |
260 | +++ INSTALL-ufr 2011-04-21 10:05:56 +0000 |
261 | @@ -0,0 +1,56 @@ |
262 | +Comment installer le forum ubuntu-fr en local : |
263 | + |
264 | +- créez une BDD |
265 | +- créez les trois tables suivantes : |
266 | + |
267 | +CREATE TABLE IF NOT EXISTS `forum_annonces` ( |
268 | + `forum_id` int(11) NOT NULL default '0', |
269 | + `forum_annonce` text, |
270 | + `forum_annonce_visible` tinyint(1) NOT NULL default '0', |
271 | + PRIMARY KEY (`forum_id`) |
272 | +) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
273 | + |
274 | +CREATE TABLE IF NOT EXISTS `forum_toolbar_tags` ( |
275 | + `name` varchar(20) NOT NULL, |
276 | + `code` varchar(20) NOT NULL, |
277 | + `enable_form` tinyint(1) NOT NULL default '0', |
278 | + `enable_quick` tinyint(1) NOT NULL default '0', |
279 | + `image` varchar(40) NOT NULL, |
280 | + `func` tinyint(1) NOT NULL default '0', |
281 | + `position` tinyint(2) UNSIGNED NOT NULL default '1', |
282 | + PRIMARY KEY (`name`) |
283 | +) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
284 | + |
285 | +CREATE TABLE IF NOT EXISTS `forum_toolbar_conf` ( |
286 | + `conf_name` varchar(40) NOT NULL, |
287 | + `conf_value` varchar(40) NOT NULL, |
288 | + PRIMARY KEY (`conf_name`) |
289 | +) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
290 | + |
291 | +- Copiez les fichiers du forum dans le dossier "/var/www" (par exemple dans un sous dossier "forum") |
292 | +- Rendez vous sur la page d'installation (par exemple http://localhost/forum/install.php) |
293 | +- Renseignez tous les champs et choisissez "forum_" comme préfixe de la BDD |
294 | +- Une fois l'installation finie, vous devrez modifier la table "forum_forums" de la manière suivante: |
295 | + |
296 | +ALTER TABLE forum_forums ADD `forum_type` int(1) NOT NULL; |
297 | + |
298 | + |
299 | +Le forum est maintenant fonctionnel !!! |
300 | +...mais le CSS n'est pas encore en place. |
301 | + |
302 | + |
303 | +Ces ressources sont hébergées séparément, car elles sont communes aux divers sites de ubuntu-fr. |
304 | +Vous devez télécharger le projet STATIC: |
305 | + bzr branch lp:ubuntu-fr-static |
306 | + |
307 | +- Placez le contenu de ce dossier dans, par exemple, "/var/www/STATIC" |
308 | +- Éditez le fichier "config.php" du forum et ajoutez y "define('UFR_STATIC', 'CHEMIN_VERS_STATIC/theme2010/');" |
309 | +Si vous avez suivi l'exemple, il faudra mettre "define('UFR_STATIC', '../STATIC/theme2010/');" |
310 | + |
311 | +Et voila, amusez vous bien ! :-) |
312 | + |
313 | +Astuces : Pour mettre le forum en mode "debug" (affichage de toutes les requêtes SQL en bas de page), |
314 | +éditez le fichier "config.php" et ajoutez y les deux lignes suivantes : |
315 | +define('PUN_DEBUG', 1); |
316 | +define('PUN_SHOW_QUERIES', 1); |
317 | + |
318 | |
319 | === modified file 'README' |
320 | --- README 2011-04-13 15:16:19 +0000 |
321 | +++ README 2011-04-21 10:05:56 +0000 |
322 | @@ -1,93 +1,31 @@ |
323 | -Les fichiers modifiés par rapport à FluxBB : |
324 | -include/templates/main.tpl |
325 | - |
326 | -Fil d'ariane |
327 | - viewtopic.php l361 (pour la rc) l371 pour 1.4 |
328 | - viewforum.php l48 |
329 | - index.php |
330 | -Stats |
331 | - index.php l249 |
332 | - FIXME : il y a peut être une façon plus élégante de le faire |
333 | -Redirection: |
334 | - functions.php l1288 |
335 | - |
336 | - |
337 | -FLUXBB 1.4.0 : |
338 | - |
339 | -Liens de recherche (searchlinks) ajoutés dans header.php |
340 | -pun_searchlinks est appelé depuis main.tpl |
341 | -J'ai pris la même classe que pour les liens de navigation "navlinks" (à différencier si ça pose problème au CSS) |
342 | - |
343 | - |
344 | -Mise en forme des pages admins : |
345 | -- inclusion des feuilles de style site_css.php dans admin.tpl |
346 | -En fait il faudrait refaire entièrement admin.tpl pour le faire correspondre à main.tpl |
347 | -(bonjour les mises à jour de FluxBB ...) |
348 | - -> ça c'est bon, je viens de le faire |
349 | - |
350 | - |
351 | -Différentiation de la recherche rapide et du formulaire de recherche : |
352 | -id="search" changé en id="searchform" |
353 | -search.php ligne 662 |
354 | - |
355 | -Ajout d'une classe pour l'ip de connexion: |
356 | -viewtopic.php l286 |
357 | - |
358 | - |
359 | -Décochage par défaut de la case "créer un lien" pour les déplacements de topic |
360 | -moderate.php l483 |
361 | -Ligne avant modif : |
362 | -<label><input type="checkbox" name="with_redirect" value="0"<?php if ($action == 'single') echo ' checked="checked"' ?> /><?php echo $lang_misc['Leave redirect'] ?><br /></label> |
363 | - |
364 | - |
365 | -Affichage des annonces des forums (div "announce-forum") |
366 | -viewforum.php L92 à L113 |
367 | - |
368 | - |
369 | -Mod affichage de l'accueil + gagnant du mois : |
370 | -Voir plugins/AP_Reception.php + lang/Francais/reception.php + index.php (L58 à L79) |
371 | -Les chaines correspondantes sont stockées dans deux nouvelles clefs de la table config: c_welcome_message et c_winner_message. |
372 | -Pas de modification de la structure de la base. Les clefs se créent automatiquement, rien de spécial à faire. |
373 | - |
374 | - |
375 | -Affichage de usertitle uniquement pour admins et modos. |
376 | -viewtopic.php l360 : |
377 | -<?php if ($pun_user['g_id'] <= 2) echo ' <dd class="usertitle"><strong>'.$user_title.'</strong></dd>'; ?> |
378 | -Ligne originale : |
379 | -<dd class="usertitle"><strong><?php echo $user_title ?></strong></dd> |
380 | - |
381 | - |
382 | -Ne pas chercher les "messages récents" et "sans réponses" dans les sections Divers: |
383 | -Ajout des conditions AND t.forum_id!=7 AND t.forum_id!=43 AND t.forum_id!=8 |
384 | -dans search.php L296 305 et 335 |
385 | - |
386 | -Limiter les résultats à 200 topics : |
387 | -Ajout d'un LIMIT 200 dans search.php L296 305 et 335 |
388 | - |
389 | - |
390 | -Bouton pour cacher le menu navigation |
391 | -include/main.tpl : L81 ajout d'un div#hidemenu avec lien vers le javascript |
392 | -header.php : L158 à 171 inclusion de common.js, menu.js, cookie menu_hidden, et modif du CSS en fonction |
393 | - |
394 | - |
395 | -Désactivation du formulaire de recherche |
396 | -search PHP L662 : changement de search.php en index.php (renvoi vers l'accueil) |
397 | - |
398 | -On enlève "Recherche" du menu navigation |
399 | -/include/functions.php : on commente les lignes 446 et 453 |
400 | - |
401 | - |
402 | -10/10/2010 XABILON |
403 | -modifs forum : index.php, style/ubuntu-light.css |
404 | -modifs static: forum-ubuntu.css, forum-kubuntu.css, forum-general.css |
405 | - |
406 | -12/10/2010 XABILON |
407 | -Supression du "Marquer tous vos messages comme lus" et "Nouveaux messages" (déplacé plus bas) dans header.php. À intégrer dans les liens de navigation. |
408 | -(attention, 2 messages et actions différents selon qu'on est sur index.php ou viewforum.php, voir code commenté dans le header L314) |
409 | -ET ATTENTION AUX LIENS VERS LES CSS ET LE META POUR GOOGLE |
410 | -Ajout de "Marquer tous vos messages comme lus" dans include/functions.php |
411 | -Traductions dans lang/Francais/common.php |
412 | -search.php (augmentation de la limite des 200) |
413 | -parser.php (balise apt) |
414 | -divers dans style/ |
415 | -viewtopic.php (lien vers haut de page) |
416 | + ===================== |
417 | + FluxBB 1.4 Readme |
418 | + ===================== |
419 | + |
420 | + About |
421 | + ---------------- |
422 | +FluxBB is an open source forum application released under the GNU General Public |
423 | +Licence. It is free to download and use and will remain so. FluxBB was conceived and |
424 | +designed to be fast and light with less of the "not so essential" features that some |
425 | +of the other forums have whilst not sacrificing essential functionality or usability. |
426 | + |
427 | + Requirements |
428 | + ---------------- |
429 | + - A webserver |
430 | + - PHP 4.4.0 or later |
431 | + - A database such as MySQL 4.1.2 or later, PostgreSQL 7.0 or later, or SQLite 2 |
432 | + |
433 | + Recommendations |
434 | + ------------------- |
435 | + - Make use of a PHP accelerator such as APC or XCache |
436 | + - Make sure PHP has the zlib module installed to allow FluxBB to gzip output |
437 | + |
438 | + Links |
439 | + --------- |
440 | + |
441 | + - Homepage: http://fluxbb.org |
442 | + - Documentation: http://fluxbb.org/docs/ |
443 | + - Community: http://fluxbb.org/forums/ |
444 | + - Resources: http://fluxbb.org/resources/ |
445 | + - IRC: irc://irc.freenode.net/fluxbb |
446 | + - Development: http://github.com/fluxbb/fluxbb |
447 | |
448 | === added file 'README-ufr' |
449 | --- README-ufr 1970-01-01 00:00:00 +0000 |
450 | +++ README-ufr 2011-04-21 10:05:56 +0000 |
451 | @@ -0,0 +1,93 @@ |
452 | +Les fichiers modifiés par rapport à FluxBB : |
453 | +include/templates/main.tpl |
454 | + |
455 | +Fil d'ariane |
456 | + viewtopic.php l361 (pour la rc) l371 pour 1.4 |
457 | + viewforum.php l48 |
458 | + index.php |
459 | +Stats |
460 | + index.php l249 |
461 | + FIXME : il y a peut être une façon plus élégante de le faire |
462 | +Redirection: |
463 | + functions.php l1288 |
464 | + |
465 | + |
466 | +FLUXBB 1.4.0 : |
467 | + |
468 | +Liens de recherche (searchlinks) ajoutés dans header.php |
469 | +pun_searchlinks est appelé depuis main.tpl |
470 | +J'ai pris la même classe que pour les liens de navigation "navlinks" (à différencier si ça pose problème au CSS) |
471 | + |
472 | + |
473 | +Mise en forme des pages admins : |
474 | +- inclusion des feuilles de style site_css.php dans admin.tpl |
475 | +En fait il faudrait refaire entièrement admin.tpl pour le faire correspondre à main.tpl |
476 | +(bonjour les mises à jour de FluxBB ...) |
477 | + -> ça c'est bon, je viens de le faire |
478 | + |
479 | + |
480 | +Différentiation de la recherche rapide et du formulaire de recherche : |
481 | +id="search" changé en id="searchform" |
482 | +search.php ligne 662 |
483 | + |
484 | +Ajout d'une classe pour l'ip de connexion: |
485 | +viewtopic.php l286 |
486 | + |
487 | + |
488 | +Décochage par défaut de la case "créer un lien" pour les déplacements de topic |
489 | +moderate.php l483 |
490 | +Ligne avant modif : |
491 | +<label><input type="checkbox" name="with_redirect" value="0"<?php if ($action == 'single') echo ' checked="checked"' ?> /><?php echo $lang_misc['Leave redirect'] ?><br /></label> |
492 | + |
493 | + |
494 | +Affichage des annonces des forums (div "announce-forum") |
495 | +viewforum.php L92 à L113 |
496 | + |
497 | + |
498 | +Mod affichage de l'accueil + gagnant du mois : |
499 | +Voir plugins/AP_Reception.php + lang/Francais/reception.php + index.php (L58 à L79) |
500 | +Les chaines correspondantes sont stockées dans deux nouvelles clefs de la table config: c_welcome_message et c_winner_message. |
501 | +Pas de modification de la structure de la base. Les clefs se créent automatiquement, rien de spécial à faire. |
502 | + |
503 | + |
504 | +Affichage de usertitle uniquement pour admins et modos. |
505 | +viewtopic.php l360 : |
506 | +<?php if ($pun_user['g_id'] <= 2) echo ' <dd class="usertitle"><strong>'.$user_title.'</strong></dd>'; ?> |
507 | +Ligne originale : |
508 | +<dd class="usertitle"><strong><?php echo $user_title ?></strong></dd> |
509 | + |
510 | + |
511 | +Ne pas chercher les "messages récents" et "sans réponses" dans les sections Divers: |
512 | +Ajout des conditions AND t.forum_id!=7 AND t.forum_id!=43 AND t.forum_id!=8 |
513 | +dans search.php L296 305 et 335 |
514 | + |
515 | +Limiter les résultats à 200 topics : |
516 | +Ajout d'un LIMIT 200 dans search.php L296 305 et 335 |
517 | + |
518 | + |
519 | +Bouton pour cacher le menu navigation |
520 | +include/main.tpl : L81 ajout d'un div#hidemenu avec lien vers le javascript |
521 | +header.php : L158 à 171 inclusion de common.js, menu.js, cookie menu_hidden, et modif du CSS en fonction |
522 | + |
523 | + |
524 | +Désactivation du formulaire de recherche |
525 | +search PHP L662 : changement de search.php en index.php (renvoi vers l'accueil) |
526 | + |
527 | +On enlève "Recherche" du menu navigation |
528 | +/include/functions.php : on commente les lignes 446 et 453 |
529 | + |
530 | + |
531 | +10/10/2010 XABILON |
532 | +modifs forum : index.php, style/ubuntu-light.css |
533 | +modifs static: forum-ubuntu.css, forum-kubuntu.css, forum-general.css |
534 | + |
535 | +12/10/2010 XABILON |
536 | +Supression du "Marquer tous vos messages comme lus" et "Nouveaux messages" (déplacé plus bas) dans header.php. À intégrer dans les liens de navigation. |
537 | +(attention, 2 messages et actions différents selon qu'on est sur index.php ou viewforum.php, voir code commenté dans le header L314) |
538 | +ET ATTENTION AUX LIENS VERS LES CSS ET LE META POUR GOOGLE |
539 | +Ajout de "Marquer tous vos messages comme lus" dans include/functions.php |
540 | +Traductions dans lang/Francais/common.php |
541 | +search.php (augmentation de la limite des 200) |
542 | +parser.php (balise apt) |
543 | +divers dans style/ |
544 | +viewtopic.php (lien vers haut de page) |
545 | |
546 | === modified file 'admin_bans.php' |
547 | --- admin_bans.php 2010-10-08 13:18:35 +0000 |
548 | +++ admin_bans.php 2011-04-21 10:05:56 +0000 |
549 | @@ -1,7 +1,7 @@ |
550 | <?php |
551 | |
552 | /** |
553 | - * Copyright (C) 2008-2010 FluxBB |
554 | + * Copyright (C) 2008-2011 FluxBB |
555 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
556 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
557 | */ |
558 | @@ -9,7 +9,7 @@ |
559 | // Tell header.php to use the admin template |
560 | define('PUN_ADMIN_CONSOLE', 1); |
561 | |
562 | -define('PUN_ROOT', './'); |
563 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
564 | require PUN_ROOT.'include/common.php'; |
565 | require PUN_ROOT.'include/common_admin.php'; |
566 | |
567 | @@ -52,9 +52,18 @@ |
568 | } |
569 | } |
570 | |
571 | - // Make sure we're not banning an admin |
572 | - if (isset($group_id) && $group_id == PUN_ADMIN) |
573 | - message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); |
574 | + // Make sure we're not banning an admin or moderator |
575 | + if (isset($group_id)) |
576 | + { |
577 | + if ($group_id == PUN_ADMIN) |
578 | + message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); |
579 | + |
580 | + $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()); |
581 | + $is_moderator_group = $db->result($result); |
582 | + |
583 | + if ($is_moderator_group) |
584 | + message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); |
585 | + } |
586 | |
587 | // If we have a $user_id, we can try to find the last known IP of that user |
588 | if (isset($user_id)) |
589 | @@ -183,6 +192,25 @@ |
590 | message($lang_admin_bans['Must enter message']); |
591 | else if (strtolower($ban_user) == 'guest') |
592 | message($lang_admin_bans['Cannot ban guest message']); |
593 | + |
594 | + // Make sure we're not banning an admin or moderator |
595 | + if (!empty($ban_user)) |
596 | + { |
597 | + $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()); |
598 | + if ($db->num_rows($result)) |
599 | + { |
600 | + $group_id = $db->result($result); |
601 | + |
602 | + if ($group_id == PUN_ADMIN) |
603 | + message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); |
604 | + |
605 | + $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()); |
606 | + $is_moderator_group = $db->result($result); |
607 | + |
608 | + if ($is_moderator_group) |
609 | + message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); |
610 | + } |
611 | + } |
612 | |
613 | // Validate IP/IP range (it's overkill, I know) |
614 | if ($ban_ip != '') |
615 | @@ -304,7 +332,7 @@ |
616 | |
617 | $expire_after = isset($_GET['expire_after']) ? trim($_GET['expire_after']) : ''; |
618 | $expire_before = isset($_GET['expire_before']) ? trim($_GET['expire_before']) : ''; |
619 | - $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? $_GET['order_by'] : 'username'; |
620 | + $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? 'b.'.$_GET['order_by'] : 'b.username'; |
621 | $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
622 | |
623 | $query_str[] = 'order_by='.$order_by; |
624 | @@ -319,7 +347,7 @@ |
625 | if ($expire_after === false || $expire_after == -1) |
626 | message($lang_admin_bans['Invalid date message']); |
627 | |
628 | - $conditions[] = 'expire>'.$expire_after; |
629 | + $conditions[] = 'b.expire>'.$expire_after; |
630 | } |
631 | if ($expire_before != '') |
632 | { |
633 | @@ -329,7 +357,7 @@ |
634 | if ($expire_before === false || $expire_before == -1) |
635 | message($lang_admin_bans['Invalid date message']); |
636 | |
637 | - $conditions[] = 'expire<'.$expire_before; |
638 | + $conditions[] = 'b.expire<'.$expire_before; |
639 | } |
640 | |
641 | $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; |
642 | |
643 | === modified file 'admin_categories.php' |
644 | --- admin_categories.php 2010-10-08 13:18:35 +0000 |
645 | +++ admin_categories.php 2011-04-21 10:05:56 +0000 |
646 | @@ -1,7 +1,7 @@ |
647 | <?php |
648 | |
649 | /** |
650 | - * Copyright (C) 2008-2010 FluxBB |
651 | + * Copyright (C) 2008-2011 FluxBB |
652 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
653 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
654 | */ |
655 | @@ -9,7 +9,7 @@ |
656 | // Tell header.php to use the admin template |
657 | define('PUN_ADMIN_CONSOLE', 1); |
658 | |
659 | -define('PUN_ROOT', './'); |
660 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
661 | require PUN_ROOT.'include/common.php'; |
662 | require PUN_ROOT.'include/common_admin.php'; |
663 | |
664 | @@ -126,23 +126,22 @@ |
665 | { |
666 | confirm_referrer('admin_categories.php'); |
667 | |
668 | - $cat_order = array_map('trim', $_POST['cat_order']); |
669 | - $cat_name = array_map('pun_trim', $_POST['cat_name']); |
670 | - |
671 | - $result = $db->query('SELECT id, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error()); |
672 | - $num_cats = $db->num_rows($result); |
673 | - |
674 | - for ($i = 0; $i < $num_cats; ++$i) |
675 | + $categories = $_POST['cat']; |
676 | + if (empty($categories)) |
677 | + message($lang_common['Bad request']); |
678 | + |
679 | + foreach ($categories as $cat_id => $cur_cat) |
680 | { |
681 | - if ($cat_name[$i] == '') |
682 | + $cur_cat['name'] = pun_trim($cur_cat['name']); |
683 | + $cur_cat['order'] = trim($cur_cat['order']); |
684 | + |
685 | + if ($cur_cat['name'] == '') |
686 | message($lang_admin_categories['Must enter name message']); |
687 | |
688 | - if ($cat_order[$i] == '' || preg_match('/[^0-9]/', $cat_order[$i])) |
689 | + if ($cur_cat['order'] == '' || preg_match('/[^0-9]/', $cur_cat['order'])) |
690 | message($lang_admin_categories['Must enter integer message']); |
691 | |
692 | - list($cat_id, $position) = $db->fetch_row($result); |
693 | - |
694 | - $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('Unable to update category', __FILE__, __LINE__, $db->error()); |
695 | + $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()); |
696 | } |
697 | |
698 | // Regenerate the quick jump cache |
699 | @@ -159,7 +158,7 @@ |
700 | $num_cats = $db->num_rows($result); |
701 | |
702 | for ($i = 0; $i < $num_cats; ++$i) |
703 | - $cat_list[] = $db->fetch_row($result); |
704 | + $cat_list[] = $db->fetch_assoc($result); |
705 | |
706 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']); |
707 | define('PUN_ACTIVE_PAGE', 'admin'); |
708 | @@ -171,7 +170,7 @@ |
709 | <div class="blockform"> |
710 | <h2><span><?php echo $lang_admin_categories['Add categories head'] ?></span></h2> |
711 | <div class="box"> |
712 | - <form method="post" action="admin_categories.php?action=foo"> |
713 | + <form method="post" action="admin_categories.php"> |
714 | <div class="inform"> |
715 | <fieldset> |
716 | <legend><?php echo $lang_admin_categories['Add categories subhead'] ?></legend> |
717 | @@ -193,7 +192,7 @@ |
718 | |
719 | <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Delete categories head'] ?></span></h2> |
720 | <div class="box"> |
721 | - <form method="post" action="admin_categories.php?action=foo"> |
722 | + <form method="post" action="admin_categories.php"> |
723 | <div class="inform"> |
724 | <fieldset> |
725 | <legend><?php echo $lang_admin_categories['Delete categories subhead'] ?></legend> |
726 | @@ -205,8 +204,8 @@ |
727 | <select name="cat_to_delete" tabindex="3"> |
728 | <?php |
729 | |
730 | - foreach ($cat_list as $category) |
731 | - echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$category[0].'">'.pun_htmlspecialchars($category[1]).'</option>'."\n"; |
732 | + foreach ($cat_list as $cur_cat) |
733 | + 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"; |
734 | |
735 | ?> |
736 | </select> |
737 | @@ -223,7 +222,7 @@ |
738 | |
739 | <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Edit categories head'] ?></span></h2> |
740 | <div class="box"> |
741 | - <form method="post" action="admin_categories.php?action=foo"> |
742 | + <form method="post" action="admin_categories.php"> |
743 | <div class="inform"> |
744 | <fieldset> |
745 | <legend><?php echo $lang_admin_categories['Edit categories subhead'] ?></legend> |
746 | @@ -238,13 +237,13 @@ |
747 | <tbody> |
748 | <?php |
749 | |
750 | - foreach ($cat_list as $i => $category) |
751 | + foreach ($cat_list as $cur_cat) |
752 | { |
753 | |
754 | ?> |
755 | <tr> |
756 | - <td class="tcl"><input type="text" name="cat_name[<?php echo $i ?>]" value="<?php echo pun_htmlspecialchars($category[1]) ?>" size="35" maxlength="80" /></td> |
757 | - <td><input type="text" name="cat_order[<?php echo $i ?>]" value="<?php echo $category[2] ?>" size="3" maxlength="3" /></td> |
758 | + <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> |
759 | + <td><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][order]" value="<?php echo $cur_cat['disp_position'] ?>" size="3" maxlength="3" /></td> |
760 | </tr> |
761 | <?php |
762 | |
763 | |
764 | === modified file 'admin_censoring.php' |
765 | --- admin_censoring.php 2010-10-08 13:18:35 +0000 |
766 | +++ admin_censoring.php 2011-04-21 10:05:56 +0000 |
767 | @@ -1,7 +1,7 @@ |
768 | <?php |
769 | |
770 | /** |
771 | - * Copyright (C) 2008-2010 FluxBB |
772 | + * Copyright (C) 2008-2011 FluxBB |
773 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
774 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
775 | */ |
776 | @@ -9,12 +9,12 @@ |
777 | // Tell header.php to use the admin template |
778 | define('PUN_ADMIN_CONSOLE', 1); |
779 | |
780 | -define('PUN_ROOT', './'); |
781 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
782 | require PUN_ROOT.'include/common.php'; |
783 | require PUN_ROOT.'include/common_admin.php'; |
784 | |
785 | |
786 | -if (!$pun_user['is_admmod'] || ($pun_user['g_moderator'] == '1' && $pun_config['o_censoring'] == '0')) |
787 | +if ($pun_user['g_id'] != PUN_ADMIN) |
788 | message($lang_common['No permission']); |
789 | |
790 | // Load the admin_censoring.php language file |
791 | @@ -28,11 +28,17 @@ |
792 | $search_for = pun_trim($_POST['new_search_for']); |
793 | $replace_with = pun_trim($_POST['new_replace_with']); |
794 | |
795 | - if ($search_for == '' || $replace_with == '') |
796 | - message($lang_admin_censoring['Must enter both message']); |
797 | + if ($search_for == '') |
798 | + message($lang_admin_censoring['Must enter word message']); |
799 | |
800 | $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()); |
801 | |
802 | + // Regenerate the censoring cache |
803 | + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
804 | + require PUN_ROOT.'include/cache.php'; |
805 | + |
806 | + generate_censoring_cache(); |
807 | + |
808 | redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']); |
809 | } |
810 | |
811 | @@ -46,11 +52,17 @@ |
812 | $search_for = pun_trim($_POST['search_for'][$id]); |
813 | $replace_with = pun_trim($_POST['replace_with'][$id]); |
814 | |
815 | - if ($search_for == '' || $replace_with == '') |
816 | - message($lang_admin_censoring['Must search both message']); |
817 | + if ($search_for == '') |
818 | + message($lang_admin_censoring['Must enter word message']); |
819 | |
820 | $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()); |
821 | |
822 | + // Regenerate the censoring cache |
823 | + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
824 | + require PUN_ROOT.'include/cache.php'; |
825 | + |
826 | + generate_censoring_cache(); |
827 | + |
828 | redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']); |
829 | } |
830 | |
831 | @@ -63,6 +75,12 @@ |
832 | |
833 | $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); |
834 | |
835 | + // Regenerate the censoring cache |
836 | + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
837 | + require PUN_ROOT.'include/cache.php'; |
838 | + |
839 | + generate_censoring_cache(); |
840 | + |
841 | redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']); |
842 | } |
843 | |
844 | @@ -77,12 +95,12 @@ |
845 | <div class="blockform"> |
846 | <h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2> |
847 | <div class="box"> |
848 | - <form id="censoring" method="post" action="admin_censoring.php?action=foo"> |
849 | + <form id="censoring" method="post" action="admin_censoring.php"> |
850 | <div class="inform"> |
851 | <fieldset> |
852 | <legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend> |
853 | <div class="infldset"> |
854 | - <p><?php echo $lang_admin_censoring['Add word info'].($pun_user['g_id'] != PUN_ADMIN ? '' : ' '.($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> |
855 | + <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> |
856 | <table cellspacing="0"> |
857 | <thead> |
858 | <tr> |
859 | |
860 | === modified file 'admin_forums.php' |
861 | --- admin_forums.php 2010-10-08 13:18:35 +0000 |
862 | +++ admin_forums.php 2011-04-21 10:05:56 +0000 |
863 | @@ -1,7 +1,7 @@ |
864 | <?php |
865 | |
866 | /** |
867 | - * Copyright (C) 2008-2010 FluxBB |
868 | + * Copyright (C) 2008-2011 FluxBB |
869 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
870 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
871 | */ |
872 | @@ -9,7 +9,7 @@ |
873 | // Tell header.php to use the admin template |
874 | define('PUN_ADMIN_CONSOLE', 1); |
875 | |
876 | -define('PUN_ROOT', './'); |
877 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
878 | require PUN_ROOT.'include/common.php'; |
879 | require PUN_ROOT.'include/common_admin.php'; |
880 | |
881 | @@ -72,6 +72,9 @@ |
882 | $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error()); |
883 | $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()); |
884 | |
885 | + // Delete any subscriptions for this forum |
886 | + $db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE forum_id='.$forum_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error()); |
887 | + |
888 | // Regenerate the quick jump cache |
889 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
890 | require PUN_ROOT.'include/cache.php'; |
891 | @@ -274,6 +277,7 @@ |
892 | <select name="sort_by" tabindex="4"> |
893 | <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Last post'] ?></option> |
894 | <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Topic start'] ?></option> |
895 | + <option value="2"<?php if ($cur_forum['sort_by'] == '2') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Subject'] ?></option> |
896 | </select> |
897 | </td> |
898 | </tr> |
899 | |
900 | === modified file 'admin_groups.php' |
901 | --- admin_groups.php 2010-10-08 13:18:35 +0000 |
902 | +++ admin_groups.php 2011-04-21 10:05:56 +0000 |
903 | @@ -1,7 +1,7 @@ |
904 | <?php |
905 | |
906 | /** |
907 | - * Copyright (C) 2008-2010 FluxBB |
908 | + * Copyright (C) 2008-2011 FluxBB |
909 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
910 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
911 | */ |
912 | @@ -9,7 +9,7 @@ |
913 | // Tell header.php to use the admin template |
914 | define('PUN_ADMIN_CONSOLE', 1); |
915 | |
916 | -define('PUN_ROOT', './'); |
917 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
918 | require PUN_ROOT.'include/common.php'; |
919 | require PUN_ROOT.'include/common_admin.php'; |
920 | |
921 | @@ -296,7 +296,8 @@ |
922 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
923 | require PUN_ROOT.'include/cache.php'; |
924 | |
925 | - generate_quickjump_cache(); |
926 | + $group_id = $_POST['mode'] == 'add' ? $new_group_id : intval($_POST['group_id']); |
927 | + generate_quickjump_cache($group_id); |
928 | |
929 | if ($_POST['mode'] == 'edit') |
930 | redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']); |
931 | @@ -364,12 +365,6 @@ |
932 | $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error()); |
933 | $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()); |
934 | |
935 | - // Regenerate the quick jump cache |
936 | - if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
937 | - require PUN_ROOT.'include/cache.php'; |
938 | - |
939 | - generate_quickjump_cache(); |
940 | - |
941 | redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']); |
942 | } |
943 | else |
944 | @@ -470,7 +465,7 @@ |
945 | <div class="blockform"> |
946 | <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> |
947 | <div class="box"> |
948 | - <form id="groups" method="post" action="admin_groups.php?action=foo"> |
949 | + <form id="groups" method="post" action="admin_groups.php"> |
950 | <div class="inform"> |
951 | <fieldset> |
952 | <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> |
953 | |
954 | === modified file 'admin_index.php' |
955 | --- admin_index.php 2010-10-08 13:18:35 +0000 |
956 | +++ admin_index.php 2011-04-21 10:05:56 +0000 |
957 | @@ -1,7 +1,7 @@ |
958 | <?php |
959 | |
960 | /** |
961 | - * Copyright (C) 2008-2010 FluxBB |
962 | + * Copyright (C) 2008-2011 FluxBB |
963 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
964 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
965 | */ |
966 | @@ -9,7 +9,7 @@ |
967 | // Tell header.php to use the admin template |
968 | define('PUN_ADMIN_CONSOLE', 1); |
969 | |
970 | -define('PUN_ROOT', './'); |
971 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
972 | require PUN_ROOT.'include/common.php'; |
973 | require PUN_ROOT.'include/common_admin.php'; |
974 | |
975 | @@ -126,18 +126,18 @@ |
976 | <h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2> |
977 | <div id="adintro" class="box"> |
978 | <div class="inbox"> |
979 | - <p> |
980 | - <?php echo $lang_admin_index['Welcome to admin'] ?><br /><br /> |
981 | -  - <?php echo $lang_admin_index['Welcome 1'] ?><br /> |
982 | -  - <?php echo $lang_admin_index['Welcome 2'] ?><br /> |
983 | -  - <?php echo $lang_admin_index['Welcome 3'] ?><br /> |
984 | -  - <?php echo $lang_admin_index['Welcome 4'] ?><br /> |
985 | -  - <?php echo $lang_admin_index['Welcome 5'] ?><br /> |
986 | -  - <?php echo $lang_admin_index['Welcome 6'] ?><br /> |
987 | -  - <?php echo $lang_admin_index['Welcome 7'] ?><br /> |
988 | -  - <?php echo $lang_admin_index['Welcome 8'] ?><br /> |
989 | -  - <?php echo $lang_admin_index['Welcome 9'] ?> |
990 | - </p> |
991 | + <p><?php echo $lang_admin_index['Welcome to admin'] ?></p> |
992 | + <ul> |
993 | + <li><span><?php echo $lang_admin_index['Welcome 1'] ?></span></li> |
994 | + <li><span><?php echo $lang_admin_index['Welcome 2'] ?></span></li> |
995 | + <li><span><?php echo $lang_admin_index['Welcome 3'] ?></span></li> |
996 | + <li><span><?php echo $lang_admin_index['Welcome 4'] ?></span></li> |
997 | + <li><span><?php echo $lang_admin_index['Welcome 5'] ?></span></li> |
998 | + <li><span><?php echo $lang_admin_index['Welcome 6'] ?></span></li> |
999 | + <li><span><?php echo $lang_admin_index['Welcome 7'] ?></span></li> |
1000 | + <li><span><?php echo $lang_admin_index['Welcome 8'] ?></span></li> |
1001 | + <li><span><?php echo $lang_admin_index['Welcome 9'] ?></span></li> |
1002 | + </ul> |
1003 | </div> |
1004 | </div> |
1005 | |
1006 | @@ -147,7 +147,7 @@ |
1007 | <dl> |
1008 | <dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt> |
1009 | <dd> |
1010 | - <?php printf($lang_admin_index['FluxBB version data'], $pun_config['o_cur_version'], '<a href="admin_index.php?action=check_upgrade">'.$lang_admin_index['Check for upgrade'].'</a>') ?><br /> |
1011 | + <?php printf($lang_admin_index['FluxBB version data'], $pun_config['o_cur_version'], '<a href="admin_index.php?action=check_upgrade">'.$lang_admin_index['Check for upgrade'].'</a>') ?> |
1012 | </dd> |
1013 | <dt><?php echo $lang_admin_index['Server load label'] ?></dt> |
1014 | <dd> |
1015 | @@ -164,7 +164,7 @@ |
1016 | <?php echo implode(' ', $db->get_version())."\n" ?> |
1017 | <?php if (isset($total_records) && isset($total_size)): ?> <br /><?php printf($lang_admin_index['Database data rows'], forum_number_format($total_records)) ?> |
1018 | <br /><?php printf($lang_admin_index['Database data size'], $total_size) ?> |
1019 | -<?php endif; endif; ?> </dd> |
1020 | +<?php endif; ?> </dd><?php endif; ?> |
1021 | </dl> |
1022 | </div> |
1023 | </div> |
1024 | |
1025 | === modified file 'admin_loader.php' |
1026 | --- admin_loader.php 2010-10-08 13:18:35 +0000 |
1027 | +++ admin_loader.php 2011-04-21 10:05:56 +0000 |
1028 | @@ -1,7 +1,7 @@ |
1029 | <?php |
1030 | |
1031 | /** |
1032 | - * Copyright (C) 2008-2010 FluxBB |
1033 | + * Copyright (C) 2008-2011 FluxBB |
1034 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1035 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1036 | */ |
1037 | @@ -9,7 +9,7 @@ |
1038 | // Tell header.php to use the admin template |
1039 | define('PUN_ADMIN_CONSOLE', 1); |
1040 | |
1041 | -define('PUN_ROOT', './'); |
1042 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1043 | require PUN_ROOT.'include/common.php'; |
1044 | require PUN_ROOT.'include/common_admin.php'; |
1045 | |
1046 | |
1047 | === modified file 'admin_maintenance.php' |
1048 | --- admin_maintenance.php 2010-10-08 13:18:35 +0000 |
1049 | +++ admin_maintenance.php 2011-04-21 10:05:56 +0000 |
1050 | @@ -1,7 +1,7 @@ |
1051 | <?php |
1052 | |
1053 | /** |
1054 | - * Copyright (C) 2008-2010 FluxBB |
1055 | + * Copyright (C) 2008-2011 FluxBB |
1056 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1057 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1058 | */ |
1059 | @@ -11,7 +11,7 @@ |
1060 | // Tell common.php that we don't want output buffering |
1061 | define('PUN_DISABLE_BUFFERING', 1); |
1062 | |
1063 | -define('PUN_ROOT', './'); |
1064 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1065 | require PUN_ROOT.'include/common.php'; |
1066 | require PUN_ROOT.'include/common_admin.php'; |
1067 | |
1068 | @@ -22,12 +22,16 @@ |
1069 | // Load the admin_maintenance.php language file |
1070 | require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php'; |
1071 | |
1072 | -if (isset($_GET['i_per_page']) && isset($_GET['i_start_at'])) |
1073 | +$action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : ''; |
1074 | + |
1075 | +if ($action == 'rebuild') |
1076 | { |
1077 | - $per_page = intval($_GET['i_per_page']); |
1078 | - $start_at = intval($_GET['i_start_at']); |
1079 | - if ($per_page < 1 || $start_at < 1) |
1080 | - message($lang_common['Bad request']); |
1081 | + $per_page = isset($_GET['i_per_page']) ? intval($_GET['i_per_page']) : 0; |
1082 | + $start_at = isset($_GET['i_start_at']) ? intval($_GET['i_start_at']) : 0; |
1083 | + |
1084 | + // Check per page is > 0 |
1085 | + if ($per_page < 1) |
1086 | + message($lang_admin_maintenance['Posts must be integer message']); |
1087 | |
1088 | @set_time_limit(0); |
1089 | |
1090 | @@ -110,7 +114,7 @@ |
1091 | $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id > '.$end_at.' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
1092 | |
1093 | if ($db->num_rows($result) > 0) |
1094 | - $query_str = '?i_per_page='.$per_page.'&i_start_at='.$db->result($result); |
1095 | + $query_str = '?action=rebuild&i_per_page='.$per_page.'&i_start_at='.$db->result($result); |
1096 | } |
1097 | |
1098 | $db->end_transaction(); |
1099 | @@ -119,6 +123,122 @@ |
1100 | exit('<script type="text/javascript">window.location="admin_maintenance.php'.$query_str.'"</script><hr /><p>'.sprintf($lang_admin_maintenance['Javascript redirect failed'], '<a href="admin_maintenance.php'.$query_str.'">'.$lang_admin_maintenance['Click here'].'</a>').'</p>'); |
1101 | } |
1102 | |
1103 | +if ($action == 'prune') |
1104 | +{ |
1105 | + $prune_from = trim($_POST['prune_from']); |
1106 | + $prune_sticky = intval($_POST['prune_sticky']); |
1107 | + |
1108 | + if (isset($_POST['prune_comply'])) |
1109 | + { |
1110 | + confirm_referrer('admin_maintenance.php'); |
1111 | + |
1112 | + $prune_days = intval($_POST['prune_days']); |
1113 | + $prune_date = ($prune_days) ? time() - ($prune_days * 86400) : -1; |
1114 | + |
1115 | + @set_time_limit(0); |
1116 | + |
1117 | + if ($prune_from == 'all') |
1118 | + { |
1119 | + $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
1120 | + $num_forums = $db->num_rows($result); |
1121 | + |
1122 | + for ($i = 0; $i < $num_forums; ++$i) |
1123 | + { |
1124 | + $fid = $db->result($result, $i); |
1125 | + |
1126 | + prune($fid, $prune_sticky, $prune_date); |
1127 | + update_forum($fid); |
1128 | + } |
1129 | + } |
1130 | + else |
1131 | + { |
1132 | + $prune_from = intval($prune_from); |
1133 | + prune($prune_from, $prune_sticky, $prune_date); |
1134 | + update_forum($prune_from); |
1135 | + } |
1136 | + |
1137 | + // Locate any "orphaned redirect topics" and delete them |
1138 | + $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()); |
1139 | + $num_orphans = $db->num_rows($result); |
1140 | + |
1141 | + if ($num_orphans) |
1142 | + { |
1143 | + for ($i = 0; $i < $num_orphans; ++$i) |
1144 | + $orphans[] = $db->result($result, $i); |
1145 | + |
1146 | + $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); |
1147 | + } |
1148 | + |
1149 | + redirect('admin_maintenance.php', $lang_admin_maintenance['Posts pruned redirect']); |
1150 | + } |
1151 | + |
1152 | + $prune_days = trim($_POST['req_prune_days']); |
1153 | + if ($prune_days == '' || preg_match('/[^0-9]/', $prune_days)) |
1154 | + message($lang_admin_maintenance['Days must be integer message']); |
1155 | + |
1156 | + $prune_date = time() - ($prune_days * 86400); |
1157 | + |
1158 | + // Concatenate together the query for counting number of topics to prune |
1159 | + $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL'; |
1160 | + |
1161 | + if ($prune_sticky == '0') |
1162 | + $sql .= ' AND sticky=0'; |
1163 | + |
1164 | + if ($prune_from != 'all') |
1165 | + { |
1166 | + $prune_from = intval($prune_from); |
1167 | + $sql .= ' AND forum_id='.$prune_from; |
1168 | + |
1169 | + // Fetch the forum name (just for cosmetic reasons) |
1170 | + $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error()); |
1171 | + $forum = '"'.pun_htmlspecialchars($db->result($result)).'"'; |
1172 | + } |
1173 | + else |
1174 | + $forum = $lang_admin_maintenance['All forums']; |
1175 | + |
1176 | + $result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error()); |
1177 | + $num_topics = $db->result($result); |
1178 | + |
1179 | + if (!$num_topics) |
1180 | + message(sprintf($lang_admin_maintenance['No old topics message'], $prune_days)); |
1181 | + |
1182 | + |
1183 | + $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); |
1184 | + define('PUN_ACTIVE_PAGE', 'admin'); |
1185 | + require PUN_ROOT.'header.php'; |
1186 | + |
1187 | + generate_admin_menu('maintenance'); |
1188 | + |
1189 | +?> |
1190 | + <div class="blockform"> |
1191 | + <h2><span><?php echo $lang_admin_maintenance['Prune head'] ?></span></h2> |
1192 | + <div class="box"> |
1193 | + <form method="post" action="admin_maintenance.php"> |
1194 | + <div class="inform"> |
1195 | + <input type="hidden" name="action" value="prune" /> |
1196 | + <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" /> |
1197 | + <input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" /> |
1198 | + <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" /> |
1199 | + <fieldset> |
1200 | + <legend><?php echo $lang_admin_maintenance['Confirm prune subhead'] ?></legend> |
1201 | + <div class="infldset"> |
1202 | + <p><?php printf($lang_admin_maintenance['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?></p> |
1203 | + <p class="warntext"><?php echo $lang_admin_maintenance['Confirm prune warn'] ?></p> |
1204 | + </div> |
1205 | + </fieldset> |
1206 | + </div> |
1207 | + <p class="buttons"><input type="submit" name="prune_comply" value="<?php echo $lang_admin_common['Prune'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> |
1208 | + </form> |
1209 | + </div> |
1210 | + </div> |
1211 | + <div class="clearer"></div> |
1212 | +</div> |
1213 | +<?php |
1214 | + |
1215 | + require PUN_ROOT.'footer.php'; |
1216 | + exit; |
1217 | +} |
1218 | + |
1219 | |
1220 | // Get the first post ID from the db |
1221 | $result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id ASC LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
1222 | @@ -137,6 +257,7 @@ |
1223 | <div class="box"> |
1224 | <form method="get" action="admin_maintenance.php"> |
1225 | <div class="inform"> |
1226 | + <input type="hidden" name="action" value="rebuild" /> |
1227 | <fieldset> |
1228 | <legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend> |
1229 | <div class="infldset"> |
1230 | @@ -169,6 +290,65 @@ |
1231 | </fieldset> |
1232 | </div> |
1233 | </form> |
1234 | + |
1235 | + <form method="post" action="admin_maintenance.php" onsubmit="return process_form(this)"> |
1236 | + <div class="inform"> |
1237 | + <input type="hidden" name="action" value="prune" /> |
1238 | + <fieldset> |
1239 | + <legend><?php echo $lang_admin_maintenance['Prune subhead'] ?></legend> |
1240 | + <div class="infldset"> |
1241 | + <table class="aligntop" cellspacing="0"> |
1242 | + <tr> |
1243 | + <th scope="row"><?php echo $lang_admin_maintenance['Days old label'] ?></th> |
1244 | + <td> |
1245 | + <input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="5" /> |
1246 | + <span><?php echo $lang_admin_maintenance['Days old help'] ?></span> |
1247 | + </td> |
1248 | + </tr> |
1249 | + <tr> |
1250 | + <th scope="row"><?php echo $lang_admin_maintenance['Prune sticky label'] ?></th> |
1251 | + <td> |
1252 | + <input type="radio" name="prune_sticky" value="1" tabindex="6" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="prune_sticky" value="0" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
1253 | + <span><?php echo $lang_admin_maintenance['Prune sticky help'] ?></span> |
1254 | + </td> |
1255 | + </tr> |
1256 | + <tr> |
1257 | + <th scope="row"><?php echo $lang_admin_maintenance['Prune from label'] ?></th> |
1258 | + <td> |
1259 | + <select name="prune_from" tabindex="7"> |
1260 | + <option value="all"><?php echo $lang_admin_maintenance['All forums'] ?></option> |
1261 | +<?php |
1262 | + |
1263 | + $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
1264 | + |
1265 | + $cur_category = 0; |
1266 | + while ($forum = $db->fetch_assoc($result)) |
1267 | + { |
1268 | + if ($forum['cid'] != $cur_category) // Are we still in the same category? |
1269 | + { |
1270 | + if ($cur_category) |
1271 | + echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n"; |
1272 | + |
1273 | + echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n"; |
1274 | + $cur_category = $forum['cid']; |
1275 | + } |
1276 | + |
1277 | + echo "\t\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.pun_htmlspecialchars($forum['forum_name']).'</option>'."\n"; |
1278 | + } |
1279 | + |
1280 | +?> |
1281 | + </optgroup> |
1282 | + </select> |
1283 | + <span><?php echo $lang_admin_maintenance['Prune from help'] ?></span> |
1284 | + </td> |
1285 | + </tr> |
1286 | + </table> |
1287 | + <p class="topspace"><?php printf($lang_admin_maintenance['Prune info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p> |
1288 | + <div class="fsetsubmit"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="8" /></div> |
1289 | + </div> |
1290 | + </fieldset> |
1291 | + </div> |
1292 | + </form> |
1293 | </div> |
1294 | </div> |
1295 | <div class="clearer"></div> |
1296 | |
1297 | === modified file 'admin_options.php' |
1298 | --- admin_options.php 2010-10-08 13:18:35 +0000 |
1299 | +++ admin_options.php 2011-04-21 10:05:56 +0000 |
1300 | @@ -1,7 +1,7 @@ |
1301 | <?php |
1302 | |
1303 | /** |
1304 | - * Copyright (C) 2008-2010 FluxBB |
1305 | + * Copyright (C) 2008-2011 FluxBB |
1306 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1307 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1308 | */ |
1309 | @@ -9,7 +9,7 @@ |
1310 | // Tell header.php to use the admin template |
1311 | define('PUN_ADMIN_CONSOLE', 1); |
1312 | |
1313 | -define('PUN_ROOT', './'); |
1314 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1315 | require PUN_ROOT.'include/common.php'; |
1316 | require PUN_ROOT.'include/common_admin.php'; |
1317 | |
1318 | @@ -22,9 +22,7 @@ |
1319 | |
1320 | if (isset($_POST['form_sent'])) |
1321 | { |
1322 | - // Custom referrer check (so we can output a custom error message) |
1323 | - if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')))) |
1324 | - message($lang_admin_options['Bad HTTP Referer message']); |
1325 | + confirm_referrer('admin_options.php', $lang_admin_options['Bad HTTP Referer message']); |
1326 | |
1327 | $form = array( |
1328 | 'board_title' => pun_trim($_POST['form']['board_title']), |
1329 | @@ -32,8 +30,8 @@ |
1330 | 'base_url' => pun_trim($_POST['form']['base_url']), |
1331 | 'default_timezone' => floatval($_POST['form']['default_timezone']), |
1332 | 'default_dst' => $_POST['form']['default_dst'] != '1' ? '0' : '1', |
1333 | - 'default_lang' => preg_replace('#[\.\\\/]#', '', pun_trim($_POST['form']['default_lang'])), |
1334 | - 'default_style' => preg_replace('#[\.\\\/]#', '', pun_trim($_POST['form']['default_style'])), |
1335 | + 'default_lang' => pun_trim($_POST['form']['default_lang']), |
1336 | + 'default_style' => pun_trim($_POST['form']['default_style']), |
1337 | 'time_format' => pun_trim($_POST['form']['time_format']), |
1338 | 'date_format' => pun_trim($_POST['form']['date_format']), |
1339 | 'timeout_visit' => intval($_POST['form']['timeout_visit']), |
1340 | @@ -62,6 +60,7 @@ |
1341 | 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', |
1342 | 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), |
1343 | 'feed_type' => intval($_POST['form']['feed_type']), |
1344 | + 'feed_ttl' => intval($_POST['form']['feed_ttl']), |
1345 | 'report_method' => intval($_POST['form']['report_method']), |
1346 | 'mailing_list' => pun_trim($_POST['form']['mailing_list']), |
1347 | 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', |
1348 | @@ -71,10 +70,10 @@ |
1349 | 'avatars_size' => intval($_POST['form']['avatars_size']), |
1350 | 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), |
1351 | 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), |
1352 | - 'subscriptions' => $_POST['form']['subscriptions'] != '1' ? '0' : '1', |
1353 | + 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', |
1354 | + 'topic_subscriptions' => $_POST['form']['topic_subscriptions'] != '1' ? '0' : '1', |
1355 | 'smtp_host' => pun_trim($_POST['form']['smtp_host']), |
1356 | 'smtp_user' => pun_trim($_POST['form']['smtp_user']), |
1357 | - 'smtp_pass' => pun_trim($_POST['form']['smtp_pass']), |
1358 | 'smtp_ssl' => $_POST['form']['smtp_ssl'] != '1' ? '0' : '1', |
1359 | 'regs_allow' => $_POST['form']['regs_allow'] != '1' ? '0' : '1', |
1360 | 'regs_verify' => $_POST['form']['regs_verify'] != '1' ? '0' : '1', |
1361 | @@ -95,9 +94,12 @@ |
1362 | if (substr($form['base_url'], -1) == '/') |
1363 | $form['base_url'] = substr($form['base_url'], 0, -1); |
1364 | |
1365 | - if (!file_exists(PUN_ROOT.'lang/'.$form['default_lang'].'/common.php')) |
1366 | + $languages = forum_list_langs(); |
1367 | + if (!in_array($form['default_lang'], $languages)) |
1368 | message($lang_common['Bad request']); |
1369 | - if (!file_exists(PUN_ROOT.'style/'.$form['default_style'].'.css')) |
1370 | + |
1371 | + $styles = forum_list_styles(); |
1372 | + if (!in_array($form['default_style'], $styles)) |
1373 | message($lang_common['Bad request']); |
1374 | |
1375 | if ($form['time_format'] == '') |
1376 | @@ -125,6 +127,18 @@ |
1377 | if ($form['additional_navlinks'] != '') |
1378 | $form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks'])); |
1379 | |
1380 | + // Change or enter a SMTP password |
1381 | + if (isset($_POST['form']['smtp_change_pass'])) |
1382 | + { |
1383 | + $smtp_pass1 = isset($_POST['form']['smtp_pass1']) ? pun_trim($_POST['form']['smtp_pass1']) : ''; |
1384 | + $smtp_pass2 = isset($_POST['form']['smtp_pass2']) ? pun_trim($_POST['form']['smtp_pass2']) : ''; |
1385 | + |
1386 | + if ($smtp_pass1 == $smtp_pass2) |
1387 | + $form['smtp_pass'] = $smtp_pass1; |
1388 | + else |
1389 | + message($lang_admin_options['SMTP passwords did not match']); |
1390 | + } |
1391 | + |
1392 | if ($form['announcement_message'] != '') |
1393 | $form['announcement_message'] = pun_linebreaks($form['announcement_message']); |
1394 | else |
1395 | @@ -163,6 +177,9 @@ |
1396 | if ($form['feed_type'] < 0 || $form['feed_type'] > 2) |
1397 | message($lang_common['Bad request']); |
1398 | |
1399 | + if ($form['feed_ttl'] < 0) |
1400 | + message($lang_common['Bad request']); |
1401 | + |
1402 | if ($form['report_method'] < 0 || $form['report_method'] > 2) |
1403 | message($lang_common['Bad request']); |
1404 | |
1405 | @@ -191,6 +208,7 @@ |
1406 | require PUN_ROOT.'include/cache.php'; |
1407 | |
1408 | generate_config_cache(); |
1409 | + clear_feed_cache(); |
1410 | |
1411 | redirect('admin_options.php', $lang_admin_options['Options updated redirect']); |
1412 | } |
1413 | @@ -205,7 +223,7 @@ |
1414 | <div class="blockform"> |
1415 | <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> |
1416 | <div class="box"> |
1417 | - <form method="post" action="admin_options.php?action=foo"> |
1418 | + <form method="post" action="admin_options.php"> |
1419 | <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p> |
1420 | <div class="inform"> |
1421 | <input type="hidden" name="form_sent" value="1" /> |
1422 | @@ -230,7 +248,7 @@ |
1423 | <tr> |
1424 | <th scope="row"><?php echo $lang_admin_options['Base URL label'] ?></th> |
1425 | <td> |
1426 | - <input type="text" name="form[base_url]" size="50" maxlength="100" value="<?php echo $pun_config['o_base_url'] ?>" /> |
1427 | + <input type="text" name="form[base_url]" size="50" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_base_url']) ?>" /> |
1428 | <span><?php echo $lang_admin_options['Base URL help'] ?></span> |
1429 | </td> |
1430 | </tr> |
1431 | @@ -553,6 +571,15 @@ |
1432 | <span><?php echo $lang_admin_options['Menu items help'] ?></span> |
1433 | </td> |
1434 | </tr> |
1435 | + </table> |
1436 | + </div> |
1437 | + </fieldset> |
1438 | + </div> |
1439 | + <div class="inform"> |
1440 | + <fieldset> |
1441 | + <legend><?php echo $lang_admin_options['Feed subhead'] ?></legend> |
1442 | + <div class="infldset"> |
1443 | + <table class="aligntop" cellspacing="0"> |
1444 | <tr> |
1445 | <th scope="row"><?php echo $lang_admin_options['Default feed label'] ?></th> |
1446 | <td> |
1447 | @@ -560,6 +587,23 @@ |
1448 | <span><?php echo $lang_admin_options['Default feed help'] ?></span> |
1449 | </td> |
1450 | </tr> |
1451 | + <tr> |
1452 | + <th scope="row"><?php echo $lang_admin_options['Feed TTL label'] ?></th> |
1453 | + <td> |
1454 | + <select name="form[feed_ttl]"> |
1455 | + <option value="0"<?php if ($pun_config['o_feed_ttl'] == '0') echo ' selected="selected"'; ?>><?php echo $lang_admin_options['No cache'] ?></option> |
1456 | +<?php |
1457 | + |
1458 | + $times = array(5, 15, 30, 60); |
1459 | + |
1460 | + foreach ($times as $time) |
1461 | + echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$time.'"'.($pun_config['o_feed_ttl'] == $time ? ' selected="selected"' : '').'>'.sprintf($lang_admin_options['Minutes'], $time).'</option>'."\n"; |
1462 | + |
1463 | +?> |
1464 | + </select> |
1465 | + <span><?php echo $lang_admin_options['Feed TTL help'] ?></span> |
1466 | + </td> |
1467 | + </tr> |
1468 | </table> |
1469 | </div> |
1470 | </fieldset> |
1471 | @@ -651,10 +695,17 @@ |
1472 | </td> |
1473 | </tr> |
1474 | <tr> |
1475 | - <th scope="row"><?php echo $lang_admin_options['Subscriptions label'] ?></th> |
1476 | - <td> |
1477 | - <input type="radio" name="form[subscriptions]" value="1"<?php if ($pun_config['o_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[subscriptions]" value="0"<?php if ($pun_config['o_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
1478 | - <span><?php echo $lang_admin_options['Subscriptions help'] ?></span> |
1479 | + <th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th> |
1480 | + <td> |
1481 | + <input type="radio" name="form[forum_subscriptions]" value="1"<?php if ($pun_config['o_forum_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[forum_subscriptions]" value="0"<?php if ($pun_config['o_forum_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
1482 | + <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> |
1483 | + </td> |
1484 | + </tr> |
1485 | + <tr> |
1486 | + <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> |
1487 | + <td> |
1488 | + <input type="radio" name="form[topic_subscriptions]" value="1"<?php if ($pun_config['o_topic_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[topic_subscriptions]" value="0"<?php if ($pun_config['o_topic_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
1489 | + <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> |
1490 | </td> |
1491 | </tr> |
1492 | <tr> |
1493 | @@ -674,7 +725,10 @@ |
1494 | <tr> |
1495 | <th scope="row"><?php echo $lang_admin_options['SMTP password label'] ?></th> |
1496 | <td> |
1497 | - <input type="text" name="form[smtp_pass]" size="25" maxlength="50" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_pass']) ?>" /> |
1498 | + <span><input type="checkbox" name="form[smtp_change_pass]" value="1" />  <?php echo $lang_admin_options['SMTP change password help'] ?></span> |
1499 | +<?php $smtp_pass = !empty($pun_config['o_smtp_pass']) ? random_key(pun_strlen($pun_config['o_smtp_pass']), true) : ''; ?> |
1500 | + <input type="password" name="form[smtp_pass1]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
1501 | + <input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
1502 | <span><?php echo $lang_admin_options['SMTP password help'] ?></span> |
1503 | </td> |
1504 | </tr> |
1505 | |
1506 | === modified file 'admin_permissions.php' |
1507 | --- admin_permissions.php 2010-10-08 13:18:35 +0000 |
1508 | +++ admin_permissions.php 2011-04-21 10:05:56 +0000 |
1509 | @@ -1,7 +1,7 @@ |
1510 | <?php |
1511 | |
1512 | /** |
1513 | - * Copyright (C) 2008-2010 FluxBB |
1514 | + * Copyright (C) 2008-2011 FluxBB |
1515 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1516 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1517 | */ |
1518 | @@ -9,7 +9,7 @@ |
1519 | // Tell header.php to use the admin template |
1520 | define('PUN_ADMIN_CONSOLE', 1); |
1521 | |
1522 | -define('PUN_ROOT', './'); |
1523 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1524 | require PUN_ROOT.'include/common.php'; |
1525 | require PUN_ROOT.'include/common_admin.php'; |
1526 | |
1527 | |
1528 | === removed file 'admin_prune.php' |
1529 | --- admin_prune.php 2010-10-08 13:18:35 +0000 |
1530 | +++ admin_prune.php 1970-01-01 00:00:00 +0000 |
1531 | @@ -1,217 +0,0 @@ |
1532 | -<?php |
1533 | - |
1534 | -/** |
1535 | - * Copyright (C) 2008-2010 FluxBB |
1536 | - * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1537 | - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1538 | - */ |
1539 | - |
1540 | -// Tell header.php to use the admin template |
1541 | -define('PUN_ADMIN_CONSOLE', 1); |
1542 | - |
1543 | -define('PUN_ROOT', './'); |
1544 | -require PUN_ROOT.'include/common.php'; |
1545 | -require PUN_ROOT.'include/common_admin.php'; |
1546 | - |
1547 | - |
1548 | -if ($pun_user['g_id'] != PUN_ADMIN) |
1549 | - message($lang_common['No permission']); |
1550 | - |
1551 | -// Load the admin_prune.php language file |
1552 | -require PUN_ROOT.'lang/'.$admin_language.'/admin_prune.php'; |
1553 | - |
1554 | -if (isset($_GET['action']) || isset($_POST['prune']) || isset($_POST['prune_comply'])) |
1555 | -{ |
1556 | - $prune_from = trim($_POST['prune_from']); |
1557 | - $prune_sticky = intval($_POST['prune_sticky']); |
1558 | - |
1559 | - if (isset($_POST['prune_comply'])) |
1560 | - { |
1561 | - confirm_referrer('admin_prune.php'); |
1562 | - |
1563 | - $prune_days = intval($_POST['prune_days']); |
1564 | - $prune_date = ($prune_days) ? time() - ($prune_days * 86400) : -1; |
1565 | - |
1566 | - @set_time_limit(0); |
1567 | - |
1568 | - if ($prune_from == 'all') |
1569 | - { |
1570 | - $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
1571 | - $num_forums = $db->num_rows($result); |
1572 | - |
1573 | - for ($i = 0; $i < $num_forums; ++$i) |
1574 | - { |
1575 | - $fid = $db->result($result, $i); |
1576 | - |
1577 | - prune($fid, $prune_sticky, $prune_date); |
1578 | - update_forum($fid); |
1579 | - } |
1580 | - } |
1581 | - else |
1582 | - { |
1583 | - $prune_from = intval($prune_from); |
1584 | - prune($prune_from, $prune_sticky, $prune_date); |
1585 | - update_forum($prune_from); |
1586 | - } |
1587 | - |
1588 | - // Locate any "orphaned redirect topics" and delete them |
1589 | - $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()); |
1590 | - $num_orphans = $db->num_rows($result); |
1591 | - |
1592 | - if ($num_orphans) |
1593 | - { |
1594 | - for ($i = 0; $i < $num_orphans; ++$i) |
1595 | - $orphans[] = $db->result($result, $i); |
1596 | - |
1597 | - $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); |
1598 | - } |
1599 | - |
1600 | - redirect('admin_prune.php', $lang_admin_prune['Posts pruned redirect']); |
1601 | - } |
1602 | - |
1603 | - $prune_days = trim($_POST['req_prune_days']); |
1604 | - if ($prune_days == '' || preg_match('/[^0-9]/', $prune_days)) |
1605 | - message($lang_admin_prune['Must be integer message']); |
1606 | - |
1607 | - $prune_date = time() - ($prune_days * 86400); |
1608 | - |
1609 | - // Concatenate together the query for counting number of topics to prune |
1610 | - $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL'; |
1611 | - |
1612 | - if ($prune_sticky == '0') |
1613 | - $sql .= ' AND sticky=\'0\''; |
1614 | - |
1615 | - if ($prune_from != 'all') |
1616 | - { |
1617 | - $prune_from = intval($prune_from); |
1618 | - $sql .= ' AND forum_id='.$prune_from; |
1619 | - |
1620 | - // Fetch the forum name (just for cosmetic reasons) |
1621 | - $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error()); |
1622 | - $forum = '"'.pun_htmlspecialchars($db->result($result)).'"'; |
1623 | - } |
1624 | - else |
1625 | - $forum = $lang_admin_prune['All forums']; |
1626 | - |
1627 | - $result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error()); |
1628 | - $num_topics = $db->result($result); |
1629 | - |
1630 | - if (!$num_topics) |
1631 | - message(sprintf($lang_admin_prune['No old topics message'], $prune_days)); |
1632 | - |
1633 | - |
1634 | - $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); |
1635 | - define('PUN_ACTIVE_PAGE', 'admin'); |
1636 | - require PUN_ROOT.'header.php'; |
1637 | - |
1638 | - generate_admin_menu('prune'); |
1639 | - |
1640 | -?> |
1641 | - <div class="blockform"> |
1642 | - <h2><span><?php echo $lang_admin_prune['Prune head'] ?></span></h2> |
1643 | - <div class="box"> |
1644 | - <form method="post" action="admin_prune.php?action=foo"> |
1645 | - <div class="inform"> |
1646 | - <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" /> |
1647 | - <input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" /> |
1648 | - <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" /> |
1649 | - <fieldset> |
1650 | - <legend><?php echo $lang_admin_prune['Confirm prune subhead'] ?></legend> |
1651 | - <div class="infldset"> |
1652 | - <p><?php printf($lang_admin_prune['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?></p> |
1653 | - <p class="warntext"><?php echo $lang_admin_prune['Confirm prune warn'] ?></p> |
1654 | - </div> |
1655 | - </fieldset> |
1656 | - </div> |
1657 | - <p class="buttons"><input type="submit" name="prune_comply" value="<?php echo $lang_admin_common['Prune'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> |
1658 | - </form> |
1659 | - </div> |
1660 | - </div> |
1661 | - <div class="clearer"></div> |
1662 | -</div> |
1663 | -<?php |
1664 | - |
1665 | - require PUN_ROOT.'footer.php'; |
1666 | -} |
1667 | - |
1668 | - |
1669 | -else |
1670 | -{ |
1671 | - $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); |
1672 | - $required_fields = array('req_prune_days' => $lang_admin_prune['Days old label']); |
1673 | - $focus_element = array('prune', 'req_prune_days'); |
1674 | - define('PUN_ACTIVE_PAGE', 'admin'); |
1675 | - require PUN_ROOT.'header.php'; |
1676 | - |
1677 | - generate_admin_menu('prune'); |
1678 | - |
1679 | -?> |
1680 | - <div class="blockform"> |
1681 | - <h2><span><?php echo $lang_admin_prune['Prune head'] ?></span></h2> |
1682 | - <div class="box"> |
1683 | - <form id="prune" method="post" action="admin_prune.php?action=foo" onsubmit="return process_form(this)"> |
1684 | - <div class="inform"> |
1685 | - <input type="hidden" name="form_sent" value="1" /> |
1686 | - <fieldset> |
1687 | - <legend><?php echo $lang_admin_prune['Prune subhead'] ?></legend> |
1688 | - <div class="infldset"> |
1689 | - <table class="aligntop" cellspacing="0"> |
1690 | - <tr> |
1691 | - <th scope="row"><?php echo $lang_admin_prune['Days old label'] ?></th> |
1692 | - <td> |
1693 | - <input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="1" /> |
1694 | - <span><?php echo $lang_admin_prune['Days old help'] ?></span> |
1695 | - </td> |
1696 | - </tr> |
1697 | - <tr> |
1698 | - <th scope="row"><?php echo $lang_admin_prune['Prune sticky label'] ?></th> |
1699 | - <td> |
1700 | - <input type="radio" name="prune_sticky" value="1" tabindex="2" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="prune_sticky" value="0" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
1701 | - <span><?php echo $lang_admin_prune['Prune sticky help'] ?></span> |
1702 | - </td> |
1703 | - </tr> |
1704 | - <tr> |
1705 | - <th scope="row"><?php echo $lang_admin_prune['Prune from label'] ?></th> |
1706 | - <td> |
1707 | - <select name="prune_from" tabindex="3"> |
1708 | - <option value="all"><?php echo $lang_admin_prune['All forums'] ?></option> |
1709 | -<?php |
1710 | - |
1711 | - $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
1712 | - |
1713 | - $cur_category = 0; |
1714 | - while ($forum = $db->fetch_assoc($result)) |
1715 | - { |
1716 | - if ($forum['cid'] != $cur_category) // Are we still in the same category? |
1717 | - { |
1718 | - if ($cur_category) |
1719 | - echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n"; |
1720 | - |
1721 | - echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n"; |
1722 | - $cur_category = $forum['cid']; |
1723 | - } |
1724 | - |
1725 | - echo "\t\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.pun_htmlspecialchars($forum['forum_name']).'</option>'."\n"; |
1726 | - } |
1727 | - |
1728 | -?> |
1729 | - </optgroup> |
1730 | - </select> |
1731 | - <span><?php echo $lang_admin_prune['Prune from help'] ?></span> |
1732 | - </td> |
1733 | - </tr> |
1734 | - </table> |
1735 | - <p class="topspace"><?php printf($lang_admin_prune['Prune info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p> |
1736 | - <div class="fsetsubmit"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="5" /></div> |
1737 | - </div> |
1738 | - </fieldset> |
1739 | - </div> |
1740 | - </form> |
1741 | - </div> |
1742 | - </div> |
1743 | - <div class="clearer"></div> |
1744 | -</div> |
1745 | -<?php |
1746 | - |
1747 | - require PUN_ROOT.'footer.php'; |
1748 | -} |
1749 | |
1750 | === modified file 'admin_ranks.php' |
1751 | --- admin_ranks.php 2010-10-08 13:18:35 +0000 |
1752 | +++ admin_ranks.php 2011-04-21 10:05:56 +0000 |
1753 | @@ -1,7 +1,7 @@ |
1754 | <?php |
1755 | |
1756 | /** |
1757 | - * Copyright (C) 2008-2010 FluxBB |
1758 | + * Copyright (C) 2008-2011 FluxBB |
1759 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1760 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1761 | */ |
1762 | @@ -9,7 +9,7 @@ |
1763 | // Tell header.php to use the admin template |
1764 | define('PUN_ADMIN_CONSOLE', 1); |
1765 | |
1766 | -define('PUN_ROOT', './'); |
1767 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1768 | require PUN_ROOT.'include/common.php'; |
1769 | require PUN_ROOT.'include/common_admin.php'; |
1770 | |
1771 | @@ -113,7 +113,7 @@ |
1772 | <div class="blockform"> |
1773 | <h2><span><?php echo $lang_admin_ranks['Ranks head'] ?></span></h2> |
1774 | <div class="box"> |
1775 | - <form id="ranks" method="post" action="admin_ranks.php?action=foo"> |
1776 | + <form id="ranks" method="post" action="admin_ranks.php"> |
1777 | <div class="inform"> |
1778 | <fieldset> |
1779 | <legend><?php echo $lang_admin_ranks['Add rank subhead'] ?></legend> |
1780 | |
1781 | === modified file 'admin_reports.php' |
1782 | --- admin_reports.php 2010-10-08 13:18:35 +0000 |
1783 | +++ admin_reports.php 2011-04-21 10:05:56 +0000 |
1784 | @@ -1,7 +1,7 @@ |
1785 | <?php |
1786 | |
1787 | /** |
1788 | - * Copyright (C) 2008-2010 FluxBB |
1789 | + * Copyright (C) 2008-2011 FluxBB |
1790 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1791 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1792 | */ |
1793 | @@ -9,7 +9,7 @@ |
1794 | // Tell header.php to use the admin template |
1795 | define('PUN_ADMIN_CONSOLE', 1); |
1796 | |
1797 | -define('PUN_ROOT', './'); |
1798 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1799 | require PUN_ROOT.'include/common.php'; |
1800 | require PUN_ROOT.'include/common_admin.php'; |
1801 | |
1802 | @@ -33,6 +33,14 @@ |
1803 | if ($zapped == '') |
1804 | $db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $db->error()); |
1805 | |
1806 | + // Delete old reports (which cannot be viewed anyway) |
1807 | + $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10,1') or error('Unable to fetch read reports to delete', __FILE__, __LINE__, $db->error()); |
1808 | + if ($db->num_rows($result) > 0) |
1809 | + { |
1810 | + $zapped_threshold = $db->result($result); |
1811 | + $db->query('DELETE FROM '.$db->prefix.'reports WHERE zapped <= '.$zapped_threshold) or error('Unable to delete old read reports', __FILE__, __LINE__, $db->error()); |
1812 | + } |
1813 | + |
1814 | redirect('admin_reports.php', $lang_admin_reports['Report zapped redirect']); |
1815 | } |
1816 | |
1817 | @@ -60,7 +68,7 @@ |
1818 | $forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang_admin_reports['Deleted'].'</span>'; |
1819 | $topic = ($cur_report['subject'] != '') ? '<span>» <a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>'; |
1820 | $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])); |
1821 | - $post_id = ($cur_report['pid'] != '') ? '<span>» <a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">Post #'.$cur_report['pid'].'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>'; |
1822 | + $post_id = ($cur_report['pid'] != '') ? '<span>» <a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>'; |
1823 | $report_location = array($forum, $topic, $post_id); |
1824 | |
1825 | ?> |
1826 | @@ -122,7 +130,7 @@ |
1827 | $forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang_admin_reports['Deleted'].'</span>'; |
1828 | $topic = ($cur_report['subject'] != '') ? '<span>» <a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>'; |
1829 | $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])); |
1830 | - $post_id = ($cur_report['pid'] != '') ? '<span>» <a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">Post #'.$cur_report['pid'].'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>'; |
1831 | + $post_id = ($cur_report['pid'] != '') ? '<span>» <a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>'; |
1832 | $zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.pun_htmlspecialchars($cur_report['zapped_by']).'</a>' : $lang_admin_reports['NA']; |
1833 | $zapped_by = ($cur_report['zapped_by'] != '') ? '<strong>'.pun_htmlspecialchars($cur_report['zapped_by']).'</strong>' : $lang_admin_reports['NA']; |
1834 | $report_location = array($forum, $topic, $post_id); |
1835 | @@ -173,4 +181,4 @@ |
1836 | </div> |
1837 | <?php |
1838 | |
1839 | -require PUN_ROOT.'footer.php'; |
1840 | \ No newline at end of file |
1841 | +require PUN_ROOT.'footer.php'; |
1842 | |
1843 | === modified file 'admin_users.php' |
1844 | --- admin_users.php 2010-10-08 13:18:35 +0000 |
1845 | +++ admin_users.php 2011-04-21 10:05:56 +0000 |
1846 | @@ -1,7 +1,7 @@ |
1847 | <?php |
1848 | |
1849 | /** |
1850 | - * Copyright (C) 2008-2010 FluxBB |
1851 | + * Copyright (C) 2008-2011 FluxBB |
1852 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1853 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1854 | */ |
1855 | @@ -9,7 +9,7 @@ |
1856 | // Tell header.php to use the admin template |
1857 | define('PUN_ADMIN_CONSOLE', 1); |
1858 | |
1859 | -define('PUN_ROOT', './'); |
1860 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
1861 | require PUN_ROOT.'include/common.php'; |
1862 | require PUN_ROOT.'include/common_admin.php'; |
1863 | |
1864 | @@ -194,7 +194,7 @@ |
1865 | { |
1866 | $user_title = get_title($user_data); |
1867 | |
1868 | - $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">'.$lang_admin_users['Results view IP link'].'</a> <br/> <a href="search.php?action=show_user&user_id='.$user_data['id'].'">'.$lang_admin_users['Results show posts link'].'</a>'; |
1869 | + $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">'.$lang_admin_users['Results view IP link'].'</a> | <a href="search.php?action=show_user_posts&user_id='.$user_data['id'].'">'.$lang_admin_users['Results show posts link'].'</a>'; |
1870 | |
1871 | ?> |
1872 | <tr> |
1873 | @@ -253,6 +253,419 @@ |
1874 | } |
1875 | |
1876 | |
1877 | +// Move multiple users to other user groups |
1878 | +else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) |
1879 | +{ |
1880 | + if ($pun_user['g_id'] > PUN_ADMIN) |
1881 | + message($lang_common['No permission']); |
1882 | + |
1883 | + confirm_referrer('admin_users.php'); |
1884 | + |
1885 | + if (isset($_POST['users'])) |
1886 | + { |
1887 | + $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
1888 | + $user_ids = array_map('intval', $user_ids); |
1889 | + |
1890 | + // Delete invalid IDs |
1891 | + $user_ids = array_diff($user_ids, array(0, 1)); |
1892 | + } |
1893 | + else |
1894 | + $user_ids = array(); |
1895 | + |
1896 | + if (empty($user_ids)) |
1897 | + message($lang_admin_users['No users selected']); |
1898 | + |
1899 | + // Are we trying to batch move any admins? |
1900 | + $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
1901 | + if ($db->result($result) > 0) |
1902 | + message($lang_admin_users['No move admins message']); |
1903 | + |
1904 | + // Fetch all user groups |
1905 | + $all_groups = array(); |
1906 | + $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id NOT IN ('.PUN_GUEST.','.PUN_ADMIN.') ORDER BY g_title ASC') or error('Unable to fetch groups', __FILE__, __LINE__, $db->error()); |
1907 | + while ($row = $db->fetch_row($result)) |
1908 | + $all_groups[$row[0]] = $row[1]; |
1909 | + |
1910 | + if (isset($_POST['move_users_comply'])) |
1911 | + { |
1912 | + $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); |
1913 | + |
1914 | + // Is the new group a moderator group? |
1915 | + $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$new_group) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
1916 | + $new_group_mod = $db->result($result); |
1917 | + |
1918 | + // Fetch user groups |
1919 | + $user_groups = array(); |
1920 | + $result = $db->query('SELECT id, group_id FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error()); |
1921 | + while ($cur_user = $db->fetch_assoc($result)) |
1922 | + { |
1923 | + if (!isset($user_groups[$cur_user['group_id']])) |
1924 | + $user_groups[$cur_user['group_id']] = array(); |
1925 | + |
1926 | + $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
1927 | + } |
1928 | + |
1929 | + // Are any users moderators? |
1930 | + $group_ids = array_keys($user_groups); |
1931 | + $result = $db->query('SELECT g_id, g_moderator FROM '.$db->prefix.'groups WHERE g_id IN ('.implode(',', $group_ids).')') or error('Unable to fetch group moderators', __FILE__, __LINE__, $db->error()); |
1932 | + while ($cur_group = $db->fetch_assoc($result)) |
1933 | + { |
1934 | + if ($cur_group['g_moderator'] == '0') |
1935 | + unset($user_groups[$cur_group['g_id']]); |
1936 | + } |
1937 | + |
1938 | + if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') |
1939 | + { |
1940 | + // Fetch forum list and clean up their moderator list |
1941 | + $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
1942 | + while ($cur_forum = $db->fetch_assoc($result)) |
1943 | + { |
1944 | + $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
1945 | + |
1946 | + foreach ($user_groups as $group_users) |
1947 | + $cur_moderators = array_diff($cur_moderators, $group_users); |
1948 | + |
1949 | + $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
1950 | + $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); |
1951 | + } |
1952 | + } |
1953 | + |
1954 | + // Change user group |
1955 | + $db->query('UPDATE '.$db->prefix.'users SET group_id='.$new_group.' WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to change user group', __FILE__, __LINE__, $db->error()); |
1956 | + |
1957 | + redirect('admin_users.php', $lang_admin_users['Users move redirect']); |
1958 | + } |
1959 | + |
1960 | + $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Move users']); |
1961 | + define('PUN_ACTIVE_PAGE', 'admin'); |
1962 | + require PUN_ROOT.'header.php'; |
1963 | + |
1964 | + generate_admin_menu('users'); |
1965 | + |
1966 | +?> |
1967 | + <div class="blockform"> |
1968 | + <h2><span><?php echo $lang_admin_users['Move users'] ?></span></h2> |
1969 | + <div class="box"> |
1970 | + <form name="confirm_move_users" method="post" action="admin_users.php"> |
1971 | + <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
1972 | + <div class="inform"> |
1973 | + <fieldset> |
1974 | + <legend><?php echo $lang_admin_users['Move users subhead'] ?></legend> |
1975 | + <div class="infldset"> |
1976 | + <table class="aligntop" cellspacing="0"> |
1977 | + <tr> |
1978 | + <th scope="row"><?php echo $lang_admin_users['New group label'] ?></th> |
1979 | + <td> |
1980 | + <select name="new_group" tabindex="1"> |
1981 | +<?php foreach ($all_groups as $gid => $group) : ?> <option value="<?php echo $gid ?>"><?php echo pun_htmlspecialchars($group) ?></option> |
1982 | +<?php endforeach; ?> |
1983 | + </select> |
1984 | + <span><?php echo $lang_admin_users['New group help'] ?></span> |
1985 | + </td> |
1986 | + </tr> |
1987 | + </table> |
1988 | + </div> |
1989 | + </fieldset> |
1990 | + </div> |
1991 | + <p class="submitend"><input type="submit" name="move_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="2" /></p> |
1992 | + </form> |
1993 | + </div> |
1994 | + </div> |
1995 | + <div class="clearer"></div> |
1996 | +</div> |
1997 | +<?php |
1998 | + |
1999 | + require PUN_ROOT.'footer.php'; |
2000 | +} |
2001 | + |
2002 | + |
2003 | +// Delete multiple users |
2004 | +else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) |
2005 | +{ |
2006 | + if ($pun_user['g_id'] > PUN_ADMIN) |
2007 | + message($lang_common['No permission']); |
2008 | + |
2009 | + confirm_referrer('admin_users.php'); |
2010 | + |
2011 | + if (isset($_POST['users'])) |
2012 | + { |
2013 | + $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
2014 | + $user_ids = array_map('intval', $user_ids); |
2015 | + |
2016 | + // Delete invalid IDs |
2017 | + $user_ids = array_diff($user_ids, array(0, 1)); |
2018 | + } |
2019 | + else |
2020 | + $user_ids = array(); |
2021 | + |
2022 | + if (empty($user_ids)) |
2023 | + message($lang_admin_users['No users selected']); |
2024 | + |
2025 | + // Are we trying to delete any admins? |
2026 | + $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
2027 | + if ($db->result($result) > 0) |
2028 | + message($lang_admin_users['No delete admins message']); |
2029 | + |
2030 | + if (isset($_POST['delete_users_comply'])) |
2031 | + { |
2032 | + // Fetch user groups |
2033 | + $user_groups = array(); |
2034 | + $result = $db->query('SELECT id, group_id FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error()); |
2035 | + while ($cur_user = $db->fetch_assoc($result)) |
2036 | + { |
2037 | + if (!isset($user_groups[$cur_user['group_id']])) |
2038 | + $user_groups[$cur_user['group_id']] = array(); |
2039 | + |
2040 | + $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
2041 | + } |
2042 | + |
2043 | + // Are any users moderators? |
2044 | + $group_ids = array_keys($user_groups); |
2045 | + $result = $db->query('SELECT g_id, g_moderator FROM '.$db->prefix.'groups WHERE g_id IN ('.implode(',', $group_ids).')') or error('Unable to fetch group moderators', __FILE__, __LINE__, $db->error()); |
2046 | + while ($cur_group = $db->fetch_assoc($result)) |
2047 | + { |
2048 | + if ($cur_group['g_moderator'] == '0') |
2049 | + unset($user_groups[$cur_group['g_id']]); |
2050 | + } |
2051 | + |
2052 | + // Fetch forum list and clean up their moderator list |
2053 | + $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
2054 | + while ($cur_forum = $db->fetch_assoc($result)) |
2055 | + { |
2056 | + $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
2057 | + |
2058 | + foreach ($user_groups as $group_users) |
2059 | + $cur_moderators = array_diff($cur_moderators, $group_users); |
2060 | + |
2061 | + $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
2062 | + $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); |
2063 | + } |
2064 | + |
2065 | + // Delete any subscriptions |
2066 | + $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to delete topic subscriptions', __FILE__, __LINE__, $db->error()); |
2067 | + $db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to delete forum subscriptions', __FILE__, __LINE__, $db->error()); |
2068 | + |
2069 | + // Remove them from the online list (if they happen to be logged in) |
2070 | + $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to remove users from online list', __FILE__, __LINE__, $db->error()); |
2071 | + |
2072 | + // Should we delete all posts made by these users? |
2073 | + if (isset($_POST['delete_posts'])) |
2074 | + { |
2075 | + require PUN_ROOT.'include/search_idx.php'; |
2076 | + @set_time_limit(0); |
2077 | + |
2078 | + // Find all posts made by this user |
2079 | + $result = $db->query('SELECT p.id, p.topic_id, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE p.poster_id IN ('.implode(',', $user_ids).')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); |
2080 | + if ($db->num_rows($result)) |
2081 | + { |
2082 | + while ($cur_post = $db->fetch_assoc($result)) |
2083 | + { |
2084 | + // Determine whether this post is the "topic post" or not |
2085 | + $result2 = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
2086 | + |
2087 | + if ($db->result($result2) == $cur_post['id']) |
2088 | + delete_topic($cur_post['topic_id']); |
2089 | + else |
2090 | + delete_post($cur_post['id'], $cur_post['topic_id']); |
2091 | + |
2092 | + update_forum($cur_post['forum_id']); |
2093 | + } |
2094 | + } |
2095 | + } |
2096 | + else |
2097 | + // Set all their posts to guest |
2098 | + $db->query('UPDATE '.$db->prefix.'posts SET poster_id=1 WHERE poster_id IN ('.implode(',', $user_ids).')') or error('Unable to update posts', __FILE__, __LINE__, $db->error()); |
2099 | + |
2100 | + // Delete the users |
2101 | + $db->query('DELETE FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to delete users', __FILE__, __LINE__, $db->error()); |
2102 | + |
2103 | + // Delete user avatars |
2104 | + foreach ($user_ids as $user_id) |
2105 | + delete_avatar($user_id); |
2106 | + |
2107 | + redirect('admin_users.php', $lang_admin_users['Users delete redirect']); |
2108 | + } |
2109 | + |
2110 | + $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); |
2111 | + define('PUN_ACTIVE_PAGE', 'admin'); |
2112 | + require PUN_ROOT.'header.php'; |
2113 | + |
2114 | + generate_admin_menu('users'); |
2115 | + |
2116 | +?> |
2117 | + <div class="blockform"> |
2118 | + <h2><span><?php echo $lang_admin_users['Delete users'] ?></span></h2> |
2119 | + <div class="box"> |
2120 | + <form name="confirm_del_users" method="post" action="admin_users.php"> |
2121 | + <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
2122 | + <div class="inform"> |
2123 | + <fieldset> |
2124 | + <legend><?php echo $lang_admin_users['Confirm delete legend'] ?></legend> |
2125 | + <div class="infldset"> |
2126 | + <p><?php echo $lang_admin_users['Confirm delete info'] ?></p> |
2127 | + <div class="rbox"> |
2128 | + <label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_admin_users['Delete posts'] ?><br /></label> |
2129 | + </div> |
2130 | + <p class="warntext"><strong><?php echo $lang_admin_users['Delete warning'] ?></strong></p> |
2131 | + </div> |
2132 | + </fieldset> |
2133 | + </div> |
2134 | + <p class="buttons"><input type="submit" name="delete_users_comply" value="<?php echo $lang_admin_users['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> |
2135 | + </form> |
2136 | + </div> |
2137 | + </div> |
2138 | + <div class="clearer"></div> |
2139 | +</div> |
2140 | +<?php |
2141 | + |
2142 | + require PUN_ROOT.'footer.php'; |
2143 | +} |
2144 | + |
2145 | + |
2146 | +// Ban multiple users |
2147 | +else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) |
2148 | +{ |
2149 | + if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
2150 | + message($lang_common['No permission']); |
2151 | + |
2152 | + confirm_referrer('admin_users.php'); |
2153 | + |
2154 | + if (isset($_POST['users'])) |
2155 | + { |
2156 | + $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
2157 | + $user_ids = array_map('intval', $user_ids); |
2158 | + |
2159 | + // Delete invalid IDs |
2160 | + $user_ids = array_diff($user_ids, array(0, 1)); |
2161 | + } |
2162 | + else |
2163 | + $user_ids = array(); |
2164 | + |
2165 | + if (empty($user_ids)) |
2166 | + message($lang_admin_users['No users selected']); |
2167 | + |
2168 | + // Are we trying to ban any admins? |
2169 | + $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
2170 | + if ($db->result($result) > 0) |
2171 | + message($lang_admin_users['No ban admins message']); |
2172 | + |
2173 | + // Also, we cannot ban moderators |
2174 | + $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id WHERE g.g_moderator=1 AND u.id IN ('.implode(',', $user_ids).')') or error('Unable to fetch moderator group info', __FILE__, __LINE__, $db->error()); |
2175 | + if ($db->result($result) > 0) |
2176 | + message($lang_admin_users['No ban mods message']); |
2177 | + |
2178 | + if (isset($_POST['ban_users_comply'])) |
2179 | + { |
2180 | + $ban_message = pun_trim($_POST['ban_message']); |
2181 | + $ban_expire = pun_trim($_POST['ban_expire']); |
2182 | + $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; |
2183 | + |
2184 | + if ($ban_expire != '' && $ban_expire != 'Never') |
2185 | + { |
2186 | + $ban_expire = strtotime($ban_expire.' GMT'); |
2187 | + |
2188 | + if ($ban_expire == -1 || !$ban_expire) |
2189 | + message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
2190 | + |
2191 | + $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; |
2192 | + $ban_expire -= $diff; |
2193 | + |
2194 | + if ($ban_expire <= time()) |
2195 | + message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
2196 | + } |
2197 | + else |
2198 | + $ban_expire = 'NULL'; |
2199 | + |
2200 | + $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; |
2201 | + |
2202 | + // Fetch user information |
2203 | + $user_info = array(); |
2204 | + $result = $db->query('SELECT id, username, email, registration_ip FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
2205 | + while ($cur_user = $db->fetch_assoc($result)) |
2206 | + $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); |
2207 | + |
2208 | + // Overwrite the registration IP with one from the last post (if it exists) |
2209 | + if ($ban_the_ip != 0) |
2210 | + { |
2211 | + $result = $db->query('SELECT p.poster_id, p.poster_ip FROM '.$db->prefix.'posts AS p INNER JOIN (SELECT MAX(id) AS id FROM '.$db->prefix.'posts WHERE poster_id IN ('.implode(',', $user_ids).') GROUP BY poster_id) AS i ON p.id=i.id') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
2212 | + while ($cur_address = $db->fetch_assoc($result)) |
2213 | + $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; |
2214 | + } |
2215 | + |
2216 | + // And insert the bans! |
2217 | + foreach ($user_ids as $user_id) |
2218 | + { |
2219 | + $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; |
2220 | + $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; |
2221 | + $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; |
2222 | + |
2223 | + $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire, ban_creator) VALUES('.$ban_username.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.', '.$pun_user['id'].')') or error('Unable to add ban', __FILE__, __LINE__, $db->error()); |
2224 | + } |
2225 | + |
2226 | + // Regenerate the bans cache |
2227 | + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
2228 | + require PUN_ROOT.'include/cache.php'; |
2229 | + |
2230 | + generate_bans_cache(); |
2231 | + |
2232 | + redirect('admin_users.php', $lang_admin_users['Users banned redirect']); |
2233 | + } |
2234 | + |
2235 | + $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); |
2236 | + $focus_element = array('bans2', 'ban_message'); |
2237 | + define('PUN_ACTIVE_PAGE', 'admin'); |
2238 | + require PUN_ROOT.'header.php'; |
2239 | + |
2240 | + generate_admin_menu('users'); |
2241 | + |
2242 | +?> |
2243 | + <div class="blockform"> |
2244 | + <h2><span><?php echo $lang_admin_users['Ban users'] ?></span></h2> |
2245 | + <div class="box"> |
2246 | + <form id="bans2" name="confirm_ban_users" method="post" action="admin_users.php"> |
2247 | + <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
2248 | + <div class="inform"> |
2249 | + <fieldset> |
2250 | + <legend><?php echo $lang_admin_users['Message expiry subhead'] ?></legend> |
2251 | + <div class="infldset"> |
2252 | + <table class="aligntop" cellspacing="0"> |
2253 | + <tr> |
2254 | + <th scope="row"><?php echo $lang_admin_users['Ban message label'] ?></th> |
2255 | + <td> |
2256 | + <input type="text" name="ban_message" size="50" maxlength="255" tabindex="1" /> |
2257 | + <span><?php echo $lang_admin_users['Ban message help'] ?></span> |
2258 | + </td> |
2259 | + </tr> |
2260 | + <tr> |
2261 | + <th scope="row"><?php echo $lang_admin_users['Expire date label'] ?></th> |
2262 | + <td> |
2263 | + <input type="text" name="ban_expire" size="17" maxlength="10" tabindex="2" /> |
2264 | + <span><?php echo $lang_admin_users['Expire date help'] ?></span> |
2265 | + </td> |
2266 | + </tr> |
2267 | + <tr> |
2268 | + <th scope="row"><?php echo $lang_admin_users['Ban IP label'] ?></th> |
2269 | + <td> |
2270 | + <input type="radio" name="ban_the_ip" tabindex="3" value="1" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="ban_the_ip" tabindex="4" value="0" checked="checked" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
2271 | + <span><?php echo $lang_admin_users['Ban IP help'] ?></span> |
2272 | + </td> |
2273 | + </tr> |
2274 | + </table> |
2275 | + </div> |
2276 | + </fieldset> |
2277 | + </div> |
2278 | + <p class="submitend"><input type="submit" name="ban_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="3" /></p> |
2279 | + </form> |
2280 | + </div> |
2281 | + </div> |
2282 | + <div class="clearer"></div> |
2283 | +</div> |
2284 | +<?php |
2285 | + |
2286 | + require PUN_ROOT.'footer.php'; |
2287 | +} |
2288 | + |
2289 | + |
2290 | else if (isset($_GET['find_user'])) |
2291 | { |
2292 | $form = isset($_GET['form']) ? $_GET['form'] : array(); |
2293 | @@ -356,8 +769,14 @@ |
2294 | |
2295 | // Generate paging links |
2296 | $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); |
2297 | + |
2298 | + // Some helper variables for permissions |
2299 | + $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; |
2300 | + $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); |
2301 | + $can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0; |
2302 | |
2303 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); |
2304 | + $page_head = array('js' => '<script type="text/javascript" src="common.js"></script>'); |
2305 | define('PUN_ACTIVE_PAGE', 'admin'); |
2306 | require PUN_ROOT.'header.php'; |
2307 | |
2308 | @@ -377,6 +796,7 @@ |
2309 | </div> |
2310 | |
2311 | |
2312 | +<form id="search-users-form" action="admin_users.php" method="post"> |
2313 | <div id="users2" class="blocktable"> |
2314 | <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> |
2315 | <div class="box"> |
2316 | @@ -390,6 +810,8 @@ |
2317 | <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> |
2318 | <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> |
2319 | <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> |
2320 | +<?php if ($can_action): ?> <th class="tcmod" scope="col"><?php echo $lang_admin_users['Select'] ?></th> |
2321 | +<?php endif; ?> |
2322 | </tr> |
2323 | </thead> |
2324 | <tbody> |
2325 | @@ -406,7 +828,7 @@ |
2326 | if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) |
2327 | $user_title = '<span class="warntext">'.$lang_admin_users['Not verified'].'</span>'; |
2328 | |
2329 | - $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">'.$lang_admin_users['Results view IP link'].'</a> | <a href="search.php?action=show_user&user_id='.$user_data['id'].'">'.$lang_admin_users['Results show posts link'].'</a>'; |
2330 | + $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">'.$lang_admin_users['Results view IP link'].'</a> | <a href="search.php?action=show_user_posts&user_id='.$user_data['id'].'">'.$lang_admin_users['Results show posts link'].'</a>'; |
2331 | |
2332 | ?> |
2333 | <tr> |
2334 | @@ -416,6 +838,8 @@ |
2335 | <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> |
2336 | <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> |
2337 | <td class="tcr"><?php echo $actions ?></td> |
2338 | +<?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> |
2339 | +<?php endif; ?> |
2340 | </tr> |
2341 | <?php |
2342 | |
2343 | @@ -435,6 +859,8 @@ |
2344 | <div class="inbox crumbsplus"> |
2345 | <div class="pagepost"> |
2346 | <p class="pagelink"><?php echo $paging_links ?></p> |
2347 | +<?php if ($can_action): ?> <p class="conr modbuttons"><a href="#" onclick="return select_checkboxes('search-users-form', this, '<?php echo $lang_admin_users['Unselect all'] ?>')"><?php echo $lang_admin_users['Select all'] ?></a> <?php if ($can_ban) : ?><input type="submit" name="ban_users" value="<?php echo $lang_admin_users['Ban'] ?>" /><?php endif; if ($can_delete) : ?><input type="submit" name="delete_users" value="<?php echo $lang_admin_users['Delete'] ?>" /><?php endif; if ($can_move) : ?><input type="submit" name="move_users" value="<?php echo $lang_admin_users['Change group'] ?>" /><?php endif; ?></p> |
2348 | +<?php endif; ?> |
2349 | </div> |
2350 | <ul class="crumbs"> |
2351 | <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> |
2352 | @@ -444,6 +870,7 @@ |
2353 | <div class="clearer"></div> |
2354 | </div> |
2355 | </div> |
2356 | +</form> |
2357 | <?php |
2358 | |
2359 | require PUN_ROOT.'footer.php'; |
2360 | @@ -453,7 +880,7 @@ |
2361 | else |
2362 | { |
2363 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users']); |
2364 | - $focus_element = array('find_user', 'username'); |
2365 | + $focus_element = array('find_user', 'form[username]'); |
2366 | define('PUN_ACTIVE_PAGE', 'admin'); |
2367 | require PUN_ROOT.'header.php'; |
2368 | |
2369 | |
2370 | === modified file 'cache/.htaccess' (properties changed: +x to -x) |
2371 | === modified file 'cache/index.html' (properties changed: +x to -x) |
2372 | === added file 'common.js' |
2373 | --- common.js 1970-01-01 00:00:00 +0000 |
2374 | +++ common.js 2011-04-21 10:05:56 +0000 |
2375 | @@ -0,0 +1,32 @@ |
2376 | + |
2377 | +function select_checkboxes(curFormId, link, new_string) |
2378 | +{ |
2379 | + var curForm = document.getElementById(curFormId); |
2380 | + var inputlist = curForm.getElementsByTagName("input"); |
2381 | + for (i = 0; i < inputlist.length; i++) |
2382 | + { |
2383 | + if (inputlist[i].getAttribute("type") == 'checkbox' && inputlist[i].disabled == false) |
2384 | + inputlist[i].checked = true; |
2385 | + } |
2386 | + |
2387 | + link.setAttribute('onclick', 'return unselect_checkboxes(\'' + curFormId + '\', this, \'' + link.innerHTML + '\')'); |
2388 | + link.innerHTML = new_string; |
2389 | + |
2390 | + return false; |
2391 | +} |
2392 | + |
2393 | +function unselect_checkboxes(curFormId, link, new_string) |
2394 | +{ |
2395 | + var curForm = document.getElementById(curFormId); |
2396 | + var inputlist = curForm.getElementsByTagName("input"); |
2397 | + for (i = 0; i < inputlist.length; i++) |
2398 | + { |
2399 | + if (inputlist[i].getAttribute("type") == 'checkbox' && inputlist[i].disabled == false) |
2400 | + inputlist[i].checked = false; |
2401 | + } |
2402 | + |
2403 | + link.setAttribute('onclick', 'return select_checkboxes(\'' + curFormId + '\', this, \'' + link.innerHTML + '\')'); |
2404 | + link.innerHTML = new_string; |
2405 | + |
2406 | + return false; |
2407 | +} |
2408 | \ No newline at end of file |
2409 | |
2410 | === modified file 'db_update.php' |
2411 | --- db_update.php 2010-10-08 13:18:35 +0000 |
2412 | +++ db_update.php 2011-04-21 10:05:56 +0000 |
2413 | @@ -1,19 +1,19 @@ |
2414 | <?php |
2415 | |
2416 | /** |
2417 | - * Copyright (C) 2008-2010 FluxBB |
2418 | + * Copyright (C) 2008-2011 FluxBB |
2419 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
2420 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
2421 | */ |
2422 | |
2423 | // The FluxBB version this script updates to |
2424 | -define('UPDATE_TO', '1.4.2'); |
2425 | - |
2426 | -define('UPDATE_TO_DB_REVISION', 8); |
2427 | -define('UPDATE_TO_SI_REVISION', 1); |
2428 | -define('UPDATE_TO_PARSER_REVISION', 1); |
2429 | - |
2430 | -define('MIN_PHP_VERSION', '4.3.0'); |
2431 | +define('UPDATE_TO', '1.4.5'); |
2432 | + |
2433 | +define('UPDATE_TO_DB_REVISION', 11); |
2434 | +define('UPDATE_TO_SI_REVISION', 2); |
2435 | +define('UPDATE_TO_PARSER_REVISION', 2); |
2436 | + |
2437 | +define('MIN_PHP_VERSION', '4.4.0'); |
2438 | define('MIN_MYSQL_VERSION', '4.1.2'); |
2439 | define('MIN_PGSQL_VERSION', '7.0.0'); |
2440 | define('PUN_SEARCH_MIN_WORD', 3); |
2441 | @@ -34,7 +34,7 @@ |
2442 | if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) |
2443 | exit('You are running PHP version '.PHP_VERSION.'. FluxBB '.UPDATE_TO.' requires at least PHP '.MIN_PHP_VERSION.' to run properly. You must upgrade your PHP installation before you can continue.'); |
2444 | |
2445 | -define('PUN_ROOT', './'); |
2446 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
2447 | |
2448 | // Attempt to load the configuration file config.php |
2449 | if (file_exists(PUN_ROOT.'config.php')) |
2450 | @@ -44,9 +44,12 @@ |
2451 | if (defined('FORUM')) |
2452 | define('PUN', FORUM); |
2453 | |
2454 | -// If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory |
2455 | +// If PUN isn't defined, config.php is missing or corrupt |
2456 | if (!defined('PUN')) |
2457 | - exit('This file must be run from the forum root directory.'); |
2458 | +{ |
2459 | + header('Location: install.php'); |
2460 | + exit; |
2461 | +} |
2462 | |
2463 | // Enable debug mode |
2464 | if (!defined('PUN_DEBUG')) |
2465 | @@ -115,12 +118,24 @@ |
2466 | // Set the connection to UTF-8 now |
2467 | $db->set_names('utf8'); |
2468 | |
2469 | +// Get the forum config |
2470 | +$result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); |
2471 | +while ($cur_config_item = $db->fetch_row($result)) |
2472 | + $pun_config[$cur_config_item[0]] = $cur_config_item[1]; |
2473 | + |
2474 | +// Load language file |
2475 | +$default_lang = $pun_config['o_default_lang']; |
2476 | + |
2477 | +if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) |
2478 | + $default_lang = 'English'; |
2479 | + |
2480 | +require PUN_ROOT.'lang/'.$default_lang.'/update.php'; |
2481 | + |
2482 | // Check current version |
2483 | -$result = $db->query('SELECT conf_value FROM '.$db->prefix.'config WHERE conf_name=\'o_cur_version\'') or error('Unable to fetch version info.', __FILE__, __LINE__, $db->error()); |
2484 | -$cur_version = $db->result($result); |
2485 | +$cur_version = $pun_config['o_cur_version']; |
2486 | |
2487 | if (version_compare($cur_version, '1.2', '<')) |
2488 | - exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.'); |
2489 | + error(sprintf($lang_update['Version mismatch error'], $db_name)); |
2490 | |
2491 | // Do some DB type specific checks |
2492 | $mysql = false; |
2493 | @@ -132,7 +147,7 @@ |
2494 | case 'mysqli_innodb': |
2495 | $mysql_info = $db->get_version(); |
2496 | if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) |
2497 | - error('You are running MySQL version '.$mysql_info['version'].'. FluxBB '.UPDATE_TO.' requires at least MySQL '.MIN_MYSQL_VERSION.' to run properly. You must upgrade your MySQL installation before you can continue.'); |
2498 | + error(sprintf($lang_update['You are running error'], 'MySQL', $mysql_info['version'], UPDATE_TO, MIN_MYSQL_VERSION)); |
2499 | |
2500 | $mysql = true; |
2501 | break; |
2502 | @@ -140,22 +155,17 @@ |
2503 | case 'pgsql': |
2504 | $pgsql_info = $db->get_version(); |
2505 | if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) |
2506 | - error('You are running PostgreSQL version '.$pgsql_info['version'].'. FluxBB '.UPDATE_TO.' requires at least PostgreSQL '.MIN_PGSQL_VERSION.' to run properly. You must upgrade your PostgreSQL installation before you can continue.'); |
2507 | + error(sprintf($lang_update['You are running error'], 'PostgreSQL', $pgsql_info['version'], UPDATE_TO, MIN_PGSQL_VERSION)); |
2508 | |
2509 | break; |
2510 | } |
2511 | |
2512 | -// Get the forum config |
2513 | -$result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); |
2514 | -while ($cur_config_item = $db->fetch_row($result)) |
2515 | - $pun_config[$cur_config_item[0]] = $cur_config_item[1]; |
2516 | - |
2517 | -// Check the database revision and the current version |
2518 | +// Check the database, search index and parser revision and the current version |
2519 | if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION && |
2520 | isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION && |
2521 | isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION && |
2522 | version_compare($pun_config['o_cur_version'], UPDATE_TO, '>=')) |
2523 | - exit('Your database is already as up-to-date as this script can make it.'); |
2524 | + error($lang_update['No update error']); |
2525 | |
2526 | $default_style = $pun_config['o_default_style']; |
2527 | if (!file_exists(PUN_ROOT.'style/'.$default_style.'.css')) |
2528 | @@ -164,9 +174,6 @@ |
2529 | // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. |
2530 | session_start(); |
2531 | |
2532 | -if (!isset($_SESSION['dupe_users'])) |
2533 | - $_SESSION['dupe_users'] = array(); |
2534 | - |
2535 | // |
2536 | // Determines whether $str is UTF-8 encoded or not |
2537 | // |
2538 | @@ -444,15 +451,14 @@ |
2539 | while (@ob_end_clean()); |
2540 | |
2541 | |
2542 | -$stage = isset($_GET['stage']) ? $_GET['stage'] : ''; |
2543 | -$old_charset = isset($_GET['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_GET['req_old_charset'])) : 'ISO-8859-1'; |
2544 | -$start_at = isset($_GET['start_at']) ? intval($_GET['start_at']) : 0; |
2545 | +$stage = isset($_REQUEST['stage']) ? $_REQUEST['stage'] : ''; |
2546 | +$old_charset = isset($_REQUEST['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_REQUEST['req_old_charset'])) : 'ISO-8859-1'; |
2547 | +$start_at = isset($_REQUEST['start_at']) ? intval($_REQUEST['start_at']) : 0; |
2548 | $query_str = ''; |
2549 | |
2550 | -switch ($stage) |
2551 | +// Show form |
2552 | +if (empty($stage)) |
2553 | { |
2554 | - // Show form |
2555 | - case '': |
2556 | |
2557 | ?> |
2558 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
2559 | @@ -460,81 +466,159 @@ |
2560 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
2561 | <head> |
2562 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
2563 | -<title>FluxBB Database Update</title> |
2564 | +<title><?php echo $lang_update['Update'] ?></title> |
2565 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
2566 | </head> |
2567 | -<body> |
2568 | +<body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;"> |
2569 | |
2570 | <div id="pundb_update" class="pun"> |
2571 | <div class="top-box"><div><!-- Top Corners --></div></div> |
2572 | <div class="punwrap"> |
2573 | |
2574 | +<div id="brdheader" class="block"> |
2575 | + <div class="box"> |
2576 | + <div id="brdtitle" class="inbox"> |
2577 | + <h1><span><?php echo $lang_update['Update'] ?></span></h1> |
2578 | + <div id="brddesc"><p><?php echo $lang_update['Update message'] ?></p><p><strong><?php echo $lang_update['Note']; ?></strong> <?php echo $lang_update['Members message']; ?></p></div> |
2579 | + </div> |
2580 | + </div> |
2581 | +</div> |
2582 | + |
2583 | +<div id="brdmain"> |
2584 | <div class="blockform"> |
2585 | - <h2><span>FluxBB Update</span></h2> |
2586 | + <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
2587 | <div class="box"> |
2588 | - <form method="get" action="<?php echo pun_htmlspecialchars($_SERVER['REQUEST_URI']) ?>" onsubmit="this.start.disabled=true"> |
2589 | - <input type="hidden" name="stage" value="start" /> |
2590 | + <form method="post" action="db_update.php"> |
2591 | + <input type="hidden" name="stage" value="start" /> |
2592 | + <div class="inform"> |
2593 | + <fieldset> |
2594 | + <legend><?php echo $lang_update['Administrator only'] ?></legend> |
2595 | + <div class="infldset"> |
2596 | + <p><?php echo $lang_update['Database password info'] ?></p> |
2597 | + <p><strong><?php echo $lang_update['Note']; ?></strong> <?php echo $lang_update['Database password note'] ?></p> |
2598 | + <label class="required"><strong><?php echo $lang_update['Database password'] ?> <span><?php echo $lang_update['Required'] ?></span></strong><br /><input type="password" id="req_db_pass" name="req_db_pass" /><br /></label> |
2599 | + </div> |
2600 | + </fieldset> |
2601 | + </div> |
2602 | <div class="inform"> |
2603 | <div class="forminfo"> |
2604 | - <p style="font-size: 1.1em">This script will update your forum database. The update procedure might take anything from a second to hours depending on the speed of the server and the size of the forum database. Don't forget to make a backup of the database before continuing.</p> |
2605 | - <p style="font-size: 1.1em">Did you read the update instructions in the documentation? If not, start there.</p> |
2606 | + <p><?php echo $lang_update['Intro 1'] ?></p> |
2607 | + <p><?php echo $lang_update['Intro 2'] ?></p> |
2608 | <?php |
2609 | |
2610 | -if (strpos($cur_version, '1.2') === 0) |
2611 | -{ |
2612 | - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) |
2613 | + if (strpos($cur_version, '1.2') === 0) |
2614 | { |
2615 | + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) |
2616 | + { |
2617 | |
2618 | ?> |
2619 | - <p style="font-size: 1.1em"><strong>IMPORTANT!</strong> FluxBB has detected that this PHP environment does not have support for the encoding mechanisms required to do UTF-8 conversion from character sets other than ISO-8859-1. What this means is that if the current character set is not ISO-8859-1, FluxBB won't be able to convert your forum database to UTF-8 and you will have to do it manually. Instructions for doing manual charset conversion can be found in the update instructions.</p> |
2620 | + <p><?php echo $lang_update['No charset conversion'] ?></p> |
2621 | <?php |
2622 | |
2623 | - } |
2624 | + } |
2625 | |
2626 | ?> |
2627 | </div> |
2628 | </div> |
2629 | <div class="inform"> |
2630 | <div class="forminfo"> |
2631 | - <p style="font-size: 1.1em"><strong>Enable conversion:</strong> When enabled this update script will, after it has made the required structural changes to the database, convert all text in the database from the current character set to UTF-8. This conversion is required if you're upgrading from version 1.2.</p> |
2632 | - <p style="font-size: 1.1em"><strong>Current character set:</strong> If the primary language in your forum is English, you can leave this at the default value. However, if your forum is non-English, you should enter the character set of the primary language pack used in the forum. <i>Getting this wrong can corrupt your database so don't just guess!</i> Note: This is required even if the old database is UTF-8.</p> |
2633 | + <p><?php echo $lang_update['Enable conversion'] ?></p> |
2634 | + <p><?php echo $lang_update['Current character set'] ?></p> |
2635 | </div> |
2636 | <fieldset> |
2637 | - <legend>Charset conversion</legend> |
2638 | + <legend><?php echo $lang_update['Charset conversion'] ?></legend> |
2639 | <div class="infldset"> |
2640 | <div class="rbox"> |
2641 | - <label><input type="checkbox" name="convert_charset" value="1" checked="checked" /><strong>Enable conversion</strong> (perform database charset conversion).<br /></label> |
2642 | + <label><input type="checkbox" name="convert_charset" value="1" checked="checked" /><?php echo $lang_update['Enable conversion label'] ?><br /></label> |
2643 | </div> |
2644 | <label> |
2645 | - <strong>Current character set</strong><br />Accept default for English forums otherwise the character set of the primary language pack.<br /> |
2646 | + <strong><?php echo $lang_update['Current character set label'] ?></strong><br /><?php echo $lang_update['Current character set info'] ?><br /> |
2647 | <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br /> |
2648 | </label> |
2649 | </div> |
2650 | </fieldset> |
2651 | <?php |
2652 | |
2653 | + } |
2654 | + else |
2655 | + echo "\t\t\t\t".'</div>'."\n"; |
2656 | + |
2657 | +?> |
2658 | + </div> |
2659 | + <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_update['Start update'] ?>" /></p> |
2660 | + </form> |
2661 | + </div> |
2662 | +</div> |
2663 | +</div> |
2664 | + |
2665 | +</div> |
2666 | +<div class="end-box"><div><!-- Bottom Corners --></div></div> |
2667 | +</div> |
2668 | + |
2669 | +</body> |
2670 | +</html> |
2671 | +<?php |
2672 | + |
2673 | + $db->end_transaction(); |
2674 | + $db->close(); |
2675 | + exit; |
2676 | + |
2677 | +} |
2678 | + |
2679 | +// Read the lock file |
2680 | +$lock = file_exists(FORUM_CACHE_DIR.'db_update.lock') ? trim(file_get_contents(FORUM_CACHE_DIR.'db_update.lock')) : false; |
2681 | +$lock_error = false; |
2682 | + |
2683 | +// Generate or fetch the UID - this confirms we have a valid admin |
2684 | +if (isset($_POST['req_db_pass'])) |
2685 | +{ |
2686 | + $req_db_pass = strtolower(trim($_POST['req_db_pass'])); |
2687 | + |
2688 | + switch ($db_type) |
2689 | + { |
2690 | + // For SQLite we compare against the database file name, since the password is left blank |
2691 | + case 'sqlite': |
2692 | + if ($req_db_pass != strtolower($db_name)) |
2693 | + error(sprintf($lang_update['Invalid file error'], 'config.php')); |
2694 | + |
2695 | + break; |
2696 | + // For everything else, check the password matches |
2697 | + default: |
2698 | + if ($req_db_pass != strtolower($db_password)) |
2699 | + error(sprintf($lang_update['Invalid password error'], 'config.php')); |
2700 | + |
2701 | + break; |
2702 | + } |
2703 | + |
2704 | + // Generate a unique id to identify this session, only if this is a valid session |
2705 | + $uid = pun_hash($req_db_pass.'|'.uniqid(rand(), true)); |
2706 | + if ($lock) // We already have a lock file |
2707 | + $lock_error = true; |
2708 | + else // Create the lock file |
2709 | + { |
2710 | + $fh = @fopen(FORUM_CACHE_DIR.'db_update.lock', 'wb'); |
2711 | + if (!$fh) |
2712 | + error(sprintf($lang_update['Unable to lock error'], 'cache')); |
2713 | + |
2714 | + fwrite($fh, $uid); |
2715 | + fclose($fh); |
2716 | + } |
2717 | +} |
2718 | +else if (isset($_GET['uid'])) |
2719 | +{ |
2720 | + $uid = trim($_GET['uid']); |
2721 | + if (!$lock || $lock != $uid) // The lock doesn't exist or doesn't match the given UID |
2722 | + $lock_error = true; |
2723 | } |
2724 | else |
2725 | - echo "\t\t\t\t".'</div>'."\n"; |
2726 | - |
2727 | -?> |
2728 | - </div> |
2729 | - <p class="buttons"><input type="submit" name="start" value="Start update" /></p> |
2730 | - </form> |
2731 | - </div> |
2732 | -</div> |
2733 | - |
2734 | -</div> |
2735 | -<div class="end-box"><div><!-- Bottom Corners --></div></div> |
2736 | -</div> |
2737 | - |
2738 | -</body> |
2739 | -</html> |
2740 | -<?php |
2741 | - |
2742 | - break; |
2743 | - |
2744 | - |
2745 | + error($lang_update['No password error']); |
2746 | + |
2747 | +// If there is an error with the lock file |
2748 | +if ($lock_error) |
2749 | + error(sprintf($lang_update['Script runs error'], FORUM_CACHE_DIR.'db_update.lock')); |
2750 | + |
2751 | +switch ($stage) |
2752 | +{ |
2753 | // Start by updating the database structure |
2754 | case 'start': |
2755 | $query_str = '?stage=preparse_posts'; |
2756 | @@ -623,6 +707,10 @@ |
2757 | if (!array_key_exists('o_feed_type', $pun_config)) |
2758 | $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_feed_type\', \'2\')') or error('Unable to insert config value \'o_feed_type\'', __FILE__, __LINE__, $db->error()); |
2759 | |
2760 | + // Insert new config option o_feed_ttl |
2761 | + if (!array_key_exists('o_feed_ttl', $pun_config)) |
2762 | + $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_feed_ttl\', \'0\')') or error('Unable to insert config value \'o_feed_ttl\'', __FILE__, __LINE__, $db->error()); |
2763 | + |
2764 | // Insert config option o_base_url which was removed in 1.3 |
2765 | if (!array_key_exists('o_base_url', $pun_config)) |
2766 | { |
2767 | @@ -961,13 +1049,46 @@ |
2768 | $db->create_table('search_words', $schema); |
2769 | } |
2770 | |
2771 | + // Rename the subscription table |
2772 | + $db->rename_table('subscriptions', 'topic_subscriptions'); |
2773 | + |
2774 | + // if we don't have the forum_subscriptions table, create it |
2775 | + if (!$db->table_exists('forum_subscriptions')) |
2776 | + { |
2777 | + $schema = array( |
2778 | + 'FIELDS' => array( |
2779 | + 'user_id' => array( |
2780 | + 'datatype' => 'INT(10) UNSIGNED', |
2781 | + 'allow_null' => false, |
2782 | + 'default' => '0' |
2783 | + ), |
2784 | + 'forum_id' => array( |
2785 | + 'datatype' => 'INT(10) UNSIGNED', |
2786 | + 'allow_null' => false, |
2787 | + 'default' => '0' |
2788 | + ) |
2789 | + ), |
2790 | + 'PRIMARY KEY' => array('user_id', 'forum_id') |
2791 | + ); |
2792 | + |
2793 | + $db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error()); |
2794 | + } |
2795 | + |
2796 | + // Insert new config option o_forum_subscriptions |
2797 | + if (!array_key_exists('o_forum_subscriptions', $pun_config)) |
2798 | + $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_forum_subscriptions\', \'1\')') or error('Unable to insert config value \'o_forum_subscriptions\'', __FILE__, __LINE__, $db->error()); |
2799 | + |
2800 | + // Rename config option o_subscriptions to o_topic_subscriptions |
2801 | + if (!array_key_exists('o_topic_subscriptions', $pun_config)) |
2802 | + $db->query('UPDATE '.$db->prefix.'config SET conf_name=\'o_topic_subscriptions\' WHERE conf_name=\'o_subscriptions\'') or error('Unable to rename config value \'o_subscriptions\'', __FILE__, __LINE__, $db->error()); |
2803 | + |
2804 | // Change the default style if the old doesn't exist anymore |
2805 | if ($pun_config['o_default_style'] != $default_style) |
2806 | $db->query('UPDATE '.$db->prefix.'config SET conf_value = \''.$db->escape($default_style).'\' WHERE conf_name = \'o_default_style\'') or error('Unable to update default style config', __FILE__, __LINE__, $db->error()); |
2807 | |
2808 | // Should we do charset conversion or not? |
2809 | - //if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) |
2810 | - // $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; |
2811 | + if (strpos($cur_version, '1.2') === 0 && isset($_POST['convert_charset'])) |
2812 | + $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; |
2813 | |
2814 | break; |
2815 | |
2816 | @@ -978,7 +1099,9 @@ |
2817 | |
2818 | function _conv_bans($cur_item, $old_charset) |
2819 | { |
2820 | - echo 'Converting ban '.$cur_item['id'].' …<br />'."\n"; |
2821 | + global $lang_update; |
2822 | + |
2823 | + echo sprintf($lang_update['Converting item'], $lang_update['ban'], $cur_item['id']).'<br />'."\n"; |
2824 | |
2825 | convert_to_utf8($cur_item['username'], $old_charset); |
2826 | convert_to_utf8($cur_item['message'], $old_charset); |
2827 | @@ -998,7 +1121,7 @@ |
2828 | case 'conv_categories': |
2829 | $query_str = '?stage=conv_censors&req_old_charset='.$old_charset; |
2830 | |
2831 | - echo 'Converting categories …'."<br />\n"; |
2832 | + echo sprintf($lang_update['Converting'], $lang_update['categories']).'<br />'."\n"; |
2833 | |
2834 | function _conv_categories($cur_item, $old_charset) |
2835 | { |
2836 | @@ -1016,7 +1139,7 @@ |
2837 | case 'conv_censors': |
2838 | $query_str = '?stage=conv_config&req_old_charset='.$old_charset; |
2839 | |
2840 | - echo 'Converting censor words …'."<br />\n"; |
2841 | + echo sprintf($lang_update['Converting'], $lang_update['censor words']).'<br />'."\n"; |
2842 | |
2843 | function _conv_censoring($cur_item, $old_charset) |
2844 | { |
2845 | @@ -1035,7 +1158,7 @@ |
2846 | case 'conv_config': |
2847 | $query_str = '?stage=conv_forums&req_old_charset='.$old_charset; |
2848 | |
2849 | - echo 'Converting configuration …'."<br />\n"; |
2850 | + echo sprintf($lang_update['Converting'], $lang_update['configuration']).'<br />'."\n"; |
2851 | |
2852 | function _conv_config($cur_item, $old_charset) |
2853 | { |
2854 | @@ -1053,7 +1176,7 @@ |
2855 | case 'conv_forums': |
2856 | $query_str = '?stage=conv_perms&req_old_charset='.$old_charset; |
2857 | |
2858 | - echo 'Converting forums …'."<br />\n"; |
2859 | + echo sprintf($lang_update['Converting'], $lang_update['forums']).'<br />'."\n"; |
2860 | |
2861 | function _conv_forums($cur_item, $old_charset) |
2862 | { |
2863 | @@ -1092,7 +1215,7 @@ |
2864 | case 'conv_groups': |
2865 | $query_str = '?stage=conv_online&req_old_charset='.$old_charset; |
2866 | |
2867 | - echo 'Converting groups …'."<br />\n"; |
2868 | + echo sprintf($lang_update['Converting'], $lang_update['groups']).'<br />'."\n"; |
2869 | |
2870 | function _conv_groups($cur_item, $old_charset) |
2871 | { |
2872 | @@ -1125,7 +1248,9 @@ |
2873 | |
2874 | function _conv_posts($cur_item, $old_charset) |
2875 | { |
2876 | - echo 'Converting post '.$cur_item['id'].' …<br />'."\n"; |
2877 | + global $lang_update; |
2878 | + |
2879 | + echo sprintf($lang_update['Converting item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
2880 | |
2881 | convert_to_utf8($cur_item['poster'], $old_charset); |
2882 | convert_to_utf8($cur_item['message'], $old_charset); |
2883 | @@ -1146,7 +1271,7 @@ |
2884 | case 'conv_ranks': |
2885 | $query_str = '?stage=conv_reports&req_old_charset='.$old_charset; |
2886 | |
2887 | - echo 'Converting ranks …'."<br />\n"; |
2888 | + echo sprintf($lang_update['Converting'], $lang_update['ranks']).'<br />'."\n"; |
2889 | |
2890 | function _conv_ranks($cur_item, $old_charset) |
2891 | { |
2892 | @@ -1166,7 +1291,9 @@ |
2893 | |
2894 | function _conv_reports($cur_item, $old_charset) |
2895 | { |
2896 | - echo 'Converting report '.$cur_item['id'].' …<br />'."\n"; |
2897 | + global $lang_update; |
2898 | + |
2899 | + echo sprintf($lang_update['Converting item'], $lang_update['report'], $cur_item['id']).'<br />'."\n"; |
2900 | |
2901 | convert_to_utf8($cur_item['message'], $old_charset); |
2902 | |
2903 | @@ -1236,7 +1363,9 @@ |
2904 | case 'conv_subscriptions': |
2905 | $query_str = '?stage=conv_topics&req_old_charset='.$old_charset; |
2906 | |
2907 | - alter_table_utf8($db->prefix.'subscriptions'); |
2908 | + // By this stage we should have already renamed the subscription table |
2909 | + alter_table_utf8($db->prefix.'topic_subscriptions'); |
2910 | + alter_table_utf8($db->prefix.'forum_subscriptions'); // This should actually already be utf8, but for consistency... |
2911 | |
2912 | break; |
2913 | |
2914 | @@ -1247,7 +1376,9 @@ |
2915 | |
2916 | function _conv_topics($cur_item, $old_charset) |
2917 | { |
2918 | - echo 'Converting topic '.$cur_item['id'].' …<br />'."\n"; |
2919 | + global $lang_update; |
2920 | + |
2921 | + echo sprintf($lang_update['Converting item'], $lang_update['topic'], $cur_item['id']).'<br />'."\n"; |
2922 | |
2923 | convert_to_utf8($cur_item['poster'], $old_charset); |
2924 | convert_to_utf8($cur_item['subject'], $old_charset); |
2925 | @@ -1268,9 +1399,14 @@ |
2926 | case 'conv_users': |
2927 | $query_str = '?stage=preparse_posts'; |
2928 | |
2929 | + if ($start_at == 0) |
2930 | + $_SESSION['dupe_users'] = array(); |
2931 | + |
2932 | function _conv_users($cur_item, $old_charset) |
2933 | { |
2934 | - echo 'Converting user '.$cur_item['id'].' …<br />'."\n"; |
2935 | + global $lang_update; |
2936 | + |
2937 | + echo sprintf($lang_update['Converting item'], $lang_update['user'], $cur_item['id']).'<br />'."\n"; |
2938 | |
2939 | convert_to_utf8($cur_item['username'], $old_charset); |
2940 | convert_to_utf8($cur_item['title'], $old_charset); |
2941 | @@ -1317,24 +1453,24 @@ |
2942 | $username = pun_trim($_POST['dupe_users'][$id]); |
2943 | |
2944 | if (pun_strlen($username) < 2) |
2945 | - $errors[$id][] = 'Usernames must be at least 2 characters long. Please choose another (longer) username.'; |
2946 | + $errors[$id][] = $lang_update['Username too short error']; |
2947 | else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
2948 | - $errors[$id][] = 'Usernames must not be more than 25 characters long. Please choose another (shorter) username.'; |
2949 | + $errors[$id][] = $lang_update['Username too long error']; |
2950 | else if (!strcasecmp($username, 'Guest')) |
2951 | - $errors[$id][] = 'The username guest is reserved. Please choose another username.'; |
2952 | + $errors[$id][] = $lang_update['Username Guest reserved error']; |
2953 | else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $username)) |
2954 | - $errors[$id][] = 'Usernames may not be in the form of an IP address. Please choose another username.'; |
2955 | + $errors[$id][] = $lang_update['Username IP format error']; |
2956 | else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
2957 | - $errors[$id][] = 'Usernames may not contain all the characters \', " and [ or ] at once. Please choose another username.'; |
2958 | + $errors[$id][] = $lang_update['Username bad characters error']; |
2959 | else if (preg_match('/(?:\[\/?(?:b|u|s|ins|del|em|i|h|colou?r|quote|code|img|url|email|list|\*)\]|\[(?:img|url|quote|list)=)/i', $username)) |
2960 | - $errors[$id][] = 'Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please choose another username.'; |
2961 | + $errors[$id][] = $lang_update['Username BBCode error']; |
2962 | |
2963 | - $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\')) AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
2964 | + $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(ucp_preg_replace('/[^\p{L}\p{N}]/u', '', $username)).'\')) AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
2965 | |
2966 | if ($db->num_rows($result)) |
2967 | { |
2968 | $busy = $db->result($result); |
2969 | - $errors[$id][] = 'Someone is already registered with the username '.pun_htmlspecialchars($busy).'. The username you entered is too similar. The username must differ from that by at least one alphanumerical character (a-z or 0-9). Please choose a different username.'; |
2970 | + $errors[$id][] = sprintf($lang_update['Username duplicate error'], pun_htmlspecialchars($busy)); |
2971 | } |
2972 | |
2973 | if (empty($errors[$id])) |
2974 | @@ -1396,7 +1532,7 @@ |
2975 | $mail_message = trim(substr($mail_tpl, $first_crlf)); |
2976 | |
2977 | $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject); |
2978 | - $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message); |
2979 | + $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); |
2980 | $mail_message = str_replace('<old_username>', $old_username, $mail_message); |
2981 | $mail_message = str_replace('<new_username>', $username, $mail_message); |
2982 | $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' Mailer', $mail_message); |
2983 | @@ -1418,7 +1554,7 @@ |
2984 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
2985 | <head> |
2986 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
2987 | -<title>FluxBB Database Update</title> |
2988 | +<title><?php echo $lang_update['Update'] ?></title> |
2989 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
2990 | </head> |
2991 | <body> |
2992 | @@ -1428,14 +1564,14 @@ |
2993 | <div class="punwrap"> |
2994 | |
2995 | <div class="blockform"> |
2996 | - <h2><span>Error converting users</span></h2> |
2997 | + <h2><span><?php echo $lang_update['Error converting users'] ?></span></h2> |
2998 | <div class="box"> |
2999 | - <form method="post" action="db_update.php?stage=conv_users_dupe"> |
3000 | + <form method="post" action="db_update.php?stage=conv_users_dupe&uid=<?php echo $uid ?>"> |
3001 | <input type="hidden" name="form_sent" value="1" /> |
3002 | <div class="inform"> |
3003 | <div class="forminfo"> |
3004 | - <p style="font-size: 1.1em">There was an error converting some users. This can occur when converting from FluxBB v1.2 if multiple users have registered with very similar usernames, for example "bob" and "böb".</p> |
3005 | - <p style="font-size: 1.1em">Below is a list of users who failed to convert. Please choose a new username for each user. Users who are renamed will automatically be sent an email alerting them of the change.</p> |
3006 | + <p style="font-size: 1.1em"><?php echo $lang_update['Error info 1'] ?></p> |
3007 | + <p style="font-size: 1.1em"><?php echo $lang_update['Error info 2'] ?></p> |
3008 | </div> |
3009 | </div> |
3010 | <?php |
3011 | @@ -1448,11 +1584,11 @@ |
3012 | <fieldset> |
3013 | <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> |
3014 | <div class="infldset"> |
3015 | - <label class="required"><strong>New username <span>(required)</span></strong><br /><input type="text" name="<?php echo 'dupe_users['.$id.']'; ?>" value="<?php if (isset($_POST['dupe_users'][$id])) echo pun_htmlspecialchars($_POST['dupe_users'][$id]); ?>" size="25" maxlength="25" /><br /></label> |
3016 | + <label class="required"><strong><?php echo $lang_update['New username'] ?> <span><?php echo $lang_update['Required'] ?></span></strong><br /><input type="text" name="<?php echo 'dupe_users['.$id.']'; ?>" value="<?php if (isset($_POST['dupe_users'][$id])) echo pun_htmlspecialchars($_POST['dupe_users'][$id]); ?>" size="25" maxlength="25" /><br /></label> |
3017 | </div> |
3018 | </fieldset> |
3019 | <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> |
3020 | - <h3>The following errors need to be corrected:</h3> |
3021 | + <h3><?php echo $lang_update['Correct errors'] ?></h3> |
3022 | <ul class="error-list"> |
3023 | <?php |
3024 | |
3025 | @@ -1467,7 +1603,7 @@ |
3026 | } |
3027 | |
3028 | ?> |
3029 | - <p class="buttons"><input type="submit" name="rename" value="Rename users" /></p> |
3030 | + <p class="buttons"><input type="submit" name="rename" value="<?php echo $lang_update['Rename users'] ?>" /></p> |
3031 | </form> |
3032 | </div> |
3033 | </div> |
3034 | @@ -1502,7 +1638,7 @@ |
3035 | $end_at = 0; |
3036 | while ($cur_item = $db->fetch_assoc($result)) |
3037 | { |
3038 | - echo 'Preparsing post '.$cur_item['id'].' …<br />'."\n"; |
3039 | + echo sprintf($lang_update['Preparsing item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
3040 | $db->query('UPDATE '.$db->prefix.'posts SET message = \''.$db->escape(preparse_bbcode($cur_item['message'], $temp)).'\' WHERE id = '.$cur_item['id']) or error('Unable to update post', __FILE__, __LINE__, $db->error()); |
3041 | |
3042 | $end_at = $cur_item['id']; |
3043 | @@ -1537,7 +1673,7 @@ |
3044 | $end_at = 0; |
3045 | while ($cur_item = $db->fetch_assoc($result)) |
3046 | { |
3047 | - echo 'Preparsing signature '.$cur_item['id'].' …<br />'."\n"; |
3048 | + echo sprintf($lang_update['Preparsing item'], $lang_update['signature'], $cur_item['id']).'<br />'."\n"; |
3049 | $db->query('UPDATE '.$db->prefix.'users SET signature = \''.$db->escape(preparse_bbcode($cur_item['signature'], $temp, true)).'\' WHERE id = '.$cur_item['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); |
3050 | |
3051 | $end_at = $cur_item['id']; |
3052 | @@ -1593,7 +1729,7 @@ |
3053 | $end_at = 0; |
3054 | while ($cur_item = $db->fetch_assoc($result)) |
3055 | { |
3056 | - echo 'Rebuilding index for post '.$cur_item['id'].' …<br />'."\n"; |
3057 | + echo sprintf($lang_update['Rebuilding index item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
3058 | |
3059 | if ($cur_item['id'] == $cur_item['first_post_id']) |
3060 | update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']); |
3061 | @@ -1646,13 +1782,16 @@ |
3062 | // Empty the PHP cache |
3063 | forum_clear_cache(); |
3064 | |
3065 | + // Delete the update lock file |
3066 | + @unlink(FORUM_CACHE_DIR.'db_update.lock'); |
3067 | + |
3068 | ?> |
3069 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
3070 | |
3071 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
3072 | <head> |
3073 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
3074 | -<title>FluxBB Database Update</title> |
3075 | +<title><?php echo $lang_update['Update'] ?></title> |
3076 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
3077 | </head> |
3078 | <body> |
3079 | @@ -1662,12 +1801,12 @@ |
3080 | <div class="punwrap"> |
3081 | |
3082 | <div class="blockform"> |
3083 | - <h2><span>FluxBB Update</span></h2> |
3084 | + <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
3085 | <div class="box"> |
3086 | <div class="fakeform"> |
3087 | <div class="inform"> |
3088 | <div class="forminfo"> |
3089 | - <p style="font-size: 1.1em">Your forum database was successfully updated. You may now <a href="<?php echo PUN_ROOT ?>index.php">go to the forum index</a>.</p> |
3090 | + <p style="font-size: 1.1em"><?php printf($lang_update['Successfully updated'], sprintf('<a href="index.php">%s</a>', $lang_update['go to index'])) ?></p> |
3091 | </div> |
3092 | </div> |
3093 | </div> |
3094 | @@ -1689,4 +1828,4 @@ |
3095 | $db->close(); |
3096 | |
3097 | if ($query_str != '') |
3098 | - exit('<script type="text/javascript">window.location="db_update.php'.$query_str.'"</script><noscript>JavaScript seems to be disabled. <a href="db_update.php'.$query_str.'">Click here to continue</a>.</noscript>'); |
3099 | + exit('<script type="text/javascript">window.location="db_update.php'.$query_str.'&uid='.$uid.'"</script><noscript>'.sprintf($lang_update['JavaScript disabled'], sprintf('<a href="db_update.php'.$query_str.'&uid='.$uid.'">%s</a>', $lang_update['Click here to continue'])).'</noscript>'); |
3100 | |
3101 | === modified file 'delete.php' |
3102 | --- delete.php 2010-10-08 13:18:35 +0000 |
3103 | +++ delete.php 2011-04-21 10:05:56 +0000 |
3104 | @@ -1,12 +1,12 @@ |
3105 | <?php |
3106 | |
3107 | /** |
3108 | - * Copyright (C) 2008-2010 FluxBB |
3109 | + * Copyright (C) 2008-2011 FluxBB |
3110 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3111 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3112 | */ |
3113 | |
3114 | -define('PUN_ROOT', './'); |
3115 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
3116 | require PUN_ROOT.'include/common.php'; |
3117 | |
3118 | |
3119 | @@ -67,7 +67,11 @@ |
3120 | delete_post($id, $cur_post['tid']); |
3121 | update_forum($cur_post['fid']); |
3122 | |
3123 | - redirect('viewtopic.php?id='.$cur_post['tid'], $lang_delete['Post del redirect']); |
3124 | + // Redirect towards the previous post |
3125 | + $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['tid'].' AND id < '.$id.' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
3126 | + $post_id = $db->result($result); |
3127 | + |
3128 | + redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_delete['Post del redirect']); |
3129 | } |
3130 | } |
3131 | |
3132 | @@ -108,7 +112,7 @@ |
3133 | |
3134 | <div id="postreview"> |
3135 | <div class="blockpost"> |
3136 | - <div class="box<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>"> |
3137 | + <div class="box"> |
3138 | <div class="inbox"> |
3139 | <div class="postbody"> |
3140 | <div class="postleft"> |
3141 | |
3142 | === modified file 'edit.php' |
3143 | --- edit.php 2010-10-08 13:18:35 +0000 |
3144 | +++ edit.php 2011-04-21 10:05:56 +0000 |
3145 | @@ -1,12 +1,12 @@ |
3146 | <?php |
3147 | |
3148 | /** |
3149 | - * Copyright (C) 2008-2010 FluxBB |
3150 | + * Copyright (C) 2008-2011 FluxBB |
3151 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3152 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3153 | */ |
3154 | |
3155 | -define('PUN_ROOT', './'); |
3156 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
3157 | require PUN_ROOT.'include/common.php'; |
3158 | |
3159 | |
3160 | @@ -19,7 +19,7 @@ |
3161 | message($lang_common['Bad request']); |
3162 | |
3163 | // Fetch some info about the post, the topic and the forum |
3164 | -$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.first_post_id, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
3165 | +$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.first_post_id, t.sticky, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
3166 | if (!$db->num_rows($result)) |
3167 | message($lang_common['Bad request']); |
3168 | |
3169 | @@ -61,8 +61,13 @@ |
3170 | { |
3171 | $subject = pun_trim($_POST['req_subject']); |
3172 | |
3173 | + if ($pun_config['o_censoring'] == '1') |
3174 | + $censored_subject = pun_trim(censor_words($subject)); |
3175 | + |
3176 | if ($subject == '') |
3177 | $errors[] = $lang_post['No subject']; |
3178 | + else if ($pun_config['o_censoring'] == '1' && $censored_subject == '') |
3179 | + $errors[] = $lang_post['No subject after censoring']; |
3180 | else if (pun_strlen($subject) > 70) |
3181 | $errors[] = $lang_post['Too long subject']; |
3182 | else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod']) |
3183 | @@ -85,22 +90,36 @@ |
3184 | $message = preparse_bbcode($message, $errors); |
3185 | } |
3186 | |
3187 | - if ($message == '') |
3188 | - $errors[] = $lang_post['No message']; |
3189 | + if (empty($errors)) |
3190 | + { |
3191 | + if ($message == '') |
3192 | + $errors[] = $lang_post['No message']; |
3193 | + else if ($pun_config['o_censoring'] == '1') |
3194 | + { |
3195 | + // Censor message to see if that causes problems |
3196 | + $censored_message = pun_trim(censor_words($message)); |
3197 | + |
3198 | + if ($censored_message == '') |
3199 | + $errors[] = $lang_post['No message after censoring']; |
3200 | + } |
3201 | + } |
3202 | |
3203 | $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0'; |
3204 | + $stick_topic = isset($_POST['stick_topic']) ? '1' : '0'; |
3205 | + if (!$is_admmod) |
3206 | + $stick_topic = $cur_post['sticky']; |
3207 | |
3208 | // Did everything go according to plan? |
3209 | if (empty($errors) && !isset($_POST['preview'])) |
3210 | { |
3211 | - $edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? $edited_sql = ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : ''; |
3212 | + $edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : ''; |
3213 | |
3214 | require PUN_ROOT.'include/search_idx.php'; |
3215 | |
3216 | if ($can_edit_subject) |
3217 | { |
3218 | // Update the topic and any redirect topics |
3219 | - $db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error()); |
3220 | + $db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\', sticky='.$stick_topic.' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error()); |
3221 | |
3222 | // We changed the subject, so we need to take that into account when we update the search words |
3223 | update_search_index('edit', $id, $message, $subject); |
3224 | @@ -214,7 +233,7 @@ |
3225 | ?> |
3226 | <ul class="bblinks"> |
3227 | <li><span><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
3228 | - <li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
3229 | + <li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1' && $pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
3230 | <li><span><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
3231 | </ul> |
3232 | </div> |
3233 | @@ -222,6 +241,14 @@ |
3234 | <?php |
3235 | |
3236 | $checkboxes = array(); |
3237 | +if ($can_edit_subject && $is_admmod) |
3238 | +{ |
3239 | + if (isset($_POST['stick_topic']) || $cur_post['sticky'] == '1') |
3240 | + $checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" checked="checked" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>'; |
3241 | + else |
3242 | + $checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>'; |
3243 | +} |
3244 | + |
3245 | if ($pun_config['o_smilies'] == '1') |
3246 | { |
3247 | if (isset($_POST['hide_smilies']) || $cur_post['hide_smilies'] == '1') |
3248 | |
3249 | === modified file 'extern.php' |
3250 | --- extern.php 2010-10-08 13:18:35 +0000 |
3251 | +++ extern.php 2011-04-21 10:05:56 +0000 |
3252 | @@ -1,7 +1,7 @@ |
3253 | <?php |
3254 | |
3255 | /** |
3256 | - * Copyright (C) 2008-2010 FluxBB |
3257 | + * Copyright (C) 2008-2011 FluxBB |
3258 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3259 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3260 | */ |
3261 | @@ -26,38 +26,38 @@ |
3262 | display posts) and type (output as HTML or RSS). The only |
3263 | mandatory variable is action. Possible/default values are: |
3264 | |
3265 | - action: feed - show most recent topics/posts (HTML or RSS) |
3266 | - online - show users online (HTML) |
3267 | - online_full - as above, but includes a full list (HTML) |
3268 | - stats - show board statistics (HTML) |
3269 | - |
3270 | - type: rss - output as RSS 2.0 |
3271 | - atom - output as Atom 1.0 |
3272 | - xml - output as XML |
3273 | - html - output as HTML (<li>'s) |
3274 | - |
3275 | - fid: One or more forum IDs (comma-separated). If ignored, |
3276 | - topics from all readable forums will be pulled. |
3277 | - |
3278 | - nfid: One or more forum IDs (comma-separated) that are to be |
3279 | - excluded. E.g. the ID of a a test forum. |
3280 | - |
3281 | - tid: A topic ID from which to show posts. If a tid is supplied, |
3282 | - fid and nfid are ignored. |
3283 | - |
3284 | - show: Any integer value between 1 and 50. The default is 15. |
3285 | - |
3286 | - order: last_post - show topics ordered by when they were last |
3287 | - posted in, giving information about the reply. |
3288 | - posted - show topics ordered by when they were first |
3289 | - posted, giving information about the original post. |
3290 | + action: feed - show most recent topics/posts (HTML or RSS) |
3291 | + online - show users online (HTML) |
3292 | + online_full - as above, but includes a full list (HTML) |
3293 | + stats - show board statistics (HTML) |
3294 | + |
3295 | + type: rss - output as RSS 2.0 |
3296 | + atom - output as Atom 1.0 |
3297 | + xml - output as XML |
3298 | + html - output as HTML (<li>'s) |
3299 | + |
3300 | + fid: One or more forum IDs (comma-separated). If ignored, |
3301 | + topics from all readable forums will be pulled. |
3302 | + |
3303 | + nfid: One or more forum IDs (comma-separated) that are to be |
3304 | + excluded. E.g. the ID of a a test forum. |
3305 | + |
3306 | + tid: A topic ID from which to show posts. If a tid is supplied, |
3307 | + fid and nfid are ignored. |
3308 | + |
3309 | + show: Any integer value between 1 and 50. The default is 15. |
3310 | + |
3311 | + order: last_post - show topics ordered by when they were last |
3312 | + posted in, giving information about the reply. |
3313 | + posted - show topics ordered by when they were first |
3314 | + posted, giving information about the original post. |
3315 | |
3316 | -----------------------------------------------------------------------------*/ |
3317 | |
3318 | define('PUN_QUIET_VISIT', 1); |
3319 | |
3320 | if (!defined('PUN_ROOT')) |
3321 | - define('PUN_ROOT', './'); |
3322 | + define('PUN_ROOT', dirname(__FILE__).'/'); |
3323 | require PUN_ROOT.'include/common.php'; |
3324 | |
3325 | // The length at which topic subjects will be truncated (for HTML output) |
3326 | @@ -119,10 +119,11 @@ |
3327 | header('Pragma: public'); |
3328 | |
3329 | echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
3330 | - echo '<rss version="2.0">'."\n"; |
3331 | + echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"; |
3332 | echo "\t".'<channel>'."\n"; |
3333 | + echo "\t\t".'<atom:link href="'.pun_htmlspecialchars(get_current_url()).'" rel="self" type="application/rss+xml" />'."\n"; |
3334 | echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; |
3335 | - echo "\t\t".'<link>'.$feed['link'].'</link>'."\n"; |
3336 | + echo "\t\t".'<link>'.pun_htmlspecialchars($feed['link']).'</link>'."\n"; |
3337 | echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; |
3338 | echo "\t\t".'<lastBuildDate>'.gmdate('r', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</lastBuildDate>'."\n"; |
3339 | |
3340 | @@ -135,11 +136,11 @@ |
3341 | { |
3342 | echo "\t\t".'<item>'."\n"; |
3343 | echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
3344 | - echo "\t\t\t".'<link>'.$item['link'].'</link>'."\n"; |
3345 | + echo "\t\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n"; |
3346 | echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; |
3347 | echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'dummy@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n"; |
3348 | echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; |
3349 | - echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n"; |
3350 | + echo "\t\t\t".'<guid>'.pun_htmlspecialchars($item['link']).'</guid>'."\n"; |
3351 | |
3352 | echo "\t\t".'</item>'."\n"; |
3353 | } |
3354 | @@ -167,7 +168,7 @@ |
3355 | |
3356 | echo "\t".'<title type="html"><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; |
3357 | echo "\t".'<link rel="self" href="'.pun_htmlspecialchars(get_current_url()).'"/>'."\n"; |
3358 | - echo "\t".'<link href="'.$feed['link'].'"/>'."\n"; |
3359 | + echo "\t".'<link href="'.pun_htmlspecialchars($feed['link']).'"/>'."\n"; |
3360 | echo "\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</updated>'."\n"; |
3361 | |
3362 | if ($pun_config['o_show_version'] == '1') |
3363 | @@ -175,7 +176,7 @@ |
3364 | else |
3365 | echo "\t".'<generator>FluxBB</generator>'."\n"; |
3366 | |
3367 | - echo "\t".'<id>'.$feed['link'].'</id>'."\n"; |
3368 | + echo "\t".'<id>'.pun_htmlspecialchars($feed['link']).'</id>'."\n"; |
3369 | |
3370 | $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; |
3371 | |
3372 | @@ -183,7 +184,7 @@ |
3373 | { |
3374 | echo "\t".'<entry>'."\n"; |
3375 | echo "\t\t".'<title type="html"><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
3376 | - echo "\t\t".'<link rel="alternate" href="'.$item['link'].'"/>'."\n"; |
3377 | + echo "\t\t".'<link rel="alternate" href="'.pun_htmlspecialchars($item['link']).'"/>'."\n"; |
3378 | echo "\t\t".'<'.$content_tag.' type="html"><![CDATA['.escape_cdata($item['description']).']]></'.$content_tag.'>'."\n"; |
3379 | echo "\t\t".'<author>'."\n"; |
3380 | echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n"; |
3381 | @@ -192,12 +193,12 @@ |
3382 | echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n"; |
3383 | |
3384 | if (isset($item['author']['uri'])) |
3385 | - echo "\t\t\t".'<uri>'.$item['author']['uri'].'</uri>'."\n"; |
3386 | + echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n"; |
3387 | |
3388 | echo "\t\t".'</author>'."\n"; |
3389 | echo "\t\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', $item['pubdate']).'</updated>'."\n"; |
3390 | |
3391 | - echo "\t\t".'<id>'.$item['link'].'</id>'."\n"; |
3392 | + echo "\t\t".'<id>'.pun_htmlspecialchars($item['link']).'</id>'."\n"; |
3393 | echo "\t".'</entry>'."\n"; |
3394 | } |
3395 | |
3396 | @@ -220,7 +221,7 @@ |
3397 | |
3398 | echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
3399 | echo '<source>'."\n"; |
3400 | - echo "\t".'<url>'.$feed['link'].'</url>'."\n"; |
3401 | + echo "\t".'<url>'.pun_htmlspecialchars($feed['link']).'</url>'."\n"; |
3402 | |
3403 | $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; |
3404 | |
3405 | @@ -229,7 +230,7 @@ |
3406 | echo "\t".'<'.$forum_tag.' id="'.$item['id'].'">'."\n"; |
3407 | |
3408 | echo "\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
3409 | - echo "\t\t".'<link>'.$item['link'].'</link>'."\n"; |
3410 | + echo "\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n"; |
3411 | echo "\t\t".'<content><![CDATA['.escape_cdata($item['description']).']]></content>'."\n"; |
3412 | echo "\t\t".'<author>'."\n"; |
3413 | echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n"; |
3414 | @@ -238,7 +239,7 @@ |
3415 | echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n"; |
3416 | |
3417 | if (isset($item['author']['uri'])) |
3418 | - echo "\t\t\t".'<uri>'.$item['author']['uri'].'</uri>'."\n"; |
3419 | + echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n"; |
3420 | |
3421 | echo "\t\t".'</author>'."\n"; |
3422 | echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; |
3423 | @@ -269,7 +270,7 @@ |
3424 | else |
3425 | $subject_truncated = pun_htmlspecialchars($item['title']); |
3426 | |
3427 | - echo '<li><a href="'.$item['link'].'" title="'.pun_htmlspecialchars($item['title']).'">'.$subject_truncated.'</a></li>'."\n"; |
3428 | + echo '<li><a href="'.pun_htmlspecialchars($item['link']).'" title="'.pun_htmlspecialchars($item['title']).'">'.$subject_truncated.'</a></li>'."\n"; |
3429 | } |
3430 | } |
3431 | |
3432 | @@ -308,7 +309,7 @@ |
3433 | // Setup the feed |
3434 | $feed = array( |
3435 | 'title' => $pun_config['o_board_title'].$lang_common['Title separator'].$cur_topic['subject'], |
3436 | - 'link' => $pun_config['o_base_url'].'/viewtopic.php?id='.$tid, |
3437 | + 'link' => get_base_url(true).'/viewtopic.php?id='.$tid, |
3438 | 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), |
3439 | 'items' => array(), |
3440 | 'type' => 'posts' |
3441 | @@ -323,7 +324,7 @@ |
3442 | $item = array( |
3443 | 'id' => $cur_post['id'], |
3444 | 'title' => $cur_topic['first_post_id'] == $cur_post['id'] ? $cur_topic['subject'] : $lang_common['RSS reply'].$cur_topic['subject'], |
3445 | - 'link' => $pun_config['o_base_url'].'/viewtopic.php?pid='.$cur_post['id'].'#p'.$cur_post['id'], |
3446 | + 'link' => get_base_url(true).'/viewtopic.php?pid='.$cur_post['id'].'#p'.$cur_post['id'], |
3447 | 'description' => $cur_post['message'], |
3448 | 'author' => array( |
3449 | 'name' => $cur_post['poster'], |
3450 | @@ -336,7 +337,7 @@ |
3451 | if ($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) |
3452 | $item['author']['email'] = $cur_post['email']; |
3453 | |
3454 | - $item['author']['uri'] = $pun_config['o_base_url'].'/profile.php?id='.$cur_post['poster_id']; |
3455 | + $item['author']['uri'] = get_base_url(true).'/profile.php?id='.$cur_post['poster_id']; |
3456 | } |
3457 | else if ($cur_post['poster_email'] != '' && !$pun_user['is_guest']) |
3458 | $item['author']['email'] = $cur_post['poster_email']; |
3459 | @@ -381,46 +382,88 @@ |
3460 | $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; |
3461 | } |
3462 | |
3463 | - // Setup the feed |
3464 | - $feed = array( |
3465 | - 'title' => $pun_config['o_board_title'].$forum_name, |
3466 | - 'link' => $pun_config['o_base_url'].'/index.php', |
3467 | - 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), |
3468 | - 'items' => array(), |
3469 | - 'type' => 'topics' |
3470 | - ); |
3471 | - |
3472 | - // Fetch $show topics |
3473 | - $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.$show) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
3474 | - while ($cur_topic = $db->fetch_assoc($result)) |
3475 | + // Only attempt to cache if caching is enabled and we have all or a single forum |
3476 | + if ($pun_config['o_feed_ttl'] > 0 && ($forum_sql == '' || ($forum_name != '' && !isset($_GET['nfid'])))) |
3477 | + $cache_id = 'feed'.sha1($pun_user['g_id'].'|'.$lang_common['lang_identifier'].'|'.($order_posted ? '1' : '0').($forum_name == '' ? '' : '|'.$fids[0])); |
3478 | + |
3479 | + // Load cached feed |
3480 | + if (isset($cache_id) && file_exists(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php')) |
3481 | + include FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'; |
3482 | + |
3483 | + $now = time(); |
3484 | + if (!isset($feed) || $cache_expire < $now) |
3485 | { |
3486 | - if ($pun_config['o_censoring'] == '1') |
3487 | - $cur_topic['subject'] = censor_words($cur_topic['subject']); |
3488 | - |
3489 | - $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
3490 | - |
3491 | - $item = array( |
3492 | - 'id' => $cur_topic['id'], |
3493 | - 'title' => $cur_topic['subject'], |
3494 | - 'link' => $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&action=new'), |
3495 | - 'description' => $cur_topic['message'], |
3496 | - 'author' => array( |
3497 | - 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] |
3498 | - ), |
3499 | - 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] |
3500 | + // Setup the feed |
3501 | + $feed = array( |
3502 | + 'title' => $pun_config['o_board_title'].$forum_name, |
3503 | + 'link' => '/index.php', |
3504 | + 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), |
3505 | + 'items' => array(), |
3506 | + 'type' => 'topics' |
3507 | ); |
3508 | |
3509 | - if ($cur_topic['poster_id'] > 1) |
3510 | - { |
3511 | - if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) |
3512 | - $item['author']['email'] = $cur_topic['email']; |
3513 | - |
3514 | - $item['author']['uri'] = $pun_config['o_base_url'].'/profile.php?id='.$cur_topic['poster_id']; |
3515 | - } |
3516 | - else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) |
3517 | - $item['author']['email'] = $cur_topic['poster_email']; |
3518 | - |
3519 | - $feed['items'][] = $item; |
3520 | + // Fetch $show topics |
3521 | + $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.(isset($cache_id) ? 50 : $show)) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
3522 | + while ($cur_topic = $db->fetch_assoc($result)) |
3523 | + { |
3524 | + if ($pun_config['o_censoring'] == '1') |
3525 | + $cur_topic['subject'] = censor_words($cur_topic['subject']); |
3526 | + |
3527 | + $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
3528 | + |
3529 | + $item = array( |
3530 | + 'id' => $cur_topic['id'], |
3531 | + 'title' => $cur_topic['subject'], |
3532 | + 'link' => '/viewtopic.php?id='.$cur_topic['id'].($order_posted ? '' : '&action=new'), |
3533 | + 'description' => $cur_topic['message'], |
3534 | + 'author' => array( |
3535 | + 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] |
3536 | + ), |
3537 | + 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] |
3538 | + ); |
3539 | + |
3540 | + if ($cur_topic['poster_id'] > 1) |
3541 | + { |
3542 | + if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) |
3543 | + $item['author']['email'] = $cur_topic['email']; |
3544 | + |
3545 | + $item['author']['uri'] = '/profile.php?id='.$cur_topic['poster_id']; |
3546 | + } |
3547 | + else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) |
3548 | + $item['author']['email'] = $cur_topic['poster_email']; |
3549 | + |
3550 | + $feed['items'][] = $item; |
3551 | + } |
3552 | + |
3553 | + // Output feed as PHP code |
3554 | + if (isset($cache_id)) |
3555 | + { |
3556 | + $fh = @fopen(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php', 'wb'); |
3557 | + if (!$fh) |
3558 | + error('Unable to write feed cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
3559 | + |
3560 | + fwrite($fh, '<?php'."\n\n".'$feed = '.var_export($feed, true).';'."\n\n".'$cache_expire = '.($now + ($pun_config['o_feed_ttl'] * 60)).';'."\n\n".'?>'); |
3561 | + |
3562 | + fclose($fh); |
3563 | + |
3564 | + if (function_exists('apc_delete_file')) |
3565 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'); |
3566 | + } |
3567 | + } |
3568 | + |
3569 | + // If we only want to show a few items but due to caching we have too many |
3570 | + if (count($feed['items']) > $show) |
3571 | + $feed['items'] = array_slice($feed['items'], 0, $show); |
3572 | + |
3573 | + // Prepend the current base URL onto some links. Done after caching to handle http/https correctly |
3574 | + $feed['link'] = get_base_url(true).$feed['link']; |
3575 | + |
3576 | + foreach ($feed['items'] as $key => $item) |
3577 | + { |
3578 | + $feed['items'][$key]['link'] = get_base_url(true).$item['link']; |
3579 | + |
3580 | + if (isset($item['author']['uri'])) |
3581 | + $feed['items'][$key]['author']['uri'] = get_base_url(true).$item['author']['uri']; |
3582 | } |
3583 | |
3584 | $output_func = 'output_'.$type; |
3585 | @@ -446,7 +489,7 @@ |
3586 | { |
3587 | if ($pun_user_online['user_id'] > 1) |
3588 | { |
3589 | - $users[] = ($pun_user['g_view_users'] == '1') ? '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>' : pun_htmlspecialchars($pun_user_online['ident']); |
3590 | + $users[] = ($pun_user['g_view_users'] == '1') ? '<a href="'.pun_htmlspecialchars(get_base_url(true)).'/profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>' : pun_htmlspecialchars($pun_user_online['ident']); |
3591 | ++$num_users; |
3592 | } |
3593 | else |
3594 | @@ -476,11 +519,17 @@ |
3595 | require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
3596 | |
3597 | // Collect some statistics from the database |
3598 | - $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED) or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error()); |
3599 | - $stats['total_users'] = $db->result($result); |
3600 | - |
3601 | - $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED.' ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error()); |
3602 | - $stats['last_user'] = $db->fetch_assoc($result); |
3603 | + if (file_exists(FORUM_CACHE_DIR.'cache_users_info.php')) |
3604 | + include FORUM_CACHE_DIR.'cache_users_info.php'; |
3605 | + |
3606 | + if (!defined('PUN_USERS_INFO_LOADED')) |
3607 | + { |
3608 | + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
3609 | + require PUN_ROOT.'include/cache.php'; |
3610 | + |
3611 | + generate_users_info_cache(); |
3612 | + require FORUM_CACHE_DIR.'cache_users_info.php'; |
3613 | + } |
3614 | |
3615 | $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); |
3616 | list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); |
3617 | @@ -492,7 +541,7 @@ |
3618 | header('Pragma: public'); |
3619 | |
3620 | echo sprintf($lang_index['No of users'], forum_number_format($stats['total_users'])).'<br />'."\n"; |
3621 | - echo sprintf($lang_index['Newest user'], (($pun_user['g_view_users'] == '1') ? '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username']))).'<br />'."\n"; |
3622 | + echo sprintf($lang_index['Newest user'], (($pun_user['g_view_users'] == '1') ? '<a href="'.pun_htmlspecialchars(get_base_url(true)).'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username']))).'<br />'."\n"; |
3623 | echo sprintf($lang_index['No of topics'], forum_number_format($stats['total_topics'])).'<br />'."\n"; |
3624 | echo sprintf($lang_index['No of posts'], forum_number_format($stats['total_posts'])).'<br />'."\n"; |
3625 | |
3626 | |
3627 | === modified file 'footer.php' |
3628 | --- footer.php 2010-10-08 13:18:35 +0000 |
3629 | +++ footer.php 2011-04-21 10:05:56 +0000 |
3630 | @@ -1,7 +1,7 @@ |
3631 | <?php |
3632 | |
3633 | /** |
3634 | - * Copyright (C) 2008-2010 FluxBB |
3635 | + * Copyright (C) 2008-2011 FluxBB |
3636 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3637 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3638 | */ |
3639 | @@ -63,72 +63,34 @@ |
3640 | <div id="brdfooternav" class="inbox"> |
3641 | <?php |
3642 | |
3643 | +echo "\t\t\t".'<div class="conl">'."\n"; |
3644 | + |
3645 | +// Display the "Jump to" drop list |
3646 | +if ($pun_config['o_quickjump'] == '1') |
3647 | +{ |
3648 | + // Load cached quick jump |
3649 | + if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php')) |
3650 | + include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; |
3651 | + |
3652 | + if (!defined('PUN_QJ_LOADED')) |
3653 | + { |
3654 | + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
3655 | + require PUN_ROOT.'include/cache.php'; |
3656 | + |
3657 | + generate_quickjump_cache($pun_user['g_id']); |
3658 | + require FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; |
3659 | + } |
3660 | +} |
3661 | + |
3662 | +echo "\t\t\t".'</div>'."\n"; |
3663 | + |
3664 | +?> |
3665 | + <div class="conr"> |
3666 | +<?php |
3667 | + |
3668 | // If no footer style has been specified, we use the default (only copyright/debug info) |
3669 | $footer_style = isset($footer_style) ? $footer_style : NULL; |
3670 | |
3671 | -if ($footer_style == 'index' || $footer_style == 'search') |
3672 | -{ |
3673 | - echo "\t\t\t".'<div class="conl">'."\n"; |
3674 | - |
3675 | - if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1') |
3676 | - { |
3677 | - echo "\t\t\t\t".'<dl id="searchlinks">'."\n"; |
3678 | - echo "\t\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n"; |
3679 | - |
3680 | - echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></span></dd>'."\n"; |
3681 | - echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></span></dd>'."\n"; |
3682 | - |
3683 | - if ($pun_config['o_subscriptions'] == '1') |
3684 | - echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_subscriptions">'.$lang_common['Show subscriptions'].'</a></span></dd>'."\n"; |
3685 | - |
3686 | - echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_user&user_id='.$pun_user['id'].'">'.$lang_common['Show your posts'].'</a></span></dd>'."\n"; |
3687 | - |
3688 | - echo "\t\t\t\t".'</dl>'."\n"; |
3689 | - } |
3690 | - else |
3691 | - { |
3692 | - if ($pun_user['g_search'] == '1') |
3693 | - { |
3694 | - echo "\t\t\t\t".'<dl id="searchlinks">'."\n"; |
3695 | - echo "\t\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n"; |
3696 | - |
3697 | - echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></span></dd>'."\n"; |
3698 | - echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></span></dd>'."\n"; |
3699 | - |
3700 | - echo "\t\t\t\t".'</dl>'."\n"; |
3701 | - } |
3702 | - } |
3703 | - |
3704 | - echo "\t\t\t".'</div>'."\n"; |
3705 | -} |
3706 | -else if ($footer_style == 'viewforum' || $footer_style == 'viewtopic') |
3707 | -{ |
3708 | - echo "\t\t\t".'<div class="conl">'."\n"; |
3709 | - |
3710 | - // Display the "Jump to" drop list |
3711 | - if ($pun_config['o_quickjump'] == '1') |
3712 | - { |
3713 | - // Load cached quick jump |
3714 | - if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php')) |
3715 | - include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; |
3716 | - |
3717 | - if (!defined('PUN_QJ_LOADED')) |
3718 | - { |
3719 | - if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
3720 | - require PUN_ROOT.'include/cache.php'; |
3721 | - |
3722 | - generate_quickjump_cache($pun_user['g_id']); |
3723 | - require FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; |
3724 | - } |
3725 | - } |
3726 | - |
3727 | - echo "\t\t\t".'</div>'."\n"; |
3728 | -} |
3729 | - |
3730 | -?> |
3731 | - <div class="conr"> |
3732 | -<?php |
3733 | - |
3734 | if ($footer_style == 'index') |
3735 | { |
3736 | if ($pun_config['o_feed_type'] == '1') |
3737 | @@ -141,7 +103,7 @@ |
3738 | if ($pun_config['o_feed_type'] == '1') |
3739 | echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&fid='.$forum_id.'&type=rss">'.$lang_common['RSS forum feed'].'</a></span></p>'."\n"; |
3740 | else if ($pun_config['o_feed_type'] == '2') |
3741 | - echo "\t\t\t\t".'<p id="feedlinks" class="actions"><span class="atom"><a href="extern.php?action=feed&fid='.$forum_id.'&type=atom">'.$lang_common['Atom forum feed'].'</a></span></p>'."\n"; |
3742 | + echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&fid='.$forum_id.'&type=atom">'.$lang_common['Atom forum feed'].'</a></span></p>'."\n"; |
3743 | } |
3744 | else if ($footer_style == 'viewtopic') |
3745 | { |
3746 | |
3747 | === modified file 'header.php' |
3748 | --- header.php 2011-04-16 22:04:53 +0000 |
3749 | +++ header.php 2011-04-21 10:05:56 +0000 |
3750 | @@ -1,7 +1,7 @@ |
3751 | <?php |
3752 | |
3753 | /** |
3754 | - * Copyright (C) 2008-2010 FluxBB |
3755 | + * Copyright (C) 2008-2011 FluxBB |
3756 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3757 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3758 | */ |
3759 | @@ -197,33 +197,34 @@ |
3760 | /* <![CDATA[ */ |
3761 | function process_form(the_form) |
3762 | { |
3763 | - var element_names = new Object() |
3764 | + var element_names = { |
3765 | <?php |
3766 | - |
3767 | - // Output a JavaScript array with localised field names |
3768 | + // Output a JavaScript object with localised field names |
3769 | + $tpl_temp = count($required_fields); |
3770 | foreach ($required_fields as $elem_orig => $elem_trans) |
3771 | - echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace(' ', ' ', $elem_trans)).'"'."\n"; |
3772 | - |
3773 | + { |
3774 | + echo "\t\t\"".$elem_orig.'": "'.addslashes(str_replace(' ', ' ', $elem_trans)); |
3775 | + if (--$tpl_temp) echo "\",\n"; |
3776 | + else echo "\"\n\t};\n"; |
3777 | + } |
3778 | ?> |
3779 | - |
3780 | if (document.all || document.getElementById) |
3781 | { |
3782 | for (var i = 0; i < the_form.length; ++i) |
3783 | { |
3784 | - var elem = the_form.elements[i] |
3785 | - if (elem.name && elem.name.substring(0, 4) == "req_") |
3786 | + var elem = the_form.elements[i]; |
3787 | + if (elem.name && (/^req_/.test(elem.name))) |
3788 | { |
3789 | - if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='') |
3790 | + if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) |
3791 | { |
3792 | - alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>") |
3793 | - elem.focus() |
3794 | - return false |
3795 | + alert('"' + element_names[elem.name] + '" <?php echo $lang_common['required field'] ?>'); |
3796 | + elem.focus(); |
3797 | + return false; |
3798 | } |
3799 | } |
3800 | } |
3801 | } |
3802 | - |
3803 | - return true |
3804 | + return true; |
3805 | } |
3806 | /* ]]> */ |
3807 | </script> |
3808 | @@ -234,8 +235,12 @@ |
3809 | // JavaScript tricks for IE6 and older |
3810 | echo '<!--[if lte IE 6]><script type="text/javascript" src="style/imports/minmax.js"></script><![endif]-->'."\n"; |
3811 | |
3812 | -if (isset($page_head)) |
3813 | - echo implode("\n", $page_head)."\n"; |
3814 | +if (!isset($page_head)) |
3815 | + $page_head = array(); |
3816 | + |
3817 | +$page_head['top'] = '<link rel="top" href="index.php" title="'.$lang_common['Forum index'].'" />'; |
3818 | + |
3819 | +echo implode("\n", $page_head)."\n"; |
3820 | |
3821 | $tpl_temp = trim(ob_get_contents()); |
3822 | $tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main); |
3823 | @@ -246,8 +251,8 @@ |
3824 | // START SUBST - <body> |
3825 | if (isset($focus_element)) |
3826 | { |
3827 | - $tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main); |
3828 | - $tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main); |
3829 | + $tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').elements[\''.$focus_element[1].'\'].focus();', $tpl_main); |
3830 | + $tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').elements[\''.$focus_element[1].'\'].focus()">', $tpl_main); |
3831 | } |
3832 | // END SUBST - <body> |
3833 | |
3834 | @@ -258,7 +263,7 @@ |
3835 | |
3836 | |
3837 | // START SUBST - <pun_title> |
3838 | -$tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main); |
3839 | +$tpl_main = str_replace('<pun_title>', '<h1><a href="index.php">'.pun_htmlspecialchars($pun_config['o_board_title']).'</a></h1>', $tpl_main); |
3840 | // END SUBST - <pun_title> |
3841 | |
3842 | |
3843 | @@ -268,16 +273,67 @@ |
3844 | |
3845 | |
3846 | // START SUBST - <pun_navlinks> |
3847 | -$tpl_main = str_replace('<pun_navlinks>','<div class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main); |
3848 | +$links = array(); |
3849 | + |
3850 | +// Index should always be displayed |
3851 | +//$links[] = '<li id="navindex"'.((PUN_ACTIVE_PAGE == 'index') ? ' class="isactive"' : '').'><a href="index.php">'.$lang_common['Index'].'</a></li>'; |
3852 | + |
3853 | +if ($pun_user['g_read_board'] == '1' && $pun_user['g_view_users'] == '1') |
3854 | + $links[] = '<li id="navuserlist"'.((PUN_ACTIVE_PAGE == 'userlist') ? ' class="isactive"' : '').'><a href="userlist.php" title="Rechercher des utilisateurs">'.$lang_common['User list'].'</a></li>'; |
3855 | + |
3856 | +if ($pun_config['o_rules'] == '1' && (!$pun_user['is_guest'] || $pun_user['g_read_board'] == '1' || $pun_config['o_regs_allow'] == '1')) |
3857 | + $links[] = '<li id="navrules"'.((PUN_ACTIVE_PAGE == 'rules') ? ' class="isactive"' : '').'><a href="misc.php?action=rules" title="Charte du Forum Ubuntu-fr">'.$lang_common['Rules'].'</a></li>'; |
3858 | + |
3859 | +if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
3860 | + //$links[] = '<li id="navsearch"'.((PUN_ACTIVE_PAGE == 'search') ? ' class="isactive"' : '').'><a href="search.php">'.$lang_common['Search'].'</a></li>'; |
3861 | + |
3862 | +if ($pun_user['is_guest']) |
3863 | +{ |
3864 | + $links[] = '<li id="navregister"'.((PUN_ACTIVE_PAGE == 'register') ? ' class="isactive"' : '').'><a href="register.php">'.$lang_common['Register'].'</a></li>'; |
3865 | + $links[] = '<li id="navlogin"'.((PUN_ACTIVE_PAGE == 'login') ? ' class="isactive"' : '').'><a href="login.php">'.$lang_common['Login'].'</a></li>'; |
3866 | +} |
3867 | +else |
3868 | +{ |
3869 | + $links[] = '<li id="navprofile"'.((PUN_ACTIVE_PAGE == 'profile') ? ' class="isactive"' : '').'><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a></li>'; |
3870 | + |
3871 | + if ($pun_user['is_admmod']) |
3872 | + $links[] = '<li id="navadmin"'.((PUN_ACTIVE_PAGE == 'admin') ? ' class="isactive"' : '').'><a href="admin_index.php">'.$lang_common['Admin'].'</a></li>'; |
3873 | + |
3874 | + $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'&csrf_token='.pun_hash($pun_user['id'].pun_hash(get_remote_address())).'">'.$lang_common['Logout'].'</a></li>'; |
3875 | +} |
3876 | + |
3877 | +// liens du header intégrés au menu |
3878 | + if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')) && !$pun_user['is_guest']) |
3879 | + $links[] = '<li id="navmark"><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'; |
3880 | + else if (basename($_SERVER['PHP_SELF']) == 'viewforum.php') |
3881 | + $links[] = '<li id="navmark"><a href="misc.php?action=markforumread&fid='.$id.'">'.$lang_common['Mark forum read'].'</a></li>'; |
3882 | + |
3883 | +// Are there any additional navlinks we should insert into the array before imploding it? |
3884 | +if ($pun_user['g_read_board'] == '1' && $pun_config['o_additional_navlinks'] != '') |
3885 | +{ |
3886 | + if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_navlinks']."\n", $extra_links)) |
3887 | + { |
3888 | + // Insert any additional links into the $links array (at the correct index) |
3889 | + $num_links = count($extra_links[1]); |
3890 | + for ($i = 0; $i < $num_links; ++$i) |
3891 | + array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i].'</li>')); |
3892 | + } |
3893 | +} |
3894 | + |
3895 | +$tpl_temp = '<div class="inbox">'."\n\t\t\t".'<ul>'."\n\t\t\t\t".implode("\n\t\t\t\t", $links)."\n\t\t\t".'</ul>'."\n\t\t".'</div>'; |
3896 | +$tpl_main = str_replace('<pun_navlinks>', $tpl_temp, $tpl_main); |
3897 | // END SUBST - <pun_navlinks> |
3898 | |
3899 | |
3900 | // START SUBST - <pun_status> |
3901 | +$page_statusinfo = $page_topicsearches = array(); |
3902 | + |
3903 | if ($pun_user['is_guest']) |
3904 | - $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".$lang_common['Not logged in']."\n\t\t".'</div>'; |
3905 | + $page_statusinfo = $lang_common['Not logged in']; |
3906 | else |
3907 | { |
3908 | - $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li><span>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></span></li>'."\n\t\t\t\t".'<li><span>'.sprintf($lang_common['Last visit'], format_time($pun_user['last_visit'])).'</span></li>'; |
3909 | + $page_statusinfo[] = '<li><span>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></span></li>'; |
3910 | + $page_statusinfo[] = '<li><span>'.sprintf($lang_common['Last visit'], format_time($pun_user['last_visit'])).'</span></li>'; |
3911 | |
3912 | if ($pun_user['is_admmod']) |
3913 | { |
3914 | @@ -286,21 +342,50 @@ |
3915 | $result_header = $db->query('SELECT 1 FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error()); |
3916 | |
3917 | if ($db->result($result_header)) |
3918 | - $tpl_temp .= "\n\t\t\t\t".'<li class="reportlink"><span><strong><a href="admin_reports.php">'.$lang_common['New reports'].'</a></strong></span></li>'; |
3919 | + $page_statusinfo[] = '<li class="reportlink"><span><strong><a href="admin_reports.php">'.$lang_common['New reports'].'</a></strong></span></li>'; |
3920 | } |
3921 | |
3922 | if ($pun_config['o_maintenance'] == '1') |
3923 | - $tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><span><strong><a href="admin_options.php#maintenance">'.$lang_common['Maintenance mode enabled'].'</a></strong></span></li>'; |
3924 | - } |
3925 | -//'<li><span><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></span></li>' |
3926 | -// if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php'))) |
3927 | -// $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'.($pun_user['g_search'] == '1' ? "\n\t\t\t\t" : '')."\n\t\t\t\t".'<li><span><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></span></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'; |
3928 | -// else if (basename($_SERVER['PHP_SELF']) == 'viewforum.php') |
3929 | -// $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><span><a href="misc.php?action=markforumread&fid='.$id.'">'.$lang_common['Mark forum read'].'</a></span></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'; |
3930 | -// else |
3931 | - $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'; |
3932 | -} |
3933 | - |
3934 | + $page_statusinfo[] = '<li class="maintenancelink"><span><strong><a href="admin_options.php#maintenance">'.$lang_common['Maintenance mode enabled'].'</a></strong></span></li>'; |
3935 | + } |
3936 | + |
3937 | + if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
3938 | + { |
3939 | + $page_topicsearches[] = '<a href="search.php?action=show_replies" title="'.$lang_common['Show posted topics'].'">'.$lang_common['Posted topics'].'</a>'; |
3940 | + $page_topicsearches[] = '<a href="search.php?action=show_new" title="'.$lang_common['Show new posts'].'">'.$lang_common['New posts header'].'</a>'; |
3941 | + } |
3942 | +} |
3943 | + |
3944 | +// Quick searches |
3945 | +if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
3946 | +{ |
3947 | + $page_topicsearches[] = '<a href="search.php?action=show_recent" title="'.$lang_common['Show active topics'].'">'.$lang_common['Active topics'].'</a>'; |
3948 | + $page_topicsearches[] = '<a href="search.php?action=show_unanswered" title="'.$lang_common['Show unanswered topics'].'">'.$lang_common['Unanswered topics'].'</a>'; |
3949 | +} |
3950 | + |
3951 | + |
3952 | +// Generate all that jazz |
3953 | +$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t"; |
3954 | + |
3955 | +// The status information |
3956 | +if (is_array($page_statusinfo)) |
3957 | +{ |
3958 | + $tpl_temp .= "\n\t\t\t".'<ul class="conl">'; |
3959 | + $tpl_temp .= "\n\t\t\t\t".implode("\n\t\t\t\t", $page_statusinfo); |
3960 | + $tpl_temp .= "\n\t\t\t".'</ul>'; |
3961 | +} |
3962 | +else |
3963 | + $tpl_temp .= "\n\t\t\t".$page_statusinfo; |
3964 | + |
3965 | +// Generate quicklinks |
3966 | +//if (!empty($page_topicsearches)) |
3967 | +//{ |
3968 | +// $tpl_temp .= "\n\t\t\t".'<ul class="conr">'; |
3969 | +// $tpl_temp .= "\n\t\t\t\t".'<li><span>'.$lang_common['Topic searches'].' '.implode(' | ', $page_topicsearches).'</span></li>'; |
3970 | +// $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'; |
3971 | +//} |
3972 | + |
3973 | +$tpl_temp .= "\n\t\t".'</div>'; |
3974 | |
3975 | $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main); |
3976 | // END SUBST - <pun_status> |
3977 | @@ -310,31 +395,31 @@ |
3978 | // START SUBST - <pun_searchlinks> |
3979 | if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1') |
3980 | { |
3981 | - $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; |
3982 | - $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; |
3983 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_new" title="Nouveaux messages depuis votre dernière visite">'.$lang_common['Show new posts'].'</a></li>'."\n"; |
3984 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_24h" title="300 dernières discussions actives">'.$lang_common['Show recent posts'].'</a></li>'."\n"; |
3985 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_unanswered" title="300 dernières discussions sans réponse">'.$lang_common['Show unanswered posts'].'</a></li>'."\n"; |
3986 | - if ($pun_config['o_subscriptions'] == '1') |
3987 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_subscriptions" title="Discussions auxquelles vous êtes abonné">'.$lang_common['Show subscriptions'].'</a></li>'."\n"; |
3988 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_user&user_id='.$pun_user['id'].'" title="Discussions auxquelles vous avez participé">'.$lang_common['Show your posts'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t".'</div></li>'."\n\t"; |
3989 | + $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; |
3990 | + $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; |
3991 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_new" title="Nouveaux messages depuis votre dernière visite">'.$lang_common['Show new posts'].'</a></li>'."\n"; |
3992 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_recent" title="300 dernières discussions actives">'.$lang_common['Show active topics'].'</a></li>'."\n"; |
3993 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_unanswered" title="300 dernières discussions sans réponse">'.$lang_common['Show unanswered topics'].'</a></li>'."\n"; |
3994 | + if ($pun_config['o_topic_subscriptions'] == '1') |
3995 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_subscriptions" title="Discussions auxquelles vous êtes abonné">'.$lang_common['Show subscriptions'].'</a></li>'."\n"; |
3996 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_replies&user_id='.$pun_user['id'].'" title="Discussions auxquelles vous avez participé">'.$lang_common['Show your posts'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t".'</div></li>'."\n\t"; |
3997 | } |
3998 | else |
3999 | { |
4000 | - if ($pun_user['g_search'] == '1') |
4001 | - { |
4002 | - $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; |
4003 | - $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; |
4004 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_24h" title="300 dernières discussions actives">'.$lang_common['Show recent posts'].'</a></li>'."\n"; |
4005 | - $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_unanswered" title="300 dernières discussions sans réponse">'.$lang_common['Show unanswered posts'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t".'</div></li>'."\n\t"; |
4006 | - } |
4007 | + if ($pun_user['g_search'] == '1') |
4008 | + { |
4009 | + $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; |
4010 | + $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; |
4011 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_24h" title="300 dernières discussions actives">'.$lang_common['Show active topics'].'</a></li>'."\n"; |
4012 | + $tpl_searchlinks .= "\t\t\t\t".'<li><a href="search.php?action=show_unanswered" title="300 dernières discussions sans réponse">'.$lang_common['Show unanswered topics'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t".'</div></li>'."\n\t"; |
4013 | + } |
4014 | } |
4015 | $tpl_main = str_replace('<pun_searchlinks>', $tpl_searchlinks, $tpl_main); |
4016 | // END SUBST -<pun_searchlinks> |
4017 | |
4018 | |
4019 | // START SUBST - <pun_announcement> |
4020 | -if ($pun_config['o_announcement'] == '1') |
4021 | +if ($pun_user['g_read_board'] == '1' && $pun_config['o_announcement'] == '1') |
4022 | { |
4023 | ob_start(); |
4024 | |
4025 | |
4026 | === modified file 'help.php' |
4027 | --- help.php 2010-10-08 13:18:35 +0000 |
4028 | +++ help.php 2011-04-21 10:05:56 +0000 |
4029 | @@ -1,7 +1,7 @@ |
4030 | <?php |
4031 | |
4032 | /** |
4033 | - * Copyright (C) 2008-2010 FluxBB |
4034 | + * Copyright (C) 2008-2011 FluxBB |
4035 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4036 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4037 | */ |
4038 | @@ -9,7 +9,7 @@ |
4039 | // Tell header.php to use the help template |
4040 | define('PUN_HELP', 1); |
4041 | |
4042 | -define('PUN_ROOT', './'); |
4043 | +define('PUN_ROOT', dirname(__FILE__).'/'); |
4044 | require PUN_ROOT.'include/common.php'; |
4045 | |
4046 | |
4047 | @@ -39,7 +39,7 @@ |
4048 | <p><?php echo $lang_help['Text style info'] ?></p> |
4049 | <p><code>[b]<?php echo $lang_help['Bold text'] ?>[/b]</code> <?php echo $lang_help['produces'] ?> <samp><strong><?php echo $lang_help['Bold text'] ?></strong></samp></p> |
4050 | <p><code>[u]<?php echo $lang_help['Underlined text'] ?>[/u]</code> <?php echo $lang_help['produces'] ?> <samp><span class="bbu"><?php echo $lang_help['Underlined text'] ?></span></samp></p> |
4051 | - <p><code>[i]<?php echo $lang_help['Italic text'] ?>[/i]</code> <?php echo $lang_help['produces'] ?> <samp><i><?php echo $lang_help['Italic text'] ?></i></samp></p> |
4052 | + <p><code>[i]<?php echo $lang_help['Italic text'] ?>[/i]</code> <?php echo $lang_help['produces'] ?> <samp><em><?php echo $lang_help['Italic text'] ?></em></samp></p> |
4053 | <p><code>[s]<?php echo $lang_help['Strike-through text'] ?>[/s]</code> <?php echo $lang_help['produces'] ?> <samp><span class="bbs"><?php echo $lang_help['Strike-through text'] ?></span></samp></p> |
4054 | <p><code>[del]<?php echo $lang_help['Deleted text'] ?>[/del]</code> <?php echo $lang_help['produces'] ?> <samp><del><?php echo $lang_help['Deleted text'] ?></del></samp></p> |
4055 | <p><code>[ins]<?php echo $lang_help['Inserted text'] ?>[/ins]</code> <?php echo $lang_help['produces'] ?> <samp><ins><?php echo $lang_help['Inserted text'] ?></ins></samp></p> |
4056 | @@ -53,14 +53,14 @@ |
4057 | <div class="box"> |
4058 | <div class="inbox"> |
4059 | <p><?php echo $lang_help['Links info'] ?></p> |
4060 | - <p><code>[url=<?php echo $pun_config['o_base_url'].'/' ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo $pun_config['o_base_url'].'/' ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a></samp></p> |
4061 | - <p><code>[url]<?php echo $pun_config['o_base_url'].'/' ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo $pun_config['o_base_url'] ?>"><?php echo $pun_config['o_base_url'].'/' ?></a></samp></p> |
4062 | + <p><code>[url=<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a></samp></p> |
4063 | + <p><code>[url]<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/') ?></a></samp></p> |
4064 | <p><code>[email]myname@mydomain.com[/email]</code> <?php echo $lang_help['produces'] ?> <samp><a href="mailto:myname@mydomain.com">myname@mydomain.com</a></samp></p> |
4065 | <p><code>[email=myname@mydomain.com]<?php echo $lang_help['My email address'] ?>[/email]</code> <?php echo $lang_help['produces'] ?> <samp><a href="mailto:myname@mydomain.com"><?php echo $lang_help['My email address'] ?></a></samp></p> |
4066 | </div> |
4067 | <div class="inbox"> |
4068 | <p><a name="img"></a><?php echo $lang_help['Images info'] ?></p> |
4069 | - <p><code>[img=FluxBB bbcode test]<?php echo $pun_config['o_base_url'].'/' ?>img/test.png[/img]</code> <?php echo $lang_help['produces'] ?> <samp><img src="<?php echo $pun_config['o_base_url'].'/' ?>img/test.png" alt="FluxBB bbcode test" /></samp></p> |
4070 | + <p><code>[img=<?php echo $lang_help['FluxBB bbcode test'] ?>]<?php echo pun_htmlspecialchars(get_base_url(true)) ?>/img/test.png[/img]</code> <?php echo $lang_help['produces'] ?> <samp><img src="<?php echo pun_htmlspecialchars(get_base_url(true)) ?>/img/test.png" alt="<?php echo $lang_help['FluxBB bbcode test'] ?>" /></samp></p> |
4071 | </div> |
4072 | </div> |
4073 | <h2><span><?php echo $lang_help['Quotes'] ?></span></h2> |
4074 | @@ -99,17 +99,17 @@ |
4075 | <p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> |
4076 | <br /><span><?php echo $lang_help['produces list'] ?></span></p> |
4077 | <div class="postmsg"> |
4078 | - <ul><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ul> |
4079 | + <ul><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ul> |
4080 | </div> |
4081 | <p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> |
4082 | <br /><span><?php echo $lang_help['produces decimal list'] ?></span></p> |
4083 | <div class="postmsg"> |
4084 | - <ol class="decimal"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol> |
4085 | + <ol class="decimal"><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ol> |
4086 | </div> |
4087 | <p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> |
4088 | <br /><span><?php echo $lang_help['produces alpha list'] ?></span></p> |
4089 | <div class="postmsg"> |
4090 | - <ol class="alpha"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol> |
4091 | + <ol class="alpha"><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ol> |
4092 | </div> |
4093 | </div> |
4094 | </div> |
4095 | @@ -135,7 +135,8 @@ |
4096 | $smiley_groups[$smiley_img][] = $smiley_text; |
4097 | |
4098 | foreach ($smiley_groups as $smiley_img => $smiley_texts) |
4099 | - echo "\t\t".'<p><code>'.implode('</code> '.$lang_common['and'].' <code>', $smiley_texts).'</code> <span>'.$lang_help['produces'].'</span> <samp><img src="'.$pun_config['o_base_url'].'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></samp></p>'."\n"; |
4100 | + echo "\t\t".'<p><code>'.implode('</code> '.$lang_common['and'].' <code>', $smiley_texts).'</code> <span>'.$lang_help['produces'].'</span> <samp><img src="'.pun_htmlspecialchars(get_base_url(true)).'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></samp></p>'."\n"; |
4101 | + |
4102 | ?> |
4103 | </div> |
4104 | </div> |
4105 | |
4106 | === modified file 'include/cache.php' |
4107 | --- include/cache.php 2010-10-08 13:18:35 +0000 |
4108 | +++ include/cache.php 2011-04-21 10:05:56 +0000 |
4109 | @@ -1,7 +1,7 @@ |
4110 | <?php |
4111 | |
4112 | /** |
4113 | - * Copyright (C) 2008-2010 FluxBB |
4114 | + * Copyright (C) 2008-2011 FluxBB |
4115 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4116 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4117 | */ |
4118 | @@ -26,14 +26,14 @@ |
4119 | // Output config as PHP code |
4120 | $fh = @fopen(FORUM_CACHE_DIR.'cache_config.php', 'wb'); |
4121 | if (!$fh) |
4122 | - error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); |
4123 | + error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4124 | |
4125 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>'); |
4126 | |
4127 | fclose($fh); |
4128 | |
4129 | if (function_exists('apc_delete_file')) |
4130 | - apc_delete_file(FORUM_CACHE_DIR.'cache_config.php'); |
4131 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_config.php'); |
4132 | } |
4133 | |
4134 | |
4135 | @@ -54,14 +54,14 @@ |
4136 | // Output ban list as PHP code |
4137 | $fh = @fopen(FORUM_CACHE_DIR.'cache_bans.php', 'wb'); |
4138 | if (!$fh) |
4139 | - error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); |
4140 | + error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4141 | |
4142 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>'); |
4143 | |
4144 | fclose($fh); |
4145 | |
4146 | if (function_exists('apc_delete_file')) |
4147 | - apc_delete_file(FORUM_CACHE_DIR.'cache_bans.php'); |
4148 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_bans.php'); |
4149 | } |
4150 | |
4151 | |
4152 | @@ -82,14 +82,14 @@ |
4153 | // Output ranks list as PHP code |
4154 | $fh = @fopen(FORUM_CACHE_DIR.'cache_ranks.php', 'wb'); |
4155 | if (!$fh) |
4156 | - error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); |
4157 | + error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4158 | |
4159 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>'); |
4160 | |
4161 | fclose($fh); |
4162 | |
4163 | if (function_exists('apc_delete_file')) |
4164 | - apc_delete_file(FORUM_CACHE_DIR.'cache_ranks.php'); |
4165 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_ranks.php'); |
4166 | } |
4167 | |
4168 | |
4169 | @@ -100,58 +100,184 @@ |
4170 | { |
4171 | global $db, $lang_common, $pun_user; |
4172 | |
4173 | + $groups = array(); |
4174 | + |
4175 | // If a group_id was supplied, we generate the quick jump cache for that group only |
4176 | if ($group_id !== false) |
4177 | - $groups[0] = $group_id; |
4178 | + { |
4179 | + // Is this group even allowed to read forums? |
4180 | + $result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch user group read permission', __FILE__, __LINE__, $db->error()); |
4181 | + $read_board = $db->result($result); |
4182 | + |
4183 | + $groups[$group_id] = $read_board; |
4184 | + } |
4185 | else |
4186 | { |
4187 | - // A group_id was now supplied, so we generate the quick jump cache for all groups |
4188 | - $result = $db->query('SELECT g_id FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); |
4189 | + // A group_id was not supplied, so we generate the quick jump cache for all groups |
4190 | + $result = $db->query('SELECT g_id, g_read_board FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); |
4191 | $num_groups = $db->num_rows($result); |
4192 | |
4193 | - for ($i = 0; $i < $num_groups; ++$i) |
4194 | - $groups[] = $db->result($result, $i); |
4195 | + while ($row = $db->fetch_row($result)) |
4196 | + $groups[$row[0]] = $row[1]; |
4197 | } |
4198 | |
4199 | // Loop through the groups in $groups and output the cache for each of them |
4200 | - foreach ($groups as $group_id) |
4201 | + foreach ($groups as $group_id => $read_board) |
4202 | { |
4203 | // Output quick jump as PHP code |
4204 | $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb'); |
4205 | if (!$fh) |
4206 | - error('Unable to write quick jump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); |
4207 | - |
4208 | - $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>'; |
4209 | - $output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><span><?php echo $lang_common[\'Jump to\'] ?>'.'<br /></span>'."\n\t\t\t\t\t".'<select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n"; |
4210 | - |
4211 | - |
4212 | - $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
4213 | - |
4214 | - $cur_category = 0; |
4215 | - while ($cur_forum = $db->fetch_assoc($result)) |
4216 | + error('Unable to write quick jump cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4217 | + |
4218 | + $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n".'$forum_id = isset($forum_id) ? $forum_id : 0;'."\n\n".'?>'; |
4219 | + |
4220 | + if ($read_board == '1') |
4221 | { |
4222 | - if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? |
4223 | + $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
4224 | + |
4225 | + if ($db->num_rows($result)) |
4226 | { |
4227 | - if ($cur_category) |
4228 | - $output .= "\t\t\t\t\t\t".'</optgroup>'."\n"; |
4229 | - |
4230 | - $output .= "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n"; |
4231 | - $cur_category = $cur_forum['cid']; |
4232 | + $output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><span><?php echo $lang_common[\'Jump to\'] ?>'.'<br /></span>'."\n\t\t\t\t\t".'<select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n"; |
4233 | + |
4234 | + $cur_category = 0; |
4235 | + while ($cur_forum = $db->fetch_assoc($result)) |
4236 | + { |
4237 | + if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? |
4238 | + { |
4239 | + if ($cur_category) |
4240 | + $output .= "\t\t\t\t\t\t".'</optgroup>'."\n"; |
4241 | + |
4242 | + $output .= "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n"; |
4243 | + $cur_category = $cur_forum['cid']; |
4244 | + } |
4245 | + |
4246 | + $redirect_tag = ($cur_forum['redirect_url'] != '') ? ' >>>' : ''; |
4247 | + $output .= "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n"; |
4248 | + } |
4249 | + |
4250 | + $output .= "\t\t\t\t\t\t".'</optgroup>'."\n\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form>'."\n"; |
4251 | } |
4252 | - |
4253 | - $redirect_tag = ($cur_forum['redirect_url'] != '') ? ' >>>' : ''; |
4254 | - $output .= "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n"; |
4255 | } |
4256 | |
4257 | - $output .= "\t\t\t\t\t\t".'</optgroup>'."\n\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form>'."\n"; |
4258 | - |
4259 | fwrite($fh, $output); |
4260 | |
4261 | fclose($fh); |
4262 | |
4263 | if (function_exists('apc_delete_file')) |
4264 | - apc_delete_file(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php'); |
4265 | - } |
4266 | -} |
4267 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php'); |
4268 | + } |
4269 | +} |
4270 | + |
4271 | + |
4272 | +// |
4273 | +// Generate the censoring cache PHP script |
4274 | +// |
4275 | +function generate_censoring_cache() |
4276 | +{ |
4277 | + global $db; |
4278 | + |
4279 | + $result = $db->query('SELECT search_for, replace_with FROM '.$db->prefix.'censoring') or error('Unable to fetch censoring list', __FILE__, __LINE__, $db->error()); |
4280 | + $num_words = $db->num_rows($result); |
4281 | + |
4282 | + $search_for = $replace_with = array(); |
4283 | + for ($i = 0; $i < $num_words; $i++) |
4284 | + { |
4285 | + list($search_for[$i], $replace_with[$i]) = $db->fetch_row($result); |
4286 | + $search_for[$i] = '/(?<=[^\p{L}\p{N}])('.str_replace('\*', '[\p{L}\p{N}]*?', preg_quote($search_for[$i], '/')).')(?=[^\p{L}\p{N}])/iu'; |
4287 | + } |
4288 | + |
4289 | + // Output censored words as PHP code |
4290 | + $fh = @fopen(FORUM_CACHE_DIR.'cache_censoring.php', 'wb'); |
4291 | + if (!$fh) |
4292 | + error('Unable to write censoring cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4293 | + |
4294 | + fwrite($fh, '<?php'."\n\n".'define(\'PUN_CENSOR_LOADED\', 1);'."\n\n".'$search_for = '.var_export($search_for, true).';'."\n\n".'$replace_with = '.var_export($replace_with, true).';'."\n\n".'?>'); |
4295 | + |
4296 | + fclose($fh); |
4297 | + |
4298 | + if (function_exists('apc_delete_file')) |
4299 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_censoring.php'); |
4300 | +} |
4301 | + |
4302 | + |
4303 | +// |
4304 | +// Generate the stopwords cache PHP script |
4305 | +// |
4306 | +function generate_stopwords_cache() |
4307 | +{ |
4308 | + $stopwords = array(); |
4309 | + |
4310 | + $d = dir(PUN_ROOT.'lang'); |
4311 | + while (($entry = $d->read()) !== false) |
4312 | + { |
4313 | + if ($entry{0} == '.') |
4314 | + continue; |
4315 | + |
4316 | + if (is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/stopwords.txt')) |
4317 | + $stopwords = array_merge($stopwords, file(PUN_ROOT.'lang/'.$entry.'/stopwords.txt')); |
4318 | + } |
4319 | + $d->close(); |
4320 | + |
4321 | + // Tidy up and filter the stopwords |
4322 | + $stopwords = array_map('pun_trim', $stopwords); |
4323 | + $stopwords = array_filter($stopwords); |
4324 | + |
4325 | + // Output stopwords as PHP code |
4326 | + $fh = @fopen(FORUM_CACHE_DIR.'cache_stopwords.php', 'wb'); |
4327 | + if (!$fh) |
4328 | + error('Unable to write stopwords cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4329 | + |
4330 | + fwrite($fh, '<?php'."\n\n".'$cache_id = \''.generate_stopwords_cache_id().'\';'."\n".'if ($cache_id != generate_stopwords_cache_id()) return;'."\n\n".'define(\'PUN_STOPWORDS_LOADED\', 1);'."\n\n".'$stopwords = '.var_export($stopwords, true).';'."\n\n".'?>'); |
4331 | + |
4332 | + fclose($fh); |
4333 | + |
4334 | + if (function_exists('apc_delete_file')) |
4335 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_stopwords.php'); |
4336 | +} |
4337 | + |
4338 | + |
4339 | +// |
4340 | +// Load some information about the latest registered users |
4341 | +// |
4342 | +function generate_users_info_cache() |
4343 | +{ |
4344 | + global $db; |
4345 | + |
4346 | + $stats = array(); |
4347 | + |
4348 | + $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED) or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error()); |
4349 | + $stats['total_users'] = $db->result($result); |
4350 | + |
4351 | + $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED.' ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error()); |
4352 | + $stats['last_user'] = $db->fetch_assoc($result); |
4353 | + |
4354 | + // Output users info as PHP code |
4355 | + $fh = @fopen(FORUM_CACHE_DIR.'cache_users_info.php', 'wb'); |
4356 | + if (!$fh) |
4357 | + error('Unable to write users info cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
4358 | + |
4359 | + fwrite($fh, '<?php'."\n\n".'define(\'PUN_USERS_INFO_LOADED\', 1);'."\n\n".'$stats = '.var_export($stats, true).';'."\n\n".'?>'); |
4360 | + |
4361 | + fclose($fh); |
4362 | + |
4363 | + if (function_exists('apc_delete_file')) |
4364 | + @apc_delete_file(FORUM_CACHE_DIR.'cache_users_info.php'); |
4365 | +} |
4366 | + |
4367 | + |
4368 | +// |
4369 | +// Delete all feed caches |
4370 | +// |
4371 | +function clear_feed_cache() |
4372 | +{ |
4373 | + $d = dir(FORUM_CACHE_DIR); |
4374 | + while (($entry = $d->read()) !== false) |
4375 | + { |
4376 | + if (substr($entry, 0, 10) == 'cache_feed' && substr($entry, -4) == '.php') |
4377 | + @unlink(FORUM_CACHE_DIR.$entry); |
4378 | + } |
4379 | + $d->close(); |
4380 | +} |
4381 | + |
4382 | |
4383 | define('FORUM_CACHE_FUNCTIONS_LOADED', true); |
4384 | |
4385 | === modified file 'include/common.php' |
4386 | --- include/common.php 2010-10-08 13:18:35 +0000 |
4387 | +++ include/common.php 2011-04-21 10:05:56 +0000 |
4388 | @@ -1,7 +1,7 @@ |
4389 | <?php |
4390 | |
4391 | /** |
4392 | - * Copyright (C) 2008-2010 FluxBB |
4393 | + * Copyright (C) 2008-2011 FluxBB |
4394 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4395 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4396 | */ |
4397 | @@ -10,11 +10,11 @@ |
4398 | exit('The constant PUN_ROOT must be defined and point to a valid FluxBB installation root directory.'); |
4399 | |
4400 | // Define the version and database revision that this code was written for |
4401 | -define('FORUM_VERSION', '1.4.2'); |
4402 | +define('FORUM_VERSION', '1.4.5'); |
4403 | |
4404 | -define('FORUM_DB_REVISION', 8); |
4405 | -define('FORUM_SI_REVISION', 1); |
4406 | -define('FORUM_PARSER_REVISION', 1); |
4407 | +define('FORUM_DB_REVISION', 11); |
4408 | +define('FORUM_SI_REVISION', 2); |
4409 | +define('FORUM_PARSER_REVISION', 2); |
4410 | |
4411 | // Block prefetch requests |
4412 | if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') |
4413 | @@ -38,10 +38,6 @@ |
4414 | if (defined('FORUM')) |
4415 | define('PUN', FORUM); |
4416 | |
4417 | -// If PUN isn't defined, config.php is missing or corrupt |
4418 | -if (!defined('PUN')) |
4419 | - exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install FluxBB first.'); |
4420 | - |
4421 | // Load the functions script |
4422 | require PUN_ROOT.'include/functions.php'; |
4423 | |
4424 | @@ -54,6 +50,13 @@ |
4425 | // Reverse the effect of register_globals |
4426 | forum_unregister_globals(); |
4427 | |
4428 | +// If PUN isn't defined, config.php is missing or corrupt |
4429 | +if (!defined('PUN')) |
4430 | +{ |
4431 | + header('Location: install.php'); |
4432 | + exit; |
4433 | +} |
4434 | + |
4435 | // Record the start time (will be used to calculate the generation time for the page) |
4436 | $pun_start = get_microtime(); |
4437 | |
4438 | @@ -130,7 +133,10 @@ |
4439 | !isset($pun_config['o_searchindex_revision']) || $pun_config['o_searchindex_revision'] < FORUM_SI_REVISION || |
4440 | !isset($pun_config['o_parser_revision']) || $pun_config['o_parser_revision'] < FORUM_PARSER_REVISION || |
4441 | version_compare($pun_config['o_cur_version'], FORUM_VERSION, '<')) |
4442 | - exit('Your FluxBB database is out-of-date and must be upgraded in order to continue. Please run <a href="'.PUN_ROOT.'db_update.php">db_update.php</a> in order to complete the upgrade process.'); |
4443 | + { |
4444 | + header('Location: db_update.php'); |
4445 | + exit; |
4446 | + } |
4447 | |
4448 | // Enable output buffering |
4449 | if (!defined('PUN_DISABLE_BUFFERING')) |
4450 | @@ -191,3 +197,6 @@ |
4451 | define('PUN_SEARCH_MIN_WORD', 3); |
4452 | if (!defined('PUN_SEARCH_MAX_WORD')) |
4453 | define('PUN_SEARCH_MAX_WORD', 20); |
4454 | + |
4455 | +if (!defined('FORUM_MAX_COOKIE_SIZE')) |
4456 | + define('FORUM_MAX_COOKIE_SIZE', 4048); |
4457 | |
4458 | === modified file 'include/common_admin.php' |
4459 | --- include/common_admin.php 2010-10-08 13:18:35 +0000 |
4460 | +++ include/common_admin.php 2011-04-21 10:05:56 +0000 |
4461 | @@ -1,7 +1,7 @@ |
4462 | <?php |
4463 | |
4464 | /** |
4465 | - * Copyright (C) 2008-2010 FluxBB |
4466 | + * Copyright (C) 2008-2011 FluxBB |
4467 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4468 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4469 | */ |
4470 | @@ -33,28 +33,42 @@ |
4471 | ?> |
4472 | <div id="adminconsole" class="block2col"> |
4473 | <div id="adminmenu" class="blockmenu"> |
4474 | - <h2><span><?php echo ($is_admin) ? $lang_admin_common['Admin menu'] : $lang_admin_common['Moderator menu'] ?></span></h2> |
4475 | + <h2><span><?php echo $lang_admin_common['Moderator menu'] ?></span></h2> |
4476 | <div class="box"> |
4477 | <div class="inbox"> |
4478 | <ul> |
4479 | <li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php"><?php echo $lang_admin_common['Index'] ?></a></li> |
4480 | -<?php if ($is_admin): ?> <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="admin_categories.php"><?php echo $lang_admin_common['Categories'] ?></a></li> |
4481 | -<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="admin_forums.php"><?php echo $lang_admin_common['Forums'] ?></a></li> |
4482 | -<?php endif; ?> <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> |
4483 | -<?php if ($is_admin): ?> <li<?php if ($page == 'groups') echo ' class="isactive"'; ?>><a href="admin_groups.php"><?php echo $lang_admin_common['User groups'] ?></a></li> |
4484 | -<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'options') echo ' class="isactive"'; ?>><a href="admin_options.php"><?php echo $lang_admin_common['Options'] ?></a></li> |
4485 | -<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'permissions') echo ' class="isactive"'; ?>><a href="admin_permissions.php"><?php echo $lang_admin_common['Permissions'] ?></a></li> |
4486 | -<?php endif; ?><?php if ($is_admin || $pun_config['o_censoring'] == '1'): ?> <li<?php if ($page == 'censoring') echo ' class="isactive"'; ?>><a href="admin_censoring.php"><?php echo $lang_admin_common['Censoring'] ?></a></li> |
4487 | -<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'ranks') echo ' class="isactive"'; ?>><a href="admin_ranks.php"><?php echo $lang_admin_common['Ranks'] ?></a></li> |
4488 | -<?php endif; ?><?php if ($is_admin || $pun_user['g_mod_ban_users'] == '1'): ?> <li<?php if ($page == 'bans') echo ' class="isactive"'; ?>><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li> |
4489 | -<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'prune') echo ' class="isactive"'; ?>><a href="admin_prune.php"><?php echo $lang_admin_common['Prune'] ?></a></li> |
4490 | -<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'maintenance') echo ' class="isactive"'; ?>><a href="admin_maintenance.php"><?php echo $lang_admin_common['Maintenance'] ?></a></li> |
4491 | -<?php endif; ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php"><?php echo $lang_admin_common['Reports'] ?></a></li> |
4492 | + <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> |
4493 | +<?php if ($is_admin || $pun_user['g_mod_ban_users'] == '1'): ?> <li<?php if ($page == 'bans') echo ' class="isactive"'; ?>><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li> |
4494 | +<?php endif; if ($is_admin || $pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2'): ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php"><?php echo $lang_admin_common['Reports'] ?></a></li> |
4495 | +<?php endif; ?> </ul> |
4496 | + </div> |
4497 | + </div> |
4498 | +<?php |
4499 | + |
4500 | + if ($is_admin) |
4501 | + { |
4502 | + |
4503 | +?> |
4504 | + <h2 class="block2"><span><?php echo $lang_admin_common['Admin menu'] ?></span></h2> |
4505 | + <div class="box"> |
4506 | + <div class="inbox"> |
4507 | + <ul> |
4508 | + <li<?php if ($page == 'options') echo ' class="isactive"'; ?>><a href="admin_options.php"><?php echo $lang_admin_common['Options'] ?></a></li> |
4509 | + <li<?php if ($page == 'permissions') echo ' class="isactive"'; ?>><a href="admin_permissions.php"><?php echo $lang_admin_common['Permissions'] ?></a></li> |
4510 | + <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="admin_categories.php"><?php echo $lang_admin_common['Categories'] ?></a></li> |
4511 | + <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="admin_forums.php"><?php echo $lang_admin_common['Forums'] ?></a></li> |
4512 | + <li<?php if ($page == 'groups') echo ' class="isactive"'; ?>><a href="admin_groups.php"><?php echo $lang_admin_common['User groups'] ?></a></li> |
4513 | + <li<?php if ($page == 'censoring') echo ' class="isactive"'; ?>><a href="admin_censoring.php"><?php echo $lang_admin_common['Censoring'] ?></a></li> |
4514 | + <li<?php if ($page == 'ranks') echo ' class="isactive"'; ?>><a href="admin_ranks.php"><?php echo $lang_admin_common['Ranks'] ?></a></li> |
4515 | + <li<?php if ($page == 'maintenance') echo ' class="isactive"'; ?>><a href="admin_maintenance.php"><?php echo $lang_admin_common['Maintenance'] ?></a></li> |
4516 | </ul> |
4517 | </div> |
4518 | </div> |
4519 | <?php |
4520 | |
4521 | + } |
4522 | + |
4523 | // See if there are any plugins |
4524 | $plugins = forum_list_plugins($is_admin); |
4525 | |
4526 | @@ -121,7 +135,7 @@ |
4527 | // Delete topics |
4528 | $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error()); |
4529 | // Delete subscriptions |
4530 | - $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error()); |
4531 | + $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error()); |
4532 | // Delete posts |
4533 | $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error()); |
4534 | |
4535 | |
4536 | === modified file 'include/dblayer/common_db.php' |
4537 | --- include/dblayer/common_db.php 2010-10-08 13:18:35 +0000 |
4538 | +++ include/dblayer/common_db.php 2011-04-21 10:05:56 +0000 |
4539 | @@ -1,7 +1,7 @@ |
4540 | <?php |
4541 | |
4542 | /** |
4543 | - * Copyright (C) 2008-2010 FluxBB |
4544 | + * Copyright (C) 2008-2011 FluxBB |
4545 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4546 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4547 | */ |
4548 | |
4549 | === modified file 'include/dblayer/mysql.php' |
4550 | --- include/dblayer/mysql.php 2010-10-08 13:18:35 +0000 |
4551 | +++ include/dblayer/mysql.php 2011-04-21 10:05:56 +0000 |
4552 | @@ -1,7 +1,7 @@ |
4553 | <?php |
4554 | |
4555 | /** |
4556 | - * Copyright (C) 2008-2010 FluxBB |
4557 | + * Copyright (C) 2008-2011 FluxBB |
4558 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4559 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4560 | */ |
4561 | @@ -230,7 +230,7 @@ |
4562 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4563 | while ($cur_index = $this->fetch_assoc($result)) |
4564 | { |
4565 | - if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) |
4566 | + if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4567 | { |
4568 | $exists = true; |
4569 | break; |
4570 | @@ -301,6 +301,16 @@ |
4571 | } |
4572 | |
4573 | |
4574 | + function rename_table($old_table, $new_table, $no_prefix = false) |
4575 | + { |
4576 | + // If there new table exists and the old one doesn't, then we're happy |
4577 | + if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) |
4578 | + return true; |
4579 | + |
4580 | + return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; |
4581 | + } |
4582 | + |
4583 | + |
4584 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4585 | { |
4586 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4587 | |
4588 | === modified file 'include/dblayer/mysql_innodb.php' |
4589 | --- include/dblayer/mysql_innodb.php 2010-10-08 13:18:35 +0000 |
4590 | +++ include/dblayer/mysql_innodb.php 2011-04-21 10:05:56 +0000 |
4591 | @@ -1,7 +1,7 @@ |
4592 | <?php |
4593 | |
4594 | /** |
4595 | - * Copyright (C) 2008-2010 FluxBB |
4596 | + * Copyright (C) 2008-2011 FluxBB |
4597 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4598 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4599 | */ |
4600 | @@ -244,7 +244,7 @@ |
4601 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4602 | while ($cur_index = $this->fetch_assoc($result)) |
4603 | { |
4604 | - if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) |
4605 | + if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4606 | { |
4607 | $exists = true; |
4608 | break; |
4609 | @@ -315,6 +315,16 @@ |
4610 | } |
4611 | |
4612 | |
4613 | + function rename_table($old_table, $new_table, $no_prefix = false) |
4614 | + { |
4615 | + // If there new table exists and the old one doesn't, then we're happy |
4616 | + if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) |
4617 | + return true; |
4618 | + |
4619 | + return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; |
4620 | + } |
4621 | + |
4622 | + |
4623 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4624 | { |
4625 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4626 | |
4627 | === modified file 'include/dblayer/mysqli.php' |
4628 | --- include/dblayer/mysqli.php 2010-10-08 13:18:35 +0000 |
4629 | +++ include/dblayer/mysqli.php 2011-04-21 10:05:56 +0000 |
4630 | @@ -1,7 +1,7 @@ |
4631 | <?php |
4632 | |
4633 | /** |
4634 | - * Copyright (C) 2008-2010 FluxBB |
4635 | + * Copyright (C) 2008-2011 FluxBB |
4636 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4637 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4638 | */ |
4639 | @@ -237,7 +237,7 @@ |
4640 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4641 | while ($cur_index = $this->fetch_assoc($result)) |
4642 | { |
4643 | - if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) |
4644 | + if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4645 | { |
4646 | $exists = true; |
4647 | break; |
4648 | @@ -308,6 +308,16 @@ |
4649 | } |
4650 | |
4651 | |
4652 | + function rename_table($old_table, $new_table, $no_prefix = false) |
4653 | + { |
4654 | + // If there new table exists and the old one doesn't, then we're happy |
4655 | + if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) |
4656 | + return true; |
4657 | + |
4658 | + return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; |
4659 | + } |
4660 | + |
4661 | + |
4662 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4663 | { |
4664 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4665 | |
4666 | === modified file 'include/dblayer/mysqli_innodb.php' |
4667 | --- include/dblayer/mysqli_innodb.php 2010-10-08 13:18:35 +0000 |
4668 | +++ include/dblayer/mysqli_innodb.php 2011-04-21 10:05:56 +0000 |
4669 | @@ -1,7 +1,7 @@ |
4670 | <?php |
4671 | |
4672 | /** |
4673 | - * Copyright (C) 2008-2010 FluxBB |
4674 | + * Copyright (C) 2008-2011 FluxBB |
4675 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4676 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4677 | */ |
4678 | @@ -250,7 +250,7 @@ |
4679 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4680 | while ($cur_index = $this->fetch_assoc($result)) |
4681 | { |
4682 | - if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) |
4683 | + if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4684 | { |
4685 | $exists = true; |
4686 | break; |
4687 | @@ -321,6 +321,16 @@ |
4688 | } |
4689 | |
4690 | |
4691 | + function rename_table($old_table, $new_table, $no_prefix = false) |
4692 | + { |
4693 | + // If there new table exists and the old one doesn't, then we're happy |
4694 | + if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) |
4695 | + return true; |
4696 | + |
4697 | + return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; |
4698 | + } |
4699 | + |
4700 | + |
4701 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4702 | { |
4703 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4704 | |
4705 | === modified file 'include/dblayer/pgsql.php' |
4706 | --- include/dblayer/pgsql.php 2010-10-08 13:18:35 +0000 |
4707 | +++ include/dblayer/pgsql.php 2011-04-21 10:05:56 +0000 |
4708 | @@ -1,7 +1,7 @@ |
4709 | <?php |
4710 | |
4711 | /** |
4712 | - * Copyright (C) 2008-2010 FluxBB |
4713 | + * Copyright (C) 2008-2011 FluxBB |
4714 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4715 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4716 | */ |
4717 | @@ -352,6 +352,16 @@ |
4718 | } |
4719 | |
4720 | |
4721 | + function rename_table($old_table, $new_table, $no_prefix = false) |
4722 | + { |
4723 | + // If there new table exists and the old one doesn't, then we're happy |
4724 | + if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) |
4725 | + return true; |
4726 | + |
4727 | + return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; |
4728 | + } |
4729 | + |
4730 | + |
4731 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4732 | { |
4733 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4734 | |
4735 | === modified file 'include/dblayer/sqlite.php' |
4736 | --- include/dblayer/sqlite.php 2010-10-08 13:18:35 +0000 |
4737 | +++ include/dblayer/sqlite.php 2011-04-21 10:05:56 +0000 |
4738 | @@ -1,7 +1,7 @@ |
4739 | <?php |
4740 | |
4741 | /** |
4742 | - * Copyright (C) 2008-2010 FluxBB |
4743 | + * Copyright (C) 2008-2011 FluxBB |
4744 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4745 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4746 | */ |
4747 | @@ -182,7 +182,7 @@ |
4748 | |
4749 | function affected_rows() |
4750 | { |
4751 | - return ($this->query_result) ? @sqlite_changes($this->query_result) : false; |
4752 | + return ($this->link_id) ? @sqlite_changes($this->link_id) : false; |
4753 | } |
4754 | |
4755 | |
4756 | @@ -349,6 +349,35 @@ |
4757 | } |
4758 | |
4759 | |
4760 | + function rename_table($old_name, $new_name, $no_prefix = false) |
4761 | + { |
4762 | + // If there new table exists and the old one doesn't, then we're happy |
4763 | + if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) |
4764 | + return true; |
4765 | + |
4766 | + $table = $this->get_table_info($old_name, $no_prefix); |
4767 | + |
4768 | + // Create new table |
4769 | + $newtable = str_replace('CREATE TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($old_name).' (', 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($new_name).' (', $table['sql']); |
4770 | + $result = $this->query($newtable) ? true : false; |
4771 | + |
4772 | + // Recreate indexes |
4773 | + if (!empty($table['indices'])) |
4774 | + { |
4775 | + foreach ($table['indices'] as $cur_index) |
4776 | + $result &= $this->query($cur_index) ? true : false; |
4777 | + } |
4778 | + |
4779 | + // Copy content across |
4780 | + $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($new_name).' SELECT * FROM '.($no_prefix ? '' : $this->prefix).$this->escape($old_name)) ? true : false; |
4781 | + |
4782 | + // Drop old table |
4783 | + $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name)); |
4784 | + |
4785 | + return $result; |
4786 | + } |
4787 | + |
4788 | + |
4789 | function get_table_info($table_name, $no_prefix = false) |
4790 | { |
4791 | // Grab table info |
4792 | |
4793 | === modified file 'include/email.php' |
4794 | --- include/email.php 2010-10-08 13:18:35 +0000 |
4795 | +++ include/email.php 2011-04-21 10:05:56 +0000 |
4796 | @@ -1,7 +1,7 @@ |
4797 | <?php |
4798 | |
4799 | /** |
4800 | - * Copyright (C) 2008-2010 FluxBB |
4801 | + * Copyright (C) 2008-2011 FluxBB |
4802 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4803 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4804 | */ |
4805 | @@ -10,6 +10,7 @@ |
4806 | if (!defined('PUN')) |
4807 | exit; |
4808 | |
4809 | +require PUN_ROOT.'include/utf8/utils/ascii.php'; |
4810 | |
4811 | // |
4812 | // Validate an email address |
4813 | @@ -43,6 +44,18 @@ |
4814 | |
4815 | |
4816 | // |
4817 | +// Only encode with base64, if there is at least one unicode character in the string |
4818 | +// |
4819 | +function encode_mail_text($str) |
4820 | +{ |
4821 | + if (utf8_is_ascii($str)) |
4822 | + return $str; |
4823 | + |
4824 | + return '=?UTF-8?B?'.base64_encode($str).'?='; |
4825 | +} |
4826 | + |
4827 | + |
4828 | +// |
4829 | // Wrapper for PHP's mail() |
4830 | // |
4831 | function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '') |
4832 | @@ -62,15 +75,15 @@ |
4833 | $reply_to_name = pun_trim(preg_replace('#[\n\r:]+#s', '', str_replace('"', '', $reply_to_name))); |
4834 | |
4835 | // Set up some headers to take advantage of UTF-8 |
4836 | - $from = "=?UTF-8?B?".base64_encode($from_name)."?=".' <'.$from_email.'>'; |
4837 | - $subject = "=?UTF-8?B?".base64_encode($subject)."?="; |
4838 | + $from = encode_mail_text($from_name).' <'.$from_email.'>'; |
4839 | + $subject = encode_mail_text($subject); |
4840 | |
4841 | $headers = 'From: '.$from."\r\n".'Date: '.gmdate('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset=utf-8'."\r\n".'X-Mailer: FluxBB Mailer'; |
4842 | |
4843 | // If we specified a reply-to email, we deal with it here |
4844 | if (!empty($reply_to_email)) |
4845 | { |
4846 | - $reply_to = "=?UTF-8?B?".base64_encode($reply_to_name)."?=".' <'.$reply_to_email.'>'; |
4847 | + $reply_to = encode_mail_text($reply_to_name).' <'.$reply_to_email.'>'; |
4848 | |
4849 | $headers .= "\r\n".'Reply-To: '.$reply_to; |
4850 | } |
4851 | |
4852 | === modified file 'include/functions.php' |
4853 | --- include/functions.php 2011-04-18 14:00:54 +0000 |
4854 | +++ include/functions.php 2011-04-21 10:05:56 +0000 |
4855 | @@ -1,7 +1,7 @@ |
4856 | <?php |
4857 | |
4858 | /** |
4859 | - * Copyright (C) 2008-2010 FluxBB |
4860 | + * Copyright (C) 2008-2011 FluxBB |
4861 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4862 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4863 | */ |
4864 | @@ -25,31 +25,46 @@ |
4865 | |
4866 | $now = time(); |
4867 | |
4868 | - // We assume it's a guest |
4869 | - $cookie = array('user_id' => 1, 'password_hash' => 'Guest'); |
4870 | - |
4871 | - // If a cookie is set, we get the user_id and password hash from it |
4872 | - if (isset($_COOKIE[$cookie_name])) |
4873 | - list($cookie['user_id'], $cookie['password_hash'], $cookie['expiration_time']) = @unserialize($_COOKIE[$cookie_name]); |
4874 | - |
4875 | - if ($cookie['user_id'] > 1) |
4876 | - { |
4877 | + // If the cookie is set and it matches the correct pattern, then read the values from it |
4878 | + if (isset($_COOKIE[$cookie_name]) && preg_match('/^(\d+)\|([0-9a-fA-F]+)\|(\d+)\|([0-9a-fA-F]+)$/', $_COOKIE[$cookie_name], $matches)) |
4879 | + { |
4880 | + $cookie = array( |
4881 | + 'user_id' => intval($matches[1]), |
4882 | + 'password_hash' => $matches[2], |
4883 | + 'expiration_time' => intval($matches[3]), |
4884 | + 'cookie_hash' => $matches[4], |
4885 | + ); |
4886 | + } |
4887 | + |
4888 | + // If it has a non-guest user, and hasn't expired |
4889 | + if (isset($cookie) && $cookie['user_id'] > 1 && $cookie['expiration_time'] > $now) |
4890 | + { |
4891 | + // If the cookie has been tampered with |
4892 | + if (forum_hmac($cookie['user_id'].'|'.$cookie['expiration_time'], $cookie_seed.'_cookie_hash') != $cookie['cookie_hash']) |
4893 | + { |
4894 | + $expire = $now + 31536000; // The cookie expires after a year |
4895 | + pun_setcookie(1, pun_hash(uniqid(rand(), true)), $expire); |
4896 | + set_default_user(); |
4897 | + |
4898 | + return; |
4899 | + } |
4900 | + |
4901 | // Check if there's a user with the user ID and password hash from the cookie |
4902 | $result = $db->query('SELECT u.*, g.*, o.logged, o.idle FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.user_id=u.id WHERE u.id='.intval($cookie['user_id'])) or error('Unable to fetch user information', __FILE__, __LINE__, $db->error()); |
4903 | $pun_user = $db->fetch_assoc($result); |
4904 | |
4905 | // If user authorisation failed |
4906 | - if (!isset($pun_user['id']) || md5($cookie_seed.$pun_user['password']) !== $cookie['password_hash']) |
4907 | + if (!isset($pun_user['id']) || forum_hmac($pun_user['password'], $cookie_seed.'_password_hash') !== $cookie['password_hash']) |
4908 | { |
4909 | $expire = $now + 31536000; // The cookie expires after a year |
4910 | - pun_setcookie(1, md5(uniqid(rand(), true)), $expire); |
4911 | + pun_setcookie(1, pun_hash(uniqid(rand(), true)), $expire); |
4912 | set_default_user(); |
4913 | |
4914 | return; |
4915 | } |
4916 | |
4917 | // Send a new, updated cookie with a new expiration timestamp |
4918 | - $expire = (intval($cookie['expiration_time']) > $now + $pun_config['o_timeout_visit']) ? $now + 1209600 : $now + $pun_config['o_timeout_visit']; |
4919 | + $expire = ($cookie['expiration_time'] > $now + $pun_config['o_timeout_visit']) ? $now + 1209600 : $now + $pun_config['o_timeout_visit']; |
4920 | pun_setcookie($pun_user['id'], $pun_user['password'], $expire); |
4921 | |
4922 | // Set a default language if the user selected language no longer exists |
4923 | @@ -159,10 +174,10 @@ |
4924 | // |
4925 | function get_current_url($max_length = 0) |
4926 | { |
4927 | - $protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? 'http://' : 'https://'; |
4928 | - $port = (isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http://') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https://')) && strpos($_SERVER['HTTP_HOST'], ':') === false) ? ':'.$_SERVER['SERVER_PORT'] : ''; |
4929 | + $protocol = get_current_protocol(); |
4930 | + $port = (isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https')) && strpos($_SERVER['HTTP_HOST'], ':') === false) ? ':'.$_SERVER['SERVER_PORT'] : ''; |
4931 | |
4932 | - $url = urldecode($protocol.$_SERVER['HTTP_HOST'].$port.$_SERVER['REQUEST_URI']); |
4933 | + $url = urldecode($protocol.'://'.$_SERVER['HTTP_HOST'].$port.$_SERVER['REQUEST_URI']); |
4934 | |
4935 | if (strlen($url) <= $max_length || $max_length == 0) |
4936 | return $url; |
4937 | @@ -173,6 +188,53 @@ |
4938 | |
4939 | |
4940 | // |
4941 | +// Fetch the current protocol in use - http or https |
4942 | +// |
4943 | +function get_current_protocol() |
4944 | +{ |
4945 | + $protocol = 'http'; |
4946 | + |
4947 | + // Check if the server is claiming to using HTTPS |
4948 | + if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') |
4949 | + $protocol = 'https'; |
4950 | + |
4951 | + // If we are behind a reverse proxy try to decide which protocol it is using |
4952 | + if (defined('FORUM_BEHIND_REVERSE_PROXY')) |
4953 | + { |
4954 | + // Check if we are behind a Microsoft based reverse proxy |
4955 | + if (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) != 'off') |
4956 | + $protocol = 'https'; |
4957 | + |
4958 | + // Check if we're behind a "proper" reverse proxy, and what protocol it's using |
4959 | + if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) |
4960 | + $protocol = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']); |
4961 | + } |
4962 | + |
4963 | + return $protocol; |
4964 | +} |
4965 | + |
4966 | +// |
4967 | +// Fetch the base_url, optionally support HTTPS and HTTP |
4968 | +// |
4969 | +function get_base_url($support_https = false) |
4970 | +{ |
4971 | + global $pun_config; |
4972 | + static $base_url; |
4973 | + |
4974 | + if (!$support_https) |
4975 | + return $pun_config['o_base_url']; |
4976 | + |
4977 | + if (!isset($base_url)) |
4978 | + { |
4979 | + // Make sure we are using the correct protocol |
4980 | + $base_url = str_replace(array('http://', 'https://'), get_current_protocol().'://', $pun_config['o_base_url']); |
4981 | + } |
4982 | + |
4983 | + return $base_url; |
4984 | +} |
4985 | + |
4986 | + |
4987 | +// |
4988 | // Fill $pun_user with default values (for guests) |
4989 | // |
4990 | function set_default_user() |
4991 | @@ -224,6 +286,41 @@ |
4992 | |
4993 | |
4994 | // |
4995 | +// SHA1 HMAC with PHP 4 fallback |
4996 | +// |
4997 | +function forum_hmac($data, $key, $raw_output = false) |
4998 | +{ |
4999 | + if (function_exists('hash_hmac')) |
5000 | + return hash_hmac('sha1', $data, $key, $raw_output); |
The diff has been truncated for viewing.
Il y a un petit bug avec le search.php (avant les tests à grande échelle!). Lors d'une recherche "Mes messages", "Discussions sans réponse" ou "Messages récents", le fil d'Ariane en haut est de la forme :
"Forum > Discussions de la recherche > XXXXX"
Lorsqu'on clique sur "Discussions de la recherche", on est renvoyé vers le formulaire search.php, avec en bas :
"Désolé, aucun résultat n'a été trouvé pour votre recherche."