diff options
31 files changed, 275 insertions, 66 deletions
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index f96da7e26a..f61be27c9b 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -7,7 +7,7 @@ <p>{L_EXTENSIONS_EXPLAIN}</p> <fieldset class="quick"> - <span class="small"><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE_ALL}</a> • <a href="javascript:phpbb.toggleDisplay('version_check_settings');">{L_SETTINGS}</a></span> + <span class="small"><a href="https://www.phpbb.com/go/customise/extensions/3.1" target="_blank">{L_BROWSE_EXTENSIONS_DATABASE}</a> • <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE_ALL}</a> • <a href="javascript:phpbb.toggleDisplay('version_check_settings');">{L_SETTINGS}</a></span> </fieldset> <form id="version_check_settings" method="post" action="{U_ACTION}" style="display:none"> @@ -98,6 +98,12 @@ <table class="table1"> <tr> + <th>{L_EXTENSION_INSTALL_HEADLINE}</th> + </tr> + <tr> + <td class="row3">{L_EXTENSION_INSTALL_EXPLAIN}</td> + </tr> + <tr> <th>{L_EXTENSION_UPDATE_HEADLINE}</th> </tr> <tr> diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index 4439f519e0..f708eb1508 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -68,6 +68,10 @@ <p>{L_ACP_LANGUAGE_PACKS_EXPLAIN}</p> + <fieldset class="quick"> + <span class="small"><a href="https://www.phpbb.com/go/customise/language-packs/3.1" target="_blank">{L_BROWSE_LANGUAGE_PACKS_DATABASE}</a></span> + </fieldset> + <table class="table1 zebra-table"> <thead> <tr> diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 86e666c4ed..92ceaebc08 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -19,7 +19,7 @@ {S_HIDDEN_FIELDS} <div style="text-align: center;"> - <input type="submit" name="confirm" value="{L_YES}" class="button2" /> + <input type="submit" name="confirm" value="{L_YES}" class="button2" /> <input type="submit" name="cancel" value="{L_NO}" class="button2" /> </div> @@ -32,6 +32,10 @@ <!-- IF L_EXPLAIN --><p>{L_EXPLAIN}</p><!-- ENDIF --> +<fieldset class="quick"> + <span class="small"><a href="https://www.phpbb.com/go/customise/styles/3.1" target="_blank">{L_BROWSE_STYLES_DATABASE}</a></span> +</fieldset> + <form id="acp_styles" method="post" action="{U_ACTION}"> {S_HIDDEN_FIELDS} {S_FORM_TOKEN} diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 953b6be0bd..36e881f5fd 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -394,8 +394,11 @@ phpbb.ajaxify = function(options) { error: errorHandler, cache: false }); + request.always(function() { - $loadingIndicator.fadeOut(phpbb.alertTime); + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } }); }; diff --git a/phpBB/config/cron.yml b/phpBB/config/cron.yml index 7a90c39733..c5b88df181 100644 --- a/phpBB/config/cron.yml +++ b/phpBB/config/cron.yml @@ -120,6 +120,7 @@ services: - @config - @dbal.conn - @user + - @dispatcher calls: - [set_name, [cron.task.core.tidy_search]] tags: diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c9b292ab6d..8bd7ac47e0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -6,7 +6,7 @@ <meta name="description" content="phpBB 3.1.x Changelog" /> <title>phpBB • Changelog</title> -<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -4979,7 +4979,7 @@ </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index 0b3b421e72..4786d8d796 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -6,7 +6,7 @@ <meta name="description" content="phpBB 3.1.x frequently asked questions" /> <title>phpBB • FAQ</title> -<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -343,7 +343,7 @@ I want to sue you because i think you host an illegal board!</h2> </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index d1c0fe1438..132367dd0a 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -6,7 +6,7 @@ <meta name="description" content="phpBB 3.1.x Installation, updating and conversion informations" /> <title>phpBB • Install</title> -<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -507,7 +507,7 @@ </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index f5ac3ecacd..21639045a3 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -6,7 +6,7 @@ <meta name="description" content="phpBB 3.1.x Readme" /> <title>phpBB • Readme</title> -<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -366,7 +366,7 @@ </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index d571e72dd4..27d090c296 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -6,7 +6,7 @@ <meta name="description" content="This is an explanation of how to use the phpBB auth/acl API" /> <title>phpBB3 • Auth API</title> -<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -110,7 +110,7 @@ $auth = new phpbb\auth\auth();</pre> <p>Following are the methods you are able to use.</p> <a name="acl"></a><h3>2.i. acl</h3> - + <p>The <code>acl</code> method is the initialisation routine for all the acl functions. If you intend calling any acl method you must first call this. The method takes as its one and only required parameter an associative array containing user information as stored in the database. This array must contain at least the following information; user_id, user_permissions and user_type. It is called in the following way:</p> <div class="codebox"><pre> @@ -285,7 +285,7 @@ $auth_admin = new auth_admin();</pre> </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 4c5fe73543..26189235ef 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -6,7 +6,7 @@ <meta name="description" content="Ascraeus coding guidelines document" /> <title>phpBB3 • Coding Guidelines</title> -<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -300,9 +300,9 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c <div class="indent"> <p><code>$current_user</code> is right, but <code>$currentuser</code> and <code> $currentUser</code> are not.</p> </div> - + <p>In JavaScript, variable names should use camel case:</p> - + <div class="indent"> <p><code>currentUser</code> is right, but <code>currentuser</code> and <code>current_user</code> are not.</p> </div> @@ -431,7 +431,7 @@ function do_stuff() ... }</pre> </div> - + <p>In JavaScript code, braces always go on the same line:</p> <div class="codebox"><pre> @@ -2568,7 +2568,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 27c286c598..82aa91429c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4878,7 +4878,7 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) $src = 'src="' . $avatar_data['src'] . '"'; } - $html = '<img class="avatar" ' . $src . + $html = '<img class="avatar" ' . $src . ' ' . ($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') . ($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') . 'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />'; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4f3b7ecfcf..ca8baecff8 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1542,7 +1542,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u return false; } - $current_time = time(); + if (!empty($data['post_time'])) + { + $current_time = $data['post_time']; + } + else + { + $current_time = time(); + } if ($mode == 'post') { @@ -1738,6 +1745,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_type' => $topic_type, 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : 0, + 'topic_status' => (isset($data['topic_status'])) ? $data['topic_status'] : ITEM_UNLOCKED, ); if (isset($poll['poll_options']) && !empty($poll['poll_options'])) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 815f07d2e4..c46653db9e 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1402,7 +1402,7 @@ function user_ipwhois($ip) $match = array(); // Test for referrals from $whois_host to other whois databases, roll on rwhois - if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match)) + if (preg_match('#ReferralServer:[\x20]*whois://(.+)#im', $ipwhois, $match)) { if (strpos($match[1], ':') !== false) { diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index f0fc0a3f06..0d1df2b937 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -461,7 +461,7 @@ function mcp_post_details($id, $mode, $action) */ function change_poster(&$post_info, $userdata) { - global $auth, $db, $config, $phpbb_root_path, $phpEx, $user; + global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 82c3bc9ab0..5fde63ecb4 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -404,7 +404,7 @@ class mcp_queue $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>'; foreach ($forum_list_approve as $row) { - $forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>'; + $forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . truncate_string($row['forum_name'], 30, 255, false, $user->lang['ELLIPSIS']) . '</option>'; } $sort_days = $total = 0; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 42ca9bf09d..8b3d8d9fd5 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -791,28 +791,6 @@ class bbcode_firstpass extends bbcode else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m) && substr($out, -1, 1) == '[') { $this->parsed_items['quote']++; - - // the buffer holds a valid opening tag - if ($config['max_quote_depth'] && sizeof($close_tags) >= $config['max_quote_depth']) - { - if ($config['max_quote_depth'] == 1) - { - // Depth 1 - no nesting is allowed - $error_ary['quote_depth'] = $user->lang('QUOTE_NO_NESTING'); - } - else - { - // There are too many nested quotes - $error_ary['quote_depth'] = $user->lang('QUOTE_DEPTH_EXCEEDED', (int) $config['max_quote_depth']); - } - - $out .= $buffer . $tok; - $tok = '[]'; - $buffer = ''; - - continue; - } - array_push($close_tags, '/quote:' . $this->bbcode_uid); if (isset($m[1]) && $m[1]) @@ -1277,6 +1255,12 @@ class parse_message extends bbcode_firstpass return $update_this_message ? $this->warn_msg : $return_message; } + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->remove_nested_quotes($config['max_quote_depth']); + } + // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. // The maximum length check happened before any parsings. if ($mode === 'post' && utf8_clean_string($this->message) === '') @@ -1856,6 +1840,50 @@ class parse_message extends bbcode_firstpass } /** + * Remove nested quotes at given depth in current parsed message + * + * @param integer $max_depth Depth limit + * @return null + */ + public function remove_nested_quotes($max_depth) + { + // Capture all [quote] and [/quote] tags + preg_match_all('(\\[/?quote(?:="(.*?)")?:' . $this->bbcode_uid . '\\])', $this->message, $matches, PREG_OFFSET_CAPTURE); + + // Iterate over the quote tags to mark the ranges that must be removed + $depth = 0; + $ranges = array(); + $start_pos = 0; + foreach ($matches[0] as $match) + { + if ($match[0][1] === '/') + { + --$depth; + if ($depth == $max_depth) + { + $end_pos = $match[1] + strlen($match[0]); + $length = $end_pos - $start_pos; + $ranges[] = array($start_pos, $length); + } + } + else + { + ++$depth; + if ($depth == $max_depth + 1) + { + $start_pos = $match[1]; + } + } + } + + foreach (array_reverse($ranges) as $range) + { + list($start_pos, $length) = $range; + $this->message = substr_replace($this->message, '', $start_pos, $length); + } + } + + /** * Setter function for passing the plupload object * * @param \phpbb\plupload\plupload $plupload The plupload object diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index d81c4ce7fe..d7b9b32dbf 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -265,7 +265,9 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) * @var array message_row Array with message data * @var array cp_row Array with senders custom profile field data * @var array msg_data Template array with message data + * @var array user_info User data of the sender * @since 3.1.0-a1 + * @changed 3.1.6-RC1 Added user_info into event */ $vars = array( 'id', @@ -276,6 +278,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'message_row', 'cp_row', 'msg_data', + 'user_info', ); extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_messsage', compact($vars))); diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index bacb33c70a..e5d6789764 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -68,6 +68,12 @@ $lang = array_merge($lang, array( 'EXTENSION_NAME' => 'Extension Name', 'EXTENSION_ACTIONS' => 'Actions', 'EXTENSION_OPTIONS' => 'Options', + 'EXTENSION_INSTALL_HEADLINE'=> 'Installing an extension', + 'EXTENSION_INSTALL_EXPLAIN' => '<ol> + <li>Download an extension from phpBB’s extensions database</li> + <li>Unzip the extension and upload it to the <samp>ext/</samp> directory of your phpBB board</li> + <li>Enable the extension, here in the Extensions manager</li> + </ol>', 'EXTENSION_UPDATE_HEADLINE' => 'Updating an extension', 'EXTENSION_UPDATE_EXPLAIN' => '<ol> <li>Disable the extension</li> @@ -119,6 +125,8 @@ $lang = array_merge($lang, array( 'FORCE_UNSTABLE' => 'Always check for unstable versions', 'EXTENSIONS_VERSION_CHECK_SETTINGS' => 'Version check settings', + 'BROWSE_EXTENSIONS_DATABASE' => 'Browse extensions database', + 'META_FIELD_NOT_SET' => 'Required meta field %s has not been set.', 'META_FIELD_INVALID' => 'Meta field %s is invalid.', )); diff --git a/phpBB/language/en/acp/language.php b/phpBB/language/en/acp/language.php index f46e78efd4..d14491ae75 100644 --- a/phpBB/language/en/acp/language.php +++ b/phpBB/language/en/acp/language.php @@ -73,4 +73,6 @@ $lang = array_merge($lang, array( 'THOSE_MISSING_LANG_VARIABLES' => 'The following language variables are missing from the “%s” language pack', 'UNINSTALLED_LANGUAGE_PACKS' => 'Uninstalled language packs', + + 'BROWSE_LANGUAGE_PACKS_DATABASE' => 'Browse language packs database', )); diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index e6b05c8282..0d91eb3704 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -83,4 +83,6 @@ $lang = array_merge($lang, array( 'STYLE_USED_BY' => 'Used by (including robots)', 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', + + 'BROWSE_STYLES_DATABASE' => 'Browse styles database', )); diff --git a/phpBB/language/en/help_bbcode.php b/phpBB/language/en/help_bbcode.php index 0a8d30581a..989e5fc26e 100644 --- a/phpBB/language/en/help_bbcode.php +++ b/phpBB/language/en/help_bbcode.php @@ -90,7 +90,7 @@ $help = array( ), array( 0 => 'Linking to another site', - 1 => 'phpBB BBCode supports a number of ways of creating URIs (Uniform Resource Indicators) better known as URLs.<ul><li>The first of these uses the <strong>[url=][/url]</strong> tag, whatever you type after the = sign will cause the contents of that tag to act as a URL. For example to link to phpBB.com you could use:<br /><br /><strong>[url=http://www.phpbb.com/]</strong>Visit phpBB!<strong>[/url]</strong><br /><br />This would generate the following link, <a href="http://www.phpbb.com/">Visit phpBB!</a> Please notice that the link opens in the same window or a new window depending on the users browser preferences.</li><li>If you want the URL itself displayed as the link you can do this by simply using:<br /><br /><strong>[url]</strong>http://www.phpbb.com/<strong>[/url]</strong><br /><br />This would generate the following link, <a href="http://www.phpbb.com/">http://www.phpbb.com/</a></li><li>Additionally, phpBB features something called <i>Magic Links</i>, this will turn any syntactically correct URL into a link without you needing to specify any tags or even the leading http://. For example typing www.phpbb.com into your message will automatically lead to <a href="http://www.phpbb.com/">www.phpbb.com</a> being output when you view the message.</li><li>The same thing applies equally to email addresses, you can either specify an address explicitly for example:<br /><br /><strong>[email]</strong>no.one@domain.adr<strong>[/email]</strong><br /><br />which will output <a href="mailto:no.one@domain.adr">no.one@domain.adr</a> or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.</li></ul>As with all the BBCode tags you can wrap URLs around any of the other tags such as <strong>[img][/img]</strong> (see next entry), <strong>[b][/b]</strong>, etc. As with the formatting tags it is up to you to ensure the correct open and close order is following, for example:<br /><br /><strong>[url=http://www.phpbb.com/][img]</strong>http://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/url][/img]</strong><br /><br />is <span style="text-decoration: underline">not</span> correct which may lead to your post being deleted so take care.' + 1 => 'phpBB BBCode supports a number of ways of creating URIs (Uniform Resource Indicators) better known as URLs.<ul><li>The first of these uses the <strong>[url=][/url]</strong> tag, whatever you type after the = sign will cause the contents of that tag to act as a URL. For example to link to phpBB.com you could use:<br /><br /><strong>[url=https://www.phpbb.com/]</strong>Visit phpBB!<strong>[/url]</strong><br /><br />This would generate the following link, <a href="https://www.phpbb.com/">Visit phpBB!</a> Please notice that the link opens in the same window or a new window depending on the users browser preferences.</li><li>If you want the URL itself displayed as the link you can do this by simply using:<br /><br /><strong>[url]</strong>https://www.phpbb.com/<strong>[/url]</strong><br /><br />This would generate the following link, <a href="https://www.phpbb.com/">https://www.phpbb.com/</a></li><li>Additionally, phpBB features something called <i>Magic Links</i>, this will turn any syntactically correct URL into a link without you needing to specify any tags or even the leading https://. For example typing www.phpbb.com into your message will automatically lead to <a href="https://www.phpbb.com/">www.phpbb.com</a> being output when you view the message.</li><li>The same thing applies equally to email addresses, you can either specify an address explicitly for example:<br /><br /><strong>[email]</strong>no.one@domain.adr<strong>[/email]</strong><br /><br />which will output <a href="mailto:no.one@domain.adr">no.one@domain.adr</a> or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.</li></ul>As with all the BBCode tags you can wrap URLs around any of the other tags such as <strong>[img][/img]</strong> (see next entry), <strong>[b][/b]</strong>, etc. As with the formatting tags it is up to you to ensure the correct open and close order is following, for example:<br /><br /><strong>[url=https://www.phpbb.com/][img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/url][/img]</strong><br /><br />is <span style="text-decoration: underline">not</span> correct which may lead to your post being deleted so take care.' ), array( 0 => '--', @@ -98,7 +98,7 @@ $help = array( ), array( 0 => 'Adding an image to a post', - 1 => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). To display an image you must surround the URL pointing to the image with <strong>[img][/img]</strong> tags. For example:<br /><br /><strong>[img]</strong>http://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img]</strong><br /><br />As noted in the URL section above you can wrap an image in a <strong>[url][/url]</strong> tag if you wish, e.g.<br /><br /><strong>[url=http://www.phpbb.com/][img]</strong>http://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img][/url]</strong><br /><br />would generate:<br /><br /><a href="http://www.phpbb.com/"><img src="http://www.phpbb.com/theme/images/logos/blue/160x52.png" alt="" /></a>' + 1 => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). To display an image you must surround the URL pointing to the image with <strong>[img][/img]</strong> tags. For example:<br /><br /><strong>[img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img]</strong><br /><br />As noted in the URL section above you can wrap an image in a <strong>[url][/url]</strong> tag if you wish, e.g.<br /><br /><strong>[url=https://www.phpbb.com/][img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img][/url]</strong><br /><br />would generate:<br /><br /><a href="https://www.phpbb.com/"><img src="https://www.phpbb.com/theme/images/logos/blue/160x52.png" alt="" /></a>' ), array( 0 => 'Adding attachments into a post', diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index ee36243844..73147a85a0 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -161,6 +161,13 @@ class upload extends \phpbb\avatar\driver\driver return false; } + // Delete current avatar if not overwritten + $ext = substr(strrchr($row['avatar'], '.'), 1); + if ($ext && $ext !== $file->get('extension')) + { + $this->delete($row); + } + return array( 'avatar' => $row['id'] . '_' . time() . '.' . $file->get('extension'), 'avatar_width' => $file->get('width'), diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php index ce16b3f988..eb3970254f 100644 --- a/phpBB/phpbb/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -20,24 +20,60 @@ namespace phpbb\cron\task\core; */ class tidy_search extends \phpbb\cron\task\base { + /** + * phpBB root path + * @var string + */ protected $phpbb_root_path; + + /** + * PHP file extension + * @var string + */ protected $php_ext; + + /** + * Auth object + * @var \phpbb\auth\auth + */ protected $auth; + + /** + * Config object + * @var \phpbb\config\config + */ protected $config; + + /** + * Database object + * @var \phpbb\db\driver\driver_interface + */ protected $db; + + /** + * User object + * @var \phpbb\user + */ protected $user; /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * Constructor. * - * @param string $phpbb_root_path The root path + * @param string $phpbb_root_path The phpBB root path * @param string $php_ext The PHP file extension - * @param \phpbb\auth\auth $auth The auth - * @param \phpbb\config\config $config The config - * @param \phpbb\db\driver\driver_interface $db The db connection - * @param \phpbb\user $user The user + * @param \phpbb\auth\auth $auth The auth object + * @param \phpbb\config\config $config The config object + * @param \phpbb\db\driver\driver_interface $db The database object + * @param \phpbb\user $user The user object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher The event dispatcher object */ - public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user) + public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -45,6 +81,7 @@ class tidy_search extends \phpbb\cron\task\base $this->config = $config; $this->db = $db; $this->user = $user; + $this->phpbb_dispatcher = $phpbb_dispatcher; } /** @@ -58,7 +95,7 @@ class tidy_search extends \phpbb\cron\task\base // We do some additional checks in the module to ensure it can actually be utilised $error = false; - $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user); + $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user, $this->phpbb_dispatcher); if (!$error) { diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index 2ce63402aa..2dac154036 100644 --- a/phpBB/phpbb/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -31,7 +31,7 @@ class includecss extends \phpbb\template\twig\node\includeasset $compiler ->raw("<link href=\"' . ") ->raw("\$asset_file . '\"") - ->raw(' rel="stylesheet" type="text/css" media="screen, projection" />') + ->raw(' rel="stylesheet" type="text/css" media="screen" />') ; } } diff --git a/phpBB/posting.php b/phpBB/posting.php index 7e3611c368..4f901c1d94 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -624,6 +624,11 @@ if ($mode != 'edit') $post_data['enable_urls'] = true; } +if ($mode == 'post') +{ + $post_data['topic_status'] = ($request->is_set_post('lock_topic') && $auth->acl_gets('m_lock', 'f_user_lock', $forum_id)) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + $post_data['enable_magic_url'] = $post_data['drafts'] = false; // User own some drafts? @@ -1325,7 +1330,6 @@ if ($submit || $preview || $refresh) 'enable_urls' => (bool) $post_data['enable_urls'], 'enable_indexing' => (bool) $post_data['enable_indexing'], 'message_md5' => (string) $message_md5, - 'post_time' => (isset($post_data['post_time'])) ? (int) $post_data['post_time'] : $current_time, 'post_checksum' => (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0), @@ -1340,6 +1344,7 @@ if ($submit || $preview || $refresh) 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, + 'topic_status' => $post_data['topic_status'], 'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false, 'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false, @@ -1573,11 +1578,21 @@ if (!sizeof($error) && $preview) } } +// Remove quotes that would become nested too deep before decoding the text +$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh); +if ($generate_quote && $config['max_quote_depth'] > 0) +{ + $tmp_bbcode_uid = $message_parser->bbcode_uid; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + $message_parser->remove_nested_quotes($config['max_quote_depth'] - 1); + $message_parser->bbcode_uid = $tmp_bbcode_uid; +} + // Decode text for message display $post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; $message_parser->decode_message($post_data['bbcode_uid']); -if ($mode == 'quote' && !$submit && !$preview && !$refresh) +if ($generate_quote) { if ($config['allow_bbcode']) { @@ -1768,7 +1783,7 @@ $page_data = array( 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true, 'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '', - 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, + 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote' || $mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index ccedf19604..0d53a53d8e 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -34,7 +34,7 @@ function popup(url, width, height, name) { function pageJump(item) { 'use strict'; - var page = item.val(), + var page = parseInt(item.val(), 10), perPage = item.attr('data-per-page'), baseUrl = item.attr('data-base-url'), startName = item.attr('data-start-name'); diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 2b2036883b..ebe6470fee 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -31,7 +31,7 @@ <script> WebFontConfig = { google: { - families: ['Open Sans:n6'] + families: ['Open+Sans:600:cyrillic-ext,latin,greek-ext,greek,vietnamese,latin-ext,cyrillic'] } }; diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 637ac59465..baa6223754 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -10,7 +10,7 @@ <script> WebFontConfig = { google: { - families: ['Open Sans:n6'] + families: ['Open+Sans:600:cyrillic-ext,latin,greek-ext,greek,vietnamese,latin-ext,cyrillic'] } }; diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index fd802eed45..33632a01e1 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -59,4 +59,85 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case 'Your subject contains the following unsupported characters' ); } + + /** + * @testdox max_quote_depth is applied to the text populating the posting form + */ + public function test_quote_depth_form() + { + $text = '0[quote]1[quote]2[/quote]1[/quote]0'; + $expected = array( + 0 => '[quote="admin"]0[quote]1[quote]2[/quote]1[/quote]0[/quote]', + 1 => '[quote="admin"]00[/quote]', + 2 => '[quote="admin"]0[quote]11[/quote]0[/quote]', + 3 => '[quote="admin"]0[quote]1[quote]2[/quote]1[/quote]0[/quote]', + ); + + $this->login(); + $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); + $post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text); + $quote_url = "posting.php?mode=quote&f=2&t={$post['topic_id']}&p={$post['post_id']}&sid={$this->sid}"; + + $this->admin_login(); + foreach ($expected as $quote_depth => $expected_text) + { + $this->set_quote_depth($quote_depth); + $crawler = self::request('GET', $quote_url); + $this->assertContains($expected_text, $crawler->filter('textarea#message')->text()); + } + } + + /** + * @testdox max_quote_depth is applied to the submitted text + */ + public function test_quote_depth_submit() + { + $text = 'depth:0[quote]depth:1[quote]depth:2[quote]depth:3[/quote][/quote][/quote]'; + $contains = array( + 0 => array('depth:0', 'depth:1', 'depth:2', 'depth:3'), + 1 => array('depth:0', 'depth:1'), + 2 => array('depth:0', 'depth:1', 'depth:2'), + 3 => array('depth:0', 'depth:1', 'depth:2', 'depth:3'), + ); + $not_contains = array( + 0 => array(), + 1 => array('depth:2', 'depth:3'), + 2 => array('depth:3'), + 3 => array(), + ); + + $this->login(); + $this->admin_login(); + $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); + + for ($quote_depth = 0; $quote_depth <= 2; ++$quote_depth) + { + $this->set_quote_depth($quote_depth); + + $post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text); + $url = "viewtopic.php?p={$post['post_id']}&sid={$this->sid}"; + + $crawler = self::request('GET', $url); + $text_content = $crawler->filter('#p' . $post['post_id'])->text(); + foreach ($contains[$quote_depth] as $contains_text) + { + $this->assertContains($contains_text, $text_content); + } + foreach ($not_contains[$quote_depth] as $not_contains_text) + { + $this->assertNotContains($not_contains_text, $text_content); + } + } + } + + protected function set_quote_depth($depth) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values['config[max_quote_depth]'] = $depth; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertEquals(1, $crawler->filter('.successbox')->count()); + } } diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index 49bd9dec8b..4ef9b90ec4 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -71,19 +71,19 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te */ array( array('TEST' => 1), - '<link href="tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', + '<link href="tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', ), array( array('TEST' => 2), - '<link href="tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', + '<link href="tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', ), array( array('TEST' => 3), - '<link href="' . $url_base . '/ext/include/css/styles/all/theme/test.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', + '<link href="' . $url_base . '/ext/include/css/styles/all/theme/test.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', ), array( array('TEST' => 4), - '<link href="' . $url_base . '/ext/include/css/styles/all/theme/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', + '<link href="' . $url_base . '/ext/include/css/styles/all/theme/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', ), ); } |