| a/upload/admin_options.php |
b/upload/admin_options.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: // Tell header.php to use the admin template | 11: // Tell header.php to use the admin template |
| 27: define('PUN_ADMIN_CONSOLE', 1); | 12: define('PUN_ADMIN_CONSOLE', 1); |
| 41: if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')))) | 26: if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')))) |
| 42: message('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.'); | 27: message('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.'); |
| 43: | 28: |
| 44: $form = array_map('trim', $_POST['form']); | 29: $form = array_map('pun_trim', $_POST['form']); |
| 45: | 30: |
| 46: if ($form['board_title'] == '') | 31: if ($form['board_title'] == '') |
| 47: message('You must enter a board title.'); | 32: message('You must enter a board title.'); |
| 53: | 38: |
| 54: $form['admin_email'] = strtolower($form['admin_email']); | 39: $form['admin_email'] = strtolower($form['admin_email']); |
| 55: if (!is_valid_email($form['admin_email'])) | 40: if (!is_valid_email($form['admin_email'])) |
| 56: message('The admin e-mail address you entered is invalid.'); | 41: message('The admin email address you entered is invalid.'); |
| 57: | 42: |
| 58: $form['webmaster_email'] = strtolower($form['webmaster_email']); | 43: $form['webmaster_email'] = strtolower($form['webmaster_email']); |
| 59: if (!is_valid_email($form['webmaster_email'])) | 44: if (!is_valid_email($form['webmaster_email'])) |
| 60: message('The webmaster e-mail address you entered is invalid.'); | 45: message('The webmaster email address you entered is invalid.'); |
| 61: | 46: |
| 62: if ($form['mailing_list'] != '') | 47: if ($form['mailing_list'] != '') |
| 63: $form['mailing_list'] = strtolower(preg_replace('/[\s]/', '', $form['mailing_list'])); | 48: $form['mailing_list'] = strtolower(preg_replace('/[\s]/', '', $form['mailing_list'])); |
| 185: </td> | 170: </td> |
| 186: </tr> | 171: </tr> |
| 187: <tr> | 172: <tr> |
| 188: <th scope="row">Default timezone</th> | 173: <th scope="row">Default time zone</th> |
| 189: <td> | 174: <td> |
| 190: <select name="form[default_timezone]"> | 175: <select name="form[default_timezone]"> |
| 191: <option value="-12"<?php if ($pun_config['o_default_timezone'] == -12 ) echo ' selected="selected"' ?>>-12</option> | 176: <option value="-12"<?php if ($pun_config['o_default_timezone'] == -12 ) echo ' selected="selected"' ?>>-12</option> |
| 225: <option value="12"<?php if ($pun_config['o_default_timezone'] == 12 ) echo ' selected="selected"' ?>>+12</option> | 210: <option value="12"<?php if ($pun_config['o_default_timezone'] == 12 ) echo ' selected="selected"' ?>>+12</option> |
| 226: <option value="13"<?php if ($pun_config['o_default_timezone'] == 13 ) echo ' selected="selected"' ?>>+13</option> | 211: <option value="13"<?php if ($pun_config['o_default_timezone'] == 13 ) echo ' selected="selected"' ?>>+13</option> |
| 227: </select> | 212: </select> |
| 228: <span>The default timezone for guests and users attempting to register for the board.</span> | 213: <span>The default time zone for guests and users attempting to register for the board.</span> |
| 229: </td> | 214: </td> |
| 230: </tr> | 215: </tr> |
| 231: <tr> | 216: <tr> |
| 358: <th scope="row">User info in posts</th> | 343: <th scope="row">User info in posts</th> |
| 359: <td> | 344: <td> |
| 360: <input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <strong>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>No</strong> | 345: <input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <strong>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>No</strong> |
| 361: <span>Show information about the poster under the username in topic view. The information affected is location, register date, post count and the contact links (e-mail and URL).</span> | 346: <span>Show information about the poster under the username in topic view. The information affected is location, register date, post count and the contact links (email and URL).</span> |
| 362: </td> | 347: </td> |
| 363: </tr> | 348: </tr> |
| 364: <tr> | 349: <tr> |
| 522: <tr> | 507: <tr> |
| 523: <th scope="row">Report method</th> | 508: <th scope="row">Report method</th> |
| 524: <td> | 509: <td> |
| 525: <input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> Internal <input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> E-mail <input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> Both | 510: <input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> Internal <input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> Email <input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> Both |
| 526: <span>Select the method for handling topic/post reports. You can choose whether topic/post reports should be handled by the internal report system, e-mailed to the addresses on the mailing list (see below) or both.</span> | 511: <span>Select the method for handling topic/post reports. You can choose whether topic/post reports should be handled by the internal report system, emailed to the addresses on the mailing list (see below) or both.</span> |
| 527: </td> | 512: </td> |
| 528: </tr> | 513: </tr> |
| 529: <tr> | 514: <tr> |
| 583: </div> | 568: </div> |
| 584: <div class="inform"> | 569: <div class="inform"> |
| 585: <fieldset> | 570: <fieldset> |
| 586: <legend>E-mail</legend> | 571: <legend>Email</legend> |
| 587: <div class="infldset"> | 572: <div class="infldset"> |
| 588: <table class="aligntop" cellspacing="0"> | 573: <table class="aligntop" cellspacing="0"> |
| 589: <tr> | 574: <tr> |
| 590: <th scope="row">Admin e-mail</th> | 575: <th scope="row">Admin email</th> |
| 591: <td> | 576: <td> |
| 592: <input type="text" name="form[admin_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_admin_email'] ?>" /> | 577: <input type="text" name="form[admin_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_admin_email'] ?>" /> |
| 593: <span>The e-mail address of the forum administrator.</span> | 578: <span>The email address of the forum administrator.</span> |
| 594: </td> | 579: </td> |
| 595: </tr> | 580: </tr> |
| 596: <tr> | 581: <tr> |
| 597: <th scope="row">Webmaster e-mail</th> | 582: <th scope="row">Webmaster email</th> |
| 598: <td> | 583: <td> |
| 599: <input type="text" name="form[webmaster_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_webmaster_email'] ?>" /> | 584: <input type="text" name="form[webmaster_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_webmaster_email'] ?>" /> |
| 600: <span>This is the address that all e-mails sent by the forum will be addressed from.</span> | 585: <span>This is the address that all emails sent by the forum will be addressed from.</span> |
| 601: </td> | 586: </td> |
| 602: </tr> | 587: </tr> |
| 603: <tr> | 588: <tr> |
| 604: <th scope="row">Subscriptions</th> | 589: <th scope="row">Subscriptions</th> |
| 605: <td> | 590: <td> |
| 606: <input type="radio" name="form[subscriptions]" value="1"<?php if ($pun_config['o_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong>Yes</strong> <input type="radio" name="form[subscriptions]" value="0"<?php if ($pun_config['o_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong>No</strong> | 591: <input type="radio" name="form[subscriptions]" value="1"<?php if ($pun_config['o_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong>Yes</strong> <input type="radio" name="form[subscriptions]" value="0"<?php if ($pun_config['o_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong>No</strong> |
| 607: <span>Enable users to subscribe to topics (receive e-mail when someone replies).</span> | 592: <span>Enable users to subscribe to topics (receive email when someone replies).</span> |
| 608: </td> | 593: </td> |
| 609: </tr> | 594: </tr> |
| 610: <tr> | 595: <tr> |
| 611: <th scope="row">SMTP server address</th> | 596: <th scope="row">SMTP server address</th> |
| 612: <td> | 597: <td> |
| 613: <input type="text" name="form[smtp_host]" size="30" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_host']) ?>" /> | 598: <input type="text" name="form[smtp_host]" size="30" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_host']) ?>" /> |
| 614: <span>The address of an external SMTP server to send e-mails with. You can specify a custom port number if the SMTP server doesn't run on the default port 25 (example: mail.myhost.com:3580). Leave blank to use the local mail program.</span> | 599: <span>The address of an external SMTP server to send emails with. You can specify a custom port number if the SMTP server doesn't run on the default port 25 (example: mail.myhost.com:3580). Leave blank to use the local mail program.</span> |
| 615: </td> | 600: </td> |
| 616: </tr> | 601: </tr> |
| 617: <tr> | 602: <tr> |
| 655: <th scope="row">Verify registrations</th> | 640: <th scope="row">Verify registrations</th> |
| 656: <td> | 641: <td> |
| 657: <input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <strong>Yes</strong> <input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <strong>No</strong> | 642: <input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <strong>Yes</strong> <input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <strong>No</strong> |
| 658: <span>When enabled, users are e-mailed a random password when they register. They can then log in and change the password in their profile if they see fit. This feature also requires users to verify new e-mail addresses if they choose to change from the one they registered with. This is an effective way of avoiding registration abuse and making sure that all users have "correct" e-mail addresses in their profiles.</span> | 643: <span>When enabled, users are emailed a random password when they register. They can then log in and change the password in their profile if they see fit. This feature also requires users to verify new email addresses if they choose to change from the one they registered with. This is an effective way of avoiding registration abuse and making sure that all users have "correct" email addresses in their profiles.</span> |
| 659: </td> | 644: </td> |
| 660: </tr> | 645: </tr> |
| 661: <tr> | 646: <tr> |
| 680: </td> | 665: </td> |
| 681: </tr> | 666: </tr> |
| 682: <tr> | 667: <tr> |
| 683: <th scope="row">Default e-mail setting</th> | 668: <th scope="row">Default email setting</th> |
| 684: <td> | 669: <td> |
| 685: <span>Choose the default privacy setting for new user registrations.</span> | 670: <span>Choose the default privacy setting for new user registrations.</span> |
| 686: <input type="radio" name="form[default_email_setting]" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> Display e-mail address to other users.<br /> | 671: <input type="radio" name="form[default_email_setting]" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> Display email address to other users.<br /> |
| 687: <input type="radio" name="form[default_email_setting]" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> Hide e-mail address but allow form e-mail.<br /> | 672: <input type="radio" name="form[default_email_setting]" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> Hide email address but allow form email.<br /> |
| 688: <input type="radio" name="form[default_email_setting]" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> Hide e-mail address and disallow form e-mail.<br /> | 673: <input type="radio" name="form[default_email_setting]" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> Hide email address and disallow form email.<br /> |
| 689: </td> | 674: </td> |
| 690: </tr> | 675: </tr> |
| 691: </table> | 676: </table> |
| a/upload/db_update.php |
b/upload/db_update.php |
| 1: <?php | 1: <?php |
| 2: /** | |
| 3: * Database updating script | |
| 4: * | |
| 5: * Updates the database to the latest version. | |
| 6: * | |
| 7: * @copyright Copyright (C) 2008 FluxBB.org, based on code copyright (C) 2002-2008 PunBB.org | |
| 8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | |
| 9: * @package FluxBB | |
| 10: */ | |
| 11: | 2: |
| | 3: /*--- |
| 12: | 4: |
| 13: define('UPDATE_TO', '1.4'); | 5: Copyright (C) 2008-2009 FluxBB.org |
| 14: define('UPDATE_TO_DB_REVISION', 1); | 6: based on code copyright (C) 2002-2008 PunBB.org |
| | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 15: | 8: |
| 16: // The number of items to process per pageview (lower this if the update script times out during UTF-8 conversion) | 9: ---*/ |
| | 10: |
| | 11: define('UPDATE_TO', '1.4-rc1'); |
| | 12: define('UPDATE_TO_DB_REVISION', 2); |
| | 13: |
| | 14: // The number of items to process per page view (lower this if the update script times out during UTF-8 conversion) |
| 17: define('PER_PAGE', 300); | 15: define('PER_PAGE', 300); |
| 18: | 16: |
| 19: | 17: |
| 28: if (file_exists(PUN_ROOT.'config.php')) | 26: if (file_exists(PUN_ROOT.'config.php')) |
| 29: include PUN_ROOT.'config.php'; | 27: include PUN_ROOT.'config.php'; |
| 30: | 28: |
| | 29: // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message |
| | 30: if (defined('FORUM')) |
| | 31: define('PUN', FORUM); |
| | 32: |
| 31: // If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory | 33: // If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory |
| 32: if (!defined('PUN')) | 34: if (!defined('PUN')) |
| 33: exit('This file must be run from the forum root directory.'); | 35: exit('This file must be run from the forum root directory.'); |
| 39: error_reporting(E_ALL); | 41: error_reporting(E_ALL); |
| 40: | 42: |
| 41: // Turn off magic_quotes_runtime | 43: // Turn off magic_quotes_runtime |
| 42: set_magic_quotes_runtime(0); | 44: if (get_magic_quotes_runtime()) |
| | 45: set_magic_quotes_runtime(0); |
| 43: | 46: |
| 44: // Turn off PHP time limit | 47: // Turn off PHP time limit |
| 45: @set_time_limit(0); | 48: @set_time_limit(0); |
| 61: // Strip out "bad" UTF-8 characters | 64: // Strip out "bad" UTF-8 characters |
| 62: forum_remove_bad_characters(); | 65: forum_remove_bad_characters(); |
| 63: | 66: |
| 64: // Instruct DB abstraction layer that we don't want it to "SET NAMES". If we need to, we'll do it ourselves below. | 67: // Instruct DB abstraction layer that we don't want it to "SET NAMES". If we need to, we'll do it ourselves below |
| 65: define('FORUM_NO_SET_NAMES', 1); | 68: define('FORUM_NO_SET_NAMES', 1); |
| 66: | 69: |
| 67: // Load DB abstraction layer and try to connect | 70: // Load DB abstraction layer and try to connect |
| 75: exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.'); | 78: exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.'); |
| 76: | 79: |
| 77: // If we've already done charset conversion in a previous update, we have to do SET NAMES | 80: // If we've already done charset conversion in a previous update, we have to do SET NAMES |
| 78: $db->set_names(strpos($cur_version, '1.3') === 0 ? 'utf8' : 'latin1'); | 81: $db->set_names(strpos($cur_version, '1.2') === 0 ? 'latin1' : 'utf8'); |
| 79: | 82: |
| 80: // Get the forum config | 83: // Get the forum config |
| 81: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); | 84: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); |
| 115: | 118: |
| 116: | 119: |
| 117: // | 120: // |
| 118: // Translates the number from an HTML numeric entity into an UTF-8 character | 121: // Translates the number from a HTML numeric entity into an UTF-8 character |
| 119: // | 122: // |
| 120: function dcr2utf8($src) | 123: function dcr2utf8($src) |
| 121: { | 124: { |
| 162: | 165: |
| 163: | 166: |
| 164: // | 167: // |
| 165: // Attemts to convert $str from $old_charset to UTF-8. Also converts HTML entities (including numeric entities) to UTF-8 characters. | 168: // Attempts to convert $str from $old_charset to UTF-8. Also converts HTML entities (including numeric entities) to UTF-8 characters |
| 166: // | 169: // |
| 167: function convert_to_utf8(&$str, $old_charset) | 170: function convert_to_utf8(&$str, $old_charset) |
| 168: { | 171: { |
| 230: $id = ($i == 0) ? $min_id : (($i == 1) ? $max_id : rand($min_id, $max_id)); | 233: $id = ($i == 0) ? $min_id : (($i == 1) ? $max_id : rand($min_id, $max_id)); |
| 231: | 234: |
| 232: $result = $db->query('SELECT p.message, p.poster, t.subject, f.forum_name FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON (t.id = p.topic_id) INNER JOIN '.$db->prefix.'forums AS f ON (f.id = t.forum_id) WHERE p.id >= '.$id.' LIMIT 1') or error('Unable to fetch post information', __FILE__, __LINE__, $db->error()); | 235: $result = $db->query('SELECT p.message, p.poster, t.subject, f.forum_name FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON (t.id = p.topic_id) INNER JOIN '.$db->prefix.'forums AS f ON (f.id = t.forum_id) WHERE p.id >= '.$id.' LIMIT 1') or error('Unable to fetch post information', __FILE__, __LINE__, $db->error()); |
| 233: $temp = $db->fetch_row($result); | 236: $temp = implode('', $db->fetch_row($result)); |
| 234: | 237: |
| 235: if (!seems_utf8($temp[0].$temp[1].$temp[2].$temp[3])) | 238: if (!seems_utf8($temp) || preg_match('/&(#[0-9]+|#x[a-z0-9]+|[a-z0-9]+);/i', $temp)) |
| 236: { | 239: { |
| 237: $seems_utf8 = false; | 240: $seems_utf8 = false; |
| 238: break; | 241: break; |
| 363: <tr> | 366: <tr> |
| 364: <th scope="row">Current character set:</th> | 367: <th scope="row">Current character set:</th> |
| 365: <td> | 368: <td> |
| 366: <input type="text" name="req_old_charset" size="12" maxlength="20" value="ISO-8859-1" /><br /> | 369: <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br /> |
| 367: <span>Accept default for English forums otherwise the character set of the primary langauge pack.</span> | 370: <span>Accept default for English forums otherwise the character set of the primary langauge pack.</span> |
| 368: </td> | 371: </td> |
| 369: </tr> | 372: </tr> |
| 393: | 396: |
| 394: // Start by updating the database structure | 397: // Start by updating the database structure |
| 395: case 'start': | 398: case 'start': |
| 396: // Make all e-mail fields VARCHAR(80) | 399: // Make all email fields VARCHAR(80) |
| 397: $db->alter_field('bans', 'email', 'VARCHAR(80)', true); | 400: $db->alter_field('bans', 'email', 'VARCHAR(80)', true); |
| 398: $db->alter_field('posts', 'poster_email', 'VARCHAR(80)', true); | 401: $db->alter_field('posts', 'poster_email', 'VARCHAR(80)', true); |
| 399: $db->alter_field('users', 'email', 'VARCHAR(80)', false, ''); | 402: $db->alter_field('users', 'email', 'VARCHAR(80)', false, ''); |
| 426: // Drop g_edit_subjects_interval column from groups table | 429: // Drop g_edit_subjects_interval column from groups table |
| 427: $db->drop_field('groups', 'g_edit_subjects_interval'); | 430: $db->drop_field('groups', 'g_edit_subjects_interval'); |
| 428: | 431: |
| 429: $new_config = array(); | |
| 430: | |
| 431: // Add database revision number | 432: // Add database revision number |
| 432: if (!array_key_exists('o_database_revision', $pun_config)) | 433: if (!array_key_exists('o_database_revision', $pun_config)) |
| 433: $new_config[] = '\'o_database_revision\', \'0\''; | 434: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_database_revision\', \'0\')') or error('Unable to insert config value \'o_database_revision\'', __FILE__, __LINE__, $db->error()); |
| 434: | 435: |
| 435: // Add default email setting option | 436: // Add default email setting option |
| 436: if (!array_key_exists('o_default_email_setting', $pun_config)) | 437: if (!array_key_exists('o_default_email_setting', $pun_config)) |
| 437: $new_config[] = '\'o_default_email_setting\', \'1\''; | 438: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_default_email_setting\', \'1\')') or error('Unable to insert config value \'o_default_email_setting\'', __FILE__, __LINE__, $db->error()); |
| 438: | 439: |
| 439: // Make sure we have o_additional_navlinks (was added in 1.2.1) | 440: // Make sure we have o_additional_navlinks (was added in 1.2.1) |
| 440: if (!array_key_exists('o_additional_navlinks', $pun_config)) | 441: if (!array_key_exists('o_additional_navlinks', $pun_config)) |
| 441: $new_config[] = '\'o_additional_navlinks\', \'\''; | 442: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_additional_navlinks\', \'\')') or error('Unable to insert config value \'o_additional_navlinks\'', __FILE__, __LINE__, $db->error()); |
| 442: | 443: |
| 443: // Insert new config option o_topic_views | 444: // Insert new config option o_topic_views |
| 444: if (!array_key_exists('o_topic_views', $pun_config)) | 445: if (!array_key_exists('o_topic_views', $pun_config)) |
| 445: $new_config[] = '\'o_topic_views\', \'1\''; | 446: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_topic_views\', \'1\')') or error('Unable to insert config value \'o_topic_views\'', __FILE__, __LINE__, $db->error()); |
| 446: | 447: |
| 447: // Insert new config option o_signatures | 448: // Insert new config option o_signatures |
| 448: if (!array_key_exists('o_signatures', $pun_config)) | 449: if (!array_key_exists('o_signatures', $pun_config)) |
| 449: $new_config[] = '\'o_signatures\', \'1\''; | 450: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_signatures\', \'1\')') or error('Unable to insert config value \'o_signatures\'', __FILE__, __LINE__, $db->error()); |
| 450: | 451: |
| 451: // Insert new config option o_smtp_ssl | 452: // Insert new config option o_smtp_ssl |
| 452: if (!array_key_exists('o_smtp_ssl', $pun_config)) | 453: if (!array_key_exists('o_smtp_ssl', $pun_config)) |
| 453: $new_config[] = '\'o_smtp_ssl\', \'0\''; | 454: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_smtp_ssl\', \'0\')') or error('Unable to insert config value \'o_smtp_ssl\'', __FILE__, __LINE__, $db->error()); |
| 454: | 455: |
| 455: // Insert new config option o_default_dst | 456: // Insert new config option o_default_dst |
| 456: if (!array_key_exists('o_default_dst', $pun_config)) | 457: if (!array_key_exists('o_default_dst', $pun_config)) |
| 457: $new_config[] = '\'o_default_dst\', \'0\''; | 458: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_default_dst\', \'0\')') or error('Unable to insert config value \'o_default_dst\'', __FILE__, __LINE__, $db->error()); |
| 458: | 459: |
| | 460: // Insert new config option o_quote_depth |
| 459: if (!array_key_exists('o_quote_depth', $pun_config)) | 461: if (!array_key_exists('o_quote_depth', $pun_config)) |
| 460: $new_config[] = '\'o_quote_depth\', \'3\''; | 462: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_quote_depth\', \'3\')') or error('Unable to insert config value \'o_quote_depth\'', __FILE__, __LINE__, $db->error()); |
| | 463: |
| | 464: // Insert config option o_base_url which was removed in 1.3 |
| | 465: if (!array_key_exists('o_base_url', $pun_config)) |
| | 466: { |
| | 467: // If it isn't in $pun_config['o_base_url'] it should be in $base_url, but just in-case it isn't we can make a guess at it |
| | 468: if (!isset($base_url)) |
| | 469: $base_url = 'http://'.$_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); |
| | 470: |
| | 471: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_base_url\', \''.$db->escape($base_url).'\')') or error('Unable to insert config value \'o_quote_depth\'', __FILE__, __LINE__, $db->error()); |
| | 472: } |
| | 473: |
| | 474: if (strpos($cur_version, '1.2') === 0) |
| | 475: { |
| | 476: // Groups are almost the same as 1.2: |
| | 477: // unverified: 32000 -> 0 |
| 461: | 478: |
| 462: if (!empty($new_config)) | 479: $db->query('UPDATE '.$db->prefix.'users SET group_id = 0 WHERE group_id = 32000') or error('Unable to update unverified users', __FILE__, __LINE__, $db->error()); |
| 463: $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES ('.implode('), (', $new_config).')') or error('Unable to insert config values', __FILE__, __LINE__, $db->error()); | 480: } |
| | 481: else if (strpos($cur_version, '1.3') === 0) |
| | 482: { |
| | 483: // Groups have changed quite a lot from 1.3: |
| | 484: // unverified: 0 -> 0 |
| | 485: // admin: 1 -> 1 |
| | 486: // mod: ? -> 2 |
| | 487: // guest: 2 -> 3 |
| | 488: // member: ? -> 4 |
| 464: | 489: |
| 465: unset($new_config); | 490: $result = $db->query('SELECT MAX(g_id) + 1 FROM '.$db->prefix.'groups') or error('Unable to select temp group ID', __FILE__, __LINE__, $db->error()); |
| | 491: $temp_id = $db->result($result); |
| | 492: |
| | 493: $result = $db->query('SELECT g_id FROM '.$db->prefix.'groups WHERE g_moderator = 1 AND g_id > 1 LIMIT 1') or error('Unable to select moderator group', __FILE__, __LINE__, $db->error()); |
| | 494: if ($db->num_rows($result)) |
| | 495: $mod_gid = $db->result($result); |
| | 496: else |
| | 497: { |
| | 498: $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('."'Moderators', 'Moderator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error()); |
| | 499: $mod_gid = $db->insert_id(); |
| | 500: } |
| | 501: |
| | 502: $member_gid = $pun_config['o_default_user_group']; |
| | 503: |
| | 504: // move the mod group to a temp place |
| | 505: $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$temp_id.' WHERE g_id = '.$mod_gid) or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 506: $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$temp_id.' WHERE group_id = '.$mod_gid) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 507: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$temp_id.' WHERE group_id = '.$mod_gid) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 508: if ($member_gid == $mod_gid) $member_gid = $temp_id; |
| | 509: |
| | 510: // move whoever is in 3 to a spare slot |
| | 511: $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$mod_gid.' WHERE g_id = 3') or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 512: $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$mod_gid.' WHERE group_id = 3') or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 513: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$mod_gid.' WHERE group_id = 3') or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 514: if ($member_gid == 3) $member_gid = $mod_gid; |
| | 515: |
| | 516: // move guest to 3 |
| | 517: $db->query('UPDATE '.$db->prefix.'groups SET g_id = 3 WHERE g_id = 2') or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 518: $db->query('UPDATE '.$db->prefix.'users SET group_id = 3 WHERE group_id = 2') or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 519: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = 3 WHERE group_id = 2') or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 520: if ($member_gid == 2) $member_gid = 3; |
| | 521: |
| | 522: // move mod group in temp place to 2 |
| | 523: $db->query('UPDATE '.$db->prefix.'groups SET g_id = 2 WHERE g_id = '.$temp_id) or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 524: $db->query('UPDATE '.$db->prefix.'users SET group_id = 2 WHERE group_id = '.$temp_id) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 525: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = 2 WHERE group_id = '.$temp_id) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 526: if ($member_gid == $temp_id) $member_gid = 2; |
| | 527: |
| | 528: // Only move stuff around if it isn't already in the right place |
| | 529: if ($member_gid != $mod_gid || $member_gid != 4) |
| | 530: { |
| | 531: // move members to temp place |
| | 532: $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$temp_id.' WHERE g_id = '.$member_gid) or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 533: $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$temp_id.' WHERE group_id = '.$member_gid) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 534: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$temp_id.' WHERE group_id = '.$member_gid) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 535: |
| | 536: // move whoever is in 4 to members place |
| | 537: $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$member_gid.' WHERE g_id = 4') or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 538: $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$member_gid.' WHERE group_id = 4') or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 539: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$member_gid.' WHERE group_id = 4') or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 540: |
| | 541: // move members in temp place to 4 |
| | 542: $db->query('UPDATE '.$db->prefix.'groups SET g_id = 4 WHERE g_id = '.$temp_id) or error('Unable to update group ID', __FILE__, __LINE__, $db->error()); |
| | 543: $db->query('UPDATE '.$db->prefix.'users SET group_id = 4 WHERE group_id = '.$temp_id) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error()); |
| | 544: $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = 4 WHERE group_id = '.$temp_id) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error()); |
| | 545: } |
| | 546: } |
| 466: | 547: |
| 467: // Server timezone is now simply the default timezone | 548: // Server time zone is now simply the default time zone |
| 468: if (!array_key_exists('o_default_timezone', $pun_config)) | 549: if (!array_key_exists('o_default_timezone', $pun_config)) |
| 469: $db->query('UPDATE '.$db->prefix.'config SET conf_name = \'o_default_timezone\' WHERE conf_name = \'o_server_timezone\'') or error('Unable to update timezone config', __FILE__, __LINE__, $db->error()); | 550: $db->query('UPDATE '.$db->prefix.'config SET conf_name = \'o_default_timezone\' WHERE conf_name = \'o_server_timezone\'') or error('Unable to update time zone config', __FILE__, __LINE__, $db->error()); |
| 470: | 551: |
| 471: // Increase visit timeout to 30 minutes (only if it hasn't been changed from the default) | 552: // Increase visit timeout to 30 minutes (only if it hasn't been changed from the default) |
| 472: if (!array_key_exists('o_database_revision', $pun_config) && $pun_config['o_timeout_visit'] == '600') | 553: if (!array_key_exists('o_database_revision', $pun_config) && $pun_config['o_timeout_visit'] == '600') |
| 563: break; | 644: break; |
| 564: } | 645: } |
| 565: | 646: |
| 566: // Add an index to logged on the online table | 647: // Add an index to logged in the online table |
| 567: $db->add_index('online', 'logged_idx', array('logged')); | 648: $db->add_index('online', 'logged_idx', array('logged')); |
| 568: | 649: |
| 569: // Add an index on last_post in the topics table | 650: // Add an index to last_post in the topics table |
| 570: $db->add_index('topics', 'last_post_idx', array('last_post')); | 651: $db->add_index('topics', 'last_post_idx', array('last_post')); |
| 571: | 652: |
| 572: // Add g_view_users field to groups table | 653: // Add g_view_users field to groups table |
| 591: $db->add_field('topics', 'first_post_id', 'INT(10) UNSIGNED', false, 0, 'posted'); | 672: $db->add_field('topics', 'first_post_id', 'INT(10) UNSIGNED', false, 0, 'posted'); |
| 592: $db->add_index('topics', 'first_post_id_idx', array('first_post_id')); | 673: $db->add_index('topics', 'first_post_id_idx', array('first_post_id')); |
| 593: | 674: |
| 594: // Now that we've added the column and indexed it, we need to give it correct data\ | 675: // Now that we've added the column and indexed it, we need to give it correct data |
| 595: $result = $db->query('SELECT MIN(id) AS first_post, topic_id FROM '.$db->prefix.'posts GROUP BY topic_id') or error('Unable to fetch first_post_id', __FILE__, __LINE__, $db->error()); | 676: $result = $db->query('SELECT MIN(id) AS first_post, topic_id FROM '.$db->prefix.'posts GROUP BY topic_id') or error('Unable to fetch first_post_id', __FILE__, __LINE__, $db->error()); |
| 596: | 677: |
| 597: while ($cur_post = $db->fetch_assoc($result)) | 678: while ($cur_post = $db->fetch_assoc($result)) |
| 607: $db->add_field('bans', 'ban_creator', 'INT(10) UNSIGNED', false, 0); | 688: $db->add_field('bans', 'ban_creator', 'INT(10) UNSIGNED', false, 0); |
| 608: | 689: |
| 609: // Add the time/date format settings to the user table | 690: // Add the time/date format settings to the user table |
| 610: $db->add_field('users', 'time_format', 'INT(10) UNSIGNED', false, 0, 'dst'); | 691: $db->add_field('users', 'time_format', 'TINYINT(1)', false, 0, 'dst'); |
| 611: $db->add_field('users', 'date_format', 'INT(10) UNSIGNED', false, 0, 'dst'); | 692: $db->add_field('users', 'date_format', 'TINYINT(1)', false, 0, 'dst'); |
| 612: | 693: |
| 613: // Should we do charset conversion or not? | 694: // Should we do charset conversion or not? |
| 614: if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) | 695: if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) |
| 615: $query_str = '?stage=conv_misc&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 696: $query_str = '?stage=conv_misc&req_old_charset='.$old_charset; |
| 616: else | 697: else |
| 617: $query_str = '?stage=conv_tables'; | 698: $query_str = '?stage=conv_tables'; |
| 618: break; | 699: break; |
| 709: } | 790: } |
| 710: } | 791: } |
| 711: | 792: |
| 712: $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 793: $query_str = '?stage=conv_reports&req_old_charset='.$old_charset; |
| 713: break; | 794: break; |
| 714: | 795: |
| 715: | 796: |
| 747: $result = $db->query('SELECT id FROM '.$db->prefix.'reports WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); | 828: $result = $db->query('SELECT id FROM '.$db->prefix.'reports WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| 748: | 829: |
| 749: if ($db->num_rows($result)) | 830: if ($db->num_rows($result)) |
| 750: $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result); | 831: $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&start_at='.$db->result($result); |
| 751: else | 832: else |
| 752: $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 833: $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset; |
| 753: break; | 834: break; |
| 754: | 835: |
| 755: | 836: |
| 788: $result = $db->query('SELECT id FROM '.$db->prefix.'search_words WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); | 869: $result = $db->query('SELECT id FROM '.$db->prefix.'search_words WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| 789: | 870: |
| 790: if ($db->num_rows($result)) | 871: if ($db->num_rows($result)) |
| 791: $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result); | 872: $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset.'&start_at='.$db->result($result); |
| 792: else | 873: else |
| 793: $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 874: $query_str = '?stage=conv_users&req_old_charset='.$old_charset; |
| 794: break; | 875: break; |
| 795: | 876: |
| 796: | 877: |
| 830: $result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); | 911: $result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| 831: | 912: |
| 832: if ($db->num_rows($result)) | 913: if ($db->num_rows($result)) |
| 833: $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result); | 914: $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&start_at='.$db->result($result); |
| 834: else | 915: else |
| 835: $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 916: $query_str = '?stage=conv_topics&req_old_charset='.$old_charset; |
| 836: break; | 917: break; |
| 837: | 918: |
| 838: | 919: |
| 871: $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); | 952: $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| 872: | 953: |
| 873: if ($db->num_rows($result)) | 954: if ($db->num_rows($result)) |
| 874: $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result); | 955: $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&start_at='.$db->result($result); |
| 875: else | 956: else |
| 876: $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 957: $query_str = '?stage=conv_posts&req_old_charset='.$old_charset; |
| 877: break; | 958: break; |
| 878: | 959: |
| 879: | 960: |
| 914: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); | 995: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| 915: | 996: |
| 916: if ($db->num_rows($result)) | 997: if ($db->num_rows($result)) |
| 917: $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result); | 998: $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&start_at='.$db->result($result); |
| 918: else | 999: else |
| 919: $query_str = '?stage=conv_tables'; | 1000: $query_str = '?stage=conv_tables'; |
| 920: break; | 1001: break; |
| 922: | 1003: |
| 923: // Convert table columns to utf8 (MySQL only) | 1004: // Convert table columns to utf8 (MySQL only) |
| 924: case 'conv_tables': | 1005: case 'conv_tables': |
| 925: // Do the cumbersome charset conversion of MySQL tables/columns | 1006: // Do the cumbersome charset conversion of MySQL tables/columns (if required - i.e. running 1.2) |
| 926: if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') | 1007: if (strpos($cur_version, '1.2') === 0 && ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')) |
| 927: { | 1008: { |
| 928: echo 'Converting table '.$db->prefix.'bans …<br />'."\n"; flush(); | 1009: echo 'Converting table '.$db->prefix.'bans …<br />'."\n"; flush(); |
| 929: convert_table_utf8($db->prefix.'bans'); | 1010: convert_table_utf8($db->prefix.'bans'); |
| 961: convert_table_utf8($db->prefix.'users'); | 1042: convert_table_utf8($db->prefix.'users'); |
| 962: } | 1043: } |
| 963: | 1044: |
| 964: $query_str = '?stage=finish'; | 1045: $query_str = '?stage=preparse_posts'; |
| | 1046: break; |
| | 1047: |
| | 1048: |
| | 1049: // Preparse posts |
| | 1050: case 'preparse_posts': |
| | 1051: require PUN_ROOT.'include/parser.php'; |
| | 1052: |
| | 1053: // Now we're definitely using UTF-8, so we convert the output properly |
| | 1054: $db->set_names('utf8'); |
| | 1055: |
| | 1056: // Determine where to start |
| | 1057: if ($start_at == 0) |
| | 1058: { |
| | 1059: // Get the first post ID from the db |
| | 1060: $result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id LIMIT 1') or error('Unable to fetch first post ID', __FILE__, __LINE__, $db->error()); |
| | 1061: |
| | 1062: if ($db->num_rows($result)) |
| | 1063: $start_at = $db->result($result); |
| | 1064: } |
| | 1065: $end_at = $start_at + PER_PAGE; |
| | 1066: |
| | 1067: // Fetch posts to process this cycle |
| | 1068: $result = $db->query('SELECT id, message FROM '.$db->prefix.'posts WHERE id >= '.$start_at.' AND id < '.$end_at.' ORDER BY id') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); |
| | 1069: |
| | 1070: $temp = array(); |
| | 1071: while ($cur_item = $db->fetch_assoc($result)) |
| | 1072: { |
| | 1073: echo 'Preparsing post '.$cur_item['id'].' …<br />'."\n"; |
| | 1074: $db->query('UPDATE '.$db->prefix.'posts SET message = \''.$db->escape(preparse_bbcode($cur_item['message'], $temp)).'\' WHERE id = '.$cur_item['id']) or error('Unable to update post', __FILE__, __LINE__, $db->error()); |
| | 1075: } |
| | 1076: |
| | 1077: // Check if there is more work to do |
| | 1078: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| | 1079: |
| | 1080: if ($db->num_rows($result)) |
| | 1081: $query_str = '?stage=preparse_posts&start_at='.$db->result($result); |
| | 1082: else |
| | 1083: $query_str = '?stage=preparse_sigs'; |
| | 1084: break; |
| | 1085: |
| | 1086: |
| | 1087: // Preparse signatures |
| | 1088: case 'preparse_sigs': |
| | 1089: require PUN_ROOT.'include/parser.php'; |
| | 1090: |
| | 1091: // Now we're definitely using UTF-8, so we convert the output properly |
| | 1092: $db->set_names('utf8'); |
| | 1093: |
| | 1094: // Determine where to start |
| | 1095: if ($start_at == 0) |
| | 1096: $start_at = 2; |
| | 1097: |
| | 1098: $end_at = $start_at + PER_PAGE; |
| | 1099: |
| | 1100: // Fetch users to process this cycle |
| | 1101: $result = $db->query('SELECT id, signature FROM '.$db->prefix.'users WHERE id >= '.$start_at.' AND id < '.$end_at.' ORDER BY id') or error('Unable to fetch users', __FILE__, __LINE__, $db->error()); |
| | 1102: |
| | 1103: $temp = array(); |
| | 1104: while ($cur_item = $db->fetch_assoc($result)) |
| | 1105: { |
| | 1106: echo 'Preparsing signature '.$cur_item['id'].' …<br />'."\n"; |
| | 1107: $db->query('UPDATE '.$db->prefix.'users SET signature = \''.$db->escape(preparse_bbcode($cur_item['signature'], $temp, true)).'\' WHERE id = '.$cur_item['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); |
| | 1108: } |
| | 1109: |
| | 1110: // Check if there is more work to do |
| | 1111: $result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error()); |
| | 1112: |
| | 1113: if ($db->num_rows($result)) |
| | 1114: $query_str = '?stage=preparse_sigs&start_at='.$db->result($result); |
| | 1115: else |
| | 1116: $query_str = '?stage=finish'; |
| 965: break; | 1117: break; |
| | 1118: |
| 966: | 1119: |
| 967: // Show results page | 1120: // Show results page |
| 968: case 'finish': | 1121: case 'finish': |
| a/upload/extern.php |
b/upload/extern.php |
| 1: <?php | 1: <?php |
| 2: /** | 2: |
| 3: * External syndication script | 3: /*--- |
| 4: * | 4: |
| 5: * Allows forum content to be syndicated outside of the site in various formats | 5: Copyright (C) 2008-2009 FluxBB.org |
| 6: * (ie: RSS, Atom, XML, HTML). | 6: based on code copyright (C) 2002-2008 PunBB.org |
| 7: * | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 8: * @copyright Copyright (C) 2008 FluxBB.org, based on code copyright (C) 2002-2008 PunBB.org | 8: |
| 9: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 9: ---*/ |
| 10: * @package FluxBB | 10: |
| 11: */ | 11: /*----------------------------------------------------------------------------- |
| 12: | |
| 13: /*********************************************************************** | |
| 14: | 12: |
| 15: INSTRUCTIONS | 13: INSTRUCTIONS |
| 16: | 14: |
| 24: | 22: |
| 25: The scripts behaviour is controlled via variables supplied in the | 23: The scripts behaviour is controlled via variables supplied in the |
| 26: URL to the script. The different variables are: action (what to | 24: URL to the script. The different variables are: action (what to |
| 27: do), show (how many items to display), fid (the ID or ID's of | 25: do), show (how many items to display), fid (the ID or IDs of |
| 28: the forum(s) to poll for topics), nfid (the ID or ID's of forums | 26: the forum(s) to poll for topics), nfid (the ID or IDs of forums |
| 29: that should be excluded), tid (the ID of the topic from which to | 27: that should be excluded), tid (the ID of the topic from which to |
| 30: display posts) and type (output as HTML or RSS). The only | 28: display posts) and type (output as HTML or RSS). The only |
| 31: mandatory variable is action. Possible/default values are: | 29: mandatory variable is action. Possible/default values are: |
| 40: xml - output as XML | 38: xml - output as XML |
| 41: html - output as HTML (<li>'s) | 39: html - output as HTML (<li>'s) |
| 42: | 40: |
| 43: fid: One or more forum ID's (comma-separated). If ignored, | 41: fid: One or more forum IDs (comma-separated). If ignored, |
| 44: topics from all readable forums will be pulled. | 42: topics from all readable forums will be pulled. |
| 45: | 43: |
| 46: nfid: One or more forum ID's (comma-separated) that are to be | 44: nfid: One or more forum IDs (comma-separated) that are to be |
| 47: excluded. E.g. the ID of a a test forum. | 45: excluded. E.g. the ID of a a test forum. |
| 48: | 46: |
| 49: tid: A topic ID from which to show posts. If a tid is supplied, | 47: tid: A topic ID from which to show posts. If a tid is supplied, |
| 56: posted - show topics ordered by when they were first | 54: posted - show topics ordered by when they were first |
| 57: posted, giving information about the original post. | 55: posted, giving information about the original post. |
| 58: | 56: |
| 59: | 57: -----------------------------------------------------------------------------*/ |
| 60: /***********************************************************************/ | |
| 61: | 58: |
| 62: define('PUN_QUIET_VISIT', 1); | 59: define('PUN_QUIET_VISIT', 1); |
| 63: | 60: |
| 67: | 64: |
| 68: // The length at which topic subjects will be truncated (for HTML output) | 65: // The length at which topic subjects will be truncated (for HTML output) |
| 69: if (!defined('FORUM_EXTERN_MAX_SUBJECT_LENGTH')) | 66: if (!defined('FORUM_EXTERN_MAX_SUBJECT_LENGTH')) |
| 70: define('FORUM_EXTERN_MAX_SUBJECT_LENGTH', 30); | 67: define('FORUM_EXTERN_MAX_SUBJECT_LENGTH', 30); |
| 71: | 68: |
| 72: // If we're a guest and we've sent a username/pass, we can try to authenticate using those details | 69: // If we're a guest and we've sent a username/pass, we can try to authenticate using those details |
| 73: if ($pun_user['is_guest'] && isset($_SERVER['PHP_AUTH_USER'])) | 70: if ($pun_user['is_guest'] && isset($_SERVER['PHP_AUTH_USER'])) |
| 267: // Show recent discussions | 264: // Show recent discussions |
| 268: if ($action == 'feed') | 265: if ($action == 'feed') |
| 269: { | 266: { |
| | 267: require PUN_ROOT.'include/parser.php'; |
| | 268: |
| 270: // Determine what type of feed to output | 269: // Determine what type of feed to output |
| 271: $type = isset($_GET['type']) && in_array($_GET['type'], array('html', 'rss', 'atom', 'xml')) ? $_GET['type'] : 'html'; | 270: $type = isset($_GET['type']) && in_array($_GET['type'], array('html', 'rss', 'atom', 'xml')) ? $_GET['type'] : 'html'; |
| 272: | 271: |
| 302: ); | 301: ); |
| 303: | 302: |
| 304: // Fetch $show posts | 303: // Fetch $show posts |
| 305: $result = $db->query('SELECT p.id, p.poster, p.message, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$tid.' ORDER BY p.posted DESC LIMIT '.$show) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); | 304: $result = $db->query('SELECT p.id, p.poster, p.message, p.hide_smilies, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$tid.' ORDER BY p.posted DESC LIMIT '.$show) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
| 306: while ($cur_post = $db->fetch_assoc($result)) | 305: while ($cur_post = $db->fetch_assoc($result)) |
| 307: { | 306: { |
| 308: if ($pun_config['o_censoring'] == '1') | 307: $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); |
| 309: $cur_post['message'] = censor_words($cur_post['message']); | |
| 310: | 308: |
| 311: $item = array( | 309: $item = array( |
| 312: 'id' => $cur_post['id'], | 310: 'id' => $cur_post['id'], |
| 340: $order_posted = isset($_GET['order']) && $_GET['order'] == 'posted'; | 338: $order_posted = isset($_GET['order']) && $_GET['order'] == 'posted'; |
| 341: $forum_name = ''; | 339: $forum_name = ''; |
| 342: $forum_sql = ''; | 340: $forum_sql = ''; |
| 343: | 341: |
| 344: // Were any forum ID's supplied? | 342: // Were any forum IDs supplied? |
| 345: if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '') | 343: if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '') |
| 346: { | 344: { |
| 347: $fids = explode(',', pun_trim($_GET['fid'])); | 345: $fids = explode(',', pun_trim($_GET['fid'])); |
| 355: // Fetch forum name | 353: // Fetch forum name |
| 356: $result = $db->query('SELECT f.forum_name 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='.$fids[0]) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error()); | 354: $result = $db->query('SELECT f.forum_name 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='.$fids[0]) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error()); |
| 357: if ($db->num_rows($result)) | 355: if ($db->num_rows($result)) |
| 358: $forum_name = $lang_common['Title separator'].$db->result($result); | 356: $forum_name = ' '.$db->result($result); |
| 359: } | 357: } |
| 360: } | 358: } |
| 361: | 359: |
| 362: // Any forum ID's to exclude? | 360: // Any forum IDs to exclude? |
| 363: if (isset($_GET['nfid']) && is_scalar($_GET['nfid']) && $_GET['nfid'] != '') | 361: if (isset($_GET['nfid']) && is_scalar($_GET['nfid']) && $_GET['nfid'] != '') |
| 364: { | 362: { |
| 365: $nfids = explode(',', pun_trim($_GET['nfid'])); | 363: $nfids = explode(',', pun_trim($_GET['nfid'])); |
| 373: $feed = array( | 371: $feed = array( |
| 374: 'title' => $pun_config['o_board_title'].$forum_name, | 372: 'title' => $pun_config['o_board_title'].$forum_name, |
| 375: 'link' => $pun_config['o_base_url'].'/index.php', | 373: 'link' => $pun_config['o_base_url'].'/index.php', |
| 376: 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), | 374: 'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']), |
| 377: 'items' => array(), | 375: 'items' => array(), |
| 378: 'type' => 'topics' | 376: 'type' => 'topics' |
| 379: ); | 377: ); |
| 380: | 378: |
| 381: // Fetch $show topics | 379: // Fetch $show topics |
| 382: $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.$show) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); | 380: $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.$show) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
| 383: while ($cur_topic = $db->fetch_assoc($result)) | 381: while ($cur_topic = $db->fetch_assoc($result)) |
| 384: { | 382: { |
| | 383: $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
| | 384: |
| 385: if ($pun_config['o_censoring'] == '1') | 385: if ($pun_config['o_censoring'] == '1') |
| 386: { | |
| 387: $cur_topic['subject'] = censor_words($cur_topic['subject']); | 386: $cur_topic['subject'] = censor_words($cur_topic['subject']); |
| 388: $cur_topic['message'] = censor_words($cur_topic['message']); | |
| 389: } | |
| 390: | 387: |
| 391: $item = array( | 388: $item = array( |
| 392: 'id' => $cur_topic['id'], | 389: 'id' => $cur_topic['id'], |
| 393: 'title' => $cur_topic['subject'], | 390: 'title' => $cur_topic['subject'], |
| 394: 'link' => $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&action=new'), | 391: 'link' => $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&action=new'), |
| 395: 'description' => $cur_topic['message'], | 392: 'description' => $cur_topic['message'], |
| 396: 'author' => array( | 393: 'author' => array( |
| 397: 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] | 394: 'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster'] |
| 398: ), | 395: ), |
| 430: $users = array(); | 427: $users = array(); |
| 431: | 428: |
| 432: $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); | 429: $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); |
| 433: | 430: |
| 434: while ($pun_user_online = $db->fetch_assoc($result)) | 431: while ($pun_user_online = $db->fetch_assoc($result)) |
| 435: { | 432: { |
| 436: if ($pun_user_online['user_id'] > 1) | 433: if ($pun_user_online['user_id'] > 1) |
| 447: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); | 444: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); |
| 448: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | 445: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 449: header('Pragma: public'); | 446: header('Pragma: public'); |
| 450: | 447: |
| 451: echo $lang_index['Guests online'].': '.forum_number_format($num_guests).'<br />'."\n"; | 448: echo $lang_index['Guests online'].': '.forum_number_format($num_guests).'<br />'."\n"; |
| 452: | 449: |
| 453: if ($action == 'online_full' && !empty($users)) | 450: if ($action == 'online_full' && !empty($users)) |
| 473: | 470: |
| 474: $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); | 471: $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); |
| 475: list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); | 472: list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); |
| 476: | 473: |
| 477: // Send the Content-type header in case the web server is setup to send something else | 474: // Send the Content-type header in case the web server is setup to send something else |
| 478: header('Content-type: text/html; charset=utf-8'); | 475: header('Content-type: text/html; charset=utf-8'); |
| 479: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); | 476: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); |
| 484: echo $lang_index['Newest user'].': '.(($pun_user['g_view_users'] == '1') ? '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username'])).'<br />'."\n"; | 481: echo $lang_index['Newest user'].': '.(($pun_user['g_view_users'] == '1') ? '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username'])).'<br />'."\n"; |
| 485: echo $lang_index['No of topics'].': '.forum_number_format($stats['total_topics']).'<br />'."\n"; | 482: echo $lang_index['No of topics'].': '.forum_number_format($stats['total_topics']).'<br />'."\n"; |
| 486: echo $lang_index['No of posts'].': '.forum_number_format($stats['total_posts']).'<br />'."\n"; | 483: echo $lang_index['No of posts'].': '.forum_number_format($stats['total_posts']).'<br />'."\n"; |
| 487: | 484: |
| 488: exit; | 485: exit; |
| 489: } | 486: } |
| 490: | 487: |
| a/upload/help.php |
b/upload/help.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: // Tell header.php to use the help template | 11: // Tell header.php to use the help template |
| 27: define('PUN_HELP', 1); | 12: define('PUN_HELP', 1); |
| 45: <h2><?php echo $lang_common['BBCode'] ?></h2> | 30: <h2><?php echo $lang_common['BBCode'] ?></h2> |
| 46: <div class="box"> | 31: <div class="box"> |
| 47: <div class="inbox"> | 32: <div class="inbox"> |
| 48: <a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?><br /><br /> | 33: <p><a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?></p> |
| 49: <?php echo $lang_help['BBCode info 2'] ?> | 34: <p><?php echo $lang_help['BBCode info 2'] ?></p> |
| 50: </div> | 35: </div> |
| 51: </div> | 36: </div> |
| 52: <h2><?php echo $lang_help['Text style'] ?></h2> | 37: <h2><?php echo $lang_help['Text style'] ?></h2> |
| 53: <div class="box"> | 38: <div class="box"> |
| 54: <div class="inbox"> | 39: <div class="inbox"> |
| 55: <?php echo $lang_help['Text style info'] ?><br /><br /> | 40: <p><?php echo $lang_help['Text style info'] ?></p> |
| 56: [b]<?php echo $lang_help['Bold text'] ?>[/b] <?php echo $lang_help['produces'] ?> <strong><?php echo $lang_help['Bold text'] ?></strong><br /> | 41: <p><code>[b]<?php echo $lang_help['Bold text'] ?>[/b]</code> <?php echo $lang_help['produces'] ?> <strong><?php echo $lang_help['Bold text'] ?></strong></p> |
| 57: [u]<?php echo $lang_help['Underlined text'] ?>[/u] <?php echo $lang_help['produces'] ?> <span class="bbu"><?php echo $lang_help['Underlined text'] ?></span><br /> | 42: <p><code>[u]<?php echo $lang_help['Underlined text'] ?>[/u]</code> <?php echo $lang_help['produces'] ?> <span class="bbu"><?php echo $lang_help['Underlined text'] ?></span></p> |
| 58: [i]<?php echo $lang_help['Italic text'] ?>[/i] <?php echo $lang_help['produces'] ?> <i><?php echo $lang_help['Italic text'] ?></i><br /> | 43: <p><code>[i]<?php echo $lang_help['Italic text'] ?>[/i]</code> <?php echo $lang_help['produces'] ?> <i><?php echo $lang_help['Italic text'] ?></i></p> |
| 59: [color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span><br /> | 44: <p><code>[color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span></p> |
| 60: [color=blue]<?php echo $lang_help['Blue text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: blue"><?php echo $lang_help['Blue text'] ?></span> | 45: <p><code>[color=blue]<?php echo $lang_help['Blue text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <span style="color: blue"><?php echo $lang_help['Blue text'] ?></span></p> |
| | 46: <p><code>[h]<?php echo $lang_help['Heading text'] ?>[/h]</code> <?php echo $lang_help['produces'] ?></p><h5><?php echo $lang_help['Heading text'] ?></h5> |
| 61: </div> | 47: </div> |
| 62: </div> | 48: </div> |
| 63: <h2><?php echo $lang_help['Links and images'] ?></h2> | 49: <h2><?php echo $lang_help['Links and images'] ?></h2> |
| 64: <div class="box"> | 50: <div class="box"> |
| 65: <div class="inbox"> | 51: <div class="inbox"> |
| 66: <?php echo $lang_help['Links info'] ?><br /><br /> | 52: <p><?php echo $lang_help['Links info'] ?></p> |
| 67: [url=<?php echo $pun_config['o_base_url'].'/' ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url] <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'].'/' ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a><br /> | 53: <p><code>[url=<?php echo $pun_config['o_base_url'].'/' ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url]</code> <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'].'/' ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a></p> |
| 68: [url]<?php echo $pun_config['o_base_url'].'/' ?>[/url] <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'] ?>"><?php echo $pun_config['o_base_url'].'/' ?></a><br /> | 54: <p><code>[url]<?php echo $pun_config['o_base_url'].'/' ?>[/url]</code> <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'] ?>"><?php echo $pun_config['o_base_url'].'/' ?></a></p> |
| 69: [email]myname@mydomain.com[/email] <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com">myname@mydomain.com</a><br /> | 55: <p><code>[email]myname@mydomain.com[/email]</code> <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com">myname@mydomain.com</a></p> |
| 70: [email=myname@mydomain.com]<?php echo $lang_help['My e-mail address'] ?>[/email] <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com"><?php echo $lang_help['My e-mail address'] ?></a> | 56: <p><code>[email=myname@mydomain.com]<?php echo $lang_help['My email address'] ?>[/email]</code> <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com"><?php echo $lang_help['My email address'] ?></a></p> |
| 71: </div> | 57: </div> |
| 72: <br /><br /> | |
| 73: <div class="inbox"> | 58: <div class="inbox"> |
| 74: <a name="img"></a><?php echo $lang_help['Images info'] ?><br /><br /> | 59: <p><a name="img"></a><?php echo $lang_help['Images info'] ?></p> |
| 75: [img=FluxBB bbcode test]<?php echo $pun_config['o_base_url'].'/' ?>img/test.png[/img] <?php echo $lang_help['produces'] ?> <img src="<?php echo $pun_config['o_base_url'].'/' ?>img/test.png" alt="FluxBB bbcode test" /> | 60: <p><code>[img=FluxBB bbcode test]<?php echo $pun_config['o_base_url'].'/' ?>img/test.png[/img]</code> <?php echo $lang_help['produces'] ?> <img src="<?php echo $pun_config['o_base_url'].'/' ?>img/test.png" alt="FluxBB bbcode test" /></p> |
| 76: </div> | 61: </div> |
| 77: </div> | 62: </div> |
| 78: <h2><?php echo $lang_help['Quotes'] ?></h2> | 63: <h2><?php echo $lang_help['Quotes'] ?></h2> |
| 79: <div class="box"> | 64: <div class="box"> |
| 80: <div class="inbox"> | 65: <div class="inbox"> |
| 81: <?php echo $lang_help['Quotes info'] ?><br /><br /> | 66: <p><?php echo $lang_help['Quotes info'] ?></p> |
| 82: [quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br /> | 67: <p><code>[quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p> |
| 83: <?php echo $lang_help['produces quote box'] ?><br /><br /> | 68: <p><?php echo $lang_help['produces quote box'] ?></p> |
| 84: <div class="postmsg"> | 69: <div class="postmsg"> |
| 85: <blockquote><div class="incqbox"><h4>James <?php echo $lang_common['wrote'] ?>:</h4><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote> | 70: <div class="quotebox"><cite>James <?php echo $lang_common['wrote'] ?>:</cite><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div> |
| 86: </div> | 71: </div> |
| 87: <br /> | 72: <p><?php echo $lang_help['Quotes info 2'] ?></p> |
| 88: <?php echo $lang_help['Quotes info 2'] ?><br /><br /> | 73: <p><code>[quote]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p> |
| 89: [quote]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br /> | 74: <p><?php echo $lang_help['produces quote box'] ?></p> |
| 90: <?php echo $lang_help['produces quote box'] ?><br /><br /> | |
| 91: <div class="postmsg"> | 75: <div class="postmsg"> |
| 92: <blockquote><div class="incqbox"><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote> | 76: <div class="quotebox"><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div> |
| 93: </div> | 77: </div> |
| | 78: <p><?php echo $lang_help['quote note'] ?></p> |
| 94: </div> | 79: </div> |
| 95: </div> | 80: </div> |
| 96: <h2><?php echo $lang_help['Code'] ?></h2> | 81: <h2><?php echo $lang_help['Code'] ?></h2> |
| 97: <div class="box"> | 82: <div class="box"> |
| 98: <div class="inbox"> | 83: <div class="inbox"> |
| 99: <?php echo $lang_help['Code info'] ?><br /><br /> | 84: <p><?php echo $lang_help['Code info'] ?></p> |
| 100: [code]<?php echo $lang_help['Code text'] ?>[/code]<br /><br /> | 85: <p><code>[code]<?php echo $lang_help['Code text'] ?>[/code]</code></p> |
| 101: <?php echo $lang_help['produces code box'] ?><br /><br /> | 86: <p><?php echo $lang_help['produces code box'] ?></p> |
| 102: <div class="postmsg"> | 87: <div class="postmsg"> |
| 103: <div class="codebox"><div class="incqbox"><h4><?php echo $lang_common['Code'] ?>:</h4><div class="scrollbox" style="height: 4.5em"><pre><?php echo $lang_help['Code text'] ?></pre></div></div></div> | 88: <div class="codebox"><pre><code><?php echo $lang_help['Code text'] ?></code></pre></div> |
| 104: </div> | 89: </div> |
| 105: </div> | 90: </div> |
| 106: </div> | 91: </div> |
| 107: <h2><?php echo $lang_help['Lists'] ?></h2> | 92: <h2><?php echo $lang_help['Lists'] ?></h2> |
| 108: <div class="box"> | 93: <div class="box"> |
| 109: <div class="inbox"> | 94: <div class="inbox"> |
| 110: <a name="lists"></a><?php echo $lang_help['List info'] ?><br /><br /> | 95: <p><a name="lists"></a><?php echo $lang_help['List info'] ?></p> |
| 111: | 96: |
| 112: <p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces list'] ?></span></p> | 97: <p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces list'] ?></span></p> |
| 113: <ul><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ul> | |
| 114: | 98: |
| | 99: <div class="postmsg"> |
| | 100: <ul><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ul> |
| | 101: </div> |
| 115: <p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces decimal list'] ?></span></p> | 102: <p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces decimal list'] ?></span></p> |
| 116: <ol class="decimal"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol> | 103: <div class="postmsg"> |
| 117: | 104: <ol class="decimal"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol> |
| | 105: </div> |
| 118: <p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces alpha list'] ?></span></p> | 106: <p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces alpha list'] ?></span></p> |
| 119: <ol class="alpha"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol> | 107: <div class="postmsg"> |
| | 108: <ol class="alpha"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol> |
| | 109: </div> |
| 120: </div> | 110: </div> |
| 121: </div> | 111: </div> |
| 122: <h2><?php echo $lang_help['Nested tags'] ?></h2> | 112: <h2><?php echo $lang_help['Nested tags'] ?></h2> |
| 123: <div class="box"> | 113: <div class="box"> |
| 124: <div class="inbox"> | 114: <div class="inbox"> |
| 125: <?php echo $lang_help['Nested tags info'] ?><br /><br /> | 115: <p><?php echo $lang_help['Nested tags info'] ?></p> |
| 126: [b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b] <?php echo $lang_help['produces'] ?> <strong><span class="bbu"><?php echo $lang_help['Bold, underlined text'] ?></span></strong> | 116: <p><code>[b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b]</code> <?php echo $lang_help['produces'] ?> <strong><span class="bbu"><?php echo $lang_help['Bold, underlined text'] ?></span></strong></p> |
| 127: </div> | 117: </div> |
| 128: </div> | 118: </div> |
| 129: <h2><?php echo $lang_common['Smilies'] ?></h2> | 119: <h2><?php echo $lang_common['Smilies'] ?></h2> |
| 130: <div class="box"> | 120: <div class="box"> |
| 131: <div class="inbox"> | 121: <div class="inbox"> |
| 132: <a name="smilies"></a><?php echo $lang_help['Smilies info'] ?><br /><br /> | 122: <p><a name="smilies"></a><?php echo $lang_help['Smilies info'] ?></p> |
| 133: | 123: <div class="postmsg"> |
| 134: <ul> | |
| 135: <?php | 124: <?php |
| 136: | 125: |
| 137: // Display the smiley set | 126: // Display the smiley set |
| 143: $smiley_groups[$smiley_img][] = $smiley_text; | 132: $smiley_groups[$smiley_img][] = $smiley_text; |
| 144: | 133: |
| 145: foreach ($smiley_groups as $smiley_img => $smiley_texts) | 134: foreach ($smiley_groups as $smiley_img => $smiley_texts) |
| 146: echo "\t\t\t".'<li>'.implode(' '.$lang_common['and'].' ', $smiley_texts).' <span>'.$lang_help['produces'].'</span> <img src="img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></li>'."\n"; | 135: echo "\t\t\t".'<p><code>'.implode('</code> '.$lang_common['and'].' <code>', $smiley_texts).'</code> <span>'.$lang_help['produces'].'</span> <img src="img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></p>'."\n"; |
| 147: | 136: |
| 148: ?> | 137: ?> |
| 149: </ul> | 138: </div> |
| 150: </div> | 139: </div> |
| 151: </div> | 140: </div> |
| 152: <?php | 141: <?php |
| a/upload/include/functions.php |
b/upload/include/functions.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 7: | 8: |
| 8: PunBB is free software; you can redistribute it and/or modify it | 9: ---*/ |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | 10: |
| 13: PunBB is distributed in the hope that it will be useful, but | 11: // |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | 12: // Return current timestamp (with microseconds) as a float |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13: // |
| 16: GNU General Public License for more details. | 14: function get_microtime() |
| 17: | 15: { |
| 18: You should have received a copy of the GNU General Public License | 16: list($usec, $sec) = explode(' ', microtime()); |
| 19: along with this program; if not, write to the Free Software | 17: return ((float)$usec + (float)$sec); |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 18: } |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 19: |
| 25: // | 20: // |
| 26: // Cookie stuff! | 21: // Cookie stuff! |
| 30: global $db, $db_type, $pun_config, $cookie_name, $cookie_seed; | 25: global $db, $db_type, $pun_config, $cookie_name, $cookie_seed; |
| 31: | 26: |
| 32: $now = time(); | 27: $now = time(); |
| 33: $expire = $now + 31536000; // The cookie expires after a year | 28: $expire = $now + 31536000; // The cookie expires after a year |
| 34: | 29: |
| 35: // We assume it's a guest | 30: // We assume it's a guest |
| 36: $cookie = array('user_id' => 1, 'password_hash' => 'Guest'); | 31: $cookie = array('user_id' => 1, 'password_hash' => 'Guest'); |
| 75: { | 70: { |
| 76: $pun_user['logged'] = $now; | 71: $pun_user['logged'] = $now; |
| 77: | 72: |
| 78: // With MySQL/MySQLi, REPLACE INTO avoids a user having two rows in the online table | 73: // With MySQL/MySQLi/SQLite, REPLACE INTO avoids a user having two rows in the online table |
| 79: switch ($db_type) | 74: switch ($db_type) |
| 80: { | 75: { |
| 81: case 'mysql': | 76: case 'mysql': |
| 82: case 'mysqli': | 77: case 'mysqli': |
| 83: case 'mysql_innodb': | 78: case 'mysql_innodb': |
| 84: case 'mysqli_innodb': | 79: case 'mysqli_innodb': |
| | 80: case 'sqlite': |
| 85: $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); | 81: $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); |
| 86: break; | 82: break; |
| 87: | 83: |
| 88: default: | 84: default: |
| 89: $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); | 85: $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) SELECT '.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].' WHERE NOT EXISTS (SELECT 1 FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); |
| 90: break; | 86: break; |
| 91: } | 87: } |
| 92: | 88: |
| 156: // | 152: // |
| 157: function get_current_url($max_length = 0) | 153: function get_current_url($max_length = 0) |
| 158: { | 154: { |
| 159: global $base_url; | |
| 160: | |
| 161: $protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? 'http://' : 'https://'; | 155: $protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? 'http://' : 'https://'; |
| 162: $port = (isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http://') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https://')) && strpos($_SERVER['HTTP_HOST'], ':') === false) ? ':'.$_SERVER['SERVER_PORT'] : ''; | 156: $port = (isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http://') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https://')) && strpos($_SERVER['HTTP_HOST'], ':') === false) ? ':'.$_SERVER['SERVER_PORT'] : ''; |
| 163: | 157: |
| 192: { | 186: { |
| 193: $pun_user['logged'] = time(); | 187: $pun_user['logged'] = time(); |
| 194: | 188: |
| 195: // With MySQL/MySQLi, REPLACE INTO avoids a user having two rows in the online table | 189: // With MySQL/MySQLi/SQLite, REPLACE INTO avoids a user having two rows in the online table |
| 196: switch ($db_type) | 190: switch ($db_type) |
| 197: { | 191: { |
| 198: case 'mysql': | 192: case 'mysql': |
| 199: case 'mysqli': | 193: case 'mysqli': |
| 200: case 'mysql_innodb': | 194: case 'mysql_innodb': |
| 201: case 'mysqli_innodb': | 195: case 'mysqli_innodb': |
| | 196: case 'sqlite': |
| 202: $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); | 197: $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); |
| 203: break; | 198: break; |
| 204: | 199: |
| 205: default: | 200: default: |
| 206: $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); | 201: $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) SELECT 1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].' WHERE NOT EXISTS (SELECT 1 FROM '.$db->prefix.'online WHERE ident=\''.$db->escape($remote_addr).'\')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); |
| 207: break; | 202: break; |
| 208: } | 203: } |
| 209: } | 204: } |
| 409: } | 404: } |
| 410: } | 405: } |
| 411: | 406: |
| 412: return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>'; | 407: return '<ul>'."\n\t\t\t\t".implode($lang_common['Menu link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>'; |
| 413: } | 408: } |
| 414: | 409: |
| 415: | 410: |
| 497: } | 492: } |
| 498: | 493: |
| 499: forum_setcookie($cookie_name.'_track', $cookie_data, time() + $pun_config['o_timeout_visit']); | 494: forum_setcookie($cookie_name.'_track', $cookie_data, time() + $pun_config['o_timeout_visit']); |
| 500: $_COOKIE[$cookie_name.'_track'] = $cookie_data; // Set it directly in $_COOKIE as well | 495: $_COOKIE[$cookie_name.'_track'] = $cookie_data; // Set it directly in $_COOKIE as well |
| 501: } | 496: } |
| 502: | 497: |
| 503: | 498: |
| 541: $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error()); | 536: $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error()); |
| 542: list($num_topics, $num_posts) = $db->fetch_row($result); | 537: list($num_topics, $num_posts) = $db->fetch_row($result); |
| 543: | 538: |
| 544: $num_posts = $num_posts + $num_topics; // $num_posts is only the sum of all replies (we have to add the topic posts) | 539: $num_posts = $num_posts + $num_topics; // $num_posts is only the sum of all replies (we have to add the topic posts) |
| 545: | 540: |
| 546: $result = $db->query('SELECT last_post, last_post_id, last_poster FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error()); | 541: $result = $db->query('SELECT last_post, last_post_id, last_poster FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error()); |
| 547: if ($db->num_rows($result)) // There are topics in the forum | 542: if ($db->num_rows($result)) // There are topics in the forum |
| 548: { | 543: { |
| 549: list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result); | 544: list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result); |
| 550: | 545: |
| 551: $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.$db->escape($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error()); | 546: $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.$db->escape($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error()); |
| 552: } | 547: } |
| 553: else // There are no topics | 548: else // There are no topics |
| 554: $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error()); | 549: $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error()); |
| 555: } | 550: } |
| 556: | 551: |
| 583: // Delete the topic and any redirect topics | 578: // Delete the topic and any redirect topics |
| 584: $db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$topic_id.' OR moved_to='.$topic_id) or error('Unable to delete topic', __FILE__, __LINE__, $db->error()); | 579: $db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$topic_id.' OR moved_to='.$topic_id) or error('Unable to delete topic', __FILE__, __LINE__, $db->error()); |
| 585: | 580: |
| 586: // Create a list of the post ID's in this topic | 581: // Create a list of the post IDs in this topic |
| 587: $post_ids = ''; | 582: $post_ids = ''; |
| 588: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); | 583: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); |
| 589: while ($row = $db->fetch_row($result)) | 584: while ($row = $db->fetch_row($result)) |
| 590: $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0]; | 585: $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0]; |
| 591: | 586: |
| 592: // Make sure we have a list of post ID's | 587: // Make sure we have a list of post IDs |
| 593: if ($post_ids != '') | 588: if ($post_ids != '') |
| 594: { | 589: { |
| 595: strip_search_index($post_ids); | 590: strip_search_index($post_ids); |
| 833: <h2><span><?php echo $lang_common['Info'] ?></span></h2> | 828: <h2><span><?php echo $lang_common['Info'] ?></span></h2> |
| 834: <div class="box"> | 829: <div class="box"> |
| 835: <div class="inbox"> | 830: <div class="inbox"> |
| 836: <p><?php echo $message ?></p> | 831: <p><?php echo $message ?></p> |
| 837: <?php if (!$no_back_link): ?> <p><a href="javascript: history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 832: <?php if (!$no_back_link): ?> <p><a href="javascript: history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 838: <?php endif; ?> </div> | 833: <?php endif; ?> </div> |
| 839: </div> | 834: </div> |
| 840: </div> | 835: </div> |
| 845: | 840: |
| 846: | 841: |
| 847: // | 842: // |
| 848: // Format a time string according to $time_format and timezones | 843: // Format a time string according to $time_format and time zones |
| 849: // | 844: // |
| 850: function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false) | 845: function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false) |
| 851: { | 846: { |
| 966: | 961: |
| 967: // | 962: // |
| 968: // Compute a hash of $str | 963: // Compute a hash of $str |
| 969: // Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5(). | 964: // Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5() |
| 970: // | 965: // |
| 971: function pun_hash($str) | 966: function pun_hash($str) |
| 972: { | 967: { |
| 973: if (function_exists('sha1')) // Only in PHP 4.3.0+ | 968: if (function_exists('sha1')) // Only in PHP 4.3.0+ |
| 974: return sha1($str); | 969: return sha1($str); |
| 975: else if (function_exists('mhash')) // Only if Mhash library is loaded | 970: else if (function_exists('mhash')) // Only if Mhash library is loaded |
| 976: return bin2hex(mhash(MHASH_SHA1, $str)); | 971: return bin2hex(mhash(MHASH_SHA1, $str)); |
| 977: else | 972: else |
| 978: return md5($str); | 973: return md5($str); |
| 1023: return utf8_trim($str); | 1018: return utf8_trim($str); |
| 1024: } | 1019: } |
| 1025: | 1020: |
| | 1021: // |
| | 1022: // Checks if a string is in all uppercase |
| | 1023: // |
| | 1024: function is_all_uppercase($string) |
| | 1025: { |
| | 1026: return utf8_strtoupper($string) == $string && utf8_strtolower($string) != $string; |
| | 1027: } |
| | 1028: |
| | 1029: |
| | 1030: // |
| | 1031: // Inserts $element into $input at $offset |
| | 1032: // $offset can be either a numerical offset to insert at (eg: 0 inserts at the beginning of the array) |
| | 1033: // or a string, which is the key that the new element should be inserted before |
| | 1034: // $key is optional: it's used when inserting a new key/value pair into an associative array |
| | 1035: // |
| | 1036: function array_insert(&$input, $offset, $element, $key = null) |
| | 1037: { |
| | 1038: if ($key == null) |
| | 1039: $key = $offset; |
| | 1040: |
| | 1041: // Determine the proper offset if we're using a string |
| | 1042: if (!is_int($offset)) |
| | 1043: $offset = array_search($offset, array_keys($input), true); |
| | 1044: |
| | 1045: // Out of bounds checks |
| | 1046: if ($offset > count($input)) |
| | 1047: $offset = count($input); |
| | 1048: else if ($offset < 0) |
| | 1049: $offset = 0; |
| | 1050: |
| | 1051: $input = array_merge(array_slice($input, 0, $offset), array($key => $element), array_slice($input, $offset)); |
| | 1052: } |
| | 1053: |
| 1026: | 1054: |
| 1027: // | 1055: // |
| 1028: // Display a message when board is in maintenance mode | 1056: // Display a message when board is in maintenance mode |
| 1038: | 1066: |
| 1039: | 1067: |
| 1040: // Load the maintenance template | 1068: // Load the maintenance template |
| 1041: $tpl_maint = trim(file_get_contents(PUN_ROOT.'include/template/maintenance.tpl')); | 1069: if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/maintenance.tpl')) |
| | 1070: $tpl_maint = trim(file_get_contents(PUN_ROOT.'style/'.$pun_user['style'].'/maintenance.tpl')); |
| | 1071: else |
| | 1072: $tpl_maint = trim(file_get_contents(PUN_ROOT.'include/template/maintenance.tpl')); |
| 1042: | 1073: |
| 1043: | 1074: |
| 1044: // START SUBST - <pun_include "*"> | 1075: // START SUBST - <pun_include "*"> |
| 1056: // END SUBST - <pun_include "*"> | 1087: // END SUBST - <pun_include "*"> |
| 1057: | 1088: |
| 1058: | 1089: |
| | 1090: // START SUBST - <pun_language> |
| | 1091: $tpl_maint = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_maint); |
| | 1092: // END SUBST - <pun_language> |
| | 1093: |
| | 1094: |
| 1059: // START SUBST - <pun_content_direction> | 1095: // START SUBST - <pun_content_direction> |
| 1060: $tpl_maint = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_maint); | 1096: $tpl_maint = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_maint); |
| 1061: // END SUBST - <pun_content_direction> | 1097: // END SUBST - <pun_content_direction> |
| 1116: | 1152: |
| 1117: | 1153: |
| 1118: // Load the redirect template | 1154: // Load the redirect template |
| 1119: $tpl_redir = trim(file_get_contents(PUN_ROOT.'include/template/redirect.tpl')); | 1155: if (function_exists(PUN_ROOT.'style/'.$pun_user['style'].'/redirect.tpl')) |
| | 1156: $tpl_redir = trim(file_get_contents(PUN_ROOT.'style/'.$pun_user['style'].'/redirect.tpl')); |
| | 1157: else |
| | 1158: $tpl_redir = trim(file_get_contents(PUN_ROOT.'include/template/redirect.tpl')); |
| 1120: | 1159: |
| 1121: | 1160: |
| 1122: // START SUBST - <pun_include "*"> | 1161: // START SUBST - <pun_include "*"> |
| 1134: // END SUBST - <pun_include "*"> | 1173: // END SUBST - <pun_include "*"> |
| 1135: | 1174: |
| 1136: | 1175: |
| | 1176: // START SUBST - <pun_language> |
| | 1177: $tpl_redir = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_redir); |
| | 1178: // END SUBST - <pun_language> |
| | 1179: |
| | 1180: |
| 1137: // START SUBST - <pun_content_direction> | 1181: // START SUBST - <pun_content_direction> |
| 1138: $tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir); | 1182: $tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir); |
| 1139: // END SUBST - <pun_content_direction> | 1183: // END SUBST - <pun_content_direction> |
| 1285: if (!in_array($k, $no_unset) && isset($GLOBALS[$k])) | 1329: if (!in_array($k, $no_unset) && isset($GLOBALS[$k])) |
| 1286: { | 1330: { |
| 1287: unset($GLOBALS[$k]); | 1331: unset($GLOBALS[$k]); |
| 1288: unset($GLOBALS[$k]); // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.4 | 1332: unset($GLOBALS[$k]); // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.4 |
| 1289: } | 1333: } |
| 1290: } | 1334: } |
| 1291: } | 1335: } |
| 1342: <?php | 1386: <?php |
| 1343: | 1387: |
| 1344: $query_time_total = 0.0; | 1388: $query_time_total = 0.0; |
| 1345: while (list(, $cur_query) = @each($saved_queries)) | 1389: foreach ($saved_queries as $cur_query) |
| 1346: { | 1390: { |
| 1347: $query_time_total += $cur_query[1]; | 1391: $query_time_total += $cur_query[1]; |
| 1348: | 1392: |
| 1357: | 1401: |
| 1358: ?> | 1402: ?> |
| 1359: <tr> | 1403: <tr> |
| 1360: <td class="tcl" colspan="2"><?php printf($lang_common['Total query time'], $query_time_totals.' s') ?></td> | 1404: <td class="tcl" colspan="2"><?php printf($lang_common['Total query time'], $query_time_total.' s') ?></td> |
| 1361: </tr> | 1405: </tr> |
| 1362: </tbody> | 1406: </tbody> |
| 1363: </table> | 1407: </table> |
| a/upload/include/parser.php |
b/upload/include/parser.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 7: | 8: |
| 8: PunBB is free software; you can redistribute it and/or modify it | 9: ---*/ |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 10: |
| 25: // Make sure no one attempts to run this script "directly" | 11: // Make sure no one attempts to run this script "directly" |
| 26: if (!defined('PUN')) | 12: if (!defined('PUN')) |
| 27: exit; | 13: exit; |
| 28: | 14: |
| 29: | 15: |
| 30: // Here you can add additional smilies if you like (please note that you must escape singlequote and backslash) | 16: // Here you can add additional smilies if you like (please note that you must escape single quote and backslash) |
| 31: $smilies = array( | 17: $smilies = array( |
| 32: ':)' => 'smile.png', | 18: ':)' => 'smile.png', |
| 33: '=)' => 'smile.png', | 19: '=)' => 'smile.png', |
| 59: { | 45: { |
| 60: global $lang_profile; | 46: global $lang_profile; |
| 61: | 47: |
| 62: if (preg_match('%\[/?(?:quote|code|list)\b[^\]]*\]%i', $text)) | 48: if (preg_match('%\[/?(?:quote|code|list|h)\b[^\]]*\]%i', $text)) |
| 63: $errors[] = $lang_profile['Signature quote/code/list']; | 49: $errors[] = $lang_profile['Signature quote/code/list/h']; |
| 64: } | 50: } |
| 65: | 51: |
| 66: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) | 52: // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) |
| 131: $tags_opened = $tags; | 117: $tags_opened = $tags; |
| 132: // and tags we need to check are closed (the same as above, added it just in case) | 118: // and tags we need to check are closed (the same as above, added it just in case) |
| 133: $tags_closed = $tags; | 119: $tags_closed = $tags; |
| 134: // Tags we can nest and the depth they can be nested to (only quotes ) | 120: // Tags we can nest and the depth they can be nested to (only quotes) |
| 135: $tags_nested = array('quote' => $pun_config['o_quote_depth'], 'list' => 5, '*' => 5); | 121: $tags_nested = array('quote' => $pun_config['o_quote_depth'], 'list' => 5, '*' => 5); |
| 136: // Tags to ignore the contents of completely (just code) | 122: // Tags to ignore the contents of completely (just code) |
| 137: $tags_ignore = array('code'); | 123: $tags_ignore = array('code'); |
| 173: // Are we dealing with a tag? | 159: // Are we dealing with a tag? |
| 174: if (substr($current, 0, 1) != '[' || substr($current, -1, 1) != ']') | 160: if (substr($current, 0, 1) != '[' || substr($current, -1, 1) != ']') |
| 175: { | 161: { |
| 176: // Its not a bbcode tag so we put it on the end and continue | 162: // It's not a bbcode tag so we put it on the end and continue |
| 177: | 163: |
| 178: // If we are nested too deeply don't add to the end | 164: // If we are nested too deeply don't add to the end |
| 179: if ($current_nest) | 165: if ($current_nest) |
| 261: // Is the tag defined? | 247: // Is the tag defined? |
| 262: if (!in_array($current_tag, $tags)) | 248: if (!in_array($current_tag, $tags)) |
| 263: { | 249: { |
| 264: // Its not a bbcode tag so we put it on the end and continue | 250: // It's not a bbcode tag so we put it on the end and continue |
| 265: if (!$current_nest) | 251: if (!$current_nest) |
| 266: $new_text .= $current; | 252: $new_text .= $current; |
| 267: | 253: |
| 268: continue; | 254: continue; |
| 269: } | 255: } |
| 270: | 256: |
| 271: // We definitely have a bbcode tag. | 257: // We definitely have a bbcode tag |
| 272: | 258: |
| 273: // Make the tag string lower case | 259: // Make the tag string lower case |
| 274: if ($equalpos = strpos($current,'=')) | 260: if ($equalpos = strpos($current,'=')) |
| 277: if (strlen(substr($current, $equalpos)) == 2) | 263: if (strlen(substr($current, $equalpos)) == 2) |
| 278: { | 264: { |
| 279: // Empty tag argument | 265: // Empty tag argument |
| 280: $errors[] = sprintf($lang_common['BBCode error 6'], $current_tag); | 266: $errors[] = sprintf($lang_common['BBCode error empty attribute'], $current_tag); |
| 281: return false; | 267: return false; |
| 282: } | 268: } |
| 283: $current = strtolower(substr($current, 0, $equalpos)).substr($current, $equalpos); | 269: $current = strtolower(substr($current, 0, $equalpos)).substr($current, $equalpos); |
| 285: else | 271: else |
| 286: $current = strtolower($current); | 272: $current = strtolower($current); |
| 287: | 273: |
| 288: //This is if we are currently in a tag which escapes other bbcode such as code | 274: // This is if we are currently in a tag which escapes other bbcode such as code |
| 289: if ($current_ignore) | 275: if ($current_ignore) |
| 290: { | 276: { |
| 291: if ('[/'.$current_ignore.']' == $current) | 277: if ('[/'.$current_ignore.']' == $current) |
| 302: | 288: |
| 303: if ($current_nest) | 289: if ($current_nest) |
| 304: { | 290: { |
| 305: // We are currently too deeply nested so lets see if we are closing the tag or not. | 291: // We are currently too deeply nested so lets see if we are closing the tag or not |
| 306: if ($current_tag != $current_nest) | 292: if ($current_tag != $current_nest) |
| 307: continue; | 293: continue; |
| 308: | 294: |
| 320: // Check the current tag is allowed here | 306: // Check the current tag is allowed here |
| 321: if (!in_array($current_tag, $limit_bbcode) && $current_tag != $open_tags[$opened_tag]) | 307: if (!in_array($current_tag, $limit_bbcode) && $current_tag != $open_tags[$opened_tag]) |
| 322: { | 308: { |
| 323: $errors[] = sprintf($lang_common['BBCode error 3'], $current_tag, $open_tags[$opened_tag]); | 309: $errors[] = sprintf($lang_common['BBCode error invalid nesting'], $current_tag, $open_tags[$opened_tag]); |
| 324: return false; | 310: return false; |
| 325: } | 311: } |
| 326: | 312: |
| 327: if (substr($current, 1, 1) == '/') | 313: if (substr($current, 1, 1) == '/') |
| 328: { | 314: { |
| 329: //This is if we are closing a tag | 315: // This is if we are closing a tag |
| 330: | 316: |
| 331: if ($opened_tag == 0 || !in_array($current_tag, $open_tags)) | 317: if ($opened_tag == 0 || !in_array($current_tag, $open_tags)) |
| 332: { | 318: { |
| 333: //We tried to close a tag which is not open | 319: // We tried to close a tag which is not open |
| 334: if (in_array($current_tag, $tags_opened)) | 320: if (in_array($current_tag, $tags_opened)) |
| 335: { | 321: { |
| 336: $errors[] = sprintf($lang_common['BBCode error 1'], $current_tag); | 322: $errors[] = sprintf($lang_common['BBCode error no opening tag'], $current_tag); |
| 337: return false; | 323: return false; |
| 338: } | 324: } |
| 339: } | 325: } |
| 367: if (!in_array($temp_tag, $tags_fix)) | 353: if (!in_array($temp_tag, $tags_fix)) |
| 368: { | 354: { |
| 369: // We couldn't fix nesting | 355: // We couldn't fix nesting |
| 370: $errors[] = sprintf($lang_common['BBCode error 5'], array_pop($temp_opened)); | 356: $errors[] = sprintf($lang_common['BBCode error no closing tag'], array_pop($temp_opened)); |
| 371: return false; | 357: return false; |
| 372: } | 358: } |
| 373: array_push($temp_opened, $temp_tag); | 359: array_push($temp_opened, $temp_tag); |
| 401: else | 387: else |
| 402: { | 388: { |
| 403: // We couldn't fix nesting | 389: // We couldn't fix nesting |
| 404: $errors[] = sprintf($lang_common['BBCode error 1'], $current_tag); | 390: $errors[] = sprintf($lang_common['BBCode error no opening tag'], $current_tag); |
| 405: return false; | 391: return false; |
| 406: } | 392: } |
| 407: } | 393: } |
| 442: if (in_array($current_tag, $tags_block) && !in_array($open_tags[$opened_tag], $tags_block) && $opened_tag != 0) | 428: if (in_array($current_tag, $tags_block) && !in_array($open_tags[$opened_tag], $tags_block) && $opened_tag != 0) |
| 443: { | 429: { |
| 444: // We tried to open a block tag within a non-block tag | 430: // We tried to open a block tag within a non-block tag |
| 445: $errors[] = sprintf($lang_common['BBCode error 3'], $current_tag, $open_tags[$opened_tag]); | 431: $errors[] = sprintf($lang_common['BBCode error invalid nesting'], $current_tag, $open_tags[$opened_tag]); |
| 446: return false; | 432: return false; |
| 447: } | 433: } |
| 448: | 434: |
| 449: if (in_array($current_tag, $tags_ignore)) | 435: if (in_array($current_tag, $tags_ignore)) |
| 450: { | 436: { |
| 451: // Its an ignore tag so we don't need to worry about whats inside it, | 437: // It's an ignore tag so we don't need to worry about what's inside it |
| 452: $current_ignore = $current_tag; | 438: $current_ignore = $current_tag; |
| 453: $new_text .= $current; | 439: $new_text .= $current; |
| 454: continue; | 440: continue; |
| 458: if (in_array($current_tag, $open_tags) && !in_array($current_tag, array_keys($tags_nested))) | 444: if (in_array($current_tag, $open_tags) && !in_array($current_tag, array_keys($tags_nested))) |
| 459: { | 445: { |
| 460: // We nested a tag we shouldn't | 446: // We nested a tag we shouldn't |
| 461: $errors[] = sprintf($lang_common['BBCode error 4'], $current_tag); | 447: $errors[] = sprintf($lang_common['BBCode error invalid self-nesting'], $current_tag); |
| 462: return false; | 448: return false; |
| 463: } | 449: } |
| 464: else if (in_array($current_tag, array_keys($tags_nested))) | 450: else if (in_array($current_tag, array_keys($tags_nested))) |
| 501: if (in_array($check, $open_tags)) | 487: if (in_array($check, $open_tags)) |
| 502: { | 488: { |
| 503: // We left an important tag open | 489: // We left an important tag open |
| 504: $errors[] = sprintf($lang_common['BBCode error 5'], $check); | 490: $errors[] = sprintf($lang_common['BBCode error no closing tag'], $check); |
| 505: return false; | 491: return false; |
| 506: } | 492: } |
| 507: } | 493: } |
| 509: if ($current_ignore) | 495: if ($current_ignore) |
| 510: { | 496: { |
| 511: // We left an ignore tag open | 497: // We left an ignore tag open |
| 512: $errors[] = sprintf($lang_common['BBCode error 5'], $current_ignore); | 498: $errors[] = sprintf($lang_common['BBCode error no closing tag'], $current_ignore); |
| 513: return false; | 499: return false; |
| 514: } | 500: } |
| 515: | 501: |
| 587: // | 573: // |
| 588: function handle_url_tag($url, $link = '', $bbcode = false) | 574: function handle_url_tag($url, $link = '', $bbcode = false) |
| 589: { | 575: { |
| | 576: $url = pun_trim($url); |
| 590: $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url); | 577: $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url); |
| 591: if (strpos($url, 'www.') === 0) // If it starts with www, we add http:// | 578: if (strpos($url, 'www.') === 0) // If it starts with www, we add http:// |
| 592: $full_url = 'http://'.$full_url; | 579: $full_url = 'http://'.$full_url; |
| 593: else if (strpos($url, 'ftp.') === 0) // Else if it starts with ftp, we add ftp:// | 580: else if (strpos($url, 'ftp.') === 0) // Else if it starts with ftp, we add ftp:// |
| 594: $full_url = 'ftp://'.$full_url; | 581: $full_url = 'ftp://'.$full_url; |
| 595: else if (!preg_match('#^([a-z0-9]{3,6})://#', $url)) // Else if it doesn't start with abcdef://, we add http:// | 582: else if (!preg_match('#^([a-z0-9]{3,6})://#', $url)) // Else if it doesn't start with abcdef://, we add http:// |
| 596: $full_url = 'http://'.$full_url; | 583: $full_url = 'http://'.$full_url; |
| 597: | 584: |
| 598: // Ok, not very pretty :-) | 585: // Ok, not very pretty :-) |
| 647: $content = preg_replace($pattern, $replace, $content); | 634: $content = preg_replace($pattern, $replace, $content); |
| 648: } | 635: } |
| 649: | 636: |
| 650: $content = preg_replace('#\s*\[\*\](.*?)\[/\*\]\s*#s', '<li>$1</li>', pun_trim($content)); | 637: $content = preg_replace('#\s*\[\*\](.*?)\[/\*\]\s*#s', '<li><p>$1</p></li>', pun_trim($content)); |
| 651: | 638: |
| 652: if ($type == '*') | 639: if ($type == '*') |
| 653: $content = '<ul>'.$content.'</ul>'; | 640: $content = '<ul>'.$content.'</ul>'; |
| 745: // | 732: // |
| 746: function do_smilies($text) | 733: function do_smilies($text) |
| 747: { | 734: { |
| 748: global $pun_config, $base_url, $smilies; | 735: global $pun_config, $smilies; |
| 749: | 736: |
| 750: $text = ' '.$text.' '; | 737: $text = ' '.$text.' '; |
| 751: | 738: |
| 752: foreach ($smilies as $smiley_text => $smiley_img) | 739: foreach ($smilies as $smiley_text => $smiley_img) |
| 753: { | 740: { |
| 754: if (strpos($text, $smiley_text) !== false) | 741: if (strpos($text, $smiley_text) !== false) |
| 755: $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$base_url.'img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text); | 742: $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$pun_config['o_base_url'].'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text); |
| 756: } | 743: } |
| 757: | 744: |
| 758: return substr($text, 1, -1); | 745: return substr($text, 1, -1); |
| 802: { | 789: { |
| 803: $text .= $outside[$i]; | 790: $text .= $outside[$i]; |
| 804: if (isset($inside[$i])) | 791: if (isset($inside[$i])) |
| 805: $text .= '</p><div class="codebox"><pre><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; | 792: // $text .= '</p><div class="codebox"><pre><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; |
| | 793: { |
| | 794: $num_lines = (substr_count($inside[$i], "\n")); |
| | 795: $text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>'; |
| | 796: } |
| 806: } | 797: } |
| 807: } | 798: } |
| 808: | 799: |
| a/upload/include/utf8/native/core.php |
b/upload/include/utf8/native/core.php |
| 1: <?php | 1: <?php |
| | 2: |
| 2: /** | 3: /** |
| 3: * @version $Id: core.php,v 1.9 2007/08/12 01:11:33 harryf Exp $ | 4: * @version $Id: core.php,v 1.9 2007/08/12 01:11:33 harryf Exp $ |
| 4: * @package utf8 | 5: * @package utf8 |
| 8: /** | 9: /** |
| 9: * Define UTF8_CORE as required | 10: * Define UTF8_CORE as required |
| 10: */ | 11: */ |
| 11: if ( !defined('UTF8_CORE') ) { | 12: if (!defined('UTF8_CORE')) |
| 12: define('UTF8_CORE',TRUE); | 13: define('UTF8_CORE', true); |
| 13: } | |
| 14: | 14: |
| 15: //-------------------------------------------------------------------- | |
| 16: /** | 15: /** |
| 17: * Unicode aware replacement for strlen(). Returns the number | 16: * Unicode aware replacement for strlen(). Returns the number |
| 18: * of characters in the string (not the number of bytes), replacing | 17: * of characters in the string (not the number of bytes), replacing |
| 30: * @package utf8 | 29: * @package utf8 |
| 31: * @subpackage strings | 30: * @subpackage strings |
| 32: */ | 31: */ |
| 33: function utf8_strlen($str){ | 32: function utf8_strlen($str) |
| 34: return strlen(utf8_decode($str)); | 33: { |
| | 34: return strlen(utf8_decode($str)); |
| 35: } | 35: } |
| 36: | 36: |
| 37: | |
| 38: //-------------------------------------------------------------------- | |
| 39: /** | 37: /** |
| 40: * UTF-8 aware alternative to strpos | 38: * UTF-8 aware alternative to strpos |
| 41: * Find position of first occurrence of a string | 39: * Find position of first occurrence of a string |
| 51: * @package utf8 | 49: * @package utf8 |
| 52: * @subpackage strings | 50: * @subpackage strings |
| 53: */ | 51: */ |
| 54: function utf8_strpos($str, $needle, $offset = NULL) { | 52: function utf8_strpos($str, $needle, $offset = null) |
| 55: | 53: { |
| 56: if ( is_null($offset) ) { | 54: if (is_null($offset)) |
| 57: | 55: { |
| 58: $ar = explode($needle, $str, 2); | 56: $ar = explode($needle, $str, 2); |
| 59: if ( count($ar) > 1 ) { | 57: |
| 60: return utf8_strlen($ar[0]); | 58: if (count($ar) > 1) |
| 61: } | 59: return utf8_strlen($ar[0]); |
| 62: return FALSE; | 60: |
| 63: | 61: return false; |
| 64: } else { | 62: } |
| 65: | 63: else |
| 66: if ( !is_int($offset) ) { | 64: { |
| 67: trigger_error('utf8_strpos: Offset must be an integer',E_USER_ERROR); | 65: if (!is_int($offset)) |
| 68: return FALSE; | 66: { |
| 69: } | 67: trigger_error('utf8_strpos: Offset must be an integer', E_USER_ERROR); |
| 70: | 68: return false; |
| 71: $str = utf8_substr($str, $offset); | 69: } |
| 72: | 70: |
| 73: if ( FALSE !== ( $pos = utf8_strpos($str, $needle) ) ) { | 71: $str = utf8_substr($str, $offset); |
| 74: return $pos + $offset; | 72: |
| 75: } | 73: if (false !== ($pos = utf8_strpos($str, $needle))) |
| 76: | 74: return $pos + $offset; |
| 77: return FALSE; | 75: |
| 78: } | 76: return false; |
| 79: | 77: } |
| 80: } | 78: } |
| 81: | 79: |
| 82: //-------------------------------------------------------------------- | |
| 83: /** | 80: /** |
| 84: * UTF-8 aware alternative to strrpos | 81: * UTF-8 aware alternative to strrpos |
| 85: * Find position of last occurrence of a char in a string | 82: * Find position of last occurrence of a char in a string |
| 95: * @package utf8 | 92: * @package utf8 |
| 96: * @subpackage strings | 93: * @subpackage strings |
| 97: */ | 94: */ |
| 98: function utf8_strrpos($str, $needle, $offset = NULL) { | 95: function utf8_strrpos($str, $needle, $offset = null) |
| 99: | 96: { |
| 100: if ( is_null($offset) ) { | 97: if (is_null($offset)) |
| 101: | 98: { |
| 102: $ar = explode($needle, $str); | 99: $ar = explode($needle, $str); |
| 103: | 100: |
| 104: if ( count($ar) > 1 ) { | 101: if (count($ar) > 1) |
| 105: // Pop off the end of the string where the last match was made | 102: { |
| 106: array_pop($ar); | 103: // Pop off the end of the string where the last match was made |
| 107: $str = join($needle,$ar); | 104: array_pop($ar); |
| 108: return utf8_strlen($str); | 105: $str = join($needle,$ar); |
| 109: } | 106: return utf8_strlen($str); |
| 110: return FALSE; | 107: } |
| 111: | 108: |
| 112: } else { | 109: return false; |
| 113: | 110: } |
| 114: if ( !is_int($offset) ) { | 111: else |
| 115: trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING); | 112: { |
| 116: return FALSE; | 113: if (!is_int($offset)) |
| 117: } | 114: { |
| 118: | 115: trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING); |
| 119: $str = utf8_substr($str, $offset); | 116: return false; |
| 120: | 117: } |
| 121: if ( FALSE !== ( $pos = utf8_strrpos($str, $needle) ) ) { | 118: |
| 122: return $pos + $offset; | 119: $str = utf8_substr($str, $offset); |
| 123: } | 120: |
| 124: | 121: if (false !== ($pos = utf8_strrpos($str, $needle))) |
| 125: return FALSE; | 122: return $pos + $offset; |
| 126: } | 123: |
| 127: | 124: return false; |
| | 125: } |
| 128: } | 126: } |
| 129: | 127: |
| 130: //-------------------------------------------------------------------- | |
| 131: /** | 128: /** |
| 132: * UTF-8 aware alternative to substr | 129: * UTF-8 aware alternative to substr |
| 133: * Return part of a string given character offset (and optionally length) | 130: * Return part of a string given character offset (and optionally length) |
| 157: * @package utf8 | 154: * @package utf8 |
| 158: * @subpackage strings | 155: * @subpackage strings |
| 159: */ | 156: */ |
| 160: function utf8_substr($str, $offset, $length = NULL) { | 157: function utf8_substr($str, $offset, $length = null) |
| 161: | 158: { |
| 162: // generates E_NOTICE | 159: // Generates E_NOTICE for PHP4 objects, but not PHP5 objects |
| 163: // for PHP4 objects, but not PHP5 objects | 160: $str = (string) $str; |
| 164: $str = (string)$str; | 161: $offset = (int) $offset; |
| 165: $offset = (int)$offset; | 162: if (!is_null($length)) $length = (int) $length; |
| 166: if (!is_null($length)) $length = (int)$length; | 163: |
| 167: | 164: // Handle trivial cases |
| 168: // handle trivial cases | 165: if ($length === 0) return ''; |
| 169: if ($length === 0) return ''; | 166: if ($offset < 0 && $length < 0 && $length < $offset) |
| 170: if ($offset < 0 && $length < 0 && $length < $offset) | 167: return ''; |
| 171: return ''; | 168: |
| 172: | 169: // Normalise negative offsets (we could use a tail |
| 173: // normalise negative offsets (we could use a tail | 170: // anchored pattern, but they are horribly slow!) |
| 174: // anchored pattern, but they are horribly slow!) | 171: if ($offset < 0) |
| 175: if ($offset < 0) { | 172: { |
| 176: | 173: // See notes |
| 177: // see notes | 174: $strlen = strlen(utf8_decode($str)); |
| 178: $strlen = strlen(utf8_decode($str)); | 175: $offset = $strlen + $offset; |
| 179: $offset = $strlen + $offset; | 176: if ($offset < 0) $offset = 0; |
| 180: if ($offset < 0) $offset = 0; | 177: } |
| 181: | 178: |
| 182: } | 179: $Op = ''; |
| 183: | 180: $Lp = ''; |
| 184: $Op = ''; | 181: |
| 185: $Lp = ''; | 182: // Establish a pattern for offset, a |
| 186: | 183: // non-captured group equal in length to offset |
| 187: // establish a pattern for offset, a | 184: if ($offset > 0) |
| 188: // non-captured group equal in length to offset | 185: { |
| 189: if ($offset > 0) { | 186: $Ox = (int) ($offset / 65535); |
| 190: | 187: $Oy = $offset % 65535; |
| 191: $Ox = (int)($offset/65535); | 188: |
| 192: $Oy = $offset%65535; | 189: if ($Ox) |
| 193: | 190: $Op = '(?:.{65535}){'.$Ox.'}'; |
| 194: if ($Ox) { | 191: |
| 195: $Op = '(?:.{65535}){'.$Ox.'}'; | 192: $Op = '^(?:'.$Op.'.{'.$Oy.'})'; |
| 196: } | 193: } |
| 197: | 194: else |
| 198: $Op = '^(?:'.$Op.'.{'.$Oy.'})'; | 195: $Op = '^'; |
| 199: | 196: |
| 200: } else { | 197: |
| 201: | 198: // Establish a pattern for length |
| 202: // offset == 0; just anchor the pattern | 199: if (is_null($length)) |
| 203: $Op = '^'; | 200: { |
| 204: | 201: // The rest of the string |
| 205: } | 202: $Lp = '(.*)$'; |
| 206: | 203: } |
| 207: // establish a pattern for length | 204: else |
| 208: if (is_null($length)) { | 205: { |
| 209: | 206: // See notes |
| 210: // the rest of the string | 207: if (!isset($strlen)) |
| 211: $Lp = '(.*)$'; | 208: $strlen = strlen(utf8_decode($str)); |
| 212: | 209: |
| 213: } else { | 210: // Another trivial case |
| 214: | 211: if ($offset > $strlen) return ''; |
| 215: if (!isset($strlen)) { | 212: |
| 216: // see notes | 213: if ($length > 0) |
| 217: $strlen = strlen(utf8_decode($str)); | 214: { |
| 218: } | 215: // Reduce any length that would go passed the end of the string |
| 219: | 216: $length = min($strlen-$offset, $length); |
| 220: // another trivial case | 217: |
| 221: if ($offset > $strlen) return ''; | 218: $Lx = (int)( $length / 65535 ); |
| 222: | 219: $Ly = $length % 65535; |
| 223: if ($length > 0) { | 220: |
| 224: | 221: // Negative length requires a captured group of length characters |
| 225: // reduce any length that would | 222: if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; |
| 226: // go passed the end of the string | 223: $Lp = '('.$Lp.'.{'.$Ly.'})'; |
| 227: $length = min($strlen-$offset, $length); | 224: } |
| 228: | 225: else if ($length < 0) |
| 229: $Lx = (int)( $length / 65535 ); | 226: { |
| 230: $Ly = $length % 65535; | 227: |
| 231: | 228: if ($length < ($offset - $strlen)) |
| 232: // negative length requires a captured group | 229: return ''; |
| 233: // of length characters | 230: |
| 234: if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; | 231: $Lx = (int)((-$length)/65535); |
| 235: $Lp = '('.$Lp.'.{'.$Ly.'})'; | 232: $Ly = (-$length)%65535; |
| 236: | 233: |
| 237: } else if ($length < 0) { | 234: // Negative length requires ... capture everything except a group of |
| 238: | 235: // -length characters anchored at the tail-end of the string |
| 239: if ( $length < ($offset - $strlen) ) { | 236: if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; |
| 240: return ''; | 237: $Lp = '(.*)(?:'.$Lp.'.{'.$Ly.'})$'; |
| 241: } | 238: } |
| 242: | 239: } |
| 243: $Lx = (int)((-$length)/65535); | 240: |
| 244: $Ly = (-$length)%65535; | 241: if (!preg_match( '#'.$Op.$Lp.'#us',$str, $match )) |
| 245: | 242: return ''; |
| 246: // negative length requires ... capture everything | 243: |
| 247: // except a group of -length characters | 244: return $match[1]; |
| 248: // anchored at the tail-end of the string | |
| 249: if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; | |
| 250: $Lp = '(.*)(?:'.$Lp.'.{'.$Ly.'})$'; | |
| 251: | |
| 252: } | |
| 253: | |
| 254: } | |
| 255: | |
| 256: if (!preg_match( '#'.$Op.$Lp.'#us',$str, $match )) { | |
| 257: return ''; | |
| 258: } | |
| 259: | |
| 260: return $match[1]; | |
| 261: | |
| 262: } | 245: } |
| 263: | 246: |
| 264: //--------------------------------------------------------------- | |
| 265: /** | 247: /** |
| 266: * UTF-8 aware alternative to strtolower | 248: * UTF-8 aware alternative to strtolower |
| 267: * Make a string lowercase | 249: * Make a string lowercase |
| 281: * @package utf8 | 263: * @package utf8 |
| 282: * @subpackage strings | 264: * @subpackage strings |
| 283: */ | 265: */ |
| 284: function utf8_strtolower($string){ | 266: function utf8_strtolower($string) |
| 285: | 267: { |
| 286: static $UTF8_UPPER_TO_LOWER = NULL; | 268: static $UTF8_UPPER_TO_LOWER = null; |
| 287: | 269: |
| 288: if ( is_null($UTF8_UPPER_TO_LOWER) ) { | 270: if (is_null($UTF8_UPPER_TO_LOWER)) |
| 289: $UTF8_UPPER_TO_LOWER = array( | 271: { |
| 290: 0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062, | 272: $UTF8_UPPER_TO_LOWER = array( |
| 291: 0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101, | 273: 0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062, |
| 292: 0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3, | 274: 0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101, |
| 293: 0x00D4=>0x00F4, 0x042A=>0x044A, 0x0419=>0x0439, 0x0112=>0x0113, 0x041C=>0x043C, | 275: 0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3, |
| 294: 0x015E=>0x015F, 0x0143=>0x0144, 0x00CE=>0x00EE, 0x040E=>0x045E, 0x042F=>0x044F, | 276: 0x00D4=>0x00F4, 0x042A=>0x044A, 0x0419=>0x0439, 0x0112=>0x0113, 0x041C=>0x043C, |
| 295: 0x039A=>0x03BA, 0x0154=>0x0155, 0x0049=>0x0069, 0x0053=>0x0073, 0x1E1E=>0x1E1F, | 277: 0x015E=>0x015F, 0x0143=>0x0144, 0x00CE=>0x00EE, 0x040E=>0x045E, 0x042F=>0x044F, |
| 296: 0x0134=>0x0135, 0x0427=>0x0447, 0x03A0=>0x03C0, 0x0418=>0x0438, 0x00D3=>0x00F3, | 278: 0x039A=>0x03BA, 0x0154=>0x0155, 0x0049=>0x0069, 0x0053=>0x0073, 0x1E1E=>0x1E1F, |
| 297: 0x0420=>0x0440, 0x0404=>0x0454, 0x0415=>0x0435, 0x0429=>0x0449, 0x014A=>0x014B, | 279: 0x0134=>0x0135, 0x0427=>0x0447, 0x03A0=>0x03C0, 0x0418=>0x0438, 0x00D3=>0x00F3, |
| 298: 0x0411=>0x0431, 0x0409=>0x0459, 0x1E02=>0x1E03, 0x00D6=>0x00F6, 0x00D9=>0x00F9, | 280: 0x0420=>0x0440, 0x0404=>0x0454, 0x0415=>0x0435, 0x0429=>0x0449, 0x014A=>0x014B, |
| 299: 0x004E=>0x006E, 0x0401=>0x0451, 0x03A4=>0x03C4, 0x0423=>0x0443, 0x015C=>0x015D, | 281: 0x0411=>0x0431, 0x0409=>0x0459, 0x1E02=>0x1E03, 0x00D6=>0x00F6, 0x00D9=>0x00F9, |
| 300: 0x0403=>0x0453, 0x03A8=>0x03C8, 0x0158=>0x0159, 0x0047=>0x0067, 0x00C4=>0x00E4, | 282: 0x004E=>0x006E, 0x0401=>0x0451, 0x03A4=>0x03C4, 0x0423=>0x0443, 0x015C=>0x015D, |
| 301: 0x0386=>0x03AC, 0x0389=>0x03AE, 0x0166=>0x0167, 0x039E=>0x03BE, 0x0164=>0x0165, | 283: 0x0403=>0x0453, 0x03A8=>0x03C8, 0x0158=>0x0159, 0x0047=>0x0067, 0x00C4=>0x00E4, |
| 302: 0x0116=>0x0117, 0x0108=>0x0109, 0x0056=>0x0076, 0x00DE=>0x00FE, 0x0156=>0x0157, | 284: 0x0386=>0x03AC, 0x0389=>0x03AE, 0x0166=>0x0167, 0x039E=>0x03BE, 0x0164=>0x0165, |
| 303: 0x00DA=>0x00FA, 0x1E60=>0x1E61, 0x1E82=>0x1E83, 0x00C2=>0x00E2, 0x0118=>0x0119, | 285: 0x0116=>0x0117, 0x0108=>0x0109, 0x0056=>0x0076, 0x00DE=>0x00FE, 0x0156=>0x0157, |
| 304: 0x0145=>0x0146, 0x0050=>0x0070, 0x0150=>0x0151, 0x042E=>0x044E, 0x0128=>0x0129, | 286: 0x00DA=>0x00FA, 0x1E60=>0x1E61, 0x1E82=>0x1E83, 0x00C2=>0x00E2, 0x0118=>0x0119, |
| 305: 0x03A7=>0x03C7, 0x013D=>0x013E, 0x0422=>0x0442, 0x005A=>0x007A, 0x0428=>0x0448, | 287: 0x0145=>0x0146, 0x0050=>0x0070, 0x0150=>0x0151, 0x042E=>0x044E, 0x0128=>0x0129, |
| 306: 0x03A1=>0x03C1, 0x1E80=>0x1E81, 0x016C=>0x016D, 0x00D5=>0x00F5, 0x0055=>0x0075, | 288: 0x03A7=>0x03C7, 0x013D=>0x013E, 0x0422=>0x0442, 0x005A=>0x007A, 0x0428=>0x0448, |
| 307: 0x0176=>0x0177, 0x00DC=>0x00FC, 0x1E56=>0x1E57, 0x03A3=>0x03C3, 0x041A=>0x043A, | 289: 0x03A1=>0x03C1, 0x1E80=>0x1E81, 0x016C=>0x016D, 0x00D5=>0x00F5, 0x0055=>0x0075, |
| 308: 0x004D=>0x006D, 0x016A=>0x016B, 0x0170=>0x0171, 0x0424=>0x0444, 0x00CC=>0x00EC, | 290: 0x0176=>0x0177, 0x00DC=>0x00FC, 0x1E56=>0x1E57, 0x03A3=>0x03C3, 0x041A=>0x043A, |
| 309: 0x0168=>0x0169, 0x039F=>0x03BF, 0x004B=>0x006B, 0x00D2=>0x00F2, 0x00C0=>0x00E0, | 291: 0x004D=>0x006D, 0x016A=>0x016B, 0x0170=>0x0171, 0x0424=>0x0444, 0x00CC=>0x00EC, |
| 310: 0x0414=>0x0434, 0x03A9=>0x03C9, 0x1E6A=>0x1E6B, 0x00C3=>0x00E3, 0x042D=>0x044D, | 292: 0x0168=>0x0169, 0x039F=>0x03BF, 0x004B=>0x006B, 0x00D2=>0x00F2, 0x00C0=>0x00E0, |
| 311: 0x0416=>0x0436, 0x01A0=>0x01A1, 0x010C=>0x010D, 0x011C=>0x011D, 0x00D0=>0x00F0, | 293: 0x0414=>0x0434, 0x03A9=>0x03C9, 0x1E6A=>0x1E6B, 0x00C3=>0x00E3, 0x042D=>0x044D, |
| 312: 0x013B=>0x013C, 0x040F=>0x045F, 0x040A=>0x045A, 0x00C8=>0x00E8, 0x03A5=>0x03C5, | 294: 0x0416=>0x0436, 0x01A0=>0x01A1, 0x010C=>0x010D, 0x011C=>0x011D, 0x00D0=>0x00F0, |
| 313: 0x0046=>0x0066, 0x00DD=>0x00FD, 0x0043=>0x0063, 0x021A=>0x021B, 0x00CA=>0x00EA, | 295: 0x013B=>0x013C, 0x040F=>0x045F, 0x040A=>0x045A, 0x00C8=>0x00E8, 0x03A5=>0x03C5, |
| 314: 0x0399=>0x03B9, 0x0179=>0x017A, 0x00CF=>0x00EF, 0x01AF=>0x01B0, 0x0045=>0x0065, | 296: 0x0046=>0x0066, 0x00DD=>0x00FD, 0x0043=>0x0063, 0x021A=>0x021B, 0x00CA=>0x00EA, |
| 315: 0x039B=>0x03BB, 0x0398=>0x03B8, 0x039C=>0x03BC, 0x040C=>0x045C, 0x041F=>0x043F, | 297: 0x0399=>0x03B9, 0x0179=>0x017A, 0x00CF=>0x00EF, 0x01AF=>0x01B0, 0x0045=>0x0065, |
| 316: 0x042C=>0x044C, 0x00DE=>0x00FE, 0x00D0=>0x00F0, 0x1EF2=>0x1EF3, 0x0048=>0x0068, | 298: 0x039B=>0x03BB, 0x0398=>0x03B8, 0x039C=>0x03BC, 0x040C=>0x045C, 0x041F=>0x043F, |
| 317: 0x00CB=>0x00EB, 0x0110=>0x0111, 0x0413=>0x0433, 0x012E=>0x012F, 0x00C6=>0x00E6, | 299: 0x042C=>0x044C, 0x00DE=>0x00FE, 0x00D0=>0x00F0, 0x1EF2=>0x1EF3, 0x0048=>0x0068, |
| 318: 0x0058=>0x0078, 0x0160=>0x0161, 0x016E=>0x016F, 0x0391=>0x03B1, 0x0407=>0x0457, | 300: 0x00CB=>0x00EB, 0x0110=>0x0111, 0x0413=>0x0433, 0x012E=>0x012F, 0x00C6=>0x00E6, |
| 319: 0x0172=>0x0173, 0x0178=>0x00FF, 0x004F=>0x006F, 0x041B=>0x043B, 0x0395=>0x03B5, | 301: 0x0058=>0x0078, 0x0160=>0x0161, 0x016E=>0x016F, 0x0391=>0x03B1, 0x0407=>0x0457, |
| 320: 0x0425=>0x0445, 0x0120=>0x0121, 0x017D=>0x017E, 0x017B=>0x017C, 0x0396=>0x03B6, | 302: 0x0172=>0x0173, 0x0178=>0x00FF, 0x004F=>0x006F, 0x041B=>0x043B, 0x0395=>0x03B5, |
| 321: 0x0392=>0x03B2, 0x0388=>0x03AD, 0x1E84=>0x1E85, 0x0174=>0x0175, 0x0051=>0x0071, | 303: 0x0425=>0x0445, 0x0120=>0x0121, 0x017D=>0x017E, 0x017B=>0x017C, 0x0396=>0x03B6, |
| 322: 0x0417=>0x0437, 0x1E0A=>0x1E0B, 0x0147=>0x0148, 0x0104=>0x0105, 0x0408=>0x0458, | 304: 0x0392=>0x03B2, 0x0388=>0x03AD, 0x1E84=>0x1E85, 0x0174=>0x0175, 0x0051=>0x0071, |
| 323: 0x014C=>0x014D, 0x00CD=>0x00ED, 0x0059=>0x0079, 0x010A=>0x010B, 0x038F=>0x03CE, | 305: 0x0417=>0x0437, 0x1E0A=>0x1E0B, 0x0147=>0x0148, 0x0104=>0x0105, 0x0408=>0x0458, |
| 324: 0x0052=>0x0072, 0x0410=>0x0430, 0x0405=>0x0455, 0x0402=>0x0452, 0x0126=>0x0127, | 306: 0x014C=>0x014D, 0x00CD=>0x00ED, 0x0059=>0x0079, 0x010A=>0x010B, 0x038F=>0x03CE, |
| 325: 0x0136=>0x0137, 0x012A=>0x012B, 0x038A=>0x03AF, 0x042B=>0x044B, 0x004C=>0x006C, | 307: 0x0052=>0x0072, 0x0410=>0x0430, 0x0405=>0x0455, 0x0402=>0x0452, 0x0126=>0x0127, |
| 326: 0x0397=>0x03B7, 0x0124=>0x0125, 0x0218=>0x0219, 0x00DB=>0x00FB, 0x011E=>0x011F, | 308: 0x0136=>0x0137, 0x012A=>0x012B, 0x038A=>0x03AF, 0x042B=>0x044B, 0x004C=>0x006C, |
| 327: 0x041E=>0x043E, 0x1E40=>0x1E41, 0x039D=>0x03BD, 0x0106=>0x0107, 0x03AB=>0x03CB, | 309: 0x0397=>0x03B7, 0x0124=>0x0125, 0x0218=>0x0219, 0x00DB=>0x00FB, 0x011E=>0x011F, |
| 328: 0x0426=>0x0446, 0x00DE=>0x00FE, 0x00C7=>0x00E7, 0x03AA=>0x03CA, 0x0421=>0x0441, | 310: 0x041E=>0x043E, 0x1E40=>0x1E41, 0x039D=>0x03BD, 0x0106=>0x0107, 0x03AB=>0x03CB, |
| 329: 0x0412=>0x0432, 0x010E=>0x010F, 0x00D8=>0x00F8, 0x0057=>0x0077, 0x011A=>0x011B, | 311: 0x0426=>0x0446, 0x00DE=>0x00FE, 0x00C7=>0x00E7, 0x03AA=>0x03CA, 0x0421=>0x0441, |
| 330: 0x0054=>0x0074, 0x004A=>0x006A, 0x040B=>0x045B, 0x0406=>0x0456, 0x0102=>0x0103, | 312: 0x0412=>0x0432, 0x010E=>0x010F, 0x00D8=>0x00F8, 0x0057=>0x0077, 0x011A=>0x011B, |
| 331: 0x039B=>0x03BB, 0x00D1=>0x00F1, 0x041D=>0x043D, 0x038C=>0x03CC, 0x00C9=>0x00E9, | 313: 0x0054=>0x0074, 0x004A=>0x006A, 0x040B=>0x045B, 0x0406=>0x0456, 0x0102=>0x0103, |
| 332: 0x00D0=>0x00F0, 0x0407=>0x0457, 0x0122=>0x0123, | 314: 0x039B=>0x03BB, 0x00D1=>0x00F1, 0x041D=>0x043D, 0x038C=>0x03CC, 0x00C9=>0x00E9, |
| 333: ); | 315: 0x00D0=>0x00F0, 0x0407=>0x0457, 0x0122=>0x0123); |
| 334: } | 316: } |
| 335: | 317: |
| 336: $uni = utf8_to_unicode($string); | 318: $uni = utf8_to_unicode($string); |
| 337: | 319: |
| 338: if ( !$uni ) { | 320: if (!$uni) |
| 339: return FALSE; | 321: return false; |
| 340: } | 322: |
| 341: | 323: $cnt = count($uni); |
| 342: $cnt = count($uni); | 324: |
| 343: for ($i=0; $i < $cnt; $i++){ | 325: for ($i=0; $i < $cnt; $i++) |
| 344: if ( isset($UTF8_UPPER_TO_LOWER[$uni[$i]]) ) { | 326: if (isset($UTF8_UPPER_TO_LOWER[$uni[$i]])) |
| 345: $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]]; | 327: $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]]; |
| 346: } | 328: |
| 347: } | 329: return utf8_from_unicode($uni); |
| 348: | |
| 349: return utf8_from_unicode($uni); | |
| 350: } | 330: } |
| 351: | 331: |
| 352: //--------------------------------------------------------------- | |
| 353: /** | 332: /** |
| 354: * UTF-8 aware alternative to strtoupper | 333: * UTF-8 aware alternative to strtoupper |
| 355: * Make a string uppercase | 334: * Make a string uppercase |
| 369: * @package utf8 | 348: * @package utf8 |
| 370: * @subpackage strings | 349: * @subpackage strings |
| 371: */ | 350: */ |
| 372: function utf8_strtoupper($string){ | 351: function utf8_strtoupper($string) |
| 373: | 352: { |
| 374: static $UTF8_LOWER_TO_UPPER = NULL; | 353: static $UTF8_LOWER_TO_UPPER = NULL; |
| 375: | 354: |
| 376: if ( is_null($UTF8_LOWER_TO_UPPER) ) { | 355: if (is_null($UTF8_LOWER_TO_UPPER)) |
| 377: $UTF8_LOWER_TO_UPPER = array( | 356: { |
| 378: 0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042, | 357: $UTF8_LOWER_TO_UPPER = array( |
| 379: 0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100, | 358: 0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042, |
| 380: 0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393, | 359: 0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100, |
| 381: 0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C, | 360: 0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393, |
| 382: 0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F, | 361: 0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C, |
| 383: 0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E, | 362: 0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F, |
| 384: 0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3, | 363: 0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E, |
| 385: 0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A, | 364: 0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3, |
| 386: 0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9, | 365: 0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A, |
| 387: 0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C, | 366: 0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9, |
| 388: 0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4, | 367: 0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C, |
| 389: 0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164, | 368: 0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4, |
| 390: 0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156, | 369: 0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164, |
| 391: 0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118, | 370: 0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156, |
| 392: 0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128, | 371: 0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118, |
| 393: 0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428, | 372: 0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128, |
| 394: 0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055, | 373: 0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428, |
| 395: 0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A, | 374: 0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055, |
| 396: 0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC, | 375: 0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A, |
| 397: 0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0, | 376: 0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC, |
| 398: 0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D, | 377: 0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0, |
| 399: 0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0, | 378: 0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D, |
| 400: 0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5, | 379: 0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0, |
| 401: 0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA, | 380: 0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5, |
| 402: 0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045, | 381: 0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA, |
| 403: 0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F, | 382: 0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045, |
| 404: 0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048, | 383: 0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F, |
| 405: 0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6, | 384: 0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048, |
| 406: 0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407, | 385: 0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6, |
| 407: 0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395, | 386: 0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407, |
| 408: 0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396, | 387: 0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395, |
| 409: 0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051, | 388: 0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396, |
| 410: 0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408, | 389: 0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051, |
| 411: 0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F, | 390: 0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408, |
| 412: 0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126, | 391: 0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F, |
| 413: 0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C, | 392: 0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126, |
| 414: 0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E, | 393: 0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C, |
| 415: 0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB, | 394: 0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E, |
| 416: 0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421, | 395: 0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB, |
| 417: 0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A, | 396: 0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421, |
| 418: 0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102, | 397: 0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A, |
| 419: 0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9, | 398: 0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102, |
| 420: 0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122, | 399: 0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9, |
| 421: ); | 400: 0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122); |
| 422: } | 401: } |
| 423: | 402: |
| 424: $uni = utf8_to_unicode($string); | 403: $uni = utf8_to_unicode($string); |
| 425: | 404: |
| 426: if ( !$uni ) { | 405: if (!$uni) |
| 427: return FALSE; | 406: return false; |
| 428: } | 407: |
| 429: | 408: $cnt = count($uni); |
| 430: $cnt = count($uni); | 409: |
| 431: for ($i=0; $i < $cnt; $i++){ | 410: for ($i=0; $i < $cnt; $i++) |
| 432: if( isset($UTF8_LOWER_TO_UPPER[$uni[$i]]) ) { | 411: if(isset($UTF8_LOWER_TO_UPPER[$uni[$i]])) |
| 433: $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]]; | 412: $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]]; |
| 434: } | 413: |
| 435: } | 414: return utf8_from_unicode($uni); |
| 436: | |
| 437: return utf8_from_unicode($uni); | |
| 438: } | 415: } |
| a/upload/include/utf8/utils/ascii.php |
b/upload/include/utf8/utils/ascii.php |
| 1: <?php | 1: <?php |
| | 2: |
| 2: /** | 3: /** |
| 3: * Tools to help with ASCII in UTF-8 | 4: * Tools to help with ASCII in UTF-8 |
| 4: * @version $Id: ascii.php,v 1.5 2006/10/16 20:38:12 harryf Exp $ | 5: * @version $Id: ascii.php,v 1.5 2006/10/16 20:38:12 harryf Exp $ |
| 6: * @subpackage ascii | 7: * @subpackage ascii |
| 7: */ | 8: */ |
| 8: | 9: |
| 9: //-------------------------------------------------------------------- | |
| 10: /** | 10: /** |
| 11: * Tests whether a string contains only 7bit ASCII bytes. | 11: * Tests whether a string contains only 7bit ASCII bytes. |
| 12: * You might use this to conditionally check whether a string | 12: * You might use this to conditionally check whether a string |
| 21: * $someString = utf8_strtolower($someString); | 21: * $someString = utf8_strtolower($someString); |
| 22: * } | 22: * } |
| 23: * </code> | 23: * </code> |
| 24: * | 24: * |
| 25: * @param string | 25: * @param string |
| 26: * @return boolean TRUE if it's all ASCII | 26: * @return boolean TRUE if it's all ASCII |
| 27: * @package utf8 | 27: * @package utf8 |
| 28: * @subpackage ascii | 28: * @subpackage ascii |
| 29: * @see utf8_is_ascii_ctrl | 29: * @see utf8_is_ascii_ctrl |
| 30: */ | 30: */ |
| 31: function utf8_is_ascii($str) { | 31: function utf8_is_ascii($str) |
| 32: // Search for any bytes which are outside the ASCII range... | 32: { |
| 33: return (preg_match('/(?:[^\x00-\x7F])/',$str) !== 1); | 33: // Search for any bytes which are outside the ASCII range... |
| | 34: return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1); |
| 34: } | 35: } |
| 35: | 36: |
| 36: //-------------------------------------------------------------------- | |
| 37: /** | 37: /** |
| 38: * Tests whether a string contains only 7bit ASCII bytes with device | 38: * Tests whether a string contains only 7bit ASCII bytes with device |
| 39: * control codes omitted. The device control codes can be found on the | 39: * control codes omitted. The device control codes can be found on the |
| 40: * second table here: http://www.w3schools.com/tags/ref_ascii.asp | 40: * second table here: http://www.w3schools.com/tags/ref_ascii.asp |
| 41: * | 41: * |
| 42: * @param string | 42: * @param string |
| 43: * @return boolean TRUE if it's all ASCII without device control codes | 43: * @return boolean TRUE if it's all ASCII without device control codes |
| 44: * @package utf8 | 44: * @package utf8 |
| 45: * @subpackage ascii | 45: * @subpackage ascii |
| 46: * @see utf8_is_ascii | 46: * @see utf8_is_ascii |
| 47: */ | 47: */ |
| 48: function utf8_is_ascii_ctrl($str) { | 48: function utf8_is_ascii_ctrl($str) |
| 49: if ( strlen($str) > 0 ) { | 49: { |
| 50: // Search for any bytes which are outside the ASCII range, | 50: // Search for any bytes which are outside the ASCII range, or are device control codes |
| 51: // or are device control codes | 51: if (strlen($str) > 0) |
| 52: return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/',$str) !== 1); | 52: return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/', $str) !== 1); |
| 53: } | 53: |
| 54: return FALSE; | 54: return false; |
| 55: } | 55: } |
| 56: | 56: |
| 57: //-------------------------------------------------------------------- | |
| 58: /** | 57: /** |
| 59: * Strip out all non-7bit ASCII bytes | 58: * Strip out all non-7bit ASCII bytes |
| 60: * If you need to transmit a string to system which you know can only | 59: * If you need to transmit a string to system which you know can only |
| 65: * @subpackage ascii | 64: * @subpackage ascii |
| 66: * @see utf8_strip_non_ascii_ctrl | 65: * @see utf8_strip_non_ascii_ctrl |
| 67: */ | 66: */ |
| 68: function utf8_strip_non_ascii($str) { | 67: function utf8_strip_non_ascii($str) |
| 69: ob_start(); | 68: { |
| 70: while ( preg_match( | 69: ob_start(); |
| 71: '/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S', | 70: |
| 72: $str, $matches) ) { | 71: while (preg_match('/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S', $str, $matches)) |
| 73: if ( !isset($matches[2]) ) { | 72: { |
| 74: echo $matches[0]; | 73: if (!isset($matches[2])) |
| 75: } | 74: echo $matches[0]; |
| 76: $str = substr($str, strlen($matches[0])); | 75: |
| 77: } | 76: $str = substr($str, strlen($matches[0])); |
| 78: $result = ob_get_contents(); | 77: } |
| 79: ob_end_clean(); | 78: |
| 80: return $result; | 79: $result = ob_get_contents(); |
| | 80: ob_end_clean(); |
| | 81: |
| | 82: return $result; |
| 81: } | 83: } |
| 82: | 84: |
| 83: //-------------------------------------------------------------------- | |
| 84: /** | 85: /** |
| 85: * Strip out device control codes in the ASCII range | 86: * Strip out device control codes in the ASCII range |
| 86: * which are not permitted in XML. Note that this leaves | 87: * which are not permitted in XML. Note that this leaves |
| 90: * @param string | 91: * @param string |
| 91: * @return string control codes removed | 92: * @return string control codes removed |
| 92: */ | 93: */ |
| 93: function utf8_strip_ascii_ctrl($str) { | 94: function utf8_strip_ascii_ctrl($str) |
| 94: ob_start(); | 95: { |
| 95: while ( preg_match( | 96: ob_start(); |
| 96: '/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S', | 97: |
| 97: $str, $matches) ) { | 98: while (preg_match('/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S', $str, $matches)) |
| 98: if ( !isset($matches[2]) ) { | 99: { |
| 99: echo $matches[0]; | 100: if (!isset($matches[2])) |
| 100: } | 101: echo $matches[0]; |
| 101: $str = substr($str, strlen($matches[0])); | 102: |
| 102: } | 103: $str = substr($str, strlen($matches[0])); |
| 103: $result = ob_get_contents(); | 104: } |
| 104: ob_end_clean(); | 105: |
| 105: return $result; | 106: $result = ob_get_contents(); |
| | 107: ob_end_clean(); |
| | 108: |
| | 109: return $result; |
| 106: } | 110: } |
| 107: | 111: |
| 108: //-------------------------------------------------------------------- | |
| 109: /** | 112: /** |
| 110: * Strip out all non 7bit ASCII bytes and ASCII device control codes. | 113: * Strip out all non 7bit ASCII bytes and ASCII device control codes. |
| 111: * For a list of ASCII device control codes see the 2nd table here: | 114: * For a list of ASCII device control codes see the 2nd table here: |
| 112: * http://www.w3schools.com/tags/ref_ascii.asp | 115: * http://www.w3schools.com/tags/ref_ascii.asp |
| 113: * | 116: * |
| 114: * @param string | 117: * @param string |
| 115: * @return boolean TRUE if it's all ASCII | 118: * @return boolean TRUE if it's all ASCII |
| 116: * @package utf8 | 119: * @package utf8 |
| 117: * @subpackage ascii | 120: * @subpackage ascii |
| 118: */ | 121: */ |
| 119: function utf8_strip_non_ascii_ctrl($str) { | 122: function utf8_strip_non_ascii_ctrl($str) |
| 120: ob_start(); | 123: { |
| 121: while ( preg_match( | 124: ob_start(); |
| 122: '/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S', | 125: |
| 123: $str, $matches) ) { | 126: while (preg_match( '/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S', $str, $matches)) |
| 124: if ( !isset($matches[2]) ) { | 127: { |
| 125: echo $matches[0]; | 128: if (!isset($matches[2])) |
| 126: } | 129: echo $matches[0]; |
| 127: $str = substr($str, strlen($matches[0])); | 130: |
| 128: } | 131: $str = substr($str, strlen($matches[0])); |
| 129: $result = ob_get_contents(); | 132: } |
| 130: ob_end_clean(); | 133: |
| 131: return $result; | 134: $result = ob_get_contents(); |
| | 135: ob_end_clean(); |
| | 136: |
| | 137: return $result; |
| 132: } | 138: } |
| 133: | 139: |
| 134: //--------------------------------------------------------------- | |
| 135: /** | 140: /** |
| 136: * Replace accented UTF-8 characters by unaccented ASCII-7 "equivalents". | 141: * Replace accented UTF-8 characters by unaccented ASCII-7 "equivalents". |
| 137: * The purpose of this function is to replace characters commonly found in Latin | 142: * The purpose of this function is to replace characters commonly found in Latin |
| 154: * @package utf8 | 159: * @package utf8 |
| 155: * @subpackage ascii | 160: * @subpackage ascii |
| 156: */ | 161: */ |
| 157: function utf8_accents_to_ascii( $str, $case=0 ){ | 162: function utf8_accents_to_ascii($str, $case=0) |
| 158: | 163: { |
| 159: static $UTF8_LOWER_ACCENTS = NULL; | 164: static $UTF8_LOWER_ACCENTS = null; |
| 160: static $UTF8_UPPER_ACCENTS = NULL; | 165: static $UTF8_UPPER_ACCENTS = null; |
| 161: | 166: |
| 162: if($case <= 0){ | 167: if($case <= 0) |
| 163: | 168: { |
| 164: if ( is_null($UTF8_LOWER_ACCENTS) ) { | 169: |
| 165: $UTF8_LOWER_ACCENTS = array( | 170: if (is_null($UTF8_LOWER_ACCENTS)) |
| 166: 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', | 171: { |
| 167: 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k', | 172: $UTF8_LOWER_ACCENTS = array( |
| 168: 'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o', | 173: 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', |
| 169: 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o', | 174: 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k', |
| 170: 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c', | 175: 'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o', |
| 171: 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't', | 176: 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o', |
| 172: 'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l', | 177: 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c', |
| 173: 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z', | 178: 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't', |
| 174: 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't', | 179: 'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l', |
| 175: 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o', | 180: 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z', |
| 176: 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j', | 181: 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't', |
| 177: 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o', | 182: 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o', |
| 178: 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g', | 183: 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j', |
| 179: 'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a', | 184: 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o', |
| 180: 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', | 185: 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g', |
| 181: ); | 186: 'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a', |
| 182: } | 187: 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', |
| 183: | 188: ); |
| 184: $str = str_replace( | 189: } |
| 185: array_keys($UTF8_LOWER_ACCENTS), | 190: |
| 186: array_values($UTF8_LOWER_ACCENTS), | 191: $str = str_replace(array_keys($UTF8_LOWER_ACCENTS), array_values($UTF8_LOWER_ACCENTS), $str); |
| 187: $str | 192: } |
| 188: ); | 193: |
| 189: } | 194: if($case >= 0) |
| 190: | 195: { |
| 191: if($case >= 0){ | 196: if (is_null($UTF8_UPPER_ACCENTS)) |
| 192: if ( is_null($UTF8_UPPER_ACCENTS) ) { | 197: { |
| 193: $UTF8_UPPER_ACCENTS = array( | 198: $UTF8_UPPER_ACCENTS = array( |
| 194: 'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O', | 199: 'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O', |
| 195: 'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K', | 200: 'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K', |
| 196: 'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O', | 201: 'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O', |
| 197: 'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O', | 202: 'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O', |
| 198: 'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C', | 203: 'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C', |
| 199: 'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T', | 204: 'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T', |
| 200: 'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L', | 205: 'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L', |
| 201: 'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z', | 206: 'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z', |
| 202: 'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T', | 207: 'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T', |
| 203: 'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O', | 208: 'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O', |
| 204: 'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J', | 209: 'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J', |
| 205: 'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O', | 210: 'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O', |
| 206: 'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G', | 211: 'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G', |
| 207: 'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A', | 212: 'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A', |
| 208: 'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E', | 213: 'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E', |
| 209: ); | 214: ); |
| 210: } | 215: } |
| 211: $str = str_replace( | 216: |
| 212: array_keys($UTF8_UPPER_ACCENTS), | 217: $str = str_replace(array_keys($UTF8_UPPER_ACCENTS), array_values($UTF8_UPPER_ACCENTS), $str); |
| 213: array_values($UTF8_UPPER_ACCENTS), | 218: } |
| 214: $str | 219: |
| 215: ); | 220: return $str; |
| 216: } | |
| 217: | |
| 218: return $str; | |
| 219: | |
| 220: } | 221: } |
| a/upload/include/utf8/utils/bad.php |
b/upload/include/utf8/utils/bad.php |
| 1: <?php | 1: <?php |
| | 2: |
| 2: /** | 3: /** |
| 3: * @version $Id: bad.php,v 1.2 2006/02/26 13:20:44 harryf Exp $ | 4: * @version $Id: bad.php,v 1.2 2006/02/26 13:20:44 harryf Exp $ |
| 4: * Tools for locating / replacing bad bytes in UTF-8 strings | 5: * Tools for locating / replacing bad bytes in UTF-8 strings |
| 17: * @see utf8_is_valid | 18: * @see utf8_is_valid |
| 18: */ | 19: */ |
| 19: | 20: |
| 20: //-------------------------------------------------------------------- | |
| 21: /** | 21: /** |
| 22: * Locates the first bad byte in a UTF-8 string returning it's | 22: * Locates the first bad byte in a UTF-8 string returning it's |
| 23: * byte index in the string | 23: * byte index in the string |
| 30: * @package utf8 | 30: * @package utf8 |
| 31: * @subpackage bad | 31: * @subpackage bad |
| 32: */ | 32: */ |
| 33: function utf8_bad_find($str) { | 33: function utf8_bad_find($str) |
| 34: $UTF8_BAD = | 34: { |
| 35: '([\x00-\x7F]'. # ASCII (including control chars) | 35: $UTF8_BAD = |
| 36: '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte | 36: '([\x00-\x7F]'. # ASCII (including control chars) |
| 37: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs | 37: '|[\xC2-\xDF][\x80-\xBF]'. # Non-overlong 2-byte |
| 38: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte | 38: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # Excluding overlongs |
| 39: '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates | 39: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # Straight 3-byte |
| 40: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 | 40: '|\xED[\x80-\x9F][\x80-\xBF]'. # Excluding surrogates |
| 41: '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 | 41: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # Planes 1-3 |
| 42: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 | 42: '|[\xF1-\xF3][\x80-\xBF]{3}'. # Planes 4-15 |
| 43: '|(.{1}))'; # invalid byte | 43: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # Plane 16 |
| 44: $pos = 0; | 44: '|(.{1}))'; # Invalid byte |
| 45: $badList = array(); | 45: $pos = 0; |
| 46: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { | 46: $badList = array(); |
| 47: $bytes = strlen($matches[0]); | 47: |
| 48: if ( isset($matches[2])) { | 48: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) |
| 49: return $pos; | 49: { |
| 50: } | 50: $bytes = strlen($matches[0]); |
| 51: $pos += $bytes; | 51: |
| 52: $str = substr($str,$bytes); | 52: if (isset($matches[2])) |
| 53: } | 53: return $pos; |
| 54: return FALSE; | 54: |
| | 55: $pos += $bytes; |
| | 56: $str = substr($str,$bytes); |
| | 57: } |
| | 58: |
| | 59: return false; |
| 55: } | 60: } |
| 56: | 61: |
| 57: //-------------------------------------------------------------------- | |
| 58: /** | 62: /** |
| 59: * Locates all bad bytes in a UTF-8 string and returns a list of their | 63: * Locates all bad bytes in a UTF-8 string and returns a list of their |
| 60: * byte index in the string | 64: * byte index in the string |
| 67: * @package utf8 | 71: * @package utf8 |
| 68: * @subpackage bad | 72: * @subpackage bad |
| 69: */ | 73: */ |
| 70: function utf8_bad_findall($str) { | 74: function utf8_bad_findall($str) |
| 71: $UTF8_BAD = | 75: { |
| 72: '([\x00-\x7F]'. # ASCII (including control chars) | 76: $UTF8_BAD = |
| 73: '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte | 77: '([\x00-\x7F]'. # ASCII (including control chars) |
| 74: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs | 78: '|[\xC2-\xDF][\x80-\xBF]'. # Non-overlong 2-byte |
| 75: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte | 79: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # Excluding overlongs |
| 76: '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates | 80: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # Straight 3-byte |
| 77: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 | 81: '|\xED[\x80-\x9F][\x80-\xBF]'. # Excluding surrogates |
| 78: '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 | 82: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # Planes 1-3 |
| 79: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 | 83: '|[\xF1-\xF3][\x80-\xBF]{3}'. # Planes 4-15 |
| 80: '|(.{1}))'; # invalid byte | 84: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # Plane 16 |
| 81: $pos = 0; | 85: '|(.{1}))'; # Invalid byte |
| 82: $badList = array(); | 86: $pos = 0; |
| 83: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { | 87: $badList = array(); |
| 84: $bytes = strlen($matches[0]); | 88: |
| 85: if ( isset($matches[2])) { | 89: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) |
| 86: $badList[] = $pos; | 90: { |
| 87: } | 91: $bytes = strlen($matches[0]); |
| 88: $pos += $bytes; | 92: |
| 89: $str = substr($str,$bytes); | 93: if (isset($matches[2])) |
| 90: } | 94: $badList[] = $pos; |
| 91: if ( count($badList) > 0 ) { | 95: |
| 92: return $badList; | 96: $pos += $bytes; |
| 93: } | 97: $str = substr($str,$bytes); |
| 94: return FALSE; | 98: } |
| | 99: |
| | 100: if (count($badList) > 0) |
| | 101: return $badList; |
| | 102: |
| | 103: return false; |
| 95: } | 104: } |
| 96: | 105: |
| 97: //-------------------------------------------------------------------- | |
| 98: /** | 106: /** |
| 99: * Strips out any bad bytes from a UTF-8 string and returns the rest | 107: * Strips out any bad bytes from a UTF-8 string and returns the rest |
| 100: * PCRE Pattern to locate bad bytes in a UTF-8 string | 108: * PCRE Pattern to locate bad bytes in a UTF-8 string |
| 106: * @package utf8 | 114: * @package utf8 |
| 107: * @subpackage bad | 115: * @subpackage bad |
| 108: */ | 116: */ |
| 109: function utf8_bad_strip($str) { | 117: function utf8_bad_strip($str) |
| 110: $UTF8_BAD = | 118: { |
| 111: '([\x00-\x7F]'. # ASCII (including control chars) | 119: $UTF8_BAD = |
| 112: '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte | 120: '([\x00-\x7F]'. # ASCII (including control chars) |
| 113: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs | 121: '|[\xC2-\xDF][\x80-\xBF]'. # Non-overlong 2-byte |
| 114: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte | 122: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # Excluding overlongs |
| 115: '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates | 123: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # Straight 3-byte |
| 116: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 | 124: '|\xED[\x80-\x9F][\x80-\xBF]'. # Excluding surrogates |
| 117: '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 | 125: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # Planes 1-3 |
| 118: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 | 126: '|[\xF1-\xF3][\x80-\xBF]{3}'. # Planes 4-15 |
| 119: '|(.{1}))'; # invalid byte | 127: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # Plane 16 |
| 120: ob_start(); | 128: '|(.{1}))'; # Invalid byte |
| 121: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { | 129: |
| 122: if ( !isset($matches[2])) { | 130: ob_start(); |
| 123: echo $matches[0]; | 131: |
| 124: } | 132: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) |
| 125: $str = substr($str,strlen($matches[0])); | 133: { |
| 126: } | 134: if (!isset($matches[2])) |
| 127: $result = ob_get_contents(); | 135: echo $matches[0]; |
| 128: ob_end_clean(); | 136: |
| 129: return $result; | 137: $str = substr($str, strlen($matches[0])); |
| | 138: } |
| | 139: |
| | 140: $result = ob_get_contents(); |
| | 141: ob_end_clean(); |
| | 142: |
| | 143: return $result; |
| 130: } | 144: } |
| 131: | 145: |
| 132: //-------------------------------------------------------------------- | |
| 133: /** | 146: /** |
| 134: * Replace bad bytes with an alternative character - ASCII character | 147: * Replace bad bytes with an alternative character - ASCII character |
| 135: * recommended is replacement char | 148: * recommended is replacement char |
| 143: * @package utf8 | 156: * @package utf8 |
| 144: * @subpackage bad | 157: * @subpackage bad |
| 145: */ | 158: */ |
| 146: function utf8_bad_replace($str, $replace = '?') { | 159: function utf8_bad_replace($str, $replace='?') |
| 147: $UTF8_BAD = | 160: { |
| 148: '([\x00-\x7F]'. # ASCII (including control chars) | 161: $UTF8_BAD = |
| 149: '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte | 162: '([\x00-\x7F]'. # ASCII (including control chars) |
| 150: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs | 163: '|[\xC2-\xDF][\x80-\xBF]'. # Non-overlong 2-byte |
| 151: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte | 164: '|\xE0[\xA0-\xBF][\x80-\xBF]'. # Excluding overlongs |
| 152: '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates | 165: '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # Straight 3-byte |
| 153: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 | 166: '|\xED[\x80-\x9F][\x80-\xBF]'. # Excluding surrogates |
| 154: '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 | 167: '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # Planes 1-3 |
| 155: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 | 168: '|[\xF1-\xF3][\x80-\xBF]{3}'. # Planes 4-15 |
| 156: '|(.{1}))'; # invalid byte | 169: '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # Plane 16 |
| 157: ob_start(); | 170: '|(.{1}))'; # Invalid byte |
| 158: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { | 171: |
| 159: if ( !isset($matches[2])) { | 172: ob_start(); |
| 160: echo $matches[0]; | 173: |
| 161: } else { | 174: while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) |
| 162: echo $replace; | 175: { |
| 163: } | 176: if (!isset($matches[2])) |
| 164: $str = substr($str,strlen($matches[0])); | 177: echo $matches[0]; |
| 165: } | 178: else |
| 166: $result = ob_get_contents(); | 179: echo $replace; |
| 167: ob_end_clean(); | 180: |
| 168: return $result; | 181: $str = substr($str, strlen($matches[0])); |
| | 182: } |
| | 183: |
| | 184: $result = ob_get_contents(); |
| | 185: ob_end_clean(); |
| | 186: |
| | 187: return $result; |
| 169: } | 188: } |
| 170: | 189: |
| 171: //-------------------------------------------------------------------- | |
| 172: /** | 190: /** |
| 173: * Return code from utf8_bad_identify() when a five octet sequence is detected. | 191: * Return code from utf8_bad_identify() when a five octet sequence is detected. |
| 174: * Note: 5 octets sequences are valid UTF-8 but are not supported by Unicode so | 192: * Note: 5 octets sequences are valid UTF-8 but are not supported by Unicode so |
| 177: * @package utf8 | 195: * @package utf8 |
| 178: * @subpackage bad | 196: * @subpackage bad |
| 179: */ | 197: */ |
| 180: define('UTF8_BAD_5OCTET',1); | 198: define('UTF8_BAD_5OCTET', 1); |
| 181: | 199: |
| 182: /** | 200: /** |
| 183: * Return code from utf8_bad_identify() when a six octet sequence is detected. | 201: * Return code from utf8_bad_identify() when a six octet sequence is detected. |
| 187: * @package utf8 | 205: * @package utf8 |
| 188: * @subpackage bad | 206: * @subpackage bad |
| 189: */ | 207: */ |
| 190: define('UTF8_BAD_6OCTET',2); | 208: define('UTF8_BAD_6OCTET', 2); |
| 191: | 209: |
| 192: /** | 210: /** |
| 193: * Return code from utf8_bad_identify(). | 211: * Return code from utf8_bad_identify(). |
| 196: * @package utf8 | 214: * @package utf8 |
| 197: * @subpackage bad | 215: * @subpackage bad |
| 198: */ | 216: */ |
| 199: define('UTF8_BAD_SEQID',3); | 217: define('UTF8_BAD_SEQID', 3); |
| 200: | 218: |
| 201: /** | 219: /** |
| 202: * Return code from utf8_bad_identify(). | 220: * Return code from utf8_bad_identify(). |
| 205: * @package utf8 | 223: * @package utf8 |
| 206: * @subpackage bad | 224: * @subpackage bad |
| 207: */ | 225: */ |
| 208: define('UTF8_BAD_NONSHORT',4); | 226: define('UTF8_BAD_NONSHORT', 4); |
| 209: | 227: |
| 210: /** | 228: /** |
| 211: * Return code from utf8_bad_identify(). | 229: * Return code from utf8_bad_identify(). |
| 214: * @package utf8 | 232: * @package utf8 |
| 215: * @subpackage bad | 233: * @subpackage bad |
| 216: */ | 234: */ |
| 217: define('UTF8_BAD_SURROGATE',5); | 235: define('UTF8_BAD_SURROGATE', 5); |
| 218: | 236: |
| 219: /** | 237: /** |
| 220: * Return code from utf8_bad_identify(). | 238: * Return code from utf8_bad_identify(). |
| 223: * @package utf8 | 241: * @package utf8 |
| 224: * @subpackage bad | 242: * @subpackage bad |
| 225: */ | 243: */ |
| 226: define('UTF8_BAD_UNIOUTRANGE',6); | 244: define('UTF8_BAD_UNIOUTRANGE', 6); |
| 227: | 245: |
| 228: /** | 246: /** |
| 229: * Return code from utf8_bad_identify(). | 247: * Return code from utf8_bad_identify(). |
| 233: * @package utf8 | 251: * @package utf8 |
| 234: * @subpackage bad | 252: * @subpackage bad |
| 235: */ | 253: */ |
| 236: define('UTF8_BAD_SEQINCOMPLETE',7); | 254: define('UTF8_BAD_SEQINCOMPLETE', 7); |
| 237: | 255: |
| 238: //-------------------------------------------------------------------- | |
| 239: /** | 256: /** |
| 240: * Reports on the type of bad byte found in a UTF-8 string. Returns a | 257: * Reports on the type of bad byte found in a UTF-8 string. Returns a |
| 241: * status code on the first bad byte found | 258: * status code on the first bad byte found |
| 247: * @package utf8 | 264: * @package utf8 |
| 248: * @subpackage bad | 265: * @subpackage bad |
| 249: */ | 266: */ |
| 250: function utf8_bad_identify($str, &$i) { | 267: function utf8_bad_identify($str, &$i) |
| 251: | 268: { |
| 252: $mState = 0; // cached expected number of octets after the current octet | 269: $mState = 0; // Cached expected number of octets after the current octet |
| 253: // until the beginning of the next UTF8 character sequence | 270: // until the beginning of the next UTF8 character sequence |
| 254: $mUcs4 = 0; // cached Unicode character | 271: $mUcs4 = 0; // Cached Unicode character |
| 255: $mBytes = 1; // cached expected number of octets in the current sequence | 272: $mBytes = 1; // Cached expected number of octets in the current sequence |
| 256: | 273: |
| 257: $len = strlen($str); | 274: $len = strlen($str); |
| 258: | 275: |
| 259: for($i = 0; $i < $len; $i++) { | 276: for($i=0; $i < $len; $i++) |
| 260: | 277: { |
| 261: $in = ord($str{$i}); | 278: $in = ord($str{$i}); |
| 262: | 279: |
| 263: if ( $mState == 0) { | 280: if ( $mState == 0) |
| 264: | 281: { |
| 265: // When mState is zero we expect either a US-ASCII character or a | 282: // When mState is zero we expect either a US-ASCII character or a multi-octet sequence. |
| 266: // multi-octet sequence. | 283: if (0 == (0x80 & ($in))) |
| 267: if (0 == (0x80 & ($in))) { | 284: { |
| 268: // US-ASCII, pass straight through. | 285: // US-ASCII, pass straight through. |
| 269: $mBytes = 1; | 286: $mBytes = 1; |
| 270: | 287: } |
| 271: } else if (0xC0 == (0xE0 & ($in))) { | 288: else if (0xC0 == (0xE0 & ($in))) |
| 272: // First octet of 2 octet sequence | 289: { |
| 273: $mUcs4 = ($in); | 290: // First octet of 2 octet sequence |
| 274: $mUcs4 = ($mUcs4 & 0x1F) << 6; | 291: $mUcs4 = ($in); |
| 275: $mState = 1; | 292: $mUcs4 = ($mUcs4 & 0x1F) << 6; |
| 276: $mBytes = 2; | 293: $mState = 1; |
| 277: | 294: $mBytes = 2; |
| 278: } else if (0xE0 == (0xF0 & ($in))) { | 295: } |
| 279: // First octet of 3 octet sequence | 296: else if (0xE0 == (0xF0 & ($in))) |
| 280: $mUcs4 = ($in); | 297: { |
| 281: $mUcs4 = ($mUcs4 & 0x0F) << 12; | 298: // First octet of 3 octet sequence |
| 282: $mState = 2; | 299: $mUcs4 = ($in); |
| 283: $mBytes = 3; | 300: $mUcs4 = ($mUcs4 & 0x0F) << 12; |
| 284: | 301: $mState = 2; |
| 285: } else if (0xF0 == (0xF8 & ($in))) { | 302: $mBytes = 3; |
| 286: // First octet of 4 octet sequence | 303: } |
| 287: $mUcs4 = ($in); | 304: else if (0xF0 == (0xF8 & ($in))) |
| 288: $mUcs4 = ($mUcs4 & 0x07) << 18; | 305: { |
| 289: $mState = 3; | 306: // First octet of 4 octet sequence |
| 290: $mBytes = 4; | 307: $mUcs4 = ($in); |
| 291: | 308: $mUcs4 = ($mUcs4 & 0x07) << 18; |
| 292: } else if (0xF8 == (0xFC & ($in))) { | 309: $mState = 3; |
| 293: | 310: $mBytes = 4; |
| 294: /* First octet of 5 octet sequence. | 311: } |
| 295: * | 312: else if (0xF8 == (0xFC & ($in))) |
| 296: * This is illegal because the encoded codepoint must be either | 313: { |
| 297: * (a) not the shortest form or | 314: /* First octet of 5 octet sequence. |
| 298: * (b) outside the Unicode range of 0-0x10FFFF. | 315: * |
| 299: */ | 316: * This is illegal because the encoded codepoint must be either |
| 300: | 317: * (a) not the shortest form or |
| 301: return UTF8_BAD_5OCTET; | 318: * (b) outside the Unicode range of 0-0x10FFFF. |
| 302: | 319: */ |
| 303: } else if (0xFC == (0xFE & ($in))) { | 320: return UTF8_BAD_5OCTET; |
| 304: | 321: } |
| 305: // First octet of 6 octet sequence, see comments for 5 octet sequence. | 322: else if (0xFC == (0xFE & ($in))) |
| 306: return UTF8_BAD_6OCTET; | 323: { |
| 307: | 324: // First octet of 6 octet sequence, see comments for 5 octet sequence. |
| 308: } else { | 325: return UTF8_BAD_6OCTET; |
| 309: // Current octet is neither in the US-ASCII range nor a legal first | 326: } |
| 310: // octet of a multi-octet sequence. | 327: else |
| 311: return UTF8_BAD_SEQID; | 328: { |
| 312: | 329: // Current octet is neither in the US-ASCII range nor a legal first |
| 313: } | 330: // octet of a multi-octet sequence. |
| 314: | 331: return UTF8_BAD_SEQID; |
| 315: } else { | 332: } |
| 316: | 333: } |
| 317: // When mState is non-zero, we expect a continuation of the multi-octet | 334: else |
| 318: // sequence | 335: { |
| 319: if (0x80 == (0xC0 & ($in))) { | 336: // When mState is non-zero, we expect a continuation of the multi-octet sequence |
| 320: | 337: if (0x80 == (0xC0 & ($in))) |
| 321: // Legal continuation. | 338: { |
| 322: $shift = ($mState - 1) * 6; | 339: // Legal continuation. |
| 323: $tmp = $in; | 340: $shift = ($mState - 1) * 6; |
| 324: $tmp = ($tmp & 0x0000003F) << $shift; | 341: $tmp = $in; |
| 325: $mUcs4 |= $tmp; | 342: $tmp = ($tmp & 0x0000003F) << $shift; |
| 326: | 343: $mUcs4 |= $tmp; |
| 327: /** | 344: |
| 328: * End of the multi-octet sequence. mUcs4 now contains the final | 345: /** |
| 329: * Unicode codepoint to be output | 346: * End of the multi-octet sequence. mUcs4 now contains the final |
| 330: */ | 347: * Unicode codepoint to be output |
| 331: if (0 == --$mState) { | 348: */ |
| 332: | 349: if (0 == --$mState) |
| 333: // From Unicode 3.1, non-shortest form is illegal | 350: { |
| 334: if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || | 351: // From Unicode 3.1, non-shortest form is illegal |
| 335: ((3 == $mBytes) && ($mUcs4 < 0x0800)) || | 352: if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || |
| 336: ((4 == $mBytes) && ($mUcs4 < 0x10000)) ) { | 353: ((3 == $mBytes) && ($mUcs4 < 0x0800)) || |
| 337: return UTF8_BAD_NONSHORT; | 354: ((4 == $mBytes) && ($mUcs4 < 0x10000)) ) |
| 338: | 355: return UTF8_BAD_NONSHORT; |
| 339: // From Unicode 3.2, surrogate characters are illegal | 356: else if (($mUcs4 & 0xFFFFF800) == 0xD800) // From Unicode 3.2, surrogate characters are illegal |
| 340: } else if (($mUcs4 & 0xFFFFF800) == 0xD800) { | 357: return UTF8_BAD_SURROGATE; |
| 341: return UTF8_BAD_SURROGATE; | 358: else if ($mUcs4 > 0x10FFFF) // Codepoints outside the Unicode range are illegal |
| 342: | 359: return UTF8_BAD_UNIOUTRANGE; |
| 343: // Codepoints outside the Unicode range are illegal | 360: |
| 344: } else if ($mUcs4 > 0x10FFFF) { | 361: // Initialize UTF8 cache |
| 345: return UTF8_BAD_UNIOUTRANGE; | 362: $mState = 0; |
| 346: } | 363: $mUcs4 = 0; |
| 347: | 364: $mBytes = 1; |
| 348: //initialize UTF8 cache | 365: } |
| 349: $mState = 0; | 366: |
| 350: $mUcs4 = 0; | 367: } |
| 351: $mBytes = 1; | 368: else |
| 352: } | 369: { |
| 353: | 370: // ((0xC0 & (*in) != 0x80) && (mState != 0)) |
| 354: } else { | 371: // Incomplete multi-octet sequence. |
| 355: // ((0xC0 & (*in) != 0x80) && (mState != 0)) | 372: $i--; |
| 356: // Incomplete multi-octet sequence. | 373: return UTF8_BAD_SEQINCOMPLETE; |
| 357: $i--; | 374: } |
| 358: return UTF8_BAD_SEQINCOMPLETE; | 375: } |
| 359: } | 376: } |
| 360: } | 377: |
| 361: } | 378: // Incomplete multi-octet sequence |
| 362: | 379: if ($mState != 0) |
| 363: if ( $mState != 0 ) { | 380: { |
| 364: // Incomplete multi-octet sequence. | 381: $i--; |
| 365: $i--; | 382: return UTF8_BAD_SEQINCOMPLETE; |
| 366: return UTF8_BAD_SEQINCOMPLETE; | 383: } |
| 367: } | 384: |
| 368: | 385: // No bad octets found |
| 369: // No bad octets found | 386: $i = null; |
| 370: $i = NULL; | 387: return false; |
| 371: return FALSE; | |
| 372: } | 388: } |
| 373: | 389: |
| 374: //-------------------------------------------------------------------- | |
| 375: /** | 390: /** |
| 376: * Takes a return code from utf8_bad_identify() are returns a message | 391: * Takes a return code from utf8_bad_identify() are returns a message |
| 377: * (in English) explaining what the problem is. | 392: * (in English) explaining what the problem is. |
| 381: * @package utf8 | 396: * @package utf8 |
| 382: * @subpackage bad | 397: * @subpackage bad |
| 383: */ | 398: */ |
| 384: function utf8_bad_explain($code) { | 399: function utf8_bad_explain($code) |
| 385: | 400: { |
| 386: switch ($code) { | 401: switch ($code) |
| 387: | 402: { |
| 388: case UTF8_BAD_5OCTET: | 403: case UTF8_BAD_5OCTET: |
| 389: return 'Five octet sequences are valid UTF-8 but are not supported by Unicode'; | 404: return 'Five octet sequences are valid UTF-8 but are not supported by Unicode'; |
| 390: break; | 405: break; |
| 391: | 406: |
| 392: case UTF8_BAD_6OCTET: | 407: case UTF8_BAD_6OCTET: |
| 393: return 'Six octet sequences are valid UTF-8 but are not supported by Unicode'; | 408: return 'Six octet sequences are valid UTF-8 but are not supported by Unicode'; |
| 394: break; | 409: break; |
| 395: | 410: |
| 396: case UTF8_BAD_SEQID: | 411: case UTF8_BAD_SEQID: |
| 397: return 'Invalid octet for use as start of multi-byte UTF-8 sequence'; | 412: return 'Invalid octet for use as start of multi-byte UTF-8 sequence'; |
| 398: break; | 413: break; |
| 399: | 414: |
| 400: case UTF8_BAD_NONSHORT: | 415: case UTF8_BAD_NONSHORT: |
| 401: return 'From Unicode 3.1, non-shortest form is illegal'; | 416: return 'From Unicode 3.1, non-shortest form is illegal'; |
| 402: break; | 417: break; |
| 403: | 418: |
| 404: case UTF8_BAD_SURROGATE: | 419: case UTF8_BAD_SURROGATE: |
| 405: return 'From Unicode 3.2, surrogate characters are illegal'; | 420: return 'From Unicode 3.2, surrogate characters are illegal'; |
| 406: break; | 421: break; |
| 407: | 422: |
| 408: case UTF8_BAD_UNIOUTRANGE: | 423: case UTF8_BAD_UNIOUTRANGE: |
| 409: return 'Codepoints outside the Unicode range are illegal'; | 424: return 'Codepoints outside the Unicode range are illegal'; |
| 410: break; | 425: break; |
| 411: | 426: |
| 412: case UTF8_BAD_SEQINCOMPLETE: | 427: case UTF8_BAD_SEQINCOMPLETE: |
| 413: return 'Incomplete multi-octet sequence'; | 428: return 'Incomplete multi-octet sequence'; |
| 414: break; | 429: break; |
| 415: | 430: } |
| 416: } | 431: |
| 417: | 432: trigger_error('Unknown error code: '.$code, E_USER_WARNING); |
| 418: trigger_error('Unknown error code: '.$code,E_USER_WARNING); | 433: |
| 419: return FALSE; | 434: return false; |
| 420: | |
| 421: } | 435: } |
| a/upload/include/utf8/utils/specials.php |
b/upload/include/utf8/utils/specials.php |
| 1: <?php | 1: <?php |
| | 2: |
| 2: /** | 3: /** |
| 3: * Utilities for processing "special" characters in UTF-8. "Special" largely means anything which would | 4: * Utilities for processing "special" characters in UTF-8. "Special" largely means anything which would |
| 4: * be regarded as a non-word character, like ASCII control characters and punctuation. This has a "Roman" | 5: * be regarded as a non-word character, like ASCII control characters and punctuation. This has a "Roman" |
| 10: * @see utf8_is_valid | 11: * @see utf8_is_valid |
| 11: */ | 12: */ |
| 12: | 13: |
| 13: //-------------------------------------------------------------------- | |
| 14: /** | 14: /** |
| 15: * Used internally. Builds a PCRE pattern from the $UTF8_SPECIAL_CHARS | 15: * Used internally. Builds a PCRE pattern from the $UTF8_SPECIAL_CHARS |
| 16: * array defined in this file | 16: * array defined in this file |
| 17: * The $UTF8_SPECIAL_CHARS should contain all special characters (non-letter/non-digit) | 17: * The $UTF8_SPECIAL_CHARS should contain all special characters (non-letter/non-digit) |
| 18: * defined in the various local charsets - it's not a complete list of | 18: * defined in the various local charsets - it's not a complete list of |
| 27: * @see utf8_is_word_chars | 27: * @see utf8_is_word_chars |
| 28: * @see utf8_strip_specials | 28: * @see utf8_strip_specials |
| 29: */ | 29: */ |
| 30: function utf8_specials_pattern() { | 30: function utf8_specials_pattern() |
| 31: static $pattern = NULL; | 31: { |
| 32: | 32: static $pattern = null; |
| 33: if ( !$pattern ) { | 33: |
| 34: $UTF8_SPECIAL_CHARS = array( | 34: if (!$pattern) |
| 35: 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, | 35: { |
| 36: 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, | 36: $UTF8_SPECIAL_CHARS = array( |
| 37: 0x002f, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x005b, | 37: 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, |
| 38: 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e, | 38: 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, |
| 39: 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, | 39: 0x002f, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x005b, |
| 40: 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, | 40: 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e, |
| 41: 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, | 41: 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, |
| 42: 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, | 42: 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, |
| 43: 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, | 43: 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, |
| 44: 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, | 44: 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, |
| 45: 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00d7, 0x00f7, 0x02c7, 0x02d8, 0x02d9, | 45: 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, |
| 46: 0x02da, 0x02db, 0x02dc, 0x02dd, 0x0300, 0x0301, 0x0303, 0x0309, 0x0323, 0x0384, | 46: 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, |
| 47: 0x0385, 0x0387, 0x03b2, 0x03c6, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x05b0, 0x05b1, | 47: 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00d7, 0x00f7, 0x02c7, 0x02d8, 0x02d9, |
| 48: 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0x05bb, 0x05bc, | 48: 0x02da, 0x02db, 0x02dc, 0x02dd, 0x0300, 0x0301, 0x0303, 0x0309, 0x0323, 0x0384, |
| 49: 0x05bd, 0x05be, 0x05bf, 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f3, 0x05f4, 0x060c, | 49: 0x0385, 0x0387, 0x03b2, 0x03c6, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x05b0, 0x05b1, |
| 50: 0x061b, 0x061f, 0x0640, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651, | 50: 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0x05bb, 0x05bc, |
| 51: 0x0652, 0x066a, 0x0e3f, 0x200c, 0x200d, 0x200e, 0x200f, 0x2013, 0x2014, 0x2015, | 51: 0x05bd, 0x05be, 0x05bf, 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f3, 0x05f4, 0x060c, |
| 52: 0x2017, 0x2018, 0x2019, 0x201a, 0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2022, | 52: 0x061b, 0x061f, 0x0640, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651, |
| 53: 0x2026, 0x2030, 0x2032, 0x2033, 0x2039, 0x203a, 0x2044, 0x20a7, 0x20aa, 0x20ab, | 53: 0x0652, 0x066a, 0x0e3f, 0x200c, 0x200d, 0x200e, 0x200f, 0x2013, 0x2014, 0x2015, |
| 54: 0x20ac, 0x2116, 0x2118, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, | 54: 0x2017, 0x2018, 0x2019, 0x201a, 0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2022, |
| 55: 0x2194, 0x2195, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, | 55: 0x2026, 0x2030, 0x2032, 0x2033, 0x2039, 0x203a, 0x2044, 0x20a7, 0x20aa, 0x20ab, |
| 56: 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, | 56: 0x20ac, 0x2116, 0x2118, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, |
| 57: 0x2215, 0x2217, 0x2219, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, | 57: 0x2194, 0x2195, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, |
| 58: 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, | 58: 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, |
| 59: 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2310, | 59: 0x2215, 0x2217, 0x2219, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, |
| 60: 0x2320, 0x2321, 0x2329, 0x232a, 0x2469, 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, | 60: 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, |
| 61: 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2550, 0x2551, 0x2552, 0x2553, | 61: 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2310, |
| 62: 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, | 62: 0x2320, 0x2321, 0x2329, 0x232a, 0x2469, 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, |
| 63: 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, | 63: 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2550, 0x2551, 0x2552, 0x2553, |
| 64: 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, | 64: 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, |
| 65: 0x2591, 0x2592, 0x2593, 0x25a0, 0x25b2, 0x25bc, 0x25c6, 0x25ca, 0x25cf, 0x25d7, | 65: 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, |
| 66: 0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, 0x2665, 0x2666, 0x2701, 0x2702, | 66: 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, |
| 67: 0x2703, 0x2704, 0x2706, 0x2707, 0x2708, 0x2709, 0x270c, 0x270d, 0x270e, 0x270f, | 67: 0x2591, 0x2592, 0x2593, 0x25a0, 0x25b2, 0x25bc, 0x25c6, 0x25ca, 0x25cf, 0x25d7, |
| 68: 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, | 68: 0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, 0x2665, 0x2666, 0x2701, 0x2702, |
| 69: 0x271a, 0x271b, 0x271c, 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723, | 69: 0x2703, 0x2704, 0x2706, 0x2707, 0x2708, 0x2709, 0x270c, 0x270d, 0x270e, 0x270f, |
| 70: 0x2724, 0x2725, 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, | 70: 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, |
| 71: 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, | 71: 0x271a, 0x271b, 0x271c, 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723, |
| 72: 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2742, | 72: 0x2724, 0x2725, 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, |
| 73: 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274d, | 73: 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, |
| 74: 0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, | 74: 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2742, |
| 75: 0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x277f, | 75: 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274d, |
| 76: 0x2789, 0x2793, 0x2794, 0x2798, 0x2799, 0x279a, 0x279b, 0x279c, 0x279d, 0x279e, | 76: 0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, |
| 77: 0x279f, 0x27a0, 0x27a1, 0x27a2, 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8, | 77: 0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x277f, |
| 78: 0x27a9, 0x27aa, 0x27ab, 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3, | 78: 0x2789, 0x2793, 0x2794, 0x2798, 0x2799, 0x279a, 0x279b, 0x279c, 0x279d, 0x279e, |
| 79: 0x27b4, 0x27b5, 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd, | 79: 0x279f, 0x27a0, 0x27a1, 0x27a2, 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8, |
| 80: 0x27be, 0xf6d9, 0xf6da, 0xf6db, 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc, | 80: 0x27a9, 0x27aa, 0x27ab, 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3, |
| 81: 0xf8dd, 0xf8de, 0xf8df, 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, 0xf8e5, 0xf8e6, | 81: 0x27b4, 0x27b5, 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd, |
| 82: 0xf8e7, 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, | 82: 0x27be, 0xf6d9, 0xf6da, 0xf6db, 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc, |
| 83: 0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, 0xf8fa, | 83: 0xf8dd, 0xf8de, 0xf8df, 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, 0xf8e5, 0xf8e6, |
| 84: 0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d, | 84: 0xf8e7, 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, |
| 85: ); | 85: 0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, 0xf8fa, |
| 86: $pattern = preg_quote(utf8_from_unicode($UTF8_SPECIAL_CHARS), '/'); | 86: 0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d); |
| 87: $pattern = '/[\x00-\x19'.$pattern.']/u'; | 87: |
| 88: } | 88: $pattern = preg_quote(utf8_from_unicode($UTF8_SPECIAL_CHARS), '/'); |
| 89: | 89: $pattern = '/[\x00-\x19'.$pattern.']/u'; |
| 90: return $pattern; | 90: } |
| | 91: |
| | 92: return $pattern; |
| 91: } | 93: } |
| 92: | 94: |
| 93: //-------------------------------------------------------------------- | |
| 94: /** | 95: /** |
| 95: * Checks a string for whether it contains only word characters. This | 96: * Checks a string for whether it contains only word characters. This |
| 96: * is logically equivalent to the \w PCRE meta character. Note that | 97: * is logically equivalent to the \w PCRE meta character. Note that |
| 103: * @return boolean TRUE if the string only contains word characters | 104: * @return boolean TRUE if the string only contains word characters |
| 104: * @see utf8_specials_pattern | 105: * @see utf8_specials_pattern |
| 105: */ | 106: */ |
| 106: function utf8_is_word_chars($str) { | 107: function utf8_is_word_chars($str) |
| 107: return !(bool)preg_match(utf8_specials_pattern(),$str); | 108: { |
| | 109: return !(bool) preg_match(utf8_specials_pattern(), $str); |
| 108: } | 110: } |
| 109: | 111: |
| 110: //-------------------------------------------------------------------- | |
| 111: /** | 112: /** |
| 112: * Removes special characters (nonalphanumeric) from a UTF-8 string | 113: * Removes special characters (nonalphanumeric) from a UTF-8 string |
| 113: * | 114: * |
| 114: * This can be useful as a helper for sanitizing a string for use as | 115: * This can be useful as a helper for sanitizing a string for use as |
| 115: * something like a file name or a unique identifier. Be warned though | 116: * something like a file name or a unique identifier. Be warned though |
| 116: * it does not handle all possible non-alphanumeric characters and is | 117: * it does not handle all possible non-alphanumeric characters and is |
| 124: * @return string with common non-alphanumeric characters removed | 125: * @return string with common non-alphanumeric characters removed |
| 125: * @see utf8_specials_pattern | 126: * @see utf8_specials_pattern |
| 126: */ | 127: */ |
| 127: function utf8_strip_specials($string, $repl=''){ | 128: function utf8_strip_specials($string, $repl='') |
| 128: return preg_replace(utf8_specials_pattern(), $repl, $string); | 129: { |
| | 130: return preg_replace(utf8_specials_pattern(), $repl, $string); |
| 129: } | 131: } |
| a/upload/include/utf8/utils/unicode.php |
b/upload/include/utf8/utils/unicode.php |
| 1: <?php | 1: <?php |
| | 2: |
| 2: /** | 3: /** |
| 3: * @version $Id: unicode.php,v 1.2 2006/02/26 13:20:44 harryf Exp $ | 4: * @version $Id: unicode.php,v 1.2 2006/02/26 13:20:44 harryf Exp $ |
| 4: * Tools for conversion between UTF-8 and unicode | 5: * Tools for conversion between UTF-8 and unicode |
| 16: * @subpackage unicode | 17: * @subpackage unicode |
| 17: */ | 18: */ |
| 18: | 19: |
| 19: //-------------------------------------------------------------------- | |
| 20: /** | 20: /** |
| 21: * Takes an UTF-8 string and returns an array of ints representing the | 21: * Takes an UTF-8 string and returns an array of ints representing the |
| 22: * Unicode characters. Astral planes are supported ie. the ints in the | 22: * Unicode characters. Astral planes are supported ie. the ints in the |
| 23: * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates | 23: * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates |
| 24: * are not allowed. | 24: * are not allowed. |
| 34: * @package utf8 | 34: * @package utf8 |
| 35: * @subpackage unicode | 35: * @subpackage unicode |
| 36: */ | 36: */ |
| 37: function utf8_to_unicode($str) { | 37: function utf8_to_unicode($str) |
| 38: $mState = 0; // cached expected number of octets after the current octet | 38: { |
| 39: // until the beginning of the next UTF8 character sequence | 39: $mState = 0; // Cached expected number of octets after the current octet |
| 40: $mUcs4 = 0; // cached Unicode character | 40: // until the beginning of the next UTF8 character sequence |
| 41: $mBytes = 1; // cached expected number of octets in the current sequence | 41: $mUcs4 = 0; // Cached Unicode character |
| 42: | 42: $mBytes = 1; // Cached expected number of octets in the current sequence |
| 43: $out = array(); | 43: |
| 44: | 44: $out = array(); |
| 45: $len = strlen($str); | 45: $len = strlen($str); |
| 46: | 46: |
| 47: for($i = 0; $i < $len; $i++) { | 47: for($i = 0; $i < $len; $i++) |
| 48: | 48: { |
| 49: $in = ord($str{$i}); | 49: $in = ord($str{$i}); |
| 50: | 50: |
| 51: if ( $mState == 0) { | 51: if ($mState == 0) |
| 52: | 52: { |
| 53: // When mState is zero we expect either a US-ASCII character or a | 53: // When mState is zero we expect either a US-ASCII character or a multi-octet sequence. |
| 54: // multi-octet sequence. | 54: if (0 == (0x80 & ($in))) |
| 55: if (0 == (0x80 & ($in))) { | 55: { |
| 56: // US-ASCII, pass straight through. | 56: // US-ASCII, pass straight through. |
| 57: $out[] = $in; | 57: $out[] = $in; |
| 58: $mBytes = 1; | 58: $mBytes = 1; |
| 59: | 59: } |
| 60: } else if (0xC0 == (0xE0 & ($in))) { | 60: else if (0xC0 == (0xE0 & ($in))) |
| 61: // First octet of 2 octet sequence | 61: { |
| 62: $mUcs4 = ($in); | 62: // First octet of 2 octet sequence |
| 63: $mUcs4 = ($mUcs4 & 0x1F) << 6; | 63: $mUcs4 = ($in); |
| 64: $mState = 1; | 64: $mUcs4 = ($mUcs4 & 0x1F) << 6; |
| 65: $mBytes = 2; | 65: $mState = 1; |
| 66: | 66: $mBytes = 2; |
| 67: } else if (0xE0 == (0xF0 & ($in))) { | 67: } |
| 68: // First octet of 3 octet sequence | 68: else if (0xE0 == (0xF0 & ($in))) |
| 69: $mUcs4 = ($in); | 69: { |
| 70: $mUcs4 = ($mUcs4 & 0x0F) << 12; | 70: // First octet of 3 octet sequence |
| 71: $mState = 2; | 71: $mUcs4 = ($in); |
| 72: $mBytes = 3; | 72: $mUcs4 = ($mUcs4 & 0x0F) << 12; |
| 73: | 73: $mState = 2; |
| 74: } else if (0xF0 == (0xF8 & ($in))) { | 74: $mBytes = 3; |
| 75: // First octet of 4 octet sequence | 75: } |
| 76: $mUcs4 = ($in); | 76: else if (0xF0 == (0xF8 & ($in))) |
| 77: $mUcs4 = ($mUcs4 & 0x07) << 18; | 77: { |
| 78: $mState = 3; | 78: // First octet of 4 octet sequence |
| 79: $mBytes = 4; | 79: $mUcs4 = ($in); |
| 80: | 80: $mUcs4 = ($mUcs4 & 0x07) << 18; |
| 81: } else if (0xF8 == (0xFC & ($in))) { | 81: $mState = 3; |
| 82: /* First octet of 5 octet sequence. | 82: $mBytes = 4; |
| 83: * | 83: } |
| 84: * This is illegal because the encoded codepoint must be either | 84: else if (0xF8 == (0xFC & ($in))) |
| 85: * (a) not the shortest form or | 85: { |
| 86: * (b) outside the Unicode range of 0-0x10FFFF. | 86: /* First octet of 5 octet sequence. |
| 87: * Rather than trying to resynchronize, we will carry on until the end | 87: * |
| 88: * of the sequence and let the later error handling code catch it. | 88: * This is illegal because the encoded codepoint must be either |
| 89: */ | 89: * (a) not the shortest form or |
| 90: $mUcs4 = ($in); | 90: * (b) outside the Unicode range of 0-0x10FFFF. |
| 91: $mUcs4 = ($mUcs4 & 0x03) << 24; | 91: * Rather than trying to resynchronize, we will carry on until the end |
| 92: $mState = 4; | 92: * of the sequence and let the later error handling code catch it. |
| 93: $mBytes = 5; | 93: */ |
| 94: | 94: $mUcs4 = ($in); |
| 95: } else if (0xFC == (0xFE & ($in))) { | 95: $mUcs4 = ($mUcs4 & 0x03) << 24; |
| 96: // First octet of 6 octet sequence, see comments for 5 octet sequence. | 96: $mState = 4; |
| 97: $mUcs4 = ($in); | 97: $mBytes = 5; |
| 98: $mUcs4 = ($mUcs4 & 1) << 30; | 98: } |
| 99: $mState = 5; | 99: else if (0xFC == (0xFE & ($in))) |
| 100: $mBytes = 6; | 100: { |
| 101: | 101: // First octet of 6 octet sequence, see comments for 5 octet sequence. |
| 102: } else { | 102: $mUcs4 = ($in); |
| 103: /* Current octet is neither in the US-ASCII range nor a legal first | 103: $mUcs4 = ($mUcs4 & 1) << 30; |
| 104: * octet of a multi-octet sequence. | 104: $mState = 5; |
| 105: */ | 105: $mBytes = 6; |
| 106: trigger_error( | 106: } |
| 107: 'utf8_to_unicode: Illegal sequence identifier '. | 107: else |
| 108: 'in UTF-8 at byte '.$i, | 108: { |
| 109: E_USER_WARNING | 109: /* Current octet is neither in the US-ASCII range nor a legal first octet of a multi-octet sequence. */ |
| 110: ); | 110: trigger_error('utf8_to_unicode: Illegal sequence identifier in UTF-8 at byte '.$i, E_USER_WARNING); |
| 111: return FALSE; | 111: return false; |
| 112: | 112: } |
| 113: } | 113: } |
| 114: | 114: else |
| 115: } else { | 115: { |
| 116: | 116: // When mState is non-zero, we expect a continuation of the multi-octet sequence |
| 117: // When mState is non-zero, we expect a continuation of the multi-octet | 117: if (0x80 == (0xC0 & ($in))) |
| 118: // sequence | 118: { |
| 119: if (0x80 == (0xC0 & ($in))) { | 119: // Legal continuation. |
| 120: | 120: $shift = ($mState - 1) * 6; |
| 121: // Legal continuation. | 121: $tmp = $in; |
| 122: $shift = ($mState - 1) * 6; | 122: $tmp = ($tmp & 0x0000003F) << $shift; |
| 123: $tmp = $in; | 123: $mUcs4 |= $tmp; |
| 124: $tmp = ($tmp & 0x0000003F) << $shift; | 124: |
| 125: $mUcs4 |= $tmp; | 125: /** |
| 126: | 126: * End of the multi-octet sequence. mUcs4 now contains the final |
| 127: /** | 127: * Unicode codepoint to be output |
| 128: * End of the multi-octet sequence. mUcs4 now contains the final | 128: */ |
| 129: * Unicode codepoint to be output | 129: if (0 == --$mState) |
| 130: */ | 130: { |
| 131: if (0 == --$mState) { | 131: /* |
| 132: | 132: * Check for illegal sequences and codepoints. |
| 133: /* | 133: */ |
| 134: * Check for illegal sequences and codepoints. | 134: // From Unicode 3.1, non-shortest form is illegal |
| 135: */ | 135: if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || ((3 == $mBytes) && ($mUcs4 < 0x0800)) || |
| 136: // From Unicode 3.1, non-shortest form is illegal | 136: ((4 == $mBytes) && ($mUcs4 < 0x10000)) || (4 < $mBytes) || |
| 137: if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || | 137: // From Unicode 3.2, surrogate characters are illegal |
| 138: ((3 == $mBytes) && ($mUcs4 < 0x0800)) || | 138: (($mUcs4 & 0xFFFFF800) == 0xD800) || |
| 139: ((4 == $mBytes) && ($mUcs4 < 0x10000)) || | 139: // Codepoints outside the Unicode range are illegal |
| 140: (4 < $mBytes) || | 140: ($mUcs4 > 0x10FFFF)) |
| 141: // From Unicode 3.2, surrogate characters are illegal | 141: { |
| 142: (($mUcs4 & 0xFFFFF800) == 0xD800) || | 142: trigger_error('utf8_to_unicode: Illegal sequence or codepoint in UTF-8 at byte '.$i, E_USER_WARNING); |
| 143: // Codepoints outside the Unicode range are illegal | 143: return false; |
| 144: ($mUcs4 > 0x10FFFF)) { | 144: } |
| 145: | 145: |
| 146: trigger_error( | 146: // BOM is legal but we don't want to output it |
| 147: 'utf8_to_unicode: Illegal sequence or codepoint '. | 147: if (0xFEFF != $mUcs4) |
| 148: 'in UTF-8 at byte '.$i, | 148: $out[] = $mUcs4; |
| 149: E_USER_WARNING | 149: |
| 150: ); | 150: // Initialize UTF8 cache |
| 151: | 151: $mState = 0; |
| 152: return FALSE; | 152: $mUcs4 = 0; |
| 153: | 153: $mBytes = 1; |
| 154: } | 154: } |
| 155: | 155: |
| 156: if (0xFEFF != $mUcs4) { | 156: } |
| 157: // BOM is legal but we don't want to output it | 157: else |
| 158: $out[] = $mUcs4; | 158: { |
| 159: } | 159: /* ((0xC0 & (*in) != 0x80) && (mState != 0)) |
| 160: | 160: Incomplete multi-octet sequence. */ |
| 161: //initialize UTF8 cache | 161: trigger_error('utf8_to_unicode: Incomplete multi-octet sequence in UTF-8 at byte '.$i, E_USER_WARNING); |
| 162: $mState = 0; | 162: return false; |
| 163: $mUcs4 = 0; | 163: } |
| 164: $mBytes = 1; | 164: } |
| 165: } | 165: } |
| 166: | 166: |
| 167: } else { | 167: return $out; |
| 168: /** | |
| 169: *((0xC0 & (*in) != 0x80) && (mState != 0)) | |
| 170: * Incomplete multi-octet sequence. | |
| 171: */ | |
| 172: trigger_error( | |
| 173: 'utf8_to_unicode: Incomplete multi-octet '. | |
| 174: ' sequence in UTF-8 at byte '.$i, | |
| 175: E_USER_WARNING | |
| 176: ); | |
| 177: | |
| 178: return FALSE; | |
| 179: } | |
| 180: } | |
| 181: } | |
| 182: return $out; | |
| 183: } | 168: } |
| 184: | 169: |
| 185: //-------------------------------------------------------------------- | |
| 186: /** | 170: /** |
| 187: * Takes an array of ints representing the Unicode characters and returns | 171: * Takes an array of ints representing the Unicode characters and returns |
| 188: * a UTF-8 string. Astral planes are supported ie. the ints in the | 172: * a UTF-8 string. Astral planes are supported ie. the ints in the |
| 189: * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates | 173: * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates |
| 190: * are not allowed. | 174: * are not allowed. |
| 191: * Returns false if the input array contains ints that represent | 175: * Returns false if the input array contains ints that represent |
| 192: * surrogates or are outside the Unicode range | 176: * surrogates or are outside the Unicode range |
| 193: * and raises a PHP error at level E_USER_WARNING | 177: * and raises a PHP error at level E_USER_WARNING |
| 194: * Note: this function has been modified slightly in this library to use | 178: * Note: this function has been modified slightly in this library to use |
| 202: * @package utf8 | 186: * @package utf8 |
| 203: * @subpackage unicode | 187: * @subpackage unicode |
| 204: */ | 188: */ |
| 205: function utf8_from_unicode($arr) { | 189: function utf8_from_unicode($arr) |
| 206: ob_start(); | 190: { |
| 207: | 191: ob_start(); |
| 208: foreach (array_keys($arr) as $k) { | 192: |
| 209: | 193: foreach (array_keys($arr) as $k) |
| 210: # ASCII range (including control chars) | 194: { |
| 211: if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) { | 195: if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) // ASCII range (including control chars) |
| 212: | 196: { |
| 213: echo chr($arr[$k]); | 197: echo chr($arr[$k]); |
| 214: | 198: } |
| 215: # 2 byte sequence | 199: else if ($arr[$k] <= 0x07ff) //2 byte sequence |
| 216: } else if ($arr[$k] <= 0x07ff) { | 200: { |
| 217: | 201: echo chr(0xc0 | ($arr[$k] >> 6)); |
| 218: echo chr(0xc0 | ($arr[$k] >> 6)); | 202: echo chr(0x80 | ($arr[$k] & 0x003f)); |
| 219: echo chr(0x80 | ($arr[$k] & 0x003f)); | 203: } |
| 220: | 204: else if($arr[$k] == 0xFEFF) // Byte order mark (skip) |
| 221: # Byte order mark (skip) | 205: { |
| 222: } else if($arr[$k] == 0xFEFF) { | 206: // Nop -- zap the BOM |
| 223: | 207: } |
| 224: // nop -- zap the BOM | 208: else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) // Test for illegal surrogates |
| 225: | 209: { |
| 226: # Test for illegal surrogates | 210: // Found a surrogate |
| 227: } else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) { | 211: trigger_error('utf8_from_unicode: Illegal surrogate at index: '.$k.', value: '.$arr[$k], E_USER_WARNING); |
| 228: | 212: |
| 229: // found a surrogate | 213: return false; |
| 230: trigger_error( | 214: } |
| 231: 'utf8_from_unicode: Illegal surrogate '. | 215: else if ($arr[$k] <= 0xffff) // 3 byte sequence |
| 232: 'at index: '.$k.', value: '.$arr[$k], | 216: { |
| 233: E_USER_WARNING | 217: echo chr(0xe0 | ($arr[$k] >> 12)); |
| 234: ); | 218: echo chr(0x80 | (($arr[$k] >> 6) & 0x003f)); |
| 235: | 219: echo chr(0x80 | ($arr[$k] & 0x003f)); |
| 236: return FALSE; | 220: } |
| 237: | 221: else if ($arr[$k] <= 0x10ffff) // 4 byte sequence |
| 238: # 3 byte sequence | 222: { |
| 239: } else if ($arr[$k] <= 0xffff) { | 223: echo chr(0xf0 | ($arr[$k] >> 18)); |
| 240: | 224: echo chr(0x80 | (($arr[$k] >> 12) & 0x3f)); |
| 241: echo chr(0xe0 | ($arr[$k] >> 12)); | 225: echo chr(0x80 | (($arr[$k] >> 6) & 0x3f)); |
| 242: echo chr(0x80 | (($arr[$k] >> 6) & 0x003f)); | 226: echo chr(0x80 | ($arr[$k] & 0x3f)); |
| 243: echo chr(0x80 | ($arr[$k] & 0x003f)); | 227: } |
| 244: | 228: else |
| 245: # 4 byte sequence | 229: { |
| 246: } else if ($arr[$k] <= 0x10ffff) { | 230: trigger_error('utf8_from_unicode: Codepoint out of Unicode range at index: '.$k.', value: '.$arr[$k], E_USER_WARNING); |
| 247: | 231: |
| 248: echo chr(0xf0 | ($arr[$k] >> 18)); | 232: // Out of range |
| 249: echo chr(0x80 | (($arr[$k] >> 12) & 0x3f)); | 233: return false; |
| 250: echo chr(0x80 | (($arr[$k] >> 6) & 0x3f)); | 234: } |
| 251: echo chr(0x80 | ($arr[$k] & 0x3f)); | 235: } |
| 252: | 236: |
| 253: } else { | 237: $result = ob_get_contents(); |
| 254: | 238: ob_end_clean(); |
| 255: trigger_error( | 239: return $result; |
| 256: 'utf8_from_unicode: Codepoint out of Unicode range '. | |
| 257: 'at index: '.$k.', value: '.$arr[$k], | |
| 258: E_USER_WARNING | |
| 259: ); | |
| 260: | |
| 261: // out of range | |
| 262: return FALSE; | |
| 263: } | |
| 264: } | |
| 265: | |
| 266: $result = ob_get_contents(); | |
| 267: ob_end_clean(); | |
| 268: return $result; | |
| 269: } | 240: } |
| a/upload/install.php |
b/upload/install.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: // The FluxBB version this script installs | 11: // The FluxBB version this script installs |
| 27: define('FORUM_VERSION', '1.4'); | 12: define('FORUM_VERSION', '1.4-rc1'); |
| 28: define('FORUM_DB_REVISION', 0); | 13: define('FORUM_DB_REVISION', 2); |
| 29: | 14: |
| 30: | 15: |
| 31: define('PUN_ROOT', './'); | 16: define('PUN_ROOT', './'); |
| | 17: |
| 32: if (file_exists(PUN_ROOT.'config.php')) | 18: if (file_exists(PUN_ROOT.'config.php')) |
| 33: exit('The file \'config.php\' already exists which would mean that FluxBB is already installed. You should go <a href="index.php">here</a> instead.'); | 19: { |
| | 20: // Check to see whether FluxBB is already installed |
| | 21: include PUN_ROOT.'config.php'; |
| | 22: |
| | 23: // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message |
| | 24: if (defined('FORUM')) |
| | 25: define('PUN', FORUM); |
| | 26: |
| | 27: // If PUN is defined, config.php is probably valid and thus the software is installed |
| | 28: if (defined('PUN')) |
| | 29: exit('It seems like FluxBB is already installed. You should go <a href="index.php">here</a> instead.'); |
| | 30: } |
| 34: | 31: |
| 35: | 32: |
| 36: // Make sure we are running at least PHP 4.1.0 | 33: // Make sure we are running at least PHP 4.1.0 |
| 97: if (function_exists('mysql_connect')) | 94: if (function_exists('mysql_connect')) |
| 98: { | 95: { |
| 99: $db_extensions[] = array('mysql', 'MySQL Standard'); | 96: $db_extensions[] = array('mysql', 'MySQL Standard'); |
| 100: $db_extensions[] = array('mysql_innodb', 'MySQL (InnoDB)'); | 97: $db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)'); |
| 101: $mysql_innodb = true; | 98: $mysql_innodb = true; |
| 102: | 99: |
| 103: if (count($db_extensions) > 2) | 100: if (count($db_extensions) > 2) |
| 120: <title>FluxBB Installation</title> | 117: <title>FluxBB Installation</title> |
| 121: <link rel="stylesheet" type="text/css" href="style/Oxygen.css" /> | 118: <link rel="stylesheet" type="text/css" href="style/Oxygen.css" /> |
| 122: <script type="text/javascript"> | 119: <script type="text/javascript"> |
| 123: <!-- | |
| 124: function process_form(the_form) | 120: function process_form(the_form) |
| 125: { | 121: { |
| 126: var element_names = new Object() | 122: var element_names = new Object() |
| 131: element_names["req_username"] = "Administrator username" | 127: element_names["req_username"] = "Administrator username" |
| 132: element_names["req_password1"] = "Administrator password 1" | 128: element_names["req_password1"] = "Administrator password 1" |
| 133: element_names["req_password2"] = "Administrator password 2" | 129: element_names["req_password2"] = "Administrator password 2" |
| 134: element_names["req_email"] = "Administrator's e-mail" | 130: element_names["req_email"] = "Administrator's email" |
| 135: element_names["req_base_url"] = "Base URL" | 131: element_names["req_base_url"] = "Base URL" |
| 136: | 132: |
| 137: if (document.all || document.getElementById) | 133: if (document.all || document.getElementById) |
| 153: | 149: |
| 154: return true | 150: return true |
| 155: } | 151: } |
| 156: // --> | |
| 157: </script> | 152: </script> |
| 158: </head> | 153: </head> |
| 159: <body onload="document.getElementById('install').req_db_type.focus()"> | 154: <body onload="document.getElementById('install').req_db_type.focus()"> |
| 165: <h2><span>FluxBB Installation</span></h2> | 160: <h2><span>FluxBB Installation</span></h2> |
| 166: <div class="box"> | 161: <div class="box"> |
| 167: <div class="inbox"> | 162: <div class="inbox"> |
| 168: <p>Welcome to FluxBB installation! You are about to install FluxBB. In order to install FluxBB you must complete the form set out below. If you encounter any difficulties with the installation, please refer to the documentation.</p> | 163: <p>Welcome to FluxBB installation! You are about to install FluxBB. In order to install FluxBB, you must complete the form set out below. If you encounter any difficulties with the installation, please refer to the documentation.</p> |
| 169: </div> | 164: </div> |
| 170: </div> | 165: </div> |
| 171: </div> | 166: </div> |
| 210: </div> | 205: </div> |
| 211: <div class="inform"> | 206: <div class="inform"> |
| 212: <fieldset> | 207: <fieldset> |
| 213: <legend>Enter then name of your database</legend> | 208: <legend>Enter the name of your database</legend> |
| 214: <div class="infldset"> | 209: <div class="infldset"> |
| 215: <p>The name of the database that FluxBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If the SQLite database file does not exist, FluxBB will attempt to create it.</p> | 210: <p>The name of the database that FluxBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If the SQLite database file does not exist, FluxBB will attempt to create it.</p> |
| 216: <label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label> | 211: <label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label> |
| 232: <fieldset> | 227: <fieldset> |
| 233: <legend>Enter database table prefix</legend> | 228: <legend>Enter database table prefix</legend> |
| 234: <div class="infldset"> | 229: <div class="infldset"> |
| 235: <p>If you like you can specify a table prefix. This way you can run multiple copies of FluxBB in the same database (example: foo_).</p> | 230: <p>If you like, you can specify a table prefix. This way you can run multiple copies of FluxBB in the same database (example: foo_).</p> |
| 236: <label>Table prefix<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label> | 231: <label>Table prefix<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label> |
| 237: </div> | 232: </div> |
| 238: </fieldset> | 233: </fieldset> |
| 243: <p>Please enter the requested information in order to setup an administrator for your FluxBB installation</p> | 238: <p>Please enter the requested information in order to setup an administrator for your FluxBB installation</p> |
| 244: </div> | 239: </div> |
| 245: <fieldset> | 240: <fieldset> |
| 246: <legend>Enter Administrators username</legend> | 241: <legend>Enter Administrator's username</legend> |
| 247: <div class="infldset"> | 242: <div class="infldset"> |
| 248: <p>The username of the forum administrator. You can later create more administrators and moderators. Usernames can be between 2 and 25 characters long.</p> | 243: <p>The username of the forum administrator. You can later create more administrators and moderators. Usernames can be between 2 and 25 characters long.</p> |
| 249: <label><strong>Administrator username</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label> | 244: <label><strong>Administrator's username</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label> |
| 250: </div> | 245: </div> |
| 251: </fieldset> | 246: </fieldset> |
| 252: </div> | 247: </div> |
| 253: <div class="inform"> | 248: <div class="inform"> |
| 254: <fieldset> | 249: <fieldset> |
| 255: <legend>Enter and confirm Administrator password</legend> | 250: <legend>Enter and confirm Administrator's password</legend> |
| 256: <div class="infldset"> | 251: <div class="infldset"> |
| 257: <p>Passwords can be between 4 and 16 characters long. Passwords are case sensitive.</p> | 252: <p>Passwords can be between 4 and 16 characters long. Passwords are case sensitive.</p> |
| 258: <label class="conl"><strong>Password</strong><br /><input id="req_password1" type="password" name="req_password1" size="16" maxlength="16" /><br /></label> | 253: <label class="conl"><strong>Password</strong><br /><input id="req_password1" type="password" name="req_password1" size="16" maxlength="16" /><br /></label> |
| 263: </div> | 258: </div> |
| 264: <div class="inform"> | 259: <div class="inform"> |
| 265: <fieldset> | 260: <fieldset> |
| 266: <legend>Enter Administrator's e-mail</legend> | 261: <legend>Enter Administrator's email</legend> |
| 267: <div class="infldset"> | 262: <div class="infldset"> |
| 268: <p>The e-mail address of the forum administrator.</p> | 263: <p>The email address of the forum administrator.</p> |
| 269: <label for="req_email"><strong>Administrator's e-mail</strong><br /><input id="req_email" type="text" name="req_email" size="50" maxlength="50" /><br /></label> | 264: <label for="req_email"><strong>Administrator's email</strong><br /><input id="req_email" type="text" name="req_email" size="50" maxlength="50" /><br /></label> |
| 270: </div> | 265: </div> |
| 271: </fieldset> | 266: </fieldset> |
| 272: </div> | 267: </div> |
| 274: <fieldset> | 269: <fieldset> |
| 275: <legend>Enter the Base URL of your FluxBB installation</legend> | 270: <legend>Enter the Base URL of your FluxBB installation</legend> |
| 276: <div class="infldset"> | 271: <div class="infldset"> |
| 277: <p>The URL (without trailing slash) of your FluxBB forum (example: http://forum.myhost.com or http://myhost.com/~myuser). This <strong>must</strong> be correct or administrators and moderators will not be able to submit any forms. Please note that the preset value below is just an educated guess by FluxBB.</p> | 272: <p>The URL (without trailing slash) of your FluxBB forum (example: http://forum.myhost.com or http://myhost.com/~myuser). This <strong>must</strong> be correct, otherwise, administrators and moderators will not be able to submit any forms. Please note that the preset value below is just an educated guess by FluxBB.</p> |
| 278: <label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label> | 273: <label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label> |
| 279: </div> | 274: </div> |
| 280: </fieldset> | 275: </fieldset> |
| 281: </div> | 276: </div> |
| 282: <p><input type="submit" name="start" value="Start install" /></p> | 277: <p class="buttons"><input type="submit" name="start" value="Start install" /></p> |
| 283: </form> | 278: </form> |
| 284: </div> | 279: </div> |
| 285: </div> | 280: </div> |
| 295: else | 290: else |
| 296: { | 291: { |
| 297: // | 292: // |
| 298: // Strip slashes only if magic_quotes_gpc is on. | 293: // Strip slashes only if magic_quotes_gpc is on |
| 299: // | 294: // |
| 300: function unescape($str) | 295: function unescape($str) |
| 301: { | 296: { |
| 336: error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.'); | 331: error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.'); |
| 337: | 332: |
| 338: if (strlen($email) > 80 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email)) | 333: if (strlen($email) > 80 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email)) |
| 339: error('The administrator e-mail address you entered is invalid. Please go back and correct.'); | 334: error('The administrator email address you entered is invalid. Please go back and correct.'); |
| 340: | 335: |
| 341: | 336: |
| 342: // Load the appropriate DB layer class | 337: // Load the appropriate DB layer class |
| 402: error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that FluxBB is already installed or that another piece of software is installed and is occupying one or more of the table names FluxBB requires. If you want to install multiple copies of FluxBB in the same database, you must choose a different table prefix.'); | 397: error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that FluxBB is already installed or that another piece of software is installed and is occupying one or more of the table names FluxBB requires. If you want to install multiple copies of FluxBB in the same database, you must choose a different table prefix.'); |
| 403: | 398: |
| 404: // Check if InnoDB is available | 399: // Check if InnoDB is available |
| 405: if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') | 400: if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
| 406: { | 401: { |
| 407: $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\''); | 402: $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\''); |
| 408: list (, $result) = $db->fetch_row($result); | 403: list (, $result) = $db->fetch_row($result); |
| 409: if ((strtoupper($result) != 'YES')) | 404: if ((strtoupper($result) != 'YES')) |
| 410: error('InnoDB does not seem to be enabled. Please choose a database layer that does not have InnoDB support, or enable InnoDB on your MySQL server.'); | 405: error('InnoDB does not seem to be enabled. Please choose a database layer that does not have InnoDB support, or enable InnoDB on your MySQL server.'); |
| 411: } | 406: } |
| 412: | 407: |
| 413: | 408: |
| 414: // Start a transaction | 409: // Start a transaction |
| 1237: 'default' => '0' | 1232: 'default' => '0' |
| 1238: ), | 1233: ), |
| 1239: 'time_format' => array( | 1234: 'time_format' => array( |
| 1240: 'datatype' => 'INT(10) UNSIGNED', | 1235: 'datatype' => 'TINYINT(1)', |
| 1241: 'allow_null' => false, | 1236: 'allow_null' => false, |
| 1242: 'default' => '0' | 1237: 'default' => '0' |
| 1243: ), | 1238: ), |
| 1244: 'date_format' => array( | 1239: 'date_format' => array( |
| 1245: 'datatype' => 'INT(10) UNSIGNED', | 1240: 'datatype' => 'TINYINT(1)', |
| 1246: 'allow_null' => false, | 1241: 'allow_null' => false, |
| 1247: 'default' => '0' | 1242: 'default' => '0' |
| 1248: ), | 1243: ), |
| 1340: 'o_cur_version' => "'".FORUM_VERSION."'", | 1335: 'o_cur_version' => "'".FORUM_VERSION."'", |
| 1341: 'o_database_revision' => "'".FORUM_DB_REVISION."'", | 1336: 'o_database_revision' => "'".FORUM_DB_REVISION."'", |
| 1342: 'o_board_title' => "'My FluxBB forum'", | 1337: 'o_board_title' => "'My FluxBB forum'", |
| 1343: 'o_board_desc' => "'Unfortunately no one can be told what FluxBB is - you have to see it for yourself.'", | 1338: 'o_board_desc' => "'<p><span>Unfortunately no one can be told what FluxBB is - you have to see it for yourself.</span></p>'", |
| 1344: 'o_default_timezone' => "'0'", | 1339: 'o_default_timezone' => "'0'", |
| 1345: 'o_time_format' => "'H:i:s'", | 1340: 'o_time_format' => "'H:i:s'", |
| 1346: 'o_date_format' => "'Y-m-d'", | 1341: 'o_date_format' => "'Y-m-d'", |
| 1457: // Add some random bytes at the end of the cookie name to prevent collisions | 1452: // Add some random bytes at the end of the cookie name to prevent collisions |
| 1458: $cookie_name = 'pun_cookie_'.random_key(6, false, true); | 1453: $cookie_name = 'pun_cookie_'.random_key(6, false, true); |
| 1459: | 1454: |
| 1460: /// Generate the config.php file data | 1455: // Generate the config.php file data |
| 1461: $config = generate_config_file(); | 1456: $config = generate_config_file(); |
| 1462: | 1457: |
| 1463: // Attempt to write config.php and serve it up for download if writing fails | 1458: // Attempt to write config.php and serve it up for download if writing fails |
| a/upload/lang/English/common.php |
b/upload/lang/English/common.php |
| 28: $lang_common = array( | 28: $lang_common = array( |
| 29: | 29: |
| 30: // Text orientation and encoding | 30: // Text orientation and encoding |
| 31: 'lang_direction' => 'ltr', // ltr (Left-To-Right) or rtl (Right-To-Left) | 31: 'lang_direction' => 'ltr', // ltr (Left-To-Right) or rtl (Right-To-Left) |
| | 32: 'lang_identifier' => 'en', |
| 32: | 33: |
| 33: // Number formatting | 34: // Number formatting |
| 34: 'lang_decimal_point' => '.', | 35: 'lang_decimal_point' => '.', |
| 35: 'lang_thousands_sep' => ',', | 36: 'lang_thousands_sep' => ',', |
| 36: | 37: |
| 37: // Notices | 38: // Notices |
| 38: 'Bad request' => 'Bad request. The link you followed is incorrect or outdated.', | 39: 'Bad request' => 'Bad request. The link you followed is incorrect or outdated.', |
| 39: 'No view' => 'You do not have permission to view these forums.', | 40: 'No view' => 'You do not have permission to view these forums.', |
| 40: 'No permission' => 'You do not have permission to access this page.', | 41: 'No permission' => 'You do not have permission to access this page.', |
| 41: 'Bad referrer' => 'Bad HTTP_REFERER. You were referred to this page from an unauthorized source. If the problem persists please make sure that \'Base URL\' is correctly set in Admin/Options and that you are visiting the forum by navigating to that URL. More information regarding the referrer check can be found in the FluxBB documentation.', | 42: 'Bad referrer' => 'Bad HTTP_REFERER. You were referred to this page from an unauthorized source. If the problem persists please make sure that \'Base URL\' is correctly set in Admin/Options and that you are visiting the forum by navigating to that URL. More information regarding the referrer check can be found in the FluxBB documentation.', |
| | 43: 'No cookie' => 'You appear to have logged in successfully, however a cookie has not been set. Please check your settings and if applicable, enable cookies for this website.', |
| 42: | 44: |
| 43: // Topic/forum indicators | 45: // Topic/forum indicators |
| 44: 'New icon' => 'There are new posts', | 46: 'New icon' => 'There are new posts', |
| 45: 'Normal icon' => '<!-- -->', | 47: 'Normal icon' => '<!-- -->', |
| 46: 'Closed icon' => 'This topic is closed', | 48: 'Closed icon' => 'This topic is closed', |
| 47: 'Redirect icon' => 'Redirected forum', | 49: 'Redirect icon' => 'Redirected forum', |
| 48: | 50: |
| 49: // Miscellaneous | 51: // Miscellaneous |
| 50: 'Announcement' => 'Announcement', | 52: 'Announcement' => 'Announcement', |
| 51: 'Options' => 'Options', | 53: 'Options' => 'Options', |
| 52: 'Actions' => 'Actions', | 54: 'Submit' => 'Submit', // "Name" of submit buttons |
| 53: 'Submit' => 'Submit', // "Name" of submit buttons | 55: 'Ban message' => 'You are banned from this forum.', |
| 54: 'Ban message' => 'You are banned from this forum.', | 56: 'Ban message 2' => 'The ban expires at the end of', |
| 55: 'Ban message 2' => 'The ban expires at the end of', | 57: 'Ban message 3' => 'The administrator or moderator that banned you left the following message:', |
| 56: 'Ban message 3' => 'The administrator or moderator that banned you left the following message:', | 58: 'Ban message 4' => 'Please direct any inquiries to the forum administrator at', |
| 57: 'Ban message 4' => 'Please direct any inquiries to the forum administrator at', | 59: 'Never' => 'Never', |
| 58: 'Never' => 'Never', | 60: 'Today' => 'Today', |
| 59: 'Today' => 'Today', | 61: 'Yesterday' => 'Yesterday', |
| 60: 'Yesterday' => 'Yesterday', | 62: 'Info' => 'Info', // A common table header |
| 61: 'Info' => 'Info', // A common table header | 63: 'Go back' => 'Go back', |
| 62: 'Go back' => 'Go back', | 64: 'Maintenance' => 'Maintenance', |
| 63: 'Maintenance' => 'Maintenance', | 65: 'Redirecting' => 'Redirecting', |
| 64: 'Redirecting' => 'Redirecting', | 66: 'Click redirect' => 'Click here if you do not want to wait any longer (or if your browser does not automatically forward you)', |
| 65: 'Click redirect' => 'Click here if you do not want to wait any longer (or if your browser does not automatically forward you)', | 67: 'on' => 'on', // As in "BBCode is on" |
| 66: 'on' => 'on', // As in "BBCode is on" | 68: 'off' => 'off', |
| 67: 'off' => 'off', | 69: 'Invalid email' => 'The email address you entered is invalid.', |
| 68: 'Invalid e-mail' => 'The e-mail address you entered is invalid.', | 70: 'required field' => 'is a required field in this form.', // For javascript form validation |
| 69: 'required field' => 'is a required field in this form.', // For javascript form validation | 71: 'Last post' => 'Last post', |
| 70: 'Last post' => 'Last post', | 72: 'by' => 'by', // As in last post by someuser |
| 71: 'by' => 'by', // As in last post by someuser | 73: 'New posts' => 'New posts', // The link that leads to the first new post (use for spaces) |
| 72: 'New posts' => 'New posts', // The link that leads to the first new post (use for spaces) | 74: 'New posts info' => 'Go to the first new post in this topic.', // The popup text for new posts links |
| 73: 'New posts info' => 'Go to the first new post in this topic.', // The popup text for new posts links | 75: 'Username' => 'Username', |
| 74: 'Username' => 'Username', | 76: 'Password' => 'Password', |
| 75: 'Password' => 'Password', | 77: 'Email' => 'Email', |
| 76: 'E-mail' => 'E-mail', | 78: 'Send email' => 'Send email', |
| 77: 'Send e-mail' => 'Send e-mail', | 79: 'Moderated by' => 'Moderated by', |
| 78: 'Moderated by' => 'Moderated by', | 80: 'Registered' => 'Registered', |
| 79: 'Registered' => 'Registered', | 81: 'Subject' => 'Subject', |
| 80: 'Subject' => 'Subject', | 82: 'Message' => 'Message', |
| 81: 'Message' => 'Message', | 83: 'Topic' => 'Topic', |
| 82: 'Topic' => 'Topic', | 84: 'Forum' => 'Forum', |
| 83: 'Forum' => 'Forum', | 85: 'Posts' => 'Posts', |
| 84: 'Posts' => 'Posts', | 86: 'Replies' => 'Replies', |
| 85: 'Replies' => 'Replies', | 87: 'Author' => 'Author', |
| 86: 'Author' => 'Author', | 88: 'Pages' => 'Pages', |
| 87: 'Pages' => 'Pages', | 89: 'Page' => 'Page %s', |
| 88: 'BBCode' => 'BBCode', // You probably shouldn't change this | 90: 'BBCode' => 'BBCode', // You probably shouldn't change this |
| 89: 'img tag' => '[img] tag', | 91: 'img tag' => '[img] tag', |
| 90: 'Smilies' => 'Smilies', | 92: 'Smilies' => 'Smilies', |
| 91: 'and' => 'and', | 93: 'and' => 'and', |
| 92: 'Image link' => 'image', // This is displayed (i.e. <image>) instead of images when "Show images" is disabled in the profile | 94: 'Image link' => 'image', // This is displayed (i.e. <image>) instead of images when "Show images" is disabled in the profile |
| 93: 'wrote' => 'wrote', // For [quote]'s | 95: 'wrote' => 'wrote', // For [quote]'s |
| 94: 'Code' => 'Code', // For [code]'s | 96: 'Code' => 'Code', // For [code]'s |
| 95: 'Mailer' => 'Mailer', // As in "MyForums Mailer" in the signature of outgoing e-mails | 97: 'Mailer' => 'Mailer', // As in "MyForums Mailer" in the signature of outgoing emails |
| 96: 'Important information' => 'Important information', | 98: 'Important information' => 'Important information', |
| 97: 'Write message legend' => 'Write your message and submit', | 99: 'Write message legend' => 'Write your message and submit', |
| 98: 'Previous' => 'Previous', | 100: 'Previous' => 'Previous', |
| 99: 'Next' => 'Next', | 101: 'Next' => 'Next', |
| 100: 'Spacer' => '…', // Ellipsis for paginate | 102: 'Spacer' => '…', // Ellipsis for paginate |
| 101: | 103: |
| 102: // Title | 104: // Title |
| 103: 'Title' => 'Title', | 105: 'Title' => 'Title', |
| 104: 'Member' => 'Member', // Default title | 106: 'Member' => 'Member', // Default title |
| 105: 'Moderator' => 'Moderator', | 107: 'Moderator' => 'Moderator', |
| 106: 'Administrator' => 'Administrator', | 108: 'Administrator' => 'Administrator', |
| 107: 'Banned' => 'Banned', | 109: 'Banned' => 'Banned', |
| 108: 'Guest' => 'Guest', | 110: 'Guest' => 'Guest', |
| 109: | 111: |
| 110: // Stuff for include/parser.php | 112: // Stuff for include/parser.php |
| 111: 'BBCode error 1' => '[/%1$s] was found without a matching [%1$s]', | 113: 'BBCode error no opening tag' => '[/%1$s] was found without a matching [%1$s]', |
| 112: 'BBCode error 2' => '[%s] tag is empty', | 114: 'BBCode error invalid nesting' => '[%1$s] was opened within [%2$s], this is not allowed', |
| 113: 'BBCode error 3' => '[%1$s] was opened within [%2$s], this is not allowed', | 115: 'BBCode error invalid self-nesting' => '[%s] was opened within itself, this is not allowed', |
| 114: 'BBCode error 4' => '[%s] was opened within itself, this is not allowed', | 116: 'BBCode error no closing tag' => '[%1$s] was found without a matching [/%1$s]', |
| 115: 'BBCode error 5' => '[%1$s] was found without a matching [/%1$s]', | 117: 'BBCode error empty attribute' => '[%s] tag had an empty attribute section', |
| 116: 'BBCode error 6' => '[%s] tag had an empty attribute section', | 118: 'BBCode code problem' => 'There is a problem with your [code] tags', |
| 117: 'BBCode nested list' => '[list] tags cannot be nested', | |
| 118: 'BBCode code problem' => 'There is a problem with your [code] tags', | |
| 119: | 119: |
| 120: // Stuff for the navigator (top of every page) | 120: // Stuff for the navigator (top of every page) |
| 121: 'Index' => 'Index', | 121: 'Index' => 'Index', |
| 122: 'User list' => 'User list', | 122: 'User list' => 'User list', |
| 123: 'Rules' => 'Rules', | 123: 'Rules' => 'Rules', |
| 124: 'Search' => 'Search', | 124: 'Search' => 'Search', |
| 125: 'Register' => 'Register', | 125: 'Register' => 'Register', |
| 126: 'Login' => 'Login', | 126: 'Login' => 'Login', |
| 127: 'Not logged in' => 'You are not logged in.', | 127: 'Not logged in' => 'You are not logged in.', |
| 128: 'Profile' => 'Profile', | 128: 'Profile' => 'Profile', |
| 129: 'Logout' => 'Logout', | 129: 'Logout' => 'Logout', |
| 130: 'Logged in as' => 'Logged in as', | 130: 'Logged in as' => 'Logged in as', |
| 131: 'Admin' => 'Administration', | 131: 'Admin' => 'Administration', |
| 132: 'Last visit' => 'Last visit', | 132: 'Last visit' => 'Last visit', |
| 133: 'Show new posts' => 'Show new posts since last visit', | 133: 'Show new posts' => 'Show new posts since last visit', |
| 134: 'Mark all as read' => 'Mark all topics as read', | 134: 'Mark all as read' => 'Mark all topics as read', |
| 135: 'Mark forum read' => 'Mark this forum as read', | 135: 'Mark forum read' => 'Mark this forum as read', |
| 136: 'Link separator' => '', // The text that separates links in the navigator | 136: 'Menu link separator' => '', // The text that separates links in the navigator |
| | 137: 'Link separator' => ' | ', // The text that separates links in posts |
| 137: | 138: |
| 138: // Stuff for the page footer | 139: // Stuff for the page footer |
| 139: 'Board footer' => 'Board footer', | 140: 'Board footer' => 'Board footer', |
| 140: 'Search links' => 'Search links', | 141: 'Search links' => 'Search links', |
| 141: 'Show recent posts' => 'Show recent posts', | 142: 'Show recent posts' => 'Show recent posts', |
| 142: 'Show unanswered posts' => 'Show unanswered posts', | 143: 'Show unanswered posts' => 'Show unanswered posts', |
| 143: 'Show your posts' => 'Show your posts', | 144: 'Show your posts' => 'Show your posts', |
| 144: 'Show subscriptions' => 'Show your subscribed topics', | 145: 'Show subscriptions' => 'Show your subscribed topics', |
| 145: 'Jump to' => 'Jump to', | 146: 'Jump to' => 'Jump to', |
| 146: 'Go' => ' Go ', // Submit button in forum jump | 147: 'Go' => ' Go ', // Submit button in forum jump |
| 147: 'Moderate topic' => 'Moderate topic', | 148: 'Moderate topic' => 'Moderate topic', |
| 148: 'Move topic' => 'Move topic', | 149: 'Move topic' => 'Move topic', |
| 149: 'Open topic' => 'Open topic', | 150: 'Open topic' => 'Open topic', |
| 150: 'Close topic' => 'Close topic', | 151: 'Close topic' => 'Close topic', |
| 151: 'Unstick topic' => 'Unstick topic', | 152: 'Unstick topic' => 'Unstick topic', |
| 152: 'Stick topic' => 'Stick topic', | 153: 'Stick topic' => 'Stick topic', |
| 153: 'Moderate forum' => 'Moderate forum', | 154: 'Moderate forum' => 'Moderate forum', |
| 154: 'Delete posts' => 'Delete multiple posts', // Deprecated | 155: 'Delete posts' => 'Delete multiple posts', // Deprecated |
| 155: 'Powered by' => 'Powered by %s', | 156: 'Powered by' => 'Powered by %s', |
| 156: | 157: |
| 157: // Debug information | 158: // Debug information |
| 158: 'Debug table' => 'Debug information', | 159: 'Debug table' => 'Debug information', |
| 159: 'Querytime' => 'Generated in %1$s seconds, %2$s queries executed', | 160: 'Querytime' => 'Generated in %1$s seconds, %2$s queries executed', |
| 160: 'Query times' => 'Time (s)', | 161: 'Query times' => 'Time (s)', |
| 161: 'Query' => 'Query', | 162: 'Query' => 'Query', |
| 162: 'Total query time' => 'Total query time: %s', | 163: 'Total query time' => 'Total query time: %s', |
| 163: | 164: |
| 164: // Email related notifications | 165: // Email related notifications |
| 165: 'New user notification' => 'Alert - New registration', | 166: 'New user notification' => 'Alert - New registration', |
| 166: 'New user message' => 'User \'%s\' registered in the forums at %s', | 167: 'New user message' => 'User \'%s\' registered in the forums at %s', |
| 167: 'Banned email notification' => 'Alert - Banned e-mail detected', | 168: 'Banned email notification' => 'Alert - Banned email detected', |
| 168: 'Banned email register message' => 'User \'%s\' registered with banned e-mail address: %s', | 169: 'Banned email register message' => 'User \'%s\' registered with banned email address: %s', |
| 169: 'Banned email change message' => 'User \'%s\' changed to banned e-mail address: %s', | 170: 'Banned email change message' => 'User \'%s\' changed to banned email address: %s', |
| 170: 'Duplicate email notification' => 'Alert - Duplicate e-mail detected', | 171: 'Banned email post message' => 'User \'%s\' posted with banned email address: %s', |
| 171: 'Duplicate email register message' => 'User \'%s\' registered with an e-mail address that also belongs to: %s', | 172: 'Duplicate email notification' => 'Alert - Duplicate email detected', |
| 172: 'Duplicate email change message' => 'User \'%s\' changed to an e-mail address that also belongs to: %s', | 173: 'Duplicate email register message' => 'User \'%s\' registered with an email address that also belongs to: %s', |
| 173: 'Report notification' => 'Report(%d) - \'%s\'', | 174: 'Duplicate email change message' => 'User \'%s\' changed to an email address that also belongs to: %s', |
| 174: 'Report message 1' => 'User \'%s\' has reported the following message: %s', | 175: 'Report notification' => 'Report(%d) - \'%s\'', |
| 175: 'Report message 2' => 'Reason: %s', | 176: 'Report message 1' => 'User \'%s\' has reported the following message: %s', |
| 176: | 177: 'Report message 2' => 'Reason: %s', |
| 177: 'User profile' => 'User profile: %s', | 178: |
| 178: 'Email signature' => 'Forum Mailer'."\n".'(Do not reply to this message)', | 179: 'User profile' => 'User profile: %s', |
| | 180: 'Post URL' => 'Post URL: %s', |
| | 181: 'Email signature' => 'Forum Mailer'."\n".'(Do not reply to this message)', |
| 179: | 182: |
| 180: // For extern.php RSS feed | 183: // For extern.php RSS feed |
| 181: 'RSS description' => 'The most recent topics at %s.', | 184: 'RSS description' => 'The most recent topics at %s.', |
| 182: 'RSS description topic' => 'The most recent posts in %s.', | 185: 'RSS description topic' => 'The most recent posts in %s.', |
| 183: 'RSS reply' => 'Re: ' // The topic subject will be appended to this string (to signify a reply) | 186: 'RSS reply' => 'Re: ' // The topic subject will be appended to this string (to signify a reply) |
| 184: | 187: |
| 185: ); | 188: ); |
| a/upload/lang/English/misc.php |
b/upload/lang/English/misc.php |
| 3: // Language definitions used in various scripts | 3: // Language definitions used in various scripts |
| 4: $lang_misc = array( | 4: $lang_misc = array( |
| 5: | 5: |
| 6: 'Mark read redirect' => 'All topics and forums have been marked as read. Redirecting …', | 6: 'Mark read redirect' => 'All topics and forums have been marked as read. Redirecting …', |
| 7: 'Mark forum read redirect' => 'All topics in the specified forum have been marked as read. Redirecting …', | 7: 'Mark forum read redirect' => 'All topics in the specified forum have been marked as read. Redirecting …', |
| 8: | 8: |
| 9: // Send e-mail | 9: // Send email |
| 10: 'Form e-mail disabled' => 'The user you are trying to send an e-mail to has disabled form e-mail.', | 10: 'Form email disabled' => 'The user you are trying to send an email to has disabled form email.', |
| 11: 'No e-mail subject' => 'You must enter a subject.', | 11: 'No email subject' => 'You must enter a subject.', |
| 12: 'No e-mail message' => 'You must enter a message.', | 12: 'No email message' => 'You must enter a message.', |
| 13: 'Too long e-mail message' => 'Messages cannot be longer than 65535 characters (64 KB).', | 13: 'Too long email message' => 'Messages cannot be longer than 65535 characters (64 KB).', |
| 14: 'Email flood' => 'At least %s seconds have to pass between sent emails. Please wait a while and try sending again.', | 14: 'Email flood' => 'At least %s seconds have to pass between sent emails. Please wait a while and try sending again.', |
| 15: 'E-mail sent redirect' => 'E-mail sent. Redirecting …', | 15: 'Email sent redirect' => 'Email sent. Redirecting …', |
| 16: 'Send e-mail to' => 'Send e-mail to', | 16: 'Send email to' => 'Send email to', |
| 17: 'E-mail subject' => 'Subject', | 17: 'Email subject' => 'Subject', |
| 18: 'E-mail message' => 'Message', | 18: 'Email message' => 'Message', |
| 19: 'E-mail disclosure note' => 'Please note that by using this form, your e-mail address will be disclosed to the recipient.', | 19: 'Email disclosure note' => 'Please note that by using this form, your email address will be disclosed to the recipient.', |
| 20: 'Write e-mail' => 'Write and submit your e-mail message', | 20: 'Write email' => 'Write and submit your email message', |
| 21: | 21: |
| 22: // Report | 22: // Report |
| 23: 'No reason' => 'You must enter a reason.', | 23: 'No reason' => 'You must enter a reason.', |
| 24: 'Report flood' => 'At least %s seconds have to pass between reports. Please wait a while and try sending again.', | 24: 'Report flood' => 'At least %s seconds have to pass between reports. Please wait a while and try sending again.', |
| 25: 'Report redirect' => 'Post reported. Redirecting …', | 25: 'Report redirect' => 'Post reported. Redirecting …', |
| 26: 'Report post' => 'Report post', | 26: 'Report post' => 'Report post', |
| 27: 'Reason' => 'Reason', | 27: 'Reason' => 'Reason', |
| 28: 'Reason desc' => 'Please enter a short reason why you are reporting this post', | 28: 'Reason desc' => 'Please enter a short reason why you are reporting this post', |
| 29: | 29: |
| 30: // Subscriptions | 30: // Subscriptions |
| 31: 'Already subscribed' => 'You are already subscribed to this topic.', | 31: 'Already subscribed' => 'You are already subscribed to this topic.', |
| 32: 'Subscribe redirect' => 'Your subscription has been added. Redirecting …', | 32: 'Subscribe redirect' => 'Your subscription has been added. Redirecting …', |
| 33: 'Not subscribed' => 'You are not subscribed to this topic.', | 33: 'Not subscribed' => 'You are not subscribed to this topic.', |
| 34: 'Unsubscribe redirect' => 'Your subscription has been removed. Redirecting …', | 34: 'Unsubscribe redirect' => 'Your subscription has been removed. Redirecting …', |
| 35: | 35: |
| 36: // General forum and topic moderation | 36: // General forum and topic moderation |
| 37: 'Moderate' => 'Moderate', | 37: 'Moderate' => 'Moderate', |
| 38: 'Select' => 'Select', // the header of a column of checkboxes | 38: 'Select' => 'Select', // the header of a column of checkboxes |
| 39: 'Move' => 'Move', | 39: 'Move' => 'Move', |
| 40: 'Split' => 'Split', | 40: 'Split' => 'Split', |
| 41: 'Delete' => 'Delete', | 41: 'Delete' => 'Delete', |
| 42: 'Merge' => 'Merge', | 42: 'Merge' => 'Merge', |
| 43: | 43: |
| 44: // Moderate forum | 44: // Moderate forum |
| 45: 'Open' => 'Open', | 45: 'Open' => 'Open', |
| 46: 'Close' => 'Close', | 46: 'Close' => 'Close', |
| 47: 'Move topic' => 'Move topic', | 47: 'Move topic' => 'Move topic', |
| 48: 'Move topics' => 'Move topics', | 48: 'Move topics' => 'Move topics', |
| 49: 'Move legend' => 'Select destination of move', | 49: 'Move legend' => 'Select destination of move', |
| 50: 'Move to' => 'Move to', | 50: 'Move to' => 'Move to', |
| 51: 'Leave redirect' => 'Leave redirect topic(s)', | 51: 'Nowhere to move' => 'There are no forums into which you can move topics.', |
| 52: 'Move topic redirect' => 'Topic moved. Redirecting …', | 52: 'Leave redirect' => 'Leave redirect topic(s)', |
| 53: 'Move topics redirect' => 'Topics moved. Redirecting …', | 53: 'Move topic redirect' => 'Topic moved. Redirecting …', |
| 54: 'Confirm delete legend' => 'Please confirm deletion', | 54: 'Move topics redirect' => 'Topics moved. Redirecting …', |
| 55: 'Delete topics' => 'Delete topics', | 55: 'Confirm delete legend' => 'Please confirm deletion', |
| 56: 'Delete topics comply' => 'Are you sure you want to delete the selected topics?', | 56: 'Delete topics' => 'Delete topics', |
| 57: 'Delete topics redirect' => 'Topics deleted. Redirecting …', | 57: 'Delete topics comply' => 'Are you sure you want to delete the selected topics?', |
| 58: 'Open topic redirect' => 'Topic opened. Redirecting …', | 58: 'Delete topics redirect' => 'Topics deleted. Redirecting …', |
| 59: 'Open topics redirect' => 'Topics opened. Redirecting …', | 59: 'Open topic redirect' => 'Topic opened. Redirecting …', |
| 60: 'Close topic redirect' => 'Topic closed. Redirecting …', | 60: 'Open topics redirect' => 'Topics opened. Redirecting …', |
| 61: 'Close topics redirect' => 'Topics closed. Redirecting …', | 61: 'Close topic redirect' => 'Topic closed. Redirecting …', |
| 62: 'No topics selected' => 'You must select at least one topic for move/delete/open/close.', | 62: 'Close topics redirect' => 'Topics closed. Redirecting …', |
| | 63: 'No topics selected' => 'You must select at least one topic for move/delete/open/close.', |
| 63: 'Not enough topics selected' => 'You must select at least two topics for merge.', | 64: 'Not enough topics selected' => 'You must select at least two topics for merge.', |
| 64: 'Stick topic redirect' => 'Topic sticked. Redirecting …', | 65: 'Stick topic redirect' => 'Topic sticked. Redirecting …', |
| 65: 'Unstick topic redirect' => 'Topic unsticked. Redirecting …', | 66: 'Unstick topic redirect' => 'Topic unsticked. Redirecting …', |
| 66: 'Merge topics' => 'Merge topics', | 67: 'Merge topics' => 'Merge topics', |
| 67: 'Merge topics redirect' => 'Topics merged. Redirecting …', | 68: 'Merge topics redirect' => 'Topics merged. Redirecting …', |
| 68: 'Confirm merge legend' => 'Please confirm merge', | 69: 'Confirm merge legend' => 'Please confirm merge', |
| 69: 'New subject' => 'New subject', | 70: 'New subject' => 'New subject', |
| 70: | 71: |
| 71: // Split multiple posts in topic | 72: // Split multiple posts in topic |
| 72: 'Confirm split legend' => 'Please confirm split of selected posts.', | 73: 'Confirm split legend' => 'Please confirm split of selected posts.', |
| 73: 'Split posts' => 'Split posts', | 74: 'Split posts' => 'Split posts', |
| 74: 'Split posts comply' => 'Are you sure you want to split the selected posts?', | 75: 'Split posts comply' => 'Are you sure you want to split the selected posts?', |
| 75: 'Split posts redirect' => 'Posts have been split. Redirecting …', | 76: 'Split posts redirect' => 'Posts have been split. Redirecting …', |
| 76: | 77: |
| 77: // Delete multiple posts in topic | 78: // Delete multiple posts in topic |
| 78: 'Delete posts' => 'Delete posts', | 79: 'Delete posts' => 'Delete posts', |
| 79: 'Delete posts comply' => 'Are you sure you want to delete the selected posts?', | 80: 'Cannot delete first' => 'First post cannot be selected for deletion.', |
| 80: 'Delete posts redirect' => 'Posts deleted. Redirecting …', | 81: 'Delete posts comply' => 'Are you sure you want to delete the selected posts?', |
| 81: 'No posts selected' => 'You must select at least one post to be deleted.' | 82: 'Delete posts redirect' => 'Posts deleted. Redirecting …', |
| | 83: 'No posts selected' => 'You must select at least one post to be deleted.' |
| 82: | 84: |
| 83: ); | 85: ); |
| a/upload/lang/English/profile.php |
b/upload/lang/English/profile.php |
| 4: $lang_profile = array( | 4: $lang_profile = array( |
| 5: | 5: |
| 6: // Navigation and sections | 6: // Navigation and sections |
| 7: 'Profile menu' => 'Profile menu', | 7: 'Profile menu' => 'Profile menu', |
| 8: 'Section essentials' => 'Essentials', | 8: 'Section essentials' => 'Essentials', |
| 9: 'Section personal' => 'Personal', | 9: 'Section personal' => 'Personal', |
| 10: 'Section messaging' => 'Messaging', | 10: 'Section messaging' => 'Messaging', |
| 11: 'Section personality' => 'Personality', | 11: 'Section personality' => 'Personality', |
| 12: 'Section display' => 'Display', | 12: 'Section display' => 'Display', |
| 13: 'Section privacy' => 'Privacy', | 13: 'Section privacy' => 'Privacy', |
| 14: 'Section admin' => 'Administration', | 14: 'Section admin' => 'Administration', |
| 15: | 15: |
| 16: // Miscellaneous | 16: // Miscellaneous |
| 17: 'Username and pass legend' => 'Enter your username and password', | 17: 'Username and pass legend' => 'Enter your username and password', |
| 18: 'Personal details legend' => 'Enter your personal details', | 18: 'Personal details legend' => 'Enter your personal details', |
| 19: 'Contact details legend' => 'Enter your messaging details', | 19: 'Contact details legend' => 'Enter your messaging details', |
| 20: 'Options display' => 'Set your display options', | 20: 'User activity' => 'User activity', |
| 21: 'Options post' => 'Set your post viewing options', | 21: 'Paginate info' => 'Enter the number of topics and posts you wish to view on each page.', |
| 22: 'User activity' => 'User activity', | |
| 23: 'Paginate info' => 'Enter the number of topics and posts you wish to view on each page.', | |
| 24: | 22: |
| 25: // Password stuff | 23: // Password stuff |
| 26: 'Pass key bad' => 'The specified password activation key was incorrect or has expired. Please re-request a new password. If that fails, contact the forum administrator at', | 24: 'Pass key bad' => 'The specified password activation key was incorrect or has expired. Please re-request a new password. If that fails, contact the forum administrator at', |
| 27: 'Pass updated' => 'Your password has been updated. You can now login with your new password.', | 25: 'Pass updated' => 'Your password has been updated. You can now login with your new password.', |
| 28: 'Pass updated redirect' => 'Password updated. Redirecting …', | 26: 'Pass updated redirect' => 'Password updated. Redirecting …', |
| 29: 'Wrong pass' => 'Wrong old password.', | 27: 'Wrong pass' => 'Wrong old password.', |
| 30: 'Change pass' => 'Change password', | 28: 'Change pass' => 'Change password', |
| 31: 'Change pass legend' => 'Enter and confirm your new password', | 29: 'Change pass legend' => 'Enter and confirm your new password', |
| 32: 'Old pass' => 'Old password', | 30: 'Old pass' => 'Old password', |
| 33: 'New pass' => 'New password', | 31: 'New pass' => 'New password', |
| 34: 'Confirm new pass' => 'Confirm new password', | 32: 'Confirm new pass' => 'Confirm new password', |
| 35: | 33: |
| 36: // E-mail stuff | 34: // Email stuff |
| 37: 'E-mail key bad' => 'The specified e-mail activation key was incorrect or has expired. Please re-request change of e-mail address. If that fails, contact the forum administrator at', | 35: 'Email key bad' => 'The specified email activation key was incorrect or has expired. Please re-request change of email address. If that fails, contact the forum administrator at', |
| 38: 'E-mail updated' => 'Your e-mail address has been updated.', | 36: 'Email updated' => 'Your email address has been updated.', |
| 39: 'Activate e-mail sent' => 'An email has been sent to the specified address with instructions on how to activate the new e-mail address. If it doesn\'t arrive you can contact the forum administrator at', | 37: 'Activate email sent' => 'An email has been sent to the specified address with instructions on how to activate the new email address. If it doesn\'t arrive you can contact the forum administrator at', |
| 40: 'E-mail legend' => 'Enter your new e-mail address', | 38: 'Email legend' => 'Enter your new email address', |
| 41: 'E-mail instructions' => 'An e-mail will be sent to your new address with an activation link. You must click the link in the e-mail you receive to activate the new address.', | 39: 'Email instructions' => 'An email will be sent to your new address with an activation link. You must click the link in the email you receive to activate the new address.', |
| 42: 'Change e-mail' => 'Change e-mail address', | 40: 'Change email' => 'Change email address', |
| 43: 'New e-mail' => 'New e-mail', | 41: 'New email' => 'New email', |
| 44: | 42: |
| 45: // Avatar upload stuff | 43: // Avatar upload stuff |
| 46: 'Avatars disabled' => 'The administrator has disabled avatar support.', | 44: 'Avatars disabled' => 'The administrator has disabled avatar support.', |
| 47: 'Too large ini' => 'The selected file was too large to upload. The server didn\'t allow the upload.', | 45: 'Too large ini' => 'The selected file was too large to upload. The server didn\'t allow the upload.', |
| 48: 'Partial upload' => 'The selected file was only partially uploaded. Please try again.', | 46: 'Partial upload' => 'The selected file was only partially uploaded. Please try again.', |
| 49: 'No tmp directory' => 'PHP was unable to save the uploaded file to a temporary location.', | 47: 'No tmp directory' => 'PHP was unable to save the uploaded file to a temporary location.', |
| 50: 'No file' => 'You did not select a file for upload.', | 48: 'No file' => 'You did not select a file for upload.', |
| 51: 'Bad type' => 'The file you tried to upload is not of an allowed type. Allowed types are gif, jpeg and png.', | 49: 'Bad type' => 'The file you tried to upload is not of an allowed type. Allowed types are gif, jpeg and png.', |
| 52: 'Too wide or high' => 'The file you tried to upload is wider and/or higher than the maximum allowed', | 50: 'Too wide or high' => 'The file you tried to upload is wider and/or higher than the maximum allowed', |
| 53: 'Too large' => 'The file you tried to upload is larger than the maximum allowed', | 51: 'Too large' => 'The file you tried to upload is larger than the maximum allowed', |
| 54: 'pixels' => 'pixels', | 52: 'pixels' => 'pixels', |
| 55: 'bytes' => 'bytes', | 53: 'bytes' => 'bytes', |
| 56: 'Move failed' => 'The server was unable to save the uploaded file. Please contact the forum administrator at', | 54: 'Move failed' => 'The server was unable to save the uploaded file. Please contact the forum administrator at', |
| 57: 'Unknown failure' => 'An unknown error occurred. Please try again.', | 55: 'Unknown failure' => 'An unknown error occurred. Please try again.', |
| 58: 'Avatar upload redirect' => 'Avatar uploaded. Redirecting …', | 56: 'Avatar upload redirect' => 'Avatar uploaded. Redirecting …', |
| 59: 'Avatar deleted redirect' => 'Avatar deleted. Redirecting …', | 57: 'Avatar deleted redirect' => 'Avatar deleted. Redirecting …', |
| 60: 'Avatar desc' => 'An avatar is a small image that will be displayed under your username in your posts. It must not be any bigger than', | 58: 'Avatar desc' => 'An avatar is a small image that will be displayed under your username in your posts. It must not be any bigger than', |
| 61: 'Upload avatar' => 'Upload avatar', | 59: 'Upload avatar' => 'Upload avatar', |
| 62: 'Upload avatar legend' => 'Enter an avatar file to upload', | 60: 'Upload avatar legend' => 'Enter an avatar file to upload', |
| 63: 'Delete avatar' => 'Delete avatar', // only for admins | 61: 'Delete avatar' => 'Delete avatar', // only for admins |
| 64: 'File' => 'File', | 62: 'File' => 'File', |
| 65: 'Upload' => 'Upload', // submit button | 63: 'Upload' => 'Upload', // submit button |
| 66: | 64: |
| 67: // Form validation stuff | 65: // Form validation stuff |
| 68: 'Dupe username' => 'Someone else has already registered with that username. Please go back and try a different username.', | 66: 'Dupe username' => 'Someone else has already registered with that username. Please go back and try a different username.', |
| 69: 'Forbidden title' => 'The title you entered contains a forbidden word. You must choose a different title.', | 67: 'Forbidden title' => 'The title you entered contains a forbidden word. You must choose a different title.', |
| 70: 'Profile redirect' => 'Profile updated. Redirecting …', | 68: 'Profile redirect' => 'Profile updated. Redirecting …', |
| 71: | 69: |
| 72: // Profile display stuff | 70: // Profile display stuff |
| 73: 'Not activated' => 'This user hasn\'t activated his/her account yet. The account is activated when he/she logs in the first time.', | 71: 'Users profile' => '%s\'s profile', |
| 74: 'Unknown' => '(Unknown)', // This is displayed when a user hasn't filled out profile field (e.g. Location) | 72: 'Unknown' => '(Unknown)', // This is displayed when a user hasn't filled out profile field (e.g. Location) |
| 75: 'Private' => '(Private)', // This is displayed when a user does not want to receive e-mails | 73: 'Private' => '(Private)', // This is displayed when a user does not want to receive emails |
| 76: 'No avatar' => '(No avatar)', | 74: 'No avatar' => '(No avatar)', |
| 77: 'Show posts' => 'Show all posts', | 75: 'Show posts' => 'Show all posts', |
| 78: 'Realname' => 'Real name', | 76: 'Realname' => 'Real name', |
| 79: 'Location' => 'Location', | 77: 'Location' => 'Location', |
| 80: 'Website' => 'Website', | 78: 'Website' => 'Website', |
| 81: 'Jabber' => 'Jabber', | 79: 'Jabber' => 'Jabber', |
| 82: 'ICQ' => 'ICQ', | 80: 'ICQ' => 'ICQ', |
| 83: 'MSN' => 'MSN Messenger', | 81: 'MSN' => 'MSN Messenger', |
| 84: 'AOL IM' => 'AOL IM', | 82: 'AOL IM' => 'AOL IM', |
| 85: 'Yahoo' => 'Yahoo! Messenger', | 83: 'Yahoo' => 'Yahoo! Messenger', |
| 86: 'Avatar' => 'Avatar', | 84: 'Avatar' => 'Avatar', |
| 87: 'Signature' => 'Signature', | 85: 'Signature' => 'Signature', |
| 88: 'Sig max length' => 'Max length', | 86: 'Sig max length' => 'Max length', |
| 89: 'Sig max lines' => 'Max lines', | 87: 'Sig max lines' => 'Max lines', |
| 90: 'Avatar legend' => 'Set your avatar display options', | 88: 'Avatar legend' => 'Set your avatar display options', |
| 91: 'Avatar info' => 'An avatar is a small image that will be displayed with all your posts. You can upload an avatar by clicking the link below.', | 89: 'Avatar info' => 'An avatar is a small image that will be displayed with all your posts. You can upload an avatar by clicking the link below.', |
| 92: 'Change avatar' => 'Change avatar', | 90: 'Change avatar' => 'Change avatar', |
| 93: 'Signature legend' => 'Compose your signature', | 91: 'Signature legend' => 'Compose your signature', |
| 94: 'Signature info' => 'A signature is a small piece of text that is attached to your posts. In it, you can enter just about anything you like. Perhaps you would like to enter your favourite quote or your star sign. It\'s up to you! In your signature you can use BBCode if it is allowed in this particular forum. You can see the features that are allowed/enabled listed below whenever you edit your signature.', | 92: 'Signature info' => 'A signature is a small piece of text that is attached to your posts. In it, you can enter just about anything you like. Perhaps you would like to enter your favourite quote or your star sign. It\'s up to you! In your signature you can use BBCode if it is allowed in this particular forum. You can see the features that are allowed/enabled listed below whenever you edit your signature.', |
| 95: 'Sig preview' => 'Current signature preview:', | 93: 'Sig preview' => 'Current signature preview:', |
| 96: 'No sig' => 'No signature currently stored in profile.', | 94: 'No sig' => 'No signature currently stored in profile.', |
| 97: 'Signature quote/code/list' => 'The quote, code and list BBCodes are not allowed in signatures.', | 95: 'Signature quote/code/list/h' => 'The quote, code, list, and heading BBCodes are not allowed in signatures.', |
| 98: 'Topics per page' => 'Topics', | 96: 'Topics per page' => 'Topics', |
| 99: 'Topics per page info' => 'This setting controls how many topics are displayed per page when you view a forum. If you are uncertain about what to use, you can just leave it blank and the forum default will be used.', | 97: 'Posts per page' => 'Posts', |
| 100: 'Posts per page' => 'Posts', | 98: 'Leave blank' => 'Leave blank to use forum default.', |
| 101: 'Posts per page info' => 'This setting controls how many posts are displayed per page when you view a topic. If you are uncertain about what to use, you can just leave it blank and the forum default will be used.', | 99: 'Subscription legend' => 'Set your subscription options', |
| 102: 'Leave blank' => 'Leave blank to use forum default.', | 100: 'Notify full' => 'Include a plain text version of new posts in subscription notification emails.', |
| 103: 'Subscription legend' => 'Set your subscription options', | 101: 'Auto notify full' => 'Automatically subscribe to every topic you post in.', |
| 104: 'Notify full' => 'Include post in subscription e-mails.', | 102: 'Show smilies' => 'Show smilies as graphic icons', |
| 105: 'Notify full info' => 'With this enabled, a plain text version of the new post will be included in subscription notification e-mails.', | 103: 'Show images' => 'Show images in posts.', |
| 106: 'Auto notify full' => 'Automatically subscribe to topics when posting.', | 104: 'Show images sigs' => 'Show images in user signatures.', |
| 107: 'Auto notify full info' => 'With this enabled, you will automatically be subscribed to every topic you post in.', | 105: 'Show avatars' => 'Show user avatars in posts.', |
| 108: 'Show smilies' => 'Show smilies as graphic icons', | 106: 'Show sigs' => 'Show user signatures.', |
| 109: 'Show smilies info' => 'If you enable this option, small images will be displayed instead of text smilies.', | 107: 'Style legend' => 'Select your preferred style', |
| 110: 'Show images' => 'Show images in posts.', | 108: 'Style info' => 'If you like you can use a different visual style for this forum.', |
| 111: 'Show images info' => 'Disable this if you don\'t want to see images in posts (i.e. images displayed with the [img]-tag).', | 109: 'Admin note' => 'Admin note', |
| 112: 'Show images sigs' => 'Show images in user signatures.', | 110: 'Pagination legend' => 'Enter your pagination options', |
| 113: 'Show images sigs info' => 'Disable this if you don\'t want to see images in signatures (i.e. images displayed with the [img]-tag).', | 111: 'Post display legend' => 'Set your options for viewing posts', |
| 114: 'Show avatars' => 'Show user avatars in posts.', | 112: 'Post display info' => 'If you are on a slow connection, disabling these options, particularly showing images in posts and signatures, will make pages load faster.', |
| 115: 'Show avatars info' => 'This option toggles whether user avatar images will be displayed in posts or not.', | 113: 'Instructions' => 'When you update your profile, you will be redirected back to this page.', |
| 116: 'Show sigs' => 'Show user signatures.', | |
| 117: 'Show sigs info' => 'Enable if you would like to see user signatures.', | |
| 118: 'Style legend' => 'Select your preferred style', | |
| 119: 'Style info' => 'If you like you can use a different visual style for this forum.', | |
| 120: 'Admin note' => 'Admin note', | |
| 121: 'Pagination legend' => 'Enter your pagination options', | |
| 122: 'Post display legend' => 'Set your options for viewing posts', | |
| 123: 'Post display info' => 'If you are on a slow connection, disabling these options, particularly showing images in posts and signatures, will make pages load faster.', | |
| 124: 'Instructions' => 'When you update your profile, you will be redirected back to this page.', | |
| 125: | 114: |
| 126: // Administration stuff | 115: // Administration stuff |
| 127: 'Group membership legend' => 'Choose user group', | 116: 'Group membership legend' => 'Choose user group', |
| 128: 'Save' => 'Save', | 117: 'Save' => 'Save', |
| 129: 'Set mods legend' => 'Set moderator access', | 118: 'Set mods legend' => 'Set moderator access', |
| 130: 'Moderator in' => 'Moderator in', | 119: 'Moderator in info' => 'Choose what forums this user should be allowed to moderate. Note: This only applies to moderators. Administrators always have full permissions in all forums.', |
| 131: 'Moderator in info' => 'Choose what forums this user should be allowed to moderate. Note: This only applies to moderators. Administrators always have full permissions in all forums.', | 120: 'Update forums' => 'Update forums', |
| 132: 'Update forums' => 'Update forums', | 121: 'Delete ban legend' => 'Delete (administrators only) or ban user', |
| 133: 'Delete ban legend' => 'Delete (administrators only) or ban user', | 122: 'Delete user' => 'Delete user', |
| 134: 'Delete user' => 'Delete user', | 123: 'Ban user' => 'Ban user', |
| 135: 'Ban user' => 'Ban user', | 124: 'Confirm delete legend' => 'Important: read before deleting user', |
| 136: 'Confirm delete legend' => 'Important: read before deleting user', | 125: 'Confirm delete user' => 'Confirm delete user', |
| 137: 'Confirm delete user' => 'Confirm delete user', | 126: 'Confirmation info' => 'Please confirm that you want to delete the user', // the username will be appended to this string |
| 138: 'Confirmation info' => 'Please confirm that you want to delete the user', // the username will be appended to this string | 127: 'Delete warning' => 'Warning! Deleted users and/or posts cannot be restored. If you choose not to delete the posts made by this user, the posts can only be deleted manually at a later time.', |
| 139: 'Delete warning' => 'Warning! Deleted users and/or posts cannot be restored. If you choose not to delete the posts made by this user, the posts can only be deleted manually at a later time.', | 128: 'Delete posts' => 'Delete any posts and topics this user has made.', |
| 140: 'Delete posts' => 'Delete any posts and topics this user has made.', | 129: 'Delete' => 'Delete', // submit button (confirm user delete) |
| 141: 'Delete' => 'Delete', // submit button (confirm user delete) | 130: 'User delete redirect' => 'User deleted. Redirecting …', |
| 142: 'User delete redirect' => 'User deleted. Redirecting …', | 131: 'Group membership redirect' => 'Group membership saved. Redirecting …', |
| 143: 'Group membership redirect' => 'Group membership saved. Redirecting …', | 132: 'Update forums redirect' => 'Forum moderator rights updated. Redirecting …', |
| 144: 'Update forums redirect' => 'Forum moderator rights updated. Redirecting …', | 133: 'Ban redirect' => 'Redirecting …' |
| 145: 'Ban redirect' => 'Redirecting …' | |
| 146: | 134: |
| 147: ); | 135: ); |
| a/upload/login.php |
b/upload/login.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: if (isset($_GET['action'])) | 11: if (isset($_GET['action'])) |
| 27: define('PUN_QUIET_VISIT', 1); | 12: define('PUN_QUIET_VISIT', 1); |
| 43: | 28: |
| 44: $username_sql = ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') ? 'username=\''.$db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')'; | 29: $username_sql = ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') ? 'username=\''.$db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')'; |
| 45: | 30: |
| 46: $result = $db->query('SELECT id, group_id, password FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 31: $result = $db->query('SELECT * FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 47: list($user_id, $group_id, $db_password_hash) = $db->fetch_row($result); | 32: $cur_user = $db->fetch_assoc($result); |
| 48: | 33: |
| 49: $authorized = false; | 34: $authorized = false; |
| 50: | 35: |
| 51: if (!empty($db_password_hash)) | 36: if (!empty($cur_user['password'])) |
| 52: { | 37: { |
| 53: $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false; | 38: $sha1_in_db = (strlen($cur_user['password']) == 40) ? true : false; |
| 54: $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false; | 39: $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false; |
| 55: | 40: |
| 56: $form_password_hash = pun_hash($form_password); // This could result in either an SHA-1 or an MD5 hash (depends on $sha1_available) | 41: $form_password_hash = pun_hash($form_password); // This could result in either an SHA-1 or an MD5 hash (depends on $sha1_available) |
| 57: | 42: |
| 58: if ($sha1_in_db && $sha1_available && $db_password_hash == $form_password_hash) | 43: // If there is a salt in the database we have upgraded from 1.3-legacy though havent yet logged in |
| 59: $authorized = true; | 44: if (!empty($cur_user['salt'])) |
| 60: else if (!$sha1_in_db && $db_password_hash == md5($form_password)) | |
| 61: { | 45: { |
| 62: $authorized = true; | 46: if (sha1($cur_user['salt'].sha1($form_password)) == $cur_user['password']) |
| | 47: { |
| | 48: $authorized = true; |
| 63: | 49: |
| 64: if ($sha1_available) // There's an MD5 hash in the database, but SHA1 hashing is available, so we update the DB | 50: $db->query('UPDATE '.$db->prefix.'users SET password=\''.$form_password_hash.'\', salt=NULL WHERE id='.$cur_user['id']) or error('Unable to update user password', __FILE__, __LINE__, $db->error()); |
| 65: $db->query('UPDATE '.$db->prefix.'users SET password=\''.$form_password_hash.'\' WHERE id='.$user_id) or error('Unable to update user password', __FILE__, __LINE__, $db->error()); | 51: } |
| | 52: } |
| | 53: else |
| | 54: { |
| | 55: if ($sha1_in_db && $sha1_available && $cur_user['password'] == $form_password_hash) |
| | 56: $authorized = true; |
| | 57: else if (!$sha1_in_db && $cur_user['password'] == md5($form_password)) |
| | 58: { |
| | 59: $authorized = true; |
| | 60: |
| | 61: if ($sha1_available) // There's an MD5 hash in the database, but SHA1 hashing is available, so we update the DB |
| | 62: $db->query('UPDATE '.$db->prefix.'users SET password=\''.$form_password_hash.'\' WHERE id='.$cur_user['id']) or error('Unable to update user password', __FILE__, __LINE__, $db->error()); |
| | 63: } |
| 66: } | 64: } |
| 67: } | 65: } |
| 68: | 66: |
| 70: message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>'); | 68: message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>'); |
| 71: | 69: |
| 72: // Update the status if this is the first time the user logged in | 70: // Update the status if this is the first time the user logged in |
| 73: if ($group_id == PUN_UNVERIFIED) | 71: if ($cur_user['group_id'] == PUN_UNVERIFIED) |
| 74: $db->query('UPDATE '.$db->prefix.'users SET group_id='.$pun_config['o_default_user_group'].' WHERE id='.$user_id) or error('Unable to update user status', __FILE__, __LINE__, $db->error()); | 72: $db->query('UPDATE '.$db->prefix.'users SET group_id='.$pun_config['o_default_user_group'].' WHERE id='.$cur_user['id']) or error('Unable to update user status', __FILE__, __LINE__, $db->error()); |
| 75: | 73: |
| 76: // Remove this users guest entry from the online list | 74: // Remove this users guest entry from the online list |
| 77: $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape(get_remote_address()).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); | 75: $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape(get_remote_address()).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); |
| 78: | 76: |
| 79: $expire = ($save_pass == '1') ? time() + 1209600 : time() + $pun_config['o_timeout_visit']; | 77: $expire = ($save_pass == '1') ? time() + 1209600 : time() + $pun_config['o_timeout_visit']; |
| 80: pun_setcookie($user_id, $form_password_hash, $expire); | 78: pun_setcookie($cur_user['id'], $form_password_hash, $expire); |
| 81: | 79: |
| 82: // Reset tracked topics | 80: // Reset tracked topics |
| 83: set_tracked_topics(null); | 81: set_tracked_topics(null); |
| 94: exit; | 92: exit; |
| 95: } | 93: } |
| 96: | 94: |
| 97: // Remove user from "users online" list. | 95: // Remove user from "users online" list |
| 98: $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); | 96: $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); |
| 99: | 97: |
| 100: // Update last_visit (make sure there's something to update it with) | 98: // Update last_visit (make sure there's something to update it with) |
| 116: { | 114: { |
| 117: require PUN_ROOT.'include/email.php'; | 115: require PUN_ROOT.'include/email.php'; |
| 118: | 116: |
| 119: // Validate the email-address | 117: // Validate the email address |
| 120: $email = strtolower(trim($_POST['req_email'])); | 118: $email = strtolower(trim($_POST['req_email'])); |
| 121: if (!is_valid_email($email)) | 119: if (!is_valid_email($email)) |
| 122: message($lang_common['Invalid e-mail']); | 120: message($lang_common['Invalid email']); |
| 123: | 121: |
| 124: $result = $db->query('SELECT id, username, last_email_sent FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 122: $result = $db->query('SELECT id, username, last_email_sent FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 125: | 123: |
| 133: $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8)); | 131: $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8)); |
| 134: $mail_message = trim(substr($mail_tpl, $first_crlf)); | 132: $mail_message = trim(substr($mail_tpl, $first_crlf)); |
| 135: | 133: |
| 136: // Do the generic replacements first (they apply to all e-mails sent out here) | 134: // Do the generic replacements first (they apply to all emails sent out here) |
| 137: $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message); | 135: $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message); |
| 138: $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message); | 136: $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message); |
| 139: | 137: |
| 160: message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); | 158: message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); |
| 161: } | 159: } |
| 162: else | 160: else |
| 163: message($lang_login['No e-mail match'].' '.htmlspecialchars($email).'.'); | 161: message($lang_login['No email match'].' '.htmlspecialchars($email).'.'); |
| 164: } | 162: } |
| 165: | 163: |
| 166: | 164: |
| 167: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_login['Request pass']; | 165: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_login['Request pass']; |
| 168: $required_fields = array('req_email' => $lang_common['E-mail']); | 166: $required_fields = array('req_email' => $lang_common['Email']); |
| 169: $focus_element = array('request_pass', 'req_email'); | 167: $focus_element = array('request_pass', 'req_email'); |
| 170: require PUN_ROOT.'header.php'; | 168: require PUN_ROOT.'header.php'; |
| 171: | 169: |
| 184: </div> | 182: </div> |
| 185: </fieldset> | 183: </fieldset> |
| 186: </div> | 184: </div> |
| 187: <p><input type="submit" name="request_pass" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 185: <p class="buttons"><input type="submit" name="request_pass" value="<?php echo $lang_common['Submit'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 188: </form> | 186: </form> |
| 189: </div> | 187: </div> |
| 190: </div> | 188: </div> |
| 198: header('Location: index.php'); | 196: header('Location: index.php'); |
| 199: | 197: |
| 200: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login) | 198: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login) |
| 201: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php'; | 199: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : $pun_config['o_base_url'].'/index.php'; |
| 202: | 200: |
| 203: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login']; | 201: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login']; |
| 204: $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']); | 202: $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']); |
| 213: <div class="inform"> | 211: <div class="inform"> |
| 214: <fieldset> | 212: <fieldset> |
| 215: <legend><?php echo $lang_login['Login legend'] ?></legend> | 213: <legend><?php echo $lang_login['Login legend'] ?></legend> |
| 216: <div class="infldset"> | 214: <div class="infldset"> |
| 217: <input type="hidden" name="form_sent" value="1" /> | 215: <input type="hidden" name="form_sent" value="1" /> |
| 218: <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" /> | 216: <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" /> |
| 219: <label class="conl"><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" tabindex="1" /><br /></label> | 217: <label class="conl"><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" tabindex="1" /><br /></label> |
| 220: <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" tabindex="2" /><br /></label> | 218: <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="25" tabindex="2" /><br /></label> |
| 221: | 219: |
| 222: <div class="rbox clearb"> | 220: <div class="rbox clearb"> |
| 223: <label><input type="checkbox" name="save_pass" value="1" tabindex="3" /><?php echo $lang_login['Remember me'] ?> <br /></label> | 221: <label><input type="checkbox" name="save_pass" value="1" tabindex="3" /><?php echo $lang_login['Remember me'] ?> <br /></label> |
| 224: </div> | |
| 225: | |
| 226: <p class="clearb"><?php echo $lang_login['Login info'] ?></p> | |
| 227: <p><a href="register.php" tabindex="4"><?php echo $lang_login['Not registered'] ?></a> | |
| 228: <a href="login.php?action=forget" tabindex="5"><?php echo $lang_login['Forgotten pass'] ?></a></p> | |
| 229: </div> | 222: </div> |
| | 223: |
| | 224: <p class="clearb"><?php echo $lang_login['Login info'] ?></p> |
| | 225: <p><a href="register.php" tabindex="4"><?php echo $lang_login['Not registered'] ?></a> |
| | 226: <a href="login.php?action=forget" tabindex="5"><?php echo $lang_login['Forgotten pass'] ?></a></p> |
| | 227: </div> |
| 230: </fieldset> | 228: </fieldset> |
| 231: </div> | 229: </div> |
| 232: <p><input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" /></p> | 230: <p class="buttons"><input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" /></p> |
| 233: </form> | 231: </form> |
| 234: </div> | 232: </div> |
| 235: </div> | 233: </div> |
| a/upload/misc.php |
b/upload/misc.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: if (isset($_GET['action'])) | 11: if (isset($_GET['action'])) |
| 27: define('PUN_QUIET_VISIT', 1); | 12: define('PUN_QUIET_VISIT', 1); |
| 51: <div class="block"> | 36: <div class="block"> |
| 52: <h2><span><?php echo $lang_register['Forum rules'] ?></span></h2> | 37: <h2><span><?php echo $lang_register['Forum rules'] ?></span></h2> |
| 53: <div class="box"> | 38: <div class="box"> |
| 54: <div class="inbox"> | 39: <div id="rules-block" class="inbox"> |
| 55: <p><?php echo $pun_config['o_rules_message'] ?></p> | 40: <div class="usercontent"><?php echo $pun_config['o_rules_message'] ?></div> |
| 56: </div> | 41: </div> |
| 57: </div> | 42: </div> |
| 58: </div> | 43: </div> |
| 110: list($recipient, $recipient_email, $email_setting) = $db->fetch_row($result); | 95: list($recipient, $recipient_email, $email_setting) = $db->fetch_row($result); |
| 111: | 96: |
| 112: if ($email_setting == 2 && !$pun_user['is_admmod']) | 97: if ($email_setting == 2 && !$pun_user['is_admmod']) |
| 113: message($lang_misc['Form e-mail disabled']); | 98: message($lang_misc['Form email disabled']); |
| 114: | 99: |
| 115: | 100: |
| 116: if (isset($_POST['form_sent'])) | 101: if (isset($_POST['form_sent'])) |
| 120: $message = pun_trim($_POST['req_message']); | 105: $message = pun_trim($_POST['req_message']); |
| 121: | 106: |
| 122: if ($subject == '') | 107: if ($subject == '') |
| 123: message($lang_misc['No e-mail subject']); | 108: message($lang_misc['No email subject']); |
| 124: else if ($message == '') | 109: else if ($message == '') |
| 125: message($lang_misc['No e-mail message']); | 110: message($lang_misc['No email message']); |
| 126: else if (strlen($message) > 65535) | 111: else if (strlen($message) > 65535) |
| 127: message($lang_misc['Too long e-mail message']); | 112: message($lang_misc['Too long email message']); |
| 128: | 113: |
| 129: if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0) | 114: if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0) |
| 130: message(sprintf($lang_misc['Email flood'], $pun_user['g_email_flood'])); | 115: message(sprintf($lang_misc['Email flood'], $pun_user['g_email_flood'])); |
| 131: | 116: |
| 132: // Load the "form e-mail" template | 117: // Load the "form email" template |
| 133: $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/form_email.tpl')); | 118: $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/form_email.tpl')); |
| 134: | 119: |
| 135: // The first row contains the subject | 120: // The first row contains the subject |
| 149: | 134: |
| 150: $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); | 135: $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); |
| 151: | 136: |
| 152: redirect(htmlspecialchars($_POST['redirect_url']), $lang_misc['E-mail sent redirect']); | 137: redirect(htmlspecialchars($_POST['redirect_url']), $lang_misc['Email sent redirect']); |
| 153: } | 138: } |
| 154: | 139: |
| 155: | 140: |
| 156: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to the users profile after the e-mail is sent) | 141: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to the users profile after the email is sent) |
| 157: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php'; | 142: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php'; |
| 158: | 143: |
| 159: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Send e-mail to'].' '.pun_htmlspecialchars($recipient); | 144: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Send email to'].' '.pun_htmlspecialchars($recipient); |
| 160: $required_fields = array('req_subject' => $lang_misc['E-mail subject'], 'req_message' => $lang_misc['E-mail message']); | 145: $required_fields = array('req_subject' => $lang_misc['Email subject'], 'req_message' => $lang_misc['Email message']); |
| 161: $focus_element = array('email', 'req_subject'); | 146: $focus_element = array('email', 'req_subject'); |
| 162: require PUN_ROOT.'header.php'; | 147: require PUN_ROOT.'header.php'; |
| 163: | 148: |
| 164: ?> | 149: ?> |
| 165: <div class="blockform"> | 150: <div class="blockform"> |
| 166: <h2><span><?php echo $lang_misc['Send e-mail to'] ?> <?php echo pun_htmlspecialchars($recipient) ?></span></h2> | 151: <h2><span><?php echo $lang_misc['Send email to'] ?> <?php echo pun_htmlspecialchars($recipient) ?></span></h2> |
| 167: <div class="box"> | 152: <div class="box"> |
| 168: <form id="email" method="post" action="misc.php?email=<?php echo $recipient_id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}"> | 153: <form id="email" method="post" action="misc.php?email=<?php echo $recipient_id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}"> |
| 169: <div class="inform"> | 154: <div class="inform"> |
| 170: <fieldset> | 155: <fieldset> |
| 171: <legend><?php echo $lang_misc['Write e-mail'] ?></legend> | 156: <legend><?php echo $lang_misc['Write email'] ?></legend> |
| 172: <div class="infldset txtarea"> | 157: <div class="infldset txtarea"> |
| 173: <input type="hidden" name="form_sent" value="1" /> | 158: <input type="hidden" name="form_sent" value="1" /> |
| 174: <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" /> | 159: <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" /> |
| 175: <label><strong><?php echo $lang_misc['E-mail subject'] ?></strong><br /> | 160: <label><strong><?php echo $lang_misc['Email subject'] ?></strong><br /> |
| 176: <input class="longinput" type="text" name="req_subject" size="75" maxlength="70" tabindex="1" /><br /></label> | 161: <input class="longinput" type="text" name="req_subject" size="75" maxlength="70" tabindex="1" /><br /></label> |
| 177: <label><strong><?php echo $lang_misc['E-mail message'] ?></strong><br /> | 162: <label><strong><?php echo $lang_misc['Email message'] ?></strong><br /> |
| 178: <textarea name="req_message" rows="10" cols="75" tabindex="2"></textarea><br /></label> | 163: <textarea name="req_message" rows="10" cols="75" tabindex="2"></textarea><br /></label> |
| 179: <p><?php echo $lang_misc['E-mail disclosure note'] ?></p> | 164: <p><?php echo $lang_misc['Email disclosure note'] ?></p> |
| 180: </div> | 165: </div> |
| 181: </fieldset> | 166: </fieldset> |
| 182: </div> | 167: </div> |
| 183: <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="3" accesskey="s" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 168: <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="3" accesskey="s" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 184: </form> | 169: </form> |
| 185: </div> | 170: </div> |
| 186: </div> | 171: </div> |
| 205: $reason = pun_linebreaks(pun_trim($_POST['req_reason'])); | 190: $reason = pun_linebreaks(pun_trim($_POST['req_reason'])); |
| 206: if ($reason == '') | 191: if ($reason == '') |
| 207: message($lang_misc['No reason']); | 192: message($lang_misc['No reason']); |
| 208: | 193: |
| 209: if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0) | 194: if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0) |
| 210: message(sprintf($lang_misc['Report flood'], $pun_user['g_email_flood'])); | 195: message(sprintf($lang_misc['Report flood'], $pun_user['g_email_flood'])); |
| 211: | 196: |
| 227: if ($pun_config['o_report_method'] == 0 || $pun_config['o_report_method'] == 2) | 212: if ($pun_config['o_report_method'] == 0 || $pun_config['o_report_method'] == 2) |
| 228: $db->query('INSERT INTO '.$db->prefix.'reports (post_id, topic_id, forum_id, reported_by, created, message) VALUES('.$post_id.', '.$topic_id.', '.$forum_id.', '.$pun_user['id'].', '.time().', \''.$db->escape($reason).'\')' ) or error('Unable to create report', __FILE__, __LINE__, $db->error()); | 213: $db->query('INSERT INTO '.$db->prefix.'reports (post_id, topic_id, forum_id, reported_by, created, message) VALUES('.$post_id.', '.$topic_id.', '.$forum_id.', '.$pun_user['id'].', '.time().', \''.$db->escape($reason).'\')' ) or error('Unable to create report', __FILE__, __LINE__, $db->error()); |
| 229: | 214: |
| 230: // Should we e-mail the report? | 215: // Should we email the report? |
| 231: if ($pun_config['o_report_method'] == 1 || $pun_config['o_report_method'] == 2) | 216: if ($pun_config['o_report_method'] == 1 || $pun_config['o_report_method'] == 2) |
| 232: { | 217: { |
| 233: // We send it to the complete mailing-list in one swoop | 218: // We send it to the complete mailing-list in one swoop |
| 234: if ($pun_config['o_mailing_list'] != '') | 219: if ($pun_config['o_mailing_list'] != '') |
| 235: { | 220: { |
| 236: $mail_subject = sprintf($lang_common['Report notification'], $forum_id, $subject); | 221: $mail_subject = sprintf($lang_common['Report notification'], $forum_id, $subject); |
| 237: $mail_message = sprintf($lang_common['Report message 1'], $pun_user['username'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$post_id.'#p'.$post_id)."\n"; | 222: $mail_message = sprintf($lang_common['Report message 1'], $pun_user['username'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$post_id.'#p'.$post_id)."\n"; |
| 238: $mail_message .= sprintf($lang_common['Report message 2'], $reason)."\n"; | 223: $mail_message .= sprintf($lang_common['Report message 2'], $reason)."\n"; |
| 243: pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); | 228: pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
| 244: } | 229: } |
| 245: } | 230: } |
| 246: | 231: |
| 247: $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); | 232: $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); |
| 248: | 233: |
| 249: redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_misc['Report redirect']); | 234: redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_misc['Report redirect']); |
| 269: </div> | 254: </div> |
| 270: </fieldset> | 255: </fieldset> |
| 271: </div> | 256: </div> |
| 272: <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 257: <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 273: </form> | 258: </form> |
| 274: </div> | 259: </div> |
| 275: </div> | 260: </div> |
| a/upload/moderate.php |
b/upload/moderate.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: define('PUN_ROOT', './'); | 11: define('PUN_ROOT', './'); |
| 27: require PUN_ROOT.'include/common.php'; | 12: require PUN_ROOT.'include/common.php'; |
| 28: | 13: |
| 29: | 14: |
| 30: // This particular function doesn't require forum-based moderator access. It can be used | 15: // This particular function doesn't require forum-based moderator access. It can be used |
| 31: // by all moderators and admins. | 16: // by all moderators and admins |
| 32: if (isset($_GET['get_host'])) | 17: if (isset($_GET['get_host'])) |
| 33: { | 18: { |
| 34: if (!$pun_user['is_admmod']) | 19: if (!$pun_user['is_admmod']) |
| 75: require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php'; | 60: require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php'; |
| 76: | 61: |
| 77: | 62: |
| 78: // All other topic moderation features require a topic id in GET | 63: // All other topic moderation features require a topic ID in GET |
| 79: if (isset($_GET['tid'])) | 64: if (isset($_GET['tid'])) |
| 80: { | 65: { |
| 81: $tid = intval($_GET['tid']); | 66: $tid = intval($_GET['tid']); |
| 148: </div> | 133: </div> |
| 149: </fieldset> | 134: </fieldset> |
| 150: </div> | 135: </div> |
| 151: <p><input type="submit" name="delete_posts_comply" value="<?php echo $lang_misc['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 136: <p class="buttons"><input type="submit" name="delete_posts_comply" value="<?php echo $lang_misc['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 152: </form> | 137: </form> |
| 153: </div> | 138: </div> |
| 154: </div> | 139: </div> |
| 234: </div> | 219: </div> |
| 235: </fieldset> | 220: </fieldset> |
| 236: </div> | 221: </div> |
| 237: <p><input type="submit" name="split_posts_comply" value="<?php echo $lang_misc['Split'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 222: <p class="buttons"><input type="submit" name="split_posts_comply" value="<?php echo $lang_misc['Split'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 238: </form> | 223: </form> |
| 239: </div> | 224: </div> |
| 240: </div> | 225: </div> |
| 273: ?> | 258: ?> |
| 274: <div class="linkst"> | 259: <div class="linkst"> |
| 275: <div class="inbox"> | 260: <div class="inbox"> |
| | 261: <ul class="crumbs"> |
| | 262: <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li> |
| | 263: <li>» <a href="viewforum.php?id=<?php echo $fid ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li> |
| | 264: <li>» <?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li> |
| | 265: </ul> |
| 276: <p class="pagelink conl"><?php echo $paging_links ?></p> | 266: <p class="pagelink conl"><?php echo $paging_links ?></p> |
| 277: <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li> » <a href="viewforum.php?id=<?php echo $fid ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li> » <?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul> | |
| 278: <div class="clearer"></div> | 267: <div class="clearer"></div> |
| 279: </div> | 268: </div> |
| 280: </div> | 269: </div> |
| 284: | 273: |
| 285: require PUN_ROOT.'include/parser.php'; | 274: require PUN_ROOT.'include/parser.php'; |
| 286: | 275: |
| 287: $bg_switch = true; // Used for switching background color in posts | 276: $post_count = 0; // Keep track of post numbers |
| 288: $post_count = 0; // Keep track of post numbers | |
| 289: | 277: |
| 290: // Retrieve the posts (and their respective poster) | 278: // Retrieve the posts (and their respective poster) |
| 291: $result = $db->query('SELECT u.title, u.num_posts, g.g_id, g.g_user_title, p.id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE p.topic_id='.$tid.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); | 279: $result = $db->query('SELECT u.title, u.num_posts, g.g_id, g.g_user_title, p.id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE p.topic_id='.$tid.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
| 294: { | 282: { |
| 295: $post_count++; | 283: $post_count++; |
| 296: | 284: |
| 297: // If the poster is a registered user. | 285: // If the poster is a registered user |
| 298: if ($cur_post['poster_id'] > 1) | 286: if ($cur_post['poster_id'] > 1) |
| 299: { | 287: { |
| 300: if ($pun_user['g_view_users'] == '1') | 288: if ($pun_user['g_view_users'] == '1') |
| 316: $user_title = $lang_topic['Guest']; | 304: $user_title = $lang_topic['Guest']; |
| 317: } | 305: } |
| 318: | 306: |
| 319: // Switch the background color for every message. | |
| 320: $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true; | |
| 321: $vtbg = ($bg_switch) ? ' roweven' : ' rowodd'; | |
| 322: | |
| 323: // Perform the main parsing of the message (BBCode, smilies, censor words etc) | 307: // Perform the main parsing of the message (BBCode, smilies, censor words etc) |
| 324: $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); | 308: $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); |
| 325: | 309: |
| 326: ?> | 310: ?> |
| 327: | 311: |
| 328: <div class="blockpost<?php echo $vtbg ?>"> | 312: <div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>"> |
| 329: <a name="<?php echo $cur_post['id'] ?>"></a> | 313: <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?></span> <a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2> |
| 330: <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?> </span><a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2> | |
| 331: <div class="box"> | 314: <div class="box"> |
| 332: <div class="inbox"> | 315: <div class="inbox"> |
| 333: <div class="postleft"> | 316: <div class="postbody"> |
| 334: <dl> | 317: <div class="postleft"> |
| 335: <dt><strong><?php echo $poster ?></strong></dt> | 318: <dl> |
| 336: <dd><strong><?php echo $user_title ?></strong></dd> | 319: <dt><strong><?php echo $poster ?></strong></dt> |
| 337: </dl> | 320: <dd><strong><?php echo $user_title ?></strong></dd> |
| 338: </div> | 321: </dl> |
| 339: <div class="postright"> | 322: </div> |
| 340: <h3 class="nosize"><?php echo $lang_common['Message'] ?></h3> | 323: <div class="postright"> |
| 341: <div class="postmsg"> | 324: <h3 class="nosize"><?php echo $lang_common['Message'] ?></h3> |
| 342: <?php echo $cur_post['message']."\n" ?> | 325: <div class="postmsg"> |
| 343: <?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?> | 326: <?php echo $cur_post['message']."\n" ?> |
| | 327: <?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?> |
| | 328: </div> |
| 344: </div> | 329: </div> |
| 345: <?php if ($start_from + $post_count > 1) echo '<p class="multidelete"><label><strong>'.$lang_misc['Select'].'</strong> <input type="checkbox" name="posts['.$cur_post['id'].']" value="1" /></label></p>'."\n" ?> | |
| 346: </div> | 330: </div> |
| 347: <div class="clearer"></div> | 331: </div> |
| | 332: <div class="inbox"> |
| | 333: <div class="postfoot clearb"> |
| | 334: <div class="postfootright"><?php echo ($start_from + $post_count > 1) ? '<p class="multidelete"><label><strong>'.$lang_misc['Select'].'</strong> <input type="checkbox" name="posts['.$cur_post['id'].']" value="1" /></label></p>' : '<p>'.$lang_misc['Cannot delete first'].'</p>' ?></div> |
| | 335: </div> |
| 348: </div> | 336: </div> |
| 349: </div> | 337: </div> |
| 350: </div> | 338: </div> |
| 357: <div class="postlinksb"> | 345: <div class="postlinksb"> |
| 358: <div class="inbox"> | 346: <div class="inbox"> |
| 359: <p class="pagelink conl"><?php echo $paging_links ?></p> | 347: <p class="pagelink conl"><?php echo $paging_links ?></p> |
| 360: <p class="conr"> | 348: <p class="conr modbuttons"><input type="submit" name="split_posts" value="<?php echo $lang_misc['Split'] ?>"<?php echo $button_status ?> /> <input type="submit" name="delete_posts" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /></p> |
| 361: <input type="submit" name="split_posts" value="<?php echo $lang_misc['Split'] ?>"<?php echo $button_status ?> /> | |
| 362: <input type="submit" name="delete_posts" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /> | |
| 363: </p> | |
| 364: <div class="clearer"></div> | 349: <div class="clearer"></div> |
| 365: </div> | 350: </div> |
| 366: </div> | 351: </div> |
| 392: if ($db->num_rows($result) != count($topics)) | 377: if ($db->num_rows($result) != count($topics)) |
| 393: message($lang_common['Bad request']); | 378: message($lang_common['Bad request']); |
| 394: | 379: |
| 395: // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it where it was once moved from) | 380: // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it was once moved from) |
| 396: $db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); | 381: $db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); |
| 397: | 382: |
| 398: // Move the topic(s) | 383: // Move the topic(s) |
| 412: } | 397: } |
| 413: } | 398: } |
| 414: | 399: |
| 415: update_forum($fid); // Update the forum FROM which the topic was moved | 400: update_forum($fid); // Update the forum FROM which the topic was moved |
| 416: update_forum($move_to_forum); // Update the forum TO which the topic was moved | 401: update_forum($move_to_forum); // Update the forum TO which the topic was moved |
| 417: | 402: |
| 418: $redirect_msg = (count($topics) > 1) ? $lang_misc['Move topics redirect'] : $lang_misc['Move topic redirect']; | 403: $redirect_msg = (count($topics) > 1) ? $lang_misc['Move topics redirect'] : $lang_misc['Move topic redirect']; |
| 419: redirect('viewforum.php?id='.$move_to_forum, $redirect_msg); | 404: redirect('viewforum.php?id='.$move_to_forum, $redirect_msg); |
| 437: $action = 'single'; | 422: $action = 'single'; |
| 438: } | 423: } |
| 439: | 424: |
| | 425: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id 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.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); |
| | 426: if ($db->num_rows($result) < 2) |
| | 427: message($lang_misc['Nowhere to move']); |
| | 428: |
| 440: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Moderate'; | 429: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Moderate'; |
| 441: require PUN_ROOT.'header.php'; | 430: require PUN_ROOT.'header.php'; |
| 442: | 431: |
| 454: <br /><select name="move_to_forum"> | 443: <br /><select name="move_to_forum"> |
| 455: <?php | 444: <?php |
| 456: | 445: |
| 457: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id 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.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); | |
| 458: | |
| 459: $cur_category = 0; | 446: $cur_category = 0; |
| 460: while ($cur_forum = $db->fetch_assoc($result)) | 447: while ($cur_forum = $db->fetch_assoc($result)) |
| 461: { | 448: { |
| 462: if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? | 449: if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? |
| 463: { | 450: { |
| 464: if ($cur_category) | 451: if ($cur_category) |
| 465: echo "\t\t\t\t\t\t\t".'</optgroup>'."\n"; | 452: echo "\t\t\t\t\t\t\t".'</optgroup>'."\n"; |
| 482: </div> | 469: </div> |
| 483: </fieldset> | 470: </fieldset> |
| 484: </div> | 471: </div> |
| 485: <p><input type="submit" name="move_topics_to" value="<?php echo $lang_misc['Move'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 472: <p class="buttons"><input type="submit" name="move_topics_to" value="<?php echo $lang_misc['Move'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 486: </form> | 473: </form> |
| 487: </div> | 474: </div> |
| 488: </div> | 475: </div> |
| 573: </div> | 560: </div> |
| 574: </fieldset> | 561: </fieldset> |
| 575: </div> | 562: </div> |
| 576: <p><input type="submit" name="merge_topics_comply" value="<?php echo $lang_misc['Merge'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 563: <p class="buttons"><input type="submit" name="merge_topics_comply" value="<?php echo $lang_misc['Merge'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 577: </form> | 564: </form> |
| 578: </div> | 565: </div> |
| 579: </div> | 566: </div> |
| 610: // Delete any subscriptions | 597: // Delete any subscriptions |
| 611: $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topics.')') or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error()); | 598: $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topics.')') or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error()); |
| 612: | 599: |
| 613: // Create a list of the post ID's in this topic and then strip the search index | 600: // Create a list of the post IDs in this topic and then strip the search index |
| 614: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topics.')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); | 601: $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topics.')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); |
| 615: | 602: |
| 616: $post_ids = ''; | 603: $post_ids = ''; |
| 617: while ($row = $db->fetch_row($result)) | 604: while ($row = $db->fetch_row($result)) |
| 618: $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0]; | 605: $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0]; |
| 619: | 606: |
| 620: // We have to check that we actually have a list of post ID's since we could be deleting just a redirect topic | 607: // We have to check that we actually have a list of post IDs since we could be deleting just a redirect topic |
| 621: if ($post_ids != '') | 608: if ($post_ids != '') |
| 622: strip_search_index($post_ids); | 609: strip_search_index($post_ids); |
| 623: | 610: |
| 647: </div> | 634: </div> |
| 648: </fieldset> | 635: </fieldset> |
| 649: </div> | 636: </div> |
| 650: <p><input type="submit" name="delete_topics_comply" value="<?php echo $lang_misc['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 637: <p class="buttons"><input type="submit" name="delete_topics_comply" value="<?php echo $lang_misc['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 651: </form> | 638: </form> |
| 652: </div> | 639: </div> |
| 653: </div> | 640: </div> |
| 754: ?> | 741: ?> |
| 755: <div class="linkst"> | 742: <div class="linkst"> |
| 756: <div class="inbox"> | 743: <div class="inbox"> |
| | 744: <ul class="crumbs"> |
| | 745: <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li> |
| | 746: <li>» <?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li> |
| | 747: </ul> |
| 757: <p class="pagelink conl"><?php echo $paging_links ?></p> | 748: <p class="pagelink conl"><?php echo $paging_links ?></p> |
| 758: <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a> </li><li>» <?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul> | |
| 759: <div class="clearer"></div> | 749: <div class="clearer"></div> |
| 760: </div> | 750: </div> |
| 761: </div> | 751: </div> |
| 781: // Select topics | 771: // Select topics |
| 782: $result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$fid.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error()); | 772: $result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$fid.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error()); |
| 783: | 773: |
| 784: // If there are topics in this forum. | 774: // If there are topics in this forum |
| 785: if ($db->num_rows($result)) | 775: if ($db->num_rows($result)) |
| 786: { | 776: { |
| 787: $button_status = ''; | 777: $button_status = ''; |
| 824: $item_status .= ' inew'; | 814: $item_status .= ' inew'; |
| 825: $icon_type = 'icon inew'; | 815: $icon_type = 'icon inew'; |
| 826: $subject = '<strong>'.$subject.'</strong>'; | 816: $subject = '<strong>'.$subject.'</strong>'; |
| 827: $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>'; | 817: $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>'; |
| 828: } | 818: } |
| 829: else | 819: else |
| 830: $subject_new_posts = null; | 820: $subject_new_posts = null; |
| 831: | 821: |
| 832: // We won't display "the dot", but we add the spaces anyway | |
| 833: if ($pun_config['o_show_dot'] == '1') | |
| 834: $subject = ' '.$subject; | |
| 835: | |
| 836: if ($cur_topic['sticky'] == '1') | 822: if ($cur_topic['sticky'] == '1') |
| 837: { | 823: { |
| 838: $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject; | 824: $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject; |
| 843: $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']); | 829: $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']); |
| 844: | 830: |
| 845: if ($num_pages_topic > 1) | 831: if ($num_pages_topic > 1) |
| 846: $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]'; | 832: $subject_multipage = '<span class="pagestext">[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]</span>'; |
| 847: else | 833: else |
| 848: $subject_multipage = null; | 834: $subject_multipage = null; |
| 849: | 835: |
| 850: // Should we show the "New posts" and/or the multipage links? | 836: // Should we show the "New posts" and/or the multipage links? |
| 851: if (!empty($subject_new_posts) || !empty($subject_multipage)) | 837: if (!empty($subject_new_posts) || !empty($subject_multipage)) |
| 852: { | 838: { |
| 853: $subject .= ' '.(!empty($subject_new_posts) ? $subject_new_posts : ''); | 839: $subject .= !empty($subject_new_posts) ? ' '.$subject_new_posts : ''; |
| 854: $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : ''; | 840: $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : ''; |
| 855: } | 841: } |
| 856: | 842: |
| 859: <td class="tcl"> | 845: <td class="tcl"> |
| 860: <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div> | 846: <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div> |
| 861: <div class="tclcon"> | 847: <div class="tclcon"> |
| 862: <?php echo $subject."\n" ?> | 848: <div> |
| | 849: <?php echo $subject."\n" ?> |
| | 850: </div> |
| 863: </div> | 851: </div> |
| 864: </td> | 852: </td> |
| 865: <td class="tc2"><?php echo (!$ghost_topic) ? forum_number_format($cur_topic['num_replies']) : ' ' ?></td> | 853: <td class="tc2"><?php echo (!$ghost_topic) ? forum_number_format($cur_topic['num_replies']) : ' ' ?></td> |
| 888: <div class="linksb"> | 876: <div class="linksb"> |
| 889: <div class="inbox"> | 877: <div class="inbox"> |
| 890: <p class="pagelink conl"><?php echo $paging_links ?></p> | 878: <p class="pagelink conl"><?php echo $paging_links ?></p> |
| 891: <p class="conr"><input type="submit" name="move_topics" value="<?php echo $lang_misc['Move'] ?>"<?php echo $button_status ?> /> <input type="submit" name="delete_topics" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /> <input type="submit" name="merge_topics" value="<?php echo $lang_misc['Merge'] ?>"<?php echo $button_status ?> /> <input type="submit" name="open" value="<?php echo $lang_misc['Open'] ?>"<?php echo $button_status ?> /> <input type="submit" name="close" value="<?php echo $lang_misc['Close'] ?>"<?php echo $button_status ?> /></p> | 879: <p class="conr modbuttons"><input type="submit" name="move_topics" value="<?php echo $lang_misc['Move'] ?>"<?php echo $button_status ?> /> <input type="submit" name="delete_topics" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /> <input type="submit" name="merge_topics" value="<?php echo $lang_misc['Merge'] ?>"<?php echo $button_status ?> /> <input type="submit" name="open" value="<?php echo $lang_misc['Open'] ?>"<?php echo $button_status ?> /> <input type="submit" name="close" value="<?php echo $lang_misc['Close'] ?>"<?php echo $button_status ?> /></p> |
| 892: <div class="clearer"></div> | 880: <div class="clearer"></div> |
| 893: </div> | 881: </div> |
| 894: </div> | 882: </div> |
| a/upload/post.php |
b/upload/post.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: define('PUN_ROOT', './'); | 11: define('PUN_ROOT', './'); |
| 27: require PUN_ROOT.'include/common.php'; | 12: require PUN_ROOT.'include/common.php'; |
| 38: | 23: |
| 39: // Fetch some info about the topic and/or the forum | 24: // Fetch some info about the topic and/or the forum |
| 40: if ($tid) | 25: if ($tid) |
| 41: $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed 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 t.id='.$tid) 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, t.subject, t.closed, s.user_id AS is_subscribed 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'].') LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); |
| 42: else | 27: else |
| 43: $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()); | 28: $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()); |
| 44: | 29: |
| 46: message($lang_common['Bad request']); | 31: message($lang_common['Bad request']); |
| 47: | 32: |
| 48: $cur_posting = $db->fetch_assoc($result); | 33: $cur_posting = $db->fetch_assoc($result); |
| | 34: $is_subscribed = $tid && $cur_posting['is_subscribed']; |
| 49: | 35: |
| 50: // Is someone trying to post into a redirect forum? | 36: // Is someone trying to post into a redirect forum? |
| 51: if ($cur_posting['redirect_url'] != '') | 37: if ($cur_posting['redirect_url'] != '') |
| 89: $errors[] = $lang_post['No subject']; | 75: $errors[] = $lang_post['No subject']; |
| 90: else if (pun_strlen($subject) > 70) | 76: else if (pun_strlen($subject) > 70) |
| 91: $errors[] = $lang_post['Too long subject']; | 77: $errors[] = $lang_post['Too long subject']; |
| 92: else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_user['is_admmod']) | 78: else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod']) |
| 93: $subject = ucwords(strtolower($subject)); | 79: $errors[] = $lang_post['All caps subject']; |
| 94: } | 80: } |
| 95: | 81: |
| 96: // If the user is logged in we get the username and e-mail from $pun_user | 82: // If the user is logged in we get the username and email from $pun_user |
| 97: if (!$pun_user['is_guest']) | 83: if (!$pun_user['is_guest']) |
| 98: { | 84: { |
| 99: $username = $pun_user['username']; | 85: $username = $pun_user['username']; |
| 112: // It's a guest, so we have to validate the username | 98: // It's a guest, so we have to validate the username |
| 113: if (strlen($username) < 2) | 99: if (strlen($username) < 2) |
| 114: $errors[] = $lang_prof_reg['Username too short']; | 100: $errors[] = $lang_prof_reg['Username too short']; |
| 115: else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters | 101: else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
| 116: $errors[] = $lang_prof_reg['Username too long']; | 102: $errors[] = $lang_prof_reg['Username too long']; |
| 117: else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) | 103: else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) |
| 118: $errors[] = $lang_prof_reg['Username guest']; | 104: $errors[] = $lang_prof_reg['Username guest']; |
| 119: else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $username)) | 105: else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $username)) |
| 120: $errors[] = $lang_prof_reg['Username IP']; | 106: $errors[] = $lang_prof_reg['Username IP']; |
| 121: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) | 107: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
| 122: $errors[] = $lang_prof_reg['Username reserved chars']; | 108: $errors[] = $lang_prof_reg['Username reserved chars']; |
| 123: else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username)) | 109: else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $username)) |
| 124: $errors[] = $lang_prof_reg['Username BBCode']; | 110: $errors[] = $lang_prof_reg['Username BBCode']; |
| 125: | 111: |
| 126: // Check username for any censored words | 112: // Check username for any censored words |
| 140: { | 126: { |
| 141: require PUN_ROOT.'include/email.php'; | 127: require PUN_ROOT.'include/email.php'; |
| 142: if (!is_valid_email($email)) | 128: if (!is_valid_email($email)) |
| 143: $errors[] = $lang_common['Invalid e-mail']; | 129: $errors[] = $lang_common['Invalid email']; |
| | 130: |
| | 131: // Check if it's a banned email address |
| | 132: // we should only check guests because members addresses are already verified |
| | 133: if ($pun_user['is_guest'] && is_banned_email($email)) |
| | 134: { |
| | 135: if ($pun_config['p_allow_banned_email'] == '0') |
| | 136: $errors[] = $lang_prof_reg['Banned email']; |
| | 137: |
| | 138: $banned_email = true; // Used later when we send an alert email |
| | 139: } |
| | 140: else |
| | 141: $banned_email = false; |
| 144: } | 142: } |
| 145: } | 143: } |
| 146: | 144: |
| 151: $errors[] = $lang_post['No message']; | 149: $errors[] = $lang_post['No message']; |
| 152: else if (strlen($message) > 65535) | 150: else if (strlen($message) > 65535) |
| 153: $errors[] = $lang_post['Too long message']; | 151: $errors[] = $lang_post['Too long message']; |
| 154: else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_user['is_admmod']) | 152: else if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod']) |
| 155: $message = ucwords(strtolower($message)); | 153: $errors[] = $lang_post['All caps message']; |
| 156: | 154: |
| 157: // Validate BBCode syntax | 155: // Validate BBCode syntax |
| 158: if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false) | 156: if ($pun_config['p_message_bbcode'] == '1') |
| 159: { | 157: { |
| 160: require PUN_ROOT.'include/parser.php'; | 158: require PUN_ROOT.'include/parser.php'; |
| 161: $message = preparse_bbcode($message, $errors); | 159: $message = preparse_bbcode($message, $errors); |
| 178: if (!$pun_user['is_guest']) | 176: if (!$pun_user['is_guest']) |
| 179: { | 177: { |
| 180: $new_tid = $tid; | 178: $new_tid = $tid; |
| 181: | 179: |
| 182: // Insert the new post | 180: // Insert the new post |
| 183: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); | 181: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); |
| 184: $new_pid = $db->insert_id(); | 182: $new_pid = $db->insert_id(); |
| 185: | 183: |
| 186: // To subscribe or not to subscribe, that ... | 184: // To subscribe or not to subscribe, that ... |
| 187: if ($pun_config['o_subscriptions'] == '1' && $subscribe) | 185: if ($pun_config['o_subscriptions'] == '1') |
| 188: { | 186: { |
| 189: $result = $db->query('SELECT 1 FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error()); | 187: if ($subscribe && !$is_subscribed) |
| 190: if (!$db->num_rows($result)) | |
| 191: $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error()); | 188: $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error()); |
| | 189: else if (!$subscribe && $is_subscribed) |
| | 190: $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error()); |
| 192: } | 191: } |
| 193: } | 192: } |
| 194: else | 193: else |
| 195: { | 194: { |
| 196: // It's a guest. Insert the new post | 195: // It's a guest. Insert the new post |
| 197: $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL'; | 196: $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL'; |
| 198: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); | 197: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); |
| 199: $new_pid = $db->insert_id(); | 198: $new_pid = $db->insert_id(); |
| 200: } | 199: } |
| 201: | 200: |
| 225: | 224: |
| 226: $notification_emails = array(); | 225: $notification_emails = array(); |
| 227: | 226: |
| 228: // Loop through subscribed users and send e-mails | 227: // Loop through subscribed users and send emails |
| 229: while ($cur_subscriber = $db->fetch_assoc($result)) | 228: while ($cur_subscriber = $db->fetch_assoc($result)) |
| 230: { | 229: { |
| 231: // Is the subscription e-mail for $cur_subscriber['language'] cached or not? | 230: // Is the subscription email for $cur_subscriber['language'] cached or not? |
| 232: if (!isset($notification_emails[$cur_subscriber['language']])) | 231: if (!isset($notification_emails[$cur_subscriber['language']])) |
| 233: { | 232: { |
| 234: if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl')) | 233: if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl')) |
| 294: if (!$pun_user['is_guest']) | 293: if (!$pun_user['is_guest']) |
| 295: { | 294: { |
| 296: // To subscribe or not to subscribe, that ... | 295: // To subscribe or not to subscribe, that ... |
| 297: if ($pun_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1')) | 296: if ($pun_config['o_subscriptions'] == '1' && $subscribe) |
| 298: $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error()); | 297: $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error()); |
| 299: | 298: |
| 300: // Create the post ("topic post") | 299: // Create the post ("topic post") |
| 301: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); | 300: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); |
| 302: } | 301: } |
| 303: else | 302: else |
| 304: { | 303: { |
| 305: // Create the post ("topic post") | 304: // Create the post ("topic post") |
| 306: $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL'; | 305: $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL'; |
| 307: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); | 306: $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error()); |
| 308: } | 307: } |
| 309: $new_pid = $db->insert_id(); | 308: $new_pid = $db->insert_id(); |
| 310: | 309: |
| 316: update_forum($fid); | 315: update_forum($fid); |
| 317: } | 316: } |
| 318: | 317: |
| | 318: // If we previously found out that the email was banned |
| | 319: if ($pun_user['is_guest'] && $banned_email && $pun_config['o_mailing_list'] != '') |
| | 320: { |
| | 321: $mail_subject = $lang_common['Banned email notification']; |
| | 322: $mail_message = sprintf($lang_common['Banned email post message'], $username, $email)."\n"; |
| | 323: $mail_message .= sprintf($lang_common['Post URL'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid)."\n"; |
| | 324: $mail_message .= "\n".'--'."\n".$lang_common['Email signature']; |
| | 325: |
| | 326: pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
| | 327: } |
| | 328: |
| 319: // If the posting user is logged in, increment his/her post count | 329: // If the posting user is logged in, increment his/her post count |
| 320: if (!$pun_user['is_guest']) | 330: if (!$pun_user['is_guest']) |
| 321: { | 331: { |
| 322: $db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); | 332: $db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); |
| 323: | 333: |
| 324: $tracked_topics = get_tracked_topics(); | 334: $tracked_topics = get_tracked_topics(); |
| 325: $tracked_topics['topics'][$new_tid] = time(); | 335: $tracked_topics['topics'][$new_tid] = time(); |
| 326: set_tracked_topics($tracked_topics); | 336: set_tracked_topics($tracked_topics); |
| 327: } | 337: } |
| 328: else | 338: else |
| 329: { | 339: { |
| 335: } | 345: } |
| 336: | 346: |
| 337: | 347: |
| 338: // If a topic id was specified in the url (it's a reply). | 348: // If a topic ID was specified in the url (it's a reply) |
| 339: if ($tid) | 349: if ($tid) |
| 340: { | 350: { |
| 341: $action = $lang_post['Post a reply']; | 351: $action = $lang_post['Post a reply']; |
| 342: $form = '<form id="post" method="post" action="post.php?action=post&tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">'; | 352: $form = '<form id="post" method="post" action="post.php?action=post&tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">'; |
| 343: | 353: |
| 344: // If a quote-id was specified in the url. | 354: // If a quote ID was specified in the url |
| 345: if (isset($_GET['qid'])) | 355: if (isset($_GET['qid'])) |
| 346: { | 356: { |
| 347: $qid = intval($_GET['qid']); | 357: $qid = intval($_GET['qid']); |
| 388: | 398: |
| 389: $forum_name = '<a href="viewforum.php?id='.$cur_posting['id'].'">'.pun_htmlspecialchars($cur_posting['forum_name']).'</a>'; | 399: $forum_name = '<a href="viewforum.php?id='.$cur_posting['id'].'">'.pun_htmlspecialchars($cur_posting['forum_name']).'</a>'; |
| 390: } | 400: } |
| 391: // If a forum_id was specified in the url (new topic). | 401: // If a forum ID was specified in the url (new topic) |
| 392: else if ($fid) | 402: else if ($fid) |
| 393: { | 403: { |
| 394: $action = $lang_post['Post new topic']; | 404: $action = $lang_post['Post new topic']; |
| 401: | 411: |
| 402: | 412: |
| 403: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$action; | 413: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$action; |
| 404: $required_fields = array('req_email' => $lang_common['E-mail'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']); | 414: $required_fields = array('req_email' => $lang_common['Email'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']); |
| 405: $focus_element = array('post'); | 415: $focus_element = array('post'); |
| 406: | 416: |
| 407: if (!$pun_user['is_guest']) | 417: if (!$pun_user['is_guest']) |
| 417: ?> | 427: ?> |
| 418: <div class="linkst"> | 428: <div class="linkst"> |
| 419: <div class="inbox"> | 429: <div class="inbox"> |
| 420: <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li> » <?php echo $forum_name ?><?php if (isset($cur_posting['subject'])) echo '</li><li> » '.pun_htmlspecialchars($cur_posting['subject']) ?></li></ul> | 430: <ul class="crumbs"> |
| | 431: <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li> |
| | 432: <li>» <?php echo $forum_name ?></li> |
| | 433: <?php if (isset($cur_posting['subject'])): ?> <li>» <?php echo pun_htmlspecialchars($cur_posting['subject']) ?></li> |
| | 434: <?php endif; ?> </ul> |
| 421: </div> | 435: </div> |
| 422: </div> | 436: </div> |
| 423: | 437: |
| 457: <h2><span><?php echo $lang_post['Post preview'] ?></span></h2> | 471: <h2><span><?php echo $lang_post['Post preview'] ?></span></h2> |
| 458: <div class="box"> | 472: <div class="box"> |
| 459: <div class="inbox"> | 473: <div class="inbox"> |
| 460: <div class="postright"> | 474: <div class="postbody"> |
| 461: <div class="postmsg"> | 475: <div class="postright"> |
| 462: <?php echo $preview_message."\n" ?> | 476: <div class="postmsg"> |
| | 477: <?php echo $preview_message."\n" ?> |
| | 478: </div> |
| 463: </div> | 479: </div> |
| 464: </div> | 480: </div> |
| 465: </div> | 481: </div> |
| 488: | 504: |
| 489: if ($pun_user['is_guest']) | 505: if ($pun_user['is_guest']) |
| 490: { | 506: { |
| 491: $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].'</strong>' : $lang_common['E-mail']; | 507: $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['Email'].'</strong>' : $lang_common['Email']; |
| 492: $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email'; | 508: $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email'; |
| 493: | 509: |
| 494: ?> <label class="conl"><strong><?php echo $lang_post['Guest name'] ?></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label> | 510: ?> <label class="conl"><strong><?php echo $lang_post['Guest name'] ?></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label> |
| 518: $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies']; | 534: $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies']; |
| 519: | 535: |
| 520: if ($pun_config['o_subscriptions'] == '1') | 536: if ($pun_config['o_subscriptions'] == '1') |
| 521: $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['subscribe']) || $pun_user['auto_notify'] == '1' ? ' checked="checked"' : '').' />'.$lang_post['Subscribe']; | 537: { |
| | 538: $subscr_checked = false; |
| | 539: |
| | 540: // If it's a preview |
| | 541: if (isset($_POST['preview'])) |
| | 542: $subscr_checked = isset($_POST['subscribe']) ? true : false; |
| | 543: // If auto subscribed |
| | 544: else if ($pun_user['auto_notify']) |
| | 545: $subscr_checked = true; |
| | 546: // If already subscribed to the topic |
| | 547: else if ($is_subscribed) |
| | 548: $subscr_checked = true; |
| | 549: |
| | 550: $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.($subscr_checked ? ' checked="checked"' : '').' />'.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']); |
| | 551: } |
| 522: } | 552: } |
| 523: else if ($pun_config['o_smilies'] == '1') | 553: else if ($pun_config['o_smilies'] == '1') |
| 524: $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies']; | 554: $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies']; |
| 533: <legend><?php echo $lang_common['Options'] ?></legend> | 563: <legend><?php echo $lang_common['Options'] ?></legend> |
| 534: <div class="infldset"> | 564: <div class="infldset"> |
| 535: <div class="rbox"> | 565: <div class="rbox"> |
| 536: <?php echo implode('<br /></label>'."\n\t\t\t\t", $checkboxes).'<br /></label>'."\n" ?> | 566: <?php echo implode('<br /></label>'."\n\t\t\t\t\t\t\t", $checkboxes).'<br /></label>'."\n" ?> |
| 537: </div> | 567: </div> |
| 538: </div> | 568: </div> |
| 539: </fieldset> | 569: </fieldset> |
| 543: | 573: |
| 544: ?> | 574: ?> |
| 545: </div> | 575: </div> |
| 546: <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 576: <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 547: </form> | 577: </form> |
| 548: </div> | 578: </div> |
| 549: </div> | 579: </div> |
| 550: | 580: |
| 551: <?php | 581: <?php |
| 552: | 582: |
| 553: // Check to see if the topic review is to be displayed. | 583: // Check to see if the topic review is to be displayed |
| 554: if ($tid && $pun_config['o_topic_review'] != '0') | 584: if ($tid && $pun_config['o_topic_review'] != '0') |
| 555: { | 585: { |
| 556: require_once PUN_ROOT.'include/parser.php'; | 586: require_once PUN_ROOT.'include/parser.php'; |
| 564: <?php | 594: <?php |
| 565: | 595: |
| 566: //Set background switching on | 596: //Set background switching on |
| 567: $bg_switch = true; | |
| 568: $post_count = 0; | 597: $post_count = 0; |
| 569: | 598: |
| 570: while ($cur_post = $db->fetch_assoc($result)) | 599: while ($cur_post = $db->fetch_assoc($result)) |
| 571: { | 600: { |
| 572: // Switch the background color for every message. | |
| 573: $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true; | |
| 574: $vtbg = ($bg_switch) ? ' roweven' : ' rowodd'; | |
| 575: $post_count++; | 601: $post_count++; |
| 576: | 602: |
| 577: $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); | 603: $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); |
| 578: | 604: |
| 579: ?> | 605: ?> |
| 580: <div class="box<?php echo $vtbg ?>"> | 606: <div class="box<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>"> |
| 581: <div class="inbox"> | 607: <div class="inbox"> |
| 582: <div class="postleft"> | 608: <div class="postbody"> |
| 583: <dl> | 609: <div class="postleft"> |
| 584: <dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt> | 610: <dl> |
| 585: <dd><?php echo format_time($cur_post['posted']) ?></dd> | 611: <dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt> |
| 586: </dl> | 612: <dd><?php echo format_time($cur_post['posted']) ?></dd> |
| 587: </div> | 613: </dl> |
| 588: <div class="postright"> | 614: </div> |
| 589: <div class="postmsg"> | 615: <div class="postright"> |
| 590: <?php echo $cur_post['message'] ?> | 616: <div class="postmsg"> |
| | 617: <?php echo $cur_post['message']."\n" ?> |
| | 618: </div> |
| 591: </div> | 619: </div> |
| 592: </div> | 620: </div> |
| 593: <div class="clearer"></div> | 621: <div class="clearer"></div> |
| a/upload/profile.php |
b/upload/profile.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: define('PUN_ROOT', './'); | 11: define('PUN_ROOT', './'); |
| 27: require PUN_ROOT.'include/common.php'; | 12: require PUN_ROOT.'include/common.php'; |
| 77: // Make sure we are allowed to change this users password | 62: // Make sure we are allowed to change this users password |
| 78: if ($pun_user['id'] != $id) | 63: if ($pun_user['id'] != $id) |
| 79: { | 64: { |
| 80: if (!$pun_user['is_admmod']) // A regular user trying to change another users password? | 65: if (!$pun_user['is_admmod']) // A regular user trying to change another users password? |
| 81: message($lang_common['No permission']); | 66: message($lang_common['No permission']); |
| 82: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users password? | 67: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users password? |
| 83: { | 68: { |
| 84: $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()); | 69: $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()); |
| 85: if (!$db->num_rows($result)) | 70: if (!$db->num_rows($result)) |
| 116: $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false; | 101: $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false; |
| 117: $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false; | 102: $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false; |
| 118: | 103: |
| 119: $old_password_hash = pun_hash($old_password); // This could result in either an SHA-1 or an MD5 hash | 104: $old_password_hash = pun_hash($old_password); // This could result in either an SHA-1 or an MD5 hash |
| 120: | 105: |
| 121: if (($sha1_in_db && $sha1_available && $db_password_hash == $old_password_hash) || | 106: if (($sha1_in_db && $sha1_available && $db_password_hash == $old_password_hash) || |
| 122: (!$sha1_in_db && $db_password_hash == md5($old_password)) || | 107: (!$sha1_in_db && $db_password_hash == md5($old_password)) || |
| 164: </div> | 149: </div> |
| 165: </fieldset> | 150: </fieldset> |
| 166: </div> | 151: </div> |
| 167: <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 152: <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 168: </form> | 153: </form> |
| 169: </div> | 154: </div> |
| 170: </div> | 155: </div> |
| 176: | 161: |
| 177: else if ($action == 'change_email') | 162: else if ($action == 'change_email') |
| 178: { | 163: { |
| 179: // Make sure we are allowed to change this users e-mail | 164: // Make sure we are allowed to change this users email |
| 180: if ($pun_user['id'] != $id) | 165: if ($pun_user['id'] != $id) |
| 181: { | 166: { |
| 182: if (!$pun_user['is_admmod']) // A regular user trying to change another users e-mail? | 167: if (!$pun_user['is_admmod']) // A regular user trying to change another users email? |
| 183: message($lang_common['No permission']); | 168: message($lang_common['No permission']); |
| 184: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users e-mail? | 169: else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users email? |
| 185: { | 170: { |
| 186: $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()); | 171: $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()); |
| 187: if (!$db->num_rows($result)) | 172: if (!$db->num_rows($result)) |
| 202: list($new_email, $new_email_key) = $db->fetch_row($result); | 187: list($new_email, $new_email_key) = $db->fetch_row($result); |
| 203: | 188: |
| 204: if ($key == '' || $key != $new_email_key) | 189: if ($key == '' || $key != $new_email_key) |
| 205: message($lang_profile['E-mail key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); | 190: message($lang_profile['Email key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); |
| 206: else | 191: else |
| 207: { | 192: { |
| 208: $db->query('UPDATE '.$db->prefix.'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Unable to update e-mail address', __FILE__, __LINE__, $db->error()); | 193: $db->query('UPDATE '.$db->prefix.'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Unable to update email address', __FILE__, __LINE__, $db->error()); |
| 209: | 194: |
| 210: message($lang_profile['E-mail updated'], true); | 195: message($lang_profile['Email updated'], true); |
| 211: } | 196: } |
| 212: } | 197: } |
| 213: else if (isset($_POST['form_sent'])) | 198: else if (isset($_POST['form_sent'])) |
| 217: | 202: |
| 218: require PUN_ROOT.'include/email.php'; | 203: require PUN_ROOT.'include/email.php'; |
| 219: | 204: |
| 220: // Validate the email-address | 205: // Validate the email address |
| 221: $new_email = strtolower(trim($_POST['req_new_email'])); | 206: $new_email = strtolower(trim($_POST['req_new_email'])); |
| 222: if (!is_valid_email($new_email)) | 207: if (!is_valid_email($new_email)) |
| 223: message($lang_common['Invalid e-mail']); | 208: message($lang_common['Invalid email']); |
| 224: | 209: |
| 225: // Check if it's a banned e-mail address | 210: // Check if it's a banned email address |
| 226: if (is_banned_email($new_email)) | 211: if (is_banned_email($new_email)) |
| 227: { | 212: { |
| 228: if ($pun_config['p_allow_banned_email'] == '0') | 213: if ($pun_config['p_allow_banned_email'] == '0') |
| 229: message($lang_prof_reg['Banned e-mail']); | 214: message($lang_prof_reg['Banned email']); |
| 230: else if ($pun_config['o_mailing_list'] != '') | 215: else if ($pun_config['o_mailing_list'] != '') |
| 231: { | 216: { |
| 232: $mail_subject = $lang_common['Banned email notification']; | 217: $mail_subject = $lang_common['Banned email notification']; |
| 233: $mail_message = sprintf($lang_common['Banned email change message'], $pun_user['username'], $new_email)."\n"; | 218: $mail_message = sprintf($lang_common['Banned email change message'], $pun_user['username'], $new_email)."\n"; |
| 234: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n"; | 219: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n"; |
| 238: } | 223: } |
| 239: } | 224: } |
| 240: | 225: |
| 241: // Check if someone else already has registered with that e-mail address | 226: // Check if someone else already has registered with that email address |
| 242: $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($new_email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 227: $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($new_email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 243: if ($db->num_rows($result)) | 228: if ($db->num_rows($result)) |
| 244: { | 229: { |
| 245: if ($pun_config['p_allow_dupe_email'] == '0') | 230: if ($pun_config['p_allow_dupe_email'] == '0') |
| 246: message($lang_prof_reg['Dupe e-mail']); | 231: message($lang_prof_reg['Dupe email']); |
| 247: else if ($pun_config['o_mailing_list'] != '') | 232: else if ($pun_config['o_mailing_list'] != '') |
| 248: { | 233: { |
| 249: while ($cur_dupe = $db->fetch_assoc($result)) | 234: while ($cur_dupe = $db->fetch_assoc($result)) |
| 250: $dupe_list[] = $cur_dupe['username']; | 235: $dupe_list[] = $cur_dupe['username']; |
| 251: | 236: |
| 252: $mail_subject = $lang_common['Duplicate email notification']; | 237: $mail_subject = $lang_common['Duplicate email notification']; |
| 253: $mail_message = sprintf($lang_common['Duplicate email change message'], $pun_user['username'], implode(', ', $dupe_list))."\n"; | 238: $mail_message = sprintf($lang_common['Duplicate email change message'], $pun_user['username'], implode(', ', $dupe_list))."\n"; |
| 254: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n"; | 239: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n"; |
| 263: | 248: |
| 264: $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$db->escape($new_email).'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Unable to update activation data', __FILE__, __LINE__, $db->error()); | 249: $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$db->escape($new_email).'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Unable to update activation data', __FILE__, __LINE__, $db->error()); |
| 265: | 250: |
| 266: // Load the "activate e-mail" template | 251: // Load the "activate email" template |
| 267: $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl')); | 252: $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl')); |
| 268: | 253: |
| 269: // The first row contains the subject | 254: // The first row contains the subject |
| 278: | 263: |
| 279: pun_mail($new_email, $mail_subject, $mail_message); | 264: pun_mail($new_email, $mail_subject, $mail_message); |
| 280: | 265: |
| 281: message($lang_profile['Activate e-mail sent'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true); | 266: message($lang_profile['Activate email sent'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true); |
| 282: } | 267: } |
| 283: | 268: |
| 284: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; | 269: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
| 285: $required_fields = array('req_new_email' => $lang_profile['New e-mail'], 'req_password' => $lang_common['Password']); | 270: $required_fields = array('req_new_email' => $lang_profile['New email'], 'req_password' => $lang_common['Password']); |
| 286: $focus_element = array('change_email', 'req_new_email'); | 271: $focus_element = array('change_email', 'req_new_email'); |
| 287: require PUN_ROOT.'header.php'; | 272: require PUN_ROOT.'header.php'; |
| 288: | 273: |
| 289: ?> | 274: ?> |
| 290: <div class="blockform"> | 275: <div class="blockform"> |
| 291: <h2><span><?php echo $lang_profile['Change e-mail'] ?></span></h2> | 276: <h2><span><?php echo $lang_profile['Change email'] ?></span></h2> |
| 292: <div class="box"> | 277: <div class="box"> |
| 293: <form id="change_email" method="post" action="profile.php?action=change_email&id=<?php echo $id ?>" id="change_email" onsubmit="return process_form(this)"> | 278: <form id="change_email" method="post" action="profile.php?action=change_email&id=<?php echo $id ?>" id="change_email" onsubmit="return process_form(this)"> |
| 294: <div class="inform"> | 279: <div class="inform"> |
| 295: <fieldset> | 280: <fieldset> |
| 296: <legend><?php echo $lang_profile['E-mail legend'] ?></legend> | 281: <legend><?php echo $lang_profile['Email legend'] ?></legend> |
| 297: <div class="infldset"> | 282: <div class="infldset"> |
| 298: <input type="hidden" name="form_sent" value="1" /> | 283: <input type="hidden" name="form_sent" value="1" /> |
| 299: <label><strong><?php echo $lang_profile['New e-mail'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label> | 284: <label><strong><?php echo $lang_profile['New email'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label> |
| 300: <label><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" /><br /></label> | 285: <label><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" /><br /></label> |
| 301: <p><?php echo $lang_profile['E-mail instructions'] ?></p> | 286: <p><?php echo $lang_profile['Email instructions'] ?></p> |
| 302: </div> | 287: </div> |
| 303: </fieldset> | 288: </fieldset> |
| 304: </div> | 289: </div> |
| 305: <p><input type="submit" name="new_email" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 290: <p class="buttons"><input type="submit" name="new_email" value="<?php echo $lang_common['Submit'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 306: </form> | 291: </form> |
| 307: </div> | 292: </div> |
| 308: </div> | 293: </div> |
| 324: { | 309: { |
| 325: if (!isset($_FILES['req_file'])) | 310: if (!isset($_FILES['req_file'])) |
| 326: message($lang_profile['No file']); | 311: message($lang_profile['No file']); |
| 327: | 312: |
| 328: $uploaded_file = $_FILES['req_file']; | 313: $uploaded_file = $_FILES['req_file']; |
| 329: | 314: |
| 330: // Make sure the upload went smooth | 315: // Make sure the upload went smooth |
| 332: { | 317: { |
| 333: switch ($uploaded_file['error']) | 318: switch ($uploaded_file['error']) |
| 334: { | 319: { |
| 335: case 1: // UPLOAD_ERR_INI_SIZE | 320: case 1: // UPLOAD_ERR_INI_SIZE |
| 336: case 2: // UPLOAD_ERR_FORM_SIZE | 321: case 2: // UPLOAD_ERR_FORM_SIZE |
| 337: message($lang_profile['Too large ini']); | 322: message($lang_profile['Too large ini']); |
| 338: break; | 323: break; |
| 339: | 324: |
| 340: case 3: // UPLOAD_ERR_PARTIAL | 325: case 3: // UPLOAD_ERR_PARTIAL |
| 341: message($lang_profile['Partial upload']); | 326: message($lang_profile['Partial upload']); |
| 342: break; | 327: break; |
| 343: | 328: |
| 344: case 4: // UPLOAD_ERR_NO_FILE | 329: case 4: // UPLOAD_ERR_NO_FILE |
| 345: message($lang_profile['No file']); | 330: message($lang_profile['No file']); |
| 346: break; | 331: break; |
| 347: | 332: |
| 348: case 6: // UPLOAD_ERR_NO_TMP_DIR | 333: case 6: // UPLOAD_ERR_NO_TMP_DIR |
| 349: message($lang_profile['No tmp directory']); | 334: message($lang_profile['No tmp directory']); |
| 350: break; | 335: break; |
| 351: | 336: |
| 368: if ($uploaded_file['size'] > $pun_config['o_avatars_size']) | 353: if ($uploaded_file['size'] > $pun_config['o_avatars_size']) |
| 369: message($lang_profile['Too large'].' '.forum_number_format($pun_config['o_avatars_size']).' '.$lang_profile['bytes'].'.'); | 354: message($lang_profile['Too large'].' '.forum_number_format($pun_config['o_avatars_size']).' '.$lang_profile['bytes'].'.'); |
| 370: | 355: |
| 371: // Move the file to the avatar directory. We do this before checking the width/height to circumvent open_basedir restrictions. | 356: // Move the file to the avatar directory. We do this before checking the width/height to circumvent open_basedir restrictions |
| 372: if (!@move_uploaded_file($uploaded_file['tmp_name'], $pun_config['o_avatars_dir'].'/'.$id.'.tmp')) | 357: if (!@move_uploaded_file($uploaded_file['tmp_name'], $pun_config['o_avatars_dir'].'/'.$id.'.tmp')) |
| 373: message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); | 358: message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); |
| 374: | 359: |
| 428: </div> | 413: </div> |
| 429: </fieldset> | 414: </fieldset> |
| 430: </div> | 415: </div> |
| 431: <p><input type="submit" name="upload" value="<?php echo $lang_profile['Upload'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 416: <p class="buttons"><input type="submit" name="upload" value="<?php echo $lang_profile['Upload'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 432: </form> | 417: </form> |
| 433: </div> | 418: </div> |
| 434: </div> | 419: </div> |
| 640: </div> | 625: </div> |
| 641: </fieldset> | 626: </fieldset> |
| 642: </div> | 627: </div> |
| 643: <p><input type="submit" name="delete_user_comply" value="<?php echo $lang_profile['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> | 628: <p class="buttons"><input type="submit" name="delete_user_comply" value="<?php echo $lang_profile['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
| 644: </form> | 629: </form> |
| 645: </div> | 630: </div> |
| 646: </div> | 631: </div> |
| 675: | 660: |
| 676: while (list($key, $value) = @each($_POST['form'])) | 661: while (list($key, $value) = @each($_POST['form'])) |
| 677: { | 662: { |
| 678: if (in_array($key, $allowed_elements)) | 663: if (in_array($key, $allowed_elements)) |
| 679: $form[$key] = $value; | 664: $form[$key] = $value; |
| 680: } | 665: } |
| 681: | 666: |
| 682: return $form; | 667: return $form; |
| 703: | 688: |
| 704: if (strlen($form['username']) < 2) | 689: if (strlen($form['username']) < 2) |
| 705: message($lang_prof_reg['Username too short']); | 690: message($lang_prof_reg['Username too short']); |
| 706: else if (pun_strlen($form['username']) > 25) // This usually doesn't happen since the form element only accepts 25 characters | 691: else if (pun_strlen($form['username']) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
| 707: message($lang_common['Bad request']); | 692: message($lang_common['Bad request']); |
| 708: else if (!strcasecmp($form['username'], 'Guest') || !strcasecmp($form['username'], $lang_common['Guest'])) | 693: else if (!strcasecmp($form['username'], 'Guest') || !strcasecmp($form['username'], $lang_common['Guest'])) |
| 709: message($lang_prof_reg['Username guest']); | 694: message($lang_prof_reg['Username guest']); |
| 710: else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $form['username']) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $form['username'])) | 695: else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $form['username']) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $form['username'])) |
| 711: message($lang_prof_reg['Username IP']); | 696: message($lang_prof_reg['Username IP']); |
| 712: else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $form['username'])) | 697: else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $form['username'])) |
| 713: message($lang_prof_reg['Username BBCode']); | 698: message($lang_prof_reg['Username BBCode']); |
| 714: | 699: |
| 715: // Check that the username is not already registered | 700: // Check that the username is not already registered |
| 730: { | 715: { |
| 731: require PUN_ROOT.'include/email.php'; | 716: require PUN_ROOT.'include/email.php'; |
| 732: | 717: |
| 733: // Validate the email-address | 718: // Validate the email address |
| 734: $form['email'] = strtolower(trim($_POST['req_email'])); | 719: $form['email'] = strtolower(trim($_POST['req_email'])); |
| 735: if (!is_valid_email($form['email'])) | 720: if (!is_valid_email($form['email'])) |
| 736: message($lang_common['Invalid e-mail']); | 721: message($lang_common['Invalid email']); |
| 737: } | 722: } |
| 738: | 723: |
| 739: // Make sure we got a valid language string | 724: // Make sure we got a valid language string |
| 805: message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.'); | 790: message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.'); |
| 806: else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1)) | 791: else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1)) |
| 807: message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.'); | 792: message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.'); |
| 808: else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && strtoupper($form['signature']) == $form['signature'] && !$pun_user['is_admmod']) | 793: else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && is_all_uppercase($form['signature']) && !$pun_user['is_admmod']) |
| 809: $form['signature'] = ucwords(strtolower($form['signature'])); | 794: $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature'])); |
| 810: | 795: |
| 811: // Validate BBCode syntax | 796: // Validate BBCode syntax |
| 812: if ($pun_config['p_sig_bbcode'] == '1' && strpos($form['signature'], '[') !== false && strpos($form['signature'], ']') !== false) | 797: if ($pun_config['p_sig_bbcode'] == '1') |
| 813: { | 798: { |
| 814: require PUN_ROOT.'include/parser.php'; | 799: require PUN_ROOT.'include/parser.php'; |
| 815: | 800: |
| 861: } | 846: } |
| 862: | 847: |
| 863: | 848: |
| 864: // Singlequotes around non-empty values and NULL for empty values | 849: // Single quotes around non-empty values and NULL for empty values |
| 865: $temp = array(); | 850: $temp = array(); |
| 866: while (list($key, $input) = @each($form)) | 851: while (list($key, $input) = @each($form)) |
| 867: { | 852: { |
| 880: if ($username_updated) | 865: if ($username_updated) |
| 881: { | 866: { |
| 882: $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()); | 867: $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()); |
| | 868: $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()); |
| 883: $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()); | 869: $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()); |
| 884: $db->query('UPDATE '.$db->prefix.'topics SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error()); | 870: $db->query('UPDATE '.$db->prefix.'topics SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error()); |
| 885: $db->query('UPDATE '.$db->prefix.'forums SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update forums', __FILE__, __LINE__, $db->error()); | 871: $db->query('UPDATE '.$db->prefix.'forums SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update forums', __FILE__, __LINE__, $db->error()); |
| 940: if ($user['email_setting'] == '0' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1') | 926: if ($user['email_setting'] == '0' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1') |
| 941: $email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>'; | 927: $email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>'; |
| 942: else if ($user['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1') | 928: else if ($user['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1') |
| 943: $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a>'; | 929: $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send email'].'</a>'; |
| 944: else | 930: else |
| 945: $email_field = $lang_profile['Private']; | 931: $email_field = $lang_profile['Private']; |
| 946: | 932: |
| 971: if ($pun_user['g_search'] == '1') | 957: if ($pun_user['g_search'] == '1') |
| 972: $posts_field .= (($posts_field != '') ? ' - ' : '').'<a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a>'; | 958: $posts_field .= (($posts_field != '') ? ' - ' : '').'<a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a>'; |
| 973: | 959: |
| 974: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; | 960: $page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.sprintf($lang_profile['Users profile'], $user['username'])); |
| 975: define('PUN_ALLOW_INDEX', 1); | 961: define('PUN_ALLOW_INDEX', 1); |
| 976: require PUN_ROOT.'header.php'; | 962: require PUN_ROOT.'header.php'; |
| 977: | 963: |
| 994: <dt><?php echo $lang_profile['Location'] ?>: </dt> | 980: <dt><?php echo $lang_profile['Location'] ?>: </dt> |
| 995: <dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd> | 981: <dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd> |
| 996: <dt><?php echo $lang_profile['Website'] ?>: </dt> | 982: <dt><?php echo $lang_profile['Website'] ?>: </dt> |
| 997: <dd><?php echo $url ?> </dd> | 983: <dd><?php echo $url ?></dd> |
| 998: <dt><?php echo $lang_common['E-mail'] ?>: </dt> | 984: <dt><?php echo $lang_common['Email'] ?>: </dt> |
| 999: <dd><?php echo $email_field ?></dd> | 985: <dd><?php echo $email_field ?></dd> |
| 1000: </dl> | 986: </dl> |
| 1001: <div class="clearer"></div> | 987: <div class="clearer"></div> |
| 1030: <?php if ($pun_config['o_avatars'] == '1'): ?> <dt><?php echo $lang_profile['Avatar'] ?>: </dt> | 1016: <?php if ($pun_config['o_avatars'] == '1'): ?> <dt><?php echo $lang_profile['Avatar'] ?>: </dt> |
| 1031: <dd><?php echo $avatar_field ?></dd> | 1017: <dd><?php echo $avatar_field ?></dd> |
| 1032: <?php endif; if ($pun_config['o_signatures'] == '1'): ?> <dt><?php echo $lang_profile['Signature'] ?>: </dt> | 1018: <?php endif; if ($pun_config['o_signatures'] == '1'): ?> <dt><?php echo $lang_profile['Signature'] ?>: </dt> |
| 1033: <dd><div><?php echo isset($parsed_signature) ? $parsed_signature : $lang_profile['No sig']; ?></div></dd> | 1019: <dd><?php echo isset($parsed_signature) ? '<div class="postsignature postmsg">'.$parsed_signature.'</div>' : $lang_profile['No sig']; ?></dd> |
| 1034: <?php endif; ?> </dl> | 1020: <?php endif; ?> </dl> |
| 1035: <div class="clearer"></div> | 1021: <div class="clearer"></div> |
| 1036: </div> | 1022: </div> |
| 1071: else | 1057: else |
| 1072: $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n"; | 1058: $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n"; |
| 1073: | 1059: |
| 1074: $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a></p>'."\n"; | 1060: $email_field = '<label><strong>'.$lang_common['Email'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send email'].'</a></p>'."\n"; |
| 1075: } | 1061: } |
| 1076: else | 1062: else |
| 1077: { | 1063: { |
| 1078: $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n"; | 1064: $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n"; |
| 1079: | 1065: |
| 1080: if ($pun_config['o_regs_verify'] == '1') | 1066: if ($pun_config['o_regs_verify'] == '1') |
| 1081: $email_field = '<p>'.$lang_common['E-mail'].': '.$user['email'].' - <a href="profile.php?action=change_email&id='.$id.'">'.$lang_profile['Change e-mail'].'</a></p>'."\n"; | 1067: $email_field = '<p>'.$lang_common['Email'].': '.$user['email'].' - <a href="profile.php?action=change_email&id='.$id.'">'.$lang_profile['Change email'].'</a></p>'."\n"; |
| 1082: else | 1068: else |
| 1083: $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label>'."\n"; | 1069: $email_field = '<label><strong>'.$lang_common['Email'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label>'."\n"; |
| 1084: } | 1070: } |
| 1085: | 1071: |
| 1086: $posts_field = ''; | 1072: $posts_field = ''; |
| 1090: $posts_field = '<p>'.$lang_common['Posts'].': '.forum_number_format($user['num_posts']).($pun_user['g_search'] == '1' ? ' - <a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a>' : '').'</p>'."\n"; | 1076: $posts_field = '<p>'.$lang_common['Posts'].': '.forum_number_format($user['num_posts']).($pun_user['g_search'] == '1' ? ' - <a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a>' : '').'</p>'."\n"; |
| 1091: else if ($pun_user['g_search'] == '1') | 1077: else if ($pun_user['g_search'] == '1') |
| 1092: $posts_field = '<p><a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n"; | 1078: $posts_field = '<p><a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n"; |
| 1093: | 1079: |
| 1094: | 1080: |
| 1095: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; | 1081: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
| 1096: $required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['E-mail']); | 1082: $required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['Email']); |
| 1097: require PUN_ROOT.'header.php'; | 1083: require PUN_ROOT.'header.php'; |
| 1098: | 1084: |
| 1099: generate_profile_menu('essentials'); | 1085: generate_profile_menu('essentials'); |
| 1115: </div> | 1101: </div> |
| 1116: <div class="inform"> | 1102: <div class="inform"> |
| 1117: <fieldset> | 1103: <fieldset> |
| 1118: <legend><?php echo $lang_prof_reg['E-mail legend'] ?></legend> | 1104: <legend><?php echo $lang_prof_reg['Email legend'] ?></legend> |
| 1119: <div class="infldset"> | 1105: <div class="infldset"> |
| 1120: <?php echo $email_field ?> | 1106: <?php echo $email_field ?> |
| 1121: </div> | 1107: </div> |
| 1125: <fieldset> | 1111: <fieldset> |
| 1126: <legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend> | 1112: <legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend> |
| 1127: <div class="infldset"> | 1113: <div class="infldset"> |
| 1128: <label><?php echo $lang_prof_reg['Timezone'] ?>: <?php echo $lang_prof_reg['Timezone info'] ?> | 1114: <p><?php echo $lang_prof_reg['Time zone info'] ?></p> |
| 1129: | 1115: <label><?php echo $lang_prof_reg['Time zone'] ?> |
| 1130: <br /><select name="form[timezone]"> | 1116: <br /><select name="form[timezone]"> |
| 1131: <option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option> | 1117: <option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option> |
| 1132: <option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option> | 1118: <option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option> |
| 1167: <option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option> | 1153: <option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option> |
| 1168: </select> | 1154: </select> |
| 1169: <br /></label> | 1155: <br /></label> |
| 1170: <p><?php echo $lang_prof_reg['DST'] ?></p> | |
| 1171: <div class="rbox"> | 1156: <div class="rbox"> |
| 1172: <label><input type="checkbox" name="form[dst]" value="1"<?php if ($user['dst'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['DST info'] ?><br /></label> | 1157: <label><input type="checkbox" name="form[dst]" value="1"<?php if ($user['dst'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['DST'] ?><br /></label> |
| 1173: </div> | 1158: </div> |
| 1174: <label><?php echo $lang_prof_reg['Time format'] ?> | 1159: <label><?php echo $lang_prof_reg['Time format'] ?> |
| 1175: | 1160: |
| 1205: ?> | 1190: ?> |
| 1206: </select> | 1191: </select> |
| 1207: <br /></label> | 1192: <br /></label> |
| 1208: | 1193: |
| 1209: <?php | 1194: <?php |
| 1210: | 1195: |
| 1211: $languages = array(); | 1196: $languages = array(); |
| 1254: <p><?php echo $lang_common['Last post'] ?>: <?php echo $last_post ?></p> | 1239: <p><?php echo $lang_common['Last post'] ?>: <?php echo $last_post ?></p> |
| 1255: <?php echo $posts_field ?> | 1240: <?php echo $posts_field ?> |
| 1256: <?php if ($pun_user['is_admmod']): ?> <label><?php echo $lang_profile['Admin note'] ?><br /> | 1241: <?php if ($pun_user['is_admmod']): ?> <label><?php echo $lang_profile['Admin note'] ?><br /> |
| 1257: <input id="admin_note" type="text" name="admin_note" value="<?php echo pun_htmlspecialchars($user['admin_note']) ?>" size="30" maxlength="30" /><br /></label> | 1242: <input id="admin_note" type="text" name="admin_note" value="<?php echo pun_htmlspecialchars($user['admin_note']) ?>" size="30" maxlength="30" /><br /></label> |
| 1258: <?php endif; ?> </div> | 1243: <?php endif; ?> </div> |
| 1259: </fieldset> | 1244: </fieldset> |
| 1260: </div> | 1245: </div> |
| 1261: <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> | 1246: <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
| 1262: </form> | 1247: </form> |
| 1263: </div> | 1248: </div> |
| 1264: </div> | 1249: </div> |
| 1286: <div class="infldset"> | 1271: <div class="infldset"> |
| 1287: <input type="hidden" name="form_sent" value="1" /> | 1272: <input type="hidden" name="form_sent" value="1" /> |
| 1288: <label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label> | 1273: <label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label> |
| 1289: <?php if (isset($title_field)): ?> <?php echo $title_field ?> | 1274: <?php if (isset($title_field)): ?> <?php echo $title_field ?> |
| 1290: <?php endif; ?> <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label> | 1275: <?php endif; ?> <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label> |
| 1291: <label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label> | 1276: <label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label> |
| 1292: </div> | 1277: </div> |
| 1293: </fieldset> | 1278: </fieldset> |
| 1294: </div> | 1279: </div> |
| 1295: <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> | 1280: <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
| 1296: </form> | 1281: </form> |
| 1297: </div> | 1282: </div> |
| 1298: </div> | 1283: </div> |
| 1325: </div> | 1310: </div> |
| 1326: </fieldset> | 1311: </fieldset> |
| 1327: </div> | 1312: </div> |
| 1328: <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> | 1313: <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
| 1329: </form> | 1314: </form> |
| 1330: </div> | 1315: </div> |
| 1331: </div> | 1316: </div> |
| 1338: message($lang_common['Bad request']); | 1323: message($lang_common['Bad request']); |
| 1339: | 1324: |
| 1340: $avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Change avatar'].'</a>'; | 1325: $avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Change avatar'].'</a>'; |
| 1341: | 1326: |
| 1342: $user_avatar = generate_avatar_markup($id); | 1327: $user_avatar = generate_avatar_markup($id); |
| 1343: if ($user_avatar) | 1328: if ($user_avatar) |
| 1344: $avatar_field .= ' <a href="profile.php?action=delete_avatar&id='.$id.'">'.$lang_profile['Delete avatar'].'</a>'; | 1329: $avatar_field .= ' <a href="profile.php?action=delete_avatar&id='.$id.'">'.$lang_profile['Delete avatar'].'</a>'; |
| 1346: $avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Upload avatar'].'</a>'; | 1331: $avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Upload avatar'].'</a>'; |
| 1347: | 1332: |
| 1348: if ($user['signature'] != '') | 1333: if ($user['signature'] != '') |
| 1349: $signature_preview = '<p>'.$lang_profile['Sig preview'].'</p>'."\n\t\t\t\t\t".'<div class="postsignature">'."\n\t\t\t\t\t\t".'<hr />'."\n\t\t\t\t\t\t".$parsed_signature."\n\t\t\t\t\t".'</div>'."\n"; | 1334: $signature_preview = '<p>'.$lang_profile['Sig preview'].'</p>'."\n\t\t\t\t\t\t\t".'<div class="postsignature postmsg">'."\n\t\t\t\t\t\t\t\t".'<hr />'."\n\t\t\t\t\t\t\t\t".$parsed_signature."\n\t\t\t\t\t\t\t".'</div>'."\n"; |
| 1350: else | 1335: else |
| 1351: $signature_preview = '<p>'.$lang_profile['No sig'].'</p>'."\n"; | 1336: $signature_preview = '<p>'.$lang_profile['No sig'].'</p>'."\n"; |
| 1352: | 1337: |
| 1366: <fieldset id="profileavatar"> | 1351: <fieldset id="profileavatar"> |
| 1367: <legend><?php echo $lang_profile['Avatar legend'] ?></legend> | 1352: <legend><?php echo $lang_profile['Avatar legend'] ?></legend> |
| 1368: <div class="infldset"> | 1353: <div class="infldset"> |
| 1369: <?php if ($user_avatar) echo $user_avatar ?> | 1354: <?php if ($user_avatar) echo $user_avatar ?> |
| 1370: <p><?php echo $lang_profile['Avatar info'] ?></p> | 1355: <p><?php echo $lang_profile['Avatar info'] ?></p> |
| 1371: <p class="clearb"><?php echo $avatar_field ?></p> | 1356: <p class="clearb"><?php echo $avatar_field ?></p> |
| 1372: </div> | 1357: </div> |
| 1390: </div> | 1375: </div> |
| 1391: </fieldset> | 1376: </fieldset> |
| 1392: </div> | 1377: </div> |
| 1393: <?php endif; ?> <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> | 1378: <?php endif; ?> <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
| 1394: </form> | 1379: </form> |
| 1395: </div> | 1380: </div> |
| 1396: </div> | 1381: </div> |
| 1434: <legend><?php echo $lang_profile['Style legend'] ?></legend> | 1419: <legend><?php echo $lang_profile['Style legend'] ?></legend> |
| 1435: <div class="infldset"> | 1420: <div class="infldset"> |
| 1436: <label><?php echo $lang_profile['Style info'] ?><br /> | 1421: <label><?php echo $lang_profile['Style info'] ?><br /> |
| 1437: | |
| 1438: <select name="form[style]"> | 1422: <select name="form[style]"> |
| 1439: <?php | 1423: <?php |
| 1440: | 1424: |
| 1485: </div> | 1469: </div> |
| 1486: </fieldset> | 1470: </fieldset> |
| 1487: </div> | 1471: </div> |
| 1488: <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> | 1472: <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
| 1489: </form> | 1473: </form> |
| 1490: </div> | 1474: </div> |
| 1491: </div> | 1475: </div> |
| 1509: <legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend> | 1493: <legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend> |
| 1510: <div class="infldset"> | 1494: <div class="infldset"> |
| 1511: <input type="hidden" name="form_sent" value="1" /> | 1495: <input type="hidden" name="form_sent" value="1" /> |
| 1512: <p><?php echo $lang_prof_reg['E-mail setting info'] ?></p> | 1496: <p><?php echo $lang_prof_reg['Email setting info'] ?></p> |
| 1513: <div class="rbox"> | 1497: <div class="rbox"> |
| 1514: <label><input type="radio" name="form[email_setting]" value="0"<?php if ($user['email_setting'] == '0') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 1'] ?><br /></label> | 1498: <label><input type="radio" name="form[email_setting]" value="0"<?php if ($user['email_setting'] == '0') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Email setting 1'] ?><br /></label> |
| 1515: <label><input type="radio" name="form[email_setting]" value="1"<?php if ($user['email_setting'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 2'] ?><br /></label> | 1499: <label><input type="radio" name="form[email_setting]" value="1"<?php if ($user['email_setting'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Email setting 2'] ?><br /></label> |
| 1516: <label><input type="radio" name="form[email_setting]" value="2"<?php if ($user['email_setting'] == '2') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 3'] ?><br /></label> | 1500: <label><input type="radio" name="form[email_setting]" value="2"<?php if ($user['email_setting'] == '2') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Email setting 3'] ?><br /></label> |
| 1517: </div> | 1501: </div> |
| 1518: </div> | 1502: </div> |
| 1519: </fieldset> | 1503: </fieldset> |
| 1522: <fieldset> | 1506: <fieldset> |
| 1523: <legend><?php echo $lang_profile['Subscription legend'] ?></legend> | 1507: <legend><?php echo $lang_profile['Subscription legend'] ?></legend> |
| 1524: <div class="infldset"> | 1508: <div class="infldset"> |
| 1525: <p><?php echo $lang_profile['Notify full info'] ?></p> | |
| 1526: <div class="rbox"> | 1509: <div class="rbox"> |
| 1527: <label><input type="checkbox" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Notify full'] ?><br /></label> | 1510: <label><input type="checkbox" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Notify full'] ?><br /></label> |
| 1528: </div> | |
| 1529: <p><?php echo $lang_profile['Auto notify full info'] ?></p> | |
| 1530: <div class="rbox"> | |
| 1531: <label><input type="checkbox" name="form[auto_notify]" value="1"<?php if ($user['auto_notify'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Auto notify full'] ?><br /></label> | 1511: <label><input type="checkbox" name="form[auto_notify]" value="1"<?php if ($user['auto_notify'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Auto notify full'] ?><br /></label> |
| 1532: </div> | 1512: </div> |
| 1533: </div> | 1513: </div> |
| 1534: </fieldset> | 1514: </fieldset> |
| 1535: </div> | 1515: </div> |
| 1536: <?php endif; ?> <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> | 1516: <?php endif; ?> <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
| 1537: </form> | 1517: </form> |
| 1538: </div> | 1518: </div> |
| 1539: </div> | 1519: </div> |
| 1631: $cur_category = 0; | 1611: $cur_category = 0; |
| 1632: while ($cur_forum = $db->fetch_assoc($result)) | 1612: while ($cur_forum = $db->fetch_assoc($result)) |
| 1633: { | 1613: { |
| 1634: if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? | 1614: if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? |
| 1635: { | 1615: { |
| 1636: if ($cur_category) | 1616: if ($cur_category) |
| 1637: echo "\n\t\t\t\t\t\t\t\t".'</div>'; | 1617: echo "\n\t\t\t\t\t\t\t\t".'</div>'; |
| 1667: <?php | 1647: <?php |
| 1668: | 1648: |
| 1669: } | 1649: } |
| | 1650: else |
| | 1651: message($lang_common['Bad request']); |
| 1670: | 1652: |
| 1671: ?> | 1653: ?> |
| 1672: <div class="clearer"></div> | 1654: <div class="clearer"></div> |
| a/upload/register.php |
b/upload/register.php |
| 1: <?php | 1: <?php |
| 2: /*********************************************************************** | |
| 3: | 2: |
| 4: Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) | 3: /*--- |
| 5: | 4: |
| 6: This file is part of PunBB. | 5: Copyright (C) 2008-2009 FluxBB.org |
| 7: | 6: based on code copyright (C) 2002-2005 Rickard Andersson |
| 8: PunBB is free software; you can redistribute it and/or modify it | 7: License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 9: under the terms of the GNU General Public License as published | |
| 10: by the Free Software Foundation; either version 2 of the License, | |
| 11: or (at your option) any later version. | |
| 12: | |
| 13: PunBB is distributed in the hope that it will be useful, but | |
| 14: WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16: GNU General Public License for more details. | |
| 17: | |
| 18: You should have received a copy of the GNU General Public License | |
| 19: along with this program; if not, write to the Free Software | |
| 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 21: MA 02111-1307 USA | |
| 22: | |
| 23: ************************************************************************/ | |
| 24: | 8: |
| | 9: ---*/ |
| 25: | 10: |
| 26: define('PUN_ROOT', './'); | 11: define('PUN_ROOT', './'); |
| 27: require PUN_ROOT.'include/common.php'; | 12: require PUN_ROOT.'include/common.php'; |
| 63: <fieldset> | 48: <fieldset> |
| 64: <legend><?php echo $lang_register['Rules legend'] ?></legend> | 49: <legend><?php echo $lang_register['Rules legend'] ?></legend> |
| 65: <div class="infldset"> | 50: <div class="infldset"> |
| 66: <p><?php echo $pun_config['o_rules_message'] ?></p> | 51: <div class="usercontent"><?php echo $pun_config['o_rules_message'] ?></div> |
| 67: </div> | 52: </div> |
| 68: </fieldset> | 53: </fieldset> |
| 69: </div> | 54: </div> |
| 70: <p><input type="submit" name="agree" value="<?php echo $lang_register['Agree'] ?>" /><input type="submit" name="cancel" value="<?php echo $lang_register['Cancel'] ?>" /></p> | 55: <p class="buttons"><input type="submit" name="agree" value="<?php echo $lang_register['Agree'] ?>" /> <input type="submit" name="cancel" value="<?php echo $lang_register['Cancel'] ?>" /></p> |
| 71: </form> | 56: </form> |
| 72: </div> | 57: </div> |
| 73: </div> | 58: </div> |
| 80: $errors = array(); | 65: $errors = array(); |
| 81: | 66: |
| 82: if (isset($_POST['form_sent'])) | 67: if (isset($_POST['form_sent'])) |
| 83: { | 68: { |
| 84: // Check that someone from this IP didn't register a user within the last hour (DoS prevention) | 69: // Check that someone from this IP didn't register a user within the last hour (DoS prevention) |
| 85: $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE registration_ip=\''.get_remote_address().'\' AND registered>'.(time() - 3600)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 70: $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE registration_ip=\''.get_remote_address().'\' AND registered>'.(time() - 3600)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 86: | 71: |
| 110: // Validate username and passwords | 95: // Validate username and passwords |
| 111: if (strlen($username) < 2) | 96: if (strlen($username) < 2) |
| 112: $errors[] = $lang_prof_reg['Username too short']; | 97: $errors[] = $lang_prof_reg['Username too short']; |
| 113: else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters | 98: else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
| 114: $errors[] = $lang_prof_reg['Username too long']; | 99: $errors[] = $lang_prof_reg['Username too long']; |
| 115: else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) | 100: else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) |
| 116: $errors[] = $lang_prof_reg['Username guest']; | 101: $errors[] = $lang_prof_reg['Username guest']; |
| 118: $errors[] = $lang_prof_reg['Username IP']; | 103: $errors[] = $lang_prof_reg['Username IP']; |
| 119: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) | 104: else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) |
| 120: $errors[] = $lang_prof_reg['Username reserved chars']; | 105: $errors[] = $lang_prof_reg['Username reserved chars']; |
| 121: else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username)) | 106: else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $username)) |
| 122: $errors[] = $lang_prof_reg['Username BBCode']; | 107: $errors[] = $lang_prof_reg['Username BBCode']; |
| 123: | 108: |
| 124: // Check username for any censored words | 109: // Check username for any censored words |
| 125: if ($pun_config['o_censoring'] == '1') | 110: if ($pun_config['o_censoring'] == '1') |
| 126: { | 111: { |
| 146: break; | 131: break; |
| 147: } | 132: } |
| 148: } | 133: } |
| 149: | 134: |
| 150: if (strlen($password1) < 4) | 135: if (strlen($password1) < 4) |
| 151: $errors[] = $lang_prof_reg['Pass too short']; | 136: $errors[] = $lang_prof_reg['Pass too short']; |
| 152: else if ($password1 != $password2) | 137: else if ($password1 != $password2) |
| 153: $errors[] = $lang_prof_reg['Pass not match']; | 138: $errors[] = $lang_prof_reg['Pass not match']; |
| 154: | 139: |
| 155: // Validate e-mail | 140: // Validate email |
| 156: require PUN_ROOT.'include/email.php'; | 141: require PUN_ROOT.'include/email.php'; |
| 157: | 142: |
| 158: if (!is_valid_email($email1)) | 143: if (!is_valid_email($email1)) |
| 159: $errors[] = $lang_common['Invalid e-mail']; | 144: $errors[] = $lang_common['Invalid email']; |
| 160: else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2) | 145: else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2) |
| 161: $errors[] = $lang_register['E-mail not match']; | 146: $errors[] = $lang_register['Email not match']; |
| 162: | 147: |
| 163: // Check it it's a banned e-mail address | 148: // Check if it's a banned email address |
| 164: if (is_banned_email($email1)) | 149: if (is_banned_email($email1)) |
| 165: { | 150: { |
| 166: if ($pun_config['p_allow_banned_email'] == '0') | 151: if ($pun_config['p_allow_banned_email'] == '0') |
| 167: $errors[] = $lang_prof_reg['Banned e-mail']; | 152: $errors[] = $lang_prof_reg['Banned email']; |
| 168: | 153: |
| 169: $banned_email = true; // Used later when we send an alert e-mail | 154: $banned_email = true; // Used later when we send an alert email |
| 170: } | 155: } |
| 171: else | 156: else |
| 172: $banned_email = false; | 157: $banned_email = false; |
| 173: | 158: |
| 174: // Check if someone else already has registered with that e-mail address | 159: // Check if someone else already has registered with that email address |
| 175: $dupe_list = array(); | 160: $dupe_list = array(); |
| 176: | 161: |
| 177: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE email=\''.$email1.'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 162: $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email1).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
| 178: if ($db->num_rows($result)) | 163: if ($db->num_rows($result)) |
| 179: { | 164: { |
| 180: if ($pun_config['p_allow_dupe_email'] == '0') | 165: if ($pun_config['p_allow_dupe_email'] == '0') |
| 181: $errors[] = $lang_prof_reg['Dupe e-mail']; | 166: $errors[] = $lang_prof_reg['Dupe email']; |
| 182: | 167: |
| 183: while ($cur_dupe = $db->fetch_assoc($result)) | 168: while ($cur_dupe = $db->fetch_assoc($result)) |
| 184: $dupe_list[] = $cur_dupe['username']; | 169: $dupe_list[] = $cur_dupe['username']; |
| 204: // Did everything go according to plan? | 189: // Did everything go according to plan? |
| 205: if (empty($errors)) | 190: if (empty($errors)) |
| 206: { | 191: { |
| 207: // Insert the new user into the database. We do this now to get the last inserted id for later use. | 192: // Insert the new user into the database. We do this now to get the last inserted ID for later use |
| 208: $now = time(); | 193: $now = time(); |
| 209: | 194: |
| 210: $intial_group_id = ($pun_config['o_regs_verify'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED; | 195: $intial_group_id = ($pun_config['o_regs_verify'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED; |
| 211: $password_hash = pun_hash($password1); | 196: $password_hash = pun_hash($password1); |
| 212: | 197: |
| 213: // Add the user | 198: // Add the user |
| 214: $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, timezone, dst, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$timezone.' , '.$dst.', \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error()); | 199: $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, timezone, dst, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$db->escape($email1).'\', '.$email_setting.', '.$timezone.' , '.$dst.', \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error()); |
| 215: $new_uid = $db->insert_id(); | 200: $new_uid = $db->insert_id(); |
| 216: | 201: |
| 217: | 202: |
| 218: // If we previously found out that the e-mail was banned | 203: // If we previously found out that the email was banned |
| 219: if ($banned_email && $pun_config['o_mailing_list'] != '') | 204: if ($banned_email && $pun_config['o_mailing_list'] != '') |
| 220: { | 205: { |
| 221: $mail_subject = $lang_common['Banned email notification']; | 206: $mail_subject = $lang_common['Banned email notification']; |
| 222: $mail_message = sprintf($lang_common['Banned email register message'], $username, $email1)."\n"; | 207: $mail_message = sprintf($lang_common['Banned email register message'], $username, $email1)."\n"; |
| 223: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n"; | 208: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n"; |
| 226: pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); | 211: pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
| 227: } | 212: } |
| 228: | 213: |
| 229: // If we previously found out that the e-mail was a dupe | 214: // If we previously found out that the email was a dupe |
| 230: if (!empty($dupe_list) && $pun_config['o_mailing_list'] != '') | 215: if (!empty($dupe_list) && $pun_config['o_mailing_list'] != '') |
| 231: { | 216: { |
| 232: $mail_subject = $lang_common['Duplicate email notification']; | 217: $mail_subject = $lang_common['Duplicate email notification']; |
| 233: $mail_message = sprintf($lang_common['Duplicate email register message'], $username, implode(', ', $dupe_list))."\n"; | 218: $mail_message = sprintf($lang_common['Duplicate email register message'], $username, implode(', ', $dupe_list))."\n"; |
| 234: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n"; | 219: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n"; |
| 239: | 224: |
| 240: // Should we alert people on the admin mailing list that a new user has registered? | 225: // Should we alert people on the admin mailing list that a new user has registered? |
| 241: if ($pun_config['o_regs_report'] == '1') | 226: if ($pun_config['o_regs_report'] == '1') |
| 242: { | 227: { |
| 243: $mail_subject = $lang_common['New user notification']; | 228: $mail_subject = $lang_common['New user notification']; |
| 244: $mail_message = sprintf($lang_common['New user message'], $username, $pun_config['o_base_url'].'/')."\n"; | 229: $mail_message = sprintf($lang_common['New user message'], $username, $pun_config['o_base_url'].'/')."\n"; |
| 245: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n"; | 230: $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n"; |
| 268: | 253: |
| 269: pun_mail($email1, $mail_subject, $mail_message); | 254: pun_mail($email1, $mail_subject, $mail_message); |
| 270: | 255: |
| 271: message($lang_register['Reg e-mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true); | 256: message($lang_register['Reg email'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true); |
| 272: } | 257: } |
| 273: | 258: |
| 274: pun_setcookie($new_uid, $password_hash, time() + $pun_config['o_timeout_visit']); | 259: pun_setcookie($new_uid, $password_hash, time() + $pun_config['o_timeout_visit']); |
| 279: | 264: |
| 280: | 265: |
| 281: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_register['Register']; | 266: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_register['Register']; |
| 282: $required_fields = array('req_username' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['E-mail'], 'req_email2' => $lang_common['E-mail'].' 2'); | 267: $required_fields = array('req_username' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['Email'], 'req_email2' => $lang_common['Email'].' 2'); |
| 283: $focus_element = array('register', 'req_username'); | 268: $focus_element = array('register', 'req_username'); |
| 284: require PUN_ROOT.'header.php'; | 269: require PUN_ROOT.'header.php'; |
| 285: | 270: |
| 335: </div> | 320: </div> |
| 336: <?php if ($pun_config['o_regs_verify'] == '0'): ?> <div class="inform"> | 321: <?php if ($pun_config['o_regs_verify'] == '0'): ?> <div class="inform"> |
| 337: <fieldset> | 322: <fieldset> |
| 338: <legend><?php echo $lang_register['Pass legend 1'] ?></legend> | 323: <legend><?php echo $lang_register['Pass legend'] ?></legend> |
| 339: <div class="infldset"> | 324: <div class="infldset"> |
| 340: <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password1" value="<?php if (isset($_POST['req_password1'])) echo pun_htmlspecialchars($_POST['req_password1']); ?>" size="16" maxlength="16" /><br /></label> | 325: <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password1" value="<?php if (isset($_POST['req_password1'])) echo pun_htmlspecialchars($_POST['req_password1']); ?>" size="16" maxlength="16" /><br /></label> |
| 341: <label class="conl"><strong><?php echo $lang_prof_reg['Confirm pass'] ?></strong><br /><input type="password" name="req_password2" value="<?php if (isset($_POST['req_password2'])) echo pun_htmlspecialchars($_POST['req_password2']); ?>" size="16" maxlength="16" /><br /></label> | 326: <label class="conl"><strong><?php echo $lang_prof_reg['Confirm pass'] ?></strong><br /><input type="password" name="req_password2" value="<?php if (isset($_POST['req_password2'])) echo pun_htmlspecialchars($_POST['req_password2']); ?>" size="16" maxlength="16" /><br /></label> |
| 345: </div> | 330: </div> |
| 346: <?php endif; ?> <div class="inform"> | 331: <?php endif; ?> <div class="inform"> |
| 347: <fieldset> | 332: <fieldset> |
| 348: <legend><?php echo ($pun_config['o_regs_verify'] == '1') ? $lang_prof_reg['E-mail legend 2'] : $lang_prof_reg['E-mail legend'] ?></legend> | 333: <legend><?php echo ($pun_config['o_regs_verify'] == '1') ? $lang_prof_reg['Email legend 2'] : $lang_prof_reg['Email legend'] ?></legend> |
| 349: <div class="infldset"> | 334: <div class="infldset"> |
| 350: <?php if ($pun_config['o_regs_verify'] == '1'): ?> <p><?php echo $lang_register['E-mail info'] ?></p> | 335: <?php if ($pun_config['o_regs_verify'] == '1'): ?> <p><?php echo $lang_register['Email info'] ?></p> |
| 351: <?php endif; ?> <label><strong><?php echo $lang_common['E-mail'] ?></strong><br /> | 336: <?php endif; ?>
|