aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2013-09-02 09:14:19 -0700
committerDavid King <imkingdavid@gmail.com>2013-09-02 09:14:19 -0700
commit1b1dd01391337c4a13af012cbdae7f34aa9949ee (patch)
treea6b5b622be67a3d7ab29d886913643f39778525f
parent73859da481aa2be6b02e5b7f2825938aed82e858 (diff)
parent5ddb0ba629e4b31ada931240c661d3f4c43d8676 (diff)
downloadforums-1b1dd01391337c4a13af012cbdae7f34aa9949ee.tar
forums-1b1dd01391337c4a13af012cbdae7f34aa9949ee.tar.gz
forums-1b1dd01391337c4a13af012cbdae7f34aa9949ee.tar.bz2
forums-1b1dd01391337c4a13af012cbdae7f34aa9949ee.tar.xz
forums-1b1dd01391337c4a13af012cbdae7f34aa9949ee.zip
Merge remote-tracking branch 'upstream/develop' into ticket/11215
-rw-r--r--phpBB/includes/functions_posting.php5
-rw-r--r--phpBB/language/en/email/forum_notify.txt2
-rw-r--r--phpBB/language/en/email/newtopic_notify.txt2
-rw-r--r--phpBB/language/en/email/topic_notify.txt2
-rw-r--r--phpBB/posting.php8
-rw-r--r--tests/mock/auth_provider.php34
6 files changed, 17 insertions, 36 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6e62c0c6e4..ce1238d8e0 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2166,6 +2166,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
+ // 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'];
+
// Send Notifications
$notification_data = array_merge($data, array(
'topic_title' => (isset($data['topic_title'])) ? $data['topic_title'] : $subject,
diff --git a/phpBB/language/en/email/forum_notify.txt b/phpBB/language/en/email/forum_notify.txt
index 66f3a68689..a05be5fd96 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}"<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> 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}"<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> 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 bf6799e5be..5089e7dcb8 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<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> 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<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> 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 472375fb22..529478eae2 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<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> 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<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> 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}
diff --git a/phpBB/posting.php b/phpBB/posting.php
index ac459197b3..8fe19b2c9f 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1152,8 +1152,14 @@ if ($submit || $preview || $refresh)
$data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted'];
}
+ // 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
- $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'))
{
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;
- }
}