diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index f99a2f8a73..b0d41f94e4 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -205,7 +205,10 @@ function adm_page_footer($copyright_html = true) garbage_collection(); - exit; + if (!defined('PHPBB_EMBEDDED')) + { + exit; + } } /** @@ -477,7 +480,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) $cfg_array[$config_name] = trim($cfg_array[$config_name]); // Make sure no NUL byte is present... - if (strpos($cfg_array[$config_name], '\0') !== false || strpos($cfg_array[$config_name], '%00') !== false) + if (strpos($cfg_array[$config_name], "\0") !== false || strpos($cfg_array[$config_name], '%00') !== false) { $cfg_array[$config_name] = ''; break; diff --git a/phpBB/adm/style/acp_ban.html b/phpBB/adm/style/acp_ban.html index 334d245edf..e371d48bfc 100644 --- a/phpBB/adm/style/acp_ban.html +++ b/phpBB/adm/style/acp_ban.html @@ -31,9 +31,9 @@ function display_details(option) { - document.getElementById('acp_ban').unbangivereason.value = ban_give_reason[option]; - document.getElementById('acp_ban').unbanreason.value = ban_reason[option]; - document.getElementById('acp_ban').unbanlength.value = ban_length[option]; + document.getElementById('acp_unban').unbangivereason.value = ban_give_reason[option]; + document.getElementById('acp_unban').unbanreason.value = ban_reason[option]; + document.getElementById('acp_unban').unbanlength.value = ban_length[option]; } //--> diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 9c488c9f90..5100de32d8 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -4,10 +4,10 @@ + + + + function toggle_select(icon, display, select) + { + var disp = document.getElementById('order_disp[' + icon + ']'); + var nodisp = document.getElementById('order_no_disp[' + icon + ']'); + disp.disabled = !display; + nodisp.disabled = display; + if (display) + { + document.getElementById(select).selectedIndex = 0; + nodisp.className = 'disabled-options'; + disp.className = ''; + } + else + { + document.getElementById(select).selectedIndex = {S_ORDER_LIST_DISPLAY_COUNT}; + disp.className = 'disabled-options'; + nodisp.className = ''; + } + } + //--> + + + « {L_BACK}

{L_TITLE}

@@ -89,13 +112,16 @@ - + - + @@ -113,8 +139,11 @@ - - + + diff --git a/phpBB/adm/style/acp_users_profile.html b/phpBB/adm/style/acp_users_profile.html index 69edb1159b..6a50887141 100644 --- a/phpBB/adm/style/acp_users_profile.html +++ b/phpBB/adm/style/acp_users_profile.html @@ -49,7 +49,7 @@ {L_USER_CUSTOM_PROFILE_FIELDS}
-

{profile_fields.LANG_EXPLAIN}
+
for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}:
{profile_fields.LANG_EXPLAIN}
{profile_fields.FIELD}
{profile_fields.ERROR}
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 4d30bb0b91..489b22a7d4 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -726,6 +726,11 @@ optgroup { font-weight: bold; } +optgroup.disabled-options { + display: none; + background-color: gray; +} + option { padding: 0 1em 0 0; color: #000; diff --git a/phpBB/adm/style/custom_profile_fields.html b/phpBB/adm/style/custom_profile_fields.html index 1aba162d00..351397d3c7 100644 --- a/phpBB/adm/style/custom_profile_fields.html +++ b/phpBB/adm/style/custom_profile_fields.html @@ -1,32 +1,32 @@ - - + - + - + - checked="checked" /> + checked="checked" /> - + - {L_DAY}: - {L_MONTH}: - {L_YEAR}: + {L_DAY}: + {L_MONTH}: + {L_YEAR}: diff --git a/phpBB/adm/style/install_convert.html b/phpBB/adm/style/install_convert.html index 5d52015da6..783e89d6bf 100755 --- a/phpBB/adm/style/install_convert.html +++ b/phpBB/adm/style/install_convert.html @@ -120,8 +120,9 @@ +

{L_MESSAGE}

+
-

{L_MESSAGE}

{S_HIDDEN} disabled="disabled" onclick="this.className = 'button1 disabled';" onsubmit="this.disabled = 'disabled';" name="submit" value="{L_SUBMIT}" />
diff --git a/phpBB/common.php b/phpBB/common.php index 3ee931e95d..5177bff5b8 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -98,16 +98,7 @@ else if (defined('IN_CRON')) { - chdir($phpbb_root_path); - if (@function_exists('getcwd')) - { - $phpbb_root_path = getcwd() . '/'; - } - else - { - // This is a best guess - $phpbb_root_path = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_DIRNAME) . '/'; - } + $phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; } if (!file_exists($phpbb_root_path . 'config.' . $phpEx)) diff --git a/phpBB/cron.php b/phpBB/cron.php index b5a51a1688..79cf0f40fa 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -33,6 +33,12 @@ echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw== // test without flush ;) // flush(); +// +if (!isset($config['cron_lock'])) +{ + set_config('cron_lock', '0', true); +} + // make sure cron doesn't run multiple times in parallel if ($config['cron_lock']) { diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 1675fc0899..5d974639b1 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -46,6 +46,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => 'mediumtext', 'TIMESTAMP' => 'int(11) UNSIGNED', 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'varchar(255)', 'VCHAR_UNI:'=> 'varchar(%d)', 'VCHAR_CI' => 'varchar(255)', @@ -73,6 +76,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => 'mediumblob', 'TIMESTAMP' => 'int(11) UNSIGNED', 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'blob', 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), 'VCHAR_CI' => 'blob', @@ -100,6 +106,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', 'TIMESTAMP' => 'INTEGER', 'DECIMAL' => 'DOUBLE PRECISION', + 'DECIMAL:' => 'DOUBLE PRECISION', + 'PDECIMAL' => 'DOUBLE PRECISION', + 'PDECIMAL:' => 'DOUBLE PRECISION', 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8', 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8', @@ -127,6 +136,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => '[text]', 'TIMESTAMP' => '[int]', 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', 'VCHAR_UNI' => '[varchar] (255)', 'VCHAR_UNI:'=> '[varchar] (%d)', 'VCHAR_CI' => '[varchar] (255)', @@ -154,6 +166,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => 'clob', 'TIMESTAMP' => 'number(11)', 'DECIMAL' => 'number(5, 2)', + 'DECIMAL:' => 'number(%d, 2)', + 'PDECIMAL' => 'number(6, 3)', + 'PDECIMAL:' => 'number(%d, 3)', 'VCHAR_UNI' => 'varchar2(765)', 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), 'VCHAR_CI' => 'varchar2(255)', @@ -181,6 +196,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => 'mediumtext(16777215)', 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED', 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'varchar(255)', 'VCHAR_UNI:'=> 'varchar(%d)', 'VCHAR_CI' => 'varchar(255)', @@ -208,6 +226,9 @@ $dbms_type_map = array( 'MTEXT_UNI' => 'TEXT', 'TIMESTAMP' => 'INT4', // unsigned 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'varchar(255)', 'VCHAR_UNI:'=> 'varchar(%d)', 'VCHAR_CI' => 'varchar_ci', @@ -771,6 +792,9 @@ foreach ($supported_dbms as $dbms) * VCHAR:x => varchar(x) * TIMESTAMP => int(11) UNSIGNED * DECIMAL => decimal number (5,2) +* DECIMAL: => decimal number (x,2) +* PDECIMAL => precision decimal number (6,3) +* PDECIMAL: => precision decimal number (x,3) * VCHAR_UNI => varchar(255) BINARY * VCHAR_CI => varchar_ci for postgresql, others VCHAR */ @@ -1590,7 +1614,7 @@ function get_schema_struct() $schema_data['phpbb_styles_template_data'] = array( 'COLUMNS' => array( - 'template_id' => array('USINT', NULL, 'auto_increment'), + 'template_id' => array('USINT', 0), 'template_filename' => array('VCHAR:100', ''), 'template_included' => array('TEXT', ''), 'template_mtime' => array('TIMESTAMP', 0), diff --git a/phpBB/develop/utf_normalizer_test.php b/phpBB/develop/utf_normalizer_test.php index 45ffaa11e9..9ad9c5869f 100644 --- a/phpBB/develop/utf_normalizer_test.php +++ b/phpBB/develop/utf_normalizer_test.php @@ -132,7 +132,8 @@ while (!feof($fp)) foreach ($tests as $test) { - $utf_result = call_user_func(array('utf_normalizer', $form), $utf_expected); + $utf_result = $utf_expected; + call_user_func(array('utf_normalizer', $form), $utf_result); if (strcmp($utf_expected, $utf_result)) { @@ -196,7 +197,8 @@ while (!feof($fp)) foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form) { - $utf_result = utf_normalizer::$form($utf_expected); + $utf_result = $utf_expected; + utf_normalizer::$form($utf_result); $hex_result = utf_to_hexseq($utf_result); // echo "$form($utf_expected) == $utf_result\n"; diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 198d21d885..886334175a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -169,6 +169,7 @@ p a {
@@ -360,6 +361,18 @@ $auth_admin = new auth_admin(); Top +

+ +
+ +

4. Copyright and disclaimer

+ +
+ +

This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 phpBB Group, All Rights Reserved.

+ +
+Top diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 14deabf135..a407be10ee 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -3,7 +3,7 @@ Coding Guidelines - + @@ -192,7 +192,7 @@ p a { -

These are the phpBB Coding Guidelines for Olympus, all attempts should be made to follow them as closely as possible.
This document is (c) 2006 phpBB Group, copying or redistribution is not allowed without permission.

+

These are the phpBB Coding Guidelines for Olympus, all attempts should be made to follow them as closely as possible.

Coding Guidelines

@@ -215,6 +215,7 @@ p a {
  • Styling
  • Templating
  • +
  • Character Sets and Encodings
  • Translation (i18n/L10n) Guidelines
    1. Standardisation
    2. @@ -223,6 +224,7 @@ p a {
  • Guidelines Changelog
  • +
  • Copyright and disclaimer

  • @@ -344,6 +346,7 @@ class ...
  • /includes/db/sqlite.php
    Sqlite Database Abstraction Layer
  • +
  • diff
    /includes/diff
    Diff Engine
  • docs
    /docs
    phpBB Documentation
  • images
    /images
    All global images not connected to styles
  • install
    /install
    Installation System
  • @@ -352,6 +355,7 @@ class ...
  • VC
    /includes/captcha
    CAPTCHA
  • mcp
    mcp.php, /includes/mcp, report.php
    Moderator Control Panel
  • ucp
    ucp.php, /includes/ucp
    User Control Panel
  • +
  • utf
    /includes/utf
    UTF8-related functions/classes
  • search
    /includes/search, search.php
    Search System
  • styles
    /styles, style.php
    phpBB Styles/Templates/Themes/Imagesets
  • @@ -800,7 +804,7 @@ $sql = 'SELECT *

    sql_escape():

    -

    Always use $db->sql_escape() if you need to check for a string within an SQL statement (even if you are sure the variable can not contain single quotes - never trust your input), for example:

    +

    Always use $db->sql_escape() if you need to check for a string within an SQL statement (even if you are sure the variable cannot contain single quotes - never trust your input), for example:

     $sql = 'SELECT *
    @@ -1558,9 +1562,85 @@ div
     
     
    -

    5. Translation (i18n/L10n) Guidelines

    +

    5. Character Sets and Encodings

    - 5.i. Standardisation +
    + +

    What are Unicode, UCS and UTF-8?

    +

    The Universal Character Set (UCS) described in ISO/IEC 10646 consists of a large amount of characters. Each of them has a unique name and a code point which is an integer number. Unicode - which is an industry standard - complements the Universal Character Set with further information about the characters' properties and alternative character encodings. More information on Unicode can be found on the Unicode Consortium's website. One of the Unicode encodings is the 8-bit Unicode Transformation Format (UTF-8). It encodes characters with up to four bytes aiming for maximum compatability with the American Standard Code for Information Interchange which is a 7-bit encoding of a relatively small subset of the UCS.

    + +

    phpBB's use of Unicode

    +

    Unfortunately PHP does not faciliate the use of Unicode prior to version 6. Most functions simply treat strings as sequences of bytes assuming that each character takes up exactly one byte. This behaviour still allows for storing UTF-8 encoded text in PHP strings but many operations on strings have unexpected results. To circumvent this problem we have created some alternative functions to PHP's native string operations which use code points instead of bytes. These functions can be found in /includes/utf/utf_tools.php. They are also covered in the phpBB3 Sourcecode Documentation. A lot of native PHP functions still work with UTF-8 as long as you stick to certain restrictions. For example explode still works as long as the first and the last character of the delimiter string are ASCII characters.

    + +

    phpBB only uses the ASCII and the UTF-8 character encodings. Still all Strings are UTF-8 encoded because ASCII is a subset of UTF-8. The only exceptions to this rule are code sections which deal with external systems which use other encodings and character sets. Such external data should be converted to UTF-8 using the utf8_recode() function supplied with phpBB. It supports a variety of other character sets and encodings, a full list can be found below.

    + +

    With request_var() you can either allow all UCS characters in user input or restrict user input to ASCII characters. This feature is controlled by the function's third parameter called $multibyte. You should allow multibyte characters in posts, PMs, topic titles, forum names, etc. but it's not necessary for internal uses like a $mode variable which should only hold a predefined list of ASCII strings anyway.

    + +
    +// an input string containing a multibyte character
    +$_REQUEST['multibyte_string'] = 'Käse';
    +
    +// print request variable as a UTF-8 string allowing multibyte characters
    +echo request_var('multibyte_string', '', true);
    +// print request variable as ASCII string
    +echo request_var('multibyte_string', '');
    +
    + +

    This code snippet will generate the following output:

    + +
    +Käse
    +K??se
    +
    + +

    Unicode Normalization

    + +

    If you retrieve user input with multibyte characters you should additionally normalize the string using utf8_normalize_nfc() before you work with it. This is necessary to make sure that equal characters can only occur in one particular binary representation. For example the character Å can be represented either as U+00C5 (LATIN CAPITAL LETTER A WITH RING ABOVE) or as U+212B (ANGSTROM SIGN). phpBB uses Normalization Form Canonical Composition (NFC) for all text. So the correct version of the above example would look like this:

    + +
    +$_REQUEST['multibyte_string'] = 'Käse';
    +
    +// normalize multibyte strings
    +echo utf8_normalize_nfc(request_var('multibyte_string', '', true));
    +// ASCII strings do not need to be normalized
    +echo request_var('multibyte_string', '');
    +
    + +

    Case Folding

    + +

    Case insensitive comparison of strings is no longer possible with strtolower or strtoupper as some characters have multiple lower case or multiple upper case forms depending on their position in a word. The utf8_strtolower and the utf8_strtoupper functions suffer from the same problem so they can only be used to display upper/lower case versions of a string but they cannot be used for case insensitive comparisons either. So instead you should use case folding which gives you a case insensitive version of the string which can be used for case insensitive comparisons. An NFC normalized string can be case folded using utf8_case_fold_nfc().

    + +

    // Bad - The strings might be the same even if strtolower differs

    + +
    +if (strtolower($string1) == strtolower($string2))
    +{
    +	echo '$string1 and $string2 are equal or differ in case';
    +}
    +
    + +

    // Good - Case folding is really case insensitive

    + +
    +if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
    +{
    +	echo '$string1 and $string2 are equal or differ in case';
    +}
    +
    + +

    Confusables Detection

    + +

    phpBB offers a special method utf8_clean_string which can be used to make sure string identifiers are unique. This method uses Normalization Form Compatibility Composition (NFKC) instead of NFC and replaces similarly looking characters with a particular representative of the equivalence class. This method is currently used for usernames and group names to avoid confusion with similarly looking names.

    + +
    +Top +

    + +
    + +

    6. Translation (i18n/L10n) Guidelines

    + + 6.i. Standardisation

    @@ -1854,7 +1934,7 @@ div Top

    - 5.ii. Other considerations + 6.ii. Other considerations

    @@ -2118,7 +2198,7 @@ div Top

    - 5.iii. Writing Style + 6.iii. Writing Style

    @@ -2229,13 +2309,19 @@ div
    -

    6. Guidelines Changelog

    +

    7. Guidelines Changelog

    +

    Revision 1.24

    + + +

    Revision 1.16

    Revision 1.11-1.15

    @@ -2268,6 +2354,18 @@ div +
    +Top +

    + +
    + +

    8. Copyright and disclaimer

    + +
    + +

    This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 phpBB Group, All Rights Reserved.

    +
    Top diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index ce0d12b356..235028fc3c 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -295,16 +295,22 @@ class acp_bbcodes // @todo Make sure to change this too if something changed in message parsing $tokens = array( 'URL' => array( - '!([a-z0-9]+://)?([^< "\r\n\t\]]*?)!ie' => "(('\$1') ? '\$1\$2' : 'http://\$2')" + '!(?:(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))!ie' => "\$this->bbcode_specialchars(('\$1') ? '\$1' : 'http://\$2')" ), 'LOCAL_URL' => array( - '!([^:]+/[^< "\r\n\t\]]*?)!' => '$1' + '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" ), 'EMAIL' => array( - '!([a-z0-9]+[a-z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-z0-9]+[a-z0-9\-\._]*\.[a-z]+))!i' => '$1' + '!([a-z0-9]+[a-z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-z0-9]+[a-z0-9\-\._]*\.[a-z]+))!i' => "\$this->bbcode_specialchars('$1')" ), 'TEXT' => array( - '!(.*?)!es' => "str_replace(\"\\r\\n\",\"\\n\", str_replace('\\\"', '\"', str_replace('\\'', ''', trim('\$1'))))" + '!(.*?)!es' => "str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', ''', '(', ')'), trim('\$1'))" + ), + 'SIMPLETEXT' => array( + '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" + ), + 'IDENTIFIER' => array( + '!([a-zA-Z0-9-_]+)!' => "$1" ), 'COLOR' => array( '!([a-z]+|#[0-9abcdef]+)!i' => '$1' diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index dbee5f6eed..93108c7fec 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -279,7 +279,7 @@ class acp_bots $cache->destroy('_bots'); add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']); - trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action . "&id=$bot_id&action=$action")); + trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action)); } } @@ -376,14 +376,19 @@ class acp_bots $db->sql_freeresult($result); } + /** + * Validate bot name against username table + */ function validate_botname($newname, $oldname = false) { global $db; + if ($oldname && utf8_clean_string($newname) === $oldname) { return true; } - // Admins might want to use names otherwise forbidden, thus we only check for duplicates. + + // Admins might want to use names otherwise forbidden, thus we only check for duplicates. $sql = 'SELECT username FROM ' . USERS_TABLE . " WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($newname)) . "'"; @@ -391,14 +396,7 @@ class acp_bots $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if ($row) - { - return false; - } - else - { - return true; - } + return ($row) ? false : true; } } diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 538a46358d..56a660ced2 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -144,13 +144,19 @@ class acp_icons } } } - + $sql = "SELECT * FROM $table ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); - + $data = array(); + $after = false; + $display = 0; + $order_lists = array('', ''); + $add_order_lists = array('', ''); + $display_count = 0; + while ($row = $db->sql_fetchrow($result)) { if ($action == 'add') @@ -158,9 +164,11 @@ class acp_icons unset($_images[$row[$fields . '_url']]); } + if ($row[$fields . '_id'] == $icon_id) { $after = true; + $display = $row['display_on_posting']; $data[$row[$fields . '_url']] = $row; } else @@ -176,35 +184,41 @@ class acp_icons $selected = ' selected="selected"'; $after = false; } - + if ($row['display_on_posting']) + { + $display_count++; + } $after_txt = ($mode == 'smilies') ? $row['code'] : $row['icons_url']; - $order_list = '' . $order_list; + $order_lists[$row['display_on_posting']] = '' . $order_lists[$row['display_on_posting']]; if (!empty($default_row)) { - $add_order_list = '' . $add_order_list; + $add_order_lists[$row['display_on_posting']] = '' . $add_order_lists[$row['display_on_posting']]; } } } $db->sql_freeresult($result); - $order_list = '' . $order_list; - $add_order_list = '' . $add_order_list; - + $order_list = ''; + $add_order_list = ''; + if ($action == 'add') { $data = $_images; } - + $colspan = (($mode == 'smilies') ? '7' : '5'); $colspan += ($icon_id) ? 1 : 0; $colspan += ($action == 'add') ? 2 : 0; - + $template->assign_vars(array( 'S_EDIT' => true, 'S_SMILIES' => ($mode == 'smilies') ? true : false, 'S_ADD' => ($action == 'add') ? true : false, - 'S_ORDER_LIST' => $order_list, + + 'S_ORDER_LIST_DISPLAY' => $order_list . $order_lists[1], + 'S_ORDER_LIST_UNDISPLAY' => $order_list . $order_lists[0], + 'S_ORDER_LIST_DISPLAY_COUNT' => $display_count + 1, 'L_TITLE' => $user->lang['ACP_' . $lang], 'L_EXPLAIN' => $user->lang['ACP_' . $lang . '_EXPLAIN'], @@ -247,7 +261,10 @@ class acp_icons 'S_ADD_CODE' => true, 'S_IMG_OPTIONS' => $smiley_options, - 'S_ADD_ORDER_LIST' => $add_order_list, + + 'S_ADD_ORDER_LIST_DISPLAY' => $add_order_list . $add_order_lists[1], + 'S_ADD_ORDER_LIST_UNDISPLAY' => $add_order_list . $add_order_lists[0], + 'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $default_row['smiley_url'], 'IMG_PATH' => $img_path, 'PHPBB_ROOT_PATH' => $phpbb_root_path, @@ -306,6 +323,7 @@ class acp_icons } } + $icons_updated = 0; foreach ($images as $image) { if (($mode == 'smilies' && ($image_emotion[$image] == '' || $image_code[$image] == '')) || @@ -370,25 +388,43 @@ class acp_icons SET " . $db->sql_build_array('UPDATE', $img_sql) . " WHERE {$fields}_id = " . $image_id[$image]; $db->sql_query($sql); + $icons_updated++; } else if ($action !== 'modify') { $sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql); $db->sql_query($sql); + $icons_updated++; } + } } $cache->destroy('_icons'); $cache->destroy('sql', $table); - + + $level = E_USER_NOTICE; + switch ($icons_updated) + { + case 0: + $suc_lang = "{$lang}_NONE"; + $level = E_USER_WARNING; + break; + + case 1: + $suc_lang = "{$lang}_ONE"; + break; + + default: + $suc_lang = $lang; + } if ($action == 'modify') { - trigger_error($user->lang[$lang . '_EDITED'] . adm_back_link($this->u_action)); + trigger_error($user->lang[$suc_lang . '_EDITED'] . adm_back_link($this->u_action), $level); } else { - trigger_error($user->lang[$lang . '_ADDED'] . adm_back_link($this->u_action)); + trigger_error($user->lang[$suc_lang . '_ADDED'] . adm_back_link($this->u_action), $level); } break; @@ -579,7 +615,10 @@ class acp_icons $template->assign_vars(array( 'MESSAGE_TITLE' => $user->lang['EXPORT_' . $lang], - 'MESSAGE_TEXT' => sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '', '')) + 'MESSAGE_TEXT' => sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '', ''), + + 'S_USER_NOTICE' => true, + ) ); return; diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index ff827c5141..b59729c873 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -163,7 +163,7 @@ class acp_language case 'download_file': case 'upload_data': - if (!$lang_id || empty($_POST['entry'])) + if (!$lang_id || empty($_POST['entry']) || !is_array($_POST['entry'])) { trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 9ff2db9704..c2fde25eb5 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -492,11 +492,11 @@ class acp_profile } } } - else if ($field_type == FIELD_BOOL && $key == 'field_default_value') + /* else if ($field_type == FIELD_BOOL && $key == 'field_default_value') { // Get the number of options if this key is 'field_maxlen' $var = request_var('field_default_value', 0); - } + }*/ $cp->vars[$key] = $var; } @@ -662,6 +662,10 @@ class acp_profile { $var = false; } + else if ($key == 'field_ident' && isset($cp->vars[$key])) + { + $_new_key_ary[$key]= $cp->vars[$key]; + } else { $_new_key_ary[$key] = (is_array($_REQUEST[$key])) ? utf8_normalize_nfc(request_var($key, array(''), true)) : utf8_normalize_nfc(request_var($key, '', true)); @@ -921,7 +925,7 @@ class acp_profile $lang_options[1]['lang_iso'] = $this->lang_defs['id'][$default_lang_id]; $lang_options[1]['fields'][$field] = array( 'TITLE' => $user->lang['CP_' . strtoupper($field)], - 'FIELD' => '
    ' . ((is_array($cp->vars[$field])) ? implode('
    ', $cp->vars[$field]) : str_replace("\n", '
    ', $cp->vars[$field])) . '
    ' + 'FIELD' => '
    ' . ((is_array($cp->vars[$field])) ? implode('
    ', $cp->vars[$field]) : bbcode_nl2br($cp->vars[$field])) . '
    ' ); if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 27c3157723..f8d4f1f80d 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -92,7 +92,7 @@ class acp_search unset($search); unset($error); - $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : array(); + $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : array(); $updated = request_var('updated', false); foreach ($settings as $config_name => $var_type) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 45e0ed35d1..300e795f3b 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -666,10 +666,8 @@ parse_css_file = {PARSE_CSS_FILE} $filelist = $filelist_cats = array(); - // we want newlines no carriage returns! - $_POST['template_data'] = (isset($_POST['template_data']) && !empty($_POST['template_data'])) ? str_replace(array("\r\n", "\r"), array("\n", "\n"), $_POST['template_data']) : ''; - - $template_data = (STRIP) ? stripslashes($_POST['template_data']) : $_POST['template_data']; + $template_data = utf8_normalize_nfc(request_var('template_data', '', true)); + $template_data = htmlspecialchars_decode($template_data); $template_file = utf8_normalize_nfc(request_var('template_file', '', true)); $text_rows = max(5, min(999, request_var('text_rows', 20))); $save_changes = (isset($_POST['save'])) ? true : false; @@ -871,7 +869,7 @@ parse_css_file = {PARSE_CSS_FILE} 'SELECTED_TEMPLATE' => $template_info['template_name'], 'TEMPLATE_FILE' => $template_file, - 'TEMPLATE_DATA' => htmlspecialchars($template_data), + 'TEMPLATE_DATA' => utf8_htmlspecialchars($template_data), 'TEXT_ROWS' => $text_rows) ); } @@ -1021,11 +1019,9 @@ parse_css_file = {PARSE_CSS_FILE} $filelist = $filelist_cats = array(); - // we want newlines no carriage returns! - $_POST['template_data'] = (isset($_POST['template_data']) && !empty($_POST['template_data'])) ? str_replace(array("\r\n", "\r"), array("\n", "\n"), $_POST['template_data']) : ''; - - $theme_data = (STRIP) ? stripslashes($_POST['template_data']) : $_POST['template_data']; - $theme_file = utf8_normalize_nfc(request_var('template_file', '', true)); + $theme_data = utf8_normalize_nfc(request_var('template_data', '', true)); + $theme_data = htmlspecialchars_decode($theme_data); + $theme_file = utf8_normalize_nfc(request_var('template_file', '', true)); $text_rows = max(5, min(999, request_var('text_rows', 20))); $save_changes = (isset($_POST['save'])) ? true : false; @@ -1040,7 +1036,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!($theme_info = $db->sql_fetchrow($result))) { - trigger_error($user->lang['NO_THEME'] . adm_bacl_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_freeresult($result); @@ -1188,7 +1184,7 @@ parse_css_file = {PARSE_CSS_FILE} 'SELECTED_TEMPLATE' => $theme_info['theme_name'], 'TEMPLATE_FILE' => $theme_file, - 'TEMPLATE_DATA' => htmlspecialchars($theme_data), + 'TEMPLATE_DATA' => utf8_htmlspecialchars($theme_data), 'TEXT_ROWS' => $text_rows) ); } diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 5b6a790e97..cab16af7b6 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -114,19 +114,31 @@ class acp_users // Generate overall "header" for user admin $s_form_options = ''; - // Include info file... - include_once($phpbb_root_path . 'includes/acp/info/acp_users.' . $phpEx); - $forms_ary = acp_users_info::module(); + // Build modes dropdown list + $sql = 'SELECT module_mode, module_auth + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'users' + AND module_enabled = 1 + AND module_class = 'acp' + ORDER BY left_id, module_mode"; + $result = $db->sql_query($sql); - foreach ($forms_ary['modes'] as $value => $ary) + $dropdown_modes = array(); + while ($row = $db->sql_fetchrow($result)) { - if (!$this->p_master->module_auth($ary['auth'])) + if (!$this->p_master->module_auth($row['module_auth'])) { continue; } - - $selected = ($mode == $value) ? ' selected="selected"' : ''; - $s_form_options .= ''; + + $dropdown_modes[$row['module_mode']] = true; + } + $db->sql_freeresult($result); + + foreach ($dropdown_modes as $module_mode => $null) + { + $selected = ($mode == $module_mode) ? ' selected="selected"' : ''; + $s_form_options .= ''; } $template->assign_vars(array( diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 389fe99bdb..de9cc9bac7 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -349,7 +349,7 @@ class auth // Since this function is not called that often (we are caching the data) we check for this inconsistency. $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', array_keys($hold_ary)); + WHERE ' . $db->sql_in_set('forum_id', array_keys($hold_ary), false, true); $result = $db->sql_query($sql); $forum_ids = (isset($hold_ary[0])) ? array(0) : array(); diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index ff6ff3edd1..a4e6365183 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -26,7 +26,17 @@ function init_ldap() return $user->lang['LDAP_NO_LDAP_EXTENSION']; } - if (!($ldap = @ldap_connect($config['ldap_server']))) + $config['ldap_port'] = (int) $config['ldap_port']; + if ($config['ldap_port']) + { + $ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']); + } + else + { + $ldap = @ldap_connect($config['ldap_server']); + } + + if (!$ldap) { return $user->lang['LDAP_NO_SERVER_CONNECTION']; } @@ -46,7 +56,7 @@ function init_ldap() $search = @ldap_search( $ldap, $config['ldap_base_dn'], - '(' . $config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($user->data['username'])) . ')', + ldap_user_filter($user->data['username']), (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), 0, 1 @@ -91,7 +101,17 @@ function login_ldap(&$username, &$password) ); } - if (!($ldap = @ldap_connect($config['ldap_server']))) + $config['ldap_port'] = (int) $config['ldap_port']; + if ($config['ldap_port']) + { + $ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']); + } + else + { + $ldap = @ldap_connect($config['ldap_server']); + } + + if (!$ldap) { return array( 'status' => LOGIN_ERROR_EXTERNAL_AUTH, @@ -114,7 +134,7 @@ function login_ldap(&$username, &$password) $search = @ldap_search( $ldap, $config['ldap_base_dn'], - '(' . $config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($username)) . ')', + ldap_user_filter($username), (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), 0, 1 @@ -215,6 +235,25 @@ function login_ldap(&$username, &$password) ); } +/** +* Generates a filter string for ldap_search to find a user +* +* @param $username string Username identifying the searched user +* +* @return string A filter string for ldap_search +*/ +function ldap_user_filter($username) +{ + global $config; + + $filter = '(' . $config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($username)) . ')'; + if ($config['ldap_user_filter']) + { + $filter = "(&$filter({$config['ldap_user_filter']}))"; + } + return $filter; +} + /** * Escapes an LDAP AttributeValue */ @@ -238,12 +277,8 @@ function acp_ldap(&$new)
    -

    ' . $user->lang['LDAP_USER_EXPLAIN'] . '
    -
    -
    -
    -

    ' . $user->lang['LDAP_PASSWORD_EXPLAIN'] . '
    -
    +

    ' . $user->lang['LDAP_PORT_EXPLAIN'] . '
    +

    ' . $user->lang['LDAP_DN_EXPLAIN'] . '
    @@ -253,16 +288,28 @@ function acp_ldap(&$new)

    ' . $user->lang['LDAP_UID_EXPLAIN'] . '
    +
    +

    ' . $user->lang['LDAP_USER_FILTER_EXPLAIN'] . '
    +
    +

    ' . $user->lang['LDAP_EMAIL_EXPLAIN'] . '
    +
    +

    ' . $user->lang['LDAP_USER_EXPLAIN'] . '
    +
    +
    +
    +

    ' . $user->lang['LDAP_PASSWORD_EXPLAIN'] . '
    +
    +
    '; // These are fields required in the config table return array( 'tpl' => $tpl, - 'config' => array('ldap_server', 'ldap_user', 'ldap_password', 'ldap_base_dn', 'ldap_uid', 'ldap_email') + 'config' => array('ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password') ); } diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index e2d8b7cde4..c877d56e2b 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -156,10 +156,9 @@ class bbcode while ($row = $db->sql_fetchrow($result)) { // To circumvent replacing newlines with
    for the generated html, - // we just remove newlines here. We do not do this within the admin panel to - // let the admin lay out his html code nicely - $row['bbcode_tpl'] = str_replace(array("\n", "\r"), '', $row['bbcode_tpl']); - $row['second_pass_replace'] = str_replace(array("\n", "\r"), '', $row['second_pass_replace']); + // we use carriage returns here. They are later changed back to newlines + $row['bbcode_tpl'] = str_replace("\n", "\r", $row['bbcode_tpl']); + $row['second_pass_replace'] = str_replace("\n", "\r", $row['second_pass_replace']); $rowset[$row['bbcode_id']] = $row; } @@ -333,7 +332,7 @@ class bbcode // In order to use templates with custom bbcodes we need // to replace all {VARS} to corresponding backreferences // Note that backreferences are numbered from bbcode_match - if (preg_match_all('/\{(URL|EMAIL|TEXT|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) + if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) { foreach ($m[0] as $i => $tok) { diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index af8d523ab1..771592a02a 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -164,9 +164,13 @@ class dbal_firebird extends dbal } } - if (!function_exists('ibase_affected_rows') && (preg_match('/^UPDATE ([\w_]++)\s+SET [\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\s*[\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+\s+(WHERE.*)$/s', $query, $regs) || preg_match('/^DELETE FROM ([\w_]++)\s*WHERE\s*(.*)$/s', $query, $regs))) + if (!function_exists('ibase_affected_rows') && (preg_match('/^UPDATE ([\w_]++)\s+SET [\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\s*[\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+\s+(WHERE.*)?$/s', $query, $regs) || preg_match('/^DELETE FROM ([\w_]++)\s*(WHERE\s*.*)?$/s', $query, $regs))) { - $affected_sql = 'SELECT COUNT(*) as num_rows_affected FROM ' . $regs[1] . ' ' . $regs[2]; + $affected_sql = 'SELECT COUNT(*) as num_rows_affected FROM ' . $regs[1]; + if (!empty($regs[2])) + { + $affected_sql .= ' ' . $regs[2]; + } if (!($temp_q_id = @ibase_query($this->db_connect_id, $affected_sql))) { @@ -297,7 +301,7 @@ class dbal_firebird extends dbal foreach (get_object_vars($cur_row) as $key => $value) { - $row[strtolower($key)] = trim(str_replace(array("\\0", "\\n"), array("\0", "\n"), $value)); + $row[strtolower($key)] = (is_string($value)) ? trim(str_replace(array("\\0", "\\n"), array("\0", "\n"), $value)) : $value; } return (sizeof($row)) ? $row : false; diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 422a5d44a4..f07d1adfe9 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -39,7 +39,14 @@ class dbal_mssql extends dbal @ini_set('mssql.textlimit', 2147483647); @ini_set('mssql.textsize', 2147483647); - $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link); + if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.1', '>='))) + { + $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link); + } + else + { + $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword); + } if ($this->db_connect_id && $this->dbname != '') { diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index 290142103f..72a424f46d 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -43,7 +43,28 @@ class dbal_mssql_odbc extends dbal $this->server = $sqlserver . (($port) ? ':' . $port : ''); $this->dbname = $database; - @ini_set('odbc.defaultlrl', 65536); + $max_size = @ini_get('odbc.defaultlrl'); + if (!empty($max_size)) + { + $unit = strtolower(substr($max_size, -1, 1)); + $max_size = (int) $max_size; + + if ($unit == 'k') + { + $max_size = floor($max_size / 1024); + } + else if ($unit == 'g') + { + $max_size *= 1024; + } + else if (is_numeric($unit)) + { + $max_size = floor((int) ($max_size . $unit) / 1048576); + } + $max_size = max(8, $max_size) . 'M'; + + @ini_set('odbc.defaultlrl', $max_size); + } $this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword); @@ -81,19 +102,15 @@ class dbal_mssql_odbc extends dbal switch ($status) { case 'begin': - return @odbc_autocommit($this->db_connect_id, false); + return @odbc_exec($this->db_connect_id, 'BEGIN TRANSACTION'); break; case 'commit': - $result = @odbc_commit($this->db_connect_id); - @odbc_autocommit($this->db_connect_id, true); - return $result; + return @odbc_exec($this->db_connect_id, 'COMMIT TRANSACTION'); break; case 'rollback': - $result = @odbc_rollback($this->db_connect_id); - @odbc_autocommit($this->db_connect_id, true); - return $result; + return @odbc_exec($this->db_connect_id, 'ROLLBACK TRANSACTION'); break; } diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 71a2002eb4..b3be4f9bd9 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -57,6 +57,31 @@ class dbal_mysql extends dbal if (version_compare($this->mysql_version, '4.1.3', '>=')) { @mysql_query("SET NAMES 'utf8'", $this->db_connect_id); + // enforce strict mode on databases that support it + if (version_compare($this->mysql_version, '5.0.2', '>=')) + { + $result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id); + $row = @mysql_fetch_assoc($result); + @mysql_free_result($result); + $modes = array_map('trim', explode(',', $row['sql_mode'])); + + // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES + if (!in_array('TRADITIONAL', $modes)) + { + if (!in_array('STRICT_ALL_TABLES', $modes)) + { + $modes[] = 'STRICT_ALL_TABLES'; + } + + if (!in_array('STRICT_TRANS_TABLES', $modes)) + { + $modes[] = 'STRICT_TRANS_TABLES'; + } + } + + $mode = implode(',', $modes); + @mysql_query("SET SESSION sql_mode='{$mode}'", $this->db_connect_id); + } } else if (version_compare($this->mysql_version, '4.0.0', '<')) { diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index 660188d1c7..320171e852 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -45,6 +45,31 @@ class dbal_mysqli extends dbal if ($this->db_connect_id && $this->dbname != '') { @mysqli_query($this->db_connect_id, "SET NAMES 'utf8'"); + // enforce strict mode on databases that support it + if (mysqli_get_server_version($this->db_connect_id) >= 50002) + { + $result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode'); + $row = @mysqli_fetch_assoc($result); + @mysqli_free_result($result); + $modes = array_map('trim', explode(',', $row['sql_mode'])); + + // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES + if (!in_array('TRADITIONAL', $modes)) + { + if (!in_array('STRICT_ALL_TABLES', $modes)) + { + $modes[] = 'STRICT_ALL_TABLES'; + } + + if (!in_array('STRICT_TRANS_TABLES', $modes)) + { + $modes[] = 'STRICT_TRANS_TABLES'; + } + } + + $mode = implode(',', $modes); + @mysqli_query($this->db_connect_id, "SET SESSION sql_mode='{$mode}'"); + } return $this->db_connect_id; } @@ -314,7 +339,7 @@ class dbal_mysqli extends dbal if (strpos(mysqli_get_server_info($this->db_connect_id), 'community') !== false) { $ver = mysqli_get_server_version($this->db_connect_id); - if ($ver >= 50037 && $ver < 51000) + if ($ver >= 50037 && $ver < 50100) { $test_prof = true; } diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 6049fa5734..18af5cbab0 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -115,7 +115,7 @@ class dbal_oracle extends dbal */ function _rewrite_where($where_clause) { - preg_match_all('/\s*(AND|OR)?\s*([\w_.]++)\s*(?:(=|<>)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER); + preg_match_all('/\s*(AND|OR)?\s*([\w_.]++)\s*(?:(=|<[=>]?|>=?)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER); $out = ''; foreach ($result as $val) { diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index b18970dab4..0308297c4e 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -1,7 +1,7 @@ */ class diff @@ -226,7 +226,7 @@ class diff } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki */ class mapped_diff extends diff @@ -274,7 +274,7 @@ class mapped_diff extends diff } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -301,7 +301,7 @@ class diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -326,7 +326,7 @@ class diff_op_copy extends diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -347,7 +347,7 @@ class diff_op_delete extends diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -368,7 +368,7 @@ class diff_op_add extends diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -392,7 +392,7 @@ class diff_op_change extends diff_op /** * A class for computing three way diffs. * -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki */ class diff3 extends diff @@ -637,7 +637,7 @@ class diff3 extends diff } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -683,7 +683,7 @@ class diff3_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -709,7 +709,7 @@ class diff3_op_copy extends diff3_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index a74fa9d263..c4802c2257 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -1,7 +1,7 @@ -* @package phpBB3 +* @package diff * * @access private */ diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index e920e9688f..feb741762a 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -1,7 +1,7 @@ lang a default one is displayed -* If title_CONFIRM can not be found in user->lang the text given is used. +* If title cannot be found in user->lang a default one is displayed +* If title_CONFIRM cannot be found in user->lang the text given is used. * @param string $hidden Hidden variables * @param string $html_body Template used for confirm box * @param string $u_action Custom form action @@ -1970,7 +1977,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo if (isset($_POST['confirm'])) { // language frontier - if ($_POST['confirm'] == $user->lang['YES']) + if ($_POST['confirm'] === $user->lang['YES']) { $confirm = true; } @@ -2286,8 +2293,10 @@ function login_forum_box($forum_data) if ($password) { // Remove expired authorised sessions - $sql = 'SELECT session_id - FROM ' . SESSIONS_TABLE; + $sql = 'SELECT f.session_id + FROM ' . FORUMS_ACCESS_TABLE . ' f + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (f.session_id = s.session_id) + WHERE s.session_id IS NULL'; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -2301,7 +2310,7 @@ function login_forum_box($forum_data) // Remove expired sessions $sql = 'DELETE FROM ' . FORUMS_ACCESS_TABLE . ' - WHERE ' . $db->sql_in_set('session_id', $sql_in, true); + WHERE ' . $db->sql_in_set('session_id', $sql_in); $db->sql_query($sql); } $db->sql_freeresult($result); @@ -2520,7 +2529,7 @@ function strip_bbcode(&$text, $uid = '') $uid = '[0-9a-z]{5,}'; } - $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?$uid)\]#", ' ', $text); + $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text); $match = get_preg_expression('bbcode_htm'); $replace = array('\1', '\1', '\2', '\1', '', ''); @@ -2564,8 +2573,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) $bbcode->bbcode_second_pass($text, $uid); } - $text = str_replace("\n", '
    ', $text); - + $text = bbcode_nl2br($text); $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); return $text; @@ -2806,6 +2814,17 @@ function censor_text($text) return $text; } +/** +* custom version of nl2br which takes custom BBCodes into account +*/ +function bbcode_nl2br($text) +{ + // custom BBCodes might contain carriage returns so they + // are not converted into
    so now revert that + $text = str_replace(array("\n", "\r"), array('
    ', "\n"), $text); + return $text; +} + /** * Smiley processing */ @@ -2948,7 +2967,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] ); $filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize); - $comment = str_replace("\n", '
    ', censor_text($attachment['attach_comment'])); + $comment = bbcode_nl2br(censor_text($attachment['attach_comment'])); $block_array += array( 'UPLOAD_ICON' => $upload_icon, @@ -3491,14 +3510,14 @@ function truncate_string($string, $max_length = 60, $allow_reply = true, $append } $_chars = utf8_str_split(htmlspecialchars_decode($string)); - $chars = array_map('htmlspecialchars', $_chars); + $chars = array_map('utf8_htmlspecialchars', $_chars); // Now check the length ;) if (sizeof($chars) > $max_length) { // Cut off the last elements from the array $string = implode('', array_slice($chars, 0, $max_length)); - $stripped = true; + $stripped = true; } if ($strip_reply) @@ -3685,6 +3704,15 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { + // flush the content, else we get a white page if output buffering is on + if ($config['gzip_compress']) + { + if (@extension_loaded('zlib') && !headers_sent()) + { + ob_flush(); + } + } + // remove complete path to installation, with the risk of changing backslashes meant to be there $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); @@ -4276,7 +4304,10 @@ function page_footer($run_cron = true) garbage_collection(); - exit; + if (!defined('PHPBB_EMBEDDED')) + { + exit; + } } /** diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 29d52406da..4dfd58e28c 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2429,11 +2429,11 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id // If within the admin panel we do not censor text out if (defined('IN_ADMIN')) { - $log[$i]['action'] = str_replace("\n", '
    ', $log[$i]['action']); + $log[$i]['action'] = bbcode_nl2br($log[$i]['action']); } else { - $log[$i]['action'] = str_replace("\n", '
    ', censor_text($log[$i]['action'])); + $log[$i]['action'] = bbcode_nl2br(censor_text($log[$i]['action'])); } } else diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 159ec387bd..12b3109430 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -228,7 +228,7 @@ function validate_website($url) { return ''; } - else if (strpos(strtolower($url), 'http://') !== 0) + else if (!preg_match('#^[a-z0-9]+://#i', $url) && strlen($url) > 0) { return 'http://' . $url; } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a28d91a7e9..208226257d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -997,7 +997,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $for $db->sql_freeresult($result); } - if (!is_null($notify_status)) + if (!is_null($notify_status) && $notify_status !== '') { if (isset($_GET['unwatch'])) { diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index f9c0a6308e..04f664139f 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -14,7 +14,7 @@ * * @version class.jabber2.php 1306 2007-06-21 * @copyright 2006 Flyspray.org -* @author: Florian Schmitz (floele) +* @author Florian Schmitz (floele) * * Modified by Acyd Burn * @@ -416,7 +416,7 @@ class jabber } // Let's use TLS if SSL is not enabled and we can actually use it - if (!$this->session['ssl'] && $this->can_use_tls() && isset($xml['stream:features'][0]['#']['starttls'])) + if (!$this->session['ssl'] && $this->can_use_tls() && $this->can_use_ssl() && isset($xml['stream:features'][0]['#']['starttls'])) { $this->add_to_log('Switching to TLS.'); $this->send("\n"); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index bd838a3346..ae156436f0 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -399,12 +399,12 @@ class messenger if ($config['smtp_delivery']) { - $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap($this->msg), $err_msg, $headers); + $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers); } else { ob_start(); - $result = $config['email_function_name']($mail_to, mail_encode($this->subject), implode("\n", preg_split("/\r?\n/", wordwrap($this->msg))), $headers); + $result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } @@ -575,6 +575,12 @@ class queue $package_size = $data_ary['package_size']; $num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size; + // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... + if (sizeof($data_ary['data']) > $package_size * 2.5) + { + $num_items = sizeof($data_ary['data']); + } + switch ($object) { case 'email': @@ -627,12 +633,12 @@ class queue if ($config['smtp_delivery']) { - $result = smtpmail($addresses, mail_encode($subject), wordwrap($msg), $err_msg, $headers); + $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers); } else { ob_start(); - $result = $config['email_function_name']($to, mail_encode($subject), implode("\n", preg_split("/\r?\n/", wordwrap($msg))), $headers); + $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4b38919e81..222f9a3843 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -652,11 +652,23 @@ function create_thumbnail($source, $destination, $mimetype) if ($type['version'] == 1) { $new_image = imagecreate($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); } else { $new_image = imagecreatetruecolor($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); } @@ -1009,8 +1021,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $decoded_message = $message; decode_message($decoded_message, $row['bbcode_uid']); - $decoded_message = censor_text($decoded_message); - $decoded_message = str_replace("\n", "
    ", $decoded_message); + $decoded_message = bbcode_nl2br($decoded_message); } if ($row['bbcode_bitfield']) @@ -1018,8 +1029,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); } - $message = str_replace("\n", '
    ', $message); - + $message = bbcode_nl2br($message); $message = smiley_text($message, !$row['enable_smilies']); if (!empty($attachments[$row['post_id']])) @@ -1238,8 +1248,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id 'TOPIC_TITLE' => htmlspecialchars_decode($topic_title), 'FORUM_NAME' => htmlspecialchars_decode($forum_name), - 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&e=0", - 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&e=0", + 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id", + 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id", 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&unwatch=topic", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&unwatch=forum", diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ca06e05b39..f0d0520a03 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -778,7 +778,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol trigger_error('NOT_AUTHORISED'); } - if ($row['pm_count'] + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $row['pm_count'] + sizeof($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '

    '; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $row['folder_name']); @@ -795,7 +795,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $num_messages = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); - if ($num_messages + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '

    '; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); @@ -1281,9 +1281,9 @@ function get_folder_status($folder_id, $folder) $return = array( 'folder_name' => $folder['folder_name'], 'cur' => $folder['num_messages'], - 'remaining' => $user->data['message_limit'] - $folder['num_messages'], + 'remaining' => ($user->data['message_limit']) ? $user->data['message_limit'] - $folder['num_messages'] : 0, 'max' => $user->data['message_limit'], - 'percent' => ($user->data['message_limit'] > 0) ? round(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100, + 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? round(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, ); $return['message'] = sprintf($user->lang['FOLDER_STATUS_MSG'], $return['percent'], $return['cur'], $return['max']); @@ -1348,10 +1348,12 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) if (isset($data['address_list']['g']) && sizeof($data['address_list']['g'])) { - $sql = 'SELECT group_id, user_id - FROM ' . USER_GROUP_TABLE . ' - WHERE ' . $db->sql_in_set('group_id', array_keys($data['address_list']['g'])) . ' - AND user_pending = 0'; + $sql = 'SELECT u.user_type, ug.group_id, ug.user_id + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug + WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . ' + AND ug.user_pending = 0 + AND u.user_id = ug.user_id + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -1684,4 +1686,145 @@ function pm_notification($mode, $author, $recipients, $subject, $message) unset($messenger); } +/** +* Display Message History +*/ +function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) +{ + global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; + + // Get History Messages (could be newer) + $sql = 'SELECT t.*, p.*, u.* + FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u + WHERE t.msg_id = p.msg_id + AND p.author_id = u.user_id + AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ") + AND t.user_id = $user_id"; + + if (!$message_row['root_level']) + { + $sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))"; + } + else + { + $sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')'; + } + $sql .= ' ORDER BY p.message_time DESC'; + + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + + if (!$row) + { + $db->sql_freeresult($result); + return false; + } + + $rowset = array(); + $bbcode_bitfield = ''; + $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; + + do + { + $folder_id = (int) $row['folder_id']; + + $row['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; + + if (isset($rowset[$row['msg_id']])) + { + $rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; + } + else + { + $rowset[$row['msg_id']] = $row; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); + } + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + $title = $row['message_subject']; + + if (sizeof($rowset) == 1 && !$in_post_mode) + { + return false; + } + + // Instantiate BBCode class + if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '') + { + if (!class_exists('bbcode')) + { + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); + } + + $title = censor_text($title); + + $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); + $next_history_pm = $previous_history_pm = $prev_id = 0; + + foreach ($rowset as $id => $row) + { + $author_id = $row['author_id']; + $folder_id = (int) $row['folder_id']; + + $subject = $row['message_subject']; + $message = $row['message_text']; + + $message = censor_text($message); + + if ($row['bbcode_bitfield']) + { + $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); + } + + $message = bbcode_nl2br($message); + $message = smiley_text($message, !$row['enable_smilies']); + + $subject = censor_text($subject); + + if ($id == $msg_id) + { + $next_history_pm = next($rowset); + $next_history_pm = (sizeof($next_history_pm)) ? (int) $next_history_pm['msg_id'] : 0; + $previous_history_pm = $prev_id; + } + + $template->assign_block_vars('history_row', array( + 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), + + 'SUBJECT' => $subject, + 'SENT_DATE' => $user->format_date($row['message_time']), + 'MESSAGE' => $message, + 'FOLDER' => implode(', ', $row['folder']), + + 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), + 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, + 'S_IN_POST_MODE' => $in_post_mode, + + 'MSG_ID' => $row['msg_id'], + 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], + 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') + ); + unset($rowset[$id]); + $prev_id = $id; + } + + $template->assign_vars(array( + 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), + 'HISTORY_TITLE' => $title, + + 'U_VIEW_NEXT_HISTORY' => "$url&p=" . (($next_history_pm) ? $next_history_pm : $msg_id), + 'U_VIEW_PREVIOUS_HISTORY' => "$url&p=" . (($previous_history_pm) ? $previous_history_pm : $msg_id)) + ); + + return true; +} + ?> \ No newline at end of file diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index f3ebe429cd..cbad80e28e 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -176,7 +176,7 @@ class custom_profile if (!empty($field_data['field_validation']) && $field_data['field_validation'] != '.*') { - $field_validate = ($field_type == FIELD_STRING) ? $field_value : str_replace("\n", ' ', $field_value); + $field_validate = ($field_type == FIELD_STRING) ? $field_value : bbcode_nl2br($field_value); if (!preg_match('#^' . str_replace('\\\\', '\\', $field_data['field_validation']) . '$#i', $field_validate)) { return 'FIELD_INVALID_CHARS'; @@ -462,7 +462,7 @@ class custom_profile $value = make_clickable($value); $value = censor_text($value); - $value = str_replace("\n", '
    ', $value); + $value = bbcode_nl2br($value); return $value; break; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0194ec06a4..fed783e880 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -173,6 +173,7 @@ function user_add($user_row, $cp_data = false) 'user_ip' => '', 'user_regdate' => time(), 'user_passchg' => time(), + 'user_options' => 895, 'user_inactive_reason' => 0, 'user_inactive_time' => 0, @@ -181,7 +182,7 @@ function user_add($user_row, $cp_data = false) 'user_lastpost_time' => 0, 'user_lastpage' => '', 'user_posts' => 0, - 'user_dst' => 0, + 'user_dst' => (int) $config['board_dst'], 'user_colour' => '', 'user_occ' => '', 'user_interests' => '', @@ -1981,14 +1982,13 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var $dp2 = @opendir("$path/$file"); while (($sub_file = readdir($dp2)) !== false) { - if (preg_match('#\.(?:gif|png|jpe?g)$#i', $sub_file)) + if (preg_match('#^[^&"<>]*\.(?:gif|png|jpe?g)$#i', $sub_file)) { $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array( 'file' => "$file/$sub_file", 'filename' => $sub_file, 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))), ); - $avatar_col_count++; if ($avatar_col_count == $items_per_column) { @@ -2302,6 +2302,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (!sizeof($error)) { + $user_ary = array(); $sql_ary = array( 'group_name' => (string) $name, 'group_desc' => (string) $desc, @@ -2335,6 +2336,26 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if ($group_id) { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $user_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (isset($sql_ary['group_avatar']) && !$sql_ary['group_avatar']) + { + remove_default_avatar($group_id, $user_ary); + } + if (isset($sql_ary['group_rank']) && !$sql_ary['group_rank']) + { + remove_default_rank($group_id, $user_ary); + } + $sql = 'UPDATE ' . GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE group_id = $group_id"; @@ -2380,24 +2401,10 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow } } - if (sizeof($sql_ary)) + if (sizeof($sql_ary) && sizeof($user_ary)) { - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . ' - WHERE group_id = ' . $group_id; - $result = $db->sql_query($sql); - - $user_ary = array(); - while ($row = $db->sql_fetchrow($result)) - { - $user_ary[] = $row['user_id']; - } - $db->sql_freeresult($result); - - if (sizeof($user_ary)) - { - group_set_user_default($group_id, $user_ary, $sql_ary, false, true); - } + group_set_user_default($group_id, $user_ary, $sql_ary); + } $name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name; @@ -2711,7 +2718,9 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, { if (isset($sql_where_ary[$gid]) && sizeof($sql_where_ary[$gid])) { - group_set_user_default($gid, $sql_where_ary[$gid], $special_group_data[$gid]); + remove_default_rank($group_id, $sql_where_ary[$gid]); + remove_default_avatar($group_id, $sql_where_ary[$gid]); + group_set_user_default($gid, $sql_where_ary[$gid], $default_data_ary); } } unset($special_group_data); @@ -2739,6 +2748,86 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, return false; } + +/** +* Removes the group avatar of the default group from the users in user_ids who have that group as default. +*/ +function remove_default_avatar($group_id, $user_ids) +{ + global $db; + + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + if (empty($user_ids)) + { + return false; + } + + $user_ids = array_map('intval', $user_ids); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int)$group_id; + $result = $db->sql_query($sql); + if (!$row = $db->sql_fetchrow($result)) + { + $db->sql_freeresult($result); + return false; + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_avatar = \'\', + user_avatar_type = 0, + user_avatar_width = 0, + user_avatar_height = 0 + WHERE group_id = ' . (int)$group_id . ' + AND user_avatar = \'' . $db->sql_escape($row['group_avatar']) . '\' + AND ' . $db->sql_in_set('user_id', $user_ids); + + $db->sql_query($sql); +} + +/** +* Removes the group rank of the default group from the users in user_ids who have that group as default. +*/ +function remove_default_rank($group_id, $user_ids) +{ + global $db; + + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + if (empty($user_ids)) + { + return false; + } + + $user_ids = array_map('intval', $user_ids); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int)$group_id; + $result = $db->sql_query($sql); + if (!$row = $db->sql_fetchrow($result)) + { + $db->sql_freeresult($result); + return false; + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_rank = 0 + WHERE group_id = ' . (int)$group_id . ' + AND user_rank <> 0 + AND user_rank = ' . (int)$row['group_rank'] . ' + AND ' . $db->sql_in_set('user_id', $user_ids); + $db->sql_query($sql); +} + /** * This is used to promote (to leader), demote or set as default a member/s */ @@ -2827,6 +2916,26 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna break; case 'default': + $sql = 'SELECT user_id, group_id FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true); + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($groups[$row['group_id']])) + { + $groups[$row['group_id']] = array(); + } + $groups[$row['group_id']][] = $row['user_id']; + } + $db->sql_freeresult($result); + + foreach ($groups as $gid => $uids) + { + remove_default_rank($gid, $uids); + remove_default_avatar($gid, $uids); + } group_set_user_default($group_id, $user_id_ary, $group_attributes); $log = 'LOG_GROUP_DEFAULTS'; break; @@ -2893,7 +3002,7 @@ function group_validate_groupname($group_id, $group_name) * * @private */ -function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false, $same_group = false) +function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) { global $db; @@ -2926,12 +3035,14 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal $db->sql_freeresult($result); } + + foreach ($attribute_ary as $attribute => $type) { if (isset($group_attributes[$attribute])) { // If we are about to set an avatar or rank, we will not overwrite with empty, unless we are not actually changing the default group - if (!$same_group && (strpos($attribute, 'group_avatar') === 0 || strpos($attribute, 'group_rank') === 0) && !$group_attributes[$attribute]) + if ((strpos($attribute, 'group_avatar') === 0 || strpos($attribute, 'group_rank') === 0) && !$group_attributes[$attribute]) { continue; } @@ -2957,6 +3068,12 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal } $db->sql_freeresult($result); } + else + { + unset($sql_ary['user_avatar_type']); + unset($sql_ary['user_avatar_height']); + unset($sql_ary['user_avatar_width']); + } $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE ' . $db->sql_in_set('user_id', $user_id_ary); diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 698bcc8dd6..dd10750d99 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -112,13 +112,15 @@ function mcp_post_details($id, $mode, $action) // Process message, leave it uncensored $message = $post_info['post_text']; - $message = str_replace("\n", '
    ', $message); + if ($post_info['bbcode_bitfield']) { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } + + $message = bbcode_nl2br($message); $message = smiley_text($message); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) @@ -261,8 +263,8 @@ function mcp_post_details($id, $mode, $action) 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '', 'USER_NOTIFY' => ($row['user_notify']) ? true : false, 'REPORT_TIME' => $user->format_date($row['report_time']), - 'REPORT_TEXT' => str_replace("\n", '
    ', trim($row['report_text']))) - ); + 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), + )); } while ($row = $db->sql_fetchrow($result)); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 06cabf65a0..0d2ea76498 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -119,13 +119,15 @@ class mcp_queue // Process message, leave it uncensored $message = $post_info['post_text']; - $message = str_replace("\n", '
    ', $message); + if ($post_info['bbcode_bitfield']) { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } + + $message = bbcode_nl2br($message); $message = smiley_text($message); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) @@ -460,12 +462,12 @@ function approve_post($post_id_list, $id, $mode) 'redirect' => $redirect) ); + $post_info = get_post_data($post_id_list, 'm_approve'); + if (confirm_box(true)) { $notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false; - $post_info = get_post_data($post_id_list, 'm_approve'); - // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1 // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1 @@ -690,8 +692,23 @@ function approve_post($post_id_list, $id, $mode) } else { + $show_notify = false; + + foreach ($post_info as $post_data) + { + if ($post_data['poster_id'] == ANONYMOUS) + { + continue; + } + else + { + $show_notify = true; + break; + } + } + $template->assign_vars(array( - 'S_NOTIFY_POSTER' => true, + 'S_NOTIFY_POSTER' => $show_notify, 'S_APPROVE' => true) ); @@ -771,9 +788,10 @@ function disapprove_post($post_id_list, $id, $mode) } } + $post_info = get_post_data($post_id_list, 'm_approve'); + if (confirm_box(true)) { - $post_info = get_post_data($post_id_list, 'm_approve'); // If Topic -> forum_topics_real -= 1 // If Post -> topic_replies_real -= 1 @@ -929,8 +947,23 @@ function disapprove_post($post_id_list, $id, $mode) display_reasons($reason_id); + $show_notify = false; + + foreach ($post_info as $post_data) + { + if ($post_data['poster_id'] == ANONYMOUS) + { + continue; + } + else + { + $show_notify = true; + break; + } + } + $template->assign_vars(array( - 'S_NOTIFY_POSTER' => true, + 'S_NOTIFY_POSTER' => $show_notify, 'S_APPROVE' => false, 'REASON' => $reason, 'ADDITIONAL_MSG' => $additional_msg) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 9a06b3bbf2..9528eec33b 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -128,13 +128,15 @@ class mcp_reports // Process message, leave it uncensored $message = $post_info['post_text']; - $message = str_replace("\n", '
    ', $message); + if ($post_info['bbcode_bitfield']) { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } + + $message = bbcode_nl2br($message); $message = smiley_text($message); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index a5bfba23fe..1002b1c918 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -175,13 +175,13 @@ function mcp_topic_view($id, $mode, $action) { $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; - $message = str_replace("\n", '
    ', $message); if ($row['bbcode_bitfield']) { $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); } + $message = bbcode_nl2br($message); $message = smiley_text($message); if (!empty($attachments[$row['post_id']])) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 915df898f7..892929539f 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -253,8 +253,7 @@ class mcp_warn // We want to make the message available here as a reminder // Parse the message and subject - $message = $user_row['post_text']; - $message = str_replace("\n", '
    ', censor_text($message)); + $message = censor_text($user_row['post_text']); // Second parse bbcode here if ($user_row['bbcode_bitfield']) @@ -265,7 +264,7 @@ class mcp_warn $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); } - // Always process smilies after parsing bbcodes + $message = bbcode_nl2br($message); $message = smiley_text($message); // Generate the appropriate user information for the user we are looking at diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index ea28061da0..d2e54e1404 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -426,10 +426,10 @@ class bbcode_firstpass extends bbcode } $code = preg_replace('#^(.*)#s', '$2', $code); - $code = preg_replace('#(?:[\n\r\s\t]| )*$#u', '', $code); + $code = preg_replace('#(?:\s++| )*+$#u', '', $code); // remove newline at the end - if (!empty($code) && $code[strlen($code) - 1] == "\n") + if (!empty($code) && substr($code, -1) == "\n") { $code = substr($code, 0, -1); } @@ -1138,6 +1138,9 @@ class parse_message extends bbcode_firstpass $this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, $this->allow_url_bbcode, true); } + // Replace naughty words such as farty pants + $this->message = censor_text($this->message); + // Parse BBcode if ($allow_bbcode) { @@ -1147,11 +1150,9 @@ class parse_message extends bbcode_firstpass $this->bbcode_second_pass($this->message, $this->bbcode_uid); } + $this->message = bbcode_nl2br($this->message); $this->message = smiley_text($this->message, !$allow_smilies); - // Replace naughty words such as farty pants - $this->message = str_replace("\n", '
    ', censor_text($this->message)); - if (!$update_this_message) { unset($this->message); @@ -1370,9 +1371,10 @@ class parse_message extends bbcode_firstpass { include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - $index = (int) key($_POST['delete_file']); + $index = array_keys(request_var('delete_file', array(0 => 0))); + $index = (!empty($index)) ? $index[0] : false; - if (!empty($this->attachment_data[$index])) + if ($index !== false && !empty($this->attachment_data[$index])) { // delete selected attachment if ($this->attachment_data[$index]['is_orphan']) @@ -1564,7 +1566,7 @@ class parse_message extends bbcode_firstpass $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); - $this->bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); + $bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); $this->message = $tmp_message; // Parse Poll Title diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 9d5f91a698..a029388101 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1190,6 +1190,7 @@ class user extends session var $dst; var $lang_name; + var $lang_id = false; var $lang_path; var $img_lang; var $img_array = array(); @@ -1397,7 +1398,7 @@ class user extends session $sql = 'SELECT image_name, image_filename, image_lang, image_height, image_width FROM ' . STYLES_IMAGESET_DATA_TABLE . ' WHERE imageset_id = ' . $this->theme['imageset_id'] . " - AND image_lang IN('" . $db->sql_escape($this->img_lang) . "', '')"; + AND image_lang IN ('" . $db->sql_escape($this->img_lang) . "', '')"; $result = $db->sql_query($sql, 3600); $localised_images = false; @@ -1720,7 +1721,7 @@ class user extends session { global $config, $db; - if (isset($this->lang_id)) + if (!empty($this->lang_id)) { return $this->lang_id; } @@ -1734,10 +1735,10 @@ class user extends session FROM ' . LANG_TABLE . " WHERE lang_iso = '" . $db->sql_escape($this->lang_name) . "'"; $result = $db->sql_query($sql); - $lang_id = (int) $db->sql_fetchfield('lang_id'); + $this->lang_id = (int) $db->sql_fetchfield('lang_id'); $db->sql_freeresult($result); - return $lang_id; + return $this->lang_id; } /** diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index f8db087d48..b13dbaa99a 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -149,6 +149,14 @@ class template { global $user; + if (defined('IN_ERROR_HANDLER')) + { + if ((E_NOTICE & error_reporting()) == E_NOTICE) + { + error_reporting(error_reporting() ^ E_NOTICE); + } + } + if ($filename = $this->_tpl_load($handle)) { ($include_once) ? include_once($filename) : include($filename); diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 895cb51020..b20e4a55ed 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -121,7 +121,7 @@ class ucp_attachments $template->assign_block_vars('attachrow', array( 'ROW_NUMBER' => $row_count + ($start + 1), 'FILENAME' => $row['real_filename'], - 'COMMENT' => str_replace("\n", '
    ', $row['attach_comment']), + 'COMMENT' => bbcode_nl2br($row['attach_comment']), 'EXTENSION' => $row['extension'], 'SIZE' => ($row['filesize'] >= 1048576) ? ($row['filesize'] >> 20) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? ($row['filesize'] >> 10) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']), 'DOWNLOAD_COUNT' => $row['download_count'], diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index e81c572ddf..20086e605e 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -320,6 +320,11 @@ function compose_pm($id, $mode, $action) } } + if ($action == 'post') + { + $template->assign_var('S_NEW_MESSAGE', true); + } + if (!isset($icon_id)) { $icon_id = 0; @@ -976,6 +981,15 @@ function compose_pm($id, $mode, $action) { posting_gen_attachment_entry($attachment_data, $filename_data); } + + // Message History + if ($action == 'reply' || $action == 'quote' || $action == 'forward') + { + if (message_history($msg_id, $user->data['user_id'], $post, array(), true)) + { + $template->assign_var('S_DISPLAY_HISTORY', true); + } + } } /** diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index 95326090c7..b4f2cbeb65 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -312,8 +312,8 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Remove Rule if (isset($_POST['delete_rule']) && !isset($_POST['cancel'])) { - $delete_id = array_map('intval', array_keys($_POST['delete_rule'])); - $delete_id = (int) $delete_id[0]; + $delete_id = array_keys(request_var('delete_rule', array(0 => 0))); + $delete_id = (!empty($delete_id[0])) ? $delete_id[0] : 0; if (!$delete_id) { diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 8fab63bc45..492ce08b45 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -56,8 +56,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info = get_user_information($author_id, $message_row); // Parse the message and subject - $message = $message_row['message_text']; - $message = str_replace("\n", '
    ', censor_text($message)); + $message = censor_text($message_row['message_text']); // Second parse bbcode here if ($message_row['bbcode_bitfield']) @@ -66,6 +65,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } // Always process smilies after parsing bbcodes + $message = bbcode_nl2br($message); $message = smiley_text($message); // Replace naughty words such as farty pants @@ -142,7 +142,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) if ($signature) { $signature = censor_text($signature); - $signature = str_replace("\n", '
    ', censor_text($signature)); if ($user_info['user_sig_bbcode_bitfield']) { @@ -155,6 +154,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']); } + $signature = bbcode_nl2br($signature); $signature = smiley_text($signature); } @@ -230,146 +230,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } } -/** -* Display Message History -*/ -function message_history($msg_id, $user_id, $message_row, $folder) -{ - global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; - - // Get History Messages (could be newer) - $sql = 'SELECT t.*, p.*, u.* - FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u - WHERE t.msg_id = p.msg_id - AND p.author_id = u.user_id - AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ") - AND t.user_id = $user_id"; - - if (!$message_row['root_level']) - { - $sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))"; - } - else - { - $sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')'; - } - $sql .= ' ORDER BY p.message_time DESC'; - - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - - if (!$row) - { - $db->sql_freeresult($result); - return false; - } - - $rowset = array(); - $bbcode_bitfield = ''; - $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; - - do - { - $folder_id = (int) $row['folder_id']; - - $row['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; - - if (isset($rowset[$row['msg_id']])) - { - $rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; - } - else - { - $rowset[$row['msg_id']] = $row; - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); - } - } - while ($row = $db->sql_fetchrow($result)); - $db->sql_freeresult($result); - - $title = $row['message_subject']; - - if (sizeof($rowset) == 1) - { - return false; - } - - // Instantiate BBCode class - if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '') - { - if (!class_exists('bbcode')) - { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); - } - $bbcode = new bbcode(base64_encode($bbcode_bitfield)); - } - - $title = censor_text($title); - - $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); - $next_history_pm = $previous_history_pm = $prev_id = 0; - - foreach ($rowset as $id => $row) - { - $author_id = $row['author_id']; - $folder_id = (int) $row['folder_id']; - - $subject = $row['message_subject']; - $message = $row['message_text']; - - $message = censor_text($message); - $message = str_replace("\n", '
    ', $message); - - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = smiley_text($message, !$row['enable_smilies']); - - $subject = censor_text($subject); - - if ($id == $msg_id) - { - $next_history_pm = next($rowset); - $next_history_pm = (sizeof($next_history_pm)) ? (int) $next_history_pm['msg_id'] : 0; - $previous_history_pm = $prev_id; - } - - $template->assign_block_vars('history_row', array( - 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), - 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), - 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']), - 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), - - 'SUBJECT' => $subject, - 'SENT_DATE' => $user->format_date($row['message_time']), - 'MESSAGE' => $message, - 'FOLDER' => implode(', ', $row['folder']), - - 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), - 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, - - 'MSG_ID' => $row['msg_id'], - 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], - 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', - 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') - ); - unset($rowset[$id]); - $prev_id = $id; - } - - $template->assign_vars(array( - 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), - 'TITLE' => $title, - - 'U_VIEW_NEXT_HISTORY' => "$url&p=" . (($next_history_pm) ? $next_history_pm : $msg_id), - 'U_VIEW_PREVIOUS_HISTORY' => "$url&p=" . (($previous_history_pm) ? $previous_history_pm : $msg_id)) - ); - - return true; -} - /** * Get user information (only for message display) */ diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index b62ee04318..ca44260760 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -427,8 +427,10 @@ class ucp_register $str = ''; if (!$change_lang) { - $sql = 'SELECT session_id - FROM ' . SESSIONS_TABLE; + $sql = 'SELECT DISTINCT c.session_id + FROM ' . CONFIRM_TABLE . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL'; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -443,7 +445,7 @@ class ucp_register if (sizeof($sql_in)) { $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE ' . $db->sql_in_set('session_id', $sql_in, true) . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in) . ' AND confirm_type = ' . CONFIRM_REG; $db->sql_query($sql); } diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php index c1a0fc9a7b..4c705b05cb 100644 --- a/phpBB/includes/utf/utf_normalizer.php +++ b/phpBB/includes/utf/utf_normalizer.php @@ -1,7 +1,7 @@ ''); + $index = 0; + + foreach ($lines as $line) + { + $words = explode(' ', $line); + + for ($i = 0, $size = sizeof($words); $i < $size; $i++) + { + $word = $words[$i]; + + // If cut is true we need to cut the word if it is > width chars + if ($cut && utf8_strlen($word) > $width) + { + $words[$i] = utf8_substr($word, $width); + $word = utf8_substr($word, 0, $width); + $i--; + } + + if (utf8_strlen($new_lines[$index] . $word) > $width) + { + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + $new_lines[$index] .= $word . ' '; + } + + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + unset($new_lines[$index]); + return implode($break, $new_lines); +} + ?> \ No newline at end of file diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index bacd6e43b9..7f74f7bda3 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -31,7 +31,7 @@ unset($dbpasswd); */ $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', - 'version' => '1.0.RC4', + 'version' => '1.0.RC5', 'phpbb_version' => '3.0.0', 'author' => 'phpBB Group', 'dbms' => $dbms, diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index ab1a1ede11..74ca47986e 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -587,7 +587,7 @@ function phpbb_convert_authentication($mode) $forum_access = array(); while ($row = $src_db->sql_fetchrow($result)) { - $forum_access[] = $row; + $forum_access[$row['forum_id']] = $row; } $src_db->sql_freeresult($result); @@ -967,6 +967,12 @@ function phpbb_convert_authentication($mode) { // And now the moderators // We make sure that they have at least standard access to the forums they moderate in addition to the moderating permissions + + $mod_post_map = array( + 'auth_announce' => 'f_announce', + 'auth_sticky' => 'f_sticky' + ); + foreach ($user_access as $forum_id => $access_map) { $forum_id = (int) $forum_id; @@ -977,6 +983,13 @@ function phpbb_convert_authentication($mode) { mass_auth('user_role', $forum_id, (int) phpbb_user_id($access['user_id']), 'MOD_STANDARD'); mass_auth('user_role', $forum_id, (int) phpbb_user_id($access['user_id']), 'FORUM_STANDARD'); + foreach ($mod_post_map as $old => $new) + { + if (isset($forum_access[$forum_id]) && isset($forum_access[$forum_id][$old]) && $forum_access[$forum_id][$old] == AUTH_MOD) + { + mass_auth('user', $forum_id, (int) phpbb_user_id($access['user_id']), $new, ACL_YES); + } + } } } } @@ -991,6 +1004,13 @@ function phpbb_convert_authentication($mode) { mass_auth('group_role', $forum_id, (int) $access['group_id'], 'MOD_STANDARD'); mass_auth('group_role', $forum_id, (int) $access['group_id'], 'FORUM_STANDARD'); + foreach ($mod_post_map as $old => $new) + { + if (isset($forum_access[$forum_id]) && isset($forum_access[$forum_id][$old]) && $forum_access[$forum_id][$old] == AUTH_MOD) + { + mass_auth('group', $forum_id, (int) $access['group_id'], $new, ACL_YES); + } + } } } } diff --git a/phpBB/install/data/confusables.php b/phpBB/install/data/confusables.php index 86223bd726..4472946a55 100644 --- a/phpBB/install/data/confusables.php +++ b/phpBB/install/data/confusables.php @@ -621,7 +621,7 @@ function utf8_new_case_fold_nfkc($text, $option = 'full') } // convert to NFKC - utf_normalizer::nfkc($text); + utf_new_normalizer::nfkc($text); // FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt $text = strtr($text, $fc_nfkc_closure); diff --git a/phpBB/install/data/new_normalizer.php b/phpBB/install/data/new_normalizer.php new file mode 100644 index 0000000000..bd9920f5cd --- /dev/null +++ b/phpBB/install/data/new_normalizer.php @@ -0,0 +1,181 @@ + $string) + { + if (is_array($string)) + { + foreach ($string as $_key => $_string) + { + utf_new_normalizer::nfc($strings[$key][$_key]); + } + } + else + { + utf_new_normalizer::nfc($strings[$key]); + } + } + } + + return $strings; +} + +class utf_new_normalizer +{ + /** + * Validate, cleanup and normalize a string + * + * The ultimate convenience function! Clean up invalid UTF-8 sequences, + * and convert to Normal Form C, canonical composition. + * + * @param string &$str The dirty string + * @return string The same string, all shiny and cleaned-up + */ + function cleanup(&$str) + { + // The string below is the list of all autorized characters, sorted by frequency in latin text + $pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings with no special chars return immediately + return; + } + + // Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together + if (!isset($GLOBALS['utf_nfc_qc'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); + } + + if (!isset($GLOBALS['utf_canonical_decomp'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); + } + + // Replace any byte in the range 0x00..0x1F, except for \r, \n and \t + // We replace those characters with a 0xFF byte, which is illegal in UTF-8 and will in turn be replaced with a UTF replacement char + $str = strtr( + $str, + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" + ); + + $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); + } + + /** + * Validate and normalize a UTF string to NFC + * + * @param string &$str Unchecked UTF string + * @return string The string, validated and in normal form + */ + function nfc(&$str) + { + $pos = strspn($str, UTF8_ASCII_RANGE); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings return immediately + return; + } + + if (!isset($GLOBALS['utf_nfc_qc'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); + } + + if (!isset($GLOBALS['utf_canonical_decomp'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); + } + + $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); + } + + /** + * Validate and normalize a UTF string to NFKC + * + * @param string &$str Unchecked UTF string + * @return string The string, validated and in normal form + */ + function nfkc(&$str) + { + $pos = strspn($str, UTF8_ASCII_RANGE); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings return immediately + return; + } + + if (!isset($GLOBALS['utf_nfkc_qc'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); + } + + if (!isset($GLOBALS['utf_compatibility_decomp'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); + } + + $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); + } + + /** + * Recompose a UTF string + * + * @param string $str Unchecked UTF string + * @param integer $pos Position of the first UTF char (in bytes) + * @param integer $len Length of the string (in bytes) + * @param array &$qc Quick-check array, passed by reference but never modified + * @param array &$decomp_map Decomposition mapping, passed by reference but never modified + * @return string The string, validated and recomposed + * + * @access private + */ + function recompose($str, $pos, $len, &$qc, &$decomp_map) + { + global $utf_canonical_comp; + + // Load the canonical composition table + if (!isset($utf_canonical_comp)) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); + } + + return utf_normalizer::recompose($str, $pos, $len, $qc, $decomp_map); + } +} + +?> \ No newline at end of file diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 34f0aebb12..4c15a4700f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.RC4'; +$updates_to_version = '3.0.RC5'; // Return if we "just include it" to find out for which version the database update is responsuble for if (defined('IN_PHPBB') && defined('IN_INSTALL')) @@ -387,6 +387,43 @@ $database_update_info = array( ), ), ), + // Changes from 3.0.RC4 to the next version + '3.0.RC4' => array( + // Change the following columns + 'change_columns' => array( + STYLES_TABLE => array( + 'style_id' => array('USINT', NULL, 'auto_increment'), + 'template_id' => array('USINT', 0), + 'theme_id' => array('USINT', 0), + 'imageset_id' => array('USINT', 0), + ), + STYLES_TEMPLATE_TABLE => array( + 'template_id' => array('USINT', NULL, 'auto_increment'), + ), + STYLES_TEMPLATE_DATA_TABLE => array( + 'template_id' => array('USINT', 0), + ), + STYLES_THEME_TABLE => array( + 'theme_id' => array('USINT', NULL, 'auto_increment'), + ), + STYLES_IMAGESET_TABLE => array( + 'imageset_id' => array('USINT', NULL, 'auto_increment'), + ), + STYLES_IMAGESET_DATA_TABLE => array( + 'imageset_id' => array('USINT', 0), + ), + USERS_TABLE => array( + 'user_style' => array('USINT', 0), + ), + FORUMS_TABLE => array( + 'forum_style' => array('USINT', 0), + ), + GROUPS_TABLE => array( + 'group_avatar_width' => array('USINT', 0), + 'group_avatar_height' => array('USINT', 0), + ), + ), + ), ); // Determine mapping database type @@ -473,7 +510,7 @@ while ($row = $db->sql_fetchrow($result)) $db->sql_freeresult($result); echo $lang['PREVIOUS_VERSION'] . ' :: ' . $config['version'] . '
    '; -echo $lang['UPDATED_VERSION'] . ' :: ' . $updates_to_version . ''; +echo $lang['UPDATED_VERSION'] . ' :: ' . $updates_to_version . '

    '; $current_version = str_replace('rc', 'RC', strtolower($config['version'])); $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version)); @@ -495,7 +532,7 @@ else // Checks/Operations that have to be completed prior to starting the update itself $exit = false; -if (version_compare($current_version, '3.0.RC3', '<=')) +if (version_compare($current_version, '3.0.RC4', '<=')) { // Define missing language entries... if (!isset($lang['CLEANING_USERNAMES'])) @@ -517,7 +554,7 @@ if (version_compare($current_version, '3.0.RC3', '<=')) )); } ?> -



    +

    @@ -530,6 +567,16 @@ if (version_compare($current_version, '3.0.RC3', '<=')) $modify_users = request_var('modify_users', array(0 => '')); $new_usernames = request_var('new_usernames', array(0 => ''), true); + if (!class_exists('utf_new_normalizer')) + { + if (!file_exists($phpbb_root_path . 'install/data/new_normalizer.' . $phpEx)) + { + global $lang; + trigger_error(sprintf($lang['UPDATE_REQUIRES_FILE'], $phpbb_root_path . 'install/data/new_normalizer.' . $phpEx), E_USER_ERROR); + } + include($phpbb_root_path . 'install/data/new_normalizer.' . $phpEx); + } + // the admin decided to change some usernames if (sizeof($modify_users) && $submit) { @@ -564,7 +611,7 @@ if (version_compare($current_version, '3.0.RC3', '<=')) case 'edit': if (isset($new_usernames[$user_id])) { - $data = array('username' => utf8_normalize_nfc($new_usernames[$user_id])); + $data = array('username' => utf8_new_normalize_nfc($new_usernames[$user_id])); // Need to update config, forum, topic, posting, messages, etc. if ($data['username'] != $row['username']) { @@ -720,6 +767,8 @@ if (version_compare($current_version, '3.0.RC3', '<=')) } $db->sql_freeresult($result); + _write_result(false, $errored, $error_ary); + // now retrieve all information about the users and let the admin decide what to do if (sizeof($colliding_users)) { @@ -775,7 +824,7 @@ if (version_compare($current_version, '3.0.RC3', '<=')) // for the admin: keep name, change name (with text input) or delete user $u_action = "database_update.$phpEx?language=$language&type=$inline_update"; ?> -



    +

    @@ -939,7 +988,7 @@ if ($exit) // Schema updates ?> -



    +

    @@ -1253,6 +1302,206 @@ if (version_compare($current_version, '3.0.RC3', '<=')) $no_updates = false; } +if (version_compare($current_version, '3.0.RC4', '<=')) +{ + $update_auto_increment = array( + STYLES_TABLE => 'style_id', + STYLES_TEMPLATE_TABLE => 'template_id', + STYLES_THEME_TABLE => 'theme_id', + STYLES_IMAGESET_TABLE => 'imageset_id' + ); + + $sql = 'SELECT * + FROM ' . STYLES_TABLE . ' + WHERE style_id = 0'; + $result = _sql($sql, $errored, $error_ary); + $bad_style_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($bad_style_row) + { + $sql = 'SELECT MAX(style_id) as max_id + FROM ' . STYLES_TABLE; + $result = _sql($sql, $errored, $error_ary); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $proper_id = $row['max_id'] + 1; + + _sql('UPDATE ' . STYLES_TABLE . " SET style_id = $proper_id WHERE style_id = 0", $errored, $error_ary); + _sql('UPDATE ' . FORUMS_TABLE . " SET forum_style = $proper_id WHERE forum_style = 0", $errored, $error_ary); + _sql('UPDATE ' . USERS_TABLE . " SET user_style = $proper_id WHERE user_style = 0", $errored, $error_ary); + + $sql = 'SELECT config_value + FROM ' . CONFIG_TABLE . " + WHERE config_name = 'default_style'"; + $result = _sql($sql, $errored, $error_ary); + $style_config = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($style_config['config_value'] === '0') + { + set_config('default_style', (string) $proper_id); + } + } + + $sql = 'SELECT * + FROM ' . STYLES_TEMPLATE_TABLE . ' + WHERE template_id = 0'; + $result = _sql($sql, $errored, $error_ary); + $bad_style_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($bad_style_row) + { + $sql = 'SELECT MAX(template_id) as max_id + FROM ' . STYLES_TEMPLATE_TABLE; + $result = _sql($sql, $errored, $error_ary); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $proper_id = $row['max_id'] + 1; + + _sql('UPDATE ' . STYLES_TABLE . " SET template_id = $proper_id WHERE template_id = 0", $errored, $error_ary); + } + + $sql = 'SELECT * + FROM ' . STYLES_THEME_TABLE . ' + WHERE theme_id = 0'; + $result = _sql($sql, $errored, $error_ary); + $bad_style_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($bad_style_row) + { + $sql = 'SELECT MAX(theme_id) as max_id + FROM ' . STYLES_THEME_TABLE; + $result = _sql($sql, $errored, $error_ary); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $proper_id = $row['max_id'] + 1; + + _sql('UPDATE ' . STYLES_TABLE . " SET theme_id = $proper_id WHERE theme_id = 0", $errored, $error_ary); + } + + $sql = 'SELECT * + FROM ' . STYLES_IMAGESET_TABLE . ' + WHERE imageset_id = 0'; + $result = _sql($sql, $errored, $error_ary); + $bad_style_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($bad_style_row) + { + $sql = 'SELECT MAX(imageset_id) as max_id + FROM ' . STYLES_IMAGESET_TABLE; + $result = _sql($sql, $errored, $error_ary); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $proper_id = $row['max_id'] + 1; + + _sql('UPDATE ' . STYLES_TABLE . " SET imageset_id = $proper_id WHERE imageset_id = 0", $errored, $error_ary); + _sql('UPDATE ' . STYLES_IMAGESET_DATA_TABLE . " SET imageset_id = $proper_id WHERE imageset_id = 0", $errored, $error_ary); + } + + if ($map_dbms == 'mysql_40' || $map_dbms == 'mysql_41') + { + foreach ($update_auto_increment as $auto_table_name => $auto_column_name) + { + $sql = "SELECT MAX({$auto_column_name}) as max_id + FROM {$auto_table_name}"; + $result = _sql($sql, $errored, $error_ary); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $max_id = ((int) $row['max_id']) + 1; + _sql("ALTER TABLE {$auto_table_name} AUTO_INCREMENT = {$max_id}", $errored, $error_ary); + } + + $no_updates = false; + } + else if ($map_dbms == 'postgres') + { + foreach ($update_auto_increment as $auto_table_name => $auto_column_name) + { + $sql = "SELECT SETVAL('" . $auto_table_name . "_seq',(select case when max({$auto_column_name})>0 then max({$auto_column_name})+1 else 1 end from " . $auto_table_name . '));'; + _sql($sql, $errored, $error_ary); + } + + $sql = 'DROP SEQUENCE ' . STYLES_TEMPLATE_DATA_TABLE . '_seq'; + _sql($sql, $errored, $error_ary); + } + else if ($map_dbms == 'firebird') + { + $sql = 'DROP TRIGGER t_' . STYLES_TEMPLATE_DATA_TABLE; + _sql($sql, $errored, $error_ary); + + $sql = 'DROP GENERATOR ' . STYLES_TEMPLATE_DATA_TABLE . '_gen'; + _sql($sql, $errored, $error_ary); + } + else if ($map_dbms == 'oracle') + { + $sql = 'DROP TRIGGER t_' . STYLES_TEMPLATE_DATA_TABLE; + _sql($sql, $errored, $error_ary); + + $sql = 'DROP SEQUENCE ' . STYLES_TEMPLATE_DATA_TABLE . '_seq'; + _sql($sql, $errored, $error_ary); + } + else if ($map_dbms == 'mssql') + { + // we use transactions because we need to have a working DB at the end of all of this + $db->sql_transaction('begin'); + + $sql = 'SELECT * + FROM ' . STYLES_TEMPLATE_DATA_TABLE; + $result = _sql($sql, $errored, $error_ary); + $old_style_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $old_style_rows[] = $row; + } + $db->sql_freeresult($result); + + // death to the table, it is evil! + $sql = 'DROP TABLE ' . STYLES_TEMPLATE_DATA_TABLE; + _sql($sql, $errored, $error_ary); + + // the table of awesomeness, praise be to it (or something) + $sql = 'CREATE TABLE [' . STYLES_TEMPLATE_DATA_TABLE . "] ( + [template_id] [int] DEFAULT (0) NOT NULL , + [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , + [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , + [template_mtime] [int] DEFAULT (0) NOT NULL , + [template_data] [text] DEFAULT ('') NOT NULL + ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]"; + _sql($sql, $errored, $error_ary); + + // index? index + $sql = 'CREATE INDEX [tid] ON [' . STYLES_TEMPLATE_DATA_TABLE . ']([template_id]) ON [PRIMARY]'; + _sql($sql, $errored, $error_ary); + + // yet another index + $sql = 'CREATE INDEX [tfn] ON [' . STYLES_TEMPLATE_DATA_TABLE . ']([template_filename]) ON [PRIMARY]'; + _sql($sql, $errored, $error_ary); + + foreach ($old_style_rows as $return_row) + { + _sql('INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $return_row), $errored, $error_ary); + } + + $db->sql_transaction('commit'); + } + + // Setting this here again because new installations may not have it... + set_config('cron_lock', '0', true); + set_config('ldap_port', ''); + set_config('ldap_user_filter', ''); + + $no_updates = false; +} + _write_result($no_updates, $errored, $error_ary); $error_ary = array(); @@ -1336,8 +1585,6 @@ add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version); // Now we purge the session table as well as all cache files $cache->purge(); -exit; - ?> @@ -1357,6 +1604,9 @@ exit; sql_return_on_error(true); $result = $db->sql_query($sql); - if ($db->sql_error_triggered) { $errored = true; @@ -1570,7 +1819,7 @@ function column_exists($dbms, $table, $column_name) /** * Function to prepare some column information for better usage */ -function prepare_column_data($dbms, $column_data) +function prepare_column_data($dbms, $column_data, $table_name, $column_name) { global $dbms_type_map, $unsigned_types; @@ -1704,22 +1953,32 @@ function prepare_column_data($dbms, $column_data) // In Oracle empty strings ('') are treated as NULL. // Therefore in oracle we allow NULL's for all DEFAULT '' entries - $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; + // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) + if (preg_match('/number/i', $column_type)) + { + $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; + } break; case 'postgres': $return_array['column_type'] = $column_type; - $return_array['null'] = 'NOT NULL'; - - if (!is_null($column_data[1])) - { - $return_array['default'] = $column_data[1]; - } $sql .= " {$column_type} "; - $sql .= 'NOT NULL '; - $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $default_val = "nextval('{$table_name}_seq')"; + } + else if (!is_null($column_data[1])) + { + $default_val = "'" . $column_data[1] . "'"; + $return_array['null'] = 'NOT NULL'; + $sql .= 'NOT NULL '; + } + + $return_array['default'] = $default_val; + + $sql .= "DEFAULT {$default_val}"; // Unsigned? Then add a CHECK contraint if (in_array($orig_column_type, $unsigned_types)) @@ -1730,7 +1989,7 @@ function prepare_column_data($dbms, $column_data) break; case 'sqlite': -/* if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') { $sql .= ' INTEGER PRIMARY KEY'; } @@ -1738,8 +1997,6 @@ function prepare_column_data($dbms, $column_data) { $sql .= ' ' . $column_type; } -*/ - $sql .= ' ' . $column_type; $sql .= ' NOT NULL '; $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; @@ -1758,7 +2015,7 @@ function sql_column_add($dbms, $table_name, $column_name, $column_data) { global $errored, $error_ary; - $column_data = prepare_column_data($dbms, $column_data); + $column_data = prepare_column_data($dbms, $column_data, $table_name, $column_name); switch ($dbms) { @@ -2300,7 +2557,7 @@ function sql_column_change($dbms, $table_name, $column_name, $column_data) global $dbms_type_map, $db; global $errored, $error_ary; - $column_data = prepare_column_data($dbms, $column_data); + $column_data = prepare_column_data($dbms, $column_data, $table_name, $column_name); switch ($dbms) { @@ -2332,18 +2589,21 @@ function sql_column_change($dbms, $table_name, $column_name, $column_data) $sql_array = array(); $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; - if ($column_data['null'] == 'NOT NULL') + if (isset($column_data['null'])) { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; - } - else - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; + if ($column_data['null'] == 'NOT NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + else if ($column_data['null'] == 'NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; + } } if (isset($column_data['default'])) { - $sql_array[] = 'ALTER COLUMN ' . $column_name . " SET DEFAULT '" . $column_data['default'] . "'"; + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; } // we don't want to double up on constraints if we change different number data types @@ -2377,7 +2637,7 @@ function sql_column_change($dbms, $table_name, $column_name, $column_data) if (!$constraint_exists) { - $sql_array[] = "ADD '" . $column_data['constraint'] . "'"; + $sql_array[] = 'ADD ' . $column_data['constraint']; } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 7b0f120577..56da3590ff 100755 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -109,9 +109,10 @@ if (!empty($mem_limit)) { $unit = strtolower(substr($mem_limit, -1, 1)); $mem_limit = (int) $mem_limit; + if ($unit == 'k') { - $mem_limit = floor($mem_limit/1024); + $mem_limit = floor($mem_limit / 1024); } else if ($unit == 'g') { @@ -119,7 +120,7 @@ if (!empty($mem_limit)) } else if (is_numeric($unit)) { - $mem_limit = floor($mem_limit/1048576); + $mem_limit = floor((int) ($mem_limit . $unit) / 1048576); } $mem_limit = max(128, $mem_limit) . 'M'; } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index d0f9cf88d1..38ef13c412 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1093,7 +1093,7 @@ END;; # Table: 'phpbb_styles_template_data' CREATE TABLE phpbb_styles_template_data ( - template_id INTEGER NOT NULL, + template_id INTEGER DEFAULT 0 NOT NULL, template_filename VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, template_included BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, template_mtime INTEGER DEFAULT 0 NOT NULL, @@ -1103,17 +1103,6 @@ CREATE TABLE phpbb_styles_template_data ( CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data(template_id);; CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data(template_filename);; -CREATE GENERATOR phpbb_styles_template_data_gen;; -SET GENERATOR phpbb_styles_template_data_gen TO 0;; - -CREATE TRIGGER t_phpbb_styles_template_data FOR phpbb_styles_template_data -BEFORE INSERT -AS -BEGIN - NEW.template_id = GEN_ID(phpbb_styles_template_data_gen, 1); -END;; - - # Table: 'phpbb_styles_theme' CREATE TABLE phpbb_styles_theme ( theme_id INTEGER NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 7dd9c4e924..37e8f66b2a 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1309,7 +1309,7 @@ GO Table: 'phpbb_styles_template_data' */ CREATE TABLE [phpbb_styles_template_data] ( - [template_id] [int] IDENTITY (1, 1) NOT NULL , + [template_id] [int] DEFAULT (0) NOT NULL , [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , [template_mtime] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index e2dc0718e7..a1450cacee 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -743,7 +743,7 @@ CREATE TABLE phpbb_styles_template ( # Table: 'phpbb_styles_template_data' CREATE TABLE phpbb_styles_template_data ( - template_id smallint(4) UNSIGNED NOT NULL auto_increment, + template_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, template_filename varbinary(100) DEFAULT '' NOT NULL, template_included blob NOT NULL, template_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 022c3ecbfe..4cee662be6 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -743,7 +743,7 @@ CREATE TABLE phpbb_styles_template ( # Table: 'phpbb_styles_template_data' CREATE TABLE phpbb_styles_template_data ( - template_id smallint(4) UNSIGNED NOT NULL auto_increment, + template_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, template_filename varchar(100) DEFAULT '' NOT NULL, template_included text NOT NULL, template_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 7dad10dd67..aabc00f0e2 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1453,7 +1453,7 @@ END; Table: 'phpbb_styles_template_data' */ CREATE TABLE phpbb_styles_template_data ( - template_id number(4) NOT NULL, + template_id number(4) DEFAULT '0' NOT NULL, template_filename varchar2(100) DEFAULT '' , template_included clob DEFAULT '' , template_mtime number(11) DEFAULT '0' NOT NULL, @@ -1466,22 +1466,6 @@ CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (templ CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename) / -CREATE SEQUENCE phpbb_styles_template_data_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_styles_template_data -BEFORE INSERT ON phpbb_styles_template_data -FOR EACH ROW WHEN ( - new.template_id IS NULL OR new.template_id = 0 -) -BEGIN - SELECT phpbb_styles_template_data_seq.nextval - INTO :new.template_id - FROM dual; -END; -/ - - /* Table: 'phpbb_styles_theme' */ diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index f9b0557d8a..5d4c6f477b 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -977,10 +977,8 @@ CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (te /* Table: 'phpbb_styles_template_data' */ -CREATE SEQUENCE phpbb_styles_template_data_seq; - CREATE TABLE phpbb_styles_template_data ( - template_id INT2 DEFAULT nextval('phpbb_styles_template_data_seq'), + template_id INT2 DEFAULT '0' NOT NULL CHECK (template_id >= 0), template_filename varchar(100) DEFAULT '' NOT NULL, template_included varchar(8000) DEFAULT '' NOT NULL, template_mtime INT4 DEFAULT '0' NOT NULL CHECK (template_mtime >= 0), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index cce71d0593..4ea41610f1 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -120,9 +120,11 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_username', '') INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_email', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_password', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_port', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user_filter', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0'); @@ -206,11 +208,12 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.RC4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.RC5'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cron_lock', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('database_last_gc', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('last_queue_run', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_colour', 'AA0000', 1); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 90847e9d31..546cfb0321 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -717,7 +717,7 @@ CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (te # Table: 'phpbb_styles_template_data' CREATE TABLE phpbb_styles_template_data ( - template_id INTEGER PRIMARY KEY NOT NULL , + template_id INTEGER UNSIGNED NOT NULL DEFAULT '0', template_filename varchar(100) NOT NULL DEFAULT '', template_included text(65535) NOT NULL DEFAULT '', template_mtime INTEGER UNSIGNED NOT NULL DEFAULT '0', diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 5d0627475c..a1f311ff75 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -304,13 +304,17 @@ $lang = array_merge($lang, array( 'LDAP_NO_EMAIL' => 'The specified e-mail attribute does not exist.', 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', 'LDAP_PASSWORD' => 'LDAP password', - 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous access. Else fill in the password for the above user. WARNING: This password will be stored as plain text in the database visible to everybody who can access your database.', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers. WARNING: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PORT' => 'LDAP server port', + 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', 'LDAP_SERVER' => 'LDAP server name', - 'LDAP_SERVER_EXPLAIN' => 'If using LDAP this is the name or IP address of the server.', + 'LDAP_SERVER_EXPLAIN' => 'If using LDAP this is the hostname or IP address of the LDAP server. Alternatively you can specify an URL like ldap://hostname:port/', 'LDAP_UID' => 'LDAP uid', 'LDAP_UID_EXPLAIN' => 'This is the key under which to search for a given login identity, e.g. uid, sn, etc.', - 'LDAP_USER' => 'LDAP user', - 'LDAP_USER_EXPLAIN' => 'Leave blank to use anonymous access. If filled in phpBB will connect to the LDAP server as the specified user.', + 'LDAP_USER' => 'LDAP user dn', + 'LDAP_USER_EXPLAIN' => 'Leave blank to use anonymous binding. If filled in phpBB uses the specified distinguished name on login attempts to find the correct user, e.g. uid=Username,ou=MyUnit,o=MyCompany,c=US. Required for Active Directory Servers.', + 'LDAP_USER_FILTER' => 'LDAP user filter', + 'LDAP_USER_FILTER_EXPLAIN' => 'Optionally you can further limit the searched objects with additional filters. For example objectClass=posixGroup would result in the use of (&(uid=$username)(objectClass=posixGroup))', )); // Server Settings @@ -353,7 +357,7 @@ $lang = array_merge($lang, array( 'BROWSER_VALID' => 'Validate browser', 'BROWSER_VALID_EXPLAIN' => 'Enables browser validation for each session improving security.', 'CHECK_DNSBL' => 'Check IP against DNS Blackhole List', - 'CHECK_DNSBL_EXPLAIN' => 'If enabled the user’s IP address is checked against the following DNSBL services on registration and posting: spamcop.net, dsbl.org and spamhaus.org. This lookup may take a while, depending on the server’s configuration. If slowdowns are experienced or too many false positives reported it is recommended to disable this check.', + 'CHECK_DNSBL_EXPLAIN' => 'If enabled the user’s IP address is checked against the following DNSBL services on registration and posting: spamcop.net, dsbl.org and www.spamhaus.org. This lookup may take a while, depending on the server’s configuration. If slowdowns are experienced or too many false positives reported it is recommended to disable this check.', 'CLASS_B' => 'A.B', 'CLASS_C' => 'A.B.C', 'EMAIL_CHECK_MX' => 'Check e-mail domain for valid MX record', diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 576b87eabd..fbc82d4c5b 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -268,7 +268,7 @@ $lang = array_merge($lang, array( $lang = array_merge($lang, array( 'ACP_PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by official team members on the support forums.', - 'NO_PHPINFO_AVAILABLE' => 'The PHP informations are unable to be determined. Phpinfo() has been disabled for security reasons.', + 'NO_PHPINFO_AVAILABLE' => 'Information about your PHP configuration is unable to be determined. Phpinfo() has been disabled for security reasons.', )); // Logs diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php index 9d0e5e3cf6..700aa321cc 100644 --- a/phpBB/language/en/acp/database.php +++ b/phpBB/language/en/acp/database.php @@ -33,7 +33,7 @@ if (empty($lang) || !is_array($lang)) // Database Backup/Restore $lang = array_merge($lang, array( 'ACP_BACKUP_EXPLAIN' => 'Here you can backup all your phpBB related data. You may store the resulting archive in your store/ folder or download it directly. Depending on your server configuration you may be able to compress the file in a number of formats.', - 'ACP_RESTORE_EXPLAIN' => 'This will perform a full restore of all phpBB tables from a saved file. If your server supports it you may use a gzip or bzip2 compressed text file and it will automatically be decompressed. WARNING This will overwrite any existing data. The restore may take a long time to process please do not move from this page till it is complete. Backups are stored in the store/ folder and are assumed to be generated by phpBBs backup functionality. Restoring backups that were not created by the built in system may or may not work.', + 'ACP_RESTORE_EXPLAIN' => 'This will perform a full restore of all phpBB tables from a saved file. If your server supports it you may use a gzip or bzip2 compressed text file and it will automatically be decompressed. WARNING This will overwrite any existing data. The restore may take a long time to process please do not move from this page till it is complete. Backups are stored in the store/ folder and are assumed to be generated by phpBB’s backup functionality. Restoring backups that were not created by the built in system may or may not work.', 'BACKUP_DELETE' => 'The backup file has been deleted successfully.', 'BACKUP_INVALID' => 'The selected file to backup is invalid.', diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index bededcf947..2f995dc91d 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -49,14 +49,14 @@ $lang = array_merge($lang, array( 'BBCODE_TAG_TOO_LONG' => 'The tag name you selected is too long.', 'BBCODE_TAG_DEF_TOO_LONG' => 'The tag definition that you have entered is too long, please shorten your tag definition.', 'BBCODE_USAGE' => 'BBCode usage', - 'BBCODE_USAGE_EXAMPLE' => '[hilight={COLOR}]{TEXT}[/hilight]

    [font={TEXT1}]{TEXT2}[/font]', + 'BBCODE_USAGE_EXAMPLE' => '[hilight={COLOR}]{TEXT}[/hilight]

    [font={SIMPLETEXT1}]{SIMPLETEXT2}[/font]', 'BBCODE_USAGE_EXPLAIN' => 'Here you define how to use the BBCode. Replace any variable input by the corresponding token (%ssee below%s).', 'EXAMPLE' => 'Example:', 'EXAMPLES' => 'Examples:', 'HTML_REPLACEMENT' => 'HTML replacement', - 'HTML_REPLACEMENT_EXAMPLE' => '<span style="background-color: {COLOR};">{TEXT}</span>

    <span style="font-family: {TEXT1};">{TEXT2}</span>', + 'HTML_REPLACEMENT_EXAMPLE' => '<span style="background-color: {COLOR};">{TEXT}</span>

    <span style="font-family: {SIMPLETEXT1};">{SIMPLETEXT2}</span>', 'HTML_REPLACEMENT_EXPLAIN' => 'Here you define the default HTML replacement. Do not forget to put back tokens you used above!', 'TOKEN' => 'Token', @@ -66,7 +66,9 @@ $lang = array_merge($lang, array( 'TOO_MANY_BBCODES' => 'You cannot create any more BBCodes. Please remove one or more BBCodes then try again.', 'tokens' => array( - 'TEXT' => 'Any text, including foreign characters, numbers, etc…', + 'TEXT' => 'Any text, including foreign characters, numbers, etc… You should not use this token in HTML tags. Instead try to use IDENTIFIER or SIMPLETEXT.', + 'SIMPLETEXT' => 'Characters from the latin alphabet (A-Z), numbers, spaces, commas, dots, minus, plus, hyphen and underscore', + 'IDENTIFIER' => 'Characters from the latin alphabet (A-Z), numbers, hyphen and underscore', 'NUMBER' => 'Any series of digits', 'EMAIL' => 'A valid e-mail address', 'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, "http://" is prefixed to the string.', @@ -91,8 +93,12 @@ $lang = array_merge($lang, array( 'CURRENT_SMILIES' => 'Current smilies', 'CURRENT_SMILIES_EXPLAIN' => 'Choose what to do with the currently installed smilies.', - 'DISPLAY_ON_POSTING' => 'Display on posting page', + 'DISPLAY_ON_POSTING' => 'Display on posting page', + 'DISPLAY_POSTING' => 'On posting page', + 'DISPLAY_POSTING_NO' => 'Not on posting page', + + 'EDIT_ICONS' => 'Edit icons', 'EDIT_SMILIES' => 'Edit smilies', 'EMOTION' => 'Emotion', @@ -104,11 +110,15 @@ $lang = array_merge($lang, array( 'FIRST' => 'First', 'ICONS_ADD' => 'Add a new icon', - 'ICONS_ADDED' => 'The icon has been added successfully.', + 'ICON_NONE_ADDED' => 'No icons were added.', + 'ICONS_ONE_ADDED' => 'The icon has been added successfully.', + 'ICONS_ADDED' => 'The icons have been added successfully.', 'ICONS_CONFIG' => 'Icon configuration', 'ICONS_DELETED' => 'The icon has been removed successfully.', 'ICONS_EDIT' => 'Edit icon', - 'ICONS_EDITED' => 'The icon has been updated successfully.', + 'ICONS_ONE_EDITED' => 'The icon has been updated successfully.', + 'ICON_NONE_EDITED' => 'No icons were updated.', + 'ICONS_EDITED' => 'The icons have been updated successfully.', 'ICONS_HEIGHT' => 'Icon height', 'ICONS_IMAGE' => 'Icon image', 'ICONS_IMPORTED' => 'The icons pack has been installed successfully.', @@ -140,12 +150,16 @@ $lang = array_merge($lang, array( 'SELECT_PACKAGE' => 'Select a package file', 'SMILIES_ADD' => 'Add a new smiley', - 'SMILIES_ADDED' => 'The smiley has been added successfully.', + 'SMILIES_NONE_ADDED' => 'No smilies were added.', + 'SMILIES_ONE_ADDED' => 'The smiley has been added successfully.', + 'SMILIES_ADDED' => 'The smilies have been added successfully.', 'SMILIES_CODE' => 'Smiley code', 'SMILIES_CONFIG' => 'Smiley configuration', 'SMILIES_DELETED' => 'The smiley has been removed successfully.', 'SMILIES_EDIT' => 'Edit smiley', - 'SMILIES_EDITED' => 'The smiley has been updated successfully.', + 'SMILIES_NONE_EDITED' => 'No smilies were updated.', + 'SMILIES_ONE_EDITED' => 'The smiley has been updated successfully.', + 'SMILIES_EDITED' => 'The smilies have been updated successfully.', 'SMILIES_EMOTION' => 'Emotion', 'SMILIES_HEIGHT' => 'Smiley height', 'SMILIES_IMAGE' => 'Smiley image', diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 3a2b8170ab..48f3b29334 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -99,7 +99,7 @@ $lang = array_merge($lang, array( 'USER_ADMIN_DEL_AVATAR' => 'Delete avatar', 'USER_ADMIN_DEL_POSTS' => 'Delete all posts', 'USER_ADMIN_DEL_SIG' => 'Delete signature', - 'USER_ADMIN_EXPLAIN' => 'Here you can change your users information and certain specific options. To modify the users permissions please use the user and group permissions system.', + 'USER_ADMIN_EXPLAIN' => 'Here you can change your users information and certain specific options.', 'USER_ADMIN_FORCE' => 'Force reactivation', 'USER_ADMIN_MOVE_POSTS' => 'Move all posts', 'USER_ADMIN_SIG_REMOVED' => 'Successfully removed signature from user account.', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index fe528d48fe..9b3ebbfe52 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -526,6 +526,7 @@ $lang = array_merge($lang, array( 'TOO_LONG_AIM' => 'The screenname you entered is too long.', 'TOO_LONG_CONFIRM_CODE' => 'The confirm code you entered is too long.', + 'TOO_LONG_DATEFORMAT' => 'The date format you entered is too long.', 'TOO_LONG_ICQ' => 'The ICQ number you entered is too long.', 'TOO_LONG_INTERESTS' => 'The interests you entered is too long.', 'TOO_LONG_JABBER' => 'The Jabber account name you entered is too long.', @@ -545,6 +546,7 @@ $lang = array_merge($lang, array( 'TOO_SHORT_AIM' => 'The screenname you entered is too short.', 'TOO_SHORT_CONFIRM_CODE' => 'The confirm code you entered is too short.', + 'TOO_SHORT_DATEFORMAT' => 'The date format you entered is too short.', 'TOO_SHORT_ICQ' => 'The ICQ number you entered is too short.', 'TOO_SHORT_INTERESTS' => 'The interests you entered is too short.', 'TOO_SHORT_JABBER' => 'The Jabber account name you entered is too short.', @@ -591,8 +593,9 @@ $lang = array_merge($lang, array( 'UNREAD_MESSAGES' => 'Unread messages', 'UNREAD_PM' => '%d unread message', 'UNREAD_PMS' => '%d unread messages', - 'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.', - 'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.', + 'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.', + 'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.', + 'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.', 'UPDATE' => 'Update', 'UPLOAD_IN_PROGRESS' => 'The upload is currently in progress.', 'URL_REDIRECT' => 'If your browser does not support meta redirection %splease click HERE to be redirected%s.', @@ -622,8 +625,8 @@ $lang = array_merge($lang, array( 'VIEW_LATEST_POST' => 'View the latest post', 'VIEW_NEWEST_POST' => 'View first unread post', 'VIEW_NOTES' => 'View user notes', - 'VIEW_ONLINE_TIME' => 'This data is based on users active over the past %d minute', - 'VIEW_ONLINE_TIMES' => 'This data is based on users active over the past %d minutes', + 'VIEW_ONLINE_TIME' => 'based on users active over the past %d minute', + 'VIEW_ONLINE_TIMES' => 'based on users active over the past %d minutes', 'VIEW_TOPIC' => 'View topic', 'VIEW_TOPIC_ANNOUNCEMENT' => 'Announcement: ', 'VIEW_TOPIC_GLOBAL' => 'Global Announcement: ', diff --git a/phpBB/language/en/email/forum_notify.txt b/phpBB/language/en/email/forum_notify.txt index f55e6dd80b..090782091e 100644 --- a/phpBB/language/en/email/forum_notify.txt +++ b/phpBB/language/en/email/forum_notify.txt @@ -6,6 +6,12 @@ You are receiving this notification because you are watching the forum, "{FORUM_ {U_NEWEST_POST} +If you want to view the topic, click the following link: +{U_TOPIC} + +If you want to view the forum, click the following link: +{U_TOPIC} + If you no longer wish to watch this forum you can either click the "Unsubscribe forum" link found in the forum above, or by clicking the following link: {U_STOP_WATCHING_FORUM} diff --git a/phpBB/language/en/email/topic_notify.txt b/phpBB/language/en/email/topic_notify.txt index 3c8c38cf0a..99587b28e0 100644 --- a/phpBB/language/en/email/topic_notify.txt +++ b/phpBB/language/en/email/topic_notify.txt @@ -10,6 +10,9 @@ If you want to view the newest post made since your last visit, click the follow If you want to view the topic, click the following link: {U_TOPIC} +If you want to view the forum, click the following link: +{U_FORUM} + If you no longer wish to watch this topic you can either click the "Unsubscribe topic" link found at the bottom of the topic above, or by clicking the following link: {U_STOP_WATCHING_TOPIC} diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index 193e8cf3a2..60d652e1ce 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -44,7 +44,7 @@ $help = array( ), array( 0 => 'How do I prevent my username appearing in the online user listings?', - 1 => 'Within your User Control Panel, under “Board preferences”, you will find the option Hide your online status. Enable this option with Yesand you will only appear to the administrators, moderators and yourself. You will be counted as a hidden user.' + 1 => 'Within your User Control Panel, under “Board preferences”, you will find the option Hide your online status. Enable this option with Yes and you will only appear to the administrators, moderators and yourself. You will be counted as a hidden user.' ), array( 0 => 'I’ve lost my password!', @@ -88,7 +88,7 @@ $help = array( ), array( 0 => 'My language is not in the list!', - 1 => 'Either the administrator has not installed your language or someone has not translated this board into your language. Try asking the board administrator if they can install the language pack you need. If the language pack does not exist, feel free to create a new translation. More information can be found at the phpBB website (see link at the bottom of board pages).' + 1 => 'Either the administrator has not installed your language or nobody has translated this board into your language. Try asking the board administrator if they can install the language pack you need. If the language pack does not exist, feel free to create a new translation. More information can be found at the phpBB website (see link at the bottom of board pages).' ), array( 0 => 'How do I show an image below my username?', @@ -216,7 +216,7 @@ $help = array( ), array( 0 => 'Where are the usergroups and how do I join one?', - 1 => 'You can view all usergroups by via the “Usergroups” link within your User Control Panel. If you would like to join one, proceed by clicking the appropriate button. Not all groups have open access, however. Some may require approval to join, some may be closed and some may even have hidden memberships. If the group is open, you can join it by clicking the appropriate button. If a group requires approval to join you may request to join by clicking the appropriate button. The user group leader will need to approve your request and may ask why you want to join the group. Please do not harass a group leader if they reject your request; they will have their reasons.' + 1 => 'You can view all usergroups via the “Usergroups” link within your User Control Panel. If you would like to join one, proceed by clicking the appropriate button. Not all groups have open access, however. Some may require approval to join, some may be closed and some may even have hidden memberships. If the group is open, you can join it by clicking the appropriate button. If a group requires approval to join you may request to join by clicking the appropriate button. The user group leader will need to approve your request and may ask why you want to join the group. Please do not harass a group leader if they reject your request; they will have their reasons.' ), array( 0 => 'How do I become a usergroup leader?', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 1a932369a8..b35e363563 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -34,10 +34,10 @@ $lang = array_merge($lang, array( 'ADMIN_CONFIG' => 'Administrator configuration', 'ADMIN_PASSWORD' => 'Administrator password', 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', - 'ADMIN_PASSWORD_EXPLAIN' => '(Please enter a password between 6 and 30 characters in length.)', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', 'ADMIN_TEST' => 'Check administrator settings', 'ADMIN_USERNAME' => 'Administrator username', - 'ADMIN_USERNAME_EXPLAIN' => '(Please enter a username between 3 and 20 characters in length.)', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', 'AUTHOR_NOTES' => 'Author notes
    » %s', 'AVAILABLE' => 'Available', @@ -333,10 +333,10 @@ $lang = array_merge($lang, array( 'SUCCESSFUL_CONNECT' => 'Successful connection', // TODO: Write some text on obtaining support 'SUPPORT_BODY' => 'During the release candidate phase full support will be given at the phpBB 3.0.x support forums. We will provide answers to general setup questions, configuration problems, conversion problems and support for determining common problems mostly related to bugs. We also allow discussions about modifications and custom code/style additions.

    For additional assistance, please refer to our Quick Start Guide and the online documentation.

    To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?', - 'SYNC_FORUMS' => 'Starting to sync forums', + 'SYNC_FORUMS' => 'Starting to synchronise forums', 'SYNC_POST_COUNT' => 'Synchronising post_counts', 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', - 'SYNC_TOPICS' => 'Starting to sync topics', + 'SYNC_TOPICS' => 'Starting to synchronise topics', 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', 'TABLES_MISSING' => 'Could not find these tables
    » %s.', diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index 7f4b2d932f..616d1752c5 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -43,7 +43,7 @@ $lang = array_merge($lang, array( 'GLOBAL' => 'Global announcement', 'IGNORED_TERMS' => 'ignored', - 'IGNORED_TERMS_EXPLAIN' => 'The following words in your search query were ignored: %s.', + 'IGNORED_TERMS_EXPLAIN' => 'The following words in your search query were ignored because they are too common words: %s.', 'JUMP_TO_POST' => 'Jump to post', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 34040317a0..7c397535ca 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -34,7 +34,7 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s” (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$s”. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s” after changes mean you agree to be legally bound by these terms as they are updated and/or amended.

    - Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Group”, “phpBB Teams”) which is a bulletin board solution released under the “General Public License” (hereinafter “GPL”) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: http://www.phpbb.com/.
    + Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Group”, “phpBB Teams”) which is a bulletin board solution released under the “General Public License” (hereinafter “GPL”) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: http://www.phpbb.com/.

    You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised. ', @@ -104,10 +104,10 @@ $lang = array_merge($lang, array( 'BOOKMARKS_REMOVED' => 'Bookmarks removed successfully.', 'CANNOT_EDIT_MESSAGE_TIME' => 'You can no longer edit or delete that message.', - 'CANNOT_MOVE_TO_SAME_FOLDER'=> 'Messages can not be moved to the folder you want to remove.', - 'CANNOT_MOVE_FROM_SPECIAL' => 'Messages can not be moved from the outbox.', - 'CANNOT_RENAME_FOLDER' => 'This folder can not be renamed.', - 'CANNOT_REMOVE_FOLDER' => 'This folder can not be removed.', + 'CANNOT_MOVE_TO_SAME_FOLDER'=> 'Messages cannot be moved to the folder you want to remove.', + 'CANNOT_MOVE_FROM_SPECIAL' => 'Messages cannot be moved from the outbox.', + 'CANNOT_RENAME_FOLDER' => 'This folder cannot be renamed.', + 'CANNOT_REMOVE_FOLDER' => 'This folder cannot be removed.', 'CHANGE_DEFAULT_GROUP' => 'Change default group', 'CHANGE_PASSWORD' => 'Change password', 'CLICK_RETURN_FOLDER' => '%1$sReturn to your “%3$s” folder%2$s', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index c88845340b..bcacdc9156 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -471,7 +471,6 @@ switch ($mode) if ($member['user_sig']) { $member['user_sig'] = censor_text($member['user_sig']); - $member['user_sig'] = str_replace("\n", '
    ', $member['user_sig']); if ($member['user_sig_bbcode_bitfield']) { @@ -480,6 +479,7 @@ switch ($mode) $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']); } + $member['user_sig'] = bbcode_nl2br($member['user_sig']); $member['user_sig'] = smiley_text($member['user_sig']); } diff --git a/phpBB/posting.php b/phpBB/posting.php index 92b44b3f21..71e0dfc2c7 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -113,6 +113,7 @@ switch ($mode) else { upload_popup(); + garbage_collection(); exit; } break; @@ -323,6 +324,11 @@ if ($mode == 'bump') trigger_error('BUMP_ERROR'); } +// Subject length limiting to 60 characters if first post... +if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id'])) +{ + $template->assign_var('S_NEW_MESSAGE', true); +} // Determine some vars if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) @@ -333,6 +339,7 @@ else { $post_data['quote_username'] = isset($post_data['username']) ? $post_data['username'] : ''; } + $post_data['post_edit_locked'] = (isset($post_data['post_edit_locked'])) ? (int) $post_data['post_edit_locked'] : 0; $post_data['post_subject'] = (in_array($mode, array('quote', 'edit'))) ? $post_data['post_subject'] : ((isset($post_data['topic_title'])) ? $post_data['topic_title'] : ''); $post_data['topic_time_limit'] = (isset($post_data['topic_time_limit'])) ? (($post_data['topic_time_limit']) ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit']) : 0; diff --git a/phpBB/search.php b/phpBB/search.php index 8dabfa895a..dfeb76e946 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -761,7 +761,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_forum_id = $forum_id; } - $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&t=$result_topic_id&hilit=$u_hilit"); + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '')); $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; @@ -776,6 +776,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; + $row['topic_title'] = preg_replace('#(?!<.*)(?]*(?:)#is', '$1', $row['topic_title']); + $tpl_ary = array( 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), @@ -836,18 +838,19 @@ if ($keywords || $author || $author_id || $search_id || $submit) { // now find context for the searched words $row['post_text'] = get_context($row['post_text'], array_filter(explode('|', $hilit), 'strlen'), $return_chars); - $row['post_text'] = str_replace("\n", '
    ', $row['post_text']); + $row['post_text'] = bbcode_nl2br($row['post_text']); } else { - $row['post_text'] = str_replace("\n", '
    ', $row['post_text']); - // Second parse bbcode here if ($row['bbcode_bitfield']) { $bbcode->bbcode_second_pass($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield']); } + $row['post_text'] = bbcode_nl2br($row['post_text']); + $row['post_text'] = smiley_text($row['post_text']); + if (!empty($attachments[$row['post_id']])) { parse_attachments($forum_id, $row['post_text'], $attachments[$row['post_id']], $update_count); @@ -855,15 +858,13 @@ if ($keywords || $author || $author_id || $search_id || $submit) // we only display inline attachments unset($attachments[$row['post_id']]); } - - // Always process smilies after parsing bbcodes - $row['post_text'] = smiley_text($row['post_text']); } if ($hilit) { // post highlighting $row['post_text'] = preg_replace('#(?!<.*)(?]*(?:)#is', '$1', $row['post_text']); + $row['post_subject'] = preg_replace('#(?!<.*)(?]*(?:)#is', '$1', $row['post_subject']); } $tpl_ary = array( @@ -890,7 +891,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), - 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . '&hilit=' . $u_hilit) . '#p' . $row['post_id'] : '') + 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '') )); } @@ -936,9 +937,9 @@ while ($row = $db->sql_fetchrow($result)) continue; } - if (!$auth->acl_get('f_list', $row['forum_id']) || $row['forum_type'] == FORUM_LINK || ($row['forum_password'] && !$row['user_id'])) + if ($row['forum_type'] == FORUM_LINK || ($row['forum_password'] && !$row['user_id'])) { - // if the user does not have permissions to list this forum skip to the next branch + // if this forum is a link or password protected (user has not entered the password yet) then skip to the next branch continue; } @@ -961,9 +962,9 @@ while ($row = $db->sql_fetchrow($result)) $right = $row['right_id']; - if (!$auth->acl_get('f_search', $row['forum_id'])) + if ($auth->acl_gets('!f_search', '!f_list', $row['forum_id'])) { - // if the user does not have permissions to search this forum skip only this forum/category + // if the user does not have permissions to search or see this forum skip only this forum/category continue; } @@ -1041,45 +1042,49 @@ $template->assign_vars(array( 'S_IN_SEARCH' => true, )); -// Handle large objects differently for Oracle and MSSQL -switch ($db->sql_layer) +// only show recent searches to search administrators +if ($auth->acl_get('a_search')) { - case 'oracle': - $sql = 'SELECT search_time, search_keywords - FROM ' . SEARCH_RESULTS_TABLE . ' - WHERE dbms_lob.getlength(search_keywords) > 0 - ORDER BY search_time DESC'; - break; + // Handle large objects differently for Oracle and MSSQL + switch ($db->sql_layer) + { + case 'oracle': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE dbms_lob.getlength(search_keywords) > 0 + ORDER BY search_time DESC'; + break; + + case 'mssql': + case 'mssql_odbc': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE DATALENGTH(search_keywords) > 0 + ORDER BY search_time DESC'; + break; + + default: + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE search_keywords <> \'\' + ORDER BY search_time DESC'; + break; + } + $result = $db->sql_query_limit($sql, 5); - case 'mssql': - case 'mssql_odbc': - $sql = 'SELECT search_time, search_keywords - FROM ' . SEARCH_RESULTS_TABLE . ' - WHERE DATALENGTH(search_keywords) > 0 - ORDER BY search_time DESC'; - break; + while ($row = $db->sql_fetchrow($result)) + { + $keywords = $row['search_keywords']; - default: - $sql = 'SELECT search_time, search_keywords - FROM ' . SEARCH_RESULTS_TABLE . ' - WHERE search_keywords <> \'\' - ORDER BY search_time DESC'; - break; + $template->assign_block_vars('recentsearch', array( + 'KEYWORDS' => $keywords, + 'TIME' => $user->format_date($row['search_time']), + + 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords))) + )); + } + $db->sql_freeresult($result); } -$result = $db->sql_query_limit($sql, 5); - -while ($row = $db->sql_fetchrow($result)) -{ - $keywords = $row['search_keywords']; - - $template->assign_block_vars('recentsearch', array( - 'KEYWORDS' => $keywords, - 'TIME' => $user->format_date($row['search_time']), - - 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords))) - )); -} -$db->sql_freeresult($result); // Output the basic page page_header($user->lang['SEARCH']); diff --git a/phpBB/style.php b/phpBB/style.php index b33d473ae7..f177d30c03 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -46,7 +46,7 @@ if (strspn($sid, 'abcdefABCDEF0123456789') !== strlen($sid)) // happen to have a current session it will output nothing. We will also cache the // resulting CSS data for five minutes ... anything to reduce the load on the SQL // server a little -if ($id && $sid) +if ($id) { if (empty($acm_type) || empty($dbms)) { @@ -101,6 +101,11 @@ if ($id && $sid) $theme = $db->sql_fetchrow($result); $db->sql_freeresult($result); + if (!$theme) + { + exit; + } + if ($user['user_id'] == ANONYMOUS) { $user['user_lang'] = $config['default_lang']; @@ -111,25 +116,23 @@ if ($id && $sid) $sql = 'SELECT * FROM ' . STYLES_IMAGESET_DATA_TABLE . ' WHERE imageset_id = ' . $theme['imageset_id'] . " - AND image_lang IN('" . $db->sql_escape($user_image_lang) . "', '')"; + AND image_lang IN ('" . $db->sql_escape($user_image_lang) . "', '')"; $result = $db->sql_query($sql, 3600); $img_array = array(); - while ($row = $db->sql_fetchrow($result)) { $img_array[$row['image_name']] = $row; } - - if (!$theme) - { - exit; - } + $db->sql_freeresult($result); // gzip_compression if ($config['gzip_compress']) { - if (@extension_loaded('zlib') && !headers_sent()) + // IE6 is not able to compress the style (do not ask us why!) + $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? strtolower(htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT'])) : ''; + + if ($browser && strpos($browser, 'msie 6.0') === false && @extension_loaded('zlib') && !headers_sent()) { ob_start('ob_gzhandler'); } @@ -171,8 +174,6 @@ if ($id && $sid) } } - header('Content-type: text/css; charset=UTF-8'); - if ($recache) { include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx); @@ -191,16 +192,20 @@ if ($id && $sid) $db->sql_query($sql); $cache->destroy('sql', STYLES_THEME_TABLE); + } - header('Cache-Control: private, no-cache="set-cookie"'); + // Only set the expire time if the theme changed data is older than 30 minutes - to cope with changes from the ACP + if ($recache || $theme['theme_mtime'] > (time() - 1800)) + { header('Expires: 0'); - header('Pragma: no-cache'); } else { header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $expire_time)); } + header('Content-type: text/css; charset=UTF-8'); + // Parse Theme Data $replace = array( '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme', diff --git a/phpBB/styles/prosilver/template/custom_profile_fields.html b/phpBB/styles/prosilver/template/custom_profile_fields.html index 81f6daabb4..44c68f532b 100644 --- a/phpBB/styles/prosilver/template/custom_profile_fields.html +++ b/phpBB/styles/prosilver/template/custom_profile_fields.html @@ -14,9 +14,9 @@ - + - checked="checked" /> + checked="checked" /> diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 80dd20da99..61747f7e56 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -227,7 +227,8 @@ function addquote(post_id, username) theSelection = theSelection.replace(//ig, '\n'); theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); - theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 51255489ef..1214ebb946 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -21,9 +21,9 @@     - | + diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html index 637e5c7e9a..323668628d 100644 --- a/phpBB/styles/prosilver/template/jumpbox.html +++ b/phpBB/styles/prosilver/template/jumpbox.html @@ -17,7 +17,7 @@

    - +
    {L_FIND_USERNAME}
    diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index ce299e22f6..dfcf8a7f38 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -22,10 +22,10 @@ [ {L_USE_PERMISSIONS} ] -
    {L_RANK}:
    {RANK_TITLE}
    -
     {L_RANK}:
    {RANK_IMG}
    +
    {L_RANK}:
    {RANK_TITLE}
    +
     {L_RANK}:
    {RANK_IMG}
    -
    {L_USER_IS_INACTIVE}:
    {USER_INACTIVE_REASON}
    +
    {L_USER_IS_INACTIVE}:
    {USER_INACTIVE_REASON}
    {L_LOCATION}:
    {LOCATION}
    {L_AGE}:
    {AGE}
    {L_OCCUPATION}:
    {OCCUPATION}
    @@ -96,8 +96,8 @@

    {L_SIGNATURE}

    - -
    {SIGNATURE}
    + +
    {SIGNATURE}
    diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 7b578d2c1d..202b50fe5d 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -124,7 +124,7 @@ diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 26cbe54387..8a3e582cb2 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -93,7 +93,7 @@
    -
    +
    diff --git a/phpBB/styles/prosilver/template/posting_pm_layout.html b/phpBB/styles/prosilver/template/posting_pm_layout.html index 378c632858..48812da102 100644 --- a/phpBB/styles/prosilver/template/posting_pm_layout.html +++ b/phpBB/styles/prosilver/template/posting_pm_layout.html @@ -30,4 +30,6 @@ + + \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html index 95390c2545..f785fcf50a 100644 --- a/phpBB/styles/prosilver/template/search_body.html +++ b/phpBB/styles/prosilver/template/search_body.html @@ -91,6 +91,7 @@ +
    @@ -116,5 +117,6 @@
    + \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 186f4b01da..3924fa3944 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -86,7 +86,7 @@ -
    +
    diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index e702dcc48b..65538f5da9 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -49,6 +49,11 @@ + + + + + diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index 3c18462b8e..3a32beac95 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -1,7 +1,7 @@

    {L_EXPAND_VIEW} - {L_MESSAGE_HISTORY}: {TITLE} + {L_MESSAGE_HISTORY}: {HISTORY_TITLE}

    diff --git a/phpBB/styles/prosilver/template/ucp_pm_options.html b/phpBB/styles/prosilver/template/ucp_pm_options.html index e8ecf2c306..02ffe3cee4 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_options.html +++ b/phpBB/styles/prosilver/template/ucp_pm_options.html @@ -100,7 +100,7 @@
    -
    +
    diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index c21d4b0213..2d76586262 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -31,8 +31,8 @@

    {L_SENT_AT}: {SENT_DATE}
    {L_PM_FROM}: {MESSAGE_AUTHOR_FULL} -
    {L_TO}: {to_recipient.NAME_FULL}{to_recipient.NAME} -
    {L_BCC}: {bcc_recipient.NAME_FULL}{bcc_recipient.NAME} +
    {L_TO}: {to_recipient.NAME_FULL}{to_recipient.NAME}  +
    {L_BCC}: {bcc_recipient.NAME_FULL}{bcc_recipient.NAME} 

    diff --git a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html index 329597f542..2a40bcd53e 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html +++ b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html @@ -58,7 +58,7 @@
    -
    +
    for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}: *
    {profile_fields.LANG_EXPLAIN}
    {profile_fields.ERROR}
    {profile_fields.FIELD}
    diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 66245f3e6d..3b9d88d550 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -63,7 +63,7 @@
    -
    +
    for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}: *
    {profile_fields.LANG_EXPLAIN}
    {profile_fields.ERROR}
    {profile_fields.FIELD}
    diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 7d03939605..f5cc564a8e 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -4,7 +4,7 @@

    - + {FORUM_DESC}
    {L_MODERATOR}{L_MODERATORS}: {MODERATORS}

    @@ -39,7 +39,7 @@ @@ -157,11 +157,13 @@ +
    {L_NO_TOPICS}
    + @@ -181,7 +183,7 @@
    diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 840d029b3b..970f2fb1a6 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -113,7 +113,7 @@ -
    +
    @@ -128,7 +128,7 @@
  • {L_EDIT_POST}
  • {L_DELETE_POST}
  • {L_REPORT_POST}
  • -
  • {WARN_USER}
  • +
  • {L_WARN_USER}
  • {L_INFORMATION}
  • @@ -256,7 +256,7 @@
    - {S_TOPIC_MOD} + {S_TOPIC_MOD}
    diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 623ecc1226..1d08fb22bf 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -13,6 +13,11 @@ text-align: left; } +.rtl div.rules ul { + margin-left: 0; + margin-right: 20px; +} + /* Main blocks ---------------------------------------- */ .rtl #logo { @@ -67,6 +72,24 @@ text-align: left; } +.rtl ul.leftside li, .rtl ul.rightside li { + float: left; +} + +.rtl ul.leftside { + float: right; + margin-left: 5px; + margin-right: 0; + text-align: right; +} + +.rtl ul.rightside { + float: left; + margin-left: -5px; + margin-right: 5px; + text-align: left; +} + /* Table styles ----------------------------------------*/ .rtl table.table1 thead th { @@ -128,14 +151,26 @@ .rtl dl.details dt { float: right; + clear: right; text-align: left; } .rtl dl.details dd { - margin-right: 16em; + margin-right: 0; margin-left: 0; padding-right: 5px; padding-left: 0; + float: right; +} + +*:first-child+html dl.details dd { + margin-right: 15em; + float: none; +} + +* html dl.details dd { + margin-right: 15em; + float: none; } /* Pagination @@ -433,6 +468,7 @@ .rtl .sitehome, .rtl .icon-faq, .rtl .icon-members, .rtl .icon-home, .rtl .icon-ucp, .rtl .icon-register, .rtl .icon-logout, .rtl .icon-bookmark, .rtl .icon-bump, .rtl .icon-subscribe, .rtl .icon-unsubscribe, .rtl .icon-pages, .rtl .icon-search { background-position: 100% 50%; + padding: 1px 17px 0 0; } /* Poster profile icons diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index ba089c7ce6..cda2ed9d07 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -442,12 +442,6 @@ dl.faq dt { color: #BC2A4D; } -.announce, .unreadpost { - /* Highlight the announcements & unread posts box */ - border-left-color: #BC2A4D; - border-right-color: #BC2A4D; -} - /* Post signature */ .signature { border-top-color: #CCCCCC; diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index e46bbba836..1a015ca882 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -326,6 +326,20 @@ ul.navlinks { font-weight: bold; } +ul.leftside { + float: left; + margin-left: 0; + margin-right: 5px; + text-align: left; +} + +ul.rightside { + float: right; + margin-left: 5px; + margin-right: -5px; + text-align: right; +} + /* Table styles ----------------------------------------*/ table.table1 { @@ -444,17 +458,19 @@ dl.details { dl.details dt { float: left; - width: 16em; + clear: left; + width: 15em; text-align: right; color: #000000; display: block; } dl.details dd { - margin-left: 16em; + margin-left: 0; padding-left: 5px; margin-bottom: 5px; color: #828282; + float: left; } /* Pagination @@ -582,7 +598,7 @@ div.rules { font-size: 1.1em; } -div.rules li { +div.rules ul { margin-left: 20px; } diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css index 52bdb1baaa..20f3f67a38 100644 --- a/phpBB/styles/prosilver/theme/tweaks.css +++ b/phpBB/styles/prosilver/theme/tweaks.css @@ -59,3 +59,14 @@ dl.icon { margin-right: 35px; } +/* Correctly clear floating for details on profile view */ +*:first-child+html dl.details dd { + margin-left: 15em; + float: none; +} + +* html dl.details dd { + margin-left: 15em; + float: none; +} + diff --git a/phpBB/styles/subsilver2/template/mcp_header.html b/phpBB/styles/subsilver2/template/mcp_header.html index eea9dffe58..7db7c31d5b 100644 --- a/phpBB/styles/subsilver2/template/mcp_header.html +++ b/phpBB/styles/subsilver2/template/mcp_header.html @@ -66,7 +66,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/mcp_notes_user.html b/phpBB/styles/subsilver2/template/mcp_notes_user.html index fdc3bcd094..895c0d35e6 100644 --- a/phpBB/styles/subsilver2/template/mcp_notes_user.html +++ b/phpBB/styles/subsilver2/template/mcp_notes_user.html @@ -99,6 +99,7 @@ + diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index 5db2ffcc11..2c1d464d9a 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -125,18 +125,14 @@ - - - - + + - - - - + +
    {L_PLEASE_CONFIRM}{L_PLEASE_CONFIRM}

    {CONFIRM_MESSAGE}

    {S_HIDDEN_FIELDS}  

    {L_ADD_FEEDBACK_EXPLAIN}
    {L_CHANGE_POSTER}
    [ {L_FIND_USERNAME} ]
    {L_CHANGE_POSTER}

    [ {L_FIND_USERNAME} ]
    {L_MOD_OPTIONS} {L_MOD_OPTIONS}
    diff --git a/phpBB/styles/subsilver2/template/mcp_viewlogs.html b/phpBB/styles/subsilver2/template/mcp_viewlogs.html index 785cada6bb..8f5a0753fb 100644 --- a/phpBB/styles/subsilver2/template/mcp_viewlogs.html +++ b/phpBB/styles/subsilver2/template/mcp_viewlogs.html @@ -38,10 +38,10 @@ {L_NO_ENTRIES} - - + + diff --git a/phpBB/styles/subsilver2/template/mcp_warn_user.html b/phpBB/styles/subsilver2/template/mcp_warn_user.html index 254f020db1..96ad4fb1a6 100644 --- a/phpBB/styles/subsilver2/template/mcp_warn_user.html +++ b/phpBB/styles/subsilver2/template/mcp_warn_user.html @@ -54,6 +54,7 @@ + diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index c0870da8f6..744fcb4189 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -173,7 +173,7 @@ - +
    {L_ADD_WARNING_EXPLAIN}
    {L_SUBJECT}:
    {L_MESSAGE_BODY}:
    {L_MESSAGE_BODY_EXPLAIN} 

    @@ -391,6 +391,7 @@
    + diff --git a/phpBB/styles/subsilver2/template/search_body.html b/phpBB/styles/subsilver2/template/search_body.html index a914e5f38d..82cb691c10 100644 --- a/phpBB/styles/subsilver2/template/search_body.html +++ b/phpBB/styles/subsilver2/template/search_body.html @@ -50,6 +50,7 @@
    + @@ -68,6 +69,7 @@
    {L_RECENT_SEARCHES}

    + diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index 1bcd042d03..9e05368340 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -1,7 +1,7 @@ - + - + @@ -222,6 +222,7 @@ + diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index dc56afc7d6..db6b1118e3 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -291,6 +291,7 @@ $template->assign_vars(array( 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'fid[]=' . $forum_id), 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true, + 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '', diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index f25afea1eb..6da8e81dbd 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -19,7 +19,7 @@ include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); -$user->setup(); +$user->setup('memberlist'); // Get and set some variables $mode = request_var('mode', ''); @@ -40,7 +40,7 @@ if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']); } -$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED']); +$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']); $sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page'); // Sorting and order @@ -92,6 +92,7 @@ $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id ORDER BY left_id ASC'; $result = $db->sql_query($sql, 600); +$forum_data = array(); while ($row = $db->sql_fetchrow($result)) { $forum_data[$row['forum_id']] = $row; diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index afa818fdc3..0aa06721eb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -109,13 +109,20 @@ if ($view && !$post_id) $sql_condition = ($view == 'next') ? '>' : '<'; $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC'; - $sql = 'SELECT t.topic_id, t.forum_id - FROM ' . TOPICS_TABLE . ' t - LEFT JOIN ' . TOPICS_TABLE . " t2 ON (t2.topic_id = $topic_id AND t.forum_id = t2.forum_id) - WHERE t.topic_last_post_time $sql_condition t2.topic_last_post_time - " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . " - AND t.topic_moved_id = 0 - ORDER BY t.topic_last_post_time $sql_ordering"; + $sql = 'SELECT forum_id, topic_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $sql = 'SELECT topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $row['forum_id'] . " + AND topic_moved_id = 0 + AND topic_last_post_time $sql_condition {$row['topic_last_post_time']} + " . (($auth->acl_get('m_approve', $row['forum_id'])) ? '' : 'AND topic_approved = 1') . " + ORDER BY topic_last_post_time $sql_ordering"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -648,7 +655,7 @@ if (!empty($topic_data['poll_start'])) { if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options']) { - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); meta_refresh(5, $redirect_url); @@ -716,7 +723,7 @@ if (!empty($topic_data['poll_start'])) //, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now $db->sql_query($sql); - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); meta_refresh(5, $redirect_url); trigger_error($user->lang['VOTE_SUBMITTED'] . '

    ' . sprintf($user->lang['RETURN_TOPIC'], '', '')); @@ -740,23 +747,24 @@ if (!empty($topic_data['poll_start'])) for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']); - $poll_info[$i]['poll_option_text'] = str_replace("\n", '
    ', $poll_info[$i]['poll_option_text']); if ($poll_bbcode !== false) { $poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']); } + $poll_info[$i]['poll_option_text'] = bbcode_nl2br($poll_info[$i]['poll_option_text']); $poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']); } $topic_data['poll_title'] = censor_text($topic_data['poll_title']); - $topic_data['poll_title'] = str_replace("\n", '
    ', $topic_data['poll_title']); if ($poll_bbcode !== false) { $poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']); } + + $topic_data['poll_title'] = bbcode_nl2br($topic_data['poll_title']); $topic_data['poll_title'] = smiley_text($topic_data['poll_title']); unset($poll_bbcode); @@ -1215,13 +1223,13 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig'] = str_replace("\n", '
    ', $user_cache[$poster_id]['sig']); if ($user_cache[$poster_id]['sig_bbcode_bitfield']) { $bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']); } + $user_cache[$poster_id]['sig'] = bbcode_nl2br($user_cache[$poster_id]['sig']); $user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']); $user_cache[$poster_id]['sig_parsed'] = true; } @@ -1235,9 +1243,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); } - $message = str_replace("\n", '
    ', $message); - - // Always process smilies after parsing bbcodes + $message = bbcode_nl2br($message); $message = smiley_text($message); if (!empty($attachments[$row['post_id']])) @@ -1245,15 +1251,16 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count); } + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text($row['post_subject']); + // Highlight active words (primarily for search) if ($highlight_match) { $message = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $message); + $row['post_subject'] = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $row['post_subject']); } - // Replace naughty words such as farty pants - $row['post_subject'] = censor_text($row['post_subject']); - // Editing information if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) {
    {L_MESSAGE_HISTORY} - {TITLE}{L_MESSAGE_HISTORY} - {HISTORY_TITLE}
    diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index f2786d4ea1..b4c58834b2 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -214,7 +214,7 @@
    {L_NO_TOPICS}{L_NO_TOPICS_TIME_FRAME}{L_NO_TOPICS}{L_NO_TOPICS_TIME_FRAME}