diff options
-rw-r--r-- | phpBB/docs/events.md | 12 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 49 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 23 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 16 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 10 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 3 | ||||
-rw-r--r-- | phpBB/language/en/acp/board.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/captcha/plugins/qa.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/event/md_exporter.php | 13 | ||||
-rw-r--r-- | phpBB/posting.php | 33 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/posting_attach_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/plupload.css | 4 |
13 files changed, 140 insertions, 43 deletions
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index c77691a048..39888bf671 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -1740,14 +1740,14 @@ posting_attach_body_file_list_after * Locations: + styles/prosilver/template/posting_attach_body.html * Since: 3.2.6-RC1 -* Purpose: Add content after attachments list +* Purpose: Add content after attachments list posting_attach_body_file_list_before === * Locations: + styles/prosilver/template/posting_attach_body.html * Since: 3.2.6-RC1 -* Purpose: Add content before attachments list +* Purpose: Add content before attachments list posting_editor_add_panel_tab === @@ -2130,14 +2130,14 @@ search_results_header_before search_results_last_post_author_username_append === * Locations: - + styles/prosilver/template/search_results.html + + styles/prosilver/template/search_results.html (2) * Since: 3.2.4-RC1 * Purpose: Append information to last post author username of member search_results_last_post_author_username_prepend === * Locations: - + styles/prosilver/template/search_results.html + + styles/prosilver/template/search_results.html (2) * Since: 3.2.4-RC1 * Purpose: Prepend information to last post author username of member @@ -2654,14 +2654,14 @@ ucp_register_profile_fields_before viewforum_body_last_post_author_username_append === * Locations: - + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/viewforum_body.html (2) * Since: 3.2.4-RC1 * Purpose: Append information to last post author username of member viewforum_body_last_post_author_username_prepend === * Locations: - + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/viewforum_body.html (2) * Since: 3.2.4-RC1 * Purpose: Prepend information to last post author username of member diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5234c3472d..5cc6826cb9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1843,27 +1843,6 @@ function redirect($url, $return = false, $disable_cd_check = false) garbage_collection(); } - // Redirect via an HTML form for PITA webservers - if (@preg_match('#WebSTAR|Xitami#', getenv('SERVER_SOFTWARE'))) - { - header('Refresh: 0; URL=' . $url); - - echo '<!DOCTYPE html>'; - 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>'; - echo '<body>'; - echo '<div style="text-align: center;">' . sprintf($user->lang['URL_REDIRECT'], '<a href="' . str_replace('&', '&', $url) . '">', '</a>') . '</div>'; - echo '</body>'; - echo '</html>'; - - exit; - } - // Behave as per HTTP/1.1 spec for others header('Location: ' . $url); exit; @@ -2158,7 +2137,7 @@ function check_form_key($form_name, $timespan = false) function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') { global $user, $template, $db, $request; - global $config, $language, $phpbb_path_helper; + global $config, $language, $phpbb_path_helper, $phpbb_dispatcher; if (isset($_POST['cancel'])) { @@ -2255,8 +2234,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo if ($request->is_ajax()) { $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id; - $json_response = new \phpbb\json_response; - $json_response->send(array( + $data = array( 'MESSAGE_BODY' => $template->assign_display('body'), 'MESSAGE_TITLE' => $confirm_title, 'MESSAGE_TEXT' => $confirm_text, @@ -2264,7 +2242,28 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo 'YES_VALUE' => $language->lang('YES'), 'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields - )); + ); + + /** + * This event allows an extension to modify the ajax output of confirm box. + * + * @event core.confirm_box_ajax_before + * @var string u_action Action of the form + * @var array data Data to be sent + * @var string hidden Hidden fields generated by caller + * @var string s_hidden_fields Hidden fields generated by this function + * @since 3.2.8-RC1 + */ + $vars = array( + 'u_action', + 'data', + 'hidden', + 's_hidden_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.confirm_box_ajax_before', compact($vars))); + + $json_response = new \phpbb\json_response; + $json_response->send($data); } if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f44bcc6fb7..7f8238e1bf 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1581,6 +1581,14 @@ class smtp_class */ protected function starttls() { + global $config; + + // allow SMTPS (what was used by phpBB 3.0) if hostname is prefixed with tls:// or ssl:// + if (strpos($config['smtp_host'], 'tls://') === 0 || strpos($config['smtp_host'], 'ssl://') === 0) + { + return true; + } + if (!function_exists('stream_socket_enable_crypto')) { return false; @@ -1603,7 +1611,9 @@ class smtp_class if (socket_set_blocking($this->socket, 1)) { - $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + // https://secure.php.net/manual/en/function.stream-socket-enable-crypto.php#119122 + $crypto = (phpbb_version_compare(PHP_VERSION, '5.6.7', '<')) ? STREAM_CRYPTO_METHOD_TLS_CLIENT : STREAM_CRYPTO_METHOD_SSLv23_CLIENT; + $result = stream_socket_enable_crypto($this->socket, true, $crypto); socket_set_blocking($this->socket, (int) $stream_meta['blocked']); } diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index a7a4b050fe..baadf5bdee 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1966,7 +1966,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) */ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) { - global $db, $user, $template, $phpbb_root_path, $phpEx, $auth; + global $db, $user, $template, $phpbb_root_path, $phpEx, $auth, $phpbb_dispatcher; // Select all receipts and the author from the pm we currently view, to only display their pm-history $sql = 'SELECT author_id, user_id @@ -2087,7 +2087,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $previous_history_pm = $prev_id; } - $template->assign_block_vars('history_row', array( + $template_vars = array( 'MESSAGE_AUTHOR_QUOTE' => (($decoded_message) ? addslashes(get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username'])) : ''), 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), @@ -2109,8 +2109,25 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'USER_ID' => $row['user_id'], 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', - 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') + 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '' ); + + /** + * Modify the template vars for displaying the message history in private message + * + * @event core.message_history_modify_template_vars + * @var array template_vars Array containing the query + * @var array row Array containing the action user row + * @since 3.2.8-RC1 + */ + $vars = array( + 'template_vars', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.message_history_modify_template_vars', compact($vars))); + + $template->assign_block_vars('history_row', $template_vars); + unset($rowset[$i]); $prev_id = $id; } diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 4bd783b279..744eaebd7d 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -41,6 +41,22 @@ class mcp_main $quickmod = ($mode == 'quickmod') ? true : false; + /** + * Event to perform additional actions before an MCP action is executed. + * + * @event core.mcp_main_before + * @var string action The action that is about to be performed + * @var string mode The mode in which the MCP is accessed, e.g. front, forum_view, topic_view, post_details, quickmod + * @var boolean quickmod Whether or not the action is performed via QuickMod + * @since 3.2.8-RC1 + */ + $vars = [ + 'action', + 'mode', + 'quickmod', + ]; + extract($phpbb_dispatcher->trigger_event('core.mcp_main_before', compact($vars))); + switch ($action) { case 'lock': diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 543db4f889..cb45112b01 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -1007,6 +1007,16 @@ function compose_pm($id, $mode, $action, $user_folders = array()) if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh) { $message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject); + + /** + * This event allows you to modify the PM subject of the PM being quoted + * + * @event core.pm_modify_message_subject + * @var string message_subject String with the PM subject already censored. + * @since 3.2.8-RC1 + */ + $vars = array('message_subject'); + extract($phpbb_dispatcher->trigger_event('core.pm_modify_message_subject', compact($vars))); } if ($action == 'forward' && !$preview && !$refresh && !$submit) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 9a1284083f..36ab3d0463 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -133,7 +133,6 @@ class ucp_profile 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? $passwords_manager->hash($data['new_password']) : $user->data['user_password'], - 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0, ); if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) @@ -147,6 +146,8 @@ class ucp_profile if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !$passwords_manager->check($data['new_password'], $user->data['user_password'])) { + $sql_ary['user_passchg'] = time(); + $user->reset_login_keys(); $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( 'reportee_id' => $user->data['user_id'], diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 378dd3fc38..9b637ff9d3 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -587,8 +587,8 @@ $lang = array_merge($lang, array( 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', 'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.', - 'SMTP_SERVER' => 'SMTP server address and protocol', - 'SMTP_SERVER_EXPLAIN' => 'Note that you have to provide the protocol that your server uses. If you are using SSL, this has to be "ssl://your.mailserver.com"', + 'SMTP_SERVER' => 'SMTP server address', + 'SMTP_SERVER_EXPLAIN' => 'Do not provide a protocol (<samp>ssl://</samp> or <samp>tsl://</samp>) unless your mail host tells you to do so.', 'SMTP_SETTINGS' => 'SMTP settings', 'SMTP_USERNAME' => 'SMTP username', 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 70b3f72cc3..966b8d32f2 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -21,7 +21,7 @@ class qa { var $confirm_id; var $answer; - var $question_ids; + var $question_ids = []; var $question_text; var $question_lang; var $question_strict; diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index c3942bd7ce..1a2d7c989e 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -389,9 +389,16 @@ class md_exporter $files = explode("\n + ", $file_details); foreach ($files as $file) { + if (!preg_match('#^([^ ]+)( \([0-9]+\))?$#', $file)) + { + throw new \LogicException("Invalid event instances for file '{$file}' found for event '{$this->current_event}'", 1); + } + + list($file) = explode(" ", $file); + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') { - throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2); } if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0) @@ -404,7 +411,7 @@ class md_exporter } else { - throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2); + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 3); } $this->events_by_file[$file][] = $this->current_event; @@ -424,7 +431,7 @@ class md_exporter } else { - throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 2); + throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 1); } return $files_list; diff --git a/phpBB/posting.php b/phpBB/posting.php index 75085a5635..5089448483 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -222,6 +222,25 @@ if (!$post_data) trigger_error(($mode == 'post' || $mode == 'bump' || $mode == 'reply') ? 'NO_TOPIC' : 'NO_POST'); } +/** +* This event allows you to bypass reply/quote test of an unapproved post. +* +* @event core.posting_modify_row_data +* @var array post_data All post data from database +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @since 3.2.8-RC1 +*/ +$vars = array( + 'post_data', + 'mode', + 'topic_id', + 'forum_id', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_row_data', compact($vars))); + // Not able to reply to unapproved posts/topics // TODO: add more descriptive language key if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && $post_data['topic_visibility'] != ITEM_APPROVED) || ($mode == 'quote' && $post_data['post_visibility'] != ITEM_APPROVED))) @@ -1671,6 +1690,20 @@ if ($generate_quote) if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) { $post_data['post_subject'] = ((strpos($post_data['post_subject'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($post_data['post_subject']); + + $post_subject = $post_data['post_subject']; + + /** + * This event allows you to modify the post subject of the post being quoted + * + * @event core.posting_modify_post_subject + * @var string post_subject String with the post subject already censored. + * @since 3.2.8-RC1 + */ + $vars = array('post_subject'); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_post_subject', compact($vars))); + + $post_data['post_subject'] = $post_subject; } $attachment_data = $message_parser->attachment_data; diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index b46e9c9175..ff5bfe1b55 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -34,7 +34,7 @@ </tr> </thead> <tbody class="responsive-skip-empty file-list" id="file-list"> - <tr class="attach-row" id="attach-row-tpl"> + <tr class="attach-row attach-row-tpl" id="attach-row-tpl"> <td class="attach-name"> <span class="file-name ellipsis-text"></span> <span class="attach-controls"> diff --git a/phpBB/styles/prosilver/theme/plupload.css b/phpBB/styles/prosilver/theme/plupload.css index f466803964..b1f3ae2da8 100644 --- a/phpBB/styles/prosilver/theme/plupload.css +++ b/phpBB/styles/prosilver/theme/plupload.css @@ -3,6 +3,10 @@ margin-bottom: 1em; } +.attach-row-tpl { + display: none; +} + .file-list td { vertical-align: middle; } |