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: mp+58574@code.launchpad.net |
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 | 1 | -- Requêtes pour transformer une BDD de fluxbb 1.4.2 en 1.4.5 | ||
6 | 2 | |||
7 | 3 | CREATE TABLE `forum_topic_subscriptions` SELECT * FROM `forum_subscriptions`; | ||
8 | 4 | |||
9 | 5 | CREATE TABLE IF NOT EXISTS `forum_forum_subscriptions` ( | ||
10 | 6 | `user_id` int(10) unsigned NOT NULL DEFAULT '0', | ||
11 | 7 | `forum_id` int(10) unsigned NOT NULL DEFAULT '0', | ||
12 | 8 | PRIMARY KEY (`user_id`,`forum_id`) | ||
13 | 9 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
14 | 10 | |||
15 | 11 | -- MaJ des numéros de version : | ||
16 | 12 | |||
17 | 13 | UPDATE forum_config SET conf_value = '1.4.5' WHERE conf_name = 'o_cur_version'; | ||
18 | 14 | UPDATE forum_config SET conf_value = '11' WHERE conf_name = 'o_database_revision'; | ||
19 | 15 | UPDATE forum_config SET conf_value = '2' WHERE conf_name = 'o_searchindex_revision'; | ||
20 | 16 | UPDATE forum_config SET conf_value = '2' WHERE conf_name = 'o_parser_revision'; | ||
21 | 17 | |||
22 | 18 | INSERT INTO forum_config VALUES ('o_forum_subscriptions', '0'); | ||
23 | 19 | INSERT INTO forum_config VALUES ('o_topic_subscriptions', '1'); | ||
24 | 20 | |||
25 | 21 | -- C'est tout :-) | ||
26 | 22 | COMMIT; | ||
27 | 23 | |||
28 | 24 | -- N'oubliez pas de vider le cache de fluxbb ! | ||
29 | 25 | |||
30 | 26 | |||
31 | 27 | |||
32 | 28 | -- Si la migration s'est bien passée, vous pouvez nettoyer via les requêtes suivantes : | ||
33 | 29 | |||
34 | 30 | -- DROP TABLE `forum_subscriptions`; | ||
35 | 31 | -- DELETE FROM `forum_config` WHERE `conf_name` = 'o_subscriptions'; | ||
36 | 32 | -- COMMIT; | ||
37 | 0 | 33 | ||
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 | 1 | USE ubuntu_fr; | ||
43 | 2 | |||
44 | 3 | -- Requêtes données par le script db_update.php | ||
45 | 4 | |||
46 | 5 | ALTER TABLE forum_users ADD dst TINYINT(1) NOT NULL DEFAULT 0 AFTER timezone; | ||
47 | 6 | ALTER TABLE forum_online ADD last_post INT(10) UNSIGNED; | ||
48 | 7 | ALTER TABLE forum_online ADD last_search INT(10) UNSIGNED; | ||
49 | 8 | ALTER TABLE forum_users ADD last_search INT(10) UNSIGNED AFTER last_post; | ||
50 | 9 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_database_revision', '0'); | ||
51 | 10 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_searchindex_revision', '0'); | ||
52 | 11 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_parser_revision', '0'); | ||
53 | 12 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_default_email_setting', '1'); | ||
54 | 13 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_topic_views', '0'); | ||
55 | 14 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_signatures', '1'); | ||
56 | 15 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_smtp_ssl', '0'); | ||
57 | 16 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_default_dst', '0'); | ||
58 | 17 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_quote_depth', '3'); | ||
59 | 18 | INSERT INTO forum_config (conf_name, conf_value) VALUES ('o_feed_type', '2'); | ||
60 | 19 | UPDATE forum_config SET conf_name = 'o_default_timezone' WHERE conf_name = 'o_server_timezone'; | ||
61 | 20 | |||
62 | 21 | UPDATE forum_config SET conf_value = '8' WHERE conf_name = 'o_database_revision'; | ||
63 | 22 | UPDATE forum_config SET conf_value = '1' WHERE conf_name = 'o_searchindex_revision'; | ||
64 | 23 | UPDATE forum_config SET conf_value = '1' WHERE conf_name = 'o_parser_revision'; | ||
65 | 24 | UPDATE forum_config SET conf_value = '1.4.2' WHERE conf_name = 'o_cur_version'; | ||
66 | 25 | |||
67 | 26 | ALTER TABLE forum_groups ADD g_moderator TINYINT(1) NOT NULL DEFAULT 0 AFTER g_user_title; | ||
68 | 27 | UPDATE forum_groups SET g_moderator = 1 WHERE g_id = 2; | ||
69 | 28 | |||
70 | 29 | DELETE FROM forum_config WHERE conf_name = 'p_mod_edit_users'; | ||
71 | 30 | ALTER TABLE forum_groups ADD g_mod_edit_users TINYINT(1) NOT NULL DEFAULT 0 AFTER g_moderator; | ||
72 | 31 | |||
73 | 32 | DELETE FROM forum_config WHERE conf_name = 'p_mod_rename_users'; | ||
74 | 33 | ALTER TABLE forum_groups ADD g_mod_rename_users TINYINT(1) NOT NULL DEFAULT 0 AFTER g_mod_edit_users; | ||
75 | 34 | |||
76 | 35 | DELETE FROM forum_config WHERE conf_name = 'p_mod_change_passwords'; | ||
77 | 36 | ALTER TABLE forum_groups ADD g_mod_change_passwords TINYINT(1) NOT NULL DEFAULT 0 AFTER g_mod_rename_users; | ||
78 | 37 | |||
79 | 38 | DELETE FROM forum_config WHERE conf_name = 'p_mod_ban_users'; | ||
80 | 39 | ALTER TABLE forum_groups ADD g_mod_ban_users TINYINT(1) NOT NULL DEFAULT 0 AFTER g_mod_change_passwords; | ||
81 | 40 | |||
82 | 41 | TRUNCATE TABLE forum_online; | ||
83 | 42 | ALTER TABLE forum_online ADD UNIQUE INDEX forum_online_user_id_ident_idx (user_id,ident); | ||
84 | 43 | ALTER TABLE forum_online ADD INDEX forum_online_ident_idx (ident); | ||
85 | 44 | ALTER TABLE forum_online ADD INDEX forum_online_logged_idx (logged); | ||
86 | 45 | |||
87 | 46 | ALTER TABLE forum_topics ADD INDEX forum_topics_last_post_idx (last_post); | ||
88 | 47 | ALTER TABLE forum_bans ADD INDEX forum_bans_username_idx (username); | ||
89 | 48 | ALTER TABLE forum_users ADD UNIQUE INDEX forum_users_username_idx (username); | ||
90 | 49 | |||
91 | 50 | ALTER TABLE forum_groups ADD g_view_users TINYINT(1) NOT NULL DEFAULT 1 AFTER g_read_board; | ||
92 | 51 | ALTER TABLE forum_users ADD last_email_sent INT(10) UNSIGNED AFTER last_search; | ||
93 | 52 | ALTER TABLE forum_groups ADD g_send_email TINYINT(1) NOT NULL DEFAULT 1 AFTER g_search_users; | ||
94 | 53 | ALTER TABLE forum_groups ADD g_email_flood SMALLINT(6) NOT NULL DEFAULT 60 AFTER g_search_flood; | ||
95 | 54 | UPDATE forum_groups SET g_send_email = 0 WHERE g_id = 3; | ||
96 | 55 | UPDATE forum_groups SET g_email_flood = 0 WHERE g_id IN (1,2,3); | ||
97 | 56 | ALTER TABLE forum_users ADD auto_notify TINYINT(1) NOT NULL DEFAULT 0 AFTER notify_with_post; | ||
98 | 57 | |||
99 | 58 | -- Suppression des sujets incohérents | ||
100 | 59 | |||
101 | 60 | DELETE FROM forum_topics WHERE last_poster IS NULL; | ||
102 | 61 | DELETE FROM forum_topics WHERE last_post_id = 0; | ||
103 | 62 | |||
104 | 63 | -- Ajout et remplissage du champ first_post_id | ||
105 | 64 | |||
106 | 65 | ALTER TABLE forum_topics ADD first_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER posted; | ||
107 | 66 | ALTER TABLE forum_topics ADD INDEX forum_topics_first_post_id_idx (first_post_id); | ||
108 | 67 | 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 | 68 | |||
110 | 69 | |||
111 | 70 | ALTER TABLE forum_bans ADD ban_creator INT(10) UNSIGNED NOT NULL DEFAULT 0; | ||
112 | 71 | ALTER TABLE forum_users ADD time_format TINYINT(1) NOT NULL DEFAULT 0 AFTER dst; | ||
113 | 72 | ALTER TABLE forum_users ADD date_format TINYINT(1) NOT NULL DEFAULT 0 AFTER time_format; | ||
114 | 73 | |||
115 | 74 | |||
116 | 75 | -- Requêtes complémentaires | ||
117 | 76 | |||
118 | 77 | -- Suppression de champs obsolètes | ||
119 | 78 | |||
120 | 79 | ALTER TABLE forum_forums DROP parent_forum_id; | ||
121 | 80 | ALTER TABLE forum_users DROP use_avatar; | ||
122 | 81 | ALTER TABLE forum_users DROP save_pass; | ||
123 | 82 | ALTER TABLE forum_groups DROP g_post_polls; | ||
124 | 83 | ALTER TABLE forum_groups DROP g_edit_subjects_interval; | ||
125 | 84 | |||
126 | 85 | |||
127 | 86 | -- Suppression des users non vérifiés antérieurs au 15 septembre 2010 | ||
128 | 87 | |||
129 | 88 | DELETE FROM forum_users WHERE group_id = 32000 AND registered < 1284501600; | ||
130 | 89 | OPTIMIZE TABLE forum_users; | ||
131 | 90 | |||
132 | 91 | -- Passage des users non-vérifiés restants en groupe 0 | ||
133 | 92 | |||
134 | 93 | UPDATE forum_users SET group_id = 0 WHERE group_id = 32000; | ||
135 | 94 | |||
136 | 95 | -- Changement des champs de mail à varchar(80) | ||
137 | 96 | |||
138 | 97 | ALTER TABLE forum_bans CHANGE email email VARCHAR(80); | ||
139 | 98 | ALTER TABLE forum_posts CHANGE poster_email poster_email VARCHAR(80); | ||
140 | 99 | ALTER TABLE forum_users CHANGE email email VARCHAR(80); | ||
141 | 100 | ALTER TABLE forum_users CHANGE msn msn VARCHAR(80); | ||
142 | 101 | |||
143 | 102 | -- Changement des champs d'IP à varchar(39) --> IPv6 | ||
144 | 103 | |||
145 | 104 | ALTER TABLE forum_posts CHANGE poster_ip poster_ip VARCHAR(39); | ||
146 | 105 | ALTER TABLE forum_users CHANGE registration_ip registration_ip VARCHAR(39); | ||
147 | 106 | |||
148 | 107 | |||
149 | 108 | -- Changement du champ de recherche à mediumtext | ||
150 | 109 | |||
151 | 110 | ALTER TABLE forum_search_cache CHANGE search_data search_data MEDIUMTEXT; | ||
152 | 111 | |||
153 | 112 | |||
154 | 113 | -- Changement du champ message à mediumtext | ||
155 | 114 | |||
156 | 115 | ALTER TABLE forum_posts CHANGE message message MEDIUMTEXT; | ||
157 | 116 | 0 | ||
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 | 1 | USE ubuntu_devforum; | ||
163 | 2 | |||
164 | 3 | -- phpMyAdmin SQL Dump | ||
165 | 4 | -- version 3.3.2deb1 | ||
166 | 5 | -- http://www.phpmyadmin.net | ||
167 | 6 | -- | ||
168 | 7 | -- Serveur: localhost | ||
169 | 8 | -- Généré le : Ven 08 Octobre 2010 à 15:00 | ||
170 | 9 | -- Version du serveur: 5.1.41 | ||
171 | 10 | -- Version de PHP: 5.3.2-1ubuntu4.5ppa5~lucid1 | ||
172 | 11 | |||
173 | 12 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; | ||
174 | 13 | |||
175 | 14 | |||
176 | 15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
177 | 16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
178 | 17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
179 | 18 | /*!40101 SET NAMES utf8 */; | ||
180 | 19 | |||
181 | 20 | -- | ||
182 | 21 | -- Base de données: `ubuntu_devforum` | ||
183 | 22 | -- | ||
184 | 23 | |||
185 | 24 | -- -------------------------------------------------------- | ||
186 | 25 | |||
187 | 26 | -- | ||
188 | 27 | -- Structure de la table `forum_toolbar_conf` | ||
189 | 28 | -- | ||
190 | 29 | |||
191 | 30 | CREATE TABLE IF NOT EXISTS `forum_toolbar_conf` ( | ||
192 | 31 | `conf_name` varchar(40) NOT NULL DEFAULT '', | ||
193 | 32 | `conf_value` varchar(40) NOT NULL DEFAULT '', | ||
194 | 33 | PRIMARY KEY (`conf_name`) | ||
195 | 34 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
196 | 35 | |||
197 | 36 | -- | ||
198 | 37 | -- Contenu de la table `forum_toolbar_conf` | ||
199 | 38 | -- | ||
200 | 39 | |||
201 | 40 | INSERT INTO `forum_toolbar_conf` (`conf_name`, `conf_value`) VALUES | ||
202 | 41 | ('enable_form', '1'), | ||
203 | 42 | ('enable_quickform', '1'), | ||
204 | 43 | ('img_pack', 'smooth'), | ||
205 | 44 | ('nb_smilies', '12'), | ||
206 | 45 | ('pop_up_width', '240'), | ||
207 | 46 | ('pop_up_height', '200'), | ||
208 | 47 | ('button_size', '4096'), | ||
209 | 48 | ('button_width', '32'), | ||
210 | 49 | ('button_height', '32'); | ||
211 | 50 | |||
212 | 51 | -- -------------------------------------------------------- | ||
213 | 52 | |||
214 | 53 | -- | ||
215 | 54 | -- Structure de la table `forum_toolbar_tags` | ||
216 | 55 | -- | ||
217 | 56 | |||
218 | 57 | CREATE TABLE IF NOT EXISTS `forum_toolbar_tags` ( | ||
219 | 58 | `name` varchar(20) NOT NULL DEFAULT '', | ||
220 | 59 | `code` varchar(20) NOT NULL DEFAULT '', | ||
221 | 60 | `enable_form` tinyint(1) NOT NULL DEFAULT '0', | ||
222 | 61 | `enable_quick` tinyint(1) NOT NULL DEFAULT '0', | ||
223 | 62 | `image` varchar(40) NOT NULL DEFAULT '', | ||
224 | 63 | `func` tinyint(1) NOT NULL DEFAULT '0', | ||
225 | 64 | `position` tinyint(2) unsigned NOT NULL DEFAULT '1', | ||
226 | 65 | PRIMARY KEY (`name`) | ||
227 | 66 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
228 | 67 | |||
229 | 68 | -- | ||
230 | 69 | -- Contenu de la table `forum_toolbar_tags` | ||
231 | 70 | -- | ||
232 | 71 | |||
233 | 72 | INSERT INTO `forum_toolbar_tags` (`name`, `code`, `enable_form`, `enable_quick`, `image`, `func`, `position`) VALUES | ||
234 | 73 | ('smilies', '', 1, 1, 'bt_smilies.png', 0, 0), | ||
235 | 74 | ('bold', 'b', 1, 1, 'bt_bold.png', 0, 1), | ||
236 | 75 | ('italic', 'i', 1, 1, 'bt_italic.png', 0, 2), | ||
237 | 76 | ('underline', 'u', 1, 1, 'bt_underline.png', 0, 3), | ||
238 | 77 | ('strike', 's', 1, 0, 'bt_strike.png', 0, 4), | ||
239 | 78 | ('sup', 'sup', 1, 0, 'bt_sup.png', 0, 5), | ||
240 | 79 | ('sub', 'sub', 1, 0, 'bt_sub.png', 0, 6), | ||
241 | 80 | ('heading', 'h', 0, 0, 'bt_size_plus.png', 0, 7), | ||
242 | 81 | ('left', 'left', 1, 0, 'bt_align_left.png', 0, 8), | ||
243 | 82 | ('right', 'right', 1, 0, 'bt_align_right.png', 0, 9), | ||
244 | 83 | ('center', 'center', 1, 0, 'bt_align_center.png', 0, 10), | ||
245 | 84 | ('justify', 'justify', 1, 0, 'bt_align_justify.png', 0, 11), | ||
246 | 85 | ('color', 'color', 0, 0, 'bt_color.png', 0, 12), | ||
247 | 86 | ('q', 'q', 1, 0, 'bt_quote.png', 0, 13), | ||
248 | 87 | ('acronym', 'acronym', 1, 0, 'bt_acronym.png', 1, 14), | ||
249 | 88 | ('img', 'img', 1, 1, 'bt_img.png', 2, 15), | ||
250 | 89 | ('code', 'code', 1, 1, 'bt_pre.png', 0, 16), | ||
251 | 90 | ('quote', 'quote', 1, 1, 'bt_bquote.png', 1, 17), | ||
252 | 91 | ('link', 'url', 1, 1, 'bt_link.png', 2, 18), | ||
253 | 92 | ('email', 'email', 0, 0, 'bt_email.png', 2, 19), | ||
254 | 93 | ('video', 'video', 1, 1, 'bt_video.png', 3, 20), | ||
255 | 94 | ('li', '*', 1, 0, 'bt_li.png', 0, 21), | ||
256 | 95 | ('list', 'list', 1, 0, 'bt_ul.png', 1, 22); | ||
257 | 96 | 0 | ||
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 | 1 | Comment installer le forum ubuntu-fr en local : | ||
263 | 2 | |||
264 | 3 | - créez une BDD | ||
265 | 4 | - créez les trois tables suivantes : | ||
266 | 5 | |||
267 | 6 | CREATE TABLE IF NOT EXISTS `forum_annonces` ( | ||
268 | 7 | `forum_id` int(11) NOT NULL default '0', | ||
269 | 8 | `forum_annonce` text, | ||
270 | 9 | `forum_annonce_visible` tinyint(1) NOT NULL default '0', | ||
271 | 10 | PRIMARY KEY (`forum_id`) | ||
272 | 11 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
273 | 12 | |||
274 | 13 | CREATE TABLE IF NOT EXISTS `forum_toolbar_tags` ( | ||
275 | 14 | `name` varchar(20) NOT NULL, | ||
276 | 15 | `code` varchar(20) NOT NULL, | ||
277 | 16 | `enable_form` tinyint(1) NOT NULL default '0', | ||
278 | 17 | `enable_quick` tinyint(1) NOT NULL default '0', | ||
279 | 18 | `image` varchar(40) NOT NULL, | ||
280 | 19 | `func` tinyint(1) NOT NULL default '0', | ||
281 | 20 | `position` tinyint(2) UNSIGNED NOT NULL default '1', | ||
282 | 21 | PRIMARY KEY (`name`) | ||
283 | 22 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
284 | 23 | |||
285 | 24 | CREATE TABLE IF NOT EXISTS `forum_toolbar_conf` ( | ||
286 | 25 | `conf_name` varchar(40) NOT NULL, | ||
287 | 26 | `conf_value` varchar(40) NOT NULL, | ||
288 | 27 | PRIMARY KEY (`conf_name`) | ||
289 | 28 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
290 | 29 | |||
291 | 30 | - Copiez les fichiers du forum dans le dossier "/var/www" (par exemple dans un sous dossier "forum") | ||
292 | 31 | - Rendez vous sur la page d'installation (par exemple http://localhost/forum/install.php) | ||
293 | 32 | - Renseignez tous les champs et choisissez "forum_" comme préfixe de la BDD | ||
294 | 33 | - Une fois l'installation finie, vous devrez modifier la table "forum_forums" de la manière suivante: | ||
295 | 34 | |||
296 | 35 | ALTER TABLE forum_forums ADD `forum_type` int(1) NOT NULL; | ||
297 | 36 | |||
298 | 37 | |||
299 | 38 | Le forum est maintenant fonctionnel !!! | ||
300 | 39 | ...mais le CSS n'est pas encore en place. | ||
301 | 40 | |||
302 | 41 | |||
303 | 42 | Ces ressources sont hébergées séparément, car elles sont communes aux divers sites de ubuntu-fr. | ||
304 | 43 | Vous devez télécharger le projet STATIC: | ||
305 | 44 | bzr branch lp:ubuntu-fr-static | ||
306 | 45 | |||
307 | 46 | - Placez le contenu de ce dossier dans, par exemple, "/var/www/STATIC" | ||
308 | 47 | - Éditez le fichier "config.php" du forum et ajoutez y "define('UFR_STATIC', 'CHEMIN_VERS_STATIC/theme2010/');" | ||
309 | 48 | Si vous avez suivi l'exemple, il faudra mettre "define('UFR_STATIC', '../STATIC/theme2010/');" | ||
310 | 49 | |||
311 | 50 | Et voila, amusez vous bien ! :-) | ||
312 | 51 | |||
313 | 52 | Astuces : Pour mettre le forum en mode "debug" (affichage de toutes les requêtes SQL en bas de page), | ||
314 | 53 | éditez le fichier "config.php" et ajoutez y les deux lignes suivantes : | ||
315 | 54 | define('PUN_DEBUG', 1); | ||
316 | 55 | define('PUN_SHOW_QUERIES', 1); | ||
317 | 56 | |||
318 | 0 | 57 | ||
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 @@ | |||
416 | 1 | Les fichiers modifiés par rapport à FluxBB : | 1 | ===================== |
417 | 2 | include/templates/main.tpl | 2 | FluxBB 1.4 Readme |
418 | 3 | 3 | ===================== | |
419 | 4 | Fil d'ariane | 4 | |
420 | 5 | viewtopic.php l361 (pour la rc) l371 pour 1.4 | 5 | About |
421 | 6 | viewforum.php l48 | 6 | ---------------- |
422 | 7 | index.php | 7 | FluxBB is an open source forum application released under the GNU General Public |
423 | 8 | Stats | 8 | Licence. It is free to download and use and will remain so. FluxBB was conceived and |
424 | 9 | index.php l249 | 9 | designed to be fast and light with less of the "not so essential" features that some |
425 | 10 | FIXME : il y a peut être une façon plus élégante de le faire | 10 | of the other forums have whilst not sacrificing essential functionality or usability. |
426 | 11 | Redirection: | 11 | |
427 | 12 | functions.php l1288 | 12 | Requirements |
428 | 13 | 13 | ---------------- | |
429 | 14 | 14 | - A webserver | |
430 | 15 | FLUXBB 1.4.0 : | 15 | - PHP 4.4.0 or later |
431 | 16 | 16 | - A database such as MySQL 4.1.2 or later, PostgreSQL 7.0 or later, or SQLite 2 | |
432 | 17 | Liens de recherche (searchlinks) ajoutés dans header.php | 17 | |
433 | 18 | pun_searchlinks est appelé depuis main.tpl | 18 | Recommendations |
434 | 19 | J'ai pris la même classe que pour les liens de navigation "navlinks" (à différencier si ça pose problème au CSS) | 19 | ------------------- |
435 | 20 | 20 | - Make use of a PHP accelerator such as APC or XCache | |
436 | 21 | 21 | - Make sure PHP has the zlib module installed to allow FluxBB to gzip output | |
437 | 22 | Mise en forme des pages admins : | 22 | |
438 | 23 | - inclusion des feuilles de style site_css.php dans admin.tpl | 23 | Links |
439 | 24 | En fait il faudrait refaire entièrement admin.tpl pour le faire correspondre à main.tpl | 24 | --------- |
440 | 25 | (bonjour les mises à jour de FluxBB ...) | 25 | |
441 | 26 | -> ça c'est bon, je viens de le faire | 26 | - Homepage: http://fluxbb.org |
442 | 27 | 27 | - Documentation: http://fluxbb.org/docs/ | |
443 | 28 | 28 | - Community: http://fluxbb.org/forums/ | |
444 | 29 | Différentiation de la recherche rapide et du formulaire de recherche : | 29 | - Resources: http://fluxbb.org/resources/ |
445 | 30 | id="search" changé en id="searchform" | 30 | - IRC: irc://irc.freenode.net/fluxbb |
446 | 31 | search.php ligne 662 | 31 | - Development: http://github.com/fluxbb/fluxbb |
354 | 32 | |||
355 | 33 | Ajout d'une classe pour l'ip de connexion: | ||
356 | 34 | viewtopic.php l286 | ||
357 | 35 | |||
358 | 36 | |||
359 | 37 | Décochage par défaut de la case "créer un lien" pour les déplacements de topic | ||
360 | 38 | moderate.php l483 | ||
361 | 39 | Ligne avant modif : | ||
362 | 40 | <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 | 41 | |||
364 | 42 | |||
365 | 43 | Affichage des annonces des forums (div "announce-forum") | ||
366 | 44 | viewforum.php L92 à L113 | ||
367 | 45 | |||
368 | 46 | |||
369 | 47 | Mod affichage de l'accueil + gagnant du mois : | ||
370 | 48 | Voir plugins/AP_Reception.php + lang/Francais/reception.php + index.php (L58 à L79) | ||
371 | 49 | Les chaines correspondantes sont stockées dans deux nouvelles clefs de la table config: c_welcome_message et c_winner_message. | ||
372 | 50 | Pas de modification de la structure de la base. Les clefs se créent automatiquement, rien de spécial à faire. | ||
373 | 51 | |||
374 | 52 | |||
375 | 53 | Affichage de usertitle uniquement pour admins et modos. | ||
376 | 54 | viewtopic.php l360 : | ||
377 | 55 | <?php if ($pun_user['g_id'] <= 2) echo ' <dd class="usertitle"><strong>'.$user_title.'</strong></dd>'; ?> | ||
378 | 56 | Ligne originale : | ||
379 | 57 | <dd class="usertitle"><strong><?php echo $user_title ?></strong></dd> | ||
380 | 58 | |||
381 | 59 | |||
382 | 60 | Ne pas chercher les "messages récents" et "sans réponses" dans les sections Divers: | ||
383 | 61 | Ajout des conditions AND t.forum_id!=7 AND t.forum_id!=43 AND t.forum_id!=8 | ||
384 | 62 | dans search.php L296 305 et 335 | ||
385 | 63 | |||
386 | 64 | Limiter les résultats à 200 topics : | ||
387 | 65 | Ajout d'un LIMIT 200 dans search.php L296 305 et 335 | ||
388 | 66 | |||
389 | 67 | |||
390 | 68 | Bouton pour cacher le menu navigation | ||
391 | 69 | include/main.tpl : L81 ajout d'un div#hidemenu avec lien vers le javascript | ||
392 | 70 | header.php : L158 à 171 inclusion de common.js, menu.js, cookie menu_hidden, et modif du CSS en fonction | ||
393 | 71 | |||
394 | 72 | |||
395 | 73 | Désactivation du formulaire de recherche | ||
396 | 74 | search PHP L662 : changement de search.php en index.php (renvoi vers l'accueil) | ||
397 | 75 | |||
398 | 76 | On enlève "Recherche" du menu navigation | ||
399 | 77 | /include/functions.php : on commente les lignes 446 et 453 | ||
400 | 78 | |||
401 | 79 | |||
402 | 80 | 10/10/2010 XABILON | ||
403 | 81 | modifs forum : index.php, style/ubuntu-light.css | ||
404 | 82 | modifs static: forum-ubuntu.css, forum-kubuntu.css, forum-general.css | ||
405 | 83 | |||
406 | 84 | 12/10/2010 XABILON | ||
407 | 85 | 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 | 86 | (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 | 87 | ET ATTENTION AUX LIENS VERS LES CSS ET LE META POUR GOOGLE | ||
410 | 88 | Ajout de "Marquer tous vos messages comme lus" dans include/functions.php | ||
411 | 89 | Traductions dans lang/Francais/common.php | ||
412 | 90 | search.php (augmentation de la limite des 200) | ||
413 | 91 | parser.php (balise apt) | ||
414 | 92 | divers dans style/ | ||
415 | 93 | viewtopic.php (lien vers haut de page) | ||
447 | 94 | 32 | ||
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 | 1 | Les fichiers modifiés par rapport à FluxBB : | ||
453 | 2 | include/templates/main.tpl | ||
454 | 3 | |||
455 | 4 | Fil d'ariane | ||
456 | 5 | viewtopic.php l361 (pour la rc) l371 pour 1.4 | ||
457 | 6 | viewforum.php l48 | ||
458 | 7 | index.php | ||
459 | 8 | Stats | ||
460 | 9 | index.php l249 | ||
461 | 10 | FIXME : il y a peut être une façon plus élégante de le faire | ||
462 | 11 | Redirection: | ||
463 | 12 | functions.php l1288 | ||
464 | 13 | |||
465 | 14 | |||
466 | 15 | FLUXBB 1.4.0 : | ||
467 | 16 | |||
468 | 17 | Liens de recherche (searchlinks) ajoutés dans header.php | ||
469 | 18 | pun_searchlinks est appelé depuis main.tpl | ||
470 | 19 | J'ai pris la même classe que pour les liens de navigation "navlinks" (à différencier si ça pose problème au CSS) | ||
471 | 20 | |||
472 | 21 | |||
473 | 22 | Mise en forme des pages admins : | ||
474 | 23 | - inclusion des feuilles de style site_css.php dans admin.tpl | ||
475 | 24 | En fait il faudrait refaire entièrement admin.tpl pour le faire correspondre à main.tpl | ||
476 | 25 | (bonjour les mises à jour de FluxBB ...) | ||
477 | 26 | -> ça c'est bon, je viens de le faire | ||
478 | 27 | |||
479 | 28 | |||
480 | 29 | Différentiation de la recherche rapide et du formulaire de recherche : | ||
481 | 30 | id="search" changé en id="searchform" | ||
482 | 31 | search.php ligne 662 | ||
483 | 32 | |||
484 | 33 | Ajout d'une classe pour l'ip de connexion: | ||
485 | 34 | viewtopic.php l286 | ||
486 | 35 | |||
487 | 36 | |||
488 | 37 | Décochage par défaut de la case "créer un lien" pour les déplacements de topic | ||
489 | 38 | moderate.php l483 | ||
490 | 39 | Ligne avant modif : | ||
491 | 40 | <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 | 41 | |||
493 | 42 | |||
494 | 43 | Affichage des annonces des forums (div "announce-forum") | ||
495 | 44 | viewforum.php L92 à L113 | ||
496 | 45 | |||
497 | 46 | |||
498 | 47 | Mod affichage de l'accueil + gagnant du mois : | ||
499 | 48 | Voir plugins/AP_Reception.php + lang/Francais/reception.php + index.php (L58 à L79) | ||
500 | 49 | Les chaines correspondantes sont stockées dans deux nouvelles clefs de la table config: c_welcome_message et c_winner_message. | ||
501 | 50 | Pas de modification de la structure de la base. Les clefs se créent automatiquement, rien de spécial à faire. | ||
502 | 51 | |||
503 | 52 | |||
504 | 53 | Affichage de usertitle uniquement pour admins et modos. | ||
505 | 54 | viewtopic.php l360 : | ||
506 | 55 | <?php if ($pun_user['g_id'] <= 2) echo ' <dd class="usertitle"><strong>'.$user_title.'</strong></dd>'; ?> | ||
507 | 56 | Ligne originale : | ||
508 | 57 | <dd class="usertitle"><strong><?php echo $user_title ?></strong></dd> | ||
509 | 58 | |||
510 | 59 | |||
511 | 60 | Ne pas chercher les "messages récents" et "sans réponses" dans les sections Divers: | ||
512 | 61 | Ajout des conditions AND t.forum_id!=7 AND t.forum_id!=43 AND t.forum_id!=8 | ||
513 | 62 | dans search.php L296 305 et 335 | ||
514 | 63 | |||
515 | 64 | Limiter les résultats à 200 topics : | ||
516 | 65 | Ajout d'un LIMIT 200 dans search.php L296 305 et 335 | ||
517 | 66 | |||
518 | 67 | |||
519 | 68 | Bouton pour cacher le menu navigation | ||
520 | 69 | include/main.tpl : L81 ajout d'un div#hidemenu avec lien vers le javascript | ||
521 | 70 | header.php : L158 à 171 inclusion de common.js, menu.js, cookie menu_hidden, et modif du CSS en fonction | ||
522 | 71 | |||
523 | 72 | |||
524 | 73 | Désactivation du formulaire de recherche | ||
525 | 74 | search PHP L662 : changement de search.php en index.php (renvoi vers l'accueil) | ||
526 | 75 | |||
527 | 76 | On enlève "Recherche" du menu navigation | ||
528 | 77 | /include/functions.php : on commente les lignes 446 et 453 | ||
529 | 78 | |||
530 | 79 | |||
531 | 80 | 10/10/2010 XABILON | ||
532 | 81 | modifs forum : index.php, style/ubuntu-light.css | ||
533 | 82 | modifs static: forum-ubuntu.css, forum-kubuntu.css, forum-general.css | ||
534 | 83 | |||
535 | 84 | 12/10/2010 XABILON | ||
536 | 85 | 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 | 86 | (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 | 87 | ET ATTENTION AUX LIENS VERS LES CSS ET LE META POUR GOOGLE | ||
539 | 88 | Ajout de "Marquer tous vos messages comme lus" dans include/functions.php | ||
540 | 89 | Traductions dans lang/Francais/common.php | ||
541 | 90 | search.php (augmentation de la limite des 200) | ||
542 | 91 | parser.php (balise apt) | ||
543 | 92 | divers dans style/ | ||
544 | 93 | viewtopic.php (lien vers haut de page) | ||
545 | 0 | 94 | ||
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 | 1 | <?php | 1 | <?php |
551 | 2 | 2 | ||
552 | 3 | /** | 3 | /** |
554 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
555 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
556 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
557 | 7 | */ | 7 | */ |
558 | @@ -9,7 +9,7 @@ | |||
559 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
560 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
561 | 11 | 11 | ||
563 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
564 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
565 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
566 | 15 | 15 | ||
567 | @@ -52,9 +52,18 @@ | |||
568 | 52 | } | 52 | } |
569 | 53 | } | 53 | } |
570 | 54 | 54 | ||
574 | 55 | // Make sure we're not banning an admin | 55 | // Make sure we're not banning an admin or moderator |
575 | 56 | if (isset($group_id) && $group_id == PUN_ADMIN) | 56 | if (isset($group_id)) |
576 | 57 | message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); | 57 | { |
577 | 58 | if ($group_id == PUN_ADMIN) | ||
578 | 59 | message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); | ||
579 | 60 | |||
580 | 61 | $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); | ||
581 | 62 | $is_moderator_group = $db->result($result); | ||
582 | 63 | |||
583 | 64 | if ($is_moderator_group) | ||
584 | 65 | message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); | ||
585 | 66 | } | ||
586 | 58 | 67 | ||
587 | 59 | // If we have a $user_id, we can try to find the last known IP of that user | 68 | // If we have a $user_id, we can try to find the last known IP of that user |
588 | 60 | if (isset($user_id)) | 69 | if (isset($user_id)) |
589 | @@ -183,6 +192,25 @@ | |||
590 | 183 | message($lang_admin_bans['Must enter message']); | 192 | message($lang_admin_bans['Must enter message']); |
591 | 184 | else if (strtolower($ban_user) == 'guest') | 193 | else if (strtolower($ban_user) == 'guest') |
592 | 185 | message($lang_admin_bans['Cannot ban guest message']); | 194 | message($lang_admin_bans['Cannot ban guest message']); |
593 | 195 | |||
594 | 196 | // Make sure we're not banning an admin or moderator | ||
595 | 197 | if (!empty($ban_user)) | ||
596 | 198 | { | ||
597 | 199 | $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | ||
598 | 200 | if ($db->num_rows($result)) | ||
599 | 201 | { | ||
600 | 202 | $group_id = $db->result($result); | ||
601 | 203 | |||
602 | 204 | if ($group_id == PUN_ADMIN) | ||
603 | 205 | message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); | ||
604 | 206 | |||
605 | 207 | $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); | ||
606 | 208 | $is_moderator_group = $db->result($result); | ||
607 | 209 | |||
608 | 210 | if ($is_moderator_group) | ||
609 | 211 | message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); | ||
610 | 212 | } | ||
611 | 213 | } | ||
612 | 186 | 214 | ||
613 | 187 | // Validate IP/IP range (it's overkill, I know) | 215 | // Validate IP/IP range (it's overkill, I know) |
614 | 188 | if ($ban_ip != '') | 216 | if ($ban_ip != '') |
615 | @@ -304,7 +332,7 @@ | |||
616 | 304 | 332 | ||
617 | 305 | $expire_after = isset($_GET['expire_after']) ? trim($_GET['expire_after']) : ''; | 333 | $expire_after = isset($_GET['expire_after']) ? trim($_GET['expire_after']) : ''; |
618 | 306 | $expire_before = isset($_GET['expire_before']) ? trim($_GET['expire_before']) : ''; | 334 | $expire_before = isset($_GET['expire_before']) ? trim($_GET['expire_before']) : ''; |
620 | 307 | $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? $_GET['order_by'] : 'username'; | 335 | $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? 'b.'.$_GET['order_by'] : 'b.username'; |
621 | 308 | $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; | 336 | $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
622 | 309 | 337 | ||
623 | 310 | $query_str[] = 'order_by='.$order_by; | 338 | $query_str[] = 'order_by='.$order_by; |
624 | @@ -319,7 +347,7 @@ | |||
625 | 319 | if ($expire_after === false || $expire_after == -1) | 347 | if ($expire_after === false || $expire_after == -1) |
626 | 320 | message($lang_admin_bans['Invalid date message']); | 348 | message($lang_admin_bans['Invalid date message']); |
627 | 321 | 349 | ||
629 | 322 | $conditions[] = 'expire>'.$expire_after; | 350 | $conditions[] = 'b.expire>'.$expire_after; |
630 | 323 | } | 351 | } |
631 | 324 | if ($expire_before != '') | 352 | if ($expire_before != '') |
632 | 325 | { | 353 | { |
633 | @@ -329,7 +357,7 @@ | |||
634 | 329 | if ($expire_before === false || $expire_before == -1) | 357 | if ($expire_before === false || $expire_before == -1) |
635 | 330 | message($lang_admin_bans['Invalid date message']); | 358 | message($lang_admin_bans['Invalid date message']); |
636 | 331 | 359 | ||
638 | 332 | $conditions[] = 'expire<'.$expire_before; | 360 | $conditions[] = 'b.expire<'.$expire_before; |
639 | 333 | } | 361 | } |
640 | 334 | 362 | ||
641 | 335 | $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; | 363 | $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; |
642 | 336 | 364 | ||
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 | 1 | <?php | 1 | <?php |
648 | 2 | 2 | ||
649 | 3 | /** | 3 | /** |
651 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
652 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
653 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
654 | 7 | */ | 7 | */ |
655 | @@ -9,7 +9,7 @@ | |||
656 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
657 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
658 | 11 | 11 | ||
660 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
661 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
662 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
663 | 15 | 15 | ||
664 | @@ -126,23 +126,22 @@ | |||
665 | 126 | { | 126 | { |
666 | 127 | confirm_referrer('admin_categories.php'); | 127 | confirm_referrer('admin_categories.php'); |
667 | 128 | 128 | ||
675 | 129 | $cat_order = array_map('trim', $_POST['cat_order']); | 129 | $categories = $_POST['cat']; |
676 | 130 | $cat_name = array_map('pun_trim', $_POST['cat_name']); | 130 | if (empty($categories)) |
677 | 131 | 131 | message($lang_common['Bad request']); | |
678 | 132 | $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()); | 132 | |
679 | 133 | $num_cats = $db->num_rows($result); | 133 | foreach ($categories as $cat_id => $cur_cat) |
673 | 134 | |||
674 | 135 | for ($i = 0; $i < $num_cats; ++$i) | ||
680 | 136 | { | 134 | { |
682 | 137 | if ($cat_name[$i] == '') | 135 | $cur_cat['name'] = pun_trim($cur_cat['name']); |
683 | 136 | $cur_cat['order'] = trim($cur_cat['order']); | ||
684 | 137 | |||
685 | 138 | if ($cur_cat['name'] == '') | ||
686 | 138 | message($lang_admin_categories['Must enter name message']); | 139 | message($lang_admin_categories['Must enter name message']); |
687 | 139 | 140 | ||
689 | 140 | if ($cat_order[$i] == '' || preg_match('/[^0-9]/', $cat_order[$i])) | 141 | if ($cur_cat['order'] == '' || preg_match('/[^0-9]/', $cur_cat['order'])) |
690 | 141 | message($lang_admin_categories['Must enter integer message']); | 142 | message($lang_admin_categories['Must enter integer message']); |
691 | 142 | 143 | ||
695 | 143 | list($cat_id, $position) = $db->fetch_row($result); | 144 | $db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cur_cat['name']).'\', disp_position='.$cur_cat['order'].' WHERE id='.intval($cat_id)) or error('Unable to update category', __FILE__, __LINE__, $db->error()); |
693 | 144 | |||
694 | 145 | $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()); | ||
696 | 146 | } | 145 | } |
697 | 147 | 146 | ||
698 | 148 | // Regenerate the quick jump cache | 147 | // Regenerate the quick jump cache |
699 | @@ -159,7 +158,7 @@ | |||
700 | 159 | $num_cats = $db->num_rows($result); | 158 | $num_cats = $db->num_rows($result); |
701 | 160 | 159 | ||
702 | 161 | for ($i = 0; $i < $num_cats; ++$i) | 160 | for ($i = 0; $i < $num_cats; ++$i) |
704 | 162 | $cat_list[] = $db->fetch_row($result); | 161 | $cat_list[] = $db->fetch_assoc($result); |
705 | 163 | 162 | ||
706 | 164 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']); | 163 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']); |
707 | 165 | define('PUN_ACTIVE_PAGE', 'admin'); | 164 | define('PUN_ACTIVE_PAGE', 'admin'); |
708 | @@ -171,7 +170,7 @@ | |||
709 | 171 | <div class="blockform"> | 170 | <div class="blockform"> |
710 | 172 | <h2><span><?php echo $lang_admin_categories['Add categories head'] ?></span></h2> | 171 | <h2><span><?php echo $lang_admin_categories['Add categories head'] ?></span></h2> |
711 | 173 | <div class="box"> | 172 | <div class="box"> |
713 | 174 | <form method="post" action="admin_categories.php?action=foo"> | 173 | <form method="post" action="admin_categories.php"> |
714 | 175 | <div class="inform"> | 174 | <div class="inform"> |
715 | 176 | <fieldset> | 175 | <fieldset> |
716 | 177 | <legend><?php echo $lang_admin_categories['Add categories subhead'] ?></legend> | 176 | <legend><?php echo $lang_admin_categories['Add categories subhead'] ?></legend> |
717 | @@ -193,7 +192,7 @@ | |||
718 | 193 | 192 | ||
719 | 194 | <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Delete categories head'] ?></span></h2> | 193 | <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Delete categories head'] ?></span></h2> |
720 | 195 | <div class="box"> | 194 | <div class="box"> |
722 | 196 | <form method="post" action="admin_categories.php?action=foo"> | 195 | <form method="post" action="admin_categories.php"> |
723 | 197 | <div class="inform"> | 196 | <div class="inform"> |
724 | 198 | <fieldset> | 197 | <fieldset> |
725 | 199 | <legend><?php echo $lang_admin_categories['Delete categories subhead'] ?></legend> | 198 | <legend><?php echo $lang_admin_categories['Delete categories subhead'] ?></legend> |
726 | @@ -205,8 +204,8 @@ | |||
727 | 205 | <select name="cat_to_delete" tabindex="3"> | 204 | <select name="cat_to_delete" tabindex="3"> |
728 | 206 | <?php | 205 | <?php |
729 | 207 | 206 | ||
732 | 208 | foreach ($cat_list as $category) | 207 | foreach ($cat_list as $cur_cat) |
733 | 209 | echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$category[0].'">'.pun_htmlspecialchars($category[1]).'</option>'."\n"; | 208 | echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n"; |
734 | 210 | 209 | ||
735 | 211 | ?> | 210 | ?> |
736 | 212 | </select> | 211 | </select> |
737 | @@ -223,7 +222,7 @@ | |||
738 | 223 | 222 | ||
739 | 224 | <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Edit categories head'] ?></span></h2> | 223 | <?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Edit categories head'] ?></span></h2> |
740 | 225 | <div class="box"> | 224 | <div class="box"> |
742 | 226 | <form method="post" action="admin_categories.php?action=foo"> | 225 | <form method="post" action="admin_categories.php"> |
743 | 227 | <div class="inform"> | 226 | <div class="inform"> |
744 | 228 | <fieldset> | 227 | <fieldset> |
745 | 229 | <legend><?php echo $lang_admin_categories['Edit categories subhead'] ?></legend> | 228 | <legend><?php echo $lang_admin_categories['Edit categories subhead'] ?></legend> |
746 | @@ -238,13 +237,13 @@ | |||
747 | 238 | <tbody> | 237 | <tbody> |
748 | 239 | <?php | 238 | <?php |
749 | 240 | 239 | ||
751 | 241 | foreach ($cat_list as $i => $category) | 240 | foreach ($cat_list as $cur_cat) |
752 | 242 | { | 241 | { |
753 | 243 | 242 | ||
754 | 244 | ?> | 243 | ?> |
755 | 245 | <tr> | 244 | <tr> |
758 | 246 | <td class="tcl"><input type="text" name="cat_name[<?php echo $i ?>]" value="<?php echo pun_htmlspecialchars($category[1]) ?>" size="35" maxlength="80" /></td> | 245 | <td class="tcl"><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][name]" value="<?php echo pun_htmlspecialchars($cur_cat['cat_name']) ?>" size="35" maxlength="80" /></td> |
759 | 247 | <td><input type="text" name="cat_order[<?php echo $i ?>]" value="<?php echo $category[2] ?>" size="3" maxlength="3" /></td> | 246 | <td><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][order]" value="<?php echo $cur_cat['disp_position'] ?>" size="3" maxlength="3" /></td> |
760 | 248 | </tr> | 247 | </tr> |
761 | 249 | <?php | 248 | <?php |
762 | 250 | 249 | ||
763 | 251 | 250 | ||
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 | 1 | <?php | 1 | <?php |
769 | 2 | 2 | ||
770 | 3 | /** | 3 | /** |
772 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
773 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
774 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
775 | 7 | */ | 7 | */ |
776 | @@ -9,12 +9,12 @@ | |||
777 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
778 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
779 | 11 | 11 | ||
781 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
782 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
783 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
784 | 15 | 15 | ||
785 | 16 | 16 | ||
787 | 17 | if (!$pun_user['is_admmod'] || ($pun_user['g_moderator'] == '1' && $pun_config['o_censoring'] == '0')) | 17 | if ($pun_user['g_id'] != PUN_ADMIN) |
788 | 18 | message($lang_common['No permission']); | 18 | message($lang_common['No permission']); |
789 | 19 | 19 | ||
790 | 20 | // Load the admin_censoring.php language file | 20 | // Load the admin_censoring.php language file |
791 | @@ -28,11 +28,17 @@ | |||
792 | 28 | $search_for = pun_trim($_POST['new_search_for']); | 28 | $search_for = pun_trim($_POST['new_search_for']); |
793 | 29 | $replace_with = pun_trim($_POST['new_replace_with']); | 29 | $replace_with = pun_trim($_POST['new_replace_with']); |
794 | 30 | 30 | ||
797 | 31 | if ($search_for == '' || $replace_with == '') | 31 | if ($search_for == '') |
798 | 32 | message($lang_admin_censoring['Must enter both message']); | 32 | message($lang_admin_censoring['Must enter word message']); |
799 | 33 | 33 | ||
800 | 34 | $db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error()); | 34 | $db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error()); |
801 | 35 | 35 | ||
802 | 36 | // Regenerate the censoring cache | ||
803 | 37 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
804 | 38 | require PUN_ROOT.'include/cache.php'; | ||
805 | 39 | |||
806 | 40 | generate_censoring_cache(); | ||
807 | 41 | |||
808 | 36 | redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']); | 42 | redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']); |
809 | 37 | } | 43 | } |
810 | 38 | 44 | ||
811 | @@ -46,11 +52,17 @@ | |||
812 | 46 | $search_for = pun_trim($_POST['search_for'][$id]); | 52 | $search_for = pun_trim($_POST['search_for'][$id]); |
813 | 47 | $replace_with = pun_trim($_POST['replace_with'][$id]); | 53 | $replace_with = pun_trim($_POST['replace_with'][$id]); |
814 | 48 | 54 | ||
817 | 49 | if ($search_for == '' || $replace_with == '') | 55 | if ($search_for == '') |
818 | 50 | message($lang_admin_censoring['Must search both message']); | 56 | message($lang_admin_censoring['Must enter word message']); |
819 | 51 | 57 | ||
820 | 52 | $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()); | 58 | $db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.$db->escape($search_for).'\', replace_with=\''.$db->escape($replace_with).'\' WHERE id='.$id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error()); |
821 | 53 | 59 | ||
822 | 60 | // Regenerate the censoring cache | ||
823 | 61 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
824 | 62 | require PUN_ROOT.'include/cache.php'; | ||
825 | 63 | |||
826 | 64 | generate_censoring_cache(); | ||
827 | 65 | |||
828 | 54 | redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']); | 66 | redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']); |
829 | 55 | } | 67 | } |
830 | 56 | 68 | ||
831 | @@ -63,6 +75,12 @@ | |||
832 | 63 | 75 | ||
833 | 64 | $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); | 76 | $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); |
834 | 65 | 77 | ||
835 | 78 | // Regenerate the censoring cache | ||
836 | 79 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
837 | 80 | require PUN_ROOT.'include/cache.php'; | ||
838 | 81 | |||
839 | 82 | generate_censoring_cache(); | ||
840 | 83 | |||
841 | 66 | redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']); | 84 | redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']); |
842 | 67 | } | 85 | } |
843 | 68 | 86 | ||
844 | @@ -77,12 +95,12 @@ | |||
845 | 77 | <div class="blockform"> | 95 | <div class="blockform"> |
846 | 78 | <h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2> | 96 | <h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2> |
847 | 79 | <div class="box"> | 97 | <div class="box"> |
849 | 80 | <form id="censoring" method="post" action="admin_censoring.php?action=foo"> | 98 | <form id="censoring" method="post" action="admin_censoring.php"> |
850 | 81 | <div class="inform"> | 99 | <div class="inform"> |
851 | 82 | <fieldset> | 100 | <fieldset> |
852 | 83 | <legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend> | 101 | <legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend> |
853 | 84 | <div class="infldset"> | 102 | <div class="infldset"> |
855 | 85 | <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> | 103 | <p><?php echo $lang_admin_censoring['Add word info'].' '.($pun_config['o_censoring'] == '1' ? sprintf($lang_admin_censoring['Censoring enabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>') : sprintf($lang_admin_censoring['Censoring disabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>')) ?></p> |
856 | 86 | <table cellspacing="0"> | 104 | <table cellspacing="0"> |
857 | 87 | <thead> | 105 | <thead> |
858 | 88 | <tr> | 106 | <tr> |
859 | 89 | 107 | ||
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 | 1 | <?php | 1 | <?php |
865 | 2 | 2 | ||
866 | 3 | /** | 3 | /** |
868 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
869 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
870 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
871 | 7 | */ | 7 | */ |
872 | @@ -9,7 +9,7 @@ | |||
873 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
874 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
875 | 11 | 11 | ||
877 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
878 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
879 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
880 | 15 | 15 | ||
881 | @@ -72,6 +72,9 @@ | |||
882 | 72 | $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error()); | 72 | $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error()); |
883 | 73 | $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); | 73 | $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); |
884 | 74 | 74 | ||
885 | 75 | // Delete any subscriptions for this forum | ||
886 | 76 | $db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE forum_id='.$forum_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error()); | ||
887 | 77 | |||
888 | 75 | // Regenerate the quick jump cache | 78 | // Regenerate the quick jump cache |
889 | 76 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | 79 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
890 | 77 | require PUN_ROOT.'include/cache.php'; | 80 | require PUN_ROOT.'include/cache.php'; |
891 | @@ -274,6 +277,7 @@ | |||
892 | 274 | <select name="sort_by" tabindex="4"> | 277 | <select name="sort_by" tabindex="4"> |
893 | 275 | <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Last post'] ?></option> | 278 | <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Last post'] ?></option> |
894 | 276 | <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Topic start'] ?></option> | 279 | <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Topic start'] ?></option> |
895 | 280 | <option value="2"<?php if ($cur_forum['sort_by'] == '2') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Subject'] ?></option> | ||
896 | 277 | </select> | 281 | </select> |
897 | 278 | </td> | 282 | </td> |
898 | 279 | </tr> | 283 | </tr> |
899 | 280 | 284 | ||
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 | 1 | <?php | 1 | <?php |
905 | 2 | 2 | ||
906 | 3 | /** | 3 | /** |
908 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
909 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
910 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
911 | 7 | */ | 7 | */ |
912 | @@ -9,7 +9,7 @@ | |||
913 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
914 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
915 | 11 | 11 | ||
917 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
918 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
919 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
920 | 15 | 15 | ||
921 | @@ -296,7 +296,8 @@ | |||
922 | 296 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | 296 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
923 | 297 | require PUN_ROOT.'include/cache.php'; | 297 | require PUN_ROOT.'include/cache.php'; |
924 | 298 | 298 | ||
926 | 299 | generate_quickjump_cache(); | 299 | $group_id = $_POST['mode'] == 'add' ? $new_group_id : intval($_POST['group_id']); |
927 | 300 | generate_quickjump_cache($group_id); | ||
928 | 300 | 301 | ||
929 | 301 | if ($_POST['mode'] == 'edit') | 302 | if ($_POST['mode'] == 'edit') |
930 | 302 | redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']); | 303 | redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']); |
931 | @@ -364,12 +365,6 @@ | |||
932 | 364 | $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error()); | 365 | $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error()); |
933 | 365 | $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()); | 366 | $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 | 366 | 367 | ||
935 | 367 | // Regenerate the quick jump cache | ||
936 | 368 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
937 | 369 | require PUN_ROOT.'include/cache.php'; | ||
938 | 370 | |||
939 | 371 | generate_quickjump_cache(); | ||
940 | 372 | |||
941 | 373 | redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']); | 368 | redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']); |
942 | 374 | } | 369 | } |
943 | 375 | else | 370 | else |
944 | @@ -470,7 +465,7 @@ | |||
945 | 470 | <div class="blockform"> | 465 | <div class="blockform"> |
946 | 471 | <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> | 466 | <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> |
947 | 472 | <div class="box"> | 467 | <div class="box"> |
949 | 473 | <form id="groups" method="post" action="admin_groups.php?action=foo"> | 468 | <form id="groups" method="post" action="admin_groups.php"> |
950 | 474 | <div class="inform"> | 469 | <div class="inform"> |
951 | 475 | <fieldset> | 470 | <fieldset> |
952 | 476 | <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> | 471 | <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> |
953 | 477 | 472 | ||
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 | 1 | <?php | 1 | <?php |
959 | 2 | 2 | ||
960 | 3 | /** | 3 | /** |
962 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
963 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
964 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
965 | 7 | */ | 7 | */ |
966 | @@ -9,7 +9,7 @@ | |||
967 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
968 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
969 | 11 | 11 | ||
971 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
972 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
973 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
974 | 15 | 15 | ||
975 | @@ -126,18 +126,18 @@ | |||
976 | 126 | <h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2> | 126 | <h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2> |
977 | 127 | <div id="adintro" class="box"> | 127 | <div id="adintro" class="box"> |
978 | 128 | <div class="inbox"> | 128 | <div class="inbox"> |
991 | 129 | <p> | 129 | <p><?php echo $lang_admin_index['Welcome to admin'] ?></p> |
992 | 130 | <?php echo $lang_admin_index['Welcome to admin'] ?><br /><br /> | 130 | <ul> |
993 | 131 |  - <?php echo $lang_admin_index['Welcome 1'] ?><br /> | 131 | <li><span><?php echo $lang_admin_index['Welcome 1'] ?></span></li> |
994 | 132 |  - <?php echo $lang_admin_index['Welcome 2'] ?><br /> | 132 | <li><span><?php echo $lang_admin_index['Welcome 2'] ?></span></li> |
995 | 133 |  - <?php echo $lang_admin_index['Welcome 3'] ?><br /> | 133 | <li><span><?php echo $lang_admin_index['Welcome 3'] ?></span></li> |
996 | 134 |  - <?php echo $lang_admin_index['Welcome 4'] ?><br /> | 134 | <li><span><?php echo $lang_admin_index['Welcome 4'] ?></span></li> |
997 | 135 |  - <?php echo $lang_admin_index['Welcome 5'] ?><br /> | 135 | <li><span><?php echo $lang_admin_index['Welcome 5'] ?></span></li> |
998 | 136 |  - <?php echo $lang_admin_index['Welcome 6'] ?><br /> | 136 | <li><span><?php echo $lang_admin_index['Welcome 6'] ?></span></li> |
999 | 137 |  - <?php echo $lang_admin_index['Welcome 7'] ?><br /> | 137 | <li><span><?php echo $lang_admin_index['Welcome 7'] ?></span></li> |
1000 | 138 |  - <?php echo $lang_admin_index['Welcome 8'] ?><br /> | 138 | <li><span><?php echo $lang_admin_index['Welcome 8'] ?></span></li> |
1001 | 139 |  - <?php echo $lang_admin_index['Welcome 9'] ?> | 139 | <li><span><?php echo $lang_admin_index['Welcome 9'] ?></span></li> |
1002 | 140 | </p> | 140 | </ul> |
1003 | 141 | </div> | 141 | </div> |
1004 | 142 | </div> | 142 | </div> |
1005 | 143 | 143 | ||
1006 | @@ -147,7 +147,7 @@ | |||
1007 | 147 | <dl> | 147 | <dl> |
1008 | 148 | <dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt> | 148 | <dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt> |
1009 | 149 | <dd> | 149 | <dd> |
1011 | 150 | <?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 /> | 150 | <?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 | 151 | </dd> | 151 | </dd> |
1013 | 152 | <dt><?php echo $lang_admin_index['Server load label'] ?></dt> | 152 | <dt><?php echo $lang_admin_index['Server load label'] ?></dt> |
1014 | 153 | <dd> | 153 | <dd> |
1015 | @@ -164,7 +164,7 @@ | |||
1016 | 164 | <?php echo implode(' ', $db->get_version())."\n" ?> | 164 | <?php echo implode(' ', $db->get_version())."\n" ?> |
1017 | 165 | <?php if (isset($total_records) && isset($total_size)): ?> <br /><?php printf($lang_admin_index['Database data rows'], forum_number_format($total_records)) ?> | 165 | <?php if (isset($total_records) && isset($total_size)): ?> <br /><?php printf($lang_admin_index['Database data rows'], forum_number_format($total_records)) ?> |
1018 | 166 | <br /><?php printf($lang_admin_index['Database data size'], $total_size) ?> | 166 | <br /><?php printf($lang_admin_index['Database data size'], $total_size) ?> |
1020 | 167 | <?php endif; endif; ?> </dd> | 167 | <?php endif; ?> </dd><?php endif; ?> |
1021 | 168 | </dl> | 168 | </dl> |
1022 | 169 | </div> | 169 | </div> |
1023 | 170 | </div> | 170 | </div> |
1024 | 171 | 171 | ||
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 | 1 | <?php | 1 | <?php |
1030 | 2 | 2 | ||
1031 | 3 | /** | 3 | /** |
1033 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1034 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1035 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1036 | 7 | */ | 7 | */ |
1037 | @@ -9,7 +9,7 @@ | |||
1038 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
1039 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
1040 | 11 | 11 | ||
1042 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1043 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
1044 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
1045 | 15 | 15 | ||
1046 | 16 | 16 | ||
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 | 1 | <?php | 1 | <?php |
1052 | 2 | 2 | ||
1053 | 3 | /** | 3 | /** |
1055 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1056 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1057 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1058 | 7 | */ | 7 | */ |
1059 | @@ -11,7 +11,7 @@ | |||
1060 | 11 | // Tell common.php that we don't want output buffering | 11 | // Tell common.php that we don't want output buffering |
1061 | 12 | define('PUN_DISABLE_BUFFERING', 1); | 12 | define('PUN_DISABLE_BUFFERING', 1); |
1062 | 13 | 13 | ||
1064 | 14 | define('PUN_ROOT', './'); | 14 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1065 | 15 | require PUN_ROOT.'include/common.php'; | 15 | require PUN_ROOT.'include/common.php'; |
1066 | 16 | require PUN_ROOT.'include/common_admin.php'; | 16 | require PUN_ROOT.'include/common_admin.php'; |
1067 | 17 | 17 | ||
1068 | @@ -22,12 +22,16 @@ | |||
1069 | 22 | // Load the admin_maintenance.php language file | 22 | // Load the admin_maintenance.php language file |
1070 | 23 | require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php'; | 23 | require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php'; |
1071 | 24 | 24 | ||
1073 | 25 | if (isset($_GET['i_per_page']) && isset($_GET['i_start_at'])) | 25 | $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : ''; |
1074 | 26 | |||
1075 | 27 | if ($action == 'rebuild') | ||
1076 | 26 | { | 28 | { |
1081 | 27 | $per_page = intval($_GET['i_per_page']); | 29 | $per_page = isset($_GET['i_per_page']) ? intval($_GET['i_per_page']) : 0; |
1082 | 28 | $start_at = intval($_GET['i_start_at']); | 30 | $start_at = isset($_GET['i_start_at']) ? intval($_GET['i_start_at']) : 0; |
1083 | 29 | if ($per_page < 1 || $start_at < 1) | 31 | |
1084 | 30 | message($lang_common['Bad request']); | 32 | // Check per page is > 0 |
1085 | 33 | if ($per_page < 1) | ||
1086 | 34 | message($lang_admin_maintenance['Posts must be integer message']); | ||
1087 | 31 | 35 | ||
1088 | 32 | @set_time_limit(0); | 36 | @set_time_limit(0); |
1089 | 33 | 37 | ||
1090 | @@ -110,7 +114,7 @@ | |||
1091 | 110 | $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()); | 114 | $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 | 111 | 115 | ||
1093 | 112 | if ($db->num_rows($result) > 0) | 116 | if ($db->num_rows($result) > 0) |
1095 | 113 | $query_str = '?i_per_page='.$per_page.'&i_start_at='.$db->result($result); | 117 | $query_str = '?action=rebuild&i_per_page='.$per_page.'&i_start_at='.$db->result($result); |
1096 | 114 | } | 118 | } |
1097 | 115 | 119 | ||
1098 | 116 | $db->end_transaction(); | 120 | $db->end_transaction(); |
1099 | @@ -119,6 +123,122 @@ | |||
1100 | 119 | 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>'); | 123 | 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 | 120 | } | 124 | } |
1102 | 121 | 125 | ||
1103 | 126 | if ($action == 'prune') | ||
1104 | 127 | { | ||
1105 | 128 | $prune_from = trim($_POST['prune_from']); | ||
1106 | 129 | $prune_sticky = intval($_POST['prune_sticky']); | ||
1107 | 130 | |||
1108 | 131 | if (isset($_POST['prune_comply'])) | ||
1109 | 132 | { | ||
1110 | 133 | confirm_referrer('admin_maintenance.php'); | ||
1111 | 134 | |||
1112 | 135 | $prune_days = intval($_POST['prune_days']); | ||
1113 | 136 | $prune_date = ($prune_days) ? time() - ($prune_days * 86400) : -1; | ||
1114 | 137 | |||
1115 | 138 | @set_time_limit(0); | ||
1116 | 139 | |||
1117 | 140 | if ($prune_from == 'all') | ||
1118 | 141 | { | ||
1119 | 142 | $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); | ||
1120 | 143 | $num_forums = $db->num_rows($result); | ||
1121 | 144 | |||
1122 | 145 | for ($i = 0; $i < $num_forums; ++$i) | ||
1123 | 146 | { | ||
1124 | 147 | $fid = $db->result($result, $i); | ||
1125 | 148 | |||
1126 | 149 | prune($fid, $prune_sticky, $prune_date); | ||
1127 | 150 | update_forum($fid); | ||
1128 | 151 | } | ||
1129 | 152 | } | ||
1130 | 153 | else | ||
1131 | 154 | { | ||
1132 | 155 | $prune_from = intval($prune_from); | ||
1133 | 156 | prune($prune_from, $prune_sticky, $prune_date); | ||
1134 | 157 | update_forum($prune_from); | ||
1135 | 158 | } | ||
1136 | 159 | |||
1137 | 160 | // Locate any "orphaned redirect topics" and delete them | ||
1138 | 161 | $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 | 162 | $num_orphans = $db->num_rows($result); | ||
1140 | 163 | |||
1141 | 164 | if ($num_orphans) | ||
1142 | 165 | { | ||
1143 | 166 | for ($i = 0; $i < $num_orphans; ++$i) | ||
1144 | 167 | $orphans[] = $db->result($result, $i); | ||
1145 | 168 | |||
1146 | 169 | $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); | ||
1147 | 170 | } | ||
1148 | 171 | |||
1149 | 172 | redirect('admin_maintenance.php', $lang_admin_maintenance['Posts pruned redirect']); | ||
1150 | 173 | } | ||
1151 | 174 | |||
1152 | 175 | $prune_days = trim($_POST['req_prune_days']); | ||
1153 | 176 | if ($prune_days == '' || preg_match('/[^0-9]/', $prune_days)) | ||
1154 | 177 | message($lang_admin_maintenance['Days must be integer message']); | ||
1155 | 178 | |||
1156 | 179 | $prune_date = time() - ($prune_days * 86400); | ||
1157 | 180 | |||
1158 | 181 | // Concatenate together the query for counting number of topics to prune | ||
1159 | 182 | $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL'; | ||
1160 | 183 | |||
1161 | 184 | if ($prune_sticky == '0') | ||
1162 | 185 | $sql .= ' AND sticky=0'; | ||
1163 | 186 | |||
1164 | 187 | if ($prune_from != 'all') | ||
1165 | 188 | { | ||
1166 | 189 | $prune_from = intval($prune_from); | ||
1167 | 190 | $sql .= ' AND forum_id='.$prune_from; | ||
1168 | 191 | |||
1169 | 192 | // Fetch the forum name (just for cosmetic reasons) | ||
1170 | 193 | $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 | 194 | $forum = '"'.pun_htmlspecialchars($db->result($result)).'"'; | ||
1172 | 195 | } | ||
1173 | 196 | else | ||
1174 | 197 | $forum = $lang_admin_maintenance['All forums']; | ||
1175 | 198 | |||
1176 | 199 | $result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error()); | ||
1177 | 200 | $num_topics = $db->result($result); | ||
1178 | 201 | |||
1179 | 202 | if (!$num_topics) | ||
1180 | 203 | message(sprintf($lang_admin_maintenance['No old topics message'], $prune_days)); | ||
1181 | 204 | |||
1182 | 205 | |||
1183 | 206 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); | ||
1184 | 207 | define('PUN_ACTIVE_PAGE', 'admin'); | ||
1185 | 208 | require PUN_ROOT.'header.php'; | ||
1186 | 209 | |||
1187 | 210 | generate_admin_menu('maintenance'); | ||
1188 | 211 | |||
1189 | 212 | ?> | ||
1190 | 213 | <div class="blockform"> | ||
1191 | 214 | <h2><span><?php echo $lang_admin_maintenance['Prune head'] ?></span></h2> | ||
1192 | 215 | <div class="box"> | ||
1193 | 216 | <form method="post" action="admin_maintenance.php"> | ||
1194 | 217 | <div class="inform"> | ||
1195 | 218 | <input type="hidden" name="action" value="prune" /> | ||
1196 | 219 | <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" /> | ||
1197 | 220 | <input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" /> | ||
1198 | 221 | <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" /> | ||
1199 | 222 | <fieldset> | ||
1200 | 223 | <legend><?php echo $lang_admin_maintenance['Confirm prune subhead'] ?></legend> | ||
1201 | 224 | <div class="infldset"> | ||
1202 | 225 | <p><?php printf($lang_admin_maintenance['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?></p> | ||
1203 | 226 | <p class="warntext"><?php echo $lang_admin_maintenance['Confirm prune warn'] ?></p> | ||
1204 | 227 | </div> | ||
1205 | 228 | </fieldset> | ||
1206 | 229 | </div> | ||
1207 | 230 | <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 | 231 | </form> | ||
1209 | 232 | </div> | ||
1210 | 233 | </div> | ||
1211 | 234 | <div class="clearer"></div> | ||
1212 | 235 | </div> | ||
1213 | 236 | <?php | ||
1214 | 237 | |||
1215 | 238 | require PUN_ROOT.'footer.php'; | ||
1216 | 239 | exit; | ||
1217 | 240 | } | ||
1218 | 241 | |||
1219 | 122 | 242 | ||
1220 | 123 | // Get the first post ID from the db | 243 | // Get the first post ID from the db |
1221 | 124 | $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()); | 244 | $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 | 137 | <div class="box"> | 257 | <div class="box"> |
1224 | 138 | <form method="get" action="admin_maintenance.php"> | 258 | <form method="get" action="admin_maintenance.php"> |
1225 | 139 | <div class="inform"> | 259 | <div class="inform"> |
1226 | 260 | <input type="hidden" name="action" value="rebuild" /> | ||
1227 | 140 | <fieldset> | 261 | <fieldset> |
1228 | 141 | <legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend> | 262 | <legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend> |
1229 | 142 | <div class="infldset"> | 263 | <div class="infldset"> |
1230 | @@ -169,6 +290,65 @@ | |||
1231 | 169 | </fieldset> | 290 | </fieldset> |
1232 | 170 | </div> | 291 | </div> |
1233 | 171 | </form> | 292 | </form> |
1234 | 293 | |||
1235 | 294 | <form method="post" action="admin_maintenance.php" onsubmit="return process_form(this)"> | ||
1236 | 295 | <div class="inform"> | ||
1237 | 296 | <input type="hidden" name="action" value="prune" /> | ||
1238 | 297 | <fieldset> | ||
1239 | 298 | <legend><?php echo $lang_admin_maintenance['Prune subhead'] ?></legend> | ||
1240 | 299 | <div class="infldset"> | ||
1241 | 300 | <table class="aligntop" cellspacing="0"> | ||
1242 | 301 | <tr> | ||
1243 | 302 | <th scope="row"><?php echo $lang_admin_maintenance['Days old label'] ?></th> | ||
1244 | 303 | <td> | ||
1245 | 304 | <input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="5" /> | ||
1246 | 305 | <span><?php echo $lang_admin_maintenance['Days old help'] ?></span> | ||
1247 | 306 | </td> | ||
1248 | 307 | </tr> | ||
1249 | 308 | <tr> | ||
1250 | 309 | <th scope="row"><?php echo $lang_admin_maintenance['Prune sticky label'] ?></th> | ||
1251 | 310 | <td> | ||
1252 | 311 | <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 | 312 | <span><?php echo $lang_admin_maintenance['Prune sticky help'] ?></span> | ||
1254 | 313 | </td> | ||
1255 | 314 | </tr> | ||
1256 | 315 | <tr> | ||
1257 | 316 | <th scope="row"><?php echo $lang_admin_maintenance['Prune from label'] ?></th> | ||
1258 | 317 | <td> | ||
1259 | 318 | <select name="prune_from" tabindex="7"> | ||
1260 | 319 | <option value="all"><?php echo $lang_admin_maintenance['All forums'] ?></option> | ||
1261 | 320 | <?php | ||
1262 | 321 | |||
1263 | 322 | $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 | 323 | |||
1265 | 324 | $cur_category = 0; | ||
1266 | 325 | while ($forum = $db->fetch_assoc($result)) | ||
1267 | 326 | { | ||
1268 | 327 | if ($forum['cid'] != $cur_category) // Are we still in the same category? | ||
1269 | 328 | { | ||
1270 | 329 | if ($cur_category) | ||
1271 | 330 | echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n"; | ||
1272 | 331 | |||
1273 | 332 | echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n"; | ||
1274 | 333 | $cur_category = $forum['cid']; | ||
1275 | 334 | } | ||
1276 | 335 | |||
1277 | 336 | 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 | 337 | } | ||
1279 | 338 | |||
1280 | 339 | ?> | ||
1281 | 340 | </optgroup> | ||
1282 | 341 | </select> | ||
1283 | 342 | <span><?php echo $lang_admin_maintenance['Prune from help'] ?></span> | ||
1284 | 343 | </td> | ||
1285 | 344 | </tr> | ||
1286 | 345 | </table> | ||
1287 | 346 | <p class="topspace"><?php printf($lang_admin_maintenance['Prune info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p> | ||
1288 | 347 | <div class="fsetsubmit"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="8" /></div> | ||
1289 | 348 | </div> | ||
1290 | 349 | </fieldset> | ||
1291 | 350 | </div> | ||
1292 | 351 | </form> | ||
1293 | 172 | </div> | 352 | </div> |
1294 | 173 | </div> | 353 | </div> |
1295 | 174 | <div class="clearer"></div> | 354 | <div class="clearer"></div> |
1296 | 175 | 355 | ||
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 | 1 | <?php | 1 | <?php |
1302 | 2 | 2 | ||
1303 | 3 | /** | 3 | /** |
1305 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1306 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1307 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1308 | 7 | */ | 7 | */ |
1309 | @@ -9,7 +9,7 @@ | |||
1310 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
1311 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
1312 | 11 | 11 | ||
1314 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1315 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
1316 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
1317 | 15 | 15 | ||
1318 | @@ -22,9 +22,7 @@ | |||
1319 | 22 | 22 | ||
1320 | 23 | if (isset($_POST['form_sent'])) | 23 | if (isset($_POST['form_sent'])) |
1321 | 24 | { | 24 | { |
1325 | 25 | // Custom referrer check (so we can output a custom error message) | 25 | confirm_referrer('admin_options.php', $lang_admin_options['Bad HTTP Referer message']); |
1323 | 26 | 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 | 27 | message($lang_admin_options['Bad HTTP Referer message']); | ||
1326 | 28 | 26 | ||
1327 | 29 | $form = array( | 27 | $form = array( |
1328 | 30 | 'board_title' => pun_trim($_POST['form']['board_title']), | 28 | 'board_title' => pun_trim($_POST['form']['board_title']), |
1329 | @@ -32,8 +30,8 @@ | |||
1330 | 32 | 'base_url' => pun_trim($_POST['form']['base_url']), | 30 | 'base_url' => pun_trim($_POST['form']['base_url']), |
1331 | 33 | 'default_timezone' => floatval($_POST['form']['default_timezone']), | 31 | 'default_timezone' => floatval($_POST['form']['default_timezone']), |
1332 | 34 | 'default_dst' => $_POST['form']['default_dst'] != '1' ? '0' : '1', | 32 | 'default_dst' => $_POST['form']['default_dst'] != '1' ? '0' : '1', |
1335 | 35 | 'default_lang' => preg_replace('#[\.\\\/]#', '', pun_trim($_POST['form']['default_lang'])), | 33 | 'default_lang' => pun_trim($_POST['form']['default_lang']), |
1336 | 36 | 'default_style' => preg_replace('#[\.\\\/]#', '', pun_trim($_POST['form']['default_style'])), | 34 | 'default_style' => pun_trim($_POST['form']['default_style']), |
1337 | 37 | 'time_format' => pun_trim($_POST['form']['time_format']), | 35 | 'time_format' => pun_trim($_POST['form']['time_format']), |
1338 | 38 | 'date_format' => pun_trim($_POST['form']['date_format']), | 36 | 'date_format' => pun_trim($_POST['form']['date_format']), |
1339 | 39 | 'timeout_visit' => intval($_POST['form']['timeout_visit']), | 37 | 'timeout_visit' => intval($_POST['form']['timeout_visit']), |
1340 | @@ -62,6 +60,7 @@ | |||
1341 | 62 | 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', | 60 | 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', |
1342 | 63 | 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), | 61 | 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), |
1343 | 64 | 'feed_type' => intval($_POST['form']['feed_type']), | 62 | 'feed_type' => intval($_POST['form']['feed_type']), |
1344 | 63 | 'feed_ttl' => intval($_POST['form']['feed_ttl']), | ||
1345 | 65 | 'report_method' => intval($_POST['form']['report_method']), | 64 | 'report_method' => intval($_POST['form']['report_method']), |
1346 | 66 | 'mailing_list' => pun_trim($_POST['form']['mailing_list']), | 65 | 'mailing_list' => pun_trim($_POST['form']['mailing_list']), |
1347 | 67 | 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', | 66 | 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', |
1348 | @@ -71,10 +70,10 @@ | |||
1349 | 71 | 'avatars_size' => intval($_POST['form']['avatars_size']), | 70 | 'avatars_size' => intval($_POST['form']['avatars_size']), |
1350 | 72 | 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), | 71 | 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), |
1351 | 73 | 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), | 72 | 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), |
1353 | 74 | 'subscriptions' => $_POST['form']['subscriptions'] != '1' ? '0' : '1', | 73 | 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', |
1354 | 74 | 'topic_subscriptions' => $_POST['form']['topic_subscriptions'] != '1' ? '0' : '1', | ||
1355 | 75 | 'smtp_host' => pun_trim($_POST['form']['smtp_host']), | 75 | 'smtp_host' => pun_trim($_POST['form']['smtp_host']), |
1356 | 76 | 'smtp_user' => pun_trim($_POST['form']['smtp_user']), | 76 | 'smtp_user' => pun_trim($_POST['form']['smtp_user']), |
1357 | 77 | 'smtp_pass' => pun_trim($_POST['form']['smtp_pass']), | ||
1358 | 78 | 'smtp_ssl' => $_POST['form']['smtp_ssl'] != '1' ? '0' : '1', | 77 | 'smtp_ssl' => $_POST['form']['smtp_ssl'] != '1' ? '0' : '1', |
1359 | 79 | 'regs_allow' => $_POST['form']['regs_allow'] != '1' ? '0' : '1', | 78 | 'regs_allow' => $_POST['form']['regs_allow'] != '1' ? '0' : '1', |
1360 | 80 | 'regs_verify' => $_POST['form']['regs_verify'] != '1' ? '0' : '1', | 79 | 'regs_verify' => $_POST['form']['regs_verify'] != '1' ? '0' : '1', |
1361 | @@ -95,9 +94,12 @@ | |||
1362 | 95 | if (substr($form['base_url'], -1) == '/') | 94 | if (substr($form['base_url'], -1) == '/') |
1363 | 96 | $form['base_url'] = substr($form['base_url'], 0, -1); | 95 | $form['base_url'] = substr($form['base_url'], 0, -1); |
1364 | 97 | 96 | ||
1366 | 98 | if (!file_exists(PUN_ROOT.'lang/'.$form['default_lang'].'/common.php')) | 97 | $languages = forum_list_langs(); |
1367 | 98 | if (!in_array($form['default_lang'], $languages)) | ||
1368 | 99 | message($lang_common['Bad request']); | 99 | message($lang_common['Bad request']); |
1370 | 100 | if (!file_exists(PUN_ROOT.'style/'.$form['default_style'].'.css')) | 100 | |
1371 | 101 | $styles = forum_list_styles(); | ||
1372 | 102 | if (!in_array($form['default_style'], $styles)) | ||
1373 | 101 | message($lang_common['Bad request']); | 103 | message($lang_common['Bad request']); |
1374 | 102 | 104 | ||
1375 | 103 | if ($form['time_format'] == '') | 105 | if ($form['time_format'] == '') |
1376 | @@ -125,6 +127,18 @@ | |||
1377 | 125 | if ($form['additional_navlinks'] != '') | 127 | if ($form['additional_navlinks'] != '') |
1378 | 126 | $form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks'])); | 128 | $form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks'])); |
1379 | 127 | 129 | ||
1380 | 130 | // Change or enter a SMTP password | ||
1381 | 131 | if (isset($_POST['form']['smtp_change_pass'])) | ||
1382 | 132 | { | ||
1383 | 133 | $smtp_pass1 = isset($_POST['form']['smtp_pass1']) ? pun_trim($_POST['form']['smtp_pass1']) : ''; | ||
1384 | 134 | $smtp_pass2 = isset($_POST['form']['smtp_pass2']) ? pun_trim($_POST['form']['smtp_pass2']) : ''; | ||
1385 | 135 | |||
1386 | 136 | if ($smtp_pass1 == $smtp_pass2) | ||
1387 | 137 | $form['smtp_pass'] = $smtp_pass1; | ||
1388 | 138 | else | ||
1389 | 139 | message($lang_admin_options['SMTP passwords did not match']); | ||
1390 | 140 | } | ||
1391 | 141 | |||
1392 | 128 | if ($form['announcement_message'] != '') | 142 | if ($form['announcement_message'] != '') |
1393 | 129 | $form['announcement_message'] = pun_linebreaks($form['announcement_message']); | 143 | $form['announcement_message'] = pun_linebreaks($form['announcement_message']); |
1394 | 130 | else | 144 | else |
1395 | @@ -163,6 +177,9 @@ | |||
1396 | 163 | if ($form['feed_type'] < 0 || $form['feed_type'] > 2) | 177 | if ($form['feed_type'] < 0 || $form['feed_type'] > 2) |
1397 | 164 | message($lang_common['Bad request']); | 178 | message($lang_common['Bad request']); |
1398 | 165 | 179 | ||
1399 | 180 | if ($form['feed_ttl'] < 0) | ||
1400 | 181 | message($lang_common['Bad request']); | ||
1401 | 182 | |||
1402 | 166 | if ($form['report_method'] < 0 || $form['report_method'] > 2) | 183 | if ($form['report_method'] < 0 || $form['report_method'] > 2) |
1403 | 167 | message($lang_common['Bad request']); | 184 | message($lang_common['Bad request']); |
1404 | 168 | 185 | ||
1405 | @@ -191,6 +208,7 @@ | |||
1406 | 191 | require PUN_ROOT.'include/cache.php'; | 208 | require PUN_ROOT.'include/cache.php'; |
1407 | 192 | 209 | ||
1408 | 193 | generate_config_cache(); | 210 | generate_config_cache(); |
1409 | 211 | clear_feed_cache(); | ||
1410 | 194 | 212 | ||
1411 | 195 | redirect('admin_options.php', $lang_admin_options['Options updated redirect']); | 213 | redirect('admin_options.php', $lang_admin_options['Options updated redirect']); |
1412 | 196 | } | 214 | } |
1413 | @@ -205,7 +223,7 @@ | |||
1414 | 205 | <div class="blockform"> | 223 | <div class="blockform"> |
1415 | 206 | <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> | 224 | <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> |
1416 | 207 | <div class="box"> | 225 | <div class="box"> |
1418 | 208 | <form method="post" action="admin_options.php?action=foo"> | 226 | <form method="post" action="admin_options.php"> |
1419 | 209 | <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p> | 227 | <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p> |
1420 | 210 | <div class="inform"> | 228 | <div class="inform"> |
1421 | 211 | <input type="hidden" name="form_sent" value="1" /> | 229 | <input type="hidden" name="form_sent" value="1" /> |
1422 | @@ -230,7 +248,7 @@ | |||
1423 | 230 | <tr> | 248 | <tr> |
1424 | 231 | <th scope="row"><?php echo $lang_admin_options['Base URL label'] ?></th> | 249 | <th scope="row"><?php echo $lang_admin_options['Base URL label'] ?></th> |
1425 | 232 | <td> | 250 | <td> |
1427 | 233 | <input type="text" name="form[base_url]" size="50" maxlength="100" value="<?php echo $pun_config['o_base_url'] ?>" /> | 251 | <input type="text" name="form[base_url]" size="50" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_base_url']) ?>" /> |
1428 | 234 | <span><?php echo $lang_admin_options['Base URL help'] ?></span> | 252 | <span><?php echo $lang_admin_options['Base URL help'] ?></span> |
1429 | 235 | </td> | 253 | </td> |
1430 | 236 | </tr> | 254 | </tr> |
1431 | @@ -553,6 +571,15 @@ | |||
1432 | 553 | <span><?php echo $lang_admin_options['Menu items help'] ?></span> | 571 | <span><?php echo $lang_admin_options['Menu items help'] ?></span> |
1433 | 554 | </td> | 572 | </td> |
1434 | 555 | </tr> | 573 | </tr> |
1435 | 574 | </table> | ||
1436 | 575 | </div> | ||
1437 | 576 | </fieldset> | ||
1438 | 577 | </div> | ||
1439 | 578 | <div class="inform"> | ||
1440 | 579 | <fieldset> | ||
1441 | 580 | <legend><?php echo $lang_admin_options['Feed subhead'] ?></legend> | ||
1442 | 581 | <div class="infldset"> | ||
1443 | 582 | <table class="aligntop" cellspacing="0"> | ||
1444 | 556 | <tr> | 583 | <tr> |
1445 | 557 | <th scope="row"><?php echo $lang_admin_options['Default feed label'] ?></th> | 584 | <th scope="row"><?php echo $lang_admin_options['Default feed label'] ?></th> |
1446 | 558 | <td> | 585 | <td> |
1447 | @@ -560,6 +587,23 @@ | |||
1448 | 560 | <span><?php echo $lang_admin_options['Default feed help'] ?></span> | 587 | <span><?php echo $lang_admin_options['Default feed help'] ?></span> |
1449 | 561 | </td> | 588 | </td> |
1450 | 562 | </tr> | 589 | </tr> |
1451 | 590 | <tr> | ||
1452 | 591 | <th scope="row"><?php echo $lang_admin_options['Feed TTL label'] ?></th> | ||
1453 | 592 | <td> | ||
1454 | 593 | <select name="form[feed_ttl]"> | ||
1455 | 594 | <option value="0"<?php if ($pun_config['o_feed_ttl'] == '0') echo ' selected="selected"'; ?>><?php echo $lang_admin_options['No cache'] ?></option> | ||
1456 | 595 | <?php | ||
1457 | 596 | |||
1458 | 597 | $times = array(5, 15, 30, 60); | ||
1459 | 598 | |||
1460 | 599 | foreach ($times as $time) | ||
1461 | 600 | 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 | 601 | |||
1463 | 602 | ?> | ||
1464 | 603 | </select> | ||
1465 | 604 | <span><?php echo $lang_admin_options['Feed TTL help'] ?></span> | ||
1466 | 605 | </td> | ||
1467 | 606 | </tr> | ||
1468 | 563 | </table> | 607 | </table> |
1469 | 564 | </div> | 608 | </div> |
1470 | 565 | </fieldset> | 609 | </fieldset> |
1471 | @@ -651,10 +695,17 @@ | |||
1472 | 651 | </td> | 695 | </td> |
1473 | 652 | </tr> | 696 | </tr> |
1474 | 653 | <tr> | 697 | <tr> |
1479 | 654 | <th scope="row"><?php echo $lang_admin_options['Subscriptions label'] ?></th> | 698 | <th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th> |
1480 | 655 | <td> | 699 | <td> |
1481 | 656 | <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> | 700 | <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 | 657 | <span><?php echo $lang_admin_options['Subscriptions help'] ?></span> | 701 | <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> |
1483 | 702 | </td> | ||
1484 | 703 | </tr> | ||
1485 | 704 | <tr> | ||
1486 | 705 | <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> | ||
1487 | 706 | <td> | ||
1488 | 707 | <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 | 708 | <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> | ||
1490 | 658 | </td> | 709 | </td> |
1491 | 659 | </tr> | 710 | </tr> |
1492 | 660 | <tr> | 711 | <tr> |
1493 | @@ -674,7 +725,10 @@ | |||
1494 | 674 | <tr> | 725 | <tr> |
1495 | 675 | <th scope="row"><?php echo $lang_admin_options['SMTP password label'] ?></th> | 726 | <th scope="row"><?php echo $lang_admin_options['SMTP password label'] ?></th> |
1496 | 676 | <td> | 727 | <td> |
1498 | 677 | <input type="text" name="form[smtp_pass]" size="25" maxlength="50" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_pass']) ?>" /> | 728 | <span><input type="checkbox" name="form[smtp_change_pass]" value="1" />  <?php echo $lang_admin_options['SMTP change password help'] ?></span> |
1499 | 729 | <?php $smtp_pass = !empty($pun_config['o_smtp_pass']) ? random_key(pun_strlen($pun_config['o_smtp_pass']), true) : ''; ?> | ||
1500 | 730 | <input type="password" name="form[smtp_pass1]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> | ||
1501 | 731 | <input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> | ||
1502 | 678 | <span><?php echo $lang_admin_options['SMTP password help'] ?></span> | 732 | <span><?php echo $lang_admin_options['SMTP password help'] ?></span> |
1503 | 679 | </td> | 733 | </td> |
1504 | 680 | </tr> | 734 | </tr> |
1505 | 681 | 735 | ||
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 | 1 | <?php | 1 | <?php |
1511 | 2 | 2 | ||
1512 | 3 | /** | 3 | /** |
1514 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1515 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1516 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1517 | 7 | */ | 7 | */ |
1518 | @@ -9,7 +9,7 @@ | |||
1519 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
1520 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
1521 | 11 | 11 | ||
1523 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1524 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
1525 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
1526 | 15 | 15 | ||
1527 | 16 | 16 | ||
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 | 1 | <?php | ||
1533 | 2 | |||
1534 | 3 | /** | ||
1535 | 4 | * Copyright (C) 2008-2010 FluxBB | ||
1536 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | ||
1537 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | ||
1538 | 7 | */ | ||
1539 | 8 | |||
1540 | 9 | // Tell header.php to use the admin template | ||
1541 | 10 | define('PUN_ADMIN_CONSOLE', 1); | ||
1542 | 11 | |||
1543 | 12 | define('PUN_ROOT', './'); | ||
1544 | 13 | require PUN_ROOT.'include/common.php'; | ||
1545 | 14 | require PUN_ROOT.'include/common_admin.php'; | ||
1546 | 15 | |||
1547 | 16 | |||
1548 | 17 | if ($pun_user['g_id'] != PUN_ADMIN) | ||
1549 | 18 | message($lang_common['No permission']); | ||
1550 | 19 | |||
1551 | 20 | // Load the admin_prune.php language file | ||
1552 | 21 | require PUN_ROOT.'lang/'.$admin_language.'/admin_prune.php'; | ||
1553 | 22 | |||
1554 | 23 | if (isset($_GET['action']) || isset($_POST['prune']) || isset($_POST['prune_comply'])) | ||
1555 | 24 | { | ||
1556 | 25 | $prune_from = trim($_POST['prune_from']); | ||
1557 | 26 | $prune_sticky = intval($_POST['prune_sticky']); | ||
1558 | 27 | |||
1559 | 28 | if (isset($_POST['prune_comply'])) | ||
1560 | 29 | { | ||
1561 | 30 | confirm_referrer('admin_prune.php'); | ||
1562 | 31 | |||
1563 | 32 | $prune_days = intval($_POST['prune_days']); | ||
1564 | 33 | $prune_date = ($prune_days) ? time() - ($prune_days * 86400) : -1; | ||
1565 | 34 | |||
1566 | 35 | @set_time_limit(0); | ||
1567 | 36 | |||
1568 | 37 | if ($prune_from == 'all') | ||
1569 | 38 | { | ||
1570 | 39 | $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); | ||
1571 | 40 | $num_forums = $db->num_rows($result); | ||
1572 | 41 | |||
1573 | 42 | for ($i = 0; $i < $num_forums; ++$i) | ||
1574 | 43 | { | ||
1575 | 44 | $fid = $db->result($result, $i); | ||
1576 | 45 | |||
1577 | 46 | prune($fid, $prune_sticky, $prune_date); | ||
1578 | 47 | update_forum($fid); | ||
1579 | 48 | } | ||
1580 | 49 | } | ||
1581 | 50 | else | ||
1582 | 51 | { | ||
1583 | 52 | $prune_from = intval($prune_from); | ||
1584 | 53 | prune($prune_from, $prune_sticky, $prune_date); | ||
1585 | 54 | update_forum($prune_from); | ||
1586 | 55 | } | ||
1587 | 56 | |||
1588 | 57 | // Locate any "orphaned redirect topics" and delete them | ||
1589 | 58 | $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 | 59 | $num_orphans = $db->num_rows($result); | ||
1591 | 60 | |||
1592 | 61 | if ($num_orphans) | ||
1593 | 62 | { | ||
1594 | 63 | for ($i = 0; $i < $num_orphans; ++$i) | ||
1595 | 64 | $orphans[] = $db->result($result, $i); | ||
1596 | 65 | |||
1597 | 66 | $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); | ||
1598 | 67 | } | ||
1599 | 68 | |||
1600 | 69 | redirect('admin_prune.php', $lang_admin_prune['Posts pruned redirect']); | ||
1601 | 70 | } | ||
1602 | 71 | |||
1603 | 72 | $prune_days = trim($_POST['req_prune_days']); | ||
1604 | 73 | if ($prune_days == '' || preg_match('/[^0-9]/', $prune_days)) | ||
1605 | 74 | message($lang_admin_prune['Must be integer message']); | ||
1606 | 75 | |||
1607 | 76 | $prune_date = time() - ($prune_days * 86400); | ||
1608 | 77 | |||
1609 | 78 | // Concatenate together the query for counting number of topics to prune | ||
1610 | 79 | $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL'; | ||
1611 | 80 | |||
1612 | 81 | if ($prune_sticky == '0') | ||
1613 | 82 | $sql .= ' AND sticky=\'0\''; | ||
1614 | 83 | |||
1615 | 84 | if ($prune_from != 'all') | ||
1616 | 85 | { | ||
1617 | 86 | $prune_from = intval($prune_from); | ||
1618 | 87 | $sql .= ' AND forum_id='.$prune_from; | ||
1619 | 88 | |||
1620 | 89 | // Fetch the forum name (just for cosmetic reasons) | ||
1621 | 90 | $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 | 91 | $forum = '"'.pun_htmlspecialchars($db->result($result)).'"'; | ||
1623 | 92 | } | ||
1624 | 93 | else | ||
1625 | 94 | $forum = $lang_admin_prune['All forums']; | ||
1626 | 95 | |||
1627 | 96 | $result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error()); | ||
1628 | 97 | $num_topics = $db->result($result); | ||
1629 | 98 | |||
1630 | 99 | if (!$num_topics) | ||
1631 | 100 | message(sprintf($lang_admin_prune['No old topics message'], $prune_days)); | ||
1632 | 101 | |||
1633 | 102 | |||
1634 | 103 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); | ||
1635 | 104 | define('PUN_ACTIVE_PAGE', 'admin'); | ||
1636 | 105 | require PUN_ROOT.'header.php'; | ||
1637 | 106 | |||
1638 | 107 | generate_admin_menu('prune'); | ||
1639 | 108 | |||
1640 | 109 | ?> | ||
1641 | 110 | <div class="blockform"> | ||
1642 | 111 | <h2><span><?php echo $lang_admin_prune['Prune head'] ?></span></h2> | ||
1643 | 112 | <div class="box"> | ||
1644 | 113 | <form method="post" action="admin_prune.php?action=foo"> | ||
1645 | 114 | <div class="inform"> | ||
1646 | 115 | <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" /> | ||
1647 | 116 | <input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" /> | ||
1648 | 117 | <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" /> | ||
1649 | 118 | <fieldset> | ||
1650 | 119 | <legend><?php echo $lang_admin_prune['Confirm prune subhead'] ?></legend> | ||
1651 | 120 | <div class="infldset"> | ||
1652 | 121 | <p><?php printf($lang_admin_prune['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?></p> | ||
1653 | 122 | <p class="warntext"><?php echo $lang_admin_prune['Confirm prune warn'] ?></p> | ||
1654 | 123 | </div> | ||
1655 | 124 | </fieldset> | ||
1656 | 125 | </div> | ||
1657 | 126 | <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 | 127 | </form> | ||
1659 | 128 | </div> | ||
1660 | 129 | </div> | ||
1661 | 130 | <div class="clearer"></div> | ||
1662 | 131 | </div> | ||
1663 | 132 | <?php | ||
1664 | 133 | |||
1665 | 134 | require PUN_ROOT.'footer.php'; | ||
1666 | 135 | } | ||
1667 | 136 | |||
1668 | 137 | |||
1669 | 138 | else | ||
1670 | 139 | { | ||
1671 | 140 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); | ||
1672 | 141 | $required_fields = array('req_prune_days' => $lang_admin_prune['Days old label']); | ||
1673 | 142 | $focus_element = array('prune', 'req_prune_days'); | ||
1674 | 143 | define('PUN_ACTIVE_PAGE', 'admin'); | ||
1675 | 144 | require PUN_ROOT.'header.php'; | ||
1676 | 145 | |||
1677 | 146 | generate_admin_menu('prune'); | ||
1678 | 147 | |||
1679 | 148 | ?> | ||
1680 | 149 | <div class="blockform"> | ||
1681 | 150 | <h2><span><?php echo $lang_admin_prune['Prune head'] ?></span></h2> | ||
1682 | 151 | <div class="box"> | ||
1683 | 152 | <form id="prune" method="post" action="admin_prune.php?action=foo" onsubmit="return process_form(this)"> | ||
1684 | 153 | <div class="inform"> | ||
1685 | 154 | <input type="hidden" name="form_sent" value="1" /> | ||
1686 | 155 | <fieldset> | ||
1687 | 156 | <legend><?php echo $lang_admin_prune['Prune subhead'] ?></legend> | ||
1688 | 157 | <div class="infldset"> | ||
1689 | 158 | <table class="aligntop" cellspacing="0"> | ||
1690 | 159 | <tr> | ||
1691 | 160 | <th scope="row"><?php echo $lang_admin_prune['Days old label'] ?></th> | ||
1692 | 161 | <td> | ||
1693 | 162 | <input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="1" /> | ||
1694 | 163 | <span><?php echo $lang_admin_prune['Days old help'] ?></span> | ||
1695 | 164 | </td> | ||
1696 | 165 | </tr> | ||
1697 | 166 | <tr> | ||
1698 | 167 | <th scope="row"><?php echo $lang_admin_prune['Prune sticky label'] ?></th> | ||
1699 | 168 | <td> | ||
1700 | 169 | <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 | 170 | <span><?php echo $lang_admin_prune['Prune sticky help'] ?></span> | ||
1702 | 171 | </td> | ||
1703 | 172 | </tr> | ||
1704 | 173 | <tr> | ||
1705 | 174 | <th scope="row"><?php echo $lang_admin_prune['Prune from label'] ?></th> | ||
1706 | 175 | <td> | ||
1707 | 176 | <select name="prune_from" tabindex="3"> | ||
1708 | 177 | <option value="all"><?php echo $lang_admin_prune['All forums'] ?></option> | ||
1709 | 178 | <?php | ||
1710 | 179 | |||
1711 | 180 | $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 | 181 | |||
1713 | 182 | $cur_category = 0; | ||
1714 | 183 | while ($forum = $db->fetch_assoc($result)) | ||
1715 | 184 | { | ||
1716 | 185 | if ($forum['cid'] != $cur_category) // Are we still in the same category? | ||
1717 | 186 | { | ||
1718 | 187 | if ($cur_category) | ||
1719 | 188 | echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n"; | ||
1720 | 189 | |||
1721 | 190 | echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n"; | ||
1722 | 191 | $cur_category = $forum['cid']; | ||
1723 | 192 | } | ||
1724 | 193 | |||
1725 | 194 | 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 | 195 | } | ||
1727 | 196 | |||
1728 | 197 | ?> | ||
1729 | 198 | </optgroup> | ||
1730 | 199 | </select> | ||
1731 | 200 | <span><?php echo $lang_admin_prune['Prune from help'] ?></span> | ||
1732 | 201 | </td> | ||
1733 | 202 | </tr> | ||
1734 | 203 | </table> | ||
1735 | 204 | <p class="topspace"><?php printf($lang_admin_prune['Prune info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p> | ||
1736 | 205 | <div class="fsetsubmit"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="5" /></div> | ||
1737 | 206 | </div> | ||
1738 | 207 | </fieldset> | ||
1739 | 208 | </div> | ||
1740 | 209 | </form> | ||
1741 | 210 | </div> | ||
1742 | 211 | </div> | ||
1743 | 212 | <div class="clearer"></div> | ||
1744 | 213 | </div> | ||
1745 | 214 | <?php | ||
1746 | 215 | |||
1747 | 216 | require PUN_ROOT.'footer.php'; | ||
1748 | 217 | } | ||
1749 | 218 | 0 | ||
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 | 1 | <?php | 1 | <?php |
1755 | 2 | 2 | ||
1756 | 3 | /** | 3 | /** |
1758 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1759 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1760 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1761 | 7 | */ | 7 | */ |
1762 | @@ -9,7 +9,7 @@ | |||
1763 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
1764 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
1765 | 11 | 11 | ||
1767 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1768 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
1769 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
1770 | 15 | 15 | ||
1771 | @@ -113,7 +113,7 @@ | |||
1772 | 113 | <div class="blockform"> | 113 | <div class="blockform"> |
1773 | 114 | <h2><span><?php echo $lang_admin_ranks['Ranks head'] ?></span></h2> | 114 | <h2><span><?php echo $lang_admin_ranks['Ranks head'] ?></span></h2> |
1774 | 115 | <div class="box"> | 115 | <div class="box"> |
1776 | 116 | <form id="ranks" method="post" action="admin_ranks.php?action=foo"> | 116 | <form id="ranks" method="post" action="admin_ranks.php"> |
1777 | 117 | <div class="inform"> | 117 | <div class="inform"> |
1778 | 118 | <fieldset> | 118 | <fieldset> |
1779 | 119 | <legend><?php echo $lang_admin_ranks['Add rank subhead'] ?></legend> | 119 | <legend><?php echo $lang_admin_ranks['Add rank subhead'] ?></legend> |
1780 | 120 | 120 | ||
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 | 1 | <?php | 1 | <?php |
1786 | 2 | 2 | ||
1787 | 3 | /** | 3 | /** |
1789 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1790 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1791 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1792 | 7 | */ | 7 | */ |
1793 | @@ -9,7 +9,7 @@ | |||
1794 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
1795 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
1796 | 11 | 11 | ||
1798 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1799 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
1800 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
1801 | 15 | 15 | ||
1802 | @@ -33,6 +33,14 @@ | |||
1803 | 33 | if ($zapped == '') | 33 | if ($zapped == '') |
1804 | 34 | $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()); | 34 | $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 | 35 | 35 | ||
1806 | 36 | // Delete old reports (which cannot be viewed anyway) | ||
1807 | 37 | $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 | 38 | if ($db->num_rows($result) > 0) | ||
1809 | 39 | { | ||
1810 | 40 | $zapped_threshold = $db->result($result); | ||
1811 | 41 | $db->query('DELETE FROM '.$db->prefix.'reports WHERE zapped <= '.$zapped_threshold) or error('Unable to delete old read reports', __FILE__, __LINE__, $db->error()); | ||
1812 | 42 | } | ||
1813 | 43 | |||
1814 | 36 | redirect('admin_reports.php', $lang_admin_reports['Report zapped redirect']); | 44 | redirect('admin_reports.php', $lang_admin_reports['Report zapped redirect']); |
1815 | 37 | } | 45 | } |
1816 | 38 | 46 | ||
1817 | @@ -60,7 +68,7 @@ | |||
1818 | 60 | $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>'; | 68 | $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 | 61 | $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>'; | 69 | $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 | 62 | $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])); | 70 | $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])); |
1822 | 63 | $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>'; | 71 | $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 | 64 | $report_location = array($forum, $topic, $post_id); | 72 | $report_location = array($forum, $topic, $post_id); |
1824 | 65 | 73 | ||
1825 | 66 | ?> | 74 | ?> |
1826 | @@ -122,7 +130,7 @@ | |||
1827 | 122 | $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>'; | 130 | $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 | 123 | $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>'; | 131 | $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 | 124 | $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])); | 132 | $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])); |
1831 | 125 | $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>'; | 133 | $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 | 126 | $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']; | 134 | $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 | 127 | $zapped_by = ($cur_report['zapped_by'] != '') ? '<strong>'.pun_htmlspecialchars($cur_report['zapped_by']).'</strong>' : $lang_admin_reports['NA']; | 135 | $zapped_by = ($cur_report['zapped_by'] != '') ? '<strong>'.pun_htmlspecialchars($cur_report['zapped_by']).'</strong>' : $lang_admin_reports['NA']; |
1834 | 128 | $report_location = array($forum, $topic, $post_id); | 136 | $report_location = array($forum, $topic, $post_id); |
1835 | @@ -173,4 +181,4 @@ | |||
1836 | 173 | </div> | 181 | </div> |
1837 | 174 | <?php | 182 | <?php |
1838 | 175 | 183 | ||
1839 | 176 | require PUN_ROOT.'footer.php'; | ||
1840 | 177 | \ No newline at end of file | 184 | \ No newline at end of file |
1841 | 185 | require PUN_ROOT.'footer.php'; | ||
1842 | 178 | 186 | ||
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 | 1 | <?php | 1 | <?php |
1848 | 2 | 2 | ||
1849 | 3 | /** | 3 | /** |
1851 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
1852 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
1853 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
1854 | 7 | */ | 7 | */ |
1855 | @@ -9,7 +9,7 @@ | |||
1856 | 9 | // Tell header.php to use the admin template | 9 | // Tell header.php to use the admin template |
1857 | 10 | define('PUN_ADMIN_CONSOLE', 1); | 10 | define('PUN_ADMIN_CONSOLE', 1); |
1858 | 11 | 11 | ||
1860 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
1861 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
1862 | 14 | require PUN_ROOT.'include/common_admin.php'; | 14 | require PUN_ROOT.'include/common_admin.php'; |
1863 | 15 | 15 | ||
1864 | @@ -194,7 +194,7 @@ | |||
1865 | 194 | { | 194 | { |
1866 | 195 | $user_title = get_title($user_data); | 195 | $user_title = get_title($user_data); |
1867 | 196 | 196 | ||
1869 | 197 | $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>'; | 197 | $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 | 198 | 198 | ||
1871 | 199 | ?> | 199 | ?> |
1872 | 200 | <tr> | 200 | <tr> |
1873 | @@ -253,6 +253,419 @@ | |||
1874 | 253 | } | 253 | } |
1875 | 254 | 254 | ||
1876 | 255 | 255 | ||
1877 | 256 | // Move multiple users to other user groups | ||
1878 | 257 | else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) | ||
1879 | 258 | { | ||
1880 | 259 | if ($pun_user['g_id'] > PUN_ADMIN) | ||
1881 | 260 | message($lang_common['No permission']); | ||
1882 | 261 | |||
1883 | 262 | confirm_referrer('admin_users.php'); | ||
1884 | 263 | |||
1885 | 264 | if (isset($_POST['users'])) | ||
1886 | 265 | { | ||
1887 | 266 | $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); | ||
1888 | 267 | $user_ids = array_map('intval', $user_ids); | ||
1889 | 268 | |||
1890 | 269 | // Delete invalid IDs | ||
1891 | 270 | $user_ids = array_diff($user_ids, array(0, 1)); | ||
1892 | 271 | } | ||
1893 | 272 | else | ||
1894 | 273 | $user_ids = array(); | ||
1895 | 274 | |||
1896 | 275 | if (empty($user_ids)) | ||
1897 | 276 | message($lang_admin_users['No users selected']); | ||
1898 | 277 | |||
1899 | 278 | // Are we trying to batch move any admins? | ||
1900 | 279 | $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 | 280 | if ($db->result($result) > 0) | ||
1902 | 281 | message($lang_admin_users['No move admins message']); | ||
1903 | 282 | |||
1904 | 283 | // Fetch all user groups | ||
1905 | 284 | $all_groups = array(); | ||
1906 | 285 | $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 | 286 | while ($row = $db->fetch_row($result)) | ||
1908 | 287 | $all_groups[$row[0]] = $row[1]; | ||
1909 | 288 | |||
1910 | 289 | if (isset($_POST['move_users_comply'])) | ||
1911 | 290 | { | ||
1912 | 291 | $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); | ||
1913 | 292 | |||
1914 | 293 | // Is the new group a moderator group? | ||
1915 | 294 | $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 | 295 | $new_group_mod = $db->result($result); | ||
1917 | 296 | |||
1918 | 297 | // Fetch user groups | ||
1919 | 298 | $user_groups = array(); | ||
1920 | 299 | $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 | 300 | while ($cur_user = $db->fetch_assoc($result)) | ||
1922 | 301 | { | ||
1923 | 302 | if (!isset($user_groups[$cur_user['group_id']])) | ||
1924 | 303 | $user_groups[$cur_user['group_id']] = array(); | ||
1925 | 304 | |||
1926 | 305 | $user_groups[$cur_user['group_id']][] = $cur_user['id']; | ||
1927 | 306 | } | ||
1928 | 307 | |||
1929 | 308 | // Are any users moderators? | ||
1930 | 309 | $group_ids = array_keys($user_groups); | ||
1931 | 310 | $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 | 311 | while ($cur_group = $db->fetch_assoc($result)) | ||
1933 | 312 | { | ||
1934 | 313 | if ($cur_group['g_moderator'] == '0') | ||
1935 | 314 | unset($user_groups[$cur_group['g_id']]); | ||
1936 | 315 | } | ||
1937 | 316 | |||
1938 | 317 | if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') | ||
1939 | 318 | { | ||
1940 | 319 | // Fetch forum list and clean up their moderator list | ||
1941 | 320 | $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); | ||
1942 | 321 | while ($cur_forum = $db->fetch_assoc($result)) | ||
1943 | 322 | { | ||
1944 | 323 | $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); | ||
1945 | 324 | |||
1946 | 325 | foreach ($user_groups as $group_users) | ||
1947 | 326 | $cur_moderators = array_diff($cur_moderators, $group_users); | ||
1948 | 327 | |||
1949 | 328 | $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; | ||
1950 | 329 | $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 | 330 | } | ||
1952 | 331 | } | ||
1953 | 332 | |||
1954 | 333 | // Change user group | ||
1955 | 334 | $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 | 335 | |||
1957 | 336 | redirect('admin_users.php', $lang_admin_users['Users move redirect']); | ||
1958 | 337 | } | ||
1959 | 338 | |||
1960 | 339 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Move users']); | ||
1961 | 340 | define('PUN_ACTIVE_PAGE', 'admin'); | ||
1962 | 341 | require PUN_ROOT.'header.php'; | ||
1963 | 342 | |||
1964 | 343 | generate_admin_menu('users'); | ||
1965 | 344 | |||
1966 | 345 | ?> | ||
1967 | 346 | <div class="blockform"> | ||
1968 | 347 | <h2><span><?php echo $lang_admin_users['Move users'] ?></span></h2> | ||
1969 | 348 | <div class="box"> | ||
1970 | 349 | <form name="confirm_move_users" method="post" action="admin_users.php"> | ||
1971 | 350 | <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> | ||
1972 | 351 | <div class="inform"> | ||
1973 | 352 | <fieldset> | ||
1974 | 353 | <legend><?php echo $lang_admin_users['Move users subhead'] ?></legend> | ||
1975 | 354 | <div class="infldset"> | ||
1976 | 355 | <table class="aligntop" cellspacing="0"> | ||
1977 | 356 | <tr> | ||
1978 | 357 | <th scope="row"><?php echo $lang_admin_users['New group label'] ?></th> | ||
1979 | 358 | <td> | ||
1980 | 359 | <select name="new_group" tabindex="1"> | ||
1981 | 360 | <?php foreach ($all_groups as $gid => $group) : ?> <option value="<?php echo $gid ?>"><?php echo pun_htmlspecialchars($group) ?></option> | ||
1982 | 361 | <?php endforeach; ?> | ||
1983 | 362 | </select> | ||
1984 | 363 | <span><?php echo $lang_admin_users['New group help'] ?></span> | ||
1985 | 364 | </td> | ||
1986 | 365 | </tr> | ||
1987 | 366 | </table> | ||
1988 | 367 | </div> | ||
1989 | 368 | </fieldset> | ||
1990 | 369 | </div> | ||
1991 | 370 | <p class="submitend"><input type="submit" name="move_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="2" /></p> | ||
1992 | 371 | </form> | ||
1993 | 372 | </div> | ||
1994 | 373 | </div> | ||
1995 | 374 | <div class="clearer"></div> | ||
1996 | 375 | </div> | ||
1997 | 376 | <?php | ||
1998 | 377 | |||
1999 | 378 | require PUN_ROOT.'footer.php'; | ||
2000 | 379 | } | ||
2001 | 380 | |||
2002 | 381 | |||
2003 | 382 | // Delete multiple users | ||
2004 | 383 | else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) | ||
2005 | 384 | { | ||
2006 | 385 | if ($pun_user['g_id'] > PUN_ADMIN) | ||
2007 | 386 | message($lang_common['No permission']); | ||
2008 | 387 | |||
2009 | 388 | confirm_referrer('admin_users.php'); | ||
2010 | 389 | |||
2011 | 390 | if (isset($_POST['users'])) | ||
2012 | 391 | { | ||
2013 | 392 | $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); | ||
2014 | 393 | $user_ids = array_map('intval', $user_ids); | ||
2015 | 394 | |||
2016 | 395 | // Delete invalid IDs | ||
2017 | 396 | $user_ids = array_diff($user_ids, array(0, 1)); | ||
2018 | 397 | } | ||
2019 | 398 | else | ||
2020 | 399 | $user_ids = array(); | ||
2021 | 400 | |||
2022 | 401 | if (empty($user_ids)) | ||
2023 | 402 | message($lang_admin_users['No users selected']); | ||
2024 | 403 | |||
2025 | 404 | // Are we trying to delete any admins? | ||
2026 | 405 | $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 | 406 | if ($db->result($result) > 0) | ||
2028 | 407 | message($lang_admin_users['No delete admins message']); | ||
2029 | 408 | |||
2030 | 409 | if (isset($_POST['delete_users_comply'])) | ||
2031 | 410 | { | ||
2032 | 411 | // Fetch user groups | ||
2033 | 412 | $user_groups = array(); | ||
2034 | 413 | $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 | 414 | while ($cur_user = $db->fetch_assoc($result)) | ||
2036 | 415 | { | ||
2037 | 416 | if (!isset($user_groups[$cur_user['group_id']])) | ||
2038 | 417 | $user_groups[$cur_user['group_id']] = array(); | ||
2039 | 418 | |||
2040 | 419 | $user_groups[$cur_user['group_id']][] = $cur_user['id']; | ||
2041 | 420 | } | ||
2042 | 421 | |||
2043 | 422 | // Are any users moderators? | ||
2044 | 423 | $group_ids = array_keys($user_groups); | ||
2045 | 424 | $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 | 425 | while ($cur_group = $db->fetch_assoc($result)) | ||
2047 | 426 | { | ||
2048 | 427 | if ($cur_group['g_moderator'] == '0') | ||
2049 | 428 | unset($user_groups[$cur_group['g_id']]); | ||
2050 | 429 | } | ||
2051 | 430 | |||
2052 | 431 | // Fetch forum list and clean up their moderator list | ||
2053 | 432 | $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); | ||
2054 | 433 | while ($cur_forum = $db->fetch_assoc($result)) | ||
2055 | 434 | { | ||
2056 | 435 | $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); | ||
2057 | 436 | |||
2058 | 437 | foreach ($user_groups as $group_users) | ||
2059 | 438 | $cur_moderators = array_diff($cur_moderators, $group_users); | ||
2060 | 439 | |||
2061 | 440 | $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; | ||
2062 | 441 | $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 | 442 | } | ||
2064 | 443 | |||
2065 | 444 | // Delete any subscriptions | ||
2066 | 445 | $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 | 446 | $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 | 447 | |||
2069 | 448 | // Remove them from the online list (if they happen to be logged in) | ||
2070 | 449 | $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 | 450 | |||
2072 | 451 | // Should we delete all posts made by these users? | ||
2073 | 452 | if (isset($_POST['delete_posts'])) | ||
2074 | 453 | { | ||
2075 | 454 | require PUN_ROOT.'include/search_idx.php'; | ||
2076 | 455 | @set_time_limit(0); | ||
2077 | 456 | |||
2078 | 457 | // Find all posts made by this user | ||
2079 | 458 | $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 | 459 | if ($db->num_rows($result)) | ||
2081 | 460 | { | ||
2082 | 461 | while ($cur_post = $db->fetch_assoc($result)) | ||
2083 | 462 | { | ||
2084 | 463 | // Determine whether this post is the "topic post" or not | ||
2085 | 464 | $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 | 465 | |||
2087 | 466 | if ($db->result($result2) == $cur_post['id']) | ||
2088 | 467 | delete_topic($cur_post['topic_id']); | ||
2089 | 468 | else | ||
2090 | 469 | delete_post($cur_post['id'], $cur_post['topic_id']); | ||
2091 | 470 | |||
2092 | 471 | update_forum($cur_post['forum_id']); | ||
2093 | 472 | } | ||
2094 | 473 | } | ||
2095 | 474 | } | ||
2096 | 475 | else | ||
2097 | 476 | // Set all their posts to guest | ||
2098 | 477 | $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 | 478 | |||
2100 | 479 | // Delete the users | ||
2101 | 480 | $db->query('DELETE FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to delete users', __FILE__, __LINE__, $db->error()); | ||
2102 | 481 | |||
2103 | 482 | // Delete user avatars | ||
2104 | 483 | foreach ($user_ids as $user_id) | ||
2105 | 484 | delete_avatar($user_id); | ||
2106 | 485 | |||
2107 | 486 | redirect('admin_users.php', $lang_admin_users['Users delete redirect']); | ||
2108 | 487 | } | ||
2109 | 488 | |||
2110 | 489 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); | ||
2111 | 490 | define('PUN_ACTIVE_PAGE', 'admin'); | ||
2112 | 491 | require PUN_ROOT.'header.php'; | ||
2113 | 492 | |||
2114 | 493 | generate_admin_menu('users'); | ||
2115 | 494 | |||
2116 | 495 | ?> | ||
2117 | 496 | <div class="blockform"> | ||
2118 | 497 | <h2><span><?php echo $lang_admin_users['Delete users'] ?></span></h2> | ||
2119 | 498 | <div class="box"> | ||
2120 | 499 | <form name="confirm_del_users" method="post" action="admin_users.php"> | ||
2121 | 500 | <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> | ||
2122 | 501 | <div class="inform"> | ||
2123 | 502 | <fieldset> | ||
2124 | 503 | <legend><?php echo $lang_admin_users['Confirm delete legend'] ?></legend> | ||
2125 | 504 | <div class="infldset"> | ||
2126 | 505 | <p><?php echo $lang_admin_users['Confirm delete info'] ?></p> | ||
2127 | 506 | <div class="rbox"> | ||
2128 | 507 | <label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_admin_users['Delete posts'] ?><br /></label> | ||
2129 | 508 | </div> | ||
2130 | 509 | <p class="warntext"><strong><?php echo $lang_admin_users['Delete warning'] ?></strong></p> | ||
2131 | 510 | </div> | ||
2132 | 511 | </fieldset> | ||
2133 | 512 | </div> | ||
2134 | 513 | <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 | 514 | </form> | ||
2136 | 515 | </div> | ||
2137 | 516 | </div> | ||
2138 | 517 | <div class="clearer"></div> | ||
2139 | 518 | </div> | ||
2140 | 519 | <?php | ||
2141 | 520 | |||
2142 | 521 | require PUN_ROOT.'footer.php'; | ||
2143 | 522 | } | ||
2144 | 523 | |||
2145 | 524 | |||
2146 | 525 | // Ban multiple users | ||
2147 | 526 | else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) | ||
2148 | 527 | { | ||
2149 | 528 | if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) | ||
2150 | 529 | message($lang_common['No permission']); | ||
2151 | 530 | |||
2152 | 531 | confirm_referrer('admin_users.php'); | ||
2153 | 532 | |||
2154 | 533 | if (isset($_POST['users'])) | ||
2155 | 534 | { | ||
2156 | 535 | $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); | ||
2157 | 536 | $user_ids = array_map('intval', $user_ids); | ||
2158 | 537 | |||
2159 | 538 | // Delete invalid IDs | ||
2160 | 539 | $user_ids = array_diff($user_ids, array(0, 1)); | ||
2161 | 540 | } | ||
2162 | 541 | else | ||
2163 | 542 | $user_ids = array(); | ||
2164 | 543 | |||
2165 | 544 | if (empty($user_ids)) | ||
2166 | 545 | message($lang_admin_users['No users selected']); | ||
2167 | 546 | |||
2168 | 547 | // Are we trying to ban any admins? | ||
2169 | 548 | $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 | 549 | if ($db->result($result) > 0) | ||
2171 | 550 | message($lang_admin_users['No ban admins message']); | ||
2172 | 551 | |||
2173 | 552 | // Also, we cannot ban moderators | ||
2174 | 553 | $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 | 554 | if ($db->result($result) > 0) | ||
2176 | 555 | message($lang_admin_users['No ban mods message']); | ||
2177 | 556 | |||
2178 | 557 | if (isset($_POST['ban_users_comply'])) | ||
2179 | 558 | { | ||
2180 | 559 | $ban_message = pun_trim($_POST['ban_message']); | ||
2181 | 560 | $ban_expire = pun_trim($_POST['ban_expire']); | ||
2182 | 561 | $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; | ||
2183 | 562 | |||
2184 | 563 | if ($ban_expire != '' && $ban_expire != 'Never') | ||
2185 | 564 | { | ||
2186 | 565 | $ban_expire = strtotime($ban_expire.' GMT'); | ||
2187 | 566 | |||
2188 | 567 | if ($ban_expire == -1 || !$ban_expire) | ||
2189 | 568 | message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); | ||
2190 | 569 | |||
2191 | 570 | $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; | ||
2192 | 571 | $ban_expire -= $diff; | ||
2193 | 572 | |||
2194 | 573 | if ($ban_expire <= time()) | ||
2195 | 574 | message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); | ||
2196 | 575 | } | ||
2197 | 576 | else | ||
2198 | 577 | $ban_expire = 'NULL'; | ||
2199 | 578 | |||
2200 | 579 | $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; | ||
2201 | 580 | |||
2202 | 581 | // Fetch user information | ||
2203 | 582 | $user_info = array(); | ||
2204 | 583 | $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 | 584 | while ($cur_user = $db->fetch_assoc($result)) | ||
2206 | 585 | $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); | ||
2207 | 586 | |||
2208 | 587 | // Overwrite the registration IP with one from the last post (if it exists) | ||
2209 | 588 | if ($ban_the_ip != 0) | ||
2210 | 589 | { | ||
2211 | 590 | $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 | 591 | while ($cur_address = $db->fetch_assoc($result)) | ||
2213 | 592 | $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; | ||
2214 | 593 | } | ||
2215 | 594 | |||
2216 | 595 | // And insert the bans! | ||
2217 | 596 | foreach ($user_ids as $user_id) | ||
2218 | 597 | { | ||
2219 | 598 | $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; | ||
2220 | 599 | $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; | ||
2221 | 600 | $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; | ||
2222 | 601 | |||
2223 | 602 | $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 | 603 | } | ||
2225 | 604 | |||
2226 | 605 | // Regenerate the bans cache | ||
2227 | 606 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
2228 | 607 | require PUN_ROOT.'include/cache.php'; | ||
2229 | 608 | |||
2230 | 609 | generate_bans_cache(); | ||
2231 | 610 | |||
2232 | 611 | redirect('admin_users.php', $lang_admin_users['Users banned redirect']); | ||
2233 | 612 | } | ||
2234 | 613 | |||
2235 | 614 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); | ||
2236 | 615 | $focus_element = array('bans2', 'ban_message'); | ||
2237 | 616 | define('PUN_ACTIVE_PAGE', 'admin'); | ||
2238 | 617 | require PUN_ROOT.'header.php'; | ||
2239 | 618 | |||
2240 | 619 | generate_admin_menu('users'); | ||
2241 | 620 | |||
2242 | 621 | ?> | ||
2243 | 622 | <div class="blockform"> | ||
2244 | 623 | <h2><span><?php echo $lang_admin_users['Ban users'] ?></span></h2> | ||
2245 | 624 | <div class="box"> | ||
2246 | 625 | <form id="bans2" name="confirm_ban_users" method="post" action="admin_users.php"> | ||
2247 | 626 | <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> | ||
2248 | 627 | <div class="inform"> | ||
2249 | 628 | <fieldset> | ||
2250 | 629 | <legend><?php echo $lang_admin_users['Message expiry subhead'] ?></legend> | ||
2251 | 630 | <div class="infldset"> | ||
2252 | 631 | <table class="aligntop" cellspacing="0"> | ||
2253 | 632 | <tr> | ||
2254 | 633 | <th scope="row"><?php echo $lang_admin_users['Ban message label'] ?></th> | ||
2255 | 634 | <td> | ||
2256 | 635 | <input type="text" name="ban_message" size="50" maxlength="255" tabindex="1" /> | ||
2257 | 636 | <span><?php echo $lang_admin_users['Ban message help'] ?></span> | ||
2258 | 637 | </td> | ||
2259 | 638 | </tr> | ||
2260 | 639 | <tr> | ||
2261 | 640 | <th scope="row"><?php echo $lang_admin_users['Expire date label'] ?></th> | ||
2262 | 641 | <td> | ||
2263 | 642 | <input type="text" name="ban_expire" size="17" maxlength="10" tabindex="2" /> | ||
2264 | 643 | <span><?php echo $lang_admin_users['Expire date help'] ?></span> | ||
2265 | 644 | </td> | ||
2266 | 645 | </tr> | ||
2267 | 646 | <tr> | ||
2268 | 647 | <th scope="row"><?php echo $lang_admin_users['Ban IP label'] ?></th> | ||
2269 | 648 | <td> | ||
2270 | 649 | <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 | 650 | <span><?php echo $lang_admin_users['Ban IP help'] ?></span> | ||
2272 | 651 | </td> | ||
2273 | 652 | </tr> | ||
2274 | 653 | </table> | ||
2275 | 654 | </div> | ||
2276 | 655 | </fieldset> | ||
2277 | 656 | </div> | ||
2278 | 657 | <p class="submitend"><input type="submit" name="ban_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="3" /></p> | ||
2279 | 658 | </form> | ||
2280 | 659 | </div> | ||
2281 | 660 | </div> | ||
2282 | 661 | <div class="clearer"></div> | ||
2283 | 662 | </div> | ||
2284 | 663 | <?php | ||
2285 | 664 | |||
2286 | 665 | require PUN_ROOT.'footer.php'; | ||
2287 | 666 | } | ||
2288 | 667 | |||
2289 | 668 | |||
2290 | 256 | else if (isset($_GET['find_user'])) | 669 | else if (isset($_GET['find_user'])) |
2291 | 257 | { | 670 | { |
2292 | 258 | $form = isset($_GET['form']) ? $_GET['form'] : array(); | 671 | $form = isset($_GET['form']) ? $_GET['form'] : array(); |
2293 | @@ -356,8 +769,14 @@ | |||
2294 | 356 | 769 | ||
2295 | 357 | // Generate paging links | 770 | // Generate paging links |
2296 | 358 | $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); | 771 | $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); |
2297 | 772 | |||
2298 | 773 | // Some helper variables for permissions | ||
2299 | 774 | $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; | ||
2300 | 775 | $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); | ||
2301 | 776 | $can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0; | ||
2302 | 359 | 777 | ||
2303 | 360 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); | 778 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); |
2304 | 779 | $page_head = array('js' => '<script type="text/javascript" src="common.js"></script>'); | ||
2305 | 361 | define('PUN_ACTIVE_PAGE', 'admin'); | 780 | define('PUN_ACTIVE_PAGE', 'admin'); |
2306 | 362 | require PUN_ROOT.'header.php'; | 781 | require PUN_ROOT.'header.php'; |
2307 | 363 | 782 | ||
2308 | @@ -377,6 +796,7 @@ | |||
2309 | 377 | </div> | 796 | </div> |
2310 | 378 | 797 | ||
2311 | 379 | 798 | ||
2312 | 799 | <form id="search-users-form" action="admin_users.php" method="post"> | ||
2313 | 380 | <div id="users2" class="blocktable"> | 800 | <div id="users2" class="blocktable"> |
2314 | 381 | <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> | 801 | <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> |
2315 | 382 | <div class="box"> | 802 | <div class="box"> |
2316 | @@ -390,6 +810,8 @@ | |||
2317 | 390 | <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> | 810 | <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> |
2318 | 391 | <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> | 811 | <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> |
2319 | 392 | <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> | 812 | <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> |
2320 | 813 | <?php if ($can_action): ?> <th class="tcmod" scope="col"><?php echo $lang_admin_users['Select'] ?></th> | ||
2321 | 814 | <?php endif; ?> | ||
2322 | 393 | </tr> | 815 | </tr> |
2323 | 394 | </thead> | 816 | </thead> |
2324 | 395 | <tbody> | 817 | <tbody> |
2325 | @@ -406,7 +828,7 @@ | |||
2326 | 406 | if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) | 828 | if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) |
2327 | 407 | $user_title = '<span class="warntext">'.$lang_admin_users['Not verified'].'</span>'; | 829 | $user_title = '<span class="warntext">'.$lang_admin_users['Not verified'].'</span>'; |
2328 | 408 | 830 | ||
2330 | 409 | $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>'; | 831 | $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 | 410 | 832 | ||
2332 | 411 | ?> | 833 | ?> |
2333 | 412 | <tr> | 834 | <tr> |
2334 | @@ -416,6 +838,8 @@ | |||
2335 | 416 | <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> | 838 | <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> |
2336 | 417 | <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> | 839 | <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> |
2337 | 418 | <td class="tcr"><?php echo $actions ?></td> | 840 | <td class="tcr"><?php echo $actions ?></td> |
2338 | 841 | <?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> | ||
2339 | 842 | <?php endif; ?> | ||
2340 | 419 | </tr> | 843 | </tr> |
2341 | 420 | <?php | 844 | <?php |
2342 | 421 | 845 | ||
2343 | @@ -435,6 +859,8 @@ | |||
2344 | 435 | <div class="inbox crumbsplus"> | 859 | <div class="inbox crumbsplus"> |
2345 | 436 | <div class="pagepost"> | 860 | <div class="pagepost"> |
2346 | 437 | <p class="pagelink"><?php echo $paging_links ?></p> | 861 | <p class="pagelink"><?php echo $paging_links ?></p> |
2347 | 862 | <?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 | 863 | <?php endif; ?> | ||
2349 | 438 | </div> | 864 | </div> |
2350 | 439 | <ul class="crumbs"> | 865 | <ul class="crumbs"> |
2351 | 440 | <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> | 866 | <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> |
2352 | @@ -444,6 +870,7 @@ | |||
2353 | 444 | <div class="clearer"></div> | 870 | <div class="clearer"></div> |
2354 | 445 | </div> | 871 | </div> |
2355 | 446 | </div> | 872 | </div> |
2356 | 873 | </form> | ||
2357 | 447 | <?php | 874 | <?php |
2358 | 448 | 875 | ||
2359 | 449 | require PUN_ROOT.'footer.php'; | 876 | require PUN_ROOT.'footer.php'; |
2360 | @@ -453,7 +880,7 @@ | |||
2361 | 453 | else | 880 | else |
2362 | 454 | { | 881 | { |
2363 | 455 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users']); | 882 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users']); |
2365 | 456 | $focus_element = array('find_user', 'username'); | 883 | $focus_element = array('find_user', 'form[username]'); |
2366 | 457 | define('PUN_ACTIVE_PAGE', 'admin'); | 884 | define('PUN_ACTIVE_PAGE', 'admin'); |
2367 | 458 | require PUN_ROOT.'header.php'; | 885 | require PUN_ROOT.'header.php'; |
2368 | 459 | 886 | ||
2369 | 460 | 887 | ||
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 | 1 | |||
2377 | 2 | function select_checkboxes(curFormId, link, new_string) | ||
2378 | 3 | { | ||
2379 | 4 | var curForm = document.getElementById(curFormId); | ||
2380 | 5 | var inputlist = curForm.getElementsByTagName("input"); | ||
2381 | 6 | for (i = 0; i < inputlist.length; i++) | ||
2382 | 7 | { | ||
2383 | 8 | if (inputlist[i].getAttribute("type") == 'checkbox' && inputlist[i].disabled == false) | ||
2384 | 9 | inputlist[i].checked = true; | ||
2385 | 10 | } | ||
2386 | 11 | |||
2387 | 12 | link.setAttribute('onclick', 'return unselect_checkboxes(\'' + curFormId + '\', this, \'' + link.innerHTML + '\')'); | ||
2388 | 13 | link.innerHTML = new_string; | ||
2389 | 14 | |||
2390 | 15 | return false; | ||
2391 | 16 | } | ||
2392 | 17 | |||
2393 | 18 | function unselect_checkboxes(curFormId, link, new_string) | ||
2394 | 19 | { | ||
2395 | 20 | var curForm = document.getElementById(curFormId); | ||
2396 | 21 | var inputlist = curForm.getElementsByTagName("input"); | ||
2397 | 22 | for (i = 0; i < inputlist.length; i++) | ||
2398 | 23 | { | ||
2399 | 24 | if (inputlist[i].getAttribute("type") == 'checkbox' && inputlist[i].disabled == false) | ||
2400 | 25 | inputlist[i].checked = false; | ||
2401 | 26 | } | ||
2402 | 27 | |||
2403 | 28 | link.setAttribute('onclick', 'return select_checkboxes(\'' + curFormId + '\', this, \'' + link.innerHTML + '\')'); | ||
2404 | 29 | link.innerHTML = new_string; | ||
2405 | 30 | |||
2406 | 31 | return false; | ||
2407 | 32 | } | ||
2408 | 0 | \ No newline at end of file | 33 | \ No newline at end of file |
2409 | 1 | 34 | ||
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 | 1 | <?php | 1 | <?php |
2415 | 2 | 2 | ||
2416 | 3 | /** | 3 | /** |
2418 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
2419 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
2420 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
2421 | 7 | */ | 7 | */ |
2422 | 8 | 8 | ||
2423 | 9 | // The FluxBB version this script updates to | 9 | // The FluxBB version this script updates to |
2431 | 10 | define('UPDATE_TO', '1.4.2'); | 10 | define('UPDATE_TO', '1.4.5'); |
2432 | 11 | 11 | ||
2433 | 12 | define('UPDATE_TO_DB_REVISION', 8); | 12 | define('UPDATE_TO_DB_REVISION', 11); |
2434 | 13 | define('UPDATE_TO_SI_REVISION', 1); | 13 | define('UPDATE_TO_SI_REVISION', 2); |
2435 | 14 | define('UPDATE_TO_PARSER_REVISION', 1); | 14 | define('UPDATE_TO_PARSER_REVISION', 2); |
2436 | 15 | 15 | ||
2437 | 16 | define('MIN_PHP_VERSION', '4.3.0'); | 16 | define('MIN_PHP_VERSION', '4.4.0'); |
2438 | 17 | define('MIN_MYSQL_VERSION', '4.1.2'); | 17 | define('MIN_MYSQL_VERSION', '4.1.2'); |
2439 | 18 | define('MIN_PGSQL_VERSION', '7.0.0'); | 18 | define('MIN_PGSQL_VERSION', '7.0.0'); |
2440 | 19 | define('PUN_SEARCH_MIN_WORD', 3); | 19 | define('PUN_SEARCH_MIN_WORD', 3); |
2441 | @@ -34,7 +34,7 @@ | |||
2442 | 34 | if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) | 34 | if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) |
2443 | 35 | 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.'); | 35 | 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 | 36 | 36 | ||
2446 | 37 | define('PUN_ROOT', './'); | 37 | define('PUN_ROOT', dirname(__FILE__).'/'); |
2447 | 38 | 38 | ||
2448 | 39 | // Attempt to load the configuration file config.php | 39 | // Attempt to load the configuration file config.php |
2449 | 40 | if (file_exists(PUN_ROOT.'config.php')) | 40 | if (file_exists(PUN_ROOT.'config.php')) |
2450 | @@ -44,9 +44,12 @@ | |||
2451 | 44 | if (defined('FORUM')) | 44 | if (defined('FORUM')) |
2452 | 45 | define('PUN', FORUM); | 45 | define('PUN', FORUM); |
2453 | 46 | 46 | ||
2455 | 47 | // If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory | 47 | // If PUN isn't defined, config.php is missing or corrupt |
2456 | 48 | if (!defined('PUN')) | 48 | if (!defined('PUN')) |
2458 | 49 | exit('This file must be run from the forum root directory.'); | 49 | { |
2459 | 50 | header('Location: install.php'); | ||
2460 | 51 | exit; | ||
2461 | 52 | } | ||
2462 | 50 | 53 | ||
2463 | 51 | // Enable debug mode | 54 | // Enable debug mode |
2464 | 52 | if (!defined('PUN_DEBUG')) | 55 | if (!defined('PUN_DEBUG')) |
2465 | @@ -115,12 +118,24 @@ | |||
2466 | 115 | // Set the connection to UTF-8 now | 118 | // Set the connection to UTF-8 now |
2467 | 116 | $db->set_names('utf8'); | 119 | $db->set_names('utf8'); |
2468 | 117 | 120 | ||
2469 | 121 | // Get the forum config | ||
2470 | 122 | $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); | ||
2471 | 123 | while ($cur_config_item = $db->fetch_row($result)) | ||
2472 | 124 | $pun_config[$cur_config_item[0]] = $cur_config_item[1]; | ||
2473 | 125 | |||
2474 | 126 | // Load language file | ||
2475 | 127 | $default_lang = $pun_config['o_default_lang']; | ||
2476 | 128 | |||
2477 | 129 | if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) | ||
2478 | 130 | $default_lang = 'English'; | ||
2479 | 131 | |||
2480 | 132 | require PUN_ROOT.'lang/'.$default_lang.'/update.php'; | ||
2481 | 133 | |||
2482 | 118 | // Check current version | 134 | // Check current version |
2485 | 119 | $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()); | 135 | $cur_version = $pun_config['o_cur_version']; |
2484 | 120 | $cur_version = $db->result($result); | ||
2486 | 121 | 136 | ||
2487 | 122 | if (version_compare($cur_version, '1.2', '<')) | 137 | if (version_compare($cur_version, '1.2', '<')) |
2489 | 123 | exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.'); | 138 | error(sprintf($lang_update['Version mismatch error'], $db_name)); |
2490 | 124 | 139 | ||
2491 | 125 | // Do some DB type specific checks | 140 | // Do some DB type specific checks |
2492 | 126 | $mysql = false; | 141 | $mysql = false; |
2493 | @@ -132,7 +147,7 @@ | |||
2494 | 132 | case 'mysqli_innodb': | 147 | case 'mysqli_innodb': |
2495 | 133 | $mysql_info = $db->get_version(); | 148 | $mysql_info = $db->get_version(); |
2496 | 134 | if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) | 149 | if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) |
2498 | 135 | 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.'); | 150 | error(sprintf($lang_update['You are running error'], 'MySQL', $mysql_info['version'], UPDATE_TO, MIN_MYSQL_VERSION)); |
2499 | 136 | 151 | ||
2500 | 137 | $mysql = true; | 152 | $mysql = true; |
2501 | 138 | break; | 153 | break; |
2502 | @@ -140,22 +155,17 @@ | |||
2503 | 140 | case 'pgsql': | 155 | case 'pgsql': |
2504 | 141 | $pgsql_info = $db->get_version(); | 156 | $pgsql_info = $db->get_version(); |
2505 | 142 | if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) | 157 | if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) |
2507 | 143 | 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.'); | 158 | error(sprintf($lang_update['You are running error'], 'PostgreSQL', $pgsql_info['version'], UPDATE_TO, MIN_PGSQL_VERSION)); |
2508 | 144 | 159 | ||
2509 | 145 | break; | 160 | break; |
2510 | 146 | } | 161 | } |
2511 | 147 | 162 | ||
2518 | 148 | // Get the forum config | 163 | // Check the database, search index and parser revision and the current version |
2513 | 149 | $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); | ||
2514 | 150 | while ($cur_config_item = $db->fetch_row($result)) | ||
2515 | 151 | $pun_config[$cur_config_item[0]] = $cur_config_item[1]; | ||
2516 | 152 | |||
2517 | 153 | // Check the database revision and the current version | ||
2519 | 154 | if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION && | 164 | if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION && |
2520 | 155 | isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION && | 165 | isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION && |
2521 | 156 | isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION && | 166 | isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION && |
2522 | 157 | version_compare($pun_config['o_cur_version'], UPDATE_TO, '>=')) | 167 | version_compare($pun_config['o_cur_version'], UPDATE_TO, '>=')) |
2524 | 158 | exit('Your database is already as up-to-date as this script can make it.'); | 168 | error($lang_update['No update error']); |
2525 | 159 | 169 | ||
2526 | 160 | $default_style = $pun_config['o_default_style']; | 170 | $default_style = $pun_config['o_default_style']; |
2527 | 161 | if (!file_exists(PUN_ROOT.'style/'.$default_style.'.css')) | 171 | if (!file_exists(PUN_ROOT.'style/'.$default_style.'.css')) |
2528 | @@ -164,9 +174,6 @@ | |||
2529 | 164 | // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. | 174 | // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. |
2530 | 165 | session_start(); | 175 | session_start(); |
2531 | 166 | 176 | ||
2532 | 167 | if (!isset($_SESSION['dupe_users'])) | ||
2533 | 168 | $_SESSION['dupe_users'] = array(); | ||
2534 | 169 | |||
2535 | 170 | // | 177 | // |
2536 | 171 | // Determines whether $str is UTF-8 encoded or not | 178 | // Determines whether $str is UTF-8 encoded or not |
2537 | 172 | // | 179 | // |
2538 | @@ -444,15 +451,14 @@ | |||
2539 | 444 | while (@ob_end_clean()); | 451 | while (@ob_end_clean()); |
2540 | 445 | 452 | ||
2541 | 446 | 453 | ||
2545 | 447 | $stage = isset($_GET['stage']) ? $_GET['stage'] : ''; | 454 | $stage = isset($_REQUEST['stage']) ? $_REQUEST['stage'] : ''; |
2546 | 448 | $old_charset = isset($_GET['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_GET['req_old_charset'])) : 'ISO-8859-1'; | 455 | $old_charset = isset($_REQUEST['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_REQUEST['req_old_charset'])) : 'ISO-8859-1'; |
2547 | 449 | $start_at = isset($_GET['start_at']) ? intval($_GET['start_at']) : 0; | 456 | $start_at = isset($_REQUEST['start_at']) ? intval($_REQUEST['start_at']) : 0; |
2548 | 450 | $query_str = ''; | 457 | $query_str = ''; |
2549 | 451 | 458 | ||
2551 | 452 | switch ($stage) | 459 | // Show form |
2552 | 460 | if (empty($stage)) | ||
2553 | 453 | { | 461 | { |
2554 | 454 | // Show form | ||
2555 | 455 | case '': | ||
2556 | 456 | 462 | ||
2557 | 457 | ?> | 463 | ?> |
2558 | 458 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | 464 | <!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 | 460 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 466 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
2561 | 461 | <head> | 467 | <head> |
2562 | 462 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 468 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
2564 | 463 | <title>FluxBB Database Update</title> | 469 | <title><?php echo $lang_update['Update'] ?></title> |
2565 | 464 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> | 470 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
2566 | 465 | </head> | 471 | </head> |
2568 | 466 | <body> | 472 | <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;"> |
2569 | 467 | 473 | ||
2570 | 468 | <div id="pundb_update" class="pun"> | 474 | <div id="pundb_update" class="pun"> |
2571 | 469 | <div class="top-box"><div><!-- Top Corners --></div></div> | 475 | <div class="top-box"><div><!-- Top Corners --></div></div> |
2572 | 470 | <div class="punwrap"> | 476 | <div class="punwrap"> |
2573 | 471 | 477 | ||
2574 | 478 | <div id="brdheader" class="block"> | ||
2575 | 479 | <div class="box"> | ||
2576 | 480 | <div id="brdtitle" class="inbox"> | ||
2577 | 481 | <h1><span><?php echo $lang_update['Update'] ?></span></h1> | ||
2578 | 482 | <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 | 483 | </div> | ||
2580 | 484 | </div> | ||
2581 | 485 | </div> | ||
2582 | 486 | |||
2583 | 487 | <div id="brdmain"> | ||
2584 | 472 | <div class="blockform"> | 488 | <div class="blockform"> |
2586 | 473 | <h2><span>FluxBB Update</span></h2> | 489 | <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
2587 | 474 | <div class="box"> | 490 | <div class="box"> |
2590 | 475 | <form method="get" action="<?php echo pun_htmlspecialchars($_SERVER['REQUEST_URI']) ?>" onsubmit="this.start.disabled=true"> | 491 | <form method="post" action="db_update.php"> |
2591 | 476 | <input type="hidden" name="stage" value="start" /> | 492 | <input type="hidden" name="stage" value="start" /> |
2592 | 493 | <div class="inform"> | ||
2593 | 494 | <fieldset> | ||
2594 | 495 | <legend><?php echo $lang_update['Administrator only'] ?></legend> | ||
2595 | 496 | <div class="infldset"> | ||
2596 | 497 | <p><?php echo $lang_update['Database password info'] ?></p> | ||
2597 | 498 | <p><strong><?php echo $lang_update['Note']; ?></strong> <?php echo $lang_update['Database password note'] ?></p> | ||
2598 | 499 | <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 | 500 | </div> | ||
2600 | 501 | </fieldset> | ||
2601 | 502 | </div> | ||
2602 | 477 | <div class="inform"> | 503 | <div class="inform"> |
2603 | 478 | <div class="forminfo"> | 504 | <div class="forminfo"> |
2606 | 479 | <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> | 505 | <p><?php echo $lang_update['Intro 1'] ?></p> |
2607 | 480 | <p style="font-size: 1.1em">Did you read the update instructions in the documentation? If not, start there.</p> | 506 | <p><?php echo $lang_update['Intro 2'] ?></p> |
2608 | 481 | <?php | 507 | <?php |
2609 | 482 | 508 | ||
2613 | 483 | if (strpos($cur_version, '1.2') === 0) | 509 | if (strpos($cur_version, '1.2') === 0) |
2611 | 484 | { | ||
2612 | 485 | if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) | ||
2614 | 486 | { | 510 | { |
2615 | 511 | if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) | ||
2616 | 512 | { | ||
2617 | 487 | 513 | ||
2618 | 488 | ?> | 514 | ?> |
2620 | 489 | <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> | 515 | <p><?php echo $lang_update['No charset conversion'] ?></p> |
2621 | 490 | <?php | 516 | <?php |
2622 | 491 | 517 | ||
2624 | 492 | } | 518 | } |
2625 | 493 | 519 | ||
2626 | 494 | ?> | 520 | ?> |
2627 | 495 | </div> | 521 | </div> |
2628 | 496 | </div> | 522 | </div> |
2629 | 497 | <div class="inform"> | 523 | <div class="inform"> |
2630 | 498 | <div class="forminfo"> | 524 | <div class="forminfo"> |
2633 | 499 | <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> | 525 | <p><?php echo $lang_update['Enable conversion'] ?></p> |
2634 | 500 | <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> | 526 | <p><?php echo $lang_update['Current character set'] ?></p> |
2635 | 501 | </div> | 527 | </div> |
2636 | 502 | <fieldset> | 528 | <fieldset> |
2638 | 503 | <legend>Charset conversion</legend> | 529 | <legend><?php echo $lang_update['Charset conversion'] ?></legend> |
2639 | 504 | <div class="infldset"> | 530 | <div class="infldset"> |
2640 | 505 | <div class="rbox"> | 531 | <div class="rbox"> |
2642 | 506 | <label><input type="checkbox" name="convert_charset" value="1" checked="checked" /><strong>Enable conversion</strong> (perform database charset conversion).<br /></label> | 532 | <label><input type="checkbox" name="convert_charset" value="1" checked="checked" /><?php echo $lang_update['Enable conversion label'] ?><br /></label> |
2643 | 507 | </div> | 533 | </div> |
2644 | 508 | <label> | 534 | <label> |
2646 | 509 | <strong>Current character set</strong><br />Accept default for English forums otherwise the character set of the primary language pack.<br /> | 535 | <strong><?php echo $lang_update['Current character set label'] ?></strong><br /><?php echo $lang_update['Current character set info'] ?><br /> |
2647 | 510 | <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br /> | 536 | <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br /> |
2648 | 511 | </label> | 537 | </label> |
2649 | 512 | </div> | 538 | </div> |
2650 | 513 | </fieldset> | 539 | </fieldset> |
2651 | 514 | <?php | 540 | <?php |
2652 | 515 | 541 | ||
2653 | 542 | } | ||
2654 | 543 | else | ||
2655 | 544 | echo "\t\t\t\t".'</div>'."\n"; | ||
2656 | 545 | |||
2657 | 546 | ?> | ||
2658 | 547 | </div> | ||
2659 | 548 | <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_update['Start update'] ?>" /></p> | ||
2660 | 549 | </form> | ||
2661 | 550 | </div> | ||
2662 | 551 | </div> | ||
2663 | 552 | </div> | ||
2664 | 553 | |||
2665 | 554 | </div> | ||
2666 | 555 | <div class="end-box"><div><!-- Bottom Corners --></div></div> | ||
2667 | 556 | </div> | ||
2668 | 557 | |||
2669 | 558 | </body> | ||
2670 | 559 | </html> | ||
2671 | 560 | <?php | ||
2672 | 561 | |||
2673 | 562 | $db->end_transaction(); | ||
2674 | 563 | $db->close(); | ||
2675 | 564 | exit; | ||
2676 | 565 | |||
2677 | 566 | } | ||
2678 | 567 | |||
2679 | 568 | // Read the lock file | ||
2680 | 569 | $lock = file_exists(FORUM_CACHE_DIR.'db_update.lock') ? trim(file_get_contents(FORUM_CACHE_DIR.'db_update.lock')) : false; | ||
2681 | 570 | $lock_error = false; | ||
2682 | 571 | |||
2683 | 572 | // Generate or fetch the UID - this confirms we have a valid admin | ||
2684 | 573 | if (isset($_POST['req_db_pass'])) | ||
2685 | 574 | { | ||
2686 | 575 | $req_db_pass = strtolower(trim($_POST['req_db_pass'])); | ||
2687 | 576 | |||
2688 | 577 | switch ($db_type) | ||
2689 | 578 | { | ||
2690 | 579 | // For SQLite we compare against the database file name, since the password is left blank | ||
2691 | 580 | case 'sqlite': | ||
2692 | 581 | if ($req_db_pass != strtolower($db_name)) | ||
2693 | 582 | error(sprintf($lang_update['Invalid file error'], 'config.php')); | ||
2694 | 583 | |||
2695 | 584 | break; | ||
2696 | 585 | // For everything else, check the password matches | ||
2697 | 586 | default: | ||
2698 | 587 | if ($req_db_pass != strtolower($db_password)) | ||
2699 | 588 | error(sprintf($lang_update['Invalid password error'], 'config.php')); | ||
2700 | 589 | |||
2701 | 590 | break; | ||
2702 | 591 | } | ||
2703 | 592 | |||
2704 | 593 | // Generate a unique id to identify this session, only if this is a valid session | ||
2705 | 594 | $uid = pun_hash($req_db_pass.'|'.uniqid(rand(), true)); | ||
2706 | 595 | if ($lock) // We already have a lock file | ||
2707 | 596 | $lock_error = true; | ||
2708 | 597 | else // Create the lock file | ||
2709 | 598 | { | ||
2710 | 599 | $fh = @fopen(FORUM_CACHE_DIR.'db_update.lock', 'wb'); | ||
2711 | 600 | if (!$fh) | ||
2712 | 601 | error(sprintf($lang_update['Unable to lock error'], 'cache')); | ||
2713 | 602 | |||
2714 | 603 | fwrite($fh, $uid); | ||
2715 | 604 | fclose($fh); | ||
2716 | 605 | } | ||
2717 | 606 | } | ||
2718 | 607 | else if (isset($_GET['uid'])) | ||
2719 | 608 | { | ||
2720 | 609 | $uid = trim($_GET['uid']); | ||
2721 | 610 | if (!$lock || $lock != $uid) // The lock doesn't exist or doesn't match the given UID | ||
2722 | 611 | $lock_error = true; | ||
2723 | 516 | } | 612 | } |
2724 | 517 | else | 613 | else |
2745 | 518 | echo "\t\t\t\t".'</div>'."\n"; | 614 | error($lang_update['No password error']); |
2746 | 519 | 615 | ||
2747 | 520 | ?> | 616 | // If there is an error with the lock file |
2748 | 521 | </div> | 617 | if ($lock_error) |
2749 | 522 | <p class="buttons"><input type="submit" name="start" value="Start update" /></p> | 618 | error(sprintf($lang_update['Script runs error'], FORUM_CACHE_DIR.'db_update.lock')); |
2750 | 523 | </form> | 619 | |
2751 | 524 | </div> | 620 | switch ($stage) |
2752 | 525 | </div> | 621 | { |
2733 | 526 | |||
2734 | 527 | </div> | ||
2735 | 528 | <div class="end-box"><div><!-- Bottom Corners --></div></div> | ||
2736 | 529 | </div> | ||
2737 | 530 | |||
2738 | 531 | </body> | ||
2739 | 532 | </html> | ||
2740 | 533 | <?php | ||
2741 | 534 | |||
2742 | 535 | break; | ||
2743 | 536 | |||
2744 | 537 | |||
2753 | 538 | // Start by updating the database structure | 622 | // Start by updating the database structure |
2754 | 539 | case 'start': | 623 | case 'start': |
2755 | 540 | $query_str = '?stage=preparse_posts'; | 624 | $query_str = '?stage=preparse_posts'; |
2756 | @@ -623,6 +707,10 @@ | |||
2757 | 623 | if (!array_key_exists('o_feed_type', $pun_config)) | 707 | if (!array_key_exists('o_feed_type', $pun_config)) |
2758 | 624 | $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()); | 708 | $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 | 625 | 709 | ||
2760 | 710 | // Insert new config option o_feed_ttl | ||
2761 | 711 | if (!array_key_exists('o_feed_ttl', $pun_config)) | ||
2762 | 712 | $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 | 713 | |||
2764 | 626 | // Insert config option o_base_url which was removed in 1.3 | 714 | // Insert config option o_base_url which was removed in 1.3 |
2765 | 627 | if (!array_key_exists('o_base_url', $pun_config)) | 715 | if (!array_key_exists('o_base_url', $pun_config)) |
2766 | 628 | { | 716 | { |
2767 | @@ -961,13 +1049,46 @@ | |||
2768 | 961 | $db->create_table('search_words', $schema); | 1049 | $db->create_table('search_words', $schema); |
2769 | 962 | } | 1050 | } |
2770 | 963 | 1051 | ||
2771 | 1052 | // Rename the subscription table | ||
2772 | 1053 | $db->rename_table('subscriptions', 'topic_subscriptions'); | ||
2773 | 1054 | |||
2774 | 1055 | // if we don't have the forum_subscriptions table, create it | ||
2775 | 1056 | if (!$db->table_exists('forum_subscriptions')) | ||
2776 | 1057 | { | ||
2777 | 1058 | $schema = array( | ||
2778 | 1059 | 'FIELDS' => array( | ||
2779 | 1060 | 'user_id' => array( | ||
2780 | 1061 | 'datatype' => 'INT(10) UNSIGNED', | ||
2781 | 1062 | 'allow_null' => false, | ||
2782 | 1063 | 'default' => '0' | ||
2783 | 1064 | ), | ||
2784 | 1065 | 'forum_id' => array( | ||
2785 | 1066 | 'datatype' => 'INT(10) UNSIGNED', | ||
2786 | 1067 | 'allow_null' => false, | ||
2787 | 1068 | 'default' => '0' | ||
2788 | 1069 | ) | ||
2789 | 1070 | ), | ||
2790 | 1071 | 'PRIMARY KEY' => array('user_id', 'forum_id') | ||
2791 | 1072 | ); | ||
2792 | 1073 | |||
2793 | 1074 | $db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error()); | ||
2794 | 1075 | } | ||
2795 | 1076 | |||
2796 | 1077 | // Insert new config option o_forum_subscriptions | ||
2797 | 1078 | if (!array_key_exists('o_forum_subscriptions', $pun_config)) | ||
2798 | 1079 | $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 | 1080 | |||
2800 | 1081 | // Rename config option o_subscriptions to o_topic_subscriptions | ||
2801 | 1082 | if (!array_key_exists('o_topic_subscriptions', $pun_config)) | ||
2802 | 1083 | $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 | 1084 | |||
2804 | 964 | // Change the default style if the old doesn't exist anymore | 1085 | // Change the default style if the old doesn't exist anymore |
2805 | 965 | if ($pun_config['o_default_style'] != $default_style) | 1086 | if ($pun_config['o_default_style'] != $default_style) |
2806 | 966 | $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()); | 1087 | $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 | 967 | 1088 | ||
2808 | 968 | // Should we do charset conversion or not? | 1089 | // Should we do charset conversion or not? |
2811 | 969 | //if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) | 1090 | if (strpos($cur_version, '1.2') === 0 && isset($_POST['convert_charset'])) |
2812 | 970 | // $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; | 1091 | $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; |
2813 | 971 | 1092 | ||
2814 | 972 | break; | 1093 | break; |
2815 | 973 | 1094 | ||
2816 | @@ -978,7 +1099,9 @@ | |||
2817 | 978 | 1099 | ||
2818 | 979 | function _conv_bans($cur_item, $old_charset) | 1100 | function _conv_bans($cur_item, $old_charset) |
2819 | 980 | { | 1101 | { |
2821 | 981 | echo 'Converting ban '.$cur_item['id'].' …<br />'."\n"; | 1102 | global $lang_update; |
2822 | 1103 | |||
2823 | 1104 | echo sprintf($lang_update['Converting item'], $lang_update['ban'], $cur_item['id']).'<br />'."\n"; | ||
2824 | 982 | 1105 | ||
2825 | 983 | convert_to_utf8($cur_item['username'], $old_charset); | 1106 | convert_to_utf8($cur_item['username'], $old_charset); |
2826 | 984 | convert_to_utf8($cur_item['message'], $old_charset); | 1107 | convert_to_utf8($cur_item['message'], $old_charset); |
2827 | @@ -998,7 +1121,7 @@ | |||
2828 | 998 | case 'conv_categories': | 1121 | case 'conv_categories': |
2829 | 999 | $query_str = '?stage=conv_censors&req_old_charset='.$old_charset; | 1122 | $query_str = '?stage=conv_censors&req_old_charset='.$old_charset; |
2830 | 1000 | 1123 | ||
2832 | 1001 | echo 'Converting categories …'."<br />\n"; | 1124 | echo sprintf($lang_update['Converting'], $lang_update['categories']).'<br />'."\n"; |
2833 | 1002 | 1125 | ||
2834 | 1003 | function _conv_categories($cur_item, $old_charset) | 1126 | function _conv_categories($cur_item, $old_charset) |
2835 | 1004 | { | 1127 | { |
2836 | @@ -1016,7 +1139,7 @@ | |||
2837 | 1016 | case 'conv_censors': | 1139 | case 'conv_censors': |
2838 | 1017 | $query_str = '?stage=conv_config&req_old_charset='.$old_charset; | 1140 | $query_str = '?stage=conv_config&req_old_charset='.$old_charset; |
2839 | 1018 | 1141 | ||
2841 | 1019 | echo 'Converting censor words …'."<br />\n"; | 1142 | echo sprintf($lang_update['Converting'], $lang_update['censor words']).'<br />'."\n"; |
2842 | 1020 | 1143 | ||
2843 | 1021 | function _conv_censoring($cur_item, $old_charset) | 1144 | function _conv_censoring($cur_item, $old_charset) |
2844 | 1022 | { | 1145 | { |
2845 | @@ -1035,7 +1158,7 @@ | |||
2846 | 1035 | case 'conv_config': | 1158 | case 'conv_config': |
2847 | 1036 | $query_str = '?stage=conv_forums&req_old_charset='.$old_charset; | 1159 | $query_str = '?stage=conv_forums&req_old_charset='.$old_charset; |
2848 | 1037 | 1160 | ||
2850 | 1038 | echo 'Converting configuration …'."<br />\n"; | 1161 | echo sprintf($lang_update['Converting'], $lang_update['configuration']).'<br />'."\n"; |
2851 | 1039 | 1162 | ||
2852 | 1040 | function _conv_config($cur_item, $old_charset) | 1163 | function _conv_config($cur_item, $old_charset) |
2853 | 1041 | { | 1164 | { |
2854 | @@ -1053,7 +1176,7 @@ | |||
2855 | 1053 | case 'conv_forums': | 1176 | case 'conv_forums': |
2856 | 1054 | $query_str = '?stage=conv_perms&req_old_charset='.$old_charset; | 1177 | $query_str = '?stage=conv_perms&req_old_charset='.$old_charset; |
2857 | 1055 | 1178 | ||
2859 | 1056 | echo 'Converting forums …'."<br />\n"; | 1179 | echo sprintf($lang_update['Converting'], $lang_update['forums']).'<br />'."\n"; |
2860 | 1057 | 1180 | ||
2861 | 1058 | function _conv_forums($cur_item, $old_charset) | 1181 | function _conv_forums($cur_item, $old_charset) |
2862 | 1059 | { | 1182 | { |
2863 | @@ -1092,7 +1215,7 @@ | |||
2864 | 1092 | case 'conv_groups': | 1215 | case 'conv_groups': |
2865 | 1093 | $query_str = '?stage=conv_online&req_old_charset='.$old_charset; | 1216 | $query_str = '?stage=conv_online&req_old_charset='.$old_charset; |
2866 | 1094 | 1217 | ||
2868 | 1095 | echo 'Converting groups …'."<br />\n"; | 1218 | echo sprintf($lang_update['Converting'], $lang_update['groups']).'<br />'."\n"; |
2869 | 1096 | 1219 | ||
2870 | 1097 | function _conv_groups($cur_item, $old_charset) | 1220 | function _conv_groups($cur_item, $old_charset) |
2871 | 1098 | { | 1221 | { |
2872 | @@ -1125,7 +1248,9 @@ | |||
2873 | 1125 | 1248 | ||
2874 | 1126 | function _conv_posts($cur_item, $old_charset) | 1249 | function _conv_posts($cur_item, $old_charset) |
2875 | 1127 | { | 1250 | { |
2877 | 1128 | echo 'Converting post '.$cur_item['id'].' …<br />'."\n"; | 1251 | global $lang_update; |
2878 | 1252 | |||
2879 | 1253 | echo sprintf($lang_update['Converting item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; | ||
2880 | 1129 | 1254 | ||
2881 | 1130 | convert_to_utf8($cur_item['poster'], $old_charset); | 1255 | convert_to_utf8($cur_item['poster'], $old_charset); |
2882 | 1131 | convert_to_utf8($cur_item['message'], $old_charset); | 1256 | convert_to_utf8($cur_item['message'], $old_charset); |
2883 | @@ -1146,7 +1271,7 @@ | |||
2884 | 1146 | case 'conv_ranks': | 1271 | case 'conv_ranks': |
2885 | 1147 | $query_str = '?stage=conv_reports&req_old_charset='.$old_charset; | 1272 | $query_str = '?stage=conv_reports&req_old_charset='.$old_charset; |
2886 | 1148 | 1273 | ||
2888 | 1149 | echo 'Converting ranks …'."<br />\n"; | 1274 | echo sprintf($lang_update['Converting'], $lang_update['ranks']).'<br />'."\n"; |
2889 | 1150 | 1275 | ||
2890 | 1151 | function _conv_ranks($cur_item, $old_charset) | 1276 | function _conv_ranks($cur_item, $old_charset) |
2891 | 1152 | { | 1277 | { |
2892 | @@ -1166,7 +1291,9 @@ | |||
2893 | 1166 | 1291 | ||
2894 | 1167 | function _conv_reports($cur_item, $old_charset) | 1292 | function _conv_reports($cur_item, $old_charset) |
2895 | 1168 | { | 1293 | { |
2897 | 1169 | echo 'Converting report '.$cur_item['id'].' …<br />'."\n"; | 1294 | global $lang_update; |
2898 | 1295 | |||
2899 | 1296 | echo sprintf($lang_update['Converting item'], $lang_update['report'], $cur_item['id']).'<br />'."\n"; | ||
2900 | 1170 | 1297 | ||
2901 | 1171 | convert_to_utf8($cur_item['message'], $old_charset); | 1298 | convert_to_utf8($cur_item['message'], $old_charset); |
2902 | 1172 | 1299 | ||
2903 | @@ -1236,7 +1363,9 @@ | |||
2904 | 1236 | case 'conv_subscriptions': | 1363 | case 'conv_subscriptions': |
2905 | 1237 | $query_str = '?stage=conv_topics&req_old_charset='.$old_charset; | 1364 | $query_str = '?stage=conv_topics&req_old_charset='.$old_charset; |
2906 | 1238 | 1365 | ||
2908 | 1239 | alter_table_utf8($db->prefix.'subscriptions'); | 1366 | // By this stage we should have already renamed the subscription table |
2909 | 1367 | alter_table_utf8($db->prefix.'topic_subscriptions'); | ||
2910 | 1368 | alter_table_utf8($db->prefix.'forum_subscriptions'); // This should actually already be utf8, but for consistency... | ||
2911 | 1240 | 1369 | ||
2912 | 1241 | break; | 1370 | break; |
2913 | 1242 | 1371 | ||
2914 | @@ -1247,7 +1376,9 @@ | |||
2915 | 1247 | 1376 | ||
2916 | 1248 | function _conv_topics($cur_item, $old_charset) | 1377 | function _conv_topics($cur_item, $old_charset) |
2917 | 1249 | { | 1378 | { |
2919 | 1250 | echo 'Converting topic '.$cur_item['id'].' …<br />'."\n"; | 1379 | global $lang_update; |
2920 | 1380 | |||
2921 | 1381 | echo sprintf($lang_update['Converting item'], $lang_update['topic'], $cur_item['id']).'<br />'."\n"; | ||
2922 | 1251 | 1382 | ||
2923 | 1252 | convert_to_utf8($cur_item['poster'], $old_charset); | 1383 | convert_to_utf8($cur_item['poster'], $old_charset); |
2924 | 1253 | convert_to_utf8($cur_item['subject'], $old_charset); | 1384 | convert_to_utf8($cur_item['subject'], $old_charset); |
2925 | @@ -1268,9 +1399,14 @@ | |||
2926 | 1268 | case 'conv_users': | 1399 | case 'conv_users': |
2927 | 1269 | $query_str = '?stage=preparse_posts'; | 1400 | $query_str = '?stage=preparse_posts'; |
2928 | 1270 | 1401 | ||
2929 | 1402 | if ($start_at == 0) | ||
2930 | 1403 | $_SESSION['dupe_users'] = array(); | ||
2931 | 1404 | |||
2932 | 1271 | function _conv_users($cur_item, $old_charset) | 1405 | function _conv_users($cur_item, $old_charset) |
2933 | 1272 | { | 1406 | { |
2935 | 1273 | echo 'Converting user '.$cur_item['id'].' …<br />'."\n"; | 1407 | global $lang_update; |
2936 | 1408 | |||
2937 | 1409 | echo sprintf($lang_update['Converting item'], $lang_update['user'], $cur_item['id']).'<br />'."\n"; | ||
2938 | 1274 | 1410 | ||
2939 | 1275 | convert_to_utf8($cur_item['username'], $old_charset); | 1411 | convert_to_utf8($cur_item['username'], $old_charset); |
2940 | 1276 | convert_to_utf8($cur_item['title'], $old_charset); | 1412 | convert_to_utf8($cur_item['title'], $old_charset); |
2941 | @@ -1317,24 +1453,24 @@ | |||
2942 | 1317 | $username = pun_trim($_POST['dupe_users'][$id]); | 1453 | $username = pun_trim($_POST['dupe_users'][$id]); |
2943 | 1318 | 1454 | ||
2944 | 1319 | if (pun_strlen($username) < 2) | 1455 | if (pun_strlen($username) < 2) |
2946 | 1320 | $errors[$id][] = 'Usernames must be at least 2 characters long. Please choose another (longer) username.'; | 1456 | $errors[$id][] = $lang_update['Username too short error']; |
2947 | 1321 | else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters | 1457 | else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
2949 | 1322 | $errors[$id][] = 'Usernames must not be more than 25 characters long. Please choose another (shorter) username.'; | 1458 | $errors[$id][] = $lang_update['Username too long error']; |
2950 | 1323 | else if (!strcasecmp($username, 'Guest')) | 1459 | else if (!strcasecmp($username, 'Guest')) |
2952 | 1324 | $errors[$id][] = 'The username guest is reserved. Please choose another username.'; | 1460 | $errors[$id][] = $lang_update['Username Guest reserved error']; |
2953 | 1325 | 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)) | 1461 | 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)) |
2955 | 1326 | $errors[$id][] = 'Usernames may not be in the form of an IP address. Please choose another username.'; | 1462 | $errors[$id][] = $lang_update['Username IP format error']; |
2956 | 1327 | else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) | 1463 | else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
2958 | 1328 | $errors[$id][] = 'Usernames may not contain all the characters \', " and [ or ] at once. Please choose another username.'; | 1464 | $errors[$id][] = $lang_update['Username bad characters error']; |
2959 | 1329 | 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)) | 1465 | 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)) |
2961 | 1330 | $errors[$id][] = 'Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please choose another username.'; | 1466 | $errors[$id][] = $lang_update['Username BBCode error']; |
2962 | 1331 | 1467 | ||
2964 | 1332 | $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()); | 1468 | $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 | 1333 | 1469 | ||
2966 | 1334 | if ($db->num_rows($result)) | 1470 | if ($db->num_rows($result)) |
2967 | 1335 | { | 1471 | { |
2968 | 1336 | $busy = $db->result($result); | 1472 | $busy = $db->result($result); |
2970 | 1337 | $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.'; | 1473 | $errors[$id][] = sprintf($lang_update['Username duplicate error'], pun_htmlspecialchars($busy)); |
2971 | 1338 | } | 1474 | } |
2972 | 1339 | 1475 | ||
2973 | 1340 | if (empty($errors[$id])) | 1476 | if (empty($errors[$id])) |
2974 | @@ -1396,7 +1532,7 @@ | |||
2975 | 1396 | $mail_message = trim(substr($mail_tpl, $first_crlf)); | 1532 | $mail_message = trim(substr($mail_tpl, $first_crlf)); |
2976 | 1397 | 1533 | ||
2977 | 1398 | $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject); | 1534 | $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject); |
2979 | 1399 | $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message); | 1535 | $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); |
2980 | 1400 | $mail_message = str_replace('<old_username>', $old_username, $mail_message); | 1536 | $mail_message = str_replace('<old_username>', $old_username, $mail_message); |
2981 | 1401 | $mail_message = str_replace('<new_username>', $username, $mail_message); | 1537 | $mail_message = str_replace('<new_username>', $username, $mail_message); |
2982 | 1402 | $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' Mailer', $mail_message); | 1538 | $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' Mailer', $mail_message); |
2983 | @@ -1418,7 +1554,7 @@ | |||
2984 | 1418 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 1554 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
2985 | 1419 | <head> | 1555 | <head> |
2986 | 1420 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1556 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
2988 | 1421 | <title>FluxBB Database Update</title> | 1557 | <title><?php echo $lang_update['Update'] ?></title> |
2989 | 1422 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> | 1558 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
2990 | 1423 | </head> | 1559 | </head> |
2991 | 1424 | <body> | 1560 | <body> |
2992 | @@ -1428,14 +1564,14 @@ | |||
2993 | 1428 | <div class="punwrap"> | 1564 | <div class="punwrap"> |
2994 | 1429 | 1565 | ||
2995 | 1430 | <div class="blockform"> | 1566 | <div class="blockform"> |
2997 | 1431 | <h2><span>Error converting users</span></h2> | 1567 | <h2><span><?php echo $lang_update['Error converting users'] ?></span></h2> |
2998 | 1432 | <div class="box"> | 1568 | <div class="box"> |
3000 | 1433 | <form method="post" action="db_update.php?stage=conv_users_dupe"> | 1569 | <form method="post" action="db_update.php?stage=conv_users_dupe&uid=<?php echo $uid ?>"> |
3001 | 1434 | <input type="hidden" name="form_sent" value="1" /> | 1570 | <input type="hidden" name="form_sent" value="1" /> |
3002 | 1435 | <div class="inform"> | 1571 | <div class="inform"> |
3003 | 1436 | <div class="forminfo"> | 1572 | <div class="forminfo"> |
3006 | 1437 | <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> | 1573 | <p style="font-size: 1.1em"><?php echo $lang_update['Error info 1'] ?></p> |
3007 | 1438 | <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> | 1574 | <p style="font-size: 1.1em"><?php echo $lang_update['Error info 2'] ?></p> |
3008 | 1439 | </div> | 1575 | </div> |
3009 | 1440 | </div> | 1576 | </div> |
3010 | 1441 | <?php | 1577 | <?php |
3011 | @@ -1448,11 +1584,11 @@ | |||
3012 | 1448 | <fieldset> | 1584 | <fieldset> |
3013 | 1449 | <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> | 1585 | <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> |
3014 | 1450 | <div class="infldset"> | 1586 | <div class="infldset"> |
3016 | 1451 | <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> | 1587 | <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 | 1452 | </div> | 1588 | </div> |
3018 | 1453 | </fieldset> | 1589 | </fieldset> |
3019 | 1454 | <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> | 1590 | <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> |
3021 | 1455 | <h3>The following errors need to be corrected:</h3> | 1591 | <h3><?php echo $lang_update['Correct errors'] ?></h3> |
3022 | 1456 | <ul class="error-list"> | 1592 | <ul class="error-list"> |
3023 | 1457 | <?php | 1593 | <?php |
3024 | 1458 | 1594 | ||
3025 | @@ -1467,7 +1603,7 @@ | |||
3026 | 1467 | } | 1603 | } |
3027 | 1468 | 1604 | ||
3028 | 1469 | ?> | 1605 | ?> |
3030 | 1470 | <p class="buttons"><input type="submit" name="rename" value="Rename users" /></p> | 1606 | <p class="buttons"><input type="submit" name="rename" value="<?php echo $lang_update['Rename users'] ?>" /></p> |
3031 | 1471 | </form> | 1607 | </form> |
3032 | 1472 | </div> | 1608 | </div> |
3033 | 1473 | </div> | 1609 | </div> |
3034 | @@ -1502,7 +1638,7 @@ | |||
3035 | 1502 | $end_at = 0; | 1638 | $end_at = 0; |
3036 | 1503 | while ($cur_item = $db->fetch_assoc($result)) | 1639 | while ($cur_item = $db->fetch_assoc($result)) |
3037 | 1504 | { | 1640 | { |
3039 | 1505 | echo 'Preparsing post '.$cur_item['id'].' …<br />'."\n"; | 1641 | echo sprintf($lang_update['Preparsing item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
3040 | 1506 | $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()); | 1642 | $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 | 1507 | 1643 | ||
3042 | 1508 | $end_at = $cur_item['id']; | 1644 | $end_at = $cur_item['id']; |
3043 | @@ -1537,7 +1673,7 @@ | |||
3044 | 1537 | $end_at = 0; | 1673 | $end_at = 0; |
3045 | 1538 | while ($cur_item = $db->fetch_assoc($result)) | 1674 | while ($cur_item = $db->fetch_assoc($result)) |
3046 | 1539 | { | 1675 | { |
3048 | 1540 | echo 'Preparsing signature '.$cur_item['id'].' …<br />'."\n"; | 1676 | echo sprintf($lang_update['Preparsing item'], $lang_update['signature'], $cur_item['id']).'<br />'."\n"; |
3049 | 1541 | $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()); | 1677 | $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 | 1542 | 1678 | ||
3051 | 1543 | $end_at = $cur_item['id']; | 1679 | $end_at = $cur_item['id']; |
3052 | @@ -1593,7 +1729,7 @@ | |||
3053 | 1593 | $end_at = 0; | 1729 | $end_at = 0; |
3054 | 1594 | while ($cur_item = $db->fetch_assoc($result)) | 1730 | while ($cur_item = $db->fetch_assoc($result)) |
3055 | 1595 | { | 1731 | { |
3057 | 1596 | echo 'Rebuilding index for post '.$cur_item['id'].' …<br />'."\n"; | 1732 | echo sprintf($lang_update['Rebuilding index item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
3058 | 1597 | 1733 | ||
3059 | 1598 | if ($cur_item['id'] == $cur_item['first_post_id']) | 1734 | if ($cur_item['id'] == $cur_item['first_post_id']) |
3060 | 1599 | update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']); | 1735 | update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']); |
3061 | @@ -1646,13 +1782,16 @@ | |||
3062 | 1646 | // Empty the PHP cache | 1782 | // Empty the PHP cache |
3063 | 1647 | forum_clear_cache(); | 1783 | forum_clear_cache(); |
3064 | 1648 | 1784 | ||
3065 | 1785 | // Delete the update lock file | ||
3066 | 1786 | @unlink(FORUM_CACHE_DIR.'db_update.lock'); | ||
3067 | 1787 | |||
3068 | 1649 | ?> | 1788 | ?> |
3069 | 1650 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | 1789 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
3070 | 1651 | 1790 | ||
3071 | 1652 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 1791 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
3072 | 1653 | <head> | 1792 | <head> |
3073 | 1654 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1793 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
3075 | 1655 | <title>FluxBB Database Update</title> | 1794 | <title><?php echo $lang_update['Update'] ?></title> |
3076 | 1656 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> | 1795 | <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
3077 | 1657 | </head> | 1796 | </head> |
3078 | 1658 | <body> | 1797 | <body> |
3079 | @@ -1662,12 +1801,12 @@ | |||
3080 | 1662 | <div class="punwrap"> | 1801 | <div class="punwrap"> |
3081 | 1663 | 1802 | ||
3082 | 1664 | <div class="blockform"> | 1803 | <div class="blockform"> |
3084 | 1665 | <h2><span>FluxBB Update</span></h2> | 1804 | <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
3085 | 1666 | <div class="box"> | 1805 | <div class="box"> |
3086 | 1667 | <div class="fakeform"> | 1806 | <div class="fakeform"> |
3087 | 1668 | <div class="inform"> | 1807 | <div class="inform"> |
3088 | 1669 | <div class="forminfo"> | 1808 | <div class="forminfo"> |
3090 | 1670 | <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> | 1809 | <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 | 1671 | </div> | 1810 | </div> |
3092 | 1672 | </div> | 1811 | </div> |
3093 | 1673 | </div> | 1812 | </div> |
3094 | @@ -1689,4 +1828,4 @@ | |||
3095 | 1689 | $db->close(); | 1828 | $db->close(); |
3096 | 1690 | 1829 | ||
3097 | 1691 | if ($query_str != '') | 1830 | if ($query_str != '') |
3099 | 1692 | 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>'); | 1831 | 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 | 1693 | 1832 | ||
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 | 1 | <?php | 1 | <?php |
3106 | 2 | 2 | ||
3107 | 3 | /** | 3 | /** |
3109 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
3110 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3111 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3112 | 7 | */ | 7 | */ |
3113 | 8 | 8 | ||
3115 | 9 | define('PUN_ROOT', './'); | 9 | define('PUN_ROOT', dirname(__FILE__).'/'); |
3116 | 10 | require PUN_ROOT.'include/common.php'; | 10 | require PUN_ROOT.'include/common.php'; |
3117 | 11 | 11 | ||
3118 | 12 | 12 | ||
3119 | @@ -67,7 +67,11 @@ | |||
3120 | 67 | delete_post($id, $cur_post['tid']); | 67 | delete_post($id, $cur_post['tid']); |
3121 | 68 | update_forum($cur_post['fid']); | 68 | update_forum($cur_post['fid']); |
3122 | 69 | 69 | ||
3124 | 70 | redirect('viewtopic.php?id='.$cur_post['tid'], $lang_delete['Post del redirect']); | 70 | // Redirect towards the previous post |
3125 | 71 | $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 | 72 | $post_id = $db->result($result); | ||
3127 | 73 | |||
3128 | 74 | redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_delete['Post del redirect']); | ||
3129 | 71 | } | 75 | } |
3130 | 72 | } | 76 | } |
3131 | 73 | 77 | ||
3132 | @@ -108,7 +112,7 @@ | |||
3133 | 108 | 112 | ||
3134 | 109 | <div id="postreview"> | 113 | <div id="postreview"> |
3135 | 110 | <div class="blockpost"> | 114 | <div class="blockpost"> |
3137 | 111 | <div class="box<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>"> | 115 | <div class="box"> |
3138 | 112 | <div class="inbox"> | 116 | <div class="inbox"> |
3139 | 113 | <div class="postbody"> | 117 | <div class="postbody"> |
3140 | 114 | <div class="postleft"> | 118 | <div class="postleft"> |
3141 | 115 | 119 | ||
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 | 1 | <?php | 1 | <?php |
3147 | 2 | 2 | ||
3148 | 3 | /** | 3 | /** |
3150 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
3151 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3152 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3153 | 7 | */ | 7 | */ |
3154 | 8 | 8 | ||
3156 | 9 | define('PUN_ROOT', './'); | 9 | define('PUN_ROOT', dirname(__FILE__).'/'); |
3157 | 10 | require PUN_ROOT.'include/common.php'; | 10 | require PUN_ROOT.'include/common.php'; |
3158 | 11 | 11 | ||
3159 | 12 | 12 | ||
3160 | @@ -19,7 +19,7 @@ | |||
3161 | 19 | message($lang_common['Bad request']); | 19 | message($lang_common['Bad request']); |
3162 | 20 | 20 | ||
3163 | 21 | // Fetch some info about the post, the topic and the forum | 21 | // Fetch some info about the post, the topic and the forum |
3165 | 22 | $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()); | 22 | $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 | 23 | if (!$db->num_rows($result)) | 23 | if (!$db->num_rows($result)) |
3167 | 24 | message($lang_common['Bad request']); | 24 | message($lang_common['Bad request']); |
3168 | 25 | 25 | ||
3169 | @@ -61,8 +61,13 @@ | |||
3170 | 61 | { | 61 | { |
3171 | 62 | $subject = pun_trim($_POST['req_subject']); | 62 | $subject = pun_trim($_POST['req_subject']); |
3172 | 63 | 63 | ||
3173 | 64 | if ($pun_config['o_censoring'] == '1') | ||
3174 | 65 | $censored_subject = pun_trim(censor_words($subject)); | ||
3175 | 66 | |||
3176 | 64 | if ($subject == '') | 67 | if ($subject == '') |
3177 | 65 | $errors[] = $lang_post['No subject']; | 68 | $errors[] = $lang_post['No subject']; |
3178 | 69 | else if ($pun_config['o_censoring'] == '1' && $censored_subject == '') | ||
3179 | 70 | $errors[] = $lang_post['No subject after censoring']; | ||
3180 | 66 | else if (pun_strlen($subject) > 70) | 71 | else if (pun_strlen($subject) > 70) |
3181 | 67 | $errors[] = $lang_post['Too long subject']; | 72 | $errors[] = $lang_post['Too long subject']; |
3182 | 68 | else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod']) | 73 | else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod']) |
3183 | @@ -85,22 +90,36 @@ | |||
3184 | 85 | $message = preparse_bbcode($message, $errors); | 90 | $message = preparse_bbcode($message, $errors); |
3185 | 86 | } | 91 | } |
3186 | 87 | 92 | ||
3189 | 88 | if ($message == '') | 93 | if (empty($errors)) |
3190 | 89 | $errors[] = $lang_post['No message']; | 94 | { |
3191 | 95 | if ($message == '') | ||
3192 | 96 | $errors[] = $lang_post['No message']; | ||
3193 | 97 | else if ($pun_config['o_censoring'] == '1') | ||
3194 | 98 | { | ||
3195 | 99 | // Censor message to see if that causes problems | ||
3196 | 100 | $censored_message = pun_trim(censor_words($message)); | ||
3197 | 101 | |||
3198 | 102 | if ($censored_message == '') | ||
3199 | 103 | $errors[] = $lang_post['No message after censoring']; | ||
3200 | 104 | } | ||
3201 | 105 | } | ||
3202 | 90 | 106 | ||
3203 | 91 | $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0'; | 107 | $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0'; |
3204 | 108 | $stick_topic = isset($_POST['stick_topic']) ? '1' : '0'; | ||
3205 | 109 | if (!$is_admmod) | ||
3206 | 110 | $stick_topic = $cur_post['sticky']; | ||
3207 | 92 | 111 | ||
3208 | 93 | // Did everything go according to plan? | 112 | // Did everything go according to plan? |
3209 | 94 | if (empty($errors) && !isset($_POST['preview'])) | 113 | if (empty($errors) && !isset($_POST['preview'])) |
3210 | 95 | { | 114 | { |
3212 | 96 | $edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? $edited_sql = ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : ''; | 115 | $edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : ''; |
3213 | 97 | 116 | ||
3214 | 98 | require PUN_ROOT.'include/search_idx.php'; | 117 | require PUN_ROOT.'include/search_idx.php'; |
3215 | 99 | 118 | ||
3216 | 100 | if ($can_edit_subject) | 119 | if ($can_edit_subject) |
3217 | 101 | { | 120 | { |
3218 | 102 | // Update the topic and any redirect topics | 121 | // Update the topic and any redirect topics |
3220 | 103 | $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()); | 122 | $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 | 104 | 123 | ||
3222 | 105 | // We changed the subject, so we need to take that into account when we update the search words | 124 | // We changed the subject, so we need to take that into account when we update the search words |
3223 | 106 | update_search_index('edit', $id, $message, $subject); | 125 | update_search_index('edit', $id, $message, $subject); |
3224 | @@ -214,7 +233,7 @@ | |||
3225 | 214 | ?> | 233 | ?> |
3226 | 215 | <ul class="bblinks"> | 234 | <ul class="bblinks"> |
3227 | 216 | <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> | 235 | <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> |
3229 | 217 | <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> | 236 | <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 | 218 | <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> | 237 | <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 | 219 | </ul> | 238 | </ul> |
3232 | 220 | </div> | 239 | </div> |
3233 | @@ -222,6 +241,14 @@ | |||
3234 | 222 | <?php | 241 | <?php |
3235 | 223 | 242 | ||
3236 | 224 | $checkboxes = array(); | 243 | $checkboxes = array(); |
3237 | 244 | if ($can_edit_subject && $is_admmod) | ||
3238 | 245 | { | ||
3239 | 246 | if (isset($_POST['stick_topic']) || $cur_post['sticky'] == '1') | ||
3240 | 247 | $checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" checked="checked" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>'; | ||
3241 | 248 | else | ||
3242 | 249 | $checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>'; | ||
3243 | 250 | } | ||
3244 | 251 | |||
3245 | 225 | if ($pun_config['o_smilies'] == '1') | 252 | if ($pun_config['o_smilies'] == '1') |
3246 | 226 | { | 253 | { |
3247 | 227 | if (isset($_POST['hide_smilies']) || $cur_post['hide_smilies'] == '1') | 254 | if (isset($_POST['hide_smilies']) || $cur_post['hide_smilies'] == '1') |
3248 | 228 | 255 | ||
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 | 1 | <?php | 1 | <?php |
3254 | 2 | 2 | ||
3255 | 3 | /** | 3 | /** |
3257 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
3258 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3259 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3260 | 7 | */ | 7 | */ |
3261 | @@ -26,38 +26,38 @@ | |||
3262 | 26 | display posts) and type (output as HTML or RSS). The only | 26 | display posts) and type (output as HTML or RSS). The only |
3263 | 27 | mandatory variable is action. Possible/default values are: | 27 | mandatory variable is action. Possible/default values are: |
3264 | 28 | 28 | ||
3290 | 29 | action: feed - show most recent topics/posts (HTML or RSS) | 29 | action: feed - show most recent topics/posts (HTML or RSS) |
3291 | 30 | online - show users online (HTML) | 30 | online - show users online (HTML) |
3292 | 31 | online_full - as above, but includes a full list (HTML) | 31 | online_full - as above, but includes a full list (HTML) |
3293 | 32 | stats - show board statistics (HTML) | 32 | stats - show board statistics (HTML) |
3294 | 33 | 33 | ||
3295 | 34 | type: rss - output as RSS 2.0 | 34 | type: rss - output as RSS 2.0 |
3296 | 35 | atom - output as Atom 1.0 | 35 | atom - output as Atom 1.0 |
3297 | 36 | xml - output as XML | 36 | xml - output as XML |
3298 | 37 | html - output as HTML (<li>'s) | 37 | html - output as HTML (<li>'s) |
3299 | 38 | 38 | ||
3300 | 39 | fid: One or more forum IDs (comma-separated). If ignored, | 39 | fid: One or more forum IDs (comma-separated). If ignored, |
3301 | 40 | topics from all readable forums will be pulled. | 40 | topics from all readable forums will be pulled. |
3302 | 41 | 41 | ||
3303 | 42 | nfid: One or more forum IDs (comma-separated) that are to be | 42 | nfid: One or more forum IDs (comma-separated) that are to be |
3304 | 43 | excluded. E.g. the ID of a a test forum. | 43 | excluded. E.g. the ID of a a test forum. |
3305 | 44 | 44 | ||
3306 | 45 | tid: A topic ID from which to show posts. If a tid is supplied, | 45 | tid: A topic ID from which to show posts. If a tid is supplied, |
3307 | 46 | fid and nfid are ignored. | 46 | fid and nfid are ignored. |
3308 | 47 | 47 | ||
3309 | 48 | show: Any integer value between 1 and 50. The default is 15. | 48 | show: Any integer value between 1 and 50. The default is 15. |
3310 | 49 | 49 | ||
3311 | 50 | order: last_post - show topics ordered by when they were last | 50 | order: last_post - show topics ordered by when they were last |
3312 | 51 | posted in, giving information about the reply. | 51 | posted in, giving information about the reply. |
3313 | 52 | posted - show topics ordered by when they were first | 52 | posted - show topics ordered by when they were first |
3314 | 53 | posted, giving information about the original post. | 53 | posted, giving information about the original post. |
3315 | 54 | 54 | ||
3316 | 55 | -----------------------------------------------------------------------------*/ | 55 | -----------------------------------------------------------------------------*/ |
3317 | 56 | 56 | ||
3318 | 57 | define('PUN_QUIET_VISIT', 1); | 57 | define('PUN_QUIET_VISIT', 1); |
3319 | 58 | 58 | ||
3320 | 59 | if (!defined('PUN_ROOT')) | 59 | if (!defined('PUN_ROOT')) |
3322 | 60 | define('PUN_ROOT', './'); | 60 | define('PUN_ROOT', dirname(__FILE__).'/'); |
3323 | 61 | require PUN_ROOT.'include/common.php'; | 61 | require PUN_ROOT.'include/common.php'; |
3324 | 62 | 62 | ||
3325 | 63 | // The length at which topic subjects will be truncated (for HTML output) | 63 | // The length at which topic subjects will be truncated (for HTML output) |
3326 | @@ -119,10 +119,11 @@ | |||
3327 | 119 | header('Pragma: public'); | 119 | header('Pragma: public'); |
3328 | 120 | 120 | ||
3329 | 121 | echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; | 121 | echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
3331 | 122 | echo '<rss version="2.0">'."\n"; | 122 | echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"; |
3332 | 123 | echo "\t".'<channel>'."\n"; | 123 | echo "\t".'<channel>'."\n"; |
3333 | 124 | echo "\t\t".'<atom:link href="'.pun_htmlspecialchars(get_current_url()).'" rel="self" type="application/rss+xml" />'."\n"; | ||
3334 | 124 | echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; | 125 | echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; |
3336 | 125 | echo "\t\t".'<link>'.$feed['link'].'</link>'."\n"; | 126 | echo "\t\t".'<link>'.pun_htmlspecialchars($feed['link']).'</link>'."\n"; |
3337 | 126 | echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; | 127 | echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; |
3338 | 127 | echo "\t\t".'<lastBuildDate>'.gmdate('r', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</lastBuildDate>'."\n"; | 128 | echo "\t\t".'<lastBuildDate>'.gmdate('r', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</lastBuildDate>'."\n"; |
3339 | 128 | 129 | ||
3340 | @@ -135,11 +136,11 @@ | |||
3341 | 135 | { | 136 | { |
3342 | 136 | echo "\t\t".'<item>'."\n"; | 137 | echo "\t\t".'<item>'."\n"; |
3343 | 137 | echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; | 138 | echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
3345 | 138 | echo "\t\t\t".'<link>'.$item['link'].'</link>'."\n"; | 139 | echo "\t\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n"; |
3346 | 139 | echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; | 140 | echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; |
3347 | 140 | 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"; | 141 | 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 | 141 | echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; | 142 | echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; |
3350 | 142 | echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n"; | 143 | echo "\t\t\t".'<guid>'.pun_htmlspecialchars($item['link']).'</guid>'."\n"; |
3351 | 143 | 144 | ||
3352 | 144 | echo "\t\t".'</item>'."\n"; | 145 | echo "\t\t".'</item>'."\n"; |
3353 | 145 | } | 146 | } |
3354 | @@ -167,7 +168,7 @@ | |||
3355 | 167 | 168 | ||
3356 | 168 | echo "\t".'<title type="html"><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; | 169 | echo "\t".'<title type="html"><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; |
3357 | 169 | echo "\t".'<link rel="self" href="'.pun_htmlspecialchars(get_current_url()).'"/>'."\n"; | 170 | echo "\t".'<link rel="self" href="'.pun_htmlspecialchars(get_current_url()).'"/>'."\n"; |
3359 | 170 | echo "\t".'<link href="'.$feed['link'].'"/>'."\n"; | 171 | echo "\t".'<link href="'.pun_htmlspecialchars($feed['link']).'"/>'."\n"; |
3360 | 171 | echo "\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</updated>'."\n"; | 172 | echo "\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</updated>'."\n"; |
3361 | 172 | 173 | ||
3362 | 173 | if ($pun_config['o_show_version'] == '1') | 174 | if ($pun_config['o_show_version'] == '1') |
3363 | @@ -175,7 +176,7 @@ | |||
3364 | 175 | else | 176 | else |
3365 | 176 | echo "\t".'<generator>FluxBB</generator>'."\n"; | 177 | echo "\t".'<generator>FluxBB</generator>'."\n"; |
3366 | 177 | 178 | ||
3368 | 178 | echo "\t".'<id>'.$feed['link'].'</id>'."\n"; | 179 | echo "\t".'<id>'.pun_htmlspecialchars($feed['link']).'</id>'."\n"; |
3369 | 179 | 180 | ||
3370 | 180 | $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; | 181 | $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; |
3371 | 181 | 182 | ||
3372 | @@ -183,7 +184,7 @@ | |||
3373 | 183 | { | 184 | { |
3374 | 184 | echo "\t".'<entry>'."\n"; | 185 | echo "\t".'<entry>'."\n"; |
3375 | 185 | echo "\t\t".'<title type="html"><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; | 186 | echo "\t\t".'<title type="html"><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
3377 | 186 | echo "\t\t".'<link rel="alternate" href="'.$item['link'].'"/>'."\n"; | 187 | echo "\t\t".'<link rel="alternate" href="'.pun_htmlspecialchars($item['link']).'"/>'."\n"; |
3378 | 187 | echo "\t\t".'<'.$content_tag.' type="html"><![CDATA['.escape_cdata($item['description']).']]></'.$content_tag.'>'."\n"; | 188 | echo "\t\t".'<'.$content_tag.' type="html"><![CDATA['.escape_cdata($item['description']).']]></'.$content_tag.'>'."\n"; |
3379 | 188 | echo "\t\t".'<author>'."\n"; | 189 | echo "\t\t".'<author>'."\n"; |
3380 | 189 | echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n"; | 190 | echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n"; |
3381 | @@ -192,12 +193,12 @@ | |||
3382 | 192 | echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n"; | 193 | echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n"; |
3383 | 193 | 194 | ||
3384 | 194 | if (isset($item['author']['uri'])) | 195 | if (isset($item['author']['uri'])) |
3386 | 195 | echo "\t\t\t".'<uri>'.$item['author']['uri'].'</uri>'."\n"; | 196 | echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n"; |
3387 | 196 | 197 | ||
3388 | 197 | echo "\t\t".'</author>'."\n"; | 198 | echo "\t\t".'</author>'."\n"; |
3389 | 198 | echo "\t\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', $item['pubdate']).'</updated>'."\n"; | 199 | echo "\t\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', $item['pubdate']).'</updated>'."\n"; |
3390 | 199 | 200 | ||
3392 | 200 | echo "\t\t".'<id>'.$item['link'].'</id>'."\n"; | 201 | echo "\t\t".'<id>'.pun_htmlspecialchars($item['link']).'</id>'."\n"; |
3393 | 201 | echo "\t".'</entry>'."\n"; | 202 | echo "\t".'</entry>'."\n"; |
3394 | 202 | } | 203 | } |
3395 | 203 | 204 | ||
3396 | @@ -220,7 +221,7 @@ | |||
3397 | 220 | 221 | ||
3398 | 221 | echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; | 222 | echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
3399 | 222 | echo '<source>'."\n"; | 223 | echo '<source>'."\n"; |
3401 | 223 | echo "\t".'<url>'.$feed['link'].'</url>'."\n"; | 224 | echo "\t".'<url>'.pun_htmlspecialchars($feed['link']).'</url>'."\n"; |
3402 | 224 | 225 | ||
3403 | 225 | $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; | 226 | $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; |
3404 | 226 | 227 | ||
3405 | @@ -229,7 +230,7 @@ | |||
3406 | 229 | echo "\t".'<'.$forum_tag.' id="'.$item['id'].'">'."\n"; | 230 | echo "\t".'<'.$forum_tag.' id="'.$item['id'].'">'."\n"; |
3407 | 230 | 231 | ||
3408 | 231 | echo "\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; | 232 | echo "\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
3410 | 232 | echo "\t\t".'<link>'.$item['link'].'</link>'."\n"; | 233 | echo "\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n"; |
3411 | 233 | echo "\t\t".'<content><![CDATA['.escape_cdata($item['description']).']]></content>'."\n"; | 234 | echo "\t\t".'<content><![CDATA['.escape_cdata($item['description']).']]></content>'."\n"; |
3412 | 234 | echo "\t\t".'<author>'."\n"; | 235 | echo "\t\t".'<author>'."\n"; |
3413 | 235 | echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n"; | 236 | echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n"; |
3414 | @@ -238,7 +239,7 @@ | |||
3415 | 238 | echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n"; | 239 | echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n"; |
3416 | 239 | 240 | ||
3417 | 240 | if (isset($item['author']['uri'])) | 241 | if (isset($item['author']['uri'])) |
3419 | 241 | echo "\t\t\t".'<uri>'.$item['author']['uri'].'</uri>'."\n"; | 242 | echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n"; |
3420 | 242 | 243 | ||
3421 | 243 | echo "\t\t".'</author>'."\n"; | 244 | echo "\t\t".'</author>'."\n"; |
3422 | 244 | echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; | 245 | echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; |
3423 | @@ -269,7 +270,7 @@ | |||
3424 | 269 | else | 270 | else |
3425 | 270 | $subject_truncated = pun_htmlspecialchars($item['title']); | 271 | $subject_truncated = pun_htmlspecialchars($item['title']); |
3426 | 271 | 272 | ||
3428 | 272 | echo '<li><a href="'.$item['link'].'" title="'.pun_htmlspecialchars($item['title']).'">'.$subject_truncated.'</a></li>'."\n"; | 273 | echo '<li><a href="'.pun_htmlspecialchars($item['link']).'" title="'.pun_htmlspecialchars($item['title']).'">'.$subject_truncated.'</a></li>'."\n"; |
3429 | 273 | } | 274 | } |
3430 | 274 | } | 275 | } |
3431 | 275 | 276 | ||
3432 | @@ -308,7 +309,7 @@ | |||
3433 | 308 | // Setup the feed | 309 | // Setup the feed |
3434 | 309 | $feed = array( | 310 | $feed = array( |
3435 | 310 | 'title' => $pun_config['o_board_title'].$lang_common['Title separator'].$cur_topic['subject'], | 311 | 'title' => $pun_config['o_board_title'].$lang_common['Title separator'].$cur_topic['subject'], |
3437 | 311 | 'link' => $pun_config['o_base_url'].'/viewtopic.php?id='.$tid, | 312 | 'link' => get_base_url(true).'/viewtopic.php?id='.$tid, |
3438 | 312 | 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), | 313 | 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), |
3439 | 313 | 'items' => array(), | 314 | 'items' => array(), |
3440 | 314 | 'type' => 'posts' | 315 | 'type' => 'posts' |
3441 | @@ -323,7 +324,7 @@ | |||
3442 | 323 | $item = array( | 324 | $item = array( |
3443 | 324 | 'id' => $cur_post['id'], | 325 | 'id' => $cur_post['id'], |
3444 | 325 | 'title' => $cur_topic['first_post_id'] == $cur_post['id'] ? $cur_topic['subject'] : $lang_common['RSS reply'].$cur_topic['subject'], | 326 | 'title' => $cur_topic['first_post_id'] == $cur_post['id'] ? $cur_topic['subject'] : $lang_common['RSS reply'].$cur_topic['subject'], |
3446 | 326 | 'link' => $pun_config['o_base_url'].'/viewtopic.php?pid='.$cur_post['id'].'#p'.$cur_post['id'], | 327 | 'link' => get_base_url(true).'/viewtopic.php?pid='.$cur_post['id'].'#p'.$cur_post['id'], |
3447 | 327 | 'description' => $cur_post['message'], | 328 | 'description' => $cur_post['message'], |
3448 | 328 | 'author' => array( | 329 | 'author' => array( |
3449 | 329 | 'name' => $cur_post['poster'], | 330 | 'name' => $cur_post['poster'], |
3450 | @@ -336,7 +337,7 @@ | |||
3451 | 336 | if ($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) | 337 | if ($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) |
3452 | 337 | $item['author']['email'] = $cur_post['email']; | 338 | $item['author']['email'] = $cur_post['email']; |
3453 | 338 | 339 | ||
3455 | 339 | $item['author']['uri'] = $pun_config['o_base_url'].'/profile.php?id='.$cur_post['poster_id']; | 340 | $item['author']['uri'] = get_base_url(true).'/profile.php?id='.$cur_post['poster_id']; |
3456 | 340 | } | 341 | } |
3457 | 341 | else if ($cur_post['poster_email'] != '' && !$pun_user['is_guest']) | 342 | else if ($cur_post['poster_email'] != '' && !$pun_user['is_guest']) |
3458 | 342 | $item['author']['email'] = $cur_post['poster_email']; | 343 | $item['author']['email'] = $cur_post['poster_email']; |
3459 | @@ -381,46 +382,88 @@ | |||
3460 | 381 | $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; | 382 | $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; |
3461 | 382 | } | 383 | } |
3462 | 383 | 384 | ||
3475 | 384 | // Setup the feed | 385 | // Only attempt to cache if caching is enabled and we have all or a single forum |
3476 | 385 | $feed = array( | 386 | if ($pun_config['o_feed_ttl'] > 0 && ($forum_sql == '' || ($forum_name != '' && !isset($_GET['nfid'])))) |
3477 | 386 | 'title' => $pun_config['o_board_title'].$forum_name, | 387 | $cache_id = 'feed'.sha1($pun_user['g_id'].'|'.$lang_common['lang_identifier'].'|'.($order_posted ? '1' : '0').($forum_name == '' ? '' : '|'.$fids[0])); |
3478 | 387 | 'link' => $pun_config['o_base_url'].'/index.php', | 388 | |
3479 | 388 | 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), | 389 | // Load cached feed |
3480 | 389 | 'items' => array(), | 390 | if (isset($cache_id) && file_exists(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php')) |
3481 | 390 | 'type' => 'topics' | 391 | include FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'; |
3482 | 391 | ); | 392 | |
3483 | 392 | 393 | $now = time(); | |
3484 | 393 | // Fetch $show topics | 394 | if (!isset($feed) || $cache_expire < $now) |
3473 | 394 | $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 | 395 | while ($cur_topic = $db->fetch_assoc($result)) | ||
3485 | 396 | { | 395 | { |
3500 | 397 | if ($pun_config['o_censoring'] == '1') | 396 | // Setup the feed |
3501 | 398 | $cur_topic['subject'] = censor_words($cur_topic['subject']); | 397 | $feed = array( |
3502 | 399 | 398 | 'title' => $pun_config['o_board_title'].$forum_name, | |
3503 | 400 | $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); | 399 | 'link' => '/index.php', |
3504 | 401 | 400 | 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), | |
3505 | 402 | $item = array( | 401 | 'items' => array(), |
3506 | 403 | 'id' => $cur_topic['id'], | 402 | 'type' => 'topics' |
3493 | 404 | 'title' => $cur_topic['subject'], | ||
3494 | 405 | 'link' => $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&action=new'), | ||
3495 | 406 | 'description' => $cur_topic['message'], | ||
3496 | 407 | 'author' => array( | ||
3497 | 408 | 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] | ||
3498 | 409 | ), | ||
3499 | 410 | 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] | ||
3507 | 411 | ); | 403 | ); |
3508 | 412 | 404 | ||
3520 | 413 | if ($cur_topic['poster_id'] > 1) | 405 | // Fetch $show topics |
3521 | 414 | { | 406 | $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 | 415 | if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) | 407 | while ($cur_topic = $db->fetch_assoc($result)) |
3523 | 416 | $item['author']['email'] = $cur_topic['email']; | 408 | { |
3524 | 417 | 409 | if ($pun_config['o_censoring'] == '1') | |
3525 | 418 | $item['author']['uri'] = $pun_config['o_base_url'].'/profile.php?id='.$cur_topic['poster_id']; | 410 | $cur_topic['subject'] = censor_words($cur_topic['subject']); |
3526 | 419 | } | 411 | |
3527 | 420 | else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) | 412 | $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
3528 | 421 | $item['author']['email'] = $cur_topic['poster_email']; | 413 | |
3529 | 422 | 414 | $item = array( | |
3530 | 423 | $feed['items'][] = $item; | 415 | 'id' => $cur_topic['id'], |
3531 | 416 | 'title' => $cur_topic['subject'], | ||
3532 | 417 | 'link' => '/viewtopic.php?id='.$cur_topic['id'].($order_posted ? '' : '&action=new'), | ||
3533 | 418 | 'description' => $cur_topic['message'], | ||
3534 | 419 | 'author' => array( | ||
3535 | 420 | 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] | ||
3536 | 421 | ), | ||
3537 | 422 | 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] | ||
3538 | 423 | ); | ||
3539 | 424 | |||
3540 | 425 | if ($cur_topic['poster_id'] > 1) | ||
3541 | 426 | { | ||
3542 | 427 | if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) | ||
3543 | 428 | $item['author']['email'] = $cur_topic['email']; | ||
3544 | 429 | |||
3545 | 430 | $item['author']['uri'] = '/profile.php?id='.$cur_topic['poster_id']; | ||
3546 | 431 | } | ||
3547 | 432 | else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) | ||
3548 | 433 | $item['author']['email'] = $cur_topic['poster_email']; | ||
3549 | 434 | |||
3550 | 435 | $feed['items'][] = $item; | ||
3551 | 436 | } | ||
3552 | 437 | |||
3553 | 438 | // Output feed as PHP code | ||
3554 | 439 | if (isset($cache_id)) | ||
3555 | 440 | { | ||
3556 | 441 | $fh = @fopen(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php', 'wb'); | ||
3557 | 442 | if (!$fh) | ||
3558 | 443 | 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 | 444 | |||
3560 | 445 | fwrite($fh, '<?php'."\n\n".'$feed = '.var_export($feed, true).';'."\n\n".'$cache_expire = '.($now + ($pun_config['o_feed_ttl'] * 60)).';'."\n\n".'?>'); | ||
3561 | 446 | |||
3562 | 447 | fclose($fh); | ||
3563 | 448 | |||
3564 | 449 | if (function_exists('apc_delete_file')) | ||
3565 | 450 | @apc_delete_file(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'); | ||
3566 | 451 | } | ||
3567 | 452 | } | ||
3568 | 453 | |||
3569 | 454 | // If we only want to show a few items but due to caching we have too many | ||
3570 | 455 | if (count($feed['items']) > $show) | ||
3571 | 456 | $feed['items'] = array_slice($feed['items'], 0, $show); | ||
3572 | 457 | |||
3573 | 458 | // Prepend the current base URL onto some links. Done after caching to handle http/https correctly | ||
3574 | 459 | $feed['link'] = get_base_url(true).$feed['link']; | ||
3575 | 460 | |||
3576 | 461 | foreach ($feed['items'] as $key => $item) | ||
3577 | 462 | { | ||
3578 | 463 | $feed['items'][$key]['link'] = get_base_url(true).$item['link']; | ||
3579 | 464 | |||
3580 | 465 | if (isset($item['author']['uri'])) | ||
3581 | 466 | $feed['items'][$key]['author']['uri'] = get_base_url(true).$item['author']['uri']; | ||
3582 | 424 | } | 467 | } |
3583 | 425 | 468 | ||
3584 | 426 | $output_func = 'output_'.$type; | 469 | $output_func = 'output_'.$type; |
3585 | @@ -446,7 +489,7 @@ | |||
3586 | 446 | { | 489 | { |
3587 | 447 | if ($pun_user_online['user_id'] > 1) | 490 | if ($pun_user_online['user_id'] > 1) |
3588 | 448 | { | 491 | { |
3590 | 449 | $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']); | 492 | $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 | 450 | ++$num_users; | 493 | ++$num_users; |
3592 | 451 | } | 494 | } |
3593 | 452 | else | 495 | else |
3594 | @@ -476,11 +519,17 @@ | |||
3595 | 476 | require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; | 519 | require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
3596 | 477 | 520 | ||
3597 | 478 | // Collect some statistics from the database | 521 | // Collect some statistics from the database |
3603 | 479 | $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()); | 522 | if (file_exists(FORUM_CACHE_DIR.'cache_users_info.php')) |
3604 | 480 | $stats['total_users'] = $db->result($result); | 523 | include FORUM_CACHE_DIR.'cache_users_info.php'; |
3605 | 481 | 524 | ||
3606 | 482 | $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()); | 525 | if (!defined('PUN_USERS_INFO_LOADED')) |
3607 | 483 | $stats['last_user'] = $db->fetch_assoc($result); | 526 | { |
3608 | 527 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
3609 | 528 | require PUN_ROOT.'include/cache.php'; | ||
3610 | 529 | |||
3611 | 530 | generate_users_info_cache(); | ||
3612 | 531 | require FORUM_CACHE_DIR.'cache_users_info.php'; | ||
3613 | 532 | } | ||
3614 | 484 | 533 | ||
3615 | 485 | $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()); | 534 | $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 | 486 | list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); | 535 | list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); |
3617 | @@ -492,7 +541,7 @@ | |||
3618 | 492 | header('Pragma: public'); | 541 | header('Pragma: public'); |
3619 | 493 | 542 | ||
3620 | 494 | echo sprintf($lang_index['No of users'], forum_number_format($stats['total_users'])).'<br />'."\n"; | 543 | echo sprintf($lang_index['No of users'], forum_number_format($stats['total_users'])).'<br />'."\n"; |
3622 | 495 | 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"; | 544 | 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 | 496 | echo sprintf($lang_index['No of topics'], forum_number_format($stats['total_topics'])).'<br />'."\n"; | 545 | echo sprintf($lang_index['No of topics'], forum_number_format($stats['total_topics'])).'<br />'."\n"; |
3624 | 497 | echo sprintf($lang_index['No of posts'], forum_number_format($stats['total_posts'])).'<br />'."\n"; | 546 | echo sprintf($lang_index['No of posts'], forum_number_format($stats['total_posts'])).'<br />'."\n"; |
3625 | 498 | 547 | ||
3626 | 499 | 548 | ||
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 | 1 | <?php | 1 | <?php |
3632 | 2 | 2 | ||
3633 | 3 | /** | 3 | /** |
3635 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
3636 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3637 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3638 | 7 | */ | 7 | */ |
3639 | @@ -63,72 +63,34 @@ | |||
3640 | 63 | <div id="brdfooternav" class="inbox"> | 63 | <div id="brdfooternav" class="inbox"> |
3641 | 64 | <?php | 64 | <?php |
3642 | 65 | 65 | ||
3643 | 66 | echo "\t\t\t".'<div class="conl">'."\n"; | ||
3644 | 67 | |||
3645 | 68 | // Display the "Jump to" drop list | ||
3646 | 69 | if ($pun_config['o_quickjump'] == '1') | ||
3647 | 70 | { | ||
3648 | 71 | // Load cached quick jump | ||
3649 | 72 | if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php')) | ||
3650 | 73 | include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; | ||
3651 | 74 | |||
3652 | 75 | if (!defined('PUN_QJ_LOADED')) | ||
3653 | 76 | { | ||
3654 | 77 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
3655 | 78 | require PUN_ROOT.'include/cache.php'; | ||
3656 | 79 | |||
3657 | 80 | generate_quickjump_cache($pun_user['g_id']); | ||
3658 | 81 | require FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; | ||
3659 | 82 | } | ||
3660 | 83 | } | ||
3661 | 84 | |||
3662 | 85 | echo "\t\t\t".'</div>'."\n"; | ||
3663 | 86 | |||
3664 | 87 | ?> | ||
3665 | 88 | <div class="conr"> | ||
3666 | 89 | <?php | ||
3667 | 90 | |||
3668 | 66 | // If no footer style has been specified, we use the default (only copyright/debug info) | 91 | // If no footer style has been specified, we use the default (only copyright/debug info) |
3669 | 67 | $footer_style = isset($footer_style) ? $footer_style : NULL; | 92 | $footer_style = isset($footer_style) ? $footer_style : NULL; |
3670 | 68 | 93 | ||
3671 | 69 | if ($footer_style == 'index' || $footer_style == 'search') | ||
3672 | 70 | { | ||
3673 | 71 | echo "\t\t\t".'<div class="conl">'."\n"; | ||
3674 | 72 | |||
3675 | 73 | if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1') | ||
3676 | 74 | { | ||
3677 | 75 | echo "\t\t\t\t".'<dl id="searchlinks">'."\n"; | ||
3678 | 76 | echo "\t\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n"; | ||
3679 | 77 | |||
3680 | 78 | 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 | 79 | 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 | 80 | |||
3683 | 81 | if ($pun_config['o_subscriptions'] == '1') | ||
3684 | 82 | echo "\t\t\t\t\t".'<dd><span><a href="search.php?action=show_subscriptions">'.$lang_common['Show subscriptions'].'</a></span></dd>'."\n"; | ||
3685 | 83 | |||
3686 | 84 | 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 | 85 | |||
3688 | 86 | echo "\t\t\t\t".'</dl>'."\n"; | ||
3689 | 87 | } | ||
3690 | 88 | else | ||
3691 | 89 | { | ||
3692 | 90 | if ($pun_user['g_search'] == '1') | ||
3693 | 91 | { | ||
3694 | 92 | echo "\t\t\t\t".'<dl id="searchlinks">'."\n"; | ||
3695 | 93 | echo "\t\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n"; | ||
3696 | 94 | |||
3697 | 95 | 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 | 96 | 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 | 97 | |||
3700 | 98 | echo "\t\t\t\t".'</dl>'."\n"; | ||
3701 | 99 | } | ||
3702 | 100 | } | ||
3703 | 101 | |||
3704 | 102 | echo "\t\t\t".'</div>'."\n"; | ||
3705 | 103 | } | ||
3706 | 104 | else if ($footer_style == 'viewforum' || $footer_style == 'viewtopic') | ||
3707 | 105 | { | ||
3708 | 106 | echo "\t\t\t".'<div class="conl">'."\n"; | ||
3709 | 107 | |||
3710 | 108 | // Display the "Jump to" drop list | ||
3711 | 109 | if ($pun_config['o_quickjump'] == '1') | ||
3712 | 110 | { | ||
3713 | 111 | // Load cached quick jump | ||
3714 | 112 | if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php')) | ||
3715 | 113 | include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; | ||
3716 | 114 | |||
3717 | 115 | if (!defined('PUN_QJ_LOADED')) | ||
3718 | 116 | { | ||
3719 | 117 | if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | ||
3720 | 118 | require PUN_ROOT.'include/cache.php'; | ||
3721 | 119 | |||
3722 | 120 | generate_quickjump_cache($pun_user['g_id']); | ||
3723 | 121 | require FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; | ||
3724 | 122 | } | ||
3725 | 123 | } | ||
3726 | 124 | |||
3727 | 125 | echo "\t\t\t".'</div>'."\n"; | ||
3728 | 126 | } | ||
3729 | 127 | |||
3730 | 128 | ?> | ||
3731 | 129 | <div class="conr"> | ||
3732 | 130 | <?php | ||
3733 | 131 | |||
3734 | 132 | if ($footer_style == 'index') | 94 | if ($footer_style == 'index') |
3735 | 133 | { | 95 | { |
3736 | 134 | if ($pun_config['o_feed_type'] == '1') | 96 | if ($pun_config['o_feed_type'] == '1') |
3737 | @@ -141,7 +103,7 @@ | |||
3738 | 141 | if ($pun_config['o_feed_type'] == '1') | 103 | if ($pun_config['o_feed_type'] == '1') |
3739 | 142 | 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"; | 104 | 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 | 143 | else if ($pun_config['o_feed_type'] == '2') | 105 | else if ($pun_config['o_feed_type'] == '2') |
3742 | 144 | 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"; | 106 | 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 | 145 | } | 107 | } |
3744 | 146 | else if ($footer_style == 'viewtopic') | 108 | else if ($footer_style == 'viewtopic') |
3745 | 147 | { | 109 | { |
3746 | 148 | 110 | ||
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 | 1 | <?php | 1 | <?php |
3752 | 2 | 2 | ||
3753 | 3 | /** | 3 | /** |
3755 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
3756 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
3757 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
3758 | 7 | */ | 7 | */ |
3759 | @@ -197,33 +197,34 @@ | |||
3760 | 197 | /* <![CDATA[ */ | 197 | /* <![CDATA[ */ |
3761 | 198 | function process_form(the_form) | 198 | function process_form(the_form) |
3762 | 199 | { | 199 | { |
3764 | 200 | var element_names = new Object() | 200 | var element_names = { |
3765 | 201 | <?php | 201 | <?php |
3768 | 202 | 202 | // Output a JavaScript object with localised field names | |
3769 | 203 | // Output a JavaScript array with localised field names | 203 | $tpl_temp = count($required_fields); |
3770 | 204 | foreach ($required_fields as $elem_orig => $elem_trans) | 204 | foreach ($required_fields as $elem_orig => $elem_trans) |
3773 | 205 | echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace(' ', ' ', $elem_trans)).'"'."\n"; | 205 | { |
3774 | 206 | 206 | echo "\t\t\"".$elem_orig.'": "'.addslashes(str_replace(' ', ' ', $elem_trans)); | |
3775 | 207 | if (--$tpl_temp) echo "\",\n"; | ||
3776 | 208 | else echo "\"\n\t};\n"; | ||
3777 | 209 | } | ||
3778 | 207 | ?> | 210 | ?> |
3779 | 208 | |||
3780 | 209 | if (document.all || document.getElementById) | 211 | if (document.all || document.getElementById) |
3781 | 210 | { | 212 | { |
3782 | 211 | for (var i = 0; i < the_form.length; ++i) | 213 | for (var i = 0; i < the_form.length; ++i) |
3783 | 212 | { | 214 | { |
3786 | 213 | var elem = the_form.elements[i] | 215 | var elem = the_form.elements[i]; |
3787 | 214 | if (elem.name && elem.name.substring(0, 4) == "req_") | 216 | if (elem.name && (/^req_/.test(elem.name))) |
3788 | 215 | { | 217 | { |
3790 | 216 | if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='') | 218 | if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) |
3791 | 217 | { | 219 | { |
3795 | 218 | alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>") | 220 | alert('"' + element_names[elem.name] + '" <?php echo $lang_common['required field'] ?>'); |
3796 | 219 | elem.focus() | 221 | elem.focus(); |
3797 | 220 | return false | 222 | return false; |
3798 | 221 | } | 223 | } |
3799 | 222 | } | 224 | } |
3800 | 223 | } | 225 | } |
3801 | 224 | } | 226 | } |
3804 | 225 | 227 | return true; | |
3803 | 226 | return true | ||
3805 | 227 | } | 228 | } |
3806 | 228 | /* ]]> */ | 229 | /* ]]> */ |
3807 | 229 | </script> | 230 | </script> |
3808 | @@ -234,8 +235,12 @@ | |||
3809 | 234 | // JavaScript tricks for IE6 and older | 235 | // JavaScript tricks for IE6 and older |
3810 | 235 | echo '<!--[if lte IE 6]><script type="text/javascript" src="style/imports/minmax.js"></script><![endif]-->'."\n"; | 236 | echo '<!--[if lte IE 6]><script type="text/javascript" src="style/imports/minmax.js"></script><![endif]-->'."\n"; |
3811 | 236 | 237 | ||
3814 | 237 | if (isset($page_head)) | 238 | if (!isset($page_head)) |
3815 | 238 | echo implode("\n", $page_head)."\n"; | 239 | $page_head = array(); |
3816 | 240 | |||
3817 | 241 | $page_head['top'] = '<link rel="top" href="index.php" title="'.$lang_common['Forum index'].'" />'; | ||
3818 | 242 | |||
3819 | 243 | echo implode("\n", $page_head)."\n"; | ||
3820 | 239 | 244 | ||
3821 | 240 | $tpl_temp = trim(ob_get_contents()); | 245 | $tpl_temp = trim(ob_get_contents()); |
3822 | 241 | $tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main); | 246 | $tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main); |
3823 | @@ -246,8 +251,8 @@ | |||
3824 | 246 | // START SUBST - <body> | 251 | // START SUBST - <body> |
3825 | 247 | if (isset($focus_element)) | 252 | if (isset($focus_element)) |
3826 | 248 | { | 253 | { |
3829 | 249 | $tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main); | 254 | $tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').elements[\''.$focus_element[1].'\'].focus();', $tpl_main); |
3830 | 250 | $tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main); | 255 | $tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').elements[\''.$focus_element[1].'\'].focus()">', $tpl_main); |
3831 | 251 | } | 256 | } |
3832 | 252 | // END SUBST - <body> | 257 | // END SUBST - <body> |
3833 | 253 | 258 | ||
3834 | @@ -258,7 +263,7 @@ | |||
3835 | 258 | 263 | ||
3836 | 259 | 264 | ||
3837 | 260 | // START SUBST - <pun_title> | 265 | // START SUBST - <pun_title> |
3839 | 261 | $tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main); | 266 | $tpl_main = str_replace('<pun_title>', '<h1><a href="index.php">'.pun_htmlspecialchars($pun_config['o_board_title']).'</a></h1>', $tpl_main); |
3840 | 262 | // END SUBST - <pun_title> | 267 | // END SUBST - <pun_title> |
3841 | 263 | 268 | ||
3842 | 264 | 269 | ||
3843 | @@ -268,16 +273,67 @@ | |||
3844 | 268 | 273 | ||
3845 | 269 | 274 | ||
3846 | 270 | // START SUBST - <pun_navlinks> | 275 | // START SUBST - <pun_navlinks> |
3848 | 271 | $tpl_main = str_replace('<pun_navlinks>','<div class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main); | 276 | $links = array(); |
3849 | 277 | |||
3850 | 278 | // Index should always be displayed | ||
3851 | 279 | //$links[] = '<li id="navindex"'.((PUN_ACTIVE_PAGE == 'index') ? ' class="isactive"' : '').'><a href="index.php">'.$lang_common['Index'].'</a></li>'; | ||
3852 | 280 | |||
3853 | 281 | if ($pun_user['g_read_board'] == '1' && $pun_user['g_view_users'] == '1') | ||
3854 | 282 | $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 | 283 | |||
3856 | 284 | if ($pun_config['o_rules'] == '1' && (!$pun_user['is_guest'] || $pun_user['g_read_board'] == '1' || $pun_config['o_regs_allow'] == '1')) | ||
3857 | 285 | $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 | 286 | |||
3859 | 287 | if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') | ||
3860 | 288 | //$links[] = '<li id="navsearch"'.((PUN_ACTIVE_PAGE == 'search') ? ' class="isactive"' : '').'><a href="search.php">'.$lang_common['Search'].'</a></li>'; | ||
3861 | 289 | |||
3862 | 290 | if ($pun_user['is_guest']) | ||
3863 | 291 | { | ||
3864 | 292 | $links[] = '<li id="navregister"'.((PUN_ACTIVE_PAGE == 'register') ? ' class="isactive"' : '').'><a href="register.php">'.$lang_common['Register'].'</a></li>'; | ||
3865 | 293 | $links[] = '<li id="navlogin"'.((PUN_ACTIVE_PAGE == 'login') ? ' class="isactive"' : '').'><a href="login.php">'.$lang_common['Login'].'</a></li>'; | ||
3866 | 294 | } | ||
3867 | 295 | else | ||
3868 | 296 | { | ||
3869 | 297 | $links[] = '<li id="navprofile"'.((PUN_ACTIVE_PAGE == 'profile') ? ' class="isactive"' : '').'><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a></li>'; | ||
3870 | 298 | |||
3871 | 299 | if ($pun_user['is_admmod']) | ||
3872 | 300 | $links[] = '<li id="navadmin"'.((PUN_ACTIVE_PAGE == 'admin') ? ' class="isactive"' : '').'><a href="admin_index.php">'.$lang_common['Admin'].'</a></li>'; | ||
3873 | 301 | |||
3874 | 302 | $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 | 303 | } | ||
3876 | 304 | |||
3877 | 305 | // liens du header intégrés au menu | ||
3878 | 306 | if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')) && !$pun_user['is_guest']) | ||
3879 | 307 | $links[] = '<li id="navmark"><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'; | ||
3880 | 308 | else if (basename($_SERVER['PHP_SELF']) == 'viewforum.php') | ||
3881 | 309 | $links[] = '<li id="navmark"><a href="misc.php?action=markforumread&fid='.$id.'">'.$lang_common['Mark forum read'].'</a></li>'; | ||
3882 | 310 | |||
3883 | 311 | // Are there any additional navlinks we should insert into the array before imploding it? | ||
3884 | 312 | if ($pun_user['g_read_board'] == '1' && $pun_config['o_additional_navlinks'] != '') | ||
3885 | 313 | { | ||
3886 | 314 | if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_navlinks']."\n", $extra_links)) | ||
3887 | 315 | { | ||
3888 | 316 | // Insert any additional links into the $links array (at the correct index) | ||
3889 | 317 | $num_links = count($extra_links[1]); | ||
3890 | 318 | for ($i = 0; $i < $num_links; ++$i) | ||
3891 | 319 | array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i].'</li>')); | ||
3892 | 320 | } | ||
3893 | 321 | } | ||
3894 | 322 | |||
3895 | 323 | $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 | 324 | $tpl_main = str_replace('<pun_navlinks>', $tpl_temp, $tpl_main); | ||
3897 | 272 | // END SUBST - <pun_navlinks> | 325 | // END SUBST - <pun_navlinks> |
3898 | 273 | 326 | ||
3899 | 274 | 327 | ||
3900 | 275 | // START SUBST - <pun_status> | 328 | // START SUBST - <pun_status> |
3901 | 329 | $page_statusinfo = $page_topicsearches = array(); | ||
3902 | 330 | |||
3903 | 276 | if ($pun_user['is_guest']) | 331 | if ($pun_user['is_guest']) |
3905 | 277 | $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".$lang_common['Not logged in']."\n\t\t".'</div>'; | 332 | $page_statusinfo = $lang_common['Not logged in']; |
3906 | 278 | else | 333 | else |
3907 | 279 | { | 334 | { |
3909 | 280 | $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>'; | 335 | $page_statusinfo[] = '<li><span>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></span></li>'; |
3910 | 336 | $page_statusinfo[] = '<li><span>'.sprintf($lang_common['Last visit'], format_time($pun_user['last_visit'])).'</span></li>'; | ||
3911 | 281 | 337 | ||
3912 | 282 | if ($pun_user['is_admmod']) | 338 | if ($pun_user['is_admmod']) |
3913 | 283 | { | 339 | { |
3914 | @@ -286,21 +342,50 @@ | |||
3915 | 286 | $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()); | 342 | $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 | 287 | 343 | ||
3917 | 288 | if ($db->result($result_header)) | 344 | if ($db->result($result_header)) |
3919 | 289 | $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>'; | 345 | $page_statusinfo[] = '<li class="reportlink"><span><strong><a href="admin_reports.php">'.$lang_common['New reports'].'</a></strong></span></li>'; |
3920 | 290 | } | 346 | } |
3921 | 291 | 347 | ||
3922 | 292 | if ($pun_config['o_maintenance'] == '1') | 348 | if ($pun_config['o_maintenance'] == '1') |
3934 | 293 | $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>'; | 349 | $page_statusinfo[] = '<li class="maintenancelink"><span><strong><a href="admin_options.php#maintenance">'.$lang_common['Maintenance mode enabled'].'</a></strong></span></li>'; |
3935 | 294 | } | 350 | } |
3936 | 295 | //'<li><span><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></span></li>' | 351 | |
3937 | 296 | // if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php'))) | 352 | if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
3938 | 297 | // $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>'; | 353 | { |
3939 | 298 | // else if (basename($_SERVER['PHP_SELF']) == 'viewforum.php') | 354 | $page_topicsearches[] = '<a href="search.php?action=show_replies" title="'.$lang_common['Show posted topics'].'">'.$lang_common['Posted topics'].'</a>'; |
3940 | 299 | // $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>'; | 355 | $page_topicsearches[] = '<a href="search.php?action=show_new" title="'.$lang_common['Show new posts'].'">'.$lang_common['New posts header'].'</a>'; |
3941 | 300 | // else | 356 | } |
3942 | 301 | $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'; | 357 | } |
3943 | 302 | } | 358 | |
3944 | 303 | 359 | // Quick searches | |
3945 | 360 | if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') | ||
3946 | 361 | { | ||
3947 | 362 | $page_topicsearches[] = '<a href="search.php?action=show_recent" title="'.$lang_common['Show active topics'].'">'.$lang_common['Active topics'].'</a>'; | ||
3948 | 363 | $page_topicsearches[] = '<a href="search.php?action=show_unanswered" title="'.$lang_common['Show unanswered topics'].'">'.$lang_common['Unanswered topics'].'</a>'; | ||
3949 | 364 | } | ||
3950 | 365 | |||
3951 | 366 | |||
3952 | 367 | // Generate all that jazz | ||
3953 | 368 | $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t"; | ||
3954 | 369 | |||
3955 | 370 | // The status information | ||
3956 | 371 | if (is_array($page_statusinfo)) | ||
3957 | 372 | { | ||
3958 | 373 | $tpl_temp .= "\n\t\t\t".'<ul class="conl">'; | ||
3959 | 374 | $tpl_temp .= "\n\t\t\t\t".implode("\n\t\t\t\t", $page_statusinfo); | ||
3960 | 375 | $tpl_temp .= "\n\t\t\t".'</ul>'; | ||
3961 | 376 | } | ||
3962 | 377 | else | ||
3963 | 378 | $tpl_temp .= "\n\t\t\t".$page_statusinfo; | ||
3964 | 379 | |||
3965 | 380 | // Generate quicklinks | ||
3966 | 381 | //if (!empty($page_topicsearches)) | ||
3967 | 382 | //{ | ||
3968 | 383 | // $tpl_temp .= "\n\t\t\t".'<ul class="conr">'; | ||
3969 | 384 | // $tpl_temp .= "\n\t\t\t\t".'<li><span>'.$lang_common['Topic searches'].' '.implode(' | ', $page_topicsearches).'</span></li>'; | ||
3970 | 385 | // $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'; | ||
3971 | 386 | //} | ||
3972 | 387 | |||
3973 | 388 | $tpl_temp .= "\n\t\t".'</div>'; | ||
3974 | 304 | 389 | ||
3975 | 305 | $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main); | 390 | $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main); |
3976 | 306 | // END SUBST - <pun_status> | 391 | // END SUBST - <pun_status> |
3977 | @@ -310,31 +395,31 @@ | |||
3978 | 310 | // START SUBST - <pun_searchlinks> | 395 | // START SUBST - <pun_searchlinks> |
3979 | 311 | if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1') | 396 | if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1') |
3980 | 312 | { | 397 | { |
3989 | 313 | $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; | 398 | $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; |
3990 | 314 | $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; | 399 | $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; |
3991 | 315 | $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"; | 400 | $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 | 316 | $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"; | 401 | $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 | 317 | $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"; | 402 | $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 | 318 | if ($pun_config['o_subscriptions'] == '1') | 403 | if ($pun_config['o_topic_subscriptions'] == '1') |
3995 | 319 | $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"; | 404 | $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 | 320 | $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"; | 405 | $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 | 321 | } | 406 | } |
3998 | 322 | else | 407 | else |
3999 | 323 | { | 408 | { |
4007 | 324 | if ($pun_user['g_search'] == '1') | 409 | if ($pun_user['g_search'] == '1') |
4008 | 325 | { | 410 | { |
4009 | 326 | $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; | 411 | $tpl_searchlinks = "\n\t\t".'<li class="cat"><h2>'.$lang_common['Search links'].'</h2>'."\n"; |
4010 | 327 | $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; | 412 | $tpl_searchlinks .= "\t\t".'<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n"; |
4011 | 328 | $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"; | 413 | $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 | 329 | $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"; | 414 | $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 | 330 | } | 415 | } |
4014 | 331 | } | 416 | } |
4015 | 332 | $tpl_main = str_replace('<pun_searchlinks>', $tpl_searchlinks, $tpl_main); | 417 | $tpl_main = str_replace('<pun_searchlinks>', $tpl_searchlinks, $tpl_main); |
4016 | 333 | // END SUBST -<pun_searchlinks> | 418 | // END SUBST -<pun_searchlinks> |
4017 | 334 | 419 | ||
4018 | 335 | 420 | ||
4019 | 336 | // START SUBST - <pun_announcement> | 421 | // START SUBST - <pun_announcement> |
4021 | 337 | if ($pun_config['o_announcement'] == '1') | 422 | if ($pun_user['g_read_board'] == '1' && $pun_config['o_announcement'] == '1') |
4022 | 338 | { | 423 | { |
4023 | 339 | ob_start(); | 424 | ob_start(); |
4024 | 340 | 425 | ||
4025 | 341 | 426 | ||
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 | 1 | <?php | 1 | <?php |
4031 | 2 | 2 | ||
4032 | 3 | /** | 3 | /** |
4034 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4035 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4036 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4037 | 7 | */ | 7 | */ |
4038 | @@ -9,7 +9,7 @@ | |||
4039 | 9 | // Tell header.php to use the help template | 9 | // Tell header.php to use the help template |
4040 | 10 | define('PUN_HELP', 1); | 10 | define('PUN_HELP', 1); |
4041 | 11 | 11 | ||
4043 | 12 | define('PUN_ROOT', './'); | 12 | define('PUN_ROOT', dirname(__FILE__).'/'); |
4044 | 13 | require PUN_ROOT.'include/common.php'; | 13 | require PUN_ROOT.'include/common.php'; |
4045 | 14 | 14 | ||
4046 | 15 | 15 | ||
4047 | @@ -39,7 +39,7 @@ | |||
4048 | 39 | <p><?php echo $lang_help['Text style info'] ?></p> | 39 | <p><?php echo $lang_help['Text style info'] ?></p> |
4049 | 40 | <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> | 40 | <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 | 41 | <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> | 41 | <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> |
4052 | 42 | <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> | 42 | <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 | 43 | <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> | 43 | <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 | 44 | <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> | 44 | <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 | 45 | <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> | 45 | <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 | 53 | <div class="box"> | 53 | <div class="box"> |
4058 | 54 | <div class="inbox"> | 54 | <div class="inbox"> |
4059 | 55 | <p><?php echo $lang_help['Links info'] ?></p> | 55 | <p><?php echo $lang_help['Links info'] ?></p> |
4062 | 56 | <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> | 56 | <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 | 57 | <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> | 57 | <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 | 58 | <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> | 58 | <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 | 59 | <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> | 59 | <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 | 60 | </div> | 60 | </div> |
4067 | 61 | <div class="inbox"> | 61 | <div class="inbox"> |
4068 | 62 | <p><a name="img"></a><?php echo $lang_help['Images info'] ?></p> | 62 | <p><a name="img"></a><?php echo $lang_help['Images info'] ?></p> |
4070 | 63 | <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> | 63 | <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 | 64 | </div> | 64 | </div> |
4072 | 65 | </div> | 65 | </div> |
4073 | 66 | <h2><span><?php echo $lang_help['Quotes'] ?></span></h2> | 66 | <h2><span><?php echo $lang_help['Quotes'] ?></span></h2> |
4074 | @@ -99,17 +99,17 @@ | |||
4075 | 99 | <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> | 99 | <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 | 100 | <br /><span><?php echo $lang_help['produces list'] ?></span></p> | 100 | <br /><span><?php echo $lang_help['produces list'] ?></span></p> |
4077 | 101 | <div class="postmsg"> | 101 | <div class="postmsg"> |
4079 | 102 | <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> | 102 | <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 | 103 | </div> | 103 | </div> |
4081 | 104 | <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> | 104 | <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 | 105 | <br /><span><?php echo $lang_help['produces decimal list'] ?></span></p> | 105 | <br /><span><?php echo $lang_help['produces decimal list'] ?></span></p> |
4083 | 106 | <div class="postmsg"> | 106 | <div class="postmsg"> |
4085 | 107 | <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> | 107 | <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 | 108 | </div> | 108 | </div> |
4087 | 109 | <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> | 109 | <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 | 110 | <br /><span><?php echo $lang_help['produces alpha list'] ?></span></p> | 110 | <br /><span><?php echo $lang_help['produces alpha list'] ?></span></p> |
4089 | 111 | <div class="postmsg"> | 111 | <div class="postmsg"> |
4091 | 112 | <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> | 112 | <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 | 113 | </div> | 113 | </div> |
4093 | 114 | </div> | 114 | </div> |
4094 | 115 | </div> | 115 | </div> |
4095 | @@ -135,7 +135,8 @@ | |||
4096 | 135 | $smiley_groups[$smiley_img][] = $smiley_text; | 135 | $smiley_groups[$smiley_img][] = $smiley_text; |
4097 | 136 | 136 | ||
4098 | 137 | foreach ($smiley_groups as $smiley_img => $smiley_texts) | 137 | foreach ($smiley_groups as $smiley_img => $smiley_texts) |
4100 | 138 | 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"; | 138 | 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 | 139 | |||
4102 | 139 | ?> | 140 | ?> |
4103 | 140 | </div> | 141 | </div> |
4104 | 141 | </div> | 142 | </div> |
4105 | 142 | 143 | ||
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 | 1 | <?php | 1 | <?php |
4111 | 2 | 2 | ||
4112 | 3 | /** | 3 | /** |
4114 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4115 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4116 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4117 | 7 | */ | 7 | */ |
4118 | @@ -26,14 +26,14 @@ | |||
4119 | 26 | // Output config as PHP code | 26 | // Output config as PHP code |
4120 | 27 | $fh = @fopen(FORUM_CACHE_DIR.'cache_config.php', 'wb'); | 27 | $fh = @fopen(FORUM_CACHE_DIR.'cache_config.php', 'wb'); |
4121 | 28 | if (!$fh) | 28 | if (!$fh) |
4123 | 29 | error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 29 | 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 | 30 | 30 | ||
4125 | 31 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>'); | 31 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>'); |
4126 | 32 | 32 | ||
4127 | 33 | fclose($fh); | 33 | fclose($fh); |
4128 | 34 | 34 | ||
4129 | 35 | if (function_exists('apc_delete_file')) | 35 | if (function_exists('apc_delete_file')) |
4131 | 36 | apc_delete_file(FORUM_CACHE_DIR.'cache_config.php'); | 36 | @apc_delete_file(FORUM_CACHE_DIR.'cache_config.php'); |
4132 | 37 | } | 37 | } |
4133 | 38 | 38 | ||
4134 | 39 | 39 | ||
4135 | @@ -54,14 +54,14 @@ | |||
4136 | 54 | // Output ban list as PHP code | 54 | // Output ban list as PHP code |
4137 | 55 | $fh = @fopen(FORUM_CACHE_DIR.'cache_bans.php', 'wb'); | 55 | $fh = @fopen(FORUM_CACHE_DIR.'cache_bans.php', 'wb'); |
4138 | 56 | if (!$fh) | 56 | if (!$fh) |
4140 | 57 | error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 57 | 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 | 58 | 58 | ||
4142 | 59 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>'); | 59 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>'); |
4143 | 60 | 60 | ||
4144 | 61 | fclose($fh); | 61 | fclose($fh); |
4145 | 62 | 62 | ||
4146 | 63 | if (function_exists('apc_delete_file')) | 63 | if (function_exists('apc_delete_file')) |
4148 | 64 | apc_delete_file(FORUM_CACHE_DIR.'cache_bans.php'); | 64 | @apc_delete_file(FORUM_CACHE_DIR.'cache_bans.php'); |
4149 | 65 | } | 65 | } |
4150 | 66 | 66 | ||
4151 | 67 | 67 | ||
4152 | @@ -82,14 +82,14 @@ | |||
4153 | 82 | // Output ranks list as PHP code | 82 | // Output ranks list as PHP code |
4154 | 83 | $fh = @fopen(FORUM_CACHE_DIR.'cache_ranks.php', 'wb'); | 83 | $fh = @fopen(FORUM_CACHE_DIR.'cache_ranks.php', 'wb'); |
4155 | 84 | if (!$fh) | 84 | if (!$fh) |
4157 | 85 | error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 85 | 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 | 86 | 86 | ||
4159 | 87 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>'); | 87 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>'); |
4160 | 88 | 88 | ||
4161 | 89 | fclose($fh); | 89 | fclose($fh); |
4162 | 90 | 90 | ||
4163 | 91 | if (function_exists('apc_delete_file')) | 91 | if (function_exists('apc_delete_file')) |
4165 | 92 | apc_delete_file(FORUM_CACHE_DIR.'cache_ranks.php'); | 92 | @apc_delete_file(FORUM_CACHE_DIR.'cache_ranks.php'); |
4166 | 93 | } | 93 | } |
4167 | 94 | 94 | ||
4168 | 95 | 95 | ||
4169 | @@ -100,58 +100,184 @@ | |||
4170 | 100 | { | 100 | { |
4171 | 101 | global $db, $lang_common, $pun_user; | 101 | global $db, $lang_common, $pun_user; |
4172 | 102 | 102 | ||
4173 | 103 | $groups = array(); | ||
4174 | 104 | |||
4175 | 103 | // If a group_id was supplied, we generate the quick jump cache for that group only | 105 | // If a group_id was supplied, we generate the quick jump cache for that group only |
4176 | 104 | if ($group_id !== false) | 106 | if ($group_id !== false) |
4178 | 105 | $groups[0] = $group_id; | 107 | { |
4179 | 108 | // Is this group even allowed to read forums? | ||
4180 | 109 | $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 | 110 | $read_board = $db->result($result); | ||
4182 | 111 | |||
4183 | 112 | $groups[$group_id] = $read_board; | ||
4184 | 113 | } | ||
4185 | 106 | else | 114 | else |
4186 | 107 | { | 115 | { |
4189 | 108 | // A group_id was now supplied, so we generate the quick jump cache for all groups | 116 | // A group_id was not supplied, so we generate the quick jump cache for all groups |
4190 | 109 | $result = $db->query('SELECT g_id FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); | 117 | $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 | 110 | $num_groups = $db->num_rows($result); | 118 | $num_groups = $db->num_rows($result); |
4192 | 111 | 119 | ||
4195 | 112 | for ($i = 0; $i < $num_groups; ++$i) | 120 | while ($row = $db->fetch_row($result)) |
4196 | 113 | $groups[] = $db->result($result, $i); | 121 | $groups[$row[0]] = $row[1]; |
4197 | 114 | } | 122 | } |
4198 | 115 | 123 | ||
4199 | 116 | // Loop through the groups in $groups and output the cache for each of them | 124 | // Loop through the groups in $groups and output the cache for each of them |
4201 | 117 | foreach ($groups as $group_id) | 125 | foreach ($groups as $group_id => $read_board) |
4202 | 118 | { | 126 | { |
4203 | 119 | // Output quick jump as PHP code | 127 | // Output quick jump as PHP code |
4204 | 120 | $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb'); | 128 | $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb'); |
4205 | 121 | if (!$fh) | 129 | if (!$fh) |
4216 | 122 | error('Unable to write quick jump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 130 | 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 | 123 | 131 | ||
4218 | 124 | $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>'; | 132 | $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 | 125 | $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"; | 133 | |
4220 | 126 | 134 | if ($read_board == '1') | |
4211 | 127 | |||
4212 | 128 | $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 | 129 | |||
4214 | 130 | $cur_category = 0; | ||
4215 | 131 | while ($cur_forum = $db->fetch_assoc($result)) | ||
4221 | 132 | { | 135 | { |
4223 | 133 | if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? | 136 | $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 | 137 | |||
4225 | 138 | if ($db->num_rows($result)) | ||
4226 | 134 | { | 139 | { |
4232 | 135 | if ($cur_category) | 140 | $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 | 136 | $output .= "\t\t\t\t\t\t".'</optgroup>'."\n"; | 141 | |
4234 | 137 | 142 | $cur_category = 0; | |
4235 | 138 | $output .= "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n"; | 143 | while ($cur_forum = $db->fetch_assoc($result)) |
4236 | 139 | $cur_category = $cur_forum['cid']; | 144 | { |
4237 | 145 | if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? | ||
4238 | 146 | { | ||
4239 | 147 | if ($cur_category) | ||
4240 | 148 | $output .= "\t\t\t\t\t\t".'</optgroup>'."\n"; | ||
4241 | 149 | |||
4242 | 150 | $output .= "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n"; | ||
4243 | 151 | $cur_category = $cur_forum['cid']; | ||
4244 | 152 | } | ||
4245 | 153 | |||
4246 | 154 | $redirect_tag = ($cur_forum['redirect_url'] != '') ? ' >>>' : ''; | ||
4247 | 155 | $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 | 156 | } | ||
4249 | 157 | |||
4250 | 158 | $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 | 140 | } | 159 | } |
4252 | 141 | |||
4253 | 142 | $redirect_tag = ($cur_forum['redirect_url'] != '') ? ' >>>' : ''; | ||
4254 | 143 | $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 | 144 | } | 160 | } |
4256 | 145 | 161 | ||
4257 | 146 | $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 | 147 | |||
4259 | 148 | fwrite($fh, $output); | 162 | fwrite($fh, $output); |
4260 | 149 | 163 | ||
4261 | 150 | fclose($fh); | 164 | fclose($fh); |
4262 | 151 | 165 | ||
4263 | 152 | if (function_exists('apc_delete_file')) | 166 | if (function_exists('apc_delete_file')) |
4267 | 153 | apc_delete_file(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php'); | 167 | @apc_delete_file(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php'); |
4268 | 154 | } | 168 | } |
4269 | 155 | } | 169 | } |
4270 | 170 | |||
4271 | 171 | |||
4272 | 172 | // | ||
4273 | 173 | // Generate the censoring cache PHP script | ||
4274 | 174 | // | ||
4275 | 175 | function generate_censoring_cache() | ||
4276 | 176 | { | ||
4277 | 177 | global $db; | ||
4278 | 178 | |||
4279 | 179 | $result = $db->query('SELECT search_for, replace_with FROM '.$db->prefix.'censoring') or error('Unable to fetch censoring list', __FILE__, __LINE__, $db->error()); | ||
4280 | 180 | $num_words = $db->num_rows($result); | ||
4281 | 181 | |||
4282 | 182 | $search_for = $replace_with = array(); | ||
4283 | 183 | for ($i = 0; $i < $num_words; $i++) | ||
4284 | 184 | { | ||
4285 | 185 | list($search_for[$i], $replace_with[$i]) = $db->fetch_row($result); | ||
4286 | 186 | $search_for[$i] = '/(?<=[^\p{L}\p{N}])('.str_replace('\*', '[\p{L}\p{N}]*?', preg_quote($search_for[$i], '/')).')(?=[^\p{L}\p{N}])/iu'; | ||
4287 | 187 | } | ||
4288 | 188 | |||
4289 | 189 | // Output censored words as PHP code | ||
4290 | 190 | $fh = @fopen(FORUM_CACHE_DIR.'cache_censoring.php', 'wb'); | ||
4291 | 191 | if (!$fh) | ||
4292 | 192 | 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 | 193 | |||
4294 | 194 | 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 | 195 | |||
4296 | 196 | fclose($fh); | ||
4297 | 197 | |||
4298 | 198 | if (function_exists('apc_delete_file')) | ||
4299 | 199 | @apc_delete_file(FORUM_CACHE_DIR.'cache_censoring.php'); | ||
4300 | 200 | } | ||
4301 | 201 | |||
4302 | 202 | |||
4303 | 203 | // | ||
4304 | 204 | // Generate the stopwords cache PHP script | ||
4305 | 205 | // | ||
4306 | 206 | function generate_stopwords_cache() | ||
4307 | 207 | { | ||
4308 | 208 | $stopwords = array(); | ||
4309 | 209 | |||
4310 | 210 | $d = dir(PUN_ROOT.'lang'); | ||
4311 | 211 | while (($entry = $d->read()) !== false) | ||
4312 | 212 | { | ||
4313 | 213 | if ($entry{0} == '.') | ||
4314 | 214 | continue; | ||
4315 | 215 | |||
4316 | 216 | if (is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/stopwords.txt')) | ||
4317 | 217 | $stopwords = array_merge($stopwords, file(PUN_ROOT.'lang/'.$entry.'/stopwords.txt')); | ||
4318 | 218 | } | ||
4319 | 219 | $d->close(); | ||
4320 | 220 | |||
4321 | 221 | // Tidy up and filter the stopwords | ||
4322 | 222 | $stopwords = array_map('pun_trim', $stopwords); | ||
4323 | 223 | $stopwords = array_filter($stopwords); | ||
4324 | 224 | |||
4325 | 225 | // Output stopwords as PHP code | ||
4326 | 226 | $fh = @fopen(FORUM_CACHE_DIR.'cache_stopwords.php', 'wb'); | ||
4327 | 227 | if (!$fh) | ||
4328 | 228 | 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 | 229 | |||
4330 | 230 | 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 | 231 | |||
4332 | 232 | fclose($fh); | ||
4333 | 233 | |||
4334 | 234 | if (function_exists('apc_delete_file')) | ||
4335 | 235 | @apc_delete_file(FORUM_CACHE_DIR.'cache_stopwords.php'); | ||
4336 | 236 | } | ||
4337 | 237 | |||
4338 | 238 | |||
4339 | 239 | // | ||
4340 | 240 | // Load some information about the latest registered users | ||
4341 | 241 | // | ||
4342 | 242 | function generate_users_info_cache() | ||
4343 | 243 | { | ||
4344 | 244 | global $db; | ||
4345 | 245 | |||
4346 | 246 | $stats = array(); | ||
4347 | 247 | |||
4348 | 248 | $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 | 249 | $stats['total_users'] = $db->result($result); | ||
4350 | 250 | |||
4351 | 251 | $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 | 252 | $stats['last_user'] = $db->fetch_assoc($result); | ||
4353 | 253 | |||
4354 | 254 | // Output users info as PHP code | ||
4355 | 255 | $fh = @fopen(FORUM_CACHE_DIR.'cache_users_info.php', 'wb'); | ||
4356 | 256 | if (!$fh) | ||
4357 | 257 | 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 | 258 | |||
4359 | 259 | fwrite($fh, '<?php'."\n\n".'define(\'PUN_USERS_INFO_LOADED\', 1);'."\n\n".'$stats = '.var_export($stats, true).';'."\n\n".'?>'); | ||
4360 | 260 | |||
4361 | 261 | fclose($fh); | ||
4362 | 262 | |||
4363 | 263 | if (function_exists('apc_delete_file')) | ||
4364 | 264 | @apc_delete_file(FORUM_CACHE_DIR.'cache_users_info.php'); | ||
4365 | 265 | } | ||
4366 | 266 | |||
4367 | 267 | |||
4368 | 268 | // | ||
4369 | 269 | // Delete all feed caches | ||
4370 | 270 | // | ||
4371 | 271 | function clear_feed_cache() | ||
4372 | 272 | { | ||
4373 | 273 | $d = dir(FORUM_CACHE_DIR); | ||
4374 | 274 | while (($entry = $d->read()) !== false) | ||
4375 | 275 | { | ||
4376 | 276 | if (substr($entry, 0, 10) == 'cache_feed' && substr($entry, -4) == '.php') | ||
4377 | 277 | @unlink(FORUM_CACHE_DIR.$entry); | ||
4378 | 278 | } | ||
4379 | 279 | $d->close(); | ||
4380 | 280 | } | ||
4381 | 281 | |||
4382 | 156 | 282 | ||
4383 | 157 | define('FORUM_CACHE_FUNCTIONS_LOADED', true); | 283 | define('FORUM_CACHE_FUNCTIONS_LOADED', true); |
4384 | 158 | 284 | ||
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 | 1 | <?php | 1 | <?php |
4390 | 2 | 2 | ||
4391 | 3 | /** | 3 | /** |
4393 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4394 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4395 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4396 | 7 | */ | 7 | */ |
4397 | @@ -10,11 +10,11 @@ | |||
4398 | 10 | exit('The constant PUN_ROOT must be defined and point to a valid FluxBB installation root directory.'); | 10 | exit('The constant PUN_ROOT must be defined and point to a valid FluxBB installation root directory.'); |
4399 | 11 | 11 | ||
4400 | 12 | // Define the version and database revision that this code was written for | 12 | // Define the version and database revision that this code was written for |
4402 | 13 | define('FORUM_VERSION', '1.4.2'); | 13 | define('FORUM_VERSION', '1.4.5'); |
4403 | 14 | 14 | ||
4407 | 15 | define('FORUM_DB_REVISION', 8); | 15 | define('FORUM_DB_REVISION', 11); |
4408 | 16 | define('FORUM_SI_REVISION', 1); | 16 | define('FORUM_SI_REVISION', 2); |
4409 | 17 | define('FORUM_PARSER_REVISION', 1); | 17 | define('FORUM_PARSER_REVISION', 2); |
4410 | 18 | 18 | ||
4411 | 19 | // Block prefetch requests | 19 | // Block prefetch requests |
4412 | 20 | if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') | 20 | if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') |
4413 | @@ -38,10 +38,6 @@ | |||
4414 | 38 | if (defined('FORUM')) | 38 | if (defined('FORUM')) |
4415 | 39 | define('PUN', FORUM); | 39 | define('PUN', FORUM); |
4416 | 40 | 40 | ||
4417 | 41 | // If PUN isn't defined, config.php is missing or corrupt | ||
4418 | 42 | if (!defined('PUN')) | ||
4419 | 43 | 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 | 44 | |||
4421 | 45 | // Load the functions script | 41 | // Load the functions script |
4422 | 46 | require PUN_ROOT.'include/functions.php'; | 42 | require PUN_ROOT.'include/functions.php'; |
4423 | 47 | 43 | ||
4424 | @@ -54,6 +50,13 @@ | |||
4425 | 54 | // Reverse the effect of register_globals | 50 | // Reverse the effect of register_globals |
4426 | 55 | forum_unregister_globals(); | 51 | forum_unregister_globals(); |
4427 | 56 | 52 | ||
4428 | 53 | // If PUN isn't defined, config.php is missing or corrupt | ||
4429 | 54 | if (!defined('PUN')) | ||
4430 | 55 | { | ||
4431 | 56 | header('Location: install.php'); | ||
4432 | 57 | exit; | ||
4433 | 58 | } | ||
4434 | 59 | |||
4435 | 57 | // Record the start time (will be used to calculate the generation time for the page) | 60 | // Record the start time (will be used to calculate the generation time for the page) |
4436 | 58 | $pun_start = get_microtime(); | 61 | $pun_start = get_microtime(); |
4437 | 59 | 62 | ||
4438 | @@ -130,7 +133,10 @@ | |||
4439 | 130 | !isset($pun_config['o_searchindex_revision']) || $pun_config['o_searchindex_revision'] < FORUM_SI_REVISION || | 133 | !isset($pun_config['o_searchindex_revision']) || $pun_config['o_searchindex_revision'] < FORUM_SI_REVISION || |
4440 | 131 | !isset($pun_config['o_parser_revision']) || $pun_config['o_parser_revision'] < FORUM_PARSER_REVISION || | 134 | !isset($pun_config['o_parser_revision']) || $pun_config['o_parser_revision'] < FORUM_PARSER_REVISION || |
4441 | 132 | version_compare($pun_config['o_cur_version'], FORUM_VERSION, '<')) | 135 | version_compare($pun_config['o_cur_version'], FORUM_VERSION, '<')) |
4443 | 133 | 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.'); | 136 | { |
4444 | 137 | header('Location: db_update.php'); | ||
4445 | 138 | exit; | ||
4446 | 139 | } | ||
4447 | 134 | 140 | ||
4448 | 135 | // Enable output buffering | 141 | // Enable output buffering |
4449 | 136 | if (!defined('PUN_DISABLE_BUFFERING')) | 142 | if (!defined('PUN_DISABLE_BUFFERING')) |
4450 | @@ -191,3 +197,6 @@ | |||
4451 | 191 | define('PUN_SEARCH_MIN_WORD', 3); | 197 | define('PUN_SEARCH_MIN_WORD', 3); |
4452 | 192 | if (!defined('PUN_SEARCH_MAX_WORD')) | 198 | if (!defined('PUN_SEARCH_MAX_WORD')) |
4453 | 193 | define('PUN_SEARCH_MAX_WORD', 20); | 199 | define('PUN_SEARCH_MAX_WORD', 20); |
4454 | 200 | |||
4455 | 201 | if (!defined('FORUM_MAX_COOKIE_SIZE')) | ||
4456 | 202 | define('FORUM_MAX_COOKIE_SIZE', 4048); | ||
4457 | 194 | 203 | ||
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 | 1 | <?php | 1 | <?php |
4463 | 2 | 2 | ||
4464 | 3 | /** | 3 | /** |
4466 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4467 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4468 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4469 | 7 | */ | 7 | */ |
4470 | @@ -33,28 +33,42 @@ | |||
4471 | 33 | ?> | 33 | ?> |
4472 | 34 | <div id="adminconsole" class="block2col"> | 34 | <div id="adminconsole" class="block2col"> |
4473 | 35 | <div id="adminmenu" class="blockmenu"> | 35 | <div id="adminmenu" class="blockmenu"> |
4475 | 36 | <h2><span><?php echo ($is_admin) ? $lang_admin_common['Admin menu'] : $lang_admin_common['Moderator menu'] ?></span></h2> | 36 | <h2><span><?php echo $lang_admin_common['Moderator menu'] ?></span></h2> |
4476 | 37 | <div class="box"> | 37 | <div class="box"> |
4477 | 38 | <div class="inbox"> | 38 | <div class="inbox"> |
4478 | 39 | <ul> | 39 | <ul> |
4479 | 40 | <li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php"><?php echo $lang_admin_common['Index'] ?></a></li> | 40 | <li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php"><?php echo $lang_admin_common['Index'] ?></a></li> |
4492 | 41 | <?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> | 41 | <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> |
4493 | 42 | <?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> | 42 | <?php if ($is_admin || $pun_user['g_mod_ban_users'] == '1'): ?> <li<?php if ($page == 'bans') echo ' class="isactive"'; ?>><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li> |
4494 | 43 | <?php endif; ?> <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> | 43 | <?php endif; if ($is_admin || $pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2'): ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php"><?php echo $lang_admin_common['Reports'] ?></a></li> |
4495 | 44 | <?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> | 44 | <?php endif; ?> </ul> |
4496 | 45 | <?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> | 45 | </div> |
4497 | 46 | <?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> | 46 | </div> |
4498 | 47 | <?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> | 47 | <?php |
4499 | 48 | <?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> | 48 | |
4500 | 49 | <?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> | 49 | if ($is_admin) |
4501 | 50 | <?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> | 50 | { |
4502 | 51 | <?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> | 51 | |
4503 | 52 | <?php endif; ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php"><?php echo $lang_admin_common['Reports'] ?></a></li> | 52 | ?> |
4504 | 53 | <h2 class="block2"><span><?php echo $lang_admin_common['Admin menu'] ?></span></h2> | ||
4505 | 54 | <div class="box"> | ||
4506 | 55 | <div class="inbox"> | ||
4507 | 56 | <ul> | ||
4508 | 57 | <li<?php if ($page == 'options') echo ' class="isactive"'; ?>><a href="admin_options.php"><?php echo $lang_admin_common['Options'] ?></a></li> | ||
4509 | 58 | <li<?php if ($page == 'permissions') echo ' class="isactive"'; ?>><a href="admin_permissions.php"><?php echo $lang_admin_common['Permissions'] ?></a></li> | ||
4510 | 59 | <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="admin_categories.php"><?php echo $lang_admin_common['Categories'] ?></a></li> | ||
4511 | 60 | <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="admin_forums.php"><?php echo $lang_admin_common['Forums'] ?></a></li> | ||
4512 | 61 | <li<?php if ($page == 'groups') echo ' class="isactive"'; ?>><a href="admin_groups.php"><?php echo $lang_admin_common['User groups'] ?></a></li> | ||
4513 | 62 | <li<?php if ($page == 'censoring') echo ' class="isactive"'; ?>><a href="admin_censoring.php"><?php echo $lang_admin_common['Censoring'] ?></a></li> | ||
4514 | 63 | <li<?php if ($page == 'ranks') echo ' class="isactive"'; ?>><a href="admin_ranks.php"><?php echo $lang_admin_common['Ranks'] ?></a></li> | ||
4515 | 64 | <li<?php if ($page == 'maintenance') echo ' class="isactive"'; ?>><a href="admin_maintenance.php"><?php echo $lang_admin_common['Maintenance'] ?></a></li> | ||
4516 | 53 | </ul> | 65 | </ul> |
4517 | 54 | </div> | 66 | </div> |
4518 | 55 | </div> | 67 | </div> |
4519 | 56 | <?php | 68 | <?php |
4520 | 57 | 69 | ||
4521 | 70 | } | ||
4522 | 71 | |||
4523 | 58 | // See if there are any plugins | 72 | // See if there are any plugins |
4524 | 59 | $plugins = forum_list_plugins($is_admin); | 73 | $plugins = forum_list_plugins($is_admin); |
4525 | 60 | 74 | ||
4526 | @@ -121,7 +135,7 @@ | |||
4527 | 121 | // Delete topics | 135 | // Delete topics |
4528 | 122 | $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error()); | 136 | $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error()); |
4529 | 123 | // Delete subscriptions | 137 | // Delete subscriptions |
4531 | 124 | $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error()); | 138 | $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error()); |
4532 | 125 | // Delete posts | 139 | // Delete posts |
4533 | 126 | $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error()); | 140 | $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error()); |
4534 | 127 | 141 | ||
4535 | 128 | 142 | ||
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 | 1 | <?php | 1 | <?php |
4541 | 2 | 2 | ||
4542 | 3 | /** | 3 | /** |
4544 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4545 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4546 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4547 | 7 | */ | 7 | */ |
4548 | 8 | 8 | ||
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 | 1 | <?php | 1 | <?php |
4554 | 2 | 2 | ||
4555 | 3 | /** | 3 | /** |
4557 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4558 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4559 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4560 | 7 | */ | 7 | */ |
4561 | @@ -230,7 +230,7 @@ | |||
4562 | 230 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); | 230 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4563 | 231 | while ($cur_index = $this->fetch_assoc($result)) | 231 | while ($cur_index = $this->fetch_assoc($result)) |
4564 | 232 | { | 232 | { |
4566 | 233 | if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) | 233 | if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4567 | 234 | { | 234 | { |
4568 | 235 | $exists = true; | 235 | $exists = true; |
4569 | 236 | break; | 236 | break; |
4570 | @@ -301,6 +301,16 @@ | |||
4571 | 301 | } | 301 | } |
4572 | 302 | 302 | ||
4573 | 303 | 303 | ||
4574 | 304 | function rename_table($old_table, $new_table, $no_prefix = false) | ||
4575 | 305 | { | ||
4576 | 306 | // If there new table exists and the old one doesn't, then we're happy | ||
4577 | 307 | if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) | ||
4578 | 308 | return true; | ||
4579 | 309 | |||
4580 | 310 | return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; | ||
4581 | 311 | } | ||
4582 | 312 | |||
4583 | 313 | |||
4584 | 304 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) | 314 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4585 | 305 | { | 315 | { |
4586 | 306 | if ($this->field_exists($table_name, $field_name, $no_prefix)) | 316 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4587 | 307 | 317 | ||
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 | 1 | <?php | 1 | <?php |
4593 | 2 | 2 | ||
4594 | 3 | /** | 3 | /** |
4596 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4597 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4598 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4599 | 7 | */ | 7 | */ |
4600 | @@ -244,7 +244,7 @@ | |||
4601 | 244 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); | 244 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4602 | 245 | while ($cur_index = $this->fetch_assoc($result)) | 245 | while ($cur_index = $this->fetch_assoc($result)) |
4603 | 246 | { | 246 | { |
4605 | 247 | if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) | 247 | if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4606 | 248 | { | 248 | { |
4607 | 249 | $exists = true; | 249 | $exists = true; |
4608 | 250 | break; | 250 | break; |
4609 | @@ -315,6 +315,16 @@ | |||
4610 | 315 | } | 315 | } |
4611 | 316 | 316 | ||
4612 | 317 | 317 | ||
4613 | 318 | function rename_table($old_table, $new_table, $no_prefix = false) | ||
4614 | 319 | { | ||
4615 | 320 | // If there new table exists and the old one doesn't, then we're happy | ||
4616 | 321 | if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) | ||
4617 | 322 | return true; | ||
4618 | 323 | |||
4619 | 324 | return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; | ||
4620 | 325 | } | ||
4621 | 326 | |||
4622 | 327 | |||
4623 | 318 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) | 328 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4624 | 319 | { | 329 | { |
4625 | 320 | if ($this->field_exists($table_name, $field_name, $no_prefix)) | 330 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4626 | 321 | 331 | ||
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 | 1 | <?php | 1 | <?php |
4632 | 2 | 2 | ||
4633 | 3 | /** | 3 | /** |
4635 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4636 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4637 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4638 | 7 | */ | 7 | */ |
4639 | @@ -237,7 +237,7 @@ | |||
4640 | 237 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); | 237 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4641 | 238 | while ($cur_index = $this->fetch_assoc($result)) | 238 | while ($cur_index = $this->fetch_assoc($result)) |
4642 | 239 | { | 239 | { |
4644 | 240 | if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) | 240 | if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4645 | 241 | { | 241 | { |
4646 | 242 | $exists = true; | 242 | $exists = true; |
4647 | 243 | break; | 243 | break; |
4648 | @@ -308,6 +308,16 @@ | |||
4649 | 308 | } | 308 | } |
4650 | 309 | 309 | ||
4651 | 310 | 310 | ||
4652 | 311 | function rename_table($old_table, $new_table, $no_prefix = false) | ||
4653 | 312 | { | ||
4654 | 313 | // If there new table exists and the old one doesn't, then we're happy | ||
4655 | 314 | if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) | ||
4656 | 315 | return true; | ||
4657 | 316 | |||
4658 | 317 | return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; | ||
4659 | 318 | } | ||
4660 | 319 | |||
4661 | 320 | |||
4662 | 311 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) | 321 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4663 | 312 | { | 322 | { |
4664 | 313 | if ($this->field_exists($table_name, $field_name, $no_prefix)) | 323 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4665 | 314 | 324 | ||
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 | 1 | <?php | 1 | <?php |
4671 | 2 | 2 | ||
4672 | 3 | /** | 3 | /** |
4674 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4675 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4676 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4677 | 7 | */ | 7 | */ |
4678 | @@ -250,7 +250,7 @@ | |||
4679 | 250 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); | 250 | $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
4680 | 251 | while ($cur_index = $this->fetch_assoc($result)) | 251 | while ($cur_index = $this->fetch_assoc($result)) |
4681 | 252 | { | 252 | { |
4683 | 253 | if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) | 253 | if (strtolower($cur_index['Key_name']) == strtolower(($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)) |
4684 | 254 | { | 254 | { |
4685 | 255 | $exists = true; | 255 | $exists = true; |
4686 | 256 | break; | 256 | break; |
4687 | @@ -321,6 +321,16 @@ | |||
4688 | 321 | } | 321 | } |
4689 | 322 | 322 | ||
4690 | 323 | 323 | ||
4691 | 324 | function rename_table($old_table, $new_table, $no_prefix = false) | ||
4692 | 325 | { | ||
4693 | 326 | // If there new table exists and the old one doesn't, then we're happy | ||
4694 | 327 | if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) | ||
4695 | 328 | return true; | ||
4696 | 329 | |||
4697 | 330 | return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; | ||
4698 | 331 | } | ||
4699 | 332 | |||
4700 | 333 | |||
4701 | 324 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) | 334 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4702 | 325 | { | 335 | { |
4703 | 326 | if ($this->field_exists($table_name, $field_name, $no_prefix)) | 336 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4704 | 327 | 337 | ||
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 | 1 | <?php | 1 | <?php |
4710 | 2 | 2 | ||
4711 | 3 | /** | 3 | /** |
4713 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4714 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4715 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4716 | 7 | */ | 7 | */ |
4717 | @@ -352,6 +352,16 @@ | |||
4718 | 352 | } | 352 | } |
4719 | 353 | 353 | ||
4720 | 354 | 354 | ||
4721 | 355 | function rename_table($old_table, $new_table, $no_prefix = false) | ||
4722 | 356 | { | ||
4723 | 357 | // If there new table exists and the old one doesn't, then we're happy | ||
4724 | 358 | if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) | ||
4725 | 359 | return true; | ||
4726 | 360 | |||
4727 | 361 | return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$old_table.' RENAME TO '.($no_prefix ? '' : $this->prefix).$new_table) ? true : false; | ||
4728 | 362 | } | ||
4729 | 363 | |||
4730 | 364 | |||
4731 | 355 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) | 365 | function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
4732 | 356 | { | 366 | { |
4733 | 357 | if ($this->field_exists($table_name, $field_name, $no_prefix)) | 367 | if ($this->field_exists($table_name, $field_name, $no_prefix)) |
4734 | 358 | 368 | ||
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 | 1 | <?php | 1 | <?php |
4740 | 2 | 2 | ||
4741 | 3 | /** | 3 | /** |
4743 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4744 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4745 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4746 | 7 | */ | 7 | */ |
4747 | @@ -182,7 +182,7 @@ | |||
4748 | 182 | 182 | ||
4749 | 183 | function affected_rows() | 183 | function affected_rows() |
4750 | 184 | { | 184 | { |
4752 | 185 | return ($this->query_result) ? @sqlite_changes($this->query_result) : false; | 185 | return ($this->link_id) ? @sqlite_changes($this->link_id) : false; |
4753 | 186 | } | 186 | } |
4754 | 187 | 187 | ||
4755 | 188 | 188 | ||
4756 | @@ -349,6 +349,35 @@ | |||
4757 | 349 | } | 349 | } |
4758 | 350 | 350 | ||
4759 | 351 | 351 | ||
4760 | 352 | function rename_table($old_name, $new_name, $no_prefix = false) | ||
4761 | 353 | { | ||
4762 | 354 | // If there new table exists and the old one doesn't, then we're happy | ||
4763 | 355 | if ($this->table_exists($new_table, $no_prefix) && !$this->table_exists($old_table, $no_prefix)) | ||
4764 | 356 | return true; | ||
4765 | 357 | |||
4766 | 358 | $table = $this->get_table_info($old_name, $no_prefix); | ||
4767 | 359 | |||
4768 | 360 | // Create new table | ||
4769 | 361 | $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 | 362 | $result = $this->query($newtable) ? true : false; | ||
4771 | 363 | |||
4772 | 364 | // Recreate indexes | ||
4773 | 365 | if (!empty($table['indices'])) | ||
4774 | 366 | { | ||
4775 | 367 | foreach ($table['indices'] as $cur_index) | ||
4776 | 368 | $result &= $this->query($cur_index) ? true : false; | ||
4777 | 369 | } | ||
4778 | 370 | |||
4779 | 371 | // Copy content across | ||
4780 | 372 | $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 | 373 | |||
4782 | 374 | // Drop old table | ||
4783 | 375 | $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name)); | ||
4784 | 376 | |||
4785 | 377 | return $result; | ||
4786 | 378 | } | ||
4787 | 379 | |||
4788 | 380 | |||
4789 | 352 | function get_table_info($table_name, $no_prefix = false) | 381 | function get_table_info($table_name, $no_prefix = false) |
4790 | 353 | { | 382 | { |
4791 | 354 | // Grab table info | 383 | // Grab table info |
4792 | 355 | 384 | ||
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 | 1 | <?php | 1 | <?php |
4798 | 2 | 2 | ||
4799 | 3 | /** | 3 | /** |
4801 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4802 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4803 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4804 | 7 | */ | 7 | */ |
4805 | @@ -10,6 +10,7 @@ | |||
4806 | 10 | if (!defined('PUN')) | 10 | if (!defined('PUN')) |
4807 | 11 | exit; | 11 | exit; |
4808 | 12 | 12 | ||
4809 | 13 | require PUN_ROOT.'include/utf8/utils/ascii.php'; | ||
4810 | 13 | 14 | ||
4811 | 14 | // | 15 | // |
4812 | 15 | // Validate an email address | 16 | // Validate an email address |
4813 | @@ -43,6 +44,18 @@ | |||
4814 | 43 | 44 | ||
4815 | 44 | 45 | ||
4816 | 45 | // | 46 | // |
4817 | 47 | // Only encode with base64, if there is at least one unicode character in the string | ||
4818 | 48 | // | ||
4819 | 49 | function encode_mail_text($str) | ||
4820 | 50 | { | ||
4821 | 51 | if (utf8_is_ascii($str)) | ||
4822 | 52 | return $str; | ||
4823 | 53 | |||
4824 | 54 | return '=?UTF-8?B?'.base64_encode($str).'?='; | ||
4825 | 55 | } | ||
4826 | 56 | |||
4827 | 57 | |||
4828 | 58 | // | ||
4829 | 46 | // Wrapper for PHP's mail() | 59 | // Wrapper for PHP's mail() |
4830 | 47 | // | 60 | // |
4831 | 48 | function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '') | 61 | function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '') |
4832 | @@ -62,15 +75,15 @@ | |||
4833 | 62 | $reply_to_name = pun_trim(preg_replace('#[\n\r:]+#s', '', str_replace('"', '', $reply_to_name))); | 75 | $reply_to_name = pun_trim(preg_replace('#[\n\r:]+#s', '', str_replace('"', '', $reply_to_name))); |
4834 | 63 | 76 | ||
4835 | 64 | // Set up some headers to take advantage of UTF-8 | 77 | // Set up some headers to take advantage of UTF-8 |
4838 | 65 | $from = "=?UTF-8?B?".base64_encode($from_name)."?=".' <'.$from_email.'>'; | 78 | $from = encode_mail_text($from_name).' <'.$from_email.'>'; |
4839 | 66 | $subject = "=?UTF-8?B?".base64_encode($subject)."?="; | 79 | $subject = encode_mail_text($subject); |
4840 | 67 | 80 | ||
4841 | 68 | $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'; | 81 | $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 | 69 | 82 | ||
4843 | 70 | // If we specified a reply-to email, we deal with it here | 83 | // If we specified a reply-to email, we deal with it here |
4844 | 71 | if (!empty($reply_to_email)) | 84 | if (!empty($reply_to_email)) |
4845 | 72 | { | 85 | { |
4847 | 73 | $reply_to = "=?UTF-8?B?".base64_encode($reply_to_name)."?=".' <'.$reply_to_email.'>'; | 86 | $reply_to = encode_mail_text($reply_to_name).' <'.$reply_to_email.'>'; |
4848 | 74 | 87 | ||
4849 | 75 | $headers .= "\r\n".'Reply-To: '.$reply_to; | 88 | $headers .= "\r\n".'Reply-To: '.$reply_to; |
4850 | 76 | } | 89 | } |
4851 | 77 | 90 | ||
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 | 1 | <?php | 1 | <?php |
4857 | 2 | 2 | ||
4858 | 3 | /** | 3 | /** |
4860 | 4 | * Copyright (C) 2008-2010 FluxBB | 4 | * Copyright (C) 2008-2011 FluxBB |
4861 | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
4862 | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
4863 | 7 | */ | 7 | */ |
4864 | @@ -25,31 +25,46 @@ | |||
4865 | 25 | 25 | ||
4866 | 26 | $now = time(); | 26 | $now = time(); |
4867 | 27 | 27 | ||
4877 | 28 | // We assume it's a guest | 28 | // If the cookie is set and it matches the correct pattern, then read the values from it |
4878 | 29 | $cookie = array('user_id' => 1, 'password_hash' => 'Guest'); | 29 | if (isset($_COOKIE[$cookie_name]) && preg_match('/^(\d+)\|([0-9a-fA-F]+)\|(\d+)\|([0-9a-fA-F]+)$/', $_COOKIE[$cookie_name], $matches)) |
4879 | 30 | 30 | { | |
4880 | 31 | // If a cookie is set, we get the user_id and password hash from it | 31 | $cookie = array( |
4881 | 32 | if (isset($_COOKIE[$cookie_name])) | 32 | 'user_id' => intval($matches[1]), |
4882 | 33 | list($cookie['user_id'], $cookie['password_hash'], $cookie['expiration_time']) = @unserialize($_COOKIE[$cookie_name]); | 33 | 'password_hash' => $matches[2], |
4883 | 34 | 34 | 'expiration_time' => intval($matches[3]), | |
4884 | 35 | if ($cookie['user_id'] > 1) | 35 | 'cookie_hash' => $matches[4], |
4885 | 36 | { | 36 | ); |
4886 | 37 | } | ||
4887 | 38 | |||
4888 | 39 | // If it has a non-guest user, and hasn't expired | ||
4889 | 40 | if (isset($cookie) && $cookie['user_id'] > 1 && $cookie['expiration_time'] > $now) | ||
4890 | 41 | { | ||
4891 | 42 | // If the cookie has been tampered with | ||
4892 | 43 | if (forum_hmac($cookie['user_id'].'|'.$cookie['expiration_time'], $cookie_seed.'_cookie_hash') != $cookie['cookie_hash']) | ||
4893 | 44 | { | ||
4894 | 45 | $expire = $now + 31536000; // The cookie expires after a year | ||
4895 | 46 | pun_setcookie(1, pun_hash(uniqid(rand(), true)), $expire); | ||
4896 | 47 | set_default_user(); | ||
4897 | 48 | |||
4898 | 49 | return; | ||
4899 | 50 | } | ||
4900 | 51 | |||
4901 | 37 | // Check if there's a user with the user ID and password hash from the cookie | 52 | // Check if there's a user with the user ID and password hash from the cookie |
4902 | 38 | $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()); | 53 | $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 | 39 | $pun_user = $db->fetch_assoc($result); | 54 | $pun_user = $db->fetch_assoc($result); |
4904 | 40 | 55 | ||
4905 | 41 | // If user authorisation failed | 56 | // If user authorisation failed |
4907 | 42 | if (!isset($pun_user['id']) || md5($cookie_seed.$pun_user['password']) !== $cookie['password_hash']) | 57 | if (!isset($pun_user['id']) || forum_hmac($pun_user['password'], $cookie_seed.'_password_hash') !== $cookie['password_hash']) |
4908 | 43 | { | 58 | { |
4909 | 44 | $expire = $now + 31536000; // The cookie expires after a year | 59 | $expire = $now + 31536000; // The cookie expires after a year |
4911 | 45 | pun_setcookie(1, md5(uniqid(rand(), true)), $expire); | 60 | pun_setcookie(1, pun_hash(uniqid(rand(), true)), $expire); |
4912 | 46 | set_default_user(); | 61 | set_default_user(); |
4913 | 47 | 62 | ||
4914 | 48 | return; | 63 | return; |
4915 | 49 | } | 64 | } |
4916 | 50 | 65 | ||
4917 | 51 | // Send a new, updated cookie with a new expiration timestamp | 66 | // Send a new, updated cookie with a new expiration timestamp |
4919 | 52 | $expire = (intval($cookie['expiration_time']) > $now + $pun_config['o_timeout_visit']) ? $now + 1209600 : $now + $pun_config['o_timeout_visit']; | 67 | $expire = ($cookie['expiration_time'] > $now + $pun_config['o_timeout_visit']) ? $now + 1209600 : $now + $pun_config['o_timeout_visit']; |
4920 | 53 | pun_setcookie($pun_user['id'], $pun_user['password'], $expire); | 68 | pun_setcookie($pun_user['id'], $pun_user['password'], $expire); |
4921 | 54 | 69 | ||
4922 | 55 | // Set a default language if the user selected language no longer exists | 70 | // Set a default language if the user selected language no longer exists |
4923 | @@ -159,10 +174,10 @@ | |||
4924 | 159 | // | 174 | // |
4925 | 160 | function get_current_url($max_length = 0) | 175 | function get_current_url($max_length = 0) |
4926 | 161 | { | 176 | { |
4929 | 162 | $protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? 'http://' : 'https://'; | 177 | $protocol = get_current_protocol(); |
4930 | 163 | $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'] : ''; | 178 | $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 | 164 | 179 | ||
4933 | 165 | $url = urldecode($protocol.$_SERVER['HTTP_HOST'].$port.$_SERVER['REQUEST_URI']); | 180 | $url = urldecode($protocol.'://'.$_SERVER['HTTP_HOST'].$port.$_SERVER['REQUEST_URI']); |
4934 | 166 | 181 | ||
4935 | 167 | if (strlen($url) <= $max_length || $max_length == 0) | 182 | if (strlen($url) <= $max_length || $max_length == 0) |
4936 | 168 | return $url; | 183 | return $url; |
4937 | @@ -173,6 +188,53 @@ | |||
4938 | 173 | 188 | ||
4939 | 174 | 189 | ||
4940 | 175 | // | 190 | // |
4941 | 191 | // Fetch the current protocol in use - http or https | ||
4942 | 192 | // | ||
4943 | 193 | function get_current_protocol() | ||
4944 | 194 | { | ||
4945 | 195 | $protocol = 'http'; | ||
4946 | 196 | |||
4947 | 197 | // Check if the server is claiming to using HTTPS | ||
4948 | 198 | if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') | ||
4949 | 199 | $protocol = 'https'; | ||
4950 | 200 | |||
4951 | 201 | // If we are behind a reverse proxy try to decide which protocol it is using | ||
4952 | 202 | if (defined('FORUM_BEHIND_REVERSE_PROXY')) | ||
4953 | 203 | { | ||
4954 | 204 | // Check if we are behind a Microsoft based reverse proxy | ||
4955 | 205 | if (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) != 'off') | ||
4956 | 206 | $protocol = 'https'; | ||
4957 | 207 | |||
4958 | 208 | // Check if we're behind a "proper" reverse proxy, and what protocol it's using | ||
4959 | 209 | if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) | ||
4960 | 210 | $protocol = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']); | ||
4961 | 211 | } | ||
4962 | 212 | |||
4963 | 213 | return $protocol; | ||
4964 | 214 | } | ||
4965 | 215 | |||
4966 | 216 | // | ||
4967 | 217 | // Fetch the base_url, optionally support HTTPS and HTTP | ||
4968 | 218 | // | ||
4969 | 219 | function get_base_url($support_https = false) | ||
4970 | 220 | { | ||
4971 | 221 | global $pun_config; | ||
4972 | 222 | static $base_url; | ||
4973 | 223 | |||
4974 | 224 | if (!$support_https) | ||
4975 | 225 | return $pun_config['o_base_url']; | ||
4976 | 226 | |||
4977 | 227 | if (!isset($base_url)) | ||
4978 | 228 | { | ||
4979 | 229 | // Make sure we are using the correct protocol | ||
4980 | 230 | $base_url = str_replace(array('http://', 'https://'), get_current_protocol().'://', $pun_config['o_base_url']); | ||
4981 | 231 | } | ||
4982 | 232 | |||
4983 | 233 | return $base_url; | ||
4984 | 234 | } | ||
4985 | 235 | |||
4986 | 236 | |||
4987 | 237 | // | ||
4988 | 176 | // Fill $pun_user with default values (for guests) | 238 | // Fill $pun_user with default values (for guests) |
4989 | 177 | // | 239 | // |
4990 | 178 | function set_default_user() | 240 | function set_default_user() |
4991 | @@ -224,6 +286,41 @@ | |||
4992 | 224 | 286 | ||
4993 | 225 | 287 | ||
4994 | 226 | // | 288 | // |
4995 | 289 | // SHA1 HMAC with PHP 4 fallback | ||
4996 | 290 | // | ||
4997 | 291 | function forum_hmac($data, $key, $raw_output = false) | ||
4998 | 292 | { | ||
4999 | 293 | if (function_exists('hash_hmac')) | ||
5000 | 294 | 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."