a/admin_groups.php |
b/admin_groups.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
9: // Tell header.php to use the admin template | 9: // Tell header.php to use the admin template |
10: define('PUN_ADMIN_CONSOLE', 1); | 10: define('PUN_ADMIN_CONSOLE', 1); |
11: | 11: |
12: define('PUN_ROOT', './'); | 12: define('PUN_ROOT', dirname(__FILE__).'/'); |
13: require PUN_ROOT.'include/common.php'; | 13: require PUN_ROOT.'include/common.php'; |
14: require PUN_ROOT.'include/common_admin.php'; | 14: require PUN_ROOT.'include/common_admin.php'; |
15: | 15: |
16: | 16: |
17: if ($pun_user['g_id'] != PUN_ADMIN) | 17: if ($pun_user['g_id'] != PUN_ADMIN) |
18: message($lang_common['No permission']); | 18: message($lang_common['No permission'], false, '403 Forbidden'); |
19: | 19: |
20: // Load the admin_censoring.php language file | 20: // Load the admin_censoring.php language file |
21: require PUN_ROOT.'lang/'.$admin_language.'/admin_groups.php'; | 21: require PUN_ROOT.'lang/'.$admin_language.'/admin_groups.php'; |
101: <tr> | 101: <tr> |
102: <th scope="row"><?php echo $lang_admin_groups['Rename users label'] ?></th> | 102: <th scope="row"><?php echo $lang_admin_groups['Rename users label'] ?></th> |
103: <td> | 103: <td> |
104: <input type="radio" name="mod_rename_users" value="1"<?php if ($group['g_mod_rename_users'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_rename_users" value="0"<?php if ($group['g_mod_rename_users'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 104: <input type="radio" name="mod_rename_users" value="1"<?php if ($group['g_mod_rename_users'] == '1') echo ' checked="checked"' ?> tabindex="7" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_rename_users" value="0"<?php if ($group['g_mod_rename_users'] == '0') echo ' checked="checked"' ?> tabindex="8" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
105: <span><?php echo $lang_admin_groups['Rename users help'] ?></span> | 105: <span><?php echo $lang_admin_groups['Rename users help'] ?></span> |
106: </td> | 106: </td> |
107: </tr> | 107: </tr> |
108: <tr> | 108: <tr> |
109: <th scope="row"><?php echo $lang_admin_groups['Change passwords label'] ?></th> | 109: <th scope="row"><?php echo $lang_admin_groups['Change passwords label'] ?></th> |
110: <td> | 110: <td> |
111: <input type="radio" name="mod_change_passwords" value="1"<?php if ($group['g_mod_change_passwords'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_change_passwords" value="0"<?php if ($group['g_mod_change_passwords'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 111: <input type="radio" name="mod_change_passwords" value="1"<?php if ($group['g_mod_change_passwords'] == '1') echo ' checked="checked"' ?> tabindex="9" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_change_passwords" value="0"<?php if ($group['g_mod_change_passwords'] == '0') echo ' checked="checked"' ?> tabindex="10" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
112: <span><?php echo $lang_admin_groups['Change passwords help'] ?></span> | 112: <span><?php echo $lang_admin_groups['Change passwords help'] ?></span> |
113: </td> | 113: </td> |
114: </tr> | 114: </tr> |
115: <tr> | 115: <tr> |
116: <th scope="row"><?php echo $lang_admin_groups['Ban users label'] ?></th> | 116: <th scope="row"><?php echo $lang_admin_groups['Ban users label'] ?></th> |
117: <td> | 117: <td> |
118: <input type="radio" name="mod_ban_users" value="1"<?php if ($group['g_mod_ban_users'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_ban_users" value="0"<?php if ($group['g_mod_ban_users'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 118: <input type="radio" name="mod_ban_users" value="1"<?php if ($group['g_mod_ban_users'] == '1') echo ' checked="checked"' ?> tabindex="11" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="mod_ban_users" value="0"<?php if ($group['g_mod_ban_users'] == '0') echo ' checked="checked"' ?> tabindex="12" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
119: <span><?php echo $lang_admin_groups['Ban users help'] ?></span> | 119: <span><?php echo $lang_admin_groups['Ban users help'] ?></span> |
120: </td> | 120: </td> |
121: </tr> | 121: </tr> |
122: <?php endif; endif; ?> <tr> | 122: <?php endif; endif; ?> <tr> |
123: <th scope="row"><?php echo $lang_admin_groups['Read board label'] ?></th> | 123: <th scope="row"><?php echo $lang_admin_groups['Read board label'] ?></th> |
124: <td> | 124: <td> |
125: <input type="radio" name="read_board" value="1"<?php if ($group['g_read_board'] == '1') echo ' checked="checked"' ?> tabindex="3" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="read_board" value="0"<?php if ($group['g_read_board'] == '0') echo ' checked="checked"' ?> tabindex="4" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 125: <input type="radio" name="read_board" value="1"<?php if ($group['g_read_board'] == '1') echo ' checked="checked"' ?> tabindex="13" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="read_board" value="0"<?php if ($group['g_read_board'] == '0') echo ' checked="checked"' ?> tabindex="14" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
126: <span><?php echo $lang_admin_groups['Read board help'] ?></span> | 126: <span><?php echo $lang_admin_groups['Read board help'] ?></span> |
127: </td> | 127: </td> |
128: </tr> | 128: </tr> |
129: <tr> | 129: <tr> |
130: <th scope="row"><?php echo $lang_admin_groups['View user info label'] ?></th> | 130: <th scope="row"><?php echo $lang_admin_groups['View user info label'] ?></th> |
131: <td> | 131: <td> |
132: <input type="radio" name="view_users" value="1"<?php if ($group['g_view_users'] == '1') echo ' checked="checked"' ?> tabindex="3" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="view_users" value="0"<?php if ($group['g_view_users'] == '0') echo ' checked="checked"' ?> tabindex="4" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 132: <input type="radio" name="view_users" value="1"<?php if ($group['g_view_users'] == '1') echo ' checked="checked"' ?> tabindex="15" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="view_users" value="0"<?php if ($group['g_view_users'] == '0') echo ' checked="checked"' ?> tabindex="16" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
133: <span><?php echo $lang_admin_groups['View user info help'] ?></span> | 133: <span><?php echo $lang_admin_groups['View user info help'] ?></span> |
134: </td> | 134: </td> |
135: </tr> | 135: </tr> |
136: <tr> | 136: <tr> |
137: <th scope="row"><?php echo $lang_admin_groups['Post replies label'] ?></th> | 137: <th scope="row"><?php echo $lang_admin_groups['Post replies label'] ?></th> |
138: <td> | 138: <td> |
139: <input type="radio" name="post_replies" value="1"<?php if ($group['g_post_replies'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="post_replies" value="0"<?php if ($group['g_post_replies'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 139: <input type="radio" name="post_replies" value="1"<?php if ($group['g_post_replies'] == '1') echo ' checked="checked"' ?> tabindex="17" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="post_replies" value="0"<?php if ($group['g_post_replies'] == '0') echo ' checked="checked"' ?> tabindex="18" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
140: <span><?php echo $lang_admin_groups['Post replies help'] ?></span> | 140: <span><?php echo $lang_admin_groups['Post replies help'] ?></span> |
141: </td> | 141: </td> |
142: </tr> | 142: </tr> |
143: <tr> | 143: <tr> |
144: <th scope="row"><?php echo $lang_admin_groups['Post topics label'] ?></th> | 144: <th scope="row"><?php echo $lang_admin_groups['Post topics label'] ?></th> |
145: <td> | 145: <td> |
146: <input type="radio" name="post_topics" value="1"<?php if ($group['g_post_topics'] == '1') echo ' checked="checked"' ?> tabindex="7" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="post_topics" value="0"<?php if ($group['g_post_topics'] == '0') echo ' checked="checked"' ?> tabindex="8" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 146: <input type="radio" name="post_topics" value="1"<?php if ($group['g_post_topics'] == '1') echo ' checked="checked"' ?> tabindex="19" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="post_topics" value="0"<?php if ($group['g_post_topics'] == '0') echo ' checked="checked"' ?> tabindex="20" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
147: <span><?php echo $lang_admin_groups['Post topics help'] ?></span> | 147: <span><?php echo $lang_admin_groups['Post topics help'] ?></span> |
148: </td> | 148: </td> |
149: </tr> | 149: </tr> |
150: <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> | 150: <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> |
151: <th scope="row"><?php echo $lang_admin_groups['Edit posts label'] ?></th> | 151: <th scope="row"><?php echo $lang_admin_groups['Edit posts label'] ?></th> |
152: <td> | 152: <td> |
153: <input type="radio" name="edit_posts" value="1"<?php if ($group['g_edit_posts'] == '1') echo ' checked="checked"' ?> tabindex="11" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="edit_posts" value="0"<?php if ($group['g_edit_posts'] == '0') echo ' checked="checked"' ?> tabindex="12" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 153: <input type="radio" name="edit_posts" value="1"<?php if ($group['g_edit_posts'] == '1') echo ' checked="checked"' ?> tabindex="21" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="edit_posts" value="0"<?php if ($group['g_edit_posts'] == '0') echo ' checked="checked"' ?> tabindex="22" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
154: <span><?php echo $lang_admin_groups['Edit posts help'] ?></span> | 154: <span><?php echo $lang_admin_groups['Edit posts help'] ?></span> |
155: </td> | 155: </td> |
156: </tr> | 156: </tr> |
157: <tr> | 157: <tr> |
158: <th scope="row"><?php echo $lang_admin_groups['Delete posts label'] ?></th> | 158: <th scope="row"><?php echo $lang_admin_groups['Delete posts label'] ?></th> |
159: <td> | 159: <td> |
160: <input type="radio" name="delete_posts" value="1"<?php if ($group['g_delete_posts'] == '1') echo ' checked="checked"' ?> tabindex="13" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="delete_posts" value="0"<?php if ($group['g_delete_posts'] == '0') echo ' checked="checked"' ?> tabindex="14" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 160: <input type="radio" name="delete_posts" value="1"<?php if ($group['g_delete_posts'] == '1') echo ' checked="checked"' ?> tabindex="23" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="delete_posts" value="0"<?php if ($group['g_delete_posts'] == '0') echo ' checked="checked"' ?> tabindex="24" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
161: <span><?php echo $lang_admin_groups['Delete posts help'] ?></span> | 161: <span><?php echo $lang_admin_groups['Delete posts help'] ?></span> |
162: </td> | 162: </td> |
163: </tr> | 163: </tr> |
164: <tr> | 164: <tr> |
165: <th scope="row"><?php echo $lang_admin_groups['Delete topics label'] ?></th> | 165: <th scope="row"><?php echo $lang_admin_groups['Delete topics label'] ?></th> |
166: <td> | 166: <td> |
167: <input type="radio" name="delete_topics" value="1"<?php if ($group['g_delete_topics'] == '1') echo ' checked="checked"' ?> tabindex="15" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="delete_topics" value="0"<?php if ($group['g_delete_topics'] == '0') echo ' checked="checked"' ?> tabindex="16" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 167: <input type="radio" name="delete_topics" value="1"<?php if ($group['g_delete_topics'] == '1') echo ' checked="checked"' ?> tabindex="25" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="delete_topics" value="0"<?php if ($group['g_delete_topics'] == '0') echo ' checked="checked"' ?> tabindex="26" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
168: <span><?php echo $lang_admin_groups['Delete topics help'] ?></span> | 168: <span><?php echo $lang_admin_groups['Delete topics help'] ?></span> |
169: </td> | 169: </td> |
170: </tr> | 170: </tr> |
171: <tr> | 171: <tr> |
172: <th scope="row"><?php echo $lang_admin_groups['Set own title label'] ?></th> | 172: <th scope="row"><?php echo $lang_admin_groups['Set own title label'] ?></th> |
173: <td> | 173: <td> |
174: <input type="radio" name="set_title" value="1"<?php if ($group['g_set_title'] == '1') echo ' checked="checked"' ?> tabindex="17" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="set_title" value="0"<?php if ($group['g_set_title'] == '0') echo ' checked="checked"' ?> tabindex="18" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 174: <input type="radio" name="set_title" value="1"<?php if ($group['g_set_title'] == '1') echo ' checked="checked"' ?> tabindex="27" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="set_title" value="0"<?php if ($group['g_set_title'] == '0') echo ' checked="checked"' ?> tabindex="28" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
175: <span><?php echo $lang_admin_groups['Set own title help'] ?></span> | 175: <span><?php echo $lang_admin_groups['Set own title help'] ?></span> |
176: </td> | 176: </td> |
177: </tr> | 177: </tr> |
178: <?php endif; ?> <tr> | 178: <?php endif; ?> <tr> |
179: <th scope="row"><?php echo $lang_admin_groups['User search label'] ?></th> | 179: <th scope="row"><?php echo $lang_admin_groups['User search label'] ?></th> |
180: <td> | 180: <td> |
181: <input type="radio" name="search" value="1"<?php if ($group['g_search'] == '1') echo ' checked="checked"' ?> tabindex="19" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="search" value="0"<?php if ($group['g_search'] == '0') echo ' checked="checked"' ?> tabindex="20" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 181: <input type="radio" name="search" value="1"<?php if ($group['g_search'] == '1') echo ' checked="checked"' ?> tabindex="29" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="search" value="0"<?php if ($group['g_search'] == '0') echo ' checked="checked"' ?> tabindex="30" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
182: <span><?php echo $lang_admin_groups['User search help'] ?></span> | 182: <span><?php echo $lang_admin_groups['User search help'] ?></span> |
183: </td> | 183: </td> |
184: </tr> | 184: </tr> |
185: <tr> | 185: <tr> |
186: <th scope="row"><?php echo $lang_admin_groups['User list search label'] ?></th> | 186: <th scope="row"><?php echo $lang_admin_groups['User list search label'] ?></th> |
187: <td> | 187: <td> |
188: <input type="radio" name="search_users" value="1"<?php if ($group['g_search_users'] == '1') echo ' checked="checked"' ?> tabindex="21" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="search_users" value="0"<?php if ($group['g_search_users'] == '0') echo ' checked="checked"' ?> tabindex="22" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 188: <input type="radio" name="search_users" value="1"<?php if ($group['g_search_users'] == '1') echo ' checked="checked"' ?> tabindex="31" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="search_users" value="0"<?php if ($group['g_search_users'] == '0') echo ' checked="checked"' ?> tabindex="32" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
189: <span><?php echo $lang_admin_groups['User list search help'] ?></span> | 189: <span><?php echo $lang_admin_groups['User list search help'] ?></span> |
190: </td> | 190: </td> |
191: </tr> | 191: </tr> |
192: <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> | 192: <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> |
193: <th scope="row"><?php echo $lang_admin_groups['Send e-mails label'] ?></th> | 193: <th scope="row"><?php echo $lang_admin_groups['Send e-mails label'] ?></th> |
194: <td> | 194: <td> |
195: <input type="radio" name="send_email" value="1"<?php if ($group['g_send_email'] == '1') echo ' checked="checked"' ?> tabindex="21" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="send_email" value="0"<?php if ($group['g_send_email'] == '0') echo ' checked="checked"' ?> tabindex="22" /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 195: <input type="radio" name="send_email" value="1"<?php if ($group['g_send_email'] == '1') echo ' checked="checked"' ?> tabindex="33" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="send_email" value="0"<?php if ($group['g_send_email'] == '0') echo ' checked="checked"' ?> tabindex="34" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
196: <span><?php echo $lang_admin_groups['Send e-mails help'] ?></span> | 196: <span><?php echo $lang_admin_groups['Send e-mails help'] ?></span> |
197: </td> | 197: </td> |
198: </tr> | 198: </tr> |
199: <?php endif; ?> <tr> | 199: <?php endif; ?> <tr> |
200: <th scope="row"><?php echo $lang_admin_groups['Post flood label'] ?></th> | 200: <th scope="row"><?php echo $lang_admin_groups['Post flood label'] ?></th> |
201: <td> | 201: <td> |
202: <input type="text" name="post_flood" size="5" maxlength="4" value="<?php echo $group['g_post_flood'] ?>" tabindex="24" /> | 202: <input type="text" name="post_flood" size="5" maxlength="4" value="<?php echo $group['g_post_flood'] ?>" tabindex="35" /> |
203: <span><?php echo $lang_admin_groups['Post flood help'] ?></span> | 203: <span><?php echo $lang_admin_groups['Post flood help'] ?></span> |
204: </td> | 204: </td> |
205: </tr> | 205: </tr> |
206: <tr> | 206: <tr> |
207: <th scope="row"><?php echo $lang_admin_groups['Search flood label'] ?></th> | 207: <th scope="row"><?php echo $lang_admin_groups['Search flood label'] ?></th> |
208: <td> | 208: <td> |
209: <input type="text" name="search_flood" size="5" maxlength="4" value="<?php echo $group['g_search_flood'] ?>" tabindex="25" /> | 209: <input type="text" name="search_flood" size="5" maxlength="4" value="<?php echo $group['g_search_flood'] ?>" tabindex="36" /> |
210: <span><?php echo $lang_admin_groups['Search flood help'] ?></span> | 210: <span><?php echo $lang_admin_groups['Search flood help'] ?></span> |
211: </td> | 211: </td> |
212: </tr> | 212: </tr> |
213: <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> | 213: <?php if ($group['g_id'] != PUN_GUEST): ?> <tr> |
214: <th scope="row"><?php echo $lang_admin_groups['E-mail flood label'] ?></th> | 214: <th scope="row"><?php echo $lang_admin_groups['E-mail flood label'] ?></th> |
215: <td> | 215: <td> |
216: <input type="text" name="email_flood" size="5" maxlength="4" value="<?php echo $group['g_email_flood'] ?>" tabindex="26" /> | 216: <input type="text" name="email_flood" size="5" maxlength="4" value="<?php echo $group['g_email_flood'] ?>" tabindex="37" /> |
217: <span><?php echo $lang_admin_groups['E-mail flood help'] ?></span> | 217: <span><?php echo $lang_admin_groups['E-mail flood help'] ?></span> |
218: </td> | 218: </td> |
219: </tr> | 219: </tr> |
| 220: <tr> |
| 221: <th scope="row"><?php echo $lang_admin_groups['Report flood label'] ?></th> |
| 222: <td> |
| 223: <input type="text" name="report_flood" size="5" maxlength="4" value="<?php echo $group['g_report_flood'] ?>" tabindex="38" /> |
| 224: <span><?php echo $lang_admin_groups['Report flood help'] ?></span> |
| 225: </td> |
| 226: </tr> |
220: <?php endif; endif; ?> </table> | 227: <?php endif; endif; ?> </table> |
221: <?php if ($group['g_moderator'] == '1' ): ?> <p class="warntext"><?php echo $lang_admin_groups['Moderator info'] ?></p> | 228: <?php if ($group['g_moderator'] == '1' ): ?> <p class="warntext"><?php echo $lang_admin_groups['Moderator info'] ?></p> |
222: <?php endif; ?> </div> | 229: <?php endif; ?> </div> |
223: </fieldset> | 230: </fieldset> |
224: </div> | 231: </div> |
225: <p class="submitend"><input type="submit" name="add_edit_group" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="26" /></p> | 232: <p class="submitend"><input type="submit" name="add_edit_group" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="39" /></p> |
226: </form> | 233: </form> |
227: </div> | 234: </div> |
228: </div> | 235: </div> |
260: $search = isset($_POST['search']) ? intval($_POST['search']) : '1'; | 267: $search = isset($_POST['search']) ? intval($_POST['search']) : '1'; |
261: $search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1'; | 268: $search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1'; |
262: $send_email = (isset($_POST['send_email']) && $_POST['send_email'] == '1') || $is_admin_group ? '1' : '0'; | 269: $send_email = (isset($_POST['send_email']) && $_POST['send_email'] == '1') || $is_admin_group ? '1' : '0'; |
263: $post_flood = isset($_POST['post_flood']) ? intval($_POST['post_flood']) : '0'; | 270: $post_flood = (isset($_POST['post_flood']) && $_POST['post_flood'] >= 0) ? intval($_POST['post_flood']) : '0'; |
264: $search_flood = isset($_POST['search_flood']) ? intval($_POST['search_flood']) : '0'; | 271: $search_flood = (isset($_POST['search_flood']) && $_POST['search_flood'] >= 0) ? intval($_POST['search_flood']) : '0'; |
265: $email_flood = isset($_POST['email_flood']) ? intval($_POST['email_flood']) : '0'; | 272: $email_flood = (isset($_POST['email_flood']) && $_POST['email_flood'] >= 0) ? intval($_POST['email_flood']) : '0'; |
| 273: $report_flood = (isset($_POST['report_flood']) && $_POST['report_flood'] >= 0) ? intval($_POST['report_flood']) : '0'; |
266: | 274: |
267: if ($title == '') | 275: if ($title == '') |
268: message($lang_admin_groups['Must enter title message']); | 276: message($lang_admin_groups['Must enter title message']); |
275: if ($db->num_rows($result)) | 283: if ($db->num_rows($result)) |
276: message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title))); | 284: message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title))); |
277: | 285: |
278: $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$moderator.', '.$mod_edit_users.', '.$mod_rename_users.', '.$mod_change_passwords.', '.$mod_ban_users.', '.$read_board.', '.$view_users.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$send_email.', '.$post_flood.', '.$search_flood.', '.$email_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error()); | 286: $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$moderator.', '.$mod_edit_users.', '.$mod_rename_users.', '.$mod_change_passwords.', '.$mod_ban_users.', '.$read_board.', '.$view_users.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$send_email.', '.$post_flood.', '.$search_flood.', '.$email_flood.', '.$report_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error()); |
279: $new_group_id = $db->insert_id(); | 287: $new_group_id = $db->insert_id(); |
280: | 288: |
281: // Now lets copy the forum specific permissions from the group which this group is based on | 289: // Now lets copy the forum specific permissions from the group which this group is based on |
289: if ($db->num_rows($result)) | 297: if ($db->num_rows($result)) |
290: message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title))); | 298: message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title))); |
291: | 299: |
292: $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_moderator='.$moderator.', g_mod_edit_users='.$mod_edit_users.', g_mod_rename_users='.$mod_rename_users.', g_mod_change_passwords='.$mod_change_passwords.', g_mod_ban_users='.$mod_ban_users.', g_read_board='.$read_board.', g_view_users='.$view_users.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_send_email='.$send_email.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.', g_email_flood='.$email_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error()); | 300: $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_moderator='.$moderator.', g_mod_edit_users='.$mod_edit_users.', g_mod_rename_users='.$mod_rename_users.', g_mod_change_passwords='.$mod_change_passwords.', g_mod_ban_users='.$mod_ban_users.', g_read_board='.$read_board.', g_view_users='.$view_users.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_send_email='.$send_email.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.', g_email_flood='.$email_flood.', g_report_flood='.$report_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error()); |
293: } | 301: } |
294: | 302: |
295: // Regenerate the quick jump cache | 303: // Regenerate the quick jump cache |
296: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | 304: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
297: require PUN_ROOT.'include/cache.php'; | 305: require PUN_ROOT.'include/cache.php'; |
298: | 306: |
299: generate_quickjump_cache(); | 307: $group_id = $_POST['mode'] == 'add' ? $new_group_id : intval($_POST['group_id']); |
| 308: generate_quickjump_cache($group_id); |
300: | 309: |
301: if ($_POST['mode'] == 'edit') | 310: if ($_POST['mode'] == 'edit') |
302: redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']); | 311: redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']); |
364: $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error()); | 373: $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.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); | 374: $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); |
366: | 375: |
367: // Regenerate the quick jump cache | |
368: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | |
369: require PUN_ROOT.'include/cache.php'; | |
370: | |
371: generate_quickjump_cache(); | |
372: | |
373: redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']); | 376: redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']); |
374: } | 377: } |
375: else | 378: else |
398: </div> | 401: </div> |
399: </fieldset> | 402: </fieldset> |
400: </div> | 403: </div> |
401: <p class="buttons"><input type="submit" name="del_group_comply" value="<?php echo $lang_admin_common['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> | 404: <p class="buttons"><input type="submit" name="del_group_comply" value="<?php echo $lang_admin_common['Delete'] ?>" tabindex="1" /><a href="javascript:history.go(-1)" tabindex="2"><?php echo $lang_admin_common['Go back'] ?></a></p> |
402: </form> | 405: </form> |
403: </div> | 406: </div> |
404: </div> | 407: </div> |
470: <div class="blockform"> | 473: <div class="blockform"> |
471: <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> | 474: <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> |
472: <div class="box"> | 475: <div class="box"> |
473: <form id="groups" method="post" action="admin_groups.php?action=foo"> | 476: <form id="groups" method="post" action="admin_groups.php"> |
474: <div class="inform"> | 477: <div class="inform"> |
475: <fieldset> | 478: <fieldset> |
476: <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> | 479: <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> |
545: <table cellspacing="0"> | 548: <table cellspacing="0"> |
546: <?php | 549: <?php |
547: | 550: |
| 551: $cur_index = 5; |
| 552: |
548: $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); | 553: $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); |
549: | 554: |
550: while ($cur_group = $db->fetch_assoc($result)) | 555: while ($cur_group = $db->fetch_assoc($result)) |
551: echo "\t\t\t\t\t\t\t\t".'<tr><th scope="row"><a href="admin_groups.php?edit_group='.$cur_group['g_id'].'">'.$lang_admin_groups['Edit link'].'</a>'.(($cur_group['g_id'] > PUN_MEMBER) ? ' | <a href="admin_groups.php?del_group='.$cur_group['g_id'].'">'.$lang_admin_groups['Delete link'].'</a>' : '').'</th><td>'.pun_htmlspecialchars($cur_group['g_title']).'</td></tr>'."\n"; | 556: echo "\t\t\t\t\t\t\t\t".'<tr><th scope="row"><a href="admin_groups.php?edit_group='.$cur_group['g_id'].'" tabindex="'.$cur_index++.'">'.$lang_admin_groups['Edit link'].'</a>'.(($cur_group['g_id'] > PUN_MEMBER) ? ' | <a href="admin_groups.php?del_group='.$cur_group['g_id'].'" tabindex="'.$cur_index++.'">'.$lang_admin_groups['Delete link'].'</a>' : '').'</th><td>'.pun_htmlspecialchars($cur_group['g_title']).'</td></tr>'."\n"; |
552: | 557: |
553: ?> | 558: ?> |
554: </table> | 559: </table> |
a/admin_options.php |
b/admin_options.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
9: // Tell header.php to use the admin template | 9: // Tell header.php to use the admin template |
10: define('PUN_ADMIN_CONSOLE', 1); | 10: define('PUN_ADMIN_CONSOLE', 1); |
11: | 11: |
12: define('PUN_ROOT', './'); | 12: define('PUN_ROOT', dirname(__FILE__).'/'); |
13: require PUN_ROOT.'include/common.php'; | 13: require PUN_ROOT.'include/common.php'; |
14: require PUN_ROOT.'include/common_admin.php'; | 14: require PUN_ROOT.'include/common_admin.php'; |
15: | 15: |
16: | 16: |
17: if ($pun_user['g_id'] != PUN_ADMIN) | 17: if ($pun_user['g_id'] != PUN_ADMIN) |
18: message($lang_common['No permission']); | 18: message($lang_common['No permission'], false, '403 Forbidden'); |
19: | 19: |
20: // Load the admin_options.php language file | 20: // Load the admin_options.php language file |
21: require PUN_ROOT.'lang/'.$admin_language.'/admin_options.php'; | 21: require PUN_ROOT.'lang/'.$admin_language.'/admin_options.php'; |
22: | 22: |
23: if (isset($_POST['form_sent'])) | 23: if (isset($_POST['form_sent'])) |
24: { | 24: { |
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']); |
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'] : '')))) | |
27: message($lang_admin_options['Bad HTTP Referer message']); | |
28: | 26: |
29: $form = array( | 27: $form = array( |
30: 'board_title' => pun_trim($_POST['form']['board_title']), | 28: 'board_title' => pun_trim($_POST['form']['board_title']), |
32: 'base_url' => pun_trim($_POST['form']['base_url']), | 30: 'base_url' => pun_trim($_POST['form']['base_url']), |
33: 'default_timezone' => floatval($_POST['form']['default_timezone']), | 31: 'default_timezone' => floatval($_POST['form']['default_timezone']), |
34: 'default_dst' => $_POST['form']['default_dst'] != '1' ? '0' : '1', | 32: 'default_dst' => $_POST['form']['default_dst'] != '1' ? '0' : '1', |
35: 'default_lang' => preg_replace('#[\.\\\/]#', '', pun_trim($_POST['form']['default_lang'])), | 33: 'default_lang' => pun_trim($_POST['form']['default_lang']), |
36: 'default_style' => preg_replace('#[\.\\\/]#', '', pun_trim($_POST['form']['default_style'])), | 34: 'default_style' => pun_trim($_POST['form']['default_style']), |
37: 'time_format' => pun_trim($_POST['form']['time_format']), | 35: 'time_format' => pun_trim($_POST['form']['time_format']), |
38: 'date_format' => pun_trim($_POST['form']['date_format']), | 36: 'date_format' => pun_trim($_POST['form']['date_format']), |
39: 'timeout_visit' => intval($_POST['form']['timeout_visit']), | 37: 'timeout_visit' => (intval($_POST['form']['timeout_visit']) > 0) ? intval($_POST['form']['timeout_visit']) : 1, |
40: 'timeout_online' => intval($_POST['form']['timeout_online']), | 38: 'timeout_online' => (intval($_POST['form']['timeout_online']) > 0) ? intval($_POST['form']['timeout_online']) : 1, |
41: 'redirect_delay' => intval($_POST['form']['redirect_delay']), | 39: 'redirect_delay' => (intval($_POST['form']['redirect_delay']) >= 0) ? intval($_POST['form']['redirect_delay']) : 0, |
42: 'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1', | 40: 'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1', |
43: 'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1', | 41: 'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1', |
44: 'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1', | 42: 'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1', |
45: 'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1', | 43: 'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1', |
46: 'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1', | 44: 'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1', |
47: 'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1', | 45: 'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1', |
48: 'topic_review' => intval($_POST['form']['topic_review']), | 46: 'topic_review' => (intval($_POST['form']['topic_review']) >= 0) ? intval($_POST['form']['topic_review']) : 0, |
49: 'disp_topics_default' => intval($_POST['form']['disp_topics_default']), | 47: 'disp_topics_default' => intval($_POST['form']['disp_topics_default']), |
50: 'disp_posts_default' => intval($_POST['form']['disp_posts_default']), | 48: 'disp_posts_default' => intval($_POST['form']['disp_posts_default']), |
51: 'indent_num_spaces' => intval($_POST['form']['indent_num_spaces']), | 49: 'indent_num_spaces' => (intval($_POST['form']['indent_num_spaces']) >= 0) ? intval($_POST['form']['indent_num_spaces']) : 0, |
52: 'quote_depth' => intval($_POST['form']['quote_depth']), | 50: 'quote_depth' => (intval($_POST['form']['quote_depth']) > 0) ? intval($_POST['form']['quote_depth']) : 1, |
53: 'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1', | 51: 'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1', |
54: 'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1', | 52: 'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1', |
55: 'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1', | 53: 'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1', |
62: 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', | 60: 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', |
63: 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), | 61: 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), |
64: 'feed_type' => intval($_POST['form']['feed_type']), | 62: 'feed_type' => intval($_POST['form']['feed_type']), |
| 63: 'feed_ttl' => intval($_POST['form']['feed_ttl']), |
65: 'report_method' => intval($_POST['form']['report_method']), | 64: 'report_method' => intval($_POST['form']['report_method']), |
66: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), | 65: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), |
67: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', | 66: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', |
68: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), | 67: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), |
69: 'avatars_width' => intval($_POST['form']['avatars_width']), | 68: 'avatars_width' => (intval($_POST['form']['avatars_width']) > 0) ? intval($_POST['form']['avatars_width']) : 1, |
70: 'avatars_height' => intval($_POST['form']['avatars_height']), | 69: 'avatars_height' => (intval($_POST['form']['avatars_height']) > 0) ? intval($_POST['form']['avatars_height']) : 1, |
71: 'avatars_size' => intval($_POST['form']['avatars_size']), | 70: 'avatars_size' => (intval($_POST['form']['avatars_size']) > 0) ? intval($_POST['form']['avatars_size']) : 1, |
72: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), | 71: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), |
73: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), | 72: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), |
74: 'subscriptions' => $_POST['form']['subscriptions'] != '1' ? '0' : '1', | 73: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', |
| 74: 'topic_subscriptions' => $_POST['form']['topic_subscriptions'] != '1' ? '0' : '1', |
75: 'smtp_host' => pun_trim($_POST['form']['smtp_host']), | 75: 'smtp_host' => pun_trim($_POST['form']['smtp_host']), |
76: 'smtp_user' => pun_trim($_POST['form']['smtp_user']), | 76: 'smtp_user' => pun_trim($_POST['form']['smtp_user']), |
77: 'smtp_pass' => pun_trim($_POST['form']['smtp_pass']), | |
78: 'smtp_ssl' => $_POST['form']['smtp_ssl'] != '1' ? '0' : '1', | 77: 'smtp_ssl' => $_POST['form']['smtp_ssl'] != '1' ? '0' : '1', |
79: 'regs_allow' => $_POST['form']['regs_allow'] != '1' ? '0' : '1', | 78: 'regs_allow' => $_POST['form']['regs_allow'] != '1' ? '0' : '1', |
80: 'regs_verify' => $_POST['form']['regs_verify'] != '1' ? '0' : '1', | 79: 'regs_verify' => $_POST['form']['regs_verify'] != '1' ? '0' : '1', |
95: if (substr($form['base_url'], -1) == '/') | 94: if (substr($form['base_url'], -1) == '/') |
96: $form['base_url'] = substr($form['base_url'], 0, -1); | 95: $form['base_url'] = substr($form['base_url'], 0, -1); |
97: | 96: |
98: if (!file_exists(PUN_ROOT.'lang/'.$form['default_lang'].'/common.php')) | 97: $languages = forum_list_langs(); |
| 98: if (!in_array($form['default_lang'], $languages)) |
99: message($lang_common['Bad request']); | 99: message($lang_common['Bad request']); |
100: if (!file_exists(PUN_ROOT.'style/'.$form['default_style'].'.css')) | 100: |
| 101: $styles = forum_list_styles(); |
| 102: if (!in_array($form['default_style'], $styles)) |
101: message($lang_common['Bad request']); | 103: message($lang_common['Bad request']); |
102: | 104: |
103: if ($form['time_format'] == '') | 105: if ($form['time_format'] == '') |
116: message($lang_admin_options['Invalid webmaster e-mail message']); | 118: message($lang_admin_options['Invalid webmaster e-mail message']); |
117: | 119: |
118: if ($form['mailing_list'] != '') | 120: if ($form['mailing_list'] != '') |
119: $form['mailing_list'] = strtolower(preg_replace('/\s/S', '', $form['mailing_list'])); | 121: $form['mailing_list'] = strtolower(preg_replace('%\s%S', '', $form['mailing_list'])); |
120: | 122: |
121: // Make sure avatars_dir doesn't end with a slash | 123: // Make sure avatars_dir doesn't end with a slash |
122: if (substr($form['avatars_dir'], -1) == '/') | 124: if (substr($form['avatars_dir'], -1) == '/') |
125: if ($form['additional_navlinks'] != '') | 127: if ($form['additional_navlinks'] != '') |
126: $form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks'])); | 128: $form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks'])); |
127: | 129: |
| 130: // Change or enter a SMTP password |
| 131: if (isset($_POST['form']['smtp_change_pass'])) |
| 132: { |
| 133: $smtp_pass1 = isset($_POST['form']['smtp_pass1']) ? pun_trim($_POST['form']['smtp_pass1']) : ''; |
| 134: $smtp_pass2 = isset($_POST['form']['smtp_pass2']) ? pun_trim($_POST['form']['smtp_pass2']) : ''; |
| 135: |
| 136: if ($smtp_pass1 == $smtp_pass2) |
| 137: $form['smtp_pass'] = $smtp_pass1; |
| 138: else |
| 139: message($lang_admin_options['SMTP passwords did not match']); |
| 140: } |
| 141: |
128: if ($form['announcement_message'] != '') | 142: if ($form['announcement_message'] != '') |
129: $form['announcement_message'] = pun_linebreaks($form['announcement_message']); | 143: $form['announcement_message'] = pun_linebreaks($form['announcement_message']); |
130: else | 144: else |
163: if ($form['feed_type'] < 0 || $form['feed_type'] > 2) | 177: if ($form['feed_type'] < 0 || $form['feed_type'] > 2) |
164: message($lang_common['Bad request']); | 178: message($lang_common['Bad request']); |
165: | 179: |
| 180: if ($form['feed_ttl'] < 0) |
| 181: message($lang_common['Bad request']); |
| 182: |
166: if ($form['report_method'] < 0 || $form['report_method'] > 2) | 183: if ($form['report_method'] < 0 || $form['report_method'] > 2) |
167: message($lang_common['Bad request']); | 184: message($lang_common['Bad request']); |
168: | 185: |
191: require PUN_ROOT.'include/cache.php'; | 208: require PUN_ROOT.'include/cache.php'; |
192: | 209: |
193: generate_config_cache(); | 210: generate_config_cache(); |
| 211: clear_feed_cache(); |
194: | 212: |
195: redirect('admin_options.php', $lang_admin_options['Options updated redirect']); | 213: redirect('admin_options.php', $lang_admin_options['Options updated redirect']); |
196: } | 214: } |
205: <div class="blockform"> | 223: <div class="blockform"> |
206: <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> | 224: <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> |
207: <div class="box"> | 225: <div class="box"> |
208: <form method="post" action="admin_options.php?action=foo"> | 226: <form method="post" action="admin_options.php"> |
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> |
210: <div class="inform"> | 228: <div class="inform"> |
211: <input type="hidden" name="form_sent" value="1" /> | 229: <input type="hidden" name="form_sent" value="1" /> |
230: <tr> | 248: <tr> |
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> |
232: <td> | 250: <td> |
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']) ?>" /> |
234: <span><?php echo $lang_admin_options['Base URL help'] ?></span> | 252: <span><?php echo $lang_admin_options['Base URL help'] ?></span> |
235: </td> | 253: </td> |
236: </tr> | 254: </tr> |
285: <tr> | 303: <tr> |
286: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> | 304: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> |
287: <td> | 305: <td> |
288: <input type="radio" name="form[default_dst]" value="1"<?php if ($pun_config['o_default_dst'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[default_dst]" value="0"<?php if ($pun_config['o_default_dst'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 306: <input type="radio" name="form[default_dst]" id="form_default_dst_1" value="1"<?php if ($pun_config['o_default_dst'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_default_dst_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[default_dst]" id="form_default_dst_0" value="0"<?php if ($pun_config['o_default_dst'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_default_dst_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
289: <span><?php echo $lang_admin_options['DST help'] ?></span> | 307: <span><?php echo $lang_admin_options['DST help'] ?></span> |
290: </td> | 308: </td> |
291: </tr> | 309: </tr> |
393: <tr> | 411: <tr> |
394: <th scope="row"><?php echo $lang_admin_options['Version number label'] ?></th> | 412: <th scope="row"><?php echo $lang_admin_options['Version number label'] ?></th> |
395: <td> | 413: <td> |
396: <input type="radio" name="form[show_version]" value="1"<?php if ($pun_config['o_show_version'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_version]" value="0"<?php if ($pun_config['o_show_version'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 414: <input type="radio" name="form[show_version]" id="form_show_version_1" value="1"<?php if ($pun_config['o_show_version'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_version_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_version]" id="form_show_version_0" value="0"<?php if ($pun_config['o_show_version'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_version_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
397: <span><?php echo $lang_admin_options['Version number help'] ?></span> | 415: <span><?php echo $lang_admin_options['Version number help'] ?></span> |
398: </td> | 416: </td> |
399: </tr> | 417: </tr> |
400: <tr> | 418: <tr> |
401: <th scope="row"><?php echo $lang_admin_options['Info in posts label'] ?></th> | 419: <th scope="row"><?php echo $lang_admin_options['Info in posts label'] ?></th> |
402: <td> | 420: <td> |
403: <input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_user_info]" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 421: <input type="radio" name="form[show_user_info]" id="form_show_user_info_1" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_user_info_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_user_info]" id="form_show_user_info_0" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_user_info_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
404: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> | 422: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> |
405: </td> | 423: </td> |
406: </tr> | 424: </tr> |
407: <tr> | 425: <tr> |
408: <th scope="row"><?php echo $lang_admin_options['Post count label'] ?></th> | 426: <th scope="row"><?php echo $lang_admin_options['Post count label'] ?></th> |
409: <td> | 427: <td> |
410: <input type="radio" name="form[show_post_count]" value="1"<?php if ($pun_config['o_show_post_count'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_post_count]" value="0"<?php if ($pun_config['o_show_post_count'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 428: <input type="radio" name="form[show_post_count]" id="form_show_post_count_1" value="1"<?php if ($pun_config['o_show_post_count'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_post_count_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_post_count]" id="form_show_post_count_0" value="0"<?php if ($pun_config['o_show_post_count'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_post_count_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
411: <span><?php echo $lang_admin_options['Post count help'] ?></span> | 429: <span><?php echo $lang_admin_options['Post count help'] ?></span> |
412: </td> | 430: </td> |
413: </tr> | 431: </tr> |
414: <tr> | 432: <tr> |
415: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> | 433: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> |
416: <td> | 434: <td> |
417: <input type="radio" name="form[smilies]" value="1"<?php if ($pun_config['o_smilies'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[smilies]" value="0"<?php if ($pun_config['o_smilies'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 435: <input type="radio" name="form[smilies]" id="form_smilies_1" value="1"<?php if ($pun_config['o_smilies'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[smilies]" id="form_smilies_0" value="0"<?php if ($pun_config['o_smilies'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
418: <span><?php echo $lang_admin_options['Smilies help'] ?></span> | 436: <span><?php echo $lang_admin_options['Smilies help'] ?></span> |
419: </td> | 437: </td> |
420: </tr> | 438: </tr> |
421: <tr> | 439: <tr> |
422: <th scope="row"><?php echo $lang_admin_options['Smilies sigs label'] ?></th> | 440: <th scope="row"><?php echo $lang_admin_options['Smilies sigs label'] ?></th> |
423: <td> | 441: <td> |
424: <input type="radio" name="form[smilies_sig]" value="1"<?php if ($pun_config['o_smilies_sig'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[smilies_sig]" value="0"<?php if ($pun_config['o_smilies_sig'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 442: <input type="radio" name="form[smilies_sig]" id="form_smilies_sig_1" value="1"<?php if ($pun_config['o_smilies_sig'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_sig_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[smilies_sig]" id="form_smilies_sig_0" value="0"<?php if ($pun_config['o_smilies_sig'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_sig_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
425: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> | 443: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> |
426: </td> | 444: </td> |
427: </tr> | 445: </tr> |
428: <tr> | 446: <tr> |
429: <th scope="row"><?php echo $lang_admin_options['Clickable links label'] ?></th> | 447: <th scope="row"><?php echo $lang_admin_options['Clickable links label'] ?></th> |
430: <td> | 448: <td> |
431: <input type="radio" name="form[make_links]" value="1"<?php if ($pun_config['o_make_links'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[make_links]" value="0"<?php if ($pun_config['o_make_links'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 449: <input type="radio" name="form[make_links]" id="form_make_links_1" value="1"<?php if ($pun_config['o_make_links'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_make_links_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[make_links]" id="form_make_links_0" value="0"<?php if ($pun_config['o_make_links'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_make_links_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
432: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> | 450: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> |
433: </td> | 451: </td> |
434: </tr> | 452: </tr> |
479: <tr> | 497: <tr> |
480: <th scope="row"><?php echo $lang_admin_options['Quick post label'] ?></th> | 498: <th scope="row"><?php echo $lang_admin_options['Quick post label'] ?></th> |
481: <td> | 499: <td> |
482: <input type="radio" name="form[quickpost]" value="1"<?php if ($pun_config['o_quickpost'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[quickpost]" value="0"<?php if ($pun_config['o_quickpost'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 500: <input type="radio" name="form[quickpost]" id="form_quickpost_1" value="1"<?php if ($pun_config['o_quickpost'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickpost_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[quickpost]" id="form_quickpost_0" value="0"<?php if ($pun_config['o_quickpost'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickpost_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
483: <span><?php echo $lang_admin_options['Quick post help'] ?></span> | 501: <span><?php echo $lang_admin_options['Quick post help'] ?></span> |
484: </td> | 502: </td> |
485: </tr> | 503: </tr> |
486: <tr> | 504: <tr> |
487: <th scope="row"><?php echo $lang_admin_options['Users online label'] ?></th> | 505: <th scope="row"><?php echo $lang_admin_options['Users online label'] ?></th> |
488: <td> | 506: <td> |
489: <input type="radio" name="form[users_online]" value="1"<?php if ($pun_config['o_users_online'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[users_online]" value="0"<?php if ($pun_config['o_users_online'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 507: <input type="radio" name="form[users_online]" id="form_users_online_1" value="1"<?php if ($pun_config['o_users_online'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_users_online_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[users_online]" id="form_users_online_0" value="0"<?php if ($pun_config['o_users_online'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_users_online_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
490: <span><?php echo $lang_admin_options['Users online help'] ?></span> | 508: <span><?php echo $lang_admin_options['Users online help'] ?></span> |
491: </td> | 509: </td> |
492: </tr> | 510: </tr> |
493: <tr> | 511: <tr> |
494: <th scope="row"><a name="censoring"><?php echo $lang_admin_options['Censor words label'] ?></a></th> | 512: <th scope="row"><a name="censoring"></a><?php echo $lang_admin_options['Censor words label'] ?></th> |
495: <td> | 513: <td> |
496: <input type="radio" name="form[censoring]" value="1"<?php if ($pun_config['o_censoring'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[censoring]" value="0"<?php if ($pun_config['o_censoring'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 514: <input type="radio" name="form[censoring]" id="form_censoring_1" value="1"<?php if ($pun_config['o_censoring'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_censoring_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[censoring]" id="form_censoring_0" value="0"<?php if ($pun_config['o_censoring'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_censoring_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
497: <span><?php printf($lang_admin_options['Censor words help'], '<a href="admin_censoring.php">'.$lang_admin_common['Censoring'].'</a>') ?></span> | 515: <span><?php printf($lang_admin_options['Censor words help'], '<a href="admin_censoring.php">'.$lang_admin_common['Censoring'].'</a>') ?></span> |
498: </td> | 516: </td> |
499: </tr> | 517: </tr> |
500: <tr> | 518: <tr> |
501: <th scope="row"><a name="signatures"><?php echo $lang_admin_options['Signatures label'] ?></a></th> | 519: <th scope="row"><a name="signatures"></a><?php echo $lang_admin_options['Signatures label'] ?></th> |
502: <td> | 520: <td> |
503: <input type="radio" name="form[signatures]" value="1"<?php if ($pun_config['o_signatures'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[signatures]" value="0"<?php if ($pun_config['o_signatures'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 521: <input type="radio" name="form[signatures]" id="form_signatures_1" value="1"<?php if ($pun_config['o_signatures'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_signatures_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[signatures]" id="form_signatures_0" value="0"<?php if ($pun_config['o_signatures'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_signatures_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
504: <span><?php echo $lang_admin_options['Signatures help'] ?></span> | 522: <span><?php echo $lang_admin_options['Signatures help'] ?></span> |
505: </td> | 523: </td> |
506: </tr> | 524: </tr> |
507: <tr> | 525: <tr> |
508: <th scope="row"><a name="ranks"><?php echo $lang_admin_options['User ranks label'] ?></a></th> | 526: <th scope="row"><a name="ranks"></a><?php echo $lang_admin_options['User ranks label'] ?></th> |
509: <td> | 527: <td> |
510: <input type="radio" name="form[ranks]" value="1"<?php if ($pun_config['o_ranks'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[ranks]" value="0"<?php if ($pun_config['o_ranks'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 528: <input type="radio" name="form[ranks]" id="form_ranks_1" value="1"<?php if ($pun_config['o_ranks'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_ranks_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[ranks]" id="form_ranks_0" value="0"<?php if ($pun_config['o_ranks'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_ranks_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
511: <span><?php printf($lang_admin_options['User ranks help'], '<a href="admin_ranks.php">'.$lang_admin_common['Ranks'].'</a>') ?></span> | 529: <span><?php printf($lang_admin_options['User ranks help'], '<a href="admin_ranks.php">'.$lang_admin_common['Ranks'].'</a>') ?></span> |
512: </td> | 530: </td> |
513: </tr> | 531: </tr> |
514: <tr> | 532: <tr> |
515: <th scope="row"><?php echo $lang_admin_options['User has posted label'] ?></th> | 533: <th scope="row"><?php echo $lang_admin_options['User has posted label'] ?></th> |
516: <td> | 534: <td> |
517: <input type="radio" name="form[show_dot]" value="1"<?php if ($pun_config['o_show_dot'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_dot]" value="0"<?php if ($pun_config['o_show_dot'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 535: <input type="radio" name="form[show_dot]" id="form_show_dot_1" value="1"<?php if ($pun_config['o_show_dot'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_dot_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_dot]" id="form_show_dot_0" value="0"<?php if ($pun_config['o_show_dot'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_dot_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
518: <span><?php echo $lang_admin_options['User has posted help'] ?></span> | 536: <span><?php echo $lang_admin_options['User has posted help'] ?></span> |
519: </td> | 537: </td> |
520: </tr> | 538: </tr> |
521: <tr> | 539: <tr> |
522: <th scope="row"><?php echo $lang_admin_options['Topic views label'] ?></th> | 540: <th scope="row"><?php echo $lang_admin_options['Topic views label'] ?></th> |
523: <td> | 541: <td> |
524: <input type="radio" name="form[topic_views]" value="1"<?php if ($pun_config['o_topic_views'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[topic_views]" value="0"<?php if ($pun_config['o_topic_views'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 542: <input type="radio" name="form[topic_views]" id="form_topic_views_1" value="1"<?php if ($pun_config['o_topic_views'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_views_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[topic_views]" id="form_topic_views_0" value="0"<?php if ($pun_config['o_topic_views'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_views_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
525: <span><?php echo $lang_admin_options['Topic views help'] ?></span> | 543: <span><?php echo $lang_admin_options['Topic views help'] ?></span> |
526: </td> | 544: </td> |
527: </tr> | 545: </tr> |
528: <tr> | 546: <tr> |
529: <th scope="row"><?php echo $lang_admin_options['Quick jump label'] ?></th> | 547: <th scope="row"><?php echo $lang_admin_options['Quick jump label'] ?></th> |
530: <td> | 548: <td> |
531: <input type="radio" name="form[quickjump]" value="1"<?php if ($pun_config['o_quickjump'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[quickjump]" value="0"<?php if ($pun_config['o_quickjump'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 549: <input type="radio" name="form[quickjump]" id="form_quickjump_1" value="1"<?php if ($pun_config['o_quickjump'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickjump_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[quickjump]" id="form_quickjump_0" value="0"<?php if ($pun_config['o_quickjump'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickjump_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
532: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> | 550: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> |
533: </td> | 551: </td> |
534: </tr> | 552: </tr> |
535: <tr> | 553: <tr> |
536: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> | 554: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> |
537: <td> | 555: <td> |
538: <input type="radio" name="form[gzip]" value="1"<?php if ($pun_config['o_gzip'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[gzip]" value="0"<?php if ($pun_config['o_gzip'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 556: <input type="radio" name="form[gzip]" id="form_gzip_1" value="1"<?php if ($pun_config['o_gzip'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_gzip_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[gzip]" id="form_gzip_0" value="0"<?php if ($pun_config['o_gzip'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_gzip_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
539: <span><?php echo $lang_admin_options['GZip help'] ?></span> | 557: <span><?php echo $lang_admin_options['GZip help'] ?></span> |
540: </td> | 558: </td> |
541: </tr> | 559: </tr> |
542: <tr> | 560: <tr> |
543: <th scope="row"><?php echo $lang_admin_options['Search all label'] ?></th> | 561: <th scope="row"><?php echo $lang_admin_options['Search all label'] ?></th> |
544: <td> | 562: <td> |
545: <input type="radio" name="form[search_all_forums]" value="1"<?php if ($pun_config['o_search_all_forums'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[search_all_forums]" value="0"<?php if ($pun_config['o_search_all_forums'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 563: <input type="radio" name="form[search_all_forums]" id="form_search_all_forums_1" value="1"<?php if ($pun_config['o_search_all_forums'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_search_all_forums_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[search_all_forums]" id="form_search_all_forums_0" value="0"<?php if ($pun_config['o_search_all_forums'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_search_all_forums_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
546: <span><?php echo $lang_admin_options['Search all help'] ?></span> | 564: <span><?php echo $lang_admin_options['Search all help'] ?></span> |
547: </td> | 565: </td> |
548: </tr> | 566: </tr> |
553: <span><?php echo $lang_admin_options['Menu items help'] ?></span> | 571: <span><?php echo $lang_admin_options['Menu items help'] ?></span> |
554: </td> | 572: </td> |
555: </tr> | 573: </tr> |
| 574: </table> |
| 575: </div> |
| 576: </fieldset> |
| 577: </div> |
| 578: <div class="inform"> |
| 579: <fieldset> |
| 580: <legend><?php echo $lang_admin_options['Feed subhead'] ?></legend> |
| 581: <div class="infldset"> |
| 582: <table class="aligntop" cellspacing="0"> |
556: <tr> | 583: <tr> |
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> |
558: <td> | 585: <td> |
559: <input type="radio" name="form[feed_type]" value="0"<?php if ($pun_config['o_feed_type'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['None'] ?></strong>   <input type="radio" name="form[feed_type]" value="1"<?php if ($pun_config['o_feed_type'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['RSS'] ?></strong>   <input type="radio" name="form[feed_type]" value="2"<?php if ($pun_config['o_feed_type'] == '2') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Atom'] ?></strong> | 586: <input type="radio" name="form[feed_type]" id="form_feed_type_0" value="0"<?php if ($pun_config['o_feed_type'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['None'] ?></strong>   <input type="radio" name="form[feed_type]" id="form_feed_type_1" value="1"<?php if ($pun_config['o_feed_type'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_feed_type_0"><strong><?php echo $lang_admin_options['RSS'] ?></strong></label>   <input type="radio" name="form[feed_type]" id="form_feed_type_2" value="2"<?php if ($pun_config['o_feed_type'] == '2') echo ' checked="checked"' ?> /> <label class="conl" for="form_feed_type_1"><strong><?php echo $lang_admin_options['Atom'] ?></strong></label> |
560: <span><?php echo $lang_admin_options['Default feed help'] ?></span> | 587: <span><?php echo $lang_admin_options['Default feed help'] ?></span> |
561: </td> | 588: </td> |
562: </tr> | 589: </tr> |
| 590: <tr> |
| 591: <th scope="row"><?php echo $lang_admin_options['Feed TTL label'] ?></th> |
| 592: <td> |
| 593: <select name="form[feed_ttl]"> |
| 594: <option value="0"<?php if ($pun_config['o_feed_ttl'] == '0') echo ' selected="selected"'; ?>><?php echo $lang_admin_options['No cache'] ?></option> |
| 595: <?php |
| 596: |
| 597: $times = array(5, 15, 30, 60); |
| 598: |
| 599: foreach ($times as $time) |
| 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"; |
| 601: |
| 602: ?> |
| 603: </select> |
| 604: <span><?php echo $lang_admin_options['Feed TTL help'] ?></span> |
| 605: </td> |
| 606: </tr> |
563: </table> | 607: </table> |
564: </div> | 608: </div> |
565: </fieldset> | 609: </fieldset> |
572: <tr> | 616: <tr> |
573: <th scope="row"><?php echo $lang_admin_options['Reporting method label'] ?></th> | 617: <th scope="row"><?php echo $lang_admin_options['Reporting method label'] ?></th> |
574: <td> | 618: <td> |
575: <input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Internal'] ?></strong>   <input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['By e-mail'] ?></strong>   <input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Both'] ?></strong> | 619: <input type="radio" name="form[report_method]" id="form_report_method_0" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Internal'] ?></strong>   <input type="radio" name="form[report_method]" id="form_report_method_1" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_report_method_0"><strong><?php echo $lang_admin_options['By e-mail'] ?></strong></label>   <input type="radio" name="form[report_method]" id="form_report_method_2" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> <label class="conl" for="form_report_method_1"><strong><?php echo $lang_admin_options['Both'] ?></strong></label> |
576: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> | 620: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> |
577: </td> | 621: </td> |
578: </tr> | 622: </tr> |
595: <tr> | 639: <tr> |
596: <th scope="row"><?php echo $lang_admin_options['Use avatars label'] ?></th> | 640: <th scope="row"><?php echo $lang_admin_options['Use avatars label'] ?></th> |
597: <td> | 641: <td> |
598: <input type="radio" name="form[avatars]" value="1"<?php if ($pun_config['o_avatars'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[avatars]" value="0"<?php if ($pun_config['o_avatars'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 642: <input type="radio" name="form[avatars]" id="form_avatars_1" value="1"<?php if ($pun_config['o_avatars'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_avatars_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[avatars]" id="form_avatars_0" value="0"<?php if ($pun_config['o_avatars'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_avatars_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
599: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> | 643: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> |
600: </td> | 644: </td> |
601: </tr> | 645: </tr> |
651: </td> | 695: </td> |
652: </tr> | 696: </tr> |
653: <tr> | 697: <tr> |
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> |
| 699: <td> |
| 700: <input type="radio" name="form[forum_subscriptions]" id="form_forum_subscriptions_1" value="1"<?php if ($pun_config['o_forum_subscriptions'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_forum_subscriptions_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[forum_subscriptions]" id="form_forum_subscriptions_0" value="0"<?php if ($pun_config['o_forum_subscriptions'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_forum_subscriptions_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
| 701: <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> |
| 702: </td> |
| 703: </tr> |
| 704: <tr> |
| 705: <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> |
655: <td> | 706: <td> |
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> | 707: <input type="radio" name="form[topic_subscriptions]" id="form_topic_subscriptions_1" value="1"<?php if ($pun_config['o_topic_subscriptions'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_subscriptions_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[topic_subscriptions]" id="form_topic_subscriptions_0" value="0"<?php if ($pun_config['o_topic_subscriptions'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_subscriptions_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
657: <span><?php echo $lang_admin_options['Subscriptions help'] ?></span> | 708: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> |
658: </td> | 709: </td> |
659: </tr> | 710: </tr> |
660: <tr> | 711: <tr> |
674: <tr> | 725: <tr> |
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> |
676: <td> | 727: <td> |
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]" id="form_smtp_change_pass" value="1" />  <label class="conl" for="form_smtp_change_pass"><?php echo $lang_admin_options['SMTP change password help'] ?></label></span> |
| 729: <?php $smtp_pass = !empty($pun_config['o_smtp_pass']) ? random_key(pun_strlen($pun_config['o_smtp_pass']), true) : ''; ?> |
| 730: <input type="password" name="form[smtp_pass1]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
| 731: <input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
678: <span><?php echo $lang_admin_options['SMTP password help'] ?></span> | 732: <span><?php echo $lang_admin_options['SMTP password help'] ?></span> |
679: </td> | 733: </td> |
680: </tr> | 734: </tr> |
681: <tr> | 735: <tr> |
682: <th scope="row"><?php echo $lang_admin_options['SMTP SSL label'] ?></th> | 736: <th scope="row"><?php echo $lang_admin_options['SMTP SSL label'] ?></th> |
683: <td> | 737: <td> |
684: <input type="radio" name="form[smtp_ssl]" value="1"<?php if ($pun_config['o_smtp_ssl'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[smtp_ssl]" value="0"<?php if ($pun_config['o_smtp_ssl'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 738: <input type="radio" name="form[smtp_ssl]" id="form_smtp_ssl_1" value="1"<?php if ($pun_config['o_smtp_ssl'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_smtp_ssl_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[smtp_ssl]" id="form_smtp_ssl_0" value="0"<?php if ($pun_config['o_smtp_ssl'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_smtp_ssl_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
685: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> | 739: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> |
686: </td> | 740: </td> |
687: </tr> | 741: </tr> |
697: <tr> | 751: <tr> |
698: <th scope="row"><?php echo $lang_admin_options['Allow new label'] ?></th> | 752: <th scope="row"><?php echo $lang_admin_options['Allow new label'] ?></th> |
699: <td> | 753: <td> |
700: <input type="radio" name="form[regs_allow]" value="1"<?php if ($pun_config['o_regs_allow'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[regs_allow]" value="0"<?php if ($pun_config['o_regs_allow'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 754: <input type="radio" name="form[regs_allow]" id="form_regs_allow_1" value="1"<?php if ($pun_config['o_regs_allow'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_allow_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[regs_allow]" id="form_regs_allow_0" value="0"<?php if ($pun_config['o_regs_allow'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_allow_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
701: <span><?php echo $lang_admin_options['Allow new help'] ?></span> | 755: <span><?php echo $lang_admin_options['Allow new help'] ?></span> |
702: </td> | 756: </td> |
703: </tr> | 757: </tr> |
704: <tr> | 758: <tr> |
705: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> | 759: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> |
706: <td> | 760: <td> |
707: <input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 761: <input type="radio" name="form[regs_verify]" id="form_regs_verify_1" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_verify_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[regs_verify]" id="form_regs_verify_0" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_verify_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
708: <span><?php echo $lang_admin_options['Verify help'] ?></span> | 762: <span><?php echo $lang_admin_options['Verify help'] ?></span> |
709: </td> | 763: </td> |
710: </tr> | 764: </tr> |
711: <tr> | 765: <tr> |
712: <th scope="row"><?php echo $lang_admin_options['Report new label'] ?></th> | 766: <th scope="row"><?php echo $lang_admin_options['Report new label'] ?></th> |
713: <td> | 767: <td> |
714: <input type="radio" name="form[regs_report]" value="1"<?php if ($pun_config['o_regs_report'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[regs_report]" value="0"<?php if ($pun_config['o_regs_report'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 768: <input type="radio" name="form[regs_report]" id="form_regs_report_1" value="1"<?php if ($pun_config['o_regs_report'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_report_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[regs_report]" id="form_regs_report_0" value="0"<?php if ($pun_config['o_regs_report'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_report_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
715: <span><?php echo $lang_admin_options['Report new help'] ?></span> | 769: <span><?php echo $lang_admin_options['Report new help'] ?></span> |
716: </td> | 770: </td> |
717: </tr> | 771: </tr> |
718: <tr> | 772: <tr> |
719: <th scope="row"><?php echo $lang_admin_options['Use rules label'] ?></th> | 773: <th scope="row"><?php echo $lang_admin_options['Use rules label'] ?></th> |
720: <td> | 774: <td> |
721: <input type="radio" name="form[rules]" value="1"<?php if ($pun_config['o_rules'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[rules]" value="0"<?php if ($pun_config['o_rules'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 775: <input type="radio" name="form[rules]" id="form_rules_1" value="1"<?php if ($pun_config['o_rules'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_rules_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[rules]" id="form_rules_0" value="0"<?php if ($pun_config['o_rules'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_rules_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
722: <span><?php echo $lang_admin_options['Use rules help'] ?></span> | 776: <span><?php echo $lang_admin_options['Use rules help'] ?></span> |
723: </td> | 777: </td> |
724: </tr> | 778: </tr> |
733: <th scope="row"><?php echo $lang_admin_options['E-mail default label'] ?></th> | 787: <th scope="row"><?php echo $lang_admin_options['E-mail default label'] ?></th> |
734: <td> | 788: <td> |
735: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> | 789: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> |
736: <input type="radio" name="form[default_email_setting]" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Display e-mail label'] ?><br /> | 790: <input type="radio" name="form[default_email_setting]" id="form_default_email_setting_0" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Display e-mail label'] ?><br /> |
737: <input type="radio" name="form[default_email_setting]" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide allow form label'] ?><br /> | 791: <input type="radio" name="form[default_email_setting]" id="form_default_email_setting_1" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide allow form label'] ?><br /> |
738: <input type="radio" name="form[default_email_setting]" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide both label'] ?><br /> | 792: <input type="radio" name="form[default_email_setting]" id="form_default_email_setting_2" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide both label'] ?><br /> |
739: </td> | 793: </td> |
740: </tr> | 794: </tr> |
741: </table> | 795: </table> |
750: <tr> | 804: <tr> |
751: <th scope="row"><?php echo $lang_admin_options['Display announcement label'] ?></th> | 805: <th scope="row"><?php echo $lang_admin_options['Display announcement label'] ?></th> |
752: <td> | 806: <td> |
753: <input type="radio" name="form[announcement]" value="1"<?php if ($pun_config['o_announcement'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[announcement]" value="0"<?php if ($pun_config['o_announcement'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 807: <input type="radio" name="form[announcement]" id="form_announcement_1" value="1"<?php if ($pun_config['o_announcement'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_announcement_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[announcement]" id="form_announcement_0" value="0"<?php if ($pun_config['o_announcement'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_announcement_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
754: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> | 808: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> |
755: </td> | 809: </td> |
756: </tr> | 810: </tr> |
771: <div class="infldset"> | 825: <div class="infldset"> |
772: <table class="aligntop" cellspacing="0"> | 826: <table class="aligntop" cellspacing="0"> |
773: <tr> | 827: <tr> |
774: <th scope="row"><a name="maintenance"><?php echo $lang_admin_options['Maintenance mode label'] ?></a></th> | 828: <th scope="row"><a name="maintenance"></a><?php echo $lang_admin_options['Maintenance mode label'] ?></th> |
775: <td> | 829: <td> |
776: <input type="radio" name="form[maintenance]" value="1"<?php if ($pun_config['o_maintenance'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[maintenance]" value="0"<?php if ($pun_config['o_maintenance'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 830: <input type="radio" name="form[maintenance]" id="form_maintenance_1" value="1"<?php if ($pun_config['o_maintenance'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_maintenance_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[maintenance]" id="form_maintenance_0" value="0"<?php if ($pun_config['o_maintenance'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_maintenance_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
777: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> | 831: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> |
778: </td> | 832: </td> |
779: </tr> | 833: </tr> |
a/admin_users.php |
b/admin_users.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
9: // Tell header.php to use the admin template | 9: // Tell header.php to use the admin template |
10: define('PUN_ADMIN_CONSOLE', 1); | 10: define('PUN_ADMIN_CONSOLE', 1); |
11: | 11: |
12: define('PUN_ROOT', './'); | 12: define('PUN_ROOT', dirname(__FILE__).'/'); |
13: require PUN_ROOT.'include/common.php'; | 13: require PUN_ROOT.'include/common.php'; |
14: require PUN_ROOT.'include/common_admin.php'; | 14: require PUN_ROOT.'include/common_admin.php'; |
15: | 15: |
16: | 16: |
17: if (!$pun_user['is_admmod']) | 17: if (!$pun_user['is_admmod']) |
18: message($lang_common['No permission']); | 18: message($lang_common['No permission'], false, '403 Forbidden'); |
19: | 19: |
20: // Load the admin_users.php language file | 20: // Load the admin_users.php language file |
21: require PUN_ROOT.'lang/'.$admin_language.'/admin_users.php'; | 21: require PUN_ROOT.'lang/'.$admin_language.'/admin_users.php'; |
123: | 123: |
124: if (isset($_GET['show_users'])) | 124: if (isset($_GET['show_users'])) |
125: { | 125: { |
126: $ip = trim($_GET['show_users']); | 126: $ip = pun_trim($_GET['show_users']); |
127: | 127: |
128: if (!@preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $ip) && !@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}:))$/', $ip)) | 128: if (!@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $ip) && !@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}:))$%', $ip)) |
129: message($lang_admin_users['Bad IP message']); | 129: message($lang_admin_users['Bad IP message']); |
130: | 130: |
131: // Fetch user count | 131: // Fetch user count |
194: { | 194: { |
195: $user_title = get_title($user_data); | 195: $user_title = get_title($user_data); |
196: | 196: |
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&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>'; |
198: | 198: |
199: ?> | 199: ?> |
200: <tr> | 200: <tr> |
253: } | 253: } |
254: | 254: |
255: | 255: |
| 256: // Move multiple users to other user groups |
| 257: else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) |
| 258: { |
| 259: if ($pun_user['g_id'] > PUN_ADMIN) |
| 260: message($lang_common['No permission'], false, '403 Forbidden'); |
| 261: |
| 262: confirm_referrer('admin_users.php'); |
| 263: |
| 264: if (isset($_POST['users'])) |
| 265: { |
| 266: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
| 267: $user_ids = array_map('intval', $user_ids); |
| 268: |
| 269: // Delete invalid IDs |
| 270: $user_ids = array_diff($user_ids, array(0, 1)); |
| 271: } |
| 272: else |
| 273: $user_ids = array(); |
| 274: |
| 275: if (empty($user_ids)) |
| 276: message($lang_admin_users['No users selected']); |
| 277: |
| 278: // Are we trying to batch move any admins? |
| 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()); |
| 280: if ($db->result($result) > 0) |
| 281: message($lang_admin_users['No move admins message']); |
| 282: |
| 283: // Fetch all user groups |
| 284: $all_groups = array(); |
| 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()); |
| 286: while ($row = $db->fetch_row($result)) |
| 287: $all_groups[$row[0]] = $row[1]; |
| 288: |
| 289: if (isset($_POST['move_users_comply'])) |
| 290: { |
| 291: $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); |
| 292: |
| 293: // Is the new group a moderator group? |
| 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()); |
| 295: $new_group_mod = $db->result($result); |
| 296: |
| 297: // Fetch user groups |
| 298: $user_groups = array(); |
| 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()); |
| 300: while ($cur_user = $db->fetch_assoc($result)) |
| 301: { |
| 302: if (!isset($user_groups[$cur_user['group_id']])) |
| 303: $user_groups[$cur_user['group_id']] = array(); |
| 304: |
| 305: $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
| 306: } |
| 307: |
| 308: // Are any users moderators? |
| 309: $group_ids = array_keys($user_groups); |
| 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()); |
| 311: while ($cur_group = $db->fetch_assoc($result)) |
| 312: { |
| 313: if ($cur_group['g_moderator'] == '0') |
| 314: unset($user_groups[$cur_group['g_id']]); |
| 315: } |
| 316: |
| 317: if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') |
| 318: { |
| 319: // Fetch forum list and clean up their moderator list |
| 320: $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
| 321: while ($cur_forum = $db->fetch_assoc($result)) |
| 322: { |
| 323: $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
| 324: |
| 325: foreach ($user_groups as $group_users) |
| 326: $cur_moderators = array_diff($cur_moderators, $group_users); |
| 327: |
| 328: $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
| 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()); |
| 330: } |
| 331: } |
| 332: |
| 333: // Change user group |
| 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()); |
| 335: |
| 336: redirect('admin_users.php', $lang_admin_users['Users move redirect']); |
| 337: } |
| 338: |
| 339: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Move users']); |
| 340: define('PUN_ACTIVE_PAGE', 'admin'); |
| 341: require PUN_ROOT.'header.php'; |
| 342: |
| 343: generate_admin_menu('users'); |
| 344: |
| 345: ?> |
| 346: <div class="blockform"> |
| 347: <h2><span><?php echo $lang_admin_users['Move users'] ?></span></h2> |
| 348: <div class="box"> |
| 349: <form name="confirm_move_users" method="post" action="admin_users.php"> |
| 350: <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
| 351: <div class="inform"> |
| 352: <fieldset> |
| 353: <legend><?php echo $lang_admin_users['Move users subhead'] ?></legend> |
| 354: <div class="infldset"> |
| 355: <table class="aligntop" cellspacing="0"> |
| 356: <tr> |
| 357: <th scope="row"><?php echo $lang_admin_users['New group label'] ?></th> |
| 358: <td> |
| 359: <select name="new_group" tabindex="1"> |
| 360: <?php foreach ($all_groups as $gid => $group) : ?> <option value="<?php echo $gid ?>"><?php echo pun_htmlspecialchars($group) ?></option> |
| 361: <?php endforeach; ?> |
| 362: </select> |
| 363: <span><?php echo $lang_admin_users['New group help'] ?></span> |
| 364: </td> |
| 365: </tr> |
| 366: </table> |
| 367: </div> |
| 368: </fieldset> |
| 369: </div> |
| 370: <p class="submitend"><input type="submit" name="move_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="2" /></p> |
| 371: </form> |
| 372: </div> |
| 373: </div> |
| 374: <div class="clearer"></div> |
| 375: </div> |
| 376: <?php |
| 377: |
| 378: require PUN_ROOT.'footer.php'; |
| 379: } |
| 380: |
| 381: |
| 382: // Delete multiple users |
| 383: else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) |
| 384: { |
| 385: if ($pun_user['g_id'] > PUN_ADMIN) |
| 386: message($lang_common['No permission'], false, '403 Forbidden'); |
| 387: |
| 388: confirm_referrer('admin_users.php'); |
| 389: |
| 390: if (isset($_POST['users'])) |
| 391: { |
| 392: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
| 393: $user_ids = array_map('intval', $user_ids); |
| 394: |
| 395: // Delete invalid IDs |
| 396: $user_ids = array_diff($user_ids, array(0, 1)); |
| 397: } |
| 398: else |
| 399: $user_ids = array(); |
| 400: |
| 401: if (empty($user_ids)) |
| 402: message($lang_admin_users['No users selected']); |
| 403: |
| 404: // Are we trying to delete any admins? |
| 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()); |
| 406: if ($db->result($result) > 0) |
| 407: message($lang_admin_users['No delete admins message']); |
| 408: |
| 409: if (isset($_POST['delete_users_comply'])) |
| 410: { |
| 411: // Fetch user groups |
| 412: $user_groups = array(); |
| 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()); |
| 414: while ($cur_user = $db->fetch_assoc($result)) |
| 415: { |
| 416: if (!isset($user_groups[$cur_user['group_id']])) |
| 417: $user_groups[$cur_user['group_id']] = array(); |
| 418: |
| 419: $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
| 420: } |
| 421: |
| 422: // Are any users moderators? |
| 423: $group_ids = array_keys($user_groups); |
| 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()); |
| 425: while ($cur_group = $db->fetch_assoc($result)) |
| 426: { |
| 427: if ($cur_group['g_moderator'] == '0') |
| 428: unset($user_groups[$cur_group['g_id']]); |
| 429: } |
| 430: |
| 431: // Fetch forum list and clean up their moderator list |
| 432: $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
| 433: while ($cur_forum = $db->fetch_assoc($result)) |
| 434: { |
| 435: $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
| 436: |
| 437: foreach ($user_groups as $group_users) |
| 438: $cur_moderators = array_diff($cur_moderators, $group_users); |
| 439: |
| 440: $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
| 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()); |
| 442: } |
| 443: |
| 444: // Delete any subscriptions |
| 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()); |
| 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()); |
| 447: |
| 448: // Remove them from the online list (if they happen to be logged in) |
| 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()); |
| 450: |
| 451: // Should we delete all posts made by these users? |
| 452: if (isset($_POST['delete_posts'])) |
| 453: { |
| 454: require PUN_ROOT.'include/search_idx.php'; |
| 455: @set_time_limit(0); |
| 456: |
| 457: // Find all posts made by this user |
| 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()); |
| 459: if ($db->num_rows($result)) |
| 460: { |
| 461: while ($cur_post = $db->fetch_assoc($result)) |
| 462: { |
| 463: // Determine whether this post is the "topic post" or not |
| 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()); |
| 465: |
| 466: if ($db->result($result2) == $cur_post['id']) |
| 467: delete_topic($cur_post['topic_id']); |
| 468: else |
| 469: delete_post($cur_post['id'], $cur_post['topic_id']); |
| 470: |
| 471: update_forum($cur_post['forum_id']); |
| 472: } |
| 473: } |
| 474: } |
| 475: else |
| 476: // Set all their posts to guest |
| 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()); |
| 478: |
| 479: // Delete the users |
| 480: $db->query('DELETE FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to delete users', __FILE__, __LINE__, $db->error()); |
| 481: |
| 482: // Delete user avatars |
| 483: foreach ($user_ids as $user_id) |
| 484: delete_avatar($user_id); |
| 485: |
| 486: // Regenerate the users info cache |
| 487: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 488: require PUN_ROOT.'include/cache.php'; |
| 489: |
| 490: generate_users_info_cache(); |
| 491: |
| 492: redirect('admin_users.php', $lang_admin_users['Users delete redirect']); |
| 493: } |
| 494: |
| 495: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); |
| 496: define('PUN_ACTIVE_PAGE', 'admin'); |
| 497: require PUN_ROOT.'header.php'; |
| 498: |
| 499: generate_admin_menu('users'); |
| 500: |
| 501: ?> |
| 502: <div class="blockform"> |
| 503: <h2><span><?php echo $lang_admin_users['Delete users'] ?></span></h2> |
| 504: <div class="box"> |
| 505: <form name="confirm_del_users" method="post" action="admin_users.php"> |
| 506: <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
| 507: <div class="inform"> |
| 508: <fieldset> |
| 509: <legend><?php echo $lang_admin_users['Confirm delete legend'] ?></legend> |
| 510: <div class="infldset"> |
| 511: <p><?php echo $lang_admin_users['Confirm delete info'] ?></p> |
| 512: <div class="rbox"> |
| 513: <label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_admin_users['Delete posts'] ?><br /></label> |
| 514: </div> |
| 515: <p class="warntext"><strong><?php echo $lang_admin_users['Delete warning'] ?></strong></p> |
| 516: </div> |
| 517: </fieldset> |
| 518: </div> |
| 519: <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> |
| 520: </form> |
| 521: </div> |
| 522: </div> |
| 523: <div class="clearer"></div> |
| 524: </div> |
| 525: <?php |
| 526: |
| 527: require PUN_ROOT.'footer.php'; |
| 528: } |
| 529: |
| 530: |
| 531: // Ban multiple users |
| 532: else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) |
| 533: { |
| 534: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
| 535: message($lang_common['No permission'], false, '403 Forbidden'); |
| 536: |
| 537: confirm_referrer('admin_users.php'); |
| 538: |
| 539: if (isset($_POST['users'])) |
| 540: { |
| 541: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
| 542: $user_ids = array_map('intval', $user_ids); |
| 543: |
| 544: // Delete invalid IDs |
| 545: $user_ids = array_diff($user_ids, array(0, 1)); |
| 546: } |
| 547: else |
| 548: $user_ids = array(); |
| 549: |
| 550: if (empty($user_ids)) |
| 551: message($lang_admin_users['No users selected']); |
| 552: |
| 553: // Are we trying to ban any admins? |
| 554: $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()); |
| 555: if ($db->result($result) > 0) |
| 556: message($lang_admin_users['No ban admins message']); |
| 557: |
| 558: // Also, we cannot ban moderators |
| 559: $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()); |
| 560: if ($db->result($result) > 0) |
| 561: message($lang_admin_users['No ban mods message']); |
| 562: |
| 563: if (isset($_POST['ban_users_comply'])) |
| 564: { |
| 565: $ban_message = pun_trim($_POST['ban_message']); |
| 566: $ban_expire = pun_trim($_POST['ban_expire']); |
| 567: $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; |
| 568: |
| 569: if ($ban_expire != '' && $ban_expire != 'Never') |
| 570: { |
| 571: $ban_expire = strtotime($ban_expire.' GMT'); |
| 572: |
| 573: if ($ban_expire == -1 || !$ban_expire) |
| 574: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
| 575: |
| 576: $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; |
| 577: $ban_expire -= $diff; |
| 578: |
| 579: if ($ban_expire <= time()) |
| 580: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
| 581: } |
| 582: else |
| 583: $ban_expire = 'NULL'; |
| 584: |
| 585: $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; |
| 586: |
| 587: // Fetch user information |
| 588: $user_info = array(); |
| 589: $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()); |
| 590: while ($cur_user = $db->fetch_assoc($result)) |
| 591: $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); |
| 592: |
| 593: // Overwrite the registration IP with one from the last post (if it exists) |
| 594: if ($ban_the_ip != 0) |
| 595: { |
| 596: $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()); |
| 597: while ($cur_address = $db->fetch_assoc($result)) |
| 598: $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; |
| 599: } |
| 600: |
| 601: // And insert the bans! |
| 602: foreach ($user_ids as $user_id) |
| 603: { |
| 604: $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; |
| 605: $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; |
| 606: $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; |
| 607: |
| 608: $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()); |
| 609: } |
| 610: |
| 611: // Regenerate the bans cache |
| 612: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 613: require PUN_ROOT.'include/cache.php'; |
| 614: |
| 615: generate_bans_cache(); |
| 616: |
| 617: redirect('admin_users.php', $lang_admin_users['Users banned redirect']); |
| 618: } |
| 619: |
| 620: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); |
| 621: $focus_element = array('bans2', 'ban_message'); |
| 622: define('PUN_ACTIVE_PAGE', 'admin'); |
| 623: require PUN_ROOT.'header.php'; |
| 624: |
| 625: generate_admin_menu('users'); |
| 626: |
| 627: ?> |
| 628: <div class="blockform"> |
| 629: <h2><span><?php echo $lang_admin_users['Ban users'] ?></span></h2> |
| 630: <div class="box"> |
| 631: <form id="bans2" name="confirm_ban_users" method="post" action="admin_users.php"> |
| 632: <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
| 633: <div class="inform"> |
| 634: <fieldset> |
| 635: <legend><?php echo $lang_admin_users['Message expiry subhead'] ?></legend> |
| 636: <div class="infldset"> |
| 637: <table class="aligntop" cellspacing="0"> |
| 638: <tr> |
| 639: <th scope="row"><?php echo $lang_admin_users['Ban message label'] ?></th> |
| 640: <td> |
| 641: <input type="text" name="ban_message" size="50" maxlength="255" tabindex="1" /> |
| 642: <span><?php echo $lang_admin_users['Ban message help'] ?></span> |
| 643: </td> |
| 644: </tr> |
| 645: <tr> |
| 646: <th scope="row"><?php echo $lang_admin_users['Expire date label'] ?></th> |
| 647: <td> |
| 648: <input type="text" name="ban_expire" size="17" maxlength="10" tabindex="2" /> |
| 649: <span><?php echo $lang_admin_users['Expire date help'] ?></span> |
| 650: </td> |
| 651: </tr> |
| 652: <tr> |
| 653: <th scope="row"><?php echo $lang_admin_users['Ban IP label'] ?></th> |
| 654: <td> |
| 655: <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> |
| 656: <span><?php echo $lang_admin_users['Ban IP help'] ?></span> |
| 657: </td> |
| 658: </tr> |
| 659: </table> |
| 660: </div> |
| 661: </fieldset> |
| 662: </div> |
| 663: <p class="submitend"><input type="submit" name="ban_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="3" /></p> |
| 664: </form> |
| 665: </div> |
| 666: </div> |
| 667: <div class="clearer"></div> |
| 668: </div> |
| 669: <?php |
| 670: |
| 671: require PUN_ROOT.'footer.php'; |
| 672: } |
| 673: |
| 674: |
256: else if (isset($_GET['find_user'])) | 675: else if (isset($_GET['find_user'])) |
257: { | 676: { |
258: $form = isset($_GET['form']) ? $_GET['form'] : array(); | 677: $form = isset($_GET['form']) ? $_GET['form'] : array(); |
261: $form = array_map('pun_trim', $form); | 680: $form = array_map('pun_trim', $form); |
262: $conditions = $query_str = array(); | 681: $conditions = $query_str = array(); |
263: | 682: |
264: $posts_greater = isset($_GET['posts_greater']) ? trim($_GET['posts_greater']) : ''; | 683: $posts_greater = isset($_GET['posts_greater']) ? pun_trim($_GET['posts_greater']) : ''; |
265: $posts_less = isset($_GET['posts_less']) ? trim($_GET['posts_less']) : ''; | 684: $posts_less = isset($_GET['posts_less']) ? pun_trim($_GET['posts_less']) : ''; |
266: $last_post_after = isset($_GET['last_post_after']) ? trim($_GET['last_post_after']) : ''; | 685: $last_post_after = isset($_GET['last_post_after']) ? pun_trim($_GET['last_post_after']) : ''; |
267: $last_post_before = isset($_GET['last_post_before']) ? trim($_GET['last_post_before']) : ''; | 686: $last_post_before = isset($_GET['last_post_before']) ? pun_trim($_GET['last_post_before']) : ''; |
268: $registered_after = isset($_GET['registered_after']) ? trim($_GET['registered_after']) : ''; | 687: $last_visit_after = isset($_GET['last_visit_after']) ? pun_trim($_GET['last_visit_after']) : ''; |
269: $registered_before = isset($_GET['registered_before']) ? trim($_GET['registered_before']) : ''; | 688: $last_visit_before = isset($_GET['last_visit_before']) ? pun_trim($_GET['last_visit_before']) : ''; |
270: $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'email', 'num_posts', 'last_post', 'registered')) ? $_GET['order_by'] : 'username'; | 689: $registered_after = isset($_GET['registered_after']) ? pun_trim($_GET['registered_after']) : ''; |
| 690: $registered_before = isset($_GET['registered_before']) ? pun_trim($_GET['registered_before']) : ''; |
| 691: $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'email', 'num_posts', 'last_post', 'last_visit', 'registered')) ? $_GET['order_by'] : 'username'; |
271: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; | 692: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
272: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; | 693: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; |
273: | 694: |
275: $query_str[] = 'direction='.$direction; | 696: $query_str[] = 'direction='.$direction; |
276: $query_str[] = 'user_group='.$user_group; | 697: $query_str[] = 'user_group='.$user_group; |
277: | 698: |
278: if (preg_match('/[^0-9]/', $posts_greater.$posts_less)) | 699: if (preg_match('%[^0-9]%', $posts_greater.$posts_less)) |
279: message($lang_admin_users['Non numeric message']); | 700: message($lang_admin_users['Non numeric message']); |
280: | 701: |
281: // Try to convert date/time to timestamps | 702: // Try to convert date/time to timestamps |
299: | 720: |
300: $conditions[] = 'u.last_post<'.$last_post_before; | 721: $conditions[] = 'u.last_post<'.$last_post_before; |
301: } | 722: } |
| 723: if ($last_visit_after != '') |
| 724: { |
| 725: $query_str[] = 'last_visit_after='.$last_visit_after; |
| 726: |
| 727: $last_visit_after = strtotime($last_visit_after); |
| 728: if ($last_visit_after === false || $last_visit_after == -1) |
| 729: message($lang_admin_users['Invalid date time message']); |
| 730: |
| 731: $conditions[] = 'u.last_visit>'.$last_visit_after; |
| 732: } |
| 733: if ($last_visit_before != '') |
| 734: { |
| 735: $query_str[] = 'last_visit_before='.$last_visit_before; |
| 736: |
| 737: $last_visit_before = strtotime($last_visit_before); |
| 738: if ($last_visit_before === false || $last_visit_before == -1) |
| 739: message($lang_admin_users['Invalid date time message']); |
| 740: |
| 741: $conditions[] = 'u.last_visit<'.$last_visit_before; |
| 742: } |
302: if ($registered_after != '') | 743: if ($registered_after != '') |
303: { | 744: { |
304: $query_str[] = 'registered_after='.$registered_after; | 745: $query_str[] = 'registered_after='.$registered_after; |
357: // Generate paging links | 798: // Generate paging links |
358: $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); | 799: $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); |
359: | 800: |
| 801: // Some helper variables for permissions |
| 802: $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; |
| 803: $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); |
| 804: $can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0; |
| 805: |
360: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); | 806: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); |
| 807: $page_head = array('js' => '<script type="text/javascript" src="common.js"></script>'); |
361: define('PUN_ACTIVE_PAGE', 'admin'); | 808: define('PUN_ACTIVE_PAGE', 'admin'); |
362: require PUN_ROOT.'header.php'; | 809: require PUN_ROOT.'header.php'; |
363: | 810: |
377: </div> | 824: </div> |
378: | 825: |
379: | 826: |
| 827: <form id="search-users-form" action="admin_users.php" method="post"> |
380: <div id="users2" class="blocktable"> | 828: <div id="users2" class="blocktable"> |
381: <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> | 829: <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> |
382: <div class="box"> | 830: <div class="box"> |
390: <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> | 838: <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> |
391: <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> | 839: <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> |
392: <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> | 840: <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> |
| 841: <?php if ($can_action): ?> <th class="tcmod" scope="col"><?php echo $lang_admin_users['Select'] ?></th> |
| 842: <?php endif; ?> |
393: </tr> | 843: </tr> |
394: </thead> | 844: </thead> |
395: <tbody> | 845: <tbody> |
406: if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) | 856: if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) |
407: $user_title = '<span class="warntext">'.$lang_admin_users['Not verified'].'</span>'; | 857: $user_title = '<span class="warntext">'.$lang_admin_users['Not verified'].'</span>'; |
408: | 858: |
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>'; | 859: $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>'; |
410: | 860: |
411: ?> | 861: ?> |
412: <tr> | 862: <tr> |
416: <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> | 866: <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> |
417: <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> | 867: <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> |
418: <td class="tcr"><?php echo $actions ?></td> | 868: <td class="tcr"><?php echo $actions ?></td> |
| 869: <?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> |
| 870: <?php endif; ?> |
419: </tr> | 871: </tr> |
420: <?php | 872: <?php |
421: | 873: |
435: <div class="inbox crumbsplus"> | 887: <div class="inbox crumbsplus"> |
436: <div class="pagepost"> | 888: <div class="pagepost"> |
437: <p class="pagelink"><?php echo $paging_links ?></p> | 889: <p class="pagelink"><?php echo $paging_links ?></p> |
| 890: <?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> |
| 891: <?php endif; ?> |
438: </div> | 892: </div> |
439: <ul class="crumbs"> | 893: <ul class="crumbs"> |
440: <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> | 894: <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> |
444: <div class="clearer"></div> | 898: <div class="clearer"></div> |
445: </div> | 899: </div> |
446: </div> | 900: </div> |
| 901: </form> |
447: <?php | 902: <?php |
448: | 903: |
449: require PUN_ROOT.'footer.php'; | 904: require PUN_ROOT.'footer.php'; |
453: else | 908: else |
454: { | 909: { |
455: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users']); | 910: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users']); |
456: $focus_element = array('find_user', 'username'); | 911: $focus_element = array('find_user', 'form[username]'); |
457: define('PUN_ACTIVE_PAGE', 'admin'); | 912: define('PUN_ACTIVE_PAGE', 'admin'); |
458: require PUN_ROOT.'header.php'; | 913: require PUN_ROOT.'header.php'; |
459: | 914: |
542: <span><?php echo $lang_admin_users['Date help'] ?></span></td> | 997: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
543: </tr> | 998: </tr> |
544: <tr> | 999: <tr> |
| 1000: <th scope="row"><?php echo $lang_admin_users['Last visit after label'] ?></th> |
| 1001: <td><input type="text" name="last_visit_after" size="24" maxlength="19" tabindex="17" /> |
| 1002: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
| 1003: </tr> |
| 1004: <tr> |
| 1005: <th scope="row"><?php echo $lang_admin_users['Last visit before label'] ?></th> |
| 1006: <td><input type="text" name="last_visit_before" size="24" maxlength="19" tabindex="18" /> |
| 1007: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
| 1008: </tr> |
| 1009: <tr> |
545: <th scope="row"><?php echo $lang_admin_users['Registered after label'] ?></th> | 1010: <th scope="row"><?php echo $lang_admin_users['Registered after label'] ?></th> |
546: <td><input type="text" name="registered_after" size="24" maxlength="19" tabindex="19" /> | 1011: <td><input type="text" name="registered_after" size="24" maxlength="19" tabindex="19" /> |
547: <span><?php echo $lang_admin_users['Date help'] ?></span></td> | 1012: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
559: <option value="email"><?php echo $lang_admin_users['Order by e-mail'] ?></option> | 1024: <option value="email"><?php echo $lang_admin_users['Order by e-mail'] ?></option> |
560: <option value="num_posts"><?php echo $lang_admin_users['Order by posts'] ?></option> | 1025: <option value="num_posts"><?php echo $lang_admin_users['Order by posts'] ?></option> |
561: <option value="last_post"><?php echo $lang_admin_users['Order by last post'] ?></option> | 1026: <option value="last_post"><?php echo $lang_admin_users['Order by last post'] ?></option> |
| 1027: <option value="last_visit"><?php echo $lang_admin_users['Order by last visit'] ?></option> |
562: <option value="registered"><?php echo $lang_admin_users['Order by registered'] ?></option> | 1028: <option value="registered"><?php echo $lang_admin_users['Order by registered'] ?></option> |
563: </select>   <select name="direction" tabindex="22"> | 1029: </select>   <select name="direction" tabindex="22"> |
564: <option value="ASC" selected="selected"><?php echo $lang_admin_users['Ascending'] ?></option> | 1030: <option value="ASC" selected="selected"><?php echo $lang_admin_users['Ascending'] ?></option> |
a/db_update.php |
b/db_update.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
8: | 8: |
9: // The FluxBB version this script updates to | 9: // The FluxBB version this script updates to |
10: define('UPDATE_TO', '1.4.2'); | 10: define('UPDATE_TO', '1.4.9'); |
11: | 11: |
12: define('UPDATE_TO_DB_REVISION', 8); | 12: define('UPDATE_TO_DB_REVISION', 15); |
13: define('UPDATE_TO_SI_REVISION', 1); | 13: define('UPDATE_TO_SI_REVISION', 2); |
14: define('UPDATE_TO_PARSER_REVISION', 1); | 14: define('UPDATE_TO_PARSER_REVISION', 2); |
15: | 15: |
16: define('MIN_PHP_VERSION', '4.3.0'); | 16: define('MIN_PHP_VERSION', '4.4.0'); |
17: define('MIN_MYSQL_VERSION', '4.1.2'); | 17: define('MIN_MYSQL_VERSION', '4.1.2'); |
18: define('MIN_PGSQL_VERSION', '7.0.0'); | 18: define('MIN_PGSQL_VERSION', '7.0.0'); |
19: define('PUN_SEARCH_MIN_WORD', 3); | 19: define('PUN_SEARCH_MIN_WORD', 3); |
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, '<')) |
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.'); |
36: | 36: |
37: define('PUN_ROOT', './'); | 37: define('PUN_ROOT', dirname(__FILE__).'/'); |
38: | 38: |
39: // Attempt to load the configuration file config.php | 39: // Attempt to load the configuration file config.php |
40: if (file_exists(PUN_ROOT.'config.php')) | 40: if (file_exists(PUN_ROOT.'config.php')) |
44: if (defined('FORUM')) | 44: if (defined('FORUM')) |
45: define('PUN', FORUM); | 45: define('PUN', FORUM); |
46: | 46: |
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 |
48: if (!defined('PUN')) | 48: if (!defined('PUN')) |
49: exit('This file must be run from the forum root directory.'); | 49: { |
| 50: header('Location: install.php'); |
| 51: exit; |
| 52: } |
50: | 53: |
51: // Enable debug mode | 54: // Enable debug mode |
52: if (!defined('PUN_DEBUG')) | 55: if (!defined('PUN_DEBUG')) |
115: // Set the connection to UTF-8 now | 118: // Set the connection to UTF-8 now |
116: $db->set_names('utf8'); | 119: $db->set_names('utf8'); |
117: | 120: |
| 121: // Get the forum config |
| 122: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); |
| 123: while ($cur_config_item = $db->fetch_row($result)) |
| 124: $pun_config[$cur_config_item[0]] = $cur_config_item[1]; |
| 125: |
| 126: // Load language file |
| 127: $default_lang = $pun_config['o_default_lang']; |
| 128: |
| 129: if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) |
| 130: $default_lang = 'English'; |
| 131: |
| 132: require PUN_ROOT.'lang/'.$default_lang.'/common.php'; |
| 133: require PUN_ROOT.'lang/'.$default_lang.'/update.php'; |
| 134: |
118: // Check current version | 135: // Check current version |
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()); | 136: $cur_version = $pun_config['o_cur_version']; |
120: $cur_version = $db->result($result); | |
121: | 137: |
122: if (version_compare($cur_version, '1.2', '<')) | 138: if (version_compare($cur_version, '1.2', '<')) |
123: exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.'); | 139: error(sprintf($lang_update['Version mismatch error'], $db_name)); |
124: | 140: |
125: // Do some DB type specific checks | 141: // Do some DB type specific checks |
126: $mysql = false; | 142: $mysql = false; |
132: case 'mysqli_innodb': | 148: case 'mysqli_innodb': |
133: $mysql_info = $db->get_version(); | 149: $mysql_info = $db->get_version(); |
134: if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) | 150: if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) |
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.'); | 151: error(sprintf($lang_update['You are running error'], 'MySQL', $mysql_info['version'], UPDATE_TO, MIN_MYSQL_VERSION)); |
136: | 152: |
137: $mysql = true; | 153: $mysql = true; |
138: break; | 154: break; |
140: case 'pgsql': | 156: case 'pgsql': |
141: $pgsql_info = $db->get_version(); | 157: $pgsql_info = $db->get_version(); |
142: if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) | 158: if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) |
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.'); | 159: error(sprintf($lang_update['You are running error'], 'PostgreSQL', $pgsql_info['version'], UPDATE_TO, MIN_PGSQL_VERSION)); |
144: | 160: |
145: break; | 161: break; |
146: } | 162: } |
147: | 163: |
148: // Get the forum config | 164: // Check the database, search index and parser revision and the current version |
149: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); | |
150: while ($cur_config_item = $db->fetch_row($result)) | |
151: $pun_config[$cur_config_item[0]] = $cur_config_item[1]; | |
152: | |
153: // Check the database revision and the current version | |
154: if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION && | 165: if (isset($pun_config['o_database_revision']) && $pun_config['o_database_revision'] >= UPDATE_TO_DB_REVISION && |
155: isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION && | 166: isset($pun_config['o_searchindex_revision']) && $pun_config['o_searchindex_revision'] >= UPDATE_TO_SI_REVISION && |
156: isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION && | 167: isset($pun_config['o_parser_revision']) && $pun_config['o_parser_revision'] >= UPDATE_TO_PARSER_REVISION && |
157: version_compare($pun_config['o_cur_version'], UPDATE_TO, '>=')) | 168: version_compare($pun_config['o_cur_version'], UPDATE_TO, '>=')) |
158: exit('Your database is already as up-to-date as this script can make it.'); | 169: error($lang_update['No update error']); |
159: | 170: |
160: $default_style = $pun_config['o_default_style']; | 171: $default_style = $pun_config['o_default_style']; |
161: if (!file_exists(PUN_ROOT.'style/'.$default_style.'.css')) | 172: if (!file_exists(PUN_ROOT.'style/'.$default_style.'.css')) |
164: // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. | 175: // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. |
165: session_start(); | 176: session_start(); |
166: | 177: |
167: if (!isset($_SESSION['dupe_users'])) | |
168: $_SESSION['dupe_users'] = array(); | |
169: | |
170: // | 178: // |
171: // Determines whether $str is UTF-8 encoded or not | 179: // Determines whether $str is UTF-8 encoded or not |
172: // | 180: // |
246: // | 254: // |
247: function convert_to_utf8(&$str, $old_charset) | 255: function convert_to_utf8(&$str, $old_charset) |
248: { | 256: { |
249: if ($str === null || $str == '') | 257: if (is_null($str) || $str == '') |
250: return false; | 258: return false; |
251: | 259: |
252: $save = $str; | 260: $save = $str; |
270: $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); | 278: $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); |
271: | 279: |
272: // Replace numeric entities | 280: // Replace numeric entities |
273: $str = preg_replace_callback('/&#([0-9]+);/', 'utf8_callback_1', $str); | 281: $str = preg_replace_callback('%&#([0-9]+);%', 'utf8_callback_1', $str); |
274: $str = preg_replace_callback('/&#x([a-f0-9]+);/i', 'utf8_callback_2', $str); | 282: $str = preg_replace_callback('%&#x([a-f0-9]+);%i', 'utf8_callback_2', $str); |
275: | 283: |
276: // Remove "bad" characters | 284: // Remove "bad" characters |
277: $str = remove_bad_characters($str); | 285: $str = remove_bad_characters($str); |
323: $result = $db->query('SHOW FULL COLUMNS FROM '.$table) or error('Unable to fetch column information', __FILE__, __LINE__, $db->error()); | 331: $result = $db->query('SHOW FULL COLUMNS FROM '.$table) or error('Unable to fetch column information', __FILE__, __LINE__, $db->error()); |
324: while ($cur_column = $db->fetch_assoc($result)) | 332: while ($cur_column = $db->fetch_assoc($result)) |
325: { | 333: { |
326: if ($cur_column['Collation'] === null) | 334: if (is_null($cur_column['Collation'])) |
327: continue; | 335: continue; |
328: | 336: |
329: list($type) = explode('(', $cur_column['Type']); | 337: list($type) = explode('(', $cur_column['Type']); |
332: $allow_null = ($cur_column['Null'] == 'YES'); | 340: $allow_null = ($cur_column['Null'] == 'YES'); |
333: $collate = (substr($cur_column['Collation'], -3) == 'bin') ? 'utf8_bin' : 'utf8_general_ci'; | 341: $collate = (substr($cur_column['Collation'], -3) == 'bin') ? 'utf8_bin' : 'utf8_general_ci'; |
334: | 342: |
335: $db->alter_field($table, $cur_column['Field'], preg_replace('/'.$type.'/i', $types[$type], $cur_column['Type']), $allow_null, $cur_column['Default'], null, true) or error('Unable to alter field to binary', __FILE__, __LINE__, $db->error()); | 343: $db->alter_field($table, $cur_column['Field'], preg_replace('%'.$type.'%i', $types[$type], $cur_column['Type']), $allow_null, $cur_column['Default'], null, true) or error('Unable to alter field to binary', __FILE__, __LINE__, $db->error()); |
336: $db->alter_field($table, $cur_column['Field'], $cur_column['Type'].' CHARACTER SET utf8 COLLATE '.$collate, $allow_null, $cur_column['Default'], null, true) or error('Unable to alter field to utf8', __FILE__, __LINE__, $db->error()); | 344: $db->alter_field($table, $cur_column['Field'], $cur_column['Type'].' CHARACTER SET utf8 COLLATE '.$collate, $allow_null, $cur_column['Default'], null, true) or error('Unable to alter field to utf8', __FILE__, __LINE__, $db->error()); |
337: } | 345: } |
338: } | 346: } |
351: if ($mysql) | 359: if ($mysql) |
352: { | 360: { |
353: // Only set up the tables if we are doing this in 1 go, or its the first go | 361: // Only set up the tables if we are doing this in 1 go, or its the first go |
354: if ($start_at === null || $start_at == 0) | 362: if (is_null($start_at) || $start_at == 0) |
355: { | 363: { |
356: // Drop any temp table that exists, in-case it's left over from a failed update | 364: // Drop any temp table that exists, in-case it's left over from a failed update |
357: $db->drop_table($table.'_utf8', true) or error('Unable to drop left over temp table', __FILE__, __LINE__, $db->error()); | 365: $db->drop_table($table.'_utf8', true) or error('Unable to drop left over temp table', __FILE__, __LINE__, $db->error()); |
367: $db->set_names($old_connection_charset); | 375: $db->set_names($old_connection_charset); |
368: | 376: |
369: // Move & Convert everything | 377: // Move & Convert everything |
370: $result = $db->query('SELECT * FROM '.$table.($start_at === null ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.($start_at === null ? '' : ' LIMIT '.PER_PAGE), false) or error('Unable to select from old table', __FILE__, __LINE__, $db->error()); | 378: $result = $db->query('SELECT * FROM '.$table.(is_null($start_at) ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.(is_null($start_at) ? '' : ' LIMIT '.PER_PAGE), false) or error('Unable to select from old table', __FILE__, __LINE__, $db->error()); |
371: | 379: |
372: // Change back to utf8 mode so we can insert it into the new table | 380: // Change back to utf8 mode so we can insert it into the new table |
373: $db->set_names('utf8'); | 381: $db->set_names('utf8'); |
378: | 386: |
379: $temp = array(); | 387: $temp = array(); |
380: foreach ($cur_item as $idx => $value) | 388: foreach ($cur_item as $idx => $value) |
381: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 389: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
382: | 390: |
383: $db->query('INSERT INTO '.$table.'_utf8('.implode(',', array_keys($temp)).') VALUES ('.implode(',', array_values($temp)).')') or ($error_callback === null ? error('Unable to insert data to new table', __FILE__, __LINE__, $db->error()) : call_user_func($error_callback, $cur_item)); | 391: $db->query('INSERT INTO '.$table.'_utf8('.implode(',', array_keys($temp)).') VALUES ('.implode(',', array_values($temp)).')') or (is_null($error_callback) ? error('Unable to insert data to new table', __FILE__, __LINE__, $db->error()) : call_user_func($error_callback, $cur_item)); |
384: | 392: |
385: $end_at = $cur_item[$key]; | 393: $end_at = $cur_item[$key]; |
386: } | 394: } |
387: | 395: |
388: // If we aren't doing this all in 1 go and $end_at has a value (i.e. we have processed at least 1 row), figure out if we have more to do or not | 396: // If we aren't doing this all in 1 go and $end_at has a value (i.e. we have processed at least 1 row), figure out if we have more to do or not |
389: if ($start_at !== null && $end_at > 0) | 397: if (!is_null($start_at) && $end_at > 0) |
390: { | 398: { |
391: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); | 399: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); |
392: $finished = $db->num_rows($result) == 0; | 400: $finished = $db->num_rows($result) == 0; |
409: else | 417: else |
410: { | 418: { |
411: // Convert everything | 419: // Convert everything |
412: $result = $db->query('SELECT * FROM '.$table.($start_at === null ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.($start_at === null ? '' : ' LIMIT '.PER_PAGE)) or error('Unable to select from table', __FILE__, __LINE__, $db->error()); | 420: $result = $db->query('SELECT * FROM '.$table.(is_null($start_at) ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.(is_null($start_at ) ? '' : ' LIMIT '.PER_PAGE)) or error('Unable to select from table', __FILE__, __LINE__, $db->error()); |
413: while ($cur_item = $db->fetch_assoc($result)) | 421: while ($cur_item = $db->fetch_assoc($result)) |
414: { | 422: { |
415: $cur_item = call_user_func($callback, $cur_item, $old_charset); | 423: $cur_item = call_user_func($callback, $cur_item, $old_charset); |
416: | 424: |
417: $temp = array(); | 425: $temp = array(); |
418: foreach ($cur_item as $idx => $value) | 426: foreach ($cur_item as $idx => $value) |
419: $temp[] = $idx.'='.($value === null ? 'NULL' : '\''.$db->escape($value).'\''); | 427: $temp[] = $idx.'='.(is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''); |
420: | 428: |
421: if (!empty($temp)) | 429: if (!empty($temp)) |
422: $db->query('UPDATE '.$table.' SET '.implode(', ', $temp).' WHERE '.$key.'=\''.$db->escape($cur_item[$key]).'\'') or error('Unable to update data', __FILE__, __LINE__, $db->error()); | 430: $db->query('UPDATE '.$table.' SET '.implode(', ', $temp).' WHERE '.$key.'=\''.$db->escape($cur_item[$key]).'\'') or error('Unable to update data', __FILE__, __LINE__, $db->error()); |
424: $end_at = $cur_item[$key]; | 432: $end_at = $cur_item[$key]; |
425: } | 433: } |
426: | 434: |
427: if ($start_at !== null && $end_at > 0) | 435: if (!is_null($start_at) && $end_at > 0) |
428: { | 436: { |
429: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); | 437: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); |
430: if ($db->num_rows($result) == 0) | 438: if ($db->num_rows($result) == 0) |
444: while (@ob_end_clean()); | 452: while (@ob_end_clean()); |
445: | 453: |
446: | 454: |
447: $stage = isset($_GET['stage']) ? $_GET['stage'] : ''; | 455: $stage = isset($_REQUEST['stage']) ? $_REQUEST['stage'] : ''; |
448: $old_charset = isset($_GET['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_GET['req_old_charset'])) : 'ISO-8859-1'; | 456: $old_charset = isset($_REQUEST['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_REQUEST['req_old_charset'])) : 'ISO-8859-1'; |
449: $start_at = isset($_GET['start_at']) ? intval($_GET['start_at']) : 0; | 457: $start_at = isset($_REQUEST['start_at']) ? intval($_REQUEST['start_at']) : 0; |
450: $query_str = ''; | 458: $query_str = ''; |
451: | 459: |
452: switch ($stage) | 460: // Show form |
| 461: if (empty($stage)) |
453: { | 462: { |
454: // Show form | 463: if (file_exists(FORUM_CACHE_DIR.'db_update.lock')) |
455: case '': | 464: { |
| 465: // Deal with newlines, tabs and multiple spaces |
| 466: $pattern = array("\t", ' ', ' '); |
| 467: $replace = array('    ', '  ', '  '); |
| 468: $message = str_replace($pattern, $replace, $pun_config['o_maintenance_message']); |
| 469: |
| 470: ?> |
| 471: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang_common['lang_identifier'] ?>" lang="<?php echo $lang_common['lang_identifier'] ?>" dir="<?php echo $lang_common['lang_direction'] ?>"> |
| 472: <head> |
| 473: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 474: <title><?php echo $lang_update['Maintenance'] ?></title> |
| 475: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
| 476: </head> |
| 477: <body> |
| 478: |
| 479: <div id="punmaint" class="pun"> |
| 480: <div class="top-box"><div><!-- Top Corners --></div></div> |
| 481: <div class="punwrap"> |
| 482: |
| 483: <div id="brdmain"> |
| 484: <div class="block"> |
| 485: <h2><?php echo $lang_update['Maintenance'] ?></h2> |
| 486: <div class="box"> |
| 487: <div class="inbox"> |
| 488: <p><?php echo $message ?></p> |
| 489: </div> |
| 490: </div> |
| 491: </div> |
| 492: </div> |
| 493: |
| 494: </div> |
| 495: <div class="end-box"><div><!-- Bottom Corners --></div></div> |
| 496: </div> |
| 497: |
| 498: </body> |
| 499: </html> |
| 500: <?php |
| 501: |
| 502: } |
| 503: else |
| 504: { |
456: | 505: |
457: ?> | 506: ?> |
458: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | 507: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
459: | 508: |
460: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 509: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang_common['lang_identifier'] ?>" lang="<?php echo $lang_common['lang_identifier'] ?>" dir="<?php echo $lang_common['lang_direction'] ?>"> |
461: <head> | 510: <head> |
462: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 511: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
463: <title>FluxBB Database Update</title> | 512: <title><?php echo $lang_update['Update'] ?></title> |
464: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> | 513: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
465: </head> | 514: </head> |
466: <body> | 515: <body onload="document.getElementById('install').req_db_pass.focus();document.getElementById('install').start.disabled=false;"> |
467: | 516: |
468: <div id="pundb_update" class="pun"> | 517: <div id="pundb_update" class="pun"> |
469: <div class="top-box"><div><!-- Top Corners --></div></div> | 518: <div class="top-box"><div><!-- Top Corners --></div></div> |
470: <div class="punwrap"> | 519: <div class="punwrap"> |
471: | 520: |
| 521: <div id="brdheader" class="block"> |
| 522: <div class="box"> |
| 523: <div id="brdtitle" class="inbox"> |
| 524: <h1><span><?php echo $lang_update['Update'] ?></span></h1> |
| 525: <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> |
| 526: </div> |
| 527: </div> |
| 528: </div> |
| 529: |
| 530: <div id="brdmain"> |
472: <div class="blockform"> | 531: <div class="blockform"> |
473: <h2><span>FluxBB Update</span></h2> | 532: <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
474: <div class="box"> | 533: <div class="box"> |
475: <form method="get" action="<?php echo pun_htmlspecialchars($_SERVER['REQUEST_URI']) ?>" onsubmit="this.start.disabled=true"> | 534: <form id="install" method="post" action="db_update.php"> |
476: <input type="hidden" name="stage" value="start" /> | 535: <input type="hidden" name="stage" value="start" /> |
| 536: <div class="inform"> |
| 537: <fieldset> |
| 538: <legend><?php echo $lang_update['Administrator only'] ?></legend> |
| 539: <div class="infldset"> |
| 540: <p><?php echo $lang_update['Database password info'] ?></p> |
| 541: <p><strong><?php echo $lang_update['Note']; ?></strong> <?php echo $lang_update['Database password note'] ?></p> |
| 542: <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> |
| 543: <p><?php echo $lang_update['Maintenance message info'] ?></p> |
| 544: <div class="txtarea"> |
| 545: <label class="required"><strong><?php echo $lang_update['Maintenance message'] ?> <span><?php echo $lang_update['Required'] ?></span></strong><br /> |
| 546: <textarea name="req_maintenance_message" rows="4" cols="65"><?php echo pun_htmlspecialchars($pun_config['o_maintenance_message']) ?></textarea><br /></label> |
| 547: </div> |
| 548: </div> |
| 549: </fieldset> |
| 550: </div> |
477: <div class="inform"> | 551: <div class="inform"> |
478: <div class="forminfo"> | 552: <div class="forminfo"> |
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> | 553: <p><?php echo $lang_update['Intro 1'] ?></p> |
480: <p style="font-size: 1.1em">Did you read the update instructions in the documentation? If not, start there.</p> | 554: <p><?php echo $lang_update['Intro 2'] ?></p> |
481: <?php | 555: <?php |
482: | 556: |
483: if (strpos($cur_version, '1.2') === 0) | 557: if (strpos($cur_version, '1.2') === 0) |
484: { | |
485: if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) | |
486: { | 558: { |
| 559: if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) |
| 560: { |
487: | 561: |
488: ?> | 562: ?> |
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> | 563: <p><?php echo $lang_update['No charset conversion'] ?></p> |
490: <?php | 564: <?php |
491: | 565: |
492: } | 566: } |
493: | 567: |
494: ?> | 568: ?> |
495: </div> | 569: </div> |
496: </div> | 570: </div> |
497: <div class="inform"> | 571: <div class="inform"> |
498: <div class="forminfo"> | 572: <div class="forminfo"> |
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> | 573: <p><?php echo $lang_update['Enable conversion'] ?></p> |
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> | 574: <p><?php echo $lang_update['Current character set'] ?></p> |
501: </div> | 575: </div> |
502: <fieldset> | 576: <fieldset> |
503: <legend>Charset conversion</legend> | 577: <legend><?php echo $lang_update['Charset conversion'] ?></legend> |
504: <div class="infldset"> | 578: <div class="infldset"> |
505: <div class="rbox"> | 579: <div class="rbox"> |
506: <label><input type="checkbox" name="convert_charset" value="1" checked="checked" /><strong>Enable conversion</strong> (perform database charset conversion).<br /></label> | 580: <label><input type="checkbox" name="convert_charset" value="1" checked="checked" /><?php echo $lang_update['Enable conversion label'] ?><br /></label> |
507: </div> | 581: </div> |
508: <label> | 582: <label> |
509: <strong>Current character set</strong><br />Accept default for English forums otherwise the character set of the primary language pack.<br /> | 583: <strong><?php echo $lang_update['Current character set label'] ?></strong><br /><?php echo $lang_update['Current character set info'] ?><br /> |
510: <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br /> | 584: <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br /> |
511: </label> | 585: </label> |
512: </div> | 586: </div> |
513: </fieldset> | 587: </fieldset> |
514: <?php | 588: <?php |
515: | 589: |
516: } | 590: } |
517: else | 591: else |
518: echo "\t\t\t\t".'</div>'."\n"; | 592: echo "\t\t\t\t".'</div>'."\n"; |
519: | 593: |
520: ?> | 594: ?> |
521: </div> | 595: </div> |
522: <p class="buttons"><input type="submit" name="start" value="Start update" /></p> | 596: <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_update['Start update'] ?>" /></p> |
523: </form> | 597: </form> |
524: </div> | 598: </div> |
525: </div> | 599: </div> |
| 600: </div> |
526: | 601: |
527: </div> | 602: </div> |
528: <div class="end-box"><div><!-- Bottom Corners --></div></div> | 603: <div class="end-box"><div><!-- Bottom Corners --></div></div> |
532: </html> | 607: </html> |
533: <?php | 608: <?php |
534: | 609: |
535: break; | 610: } |
| 611: $db->end_transaction(); |
| 612: $db->close(); |
| 613: exit; |
| 614: |
| 615: } |
| 616: |
| 617: // Read the lock file |
| 618: $lock = file_exists(FORUM_CACHE_DIR.'db_update.lock') ? trim(file_get_contents(FORUM_CACHE_DIR.'db_update.lock')) : false; |
| 619: $lock_error = false; |
| 620: |
| 621: // Generate or fetch the UID - this confirms we have a valid admin |
| 622: if (isset($_POST['req_db_pass'])) |
| 623: { |
| 624: $req_db_pass = strtolower(pun_trim($_POST['req_db_pass'])); |
| 625: |
| 626: switch ($db_type) |
| 627: { |
| 628: // For SQLite we compare against the database file name, since the password is left blank |
| 629: case 'sqlite': |
| 630: if ($req_db_pass != strtolower($db_name)) |
| 631: error(sprintf($lang_update['Invalid file error'], 'config.php')); |
| 632: |
| 633: break; |
| 634: // For everything else, check the password matches |
| 635: default: |
| 636: if ($req_db_pass != strtolower($db_password)) |
| 637: error(sprintf($lang_update['Invalid password error'], 'config.php')); |
| 638: |
| 639: break; |
| 640: } |
| 641: |
| 642: // Generate a unique id to identify this session, only if this is a valid session |
| 643: $uid = pun_hash($req_db_pass.'|'.uniqid(rand(), true)); |
| 644: if ($lock) // We already have a lock file |
| 645: $lock_error = true; |
| 646: else // Create the lock file |
| 647: { |
| 648: $fh = @fopen(FORUM_CACHE_DIR.'db_update.lock', 'wb'); |
| 649: if (!$fh) |
| 650: error(sprintf($lang_update['Unable to lock error'], 'cache')); |
| 651: |
| 652: fwrite($fh, $uid); |
| 653: fclose($fh); |
| 654: |
| 655: // Update maintenance message |
| 656: if ($_POST['req_maintenance_message'] != '') |
| 657: $maintenance_message = pun_trim(pun_linebreaks($_POST['req_maintenance_message'])); |
| 658: else |
| 659: { |
| 660: // Load the admin_options.php language file |
| 661: require PUN_ROOT.'lang/'.$default_lang.'/admin_options.php'; |
| 662: |
| 663: $maintenance_message = $lang_admin_options['Default maintenance message']; |
| 664: } |
| 665: |
| 666: $db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$db->escape($maintenance_message).'\' WHERE conf_name=\'o_maintenance_message\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error()); |
| 667: |
| 668: // Regenerate the config cache |
| 669: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 670: require PUN_ROOT.'include/cache.php'; |
| 671: |
| 672: generate_config_cache(); |
| 673: } |
| 674: } |
| 675: else if (isset($_GET['uid'])) |
| 676: { |
| 677: $uid = pun_trim($_GET['uid']); |
| 678: if (!$lock || $lock != $uid) // The lock doesn't exist or doesn't match the given UID |
| 679: $lock_error = true; |
| 680: } |
| 681: else |
| 682: error($lang_update['No password error']); |
536: | 683: |
| 684: // If there is an error with the lock file |
| 685: if ($lock_error) |
| 686: error(sprintf($lang_update['Script runs error'], FORUM_CACHE_DIR.'db_update.lock')); |
537: | 687: |
| 688: switch ($stage) |
| 689: { |
538: // Start by updating the database structure | 690: // Start by updating the database structure |
539: case 'start': | 691: case 'start': |
540: $query_str = '?stage=preparse_posts'; | 692: $query_str = '?stage=preparse_posts'; |
623: if (!array_key_exists('o_feed_type', $pun_config)) | 775: if (!array_key_exists('o_feed_type', $pun_config)) |
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()); | 776: $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()); |
625: | 777: |
| 778: // Insert new config option o_feed_ttl |
| 779: if (!array_key_exists('o_feed_ttl', $pun_config)) |
| 780: $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()); |
| 781: |
626: // Insert config option o_base_url which was removed in 1.3 | 782: // Insert config option o_base_url which was removed in 1.3 |
627: if (!array_key_exists('o_base_url', $pun_config)) | 783: if (!array_key_exists('o_base_url', $pun_config)) |
628: { | 784: { |
631: { | 787: { |
632: // Make an educated guess regarding base_url | 788: // Make an educated guess regarding base_url |
633: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol | 789: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol |
634: $base_url .= preg_replace('/:(80|443)$/', '', $_SERVER['HTTP_HOST']); // host[:port] | 790: $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port] |
635: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path | 791: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path |
636: } | 792: } |
637: | 793: |
665: $mod_gid = $db->result($result); | 821: $mod_gid = $db->result($result); |
666: else | 822: else |
667: { | 823: { |
668: $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('."'Moderators', 'Moderator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error()); | 824: $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('."'Moderators', 'Moderator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error()); |
669: $mod_gid = $db->insert_id(); | 825: $mod_gid = $db->insert_id(); |
670: } | 826: } |
671: | 827: |
828: $db->add_field('groups', 'g_send_email', 'TINYINT(1)', false, 1, 'g_search_users') or error('Unable to add g_send_email field', __FILE__, __LINE__, $db->error()); | 984: $db->add_field('groups', 'g_send_email', 'TINYINT(1)', false, 1, 'g_search_users') or error('Unable to add g_send_email field', __FILE__, __LINE__, $db->error()); |
829: $db->add_field('groups', 'g_email_flood', 'SMALLINT(6)', false, 60, 'g_search_flood') or error('Unable to add g_email_flood field', __FILE__, __LINE__, $db->error()); | 985: $db->add_field('groups', 'g_email_flood', 'SMALLINT(6)', false, 60, 'g_search_flood') or error('Unable to add g_email_flood field', __FILE__, __LINE__, $db->error()); |
830: | 986: |
831: // Set non-default g_send_email and g_flood_email values properly | 987: // Add the last_report_sent column to the users table and the g_report_flood |
| 988: // column to the groups table |
| 989: $db->add_field('users', 'last_report_sent', 'INT(10) UNSIGNED', true, null, 'last_email_sent') or error('Unable to add last_report_sent field', __FILE__, __LINE__, $db->error()); |
| 990: $db->add_field('groups', 'g_report_flood', 'SMALLINT(6)', false, 60, 'g_email_flood') or error('Unable to add g_report_flood field', __FILE__, __LINE__, $db->error()); |
| 991: |
| 992: // Set non-default g_send_email, g_flood_email and g_flood_report values properly |
832: $db->query('UPDATE '.$db->prefix.'groups SET g_send_email = 0 WHERE g_id = 3') or error('Unable to update group email permissions', __FILE__, __LINE__, $db->error()); | 993: $db->query('UPDATE '.$db->prefix.'groups SET g_send_email = 0 WHERE g_id = 3') or error('Unable to update group email permissions', __FILE__, __LINE__, $db->error()); |
833: $db->query('UPDATE '.$db->prefix.'groups SET g_email_flood = 0 WHERE g_id IN (1,2,3)') or error('Unable to update group email permissions', __FILE__, __LINE__, $db->error()); | 994: $db->query('UPDATE '.$db->prefix.'groups SET g_email_flood = 0, g_report_flood = 0 WHERE g_id IN (1,2,3)') or error('Unable to update group email permissions', __FILE__, __LINE__, $db->error()); |
834: | 995: |
835: // Add the auto notify/subscription option to the users table | 996: // Add the auto notify/subscription option to the users table |
836: $db->add_field('users', 'auto_notify', 'TINYINT(1)', false, 0, 'notify_with_post') or error('Unable to add auto_notify field', __FILE__, __LINE__, $db->error()); | 997: $db->add_field('users', 'auto_notify', 'TINYINT(1)', false, 0, 'notify_with_post') or error('Unable to add auto_notify field', __FILE__, __LINE__, $db->error()); |
961: $db->create_table('search_words', $schema); | 1122: $db->create_table('search_words', $schema); |
962: } | 1123: } |
963: | 1124: |
| 1125: // Rename the subscription table |
| 1126: $db->rename_table('subscriptions', 'topic_subscriptions'); |
| 1127: |
| 1128: // if we don't have the forum_subscriptions table, create it |
| 1129: if (!$db->table_exists('forum_subscriptions')) |
| 1130: { |
| 1131: $schema = array( |
| 1132: 'FIELDS' => array( |
| 1133: 'user_id' => array( |
| 1134: 'datatype' => 'INT(10) UNSIGNED', |
| 1135: 'allow_null' => false, |
| 1136: 'default' => '0' |
| 1137: ), |
| 1138: 'forum_id' => array( |
| 1139: 'datatype' => 'INT(10) UNSIGNED', |
| 1140: 'allow_null' => false, |
| 1141: 'default' => '0' |
| 1142: ) |
| 1143: ), |
| 1144: 'PRIMARY KEY' => array('user_id', 'forum_id') |
| 1145: ); |
| 1146: |
| 1147: $db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error()); |
| 1148: } |
| 1149: |
| 1150: // Insert new config option o_forum_subscriptions |
| 1151: if (!array_key_exists('o_forum_subscriptions', $pun_config)) |
| 1152: $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()); |
| 1153: |
| 1154: // Rename config option o_subscriptions to o_topic_subscriptions |
| 1155: if (!array_key_exists('o_topic_subscriptions', $pun_config)) |
| 1156: $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()); |
| 1157: |
964: // Change the default style if the old doesn't exist anymore | 1158: // Change the default style if the old doesn't exist anymore |
965: if ($pun_config['o_default_style'] != $default_style) | 1159: if ($pun_config['o_default_style'] != $default_style) |
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()); | 1160: $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()); |
967: | 1161: |
| 1162: // For MySQL(i) without InnoDB, change the engine of the online table (for performance reasons) |
| 1163: if ($db_type == 'mysql' || $db_type == 'mysqli') |
| 1164: $db->query('ALTER TABLE '.$db->prefix.'online ENGINE = MyISAM') or error('Unable to change engine type of online table to MyISAM', __FILE__, __LINE__, $db->error()); |
| 1165: |
968: // Should we do charset conversion or not? | 1166: // Should we do charset conversion or not? |
969: if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) | 1167: if (strpos($cur_version, '1.2') === 0 && isset($_POST['convert_charset'])) |
970: $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; | 1168: $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; |
971: | 1169: |
972: break; | 1170: break; |
978: | 1176: |
979: function _conv_bans($cur_item, $old_charset) | 1177: function _conv_bans($cur_item, $old_charset) |
980: { | 1178: { |
981: echo 'Converting ban '.$cur_item['id'].' …<br />'."\n"; | 1179: global $lang_update; |
| 1180: |
| 1181: echo sprintf($lang_update['Converting item'], $lang_update['ban'], $cur_item['id']).'<br />'."\n"; |
982: | 1182: |
983: convert_to_utf8($cur_item['username'], $old_charset); | 1183: convert_to_utf8($cur_item['username'], $old_charset); |
984: convert_to_utf8($cur_item['message'], $old_charset); | 1184: convert_to_utf8($cur_item['message'], $old_charset); |
998: case 'conv_categories': | 1198: case 'conv_categories': |
999: $query_str = '?stage=conv_censors&req_old_charset='.$old_charset; | 1199: $query_str = '?stage=conv_censors&req_old_charset='.$old_charset; |
1000: | 1200: |
1001: echo 'Converting categories …'."<br />\n"; | 1201: echo sprintf($lang_update['Converting'], $lang_update['categories']).'<br />'."\n"; |
1002: | 1202: |
1003: function _conv_categories($cur_item, $old_charset) | 1203: function _conv_categories($cur_item, $old_charset) |
1004: { | 1204: { |
1016: case 'conv_censors': | 1216: case 'conv_censors': |
1017: $query_str = '?stage=conv_config&req_old_charset='.$old_charset; | 1217: $query_str = '?stage=conv_config&req_old_charset='.$old_charset; |
1018: | 1218: |
1019: echo 'Converting censor words …'."<br />\n"; | 1219: echo sprintf($lang_update['Converting'], $lang_update['censor words']).'<br />'."\n"; |
1020: | 1220: |
1021: function _conv_censoring($cur_item, $old_charset) | 1221: function _conv_censoring($cur_item, $old_charset) |
1022: { | 1222: { |
1035: case 'conv_config': | 1235: case 'conv_config': |
1036: $query_str = '?stage=conv_forums&req_old_charset='.$old_charset; | 1236: $query_str = '?stage=conv_forums&req_old_charset='.$old_charset; |
1037: | 1237: |
1038: echo 'Converting configuration …'."<br />\n"; | 1238: echo sprintf($lang_update['Converting'], $lang_update['configuration']).'<br />'."\n"; |
1039: | 1239: |
1040: function _conv_config($cur_item, $old_charset) | 1240: function _conv_config($cur_item, $old_charset) |
1041: { | 1241: { |
1053: case 'conv_forums': | 1253: case 'conv_forums': |
1054: $query_str = '?stage=conv_perms&req_old_charset='.$old_charset; | 1254: $query_str = '?stage=conv_perms&req_old_charset='.$old_charset; |
1055: | 1255: |
1056: echo 'Converting forums …'."<br />\n"; | 1256: echo sprintf($lang_update['Converting'], $lang_update['forums']).'<br />'."\n"; |
1057: | 1257: |
1058: function _conv_forums($cur_item, $old_charset) | 1258: function _conv_forums($cur_item, $old_charset) |
1059: { | 1259: { |
1092: case 'conv_groups': | 1292: case 'conv_groups': |
1093: $query_str = '?stage=conv_online&req_old_charset='.$old_charset; | 1293: $query_str = '?stage=conv_online&req_old_charset='.$old_charset; |
1094: | 1294: |
1095: echo 'Converting groups …'."<br />\n"; | 1295: echo sprintf($lang_update['Converting'], $lang_update['groups']).'<br />'."\n"; |
1096: | 1296: |
1097: function _conv_groups($cur_item, $old_charset) | 1297: function _conv_groups($cur_item, $old_charset) |
1098: { | 1298: { |
1125: | 1325: |
1126: function _conv_posts($cur_item, $old_charset) | 1326: function _conv_posts($cur_item, $old_charset) |
1127: { | 1327: { |
1128: echo 'Converting post '.$cur_item['id'].' …<br />'."\n"; | 1328: global $lang_update; |
| 1329: |
| 1330: echo sprintf($lang_update['Converting item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
1129: | 1331: |
1130: convert_to_utf8($cur_item['poster'], $old_charset); | 1332: convert_to_utf8($cur_item['poster'], $old_charset); |
1131: convert_to_utf8($cur_item['message'], $old_charset); | 1333: convert_to_utf8($cur_item['message'], $old_charset); |
1146: case 'conv_ranks': | 1348: case 'conv_ranks': |
1147: $query_str = '?stage=conv_reports&req_old_charset='.$old_charset; | 1349: $query_str = '?stage=conv_reports&req_old_charset='.$old_charset; |
1148: | 1350: |
1149: echo 'Converting ranks …'."<br />\n"; | 1351: echo sprintf($lang_update['Converting'], $lang_update['ranks']).'<br />'."\n"; |
1150: | 1352: |
1151: function _conv_ranks($cur_item, $old_charset) | 1353: function _conv_ranks($cur_item, $old_charset) |
1152: { | 1354: { |
1166: | 1368: |
1167: function _conv_reports($cur_item, $old_charset) | 1369: function _conv_reports($cur_item, $old_charset) |
1168: { | 1370: { |
1169: echo 'Converting report '.$cur_item['id'].' …<br />'."\n"; | 1371: global $lang_update; |
| 1372: |
| 1373: echo sprintf($lang_update['Converting item'], $lang_update['report'], $cur_item['id']).'<br />'."\n"; |
1170: | 1374: |
1171: convert_to_utf8($cur_item['message'], $old_charset); | 1375: convert_to_utf8($cur_item['message'], $old_charset); |
1172: | 1376: |
1236: case 'conv_subscriptions': | 1440: case 'conv_subscriptions': |
1237: $query_str = '?stage=conv_topics&req_old_charset='.$old_charset; | 1441: $query_str = '?stage=conv_topics&req_old_charset='.$old_charset; |
1238: | 1442: |
1239: alter_table_utf8($db->prefix.'subscriptions'); | 1443: // By this stage we should have already renamed the subscription table |
| 1444: alter_table_utf8($db->prefix.'topic_subscriptions'); |
| 1445: alter_table_utf8($db->prefix.'forum_subscriptions'); // This should actually already be utf8, but for consistency... |
1240: | 1446: |
1241: break; | 1447: break; |
1242: | 1448: |
1247: | 1453: |
1248: function _conv_topics($cur_item, $old_charset) | 1454: function _conv_topics($cur_item, $old_charset) |
1249: { | 1455: { |
1250: echo 'Converting topic '.$cur_item['id'].' …<br />'."\n"; | 1456: global $lang_update; |
| 1457: |
| 1458: echo sprintf($lang_update['Converting item'], $lang_update['topic'], $cur_item['id']).'<br />'."\n"; |
1251: | 1459: |
1252: convert_to_utf8($cur_item['poster'], $old_charset); | 1460: convert_to_utf8($cur_item['poster'], $old_charset); |
1253: convert_to_utf8($cur_item['subject'], $old_charset); | 1461: convert_to_utf8($cur_item['subject'], $old_charset); |
1268: case 'conv_users': | 1476: case 'conv_users': |
1269: $query_str = '?stage=preparse_posts'; | 1477: $query_str = '?stage=preparse_posts'; |
1270: | 1478: |
| 1479: if ($start_at == 0) |
| 1480: $_SESSION['dupe_users'] = array(); |
| 1481: |
1271: function _conv_users($cur_item, $old_charset) | 1482: function _conv_users($cur_item, $old_charset) |
1272: { | 1483: { |
1273: echo 'Converting user '.$cur_item['id'].' …<br />'."\n"; | 1484: global $lang_update; |
| 1485: |
| 1486: echo sprintf($lang_update['Converting item'], $lang_update['user'], $cur_item['id']).'<br />'."\n"; |
1274: | 1487: |
1275: convert_to_utf8($cur_item['username'], $old_charset); | 1488: convert_to_utf8($cur_item['username'], $old_charset); |
1276: convert_to_utf8($cur_item['title'], $old_charset); | 1489: convert_to_utf8($cur_item['title'], $old_charset); |
1317: $username = pun_trim($_POST['dupe_users'][$id]); | 1530: $username = pun_trim($_POST['dupe_users'][$id]); |
1318: | 1531: |
1319: if (pun_strlen($username) < 2) | 1532: if (pun_strlen($username) < 2) |
1320: $errors[$id][] = 'Usernames must be at least 2 characters long. Please choose another (longer) username.'; | 1533: $errors[$id][] = $lang_update['Username too short error']; |
1321: else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters | 1534: else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
1322: $errors[$id][] = 'Usernames must not be more than 25 characters long. Please choose another (shorter) username.'; | 1535: $errors[$id][] = $lang_update['Username too long error']; |
1323: else if (!strcasecmp($username, 'Guest')) | 1536: else if (!strcasecmp($username, 'Guest')) |
1324: $errors[$id][] = 'The username guest is reserved. Please choose another username.'; | 1537: $errors[$id][] = $lang_update['Username Guest reserved error']; |
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)) | 1538: 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)) |
1326: $errors[$id][] = 'Usernames may not be in the form of an IP address. Please choose another username.'; | 1539: $errors[$id][] = $lang_update['Username IP format error']; |
1327: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) | 1540: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
1328: $errors[$id][] = 'Usernames may not contain all the characters \', " and [ or ] at once. Please choose another username.'; | 1541: $errors[$id][] = $lang_update['Username bad characters error']; |
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)) | 1542: 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)) |
1330: $errors[$id][] = 'Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please choose another username.'; | 1543: $errors[$id][] = $lang_update['Username BBCode error']; |
1331: | 1544: |
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()); | 1545: $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()); |
1333: | 1546: |
1334: if ($db->num_rows($result)) | 1547: if ($db->num_rows($result)) |
1335: { | 1548: { |
1336: $busy = $db->result($result); | 1549: $busy = $db->result($result); |
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.'; | 1550: $errors[$id][] = sprintf($lang_update['Username duplicate error'], pun_htmlspecialchars($busy)); |
1338: } | 1551: } |
1339: | 1552: |
1340: if (empty($errors[$id])) | 1553: if (empty($errors[$id])) |
1344: | 1557: |
1345: $temp = array(); | 1558: $temp = array(); |
1346: foreach ($cur_user as $idx => $value) | 1559: foreach ($cur_user as $idx => $value) |
1347: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 1560: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
1348: | 1561: |
1349: // Insert the renamed user | 1562: // Insert the renamed user |
1350: $db->query('INSERT INTO '.$db->prefix.'users('.implode(',', array_keys($temp)).') VALUES ('.implode(',', array_values($temp)).')') or error('Unable to insert data to new table', __FILE__, __LINE__, $db->error()); | 1563: $db->query('INSERT INTO '.$db->prefix.'users('.implode(',', array_keys($temp)).') VALUES ('.implode(',', array_values($temp)).')') or error('Unable to insert data to new table', __FILE__, __LINE__, $db->error()); |
1396: $mail_message = trim(substr($mail_tpl, $first_crlf)); | 1609: $mail_message = trim(substr($mail_tpl, $first_crlf)); |
1397: | 1610: |
1398: $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject); | 1611: $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject); |
1399: $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message); | 1612: $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); |
1400: $mail_message = str_replace('<old_username>', $old_username, $mail_message); | 1613: $mail_message = str_replace('<old_username>', $old_username, $mail_message); |
1401: $mail_message = str_replace('<new_username>', $username, $mail_message); | 1614: $mail_message = str_replace('<new_username>', $username, $mail_message); |
1402: $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' Mailer', $mail_message); | 1615: $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'], $mail_message); |
1403: | 1616: |
1404: pun_mail($cur_user['email'], $mail_subject, $mail_message); | 1617: pun_mail($cur_user['email'], $mail_subject, $mail_message); |
1405: | 1618: |
1415: ?> | 1628: ?> |
1416: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | 1629: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
1417: | 1630: |
1418: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 1631: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang_common['lang_identifier'] ?>" lang="<?php echo $lang_common['lang_identifier'] ?>" dir="<?php echo $lang_common['lang_direction'] ?>"> |
1419: <head> | 1632: <head> |
1420: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1633: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1421: <title>FluxBB Database Update</title> | 1634: <title><?php echo $lang_update['Update'] ?></title> |
1422: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> | 1635: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
1423: </head> | 1636: </head> |
1424: <body> | 1637: <body> |
1428: <div class="punwrap"> | 1641: <div class="punwrap"> |
1429: | 1642: |
1430: <div class="blockform"> | 1643: <div class="blockform"> |
1431: <h2><span>Error converting users</span></h2> | 1644: <h2><span><?php echo $lang_update['Error converting users'] ?></span></h2> |
1432: <div class="box"> | 1645: <div class="box"> |
1433: <form method="post" action="db_update.php?stage=conv_users_dupe"> | 1646: <form method="post" action="db_update.php?stage=conv_users_dupe&uid=<?php echo $uid ?>"> |
1434: <input type="hidden" name="form_sent" value="1" /> | 1647: <input type="hidden" name="form_sent" value="1" /> |
1435: <div class="inform"> | 1648: <div class="inform"> |
1436: <div class="forminfo"> | 1649: <div class="forminfo"> |
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> | 1650: <p style="font-size: 1.1em"><?php echo $lang_update['Error info 1'] ?></p> |
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> | 1651: <p style="font-size: 1.1em"><?php echo $lang_update['Error info 2'] ?></p> |
1439: </div> | 1652: </div> |
1440: </div> | 1653: </div> |
1441: <?php | 1654: <?php |
1448: <fieldset> | 1661: <fieldset> |
1449: <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> | 1662: <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> |
1450: <div class="infldset"> | 1663: <div class="infldset"> |
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> | 1664: <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> |
1452: </div> | 1665: </div> |
1453: </fieldset> | 1666: </fieldset> |
1454: <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> | 1667: <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> |
1455: <h3>The following errors need to be corrected:</h3> | 1668: <h3><?php echo $lang_update['Correct errors'] ?></h3> |
1456: <ul class="error-list"> | 1669: <ul class="error-list"> |
1457: <?php | 1670: <?php |
1458: | 1671: |
1467: } | 1680: } |
1468: | 1681: |
1469: ?> | 1682: ?> |
1470: <p class="buttons"><input type="submit" name="rename" value="Rename users" /></p> | 1683: <p class="buttons"><input type="submit" name="rename" value="<?php echo $lang_update['Rename users'] ?>" /></p> |
1471: </form> | 1684: </form> |
1472: </div> | 1685: </div> |
1473: </div> | 1686: </div> |
1502: $end_at = 0; | 1715: $end_at = 0; |
1503: while ($cur_item = $db->fetch_assoc($result)) | 1716: while ($cur_item = $db->fetch_assoc($result)) |
1504: { | 1717: { |
1505: echo 'Preparsing post '.$cur_item['id'].' …<br />'."\n"; | 1718: echo sprintf($lang_update['Preparsing item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
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()); | 1719: $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()); |
1507: | 1720: |
1508: $end_at = $cur_item['id']; | 1721: $end_at = $cur_item['id']; |
1537: $end_at = 0; | 1750: $end_at = 0; |
1538: while ($cur_item = $db->fetch_assoc($result)) | 1751: while ($cur_item = $db->fetch_assoc($result)) |
1539: { | 1752: { |
1540: echo 'Preparsing signature '.$cur_item['id'].' …<br />'."\n"; | 1753: echo sprintf($lang_update['Preparsing item'], $lang_update['signature'], $cur_item['id']).'<br />'."\n"; |
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()); | 1754: $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()); |
1542: | 1755: |
1543: $end_at = $cur_item['id']; | 1756: $end_at = $cur_item['id']; |
1593: $end_at = 0; | 1806: $end_at = 0; |
1594: while ($cur_item = $db->fetch_assoc($result)) | 1807: while ($cur_item = $db->fetch_assoc($result)) |
1595: { | 1808: { |
1596: echo 'Rebuilding index for post '.$cur_item['id'].' …<br />'."\n"; | 1809: echo sprintf($lang_update['Rebuilding index item'], $lang_update['post'], $cur_item['id']).'<br />'."\n"; |
1597: | 1810: |
1598: if ($cur_item['id'] == $cur_item['first_post_id']) | 1811: if ($cur_item['id'] == $cur_item['first_post_id']) |
1599: update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']); | 1812: update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']); |
1646: // Empty the PHP cache | 1859: // Empty the PHP cache |
1647: forum_clear_cache(); | 1860: forum_clear_cache(); |
1648: | 1861: |
| 1862: // Delete the update lock file |
| 1863: @unlink(FORUM_CACHE_DIR.'db_update.lock'); |
| 1864: |
1649: ?> | 1865: ?> |
1650: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | 1866: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
1651: | 1867: |
1652: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 1868: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang_common['lang_identifier'] ?>" lang="<?php echo $lang_common['lang_identifier'] ?>" dir="<?php echo $lang_common['lang_direction'] ?>"> |
1653: <head> | 1869: <head> |
1654: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1870: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1655: <title>FluxBB Database Update</title> | 1871: <title><?php echo $lang_update['Update'] ?></title> |
1656: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> | 1872: <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> |
1657: </head> | 1873: </head> |
1658: <body> | 1874: <body> |
1662: <div class="punwrap"> | 1878: <div class="punwrap"> |
1663: | 1879: |
1664: <div class="blockform"> | 1880: <div class="blockform"> |
1665: <h2><span>FluxBB Update</span></h2> | 1881: <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
1666: <div class="box"> | 1882: <div class="box"> |
1667: <div class="fakeform"> | 1883: <div class="fakeform"> |
1668: <div class="inform"> | 1884: <div class="inform"> |
1669: <div class="forminfo"> | 1885: <div class="forminfo"> |
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> | 1886: <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> |
1671: </div> | 1887: </div> |
1672: </div> | 1888: </div> |
1673: </div> | 1889: </div> |
1689: $db->close(); | 1905: $db->close(); |
1690: | 1906: |
1691: if ($query_str != '') | 1907: if ($query_str != '') |
a/extern.php |
b/extern.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
26: display posts) and type (output as HTML or RSS). The only | 26: display posts) and type (output as HTML or RSS). The only |
27: mandatory variable is action. Possible/default values are: | 27: mandatory variable is action. Possible/default values are: |
28: | 28: |
29: action: feed - show most recent topics/posts (HTML or RSS) | 29: action: feed - show most recent topics/posts (HTML or RSS) |
30: online - show users online (HTML) | 30: online - show users online (HTML) |
31: online_full - as above, but includes a full list (HTML) | 31: online_full - as above, but includes a full list (HTML) |
32: stats - show board statistics (HTML) | 32: stats - show board statistics (HTML) |
33: | 33: |
34: type: rss - output as RSS 2.0 | 34: type: rss - output as RSS 2.0 |
35: atom - output as Atom 1.0 | 35: atom - output as Atom 1.0 |
36: xml - output as XML | 36: xml - output as XML |
37: html - output as HTML (<li>'s) | 37: html - output as HTML (<li>'s) |
38: | 38: |
39: fid: One or more forum IDs (comma-separated). If ignored, | 39: fid: One or more forum IDs (comma-separated). If ignored, |
40: topics from all readable forums will be pulled. | 40: topics from all readable forums will be pulled. |
41: | 41: |
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 |
43: excluded. E.g. the ID of a a test forum. | 43: excluded. E.g. the ID of a a test forum. |
44: | 44: |
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, |
46: fid and nfid are ignored. | 46: fid and nfid are ignored. |
47: | 47: |
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. |
49: | 49: |
50: order: last_post - show topics ordered by when they were last | 50: order: last_post - show topics ordered by when they were last |
51: posted in, giving information about the reply. | 51: posted in, giving information about the reply. |
52: posted - show topics ordered by when they were first | 52: posted - show topics ordered by when they were first |
53: posted, giving information about the original post. | 53: posted, giving information about the original post. |
54: | 54: |
55: -----------------------------------------------------------------------------*/ | 55: -----------------------------------------------------------------------------*/ |
56: | 56: |
57: define('PUN_QUIET_VISIT', 1); | 57: define('PUN_QUIET_VISIT', 1); |
58: | 58: |
59: if (!defined('PUN_ROOT')) | 59: if (!defined('PUN_ROOT')) |
60: define('PUN_ROOT', './'); | 60: define('PUN_ROOT', dirname(__FILE__).'/'); |
61: require PUN_ROOT.'include/common.php'; | 61: require PUN_ROOT.'include/common.php'; |
62: | 62: |
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) |
119: header('Pragma: public'); | 119: header('Pragma: public'); |
120: | 120: |
121: echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; | 121: echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
122: echo '<rss version="2.0">'."\n"; | 122: echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"; |
123: echo "\t".'<channel>'."\n"; | 123: echo "\t".'<channel>'."\n"; |
| 124: echo "\t\t".'<atom:link href="'.pun_htmlspecialchars(get_current_url()).'" rel="self" type="application/rss+xml" />'."\n"; |
124: echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; | 125: echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; |
125: echo "\t\t".'<link>'.$feed['link'].'</link>'."\n"; | 126: echo "\t\t".'<link>'.pun_htmlspecialchars($feed['link']).'</link>'."\n"; |
126: echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; | 127: echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; |
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"; |
128: | 129: |
135: { | 136: { |
136: echo "\t\t".'<item>'."\n"; | 137: echo "\t\t".'<item>'."\n"; |
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"; |
138: echo "\t\t\t".'<link>'.$item['link'].'</link>'."\n"; | 139: echo "\t\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n"; |
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"; |
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"; |
141: echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; | 142: echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; |
142: echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n"; | 143: echo "\t\t\t".'<guid>'.pun_htmlspecialchars($item['link']).'</guid>'."\n"; |
143: | 144: |
144: echo "\t\t".'</item>'."\n"; | 145: echo "\t\t".'</item>'."\n"; |
145: } | 146: } |
167: | 168: |
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"; |
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"; |
170: echo "\t".'<link href="'.$feed['link'].'"/>'."\n"; | 171: echo "\t".'<link href="'.pun_htmlspecialchars($feed['link']).'"/>'."\n"; |
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"; |
172: | 173: |
173: if ($pun_config['o_show_version'] == '1') | 174: if ($pun_config['o_show_version'] == '1') |
175: else | 176: else |
176: echo "\t".'<generator>FluxBB</generator>'."\n"; | 177: echo "\t".'<generator>FluxBB</generator>'."\n"; |
177: | 178: |
178: echo "\t".'<id>'.$feed['link'].'</id>'."\n"; | 179: echo "\t".'<id>'.pun_htmlspecialchars($feed['link']).'</id>'."\n"; |
179: | 180: |
180: $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; | 181: $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; |
181: | 182: |
183: { | 184: { |
184: echo "\t".'<entry>'."\n"; | 185: echo "\t".'<entry>'."\n"; |
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"; |
186: echo "\t\t".'<link rel="alternate" href="'.$item['link'].'"/>'."\n"; | 187: echo "\t\t".'<link rel="alternate" href="'.pun_htmlspecialchars($item['link']).'"/>'."\n"; |
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"; |
188: echo "\t\t".'<author>'."\n"; | 189: echo "\t\t".'<author>'."\n"; |
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"; |
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"; |
193: | 194: |
194: if (isset($item['author']['uri'])) | 195: if (isset($item['author']['uri'])) |
195: echo "\t\t\t".'<uri>'.$item['author']['uri'].'</uri>'."\n"; | 196: echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n"; |
196: | 197: |
197: echo "\t\t".'</author>'."\n"; | 198: echo "\t\t".'</author>'."\n"; |
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"; |
199: | 200: |
200: echo "\t\t".'<id>'.$item['link'].'</id>'."\n"; | 201: echo "\t\t".'<id>'.pun_htmlspecialchars($item['link']).'</id>'."\n"; |
201: echo "\t".'</entry>'."\n"; | 202: echo "\t".'</entry>'."\n"; |
202: } | 203: } |
203: | 204: |
220: | 221: |
221: echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; | 222: echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
222: echo '<source>'."\n"; | 223: echo '<source>'."\n"; |
223: echo "\t".'<url>'.$feed['link'].'</url>'."\n"; | 224: echo "\t".'<url>'.pun_htmlspecialchars($feed['link']).'</url>'."\n"; |
224: | 225: |
225: $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; | 226: $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; |
226: | 227: |
229: echo "\t".'<'.$forum_tag.' id="'.$item['id'].'">'."\n"; | 230: echo "\t".'<'.$forum_tag.' id="'.$item['id'].'">'."\n"; |
230: | 231: |
231: echo "\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; | 232: echo "\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
232: echo "\t\t".'<link>'.$item['link'].'</link>'."\n"; | 233: echo "\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n"; |
233: echo "\t\t".'<content><![CDATA['.escape_cdata($item['description']).']]></content>'."\n"; | 234: echo "\t\t".'<content><![CDATA['.escape_cdata($item['description']).']]></content>'."\n"; |
234: echo "\t\t".'<author>'."\n"; | 235: echo "\t\t".'<author>'."\n"; |
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"; |
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"; |
239: | 240: |
240: if (isset($item['author']['uri'])) | 241: if (isset($item['author']['uri'])) |
241: echo "\t\t\t".'<uri>'.$item['author']['uri'].'</uri>'."\n"; | 242: echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n"; |
242: | 243: |
243: echo "\t\t".'</author>'."\n"; | 244: echo "\t\t".'</author>'."\n"; |
244: echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; | 245: echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; |
269: else | 270: else |
270: $subject_truncated = pun_htmlspecialchars($item['title']); | 271: $subject_truncated = pun_htmlspecialchars($item['title']); |
271: | 272: |
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"; |
273: } | 274: } |
274: } | 275: } |
275: | 276: |
308: // Setup the feed | 309: // Setup the feed |
309: $feed = array( | 310: $feed = array( |
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'], |
311: 'link' => $pun_config['o_base_url'].'/viewtopic.php?id='.$tid, | 312: 'link' => get_base_url(true).'/viewtopic.php?id='.$tid, |
312: 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), | 313: 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), |
313: 'items' => array(), | 314: 'items' => array(), |
314: 'type' => 'posts' | 315: 'type' => 'posts' |
323: $item = array( | 324: $item = array( |
324: 'id' => $cur_post['id'], | 325: 'id' => $cur_post['id'], |
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'], |
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'], |
327: 'description' => $cur_post['message'], | 328: 'description' => $cur_post['message'], |
328: 'author' => array( | 329: 'author' => array( |
329: 'name' => $cur_post['poster'], | 330: 'name' => $cur_post['poster'], |
336: if ($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) | 337: if ($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) |
337: $item['author']['email'] = $cur_post['email']; | 338: $item['author']['email'] = $cur_post['email']; |
338: | 339: |
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']; |
340: } | 341: } |
341: else if ($cur_post['poster_email'] != '' && !$pun_user['is_guest']) | 342: else if ($cur_post['poster_email'] != '' && !$pun_user['is_guest']) |
342: $item['author']['email'] = $cur_post['poster_email']; | 343: $item['author']['email'] = $cur_post['poster_email']; |
381: $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; | 382: $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; |
382: } | 383: } |
383: | 384: |
384: // Setup the feed | 385: // Only attempt to cache if caching is enabled and we have all or a single forum |
385: $feed = array( | 386: if ($pun_config['o_feed_ttl'] > 0 && ($forum_sql == '' || ($forum_name != '' && !isset($_GET['nfid'])))) |
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])); |
387: 'link' => $pun_config['o_base_url'].'/index.php', | |
388: 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), | |
389: 'items' => array(), | |
390: 'type' => 'topics' | |
391: ); | |
392: | |
393: // Fetch $show topics | |
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()); | |
395: while ($cur_topic = $db->fetch_assoc($result)) | |
396: { | |
397: if ($pun_config['o_censoring'] == '1') | |
398: $cur_topic['subject'] = censor_words($cur_topic['subject']); | |
399: | 388: |
400: $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); | 389: // Load cached feed |
| 390: if (isset($cache_id) && file_exists(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php')) |
| 391: include FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'; |
401: | 392: |
402: $item = array( | 393: $now = time(); |
403: 'id' => $cur_topic['id'], | 394: if (!isset($feed) || $cache_expire < $now) |
404: 'title' => $cur_topic['subject'], | 395: { |
405: 'link' => $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&action=new'), | 396: // Setup the feed |
406: 'description' => $cur_topic['message'], | 397: $feed = array( |
407: 'author' => array( | 398: 'title' => $pun_config['o_board_title'].$forum_name, |
408: 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] | 399: 'link' => '/index.php', |
409: ), | 400: 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), |
410: 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] | 401: 'items' => array(), |
| 402: 'type' => 'topics' |
411: ); | 403: ); |
412: | 404: |
413: if ($cur_topic['poster_id'] > 1) | 405: // Fetch $show topics |
| 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()); |
| 407: while ($cur_topic = $db->fetch_assoc($result)) |
| 408: { |
| 409: if ($pun_config['o_censoring'] == '1') |
| 410: $cur_topic['subject'] = censor_words($cur_topic['subject']); |
| 411: |
| 412: $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
| 413: |
| 414: $item = array( |
| 415: 'id' => $cur_topic['id'], |
| 416: 'title' => $cur_topic['subject'], |
| 417: 'link' => '/viewtopic.php?id='.$cur_topic['id'].($order_posted ? '' : '&action=new'), |
| 418: 'description' => $cur_topic['message'], |
| 419: 'author' => array( |
| 420: 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] |
| 421: ), |
| 422: 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] |
| 423: ); |
| 424: |
| 425: if ($cur_topic['poster_id'] > 1) |
| 426: { |
| 427: if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) |
| 428: $item['author']['email'] = $cur_topic['email']; |
| 429: |
| 430: $item['author']['uri'] = '/profile.php?id='.$cur_topic['poster_id']; |
| 431: } |
| 432: else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) |
| 433: $item['author']['email'] = $cur_topic['poster_email']; |
| 434: |
| 435: $feed['items'][] = $item; |
| 436: } |
| 437: |
| 438: // Output feed as PHP code |
| 439: if (isset($cache_id)) |
414: { | 440: { |
415: if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) | 441: $fh = @fopen(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php', 'wb'); |
416: $item['author']['email'] = $cur_topic['email']; | 442: if (!$fh) |
| 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__); |
| 444: |
| 445: fwrite($fh, '<?php'."\n\n".'$feed = '.var_export($feed, true).';'."\n\n".'$cache_expire = '.($now + ($pun_config['o_feed_ttl'] * 60)).';'."\n\n".'?>'); |
| 446: |
| 447: fclose($fh); |
417: | 448: |
418: $item['author']['uri'] = $pun_config['o_base_url'].'/profile.php?id='.$cur_topic['poster_id']; | 449: if (function_exists('apc_delete_file')) |
| 450: @apc_delete_file(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'); |
419: } | 451: } |
420: else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) | 452: } |
421: $item['author']['email'] = $cur_topic['poster_email']; | |
422: | 453: |
423: $feed['items'][] = $item; | 454: // If we only want to show a few items but due to caching we have too many |
| 455: if (count($feed['items']) > $show) |
| 456: $feed['items'] = array_slice($feed['items'], 0, $show); |
| 457: |
| 458: // Prepend the current base URL onto some links. Done after caching to handle http/https correctly |
| 459: $feed['link'] = get_base_url(true).$feed['link']; |
| 460: |
| 461: foreach ($feed['items'] as $key => $item) |
| 462: { |
| 463: $feed['items'][$key]['link'] = get_base_url(true).$item['link']; |
| 464: |
| 465: if (isset($item['author']['uri'])) |
| 466: $feed['items'][$key]['author']['uri'] = get_base_url(true).$item['author']['uri']; |
424: } | 467: } |
425: | 468: |
426: $output_func = 'output_'.$type; | 469: $output_func = 'output_'.$type; |
446: { | 489: { |
447: if ($pun_user_online['user_id'] > 1) | 490: if ($pun_user_online['user_id'] > 1) |
448: { | 491: { |
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']); |
450: ++$num_users; | 493: ++$num_users; |
451: } | 494: } |
452: else | 495: else |
476: require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; | 519: require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
477: | 520: |
478: // Collect some statistics from the database | 521: // Collect some statistics from the database |
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')) |
480: $stats['total_users'] = $db->result($result); | 523: include FORUM_CACHE_DIR.'cache_users_info.php'; |
481: | 524: |
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')) |
483: $stats['last_user'] = $db->fetch_assoc($result); | 526: { |
| 527: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 528: require PUN_ROOT.'include/cache.php'; |
| 529: |
| 530: generate_users_info_cache(); |
| 531: require FORUM_CACHE_DIR.'cache_users_info.php'; |
| 532: } |
484: | 533: |
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()); |
486: list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); | 535: list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); |
492: header('Pragma: public'); | 541: header('Pragma: public'); |
493: | 542: |
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"; |
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"; |
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"; |
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"; |
498: | 547: |