a/admin_bans.php |
b/admin_bans.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
15: | 15: |
16: | 16: |
17: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) | 17: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
18: message($lang_common['No permission']); | 18: message($lang_common['No permission'], false, '403 Forbidden'); |
19: | 19: |
20: // Load the admin_bans.php language file | 20: // Load the admin_bans.php language file |
21: require PUN_ROOT.'lang/'.$admin_language.'/admin_bans.php'; | 21: require PUN_ROOT.'lang/'.$admin_language.'/admin_bans.php'; |
52: } | 52: } |
53: } | 53: } |
54: | 54: |
55: // Make sure we're not banning an admin | 55: // Make sure we're not banning an admin or moderator |
56: if (isset($group_id) && $group_id == PUN_ADMIN) | 56: if (isset($group_id)) |
57: message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); | 57: { |
| 58: if ($group_id == PUN_ADMIN) |
| 59: message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); |
| 60: |
| 61: $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
| 62: $is_moderator_group = $db->result($result); |
| 63: |
| 64: if ($is_moderator_group) |
| 65: message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); |
| 66: } |
58: | 67: |
59: // If we have a $user_id, we can try to find the last known IP of that user | 68: // If we have a $user_id, we can try to find the last known IP of that user |
60: if (isset($user_id)) | 69: if (isset($user_id)) |
174: confirm_referrer('admin_bans.php'); | 183: confirm_referrer('admin_bans.php'); |
175: | 184: |
176: $ban_user = pun_trim($_POST['ban_user']); | 185: $ban_user = pun_trim($_POST['ban_user']); |
177: $ban_ip = trim($_POST['ban_ip']); | 186: $ban_ip = pun_trim($_POST['ban_ip']); |
178: $ban_email = strtolower(trim($_POST['ban_email'])); | 187: $ban_email = strtolower(pun_trim($_POST['ban_email'])); |
179: $ban_message = pun_trim($_POST['ban_message']); | 188: $ban_message = pun_trim($_POST['ban_message']); |
180: $ban_expire = trim($_POST['ban_expire']); | 189: $ban_expire = pun_trim($_POST['ban_expire']); |
181: | 190: |
182: if ($ban_user == '' && $ban_ip == '' && $ban_email == '') | 191: if ($ban_user == '' && $ban_ip == '' && $ban_email == '') |
183: message($lang_admin_bans['Must enter message']); | 192: message($lang_admin_bans['Must enter message']); |
184: else if (strtolower($ban_user) == 'guest') | 193: else if (strtolower($ban_user) == 'guest') |
185: message($lang_admin_bans['Cannot ban guest message']); | 194: message($lang_admin_bans['Cannot ban guest message']); |
186: | 195: |
| 196: // Make sure we're not banning an admin or moderator |
| 197: if (!empty($ban_user)) |
| 198: { |
| 199: $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 200: if ($db->num_rows($result)) |
| 201: { |
| 202: $group_id = $db->result($result); |
| 203: |
| 204: if ($group_id == PUN_ADMIN) |
| 205: message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user))); |
| 206: |
| 207: $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
| 208: $is_moderator_group = $db->result($result); |
| 209: |
| 210: if ($is_moderator_group) |
| 211: message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user))); |
| 212: } |
| 213: } |
| 214: |
187: // Validate IP/IP range (it's overkill, I know) | 215: // Validate IP/IP range (it's overkill, I know) |
188: if ($ban_ip != '') | 216: if ($ban_ip != '') |
189: { | 217: { |
190: $ban_ip = preg_replace('/\s{2,}/S', ' ', $ban_ip); | 218: $ban_ip = preg_replace('%\s{2,}%S', ' ', $ban_ip); |
191: $addresses = explode(' ', $ban_ip); | 219: $addresses = explode(' ', $ban_ip); |
192: $addresses = array_map('pun_trim', $addresses); | 220: $addresses = array_map('pun_trim', $addresses); |
193: | 221: |
216: { | 244: { |
217: $octets[$c] = (strlen($octets[$c]) > 1) ? ltrim($octets[$c], "0") : $octets[$c]; | 245: $octets[$c] = (strlen($octets[$c]) > 1) ? ltrim($octets[$c], "0") : $octets[$c]; |
218: | 246: |
219: if ($c > 3 || preg_match('/[^0-9]/', $octets[$c]) || intval($octets[$c]) > 255) | 247: if ($c > 3 || preg_match('%[^0-9]%', $octets[$c]) || intval($octets[$c]) > 255) |
220: message($lang_admin_bans['Invalid IP message']); | 248: message($lang_admin_bans['Invalid IP message']); |
221: } | 249: } |
222: | 250: |
231: require PUN_ROOT.'include/email.php'; | 259: require PUN_ROOT.'include/email.php'; |
232: if ($ban_email != '' && !is_valid_email($ban_email)) | 260: if ($ban_email != '' && !is_valid_email($ban_email)) |
233: { | 261: { |
234: if (!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email)) | 262: if (!preg_match('%^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$%', $ban_email)) |
235: message($lang_admin_bans['Invalid e-mail message']); | 263: message($lang_admin_bans['Invalid e-mail message']); |
236: } | 264: } |
237: | 265: |
302: $form = array_map('pun_trim', $form); | 330: $form = array_map('pun_trim', $form); |
303: $conditions = $query_str = array(); | 331: $conditions = $query_str = array(); |
304: | 332: |
305: $expire_after = isset($_GET['expire_after']) ? trim($_GET['expire_after']) : ''; | 333: $expire_after = isset($_GET['expire_after']) ? pun_trim($_GET['expire_after']) : ''; |
306: $expire_before = isset($_GET['expire_before']) ? trim($_GET['expire_before']) : ''; | 334: $expire_before = isset($_GET['expire_before']) ? pun_trim($_GET['expire_before']) : ''; |
307: $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? $_GET['order_by'] : 'username'; | 335: $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? 'b.'.$_GET['order_by'] : 'b.username'; |
308: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; | 336: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
309: | 337: |
310: $query_str[] = 'order_by='.$order_by; | 338: $query_str[] = 'order_by='.$order_by; |
319: if ($expire_after === false || $expire_after == -1) | 347: if ($expire_after === false || $expire_after == -1) |
320: message($lang_admin_bans['Invalid date message']); | 348: message($lang_admin_bans['Invalid date message']); |
321: | 349: |
322: $conditions[] = 'expire>'.$expire_after; | 350: $conditions[] = 'b.expire>'.$expire_after; |
323: } | 351: } |
324: if ($expire_before != '') | 352: if ($expire_before != '') |
325: { | 353: { |
329: if ($expire_before === false || $expire_before == -1) | 357: if ($expire_before === false || $expire_before == -1) |
330: message($lang_admin_bans['Invalid date message']); | 358: message($lang_admin_bans['Invalid date message']); |
331: | 359: |
332: $conditions[] = 'expire<'.$expire_before; | 360: $conditions[] = 'b.expire<'.$expire_before; |
333: } | 361: } |
334: | 362: |
335: $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; | 363: $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; |
a/admin_groups.php |
b/admin_groups.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
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> |
465: <div class="blockform"> | 473: <div class="blockform"> |
466: <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> | 474: <h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2> |
467: <div class="box"> | 475: <div class="box"> |
468: <form id="groups" method="post" action="admin_groups.php?action=foo"> | 476: <form id="groups" method="post" action="admin_groups.php"> |
469: <div class="inform"> | 477: <div class="inform"> |
470: <fieldset> | 478: <fieldset> |
471: <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> | 479: <legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend> |
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_maintenance.php |
b/admin_maintenance.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
17: | 17: |
18: | 18: |
19: if ($pun_user['g_id'] != PUN_ADMIN) | 19: if ($pun_user['g_id'] != PUN_ADMIN) |
20: message($lang_common['No permission']); | 20: message($lang_common['No permission'], false, '403 Forbidden'); |
21: | 21: |
22: // Load the admin_maintenance.php language file | 22: // Load the admin_maintenance.php language file |
23: require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php'; | 23: require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php'; |
24: | 24: |
25: if (isset($_GET['i_per_page']) && isset($_GET['i_start_at'])) | 25: $action = isset($_REQUEST['action']) ? pun_trim($_REQUEST['action']) : ''; |
| 26: |
| 27: if ($action == 'rebuild') |
26: { | 28: { |
27: $per_page = intval($_GET['i_per_page']); | 29: $per_page = isset($_GET['i_per_page']) ? intval($_GET['i_per_page']) : 0; |
28: $start_at = intval($_GET['i_start_at']); | 30: $start_at = isset($_GET['i_start_at']) ? intval($_GET['i_start_at']) : 0; |
29: if ($per_page < 1 || $start_at < 1) | 31: |
30: message($lang_common['Bad request']); | 32: // Check per page is > 0 |
| 33: if ($per_page < 1) |
| 34: message($lang_admin_maintenance['Posts must be integer message']); |
31: | 35: |
32: @set_time_limit(0); | 36: @set_time_limit(0); |
33: | 37: |
110: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id > '.$end_at.' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); | 114: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id > '.$end_at.' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
111: | 115: |
112: if ($db->num_rows($result) > 0) | 116: if ($db->num_rows($result) > 0) |
113: $query_str = '?i_per_page='.$per_page.'&i_start_at='.$db->result($result); | 117: $query_str = '?action=rebuild&i_per_page='.$per_page.'&i_start_at='.$db->result($result); |
114: } | 118: } |
115: | 119: |
116: $db->end_transaction(); | 120: $db->end_transaction(); |
119: exit('<script type="text/javascript">window.location="admin_maintenance.php'.$query_str.'"</script><hr /><p>'.sprintf($lang_admin_maintenance['Javascript redirect failed'], '<a href="admin_maintenance.php'.$query_str.'">'.$lang_admin_maintenance['Click here'].'</a>').'</p>'); | 123: exit('<script type="text/javascript">window.location="admin_maintenance.php'.$query_str.'"</script><hr /><p>'.sprintf($lang_admin_maintenance['Javascript redirect failed'], '<a href="admin_maintenance.php'.$query_str.'">'.$lang_admin_maintenance['Click here'].'</a>').'</p>'); |
120: } | 124: } |
121: | 125: |
| 126: if ($action == 'prune') |
| 127: { |
| 128: $prune_from = pun_trim($_POST['prune_from']); |
| 129: $prune_sticky = intval($_POST['prune_sticky']); |
| 130: |
| 131: if (isset($_POST['prune_comply'])) |
| 132: { |
| 133: confirm_referrer('admin_maintenance.php'); |
| 134: |
| 135: $prune_days = intval($_POST['prune_days']); |
| 136: $prune_date = ($prune_days) ? time() - ($prune_days * 86400) : -1; |
| 137: |
| 138: @set_time_limit(0); |
| 139: |
| 140: if ($prune_from == 'all') |
| 141: { |
| 142: $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
| 143: $num_forums = $db->num_rows($result); |
| 144: |
| 145: for ($i = 0; $i < $num_forums; ++$i) |
| 146: { |
| 147: $fid = $db->result($result, $i); |
| 148: |
| 149: prune($fid, $prune_sticky, $prune_date); |
| 150: update_forum($fid); |
| 151: } |
| 152: } |
| 153: else |
| 154: { |
| 155: $prune_from = intval($prune_from); |
| 156: prune($prune_from, $prune_sticky, $prune_date); |
| 157: update_forum($prune_from); |
| 158: } |
| 159: |
| 160: // Locate any "orphaned redirect topics" and delete them |
| 161: $result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error()); |
| 162: $num_orphans = $db->num_rows($result); |
| 163: |
| 164: if ($num_orphans) |
| 165: { |
| 166: for ($i = 0; $i < $num_orphans; ++$i) |
| 167: $orphans[] = $db->result($result, $i); |
| 168: |
| 169: $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); |
| 170: } |
| 171: |
| 172: redirect('admin_maintenance.php', $lang_admin_maintenance['Posts pruned redirect']); |
| 173: } |
| 174: |
| 175: $prune_days = pun_trim($_POST['req_prune_days']); |
| 176: if ($prune_days == '' || preg_match('%[^0-9]%', $prune_days)) |
| 177: message($lang_admin_maintenance['Days must be integer message']); |
| 178: |
| 179: $prune_date = time() - ($prune_days * 86400); |
| 180: |
| 181: // Concatenate together the query for counting number of topics to prune |
| 182: $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL'; |
| 183: |
| 184: if ($prune_sticky == '0') |
| 185: $sql .= ' AND sticky=0'; |
| 186: |
| 187: if ($prune_from != 'all') |
| 188: { |
| 189: $prune_from = intval($prune_from); |
| 190: $sql .= ' AND forum_id='.$prune_from; |
| 191: |
| 192: // Fetch the forum name (just for cosmetic reasons) |
| 193: $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error()); |
| 194: $forum = '"'.pun_htmlspecialchars($db->result($result)).'"'; |
| 195: } |
| 196: else |
| 197: $forum = $lang_admin_maintenance['All forums']; |
| 198: |
| 199: $result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error()); |
| 200: $num_topics = $db->result($result); |
| 201: |
| 202: if (!$num_topics) |
| 203: message(sprintf($lang_admin_maintenance['No old topics message'], $prune_days)); |
| 204: |
| 205: |
| 206: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']); |
| 207: define('PUN_ACTIVE_PAGE', 'admin'); |
| 208: require PUN_ROOT.'header.php'; |
| 209: |
| 210: generate_admin_menu('maintenance'); |
| 211: |
| 212: ?> |
| 213: <div class="blockform"> |
| 214: <h2><span><?php echo $lang_admin_maintenance['Prune head'] ?></span></h2> |
| 215: <div class="box"> |
| 216: <form method="post" action="admin_maintenance.php"> |
| 217: <div class="inform"> |
| 218: <input type="hidden" name="action" value="prune" /> |
| 219: <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" /> |
| 220: <input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" /> |
| 221: <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" /> |
| 222: <fieldset> |
| 223: <legend><?php echo $lang_admin_maintenance['Confirm prune subhead'] ?></legend> |
| 224: <div class="infldset"> |
| 225: <p><?php printf($lang_admin_maintenance['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?></p> |
| 226: <p class="warntext"><?php echo $lang_admin_maintenance['Confirm prune warn'] ?></p> |
| 227: </div> |
| 228: </fieldset> |
| 229: </div> |
| 230: <p class="buttons"><input type="submit" name="prune_comply" value="<?php echo $lang_admin_common['Prune'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> |
| 231: </form> |
| 232: </div> |
| 233: </div> |
| 234: <div class="clearer"></div> |
| 235: </div> |
| 236: <?php |
| 237: |
| 238: require PUN_ROOT.'footer.php'; |
| 239: exit; |
| 240: } |
| 241: |
122: | 242: |
123: // Get the first post ID from the db | 243: // Get the first post ID from the db |
124: $result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id ASC LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); | 244: $result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id ASC LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
137: <div class="box"> | 257: <div class="box"> |
138: <form method="get" action="admin_maintenance.php"> | 258: <form method="get" action="admin_maintenance.php"> |
139: <div class="inform"> | 259: <div class="inform"> |
| 260: <input type="hidden" name="action" value="rebuild" /> |
140: <fieldset> | 261: <fieldset> |
141: <legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend> | 262: <legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend> |
142: <div class="infldset"> | 263: <div class="infldset"> |
169: </fieldset> | 290: </fieldset> |
170: </div> | 291: </div> |
171: </form> | 292: </form> |
| 293: |
| 294: <form method="post" action="admin_maintenance.php" onsubmit="return process_form(this)"> |
| 295: <div class="inform"> |
| 296: <input type="hidden" name="action" value="prune" /> |
| 297: <fieldset> |
| 298: <legend><?php echo $lang_admin_maintenance['Prune subhead'] ?></legend> |
| 299: <div class="infldset"> |
| 300: <table class="aligntop" cellspacing="0"> |
| 301: <tr> |
| 302: <th scope="row"><?php echo $lang_admin_maintenance['Days old label'] ?></th> |
| 303: <td> |
| 304: <input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="5" /> |
| 305: <span><?php echo $lang_admin_maintenance['Days old help'] ?></span> |
| 306: </td> |
| 307: </tr> |
| 308: <tr> |
| 309: <th scope="row"><?php echo $lang_admin_maintenance['Prune sticky label'] ?></th> |
| 310: <td> |
| 311: <input type="radio" name="prune_sticky" value="1" tabindex="6" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="prune_sticky" value="0" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
| 312: <span><?php echo $lang_admin_maintenance['Prune sticky help'] ?></span> |
| 313: </td> |
| 314: </tr> |
| 315: <tr> |
| 316: <th scope="row"><?php echo $lang_admin_maintenance['Prune from label'] ?></th> |
| 317: <td> |
| 318: <select name="prune_from" tabindex="7"> |
| 319: <option value="all"><?php echo $lang_admin_maintenance['All forums'] ?></option> |
| 320: <?php |
| 321: |
| 322: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
| 323: |
| 324: $cur_category = 0; |
| 325: while ($forum = $db->fetch_assoc($result)) |
| 326: { |
| 327: if ($forum['cid'] != $cur_category) // Are we still in the same category? |
| 328: { |
| 329: if ($cur_category) |
| 330: echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n"; |
| 331: |
| 332: echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n"; |
| 333: $cur_category = $forum['cid']; |
| 334: } |
| 335: |
| 336: echo "\t\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.pun_htmlspecialchars($forum['forum_name']).'</option>'."\n"; |
| 337: } |
| 338: |
| 339: ?> |
| 340: </optgroup> |
| 341: </select> |
| 342: <span><?php echo $lang_admin_maintenance['Prune from help'] ?></span> |
| 343: </td> |
| 344: </tr> |
| 345: </table> |
| 346: <p class="topspace"><?php printf($lang_admin_maintenance['Prune info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p> |
| 347: <div class="fsetsubmit"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="8" /></div> |
| 348: </div> |
| 349: </fieldset> |
| 350: </div> |
| 351: </form> |
172: </div> | 352: </div> |
173: </div> | 353: </div> |
174: <div class="clearer"></div> | 354: <div class="clearer"></div> |
a/admin_options.php |
b/admin_options.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
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', |
60: 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', | 60: 'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1', |
61: 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), | 61: 'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']), |
62: 'feed_type' => intval($_POST['form']['feed_type']), | 62: 'feed_type' => intval($_POST['form']['feed_type']), |
| 63: 'feed_ttl' => intval($_POST['form']['feed_ttl']), |
63: 'report_method' => intval($_POST['form']['report_method']), | 64: 'report_method' => intval($_POST['form']['report_method']), |
64: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), | 65: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), |
65: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', | 66: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', |
66: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), | 67: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), |
67: 'avatars_width' => intval($_POST['form']['avatars_width']), | 68: 'avatars_width' => (intval($_POST['form']['avatars_width']) > 0) ? intval($_POST['form']['avatars_width']) : 1, |
68: 'avatars_height' => intval($_POST['form']['avatars_height']), | 69: 'avatars_height' => (intval($_POST['form']['avatars_height']) > 0) ? intval($_POST['form']['avatars_height']) : 1, |
69: 'avatars_size' => intval($_POST['form']['avatars_size']), | 70: 'avatars_size' => (intval($_POST['form']['avatars_size']) > 0) ? intval($_POST['form']['avatars_size']) : 1, |
70: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), | 71: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), |
71: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), | 72: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), |
72: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', | 73: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', |
117: message($lang_admin_options['Invalid webmaster e-mail message']); | 118: message($lang_admin_options['Invalid webmaster e-mail message']); |
118: | 119: |
119: if ($form['mailing_list'] != '') | 120: if ($form['mailing_list'] != '') |
120: $form['mailing_list'] = strtolower(preg_replace('/\s/S', '', $form['mailing_list'])); | 121: $form['mailing_list'] = strtolower(preg_replace('%\s%S', '', $form['mailing_list'])); |
121: | 122: |
122: // Make sure avatars_dir doesn't end with a slash | 123: // Make sure avatars_dir doesn't end with a slash |
123: if (substr($form['avatars_dir'], -1) == '/') | 124: if (substr($form['avatars_dir'], -1) == '/') |
176: if ($form['feed_type'] < 0 || $form['feed_type'] > 2) | 177: if ($form['feed_type'] < 0 || $form['feed_type'] > 2) |
177: message($lang_common['Bad request']); | 178: message($lang_common['Bad request']); |
178: | 179: |
| 180: if ($form['feed_ttl'] < 0) |
| 181: message($lang_common['Bad request']); |
| 182: |
179: if ($form['report_method'] < 0 || $form['report_method'] > 2) | 183: if ($form['report_method'] < 0 || $form['report_method'] > 2) |
180: message($lang_common['Bad request']); | 184: message($lang_common['Bad request']); |
181: | 185: |
204: require PUN_ROOT.'include/cache.php'; | 208: require PUN_ROOT.'include/cache.php'; |
205: | 209: |
206: generate_config_cache(); | 210: generate_config_cache(); |
| 211: clear_feed_cache(); |
207: | 212: |
208: redirect('admin_options.php', $lang_admin_options['Options updated redirect']); | 213: redirect('admin_options.php', $lang_admin_options['Options updated redirect']); |
209: } | 214: } |
218: <div class="blockform"> | 223: <div class="blockform"> |
219: <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> | 224: <h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2> |
220: <div class="box"> | 225: <div class="box"> |
221: <form method="post" action="admin_options.php?action=foo"> | 226: <form method="post" action="admin_options.php"> |
222: <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p> | 227: <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p> |
223: <div class="inform"> | 228: <div class="inform"> |
224: <input type="hidden" name="form_sent" value="1" /> | 229: <input type="hidden" name="form_sent" value="1" /> |
298: <tr> | 303: <tr> |
299: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> | 304: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> |
300: <td> | 305: <td> |
301: <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> |
302: <span><?php echo $lang_admin_options['DST help'] ?></span> | 307: <span><?php echo $lang_admin_options['DST help'] ?></span> |
303: </td> | 308: </td> |
304: </tr> | 309: </tr> |
406: <tr> | 411: <tr> |
407: <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> |
408: <td> | 413: <td> |
409: <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> |
410: <span><?php echo $lang_admin_options['Version number help'] ?></span> | 415: <span><?php echo $lang_admin_options['Version number help'] ?></span> |
411: </td> | 416: </td> |
412: </tr> | 417: </tr> |
413: <tr> | 418: <tr> |
414: <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> |
415: <td> | 420: <td> |
416: <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> |
417: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> | 422: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> |
418: </td> | 423: </td> |
419: </tr> | 424: </tr> |
420: <tr> | 425: <tr> |
421: <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> |
422: <td> | 427: <td> |
423: <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> |
424: <span><?php echo $lang_admin_options['Post count help'] ?></span> | 429: <span><?php echo $lang_admin_options['Post count help'] ?></span> |
425: </td> | 430: </td> |
426: </tr> | 431: </tr> |
427: <tr> | 432: <tr> |
428: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> | 433: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> |
429: <td> | 434: <td> |
430: <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> |
431: <span><?php echo $lang_admin_options['Smilies help'] ?></span> | 436: <span><?php echo $lang_admin_options['Smilies help'] ?></span> |
432: </td> | 437: </td> |
433: </tr> | 438: </tr> |
434: <tr> | 439: <tr> |
435: <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> |
436: <td> | 441: <td> |
437: <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> |
438: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> | 443: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> |
439: </td> | 444: </td> |
440: </tr> | 445: </tr> |
441: <tr> | 446: <tr> |
442: <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> |
443: <td> | 448: <td> |
444: <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> |
445: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> | 450: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> |
446: </td> | 451: </td> |
447: </tr> | 452: </tr> |
492: <tr> | 497: <tr> |
493: <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> |
494: <td> | 499: <td> |
495: <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> |
496: <span><?php echo $lang_admin_options['Quick post help'] ?></span> | 501: <span><?php echo $lang_admin_options['Quick post help'] ?></span> |
497: </td> | 502: </td> |
498: </tr> | 503: </tr> |
499: <tr> | 504: <tr> |
500: <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> |
501: <td> | 506: <td> |
502: <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> |
503: <span><?php echo $lang_admin_options['Users online help'] ?></span> | 508: <span><?php echo $lang_admin_options['Users online help'] ?></span> |
504: </td> | 509: </td> |
505: </tr> | 510: </tr> |
506: <tr> | 511: <tr> |
507: <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> |
508: <td> | 513: <td> |
509: <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> |
510: <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> |
511: </td> | 516: </td> |
512: </tr> | 517: </tr> |
513: <tr> | 518: <tr> |
514: <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> |
515: <td> | 520: <td> |
516: <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> |
517: <span><?php echo $lang_admin_options['Signatures help'] ?></span> | 522: <span><?php echo $lang_admin_options['Signatures help'] ?></span> |
518: </td> | 523: </td> |
519: </tr> | 524: </tr> |
520: <tr> | 525: <tr> |
521: <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> |
522: <td> | 527: <td> |
523: <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> |
524: <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> |
525: </td> | 530: </td> |
526: </tr> | 531: </tr> |
527: <tr> | 532: <tr> |
528: <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> |
529: <td> | 534: <td> |
530: <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> |
531: <span><?php echo $lang_admin_options['User has posted help'] ?></span> | 536: <span><?php echo $lang_admin_options['User has posted help'] ?></span> |
532: </td> | 537: </td> |
533: </tr> | 538: </tr> |
534: <tr> | 539: <tr> |
535: <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> |
536: <td> | 541: <td> |
537: <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> |
538: <span><?php echo $lang_admin_options['Topic views help'] ?></span> | 543: <span><?php echo $lang_admin_options['Topic views help'] ?></span> |
539: </td> | 544: </td> |
540: </tr> | 545: </tr> |
541: <tr> | 546: <tr> |
542: <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> |
543: <td> | 548: <td> |
544: <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> |
545: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> | 550: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> |
546: </td> | 551: </td> |
547: </tr> | 552: </tr> |
548: <tr> | 553: <tr> |
549: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> | 554: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> |
550: <td> | 555: <td> |
551: <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> |
552: <span><?php echo $lang_admin_options['GZip help'] ?></span> | 557: <span><?php echo $lang_admin_options['GZip help'] ?></span> |
553: </td> | 558: </td> |
554: </tr> | 559: </tr> |
555: <tr> | 560: <tr> |
556: <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> |
557: <td> | 562: <td> |
558: <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> |
559: <span><?php echo $lang_admin_options['Search all help'] ?></span> | 564: <span><?php echo $lang_admin_options['Search all help'] ?></span> |
560: </td> | 565: </td> |
561: </tr> | 566: </tr> |
566: <span><?php echo $lang_admin_options['Menu items help'] ?></span> | 571: <span><?php echo $lang_admin_options['Menu items help'] ?></span> |
567: </td> | 572: </td> |
568: </tr> | 573: </tr> |
| 574: </table> |
| 575: </div> |
| 576: </fieldset> |
| 577: </div> |
| 578: <div class="inform"> |
| 579: <fieldset> |
| 580: <legend><?php echo $lang_admin_options['Feed subhead'] ?></legend> |
| 581: <div class="infldset"> |
| 582: <table class="aligntop" cellspacing="0"> |
569: <tr> | 583: <tr> |
570: <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> |
571: <td> | 585: <td> |
572: <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> |
573: <span><?php echo $lang_admin_options['Default feed help'] ?></span> | 587: <span><?php echo $lang_admin_options['Default feed help'] ?></span> |
574: </td> | 588: </td> |
575: </tr> | 589: </tr> |
| 590: <tr> |
| 591: <th scope="row"><?php echo $lang_admin_options['Feed TTL label'] ?></th> |
| 592: <td> |
| 593: <select name="form[feed_ttl]"> |
| 594: <option value="0"<?php if ($pun_config['o_feed_ttl'] == '0') echo ' selected="selected"'; ?>><?php echo $lang_admin_options['No cache'] ?></option> |
| 595: <?php |
| 596: |
| 597: $times = array(5, 15, 30, 60); |
| 598: |
| 599: foreach ($times as $time) |
| 600: echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$time.'"'.($pun_config['o_feed_ttl'] == $time ? ' selected="selected"' : '').'>'.sprintf($lang_admin_options['Minutes'], $time).'</option>'."\n"; |
| 601: |
| 602: ?> |
| 603: </select> |
| 604: <span><?php echo $lang_admin_options['Feed TTL help'] ?></span> |
| 605: </td> |
| 606: </tr> |
576: </table> | 607: </table> |
577: </div> | 608: </div> |
578: </fieldset> | 609: </fieldset> |
585: <tr> | 616: <tr> |
586: <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> |
587: <td> | 618: <td> |
588: <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> |
589: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> | 620: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> |
590: </td> | 621: </td> |
591: </tr> | 622: </tr> |
608: <tr> | 639: <tr> |
609: <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> |
610: <td> | 641: <td> |
611: <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> |
612: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> | 643: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> |
613: </td> | 644: </td> |
614: </tr> | 645: </tr> |
666: <tr> | 697: <tr> |
667: <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> |
668: <td> | 699: <td> |
669: <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> |
670: <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> | 701: <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> |
671: </td> | 702: </td> |
672: </tr> | 703: </tr> |
673: <tr> | 704: <tr> |
674: <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> |
675: <td> | 706: <td> |
676: <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> |
677: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> | 708: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> |
678: </td> | 709: </td> |
679: </tr> | 710: </tr> |
694: <tr> | 725: <tr> |
695: <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> |
696: <td> | 727: <td> |
697: <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> |
698: <?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) : ''; ?> |
699: <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 ?>" /> |
700: <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 ?>" /> |
704: <tr> | 735: <tr> |
705: <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> |
706: <td> | 737: <td> |
707: <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> |
708: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> | 739: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> |
709: </td> | 740: </td> |
710: </tr> | 741: </tr> |
720: <tr> | 751: <tr> |
721: <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> |
722: <td> | 753: <td> |
723: <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> |
724: <span><?php echo $lang_admin_options['Allow new help'] ?></span> | 755: <span><?php echo $lang_admin_options['Allow new help'] ?></span> |
725: </td> | 756: </td> |
726: </tr> | 757: </tr> |
727: <tr> | 758: <tr> |
728: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> | 759: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> |
729: <td> | 760: <td> |
730: <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> |
731: <span><?php echo $lang_admin_options['Verify help'] ?></span> | 762: <span><?php echo $lang_admin_options['Verify help'] ?></span> |
732: </td> | 763: </td> |
733: </tr> | 764: </tr> |
734: <tr> | 765: <tr> |
735: <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> |
736: <td> | 767: <td> |
737: <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> |
738: <span><?php echo $lang_admin_options['Report new help'] ?></span> | 769: <span><?php echo $lang_admin_options['Report new help'] ?></span> |
739: </td> | 770: </td> |
740: </tr> | 771: </tr> |
741: <tr> | 772: <tr> |
742: <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> |
743: <td> | 774: <td> |
744: <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> |
745: <span><?php echo $lang_admin_options['Use rules help'] ?></span> | 776: <span><?php echo $lang_admin_options['Use rules help'] ?></span> |
746: </td> | 777: </td> |
747: </tr> | 778: </tr> |
756: <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> |
757: <td> | 788: <td> |
758: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> | 789: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> |
759: <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 /> |
760: <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 /> |
761: <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 /> |
762: </td> | 793: </td> |
763: </tr> | 794: </tr> |
764: </table> | 795: </table> |
773: <tr> | 804: <tr> |
774: <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> |
775: <td> | 806: <td> |
776: <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> |
777: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> | 808: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> |
778: </td> | 809: </td> |
779: </tr> | 810: </tr> |
794: <div class="infldset"> | 825: <div class="infldset"> |
795: <table class="aligntop" cellspacing="0"> | 826: <table class="aligntop" cellspacing="0"> |
796: <tr> | 827: <tr> |
797: <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> |
798: <td> | 829: <td> |
799: <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> |
800: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> | 831: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> |
801: </td> | 832: </td> |
802: </tr> | 833: </tr> |
a/admin_users.php |
b/admin_users.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
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 |
253: } | 253: } |
254: | 254: |
255: | 255: |
| 256: // Move multiple users to other user groups |
| 257: else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) |
| 258: { |
| 259: if ($pun_user['g_id'] > PUN_ADMIN) |
| 260: message($lang_common['No permission'], false, '403 Forbidden'); |
| 261: |
| 262: confirm_referrer('admin_users.php'); |
| 263: |
| 264: if (isset($_POST['users'])) |
| 265: { |
| 266: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
| 267: $user_ids = array_map('intval', $user_ids); |
| 268: |
| 269: // Delete invalid IDs |
| 270: $user_ids = array_diff($user_ids, array(0, 1)); |
| 271: } |
| 272: else |
| 273: $user_ids = array(); |
| 274: |
| 275: if (empty($user_ids)) |
| 276: message($lang_admin_users['No users selected']); |
| 277: |
| 278: // Are we trying to batch move any admins? |
| 279: $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 280: if ($db->result($result) > 0) |
| 281: message($lang_admin_users['No move admins message']); |
| 282: |
| 283: // Fetch all user groups |
| 284: $all_groups = array(); |
| 285: $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id NOT IN ('.PUN_GUEST.','.PUN_ADMIN.') ORDER BY g_title ASC') or error('Unable to fetch groups', __FILE__, __LINE__, $db->error()); |
| 286: while ($row = $db->fetch_row($result)) |
| 287: $all_groups[$row[0]] = $row[1]; |
| 288: |
| 289: if (isset($_POST['move_users_comply'])) |
| 290: { |
| 291: $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); |
| 292: |
| 293: // Is the new group a moderator group? |
| 294: $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$new_group) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
| 295: $new_group_mod = $db->result($result); |
| 296: |
| 297: // Fetch user groups |
| 298: $user_groups = array(); |
| 299: $result = $db->query('SELECT id, group_id FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error()); |
| 300: while ($cur_user = $db->fetch_assoc($result)) |
| 301: { |
| 302: if (!isset($user_groups[$cur_user['group_id']])) |
| 303: $user_groups[$cur_user['group_id']] = array(); |
| 304: |
| 305: $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
| 306: } |
| 307: |
| 308: // Are any users moderators? |
| 309: $group_ids = array_keys($user_groups); |
| 310: $result = $db->query('SELECT g_id, g_moderator FROM '.$db->prefix.'groups WHERE g_id IN ('.implode(',', $group_ids).')') or error('Unable to fetch group moderators', __FILE__, __LINE__, $db->error()); |
| 311: while ($cur_group = $db->fetch_assoc($result)) |
| 312: { |
| 313: if ($cur_group['g_moderator'] == '0') |
| 314: unset($user_groups[$cur_group['g_id']]); |
| 315: } |
| 316: |
| 317: if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') |
| 318: { |
| 319: // Fetch forum list and clean up their moderator list |
| 320: $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
| 321: while ($cur_forum = $db->fetch_assoc($result)) |
| 322: { |
| 323: $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
| 324: |
| 325: foreach ($user_groups as $group_users) |
| 326: $cur_moderators = array_diff($cur_moderators, $group_users); |
| 327: |
| 328: $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
| 329: $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); |
| 330: } |
| 331: } |
| 332: |
| 333: // Change user group |
| 334: $db->query('UPDATE '.$db->prefix.'users SET group_id='.$new_group.' WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to change user group', __FILE__, __LINE__, $db->error()); |
| 335: |
| 336: redirect('admin_users.php', $lang_admin_users['Users move redirect']); |
| 337: } |
| 338: |
| 339: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Move users']); |
| 340: define('PUN_ACTIVE_PAGE', 'admin'); |
| 341: require PUN_ROOT.'header.php'; |
| 342: |
| 343: generate_admin_menu('users'); |
| 344: |
| 345: ?> |
| 346: <div class="blockform"> |
| 347: <h2><span><?php echo $lang_admin_users['Move users'] ?></span></h2> |
| 348: <div class="box"> |
| 349: <form name="confirm_move_users" method="post" action="admin_users.php"> |
| 350: <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
| 351: <div class="inform"> |
| 352: <fieldset> |
| 353: <legend><?php echo $lang_admin_users['Move users subhead'] ?></legend> |
| 354: <div class="infldset"> |
| 355: <table class="aligntop" cellspacing="0"> |
| 356: <tr> |
| 357: <th scope="row"><?php echo $lang_admin_users['New group label'] ?></th> |
| 358: <td> |
| 359: <select name="new_group" tabindex="1"> |
| 360: <?php foreach ($all_groups as $gid => $group) : ?> <option value="<?php echo $gid ?>"><?php echo pun_htmlspecialchars($group) ?></option> |
| 361: <?php endforeach; ?> |
| 362: </select> |
| 363: <span><?php echo $lang_admin_users['New group help'] ?></span> |
| 364: </td> |
| 365: </tr> |
| 366: </table> |
| 367: </div> |
| 368: </fieldset> |
| 369: </div> |
| 370: <p class="submitend"><input type="submit" name="move_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="2" /></p> |
| 371: </form> |
| 372: </div> |
| 373: </div> |
| 374: <div class="clearer"></div> |
| 375: </div> |
| 376: <?php |
| 377: |
| 378: require PUN_ROOT.'footer.php'; |
| 379: } |
| 380: |
| 381: |
| 382: // Delete multiple users |
| 383: else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) |
| 384: { |
| 385: if ($pun_user['g_id'] > PUN_ADMIN) |
| 386: message($lang_common['No permission'], false, '403 Forbidden'); |
| 387: |
| 388: confirm_referrer('admin_users.php'); |
| 389: |
| 390: if (isset($_POST['users'])) |
| 391: { |
| 392: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
| 393: $user_ids = array_map('intval', $user_ids); |
| 394: |
| 395: // Delete invalid IDs |
| 396: $user_ids = array_diff($user_ids, array(0, 1)); |
| 397: } |
| 398: else |
| 399: $user_ids = array(); |
| 400: |
| 401: if (empty($user_ids)) |
| 402: message($lang_admin_users['No users selected']); |
| 403: |
| 404: // Are we trying to delete any admins? |
| 405: $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 406: if ($db->result($result) > 0) |
| 407: message($lang_admin_users['No delete admins message']); |
| 408: |
| 409: if (isset($_POST['delete_users_comply'])) |
| 410: { |
| 411: // Fetch user groups |
| 412: $user_groups = array(); |
| 413: $result = $db->query('SELECT id, group_id FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error()); |
| 414: while ($cur_user = $db->fetch_assoc($result)) |
| 415: { |
| 416: if (!isset($user_groups[$cur_user['group_id']])) |
| 417: $user_groups[$cur_user['group_id']] = array(); |
| 418: |
| 419: $user_groups[$cur_user['group_id']][] = $cur_user['id']; |
| 420: } |
| 421: |
| 422: // Are any users moderators? |
| 423: $group_ids = array_keys($user_groups); |
| 424: $result = $db->query('SELECT g_id, g_moderator FROM '.$db->prefix.'groups WHERE g_id IN ('.implode(',', $group_ids).')') or error('Unable to fetch group moderators', __FILE__, __LINE__, $db->error()); |
| 425: while ($cur_group = $db->fetch_assoc($result)) |
| 426: { |
| 427: if ($cur_group['g_moderator'] == '0') |
| 428: unset($user_groups[$cur_group['g_id']]); |
| 429: } |
| 430: |
| 431: // Fetch forum list and clean up their moderator list |
| 432: $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); |
| 433: while ($cur_forum = $db->fetch_assoc($result)) |
| 434: { |
| 435: $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
| 436: |
| 437: foreach ($user_groups as $group_users) |
| 438: $cur_moderators = array_diff($cur_moderators, $group_users); |
| 439: |
| 440: $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
| 441: $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); |
| 442: } |
| 443: |
| 444: // Delete any subscriptions |
| 445: $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to delete topic subscriptions', __FILE__, __LINE__, $db->error()); |
| 446: $db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to delete forum subscriptions', __FILE__, __LINE__, $db->error()); |
| 447: |
| 448: // Remove them from the online list (if they happen to be logged in) |
| 449: $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to remove users from online list', __FILE__, __LINE__, $db->error()); |
| 450: |
| 451: // Should we delete all posts made by these users? |
| 452: if (isset($_POST['delete_posts'])) |
| 453: { |
| 454: require PUN_ROOT.'include/search_idx.php'; |
| 455: @set_time_limit(0); |
| 456: |
| 457: // Find all posts made by this user |
| 458: $result = $db->query('SELECT p.id, p.topic_id, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE p.poster_id IN ('.implode(',', $user_ids).')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); |
| 459: if ($db->num_rows($result)) |
| 460: { |
| 461: while ($cur_post = $db->fetch_assoc($result)) |
| 462: { |
| 463: // Determine whether this post is the "topic post" or not |
| 464: $result2 = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
| 465: |
| 466: if ($db->result($result2) == $cur_post['id']) |
| 467: delete_topic($cur_post['topic_id']); |
| 468: else |
| 469: delete_post($cur_post['id'], $cur_post['topic_id']); |
| 470: |
| 471: update_forum($cur_post['forum_id']); |
| 472: } |
| 473: } |
| 474: } |
| 475: else |
| 476: // Set all their posts to guest |
| 477: $db->query('UPDATE '.$db->prefix.'posts SET poster_id=1 WHERE poster_id IN ('.implode(',', $user_ids).')') or error('Unable to update posts', __FILE__, __LINE__, $db->error()); |
| 478: |
| 479: // Delete the users |
| 480: $db->query('DELETE FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to delete users', __FILE__, __LINE__, $db->error()); |
| 481: |
| 482: // Delete user avatars |
| 483: foreach ($user_ids as $user_id) |
| 484: delete_avatar($user_id); |
| 485: |
| 486: // Regenerate the users info cache |
| 487: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 488: require PUN_ROOT.'include/cache.php'; |
| 489: |
| 490: generate_users_info_cache(); |
| 491: |
| 492: redirect('admin_users.php', $lang_admin_users['Users delete redirect']); |
| 493: } |
| 494: |
| 495: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); |
| 496: define('PUN_ACTIVE_PAGE', 'admin'); |
| 497: require PUN_ROOT.'header.php'; |
| 498: |
| 499: generate_admin_menu('users'); |
| 500: |
| 501: ?> |
| 502: <div class="blockform"> |
| 503: <h2><span><?php echo $lang_admin_users['Delete users'] ?></span></h2> |
| 504: <div class="box"> |
| 505: <form name="confirm_del_users" method="post" action="admin_users.php"> |
| 506: <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
| 507: <div class="inform"> |
| 508: <fieldset> |
| 509: <legend><?php echo $lang_admin_users['Confirm delete legend'] ?></legend> |
| 510: <div class="infldset"> |
| 511: <p><?php echo $lang_admin_users['Confirm delete info'] ?></p> |
| 512: <div class="rbox"> |
| 513: <label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_admin_users['Delete posts'] ?><br /></label> |
| 514: </div> |
| 515: <p class="warntext"><strong><?php echo $lang_admin_users['Delete warning'] ?></strong></p> |
| 516: </div> |
| 517: </fieldset> |
| 518: </div> |
| 519: <p class="buttons"><input type="submit" name="delete_users_comply" value="<?php echo $lang_admin_users['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> |
| 520: </form> |
| 521: </div> |
| 522: </div> |
| 523: <div class="clearer"></div> |
| 524: </div> |
| 525: <?php |
| 526: |
| 527: require PUN_ROOT.'footer.php'; |
| 528: } |
| 529: |
| 530: |
| 531: // Ban multiple users |
| 532: else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) |
| 533: { |
| 534: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
| 535: message($lang_common['No permission'], false, '403 Forbidden'); |
| 536: |
| 537: confirm_referrer('admin_users.php'); |
| 538: |
| 539: if (isset($_POST['users'])) |
| 540: { |
| 541: $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); |
| 542: $user_ids = array_map('intval', $user_ids); |
| 543: |
| 544: // Delete invalid IDs |
| 545: $user_ids = array_diff($user_ids, array(0, 1)); |
| 546: } |
| 547: else |
| 548: $user_ids = array(); |
| 549: |
| 550: if (empty($user_ids)) |
| 551: message($lang_admin_users['No users selected']); |
| 552: |
| 553: // Are we trying to ban any admins? |
| 554: $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); |
| 555: if ($db->result($result) > 0) |
| 556: message($lang_admin_users['No ban admins message']); |
| 557: |
| 558: // Also, we cannot ban moderators |
| 559: $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id WHERE g.g_moderator=1 AND u.id IN ('.implode(',', $user_ids).')') or error('Unable to fetch moderator group info', __FILE__, __LINE__, $db->error()); |
| 560: if ($db->result($result) > 0) |
| 561: message($lang_admin_users['No ban mods message']); |
| 562: |
| 563: if (isset($_POST['ban_users_comply'])) |
| 564: { |
| 565: $ban_message = pun_trim($_POST['ban_message']); |
| 566: $ban_expire = pun_trim($_POST['ban_expire']); |
| 567: $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; |
| 568: |
| 569: if ($ban_expire != '' && $ban_expire != 'Never') |
| 570: { |
| 571: $ban_expire = strtotime($ban_expire.' GMT'); |
| 572: |
| 573: if ($ban_expire == -1 || !$ban_expire) |
| 574: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
| 575: |
| 576: $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; |
| 577: $ban_expire -= $diff; |
| 578: |
| 579: if ($ban_expire <= time()) |
| 580: message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); |
| 581: } |
| 582: else |
| 583: $ban_expire = 'NULL'; |
| 584: |
| 585: $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; |
| 586: |
| 587: // Fetch user information |
| 588: $user_info = array(); |
| 589: $result = $db->query('SELECT id, username, email, registration_ip FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 590: while ($cur_user = $db->fetch_assoc($result)) |
| 591: $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); |
| 592: |
| 593: // Overwrite the registration IP with one from the last post (if it exists) |
| 594: if ($ban_the_ip != 0) |
| 595: { |
| 596: $result = $db->query('SELECT p.poster_id, p.poster_ip FROM '.$db->prefix.'posts AS p INNER JOIN (SELECT MAX(id) AS id FROM '.$db->prefix.'posts WHERE poster_id IN ('.implode(',', $user_ids).') GROUP BY poster_id) AS i ON p.id=i.id') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
| 597: while ($cur_address = $db->fetch_assoc($result)) |
| 598: $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; |
| 599: } |
| 600: |
| 601: // And insert the bans! |
| 602: foreach ($user_ids as $user_id) |
| 603: { |
| 604: $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; |
| 605: $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; |
| 606: $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; |
| 607: |
| 608: $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire, ban_creator) VALUES('.$ban_username.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.', '.$pun_user['id'].')') or error('Unable to add ban', __FILE__, __LINE__, $db->error()); |
| 609: } |
| 610: |
| 611: // Regenerate the bans cache |
| 612: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 613: require PUN_ROOT.'include/cache.php'; |
| 614: |
| 615: generate_bans_cache(); |
| 616: |
| 617: redirect('admin_users.php', $lang_admin_users['Users banned redirect']); |
| 618: } |
| 619: |
| 620: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); |
| 621: $focus_element = array('bans2', 'ban_message'); |
| 622: define('PUN_ACTIVE_PAGE', 'admin'); |
| 623: require PUN_ROOT.'header.php'; |
| 624: |
| 625: generate_admin_menu('users'); |
| 626: |
| 627: ?> |
| 628: <div class="blockform"> |
| 629: <h2><span><?php echo $lang_admin_users['Ban users'] ?></span></h2> |
| 630: <div class="box"> |
| 631: <form id="bans2" name="confirm_ban_users" method="post" action="admin_users.php"> |
| 632: <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> |
| 633: <div class="inform"> |
| 634: <fieldset> |
| 635: <legend><?php echo $lang_admin_users['Message expiry subhead'] ?></legend> |
| 636: <div class="infldset"> |
| 637: <table class="aligntop" cellspacing="0"> |
| 638: <tr> |
| 639: <th scope="row"><?php echo $lang_admin_users['Ban message label'] ?></th> |
| 640: <td> |
| 641: <input type="text" name="ban_message" size="50" maxlength="255" tabindex="1" /> |
| 642: <span><?php echo $lang_admin_users['Ban message help'] ?></span> |
| 643: </td> |
| 644: </tr> |
| 645: <tr> |
| 646: <th scope="row"><?php echo $lang_admin_users['Expire date label'] ?></th> |
| 647: <td> |
| 648: <input type="text" name="ban_expire" size="17" maxlength="10" tabindex="2" /> |
| 649: <span><?php echo $lang_admin_users['Expire date help'] ?></span> |
| 650: </td> |
| 651: </tr> |
| 652: <tr> |
| 653: <th scope="row"><?php echo $lang_admin_users['Ban IP label'] ?></th> |
| 654: <td> |
| 655: <input type="radio" name="ban_the_ip" tabindex="3" value="1" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="ban_the_ip" tabindex="4" value="0" checked="checked" /> <strong><?php echo $lang_admin_common['No'] ?></strong> |
| 656: <span><?php echo $lang_admin_users['Ban IP help'] ?></span> |
| 657: </td> |
| 658: </tr> |
| 659: </table> |
| 660: </div> |
| 661: </fieldset> |
| 662: </div> |
| 663: <p class="submitend"><input type="submit" name="ban_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="3" /></p> |
| 664: </form> |
| 665: </div> |
| 666: </div> |
| 667: <div class="clearer"></div> |
| 668: </div> |
| 669: <?php |
| 670: |
| 671: require PUN_ROOT.'footer.php'; |
| 672: } |
| 673: |
| 674: |
256: else if (isset($_GET['find_user'])) | 675: else if (isset($_GET['find_user'])) |
257: { | 676: { |
258: $form = isset($_GET['form']) ? $_GET['form'] : array(); | 677: $form = isset($_GET['form']) ? $_GET['form'] : array(); |
261: $form = array_map('pun_trim', $form); | 680: $form = array_map('pun_trim', $form); |
262: $conditions = $query_str = array(); | 681: $conditions = $query_str = array(); |
263: | 682: |
264: $posts_greater = isset($_GET['posts_greater']) ? trim($_GET['posts_greater']) : ''; | 683: $posts_greater = isset($_GET['posts_greater']) ? pun_trim($_GET['posts_greater']) : ''; |
265: $posts_less = isset($_GET['posts_less']) ? trim($_GET['posts_less']) : ''; | 684: $posts_less = isset($_GET['posts_less']) ? pun_trim($_GET['posts_less']) : ''; |
266: $last_post_after = isset($_GET['last_post_after']) ? trim($_GET['last_post_after']) : ''; | 685: $last_post_after = isset($_GET['last_post_after']) ? pun_trim($_GET['last_post_after']) : ''; |
267: $last_post_before = isset($_GET['last_post_before']) ? trim($_GET['last_post_before']) : ''; | 686: $last_post_before = isset($_GET['last_post_before']) ? pun_trim($_GET['last_post_before']) : ''; |
268: $registered_after = isset($_GET['registered_after']) ? trim($_GET['registered_after']) : ''; | 687: $last_visit_after = isset($_GET['last_visit_after']) ? pun_trim($_GET['last_visit_after']) : ''; |
269: $registered_before = isset($_GET['registered_before']) ? trim($_GET['registered_before']) : ''; | 688: $last_visit_before = isset($_GET['last_visit_before']) ? pun_trim($_GET['last_visit_before']) : ''; |
270: $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'email', 'num_posts', 'last_post', 'registered')) ? $_GET['order_by'] : 'username'; | 689: $registered_after = isset($_GET['registered_after']) ? pun_trim($_GET['registered_after']) : ''; |
| 690: $registered_before = isset($_GET['registered_before']) ? pun_trim($_GET['registered_before']) : ''; |
| 691: $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'email', 'num_posts', 'last_post', 'last_visit', 'registered')) ? $_GET['order_by'] : 'username'; |
271: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; | 692: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
272: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; | 693: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; |
273: | 694: |
275: $query_str[] = 'direction='.$direction; | 696: $query_str[] = 'direction='.$direction; |
276: $query_str[] = 'user_group='.$user_group; | 697: $query_str[] = 'user_group='.$user_group; |
277: | 698: |
278: if (preg_match('/[^0-9]/', $posts_greater.$posts_less)) | 699: if (preg_match('%[^0-9]%', $posts_greater.$posts_less)) |
279: message($lang_admin_users['Non numeric message']); | 700: message($lang_admin_users['Non numeric message']); |
280: | 701: |
281: // Try to convert date/time to timestamps | 702: // Try to convert date/time to timestamps |
299: | 720: |
300: $conditions[] = 'u.last_post<'.$last_post_before; | 721: $conditions[] = 'u.last_post<'.$last_post_before; |
301: } | 722: } |
| 723: if ($last_visit_after != '') |
| 724: { |
| 725: $query_str[] = 'last_visit_after='.$last_visit_after; |
| 726: |
| 727: $last_visit_after = strtotime($last_visit_after); |
| 728: if ($last_visit_after === false || $last_visit_after == -1) |
| 729: message($lang_admin_users['Invalid date time message']); |
| 730: |
| 731: $conditions[] = 'u.last_visit>'.$last_visit_after; |
| 732: } |
| 733: if ($last_visit_before != '') |
| 734: { |
| 735: $query_str[] = 'last_visit_before='.$last_visit_before; |
| 736: |
| 737: $last_visit_before = strtotime($last_visit_before); |
| 738: if ($last_visit_before === false || $last_visit_before == -1) |
| 739: message($lang_admin_users['Invalid date time message']); |
| 740: |
| 741: $conditions[] = 'u.last_visit<'.$last_visit_before; |
| 742: } |
302: if ($registered_after != '') | 743: if ($registered_after != '') |
303: { | 744: { |
304: $query_str[] = 'registered_after='.$registered_after; | 745: $query_str[] = 'registered_after='.$registered_after; |
357: // Generate paging links | 798: // Generate paging links |
358: $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); | 799: $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); |
359: | 800: |
| 801: // Some helper variables for permissions |
| 802: $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; |
| 803: $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); |
| 804: $can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0; |
| 805: |
360: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); | 806: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); |
| 807: $page_head = array('js' => '<script type="text/javascript" src="common.js"></script>'); |
361: define('PUN_ACTIVE_PAGE', 'admin'); | 808: define('PUN_ACTIVE_PAGE', 'admin'); |
362: require PUN_ROOT.'header.php'; | 809: require PUN_ROOT.'header.php'; |
363: | 810: |
377: </div> | 824: </div> |
378: | 825: |
379: | 826: |
| 827: <form id="search-users-form" action="admin_users.php" method="post"> |
380: <div id="users2" class="blocktable"> | 828: <div id="users2" class="blocktable"> |
381: <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> | 829: <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> |
382: <div class="box"> | 830: <div class="box"> |
390: <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> | 838: <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> |
391: <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> | 839: <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> |
392: <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> | 840: <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> |
| 841: <?php if ($can_action): ?> <th class="tcmod" scope="col"><?php echo $lang_admin_users['Select'] ?></th> |
| 842: <?php endif; ?> |
393: </tr> | 843: </tr> |
394: </thead> | 844: </thead> |
395: <tbody> | 845: <tbody> |
416: <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> | 866: <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> |
417: <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> | 867: <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> |
418: <td class="tcr"><?php echo $actions ?></td> | 868: <td class="tcr"><?php echo $actions ?></td> |
| 869: <?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> |
| 870: <?php endif; ?> |
419: </tr> | 871: </tr> |
420: <?php | 872: <?php |
421: | 873: |
435: <div class="inbox crumbsplus"> | 887: <div class="inbox crumbsplus"> |
436: <div class="pagepost"> | 888: <div class="pagepost"> |
437: <p class="pagelink"><?php echo $paging_links ?></p> | 889: <p class="pagelink"><?php echo $paging_links ?></p> |
| 890: <?php if ($can_action): ?> <p class="conr modbuttons"><a href="#" onclick="return select_checkboxes('search-users-form', this, '<?php echo $lang_admin_users['Unselect all'] ?>')"><?php echo $lang_admin_users['Select all'] ?></a> <?php if ($can_ban) : ?><input type="submit" name="ban_users" value="<?php echo $lang_admin_users['Ban'] ?>" /><?php endif; if ($can_delete) : ?><input type="submit" name="delete_users" value="<?php echo $lang_admin_users['Delete'] ?>" /><?php endif; if ($can_move) : ?><input type="submit" name="move_users" value="<?php echo $lang_admin_users['Change group'] ?>" /><?php endif; ?></p> |
| 891: <?php endif; ?> |
438: </div> | 892: </div> |
439: <ul class="crumbs"> | 893: <ul class="crumbs"> |
440: <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> | 894: <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> |
444: <div class="clearer"></div> | 898: <div class="clearer"></div> |
445: </div> | 899: </div> |
446: </div> | 900: </div> |
| 901: </form> |
447: <?php | 902: <?php |
448: | 903: |
449: require PUN_ROOT.'footer.php'; | 904: require PUN_ROOT.'footer.php'; |
542: <span><?php echo $lang_admin_users['Date help'] ?></span></td> | 997: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
543: </tr> | 998: </tr> |
544: <tr> | 999: <tr> |
| 1000: <th scope="row"><?php echo $lang_admin_users['Last visit after label'] ?></th> |
| 1001: <td><input type="text" name="last_visit_after" size="24" maxlength="19" tabindex="17" /> |
| 1002: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
| 1003: </tr> |
| 1004: <tr> |
| 1005: <th scope="row"><?php echo $lang_admin_users['Last visit before label'] ?></th> |
| 1006: <td><input type="text" name="last_visit_before" size="24" maxlength="19" tabindex="18" /> |
| 1007: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
| 1008: </tr> |
| 1009: <tr> |
545: <th scope="row"><?php echo $lang_admin_users['Registered after label'] ?></th> | 1010: <th scope="row"><?php echo $lang_admin_users['Registered after label'] ?></th> |
546: <td><input type="text" name="registered_after" size="24" maxlength="19" tabindex="19" /> | 1011: <td><input type="text" name="registered_after" size="24" maxlength="19" tabindex="19" /> |
547: <span><?php echo $lang_admin_users['Date help'] ?></span></td> | 1012: <span><?php echo $lang_admin_users['Date help'] ?></span></td> |
559: <option value="email"><?php echo $lang_admin_users['Order by e-mail'] ?></option> | 1024: <option value="email"><?php echo $lang_admin_users['Order by e-mail'] ?></option> |
560: <option value="num_posts"><?php echo $lang_admin_users['Order by posts'] ?></option> | 1025: <option value="num_posts"><?php echo $lang_admin_users['Order by posts'] ?></option> |
561: <option value="last_post"><?php echo $lang_admin_users['Order by last post'] ?></option> | 1026: <option value="last_post"><?php echo $lang_admin_users['Order by last post'] ?></option> |
| 1027: <option value="last_visit"><?php echo $lang_admin_users['Order by last visit'] ?></option> |
562: <option value="registered"><?php echo $lang_admin_users['Order by registered'] ?></option> | 1028: <option value="registered"><?php echo $lang_admin_users['Order by registered'] ?></option> |
563: </select>   <select name="direction" tabindex="22"> | 1029: </select>   <select name="direction" tabindex="22"> |
564: <option value="ASC" selected="selected"><?php echo $lang_admin_users['Ascending'] ?></option> | 1030: <option value="ASC" selected="selected"><?php echo $lang_admin_users['Ascending'] ?></option> |
a/db_update.php |
b/db_update.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
8: | 8: |
9: // The FluxBB version this script updates to | 9: // The FluxBB version this script updates to |
10: define('UPDATE_TO', '1.4.3'); | 10: define('UPDATE_TO', '1.4.9'); |
11: | 11: |
12: define('UPDATE_TO_DB_REVISION', 10); | 12: define('UPDATE_TO_DB_REVISION', 15); |
13: define('UPDATE_TO_SI_REVISION', 1); | 13: define('UPDATE_TO_SI_REVISION', 2); |
14: define('UPDATE_TO_PARSER_REVISION', 1); | 14: define('UPDATE_TO_PARSER_REVISION', 2); |
15: | 15: |
16: define('MIN_PHP_VERSION', '4.3.0'); | 16: define('MIN_PHP_VERSION', '4.4.0'); |
17: define('MIN_MYSQL_VERSION', '4.1.2'); | 17: define('MIN_MYSQL_VERSION', '4.1.2'); |
18: define('MIN_PGSQL_VERSION', '7.0.0'); | 18: define('MIN_PGSQL_VERSION', '7.0.0'); |
19: define('PUN_SEARCH_MIN_WORD', 3); | 19: define('PUN_SEARCH_MIN_WORD', 3); |
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 |
174: // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. | 175: // Start a session, used to queue up errors if duplicate users occur when converting from FluxBB v1.2. |
175: session_start(); | 176: session_start(); |
176: | 177: |
177: if (!isset($_SESSION['dupe_users'])) | |
178: $_SESSION['dupe_users'] = array(); | |
179: | |
180: // | 178: // |
181: // Determines whether $str is UTF-8 encoded or not | 179: // Determines whether $str is UTF-8 encoded or not |
182: // | 180: // |
256: // | 254: // |
257: function convert_to_utf8(&$str, $old_charset) | 255: function convert_to_utf8(&$str, $old_charset) |
258: { | 256: { |
259: if ($str === null || $str == '') | 257: if (is_null($str) || $str == '') |
260: return false; | 258: return false; |
261: | 259: |
262: $save = $str; | 260: $save = $str; |
280: $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); | 278: $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); |
281: | 279: |
282: // Replace numeric entities | 280: // Replace numeric entities |
283: $str = preg_replace_callback('/&#([0-9]+);/', 'utf8_callback_1', $str); | 281: $str = preg_replace_callback('%&#([0-9]+);%', 'utf8_callback_1', $str); |
284: $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); |
285: | 283: |
286: // Remove "bad" characters | 284: // Remove "bad" characters |
287: $str = remove_bad_characters($str); | 285: $str = remove_bad_characters($str); |
333: $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()); |
334: while ($cur_column = $db->fetch_assoc($result)) | 332: while ($cur_column = $db->fetch_assoc($result)) |
335: { | 333: { |
336: if ($cur_column['Collation'] === null) | 334: if (is_null($cur_column['Collation'])) |
337: continue; | 335: continue; |
338: | 336: |
339: list($type) = explode('(', $cur_column['Type']); | 337: list($type) = explode('(', $cur_column['Type']); |
342: $allow_null = ($cur_column['Null'] == 'YES'); | 340: $allow_null = ($cur_column['Null'] == 'YES'); |
343: $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'; |
344: | 342: |
345: $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()); |
346: $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()); |
347: } | 345: } |
348: } | 346: } |
361: if ($mysql) | 359: if ($mysql) |
362: { | 360: { |
363: // 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 |
364: if ($start_at === null || $start_at == 0) | 362: if (is_null($start_at) || $start_at == 0) |
365: { | 363: { |
366: // 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 |
367: $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()); |
377: $db->set_names($old_connection_charset); | 375: $db->set_names($old_connection_charset); |
378: | 376: |
379: // Move & Convert everything | 377: // Move & Convert everything |
380: $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()); |
381: | 379: |
382: // 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 |
383: $db->set_names('utf8'); | 381: $db->set_names('utf8'); |
388: | 386: |
389: $temp = array(); | 387: $temp = array(); |
390: foreach ($cur_item as $idx => $value) | 388: foreach ($cur_item as $idx => $value) |
391: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 389: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
392: | 390: |
393: $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)); |
394: | 392: |
395: $end_at = $cur_item[$key]; | 393: $end_at = $cur_item[$key]; |
396: } | 394: } |
397: | 395: |
398: // 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 |
399: if ($start_at !== null && $end_at > 0) | 397: if (!is_null($start_at) && $end_at > 0) |
400: { | 398: { |
401: $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()); |
402: $finished = $db->num_rows($result) == 0; | 400: $finished = $db->num_rows($result) == 0; |
419: else | 417: else |
420: { | 418: { |
421: // Convert everything | 419: // Convert everything |
422: $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()); |
423: while ($cur_item = $db->fetch_assoc($result)) | 421: while ($cur_item = $db->fetch_assoc($result)) |
424: { | 422: { |
425: $cur_item = call_user_func($callback, $cur_item, $old_charset); | 423: $cur_item = call_user_func($callback, $cur_item, $old_charset); |
426: | 424: |
427: $temp = array(); | 425: $temp = array(); |
428: foreach ($cur_item as $idx => $value) | 426: foreach ($cur_item as $idx => $value) |
429: $temp[] = $idx.'='.($value === null ? 'NULL' : '\''.$db->escape($value).'\''); | 427: $temp[] = $idx.'='.(is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''); |
430: | 428: |
431: if (!empty($temp)) | 429: if (!empty($temp)) |
432: $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()); |
434: $end_at = $cur_item[$key]; | 432: $end_at = $cur_item[$key]; |
435: } | 433: } |
436: | 434: |
437: if ($start_at !== null && $end_at > 0) | 435: if (!is_null($start_at) && $end_at > 0) |
438: { | 436: { |
439: $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()); |
440: if ($db->num_rows($result) == 0) | 438: if ($db->num_rows($result) == 0) |
462: // Show form | 460: // Show form |
463: if (empty($stage)) | 461: if (empty($stage)) |
464: { | 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: { |
465: | 505: |
466: ?> | 506: ?> |
467: <!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"> |
468: | 508: |
469: <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'] ?>"> |
470: <head> | 510: <head> |
471: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 511: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
472: <title><?php echo $lang_update['Update'] ?></title> | 512: <title><?php echo $lang_update['Update'] ?></title> |
473: <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" /> |
474: <script type="text/javascript"> | |
475: /* <![CDATA[ */ | |
476: function process_form(the_form) | |
477: { | |
478: var element_names = { | |
479: "req_db_pass": "<?php echo $lang_update['Database password'] ?>", | |
480: "req_old_charset": "<?php echo $lang_update['Current character set label'] ?>" | |
481: }; | |
482: if (document.all || document.getElementById) | |
483: { | |
484: for (var i = 0; i < the_form.length; ++i) | |
485: { | |
486: var elem = the_form.elements[i]; | |
487: if (elem.name && (/^req_/.test(elem.name))) | |
488: { | |
489: if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) | |
490: { | |
491: alert('"' + element_names[elem.name] + '" <?php echo $lang_update['Required field'] ?>'); | |
492: elem.focus(); | |
493: return false; | |
494: } | |
495: } | |
496: } | |
497: } | |
498: return true; | |
499: } | |
500: /* ]]> */ | |
501: </script> | |
502: </head> | 514: </head> |
503: <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;"> |
504: | 516: |
505: <div id="pundb_update" class="pun"> | 517: <div id="pundb_update" class="pun"> |
506: <div class="top-box"><div><!-- Top Corners --></div></div> | 518: <div class="top-box"><div><!-- Top Corners --></div></div> |
519: <div class="blockform"> | 531: <div class="blockform"> |
520: <h2><span><?php echo $lang_update['Update'] ?></span></h2> | 532: <h2><span><?php echo $lang_update['Update'] ?></span></h2> |
521: <div class="box"> | 533: <div class="box"> |
522: <form method="post" action="db_update.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}"> | 534: <form id="install" method="post" action="db_update.php"> |
523: <input type="hidden" name="stage" value="start" /> | 535: <input type="hidden" name="stage" value="start" /> |
524: <div class="inform"> | 536: <div class="inform"> |
525: <fieldset> | 537: <fieldset> |
528: <p><?php echo $lang_update['Database password info'] ?></p> | 540: <p><?php echo $lang_update['Database password info'] ?></p> |
529: <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> |
530: <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> |
531: </div> | 548: </div> |
532: </fieldset> | 549: </fieldset> |
533: </div> | 550: </div> |
590: </html> | 607: </html> |
591: <?php | 608: <?php |
592: | 609: |
| 610: } |
593: $db->end_transaction(); | 611: $db->end_transaction(); |
594: $db->close(); | 612: $db->close(); |
595: exit; | 613: exit; |
603: // 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 |
604: if (isset($_POST['req_db_pass'])) | 622: if (isset($_POST['req_db_pass'])) |
605: { | 623: { |
606: $req_db_pass = strtolower(trim($_POST['req_db_pass'])); | 624: $req_db_pass = strtolower(pun_trim($_POST['req_db_pass'])); |
607: | 625: |
608: switch ($db_type) | 626: switch ($db_type) |
609: { | 627: { |
633: | 651: |
634: fwrite($fh, $uid); | 652: fwrite($fh, $uid); |
635: 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(); |
636: } | 673: } |
637: } | 674: } |
638: else if (isset($_GET['uid'])) | 675: else if (isset($_GET['uid'])) |
639: { | 676: { |
640: $uid = trim($_GET['uid']); | 677: $uid = pun_trim($_GET['uid']); |
641: 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 |
642: $lock_error = true; | 679: $lock_error = true; |
643: } | 680: } |
738: if (!array_key_exists('o_feed_type', $pun_config)) | 775: if (!array_key_exists('o_feed_type', $pun_config)) |
739: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_feed_type\', \'2\')') or error('Unable to insert config value \'o_feed_type\'', __FILE__, __LINE__, $db->error()); | 776: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_feed_type\', \'2\')') or error('Unable to insert config value \'o_feed_type\'', __FILE__, __LINE__, $db->error()); |
740: | 777: |
| 778: // Insert new config option o_feed_ttl |
| 779: if (!array_key_exists('o_feed_ttl', $pun_config)) |
| 780: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_feed_ttl\', \'0\')') or error('Unable to insert config value \'o_feed_ttl\'', __FILE__, __LINE__, $db->error()); |
| 781: |
741: // Insert config option o_base_url which was removed in 1.3 | 782: // Insert config option o_base_url which was removed in 1.3 |
742: if (!array_key_exists('o_base_url', $pun_config)) | 783: if (!array_key_exists('o_base_url', $pun_config)) |
743: { | 784: { |
746: { | 787: { |
747: // Make an educated guess regarding base_url | 788: // Make an educated guess regarding base_url |
748: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol | 789: $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol |
749: $base_url .= preg_replace('/:(80|443)$/', '', $_SERVER['HTTP_HOST']); // host[:port] | 790: $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port] |
750: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path | 791: $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path |
751: } | 792: } |
752: | 793: |
780: $mod_gid = $db->result($result); | 821: $mod_gid = $db->result($result); |
781: else | 822: else |
782: { | 823: { |
783: $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()); |
784: $mod_gid = $db->insert_id(); | 825: $mod_gid = $db->insert_id(); |
785: } | 826: } |
786: | 827: |
943: $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()); |
944: $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()); |
945: | 986: |
946: // 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 |
947: $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()); |
948: $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()); |
949: | 995: |
950: // Add the auto notify/subscription option to the users table | 996: // Add the auto notify/subscription option to the users table |
951: $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()); |
1113: if ($pun_config['o_default_style'] != $default_style) | 1159: if ($pun_config['o_default_style'] != $default_style) |
1114: $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()); |
1115: | 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: |
1116: // Should we do charset conversion or not? | 1166: // Should we do charset conversion or not? |
1117: if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) | 1167: if (strpos($cur_version, '1.2') === 0 && isset($_POST['convert_charset'])) |
1118: $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; | 1168: $query_str = '?stage=conv_bans&req_old_charset='.$old_charset; |
1119: | 1169: |
1120: break; | 1170: break; |
1426: case 'conv_users': | 1476: case 'conv_users': |
1427: $query_str = '?stage=preparse_posts'; | 1477: $query_str = '?stage=preparse_posts'; |
1428: | 1478: |
| 1479: if ($start_at == 0) |
| 1480: $_SESSION['dupe_users'] = array(); |
| 1481: |
1429: function _conv_users($cur_item, $old_charset) | 1482: function _conv_users($cur_item, $old_charset) |
1430: { | 1483: { |
1431: global $lang_update; | 1484: global $lang_update; |
1482: $errors[$id][] = $lang_update['Username too long error']; | 1535: $errors[$id][] = $lang_update['Username too long error']; |
1483: else if (!strcasecmp($username, 'Guest')) | 1536: else if (!strcasecmp($username, 'Guest')) |
1484: $errors[$id][] = $lang_update['Username Guest reserved error']; | 1537: $errors[$id][] = $lang_update['Username Guest reserved error']; |
1485: 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)) |
1486: $errors[$id][] = $lang_update['Username IP format error']; | 1539: $errors[$id][] = $lang_update['Username IP format error']; |
1487: 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) |
1488: $errors[$id][] = $lang_update['Username bad characters error']; | 1541: $errors[$id][] = $lang_update['Username bad characters error']; |
1489: 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)) |
1490: $errors[$id][] = $lang_update['Username BBCode error']; | 1543: $errors[$id][] = $lang_update['Username BBCode error']; |
1491: | 1544: |
1492: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\')) AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 1545: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(ucp_preg_replace('%[^\p{L}\p{N}]%u', '', $username)).'\')) AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
1493: | 1546: |
1494: if ($db->num_rows($result)) | 1547: if ($db->num_rows($result)) |
1495: { | 1548: { |
1504: | 1557: |
1505: $temp = array(); | 1558: $temp = array(); |
1506: foreach ($cur_user as $idx => $value) | 1559: foreach ($cur_user as $idx => $value) |
1507: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 1560: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
1508: | 1561: |
1509: // Insert the renamed user | 1562: // Insert the renamed user |
1510: $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()); |
1559: $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); | 1612: $mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message); |
1560: $mail_message = str_replace('<old_username>', $old_username, $mail_message); | 1613: $mail_message = str_replace('<old_username>', $old_username, $mail_message); |
1561: $mail_message = str_replace('<new_username>', $username, $mail_message); | 1614: $mail_message = str_replace('<new_username>', $username, $mail_message); |
1562: $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); |
1563: | 1616: |
1564: pun_mail($cur_user['email'], $mail_subject, $mail_message); | 1617: pun_mail($cur_user['email'], $mail_subject, $mail_message); |
1565: | 1618: |
1575: ?> | 1628: ?> |
1576: <!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"> |
1577: | 1630: |
1578: <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'] ?>"> |
1579: <head> | 1632: <head> |
1580: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1633: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1581: <title><?php echo $lang_update['Update'] ?></title> | 1634: <title><?php echo $lang_update['Update'] ?></title> |
1590: <div class="blockform"> | 1643: <div class="blockform"> |
1591: <h2><span><?php echo $lang_update['Error converting users'] ?></span></h2> | 1644: <h2><span><?php echo $lang_update['Error converting users'] ?></span></h2> |
1592: <div class="box"> | 1645: <div class="box"> |
1593: <form method="post" action="db_update.php?stage=conv_users_dupe"> | 1646: <form method="post" action="db_update.php?stage=conv_users_dupe&uid=<?php echo $uid ?>"> |
1594: <input type="hidden" name="form_sent" value="1" /> | 1647: <input type="hidden" name="form_sent" value="1" /> |
1595: <div class="inform"> | 1648: <div class="inform"> |
1596: <div class="forminfo"> | 1649: <div class="forminfo"> |
1608: <fieldset> | 1661: <fieldset> |
1609: <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> | 1662: <legend><?php echo pun_htmlspecialchars($cur_user['username']); ?></legend> |
1610: <div class="infldset"> | 1663: <div class="infldset"> |
1611: <label class="required"><strong><?php echo $lang_update['New username'] ?> <span><?php echo $lang_update['required'] ?></span></strong><br /><input type="text" name="<?php echo 'dupe_users['.$id.']'; ?>" value="<?php if (isset($_POST['dupe_users'][$id])) echo pun_htmlspecialchars($_POST['dupe_users'][$id]); ?>" size="25" maxlength="25" /><br /></label> | 1664: <label class="required"><strong><?php echo $lang_update['New username'] ?> <span><?php echo $lang_update['Required'] ?></span></strong><br /><input type="text" name="<?php echo 'dupe_users['.$id.']'; ?>" value="<?php if (isset($_POST['dupe_users'][$id])) echo pun_htmlspecialchars($_POST['dupe_users'][$id]); ?>" size="25" maxlength="25" /><br /></label> |
1612: </div> | 1665: </div> |
1613: </fieldset> | 1666: </fieldset> |
1614: <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> | 1667: <?php if (!empty($errors[$id])): ?> <div class="forminfo error-info"> |
1812: ?> | 1865: ?> |
1813: <!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"> |
1814: | 1867: |
1815: <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'] ?>"> |
1816: <head> | 1869: <head> |
1817: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1870: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1818: <title><?php echo $lang_update['Update'] ?></title> | 1871: <title><?php echo $lang_update['Update'] ?></title> |
1852: $db->close(); | 1905: $db->close(); |
1853: | 1906: |
1854: if ($query_str != '') | 1907: if ($query_str != '') |
a/extern.php |
b/extern.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
119: header('Pragma: public'); | 119: header('Pragma: public'); |
120: | 120: |
121: echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; | 121: echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
122: echo '<rss version="2.0">'."\n"; | 122: echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"; |
123: echo "\t".'<channel>'."\n"; | 123: echo "\t".'<channel>'."\n"; |
| 124: echo "\t\t".'<atom:link href="'.pun_htmlspecialchars(get_current_url()).'" rel="self" type="application/rss+xml" />'."\n"; |
124: echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; | 125: echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n"; |
125: echo "\t\t".'<link>'.pun_htmlspecialchars($feed['link']).'</link>'."\n"; | 126: echo "\t\t".'<link>'.pun_htmlspecialchars($feed['link']).'</link>'."\n"; |
126: echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; | 127: echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n"; |
139: echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; | 140: echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; |
140: echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'dummy@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n"; | 141: echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'dummy@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n"; |
141: echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; | 142: echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; |
142: echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n"; | 143: echo "\t\t\t".'<guid>'.pun_htmlspecialchars($item['link']).'</guid>'."\n"; |
143: | 144: |
144: echo "\t\t".'</item>'."\n"; | 145: echo "\t\t".'</item>'."\n"; |
145: } | 146: } |
381: $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; | 382: $forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')'; |
382: } | 383: } |
383: | 384: |
384: // Setup the feed | 385: // Only attempt to cache if caching is enabled and we have all or a single forum |
385: $feed = array( | 386: if ($pun_config['o_feed_ttl'] > 0 && ($forum_sql == '' || ($forum_name != '' && !isset($_GET['nfid'])))) |
386: 'title' => $pun_config['o_board_title'].$forum_name, | 387: $cache_id = 'feed'.sha1($pun_user['g_id'].'|'.$lang_common['lang_identifier'].'|'.($order_posted ? '1' : '0').($forum_name == '' ? '' : '|'.$fids[0])); |
387: 'link' => get_base_url(true).'/index.php', | |
388: 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), | |
389: 'items' => array(), | |
390: 'type' => 'topics' | |
391: ); | |
392: | |
393: // Fetch $show topics | |
394: $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.$show) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); | |
395: while ($cur_topic = $db->fetch_assoc($result)) | |
396: { | |
397: if ($pun_config['o_censoring'] == '1') | |
398: $cur_topic['subject'] = censor_words($cur_topic['subject']); | |
399: | 388: |
400: $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); | 389: // Load cached feed |
| 390: if (isset($cache_id) && file_exists(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php')) |
| 391: include FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'; |
401: | 392: |
402: $item = array( | 393: $now = time(); |
403: 'id' => $cur_topic['id'], | 394: if (!isset($feed) || $cache_expire < $now) |
404: 'title' => $cur_topic['subject'], | 395: { |
405: 'link' => get_base_url(true).'/viewtopic.php?id='.$cur_topic['id'].($order_posted ? '' : '&action=new'), | 396: // Setup the feed |
406: 'description' => $cur_topic['message'], | 397: $feed = array( |
407: 'author' => array( | 398: 'title' => $pun_config['o_board_title'].$forum_name, |
408: 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] | 399: 'link' => '/index.php', |
409: ), | 400: 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), |
410: 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] | 401: 'items' => array(), |
| 402: 'type' => 'topics' |
411: ); | 403: ); |
412: | 404: |
413: if ($cur_topic['poster_id'] > 1) | 405: // Fetch $show topics |
| 406: $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.(isset($cache_id) ? 50 : $show)) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
| 407: while ($cur_topic = $db->fetch_assoc($result)) |
| 408: { |
| 409: if ($pun_config['o_censoring'] == '1') |
| 410: $cur_topic['subject'] = censor_words($cur_topic['subject']); |
| 411: |
| 412: $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
| 413: |
| 414: $item = array( |
| 415: 'id' => $cur_topic['id'], |
| 416: 'title' => $cur_topic['subject'], |
| 417: 'link' => '/viewtopic.php?id='.$cur_topic['id'].($order_posted ? '' : '&action=new'), |
| 418: 'description' => $cur_topic['message'], |
| 419: 'author' => array( |
| 420: 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] |
| 421: ), |
| 422: 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post'] |
| 423: ); |
| 424: |
| 425: if ($cur_topic['poster_id'] > 1) |
| 426: { |
| 427: if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) |
| 428: $item['author']['email'] = $cur_topic['email']; |
| 429: |
| 430: $item['author']['uri'] = '/profile.php?id='.$cur_topic['poster_id']; |
| 431: } |
| 432: else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) |
| 433: $item['author']['email'] = $cur_topic['poster_email']; |
| 434: |
| 435: $feed['items'][] = $item; |
| 436: } |
| 437: |
| 438: // Output feed as PHP code |
| 439: if (isset($cache_id)) |
414: { | 440: { |
415: if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest']) | 441: $fh = @fopen(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php', 'wb'); |
416: $item['author']['email'] = $cur_topic['email']; | 442: if (!$fh) |
| 443: error('Unable to write feed cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
| 444: |
| 445: fwrite($fh, '<?php'."\n\n".'$feed = '.var_export($feed, true).';'."\n\n".'$cache_expire = '.($now + ($pun_config['o_feed_ttl'] * 60)).';'."\n\n".'?>'); |
| 446: |
| 447: fclose($fh); |
417: | 448: |
418: $item['author']['uri'] = get_base_url(true).'/profile.php?id='.$cur_topic['poster_id']; | 449: if (function_exists('apc_delete_file')) |
| 450: @apc_delete_file(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'); |
419: } | 451: } |
420: else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest']) | 452: } |
421: $item['author']['email'] = $cur_topic['poster_email']; | |
422: | 453: |
423: $feed['items'][] = $item; | 454: // If we only want to show a few items but due to caching we have too many |
| 455: if (count($feed['items']) > $show) |
| 456: $feed['items'] = array_slice($feed['items'], 0, $show); |
| 457: |
| 458: // Prepend the current base URL onto some links. Done after caching to handle http/https correctly |
| 459: $feed['link'] = get_base_url(true).$feed['link']; |
| 460: |
| 461: foreach ($feed['items'] as $key => $item) |
| 462: { |
| 463: $feed['items'][$key]['link'] = get_base_url(true).$item['link']; |
| 464: |
| 465: if (isset($item['author']['uri'])) |
| 466: $feed['items'][$key]['author']['uri'] = get_base_url(true).$item['author']['uri']; |
424: } | 467: } |
425: | 468: |
426: $output_func = 'output_'.$type; | 469: $output_func = 'output_'.$type; |
476: require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; | 519: require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php'; |
477: | 520: |
478: // Collect some statistics from the database | 521: // Collect some statistics from the database |
479: $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED) or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error()); | 522: if (file_exists(FORUM_CACHE_DIR.'cache_users_info.php')) |
480: $stats['total_users'] = $db->result($result); | 523: include FORUM_CACHE_DIR.'cache_users_info.php'; |
481: | 524: |
482: $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED.' ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error()); | 525: if (!defined('PUN_USERS_INFO_LOADED')) |
483: $stats['last_user'] = $db->fetch_assoc($result); | 526: { |
| 527: if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) |
| 528: require PUN_ROOT.'include/cache.php'; |
| 529: |
| 530: generate_users_info_cache(); |
| 531: require FORUM_CACHE_DIR.'cache_users_info.php'; |
| 532: } |
484: | 533: |
485: $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); | 534: $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); |
486: list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); | 535: list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); |
a/header.php |
b/header.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
41: $tpl_main = file_get_contents($tpl_file); | 41: $tpl_main = file_get_contents($tpl_file); |
42: | 42: |
43: // START SUBST - <pun_include "*"> | 43: // START SUBST - <pun_include "*"> |
44: preg_match_all('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $pun_includes, PREG_SET_ORDER); | 44: preg_match_all('%<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">%i', $tpl_main, $pun_includes, PREG_SET_ORDER); |
45: | 45: |
46: foreach ($pun_includes as $cur_include) | 46: foreach ($pun_includes as $cur_include) |
47: { | 47: { |
104: /* <![CDATA[ */ | 104: /* <![CDATA[ */ |
105: function process_form(the_form) | 105: function process_form(the_form) |
106: { | 106: { |
107: var element_names = { | 107: var required_fields = { |
108: <?php | 108: <?php |
109: // Output a JavaScript object with localised field names | 109: // Output a JavaScript object with localised field names |
110: $tpl_temp = count($required_fields); | 110: $tpl_temp = count($required_fields); |
120: for (var i = 0; i < the_form.length; ++i) | 120: for (var i = 0; i < the_form.length; ++i) |
121: { | 121: { |
122: var elem = the_form.elements[i]; | 122: var elem = the_form.elements[i]; |
123: if (elem.name && (/^req_/.test(elem.name))) | 123: if (elem.name && required_fields[elem.name] && !elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) |
124: { | 124: { |
125: if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) | 125: alert('"' + required_fields[elem.name] + '" <?php echo $lang_common['required field'] ?>'); |
126: { | 126: elem.focus(); |
127: alert('"' + element_names[elem.name] + '" <?php echo $lang_common['required field'] ?>'); | 127: return false; |
128: elem.focus(); | |
129: return false; | |
130: } | |
131: } | 128: } |
132: } | 129: } |
133: } | 130: } |
176: | 173: |
177: | 174: |
178: // START SUBST - <pun_navlinks> | 175: // START SUBST - <pun_navlinks> |
179: $tpl_main = str_replace('<pun_navlinks>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main); | 176: $links = array(); |
| 177: |
| 178: // Index should always be displayed |
| 179: $links[] = '<li id="navindex"'.((PUN_ACTIVE_PAGE == 'index') ? ' class="isactive"' : '').'><a href="index.php">'.$lang_common['Index'].'</a></li>'; |
| 180: |
| 181: if ($pun_user['g_read_board'] == '1' && $pun_user['g_view_users'] == '1') |
| 182: $links[] = '<li id="navuserlist"'.((PUN_ACTIVE_PAGE == 'userlist') ? ' class="isactive"' : '').'><a href="userlist.php">'.$lang_common['User list'].'</a></li>'; |
| 183: |
| 184: if ($pun_config['o_rules'] == '1' && (!$pun_user['is_guest'] || $pun_user['g_read_board'] == '1' || $pun_config['o_regs_allow'] == '1')) |
| 185: $links[] = '<li id="navrules"'.((PUN_ACTIVE_PAGE == 'rules') ? ' class="isactive"' : '').'><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a></li>'; |
| 186: |
| 187: if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
| 188: $links[] = '<li id="navsearch"'.((PUN_ACTIVE_PAGE == 'search') ? ' class="isactive"' : '').'><a href="search.php">'.$lang_common['Search'].'</a></li>'; |
| 189: |
| 190: if ($pun_user['is_guest']) |
| 191: { |
| 192: $links[] = '<li id="navregister"'.((PUN_ACTIVE_PAGE == 'register') ? ' class="isactive"' : '').'><a href="register.php">'.$lang_common['Register'].'</a></li>'; |
| 193: $links[] = '<li id="navlogin"'.((PUN_ACTIVE_PAGE == 'login') ? ' class="isactive"' : '').'><a href="login.php">'.$lang_common['Login'].'</a></li>'; |
| 194: } |
| 195: else |
| 196: { |
| 197: $links[] = '<li id="navprofile"'.((PUN_ACTIVE_PAGE == 'profile') ? ' class="isactive"' : '').'><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a></li>'; |
| 198: |
| 199: if ($pun_user['is_admmod']) |
| 200: $links[] = '<li id="navadmin"'.((PUN_ACTIVE_PAGE == 'admin') ? ' class="isactive"' : '').'><a href="admin_index.php">'.$lang_common['Admin'].'</a></li>'; |
| 201: |
| 202: $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'&csrf_token='.pun_hash($pun_user['id'].pun_hash(get_remote_address())).'">'.$lang_common['Logout'].'</a></li>'; |
| 203: } |
| 204: |
| 205: // Are there any additional navlinks we should insert into the array before imploding it? |
| 206: if ($pun_user['g_read_board'] == '1' && $pun_config['o_additional_navlinks'] != '') |
| 207: { |
| 208: if (preg_match_all('%([0-9]+)\s*=\s*(.*?)\n%s', $pun_config['o_additional_navlinks']."\n", $extra_links)) |
| 209: { |
| 210: // Insert any additional links into the $links array (at the correct index) |
| 211: $num_links = count($extra_links[1]); |
| 212: for ($i = 0; $i < $num_links; ++$i) |
| 213: array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i].'</li>')); |
| 214: } |
| 215: } |
| 216: |
| 217: $tpl_temp = '<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n\t\t\t\t".implode("\n\t\t\t\t", $links)."\n\t\t\t".'</ul>'."\n\t\t".'</div>'; |
| 218: $tpl_main = str_replace('<pun_navlinks>', $tpl_temp, $tpl_main); |
180: // END SUBST - <pun_navlinks> | 219: // END SUBST - <pun_navlinks> |
181: | 220: |
182: | 221: |
183: // START SUBST - <pun_status> | 222: // START SUBST - <pun_status> |
184: $page_statusinfo = $page_quicklinks = array(); | 223: $page_statusinfo = $page_topicsearches = array(); |
185: | 224: |
186: if ($pun_user['is_guest']) | 225: if ($pun_user['is_guest']) |
187: $page_statusinfo = '<p>'.$lang_common['Not logged in'].'</p>'; | 226: $page_statusinfo = '<p class="conl">'.$lang_common['Not logged in'].'</p>'; |
188: else | 227: else |
189: { | 228: { |
190: $page_statusinfo[] = '<li><span>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></span></li>'; | 229: $page_statusinfo[] = '<li><span>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></span></li>'; |
204: $page_statusinfo[] = '<li class="maintenancelink"><span><strong><a href="admin_options.php#maintenance">'.$lang_common['Maintenance mode enabled'].'</a></strong></span></li>'; | 243: $page_statusinfo[] = '<li class="maintenancelink"><span><strong><a href="admin_options.php#maintenance">'.$lang_common['Maintenance mode enabled'].'</a></strong></span></li>'; |
205: } | 244: } |
206: | 245: |
207: $script_name = basename($_SERVER['PHP_SELF']); | |
208: if ($script_name == 'index.php') | |
209: $page_quicklinks[] = '<a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a>'; | |
210: | |
211: if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') | 246: if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
212: $page_quicklinks[] = '<a href="search.php?action=show_new" title="'.$lang_common['Show new posts'].'">'.$lang_common['New posts'].'</a>'; | 247: { |
| 248: $page_topicsearches[] = '<a href="search.php?action=show_replies" title="'.$lang_common['Show posted topics'].'">'.$lang_common['Posted topics'].'</a>'; |
| 249: $page_topicsearches[] = '<a href="search.php?action=show_new" title="'.$lang_common['Show new posts'].'">'.$lang_common['New posts header'].'</a>'; |
| 250: } |
213: } | 251: } |
214: | 252: |
215: // Quick searches | 253: // Quick searches |
216: if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') | 254: if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1') |
217: { | 255: { |
218: $page_quicklinks[] = '<a href="search.php?action=show_recent" title="'.$lang_common['Show active topics'].'">'.$lang_common['Active topics'].'</a>'; | 256: $page_topicsearches[] = '<a href="search.php?action=show_recent" title="'.$lang_common['Show active topics'].'">'.$lang_common['Active topics'].'</a>'; |
219: $page_quicklinks[] = '<a href="search.php?action=show_unanswered" title="'.$lang_common['Show unanswered topics'].'">'.$lang_common['Unanswered topics'].'</a>'; | 257: $page_topicsearches[] = '<a href="search.php?action=show_unanswered" title="'.$lang_common['Show unanswered topics'].'">'.$lang_common['Unanswered topics'].'</a>'; |
220: } | 258: } |
221: | 259: |
222: | 260: |
223: // Generate all that jazz | 261: // Generate all that jazz |
224: $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t"; | 262: $tpl_temp = '<div id="brdwelcome" class="inbox">'; |
225: | 263: |
226: // The status information | 264: // The status information |
227: if (is_array($page_statusinfo)) | 265: if (is_array($page_statusinfo)) |
234: $tpl_temp .= "\n\t\t\t".$page_statusinfo; | 272: $tpl_temp .= "\n\t\t\t".$page_statusinfo; |
235: | 273: |
236: // Generate quicklinks | 274: // Generate quicklinks |
237: if (count($page_quicklinks)) | 275: if (!empty($page_topicsearches)) |
238: { | 276: { |
239: $tpl_temp .= "\n\t\t\t".'<ul class="conr">'; | 277: $tpl_temp .= "\n\t\t\t".'<ul class="conr">'; |
240: $tpl_temp .= "\n\t\t\t\t".'<li><span>'.implode('</span></li>'."\n\t\t\t\t".'<li><span>', $page_quicklinks).'</span></li>'; | 278: $tpl_temp .= "\n\t\t\t\t".'<li><span>'.$lang_common['Topic searches'].' '.implode(' | ', $page_topicsearches).'</span></li>'; |
241: $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'; | 279: $tpl_temp .= "\n\t\t\t".'</ul>'; |
242: } | 280: } |
243: | 281: |
244: $tpl_temp .= "\n\t\t".'</div>'; | 282: $tpl_temp .= "\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'; |
245: | 283: |
246: $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main); | 284: $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main); |
247: // END SUBST - <pun_status> | 285: // END SUBST - <pun_status> |
248: | 286: |
249: | 287: |
250: // START SUBST - <pun_announcement> | 288: // START SUBST - <pun_announcement> |
251: if ($pun_config['o_announcement'] == '1') | 289: if ($pun_user['g_read_board'] == '1' && $pun_config['o_announcement'] == '1') |
252: { | 290: { |
253: ob_start(); | 291: ob_start(); |
254: | 292: |
a/include/cache.php |
b/include/cache.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
20: | 20: |
21: // Get the forum config from the DB | 21: // Get the forum config from the DB |
22: $result = $db->query('SELECT * FROM '.$db->prefix.'config', true) or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error()); | 22: $result = $db->query('SELECT * FROM '.$db->prefix.'config', true) or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error()); |
| 23: |
| 24: $output = array(); |
23: while ($cur_config_item = $db->fetch_row($result)) | 25: while ($cur_config_item = $db->fetch_row($result)) |
24: $output[$cur_config_item[0]] = $cur_config_item[1]; | 26: $output[$cur_config_item[0]] = $cur_config_item[1]; |
25: | 27: |
26: // Output config as PHP code | 28: // Output config as PHP code |
27: $fh = @fopen(FORUM_CACHE_DIR.'cache_config.php', 'wb'); | 29: $fh = @fopen(FORUM_CACHE_DIR.'cache_config.php', 'wb'); |
28: if (!$fh) | 30: if (!$fh) |
29: error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 31: error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
30: | 32: |
31: fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>'); | 33: fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>'); |
32: | 34: |
54: // Output ban list as PHP code | 56: // Output ban list as PHP code |
55: $fh = @fopen(FORUM_CACHE_DIR.'cache_bans.php', 'wb'); | 57: $fh = @fopen(FORUM_CACHE_DIR.'cache_bans.php', 'wb'); |
56: if (!$fh) | 58: if (!$fh) |
57: error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 59: error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
58: | 60: |
59: fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>'); | 61: fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>'); |
60: | 62: |
82: // Output ranks list as PHP code | 84: // Output ranks list as PHP code |
83: $fh = @fopen(FORUM_CACHE_DIR.'cache_ranks.php', 'wb'); | 85: $fh = @fopen(FORUM_CACHE_DIR.'cache_ranks.php', 'wb'); |
84: if (!$fh) | 86: if (!$fh) |
85: error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 87: error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
86: | 88: |
87: fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>'); | 89: fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>'); |
88: | 90: |
127: // Output quick jump as PHP code | 129: // Output quick jump as PHP code |
128: $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb'); | 130: $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb'); |
129: if (!$fh) | 131: if (!$fh) |
130: error('Unable to write quick jump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__); | 132: error('Unable to write quick jump cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
131: | 133: |
132: $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n".'$forum_id = isset($forum_id) ? $forum_id : 0;'."\n\n".'?>'; | 134: $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n".'$forum_id = isset($forum_id) ? $forum_id : 0;'."\n\n".'?>'; |
133: | 135: |
134: if ($read_board == '1') | 136: if ($read_board == '1') |
135: { | 137: { |
136: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); | 138: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
137: | 139: |
138: if ($db->num_rows($result)) | 140: if ($db->num_rows($result)) |
139: { | 141: { |
168: } | 170: } |
169: } | 171: } |
170: | 172: |
| 173: |
| 174: // |
| 175: // Generate the censoring cache PHP script |
| 176: // |
| 177: function generate_censoring_cache() |
| 178: { |
| 179: global $db; |
| 180: |
| 181: $result = $db->query('SELECT search_for, replace_with FROM '.$db->prefix.'censoring') or error('Unable to fetch censoring list', __FILE__, __LINE__, $db->error()); |
| 182: $num_words = $db->num_rows($result); |
| 183: |
| 184: $search_for = $replace_with = array(); |
| 185: for ($i = 0; $i < $num_words; $i++) |
| 186: { |
| 187: list($search_for[$i], $replace_with[$i]) = $db->fetch_row($result); |
| 188: $search_for[$i] = '%(?<=[^\p{L}\p{N}])('.str_replace('\*', '[\p{L}\p{N}]*?', preg_quote($search_for[$i], '%')).')(?=[^\p{L}\p{N}])%iu'; |
| 189: } |
| 190: |
| 191: // Output censored words as PHP code |
| 192: $fh = @fopen(FORUM_CACHE_DIR.'cache_censoring.php', 'wb'); |
| 193: if (!$fh) |
| 194: error('Unable to write censoring cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
| 195: |
| 196: fwrite($fh, '<?php'."\n\n".'define(\'PUN_CENSOR_LOADED\', 1);'."\n\n".'$search_for = '.var_export($search_for, true).';'."\n\n".'$replace_with = '.var_export($replace_with, true).';'."\n\n".'?>'); |
| 197: |
| 198: fclose($fh); |
| 199: |
| 200: if (function_exists('apc_delete_file')) |
| 201: @apc_delete_file(FORUM_CACHE_DIR.'cache_censoring.php'); |
| 202: } |
| 203: |
| 204: |
| 205: // |
| 206: // Generate the stopwords cache PHP script |
| 207: // |
| 208: function generate_stopwords_cache() |
| 209: { |
| 210: $stopwords = array(); |
| 211: |
| 212: $d = dir(PUN_ROOT.'lang'); |
| 213: while (($entry = $d->read()) !== false) |
| 214: { |
| 215: if ($entry{0} == '.') |
| 216: continue; |
| 217: |
| 218: if (is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/stopwords.txt')) |
| 219: $stopwords = array_merge($stopwords, file(PUN_ROOT.'lang/'.$entry.'/stopwords.txt')); |
| 220: } |
| 221: $d->close(); |
| 222: |
| 223: // Tidy up and filter the stopwords |
| 224: $stopwords = array_map('pun_trim', $stopwords); |
| 225: $stopwords = array_filter($stopwords); |
| 226: |
| 227: // Output stopwords as PHP code |
| 228: $fh = @fopen(FORUM_CACHE_DIR.'cache_stopwords.php', 'wb'); |
| 229: if (!$fh) |
| 230: error('Unable to write stopwords cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
| 231: |
| 232: fwrite($fh, '<?php'."\n\n".'$cache_id = \''.generate_stopwords_cache_id().'\';'."\n".'if ($cache_id != generate_stopwords_cache_id()) return;'."\n\n".'define(\'PUN_STOPWORDS_LOADED\', 1);'."\n\n".'$stopwords = '.var_export($stopwords, true).';'."\n\n".'?>'); |
| 233: |
| 234: fclose($fh); |
| 235: |
| 236: if (function_exists('apc_delete_file')) |
| 237: @apc_delete_file(FORUM_CACHE_DIR.'cache_stopwords.php'); |
| 238: } |
| 239: |
| 240: |
| 241: // |
| 242: // Load some information about the latest registered users |
| 243: // |
| 244: function generate_users_info_cache() |
| 245: { |
| 246: global $db; |
| 247: |
| 248: $stats = array(); |
| 249: |
| 250: $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED) or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error()); |
| 251: $stats['total_users'] = $db->result($result); |
| 252: |
| 253: $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE group_id!='.PUN_UNVERIFIED.' ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error()); |
| 254: $stats['last_user'] = $db->fetch_assoc($result); |
| 255: |
| 256: // Output users info as PHP code |
| 257: $fh = @fopen(FORUM_CACHE_DIR.'cache_users_info.php', 'wb'); |
| 258: if (!$fh) |
| 259: error('Unable to write users info cache file to cache directory. Please make sure PHP has write access to the directory \''.pun_htmlspecialchars(FORUM_CACHE_DIR).'\'', __FILE__, __LINE__); |
| 260: |
| 261: fwrite($fh, '<?php'."\n\n".'define(\'PUN_USERS_INFO_LOADED\', 1);'."\n\n".'$stats = '.var_export($stats, true).';'."\n\n".'?>'); |
| 262: |
| 263: fclose($fh); |
| 264: |
| 265: if (function_exists('apc_delete_file')) |
| 266: @apc_delete_file(FORUM_CACHE_DIR.'cache_users_info.php'); |
| 267: } |
| 268: |
| 269: |
| 270: // |
| 271: // Delete all feed caches |
| 272: // |
| 273: function clear_feed_cache() |
| 274: { |
| 275: $d = dir(FORUM_CACHE_DIR); |
| 276: while (($entry = $d->read()) !== false) |
| 277: { |
| 278: if (substr($entry, 0, 10) == 'cache_feed' && substr($entry, -4) == '.php') |
| 279: @unlink(FORUM_CACHE_DIR.$entry); |
| 280: } |
| 281: $d->close(); |
| 282: } |
| 283: |
| 284: |
171: define('FORUM_CACHE_FUNCTIONS_LOADED', true); | 285: define('FORUM_CACHE_FUNCTIONS_LOADED', true); |
a/include/dblayer/sqlite.php |
b/include/dblayer/sqlite.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
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) |
182: | 182: |
183: function affected_rows() | 183: function affected_rows() |
184: { | 184: { |
185: return ($this->query_result) ? @sqlite_changes($this->query_result) : false; | 185: return ($this->link_id) ? @sqlite_changes($this->link_id) : false; |
186: } | 186: } |
187: | 187: |
188: | 188: |
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-2010 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
10: if (!defined('PUN')) | 10: if (!defined('PUN')) |
11: exit; | 11: exit; |
12: | 12: |
| 13: require PUN_ROOT.'include/utf8/utils/ascii.php'; |
13: | 14: |
14: // | 15: // |
15: // Validate an email address | 16: // Validate an email address |
19: if (strlen($email) > 80) | 20: if (strlen($email) > 80) |
20: return false; | 21: return false; |
21: | 22: |
22: 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); |
23: } | 24: } |
24: | 25: |
25: | 26: |
43: | 44: |
44: | 45: |
45: // | 46: // |
| 47: // Only encode with base64, if there is at least one unicode character in the string |
| 48: // |
| 49: function encode_mail_text($str) |
| 50: { |
| 51: if (utf8_is_ascii($str)) |
| 52: return $str; |
| 53: |
| 54: return '=?UTF-8?B?'.base64_encode($str).'?='; |
| 55: } |
| 56: |
| 57: |
| 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: // |
46: // Wrapper for PHP's mail() | 210: // Wrapper for PHP's mail() |
47: // | 211: // |
48: 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 = '') |
50: global $pun_config, $lang_common; | 214: global $pun_config, $lang_common; |
51: | 215: |
52: // Default sender/return address | 216: // Default sender/return address |
53: $from_name = str_replace('"', '', $pun_config['o_board_title'].' '.$lang_common['Mailer']); | 217: $from_name = sprintf($lang_common['Mailer'], $pun_config['o_board_title']); |
54: $from_email = $pun_config['o_webmaster_email']; | 218: $from_email = $pun_config['o_webmaster_email']; |
55: | 219: |
56: // Do a little spring cleaning | 220: // Do a little spring cleaning |
57: $to = pun_trim(preg_replace('#[\n\r]+#s', '', $to)); | 221: $to = pun_trim(preg_replace('%[\n\r]+%s', '', $to)); |
58: $subject = pun_trim(preg_replace('#[\n\r]+#s', '', $subject)); | 222: $subject = pun_trim(preg_replace('%[\n\r]+%s', '', $subject)); |
59: $from_email = pun_trim(preg_replace('#[\n\r:]+#s', '', $from_email)); | 223: $from_email = pun_trim(preg_replace('%[\n\r:]+%s', '', $from_email)); |
60: $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))); |
61: $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)); |
62: $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))); |
63: | 227: |
64: // Set up some headers to take advantage of UTF-8 | 228: // Set up some headers to take advantage of UTF-8 |
65: $from = "=?UTF-8?B?".base64_encode($from_name)."?=".' <'.$from_email.'>'; | 229: $from = '"'.encode_mail_text($from_name).'" <'.$from_email.'>'; |
66: $subject = "=?UTF-8?B?".base64_encode($subject)."?="; | 230: $subject = encode_mail_text($subject); |
67: | 231: |
68: $headers = 'From: '.$from."\r\n".'Date: '.gmdate('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset=utf-8'."\r\n".'X-Mailer: FluxBB Mailer'; | 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'; |
69: | 233: |
70: // 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 |
71: if (!empty($reply_to_email)) | 235: if (!empty($reply_to_email)) |
72: { | 236: { |
73: $reply_to = "=?UTF-8?B?".base64_encode($reply_to_name)."?=".' <'.$reply_to_email.'>'; | 237: $reply_to = '"'.encode_mail_text($reply_to_name).'" <'.$reply_to_email.'>'; |
74: | 238: |
75: $headers .= "\r\n".'Reply-To: '.$reply_to; | 239: $headers .= "\r\n".'Reply-To: '.$reply_to; |
76: } | 240: } |
77: | 241: |
78: // 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) |
79: $message = str_replace(array("\n", "\0"), array("\r\n", ''), pun_linebreaks($message)); | 243: $message = str_replace("\0", '', pun_linebreaks($message)); |
80: | 244: |
81: if ($pun_config['o_smtp_host'] != '') | 245: if ($pun_config['o_smtp_host'] != '') |
| 246: { |
| 247: // Headers should be \r\n |
| 248: // Message should&n |