diff options
Diffstat (limited to 'phpBB')
57 files changed, 617 insertions, 109 deletions
diff --git a/phpBB/adm/style/installer_header.html b/phpBB/adm/style/installer_header.html index 775caa7c67..704db9e174 100644 --- a/phpBB/adm/style/installer_header.html +++ b/phpBB/adm/style/installer_header.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index 9266372ab8..f227f729fd 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html index f62a7a900e..9f47b2052b 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> diff --git a/phpBB/composer.json b/phpBB/composer.json index b0c9b57cb6..d6a4213c4a 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -62,7 +62,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "3.3.x-dev" } } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 968447fd63..f565c424fa 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9cbb41222e71eb86e0ef9118baafc691", - "content-hash": "03a990fa2d088c89afe4824d2d53e873", + "hash": "e61304256160e9e0c521a4996912d65d", + "content-hash": "64ae8ac9ac0cc8b1f47e58f43e2d7461", "packages": [ { "name": "bantu/ini-get-wrapper", diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml index 2055fb68c5..0a28c0ed1f 100644 --- a/phpBB/config/default/container/services_console.yml +++ b/phpBB/config/default/container/services_console.yml @@ -219,3 +219,16 @@ services: - '@user' tags: - { name: console.command } + + console.command.user.add: + class: phpbb\console\command\user\add + arguments: + - '@user' + - '@dbal.conn' + - '@config' + - '@language' + - '@passwords.manager' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } diff --git a/phpBB/config/default/container/services_cron.yml b/phpBB/config/default/container/services_cron.yml index dd3982a659..0b95a96190 100644 --- a/phpBB/config/default/container/services_cron.yml +++ b/phpBB/config/default/container/services_cron.yml @@ -75,6 +75,7 @@ services: - '%core.root_path%' - '%core.php_ext%' - '@config' + - '%core.cache_dir%' calls: - [set_name, [cron.task.core.queue]] tags: diff --git a/phpBB/config/default/container/services_routing.yml b/phpBB/config/default/container/services_routing.yml index 3cb74ca2b1..3048145a2f 100644 --- a/phpBB/config/default/container/services_routing.yml +++ b/phpBB/config/default/container/services_routing.yml @@ -5,9 +5,8 @@ services: - '@service_container' - '@routing.chained_resources_locator' - '@routing.delegated_loader' - - '%core.root_path%' - '%core.php_ext%' - - '%core.environment%' + - '%core.cache_dir%' router.listener: class: Symfony\Component\HttpKernel\EventListener\RouterListener diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index 943a79cd65..a9f2efdb16 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -1,5 +1,5 @@ parameters: - text_formatter.cache.dir: '%core.root_path%cache/%core.environment%/' + text_formatter.cache.dir: '%core.cache_dir%' text_formatter.cache.parser.key: _text_formatter_parser text_formatter.cache.renderer.key: _text_formatter_renderer diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index 2dbf444e0c..dc08d65e1a 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -1,5 +1,5 @@ parameters: - core.template.cache_path: '%core.root_path%cache/%core.environment%/twig/' + core.template.cache_path: '%core.cache_dir%twig/' services: template.twig.environment: diff --git a/phpBB/config/installer/container/services.yml b/phpBB/config/installer/container/services.yml index 20d790e9a6..97fc1256fd 100644 --- a/phpBB/config/installer/container/services.yml +++ b/phpBB/config/installer/container/services.yml @@ -12,7 +12,7 @@ services: cache.driver: class: '%cache.driver.class%' arguments: - - '%core.root_path%/cache/installer/' + - '%core.cache_dir%' config: class: phpbb\config\config diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f6e63196ee..10dc48b801 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -2,6 +2,7 @@ <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Changelog" /> <title>phpBB • Changelog</title> diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index 4786d8d796..5f3a425cda 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -2,6 +2,7 @@ <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x frequently asked questions" /> <title>phpBB • FAQ</title> diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 86b320d197..c0e0dce2a7 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -2,6 +2,7 @@ <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Installation, updating and conversion informations" /> <title>phpBB • Install</title> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 96af78f48a..20afc310db 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -2,8 +2,9 @@ <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="" /> -<meta name="description" content="phpBB 3.1.x Readme" /> +<meta name="description" content="phpBB 3.3.x Readme" /> <title>phpBB • Readme</title> <link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> @@ -20,7 +21,7 @@ <div id="doc-description"> <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> - <h1>phpBB 3.1.x Readme</h1> + <h1>phpBB 3.3.x Readme</h1> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> @@ -224,7 +225,7 @@ <div class="content"> - <p>This is a stable release of phpBB. The 3.1.x line is feature frozen, with point releases principally including fixes for bugs and security issues. Feature alterations and minor feature additions may be done if deemed absolutely required. The next major release will be phpBB 3.2 which is currently under development. Please do not post questions asking when 3.2 will be available, no release date has been set.</p> + <p>This is a stable release of phpBB. The 3.2.x line is feature frozen, with point releases principally including fixes for bugs and security issues. Feature alterations and minor feature additions may be done if deemed absolutely required. The next major release will be phpBB 3.3 which is currently under development. Please do not post questions asking when 3.3 will be available, no release date has been set.</p> <p>Those interested in the development of phpBB should keep an eye on the development forums to see how things are progressing:</p> @@ -323,7 +324,7 @@ <div class="content"> - <p>phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.0 and the maximum supported version is PHP 7.0.</p> + <p>phpBB 3.3.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.0 and the maximum supported version is PHP 7.0.</p> <p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p> diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index 27d090c296..960fa76417 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -2,6 +2,7 @@ <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="" /> <meta name="description" content="This is an explanation of how to use the phpBB auth/acl API" /> <title>phpBB3 • Auth API</title> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 26189235ef..eb0fb60de2 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2,6 +2,7 @@ <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="" /> <meta name="description" content="Ascraeus coding guidelines document" /> <title>phpBB3 • Coding Guidelines</title> diff --git a/phpBB/docs/nginx.sample.conf b/phpBB/docs/nginx.sample.conf index 2ead3552fd..c415720e9c 100644 --- a/phpBB/docs/nginx.sample.conf +++ b/phpBB/docs/nginx.sample.conf @@ -62,7 +62,7 @@ http { root /path/to/phpbb; location / { - # phpbb uses index.htm + # phpBB uses index.htm index index.php index.html index.htm; try_files $uri $uri/ @rewriteapp; } @@ -92,6 +92,29 @@ http { fastcgi_pass php; } + # Correctly pass scripts for installer + location /install/ { + # phpBB uses index.htm + try_files $uri $uri/ @rewrite_installapp; + + # Pass the php scripts to fastcgi server specified in upstream declaration. + location ~ \.php(/|$) { + # Unmodified fastcgi_params from nginx distribution. + include fastcgi_params; + # Necessary for php. + fastcgi_split_path_info ^(.+\.php)(/.*)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + try_files $uri $uri/ /install/app.php$is_args$args; + fastcgi_pass php; + } + } + + location @rewrite_installapp { + rewrite ^(.*)$ /install/app.php/$1 last; + } + # Deny access to version control system directories. location ~ /\.svn|/\.git { deny all; diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 0ee6452ada..76b6275954 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2073,7 +2073,10 @@ class acp_users // Replace "error" strings with their real, localised form $error = array_map(array($user, 'lang'), $error); - $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield); + if ($request->is_set_post('preview')) + { + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield); + } /** @var \phpbb\controller\helper $controller_helper */ $controller_helper = $phpbb_container->get('controller.helper'); diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index f439279e78..e8969e552e 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -155,13 +155,13 @@ class bbcode $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), $phpbb_container, - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('ext.manager'), new \phpbb\template\twig\loader( $phpbb_filesystem ) ), - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index be51a7342d..10788d0d6a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -96,7 +96,7 @@ function gen_rand_string_friendly($num_chars = 8) */ function unique_id() { - return bin2hex(random_bytes(6)); + return bin2hex(random_bytes(8)); } /** @@ -1813,6 +1813,7 @@ function redirect($url, $return = false, $disable_cd_check = false) echo '<html dir="' . $user->lang['DIRECTION'] . '" lang="' . $user->lang['USER_LANG'] . '">'; echo '<head>'; echo '<meta charset="utf-8">'; + echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">'; echo '<meta http-equiv="refresh" content="0; url=' . str_replace('&', '&', $url) . '" />'; echo '<title>' . $user->lang['REDIRECT'] . '</title>'; echo '</head>'; @@ -2745,7 +2746,8 @@ function get_preg_expression($mode) return array( '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#', - '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">(.*?)</a><!\-\- \1 \-\->#', + '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="http://(.*?)">\2</a><!\-\- \1 \-\->#', + '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#', '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '#<!\-\- .*? \-\->#s', '#<.*?>#s', @@ -3322,6 +3324,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) echo '<html dir="ltr">'; echo '<head>'; echo '<meta charset="utf-8">'; + echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">'; echo '<title>' . $msg_title . '</title>'; echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n"; echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } '; diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 39a3f0352f..fd7fc478bd 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -469,7 +469,7 @@ function decode_message(&$message, $bbcode_uid = '') $message = str_replace($match, $replace, $message); $match = get_preg_expression('bbcode_htm'); - $replace = array('\1', '\1', '\3', '\1', '', ''); + $replace = array('\1', '\1', '\2', '\2', '\1', '', ''); $message = preg_replace($match, $replace, $message); } @@ -1091,17 +1091,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a unset($new_attachment_data); } - // Sort correctly - if ($config['display_order']) - { - // Ascending sort - krsort($attachments); - } - else - { - // Descending sort - ksort($attachments); - } + // Make sure attachments are properly ordered + ksort($attachments); foreach ($attachments as $attachment) { @@ -1309,8 +1300,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a $attachments = $compiled_attachments; unset($compiled_attachments); - $tpl_size = sizeof($attachments); - $unset_tpl = array(); preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $message, $matches, PREG_PATTERN_ORDER); @@ -1318,8 +1307,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a $replace = array(); foreach ($matches[0] as $num => $capture) { - // Flip index if we are displaying the reverse way - $index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num]; + $index = $matches[1][$num]; $replace['from'][] = $matches[0][$num]; $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); @@ -1334,6 +1322,18 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a $unset_tpl = array_unique($unset_tpl); + // Sort correctly + if ($config['display_order']) + { + // Ascending sort + krsort($attachments); + } + else + { + // Descending sort + ksort($attachments); + } + // Needed to let not display the inlined attachments at the end of the post again foreach ($unset_tpl as $index) { diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 916655e77c..b295d4cd1e 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -108,6 +108,7 @@ function wrap_img_in_html($src, $title) echo '<html>'; echo '<head>'; echo '<meta charset="utf-8">'; + echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">'; echo '<title>' . $title . '</title>'; echo '</head>'; echo '<body>'; @@ -412,7 +413,7 @@ function set_modified_headers($stamp, $browser) global $request; // let's see if we have to send the file at all - $last_load = $request->header('Modified-Since') ? strtotime(trim($request->header('Modified-Since'))) : false; + $last_load = $request->header('If-Modified-Since') ? strtotime(trim($request->header('If-Modified-Since'))) : false; if (strpos(strtolower($browser), 'msie 6.0') === false && !phpbb_is_greater_ie_version($browser, 7)) { diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index e8d4e0d7f1..f55b5e7ec3 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -640,13 +640,13 @@ class messenger $phpbb_container->get('filesystem'), $phpbb_container->get('path_helper'), $phpbb_container, - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('ext.manager'), new \phpbb\template\twig\loader( $phpbb_filesystem ) ), - $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->getParameter('core.cache_dir'), $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 0b66aae030..0e80372f43 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -530,12 +530,28 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); - $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.$phpEx")) ? $user_row['user_lang'] : $config['default_lang']; - include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.$phpEx"); + // Attempt to translate warning to language of user being warned if user's language differs from issuer's language + if ($user_row['user_lang'] != $user->lang_name) + { + $lang = array(); + + $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx)) ? $user_row['user_lang'] : $config['default_lang']; + include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx); + + $warn_pm_subject = $lang['WARNING_PM_SUBJECT']; + $warn_pm_body = sprintf($lang['WARNING_PM_BODY'], $warning); + + unset($lang); + } + else + { + $warn_pm_subject = $user->lang('WARNING_PM_SUBJECT'); + $warn_pm_body = $user->lang('WARNING_PM_BODY', $warning); + } $message_parser = new parse_message(); - $message_parser->message = $user->lang('WARNING_PM_BODY', $warning); + $message_parser->message = $warn_pm_body; $message_parser->parse(true, true, true, false, false, true, true); $pm_data = array( @@ -553,7 +569,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) 'address_list' => array('u' => array($user_row['user_id'] => 'to')), ); - submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false); + submit_pm('post', $warn_pm_subject, $pm_data, false); } $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array($user_row['username'])); diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index e707c251fe..1132271689 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -157,7 +157,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'S_SHOW_PM_BOX' => true, 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=" . (int) $select_single), )); } diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 4ac8e0f17d..5c0b792f6f 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -544,7 +544,10 @@ class ucp_profile // Replace "error" strings with their real, localised form $error = array_map(array($user, 'lang'), $error); - $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield); + if ($request->is_set_post('preview')) + { + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags); + } /** @var \phpbb\controller\helper $controller_helper */ $controller_helper = $phpbb_container->get('controller.helper'); diff --git a/phpBB/install/convert/convertor.php b/phpBB/install/convert/convertor.php index 2dae356c26..769f8bb637 100644 --- a/phpBB/install/convert/convertor.php +++ b/phpBB/install/convert/convertor.php @@ -1044,7 +1044,7 @@ class convertor OR config_name = 'convert_db_user'"); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - @unlink($phpbb_root_path . 'cache/data_global.' . $phpEx); + @unlink($phpbb_container->getParameter('core.cache_dir') . 'data_global.' . $phpEx); phpbb_cache_moderators($db, $cache, $auth); // And finally, add a note to the log diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 414d23623a..d0885dc620 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -38,7 +38,7 @@ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.2.0-b1', + 'phpbb_version' => '3.3.0-a1-dev', 'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/install/phpbbcli.php b/phpBB/install/phpbbcli.php index 6b0ac39f84..4b86f64e2a 100755 --- a/phpBB/install/phpbbcli.php +++ b/phpBB/install/phpbbcli.php @@ -23,7 +23,7 @@ if (php_sapi_name() !== 'cli') define('IN_PHPBB', true); define('IN_INSTALL', true); define('PHPBB_ENVIRONMENT', 'production'); -define('PHPBB_VERSION', '3.2.0-b2-dev'); +define('PHPBB_VERSION', '3.3.0-a1-dev'); $phpbb_root_path = __DIR__ . '/../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 4a70aafc6f..3d1ab7f873 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -606,6 +606,7 @@ $lang = array_merge($lang, array( 'LOG_ERROR_JABBER' => '<strong>Jabber error</strong><br />» %s', 'LOG_ERROR_EMAIL' => '<strong>Email error</strong><br />» %s', + 'LOG_ERROR_CAPTCHA' => '<strong>CAPTCHA error</strong><br />» %s', 'LOG_FORUM_ADD' => '<strong>Created new forum</strong><br />» %s', 'LOG_FORUM_COPIED_PERMISSIONS' => '<strong>Copied forum permissions</strong> from %1$s<br />» %2$s', diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index f764a83f24..28011eb636 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -40,6 +40,7 @@ $lang = array_merge($lang, array( 'CAPTCHA_QA' => 'Q&A', 'CONFIRM_QUESTION_EXPLAIN' => 'This question is a means of preventing automated form submissions by spambots.', 'CONFIRM_QUESTION_WRONG' => 'You have provided an invalid answer to the question.', + 'CONFIRM_QUESTION_MISSING' => 'Questions for the captcha could not be retrieved. Please contact a board administrator.', 'QUESTION_ANSWERS' => 'Answers', 'ANSWERS_EXPLAIN' => 'Please enter valid answers to the question, one per line.', @@ -60,5 +61,4 @@ $lang = array_merge($lang, array( 'QA_ERROR_MSG' => 'Please fill in all fields and enter at least one answer.', 'QA_LAST_QUESTION' => 'You cannot delete all questions while the plugin is active.', - )); diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 1c549e5f9f..6cb516ebfd 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -82,6 +82,12 @@ $lang = array_merge($lang, array( 'CLI_DESCRIPTION_THUMBNAIL_GENERATE' => 'Generate all missing thumbnails.', 'CLI_DESCRIPTION_THUMBNAIL_RECREATE' => 'Recreate all thumbnails.', + 'CLI_DESCRIPTION_USER_ADD' => 'Add a new user.', + 'CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME' => 'Username of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD' => 'Password of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL' => 'E-mail address of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY' => 'Send account activation email to the new user (not sent by default)', + 'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s', 'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s', 'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s', @@ -118,9 +124,14 @@ $lang = array_merge($lang, array( 'CLI_THUMBNAIL_NOTHING_TO_GENERATE' => 'No thumbnails to generate.', 'CLI_THUMBNAIL_NOTHING_TO_DELETE' => 'No thumbnails to delete.', + + 'CLI_USER_ADD_SUCCESS' => 'Successfully added user %s.', )); // Additional help for commands. $lang = array_merge($lang, array( 'CLI_HELP_CRON_RUN' => $lang['CLI_DESCRIPTION_CRON_RUN'] . ' Optionally you can specify a cron task name to run only the specified cron task.', + 'CLI_HELP_USER_ADD' => 'The <info>%command.name%</info> command adds a new user: +If this command is run without options, you will be prompted to enter them. +To optionally send an email to the new user, use the <info>--send-email</info> option.', )); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a473e0d091..f501dc074d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -677,7 +677,7 @@ $lang = array_merge($lang, array( 'SEARCH_POSTS_BY' => 'Search posts by', 'SEARCH_SELF' => 'Your posts', 'SEARCH_TOPIC' => 'Search this topic…', - 'SEARCH_UNANSWERED' => 'Unanswered posts', + 'SEARCH_UNANSWERED' => 'Unanswered topics', 'SEARCH_UNREAD' => 'Unread posts', 'SEARCH_USER_POSTS' => 'Search user’s posts', 'SECONDS' => 'Seconds', @@ -822,7 +822,7 @@ $lang = array_merge($lang, array( 'USERS' => 'Users', 'USE_PERMISSIONS' => 'Test out user’s permissions', - 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more to be able to use this feature.', + 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more in discussions to be able to use this feature.', 'VARIANT_DATE_SEPARATOR' => ' / ', // Used in date format dropdown, eg: "Today, 13:37 / 01 Jan 2007, 13:37" ... to join a relative date with calendar date 'VIEWED' => 'Viewed', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index ba35aa24c9..39d53ece7b 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -523,7 +523,7 @@ $lang = array_merge($lang, array( // Finish conversion 'CONVERT_COMPLETE' => 'Conversion completed', - 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.2. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="https://www.phpbb.com/support/docs/en/3.2/ug/">Documentation</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=466">support forums</a>.', + 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.3. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="https://www.phpbb.com/support/docs/en/3.3/ug/">Documentation</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=466">support forums</a>.', 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 759a899de1..146ded0929 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1279,7 +1279,8 @@ switch ($mode) } $param = call_user_func_array(array($request, 'variable'), $call); - $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param); + // Encode strings, convert everything else to int in order to prevent empty parameters. + $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : (int) $param); $params[] = $param; if ($key != 'first_char') diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index a0c23cb624..2640e1ad1e 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -179,17 +179,29 @@ class upload extends \phpbb\avatar\driver\driver $destination = ''; } + $filedata = array( + 'filename' => $file->get('filename'), + 'filesize' => $file->get('filesize'), + 'mimetype' => $file->get('mimetype'), + 'extension' => $file->get('extension'), + 'physical_filename' => $file->get('realname'), + 'real_filename' => $file->get('uploadname'), + ); + /** * Before moving new file in place (and eventually overwriting the existing avatar with the newly uploaded avatar) * * @event core.avatar_driver_upload_move_file_before + * @var array filedata Array containing uploaded file data * @var string destination Destination directory where the file is going to be moved * @var string prefix Prefix for the avatar filename * @var array row Array with avatar row data * @var array error Array of errors, if filled in by this event file will not be moved * @since 3.1.6-RC1 + * @changed 3.1.9-RC1 Added filedata */ $vars = array( + 'filedata', 'destination', 'prefix', 'row', @@ -197,6 +209,8 @@ class upload extends \phpbb\avatar\driver\driver ); extract($this->dispatcher->trigger_event('core.avatar_driver_upload_move_file_before', compact($vars))); + unset($filedata); + if (!sizeof($error)) { // Move file and overwrite any existing image diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index d994394249..a210d877f0 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -32,9 +32,9 @@ class file extends \phpbb\cache\driver\base */ function __construct($cache_dir = null) { - global $phpbb_root_path, $phpbb_container; + global $phpbb_container; - $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/'; + $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir'); $this->filesystem = new \phpbb\filesystem\filesystem(); if (!is_dir($this->cache_dir)) diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index baae22d809..cc03804705 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -25,9 +25,9 @@ abstract class memory extends \phpbb\cache\driver\base */ function __construct() { - global $phpbb_root_path, $dbname, $table_prefix; + global $phpbb_root_path, $dbname, $table_prefix, $phpbb_container; - $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->cache_dir = $phpbb_container->getParameter('core.cache_dir'); $this->key_prefix = substr(md5($dbname . $table_prefix), 0, 8) . '_'; if (!isset($this->extension) || !extension_loaded($this->extension)) diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 4df8a86432..7f804850a4 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -100,6 +100,28 @@ class qa $db->sql_freeresult($result); } + // final fallback to any language + if (!sizeof($this->question_ids)) + { + $this->question_lang = ''; + + $sql = 'SELECT q.question_id, q.lang_iso + FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a + WHERE q.question_id = a.question_id + GROUP BY lang_iso'; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($this->question_lang)) + { + $this->question_lang = $row['lang_iso']; + } + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) { @@ -198,10 +220,12 @@ class qa */ function get_template() { - global $template; + global $phpbb_log, $template, $user; - if ($this->is_solved()) + if ($this->is_solved() || empty($this->question_text) || !count($this->question_ids)) { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); return false; } else @@ -363,13 +387,15 @@ class qa */ function validate() { - global $user; + global $phpbb_log, $user; $error = ''; if (!sizeof($this->question_ids)) { - return false; + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return $user->lang('CONFIRM_QUESTION_MISSING'); } if (!$this->confirm_id) diff --git a/phpBB/phpbb/composer.json b/phpBB/phpbb/composer.json index 758125234f..0b6299d6bc 100644 --- a/phpBB/phpbb/composer.json +++ b/phpBB/phpbb/composer.json @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "3.3.x-dev" } } } diff --git a/phpBB/phpbb/console/command/user/add.php b/phpBB/phpbb/console/command/user/add.php new file mode 100644 index 0000000000..df1f4aa54a --- /dev/null +++ b/phpBB/phpbb/console/command/user/add.php @@ -0,0 +1,328 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\console\command\user; + +use phpbb\exception\runtime_exception; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; + +class add extends \phpbb\console\command\command +{ + /** @var array Array of interactively acquired options */ + protected $data; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\passwords\manager */ + protected $password_manager; + + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP extension. + * + * @var string + */ + protected $php_ext; + + /** + * Construct method + * + * @param \phpbb\user $user + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\config\config $config + * @param \phpbb\language\language $language + * @param \phpbb\passwords\manager $password_manager + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\language\language $language, \phpbb\passwords\manager $password_manager, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->config = $config; + $this->language = $language; + $this->password_manager = $password_manager; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->language->add_lang('ucp'); + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('user:add') + ->setDescription($this->language->lang('CLI_DESCRIPTION_USER_ADD')) + ->setHelp($this->language->lang('CLI_HELP_USER_ADD')) + ->addOption( + 'username', + 'U', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME') + ) + ->addOption( + 'password', + 'P', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD') + ) + ->addOption( + 'email', + 'E', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL') + ) + ->addOption( + 'send-email', + null, + InputOption::VALUE_NONE, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY') + ) + ; + } + + /** + * Executes the command user:add + * + * Adds a new user to the database. If options are not provided, it will ask for the username, password and email. + * User is added to the registered user group. Language and timezone default to $config settings. + * + * @param InputInterface $input The input stream used to get the options + * @param OutputInterface $output The output stream, used to print messages + * + * @return int 0 if all is well, 1 if any errors occurred + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + try + { + $this->validate_user_data(); + $group_id = $this->get_group_id(); + } + catch (runtime_exception $e) + { + $io->error($e->getMessage()); + return 1; + } + + $user_row = array( + 'username' => $this->data['username'], + 'user_password' => $this->password_manager->hash($this->data['new_password']), + 'user_email' => $this->data['email'], + 'group_id' => $group_id, + 'user_timezone' => $this->config['board_timezone'], + 'user_lang' => $this->config['default_lang'], + 'user_type' => USER_NORMAL, + 'user_regdate' => time(), + ); + + $user_id = (int) user_add($user_row); + + if (!$user_id) + { + $io->error($this->language->lang('AUTH_NO_PROFILE_CREATED')); + return 1; + } + + if ($input->getOption('send-email') && $this->config['email_enable']) + { + $this->send_activation_email($user_id); + } + + $io->success($this->language->lang('CLI_USER_ADD_SUCCESS', $this->data['username'])); + + return 0; + } + + /** + * Interacts with the user. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $helper = $this->getHelper('question'); + + $this->data = array( + 'username' => $input->getOption('username'), + 'new_password' => $input->getOption('password'), + 'email' => $input->getOption('email'), + ); + + if (!$this->data['username']) + { + $question = new Question($this->ask_user('USERNAME')); + $this->data['username'] = $helper->ask($input, $output, $question); + } + + if (!$this->data['new_password']) + { + $question = new Question($this->ask_user('PASSWORD')); + $question->setValidator(function ($value) use ($helper, $input, $output) { + $question = new Question($this->ask_user('CONFIRM_PASSWORD')); + $question->setHidden(true); + if ($helper->ask($input, $output, $question) != $value) + { + throw new runtime_exception($this->language->lang('NEW_PASSWORD_ERROR')); + } + return $value; + }); + $question->setHidden(true); + $question->setMaxAttempts(5); + + $this->data['new_password'] = $helper->ask($input, $output, $question); + } + + if (!$this->data['email']) + { + $question = new Question($this->ask_user('EMAIL_ADDRESS')); + $this->data['email'] = $helper->ask($input, $output, $question); + } + } + + /** + * Validate the submitted user data + * + * @throws runtime_exception if any data fails validation + * @return null + */ + protected function validate_user_data() + { + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $error = validate_data($this->data, array( + 'username' => array( + array('string', false, $this->config['min_name_chars'], $this->config['max_name_chars']), + array('username', '')), + 'new_password' => array( + array('string', false, $this->config['min_pass_chars'], $this->config['max_pass_chars']), + array('password')), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + )); + + if ($error) + { + throw new runtime_exception(implode("\n", array_map(array($this->language, 'lang'), $error))); + } + } + + /** + * Get the group id + * + * Go and find in the database the group_id corresponding to 'REGISTERED' + * + * @throws runtime_exception if the group id does not exist in database. + * @return null + */ + protected function get_group_id() + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row || !$row['group_id']) + { + throw new runtime_exception($this->language->lang('NO_GROUP')); + } + + return $row['group_id']; + } + + /** + * Send account activation email + * + * @param int $user_id The new user's id + * @return null + */ + protected function send_activation_email($user_id) + { + switch ($this->config['require_activation']) + { + case USER_ACTIVATION_SELF: + $email_template = 'user_welcome_inactive'; + $user_actkey = gen_rand_string(mt_rand(6, 10)); + break; + case USER_ACTIVATION_ADMIN: + $email_template = 'admin_welcome_inactive'; + $user_actkey = gen_rand_string(mt_rand(6, 10)); + break; + default: + $email_template = 'user_welcome'; + $user_actkey = ''; + break; + } + + if (!class_exists('messenger')) + { + require($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); + } + + $messenger = new \messenger(false); + $messenger->template($email_template, $this->user->lang_name); + $messenger->to($this->data['email'], $this->data['username']); + $messenger->anti_abuse_headers($this->config, $this->user); + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode($this->language->lang('WELCOME_SUBJECT', $this->config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($this->data['username']), + 'PASSWORD' => htmlspecialchars_decode($this->data['new_password']), + 'U_ACTIVATE' => generate_board_url() . "/ucp.{$this->php_ext}?mode=activate&u=$user_id&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + } + + /** + * Helper to translate questions to the user + * + * @param string $key The language key + * @return string The language key translated with a colon and space appended + */ + protected function ask_user($key) + { + return $this->language->lang($key) . $this->language->lang('COLON') . ' '; + } +} diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index a9345a44df..eca69a5041 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -20,20 +20,23 @@ class queue extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; + protected $cache_dir; protected $config; /** - * Constructor. - * - * @param string $phpbb_root_path The root path - * @param string $php_ext PHP file extension - * @param \phpbb\config\config $config The config - */ - public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext PHP file extension + * @param \phpbb\config\config $config The config + * @param string $cache_dir phpBB cache directory + */ + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, $cache_dir) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->config = $config; + $this->cache_dir = $cache_dir; } /** @@ -60,7 +63,7 @@ class queue extends \phpbb\cron\task\base */ public function is_runnable() { - return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext); + return file_exists($this->cache_dir . 'queue.' . $this->php_ext); } /** diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 30cb667344..214c5590e7 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -1041,6 +1041,7 @@ abstract class driver implements driver_interface <html dir="ltr"> <head> <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>SQL Report</title> <link href="' . htmlspecialchars($phpbb_path_helper->update_web_root_path($phpbb_root_path) . $phpbb_path_helper->get_adm_relative_path()) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" /> </head> diff --git a/phpBB/phpbb/db/migration/data/v320/notifications_board.php b/phpBB/phpbb/db/migration/data/v320/notifications_board.php index 8a76ebab58..ac1b3a0f2c 100644 --- a/phpBB/phpbb/db/migration/data/v320/notifications_board.php +++ b/phpBB/phpbb/db/migration/data/v320/notifications_board.php @@ -34,7 +34,7 @@ class notifications_board extends \phpbb\db\migration\migration public function update_module() { $sql = 'UPDATE ' . MODULES_TABLE . " - SET auth = 'cfg_allow_board_notifications' + SET module_auth = 'cfg_allow_board_notifications' WHERE module_basename = 'ucp_notifications' AND module_mode = 'notification_list'"; $this->sql_query($sql); diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 2fb248082f..7bfe1bbb87 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -522,6 +522,7 @@ class container_builder 'core.php_ext' => $this->php_ext, 'core.environment' => $this->get_environment(), 'core.debug' => defined('DEBUG') ? DEBUG : false, + 'core.cache_dir' => $this->get_cache_dir(), ), $this->get_env_parameters() ); diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php index 5d237b6433..f19886fb0b 100644 --- a/phpBB/phpbb/routing/router.php +++ b/phpBB/phpbb/routing/router.php @@ -49,13 +49,6 @@ class router implements RouterInterface protected $loader; /** - * phpBB root path - * - * @var string - */ - protected $phpbb_root_path; - - /** * PHP file extensions * * @var string @@ -63,13 +56,6 @@ class router implements RouterInterface protected $php_ext; /** - * Name of the current environment - * - * @var string - */ - protected $environment; - - /** * @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|null */ protected $matcher; @@ -90,24 +76,27 @@ class router implements RouterInterface protected $route_collection; /** + * @var string + */ + protected $cache_dir; + + /** * Construct method * * @param ContainerInterface $container DI container * @param resources_locator_interface $resources_locator Resources locator * @param LoaderInterface $loader Resources loader - * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP file extension - * @param string $environment Name of the current environment + * @param string $cache_dir phpBB cache directory */ - public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $phpbb_root_path, $php_ext, $environment) + public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir) { $this->container = $container; $this->resources_locator = $resources_locator; $this->loader = $loader; - $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->environment = $environment; $this->context = new RequestContext(); + $this->cache_dir = $cache_dir; } /** @@ -211,7 +200,7 @@ class router implements RouterInterface { try { - $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG')); + $cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", defined('DEBUG')); if (!$cache->isFresh()) { $dumper = new PhpMatcherDumper($this->get_routes()); @@ -266,7 +255,7 @@ class router implements RouterInterface { try { - $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG')); + $cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", defined('DEBUG')); if (!$cache->isFresh()) { $dumper = new PhpGeneratorDumper($this->get_routes()); diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php index 3e5ee248a1..afa5ccacad 100644 --- a/phpBB/phpbb/textreparser/base.php +++ b/phpBB/phpbb/textreparser/base.php @@ -230,7 +230,8 @@ abstract class base implements reparser_interface $unparsed['enable_img_bbcode'], $unparsed['enable_flash_bbcode'], $unparsed['enable_quote_bbcode'], - $unparsed['enable_url_bbcode'] + $unparsed['enable_url_bbcode'], + 'reparse' ); // Save the new text if it has changed and it's not a dry run diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 5262e10e87..305510851c 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -595,7 +595,7 @@ class user extends \phpbb\session $utc = new \DateTimeZone('UTC'); } - $time = new $this->datetime($this, "@$gmepoch", $utc); + $time = new $this->datetime($this, '@' . (int) $gmepoch, $utc); $time->setTimezone($this->timezone); return $time->format($format, $forcedate); diff --git a/phpBB/posting.php b/phpBB/posting.php index 692f3c8092..9bd4acf99b 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -602,7 +602,7 @@ if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode WHERE post_msg_id = $post_id AND in_message = 0 AND is_orphan = 0 - ORDER BY filetime DESC"; + ORDER BY attach_id DESC"; $result = $db->sql_query($sql); $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index ec7d8d2e27..e0b87f2398 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = prosilver copyright = © phpBB Limited, 2007 -style_version = 3.2.0-b1 -phpbb_version = 3.2.0-b1 +style_version = 3.3.0-dev +phpbb_version = 3.3.0-dev # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 823d5e1c12..8a3eb65cd4 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8" /> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1" /> {META} <title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 954eebd011..0e889b476d 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8" /> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1" /> {META} <title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index 70beec8256..9377eeb9f5 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8" /> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="robots" content="noindex" /> {META} <title>{SITENAME} • {PAGE_TITLE}</title> diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 796111dd3c..3c1ed4c3f1 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8" /> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="robots" content="noindex" /> {META} <title>{SITENAME} • {PAGE_TITLE}</title> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index c9a081cc0e..7db5b8759c 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -277,14 +277,42 @@ if ($sort_days) { $min_post_time = time() - ($sort_days * 86400); - $sql = 'SELECT COUNT(topic_id) AS num_topics - FROM ' . TOPICS_TABLE . " - WHERE forum_id = $forum_id - AND (topic_last_post_time >= $min_post_time - OR topic_type = " . POST_ANNOUNCE . ' - OR topic_type = ' . POST_GLOBAL . ') - AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id); - $result = $db->sql_query($sql); + $sql_array = array( + 'SELECT' => 'COUNT(t.topic_id) AS num_topics', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => 't.forum_id = ' . $forum_id . ' + AND (t.topic_last_post_time >= ' . $min_post_time . ' + OR t.topic_type = ' . POST_ANNOUNCE . ' + OR t.topic_type = ' . POST_GLOBAL . ') + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'), + ); + + /** + * Modify the sort data SQL query for getting additional fields if needed + * + * @event core.viewforum_modify_sort_data_sql + * @var int forum_id The forum_id whose topics are being listed + * @var int start Variable containing start for pagination + * @var int sort_days The oldest topic displayable in elapsed days + * @var string sort_key The sorting by. It is one of the first character of (in low case): + * Author, Post time, Replies, Subject, Views + * @var string sort_dir Either "a" for ascending or "d" for descending + * @var array sql_array The SQL array to get the data of all topics + * @since 3.1.9-RC1 + */ + $vars = array( + 'forum_id', + 'start', + 'sort_days', + 'sort_key', + 'sort_dir', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_data_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_array)); $topics_count = (int) $db->sql_fetchfield('num_topics'); $db->sql_freeresult($result); @@ -399,15 +427,16 @@ $sql_array = array( * @event core.viewforum_get_topic_data * @var array forum_data Array with forum data * @var array sql_array The SQL array to get the data of all topics -* @var array forum_id The forum_id whose topics are being listed -* @var array topics_count The total number of topics for display -* @var array sort_days The oldest topic displayable in elapsed days -* @var array sort_key The sorting by. It is one of the first character of (in low case): +* @var int forum_id The forum_id whose topics are being listed +* @var int topics_count The total number of topics for display +* @var int sort_days The oldest topic displayable in elapsed days +* @var string sort_key The sorting by. It is one of the first character of (in low case): * Author, Post time, Replies, Subject, Views -* @var array sort_dir Either "a" for ascending or "d" for descending +* @var string sort_dir Either "a" for ascending or "d" for descending * @since 3.1.0-a1 * @change 3.1.0-RC4 Added forum_data var * @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars +* @change 3.1.9-RC1 Fix types of properties */ $vars = array( 'forum_data', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 87de7c79a4..ded0f9aacc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -590,6 +590,33 @@ $quickmod_array = array( 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), ); +/** +* Event to modify data in the quickmod_array before it gets sent to the +* phpbb_add_quickmod_option function. +* +* @event core.viewtopic_add_quickmod_option_before +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var string viewtopic_url URL to the topic page +* @var bool allow_change_type Topic change permissions check +* @since 3.1.9-RC1 +*/ +$vars = array( + 'forum_id', + 'post_id', + 'quickmod_array', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'viewtopic_url', + 'allow_change_type', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_before', compact($vars))); + foreach ($quickmod_array as $option => $qm_ary) { if (!empty($qm_ary[1])) @@ -1455,7 +1482,7 @@ if (sizeof($attach_list)) FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' AND in_message = 0 - ORDER BY filetime DESC, post_msg_id ASC'; + ORDER BY attach_id DESC, post_msg_id ASC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -1597,6 +1624,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $parse_flags = ($user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true); + $user_cache[$poster_id]['sig_parsed'] = true; } // Parse the message and subject |