a/admin_groups.php |
b/admin_groups.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: */ |
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 |
393: </div> | 401: </div> |
394: </fieldset> | 402: </fieldset> |
395: </div> | 403: </div> |
396: <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> |
397: </form> | 405: </form> |
398: </div> | 406: </div> |
399: </div> | 407: </div> |
540: <table cellspacing="0"> | 548: <table cellspacing="0"> |
541: <?php | 549: <?php |
542: | 550: |
| 551: $cur_index = 5; |
| 552: |
543: $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()); |
544: | 554: |
545: while ($cur_group = $db->fetch_assoc($result)) | 555: while ($cur_group = $db->fetch_assoc($result)) |
546: 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"; |
547: | 557: |
548: ?> | 558: ?> |
549: </table> | 559: </table> |
a/admin_options.php |
b/admin_options.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: */ |
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'; |
34: 'default_style' => pun_trim($_POST['form']['default_style']), | 34: 'default_style' => pun_trim($_POST['form']['default_style']), |
35: 'time_format' => pun_trim($_POST['form']['time_format']), | 35: 'time_format' => pun_trim($_POST['form']['time_format']), |
36: 'date_format' => pun_trim($_POST['form']['date_format']), | 36: 'date_format' => pun_trim($_POST['form']['date_format']), |
37: 'timeout_visit' => intval($_POST['form']['timeout_visit']), | 37: 'timeout_visit' => (intval($_POST['form']['timeout_visit']) > 0) ? intval($_POST['form']['timeout_visit']) : 1, |
38: 'timeout_online' => intval($_POST['form']['timeout_online']), | 38: 'timeout_online' => (intval($_POST['form']['timeout_online']) > 0) ? intval($_POST['form']['timeout_online']) : 1, |
39: 'redirect_delay' => intval($_POST['form']['redirect_delay']), | 39: 'redirect_delay' => (intval($_POST['form']['redirect_delay']) >= 0) ? intval($_POST['form']['redirect_delay']) : 0, |
40: 'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1', | 40: 'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1', |
41: 'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1', | 41: 'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1', |
42: 'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1', | 42: 'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1', |
43: 'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1', | 43: 'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1', |
44: 'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1', | 44: 'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1', |
45: 'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1', | 45: 'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1', |
46: 'topic_review' => intval($_POST['form']['topic_review']), | 46: 'topic_review' => (intval($_POST['form']['topic_review']) >= 0) ? intval($_POST['form']['topic_review']) : 0, |
47: 'disp_topics_default' => intval($_POST['form']['disp_topics_default']), | 47: 'disp_topics_default' => intval($_POST['form']['disp_topics_default']), |
48: 'disp_posts_default' => intval($_POST['form']['disp_posts_default']), | 48: 'disp_posts_default' => intval($_POST['form']['disp_posts_default']), |
49: '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, |
50: 'quote_depth' => intval($_POST['form']['quote_depth']), | 50: 'quote_depth' => (intval($_POST['form']['quote_depth']) > 0) ? intval($_POST['form']['quote_depth']) : 1, |
51: 'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1', | 51: 'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1', |
52: 'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1', | 52: 'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1', |
53: 'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1', | 53: 'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1', |
65: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), | 65: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), |
66: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', | 66: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', |
67: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), | 67: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), |
68: 'avatars_width' => intval($_POST['form']['avatars_width']), | 68: 'avatars_width' => (intval($_POST['form']['avatars_width']) > 0) ? intval($_POST['form']['avatars_width']) : 1, |
69: 'avatars_height' => intval($_POST['form']['avatars_height']), | 69: 'avatars_height' => (intval($_POST['form']['avatars_height']) > 0) ? intval($_POST['form']['avatars_height']) : 1, |
70: 'avatars_size' => intval($_POST['form']['avatars_size']), | 70: 'avatars_size' => (intval($_POST['form']['avatars_size']) > 0) ? intval($_POST['form']['avatars_size']) : 1, |
71: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), | 71: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), |
72: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), | 72: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), |
73: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', | 73: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', |
118: message($lang_admin_options['Invalid webmaster e-mail message']); | 118: message($lang_admin_options['Invalid webmaster e-mail message']); |
119: | 119: |
120: if ($form['mailing_list'] != '') | 120: if ($form['mailing_list'] != '') |
121: $form['mailing_list'] = strtolower(preg_replace('/\s/S', '', $form['mailing_list'])); | 121: $form['mailing_list'] = strtolower(preg_replace('%\s%S', '', $form['mailing_list'])); |
122: | 122: |
123: // Make sure avatars_dir doesn't end with a slash | 123: // Make sure avatars_dir doesn't end with a slash |
124: if (substr($form['avatars_dir'], -1) == '/') | 124: if (substr($form['avatars_dir'], -1) == '/') |
303: <tr> | 303: <tr> |
304: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> | 304: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> |
305: <td> | 305: <td> |
306: <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> |
307: <span><?php echo $lang_admin_options['DST help'] ?></span> | 307: <span><?php echo $lang_admin_options['DST help'] ?></span> |
308: </td> | 308: </td> |
309: </tr> | 309: </tr> |
411: <tr> | 411: <tr> |
412: <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> |
413: <td> | 413: <td> |
414: <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> |
415: <span><?php echo $lang_admin_options['Version number help'] ?></span> | 415: <span><?php echo $lang_admin_options['Version number help'] ?></span> |
416: </td> | 416: </td> |
417: </tr> | 417: </tr> |
418: <tr> | 418: <tr> |
419: <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> |
420: <td> | 420: <td> |
421: <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> |
422: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> | 422: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> |
423: </td> | 423: </td> |
424: </tr> | 424: </tr> |
425: <tr> | 425: <tr> |
426: <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> |
427: <td> | 427: <td> |
428: <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> |
429: <span><?php echo $lang_admin_options['Post count help'] ?></span> | 429: <span><?php echo $lang_admin_options['Post count help'] ?></span> |
430: </td> | 430: </td> |
431: </tr> | 431: </tr> |
432: <tr> | 432: <tr> |
433: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> | 433: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> |
434: <td> | 434: <td> |
435: <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> |
436: <span><?php echo $lang_admin_options['Smilies help'] ?></span> | 436: <span><?php echo $lang_admin_options['Smilies help'] ?></span> |
437: </td> | 437: </td> |
438: </tr> | 438: </tr> |
439: <tr> | 439: <tr> |
440: <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> |
441: <td> | 441: <td> |
442: <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> |
443: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> | 443: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> |
444: </td> | 444: </td> |
445: </tr> | 445: </tr> |
446: <tr> | 446: <tr> |
447: <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> |
448: <td> | 448: <td> |
449: <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> |
450: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> | 450: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> |
451: </td> | 451: </td> |
452: </tr> | 452: </tr> |
497: <tr> | 497: <tr> |
498: <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> |
499: <td> | 499: <td> |
500: <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> |
501: <span><?php echo $lang_admin_options['Quick post help'] ?></span> | 501: <span><?php echo $lang_admin_options['Quick post help'] ?></span> |
502: </td> | 502: </td> |
503: </tr> | 503: </tr> |
504: <tr> | 504: <tr> |
505: <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> |
506: <td> | 506: <td> |
507: <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> |
508: <span><?php echo $lang_admin_options['Users online help'] ?></span> | 508: <span><?php echo $lang_admin_options['Users online help'] ?></span> |
509: </td> | 509: </td> |
510: </tr> | 510: </tr> |
511: <tr> | 511: <tr> |
512: <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> |
513: <td> | 513: <td> |
514: <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> |
515: <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> |
516: </td> | 516: </td> |
517: </tr> | 517: </tr> |
518: <tr> | 518: <tr> |
519: <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> |
520: <td> | 520: <td> |
521: <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> |
522: <span><?php echo $lang_admin_options['Signatures help'] ?></span> | 522: <span><?php echo $lang_admin_options['Signatures help'] ?></span> |
523: </td> | 523: </td> |
524: </tr> | 524: </tr> |
525: <tr> | 525: <tr> |
526: <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> |
527: <td> | 527: <td> |
528: <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> |
529: <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> |
530: </td> | 530: </td> |
531: </tr> | 531: </tr> |
532: <tr> | 532: <tr> |
533: <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> |
534: <td> | 534: <td> |
535: <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> |
536: <span><?php echo $lang_admin_options['User has posted help'] ?></span> | 536: <span><?php echo $lang_admin_options['User has posted help'] ?></span> |
537: </td> | 537: </td> |
538: </tr> | 538: </tr> |
539: <tr> | 539: <tr> |
540: <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> |
541: <td> | 541: <td> |
542: <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> |
543: <span><?php echo $lang_admin_options['Topic views help'] ?></span> | 543: <span><?php echo $lang_admin_options['Topic views help'] ?></span> |
544: </td> | 544: </td> |
545: </tr> | 545: </tr> |
546: <tr> | 546: <tr> |
547: <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> |
548: <td> | 548: <td> |
549: <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> |
550: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> | 550: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> |
551: </td> | 551: </td> |
552: </tr> | 552: </tr> |
553: <tr> | 553: <tr> |
554: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> | 554: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> |
555: <td> | 555: <td> |
556: <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> |
557: <span><?php echo $lang_admin_options['GZip help'] ?></span> | 557: <span><?php echo $lang_admin_options['GZip help'] ?></span> |
558: </td> | 558: </td> |
559: </tr> | 559: </tr> |
560: <tr> | 560: <tr> |
561: <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> |
562: <td> | 562: <td> |
563: <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> |
564: <span><?php echo $lang_admin_options['Search all help'] ?></span> | 564: <span><?php echo $lang_admin_options['Search all help'] ?></span> |
565: </td> | 565: </td> |
566: </tr> | 566: </tr> |
583: <tr> | 583: <tr> |
584: <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> |
585: <td> | 585: <td> |
586: <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> |
587: <span><?php echo $lang_admin_options['Default feed help'] ?></span> | 587: <span><?php echo $lang_admin_options['Default feed help'] ?></span> |
588: </td> | 588: </td> |
589: </tr> | 589: </tr> |
616: <tr> | 616: <tr> |
617: <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> |
618: <td> | 618: <td> |
619: <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> |
620: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> | 620: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> |
621: </td> | 621: </td> |
622: </tr> | 622: </tr> |
639: <tr> | 639: <tr> |
640: <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> |
641: <td> | 641: <td> |
642: <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> |
643: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> | 643: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> |
644: </td> | 644: </td> |
645: </tr> | 645: </tr> |
697: <tr> | 697: <tr> |
698: <th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th> | 698: <th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th> |
699: <td> | 699: <td> |
700: <input type="radio" name="form[forum_subscriptions]" value="1"<?php if ($pun_config['o_forum_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[forum_subscriptions]" value="0"<?php if ($pun_config['o_forum_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 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> | 701: <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> |
702: </td> | 702: </td> |
703: </tr> | 703: </tr> |
704: <tr> | 704: <tr> |
705: <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> | 705: <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> |
706: <td> | 706: <td> |
707: <input type="radio" name="form[topic_subscriptions]" value="1"<?php if ($pun_config['o_topic_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[topic_subscriptions]" value="0"<?php if ($pun_config['o_topic_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 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> |
708: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> | 708: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> |
709: </td> | 709: </td> |
710: </tr> | 710: </tr> |
725: <tr> | 725: <tr> |
726: <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> |
727: <td> | 727: <td> |
728: <span><input type="checkbox" name="form[smtp_change_pass]" value="1" />  <?php echo $lang_admin_options['SMTP change password help'] ?></span> | 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) : ''; ?> | 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 ?>" /> | 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 ?>" /> | 731: <input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
735: <tr> | 735: <tr> |
736: <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> |
737: <td> | 737: <td> |
738: <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> |
739: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> | 739: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> |
740: </td> | 740: </td> |
741: </tr> | 741: </tr> |
751: <tr> | 751: <tr> |
752: <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> |
753: <td> | 753: <td> |
754: <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> |
755: <span><?php echo $lang_admin_options['Allow new help'] ?></span> | 755: <span><?php echo $lang_admin_options['Allow new help'] ?></span> |
756: </td> | 756: </td> |
757: </tr> | 757: </tr> |
758: <tr> | 758: <tr> |
759: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> | 759: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> |
760: <td> | 760: <td> |
761: <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> |
762: <span><?php echo $lang_admin_options['Verify help'] ?></span> | 762: <span><?php echo $lang_admin_options['Verify help'] ?></span> |
763: </td> | 763: </td> |
764: </tr> | 764: </tr> |
765: <tr> | 765: <tr> |
766: <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> |
767: <td> | 767: <td> |
768: <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> |
769: <span><?php echo $lang_admin_options['Report new help'] ?></span> | 769: <span><?php echo $lang_admin_options['Report new help'] ?></span> |
770: </td> | 770: </td> |
771: </tr> | 771: </tr> |
772: <tr> | 772: <tr> |
773: <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> |
774: <td> | 774: <td> |
775: <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> |
776: <span><?php echo $lang_admin_options['Use rules help'] ?></span> | 776: <span><?php echo $lang_admin_options['Use rules help'] ?></span> |
777: </td> | 777: </td> |
778: </tr> | 778: </tr> |
787: <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> |
788: <td> | 788: <td> |
789: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> | 789: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> |
790: <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 /> |
791: <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 /> |
792: <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 /> |
793: </td> | 793: </td> |
794: </tr> | 794: </tr> |
795: </table> | 795: </table> |
804: <tr> | 804: <tr> |
805: <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> |
806: <td> | 806: <td> |
807: <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> |
808: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> | 808: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> |
809: </td> | 809: </td> |
810: </tr> | 810: </tr> |
825: <div class="infldset"> | 825: <div class="infldset"> |
826: <table class="aligntop" cellspacing="0"> | 826: <table class="aligntop" cellspacing="0"> |
827: <tr> | 827: <tr> |
828: <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> |
829: <td> | 829: <td> |
830: <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> |
831: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> | 831: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> |
832: </td> | 832: </td> |
833: </tr> | 833: </tr> |
a/admin_users.php |
b/admin_users.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: */ |
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 |
257: else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) | 257: else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) |
258: { | 258: { |
259: if ($pun_user['g_id'] > PUN_ADMIN) | 259: if ($pun_user['g_id'] > PUN_ADMIN) |
260: message($lang_common['No permission']); | 260: message($lang_common['No permission'], false, '403 Forbidden'); |
261: | 261: |
262: confirm_referrer('admin_users.php'); | 262: confirm_referrer('admin_users.php'); |
263: | 263: |
264: if (isset($_POST['users'])) | 264: if (isset($_POST['users'])) |
265: { | 265: { |
266: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); | 266: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
267: $user_ids = array_map('intval', $user_ids); | 267: $user_ids = array_map('intval', $user_ids); |
268: | 268: |
269: // Delete invalid IDs | 269: // Delete invalid IDs |
270: $user_ids = array_diff($user_ids, array(0, 1)); | 270: $user_ids = array_diff($user_ids, array(0, 1)); |
271: } | 271: } |
272: else | 272: else |
273: $user_ids = array(); | 273: $user_ids = array(); |
274: | 274: |
275: if (empty($user_ids)) | 275: if (empty($user_ids)) |
276: message($lang_admin_users['No users selected']); | 276: message($lang_admin_users['No users selected']); |
277: | 277: |
278: // Are we trying to batch move any admins? | 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()); | 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) | 280: if ($db->result($result) > 0) |
281: message($lang_admin_users['No move admins message']); | 281: message($lang_admin_users['No move admins message']); |
282: | 282: |
283: // Fetch all user groups | 283: // Fetch all user groups |
284: $all_groups = array(); | 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()); | 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()); |
289: if (isset($_POST['move_users_comply'])) | 289: if (isset($_POST['move_users_comply'])) |
290: { | 290: { |
291: $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); | 291: $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); |
292: | 292: |
293: // Is the new group a moderator group? | 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()); | 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); | 295: $new_group_mod = $db->result($result); |
296: | 296: |
297: // Fetch user groups | 297: // Fetch user groups |
298: $user_groups = array(); | 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()); | 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()); |
301: { | 301: { |
302: if (!isset($user_groups[$cur_user['group_id']])) | 302: if (!isset($user_groups[$cur_user['group_id']])) |
303: $user_groups[$cur_user['group_id']] = array(); | 303: $user_groups[$cur_user['group_id']] = array(); |
304: | 304: |
305: $user_groups[$cur_user['group_id']][] = $cur_user['id']; | 305: $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
306: } | 306: } |
307: | 307: |
308: // Are any users moderators? | 308: // Are any users moderators? |
309: $group_ids = array_keys($user_groups); | 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()); | 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()); |
313: if ($cur_group['g_moderator'] == '0') | 313: if ($cur_group['g_moderator'] == '0') |
314: unset($user_groups[$cur_group['g_id']]); | 314: unset($user_groups[$cur_group['g_id']]); |
315: } | 315: } |
316: | 316: |
317: if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') | 317: if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') |
318: { | 318: { |
319: // Fetch forum list and clean up their moderator list | 319: // Fetch forum list and clean up their moderator list |
321: while ($cur_forum = $db->fetch_assoc($result)) | 321: while ($cur_forum = $db->fetch_assoc($result)) |
322: { | 322: { |
323: $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); | 323: $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
324: | 324: |
325: foreach ($user_groups as $group_users) | 325: foreach ($user_groups as $group_users) |
326: $cur_moderators = array_diff($cur_moderators, $group_users); | 326: $cur_moderators = array_diff($cur_moderators, $group_users); |
327: | 327: |
328: $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; | 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()); | 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: } | 330: } |
331: } | 331: } |
332: | 332: |
333: // Change user group | 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()); | 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: | 335: |
336: redirect('admin_users.php', $lang_admin_users['Users move redirect']); | 336: redirect('admin_users.php', $lang_admin_users['Users move redirect']); |
337: } | 337: } |
338: | 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']); | 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'); | 340: define('PUN_ACTIVE_PAGE', 'admin'); |
341: require PUN_ROOT.'header.php'; | 341: require PUN_ROOT.'header.php'; |
342: | 342: |
343: generate_admin_menu('users'); | 343: generate_admin_menu('users'); |
344: | 344: |
345: ?> | 345: ?> |
383: else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) | 383: else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) |
384: { | 384: { |
385: if ($pun_user['g_id'] > PUN_ADMIN) | 385: if ($pun_user['g_id'] > PUN_ADMIN) |
386: message($lang_common['No permission']); | 386: message($lang_common['No permission'], false, '403 Forbidden'); |
387: | 387: |
388: confirm_referrer('admin_users.php'); | 388: confirm_referrer('admin_users.php'); |
389: | 389: |
390: if (isset($_POST['users'])) | 390: if (isset($_POST['users'])) |
391: { | 391: { |
392: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); | 392: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
393: $user_ids = array_map('intval', $user_ids); | 393: $user_ids = array_map('intval', $user_ids); |
394: | 394: |
395: // Delete invalid IDs | 395: // Delete invalid IDs |
396: $user_ids = array_diff($user_ids, array(0, 1)); | 396: $user_ids = array_diff($user_ids, array(0, 1)); |
397: } | 397: } |
398: else | 398: else |
399: $user_ids = array(); | 399: $user_ids = array(); |
400: | 400: |
401: if (empty($user_ids)) | 401: if (empty($user_ids)) |
402: message($lang_admin_users['No users selected']); | 402: message($lang_admin_users['No users selected']); |
403: | 403: |
404: // Are we trying to delete any admins? | 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()); | 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) | 406: if ($db->result($result) > 0) |
415: { | 415: { |
416: if (!isset($user_groups[$cur_user['group_id']])) | 416: if (!isset($user_groups[$cur_user['group_id']])) |
417: $user_groups[$cur_user['group_id']] = array(); | 417: $user_groups[$cur_user['group_id']] = array(); |
418: | 418: |
419: $user_groups[$cur_user['group_id']][] = $cur_user['id']; | 419: $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
420: } | 420: } |
421: | 421: |
422: // Are any users moderators? | 422: // Are any users moderators? |
423: $group_ids = array_keys($user_groups); | 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()); | 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()); |
427: if ($cur_group['g_moderator'] == '0') | 427: if ($cur_group['g_moderator'] == '0') |
428: unset($user_groups[$cur_group['g_id']]); | 428: unset($user_groups[$cur_group['g_id']]); |
429: } | 429: } |
430: | 430: |
431: // Fetch forum list and clean up their moderator list | 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()); | 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)) | 433: while ($cur_forum = $db->fetch_assoc($result)) |
436: | 436: |
437: foreach ($user_groups as $group_users) | 437: foreach ($user_groups as $group_users) |
438: $cur_moderators = array_diff($cur_moderators, $group_users); | 438: $cur_moderators = array_diff($cur_moderators, $group_users); |
439: | 439: |
440: $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; | 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()); | 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: } | 442: } |
443: | 443: |
444: // Delete any subscriptions | 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()); | 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()); | 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: | 447: |
448: // Remove them from the online list (if they happen to be logged in) | 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()); | 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: | 450: |
451: // Should we delete all posts made by these users? | 451: // Should we delete all posts made by these users? |
452: if (isset($_POST['delete_posts'])) | 452: if (isset($_POST['delete_posts'])) |
453: { | 453: { |
482: // Delete user avatars | 482: // Delete user avatars |
483: foreach ($user_ids as $user_id) | 483: foreach ($user_ids as $user_id) |
484: delete_avatar($user_id); | 484: delete_avatar($user_id); |
485: | 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: |
486: redirect('admin_users.php', $lang_admin_users['Users delete redirect']); | 492: redirect('admin_users.php', $lang_admin_users['Users delete redirect']); |
487: } | 493: } |
488: | 494: |
489: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); | 495: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); |
490: define('PUN_ACTIVE_PAGE', 'admin'); | 496: define('PUN_ACTIVE_PAGE', 'admin'); |
491: require PUN_ROOT.'header.php'; | 497: require PUN_ROOT.'header.php'; |
492: | 498: |
493: generate_admin_menu('users'); | 499: generate_admin_menu('users'); |
494: | 500: |
495: ?> | 501: ?> |
526: else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) | 532: else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) |
527: { | 533: { |
528: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) | 534: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
529: message($lang_common['No permission']); | 535: message($lang_common['No permission'], false, '403 Forbidden'); |
530: | 536: |
531: confirm_referrer('admin_users.php'); | 537: confirm_referrer('admin_users.php'); |
532: | 538: |
533: if (isset($_POST['users'])) | 539: if (isset($_POST['users'])) |
534: { | 540: { |
535: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); | 541: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
536: $user_ids = array_map('intval', $user_ids); | 542: $user_ids = array_map('intval', $user_ids); |
537: | 543: |
538: // Delete invalid IDs | 544: // Delete invalid IDs |
539: $user_ids = array_diff($user_ids, array(0, 1)); | 545: $user_ids = array_diff($user_ids, array(0, 1)); |
540: } | 546: } |
541: else | 547: else |
542: $user_ids = array(); | 548: $user_ids = array(); |
543: | 549: |
544: if (empty($user_ids)) | 550: if (empty($user_ids)) |
545: message($lang_admin_users['No users selected']); | 551: message($lang_admin_users['No users selected']); |
546: | 552: |
547: // Are we trying to ban any admins? | 553: // Are we trying to ban any admins? |
548: $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); | 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()); |
549: if ($db->result($result) > 0) | 555: if ($db->result($result) > 0) |
550: message($lang_admin_users['No ban admins message']); | 556: message($lang_admin_users['No ban admins message']); |
551: | 557: |
552: // Also, we cannot ban moderators | 558: // Also, we cannot ban moderators |
553: $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id WHERE g.g_moderator=1 AND u.id IN ('.implode(',', $user_ids).')') or error('Unable to fetch moderator group info', __FILE__, __LINE__, $db->error()); | 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()); |
554: if ($db->result($result) > 0) | 560: if ($db->result($result) > 0) |
555: message($lang_admin_users['No ban mods message']); | 561: message($lang_admin_users['No ban mods message']); |
556: | 562: |
557: if (isset($_POST['ban_users_comply'])) | 563: if (isset($_POST['ban_users_comply'])) |
558: { | 564: { |
559: $ban_message = pun_trim($_POST['ban_message']); | 565: $ban_message = pun_trim($_POST['ban_message']); |
560: $ban_expire = pun_trim($_POST['ban_expire']); | 566: $ban_expire = pun_trim($_POST['ban_expire']); |
561: $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; | 567: $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; |
562: | 568: |
563: if ($ban_expire != '' && $ban_expire != 'Never') | 569: if ($ban_expire != '' && $ban_expire != 'Never') |
564: { | 570: { |
565: $ban_expire = strtotime($ban_expire.' GMT'); | 571: $ban_expire = strtotime($ban_expire.' GMT'); |
566: | 572: |
567: if ($ban_expire == -1 || !$ban_expire) | 573: if ($ban_expire == -1 || !$ban_expire) |
568: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); | 574: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
569: | 575: |
570: $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; | 576: $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; |
571: $ban_expire -= $diff; | 577: $ban_expire -= $diff; |
572: | 578: |
573: if ($ban_expire <= time()) | 579: if ($ban_expire <= time()) |
574: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); | 580: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
575: } | 581: } |
576: else | 582: else |
577: $ban_expire = 'NULL'; | 583: $ban_expire = 'NULL'; |
578: | 584: |
579: $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; | 585: $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; |
580: | 586: |
581: // Fetch user information | 587: // Fetch user information |
582: $user_info = array(); | 588: $user_info = array(); |
583: $result = $db->query('SELECT id, username, email, registration_ip FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 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()); |
584: while ($cur_user = $db->fetch_assoc($result)) | 590: while ($cur_user = $db->fetch_assoc($result)) |
585: $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); | 591: $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); |
586: | 592: |
587: // Overwrite the registration IP with one from the last post (if it exists) | 593: // Overwrite the registration IP with one from the last post (if it exists) |
588: if ($ban_the_ip != 0) | 594: if ($ban_the_ip != 0) |
589: { | 595: { |
591: while ($cur_address = $db->fetch_assoc($result)) | 597: while ($cur_address = $db->fetch_assoc($result)) |
592: $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; | 598: $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; |
593: } | 599: } |
594: | 600: |
595: // And insert the bans! | 601: // And insert the bans! |
596: foreach ($user_ids as $user_id) | 602: foreach ($user_ids as $user_id) |
597: { | 603: { |
598: $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; | 604: $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; |
599: $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; | 605: $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; |
600: $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; | 606: $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; |
601: | 607: |
602: $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire, ban_creator) VALUES('.$ban_username.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.', '.$pun_user['id'].')') or error('Unable to add ban', __FILE__, __LINE__, $db->error()); | 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()); |
603: } | 609: } |
604: | 610: |
605: // Regenerate the bans cache | 611: // Regenerate the bans cache |
606: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | 612: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
607: require PUN_ROOT.'include/cache.php'; | 613: require PUN_ROOT.'include/cache.php'; |
608: | 614: |
609: generate_bans_cache(); | 615: generate_bans_cache(); |
610: | 616: |
611: redirect('admin_users.php', $lang_admin_users['Users banned redirect']); | 617: redirect('admin_users.php', $lang_admin_users['Users banned redirect']); |
612: } | 618: } |
613: | 619: |
674: $form = array_map('pun_trim', $form); | 680: $form = array_map('pun_trim', $form); |
675: $conditions = $query_str = array(); | 681: $conditions = $query_str = array(); |
676: | 682: |
677: $posts_greater = isset($_GET['posts_greater']) ? trim($_GET['posts_greater']) : ''; | 683: $posts_greater = isset($_GET['posts_greater']) ? pun_trim($_GET['posts_greater']) : ''; |
678: $posts_less = isset($_GET['posts_less']) ? trim($_GET['posts_less']) : ''; | 684: $posts_less = isset($_GET['posts_less']) ? pun_trim($_GET['posts_less']) : ''; |
679: $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']) : ''; |
680: $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']) : ''; |
681: $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']) : ''; |
682: $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']) : ''; |
683: $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'; |
684: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; | 692: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
685: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; | 693: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; |
686: | 694: |
688: $query_str[] = 'direction='.$direction; | 696: $query_str[] = 'direction='.$direction; |
689: $query_str[] = 'user_group='.$user_group; | 697: $query_str[] = 'user_group='.$user_group; |
690: | 698: |
691: if (preg_match('/[^0-9]/', $posts_greater.$posts_less)) | 699: if (preg_match('%[^0-9]%', $posts_greater.$posts_less)) |
692: message($lang_admin_users['Non numeric message']); | 700: message($lang_admin_users['Non numeric message']); |
693: | 701: |
694: // Try to convert date/time to timestamps | 702: // Try to convert date/time to timestamps |
712: | 720: |
713: $conditions[] = 'u.last_post<'.$last_post_before; | 721: $conditions[] = 'u.last_post<'.$last_post_before; |
714: } | 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: } |
715: if ($registered_after != '') | 743: if ($registered_after != '') |
716: { | 744: { |
717: $query_str[] = 'registered_after='.$registered_after; | 745: $query_str[] = 'registered_after='.$registered_after; |
769: | 797: |
770: // Generate paging links | 798: // Generate paging links |
771: $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)); |
772: | 800: |
773: // Some helper variables for permissions | 801: // Some helper variables for permissions |
774: $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; | 802: $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; |
775: $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); | 803: $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); |
839: <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> |
840: <td class="tcr"><?php echo $actions ?></td> | 868: <td class="tcr"><?php echo $actions ?></td> |
841: <?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> | 869: <?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> |
842: <?php endif; ?> | 870: <?php endif; ?> |
843: </tr> | 871: </tr> |
844: <?php | 872: <?php |
845: | 873: |
969: <span><?php echo $lang_admin_users['Date help'] ?></span></td> | 997: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
970: </tr> | 998: </tr> |
971: <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> |
972: <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> |
973: <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" /> |
974: <span><?php echo $lang_admin_users['Date help'] ?></span></td> | 1012: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
986: <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> |
987: <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> |
988: <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> |
989: <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> |
990: </select>   <select name="direction" tabindex="22"> | 1029: </select>   <select name="direction" tabindex="22"> |
991: <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-2011 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.5'); | 10: define('UPDATE_TO', '1.4.9'); |
11: | 11: |
12: define('UPDATE_TO_DB_REVISION', 11); | 12: define('UPDATE_TO_DB_REVISION', 15); |
13: define('UPDATE_TO_SI_REVISION', 2); | 13: define('UPDATE_TO_SI_REVISION', 2); |
14: define('UPDATE_TO_PARSER_REVISION', 2); | 14: define('UPDATE_TO_PARSER_REVISION', 2); |
15: | 15: |
129: if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) | 129: if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) |
130: $default_lang = 'English'; | 130: $default_lang = 'English'; |
131: | 131: |
| 132: require PUN_ROOT.'lang/'.$default_lang.'/common.php'; |
132: require PUN_ROOT.'lang/'.$default_lang.'/update.php'; | 133: require PUN_ROOT.'lang/'.$default_lang.'/update.php'; |
133: | 134: |
134: // Check current version | 135: // Check current version |
253: // | 254: // |
254: function convert_to_utf8(&$str, $old_charset) | 255: function convert_to_utf8(&$str, $old_charset) |
255: { | 256: { |
256: if ($str === null || $str == '') | 257: if (is_null($str) || $str == '') |
257: return false; | 258: return false; |
258: | 259: |
259: $save = $str; | 260: $save = $str; |
277: $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); | 278: $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); |
278: | 279: |
279: // Replace numeric entities | 280: // Replace numeric entities |
280: $str = preg_replace_callback('/&#([0-9]+);/', 'utf8_callback_1', $str); | 281: $str = preg_replace_callback('%&#([0-9]+);%', 'utf8_callback_1', $str); |
281: $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); |
282: | 283: |
283: // Remove "bad" characters | 284: // Remove "bad" characters |
284: $str = remove_bad_characters($str); | 285: $str = remove_bad_characters($str); |
330: $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()); |
331: while ($cur_column = $db->fetch_assoc($result)) | 332: while ($cur_column = $db->fetch_assoc($result)) |
332: { | 333: { |
333: if ($cur_column['Collation'] === null) | 334: if (is_null($cur_column['Collation'])) |
334: continue; | 335: continue; |
335: | 336: |
336: list($type) = explode('(', $cur_column['Type']); | 337: list($type) = explode('(', $cur_column['Type']); |
339: $allow_null = ($cur_column['Null'] == 'YES'); | 340: $allow_null = ($cur_column['Null'] == 'YES'); |
340: $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'; |
341: | 342: |
342: $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()); |
343: $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()); |
344: } | 345: } |
345: } | 346: } |
358: if ($mysql) | 359: if ($mysql) |
359: { | 360: { |
360: // 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 |
361: if ($start_at === null || $start_at == 0) | 362: if (is_null($start_at) || $start_at == 0) |
362: { | 363: { |
363: // 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 |
364: $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()); |
374: $db->set_names($old_connection_charset); | 375: $db->set_names($old_connection_charset); |
375: | 376: |
376: // Move & Convert everything | 377: // Move & Convert everything |
377: $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()); |
378: | 379: |
379: // 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 |
380: $db->set_names('utf8'); | 381: $db->set_names('utf8'); |
385: | 386: |
386: $temp = array(); | 387: $temp = array(); |
387: foreach ($cur_item as $idx => $value) | 388: foreach ($cur_item as $idx => $value) |
388: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 389: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
389: | 390: |
390: $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)); |
391: | 392: |
392: $end_at = $cur_item[$key]; | 393: $end_at = $cur_item[$key]; |
393: } | 394: } |
394: | 395: |
395: // 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 |
396: if ($start_at !== null && $end_at > 0) | 397: if (!is_null($start_at) && $end_at > 0) |
397: { | 398: { |
398: $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()); |
399: $finished = $db->num_rows($result) == 0; | 400: $finished = $db->num_rows($result) == 0; |
416: else | 417: else |
417: { | 418: { |
418: // Convert everything | 419: // Convert everything |
419: $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()); |
420: while ($cur_item = $db->fetch_assoc($result)) | 421: while ($cur_item = $db->fetch_assoc($result)) |
421: { | 422: { |
422: $cur_item = call_user_func($callback, $cur_item, $old_charset); | 423: $cur_item = call_user_func($callback, $cur_item, $old_charset); |
423: | 424: |
424: $temp = array(); | 425: $temp = array(); |
425: foreach ($cur_item as $idx => $value) | 426: foreach ($cur_item as $idx => $value) |
426: $temp[] = $idx.'='.($value === null ? 'NULL' : '\''.$db->escape($value).'\''); | 427: $temp[] = $idx.'='.(is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''); |
427: | 428: |
428: if (!empty($temp)) | 429: if (!empty($temp)) |
429: $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()); |
431: $end_at = $cur_item[$key]; | 432: $end_at = $cur_item[$key]; |
432: } | 433: } |
433: | 434: |
434: if ($start_at !== null && $end_at > 0) | 435: if (!is_null($start_at) && $end_at > 0) |
435: { | 436: { |
436: $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()); |
437: if ($db->num_rows($result) == 0) | 438: if ($db->num_rows($result) == 0) |
459: // Show form | 460: // Show form |
460: if (empty($stage)) | 461: if (empty($stage)) |
461: { | 462: { |
| 463: if (file_exists(FORUM_CACHE_DIR.'db_update.lock')) |
| 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: { |
462: | 505: |
463: ?> | 506: ?> |
464: <!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"> |
465: | 508: |
466: <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'] ?>"> |
467: <head> | 510: <head> |
468: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 511: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
469: <title><?php echo $lang_update['Update'] ?></title> | 512: <title><?php echo $lang_update['Update'] ?></title> |
470: <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" /> |
471: </head> | 514: </head> |
472: <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;"> | 515: <body onload="document.getElementById('install').req_db_pass.focus();document.getElementById('install').start.disabled=false;"> |
473: | 516: |
474: <div id="pundb_update" class="pun"> | 517: <div id="pundb_update" class="pun"> |
475: <div class="top-box"><div><!-- Top Corners --></div></div> | 518: <div class="top-box"><div><!-- Top Corners --></div></div> |
488: <div class="blockform"> | 531: <div class="blockform"> |
489: <h2><span><?php echo $lang_update['Update'] ?></span></h2> | 532: <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
490: <div class="box"> | 533: <div class="box"> |
491: <form method="post" action="db_update.php"> | 534: <form id="install" method="post" action="db_update.php"> |
492: <input type="hidden" name="stage" value="start" /> | 535: <input type="hidden" name="stage" value="start" /> |
493: <div class="inform"> | 536: <div class="inform"> |
494: <fieldset> | 537: <fieldset> |
497: <p><?php echo $lang_update['Database password info'] ?></p> | 540: <p><?php echo $lang_update['Database password info'] ?></p> |
498: <p><strong><?php echo $lang_update['Note']; ?></strong> <?php echo $lang_update['Database password note'] ?></p> | 541: <p><strong><?php echo $lang_update['Note']; ?></strong> <?php echo $lang_update['Database password note'] ?></p> |
499: <label class="required"><strong><?php echo $lang_update['Database password'] ?> <span><?php echo $lang_update['Required'] ?></span></strong><br /><input type="password" id="req_db_pass" name="req_db_pass" /><br /></label> | 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> |
500: </div> | 548: </div> |
501: </fieldset> | 549: </fieldset> |
502: </div> | 550: </div> |
559: </html> | 607: </html> |
560: <?php | 608: <?php |
561: | 609: |
| 610: } |
562: $db->end_transaction(); | 611: $db->end_transaction(); |
563: $db->close(); | 612: $db->close(); |
564: exit; | 613: exit; |
572: // Generate or fetch the UID - this confirms we have a valid admin | 621: // Generate or fetch the UID - this confirms we have a valid admin |
573: if (isset($_POST['req_db_pass'])) | 622: if (isset($_POST['req_db_pass'])) |
574: { | 623: { |
575: $req_db_pass = strtolower(trim($_POST['req_db_pass'])); | 624: $req_db_pass = strtolower(pun_trim($_POST['req_db_pass'])); |
576: | 625: |
577: switch ($db_type) | 626: switch ($db_type) |
578: { | 627: { |
602: | 651: |
603: fwrite($fh, $uid); | 652: fwrite($fh, $uid); |
604: fclose($fh); | 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(); |
605: } | 673: } |
606: } | 674: } |
607: else if (isset($_GET['uid'])) | 675: else if (isset($_GET['uid'])) |
608: { | 676: { |
609: $uid = trim($_GET['uid']); | 677: $uid = pun_trim($_GET['uid']); |
610: if (!$lock || $lock != $uid) // The lock doesn't exist or doesn't match the given UID | 678: if (!$lock || $lock != $uid) // The lock doesn't exist or doesn't match the given UID |
611: $lock_error = true; | 679: $lock_error = true; |
612: } | 680: } |
719: { | 787: { |
720: // Make an educated guess regarding base_url | 788: // Make an educated guess regarding base_url |
721: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol | 789: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol |
722: $base_url .= preg_replace('/:(80|443)$/', '', $_SERVER['HTTP_HOST']); // host[:port] | 790: $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port] |
723: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path | 791: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path |
724: } | 792: } |
725: | 793: |
753: $mod_gid = $db->result($result); | 821: $mod_gid = $db->result($result); |
754: else | 822: else |
755: { | 823: { |
756: $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()); |
757: $mod_gid = $db->insert_id(); | 825: $mod_gid = $db->insert_id(); |
758: } | 826: } |
759: | 827: |
916: $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()); |
917: $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()); |
918: | 986: |
919: // 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 |
920: $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()); |
921: $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()); |
922: | 995: |
923: // Add the auto notify/subscription option to the users table | 996: // Add the auto notify/subscription option to the users table |
924: $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()); |
1086: if ($pun_config['o_default_style'] != $default_style) | 1159: if ($pun_config['o_default_style'] != $default_style) |
1087: $db->query('UPDATE '.$db->prefix.'config SET conf_value = \''.$db->escape($default_style).'\' WHERE conf_name = \'o_default_style\'') or error('Unable to update default style config', __FILE__, __LINE__, $db->error()); | 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()); |
1088: | 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: |
1089: // Should we do charset conversion or not? | 1166: // Should we do charset conversion or not? |
1090: if (strpos($cur_version, '1.2') === 0 && isset($_POST['convert_charset'])) | 1167: if (strpos($cur_version, '1.2') === 0 && isset($_POST['convert_charset'])) |
1091: $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; | 1168: $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; |
1458: $errors[$id][] = $lang_update['Username too long error']; | 1535: $errors[$id][] = $lang_update['Username too long error']; |
1459: else if (!strcasecmp($username, 'Guest')) | 1536: else if (!strcasecmp($username, 'Guest')) |
1460: $errors[$id][] = $lang_update['Username Guest reserved error']; | 1537: $errors[$id][] = $lang_update['Username Guest reserved error']; |
1461: else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $username)) | 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)) |
1462: $errors[$id][] = $lang_update['Username IP format error']; | 1539: $errors[$id][] = $lang_update['Username IP format error']; |
1463: 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) |
1464: $errors[$id][] = $lang_update['Username bad characters error']; | 1541: $errors[$id][] = $lang_update['Username bad characters error']; |
1465: else if (preg_match('/(?:\[\/?(?:b|u|s|ins|del|em|i|h|colou?r|quote|code|img|url|email|list|\*)\]|\[(?:img|url|quote|list)=)/i', $username)) | 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)) |
1466: $errors[$id][] = $lang_update['Username BBCode error']; | 1543: $errors[$id][] = $lang_update['Username BBCode error']; |
1467: | 1544: |
1468: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(ucp_preg_replace('/[^\p{L}\p{N}]/u', '', $username)).'\')) AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 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()); |
1469: | 1546: |
1470: if ($db->num_rows($result)) | 1547: if ($db->num_rows($result)) |
1471: { | 1548: { |
1480: | 1557: |
1481: $temp = array(); | 1558: $temp = array(); |
1482: foreach ($cur_user as $idx => $value) | 1559: foreach ($cur_user as $idx => $value) |
1483: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 1560: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
1484: | 1561: |
1485: // Insert the renamed user | 1562: // Insert the renamed user |
1486: $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()); |
1535: $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); | 1612: $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); |
1536: $mail_message = str_replace('<old_username>', $old_username, $mail_message); | 1613: $mail_message = str_replace('<old_username>', $old_username, $mail_message); |
1537: $mail_message = str_replace('<new_username>', $username, $mail_message); | 1614: $mail_message = str_replace('<new_username>', $username, $mail_message); |
1538: $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); |
1539: | 1616: |
1540: pun_mail($cur_user['email'], $mail_subject, $mail_message); | 1617: pun_mail($cur_user['email'], $mail_subject, $mail_message); |
1541: | 1618: |
1551: ?> | 1628: ?> |
1552: <!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"> |
1553: | 1630: |
1554: <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'] ?>"> |
1555: <head> | 1632: <head> |
1556: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1633: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1557: <title><?php echo $lang_update['Update'] ?></title> | 1634: <title><?php echo $lang_update['Update'] ?></title> |
1788: ?> | 1865: ?> |
1789: <!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"> |
1790: | 1867: |
1791: <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'] ?>"> |
1792: <head> | 1869: <head> |
1793: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1870: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1794: <title><?php echo $lang_update['Update'] ?></title> | 1871: <title><?php echo $lang_update['Update'] ?></title> |
1828: $db->close(); | 1905: $db->close(); |
1829: | 1906: |
1830: if ($query_str != '') | 1907: if ($query_str != '') |
a/include/dblayer/sqlite.php |
b/include/dblayer/sqlite.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: */ |
25: var $error_msg = 'Unknown'; | 25: var $error_msg = 'Unknown'; |
26: | 26: |
27: var $datatype_transformations = array( | 27: var $datatype_transformations = array( |
28: '/^SERIAL$/' => 'INTEGER', | 28: '%^SERIAL$%' => 'INTEGER', |
29: '/^(TINY|SMALL|MEDIUM|BIG)?INT( )?(\\([0-9]+\\))?( )?(UNSIGNED)?$/i' => 'INTEGER', | 29: '%^(TINY|SMALL|MEDIUM|BIG)?INT( )?(\\([0-9]+\\))?( )?(UNSIGNED)?$%i' => 'INTEGER', |
30: '/^(TINY|MEDIUM|LONG)?TEXT$/i' => 'TEXT' | 30: '%^(TINY|MEDIUM|LONG)?TEXT$%i' => 'TEXT' |
31: ); | 31: ); |
32: | 32: |
33: | 33: |
49: if (!is_readable($db_name)) | 49: if (!is_readable($db_name)) |
50: error('Unable to open database \''.$db_name.'\' for reading. Permission denied', __FILE__, __LINE__); | 50: error('Unable to open database \''.$db_name.'\' for reading. Permission denied', __FILE__, __LINE__); |
51: | 51: |
52: if (!is_writable($db_name)) | 52: if (!forum_is_writable($db_name)) |
53: error('Unable to open database \''.$db_name.'\' for writing. Permission denied', __FILE__, __LINE__); | 53: error('Unable to open database \''.$db_name.'\' for writing. Permission denied', __FILE__, __LINE__); |
54: | 54: |
55: if ($p_connect) | 55: if ($p_connect) |
279: if (!$this->num_rows($result)) | 279: if (!$this->num_rows($result)) |
280: return false; | 280: return false; |
281: | 281: |
282: return preg_match('/[\r\n]'.preg_quote($field_name).' /', $this->result($result)); | 282: return preg_match('%[\r\n]'.preg_quote($field_name, '%').' %', $this->result($result)); |
283: } | 283: } |
284: | 284: |
285: | 285: |
345: if (!$this->table_exists($table_name, $no_prefix)) | 345: if (!$this->table_exists($table_name, $no_prefix)) |
346: return true; | 346: return true; |
347: | 347: |
348: return $this->query('DROP TABLE '.($no_prefix ? '' : $this->prefix).$table_name) ? true : false; | 348: return $this->query('DROP TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($table_name)) ? true : false; |
349: } | 349: } |
350: | 350: |
351: | 351: |
372: $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($new_name).' SELECT * FROM '.($no_prefix ? '' : $this->prefix).$this->escape($old_name)) ? true : false; | 372: $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($new_name).' SELECT * FROM '.($no_prefix ? '' : $this->prefix).$this->escape($old_name)) ? true : false; |
373: | 373: |
374: // Drop old table | 374: // Drop old table |
375: $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name)); | 375: $result &= $this->drop_table($table_name, $no_prefix); |
376: | 376: |
377: return $result; | 377: return $result; |
378: } | 378: } |
405: $table['columns'] = array(); | 405: $table['columns'] = array(); |
406: foreach ($table_lines as $table_line) | 406: foreach ($table_lines as $table_line) |
407: { | 407: { |
408: $table_line = pun_trim($table_line); | 408: $table_line = trim($table_line, " \t\n\r,"); // trim spaces, tabs, newlines, and commas |
409: if (substr($table_line, 0, 12) == 'CREATE TABLE') | 409: if (substr($table_line, 0, 12) == 'CREATE TABLE') |
410: continue; | 410: continue; |
411: else if (substr($table_line, 0, 11) == 'PRIMARY KEY') | 411: else if (substr($table_line, 0, 11) == 'PRIMARY KEY') |
413: else if (substr($table_line, 0, 6) == 'UNIQUE') | 413: else if (substr($table_line, 0, 6) == 'UNIQUE') |
414: $table['unique'] = $table_line; | 414: $table['unique'] = $table_line; |
415: else if (substr($table_line, 0, strpos($table_line, ' ')) != '') | 415: else if (substr($table_line, 0, strpos($table_line, ' ')) != '') |
416: $table['columns'][substr($table_line, 0, strpos($table_line, ' '))] = pun_trim(substr($table_line, strpos($table_line, ' '))); | 416: $table['columns'][substr($table_line, 0, strpos($table_line, ' '))] = trim(substr($table_line, strpos($table_line, ' '))); |
417: } | 417: } |
418: | 418: |
419: return $table; | 419: return $table; |
438: $query = $field_type; | 438: $query = $field_type; |
439: if (!$allow_null) | 439: if (!$allow_null) |
440: $query .= ' NOT NULL'; | 440: $query .= ' NOT NULL'; |
441: if ($default_value === null || $default_value === '') | 441: if (is_null($default_value) || $default_value === '') |
442: $default_value = '\'\''; | 442: $default_value = '\'\''; |
443: | 443: |
444: $query .= ' DEFAULT '.$default_value; | 444: $query .= ' DEFAULT '.$default_value; |
445: | 445: |
446: $old_columns = array_keys($table['columns']); | 446: $old_columns = array_keys($table['columns']); |
447: array_insert($table['columns'], $after_field, $query.',', $field_name); | 447: array_insert($table['columns'], $after_field, $query, $field_name); |
448: | 448: |
449: $new_table = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' ('; | 449: $new_table = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' ('; |
450: | 450: |
451: foreach ($table['columns'] as $cur_column => $column_details) | 451: foreach ($table['columns'] as $cur_column => $column_details) |
452: $new_table .= "\n".$cur_column.' '.$column_details; | 452: $new_table .= "\n".$cur_column.' '.$column_details.','; |
453: | 453: |
454: if (isset($table['unique'])) | 454: if (isset($table['unique'])) |
455: $new_table .= "\n".$table['unique'].','; | 455: $new_table .= "\n".$table['unique'].','; |
456: | 456: |
457: if (isset($table['primary_key'])) | 457: if (isset($table['primary_key'])) |
458: $new_table .= "\n".$table['primary_key']; | 458: $new_table .= "\n".$table['primary_key'].','; |
459: | 459: |
460: $new_table = trim($new_table, ',')."\n".');'; | 460: $new_table = trim($new_table, ',')."\n".');'; |
461: | 461: |
462: // Drop old table | 462: // Drop old table |
463: $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name)); | 463: $result &= $this->drop_table($table_name, $no_prefix); |
464: | 464: |
465: // Create new table | 465: // Create new table |
466: $result &= $this->query($new_table) ? true : false; | 466: $result &= $this->query($new_table) ? true : false; |
476: $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' ('.implode(', ', $old_columns).') SELECT * FROM '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'_t'.$now) ? true : false; | 476: $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' ('.implode(', ', $old_columns).') SELECT * FROM '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'_t'.$now) ? true : false; |
477: | 477: |
478: // Drop temp table | 478: // Drop temp table |
479: $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name).'_t'.$now); | 479: $result &= $this->drop_table($table_name.'_t'.$now, $no_prefix); |
480: | 480: |
481: return $result; | 481: return $result; |
482: } | 482: } |
509: $new_table = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' ('; | 509: $new_table = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' ('; |
510: | 510: |
511: foreach ($table['columns'] as $cur_column => $column_details) | 511: foreach ($table['columns'] as $cur_column => $column_details) |
512: $new_table .= "\n".$cur_column.' '.$column_details; | 512: $new_table .= "\n".$cur_column.' '.$column_details.','; |
513: | 513: |
514: if (isset($table['unique'])) | 514: if (isset($table['unique'])) |
515: $new_table .= "\n".$table['unique'].','; | 515: $new_table .= "\n".$table['unique'].','; |
516: | 516: |
517: if (isset($table['primary_key'])) | 517: if (isset($table['primary_key'])) |
518: $new_table .= "\n".$table['primary_key']; | 518: $new_table .= "\n".$table['primary_key'].','; |
519: | 519: |
520: $new_table = trim($new_table, ',')."\n".');'; | 520: $new_table = trim($new_table, ',')."\n".');'; |
521: | 521: |
522: // Drop old table | 522: // Drop old table |
523: $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name)); | 523: $result &= $this->drop_table($table_name, $no_prefix); |
524: | 524: |
525: // Create new table | 525: // Create new table |
526: $result &= $this->query($new_table) ? true : false; | 526: $result &= $this->query($new_table) ? true : false; |
537: $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' SELECT '.implode(', ', $new_columns).' FROM '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'_t'.$now) ? true : false; | 537: $result &= $this->query('INSERT INTO '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).' SELECT '.implode(', ', $new_columns).' FROM '.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'_t'.$now) ? true : false; |
538: | 538: |
539: // Drop temp table | 539: // Drop temp table |
540: $result &= $this->drop_table(($no_prefix ? '' : $this->prefix).$this->escape($table_name).'_t'.$now); | 540: $result &= $this->drop_table($table_name.'_t'.$now, $no_prefix); |
541: | 541: |
542: return $result; | 542: return $result; |
543: } | 543: } |
a/include/email.php |
b/include/email.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: */ |
20: if (strlen($email) > 80) | 20: if (strlen($email) > 80) |
21: return false; | 21: return false; |
22: | 22: |
23: return preg_match('/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|("[^"]+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email); | 23: return preg_match('%^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|("[^"]+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$%', $email); |
24: } | 24: } |
25: | 25: |
26: | 26: |
56: | 56: |
57: | 57: |
58: // | 58: // |
| 59: // Make a post email safe |
| 60: // |
| 61: function bbcode2email($text, $wrap_length = 72) |
| 62: { |
| 63: static $base_url; |
| 64: |
| 65: if (!isset($base_url)) |
| 66: $base_url = get_base_url(); |
| 67: |
| 68: $text = pun_trim($text, "\t\n "); |
| 69: |
| 70: $shortcut_urls = array( |
| 71: 'topic' => '/viewtopic.php?id=$1', |
| 72: 'post' => '/viewtopic.php?pid=$1#p$1', |
| 73: 'forum' => '/viewforum.php?id=$1', |
| 74: 'user' => '/profile.php?id=$1', |
| 75: ); |
| 76: |
| 77: // Split code blocks and text so BBcode in codeblocks won't be touched |
| 78: list($code, $text) = extract_blocks($text, '[code]', '[/code]'); |
| 79: |
| 80: // Strip all bbcodes, except the quote, url, img, email, code and list items bbcodes |
| 81: $text = preg_replace(array( |
| 82: '%\[/?(?!(?:quote|url|topic|post|user|forum|img|email|code|list|\*))[a-z]+(?:=[^\]]+)?\]%i', |
| 83: '%\n\[/?list(?:=[^\]]+)?\]%i' // A separate regex for the list tags to get rid of some whitespace |
| 84: ), '', $text); |
| 85: |
| 86: // Match the deepest nested bbcode |
| 87: // An adapted example from Mastering Regular Expressions |
| 88: $match_quote_regex = '% |
| 89: \[(quote|\*|url|img|email|topic|post|user|forum)(?:=([^\]]+))?\] |
| 90: ( |
| 91: (?>[^\[]*) |
| 92: (?> |
| 93: (?!\[/?\1(?:=[^\]]+)?\]) |
| 94: \[ |
| 95: [^\[]* |
| 96: )* |
| 97: ) |
| 98: \[/\1\] |
| 99: %ix'; |
| 100: |
| 101: $url_index = 1; |
| 102: $url_stack = array(); |
| 103: while (preg_match($match_quote_regex, $text, $matches)) |
| 104: { |
| 105: // Quotes |
| 106: if ($matches[1] == 'quote') |
| 107: { |
| 108: // Put '>' or '> ' at the start of a line |
| 109: $replacement = preg_replace( |
| 110: array('%^(?=\>)%m', '%^(?!\>)%m'), |
| 111: array('>', '> '), |
| 112: $matches[2]." said:\n".$matches[3]); |
| 113: } |
| 114: |
| 115: // List items |
| 116: elseif ($matches[1] == '*') |
| 117: { |
| 118: $replacement = ' * '.$matches[3]; |
| 119: } |
| 120: |
| 121: // URLs and emails |
| 122: elseif (in_array($matches[1], array('url', 'email'))) |
| 123: { |
| 124: if (!empty($matches[2])) |
| 125: { |
| 126: $replacement = '['.$matches[3].']['.$url_index.']'; |
| 127: $url_stack[$url_index] = $matches[2]; |
| 128: $url_index++; |
| 129: } |
| 130: else |
| 131: $replacement = '['.$matches[3].']'; |
| 132: } |
| 133: |
| 134: // Images |
| 135: elseif ($matches[1] == 'img') |
| 136: { |
| 137: if (!empty($matches[2])) |
| 138: $replacement = '['.$matches[2].']['.$url_index.']'; |
| 139: else |
| 140: $replacement = '['.basename($matches[3]).']['.$url_index.']'; |
| 141: |
| 142: $url_stack[$url_index] = $matches[3]; |
| 143: $url_index++; |
| 144: } |
| 145: |
| 146: // Topic, post, forum and user URLs |
| 147: elseif (in_array($matches[1], array('topic', 'post', 'forum', 'user'))) |
| 148: { |
| 149: $url = isset($shortcut_urls[$matches[1]]) ? $base_url.$shortcut_urls[$matches[1]] : ''; |
| 150: |
| 151: if (!empty($matches[2])) |
| 152: { |
| 153: $replacement = '['.$matches[3].']['.$url_index.']'; |
| 154: $url_stack[$url_index] = str_replace('$1', $matches[2], $url); |
| 155: $url_index++; |
| 156: } |
| 157: else |
| 158: $replacement = '['.str_replace('$1', $matches[3], $url).']'; |
| 159: } |
| 160: |
| 161: // Update the main text if there is a replacment |
| 162: if (!is_null($replacement)) |
| 163: { |
| 164: $text = str_replace($matches[0], $replacement, $text); |
| 165: $replacement = null; |
| 166: } |
| 167: } |
| 168: |
| 169: // Put code blocks and text together |
| 170: if (isset($code)) |
| 171: { |
| 172: $parts = explode("\1", $text); |
| 173: $text = ''; |
| 174: foreach ($parts as $i => $part) |
| 175: { |
| 176: $text .= $part; |
| 177: if (isset($code[$i])) |
| 178: $text .= trim($code[$i], "\n\r"); |
| 179: } |
| 180: } |
| 181: |
| 182: // Put URLs at the bottom |
| 183: if ($url_stack) |
| 184: { |
| 185: $text .= "\n\n"; |
| 186: foreach ($url_stack as $i => $url) |
| 187: $text .= "\n".' ['.$i.']: '.$url; |
| 188: } |
| 189: |
| 190: // Wrap lines if $wrap_length is higher than -1 |
| 191: if ($wrap_length > -1) |
| 192: { |
| 193: // Split all lines and wrap them individually |
| 194: $parts = explode("\n", $text); |
| 195: foreach ($parts as $k => $part) |
| 196: { |
| 197: preg_match('%^(>+ )?(.*)%', $part, $matches); |
| 198: $parts[$k] = wordwrap($matches[1].$matches[2], $wrap_length - |
| 199: strlen($matches[1]), "\n".$matches[1]); |
| 200: } |
| 201: |
| 202: return implode("\n", $parts); |
| 203: } |
| 204: else |
| 205: return $text; |
| 206: } |
| 207: |
| 208: |
| 209: // |
59: // Wrapper for PHP's mail() | 210: // Wrapper for PHP's mail() |
60: // | 211: // |
61: function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '') | 212: function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '') |
63: global $pun_config, $lang_common; | 214: global $pun_config, $lang_common; |
64: | 215: |
65: // Default sender/return address | 216: // Default sender/return address |
66: $from_name = str_replace('"', '', $pun_config['o_board_title'].' '.$lang_common['Mailer']); | 217: $from_name = sprintf($lang_common['Mailer'], $pun_config['o_board_title']); |
67: $from_email = $pun_config['o_webmaster_email']; | 218: $from_email = $pun_config['o_webmaster_email']; |
68: | 219: |
69: // Do a little spring cleaning | 220: // Do a little spring cleaning |
70: $to = pun_trim(preg_replace('#[\n\r]+#s', '', $to)); | 221: $to = pun_trim(preg_replace('%[\n\r]+%s', '', $to)); |
71: $subject = pun_trim(preg_replace('#[\n\r]+#s', '', $subject)); | 222: $subject = pun_trim(preg_replace('%[\n\r]+%s', '', $subject)); |
72: $from_email = pun_trim(preg_replace('#[\n\r:]+#s', '', $from_email)); | 223: $from_email = pun_trim(preg_replace('%[\n\r:]+%s', '', $from_email)); |
73: $from_name = pun_trim(preg_replace('#[\n\r:]+#s', '', str_replace('"', '', $from_name))); | 224: $from_name = pun_trim(preg_replace('%[\n\r:]+%s', '', str_replace('"', '', $from_name))); |
74: $reply_to_email = pun_trim(preg_replace('#[\n\r:]+#s', '', $reply_to_email)); | 225: $reply_to_email = pun_trim(preg_replace('%[\n\r:]+%s', '', $reply_to_email)); |
75: $reply_to_name = pun_trim(preg_replace('#[\n\r:]+#s', '', str_replace('"', '', $reply_to_name))); | 226: $reply_to_name = pun_trim(preg_replace('%[\n\r:]+%s', '', str_replace('"', '', $reply_to_name))); |
76: | 227: |
77: // Set up some headers to take advantage of UTF-8 | 228: // Set up some headers to take advantage of UTF-8 |
78: $from = encode_mail_text($from_name).' <'.$from_email.'>'; | 229: $from = '"'.encode_mail_text($from_name).'" <'.$from_email.'>'; |
79: $subject = encode_mail_text($subject); | 230: $subject = encode_mail_text($subject); |
80: | 231: |
81: $headers = 'From: '.$from."\r\n".'Date: '.gmdate('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset=utf-8'."\r\n".'X-Mailer: FluxBB Mailer'; | 232: $headers = 'From: '.$from."\r\n".'Date: '.gmdate('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset=utf-8'."\r\n".'X-Mailer: FluxBB Mailer'; |
83: // If we specified a reply-to email, we deal with it here | 234: // If we specified a reply-to email, we deal with it here |
84: if (!empty($reply_to_email)) | 235: if (!empty($reply_to_email)) |
85: { | 236: { |
86: $reply_to = encode_mail_text($reply_to_name).' <'.$reply_to_email.'>'; | 237: $reply_to = '"'.encode_mail_text($reply_to_name).'" <'.$reply_to_email.'>'; |
87: | 238: |
88: $headers .= "\r\n".'Reply-To: '.$reply_to; | 239: $headers .= "\r\n".'Reply-To: '.$reply_to; |
89: } | 240: } |
90: | 241: |
91: // Make sure all linebreaks are CRLF in message (and strip out any NULL bytes) | 242: // Make sure all linebreaks are LF in message (and strip out any NULL bytes) |
92: $message = str_replace(array("\n", "\0"), array("\r\n", ''), pun_linebreaks($message)); | 243: $message = str_replace("\0", '', pun_linebreaks($message)); |
93: | 244: |
94: if ($pun_config['o_smtp_host'] != '') | 245: if ($pun_config['o_smtp_host'] != '') |
| 246: { |
| 247: // Headers should be \r\n |
| 248: // Message should be ?? |
| 249: $message = str_replace("\n", "\r\n", $message); |
95: smtp_mail($to, $subject, $message, $headers); | 250: smtp_mail($to, $subject, $message, $headers); |
| 251: } |
96: else | 252: else |
97: { | 253: { |
98: // Change the linebreaks used in the headers according to OS | 254: // Headers should be \r\n |
99: if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') | 255: // Message should be \n |
100: $headers = str_replace("\r\n", "\r", $headers); | |
101: else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') | |
102: $headers = str_replace("\r\n", "\n", $headers); | |
103: | |
104: mail($to, $subject, $message, $headers); | 256: mail($to, $subject, $message, $headers); |
105: } | 257: } |
106: } | 258: } |
a/include/functions.php |
b/include/functions.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: $now = time(); | 26: $now = time(); |
27: | 27: |
28: // If the cookie is set and it matches the correct pattern, then read the values from it | 28: // If the cookie is set and it matches the correct pattern, then read the values from it |
29: if (isset($_COOKIE[$cookie_name]) && preg_match('/^(\d+)\|([0-9a-fA-F]+)\|(\d+)\|([0-9a-fA-F]+)$/', $_COOKIE[$cookie_name], $matches)) | 29: if (isset($_COOKIE[$cookie_name]) && preg_match('%^(\d+)\|([0-9a-fA-F]+)\|(\d+)\|([0-9a-fA-F]+)$%', $_COOKIE[$cookie_name], $matches)) |
30: { | 30: { |
31: $cookie = array( | 31: $cookie = array( |
32: 'user_id' => intval($matches[1]), | 32: 'user_id' => intval($matches[1]), |
246: // Fetch guest user | 246: // Fetch guest user |
247: $result = $db->query('SELECT u.*, g.*, o.logged, o.last_post, o.last_search FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error()); | 247: $result = $db->query('SELECT u.*, g.*, o.logged, o.last_post, o.last_search FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error()); |
248: if (!$db->num_rows($result)) | 248: if (!$db->num_rows($result)) |
249: exit('Unable to fetch guest information. The table \''.$db->prefix.'users\' must contain an entry with id = 1 that represents anonymous users.'); | 249: exit('Unable to fetch guest information. Your database must contain both a guest user and a guest user group.'); |
250: | 250: |
251: $pun_user = $db->fetch_assoc($result); | 251: $pun_user = $db->fetch_assoc($result); |
252: | 252: |
428: global $db, $pun_config, $errors, $lang_prof_reg, $lang_register, $lang_common, $pun_bans; | 428: global $db, $pun_config, $errors, $lang_prof_reg, $lang_register, $lang_common, $pun_bans; |
429: | 429: |
430: // Convert multiple whitespace characters into one (to prevent people from registering with indistinguishable usernames) | 430: // Convert multiple whitespace characters into one (to prevent people from registering with indistinguishable usernames) |
431: $username = preg_replace('#\s+#s', ' ', $username); | 431: $username = preg_replace('%\s+%s', ' ', $username); |
432: | 432: |
433: // Validate username | 433: // Validate username |
434: if (pun_strlen($username) < 2) | 434: if (pun_strlen($username) < 2) |
437: $errors[] = $lang_prof_reg['Username too long']; | 437: $errors[] = $lang_prof_reg['Username too long']; |
438: else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) | 438: else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) |
439: $errors[] = $lang_prof_reg['Username guest']; | 439: $errors[] = $lang_prof_reg['Username guest']; |
440: 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)) | 440: 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)) |
441: $errors[] = $lang_prof_reg['Username IP']; | 441: $errors[] = $lang_prof_reg['Username IP']; |
442: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) | 442: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
443: $errors[] = $lang_prof_reg['Username reserved chars']; | 443: $errors[] = $lang_prof_reg['Username reserved chars']; |
444: 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)) | 444: else if (preg_match('%(?:\[/?(?:b|u|s|ins|del|em|i|h|colou?r|quote|code|img|url|email|list|\*|topic|post|forum|user)\]|\[(?:img|url|quote|list)=)%i', $username)) |
445: $errors[] = $lang_prof_reg['Username BBCode']; | 445: $errors[] = $lang_prof_reg['Username BBCode']; |
446: | 446: |
447: // Check username for any censored words | 447: // Check username for any censored words |
451: // Check that the username (or a too similar username) is not already registered | 451: // Check that the username (or a too similar username) is not already registered |
452: $query = ($exclude_id) ? ' AND id!='.$exclude_id : ''; | 452: $query = ($exclude_id) ? ' AND id!='.$exclude_id : ''; |
453: | 453: |
454: $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'.$query) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 454: $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'.$query) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
455: | 455: |
456: if ($db->num_rows($result)) | 456: if ($db->num_rows($result)) |
457: { | 457: { |
566: | 566: |
567: $page_title = array_reverse($page_title); | 567: $page_title = array_reverse($page_title); |
568: | 568: |
569: if ($p != null) | 569: if (!is_null($p)) |
570: $page_title[0] .= ' ('.sprintf($lang_common['Page'], forum_number_format($p)).')'; | 570: $page_title[0] .= ' ('.sprintf($lang_common['Page'], forum_number_format($p)).')'; |
571: | 571: |
572: $crumbs = implode($lang_common['Title separator'], $page_title); | 572: $crumbs = implode($lang_common['Title separator'], $page_title); |
619: if (!$cookie_data) | 619: if (!$cookie_data) |
620: return array('topics' => array(), 'forums' => array()); | 620: return array('topics' => array(), 'forums' => array()); |
621: | 621: |
622: if (strlen($cookie_data) > 4048) | 622: if (strlen($cookie_data) > FORUM_MAX_COOKIE_SIZE) |
623: return array('topics' => array(), 'forums' => array()); | 623: return array('topics' => array(), 'forums' => array()); |
624: | 624: |
625: // Unserialize data from cookie | 625: // Unserialize data from cookie |
882: { | 882: { |
883: // Add a previous page link | 883: // Add a previous page link |
884: if ($num_pages > 1 && $cur_page > 1) | 884: if ($num_pages > 1 && $cur_page > 1) |
885: $pages[] = '<a'.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page - 1).'">'.$lang_common['Previous'].'</a>'; | 885: $pages[] = '<a rel="prev" '.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page - 1).'">'.$lang_common['Previous'].'</a>'; |
886: | 886: |
887: if ($cur_page > 3) | 887: if ($cur_page > 3) |
888: { | 888: { |
913: | 913: |
914: // Add a next page link | 914: // Add a next page link |
915: if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages) | 915: if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages) |
916: $pages[] = '<a'.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page +1).'">'.$lang_common['Next'].'</a>'; | 916: $pages[] = '<a rel="next" '.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page +1).'">'.$lang_common['Next'].'</a>'; |
917: } | 917: } |
918: | 918: |
919: return implode(' ', $pages); | 919: return implode(' ', $pages); |
923: // | 923: // |
924: // Display a message | 924: // Display a message |
925: // | 925: // |
926: function message($message, $no_back_link = false) | 926: function message($message, $no_back_link = false, $http_status = null) |
927: { | 927: { |
928: global $db, $lang_common, $pun_config, $pun_start, $tpl_main, $pun_user; | 928: global $db, $lang_common, $pun_config, $pun_start, $tpl_main, $pun_user; |
929: | 929: |
| 930: // Did we receive a custom header? |
| 931: if(!is_null($http_status)) { |
| 932: header('HTTP/1.1 ' . $http_status); |
| 933: } |
| 934: |
930: if (!defined('PUN_HEADER')) | 935: if (!defined('PUN_HEADER')) |
931: { | 936: { |
932: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Info']); | 937: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Info']); |
965: $timestamp += $diff; | 970: $timestamp += $diff; |
966: $now = time(); | 971: $now = time(); |
967: | 972: |
968: if($date_format == null) | 973: if(is_null($date_format)) |
969: $date_format = $forum_date_formats[$pun_user['date_format']]; | 974: $date_format = $forum_date_formats[$pun_user['date_format']]; |
970: | 975: |
971: if($time_format == null) | 976: if(is_null($time_format)) |
972: $time_format = $forum_time_formats[$pun_user['time_format']]; | 977: $time_format = $forum_time_formats[$pun_user['time_format']]; |
973: | 978: |
974: $date = gmdate($date_format, $timestamp); | 979: $date = gmdate($date_format, $timestamp); |
1091: // X-Forwarded-For: client1, proxy1, proxy2 | 1096: // X-Forwarded-For: client1, proxy1, proxy2 |
1092: // where the value is a comma+space separated list of IP addresses, the left-most being the farthest downstream client, | 1097: // where the value is a comma+space separated list of IP addresses, the left-most being the farthest downstream client, |
1093: // and each successive proxy that passed the request adding the IP address where it received the request from. | 1098: // and each successive proxy that passed the request adding the IP address where it received the request from. |
1094: $remote_addr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); | 1099: $forwarded_for = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
1095: $remote_addr = trim($remote_addr[0]); | 1100: $forwarded_for = trim($forwarded_for[0]); |
| 1101: |
| 1102: if (@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $forwarded_for) || @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}:))$%', $forwarded_for)) |
| 1103: $remote_addr = $forwarded_for; |
1096: } | 1104: } |
1097: } | 1105: } |
1098: | 1106: |
1152: // | 1160: // |
1153: function pun_trim($str, $charlist = false) | 1161: function pun_trim($str, $charlist = false) |
1154: { | 1162: { |
1155: return utf8_trim($str, $charlist); | 1163: return is_string($str) ? utf8_trim($str, $charlist) : ''; |
1156: } | 1164: } |
1157: | 1165: |
1158: // | 1166: // |
1172: // | 1180: // |
1173: function array_insert(&$input, $offset, $element, $key = null) | 1181: function array_insert(&$input, $offset, $element, $key = null) |
1174: { | 1182: { |
1175: if ($key == null) | 1183: if (is_null($key)) |
1176: $key = $offset; | 1184: $key = $offset; |
1177: | 1185: |
1178: // Determine the proper offset if we're using a string | 1186: // Determine the proper offset if we're using a string |
1224: $tpl_maint = file_get_contents($tpl_file); | 1232: $tpl_maint = file_get_contents($tpl_file); |
1225: | 1233: |
1226: // START SUBST - <pun_include "*"> | 1234: // START SUBST - <pun_include "*"> |
1227: preg_match_all('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_maint, $pun_includes, PREG_SET_ORDER); | 1235: preg_match_all('%<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">%i', $tpl_maint, $pun_includes, PREG_SET_ORDER); |
1228: | 1236: |
1229: foreach ($pun_includes as $cur_include) | 1237: foreach ($pun_includes as $cur_include) |
1230: { | 1238: { |
1314: $destination_url = get_base_url(true).'/'.$destination_url; | 1322: $destination_url = get_base_url(true).'/'.$destination_url; |
1315: | 1323: |
1316: // Do a little spring cleaning | 1324: // Do a little spring cleaning |
1317: $destination_url = preg_replace('/([\r\n])|(%0[ad])|(;\s*data\s*:)/i', '', $destination_url); | 1325: $destination_url = preg_replace('%([\r\n])|(\%0[ad])|(;\s*data\s*:)%i', '', $destination_url); |
1318: | 1326: |
1319: // If the delay is 0 seconds, we might as well skip the redirect all together | 1327: // If the delay is 0 seconds, we might as well skip the redirect all together |
1320: if ($pun_config['o_redirect_delay'] == '0') | 1328: if ($pun_config['o_redirect_delay'] == '0') |
1343: $tpl_redir = file_get_contents($tpl_file); | 1351: $tpl_redir = file_get_contents($tpl_file); |
1344: | 1352: |
1345: // START SUBST - <pun_include "*"> | 1353: // START SUBST - <pun_include "*"> |
1346: preg_match_all('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_redir, $pun_includes, PREG_SET_ORDER); | 1354: preg_match_all('%<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">%i', $tpl_redir, $pun_includes, PREG_SET_ORDER); |
1347: | 1355: |
1348: foreach ($pun_includes as $cur_include) | 1356: foreach ($pun_includes as $cur_include) |
1349: { | 1357: { |
1498: <div> | 1506: <div> |
1499: <?php | 1507: <?php |
1500: | 1508: |
1501: if (defined('PUN_DEBUG') && $file !== null && $line !== null) | 1509: if (defined('PUN_DEBUG') && !is_null($file) && !is_null($line)) |
1502: { | 1510: { |
1503: echo "\t\t".'<strong>File:</strong> '.$file.'<br />'."\n\t\t".'<strong>Line:</strong> '.$line.'<br /><br />'."\n\t\t".'<strong>FluxBB reported</strong>: '.$message."\n"; | 1511: echo "\t\t".'<strong>File:</strong> '.$file.'<br />'."\n\t\t".'<strong>Line:</strong> '.$line.'<br /><br />'."\n\t\t".'<strong>FluxBB reported</strong>: '.$message."\n"; |
1504: | 1512: |
1627: $array = utf8_bad_strip($array); | 1635: $array = utf8_bad_strip($array); |
1628: | 1636: |
1629: // Remove control characters | 1637: // Remove control characters |
1630: $array = preg_replace('/[\x{00}-\x{08}\x{0b}-\x{0c}\x{0e}-\x{1f}]/', '', $array); | 1638: $array = preg_replace('%[\x00-\x08\x0b-\x0c\x0e-\x1f]%', '', $array); |
1631: | 1639: |
1632: // Replace some "bad" characters | 1640: // Replace some "bad" characters |
1633: $array = str_replace(array_keys($bad_utf8_chars), array_values($bad_utf8_chars), $array); | 1641: $array = str_replace(array_keys($bad_utf8_chars), array_values($bad_utf8_chars), $array); |
1641: // | 1649: // |
1642: function file_size($size) | 1650: function file_size($size) |
1643: { | 1651: { |
| 1652: global $lang_common; |
| 1653: |
1644: $units = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'); | 1654: $units = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'); |
1645: | 1655: |
1646: for ($i = 0; $size > 1024; $i++) | 1656: for ($i = 0; $size > 1024; $i++) |
1647: $size /= 1024; | 1657: $size /= 1024; |
1648: | 1658: |
1649: return round($size, 2).' '.$units[$i]; | 1659: return sprintf($lang_common['Size unit '.$units[$i]], round($size, 2)); |
1650: } | 1660: } |
1651: | 1661: |
1652: | 1662: |
1736: $suffix = substr($entry, strlen($entry) - 4); | 1746: $suffix = substr($entry, strlen($entry) - 4); |
1737: | 1747: |
1738: if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP')))) | 1748: if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP')))) |
1739: $plugins[] = array(substr($entry, strpos($entry, '_') + 1, -4), $entry); | 1749: $plugins[$entry] = substr($entry, strpos($entry, '_') + 1, -4); |
1740: } | 1750: } |
1741: $d->close(); | 1751: $d->close(); |
1742: | 1752: |
| 1753: natcasesort($plugins); |
| 1754: |
1743: return $plugins; | 1755: return $plugins; |
1744: } | 1756: } |
1745: | 1757: |
1747: // | 1759: // |
1748: // Split text into chunks ($inside contains all text inside $start and $end, and $outside contains all text outside) | 1760: // Split text into chunks ($inside contains all text inside $start and $end, and $outside contains all text outside) |
1749: // | 1761: // |
1750: function split_text($text, $start, $end, &$errors, $retab = true) | 1762: function split_text($text, $start, $end, $retab = true) |
1751: { | 1763: { |
1752: global $pun_config, $lang_common; | 1764: global $pun_config, $lang_common; |
1753: | 1765: |
1754: $tokens = explode($start, $text); | 1766: $result = array(0 => array(), 1 => array()); // 0 = inside, 1 = outside |
1755: | 1767: |
1756: $outside[] = $tokens[0]; | 1768: // split the text into parts |
| 1769: $parts = preg_split('%'.preg_quote($start, '%').'(.*)'.preg_quote($end, '%').'%Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 1770: $num_parts = count($parts); |
1757: | 1771: |
1758: $num_tokens = count($tokens); | 1772: // preg_split results in outside parts having even indices, inside parts having odd |
1759: for ($i = 1; $i < $num_tokens; ++$i) | 1773: for ($i = 0;$i < $num_parts;$i++) |
| 1774: $result[1 - ($i % 2)][] = $parts[$i]; |
| 1775: |
| 1776: if ($pun_config['o_indent_num_spaces'] != 8 && $retab) |
1760: { | 1777: { |
1761: $temp = explode($end, $tokens[$i]); | 1778: $spaces = str_repeat(' ', $pun_config['o_indent_num_spaces']); |
| 1779: $result[1] = str_replace("\t", $spaces, $result[1]); |
| 1780: } |
| 1781: |
| 1782: return $result; |
| 1783: } |
1762: | 1784: |
1763: if (count($temp) != 2) | 1785: |
| 1786: // |
| 1787: // Extract blocks from a text with a starting and ending string |
| 1788: // This function always matches the most outer block so nesting is possible |
| 1789: // |
| 1790: function extract_blocks($text, $start, $end, $retab = true) |
| 1791: { |
| 1792: global $pun_config; |
| 1793: |
| 1794: $code = array(); |
| 1795: $start_len = strlen($start); |
| 1796: $end_len = strlen($end); |
| 1797: $regex = '%(?:'.preg_quote($start, '%').'|'.preg_quote($end, '%').')%'; |
| 1798: $matches = array(); |
| 1799: |
| 1800: if (preg_match_all($regex, $text, $matches)) |
| 1801: { |
| 1802: $counter = $offset = 0; |
| 1803: $start_pos = $end_pos = false; |
| 1804: |
| 1805: foreach ($matches[0] as $match) |
1764: { | 1806: { |
1765: $errors[] = $lang_common['BBCode code problem']; | 1807: if ($match == $start) |
1766: return array(null, array($text)); | 1808: { |
| 1809: if ($counter == 0) |
| 1810: $start_pos = strpos($text, $start); |
| 1811: $counter++; |
| 1812: } |
| 1813: elseif ($match == $end) |
| 1814: { |
| 1815: $counter--; |
| 1816: if ($counter == 0) |
| 1817: $end_pos = strpos($text, $end, $offset + 1); |
| 1818: $offset = strpos($text, $end, $offset + 1); |
| 1819: } |
| 1820: |
| 1821: if ($start_pos !== false && $end_pos !== false) |
| 1822: { |
| 1823: $code[] = substr($text, $start_pos + $start_len, |
| 1824: $end_pos - $start_pos - $start_len); |
| 1825: $text = substr_replace($text, "\1", $start_pos, |
| 1826: $end_pos - $start_pos + $end_len); |
| 1827: $start_pos = $end_pos = false; |
| 1828: $offset = 0; |
| 1829: } |
1767: } | 1830: } |
1768: $inside[] = $temp[0]; | |
1769: $outside[] = $temp[1]; | |
1770: } | 1831: } |
1771: | 1832: |
1772: if ($pun_config['o_indent_num_spaces'] != 8 && $retab) | 1833: if ($pun_config['o_indent_num_spaces'] != 8 && $retab) |
1773: { | 1834: { |
1774: $spaces = str_repeat(' ', $pun_config['o_indent_num_spaces']); | 1835: $spaces = str_repeat(' ', $pun_config['o_indent_num_spaces']); |
1775: $inside = str_replace("\t", $spaces, $inside); | 1836: $text = str_replace("\t", $spaces, $text); |
1776: } | 1837: } |
1777: | 1838: |
1778: return array($inside, $outside); | 1839: return array($code, $text); |
1779: } | 1840: } |
1780: | 1841: |
| 1842: |
1781: // | 1843: // |
1782: // function url_valid($url) { | 1844: // function url_valid($url) { |
1783: // | 1845: // |
1897: function ucp_preg_replace($pattern, $replace, $subject) | 1959: function ucp_preg_replace($pattern, $replace, $subject) |
1898: { | 1960: { |
1899: $replaced = preg_replace($pattern, $replace, $subject); | 1961: $replaced = preg_replace($pattern, $replace, $subject); |
1900: | 1962: |
1901: // If preg_replace() returns false, this probably means unicode support is not built-in, so we need to modify the pattern a little | 1963: // If preg_replace() returns false, this probably means unicode support is not built-in, so we need to modify the pattern a little |
1902: if ($replaced === false) | 1964: if ($replaced === false) |
1903: { | 1965: { |
1905: { | 1967: { |
1906: foreach ($pattern as $cur_key => $cur_pattern) | 1968: foreach ($pattern as $cur_key => $cur_pattern) |
1907: $pattern[$cur_key] = str_replace('\p{L}\p{N}', '\w', $cur_pattern); | 1969: $pattern[$cur_key] = str_replace('\p{L}\p{N}', '\w', $cur_pattern); |
1908: | 1970: |
1909: $replaced = preg_replace($pattern, $replace, $subject); | 1971: $replaced = preg_replace($pattern, $replace, $subject); |
1910: } | 1972: } |
1911: else | 1973: else |
1912: $replaced = preg_replace(str_replace('\p{L}\p{N}', '\w', $pattern), $replace, $subject); | 1974: $replaced = preg_replace(str_replace('\p{L}\p{N}', '\w', $pattern), $replace, $subject); |
1913: } | 1975: } |
1914: | 1976: |
1915: return $replaced; | 1977: return $replaced; |
1916: } | 1978: } |
1917: | 1979: |
| 1980: // |
| 1981: // Replace four-byte characters with a question mark |
| 1982: // |
| 1983: // As MySQL cannot properly handle four-byte characters with the default utf-8 |
| 1984: // charset up until version 5.5.3 (where a special charset has to be used), they |
| 1985: // need to be replaced, by question marks in this case. |
| 1986: // |
| 1987: function strip_bad_multibyte_chars($str) |
| 1988: { |
| 1989: $result = ''; |
| 1990: $length = strlen($str); |
| 1991: |
| 1992: for ($i = 0; $i < $length; $i++) |
| 1993: { |
| 1994: // Replace four-byte characters (11110www 10zzzzzz 10yyyyyy 10xxxxxx) |
| 1995: $ord = ord($str[$i]); |
| 1996: if ($ord >= 240 && $ord <= 244) |
| 1997: { |
| 1998: $result .= '?'; |
| 1999: $i += 3; |
| 2000: } |
| 2001: else |
| 2002: { |
| 2003: $result .= $str[$i]; |
| 2004: } |
| 2005: } |
| 2006: |
| 2007: return $result; |
| 2008: } |
| 2009: |
| 2010: // |
| 2011: // Check whether a file/folder is writable. |
| 2012: // |
| 2013: // This function also works on Windows Server where ACLs seem to be ignored. |
| 2014: // |
| 2015: function forum_is_writable($path) |
| 2016: { |
| 2017: if (is_dir($path)) |
| 2018: { |
| 2019: $path = rtrim($path, '/').'/'; |
| 2020: return forum_is_writable($path.uniqid(mt_rand()).'.tmp'); |
| 2021: } |
| 2022: |
| 2023: // Check temporary file for read/write capabilities |
| 2024: $rm = file_exists($path); |
| 2025: $f = @fopen($path, 'a'); |
| 2026: |
| 2027: if ($f === false) |
| 2028: return false; |
| 2029: |
| 2030: fclose($f); |
| 2031: |
| 2032: if (!$rm) |
| 2033: @unlink($path); |
| 2034: |
| 2035: return true; |
| 2036: } |
| 2037: |
| 2038: |
1918: // DEBUG FUNCTIONS BELOW | 2039: // DEBUG FUNCTIONS BELOW |
1919: | 2040: |
1920: // | 2041: // |
a/include/parser.php |
b/include/parser.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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: */ |
76: | 76: |
77: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) | 77: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) |
78: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 78: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
79: { | 79: list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); |
80: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); | |
81: $text = implode("\1", $outside); | |
82: } | |
83: | 80: |
84: // Tidy up lists | 81: // Tidy up lists |
85: $temp = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\', $errors)', $text); | 82: $temp = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\')', $text); |
86: | 83: |
87: // If the regex failed | 84: // If the regex failed |
88: if ($temp === null) | 85: if (is_null($temp)) |
89: $errors[] = $lang_common['BBCode list size error']; | 86: $errors[] = $lang_common['BBCode list size error']; |
90: else | 87: else |
91: $text = str_replace('*'."\0".']', '*]', $temp); | 88: $text = str_replace('*'."\0".']', '*]', $temp); |
118: $text = $temp_text; | 115: $text = $temp_text; |
119: | 116: |
120: // Remove empty tags | 117: // Remove empty tags |
121: while (($new_text = strip_empty_bbcode($text, $errors)) !== false) | 118: while (($new_text = strip_empty_bbcode($text)) !== false) |
122: { | 119: { |
123: if ($new_text != $text) | 120: if ($new_text != $text) |
124: { | 121: { |
140: // | 137: // |
141: // Strip empty bbcode tags from some text | 138: // Strip empty bbcode tags from some text |
142: // | 139: // |
143: function strip_empty_bbcode($text, &$errors) | 140: function strip_empty_bbcode($text) |
144: { | 141: { |
145: // If the message contains a code tag we have to split it up (empty tags within [code][/code] are fine) | 142: // If the message contains a code tag we have to split it up (empty tags within [code][/code] are fine) |
146: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 143: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
147: { | 144: list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); |
148: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); | |
149: $text = implode("\1", $outside); | |
150: } | |
151: | 145: |
152: // Remove empty tags | 146: // Remove empty tags |
153: while (($new_text = preg_replace('/\[(b|u|s|ins|del|em|i|h|colou?r|quote|img|url|email|list)(?:\=[^\]]*)?\]\s*\[\/\1\]/', '', $text)) !== NULL) | 147: while (!is_null($new_text = preg_replace('%\[(b|u|s|ins|del|em|i|h|colou?r|quote|img|url|email|list|topic|post|forum|user)(?:\=[^\]]*)?\]\s*\[/\1\]%', '', $text))) |
154: { | 148: { |
155: if ($new_text != $text) | 149: if ($new_text != $text) |
156: $text = $new_text; | 150: $text = $new_text; |
161: // If we split up the message before we have to concatenate it together again (code tags) | 155: // If we split up the message before we have to concatenate it together again (code tags) |
162: if (isset($inside)) | 156: if (isset($inside)) |
163: { | 157: { |
164: $outside = explode("\1", $text); | 158: $parts = explode("\1", $text); |
165: $text = ''; | 159: $text = ''; |
166: | 160: foreach ($parts as $i => $part) |
167: $num_tokens = count($outside); | |
168: for ($i = 0; $i < $num_tokens; ++$i) | |
169: { | 161: { |
170: $text .= $outside[$i]; | 162: $text .= $part; |
171: if (isset($inside[$i])) | 163: if (isset($inside[$i])) |
172: $text .= '[code]'.$inside[$i].'[/code]'; | 164: $text .= '[code]'.$inside[$i].'[/code]'; |
173: } | 165: } |
174: } | 166: } |
175: | 167: |
176: // Remove empty code tags | 168: // Remove empty code tags |
177: while (($new_text = preg_replace('/\[(code)\]\s*\[\/\1\]/', '', $text)) !== NULL) | 169: while (!is_null($new_text = preg_replace('%\[(code)\]\s*\[/\1\]%', '', $text))) |
178: { | 170: { |
179: if ($new_text != $text) | 171: if ($new_text != $text) |
180: $text = $new_text; | 172: $text = $new_text; |
196: // Start off by making some arrays of bbcode tags and what we need to do with each one | 188: // Start off by making some arrays of bbcode tags and what we need to do with each one |
197: | 189: |
198: // List of all the tags | 190: // List of all the tags |
199: $tags = array('quote', 'code', 'b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'img', 'list', '*', 'h'); | 191: $tags = array('quote', 'code', 'b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'img', 'list', '*', 'h', 'topic', 'post', 'forum', 'user'); |
200: // List of tags that we need to check are open (You could not put b,i,u in here then illegal nesting like [b][i][/b][/i] would be allowed) | 192: // List of tags that we need to check are open (You could not put b,i,u in here then illegal nesting like [b][i][/b][/i] would be allowed) |
201: $tags_opened = $tags; | 193: $tags_opened = $tags; |
202: // and tags we need to check are closed (the same as above, added it just in case) | 194: // and tags we need to check are closed (the same as above, added it just in case) |
208: // Block tags, block tags can only go within another block tag, they cannot be in a normal tag | 200: // Block tags, block tags can only go within another block tag, they cannot be in a normal tag |
209: $tags_block = array('quote', 'code', 'list', 'h', '*'); | 201: $tags_block = array('quote', 'code', 'list', 'h', '*'); |
210: // Inline tags, we do not allow new lines in these | 202: // Inline tags, we do not allow new lines in these |
211: $tags_inline = array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'h'); | 203: $tags_inline = array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'h', 'topic', 'post', 'forum', 'user'); |
212: // Tags we trim interior space | 204: // Tags we trim interior space |
213: $tags_trim = array('img'); | 205: $tags_trim = array('img'); |
214: // Tags we remove quotes from the argument | 206: // Tags we remove quotes from the argument |
215: $tags_quotes = array('url', 'email', 'img'); | 207: $tags_quotes = array('url', 'email', 'img', 'topic', 'post', 'forum', 'user'); |
216: // Tags we limit bbcode in | 208: // Tags we limit bbcode in |
217: $tags_limit_bbcode = array( | 209: $tags_limit_bbcode = array( |
218: '*' => array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'list', 'img', 'code'), | 210: '*' => array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'list', 'img', 'code', 'topic', 'post', 'forum', 'user'), |
219: 'list' => array('*'), | 211: 'list' => array('*'), |
220: 'url' => array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'img'), | 212: 'url' => array('img'), |
221: 'email' => array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'img'), | 213: 'email' => array('img'), |
| 214: 'topic' => array('img'), |
| 215: 'post' => array('img'), |
| 216: 'forum' => array('img'), |
| 217: 'user' => array('img'), |
222: 'img' => array(), | 218: 'img' => array(), |
223: 'h' => array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email'), | 219: 'h' => array('b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'topic', 'post', 'forum', 'user'), |
224: ); | 220: ); |
225: // Tags we can automatically fix bad nesting | 221: // Tags we can automatically fix bad nesting |
226: $tags_fix = array('quote', 'b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'h'); | 222: $tags_fix = array('quote', 'b', 'i', 'u', 's', 'ins', 'del', 'em', 'color', 'colour', 'url', 'email', 'h', 'topic', 'post', 'forum', 'user'); |
227: | 223: |
228: $split_text = preg_split("/(\[[\*a-zA-Z0-9-\/]*?(?:=.*?)?\])/", $text, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); | 224: $split_text = preg_split('%(\[[\*a-zA-Z0-9-/]*?(?:=.*?)?\])%', $text, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); |
229: | 225: |
230: $open_tags = array('post'); | 226: $open_tags = array('fluxbb-bbcode'); |
231: $open_args = array(''); | 227: $open_args = array(''); |
232: $opened_tag = 0; | 228: $opened_tag = 0; |
233: $new_text = ''; | 229: $new_text = ''; |
235: $current_nest = ''; | 231: $current_nest = ''; |
236: $current_depth = array(); | 232: $current_depth = array(); |
237: $limit_bbcode = $tags; | 233: $limit_bbcode = $tags; |
| 234: $count_ignored = array(); |
238: | 235: |
239: foreach ($split_text as $current) | 236: foreach ($split_text as $current) |
240: { | 237: { |
245: if (substr($current, 0, 1) != '[' || substr($current, -1, 1) != ']') | 242: if (substr($current, 0, 1) != '[' || substr($current, -1, 1) != ']') |
246: { | 243: { |
247: // It's not a bbcode tag so we put it on the end and continue | 244: // It's not a bbcode tag so we put it on the end and continue |
248: | |
249: // If we are nested too deeply don't add to the end | 245: // If we are nested too deeply don't add to the end |
250: if ($current_nest) | 246: if ($current_nest) |
251: continue; | 247: continue; |
255: if (in_array($open_tags[$opened_tag], $tags_inline) && strpos($current, "\n") !== false) | 251: if (in_array($open_tags[$opened_tag], $tags_inline) && strpos($current, "\n") !== false) |
256: { | 252: { |
257: // Deal with new lines | 253: // Deal with new lines |
258: $split_current = preg_split("/(\n\n+)/", $current, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); | 254: $split_current = preg_split('%(\n\n+)%', $current, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); |
259: $current = ''; | 255: $current = ''; |
260: | 256: |
261: if (!pun_trim($split_current[0], "\n")) // The first part is a linebreak so we need to handle any open tags first | 257: if (!pun_trim($split_current[0], "\n")) // The first part is a linebreak so we need to handle any open tags first |
357: $current = strtolower($current); | 353: $current = strtolower($current); |
358: | 354: |
359: // This is if we are currently in a tag which escapes other bbcode such as code | 355: // This is if we are currently in a tag which escapes other bbcode such as code |
| 356: // We keep a count of ignored bbcodes (code tags) so we can nest them, but |
| 357: // only balanced sets of tags can be nested |
360: if ($current_ignore) | 358: if ($current_ignore) |
361: { | 359: { |
| 360: // Increase the current ignored tags counter |
| 361: if ('['.$current_ignore.']' == $current) |
| 362: $count_ignored[$current_tag]++; |
| 363: |
| 364: // Decrease the current ignored tags counter |
362: if ('[/'.$current_ignore.']' == $current) | 365: if ('[/'.$current_ignore.']' == $current) |
| 366: $count_ignored[$current_tag]--; |
| 367: |
| 368: if ('[/'.$current_ignore.']' == $current && $count_ignored[$current_tag] == 0) |
363: { | 369: { |
364: // We've finished the ignored section | 370: // We've finished the ignored section |
365: $current = '[/'.$current_tag.']'; | 371: $current = '[/'.$current_tag.']'; |
366: $current_ignore = ''; | 372: $current_ignore = ''; |
| 373: $count_ignored = array(); |
367: } | 374: } |
368: | 375: |
369: $new_text .= $current; | 376: $new_text .= $current; |
398: if (substr($current, 1, 1) == '/') | 405: if (substr($current, 1, 1) == '/') |
399: { | 406: { |
400: // This is if we are closing a tag | 407: // This is if we are closing a tag |
401: | |
402: if ($opened_tag == 0 || !in_array($current_tag, $open_tags)) | 408: if ($opened_tag == 0 || !in_array($current_tag, $open_tags)) |
403: { | 409: { |
404: // We tried to close a tag which is not open | 410: // We tried to close a tag which is not open |
521: { | 527: { |
522: // It's an ignore tag so we don't need to worry about what's inside it | 528: // It's an ignore tag so we don't need to worry about what's inside it |
523: $current_ignore = $current_tag; | 529: $current_ignore = $current_tag; |
| 530: $count_ignored[$current_tag] = 1; |
524: $new_text .= $current; | 531: $new_text .= $current; |
525: continue; | 532: continue; |
526: } | 533: } |
552: // Remove quotes from arguments for certain tags | 559: // Remove quotes from arguments for certain tags |
553: if (strpos($current, '=') !== false && in_array($current_tag, $tags_quotes)) | 560: if (strpos($current, '=') !== false && in_array($current_tag, $tags_quotes)) |
554: { | 561: { |
555: $current = preg_replace('#\['.$current_tag.'=("|\'|)(.*?)\\1\]\s*#i', '['.$current_tag.'=$2]', $current); | 562: $current = preg_replace('%\['.$current_tag.'=("|\'|)(.*?)\\1\]\s*%i', '['.$current_tag.'=$2]', $current); |
556: } | 563: } |
557: | 564: |
558: if (in_array($current_tag, array_keys($tags_limit_bbcode))) | 565: if (in_array($current_tag, array_keys($tags_limit_bbcode))) |
591: // | 598: // |
592: // Preparse the contents of [list] bbcode | 599: // Preparse the contents of [list] bbcode |
593: // | 600: // |
594: function preparse_list_tag($content, $type = '*', &$errors) | 601: function preparse_list_tag($content, $type = '*') |
595: { | 602: { |
596: global $lang_common, $re_list; | 603: global $lang_common, $re_list; |
597: | 604: |
600: | 607: |
601: if (strpos($content,'[list') !== false) | 608: if (strpos($content,'[list') !== false) |
602: { | 609: { |
603: $content = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\', $errors)', $content); | 610: $content = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\')', $content); |
604: } | 611: } |
605: | 612: |
606: $items = explode('[*]', str_replace('\"', '"', $content)); | 613: $items = explode('[*]', str_replace('\"', '"', $content)); |
622: function handle_url_tag($url, $link = '', $bbcode = false) | 629: function handle_url_tag($url, $link = '', $bbcode = false) |
623: { | 630: { |
624: $url = pun_trim($url); | 631: $url = pun_trim($url); |
| 632: |
| 633: // Deal with [url][img]http://example.com/test.png[/img][/url] |
| 634: if (preg_match('%<img src=\\\\"(.*?)\\\\"%', $url, $matches)) |
| 635: return handle_url_tag($matches[1], $url, $bbcode); |
| 636: |
625: $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url); | 637: $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url); |
626: if (strpos($url, 'www.') === 0) // If it starts with www, we add http:// | 638: if (strpos($url, 'www.') === 0) // If it starts with www, we add http:// |
627: $full_url = 'http://'.$full_url; | 639: $full_url = 'http://'.$full_url; |
628: else if (strpos($url, 'ftp.') === 0) // Else if it starts with ftp, we add ftp:// | 640: else if (strpos($url, 'ftp.') === 0) // Else if it starts with ftp, we add ftp:// |
629: $full_url = 'ftp://'.$full_url; | 641: $full_url = 'ftp://'.$full_url; |
| 642: else if (strpos($url, '/') === 0) // Allow for relative URLs that start with a slash |
| 643: $full_url = get_base_url(true).$full_url; |
630: else if (!preg_match('#^([a-z0-9]{3,6})://#', $url)) // Else if it doesn't start with abcdef://, we add http:// | 644: else if (!preg_match('#^([a-z0-9]{3,6})://#', $url)) // Else if it doesn't start with abcdef://, we add http:// |
631: $full_url = 'http://'.$full_url; | 645: $full_url = 'http://'.$full_url; |
632: | 646: |
661: { | 675: { |
662: global $lang_common, $pun_user; | 676: global $lang_common, $pun_user; |
663: | 677: |
664: if ($alt == null) | 678: if (is_null($alt)) |
665: $alt = basename($url); | 679: $alt = basename($url); |
666: | 680: |
667: $img_tag = '<a href="'.$url.'"><'.$lang_common['Image link'].' - '.$alt.'></a>'; | 681: $img_tag = '<a href="'.$url.'"><'.$lang_common['Image link'].' - '.$alt.'></a>'; |
713: | 727: |
714: if (strpos($text, '[quote') !== false) | 728: if (strpos($text, '[quote') !== false) |
715: { | 729: { |
716: $text = preg_replace('#\[quote\]\s*#', '</p><div class="quotebox"><blockquote><div><p>', $text); | 730: $text = preg_replace('%\[quote\]\s*%', '</p><div class="quotebox"><blockquote><div><p>', $text); |
717: $text = preg_replace('#\[quote=("|&\#039;|"|\'|)(.*?)\\1\]#se', '"</p><div class=\"quotebox\"><cite>".str_replace(array(\'[\', \'\\"\'), array(\'[\', \'"\'), \'$2\')." ".$lang_common[\'wrote\']."</cite><blockquote><div><p>"', $text); | 731: $text = preg_replace('%\[quote=("|&\#039;|"|\'|)(.*?)\\1\]%se', '"</p><div class=\"quotebox\"><cite>".str_replace(array(\'[\', \'\\"\'), array(\'[\', \'"\'), \'$2\')." ".$lang_common[\'wrote\']."</cite><blockquote><div><p>"', $text); |
718: $text = preg_replace('#\s*\[\/quote\]#S', '</p></div></blockquote></div><p>', $text); | 732: $text = preg_replace('%\s*\[\/quote\]%S', '</p></div></blockquote></div><p>', $text); |
719: } | 733: } |
720: | 734: |
721: if (!$is_signature) | 735: if (!$is_signature) |
724: $replace[] = 'handle_list_tag(\'$2\', \'$1\')'; | 738: $replace[] = 'handle_list_tag(\'$2\', \'$1\')'; |
725: } | 739: } |
726: | 740: |
727: $pattern[] = '#\[b\](.*?)\[/b\]#ms'; | 741: $pattern[] = '%\[b\](.*?)\[/b\]%ms'; |
728: $pattern[] = '#\[i\](.*?)\[/i\]#ms'; | 742: $pattern[] = '%\[i\](.*?)\[/i\]%ms'; |
729: $pattern[] = '#\[u\](.*?)\[/u\]#ms'; | 743: $pattern[] = '%\[u\](.*?)\[/u\]%ms'; |
730: $pattern[] = '#\[s\](.*?)\[/s\]#ms'; | 744: $pattern[] = '%\[s\](.*?)\[/s\]%ms'; |
731: $pattern[] = '#\[del\](.*?)\[/del\]#ms'; | 745: $pattern[] = '%\[del\](.*?)\[/del\]%ms'; |
732: $pattern[] = '#\[ins\](.*?)\[/ins\]#ms'; | 746: $pattern[] = '%\[ins\](.*?)\[/ins\]%ms'; |
733: $pattern[] = '#\[em\](.*?)\[/em\]#ms'; | 747: $pattern[] = '%\[em\](.*?)\[/em\]%ms'; |
734: $pattern[] = '#\[colou?r=([a-zA-Z]{3,20}|\#[0-9a-fA-F]{6}|\#[0-9a-fA-F]{3})](.*?)\[/colou?r\]#ms'; | 748: $pattern[] = '%\[colou?r=([a-zA-Z]{3,20}|\#[0-9a-fA-F]{6}|\#[0-9a-fA-F]{3})](.*?)\[/colou?r\]%ms'; |
735: $pattern[] = '#\[h\](.*?)\[/h\]#ms'; | 749: $pattern[] = '%\[h\](.*?)\[/h\]%ms'; |
736: | 750: |
737: $replace[] = '<strong>$1</strong>'; | 751: $replace[] = '<strong>$1</strong>'; |
738: $replace[] = '<em>$1</em>'; | 752: $replace[] = '<em>$1</em>'; |
746: | 760: |
747: if (($is_signature && $pun_config['p_sig_img_tag'] == '1') || (!$is_signature && $pun_config['p_message_img_tag'] == '1')) | 761: if (($is_signature && $pun_config['p_sig_img_tag'] == '1') || (!$is_signature && $pun_config['p_message_img_tag'] == '1')) |
748: { | 762: { |
749: $pattern[] = '#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e'; | 763: $pattern[] = '%\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%e'; |
750: $pattern[] = '#\[img=([^\[]*?)\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e'; | 764: $pattern[] = '%\[img=([^\[]*?)\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%e'; |
751: if ($is_signature) | 765: if ($is_signature) |
752: { | 766: { |
753: $replace[] = 'handle_img_tag(\'$1$3\', true)'; | 767: $replace[] = 'handle_img_tag(\'$1$3\', true)'; |
760: } | 774: } |
761: } | 775: } |
762: | 776: |
763: $pattern[] = '#\[url\]([^\[]*?)\[/url\]#e'; | 777: $pattern[] = '%\[url\]([^\[]*?)\[/url\]%e'; |
764: $pattern[] = '#\[url=([^\[]+?)\](.*?)\[/url\]#e'; | 778: $pattern[] = '%\[url=([^\[]+?)\](.*?)\[/url\]%e'; |
765: $pattern[] = '#\[email\]([^\[]*?)\[/email\]#'; | 779: $pattern[] = '%\[email\]([^\[]*?)\[/email\]%'; |
766: $pattern[] = '#\[email=([^\[]+?)\](.*?)\[/email\]#'; | 780: $pattern[] = '%\[email=([^\[]+?)\](.*?)\[/email\]%'; |
| 781: $pattern[] = '%\[topic\]([1-9]\d*)\[/topic\]%e'; |
| 782: $pattern[] = '%\[topic=([1-9]\d*)\](.*?)\[/topic\]%e'; |
| 783: $pattern[] = '%\[post\]([1-9]\d*)\[/post\]%e'; |
| 784: $pattern[] = '%\[post=([1-9]\d*)\](.*?)\[/post\]%e'; |
| 785: $pattern[] = '%\[forum\]([1-9]\d*)\[/forum\]%e'; |
| 786: $pattern[] = '%\[forum=([1-9]\d*)\](.*?)\[/forum\]%e'; |
| 787: $pattern[] = '%\[user\]([1-9]\d*)\[/user\]%e'; |
| 788: $pattern[] = '%\[user=([1-9]\d*)\](.*?)\[/user\]%e'; |
767: | 789: |
768: $replace[] = 'handle_url_tag(\'$1\')'; | 790: $replace[] = 'handle_url_tag(\'$1\')'; |
769: $replace[] = 'handle_url_tag(\'$1\', \'$2\')'; | 791: $replace[] = 'handle_url_tag(\'$1\', \'$2\')'; |
770: $replace[] = '<a href="mailto:$1">$1</a>'; | 792: $replace[] = '<a href="mailto:$1">$1</a>'; |
771: $replace[] = '<a href="mailto:$1">$2</a>'; | 793: $replace[] = '<a href="mailto:$1">$2</a>'; |
| 794: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=$1\')'; |
| 795: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=$1\', \'$2\')'; |
| 796: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?pid=$1#p$1\')'; |
| 797: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?pid=$1#p$1\', \'$2\')'; |
| 798: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewforum.php?id=$1\')'; |
| 799: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewforum.php?id=$1\', \'$2\')'; |
| 800: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/profile.php?id=$1\')'; |
| 801: $replace[] = 'handle_url_tag(\''.get_base_url(true).'/profile.php?id=$1\', \'$2\')'; |
772: | 802: |
773: // This thing takes a while! :) | 803: // This thing takes a while! :) |
774: $text = preg_replace($pattern, $replace, $text); | 804: $text = preg_replace($pattern, $replace, $text); |
784: { | 814: { |
785: $text = ' '.$text; | 815: $text = ' '.$text; |
786: | 816: |
787: $text = ucp_preg_replace('#(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(https?|ftp|news){1}://([\p{L}\p{N}\-]+\.([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-])?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])#uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5://$6\', \'$5://$6\', true).stripslashes(\'$4$10$11$12\')', $text); | 817: $text = ucp_preg_replace('%(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(https?|ftp|news){1}://([\p{L}\p{N}\-]+\.([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/(?:[^\s\[]*[^\s.,?!\[;:-])?)?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])%uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5://$6\', \'$5://$6\', true).stripslashes(\'$4$10$11$12\')', $text); |
788: $text = ucp_preg_replace('#(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(www|ftp)\.(([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-])?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])#uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5.$6\', \'$5.$6\', true).stripslashes(\'$4$10$11$12\')', $text); | 818: $text = ucp_preg_replace('%(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(www|ftp)\.(([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/(?:[^\s\[]*[^\s.,?!\[;:-])?)?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])%uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5.$6\', \'$5.$6\', true).stripslashes(\'$4$10$11$12\')', $text); |
789: | 819: |
790: return substr($text, 1); | 820: return substr($text, 1); |
791: } | 821: } |
803: foreach ($smilies as $smiley_text => $smiley_img) | 833: foreach ($smilies as $smiley_text => $smiley_img) |
804: { | 834: { |
805: if (strpos($text, $smiley_text) !== false) | 835: if (strpos($text, $smiley_text) !== false) |
806: $text = ucp_preg_replace('#(?<=[>\s])'.preg_quote($smiley_text, '#').'(?=[^\p{L}\p{N}])#um', '<img src="'.pun_htmlspecialchars(get_base_url(true).'/img/smilies/'.$smiley_img).'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text); | 836: $text = ucp_preg_replace('%(?<=[>\s])'.preg_quote($smiley_text, '%').'(?=[^\p{L}\p{N}])%um', '<img src="'.pun_htmlspecialchars(get_base_url(true).'/img/smilies/'.$smiley_img).'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text); |
807: } | 837: } |
808: | 838: |
809: return substr($text, 1, -1); | 839: return substr($text, 1, -1); |
825: | 855: |
826: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) | 856: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) |
827: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 857: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
828: { | 858: list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); |
829: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); | |
830: $text = implode("\1", $outside); | |
831: } | |
832: | 859: |
833: if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) | 860: if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) |
834: $text = do_bbcode($text); | 861: $text = do_bbcode($text); |
844: // If we split up the message before we have to concatenate it together again (code tags) | 871: // If we split up the message before we have to concatenate it together again (code tags) |
845: if (isset($inside)) | 872: if (isset($inside)) |
846: { | 873: { |
847: $outside = explode("\1", $text); | 874: $parts = explode("\1", $text); |
848: $text = ''; | 875: $text = ''; |
849: | 876: foreach ($parts as $i => $part) |
850: $num_tokens = count($outside); | |
851: | |
852: for ($i = 0; $i < $num_tokens; ++$i) | |
853: { | 877: { |
854: $text .= $outside[$i]; | 878: $text .= $part; |
855: if (isset($inside[$i])) | 879: if (isset($inside[$i])) |
856: // $text .= '</p><div class="codebox"><pre><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; | |
857: { | 880: { |
858: $num_lines = (substr_count($inside[$i], "\n")); | 881: $num_lines = (substr_count($inside[$i], "\n")); |
859: $text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; | 882: $text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; |
861: } | 884: } |
862: } | 885: } |
863: | 886: |
| 887: return clean_paragraphs($text); |
| 888: } |
| 889: |
| 890: |
| 891: // |
| 892: // Clean up paragraphs and line breaks |
| 893: // |
| 894: function clean_paragraphs($text) |
| 895: { |
864: // Add paragraph tag around post, but make sure there are no empty paragraphs | 896: // Add paragraph tag around post, but make sure there are no empty paragraphs |
865: $text = preg_replace('#<br />\s*?<br />((\s*<br />)*)#i', "</p>$1<p>", $text); | 897: |
866: $text = str_replace('<p><br />', '<p>', $text); | 898: $text = '<p>'.$text.'</p>'; |
867: $text = str_replace('<p></p>', '', '<p>'.$text.'</p>'); | 899: |
| 900: // Replace any breaks next to paragraphs so our replace below catches them |
| 901: $text = preg_replace('%(</?p>)(?:\s*?<br />){1,2}%i', '$1', $text); |
| 902: $text = preg_replace('%(?:<br />\s*?){1,2}(</?p>)%i', '$1', $text); |
| 903: |
| 904: // Remove any empty paragraph tags (inserted via quotes/lists/code/etc) which should be stripped |
| 905: $text = str_replace('<p></p>', '', $text); |
| 906: |
| 907: $text = preg_replace('%<br />\s*?<br />%i', '</p><p>', $text); |
| 908: |
| 909: $text = str_replace('<p><br />', '<br /><p>', $text); |
| 910: $text = str_replace('<br /></p>', '</p><br />', $text); |
| 911: $text = str_replace('<p></p>', '<br /><br />', $text); |
868: | 912: |
869: return $text; | 913: return $text; |
870: } | 914: } |
895: $replace = array('<br />', '    ', '  ', '  '); | 939: $replace = array('<br />', '    ', '  ', '  '); |
896: $text = str_replace($pattern, $replace, $text); | 940: $text = str_replace($pattern, $replace, $text); |
897: | 941: |
898: // Add paragraph tag around post, but make sure there are no empty paragraphs | 942: return clean_paragraphs($text); |
899: $text = preg_replace('#<br />\s*?<br />((\s*<br />)*)#i', "</p>$1<p>", $text); | |
900: $text = str_replace('<p><br />', '<p>', $text); | |
901: $text = str_replace('<p></p>', '', '<p>'.$text.'</p>'); | |
902: | |
903: return $text; | |
904: } | 943: } |
a/install.php |
b/install.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 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 installs | 9: // The FluxBB version this script installs |
10: define('FORUM_VERSION', '1.4.5'); | 10: define('FORUM_VERSION', '1.4.9'); |
11: | 11: |
12: define('FORUM_DB_REVISION', 11); | 12: define('FORUM_DB_REVISION', 15); |
13: define('FORUM_SI_REVISION', 2); | 13: define('FORUM_SI_REVISION', 2); |
14: define('FORUM_PARSER_REVISION', 2); | 14: define('FORUM_PARSER_REVISION', 2); |
15: | 15: |
22: | 22: |
23: define('PUN_ROOT', dirname(__FILE__).'/'); | 23: define('PUN_ROOT', dirname(__FILE__).'/'); |
24: | 24: |
25: // If we've been passed a default language, use it | |
26: $install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English'; | |
27: | |
28: // If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English | |
29: if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php')) | |
30: $install_lang = 'English'; | |
31: | |
32: require PUN_ROOT.'lang/'.$install_lang.'/install.php'; | |
33: | |
34: if (file_exists(PUN_ROOT.'config.php')) | |
35: { | |
36: // Check to see whether FluxBB is already installed | |
37: include PUN_ROOT.'config.php'; | |
38: | |
39: // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message | |
40: if (defined('FORUM')) | |
41: define('PUN', FORUM); | |
42: | |
43: // If PUN is defined, config.php is probably valid and thus the software is installed | |
44: if (defined('PUN')) | |
45: exit($lang_install['Already installed']); | |
46: } | |
47: | |
48: // Define PUN because email.php requires it | |
49: define('PUN', 1); | |
50: | |
51: // If the cache directory is not specified, we use the default setting | |
52: if (!defined('FORUM_CACHE_DIR')) | |
53: define('FORUM_CACHE_DIR', PUN_ROOT.'cache/'); | |
54: | |
55: // Make sure we are running at least MIN_PHP_VERSION | |
56: if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) | |
57: exit(sprintf($lang_install['You are running error'], 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION)); | |
58: | |
59: // Load the functions script | 25: // Load the functions script |
60: require PUN_ROOT.'include/functions.php'; | 26: require PUN_ROOT.'include/functions.php'; |
61: | 27: |
95: // Turn off PHP time limit | 61: // Turn off PHP time limit |
96: @set_time_limit(0); | 62: @set_time_limit(0); |
97: | 63: |
| 64: |
| 65: // If we've been passed a default language, use it |
| 66: $install_lang = isset($_REQUEST['install_lang']) ? pun_trim($_REQUEST['install_lang']) : 'English'; |
| 67: |
| 68: // If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English |
| 69: if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php')) |
| 70: $install_lang = 'English'; |
| 71: |
| 72: require PUN_ROOT.'lang/'.$install_lang.'/install.php'; |
| 73: |
| 74: if (file_exists(PUN_ROOT.'config.php')) |
| 75: { |
| 76: // Check to see whether FluxBB is already installed |
| 77: include PUN_ROOT.'config.php'; |
| 78: |
| 79: // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message |
| 80: if (defined('FORUM')) |
| 81: define('PUN', FORUM); |
| 82: |
| 83: // If PUN is defined, config.php is probably valid and thus the software is installed |
| 84: if (defined('PUN')) |
| 85: exit($lang_install['Already installed']); |
| 86: } |
| 87: |
| 88: // Define PUN because email.php requires it |
| 89: define('PUN', 1); |
| 90: |
| 91: // If the cache directory is not specified, we use the default setting |
| 92: if (!defined('FORUM_CACHE_DIR')) |
| 93: define('FORUM_CACHE_DIR', PUN_ROOT.'cache/'); |
| 94: |
| 95: // Make sure we are running at least MIN_PHP_VERSION |
| 96: if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) |
| 97: exit(sprintf($lang_install['You are running error'], 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION)); |
| 98: |
| 99: |
98: // | 100: // |
99: // Generate output to be used for config.php | 101: // Generate output to be used for config.php |
100: // | 102: // |
129: { | 131: { |
130: // Make an educated guess regarding base_url | 132: // Make an educated guess regarding base_url |
131: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol | 133: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol |
132: $base_url .= preg_replace('/:(80|443)$/', '', $_SERVER['HTTP_HOST']); // host[:port] | 134: $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port] |
133: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path | 135: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path |
134: | 136: |
135: if (substr($base_url, -1) == '/') | 137: if (substr($base_url, -1) == '/') |
172: $alerts[] = $lang_install['Username 2']; | 174: $alerts[] = $lang_install['Username 2']; |
173: else if (!strcasecmp($username, 'Guest')) | 175: else if (!strcasecmp($username, 'Guest')) |
174: $alerts[] = $lang_install['Username 3']; | 176: $alerts[] = $lang_install['Username 3']; |
175: 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)) | 177: 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)) |
176: $alerts[] = $lang_install['Username 4']; | 178: $alerts[] = $lang_install['Username 4']; |
177: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) | 179: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
178: $alerts[] = $lang_install['Username 5']; | 180: $alerts[] = $lang_install['Username 5']; |
179: else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $username)) | 181: else if (preg_match('%(?:\[/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)%i', $username)) |
180: $alerts[] = $lang_install['Username 6']; | 182: $alerts[] = $lang_install['Username 6']; |
181: | 183: |
182: if (pun_strlen($password1) < 4) | 184: if (pun_strlen($password1) < 4) |
203: } | 205: } |
204: | 206: |
205: // Check if the cache directory is writable | 207: // Check if the cache directory is writable |
206: if (!@is_writable(FORUM_CACHE_DIR)) | 208: if (!forum_is_writable(FORUM_CACHE_DIR)) |
207: $alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR); | 209: $alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR); |
208: | 210: |
209: // Check if default avatar directory is writable | 211: // Check if default avatar directory is writable |
210: if (!@is_writable(PUN_ROOT.'img/avatars/')) | 212: if (!forum_is_writable(PUN_ROOT.'img/avatars/')) |
211: $alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/'); | 213: $alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/'); |
212: | 214: |
213: if (!isset($_POST['form_sent']) || !empty($alerts)) | 215: if (!isset($_POST['form_sent']) || !empty($alerts)) |
253: /* <![CDATA[ */ | 255: /* <![CDATA[ */ |
254: function process_form(the_form) | 256: function process_form(the_form) |
255: { | 257: { |
256: var element_names = { | 258: var required_fields = { |
257: "req_db_type": "<?php echo $lang_install['Database type'] ?>", | 259: "req_db_type": "<?php echo $lang_install['Database type'] ?>", |
258: "req_db_host": "<?php echo $lang_install['Database server hostname'] ?>", | 260: "req_db_host": "<?php echo $lang_install['Database server hostname'] ?>", |
259: "req_db_name": "<?php echo $lang_install['Database name'] ?>", | 261: "req_db_name": "<?php echo $lang_install['Database name'] ?>", |
260: "db_prefix": "<?php echo $lang_install['Table prefix'] ?>", | |
261: "req_username": "<?php echo $lang_install['Administrator username'] ?>", | 262: "req_username": "<?php echo $lang_install['Administrator username'] ?>", |
262: "req_password1": "<?php echo $lang_install['Administrator password 1'] ?>", | 263: "req_password1": "<?php echo $lang_install['Administrator password 1'] ?>", |
263: "req_password2": "<?php echo $lang_install['Administrator password 2'] ?>", | 264: "req_password2": "<?php echo $lang_install['Administrator password 2'] ?>", |
270: for (var i = 0; i < the_form.length; ++i) | 271: for (var i = 0; i < the_form.length; ++i) |
271: { | 272: { |
272: var elem = the_form.elements[i]; | 273: var elem = the_form.elements[i]; |
273: if (elem.name && (/^req_/.test(elem.name))) | 274: if (elem.name && required_fields[elem.name] && !elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) |
274: { | 275: { |
275: if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) | 276: alert('"' + required_fields[elem.name] + '" <?php echo $lang_install['Required field'] ?>'); |
276: { | 277: elem.focus(); |
277: alert('"' + element_names[elem.name] + '" <?php echo $lang_install['Required field'] ?>'); | 278: return false; |
278: elem.focus(); | |
279: return false; | |
280: } | |
281: } | 279: } |
282: } | 280: } |
283: } | 281: } |
286: /* ]]> */ | 284: /* ]]> */ |
287: </script> | 285: </script> |
288: </head> | 286: </head> |
289: <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;"> | 287: <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;" onunload=""> |
290: | 288: |
291: <div id="puninstall" class="pun"> | 289: <div id="puninstall" class="pun"> |
292: <div class="top-box"><div><!-- Top Corners --></div></div> | 290: <div class="top-box"><div><!-- Top Corners --></div></div> |
336: <?php endif; ?> | 334: <?php endif; ?> |
337: | 335: |
338: <div class="blockform"> | 336: <div class="blockform"> |
339: <h2><span><?php echo $lang_install['Install'] ?></span></h2> | 337: <h2><span><?php echo sprintf($lang_install['Install'], FORUM_VERSION) ?></span></h2> |
340: <div class="box"> | 338: <div class="box"> |
341: <form id="install" method="post" action="install.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}"> | 339: <form id="install" method="post" action="install.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}"> |
342: <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div> | 340: <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div> |
579: $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false); | 577: $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false); |
580: | 578: |
581: // Validate prefix | 579: // Validate prefix |
582: if (strlen($db_prefix) > 0 && (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $db_prefix) || strlen($db_prefix) > 40)) | 580: if (strlen($db_prefix) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $db_prefix) || strlen($db_prefix) > 40)) |
583: error(sprintf($lang_install['Table prefix error'], $db->prefix)); | 581: error(sprintf($lang_install['Table prefix error'], $db->prefix)); |
584: | 582: |
585: // Do some DB type specific checks | 583: // Do some DB type specific checks |
945: 'datatype' => 'SMALLINT(6)', | 943: 'datatype' => 'SMALLINT(6)', |
946: 'allow_null' => false, | 944: 'allow_null' => false, |
947: 'default' => '60' | 945: 'default' => '60' |
| 946: ), |
| 947: 'g_report_flood' => array( |
| 948: 'datatype' => 'SMALLINT(6)', |
| 949: 'allow_null' => false, |
| 950: 'default' => '60' |
948: ) | 951: ) |
949: ), | 952: ), |
950: 'PRIMARY KEY' => array('g_id') | 953: 'PRIMARY KEY' => array('g_id') |
990: 'INDEXES' => array( | 993: 'INDEXES' => array( |
991: 'ident_idx' => array('ident'), | 994: 'ident_idx' => array('ident'), |
992: 'logged_idx' => array('logged') | 995: 'logged_idx' => array('logged') |
993: ), | 996: ) |
994: 'ENGINE' => 'HEAP' | |
995: ); | 997: ); |
996: | 998: |
997: if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') | 999: if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
1485: 'language' => array( | 1487: 'language' => array( |
1486: 'datatype' => 'VARCHAR(25)', | 1488: 'datatype' => 'VARCHAR(25)', |
1487: 'allow_null' => false, | 1489: 'allow_null' => false, |
1488: 'default' => '\'English\'' | 1490: 'default' => '\''.$db->escape($default_lang).'\'' |
1489: ), | 1491: ), |
1490: 'style' => array( | 1492: 'style' => array( |
1491: 'datatype' => 'VARCHAR(25)', | 1493: 'datatype' => 'VARCHAR(25)', |
1509: 'datatype' => 'INT(10) UNSIGNED', | 1511: 'datatype' => 'INT(10) UNSIGNED', |
1510: 'allow_null' => true | 1512: 'allow_null' => true |
1511: ), | 1513: ), |
| 1514: 'last_report_sent' => array( |
| 1515: 'datatype' => 'INT(10) UNSIGNED', |
| 1516: 'allow_null' => true |
| 1517: ), |
1512: 'registered' => array( | 1518: 'registered' => array( |
1513: 'datatype' => 'INT(10) UNSIGNED', | 1519: 'datatype' => 'INT(10) UNSIGNED', |
1514: 'allow_null' => false, | 1520: 'allow_null' => false, |
1555: $now = time(); | 1561: $now = time(); |
1556: | 1562: |
1557: // Insert the four preset groups | 1563: // Insert the four preset groups |
1558: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('.($db_type != 'pgsql' ? '1, ' : '').'\''.$db->escape($lang_install['Administrators']).'\', \''.$db->escape($lang_install['Administrator']).'\', 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)') or error('Unable to add group', __FILE__, __LINE__, $db->error()); | 1564: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '1, ' : '').'\''.$db->escape($lang_install['Administrators']).'\', \''.$db->escape($lang_install['Administrator']).'\', 0, 0, 0, 0, 0, 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()); |
1559: | 1565: |
1560: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('.($db_type != 'pgsql' ? '2, ' : '').'\''.$db->escape($lang_install['Moderators']).'\', \''.$db->escape($lang_install['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()); | 1566: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '2, ' : '').'\''.$db->escape($lang_install['Moderators']).'\', \''.$db->escape($lang_install['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()); |
1561: | 1567: |
1562: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('.($db_type != 'pgsql' ? '3, ' : '').'\''.$db->escape($lang_install['Guests']).'\', NULL, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 60, 30, 0)') or error('Unable to add group', __FILE__, __LINE__, $db->error()); | 1568: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '3, ' : '').'\''.$db->escape($lang_install['Guests']).'\', NULL, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 60, 30, 0, 0)') or error('Unable to add group', __FILE__, __LINE__, $db->error()); |
1563: | 1569: |
1564: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('.($db_type != 'pgsql' ? '4, ' : '').'\''.$db->escape($lang_install['Members']).'\', NULL, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60)') or error('Unable to add group', __FILE__, __LINE__, $db->error()); | 1570: $db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '4, ' : '').'\''.$db->escape($lang_install['Members']).'\', NULL, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60, 60)') or error('Unable to add group', __FILE__, __LINE__, $db->error()); |
1565: | 1571: |
1566: // Insert guest and first admin user | 1572: // Insert guest and first admin user |
1567: $db->query('INSERT INTO '.$db_prefix.'users (group_id, username, password, email) VALUES(3, \''.$db->escape($lang_install['Guest']).'\', \''.$db->escape($lang_install['Guest']).'\', \''.$db->escape($lang_install['Guest']).'\')') | 1573: $db->query('INSERT INTO '.$db_prefix.'users (group_id, username, password, email) VALUES(3, \''.$db->escape($lang_install['Guest']).'\', \''.$db->escape($lang_install['Guest']).'\', \''.$db->escape($lang_install['Guest']).'\')') |
1574: $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0; | 1580: $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0; |
1575: | 1581: |
1576: // Insert config data | 1582: // Insert config data |
1577: $config = array( | 1583: $pun_config = array( |
1578: 'o_cur_version' => "'".FORUM_VERSION."'", | 1584: 'o_cur_version' => FORUM_VERSION, |
1579: 'o_database_revision' => "'".FORUM_DB_REVISION."'", | 1585: 'o_database_revision' => FORUM_DB_REVISION, |
1580: 'o_searchindex_revision' => "'".FORUM_SI_REVISION."'", | 1586: 'o_searchindex_revision' => FORUM_SI_REVISION, |
1581: 'o_parser_revision' => "'".FORUM_PARSER_REVISION."'", | 1587: 'o_parser_revision' => FORUM_PARSER_REVISION, |
1582: 'o_board_title' => "'".$db->escape($title)."'", | 1588: 'o_board_title' => $title, |
1583: 'o_board_desc' => "'".$db->escape($description)."'", | 1589: 'o_board_desc' => $description, |
1584: 'o_default_timezone' => "'0'", | 1590: 'o_default_timezone' => 0, |
1585: 'o_time_format' => "'H:i:s'", | 1591: 'o_time_format' => 'H:i:s', |
1586: 'o_date_format' => "'Y-m-d'", | 1592: 'o_date_format' => 'Y-m-d', |
1587: 'o_timeout_visit' => "'1800'", | 1593: 'o_timeout_visit' => 1800, |
1588: 'o_timeout_online' => "'300'", | 1594: 'o_timeout_online' => 300, |
1589: 'o_redirect_delay' => "'1'", | 1595: 'o_redirect_delay' => 1, |
1590: 'o_show_version' => "'0'", | 1596: 'o_show_version' => 0, |
1591: 'o_show_user_info' => "'1'", | 1597: 'o_show_user_info' => 1, |
1592: 'o_show_post_count' => "'1'", | 1598: 'o_show_post_count' => 1, |
1593: 'o_signatures' => "'1'", | 1599: 'o_signatures' => 1, |
1594: 'o_smilies' => "'1'", | 1600: 'o_smilies' => 1, |
1595: 'o_smilies_sig' => "'1'", | 1601: 'o_smilies_sig' => 1, |
1596: 'o_make_links' => "'1'", | 1602: 'o_make_links' => 1, |
1597: 'o_default_lang' => "'".$db->escape($default_lang)."'", | 1603: 'o_default_lang' => $default_lang, |
1598: 'o_default_style' => "'".$db->escape($default_style)."'", | 1604: 'o_default_style' => $default_style, |
1599: 'o_default_user_group' => "'4'", | 1605: 'o_default_user_group' => 4, |
1600: 'o_topic_review' => "'15'", | 1606: 'o_topic_review' => 15, |
1601: 'o_disp_topics_default' => "'30'", | 1607: 'o_disp_topics_default' => 30, |
1602: 'o_disp_posts_default' => "'25'", | 1608: 'o_disp_posts_default' => 25, |
1603: 'o_indent_num_spaces' => "'4'", | 1609: 'o_indent_num_spaces' => 4, |
1604: 'o_quote_depth' => "'3'", | 1610: 'o_quote_depth' => 3, |
1605: 'o_quickpost' => "'1'", | 1611: 'o_quickpost' => 1, |
1606: 'o_users_online' => "'1'", | 1612: 'o_users_online' => 1, |
1607: 'o_censoring' => "'0'", | 1613: 'o_censoring' => 0, |
1608: 'o_ranks' => "'1'", | 1614: 'o_ranks' => 1, |
1609: 'o_show_dot' => "'0'", | 1615: 'o_show_dot' => 0, |
1610: 'o_topic_views' => "'1'", | 1616: 'o_topic_views' => 1, |
1611: 'o_quickjump' => "'1'", | 1617: 'o_quickjump' => 1, |
1612: 'o_gzip' => "'0'", | 1618: 'o_gzip' => 0, |
1613: 'o_additional_navlinks' => "''", | 1619: 'o_additional_navlinks' => '', |
1614: 'o_report_method' => "'0'", | 1620: 'o_report_method' => 0, |
1615: 'o_regs_report' => "'0'", | 1621: 'o_regs_report' => 0, |
1616: 'o_default_email_setting' => "'1'", | 1622: 'o_default_email_setting' => 1, |
1617: 'o_mailing_list' => "'".$email."'", | 1623: 'o_mailing_list' => $email, |
1618: 'o_avatars' => "'".$avatars."'", | 1624: 'o_avatars' => $avatars, |
1619: 'o_avatars_dir' => "'img/avatars'", | 1625: 'o_avatars_dir' => 'img/avatars', |
1620: 'o_avatars_width' => "'60'", | 1626: 'o_avatars_width' => 60, |
1621: 'o_avatars_height' => "'60'", | 1627: 'o_avatars_height' => 60, |
1622: 'o_avatars_size' => "'10240'", | 1628: 'o_avatars_size' => 10240, |
1623: 'o_search_all_forums' => "'1'", | 1629: 'o_search_all_forums' => 1, |
1624: 'o_base_url' => "'".$db->escape($base_url)."'", | 1630: 'o_base_url' => $base_url, |
1625: 'o_admin_email' => "'".$email."'", | 1631: 'o_admin_email' => $email, |
1626: 'o_webmaster_email' => "'".$email."'", | 1632: 'o_webmaster_email' => $email, |
1627: 'o_forum_subscriptions' => "'1'", | 1633: 'o_forum_subscriptions' => 1, |
1628: 'o_topic_subscriptions' => "'1'", | 1634: 'o_topic_subscriptions' => 1, |
1629: 'o_smtp_host' => "NULL", | 1635: 'o_smtp_host' => NULL, |
1630: 'o_smtp_user' => "NULL", | 1636: 'o_smtp_user' => NULL, |
1631: 'o_smtp_pass' => "NULL", | 1637: 'o_smtp_pass' => NULL, |
1632: 'o_smtp_ssl' => "'0'", | 1638: 'o_smtp_ssl' => 0, |
1633: 'o_regs_allow' => "'1'", | 1639: 'o_regs_allow' => 1, |
1634: 'o_regs_verify' => "'0'", | 1640: 'o_regs_verify' => 0, |
1635: 'o_announcement' => "'0'", | 1641: 'o_announcement' => 0, |
1636: 'o_announcement_message' => "'".$db->escape($lang_install['Announcement'])."'", | 1642: 'o_announcement_message' => $lang_install['Announcement'], |
1637: 'o_rules' => "'0'", | 1643: 'o_rules' => 0, |
1638: 'o_rules_message' => "'".$db->escape($lang_install['Rules'])."'", | 1644: 'o_rules_message' => $lang_install['Rules'], |
1639: 'o_maintenance' => "'0'", | 1645: 'o_maintenance' => 0, |
1640: 'o_maintenance_message' => "'".$db->escape($lang_install['Maintenance message'])."'", | 1646: 'o_maintenance_message' => $lang_install['Maintenance message'], |
1641: 'o_default_dst' => "'0'", | 1647: 'o_default_dst' => 0, |
1642: 'o_feed_type' => "'2'", | 1648: 'o_feed_type' => 2, |
1643: 'o_feed_ttl' => "'0'", | 1649: 'o_feed_ttl' => 0, |
1644: 'p_message_bbcode' => "'1'", | |