From 2845b153d8e86b80c6b9a8c0869474affb277516 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2013 22:52:33 +0200 Subject: [ticket/11769] Correctly supply the post author's username in posting.php Only supply the username, when it is a guest posting or we edit and it was supplied, otherwise post_data might hold data of the post we quote, in which case username is the original poster, not the current one. PHPBB3-11769 --- phpBB/includes/functions_posting.php | 5 ++++- phpBB/posting.php | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2e5130c5b8..aff7129fce 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2604,7 +2604,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Send Notifications if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval) { - $username = ($username) ? $username : $user->data['username']; + // If a username was supplied or the poster is a guest, we use the supplied username. + // This way we will use "...post by guest-username..." in notifications, + // when guest-username was supplied and ommit the username-part otherwise. + $username = ($username || !$user->data['is_registered']) ? $username : $user->data['username']; user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id'], $username); } diff --git a/phpBB/posting.php b/phpBB/posting.php index 42c4f7bc55..d690445fdb 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1131,8 +1131,13 @@ if ($submit || $preview || $refresh) $data['topic_replies'] = $post_data['topic_replies']; } + // Only supply the username, when it is a guest posting or we edit and it was supplied, + // otherwise post_data might hold data of the post we quote, in which case + // username is the original poster, not the current one. See: PHPBB3-11769 + $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username']) ? $post_data['username'] : ''; + // The last parameter tells submit_post if search indexer has to be run - $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); + $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { -- cgit v1.2.1 From d717203af1263e552886251fbee9b718be45f623 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2013 23:49:11 +0200 Subject: [ticket/11769] Fix language issues in the doc blocks PHPBB3-11769 --- phpBB/includes/functions_posting.php | 6 +++--- phpBB/posting.php | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index aff7129fce..32206df868 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2604,9 +2604,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Send Notifications if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval) { - // If a username was supplied or the poster is a guest, we use the supplied username. - // This way we will use "...post by guest-username..." in notifications, - // when guest-username was supplied and ommit the username-part otherwise. + // If a username was supplied or the poster is a guest, we will use the supplied username. + // Doing it this way we can use "...post by guest-username..." in notifications when + // "guest-username" is supplied or ommit the username if it is not. $username = ($username || !$user->data['is_registered']) ? $username : $user->data['username']; user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id'], $username); } diff --git a/phpBB/posting.php b/phpBB/posting.php index d690445fdb..7ab4773df2 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1131,9 +1131,10 @@ if ($submit || $preview || $refresh) $data['topic_replies'] = $post_data['topic_replies']; } - // Only supply the username, when it is a guest posting or we edit and it was supplied, - // otherwise post_data might hold data of the post we quote, in which case - // username is the original poster, not the current one. See: PHPBB3-11769 + // Only return the username when it is either a guest posting or we are editing a post and + // the username was supplied; otherwise post_data might hold the data of the post that is + // being quoted (which could result in the username being returned being that of the quoted + // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information. $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username']) ? $post_data['username'] : ''; // The last parameter tells submit_post if search indexer has to be run -- cgit v1.2.1 From 2ce83fce1eb3031b71a54a555b8766f35d8b6ac7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2013 23:53:33 +0200 Subject: [ticket/11769] Allow '0' as username in notification mails PHPBB3-11769 --- phpBB/language/en/email/forum_notify.txt | 2 +- phpBB/language/en/email/newtopic_notify.txt | 2 +- phpBB/language/en/email/topic_notify.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/email/forum_notify.txt b/phpBB/language/en/email/forum_notify.txt index 490780a0a6..6a2eb90190 100644 --- a/phpBB/language/en/email/forum_notify.txt +++ b/phpBB/language/en/email/forum_notify.txt @@ -2,7 +2,7 @@ Subject: Forum post notification - "{FORUM_NAME}" Hello {USERNAME}, -You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new reply to the topic "{TOPIC_TITLE}" by {AUTHOR_NAME} since your last visit. You can use the following link to view the last unread reply, no more notifications will be sent until you visit the topic. +You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new reply to the topic "{TOPIC_TITLE}" by {AUTHOR_NAME} since your last visit. You can use the following link to view the last unread reply, no more notifications will be sent until you visit the topic. {U_NEWEST_POST} diff --git a/phpBB/language/en/email/newtopic_notify.txt b/phpBB/language/en/email/newtopic_notify.txt index eda1370938..2da7ee8766 100644 --- a/phpBB/language/en/email/newtopic_notify.txt +++ b/phpBB/language/en/email/newtopic_notify.txt @@ -2,7 +2,7 @@ Subject: New topic notification - "{FORUM_NAME}" Hello {USERNAME}, -You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic by {AUTHOR_NAME} since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. +You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic by {AUTHOR_NAME} since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. {U_FORUM} diff --git a/phpBB/language/en/email/topic_notify.txt b/phpBB/language/en/email/topic_notify.txt index fcfbcc2abd..f48eb5d40a 100644 --- a/phpBB/language/en/email/topic_notify.txt +++ b/phpBB/language/en/email/topic_notify.txt @@ -2,7 +2,7 @@ Subject: Topic reply notification - "{TOPIC_TITLE}" Hello {USERNAME}, -You are receiving this notification because you are watching the topic, "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply by {AUTHOR_NAME} since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. +You are receiving this notification because you are watching the topic, "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply by {AUTHOR_NAME} since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. If you want to view the newest post made since your last visit, click the following link: {U_NEWEST_POST} -- cgit v1.2.1 From d204cdeee0de5668961531c2db88c1b749c290ed Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Tue, 27 Aug 2013 19:36:19 -0400 Subject: [ticket/11813] Change mock auth provider to implement base provider PHPBB3-11813 --- tests/mock/auth_provider.php | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index 9d002334d6..a576ef6b67 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -10,14 +10,9 @@ /** * Mock auth provider class with basic functions to help test sessions. */ -class phpbb_mock_auth_provider implements phpbb_auth_provider_interface +class phpbb_mock_auth_provider extends phpbb_auth_provider_base { - function init() - { - return null; - } - - function login($username, $password) + public function login($username, $password) { return array( 'status' => "", @@ -25,29 +20,4 @@ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface 'user_row' => "", ); } - - function autologin() - { - return array(); - } - - function acp() - { - return array(); - } - - function logout($data, $new_session) - { - return null; - } - - function validate_session($user) - { - return null; - } - - public function get_acp_template($new_config) - { - return null; - } } -- cgit v1.2.1 From 42b9c3c479a28ba74c214676a17e7e783150e227 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Sep 2013 01:11:40 +0200 Subject: [ticket/11769] Allow '0' as username PHPBB3-11769 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 32206df868..11a5067ef9 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2607,7 +2607,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // If a username was supplied or the poster is a guest, we will use the supplied username. // Doing it this way we can use "...post by guest-username..." in notifications when // "guest-username" is supplied or ommit the username if it is not. - $username = ($username || !$user->data['is_registered']) ? $username : $user->data['username']; + $username = ($username !== '' || !$user->data['is_registered']) ? $username : $user->data['username']; user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id'], $username); } -- cgit v1.2.1 From cd9711b7c9201fa58ce56e56f85aa2c196bcbdae Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Sep 2013 11:29:50 +0200 Subject: [ticket/11769] Allow using 0 as poster name PHPBB3-11769 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 7ab4773df2..61df10b125 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1135,7 +1135,7 @@ if ($submit || $preview || $refresh) // the username was supplied; otherwise post_data might hold the data of the post that is // being quoted (which could result in the username being returned being that of the quoted // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information. - $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username']) ? $post_data['username'] : ''; + $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : ''; // The last parameter tells submit_post if search indexer has to be run $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); -- cgit v1.2.1 From 48825975d1e5cb8139757273df8ce9a654efe7bd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 2 Sep 2013 11:41:31 +0200 Subject: [ticket/11821] Fix comma usage next to "You are receiving this notification". This is a partial backport of 31502cdd6c3a5bac5164ec30530e5b4bf63f3196. PHPBB3-11821 --- phpBB/language/en/email/forum_notify.txt | 2 +- phpBB/language/en/email/newtopic_notify.txt | 2 +- phpBB/language/en/email/topic_notify.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/email/forum_notify.txt b/phpBB/language/en/email/forum_notify.txt index 490780a0a6..66f3a68689 100644 --- a/phpBB/language/en/email/forum_notify.txt +++ b/phpBB/language/en/email/forum_notify.txt @@ -2,7 +2,7 @@ Subject: Forum post notification - "{FORUM_NAME}" Hello {USERNAME}, -You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new reply to the topic "{TOPIC_TITLE}" by {AUTHOR_NAME} since your last visit. You can use the following link to view the last unread reply, no more notifications will be sent until you visit the topic. +You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new reply to the topic "{TOPIC_TITLE}" by {AUTHOR_NAME} since your last visit. You can use the following link to view the last unread reply, no more notifications will be sent until you visit the topic. {U_NEWEST_POST} diff --git a/phpBB/language/en/email/newtopic_notify.txt b/phpBB/language/en/email/newtopic_notify.txt index eda1370938..d4f5cae620 100644 --- a/phpBB/language/en/email/newtopic_notify.txt +++ b/phpBB/language/en/email/newtopic_notify.txt @@ -2,7 +2,7 @@ Subject: New topic notification - "{FORUM_NAME}" Hello {USERNAME}, -You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic by {AUTHOR_NAME} since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. +You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic by {AUTHOR_NAME} since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. {U_FORUM} diff --git a/phpBB/language/en/email/topic_notify.txt b/phpBB/language/en/email/topic_notify.txt index fcfbcc2abd..fa2481dd9a 100644 --- a/phpBB/language/en/email/topic_notify.txt +++ b/phpBB/language/en/email/topic_notify.txt @@ -2,7 +2,7 @@ Subject: Topic reply notification - "{TOPIC_TITLE}" Hello {USERNAME}, -You are receiving this notification because you are watching the topic, "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply by {AUTHOR_NAME} since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. +You are receiving this notification because you are watching the topic "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply by {AUTHOR_NAME} since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. If you want to view the newest post made since your last visit, click the following link: {U_NEWEST_POST} -- cgit v1.2.1