From d3749538f1692af50ee340da1d942d4b963f5c40 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Thu, 5 Dec 2019 10:14:46 +0100 Subject: [ticket/16247] Quote PM has no identifier PHPBB3-16247 --- phpBB/phpbb/textformatter/s9e/factory.php | 2 ++ phpBB/phpbb/textformatter/s9e/quote_helper.php | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'phpBB/phpbb/textformatter') diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index dca1c78d40..024bad4dd6 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -90,6 +90,8 @@ class factory implements \phpbb\textformatter\cache_interface post_id={UINT;optional} post_url={URL;optional;postFilter=#false} profile_url={URL;optional;postFilter=#false} + msg_id={UINT;optional} + msg_url={URL;optional;postFilter=#false} time={UINT;optional} url={URL;optional} user_id={UINT;optional} diff --git a/phpBB/phpbb/textformatter/s9e/quote_helper.php b/phpBB/phpbb/textformatter/s9e/quote_helper.php index 86c33c7591..dc01883c43 100644 --- a/phpBB/phpbb/textformatter/s9e/quote_helper.php +++ b/phpBB/phpbb/textformatter/s9e/quote_helper.php @@ -40,6 +40,7 @@ class quote_helper public function __construct(\phpbb\user $user, $root_path, $php_ext) { $this->post_url = append_sid($root_path . 'viewtopic.' . $php_ext, 'p={POST_ID}#p{POST_ID}', false); + $this->msg_url = append_sid($root_path . 'ucp.' . $php_ext, 'i=pm&mode=view&p={MSG_ID}', false); $this->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}', false); $this->user = $user; } @@ -53,6 +54,7 @@ class quote_helper public function inject_metadata($xml) { $post_url = $this->post_url; + $msg_url = $this->msg_url; $profile_url = $this->profile_url; $user = $this->user; @@ -65,6 +67,10 @@ class quote_helper { $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $post_url); } + if (isset($attributes['msg_id'])) + { + $attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $msg_url); + } if (isset($attributes['time'])) { $attributes['date'] = $user->format_date($attributes['time']); -- cgit v1.2.1 From 8c42a9d9000ff06d4ea10ab04e47ab2a998e260a Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Thu, 5 Dec 2019 11:56:41 +0100 Subject: [ticket/16247] Code consistency PHPBB3-16247 --- phpBB/phpbb/textformatter/s9e/factory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/textformatter') diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 024bad4dd6..f82c7b0771 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -89,9 +89,9 @@ class factory implements \phpbb\textformatter\cache_interface author={TEXT1;optional} post_id={UINT;optional} post_url={URL;optional;postFilter=#false} - profile_url={URL;optional;postFilter=#false} msg_id={UINT;optional} msg_url={URL;optional;postFilter=#false} + profile_url={URL;optional;postFilter=#false} time={UINT;optional} url={URL;optional} user_id={UINT;optional} -- cgit v1.2.1 From e6c45623eaa5023d6372303158aa976a7e945626 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Thu, 5 Dec 2019 23:41:44 +0100 Subject: [ticket/16247] Quote PM has no identifier Code review PHPBB3-16247 --- phpBB/phpbb/textformatter/s9e/quote_helper.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'phpBB/phpbb/textformatter') diff --git a/phpBB/phpbb/textformatter/s9e/quote_helper.php b/phpBB/phpbb/textformatter/s9e/quote_helper.php index dc01883c43..3011ec88dc 100644 --- a/phpBB/phpbb/textformatter/s9e/quote_helper.php +++ b/phpBB/phpbb/textformatter/s9e/quote_helper.php @@ -20,6 +20,11 @@ class quote_helper */ protected $post_url; + /** + * @var string Base URL for a private message link, uses {MSG_ID} as placeholder + */ + protected $msg_url; + /** * @var string Base URL for a profile link, uses {USER_ID} as placeholder */ @@ -53,31 +58,26 @@ class quote_helper */ public function inject_metadata($xml) { - $post_url = $this->post_url; - $msg_url = $this->msg_url; - $profile_url = $this->profile_url; - $user = $this->user; - return \s9e\TextFormatter\Utils::replaceAttributes( $xml, 'QUOTE', - function ($attributes) use ($post_url, $profile_url, $user) + function ($attributes) { if (isset($attributes['post_id'])) { - $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $post_url); + $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $this->post_url); } if (isset($attributes['msg_id'])) { - $attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $msg_url); + $attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $this->msg_url); } if (isset($attributes['time'])) { - $attributes['date'] = $user->format_date($attributes['time']); + $attributes['date'] = $this->user->format_date($attributes['time']); } if (isset($attributes['user_id'])) { - $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $profile_url); + $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $this->profile_url); } return $attributes; -- cgit v1.2.1