a/admin_options.php |
b/admin_options.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
15: | 15: |
16: | 16: |
17: if ($pun_user['g_id'] != PUN_ADMIN) | 17: if ($pun_user['g_id'] != PUN_ADMIN) |
18: message($lang_common['No permission']); | 18: message($lang_common['No permission'], false, '403 Forbidden'); |
19: | 19: |
20: // Load the admin_options.php language file | 20: // Load the admin_options.php language file |
21: require PUN_ROOT.'lang/'.$admin_language.'/admin_options.php'; | 21: require PUN_ROOT.'lang/'.$admin_language.'/admin_options.php'; |
34: 'default_style' => pun_trim($_POST['form']['default_style']), | 34: 'default_style' => pun_trim($_POST['form']['default_style']), |
35: 'time_format' => pun_trim($_POST['form']['time_format']), | 35: 'time_format' => pun_trim($_POST['form']['time_format']), |
36: 'date_format' => pun_trim($_POST['form']['date_format']), | 36: 'date_format' => pun_trim($_POST['form']['date_format']), |
37: 'timeout_visit' => intval($_POST['form']['timeout_visit']), | 37: 'timeout_visit' => (intval($_POST['form']['timeout_visit']) > 0) ? intval($_POST['form']['timeout_visit']) : 1, |
38: 'timeout_online' => intval($_POST['form']['timeout_online']), | 38: 'timeout_online' => (intval($_POST['form']['timeout_online']) > 0) ? intval($_POST['form']['timeout_online']) : 1, |
39: 'redirect_delay' => intval($_POST['form']['redirect_delay']), | 39: 'redirect_delay' => (intval($_POST['form']['redirect_delay']) >= 0) ? intval($_POST['form']['redirect_delay']) : 0, |
40: 'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1', | 40: 'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1', |
41: 'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1', | 41: 'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1', |
42: 'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1', | 42: 'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1', |
43: 'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1', | 43: 'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1', |
44: 'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1', | 44: 'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1', |
45: 'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1', | 45: 'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1', |
46: 'topic_review' => intval($_POST['form']['topic_review']), | 46: 'topic_review' => (intval($_POST['form']['topic_review']) >= 0) ? intval($_POST['form']['topic_review']) : 0, |
47: 'disp_topics_default' => intval($_POST['form']['disp_topics_default']), | 47: 'disp_topics_default' => intval($_POST['form']['disp_topics_default']), |
48: 'disp_posts_default' => intval($_POST['form']['disp_posts_default']), | 48: 'disp_posts_default' => intval($_POST['form']['disp_posts_default']), |
49: 'indent_num_spaces' => intval($_POST['form']['indent_num_spaces']), | 49: 'indent_num_spaces' => (intval($_POST['form']['indent_num_spaces']) >= 0) ? intval($_POST['form']['indent_num_spaces']) : 0, |
50: 'quote_depth' => intval($_POST['form']['quote_depth']), | 50: 'quote_depth' => (intval($_POST['form']['quote_depth']) > 0) ? intval($_POST['form']['quote_depth']) : 1, |
51: 'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1', | 51: 'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1', |
52: 'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1', | 52: 'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1', |
53: 'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1', | 53: 'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1', |
65: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), | 65: 'mailing_list' => pun_trim($_POST['form']['mailing_list']), |
66: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', | 66: 'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1', |
67: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), | 67: 'avatars_dir' => pun_trim($_POST['form']['avatars_dir']), |
68: 'avatars_width' => intval($_POST['form']['avatars_width']), | 68: 'avatars_width' => (intval($_POST['form']['avatars_width']) > 0) ? intval($_POST['form']['avatars_width']) : 1, |
69: 'avatars_height' => intval($_POST['form']['avatars_height']), | 69: 'avatars_height' => (intval($_POST['form']['avatars_height']) > 0) ? intval($_POST['form']['avatars_height']) : 1, |
70: 'avatars_size' => intval($_POST['form']['avatars_size']), | 70: 'avatars_size' => (intval($_POST['form']['avatars_size']) > 0) ? intval($_POST['form']['avatars_size']) : 1, |
71: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), | 71: 'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])), |
72: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), | 72: 'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])), |
73: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', | 73: 'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1', |
303: <tr> | 303: <tr> |
304: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> | 304: <th scope="row"><?php echo $lang_admin_options['DST label'] ?></th> |
305: <td> | 305: <td> |
306: <input type="radio" name="form[default_dst]" value="1"<?php if ($pun_config['o_default_dst'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[default_dst]" value="0"<?php if ($pun_config['o_default_dst'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 306: <input type="radio" name="form[default_dst]" id="form_default_dst_1" value="1"<?php if ($pun_config['o_default_dst'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_default_dst_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[default_dst]" id="form_default_dst_0" value="0"<?php if ($pun_config['o_default_dst'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_default_dst_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
307: <span><?php echo $lang_admin_options['DST help'] ?></span> | 307: <span><?php echo $lang_admin_options['DST help'] ?></span> |
308: </td> | 308: </td> |
309: </tr> | 309: </tr> |
411: <tr> | 411: <tr> |
412: <th scope="row"><?php echo $lang_admin_options['Version number label'] ?></th> | 412: <th scope="row"><?php echo $lang_admin_options['Version number label'] ?></th> |
413: <td> | 413: <td> |
414: <input type="radio" name="form[show_version]" value="1"<?php if ($pun_config['o_show_version'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_version]" value="0"<?php if ($pun_config['o_show_version'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 414: <input type="radio" name="form[show_version]" id="form_show_version_1" value="1"<?php if ($pun_config['o_show_version'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_version_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_version]" id="form_show_version_0" value="0"<?php if ($pun_config['o_show_version'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_version_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
415: <span><?php echo $lang_admin_options['Version number help'] ?></span> | 415: <span><?php echo $lang_admin_options['Version number help'] ?></span> |
416: </td> | 416: </td> |
417: </tr> | 417: </tr> |
418: <tr> | 418: <tr> |
419: <th scope="row"><?php echo $lang_admin_options['Info in posts label'] ?></th> | 419: <th scope="row"><?php echo $lang_admin_options['Info in posts label'] ?></th> |
420: <td> | 420: <td> |
421: <input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_user_info]" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 421: <input type="radio" name="form[show_user_info]" id="form_show_user_info_1" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_user_info_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_user_info]" id="form_show_user_info_0" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_user_info_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
422: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> | 422: <span><?php echo $lang_admin_options['Info in posts help'] ?></span> |
423: </td> | 423: </td> |
424: </tr> | 424: </tr> |
425: <tr> | 425: <tr> |
426: <th scope="row"><?php echo $lang_admin_options['Post count label'] ?></th> | 426: <th scope="row"><?php echo $lang_admin_options['Post count label'] ?></th> |
427: <td> | 427: <td> |
428: <input type="radio" name="form[show_post_count]" value="1"<?php if ($pun_config['o_show_post_count'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_post_count]" value="0"<?php if ($pun_config['o_show_post_count'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 428: <input type="radio" name="form[show_post_count]" id="form_show_post_count_1" value="1"<?php if ($pun_config['o_show_post_count'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_post_count_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_post_count]" id="form_show_post_count_0" value="0"<?php if ($pun_config['o_show_post_count'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_post_count_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
429: <span><?php echo $lang_admin_options['Post count help'] ?></span> | 429: <span><?php echo $lang_admin_options['Post count help'] ?></span> |
430: </td> | 430: </td> |
431: </tr> | 431: </tr> |
432: <tr> | 432: <tr> |
433: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> | 433: <th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th> |
434: <td> | 434: <td> |
435: <input type="radio" name="form[smilies]" value="1"<?php if ($pun_config['o_smilies'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[smilies]" value="0"<?php if ($pun_config['o_smilies'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 435: <input type="radio" name="form[smilies]" id="form_smilies_1" value="1"<?php if ($pun_config['o_smilies'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[smilies]" id="form_smilies_0" value="0"<?php if ($pun_config['o_smilies'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
436: <span><?php echo $lang_admin_options['Smilies help'] ?></span> | 436: <span><?php echo $lang_admin_options['Smilies help'] ?></span> |
437: </td> | 437: </td> |
438: </tr> | 438: </tr> |
439: <tr> | 439: <tr> |
440: <th scope="row"><?php echo $lang_admin_options['Smilies sigs label'] ?></th> | 440: <th scope="row"><?php echo $lang_admin_options['Smilies sigs label'] ?></th> |
441: <td> | 441: <td> |
442: <input type="radio" name="form[smilies_sig]" value="1"<?php if ($pun_config['o_smilies_sig'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[smilies_sig]" value="0"<?php if ($pun_config['o_smilies_sig'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 442: <input type="radio" name="form[smilies_sig]" id="form_smilies_sig_1" value="1"<?php if ($pun_config['o_smilies_sig'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_sig_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[smilies_sig]" id="form_smilies_sig_0" value="0"<?php if ($pun_config['o_smilies_sig'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_smilies_sig_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
443: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> | 443: <span><?php echo $lang_admin_options['Smilies sigs help'] ?></span> |
444: </td> | 444: </td> |
445: </tr> | 445: </tr> |
446: <tr> | 446: <tr> |
447: <th scope="row"><?php echo $lang_admin_options['Clickable links label'] ?></th> | 447: <th scope="row"><?php echo $lang_admin_options['Clickable links label'] ?></th> |
448: <td> | 448: <td> |
449: <input type="radio" name="form[make_links]" value="1"<?php if ($pun_config['o_make_links'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[make_links]" value="0"<?php if ($pun_config['o_make_links'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 449: <input type="radio" name="form[make_links]" id="form_make_links_1" value="1"<?php if ($pun_config['o_make_links'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_make_links_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[make_links]" id="form_make_links_0" value="0"<?php if ($pun_config['o_make_links'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_make_links_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
450: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> | 450: <span><?php echo $lang_admin_options['Clickable links help'] ?></span> |
451: </td> | 451: </td> |
452: </tr> | 452: </tr> |
497: <tr> | 497: <tr> |
498: <th scope="row"><?php echo $lang_admin_options['Quick post label'] ?></th> | 498: <th scope="row"><?php echo $lang_admin_options['Quick post label'] ?></th> |
499: <td> | 499: <td> |
500: <input type="radio" name="form[quickpost]" value="1"<?php if ($pun_config['o_quickpost'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[quickpost]" value="0"<?php if ($pun_config['o_quickpost'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 500: <input type="radio" name="form[quickpost]" id="form_quickpost_1" value="1"<?php if ($pun_config['o_quickpost'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickpost_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[quickpost]" id="form_quickpost_0" value="0"<?php if ($pun_config['o_quickpost'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickpost_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
501: <span><?php echo $lang_admin_options['Quick post help'] ?></span> | 501: <span><?php echo $lang_admin_options['Quick post help'] ?></span> |
502: </td> | 502: </td> |
503: </tr> | 503: </tr> |
504: <tr> | 504: <tr> |
505: <th scope="row"><?php echo $lang_admin_options['Users online label'] ?></th> | 505: <th scope="row"><?php echo $lang_admin_options['Users online label'] ?></th> |
506: <td> | 506: <td> |
507: <input type="radio" name="form[users_online]" value="1"<?php if ($pun_config['o_users_online'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[users_online]" value="0"<?php if ($pun_config['o_users_online'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 507: <input type="radio" name="form[users_online]" id="form_users_online_1" value="1"<?php if ($pun_config['o_users_online'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_users_online_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[users_online]" id="form_users_online_0" value="0"<?php if ($pun_config['o_users_online'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_users_online_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
508: <span><?php echo $lang_admin_options['Users online help'] ?></span> | 508: <span><?php echo $lang_admin_options['Users online help'] ?></span> |
509: </td> | 509: </td> |
510: </tr> | 510: </tr> |
511: <tr> | 511: <tr> |
512: <th scope="row"><a name="censoring"><?php echo $lang_admin_options['Censor words label'] ?></a></th> | 512: <th scope="row"><a name="censoring"></a><?php echo $lang_admin_options['Censor words label'] ?></th> |
513: <td> | 513: <td> |
514: <input type="radio" name="form[censoring]" value="1"<?php if ($pun_config['o_censoring'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[censoring]" value="0"<?php if ($pun_config['o_censoring'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 514: <input type="radio" name="form[censoring]" id="form_censoring_1" value="1"<?php if ($pun_config['o_censoring'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_censoring_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[censoring]" id="form_censoring_0" value="0"<?php if ($pun_config['o_censoring'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_censoring_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
515: <span><?php printf($lang_admin_options['Censor words help'], '<a href="admin_censoring.php">'.$lang_admin_common['Censoring'].'</a>') ?></span> | 515: <span><?php printf($lang_admin_options['Censor words help'], '<a href="admin_censoring.php">'.$lang_admin_common['Censoring'].'</a>') ?></span> |
516: </td> | 516: </td> |
517: </tr> | 517: </tr> |
518: <tr> | 518: <tr> |
519: <th scope="row"><a name="signatures"><?php echo $lang_admin_options['Signatures label'] ?></a></th> | 519: <th scope="row"><a name="signatures"></a><?php echo $lang_admin_options['Signatures label'] ?></th> |
520: <td> | 520: <td> |
521: <input type="radio" name="form[signatures]" value="1"<?php if ($pun_config['o_signatures'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[signatures]" value="0"<?php if ($pun_config['o_signatures'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 521: <input type="radio" name="form[signatures]" id="form_signatures_1" value="1"<?php if ($pun_config['o_signatures'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_signatures_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[signatures]" id="form_signatures_0" value="0"<?php if ($pun_config['o_signatures'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_signatures_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
522: <span><?php echo $lang_admin_options['Signatures help'] ?></span> | 522: <span><?php echo $lang_admin_options['Signatures help'] ?></span> |
523: </td> | 523: </td> |
524: </tr> | 524: </tr> |
525: <tr> | 525: <tr> |
526: <th scope="row"><a name="ranks"><?php echo $lang_admin_options['User ranks label'] ?></a></th> | 526: <th scope="row"><a name="ranks"></a><?php echo $lang_admin_options['User ranks label'] ?></th> |
527: <td> | 527: <td> |
528: <input type="radio" name="form[ranks]" value="1"<?php if ($pun_config['o_ranks'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[ranks]" value="0"<?php if ($pun_config['o_ranks'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 528: <input type="radio" name="form[ranks]" id="form_ranks_1" value="1"<?php if ($pun_config['o_ranks'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_ranks_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[ranks]" id="form_ranks_0" value="0"<?php if ($pun_config['o_ranks'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_ranks_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
529: <span><?php printf($lang_admin_options['User ranks help'], '<a href="admin_ranks.php">'.$lang_admin_common['Ranks'].'</a>') ?></span> | 529: <span><?php printf($lang_admin_options['User ranks help'], '<a href="admin_ranks.php">'.$lang_admin_common['Ranks'].'</a>') ?></span> |
530: </td> | 530: </td> |
531: </tr> | 531: </tr> |
532: <tr> | 532: <tr> |
533: <th scope="row"><?php echo $lang_admin_options['User has posted label'] ?></th> | 533: <th scope="row"><?php echo $lang_admin_options['User has posted label'] ?></th> |
534: <td> | 534: <td> |
535: <input type="radio" name="form[show_dot]" value="1"<?php if ($pun_config['o_show_dot'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[show_dot]" value="0"<?php if ($pun_config['o_show_dot'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 535: <input type="radio" name="form[show_dot]" id="form_show_dot_1" value="1"<?php if ($pun_config['o_show_dot'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_dot_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[show_dot]" id="form_show_dot_0" value="0"<?php if ($pun_config['o_show_dot'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_show_dot_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
536: <span><?php echo $lang_admin_options['User has posted help'] ?></span> | 536: <span><?php echo $lang_admin_options['User has posted help'] ?></span> |
537: </td> | 537: </td> |
538: </tr> | 538: </tr> |
539: <tr> | 539: <tr> |
540: <th scope="row"><?php echo $lang_admin_options['Topic views label'] ?></th> | 540: <th scope="row"><?php echo $lang_admin_options['Topic views label'] ?></th> |
541: <td> | 541: <td> |
542: <input type="radio" name="form[topic_views]" value="1"<?php if ($pun_config['o_topic_views'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[topic_views]" value="0"<?php if ($pun_config['o_topic_views'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 542: <input type="radio" name="form[topic_views]" id="form_topic_views_1" value="1"<?php if ($pun_config['o_topic_views'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_views_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[topic_views]" id="form_topic_views_0" value="0"<?php if ($pun_config['o_topic_views'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_views_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
543: <span><?php echo $lang_admin_options['Topic views help'] ?></span> | 543: <span><?php echo $lang_admin_options['Topic views help'] ?></span> |
544: </td> | 544: </td> |
545: </tr> | 545: </tr> |
546: <tr> | 546: <tr> |
547: <th scope="row"><?php echo $lang_admin_options['Quick jump label'] ?></th> | 547: <th scope="row"><?php echo $lang_admin_options['Quick jump label'] ?></th> |
548: <td> | 548: <td> |
549: <input type="radio" name="form[quickjump]" value="1"<?php if ($pun_config['o_quickjump'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[quickjump]" value="0"<?php if ($pun_config['o_quickjump'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 549: <input type="radio" name="form[quickjump]" id="form_quickjump_1" value="1"<?php if ($pun_config['o_quickjump'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickjump_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[quickjump]" id="form_quickjump_0" value="0"<?php if ($pun_config['o_quickjump'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_quickjump_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
550: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> | 550: <span><?php echo $lang_admin_options['Quick jump help'] ?></span> |
551: </td> | 551: </td> |
552: </tr> | 552: </tr> |
553: <tr> | 553: <tr> |
554: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> | 554: <th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th> |
555: <td> | 555: <td> |
556: <input type="radio" name="form[gzip]" value="1"<?php if ($pun_config['o_gzip'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[gzip]" value="0"<?php if ($pun_config['o_gzip'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 556: <input type="radio" name="form[gzip]" id="form_gzip_1" value="1"<?php if ($pun_config['o_gzip'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_gzip_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[gzip]" id="form_gzip_0" value="0"<?php if ($pun_config['o_gzip'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_gzip_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
557: <span><?php echo $lang_admin_options['GZip help'] ?></span> | 557: <span><?php echo $lang_admin_options['GZip help'] ?></span> |
558: </td> | 558: </td> |
559: </tr> | 559: </tr> |
560: <tr> | 560: <tr> |
561: <th scope="row"><?php echo $lang_admin_options['Search all label'] ?></th> | 561: <th scope="row"><?php echo $lang_admin_options['Search all label'] ?></th> |
562: <td> | 562: <td> |
563: <input type="radio" name="form[search_all_forums]" value="1"<?php if ($pun_config['o_search_all_forums'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[search_all_forums]" value="0"<?php if ($pun_config['o_search_all_forums'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 563: <input type="radio" name="form[search_all_forums]" id="form_search_all_forums_1" value="1"<?php if ($pun_config['o_search_all_forums'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_search_all_forums_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[search_all_forums]" id="form_search_all_forums_0" value="0"<?php if ($pun_config['o_search_all_forums'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_search_all_forums_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
564: <span><?php echo $lang_admin_options['Search all help'] ?></span> | 564: <span><?php echo $lang_admin_options['Search all help'] ?></span> |
565: </td> | 565: </td> |
566: </tr> | 566: </tr> |
583: <tr> | 583: <tr> |
584: <th scope="row"><?php echo $lang_admin_options['Default feed label'] ?></th> | 584: <th scope="row"><?php echo $lang_admin_options['Default feed label'] ?></th> |
585: <td> | 585: <td> |
586: <input type="radio" name="form[feed_type]" value="0"<?php if ($pun_config['o_feed_type'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['None'] ?></strong>   <input type="radio" name="form[feed_type]" value="1"<?php if ($pun_config['o_feed_type'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['RSS'] ?></strong>   <input type="radio" name="form[feed_type]" value="2"<?php if ($pun_config['o_feed_type'] == '2') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Atom'] ?></strong> | 586: <input type="radio" name="form[feed_type]" id="form_feed_type_0" value="0"<?php if ($pun_config['o_feed_type'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['None'] ?></strong>   <input type="radio" name="form[feed_type]" id="form_feed_type_1" value="1"<?php if ($pun_config['o_feed_type'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_feed_type_0"><strong><?php echo $lang_admin_options['RSS'] ?></strong></label>   <input type="radio" name="form[feed_type]" id="form_feed_type_2" value="2"<?php if ($pun_config['o_feed_type'] == '2') echo ' checked="checked"' ?> /> <label class="conl" for="form_feed_type_1"><strong><?php echo $lang_admin_options['Atom'] ?></strong></label> |
587: <span><?php echo $lang_admin_options['Default feed help'] ?></span> | 587: <span><?php echo $lang_admin_options['Default feed help'] ?></span> |
588: </td> | 588: </td> |
589: </tr> | 589: </tr> |
616: <tr> | 616: <tr> |
617: <th scope="row"><?php echo $lang_admin_options['Reporting method label'] ?></th> | 617: <th scope="row"><?php echo $lang_admin_options['Reporting method label'] ?></th> |
618: <td> | 618: <td> |
619: <input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Internal'] ?></strong>   <input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['By e-mail'] ?></strong>   <input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Both'] ?></strong> | 619: <input type="radio" name="form[report_method]" id="form_report_method_0" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Internal'] ?></strong>   <input type="radio" name="form[report_method]" id="form_report_method_1" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_report_method_0"><strong><?php echo $lang_admin_options['By e-mail'] ?></strong></label>   <input type="radio" name="form[report_method]" id="form_report_method_2" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> <label class="conl" for="form_report_method_1"><strong><?php echo $lang_admin_options['Both'] ?></strong></label> |
620: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> | 620: <span><?php echo $lang_admin_options['Reporting method help'] ?></span> |
621: </td> | 621: </td> |
622: </tr> | 622: </tr> |
639: <tr> | 639: <tr> |
640: <th scope="row"><?php echo $lang_admin_options['Use avatars label'] ?></th> | 640: <th scope="row"><?php echo $lang_admin_options['Use avatars label'] ?></th> |
641: <td> | 641: <td> |
642: <input type="radio" name="form[avatars]" value="1"<?php if ($pun_config['o_avatars'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[avatars]" value="0"<?php if ($pun_config['o_avatars'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 642: <input type="radio" name="form[avatars]" id="form_avatars_1" value="1"<?php if ($pun_config['o_avatars'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_avatars_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[avatars]" id="form_avatars_0" value="0"<?php if ($pun_config['o_avatars'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_avatars_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
643: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> | 643: <span><?php echo $lang_admin_options['Use avatars help'] ?></span> |
644: </td> | 644: </td> |
645: </tr> | 645: </tr> |
697: <tr> | 697: <tr> |
698: <th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th> | 698: <th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th> |
699: <td> | 699: <td> |
700: <input type="radio" name="form[forum_subscriptions]" value="1"<?php if ($pun_config['o_forum_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[forum_subscriptions]" value="0"<?php if ($pun_config['o_forum_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 700: <input type="radio" name="form[forum_subscriptions]" id="form_forum_subscriptions_1" value="1"<?php if ($pun_config['o_forum_subscriptions'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_forum_subscriptions_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[forum_subscriptions]" id="form_forum_subscriptions_0" value="0"<?php if ($pun_config['o_forum_subscriptions'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_forum_subscriptions_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
701: <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> | 701: <span><?php echo $lang_admin_options['Forum subscriptions help'] ?></span> |
702: </td> | 702: </td> |
703: </tr> | 703: </tr> |
704: <tr> | 704: <tr> |
705: <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> | 705: <th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th> |
706: <td> | 706: <td> |
707: <input type="radio" name="form[topic_subscriptions]" value="1"<?php if ($pun_config['o_topic_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[topic_subscriptions]" value="0"<?php if ($pun_config['o_topic_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 707: <input type="radio" name="form[topic_subscriptions]" id="form_topic_subscriptions_1" value="1"<?php if ($pun_config['o_topic_subscriptions'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_subscriptions_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[topic_subscriptions]" id="form_topic_subscriptions_0" value="0"<?php if ($pun_config['o_topic_subscriptions'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_topic_subscriptions_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
708: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> | 708: <span><?php echo $lang_admin_options['Topic subscriptions help'] ?></span> |
709: </td> | 709: </td> |
710: </tr> | 710: </tr> |
725: <tr> | 725: <tr> |
726: <th scope="row"><?php echo $lang_admin_options['SMTP password label'] ?></th> | 726: <th scope="row"><?php echo $lang_admin_options['SMTP password label'] ?></th> |
727: <td> | 727: <td> |
728: <span><input type="checkbox" name="form[smtp_change_pass]" value="1" />  <?php echo $lang_admin_options['SMTP change password help'] ?></span> | 728: <span><input type="checkbox" name="form[smtp_change_pass]" id="form_smtp_change_pass" value="1" />  <label class="conl" for="form_smtp_change_pass"><?php echo $lang_admin_options['SMTP change password help'] ?></label></span> |
729: <?php $smtp_pass = !empty($pun_config['o_smtp_pass']) ? random_key(pun_strlen($pun_config['o_smtp_pass']), true) : ''; ?> | 729: <?php $smtp_pass = !empty($pun_config['o_smtp_pass']) ? random_key(pun_strlen($pun_config['o_smtp_pass']), true) : ''; ?> |
730: <input type="password" name="form[smtp_pass1]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> | 730: <input type="password" name="form[smtp_pass1]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
731: <input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> | 731: <input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" /> |
735: <tr> | 735: <tr> |
736: <th scope="row"><?php echo $lang_admin_options['SMTP SSL label'] ?></th> | 736: <th scope="row"><?php echo $lang_admin_options['SMTP SSL label'] ?></th> |
737: <td> | 737: <td> |
738: <input type="radio" name="form[smtp_ssl]" value="1"<?php if ($pun_config['o_smtp_ssl'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[smtp_ssl]" value="0"<?php if ($pun_config['o_smtp_ssl'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 738: <input type="radio" name="form[smtp_ssl]" id="form_smtp_ssl_1" value="1"<?php if ($pun_config['o_smtp_ssl'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_smtp_ssl_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[smtp_ssl]" id="form_smtp_ssl_0" value="0"<?php if ($pun_config['o_smtp_ssl'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_smtp_ssl_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
739: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> | 739: <span><?php echo $lang_admin_options['SMTP SSL help'] ?></span> |
740: </td> | 740: </td> |
741: </tr> | 741: </tr> |
751: <tr> | 751: <tr> |
752: <th scope="row"><?php echo $lang_admin_options['Allow new label'] ?></th> | 752: <th scope="row"><?php echo $lang_admin_options['Allow new label'] ?></th> |
753: <td> | 753: <td> |
754: <input type="radio" name="form[regs_allow]" value="1"<?php if ($pun_config['o_regs_allow'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[regs_allow]" value="0"<?php if ($pun_config['o_regs_allow'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 754: <input type="radio" name="form[regs_allow]" id="form_regs_allow_1" value="1"<?php if ($pun_config['o_regs_allow'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_allow_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[regs_allow]" id="form_regs_allow_0" value="0"<?php if ($pun_config['o_regs_allow'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_allow_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
755: <span><?php echo $lang_admin_options['Allow new help'] ?></span> | 755: <span><?php echo $lang_admin_options['Allow new help'] ?></span> |
756: </td> | 756: </td> |
757: </tr> | 757: </tr> |
758: <tr> | 758: <tr> |
759: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> | 759: <th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th> |
760: <td> | 760: <td> |
761: <input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 761: <input type="radio" name="form[regs_verify]" id="form_regs_verify_1" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_verify_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[regs_verify]" id="form_regs_verify_0" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_verify_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
762: <span><?php echo $lang_admin_options['Verify help'] ?></span> | 762: <span><?php echo $lang_admin_options['Verify help'] ?></span> |
763: </td> | 763: </td> |
764: </tr> | 764: </tr> |
765: <tr> | 765: <tr> |
766: <th scope="row"><?php echo $lang_admin_options['Report new label'] ?></th> | 766: <th scope="row"><?php echo $lang_admin_options['Report new label'] ?></th> |
767: <td> | 767: <td> |
768: <input type="radio" name="form[regs_report]" value="1"<?php if ($pun_config['o_regs_report'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[regs_report]" value="0"<?php if ($pun_config['o_regs_report'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 768: <input type="radio" name="form[regs_report]" id="form_regs_report_1" value="1"<?php if ($pun_config['o_regs_report'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_report_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[regs_report]" id="form_regs_report_0" value="0"<?php if ($pun_config['o_regs_report'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_regs_report_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
769: <span><?php echo $lang_admin_options['Report new help'] ?></span> | 769: <span><?php echo $lang_admin_options['Report new help'] ?></span> |
770: </td> | 770: </td> |
771: </tr> | 771: </tr> |
772: <tr> | 772: <tr> |
773: <th scope="row"><?php echo $lang_admin_options['Use rules label'] ?></th> | 773: <th scope="row"><?php echo $lang_admin_options['Use rules label'] ?></th> |
774: <td> | 774: <td> |
775: <input type="radio" name="form[rules]" value="1"<?php if ($pun_config['o_rules'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[rules]" value="0"<?php if ($pun_config['o_rules'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 775: <input type="radio" name="form[rules]" id="form_rules_1" value="1"<?php if ($pun_config['o_rules'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_rules_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[rules]" id="form_rules_0" value="0"<?php if ($pun_config['o_rules'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_rules_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
776: <span><?php echo $lang_admin_options['Use rules help'] ?></span> | 776: <span><?php echo $lang_admin_options['Use rules help'] ?></span> |
777: </td> | 777: </td> |
778: </tr> | 778: </tr> |
787: <th scope="row"><?php echo $lang_admin_options['E-mail default label'] ?></th> | 787: <th scope="row"><?php echo $lang_admin_options['E-mail default label'] ?></th> |
788: <td> | 788: <td> |
789: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> | 789: <span><?php echo $lang_admin_options['E-mail default help'] ?></span> |
790: <input type="radio" name="form[default_email_setting]" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Display e-mail label'] ?><br /> | 790: <input type="radio" name="form[default_email_setting]" id="form_default_email_setting_0" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Display e-mail label'] ?><br /> |
791: <input type="radio" name="form[default_email_setting]" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide allow form label'] ?><br /> | 791: <input type="radio" name="form[default_email_setting]" id="form_default_email_setting_1" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide allow form label'] ?><br /> |
792: <input type="radio" name="form[default_email_setting]" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide both label'] ?><br /> | 792: <input type="radio" name="form[default_email_setting]" id="form_default_email_setting_2" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide both label'] ?><br /> |
793: </td> | 793: </td> |
794: </tr> | 794: </tr> |
795: </table> | 795: </table> |
804: <tr> | 804: <tr> |
805: <th scope="row"><?php echo $lang_admin_options['Display announcement label'] ?></th> | 805: <th scope="row"><?php echo $lang_admin_options['Display announcement label'] ?></th> |
806: <td> | 806: <td> |
807: <input type="radio" name="form[announcement]" value="1"<?php if ($pun_config['o_announcement'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[announcement]" value="0"<?php if ($pun_config['o_announcement'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 807: <input type="radio" name="form[announcement]" id="form_announcement_1" value="1"<?php if ($pun_config['o_announcement'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_announcement_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[announcement]" id="form_announcement_0" value="0"<?php if ($pun_config['o_announcement'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_announcement_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
808: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> | 808: <span><?php echo $lang_admin_options['Display announcement help'] ?></span> |
809: </td> | 809: </td> |
810: </tr> | 810: </tr> |
825: <div class="infldset"> | 825: <div class="infldset"> |
826: <table class="aligntop" cellspacing="0"> | 826: <table class="aligntop" cellspacing="0"> |
827: <tr> | 827: <tr> |
828: <th scope="row"><a name="maintenance"><?php echo $lang_admin_options['Maintenance mode label'] ?></a></th> | 828: <th scope="row"><a name="maintenance"></a><?php echo $lang_admin_options['Maintenance mode label'] ?></th> |
829: <td> | 829: <td> |
830: <input type="radio" name="form[maintenance]" value="1"<?php if ($pun_config['o_maintenance'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="form[maintenance]" value="0"<?php if ($pun_config['o_maintenance'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong> | 830: <input type="radio" name="form[maintenance]" id="form_maintenance_1" value="1"<?php if ($pun_config['o_maintenance'] == '1') echo ' checked="checked"' ?> /> <label class="conl" for="form_maintenance_1"><strong><?php echo $lang_admin_common['Yes'] ?></strong></label>   <input type="radio" name="form[maintenance]" id="form_maintenance_0" value="0"<?php if ($pun_config['o_maintenance'] == '0') echo ' checked="checked"' ?> /> <label class="conl" for="form_maintenance_0"><strong><?php echo $lang_admin_common['No'] ?></strong></label> |
831: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> | 831: <span><?php echo $lang_admin_options['Maintenance mode help'] ?></span> |
832: </td> | 832: </td> |
833: </tr> | 833: </tr> |
a/admin_users.php |
b/admin_users.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
15: | 15: |
16: | 16: |
17: if (!$pun_user['is_admmod']) | 17: if (!$pun_user['is_admmod']) |
18: message($lang_common['No permission']); | 18: message($lang_common['No permission'], false, '403 Forbidden'); |
19: | 19: |
20: // Load the admin_users.php language file | 20: // Load the admin_users.php language file |
21: require PUN_ROOT.'lang/'.$admin_language.'/admin_users.php'; | 21: require PUN_ROOT.'lang/'.$admin_language.'/admin_users.php'; |
123: | 123: |
124: if (isset($_GET['show_users'])) | 124: if (isset($_GET['show_users'])) |
125: { | 125: { |
126: $ip = trim($_GET['show_users']); | 126: $ip = pun_trim($_GET['show_users']); |
127: | 127: |
128: if (!@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $ip) && !@preg_match('%^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$%', $ip)) | 128: if (!@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $ip) && !@preg_match('%^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$%', $ip)) |
129: message($lang_admin_users['Bad IP message']); | 129: message($lang_admin_users['Bad IP message']); |
257: else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) | 257: else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) |
258: { | 258: { |
259: if ($pun_user['g_id'] > PUN_ADMIN) | 259: if ($pun_user['g_id'] > PUN_ADMIN) |
260: message($lang_common['No permission']); | 260: message($lang_common['No permission'], false, '403 Forbidden'); |
261: | 261: |
262: confirm_referrer('admin_users.php'); | 262: confirm_referrer('admin_users.php'); |
263: | 263: |
383: else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) | 383: else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) |
384: { | 384: { |
385: if ($pun_user['g_id'] > PUN_ADMIN) | 385: if ($pun_user['g_id'] > PUN_ADMIN) |
386: message($lang_common['No permission']); | 386: message($lang_common['No permission'], false, '403 Forbidden'); |
387: | 387: |
388: confirm_referrer('admin_users.php'); | 388: confirm_referrer('admin_users.php'); |
389: | 389: |
532: else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) | 532: else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) |
533: { | 533: { |
534: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) | 534: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
535: message($lang_common['No permission']); | 535: message($lang_common['No permission'], false, '403 Forbidden'); |
536: | 536: |
537: confirm_referrer('admin_users.php'); | 537: confirm_referrer('admin_users.php'); |
538: | 538: |
680: $form = array_map('pun_trim', $form); | 680: $form = array_map('pun_trim', $form); |
681: $conditions = $query_str = array(); | 681: $conditions = $query_str = array(); |
682: | 682: |
683: $posts_greater = isset($_GET['posts_greater']) ? trim($_GET['posts_greater']) : ''; | 683: $posts_greater = isset($_GET['posts_greater']) ? pun_trim($_GET['posts_greater']) : ''; |
684: $posts_less = isset($_GET['posts_less']) ? trim($_GET['posts_less']) : ''; | 684: $posts_less = isset($_GET['posts_less']) ? pun_trim($_GET['posts_less']) : ''; |
685: $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']) : ''; |
686: $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']) : ''; |
687: $last_visit_after = isset($_GET['last_visit_after']) ? trim($_GET['last_visit_after']) : ''; | 687: $last_visit_after = isset($_GET['last_visit_after']) ? pun_trim($_GET['last_visit_after']) : ''; |
688: $last_visit_before = isset($_GET['last_visit_before']) ? trim($_GET['last_visit_before']) : ''; | 688: $last_visit_before = isset($_GET['last_visit_before']) ? pun_trim($_GET['last_visit_before']) : ''; |
689: $registered_after = isset($_GET['registered_after']) ? trim($_GET['registered_after']) : ''; | 689: $registered_after = isset($_GET['registered_after']) ? pun_trim($_GET['registered_after']) : ''; |
690: $registered_before = isset($_GET['registered_before']) ? trim($_GET['registered_before']) : ''; | 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'; | 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'; |
692: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; | 692: $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; |
693: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; | 693: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; |
a/db_update.php |
b/db_update.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
8: | 8: |
9: // The FluxBB version this script updates to | 9: // The FluxBB version this script updates to |
10: define('UPDATE_TO', '1.4.6'); | 10: define('UPDATE_TO', '1.4.9'); |
11: | 11: |
12: define('UPDATE_TO_DB_REVISION', 15); | 12: define('UPDATE_TO_DB_REVISION', 15); |
13: define('UPDATE_TO_SI_REVISION', 2); | 13: define('UPDATE_TO_SI_REVISION', 2); |
129: if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) | 129: if (!file_exists(PUN_ROOT.'lang/'.$default_lang.'/update.php')) |
130: $default_lang = 'English'; | 130: $default_lang = 'English'; |
131: | 131: |
| 132: require PUN_ROOT.'lang/'.$default_lang.'/common.php'; |
132: require PUN_ROOT.'lang/'.$default_lang.'/update.php'; | 133: require PUN_ROOT.'lang/'.$default_lang.'/update.php'; |
133: | 134: |
134: // Check current version | 135: // Check current version |
253: // | 254: // |
254: function convert_to_utf8(&$str, $old_charset) | 255: function convert_to_utf8(&$str, $old_charset) |
255: { | 256: { |
256: if ($str === null || $str == '') | 257: if (is_null($str) || $str == '') |
257: return false; | 258: return false; |
258: | 259: |
259: $save = $str; | 260: $save = $str; |
330: $result = $db->query('SHOW FULL COLUMNS FROM '.$table) or error('Unable to fetch column information', __FILE__, __LINE__, $db->error()); | 331: $result = $db->query('SHOW FULL COLUMNS FROM '.$table) or error('Unable to fetch column information', __FILE__, __LINE__, $db->error()); |
331: while ($cur_column = $db->fetch_assoc($result)) | 332: while ($cur_column = $db->fetch_assoc($result)) |
332: { | 333: { |
333: if ($cur_column['Collation'] === null) | 334: if (is_null($cur_column['Collation'])) |
334: continue; | 335: continue; |
335: | 336: |
336: list($type) = explode('(', $cur_column['Type']); | 337: list($type) = explode('(', $cur_column['Type']); |
358: if ($mysql) | 359: if ($mysql) |
359: { | 360: { |
360: // Only set up the tables if we are doing this in 1 go, or its the first go | 361: // Only set up the tables if we are doing this in 1 go, or its the first go |
361: if ($start_at === null || $start_at == 0) | 362: if (is_null($start_at) || $start_at == 0) |
362: { | 363: { |
363: // Drop any temp table that exists, in-case it's left over from a failed update | 364: // Drop any temp table that exists, in-case it's left over from a failed update |
364: $db->drop_table($table.'_utf8', true) or error('Unable to drop left over temp table', __FILE__, __LINE__, $db->error()); | 365: $db->drop_table($table.'_utf8', true) or error('Unable to drop left over temp table', __FILE__, __LINE__, $db->error()); |
374: $db->set_names($old_connection_charset); | 375: $db->set_names($old_connection_charset); |
375: | 376: |
376: // Move & Convert everything | 377: // Move & Convert everything |
377: $result = $db->query('SELECT * FROM '.$table.($start_at === null ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.($start_at === null ? '' : ' LIMIT '.PER_PAGE), false) or error('Unable to select from old table', __FILE__, __LINE__, $db->error()); | 378: $result = $db->query('SELECT * FROM '.$table.(is_null($start_at) ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.(is_null($start_at) ? '' : ' LIMIT '.PER_PAGE), false) or error('Unable to select from old table', __FILE__, __LINE__, $db->error()); |
378: | 379: |
379: // Change back to utf8 mode so we can insert it into the new table | 380: // Change back to utf8 mode so we can insert it into the new table |
380: $db->set_names('utf8'); | 381: $db->set_names('utf8'); |
385: | 386: |
386: $temp = array(); | 387: $temp = array(); |
387: foreach ($cur_item as $idx => $value) | 388: foreach ($cur_item as $idx => $value) |
388: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 389: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
389: | 390: |
390: $db->query('INSERT INTO '.$table.'_utf8('.implode(',', array_keys($temp)).') VALUES ('.implode(',', array_values($temp)).')') or ($error_callback === null ? error('Unable to insert data to new table', __FILE__, __LINE__, $db->error()) : call_user_func($error_callback, $cur_item)); | 391: $db->query('INSERT INTO '.$table.'_utf8('.implode(',', array_keys($temp)).') VALUES ('.implode(',', array_values($temp)).')') or (is_null($error_callback) ? error('Unable to insert data to new table', __FILE__, __LINE__, $db->error()) : call_user_func($error_callback, $cur_item)); |
391: | 392: |
392: $end_at = $cur_item[$key]; | 393: $end_at = $cur_item[$key]; |
393: } | 394: } |
394: | 395: |
395: // If we aren't doing this all in 1 go and $end_at has a value (i.e. we have processed at least 1 row), figure out if we have more to do or not | 396: // If we aren't doing this all in 1 go and $end_at has a value (i.e. we have processed at least 1 row), figure out if we have more to do or not |
396: if ($start_at !== null && $end_at > 0) | 397: if (!is_null($start_at) && $end_at > 0) |
397: { | 398: { |
398: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); | 399: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); |
399: $finished = $db->num_rows($result) == 0; | 400: $finished = $db->num_rows($result) == 0; |
416: else | 417: else |
417: { | 418: { |
418: // Convert everything | 419: // Convert everything |
419: $result = $db->query('SELECT * FROM '.$table.($start_at === null ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.($start_at === null ? '' : ' LIMIT '.PER_PAGE)) or error('Unable to select from table', __FILE__, __LINE__, $db->error()); | 420: $result = $db->query('SELECT * FROM '.$table.(is_null($start_at) ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.(is_null($start_at ) ? '' : ' LIMIT '.PER_PAGE)) or error('Unable to select from table', __FILE__, __LINE__, $db->error()); |
420: while ($cur_item = $db->fetch_assoc($result)) | 421: while ($cur_item = $db->fetch_assoc($result)) |
421: { | 422: { |
422: $cur_item = call_user_func($callback, $cur_item, $old_charset); | 423: $cur_item = call_user_func($callback, $cur_item, $old_charset); |
423: | 424: |
424: $temp = array(); | 425: $temp = array(); |
425: foreach ($cur_item as $idx => $value) | 426: foreach ($cur_item as $idx => $value) |
426: $temp[] = $idx.'='.($value === null ? 'NULL' : '\''.$db->escape($value).'\''); | 427: $temp[] = $idx.'='.(is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''); |
427: | 428: |
428: if (!empty($temp)) | 429: if (!empty($temp)) |
429: $db->query('UPDATE '.$table.' SET '.implode(', ', $temp).' WHERE '.$key.'=\''.$db->escape($cur_item[$key]).'\'') or error('Unable to update data', __FILE__, __LINE__, $db->error()); | 430: $db->query('UPDATE '.$table.' SET '.implode(', ', $temp).' WHERE '.$key.'=\''.$db->escape($cur_item[$key]).'\'') or error('Unable to update data', __FILE__, __LINE__, $db->error()); |
431: $end_at = $cur_item[$key]; | 432: $end_at = $cur_item[$key]; |
432: } | 433: } |
433: | 434: |
434: if ($start_at !== null && $end_at > 0) | 435: if (!is_null($start_at) && $end_at > 0) |
435: { | 436: { |
436: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); | 437: $result = $db->query('SELECT 1 FROM '.$table.' WHERE '.$key.'>'.$end_at.' ORDER BY '.$key.' ASC LIMIT 1') or error('Unable to check for next row', __FILE__, __LINE__, $db->error()); |
437: if ($db->num_rows($result) == 0) | 438: if ($db->num_rows($result) == 0) |
467: $message = str_replace($pattern, $replace, $pun_config['o_maintenance_message']); | 468: $message = str_replace($pattern, $replace, $pun_config['o_maintenance_message']); |
468: | 469: |
469: ?> | 470: ?> |
470: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> | 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'] ?>"> |
471: <head> | 472: <head> |
472: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 473: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
473: <title><?php echo $lang_update['Maintenance'] ?></title> | 474: <title><?php echo $lang_update['Maintenance'] ?></title> |
505: ?> | 506: ?> |
506: <!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"> |
507: | 508: |
508: <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'] ?>"> |
509: <head> | 510: <head> |
510: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 511: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
511: <title><?php echo $lang_update['Update'] ?></title> | 512: <title><?php echo $lang_update['Update'] ?></title> |
620: // 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 |
621: if (isset($_POST['req_db_pass'])) | 622: if (isset($_POST['req_db_pass'])) |
622: { | 623: { |
623: $req_db_pass = strtolower(trim($_POST['req_db_pass'])); | 624: $req_db_pass = strtolower(pun_trim($_POST['req_db_pass'])); |
624: | 625: |
625: switch ($db_type) | 626: switch ($db_type) |
626: { | 627: { |
673: } | 674: } |
674: else if (isset($_GET['uid'])) | 675: else if (isset($_GET['uid'])) |
675: { | 676: { |
676: $uid = trim($_GET['uid']); | 677: $uid = pun_trim($_GET['uid']); |
677: 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 |
678: $lock_error = true; | 679: $lock_error = true; |
679: } | 680: } |
1556: | 1557: |
1557: $temp = array(); | 1558: $temp = array(); |
1558: foreach ($cur_user as $idx => $value) | 1559: foreach ($cur_user as $idx => $value) |
1559: $temp[$idx] = $value === null ? 'NULL' : '\''.$db->escape($value).'\''; | 1560: $temp[$idx] = is_null($value) ? 'NULL' : '\''.$db->escape($value).'\''; |
1560: | 1561: |
1561: // Insert the renamed user | 1562: // Insert the renamed user |
1562: $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()); |
1627: ?> | 1628: ?> |
1628: <!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"> |
1629: | 1630: |
1630: <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'] ?>"> |
1631: <head> | 1632: <head> |
1632: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1633: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1633: <title><?php echo $lang_update['Update'] ?></title> | 1634: <title><?php echo $lang_update['Update'] ?></title> |
1864: ?> | 1865: ?> |
1865: <!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"> |
1866: | 1867: |
1867: <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'] ?>"> |
1868: <head> | 1869: <head> |
1869: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 1870: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1870: <title><?php echo $lang_update['Update'] ?></title> | 1871: <title><?php echo $lang_update['Update'] ?></title> |
1905: | 1906: |
1906: if ($query_str != '') | 1907: if ($query_str != '') |
1907: exit('<script type="text/javascript">window.location="db_update.php'.$query_str.'&uid='.$uid.'"</script><noscript><meta http-equiv="refresh" content="0;url=db_update.php'.$query_str.'&uid='.$uid.'" /></noscript>'); | 1908: exit('<script type="text/javascript">window.location="db_update.php'.$query_str.'&uid='.$uid.'"</script><noscript><meta http-equiv="refresh" content="0;url=db_update.php'.$query_str.'&uid='.$uid.'" /></noscript>'); |
a/include/email.php |
b/include/email.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
60: // | 60: // |
61: function bbcode2email($text, $wrap_length = 72) | 61: function bbcode2email($text, $wrap_length = 72) |
62: { | 62: { |
63: static $base_url; | 63: static $base_url; |
64: | 64: |
65: if (!isset($base_url)) | 65: if (!isset($base_url)) |
66: $base_url = get_base_url(); | 66: $base_url = get_base_url(); |
67: | 67: |
68: $text = pun_trim($text, "\t\n "); | 68: $text = pun_trim($text, "\t\n "); |
69: | 69: |
70: $shortcut_urls = array( | 70: $shortcut_urls = array( |
71: 'topic' => '/viewtopic.php?id=$1', | 71: 'topic' => '/viewtopic.php?id=$1', |
72: 'post' => '/viewtopic.php?pid=$1#p$1', | 72: 'post' => '/viewtopic.php?pid=$1#p$1', |
73: 'forum' => '/viewforum.php?id=$1', | 73: 'forum' => '/viewforum.php?id=$1', |
74: 'user' => '/profile.php?id=$1', | 74: 'user' => '/profile.php?id=$1', |
75: ); | 75: ); |
76: | 76: |
77: // Split code blocks and text so BBcode in codeblocks won't be touched | 77: // Split code blocks and text so BBcode in codeblocks won't be touched |
78: list($code, $text) = extract_blocks($text, '[code]', '[/code]'); | 78: list($code, $text) = extract_blocks($text, '[code]', '[/code]'); |
79: | 79: |
80: // Strip all bbcodes, except the quote, url, img, email, code and list items bbcodes | 80: // Strip all bbcodes, except the quote, url, img, email, code and list items bbcodes |
81: $text = preg_replace(array( | 81: $text = preg_replace(array( |
82: '%\[/?(?!(?:quote|url|topic|post|user|forum|img|email|code|list|\*))[a-z]+(?:=[^\]]+)?\]%i', | 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 | 83: '%\n\[/?list(?:=[^\]]+)?\]%i' // A separate regex for the list tags to get rid of some whitespace |
84: ), '', $text); | 84: ), '', $text); |
85: | 85: |
86: // Match the deepest nested bbcode | 86: // Match the deepest nested bbcode |
87: // An adapted example from Mastering Regular Expressions | 87: // An adapted example from Mastering Regular Expressions |
88: $match_quote_regex = '% | 88: $match_quote_regex = '% |
89: \[(quote|\*|url|img|email|topic|post|user|forum)(?:=([^\]]+))?\] | 89: \[(quote|\*|url|img|email|topic|post|user|forum)(?:=([^\]]+))?\] |
90: ( | 90: ( |
91: (?>[^\[]*) | 91: (?>[^\[]*) |
92: (?> | 92: (?> |
93: (?!\[/?\1(?:=[^\]]+)?\]) | 93: (?!\[/?\1(?:=[^\]]+)?\]) |
94: \[ | 94: \[ |
95: [^\[]* | 95: [^\[]* |
96: )* | 96: )* |
97: ) | 97: ) |
98: \[/\1\] | 98: \[/\1\] |
99: %ix'; | 99: %ix'; |
100: | 100: |
101: $url_index = 1; | 101: $url_index = 1; |
102: $url_stack = array(); | 102: $url_stack = array(); |
103: while (preg_match($match_quote_regex, $text, $matches)) | 103: while (preg_match($match_quote_regex, $text, $matches)) |
104: { | 104: { |
105: // Quotes | 105: // Quotes |
106: if ($matches[1] == 'quote') | 106: if ($matches[1] == 'quote') |
107: { | 107: { |
108: // Put '>' or '> ' at the start of a line | 108: // Put '>' or '> ' at the start of a line |
109: $replacement = preg_replace( | 109: $replacement = preg_replace( |
110: array('%^(?=\>)%m', '%^(?!\>)%m'), | 110: array('%^(?=\>)%m', '%^(?!\>)%m'), |
111: array('>', '> '), | 111: array('>', '> '), |
112: $matches[2]." said:\n".$matches[3]); | 112: $matches[2]." said:\n".$matches[3]); |
113: } | 113: } |
114: | 114: |
115: // List items | 115: // List items |
116: elseif ($matches[1] == '*') | 116: elseif ($matches[1] == '*') |
117: { | 117: { |
118: $replacement = ' * '.$matches[3]; | 118: $replacement = ' * '.$matches[3]; |
119: } | 119: } |
120: | 120: |
121: // URLs and emails | 121: // URLs and emails |
122: elseif (in_array($matches[1], array('url', 'email'))) | 122: elseif (in_array($matches[1], array('url', 'email'))) |
123: { | 123: { |
124: if (!empty($matches[2])) | 124: if (!empty($matches[2])) |
125: { | 125: { |
126: $replacement = '['.$matches[3].']['.$url_index.']'; | 126: $replacement = '['.$matches[3].']['.$url_index.']'; |
127: $url_stack[$url_index] = $matches[2]; | 127: $url_stack[$url_index] = $matches[2]; |
128: $url_index++; | 128: $url_index++; |
129: } | 129: } |
130: else | 130: else |
131: $replacement = '['.$matches[3].']'; | 131: $replacement = '['.$matches[3].']'; |
132: } | 132: } |
133: | 133: |
134: // Images | 134: // Images |
135: elseif ($matches[1] == 'img') | 135: elseif ($matches[1] == 'img') |
136: { | 136: { |
137: if (!empty($matches[2])) | 137: if (!empty($matches[2])) |
138: $replacement = '['.$matches[2].']['.$url_index.']'; | 138: $replacement = '['.$matches[2].']['.$url_index.']'; |
139: else | 139: else |
140: $replacement = '['.basename($matches[3]).']['.$url_index.']'; | 140: $replacement = '['.basename($matches[3]).']['.$url_index.']'; |
141: | 141: |
142: $url_stack[$url_index] = $matches[3]; | 142: $url_stack[$url_index] = $matches[3]; |
143: $url_index++; | 143: $url_index++; |
144: } | 144: } |
145: | 145: |
146: // Topic, post, forum and user URLs | 146: // Topic, post, forum and user URLs |
147: elseif (in_array($matches[1], array('topic', 'post', 'forum', 'user'))) | 147: elseif (in_array($matches[1], array('topic', 'post', 'forum', 'user'))) |
148: { | 148: { |
149: $url = isset($shortcut_urls[$matches[1]]) ? $base_url.$shortcut_urls[$matches[1]] : ''; | 149: $url = isset($shortcut_urls[$matches[1]]) ? $base_url.$shortcut_urls[$matches[1]] : ''; |
150: | 150: |
151: if (!empty($matches[2])) | 151: if (!empty($matches[2])) |
152: { | 152: { |
153: $replacement = '['.$matches[3].']['.$url_index.']'; | 153: $replacement = '['.$matches[3].']['.$url_index.']'; |
154: $url_stack[$url_index] = str_replace('$1', $matches[2], $url); | 154: $url_stack[$url_index] = str_replace('$1', $matches[2], $url); |
155: $url_index++; | 155: $url_index++; |
156: } | 156: } |
157: else | 157: else |
158: $replacement = '['.str_replace('$1', $matches[3], $url).']'; | 158: $replacement = '['.str_replace('$1', $matches[3], $url).']'; |
159: } | 159: } |
160: | 160: |
161: // Update the main text if there is a replacment | 161: // Update the main text if there is a replacment |
162: if (!is_null($replacement)) | 162: if (!is_null($replacement)) |
163: { | 163: { |
164: $text = str_replace($matches[0], $replacement, $text); | 164: $text = str_replace($matches[0], $replacement, $text); |
165: $replacement = null; | 165: $replacement = null; |
166: } | 166: } |
167: } | 167: } |
168: | 168: |
169: // Put code blocks and text together | 169: // Put code blocks and text together |
170: if (isset($code)) | 170: if (isset($code)) |
171: { | 171: { |
172: $parts = explode("\1", $text); | 172: $parts = explode("\1", $text); |
173: $text = ''; | 173: $text = ''; |
174: foreach ($parts as $i => $part) | 174: foreach ($parts as $i => $part) |
175: { | 175: { |
176: $text .= $part; | 176: $text .= $part; |
177: if (isset($code[$i])) | 177: if (isset($code[$i])) |
178: $text .= trim($code[$i], "\n\r"); | 178: $text .= trim($code[$i], "\n\r"); |
179: } | 179: } |
180: } | 180: } |
181: | 181: |
182: // Put URLs at the bottom | 182: // Put URLs at the bottom |
183: if ($url_stack) | 183: if ($url_stack) |
184: { | 184: { |
185: $text .= "\n\n"; | 185: $text .= "\n\n"; |
186: foreach ($url_stack as $i => $url) | 186: foreach ($url_stack as $i => $url) |
187: $text .= "\n".' ['.$i.']: '.$url; | 187: $text .= "\n".' ['.$i.']: '.$url; |
188: } | 188: } |
189: | 189: |
190: // Wrap lines if $wrap_length is higher than -1 | 190: // Wrap lines if $wrap_length is higher than -1 |
191: if ($wrap_length > -1) | 191: if ($wrap_length > -1) |
192: { | 192: { |
193: // Split all lines and wrap them individually | 193: // Split all lines and wrap them individually |
194: $parts = explode("\n", $text); | 194: $parts = explode("\n", $text); |
195: foreach ($parts as $k => $part) | 195: foreach ($parts as $k => $part) |
196: { | 196: { |
197: preg_match('%^(>+ )?(.*)%', $part, $matches); | 197: preg_match('%^(>+ )?(.*)%', $part, $matches); |
198: $parts[$k] = wordwrap($matches[1].$matches[2], $wrap_length - | 198: $parts[$k] = wordwrap($matches[1].$matches[2], $wrap_length - |
199: strlen($matches[1]), "\n".$matches[1]); | 199: strlen($matches[1]), "\n".$matches[1]); |
200: } | 200: } |
201: | 201: |
202: return implode("\n", $parts); | 202: return implode("\n", $parts); |
203: } | 203: } |
204: else | 204: else |
205: return $text; | 205: return $text; |
206: } | 206: } |
207: | 207: |
208: | 208: |
a/include/functions.php |
b/include/functions.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
566: | 566: |
567: $page_title = array_reverse($page_title); | 567: $page_title = array_reverse($page_title); |
568: | 568: |
569: if ($p != null) | 569: if (!is_null($p)) |
570: $page_title[0] .= ' ('.sprintf($lang_common['Page'], forum_number_format($p)).')'; | 570: $page_title[0] .= ' ('.sprintf($lang_common['Page'], forum_number_format($p)).')'; |
571: | 571: |
572: $crumbs = implode($lang_common['Title separator'], $page_title); | 572: $crumbs = implode($lang_common['Title separator'], $page_title); |
619: if (!$cookie_data) | 619: if (!$cookie_data) |
620: return array('topics' => array(), 'forums' => array()); | 620: return array('topics' => array(), 'forums' => array()); |
621: | 621: |
622: if (strlen($cookie_data) > 4048) | 622: if (strlen($cookie_data) > FORUM_MAX_COOKIE_SIZE) |
623: return array('topics' => array(), 'forums' => array()); | 623: return array('topics' => array(), 'forums' => array()); |
624: | 624: |
625: // Unserialize data from cookie | 625: // Unserialize data from cookie |
882: { | 882: { |
883: // Add a previous page link | 883: // Add a previous page link |
884: if ($num_pages > 1 && $cur_page > 1) | 884: if ($num_pages > 1 && $cur_page > 1) |
885: $pages[] = '<a'.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page - 1).'">'.$lang_common['Previous'].'</a>'; | 885: $pages[] = '<a rel="prev" '.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page - 1).'">'.$lang_common['Previous'].'</a>'; |
886: | 886: |
887: if ($cur_page > 3) | 887: if ($cur_page > 3) |
888: { | 888: { |
913: | 913: |
914: // Add a next page link | 914: // Add a next page link |
915: if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages) | 915: if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages) |
916: $pages[] = '<a'.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page +1).'">'.$lang_common['Next'].'</a>'; | 916: $pages[] = '<a rel="next" '.(empty($pages) ? ' class="item1"' : '').' href="'.$link.'&p='.($cur_page +1).'">'.$lang_common['Next'].'</a>'; |
917: } | 917: } |
918: | 918: |
919: return implode(' ', $pages); | 919: return implode(' ', $pages); |
923: // | 923: // |
924: // Display a message | 924: // Display a message |
925: // | 925: // |
926: function message($message, $no_back_link = false) | 926: function message($message, $no_back_link = false, $http_status = null) |
927: { | 927: { |
928: global $db, $lang_common, $pun_config, $pun_start, $tpl_main, $pun_user; | 928: global $db, $lang_common, $pun_config, $pun_start, $tpl_main, $pun_user; |
929: | 929: |
| 930: // Did we receive a custom header? |
| 931: if(!is_null($http_status)) { |
| 932: header('HTTP/1.1 ' . $http_status); |
| 933: } |
| 934: |
930: if (!defined('PUN_HEADER')) | 935: if (!defined('PUN_HEADER')) |
931: { | 936: { |
932: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Info']); | 937: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Info']); |
965: $timestamp += $diff; | 970: $timestamp += $diff; |
966: $now = time(); | 971: $now = time(); |
967: | 972: |
968: if($date_format == null) | 973: if(is_null($date_format)) |
969: $date_format = $forum_date_formats[$pun_user['date_format']]; | 974: $date_format = $forum_date_formats[$pun_user['date_format']]; |
970: | 975: |
971: if($time_format == null) | 976: if(is_null($time_format)) |
972: $time_format = $forum_time_formats[$pun_user['time_format']]; | 977: $time_format = $forum_time_formats[$pun_user['time_format']]; |
973: | 978: |
974: $date = gmdate($date_format, $timestamp); | 979: $date = gmdate($date_format, $timestamp); |
1091: // X-Forwarded-For: client1, proxy1, proxy2 | 1096: // X-Forwarded-For: client1, proxy1, proxy2 |
1092: // where the value is a comma+space separated list of IP addresses, the left-most being the farthest downstream client, | 1097: // where the value is a comma+space separated list of IP addresses, the left-most being the farthest downstream client, |
1093: // and each successive proxy that passed the request adding the IP address where it received the request from. | 1098: // and each successive proxy that passed the request adding the IP address where it received the request from. |
1094: $remote_addr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); | 1099: $forwarded_for = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
1095: $remote_addr = trim($remote_addr[0]); | 1100: $forwarded_for = trim($forwarded_for[0]); |
| 1101: |
| 1102: if (@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $forwarded_for) || @preg_match('%^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$%', $forwarded_for)) |
| 1103: $remote_addr = $forwarded_for; |
1096: } | 1104: } |
1097: } | 1105: } |
1098: | 1106: |
1152: // | 1160: // |
1153: function pun_trim($str, $charlist = false) | 1161: function pun_trim($str, $charlist = false) |
1154: { | 1162: { |
1155: return utf8_trim($str, $charlist); | 1163: return is_string($str) ? utf8_trim($str, $charlist) : ''; |
1156: } | 1164: } |
1157: | 1165: |
1158: // | 1166: // |
1172: // | 1180: // |
1173: function array_insert(&$input, $offset, $element, $key = null) | 1181: function array_insert(&$input, $offset, $element, $key = null) |
1174: { | 1182: { |
1175: if ($key == null) | 1183: if (is_null($key)) |
1176: $key = $offset; | 1184: $key = $offset; |
1177: | 1185: |
1178: // Determine the proper offset if we're using a string | 1186: // Determine the proper offset if we're using a string |
1498: <div> | 1506: <div> |
1499: <?php | 1507: <?php |
1500: | 1508: |
1501: if (defined('PUN_DEBUG') && $file !== null && $line !== null) | 1509: if (defined('PUN_DEBUG') && !is_null($file) && !is_null($line)) |
1502: { | 1510: { |
1503: echo "\t\t".'<strong>File:</strong> '.$file.'<br />'."\n\t\t".'<strong>Line:</strong> '.$line.'<br /><br />'."\n\t\t".'<strong>FluxBB reported</strong>: '.$message."\n"; | 1511: echo "\t\t".'<strong>File:</strong> '.$file.'<br />'."\n\t\t".'<strong>Line:</strong> '.$line.'<br /><br />'."\n\t\t".'<strong>FluxBB reported</strong>: '.$message."\n"; |
1504: | 1512: |
1627: $array = utf8_bad_strip($array); | 1635: $array = utf8_bad_strip($array); |
1628: | 1636: |
1629: // Remove control characters | 1637: // Remove control characters |
1630: $array = preg_replace('%[\x{00}-\x{08}\x{0b}-\x{0c}\x{0e}-\x{1f}]%', '', $array); | 1638: $array = preg_replace('%[\x00-\x08\x0b-\x0c\x0e-\x1f]%', '', $array); |
1631: | 1639: |
1632: // Replace some "bad" characters | 1640: // Replace some "bad" characters |
1633: $array = str_replace(array_keys($bad_utf8_chars), array_values($bad_utf8_chars), $array); | 1641: $array = str_replace(array_keys($bad_utf8_chars), array_values($bad_utf8_chars), $array); |
1648: for ($i = 0; $size > 1024; $i++) | 1656: for ($i = 0; $size > 1024; $i++) |
1649: $size /= 1024; | 1657: $size /= 1024; |
1650: | 1658: |
1651: return sprintf($lang_common['Size unit '.$units[$i]], round($size, 2));; | 1659: return sprintf($lang_common['Size unit '.$units[$i]], round($size, 2)); |
1652: } | 1660: } |
1653: | 1661: |
1654: | 1662: |
1751: // | 1759: // |
1752: // Split text into chunks ($inside contains all text inside $start and $end, and $outside contains all text outside) | 1760: // Split text into chunks ($inside contains all text inside $start and $end, and $outside contains all text outside) |
1753: // | 1761: // |
1754: function split_text($text, $start, $end, &$errors, $retab = true) | 1762: function split_text($text, $start, $end, $retab = true) |
1755: { | 1763: { |
1756: global $pun_config, $lang_common; | 1764: global $pun_config, $lang_common; |
1757: | 1765: |
1779: // Extract blocks from a text with a starting and ending string | 1787: // Extract blocks from a text with a starting and ending string |
1780: // This function always matches the most outer block so nesting is possible | 1788: // This function always matches the most outer block so nesting is possible |
1781: // | 1789: // |
1782: function extract_blocks($text, $start, $end, &$errors = array(), $retab = true) | 1790: function extract_blocks($text, $start, $end, $retab = true) |
1783: { | 1791: { |
1784: global $pun_config; | 1792: global $pun_config; |
1785: | 1793: |
1969: return $replaced; | 1977: return $replaced; |
1970: } | 1978: } |
1971: | 1979: |
| 1980: // |
| 1981: // Replace four-byte characters with a question mark |
| 1982: // |
| 1983: // As MySQL cannot properly handle four-byte characters with the default utf-8 |
| 1984: // charset up until version 5.5.3 (where a special charset has to be used), they |
| 1985: // need to be replaced, by question marks in this case. |
| 1986: // |
| 1987: function strip_bad_multibyte_chars($str) |
| 1988: { |
| 1989: $result = ''; |
| 1990: $length = strlen($str); |
| 1991: |
| 1992: for ($i = 0; $i < $length; $i++) |
| 1993: { |
| 1994: // Replace four-byte characters (11110www 10zzzzzz 10yyyyyy 10xxxxxx) |
| 1995: $ord = ord($str[$i]); |
| 1996: if ($ord >= 240 && $ord <= 244) |
| 1997: { |
| 1998: $result .= '?'; |
| 1999: $i += 3; |
| 2000: } |
| 2001: else |
| 2002: { |
| 2003: $result .= $str[$i]; |
| 2004: } |
| 2005: } |
| 2006: |
| 2007: return $result; |
| 2008: } |
| 2009: |
| 2010: // |
| 2011: // Check whether a file/folder is writable. |
| 2012: // |
| 2013: // This function also works on Windows Server where ACLs seem to be ignored. |
| 2014: // |
| 2015: function forum_is_writable($path) |
| 2016: { |
| 2017: if (is_dir($path)) |
| 2018: { |
| 2019: $path = rtrim($path, '/').'/'; |
| 2020: return forum_is_writable($path.uniqid(mt_rand()).'.tmp'); |
| 2021: } |
| 2022: |
| 2023: // Check temporary file for read/write capabilities |
| 2024: $rm = file_exists($path); |
| 2025: $f = @fopen($path, 'a'); |
| 2026: |
| 2027: if ($f === false) |
| 2028: return false; |
| 2029: |
| 2030: fclose($f); |
| 2031: |
| 2032: if (!$rm) |
| 2033: @unlink($path); |
| 2034: |
| 2035: return true; |
| 2036: } |
| 2037: |
| 2038: |
1972: // DEBUG FUNCTIONS BELOW | 2039: // DEBUG FUNCTIONS BELOW |
1973: | 2040: |
1974: // | 2041: // |
a/include/parser.php |
b/include/parser.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
76: | 76: |
77: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) | 77: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) |
78: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 78: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
79: list($inside, $text) = extract_blocks($text, '[code]', '[/code]', $errors); | 79: list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); |
80: | 80: |
81: // Tidy up lists | 81: // Tidy up lists |
82: $temp = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\', $errors)', $text); | 82: $temp = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\')', $text); |
83: | 83: |
84: // If the regex failed | 84: // If the regex failed |
85: if ($temp === null) | 85: if (is_null($temp)) |
86: $errors[] = $lang_common['BBCode list size error']; | 86: $errors[] = $lang_common['BBCode list size error']; |
87: else | 87: else |
88: $text = str_replace('*'."\0".']', '*]', $temp); | 88: $text = str_replace('*'."\0".']', '*]', $temp); |
115: $text = $temp_text; | 115: $text = $temp_text; |
116: | 116: |
117: // Remove empty tags | 117: // Remove empty tags |
118: while (($new_text = strip_empty_bbcode($text, $errors)) !== false) | 118: while (($new_text = strip_empty_bbcode($text)) !== false) |
119: { | 119: { |
120: if ($new_text != $text) | 120: if ($new_text != $text) |
121: { | 121: { |
137: // | 137: // |
138: // Strip empty bbcode tags from some text | 138: // Strip empty bbcode tags from some text |
139: // | 139: // |
140: function strip_empty_bbcode($text, &$errors) | 140: function strip_empty_bbcode($text) |
141: { | 141: { |
142: // If the message contains a code tag we have to split it up (empty tags within [code][/code] are fine) | 142: // If the message contains a code tag we have to split it up (empty tags within [code][/code] are fine) |
143: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 143: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
144: list($inside, $text) = extract_blocks($text, '[code]', '[/code]', $errors); | 144: list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); |
145: | 145: |
146: // Remove empty tags | 146: // Remove empty tags |
147: while (($new_text = preg_replace('%\[(b|u|s|ins|del|em|i|h|colou?r|quote|img|url|email|list|topic|post|forum|user)(?:\=[^\]]*)?\]\s*\[/\1\]%', '', $text)) !== NULL) | 147: while (!is_null($new_text = preg_replace('%\[(b|u|s|ins|del|em|i|h|colou?r|quote|img|url|email|list|topic|post|forum|user)(?:\=[^\]]*)?\]\s*\[/\1\]%', '', $text))) |
148: { | 148: { |
149: if ($new_text != $text) | 149: if ($new_text != $text) |
150: $text = $new_text; | 150: $text = $new_text; |
153: } | 153: } |
154: | 154: |
155: // If we split up the message before we have to concatenate it together again (code tags) | 155: // If we split up the message before we have to concatenate it together again (code tags) |
156: if (isset($inside)) { | 156: if (isset($inside)) |
157: $parts = explode("\1", $text); | 157: { |
158: $text = ''; | 158: $parts = explode("\1", $text); |
159: foreach ($parts as $i => $part) | 159: $text = ''; |
160: { | 160: foreach ($parts as $i => $part) |
161: $text .= $part; | 161: { |
162: if (isset($inside[$i])) | 162: $text .= $part; |
163: $text .= '[code]'.$inside[$i].'[/code]'; | 163: if (isset($inside[$i])) |
164: } | 164: $text .= '[code]'.$inside[$i].'[/code]'; |
165: } | 165: } |
| 166: } |
166: | 167: |
167: // Remove empty code tags | 168: // Remove empty code tags |
168: while (($new_text = preg_replace('%\[(code)\]\s*\[/\1\]%', '', $text)) !== NULL) | 169: while (!is_null($new_text = preg_replace('%\[(code)\]\s*\[/\1\]%', '', $text))) |
169: { | 170: { |
170: if ($new_text != $text) | 171: if ($new_text != $text) |
171: $text = $new_text; | 172: $text = $new_text; |
352: $current = strtolower($current); | 353: $current = strtolower($current); |
353: | 354: |
354: // This is if we are currently in a tag which escapes other bbcode such as code | 355: // This is if we are currently in a tag which escapes other bbcode such as code |
355: // We keep a cound of ignored bbcodes (code tags) so we can nest them, but | 356: // We keep a count of ignored bbcodes (code tags) so we can nest them, but |
356: // only balanced sets of tags can be nested | 357: // only balanced sets of tags can be nested |
357: if ($current_ignore) | 358: if ($current_ignore) |
358: { | 359: { |
359: // Increase the current ignored tags counter | 360: // Increase the current ignored tags counter |
360: if ('['.$current_ignore.']' == $current) | 361: if ('['.$current_ignore.']' == $current) |
361: { | 362: $count_ignored[$current_tag]++; |
362: if (!isset($count_ignored[$current_tag])) | |
363: $count_ignored[$current_tag] = 2; | |
364: else | |
365: $count_ignored[$current_tag]++; | |
366: } | |
367: | 363: |
368: // Decrease the current ignored tags counter | 364: // Decrease the current ignored tags counter |
369: if ('[/'.$current_ignore.']' == $current) | 365: if ('[/'.$current_ignore.']' == $current) |
531: { | 527: { |
532: // It's an ignore tag so we don't need to worry about what's inside it | 528: // It's an ignore tag so we don't need to worry about what's inside it |
533: $current_ignore = $current_tag; | 529: $current_ignore = $current_tag; |
| 530: $count_ignored[$current_tag] = 1; |
534: $new_text .= $current; | 531: $new_text .= $current; |
535: continue; | 532: continue; |
536: } | 533: } |
601: // | 598: // |
602: // Preparse the contents of [list] bbcode | 599: // Preparse the contents of [list] bbcode |
603: // | 600: // |
604: function preparse_list_tag($content, $type = '*', &$errors) | 601: function preparse_list_tag($content, $type = '*') |
605: { | 602: { |
606: global $lang_common, $re_list; | 603: global $lang_common, $re_list; |
607: | 604: |
610: | 607: |
611: if (strpos($content,'[list') !== false) | 608: if (strpos($content,'[list') !== false) |
612: { | 609: { |
613: $content = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\', $errors)', $content); | 610: $content = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\')', $content); |
614: } | 611: } |
615: | 612: |
616: $items = explode('[*]', str_replace('\"', '"', $content)); | 613: $items = explode('[*]', str_replace('\"', '"', $content)); |
632: function handle_url_tag($url, $link = '', $bbcode = false) | 629: function handle_url_tag($url, $link = '', $bbcode = false) |
633: { | 630: { |
634: $url = pun_trim($url); | 631: $url = pun_trim($url); |
| 632: |
| 633: // Deal with [url][img]http://example.com/test.png[/img][/url] |
| 634: if (preg_match('%<img src=\\\\"(.*?)\\\\"%', $url, $matches)) |
| 635: return handle_url_tag($matches[1], $url, $bbcode); |
| 636: |
635: $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url); | 637: $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url); |
636: if (strpos($url, 'www.') === 0) // If it starts with www, we add http:// | 638: if (strpos($url, 'www.') === 0) // If it starts with www, we add http:// |
637: $full_url = 'http://'.$full_url; | 639: $full_url = 'http://'.$full_url; |
673: { | 675: { |
674: global $lang_common, $pun_user; | 676: global $lang_common, $pun_user; |
675: | 677: |
676: if ($alt == null) | 678: if (is_null($alt)) |
677: $alt = basename($url); | 679: $alt = basename($url); |
678: | 680: |
679: $img_tag = '<a href="'.$url.'"><'.$lang_common['Image link'].' - '.$alt.'></a>'; | 681: $img_tag = '<a href="'.$url.'"><'.$lang_common['Image link'].' - '.$alt.'></a>'; |
776: $pattern[] = '%\[url=([^\[]+?)\](.*?)\[/url\]%e'; | 778: $pattern[] = '%\[url=([^\[]+?)\](.*?)\[/url\]%e'; |
777: $pattern[] = '%\[email\]([^\[]*?)\[/email\]%'; | 779: $pattern[] = '%\[email\]([^\[]*?)\[/email\]%'; |
778: $pattern[] = '%\[email=([^\[]+?)\](.*?)\[/email\]%'; | 780: $pattern[] = '%\[email=([^\[]+?)\](.*?)\[/email\]%'; |
779: $pattern[] = '%\[topic\]([^\[]*?)\[/topic\]%e'; | 781: $pattern[] = '%\[topic\]([1-9]\d*)\[/topic\]%e'; |
780: $pattern[] = '%\[topic=([^\[]+?)\](.*?)\[/topic\]%e'; | 782: $pattern[] = '%\[topic=([1-9]\d*)\](.*?)\[/topic\]%e'; |
781: $pattern[] = '%\[post\]([^\[]*?)\[/post\]%e'; | 783: $pattern[] = '%\[post\]([1-9]\d*)\[/post\]%e'; |
782: $pattern[] = '%\[post=([^\[]+?)\](.*?)\[/post\]%e'; | 784: $pattern[] = '%\[post=([1-9]\d*)\](.*?)\[/post\]%e'; |
783: $pattern[] = '%\[forum\]([^\[]*?)\[/forum\]%e'; | 785: $pattern[] = '%\[forum\]([1-9]\d*)\[/forum\]%e'; |
784: $pattern[] = '%\[forum=([^\[]+?)\](.*?)\[/forum\]%e'; | 786: $pattern[] = '%\[forum=([1-9]\d*)\](.*?)\[/forum\]%e'; |
785: $pattern[] = '%\[user\]([^\[]*?)\[/user\]%e'; | 787: $pattern[] = '%\[user\]([1-9]\d*)\[/user\]%e'; |
786: $pattern[] = '%\[user=([^\[]+?)\](.*?)\[/user\]%e'; | 788: $pattern[] = '%\[user=([1-9]\d*)\](.*?)\[/user\]%e'; |
787: | 789: |
788: $replace[] = 'handle_url_tag(\'$1\')'; | 790: $replace[] = 'handle_url_tag(\'$1\')'; |
789: $replace[] = 'handle_url_tag(\'$1\', \'$2\')'; | 791: $replace[] = 'handle_url_tag(\'$1\', \'$2\')'; |
812: { | 814: { |
813: $text = ' '.$text; | 815: $text = ' '.$text; |
814: | 816: |
815: $text = ucp_preg_replace('%(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(https?|ftp|news){1}://([\p{L}\p{N}\-]+\.([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-])?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])%uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5://$6\', \'$5://$6\', true).stripslashes(\'$4$10$11$12\')', $text); | 817: $text = ucp_preg_replace('%(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(https?|ftp|news){1}://([\p{L}\p{N}\-]+\.([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/(?:[^\s\[]*[^\s.,?!\[;:-])?)?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])%uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5://$6\', \'$5://$6\', true).stripslashes(\'$4$10$11$12\')', $text); |
816: $text = ucp_preg_replace('%(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(www|ftp)\.(([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-])?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])%uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5.$6\', \'$5.$6\', true).stripslashes(\'$4$10$11$12\')', $text); | 818: $text = ucp_preg_replace('%(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(www|ftp)\.(([\p{L}\p{N}\-]+\.)*[\p{L}\p{N}]+(:[0-9]+)?(/(?:[^\s\[]*[^\s.,?!\[;:-])?)?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])%uie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5.$6\', \'$5.$6\', true).stripslashes(\'$4$10$11$12\')', $text); |
817: | 819: |
818: return substr($text, 1); | 820: return substr($text, 1); |
819: } | 821: } |
853: | 855: |
854: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) | 856: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) |
855: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 857: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
856: list($inside, $text) = extract_blocks($text, '[code]', '[/code]', $errors); | 858: list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); |
857: | 859: |
858: if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) | 860: if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) |
859: $text = do_bbcode($text); | 861: $text = do_bbcode($text); |
867: $text = str_replace($pattern, $replace, $text); | 869: $text = str_replace($pattern, $replace, $text); |
868: | 870: |
869: // If we split up the message before we have to concatenate it together again (code tags) | 871: // If we split up the message before we have to concatenate it together again (code tags) |
870: if (isset($inside)) { | 872: if (isset($inside)) |
871: $parts = explode("\1", $text); | 873: { |
872: $text = ''; | 874: $parts = explode("\1", $text); |
873: foreach ($parts as $i => $part) | 875: $text = ''; |
874: { | 876: foreach ($parts as $i => $part) |
875: $text .= $part; | 877: { |
876: if (isset($inside[$i])) | 878: $text .= $part; |
877: { | 879: if (isset($inside[$i])) |
878: $num_lines = (substr_count($inside[$i], "\n")); | 880: { |
879: $text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; | 881: $num_lines = (substr_count($inside[$i], "\n")); |
880: } | 882: $text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; |
881: } | 883: } |
882: } | 884: } |
| 885: } |
883: | 886: |
| 887: return clean_paragraphs($text); |
| 888: } |
| 889: |
| 890: |
| 891: // |
| 892: // Clean up paragraphs and line breaks |
| 893: // |
| 894: function clean_paragraphs($text) |
| 895: { |
884: // Add paragraph tag around post, but make sure there are no empty paragraphs | 896: // Add paragraph tag around post, but make sure there are no empty paragraphs |
885: $text = preg_replace('%<br />\s*?<br />((\s*<br />)*)%i', "</p>$1<p>", $text); | 897: |
886: $text = str_replace('<p><br />', '<p>', $text); | 898: $text = '<p>'.$text.'</p>'; |
887: $text = str_replace('<p></p>', '', '<p>'.$text.'</p>'); | 899: |
| 900: // Replace any breaks next to paragraphs so our replace below catches them |
| 901: $text = preg_replace('%(</?p>)(?:\s*?<br />){1,2}%i', '$1', $text); |
| 902: $text = preg_replace('%(?:<br />\s*?){1,2}(</?p>)%i', '$1', $text); |
| 903: |
| 904: // Remove any empty paragraph tags (inserted via quotes/lists/code/etc) which should be stripped |
| 905: $text = str_replace('<p></p>', '', $text); |
| 906: |
| 907: $text = preg_replace('%<br />\s*?<br />%i', '</p><p>', $text); |
| 908: |
| 909: $text = str_replace('<p><br />', '<br /><p>', $text); |
| 910: $text = str_replace('<br /></p>', '</p><br />', $text); |
| 911: $text = str_replace('<p></p>', '<br /><br />', $text); |
888: | 912: |
889: return $text; | 913: return $text; |
890: } | 914: } |
915: $replace = array('<br />', '    ', '  ', '  '); | 939: $replace = array('<br />', '    ', '  ', '  '); |
916: $text = str_replace($pattern, $replace, $text); | 940: $text = str_replace($pattern, $replace, $text); |
917: | 941: |
918: // Add paragraph tag around post, but make sure there are no empty paragraphs | 942: return clean_paragraphs($text); |
919: $text = preg_replace('%<br />\s*?<br />((\s*<br />)*)%i', "</p>$1<p>", $text); | |
920: $text = str_replace('<p><br />', '<p>', $text); | |
921: $text = str_replace('<p></p>', '', '<p>'.$text.'</p>'); | |
922: | |
923: return $text; | |
924: } | 943: } |
a/install.php |
b/install.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
8: | 8: |
9: // The FluxBB version this script installs | 9: // The FluxBB version this script installs |
10: define('FORUM_VERSION', '1.4.6'); | 10: define('FORUM_VERSION', '1.4.9'); |
11: | 11: |
12: define('FORUM_DB_REVISION', 15); | 12: define('FORUM_DB_REVISION', 15); |
13: define('FORUM_SI_REVISION', 2); | 13: define('FORUM_SI_REVISION', 2); |
63: | 63: |
64: | 64: |
65: // If we've been passed a default language, use it | 65: // If we've been passed a default language, use it |
66: $install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English'; | 66: $install_lang = isset($_REQUEST['install_lang']) ? pun_trim($_REQUEST['install_lang']) : 'English'; |
67: | 67: |
68: // If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English | 68: // If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English |
69: if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php')) | 69: if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php')) |
205: } | 205: } |
206: | 206: |
207: // Check if the cache directory is writable | 207: // Check if the cache directory is writable |
208: if (!@is_writable(FORUM_CACHE_DIR)) | 208: if (!forum_is_writable(FORUM_CACHE_DIR)) |
209: $alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR); | 209: $alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR); |
210: | 210: |
211: // Check if default avatar directory is writable | 211: // Check if default avatar directory is writable |
212: if (!@is_writable(PUN_ROOT.'img/avatars/')) | 212: if (!forum_is_writable(PUN_ROOT.'img/avatars/')) |
213: $alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/'); | 213: $alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/'); |
214: | 214: |
215: if (!isset($_POST['form_sent']) || !empty($alerts)) | 215: if (!isset($_POST['form_sent']) || !empty($alerts)) |
255: /* <![CDATA[ */ | 255: /* <![CDATA[ */ |
256: function process_form(the_form) | 256: function process_form(the_form) |
257: { | 257: { |
258: var element_names = { | 258: var required_fields = { |
259: "req_db_type": "<?php echo $lang_install['Database type'] ?>", | 259: "req_db_type": "<?php echo $lang_install['Database type'] ?>", |
260: "req_db_host": "<?php echo $lang_install['Database server hostname'] ?>", | 260: "req_db_host": "<?php echo $lang_install['Database server hostname'] ?>", |
261: "req_db_name": "<?php echo $lang_install['Database name'] ?>", | 261: "req_db_name": "<?php echo $lang_install['Database name'] ?>", |
262: "db_prefix": "<?php echo $lang_install['Table prefix'] ?>", | |
263: "req_username": "<?php echo $lang_install['Administrator username'] ?>", | 262: "req_username": "<?php echo $lang_install['Administrator username'] ?>", |
264: "req_password1": "<?php echo $lang_install['Administrator password 1'] ?>", | 263: "req_password1": "<?php echo $lang_install['Administrator password 1'] ?>", |
265: "req_password2": "<?php echo $lang_install['Administrator password 2'] ?>", | 264: "req_password2": "<?php echo $lang_install['Administrator password 2'] ?>", |
272: for (var i = 0; i < the_form.length; ++i) | 271: for (var i = 0; i < the_form.length; ++i) |
273: { | 272: { |
274: var elem = the_form.elements[i]; | 273: var elem = the_form.elements[i]; |
275: if (elem.name && (/^req_/.test(elem.name))) | 274: if (elem.name && required_fields[elem.name] && !elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) |
276: { | 275: { |
277: if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) | 276: alert('"' + required_fields[elem.name] + '" <?php echo $lang_install['Required field'] ?>'); |
278: { | 277: elem.focus(); |
279: alert('"' + element_names[elem.name] + '" <?php echo $lang_install['Required field'] ?>'); | 278: return false; |
280: elem.focus(); | |
281: return false; | |
282: } | |
283: } | 279: } |
284: } | 280: } |
285: } | 281: } |
338: <?php endif; ?> | 334: <?php endif; ?> |
339: | 335: |
340: <div class="blockform"> | 336: <div class="blockform"> |
341: <h2><span><?php echo $lang_install['Install'] ?></span></h2> | 337: <h2><span><?php echo sprintf($lang_install['Install'], FORUM_VERSION) ?></span></h2> |
342: <div class="box"> | 338: <div class="box"> |
343: <form id="install" method="post" action="install.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}"> | 339: <form id="install" method="post" action="install.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}"> |
344: <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div> | 340: <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div> |
1584: $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0; | 1580: $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0; |
1585: | 1581: |
1586: // Insert config data | 1582: // Insert config data |
1587: $config = array( | 1583: $pun_config = array( |
1588: 'o_cur_version' => "'".FORUM_VERSION."'", | 1584: 'o_cur_version' => FORUM_VERSION, |
1589: 'o_database_revision' => "'".FORUM_DB_REVISION."'", | 1585: 'o_database_revision' => FORUM_DB_REVISION, |
1590: 'o_searchindex_revision' => "'".FORUM_SI_REVISION."'", | 1586: 'o_searchindex_revision' => FORUM_SI_REVISION, |
1591: 'o_parser_revision' => "'".FORUM_PARSER_REVISION."'", | 1587: 'o_parser_revision' => FORUM_PARSER_REVISION, |
1592: 'o_board_title' => "'".$db->escape($title)."'", | 1588: 'o_board_title' => $title, |
1593: 'o_board_desc' => "'".$db->escape($description)."'", | 1589: 'o_board_desc' => $description, |
1594: 'o_default_timezone' => "'0'", | 1590: 'o_default_timezone' => 0, |
1595: 'o_time_format' => "'H:i:s'", | 1591: 'o_time_format' => 'H:i:s', |
1596: 'o_date_format' => "'Y-m-d'", | 1592: 'o_date_format' => 'Y-m-d', |
1597: 'o_timeout_visit' => "'1800'", | 1593: 'o_timeout_visit' => 1800, |
1598: 'o_timeout_online' => "'300'", | 1594: 'o_timeout_online' => 300, |
1599: 'o_redirect_delay' => "'1'", | 1595: 'o_redirect_delay' => 1, |
1600: 'o_show_version' => "'0'", | 1596: 'o_show_version' => 0, |
1601: 'o_show_user_info' => "'1'", | 1597: 'o_show_user_info' => 1, |
1602: 'o_show_post_count' => "'1'", | 1598: 'o_show_post_count' => 1, |
1603: 'o_signatures' => "'1'", | 1599: 'o_signatures' => 1, |
1604: 'o_smilies' => "'1'", | 1600: 'o_smilies' => 1, |
1605: 'o_smilies_sig' => "'1'", | 1601: 'o_smilies_sig' => 1, |
1606: 'o_make_links' => "'1'", | 1602: 'o_make_links' => 1, |
1607: 'o_default_lang' => "'".$db->escape($default_lang)."'", | 1603: 'o_default_lang' => $default_lang, |
1608: 'o_default_style' => "'".$db->escape($default_style)."'", | 1604: 'o_default_style' => $default_style, |
1609: 'o_default_user_group' => "'4'", | 1605: 'o_default_user_group' => 4, |
1610: 'o_topic_review' => "'15'", | 1606: 'o_topic_review' => 15, |
1611: 'o_disp_topics_default' => "'30'", | 1607: 'o_disp_topics_default' => 30, |
1612: 'o_disp_posts_default' => "'25'", | 1608: 'o_disp_posts_default' => 25, |
1613: 'o_indent_num_spaces' => "'4'", | 1609: 'o_indent_num_spaces' => 4, |
1614: 'o_quote_depth' => "'3'", | 1610: 'o_quote_depth' => 3, |
1615: 'o_quickpost' => "'1'", | 1611: 'o_quickpost' => 1, |
1616: 'o_users_online' => "'1'", | 1612: 'o_users_online' => 1, |
1617: 'o_censoring' => "'0'", | 1613: 'o_censoring' => 0, |
1618: 'o_ranks' => "'1'", | 1614: 'o_ranks' => 1, |
1619: 'o_show_dot' => "'0'", | 1615: 'o_show_dot' => 0, |
1620: 'o_topic_views' => "'1'", | 1616: 'o_topic_views' => 1, |
1621: 'o_quickjump' => "'1'", | 1617: 'o_quickjump' => 1, |
1622: 'o_gzip' => "'0'", | 1618: 'o_gzip' => 0, |
1623: 'o_additional_navlinks' => "''", | 1619: 'o_additional_navlinks' => '', |
1624: 'o_report_method' => "'0'", | 1620: 'o_report_method' => 0, |
1625: 'o_regs_report' => "'0'", | 1621: 'o_regs_report' => 0, |
1626: 'o_default_email_setting' => "'1'", | 1622: 'o_default_email_setting' => 1, |
1627: 'o_mailing_list' => "'".$email."'", | 1623: 'o_mailing_list' => $email, |
1628: 'o_avatars' => "'".$avatars."'", | 1624: 'o_avatars' => $avatars, |
1629: 'o_avatars_dir' => "'img/avatars'", | 1625: 'o_avatars_dir' => 'img/avatars', |
1630: 'o_avatars_width' => "'60'", | 1626: 'o_avatars_width' => 60, |
1631: 'o_avatars_height' => "'60'", | 1627: 'o_avatars_height' => 60, |
1632: 'o_avatars_size' => "'10240'", | 1628: 'o_avatars_size' => 10240, |
1633: 'o_search_all_forums' => "'1'", | 1629: 'o_search_all_forums' => 1, |
1634: 'o_base_url' => "'".$db->escape($base_url)."'", | 1630: 'o_base_url' => $base_url, |
1635: 'o_admin_email' => "'".$email."'", | 1631: 'o_admin_email' => $email, |
1636: 'o_webmaster_email' => "'".$email."'", | 1632: 'o_webmaster_email' => $email, |
1637: 'o_forum_subscriptions' => "'1'", | 1633: 'o_forum_subscriptions' => 1, |
1638: 'o_topic_subscriptions' => "'1'", | 1634: 'o_topic_subscriptions' => 1, |
1639: 'o_smtp_host' => "NULL", | 1635: 'o_smtp_host' => NULL, |
1640: 'o_smtp_user' => "NULL", | 1636: 'o_smtp_user' => NULL, |
1641: 'o_smtp_pass' => "NULL", | 1637: 'o_smtp_pass' => NULL, |
1642: 'o_smtp_ssl' => "'0'", | 1638: 'o_smtp_ssl' => 0, |
1643: 'o_regs_allow' => "'1'", | 1639: 'o_regs_allow' => 1, |
1644: 'o_regs_verify' => "'0'", | 1640: 'o_regs_verify' => 0, |
1645: 'o_announcement' => "'0'", | 1641: 'o_announcement' => 0, |
1646: 'o_announcement_message' => "'".$db->escape($lang_install['Announcement'])."'", | 1642: 'o_announcement_message' => $lang_install['Announcement'], |
1647: 'o_rules' => "'0'", | 1643: 'o_rules' => 0, |
1648: 'o_rules_message' => "'".$db->escape($lang_install['Rules'])."'", | 1644: 'o_rules_message' => $lang_install['Rules'], |
1649: 'o_maintenance' => "'0'", | 1645: 'o_maintenance' => 0, |
1650: 'o_maintenance_message' => "'".$db->escape($lang_install['Maintenance message'])."'", | 1646: 'o_maintenance_message' => $lang_install['Maintenance message'], |
1651: 'o_default_dst' => "'0'", | 1647: 'o_default_dst' => 0, |
1652: 'o_feed_type' => "'2'", | 1648: 'o_feed_type' => 2, |
1653: 'o_feed_ttl' => "'0'", | 1649: 'o_feed_ttl' => 0, |
1654: 'p_message_bbcode' => "'1'", | 1650: 'p_message_bbcode' => 1, |
1655: 'p_message_img_tag' => "'1'", | 1651: 'p_message_img_tag' => 1, |
1656: 'p_message_all_caps' => "'1'", | 1652: 'p_message_all_caps' => 1, |
1657: 'p_subject_all_caps' => "'1'", | 1653: 'p_subject_all_caps' => 1, |
1658: 'p_sig_all_caps' => "'1'", | 1654: 'p_sig_all_caps' => 1, |
1659: 'p_sig_bbcode' => "'1'", | 1655: 'p_sig_bbcode' => 1, |
1660: 'p_sig_img_tag' => "'0'", | 1656: 'p_sig_img_tag' => 0, |
1661: 'p_sig_length' => "'400'", | 1657: 'p_sig_length' => 400, |
1662: 'p_sig_lines' => "'4'", | 1658: 'p_sig_lines' => 4, |
1663: 'p_allow_banned_email' => "'1'", | 1659: 'p_allow_banned_email' => 1, |
1664: 'p_allow_dupe_email' => "'0'", | 1660: 'p_allow_dupe_email' => 0, |
1665: 'p_force_guest_email' => "'1'" | 1661: 'p_force_guest_email' => 1 |
1666: ); | 1662: ); |
1667: | 1663: |
1668: foreach ($config as $conf_name => $conf_value) | 1664: foreach ($pun_config as $conf_name => $conf_value) |
1669: { | 1665: { |
1670: $db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)") | 1666: $db->query('INSERT INTO '.$db_prefix.'config (conf_name, conf_value) VALUES(\''.$conf_name.'\', '.(is_null($conf_value) ? 'NULL' : '\''.$db->escape($conf_value).'\'').')') |
1671: or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); | 1667: or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); |
1672: } | 1668: } |
1673: | 1669: |
1695: | 1691: |
1696: // Index the test post so searching for it works | 1692: // Index the test post so searching for it works |
1697: require PUN_ROOT.'include/search_idx.php'; | 1693: require PUN_ROOT.'include/search_idx.php'; |
1698: $pun_config['o_default_lang'] = $default_lang; | |
1699: update_search_index('post', 1, $message, $subject); | 1694: update_search_index('post', 1, $message, $subject); |
1700: | 1695: |
1701: $db->end_transaction(); | 1696: $db->end_transaction(); |
1715: | 1710: |
1716: // Attempt to write config.php and serve it up for download if writing fails | 1711: // Attempt to write config.php and serve it up for download if writing fails |
1717: $written = false; | 1712: $written = false; |
1718: if (is_writable(PUN_ROOT)) | 1713: if (forum_is_writable(PUN_ROOT)) |
1719: { | 1714: { |
1720: $fh = @fopen(PUN_ROOT.'config.php', 'wb'); | 1715: $fh = @fopen(PUN_ROOT.'config.php', 'wb'); |
1721: if ($fh) | 1716: if ($fh) |
a/lang/English/admin_options.php |
b/lang/English/admin_options.php |
51: 'UTC' => '(UTC) Western European, Greenwich', | 51: 'UTC' => '(UTC) Western European, Greenwich', |
52: 'UTC+01:00' => '(UTC+01:00) Central European, West African', | 52: 'UTC+01:00' => '(UTC+01:00) Central European, West African', |
53: 'UTC+02:00' => '(UTC+02:00) Eastern European, Central African', | 53: 'UTC+02:00' => '(UTC+02:00) Eastern European, Central African', |
54: 'UTC+03:00' => '(UTC+03:00) Moscow, Eastern African', | 54: 'UTC+03:00' => '(UTC+03:00) Eastern African', |
55: 'UTC+03:30' => '(UTC+03:30) Iran', | 55: 'UTC+03:30' => '(UTC+03:30) Iran', |
56: 'UTC+04:00' => '(UTC+04:00) Gulf, Samara', | 56: 'UTC+04:00' => '(UTC+04:00) Moscow, Gulf, Samara', |
57: 'UTC+04:30' => '(UTC+04:30) Afghanistan', | 57: 'UTC+04:30' => '(UTC+04:30) Afghanistan', |
58: 'UTC+05:00' => '(UTC+05:00) Pakistan, Yekaterinburg', | 58: 'UTC+05:00' => '(UTC+05:00) Pakistan', |
59: 'UTC+05:30' => '(UTC+05:30) India, Sri Lanka', | 59: 'UTC+05:30' => '(UTC+05:30) India, Sri Lanka', |
60: 'UTC+05:45' => '(UTC+05:45) Nepal', | 60: 'UTC+05:45' => '(UTC+05:45) Nepal', |
61: 'UTC+06:00' => '(UTC+06:00) Bangladesh, Bhutan, Novosibirsk', | 61: 'UTC+06:00' => '(UTC+06:00) Bangladesh, Bhutan, Yekaterinburg', |
62: 'UTC+06:30' => '(UTC+06:30) Cocos Islands, Myanmar', | 62: 'UTC+06:30' => '(UTC+06:30) Cocos Islands, Myanmar', |
63: 'UTC+07:00' => '(UTC+07:00) Indochina, Krasnoyarsk', | 63: 'UTC+07:00' => '(UTC+07:00) Indochina, Novosibirsk', |
64: 'UTC+08:00' => '(UTC+08:00) Greater China, Australian Western, Irkutsk', | 64: 'UTC+08:00' => '(UTC+08:00) Greater China, Australian Western, Krasnoyarsk', |
65: 'UTC+08:45' => '(UTC+08:45) Southeastern Western Australia', | 65: 'UTC+08:45' => '(UTC+08:45) Southeastern Western Australia', |
66: 'UTC+09:00' => '(UTC+09:00) Japan, Korea, Chita', | 66: 'UTC+09:00' => '(UTC+09:00) Japan, Korea, Chita, Irkutsk', |
67: 'UTC+09:30' => '(UTC+09:30) Australian Central', | 67: 'UTC+09:30' => '(UTC+09:30) Australian Central', |
68: 'UTC+10:00' => '(UTC+10:00) Australian Eastern, Vladivostok', | 68: 'UTC+10:00' => '(UTC+10:00) Australian Eastern', |
69: 'UTC+10:30' => '(UTC+10:30) Lord Howe', | 69: 'UTC+10:30' => '(UTC+10:30) Lord Howe', |
70: 'UTC+11:00' => '(UTC+11:00) Solomon Island, Magadan', | 70: 'UTC+11:00' => '(UTC+11:00) Solomon Island, Vladivostok', |
71: 'UTC+11:30' => '(UTC+11:30) Norfolk Island', | 71: 'UTC+11:30' => '(UTC+11:30) Norfolk Island', |
72: 'UTC+12:00' => '(UTC+12:00) New Zealand, Fiji, Kamchatka', | 72: 'UTC+12:00' => '(UTC+12:00) New Zealand, Fiji, Magadan', |
73: 'UTC+12:45' => '(UTC+12:45) Chatham Islands', | 73: 'UTC+12:45' => '(UTC+12:45) Chatham Islands', |
74: 'UTC+13:00' => '(UTC+13:00) Tonga, Phoenix Islands', | 74: 'UTC+13:00' => '(UTC+13:00) Tonga, Phoenix Islands, Kamchatka', |
75: 'UTC+14:00' => '(UTC+14:00) Line Islands', | 75: 'UTC+14:00' => '(UTC+14:00) Line Islands', |
76: | 76: |
77: // Timeout Section | 77: // Timeout Section |
a/lang/English/prof_reg.php |
b/lang/English/prof_reg.php |
53: 'UTC' => '(UTC) Western European, Greenwich', | 53: 'UTC' => '(UTC) Western European, Greenwich', |
54: 'UTC+01:00' => '(UTC+01:00) Central European, West African', | 54: 'UTC+01:00' => '(UTC+01:00) Central European, West African', |
55: 'UTC+02:00' => '(UTC+02:00) Eastern European, Central African', | 55: 'UTC+02:00' => '(UTC+02:00) Eastern European, Central African', |
56: 'UTC+03:00' => '(UTC+03:00) Moscow, Eastern African', | 56: 'UTC+03:00' => '(UTC+03:00) Eastern African', |
57: 'UTC+03:30' => '(UTC+03:30) Iran', | 57: 'UTC+03:30' => '(UTC+03:30) Iran', |
58: 'UTC+04:00' => '(UTC+04:00) Gulf, Samara', | 58: 'UTC+04:00' => '(UTC+04:00) Moscow, Gulf, Samara', |
59: 'UTC+04:30' => '(UTC+04:30) Afghanistan', | 59: 'UTC+04:30' => '(UTC+04:30) Afghanistan', |
60: 'UTC+05:00' => '(UTC+05:00) Pakistan, Yekaterinburg', | 60: 'UTC+05:00' => '(UTC+05:00) Pakistan', |
61: 'UTC+05:30' => '(UTC+05:30) India, Sri Lanka', | 61: 'UTC+05:30' => '(UTC+05:30) India, Sri Lanka', |
62: 'UTC+05:45' => '(UTC+05:45) Nepal', | 62: 'UTC+05:45' => '(UTC+05:45) Nepal', |
63: 'UTC+06:00' => '(UTC+06:00) Bangladesh, Bhutan, Novosibirsk', | 63: 'UTC+06:00' => '(UTC+06:00) Bangladesh, Bhutan, Yekaterinburg', |
64: 'UTC+06:30' => '(UTC+06:30) Cocos Islands, Myanmar', | 64: 'UTC+06:30' => '(UTC+06:30) Cocos Islands, Myanmar', |
65: 'UTC+07:00' => '(UTC+07:00) Indochina, Krasnoyarsk', | 65: 'UTC+07:00' => '(UTC+07:00) Indochina, Novosibirsk', |
66: 'UTC+08:00' => '(UTC+08:00) Greater China, Australian Western, Irkutsk', | 66: 'UTC+08:00' => '(UTC+08:00) Greater China, Australian Western, Krasnoyarsk', |
67: 'UTC+08:45' => '(UTC+08:45) Southeastern Western Australia', | 67: 'UTC+08:45' => '(UTC+08:45) Southeastern Western Australia', |
68: 'UTC+09:00' => '(UTC+09:00) Japan, Korea, Chita', | 68: 'UTC+09:00' => '(UTC+09:00) Japan, Korea, Chita, Irkutsk', |
69: 'UTC+09:30' => '(UTC+09:30) Australian Central', | 69: 'UTC+09:30' => '(UTC+09:30) Australian Central', |
70: 'UTC+10:00' => '(UTC+10:00) Australian Eastern, Vladivostok', | 70: 'UTC+10:00' => '(UTC+10:00) Australian Eastern', |
71: 'UTC+10:30' => '(UTC+10:30) Lord Howe', | 71: 'UTC+10:30' => '(UTC+10:30) Lord Howe', |
72: 'UTC+11:00' => '(UTC+11:00) Solomon Island, Magadan', | 72: 'UTC+11:00' => '(UTC+11:00) Solomon Island, Vladivostok', |
73: 'UTC+11:30' => '(UTC+11:30) Norfolk Island', | 73: 'UTC+11:30' => '(UTC+11:30) Norfolk Island', |
74: 'UTC+12:00' => '(UTC+12:00) New Zealand, Fiji, Kamchatka', | 74: 'UTC+12:00' => '(UTC+12:00) New Zealand, Fiji, Magadan', |
75: 'UTC+12:45' => '(UTC+12:45) Chatham Islands', | 75: 'UTC+12:45' => '(UTC+12:45) Chatham Islands', |
76: 'UTC+13:00' => '(UTC+13:00) Tonga, Phoenix Islands', | 76: 'UTC+13:00' => '(UTC+13:00) Tonga, Phoenix Islands, Kamchatka', |
77: 'UTC+14:00' => '(UTC+14:00) Line Islands' | 77: 'UTC+14:00' => '(UTC+14:00) Line Islands' |
78: | 78: |
79: ); | 79: ); |
a/moderate.php |
b/moderate.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
15: if (isset($_GET['get_host'])) | 15: if (isset($_GET['get_host'])) |
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: // Is get_host an IP address or a post ID? | 20: // Is get_host an IP address or a post ID? |
21: if (@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $_GET['get_host']) || @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}:))$%', $_GET['get_host'])) | 21: if (@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $_GET['get_host']) || @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}:))$%', $_GET['get_host'])) |
28: | 28: |
29: $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE id='.$get_host) or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error()); | 29: $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE id='.$get_host) or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error()); |
30: if (!$db->num_rows($result)) | 30: if (!$db->num_rows($result)) |
31: message($lang_common['Bad request']); | 31: message($lang_common['Bad request'], false, '404 Not Found'); |
32: | 32: |
33: $ip = $db->result($result); | 33: $ip = $db->result($result); |
34: } | 34: } |
43: // All other functions require moderator/admin access | 43: // All other functions require moderator/admin access |
44: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; | 44: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; |
45: if ($fid < 1) | 45: if ($fid < 1) |
46: message($lang_common['Bad request']); | 46: message($lang_common['Bad request'], false, '404 Not Found'); |
47: | 47: |
48: $result = $db->query('SELECT moderators FROM '.$db->prefix.'forums WHERE id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); | 48: $result = $db->query('SELECT moderators FROM '.$db->prefix.'forums WHERE id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); |
49: | 49: |
51: $mods_array = ($moderators != '') ? unserialize($moderators) : array(); | 51: $mods_array = ($moderators != '') ? unserialize($moderators) : array(); |
52: | 52: |
53: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] == '0' || !array_key_exists($pun_user['username'], $mods_array))) | 53: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] == '0' || !array_key_exists($pun_user['username'], $mods_array))) |
54: message($lang_common['No permission']); | 54: message($lang_common['No permission'], false, '403 Forbidden'); |
55: | 55: |
56: // Get topic/forum tracking data | 56: // Get topic/forum tracking data |
57: if (!$pun_user['is_guest']) | 57: if (!$pun_user['is_guest']) |
66: { | 66: { |
67: $tid = intval($_GET['tid']); | 67: $tid = intval($_GET['tid']); |
68: if ($tid < 1) | 68: if ($tid < 1) |
69: message($lang_common['Bad request']); | 69: message($lang_common['Bad request'], false, '404 Not Found'); |
70: | 70: |
71: // Fetch some info about the topic | 71: // Fetch some info about the topic |
72: $result = $db->query('SELECT t.subject, t.num_replies, t.first_post_id, f.id AS forum_id, forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid.' AND t.id='.$tid.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); | 72: $result = $db->query('SELECT t.subject, t.num_replies, t.first_post_id, f.id AS forum_id, forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid.' AND t.id='.$tid.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
73: if (!$db->num_rows($result)) | 73: if (!$db->num_rows($result)) |
74: message($lang_common['Bad request']); | 74: message($lang_common['Bad request'], false, '404 Not Found'); |
75: | 75: |
76: $cur_topic = $db->fetch_assoc($result); | 76: $cur_topic = $db->fetch_assoc($result); |
77: | 77: |
195: // Move the posts to the new topic | 195: // Move the posts to the new topic |
196: $db->query('UPDATE '.$db->prefix.'posts SET topic_id='.$new_tid.' WHERE id IN('.$posts.')') or error('Unable to move posts into new topic', __FILE__, __LINE__, $db->error()); | 196: $db->query('UPDATE '.$db->prefix.'posts SET topic_id='.$new_tid.' WHERE id IN('.$posts.')') or error('Unable to move posts into new topic', __FILE__, __LINE__, $db->error()); |
197: | 197: |
| 198: // Apply every subscription to both topics |
| 199: $db->query('INSERT INTO '.$db->prefix.'topic_subscriptions (user_id, topic_id) SELECT user_id, '.$new_tid.' FROM '.$db->prefix.'topic_subscriptions WHERE topic_id='.$tid) or error('Unable to copy existing subscriptions', __FILE__, __LINE__, $db->error()); |
| 200: |
198: // Get last_post, last_post_id, and last_poster from the topic and update it | 201: // Get last_post, last_post_id, and last_poster from the topic and update it |
199: $result = $db->query('SELECT id, poster, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); | 202: $result = $db->query('SELECT id, poster, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
200: $last_post_data = $db->fetch_assoc($result); | 203: $last_post_data = $db->fetch_assoc($result); |
575: // Merge the posts into the topic | 578: // Merge the posts into the topic |
576: $db->query('UPDATE '.$db->prefix.'posts SET topic_id='.$merge_to_tid.' WHERE topic_id IN('.implode(',', $topics).')') or error('Unable to merge the posts into the topic', __FILE__, __LINE__, $db->error()); | 579: $db->query('UPDATE '.$db->prefix.'posts SET topic_id='.$merge_to_tid.' WHERE topic_id IN('.implode(',', $topics).')') or error('Unable to merge the posts into the topic', __FILE__, __LINE__, $db->error()); |
577: | 580: |
578: // Delete any subscriptions | 581: // Update any subscriptions |
579: $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN('.implode(',', $topics).') AND topic_id != '.$merge_to_tid) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error()); | 582: $result = $db->query('SELECT user_id FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN ('.implode(',', $topics).')') or error('Unable to fetch subscriptions of merged topics', __FILE__, __LINE__, $db->error()); |
| 583: |
| 584: $subscribed_users = array(); |
| 585: while ($cur_user_id = $db->result($result)) |
| 586: $subscribed_users[] = $cur_user_id; |
| 587: $subscribed_users = array_unique($subscribed_users); |
| 588: |
| 589: $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN ('.implode(',', $topics).')') or error('Unable to delete subscriptions of merged topics', __FILE__, __LINE__, $db->error()); |
| 590: |
| 591: foreach ($subscribed_users as $cur_user_id) |
| 592: $db->query('INSERT INTO '.$db->prefix.'topic_subscriptions (topic_id, user_id) VALUES ('.$merge_to_tid.', '.$cur_user_id.')') or error('Unable to re-enter subscriptions for merge topic', __FILE__, __LINE__, $db->error()); |
580: | 593: |
581: // Without redirection the old topics are removed | 594: // Without redirection the old topics are removed |
582: if (!isset($_POST['with_redirect'])) | 595: if (!isset($_POST['with_redirect'])) |
781: // Fetch some info about the forum | 794: // Fetch some info about the forum |
782: $result = $db->query('SELECT f.forum_name, f.redirect_url, f.num_topics, f.sort_by FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); | 795: $result = $db->query('SELECT f.forum_name, f.redirect_url, f.num_topics, f.sort_by FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); |
783: if (!$db->num_rows($result)) | 796: if (!$db->num_rows($result)) |
784: message($lang_common['Bad request']); | 797: message($lang_common['Bad request'], false, '404 Not Found'); |
785: | 798: |
786: $cur_forum = $db->fetch_assoc($result); | 799: $cur_forum = $db->fetch_assoc($result); |
787: | 800: |
875: $item_status = ($topic_count % 2 == 0) ? 'roweven' : 'rowodd'; | 888: $item_status = ($topic_count % 2 == 0) ? 'roweven' : 'rowodd'; |
876: $icon_type = 'icon'; | 889: $icon_type = 'icon'; |
877: | 890: |
878: if ($cur_topic['moved_to'] == null) | 891: if (is_null($cur_topic['moved_to'])) |
879: { | 892: { |
880: $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>'; | 893: $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>'; |
881: $ghost_topic = false; | 894: $ghost_topic = false; |
a/post.php |
b/post.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
11: | 11: |
12: | 12: |
13: if ($pun_user['g_read_board'] == '0') | 13: if ($pun_user['g_read_board'] == '0') |
14: message($lang_common['No view']); | 14: message($lang_common['No view'], false, '403 Forbidden'); |
15: | 15: |
16: | 16: |
17: $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0; | 17: $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0; |
18: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; | 18: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; |
19: if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0) | 19: if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0) |
20: message($lang_common['Bad request']); | 20: message($lang_common['Bad request'], false, '404 Not Found'); |
21: | 21: |
22: // Fetch some info about the topic and/or the forum | 22: // Fetch some info about the topic and/or the forum |
23: if ($tid) | 23: if ($tid) |
26: $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); | 26: $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); |
27: | 27: |
28: if (!$db->num_rows($result)) | 28: if (!$db->num_rows($result)) |
29: message($lang_common['Bad request']); | 29: message($lang_common['Bad request'], false, '404 Not Found'); |
30: | 30: |
31: $cur_posting = $db->fetch_assoc($result); | 31: $cur_posting = $db->fetch_assoc($result); |
32: $is_subscribed = $tid && $cur_posting['is_subscribed']; | 32: $is_subscribed = $tid && $cur_posting['is_subscribed']; |
47: ($fid && (($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) || | 47: ($fid && (($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) || |
48: (isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) && | 48: (isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) && |
49: !$is_admmod) | 49: !$is_admmod) |
50: message($lang_common['No permission']); | 50: message($lang_common['No permission'], false, '403 Forbidden'); |
51: | 51: |
52: // Load the post.php language file | 52: // Load the post.php language file |
53: require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php'; | 53: require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php'; |
91: else | 91: else |
92: { | 92: { |
93: $username = pun_trim($_POST['req_username']); | 93: $username = pun_trim($_POST['req_username']); |
94: $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email'])); | 94: $email = strtolower(pun_trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email'])); |
95: $banned_email = false; | 95: $banned_email = false; |
96: | 96: |
97: // Load the register.php/prof_reg.php language files | 97: // Load the register.php/prof_reg.php language files |
152: $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0'; | 152: $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0'; |
153: $subscribe = isset($_POST['subscribe']) ? '1' : '0'; | 153: $subscribe = isset($_POST['subscribe']) ? '1' : '0'; |
154: $stick_topic = isset($_POST['stick_topic']) && $is_admmod ? '1' : '0'; | 154: $stick_topic = isset($_POST['stick_topic']) && $is_admmod ? '1' : '0'; |
| 155: |
| 156: // Replace four-byte characters (MySQL cannot handle them) |
| 157: $message = strip_bad_multibyte_chars($message); |
155: | 158: |
156: $now = time(); | 159: $now = time(); |
157: | 160: |
188: $new_pid = $db->insert_id(); | 191: $new_pid = $db->insert_id(); |
189: } | 192: } |
190: | 193: |
191: // Count number of replies in the topic | |
192: $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$tid) or error('Unable to fetch post count for topic', __FILE__, __LINE__, $db->error()); | |
193: $num_replies = $db->result($result, 0) - 1; | |
194: | |
195: // Update topic | 194: // Update topic |
196: $db->query('UPDATE '.$db->prefix.'topics SET num_replies='.$num_replies.', last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.$db->escape($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error()); | 195: $db->query('UPDATE '.$db->prefix.'topics SET num_replies=num_replies+1, last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.$db->escape($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error()); |
197: | 196: |
198: update_search_index('post', $new_pid, $message); | 197: update_search_index('post', $new_pid, $message); |
199: | 198: |
440: { | 439: { |
441: $qid = intval($_GET['qid']); | 440: $qid = intval($_GET['qid']); |
442: if ($qid < 1) | 441: if ($qid < 1) |
443: message($lang_common['Bad request']); | 442: message($lang_common['Bad request'], false, '404 Not Found'); |
444: | 443: |
445: $result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid.' AND topic_id='.$tid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error()); | 444: $result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid.' AND topic_id='.$tid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error()); |
446: if (!$db->num_rows($result)) | 445: if (!$db->num_rows($result)) |
447: message($lang_common['Bad request']); | 446: message($lang_common['Bad request'], false, '404 Not Found'); |
448: | 447: |
449: list($q_poster, $q_message) = $db->fetch_row($result); | 448: list($q_poster, $q_message) = $db->fetch_row($result); |
450: | 449: |
451: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) | 450: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) |
452: if (strpos($q_message, '[code]') !== false && strpos($q_message, '[/code]') !== false) | 451: if (strpos($q_message, '[code]') !== false && strpos($q_message, '[/code]') !== false) |
453: { | 452: { |
454: $errors = array(); | 453: list($inside, $outside) = split_text($q_message, '[code]', '[/code]'); |
455: list($inside, $outside) = split_text($q_message, '[code]', '[/code]', $errors); | |
456: if (!empty($errors)) // Technically this shouldn't happen, since $q_message is an existing post it should only exist if it previously passed validation | |
457: message($errors[0]); | |
458: | 454: |
459: $q_message = implode("\1", $outside); | 455: $q_message = implode("\1", $outside); |
460: } | 456: } |
a/profile.php |
b/profile.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
18: $section = isset($_GET['section']) ? $_GET['section'] : null; | 18: $section = isset($_GET['section']) ? $_GET['section'] : null; |
19: $id = isset($_GET['id']) ? intval($_GET['id']) : 0; | 19: $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
20: if ($id < 2) | 20: if ($id < 2) |
21: message($lang_common['Bad request']); | 21: message($lang_common['Bad request'], false, '404 Not Found'); |
22: | 22: |
23: if ($action != 'change_pass' || !isset($_GET['key'])) | 23: if ($action != 'change_pass' || !isset($_GET['key'])) |
24: { | 24: { |
25: if ($pun_user['g_read_board'] == '0') | 25: if ($pun_user['g_read_board'] == '0') |
26: message($lang_common['No view']); | 26: message($lang_common['No view'], false, '403 Forbidden'); |
27: else if ($pun_user['g_view_users'] == '0' && ($pun_user['is_guest'] || $pun_user['id'] != $id)) | 27: else if ($pun_user['g_view_users'] == '0' && ($pun_user['is_guest'] || $pun_user['id'] != $id)) |
28: message($lang_common['No permission']); | 28: message($lang_common['No permission'], false, '403 Forbidden'); |
29: } | 29: } |
30: | 30: |
31: // Load the profile.php/register.php language file | 31: // Load the profile.php/register.php language file |
65: if ($pun_user['id'] != $id) | 65: if ($pun_user['id'] != $id) |
66: { | 66: { |
67: if (!$pun_user['is_admmod']) // A regular user trying to change another users password? | 67: if (!$pun_user['is_admmod']) // A regular user trying to change another users password? |
68: message($lang_common['No permission']); | 68: message($lang_common['No permission'], false, '403 Forbidden'); |
69: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users password? | 69: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users password? |
70: { | 70: { |
71: $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 71: $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
72: if (!$db->num_rows($result)) | 72: if (!$db->num_rows($result)) |
73: message($lang_common['Bad request']); | 73: message($lang_common['Bad request'], false, '404 Not Found'); |
74: | 74: |
75: list($group_id, $is_moderator) = $db->fetch_row($result); | 75: list($group_id, $is_moderator) = $db->fetch_row($result); |
76: | 76: |
77: if ($pun_user['g_mod_edit_users'] == '0' || $pun_user['g_mod_change_passwords'] == '0' || $group_id == PUN_ADMIN || $is_moderator == '1') | 77: if ($pun_user['g_mod_edit_users'] == '0' || $pun_user['g_mod_change_passwords'] == '0' || $group_id == PUN_ADMIN || $is_moderator == '1') |
78: message($lang_common['No permission']); | 78: message($lang_common['No permission'], false, '403 Forbidden'); |
79: } | 79: } |
80: } | 80: } |
81: | 81: |
161: if ($pun_user['id'] != $id) | 161: if ($pun_user['id'] != $id) |
162: { | 162: { |
163: if (!$pun_user['is_admmod']) // A regular user trying to change another users email? | 163: if (!$pun_user['is_admmod']) // A regular user trying to change another users email? |
164: message($lang_common['No permission']); | 164: message($lang_common['No permission'], false, '403 Forbidden'); |
165: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users email? | 165: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users email? |
166: { | 166: { |
167: $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 167: $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
168: if (!$db->num_rows($result)) | 168: if (!$db->num_rows($result)) |
169: message($lang_common['Bad request']); | 169: message($lang_common['Bad request'], false, '404 Not Found'); |
170: | 170: |
171: list($group_id, $is_moderator) = $db->fetch_row($result); | 171: list($group_id, $is_moderator) = $db->fetch_row($result); |
172: | 172: |
173: if ($pun_user['g_mod_edit_users'] == '0' || $group_id == PUN_ADMIN || $is_moderator == '1') | 173: if ($pun_user['g_mod_edit_users'] == '0' || $group_id == PUN_ADMIN || $is_moderator == '1') |
174: message($lang_common['No permission']); | 174: message($lang_common['No permission'], false, '403 Forbidden'); |
175: } | 175: } |
176: } | 176: } |
177: | 177: |
199: require PUN_ROOT.'include/email.php'; | 199: require PUN_ROOT.'include/email.php'; |
200: | 200: |
201: // Validate the email address | 201: // Validate the email address |
202: $new_email = strtolower(trim($_POST['req_new_email'])); | 202: $new_email = strtolower(pun_trim($_POST['req_new_email'])); |
203: if (!is_valid_email($new_email)) | 203: if (!is_valid_email($new_email)) |
204: message($lang_common['Invalid email']); | 204: message($lang_common['Invalid email']); |
205: | 205: |
316: message($lang_profile['Avatars disabled']); | 316: message($lang_profile['Avatars disabled']); |
317: | 317: |
318: if ($pun_user['id'] != $id && !$pun_user['is_admmod']) | 318: if ($pun_user['id'] != $id && !$pun_user['is_admmod']) |
319: message($lang_common['No permission']); | 319: message($lang_common['No permission'], false, '403 Forbidden'); |
320: | 320: |
321: if (isset($_POST['form_sent'])) | 321: if (isset($_POST['form_sent'])) |
322: { | 322: { |
439: else if ($action == 'delete_avatar') | 439: else if ($action == 'delete_avatar') |
440: { | 440: { |
441: if ($pun_user['id'] != $id && !$pun_user['is_admmod']) | 441: if ($pun_user['id'] != $id && !$pun_user['is_admmod']) |
442: message($lang_common['No permission']); | 442: message($lang_common['No permission'], false, '403 Forbidden'); |
443: | 443: |
444: confirm_referrer('profile.php'); | 444: confirm_referrer('profile.php'); |
445: | 445: |
452: else if (isset($_POST['update_group_membership'])) | 452: else if (isset($_POST['update_group_membership'])) |
453: { | 453: { |
454: if ($pun_user['g_id'] > PUN_ADMIN) | 454: if ($pun_user['g_id'] > PUN_ADMIN) |
455: message($lang_common['No permission']); | 455: message($lang_common['No permission'], false, '403 Forbidden'); |
456: | 456: |
457: confirm_referrer('profile.php'); | 457: confirm_referrer('profile.php'); |
458: | 458: |
496: else if (isset($_POST['update_forums'])) | 496: else if (isset($_POST['update_forums'])) |
497: { | 497: { |
498: if ($pun_user['g_id'] > PUN_ADMIN) | 498: if ($pun_user['g_id'] > PUN_ADMIN) |
499: message($lang_common['No permission']); | 499: message($lang_common['No permission'], false, '403 Forbidden'); |
500: | 500: |
501: confirm_referrer('profile.php'); | 501: confirm_referrer('profile.php'); |
502: | 502: |
537: else if (isset($_POST['ban'])) | 537: else if (isset($_POST['ban'])) |
538: { | 538: { |
539: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) | 539: if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
540: message($lang_common['No permission']); | 540: message($lang_common['No permission'], false, '403 Forbidden'); |
541: | 541: |
542: // Get the username of the user we are banning | 542: // Get the username of the user we are banning |
543: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch username', __FILE__, __LINE__, $db->error()); | 543: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch username', __FILE__, __LINE__, $db->error()); |
558: else if (isset($_POST['delete_user']) || isset($_POST['delete_user_comply'])) | 558: else if (isset($_POST['delete_user']) || isset($_POST['delete_user_comply'])) |
559: { | 559: { |
560: if ($pun_user['g_id'] > PUN_ADMIN) | 560: if ($pun_user['g_id'] > PUN_ADMIN) |
561: message($lang_common['No permission']); | 561: message($lang_common['No permission'], false, '403 Forbidden'); |
562: | 562: |
563: confirm_referrer('profile.php'); | 563: confirm_referrer('profile.php'); |
564: | 564: |
679: // Fetch the user group of the user we are editing | 679: // Fetch the user group of the user we are editing |
680: $result = $db->query('SELECT u.username, u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 680: $result = $db->query('SELECT u.username, u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
681: if (!$db->num_rows($result)) | 681: if (!$db->num_rows($result)) |
682: message($lang_common['Bad request']); | 682: message($lang_common['Bad request'], false, '404 Not Found'); |
683: | 683: |
684: list($old_username, $group_id, $is_moderator) = $db->fetch_row($result); | 684: list($old_username, $group_id, $is_moderator) = $db->fetch_row($result); |
685: | 685: |
689: ($pun_user['g_mod_edit_users'] == '0' || // mods aren't allowed to edit users | 689: ($pun_user['g_mod_edit_users'] == '0' || // mods aren't allowed to edit users |
690: $group_id == PUN_ADMIN || // or the user is an admin | 690: $group_id == PUN_ADMIN || // or the user is an admin |
691: $is_moderator)))) // or the user is another mod | 691: $is_moderator)))) // or the user is another mod |
692: message($lang_common['No permission']); | 692: message($lang_common['No permission'], false, '403 Forbidden'); |
693: | 693: |
694: if ($pun_user['is_admmod']) | 694: if ($pun_user['is_admmod']) |
695: confirm_referrer('profile.php'); | 695: confirm_referrer('profile.php'); |
714: $languages = forum_list_langs(); | 714: $languages = forum_list_langs(); |
715: $form['language'] = pun_trim($_POST['form']['language']); | 715: $form['language'] = pun_trim($_POST['form']['language']); |
716: if (!in_array($form['language'], $languages)) | 716: if (!in_array($form['language'], $languages)) |
717: message($lang_common['Bad request']); | 717: message($lang_common['Bad request'], false, '404 Not Found'); |
718: } | 718: } |
719: | 719: |
720: if ($pun_user['is_admmod']) | 720: if ($pun_user['is_admmod']) |
750: require PUN_ROOT.'include/email.php'; | 750: require PUN_ROOT.'include/email.php'; |
751: | 751: |
752: // Validate the email address | 752: // Validate the email address |
753: $form['email'] = strtolower(trim($_POST['req_email'])); | 753: $form['email'] = strtolower(pun_trim($_POST['req_email'])); |
754: if (!is_valid_email($form['email'])) | 754: if (!is_valid_email($form['email'])) |
755: message($lang_common['Invalid email']); | 755: message($lang_common['Invalid email']); |
756: } | 756: } |
884: $styles = forum_list_styles(); | 884: $styles = forum_list_styles(); |
885: $form['style'] = pun_trim($_POST['form']['style']); | 885: $form['style'] = pun_trim($_POST['form']['style']); |
886: if (!in_array($form['style'], $styles)) | 886: if (!in_array($form['style'], $styles)) |
887: message($lang_common['Bad request']); | 887: message($lang_common['Bad request'], false, '404 Not Found'); |
888: } | 888: } |
889: | 889: |
890: break; | 890: break; |
927: // If we changed the username we have to update some stuff | 927: // If we changed the username we have to update some stuff |
928: if ($username_updated) | 928: if ($username_updated) |
929: { | 929: { |
| 930: $db->query('UPDATE '.$db->prefix.'bans SET username=\''.$db->escape($form['username']).'\' WHERE username=\''.$db->escape($old_username).'\'') or error('Unable to update bans', __FILE__, __LINE__, $db->error()); |
| 931: // If any bans were updated, we will need to know because the cache will need to be regenerated. |
| 932: if ($db->affected_rows() > 0) |
| 933: $bans_updated = true; |
930: $db->query('UPDATE '.$db->prefix.'posts SET poster=\''.$db->escape($form['username']).'\' WHERE poster_id='.$id) or error('Unable to update posts', __FILE__, __LINE__, $db->error()); | 934: $db->query('UPDATE '.$db->prefix.'posts SET poster=\''.$db->escape($form['username']).'\' WHERE poster_id='.$id) or error('Unable to update posts', __FILE__, __LINE__, $db->error()); |
931: $db->query('UPDATE '.$db->prefix.'posts SET edited_by=\''.$db->escape($form['username']).'\' WHERE edited_by=\''.$db->escape($old_username).'\'') or error('Unable to update posts', __FILE__, __LINE__, $db->error()); | 935: $db->query('UPDATE '.$db->prefix.'posts SET edited_by=\''.$db->escape($form['username']).'\' WHERE edited_by=\''.$db->escape($old_username).'\'') or error('Unable to update posts', __FILE__, __LINE__, $db->error()); |
932: $db->query('UPDATE '.$db->prefix.'topics SET poster=\''.$db->escape($form['username']).'\' WHERE poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error()); | 936: $db->query('UPDATE '.$db->prefix.'topics SET poster=\''.$db->escape($form['username']).'\' WHERE poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error()); |
965: require PUN_ROOT.'include/cache.php'; | 969: require PUN_ROOT.'include/cache.php'; |
966: | 970: |
967: generate_users_info_cache(); | 971: generate_users_info_cache(); |
| 972: |
| 973: // Check if the bans table was updated and regenerate the bans cache when needed |
| 974: if (isset($bans_updated)) |
| 975: generate_bans_cache(); |
968: } | 976: } |
969: | 977: |
970: redirect('profile.php?section='.$section.'&id='.$id, $lang_profile['Profile redirect']); | 978: redirect('profile.php?section='.$section.'&id='.$id, $lang_profile['Profile redirect']); |
973: | 981: |
974: $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.dst, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, u.last_visit, g.g_id, g.g_user_title, g.g_moderator FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 982: $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.dst, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, u.last_visit, g.g_id, g.g_user_title, g.g_moderator FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
975: if (!$db->num_rows($result)) | 983: if (!$db->num_rows($result)) |
976: message($lang_common['Bad request']); | 984: message($lang_common['Bad request'], false, '404 Not Found'); |
977: | 985: |
978: $user = $db->fetch_assoc($result); | 986: $user = $db->fetch_assoc($result); |
979: | 987: |
1666: else if ($section == 'admin') | 1674: else if ($section == 'admin') |
1667: { | 1675: { |
1668: if (!$pun_user['is_admmod'] || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '0')) | 1676: if (!$pun_user['is_admmod'] || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '0')) |
1669: message($lang_common['Bad request']); | 1677: message($lang_common['Bad request'], false, '403 Forbidden'); |
1670: | 1678: |
1671: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Section admin']); | 1679: $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Section admin']); |
1672: define('PUN_ACTIVE_PAGE', 'profile'); | 1680: define('PUN_ACTIVE_PAGE', 'profile'); |
a/search.php |
b/search.php |
1: <?php | 1: <?php |
2: | 2: |
3: /** | 3: /** |
4: * Copyright (C) 2008-2011 FluxBB | 4: * Copyright (C) 2008-2012 FluxBB |
5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | 5: * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: */ | 7: */ |
18: | 18: |
19: | 19: |
20: if ($pun_user['g_read_board'] == '0') | 20: if ($pun_user['g_read_board'] == '0') |
21: message($lang_common['No view']); | 21: message($lang_common['No view'], false, '403 Forbidden'); |
22: else if ($pun_user['g_search'] == '0') | 22: else if ($pun_user['g_search'] == '0') |
23: message($lang_search['No search permission']); | 23: message($lang_search['No search permission'], false, '403 Forbidden'); |
24: | 24: |
25: require PUN_ROOT.'include/search_idx.php'; | 25: require PUN_ROOT.'include/search_idx.php'; |
26: | 26: |
28: if (isset($_GET['action']) || isset($_GET['search_id'])) | 28: if (isset($_GET['action']) || isset($_GET['search_id'])) |
29: { | 29: { |
30: $action = (isset($_GET['action'])) ? $_GET['action'] : null; | 30: $action = (isset($_GET['action'])) ? $_GET['action'] : null; |
31: $forums = isset($_GET['forums']) ? (is_array($_GET['forums']) ? $_GET['forums'] : explode(',', $_GET['forums'])) : (isset($_GET['forum']) ? array($_GET['forum']) : array()); | 31: $forums = isset($_GET['forums']) ? (is_array($_GET['forums']) ? $_GET['forums'] : array_filter(explode(',', $_GET['forums']))) : (isset($_GET['forum']) ? array($_GET['forum']) : array()); |
32: $sort_dir = (isset($_GET['sort_dir']) && $_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC'; | 32: $sort_dir = (isset($_GET['sort_dir']) && $_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC'; |
33: | 33: |
34: $forums = array_map('intval', $forums); | 34: $forums = array_map('intval', $forums); |
44: { | 44: { |
45: $search_id = intval($_GET['search_id']); | 45: $search_id = intval($_GET['search_id']); |
46: if ($search_id < 1) | 46: if ($search_id < 1) |
47: message($lang_common['Bad request']); | 47: message($lang_common['Bad request'], false, '404 Not Found'); |
48: } | 48: } |
49: // If it's a regular search (keywords and/or author) | 49: // If it's a regular search (keywords and/or author) |
50: else if ($action == 'search') | 50: else if ($action == 'search') |
73: { | 73: { |
74: $user_id = (isset($_GET['user_id'])) ? intval($_GET['user_id']) : $pun_user['id']; | 74: $user_id = (isset($_GET['user_id'])) ? intval($_GET['user_id']) : $pun_user['id']; |
75: if ($user_id < 2) | 75: if ($user_id < 2) |
76: message($lang_common['Bad request']); | 76: message($lang_common['Bad request'], false, '404 Not Found'); |
77: | 77: |
78: // Subscribed topics can only be viewed by admins, moderators and the users themselves | 78: // Subscribed topics can only be viewed by admins, moderators and the users themselves |
79: if ($action == 'show_subscriptions' && !$pun_user['is_admmod'] && $user_id != $pun_user['id']) | 79: if ($action == 'show_subscriptions' && !$pun_user['is_admmod'] && $user_id != $pun_user['id']) |
80: message($lang_common['No permission']); | 80: message($lang_common['No permission'], false, '403 Forbidden'); |
81: } | 81: } |
82: else if ($action == 'show_recent') | 82: else if ($action == 'show_recent') |
83: $interval = isset($_GET['value']) ? intval($_GET['value']) : 86400; | 83: $interval = isset($_GET['value']) ? intval($_GET['value']) : 86400; |
323: if ($action == 'show_new') | 323: if ($action == 'show_new') |
324: { | 324: { |
325: if ($pun_user['is_guest']) | 325: if ($pun_user['is_guest']) |
326: message($lang_common['No permission']); | 326: message($lang_common['No permission'], false, '403 Forbidden'); |
327: | 327: |
328: $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t 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.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL'.(isset($_GET['fid']) ? ' AND t.forum_id='.intval($_GET['fid']) : '').' ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); | 328: $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t 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.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL'.(isset($_GET['fid']) ? ' AND t.forum_id='.intval($_GET['fid']) : '').' ORDER BY t.last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); |
329: $num_hits = $db->num_rows($result); | 329: $num_hits = $db->num_rows($result); |
517: if ($db->num_rows($result)) | 517: if ($db->num_rows($result)) |
518: $subscriber_name = $db->result($result); | 518: $subscriber_name = $db->result($result); |
519: else | 519: else |
520: message($lang_common['Bad request']); | 520: message($lang_common['Bad request'], false, '404 Not Found'); |
521: | 521: |
522: $crumbs_text['search_type'] = '<a href="search.php?action=show_subscriptions&user_id='.$subscriber_id.'">'.sprintf($lang_search['Quick search show_subscriptions'], pun_htmlspecialchars($subscriber_name)).'</a>'; | 522: $crumbs_text['search_type'] = '<a href="search.php?action=show_subscriptions&user_id='.$subscriber_id.'">'.sprintf($lang_search['Quick search show_subscriptions'], pun_htmlspecialchars($subscriber_name)).'</a>'; |
523: } | 523: } |