mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
2c8e6e400c
5 changed files with 25 additions and 10 deletions
|
@ -999,7 +999,10 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||||
{
|
{
|
||||||
$quote_attributes['post_id'] = $post['msg_id'];
|
$quote_attributes['post_id'] = $post['msg_id'];
|
||||||
}
|
}
|
||||||
|
if ($action === 'quote')
|
||||||
|
{
|
||||||
|
$quote_attributes['msg_id'] = $post['msg_id'];
|
||||||
|
}
|
||||||
/** @var \phpbb\language\language $language */
|
/** @var \phpbb\language\language $language */
|
||||||
$language = $phpbb_container->get('language');
|
$language = $phpbb_container->get('language');
|
||||||
/** @var \phpbb\textformatter\utils_interface $text_formatter_utils */
|
/** @var \phpbb\textformatter\utils_interface $text_formatter_utils */
|
||||||
|
|
|
@ -89,6 +89,8 @@ class factory implements \phpbb\textformatter\cache_interface
|
||||||
author={TEXT1;optional}
|
author={TEXT1;optional}
|
||||||
post_id={UINT;optional}
|
post_id={UINT;optional}
|
||||||
post_url={URL;optional;postFilter=#false}
|
post_url={URL;optional;postFilter=#false}
|
||||||
|
msg_id={UINT;optional}
|
||||||
|
msg_url={URL;optional;postFilter=#false}
|
||||||
profile_url={URL;optional;postFilter=#false}
|
profile_url={URL;optional;postFilter=#false}
|
||||||
time={UINT;optional}
|
time={UINT;optional}
|
||||||
url={URL;optional}
|
url={URL;optional}
|
||||||
|
|
|
@ -20,6 +20,11 @@ class quote_helper
|
||||||
*/
|
*/
|
||||||
protected $post_url;
|
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
|
* @var string Base URL for a profile link, uses {USER_ID} as placeholder
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +45,7 @@ class quote_helper
|
||||||
public function __construct(\phpbb\user $user, $root_path, $php_ext)
|
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->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->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}', false);
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
@ -52,26 +58,26 @@ class quote_helper
|
||||||
*/
|
*/
|
||||||
public function inject_metadata($xml)
|
public function inject_metadata($xml)
|
||||||
{
|
{
|
||||||
$post_url = $this->post_url;
|
|
||||||
$profile_url = $this->profile_url;
|
|
||||||
$user = $this->user;
|
|
||||||
|
|
||||||
return \s9e\TextFormatter\Utils::replaceAttributes(
|
return \s9e\TextFormatter\Utils::replaceAttributes(
|
||||||
$xml,
|
$xml,
|
||||||
'QUOTE',
|
'QUOTE',
|
||||||
function ($attributes) use ($post_url, $profile_url, $user)
|
function ($attributes)
|
||||||
{
|
{
|
||||||
if (isset($attributes['post_id']))
|
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'], $this->msg_url);
|
||||||
}
|
}
|
||||||
if (isset($attributes['time']))
|
if (isset($attributes['time']))
|
||||||
{
|
{
|
||||||
$attributes['date'] = $user->format_date($attributes['time']);
|
$attributes['date'] = $this->user->format_date($attributes['time']);
|
||||||
}
|
}
|
||||||
if (isset($attributes['user_id']))
|
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;
|
return $attributes;
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<a href="{@post_url}" data-post-id="{@post_id}" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a>
|
<a href="{@post_url}" data-post-id="{@post_id}" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
<xsl:if test="@msg_url">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<a href="{@msg_url}" data-msg-id="{@msg_id}">↑</a>
|
||||||
|
</xsl:if>
|
||||||
<xsl:if test="@date">
|
<xsl:if test="@date">
|
||||||
<div class="responsive-hide"><xsl:value-of select="@date"/></div>
|
<div class="responsive-hide"><xsl:value-of select="@date"/></div>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
|
@ -85,7 +85,7 @@ class phpbb_functional_private_messages_test extends phpbb_functional_test_case
|
||||||
public function test_quote_pm()
|
public function test_quote_pm()
|
||||||
{
|
{
|
||||||
$text = 'This is a test private message sent by the testing framework.';
|
$text = 'This is a test private message sent by the testing framework.';
|
||||||
$expected = "(\\[quote=admin time=\\d+ user_id=2\\]\n" . $text . "\n\\[/quote\\])";
|
$expected = "(\\[quote=admin msg_id=\\d+ time=\\d+ user_id=2\\]\n" . $text . "\n\\[/quote\\])";
|
||||||
|
|
||||||
$this->login();
|
$this->login();
|
||||||
$message_id = $this->create_private_message('Test', $text, array(2));
|
$message_id = $this->create_private_message('Test', $text, array(2));
|
||||||
|
|
Loading…
Add table
Reference in a new issue