diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_container.php | 41 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 13 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_pm_reports.php | 12 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_reports.php | 2 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_warn.php | 15 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewmessage.php | 30 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 3 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_remind.php | 2 |
15 files changed, 70 insertions, 112 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 49f2e469bc..3db843ffd1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5390,8 +5390,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_UPLOAD' => $config['upload_path'], 'SITE_LOGO_IMG' => $user->img('site_logo'), - - 'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')), )); // application/xhtml+xml not used because of IE diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index f63dde0614..7cbfa17a0e 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -118,7 +118,10 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) */ function phpbb_create_install_container($phpbb_root_path, $php_ext) { - $core = new phpbb_di_extension_core($phpbb_root_path); + $other_config_path = $phpbb_root_path . 'install/update/new/config/'; + $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; + + $core = new phpbb_di_extension_core($config_path); $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); $container->setParameter('core.root_path', $phpbb_root_path); @@ -136,6 +139,32 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) } /** +* Create updater container +* +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @param array $config_path Path to config directory +* @return ContainerBuilder object (compiled) +*/ +function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) +{ + $config_file = $phpbb_root_path . 'config.' . $php_ext; + return phpbb_create_compiled_container( + $config_file, + array( + new phpbb_di_extension_config($config_file), + new phpbb_di_extension_core($config_path), + ), + array( + new phpbb_di_pass_collection_pass(), + new phpbb_di_pass_kernel_pass(), + ), + $phpbb_root_path, + $php_ext + ); +} + +/** * Create a compiled ContainerBuilder object * * @param array $extensions Array of Container extension objects @@ -146,11 +175,6 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) */ function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) { - $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); - - // Now pass the enabled extension paths into the ext compiler extension - $extensions[] = new phpbb_di_extension_ext($installed_exts); - // Create the final container to be compiled and cached $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); @@ -231,11 +255,14 @@ function phpbb_create_dumped_container_unless_debug($config_file, array $extensi function phpbb_create_default_container($phpbb_root_path, $php_ext) { $config_file = $phpbb_root_path . 'config.' . $php_ext; + $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); + return phpbb_create_dumped_container_unless_debug( $config_file, array( new phpbb_di_extension_config($config_file), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), + new phpbb_di_extension_ext($installed_exts), ), array( new phpbb_di_pass_collection_pass(), diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c54cc25f34..05d3c5fde2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -413,7 +413,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text static $bbcode; global $phpbb_dispatcher; - if (!$text) + if ($text === '') { return ''; } @@ -505,7 +505,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb $uid = $bitfield = ''; $flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0); - if (!$text) + if ($text === '') { return; } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 103cc81205..6e62c0c6e4 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1095,25 +1095,20 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $poster_id = $row['user_id']; $post_subject = $row['post_subject']; - $message = censor_text($row['post_text']); $decoded_message = false; if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) { - $decoded_message = $message; + $decoded_message = censor_text($row['post_text']); decode_message($decoded_message, $row['bbcode_uid']); $decoded_message = bbcode_nl2br($decoded_message); } - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message, !$row['enable_smilies']); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); + $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true); if (!empty($attachments[$row['post_id']])) { diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 14278a2529..5fc6de8e02 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2018,14 +2018,11 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = bbcode_nl2br($decoded_message); } - - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message, !$row['enable_smilies']); + + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); + + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); $subject = censor_text($subject); diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 99ff397a66..cb61b25174 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -115,17 +115,9 @@ class mcp_pm_reports } // Process message, leave it uncensored - $message = $pm_info['message_text']; + $parse_flags = ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], $parse_flags, false); - if ($pm_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($pm_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text'])); if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download')) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 734fa96a78..06f27655ae 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -125,17 +125,8 @@ function mcp_post_details($id, $mode, $action) $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = $post_info['post_text']; - - if ($post_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($post_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 8a9390212f..1fa89af8e1 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -206,17 +206,8 @@ class mcp_queue $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = $post_info['post_text']; - - if ($post_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($post_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 72400ce623..3f48c58073 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -187,7 +187,7 @@ class mcp_reports 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == POST_UNAPPROVED), + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED), 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index d0e4a2e057..9c294b96c8 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -207,13 +207,8 @@ function mcp_topic_view($id, $mode, $action) $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); if (!empty($attachments[$row['post_id']])) { @@ -674,10 +669,10 @@ function merge_posts($topic_id, $to_topic_id) } // If the topic no longer exist, we will update the topic watch table. - phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id); + phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', array($topic_id), $to_topic_id); // If the topic no longer exist, we will update the bookmarks table. - phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id); + phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id); } // Link to the new topic diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 4ef477775d..bb21d3d377 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -289,19 +289,8 @@ class mcp_warn // We want to make the message available here as a reminder // Parse the message and subject - $message = censor_text($user_row['post_text']); - - // Second parse bbcode here - if ($user_row['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - - $bbcode = new bbcode($user_row['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = OPTION_FLAG_SMILIES | ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index b7d2dd6821..c7b4489daf 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -76,17 +76,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info = get_user_information($author_id, $message_row); // Parse the message and subject - $message = censor_text($message_row['message_text']); - - // Second parse bbcode here - if ($message_row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']); - } - - // Always process smilies after parsing bbcodes - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true); // Replace naughty words such as farty pants $message_row['message_subject'] = censor_text($message_row['message_subject']); @@ -160,21 +151,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // End signature parsing, only if needed if ($signature) { - $signature = censor_text($signature); - - if ($user_info['user_sig_bbcode_bitfield']) - { - if ($bbcode === false) - { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']); - } - - $bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']); - } - - $signature = bbcode_nl2br($signature); - $signature = smiley_text($signature); + $parse_flags = ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], $parse_flags, true); } $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 55df5f610c..e55569fdd5 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -546,6 +546,9 @@ class ucp_profile // Build custom bbcodes array display_custom_bbcodes(); + // Generate smiley listing + generate_smilies('inline', 0); + break; case 'avatar': diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 70fbfe46fb..7bc7ac8191 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -38,7 +38,7 @@ class ucp_register include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false; - $agreed = (int) $request->variable('agreed', false); + $agreed = $request->variable('agreed', false); $submit = $request->is_set_post('submit'); $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); @@ -63,7 +63,7 @@ class ucp_register $submit = false; // Setting back agreed to let the user view the agreement in his/her language - $agreed = ($request->variable('change_lang', false)) ? 0 : $agreed; + $agreed = false; } $user->lang_name = $user_lang = $use_lang; @@ -89,7 +89,7 @@ class ucp_register $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; $s_hidden_fields = array( - 'change_lang' => $change_lang, + 'change_lang' => '', ); // If we change the language, we want to pass on some more possible parameter. diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index ff7ab53736..bdbf693ddd 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -101,6 +101,8 @@ class ucp_remind $messenger->set_addresses($user_row); + $messenger->anti_abuse_headers($config, $user); + $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), |