1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 19:24:01 +02:00

[ticket/13713] Introduce ACP settings for mentions

PHPBB3-13713
This commit is contained in:
lavigor
2018-06-15 02:03:57 +03:00
committed by Marc Alexander
parent 012d009fbe
commit 31e4fb4729
14 changed files with 101 additions and 13 deletions

View File

@@ -89,4 +89,12 @@ interface renderer_interface
* @return null
*/
public function set_viewsmilies($value);
/**
* Set the "usemention" option
*
* @param bool $value Option's value
* @return null
*/
public function set_usemention($value);
}

View File

@@ -310,8 +310,8 @@ class factory implements \phpbb\textformatter\cache_interface
$configurator->tags['QUOTE']->nestingLimit = PHP_INT_MAX;
}
// Modify the template to disable images/flash depending on user's settings
foreach (array('FLASH', 'IMG') as $name)
// Modify the template to disable images/flash/mentions depending on user's settings
foreach (array('FLASH', 'IMG', 'MENTION') as $name)
{
$tag = $configurator->tags[$name];
$tag->template = '<xsl:choose><xsl:when test="$S_VIEW' . $name . '">' . $tag->template . '</xsl:when><xsl:otherwise><xsl:apply-templates/></xsl:otherwise></xsl:choose>';

View File

@@ -63,6 +63,11 @@ class renderer implements \phpbb\textformatter\renderer_interface
*/
protected $viewsmilies = false;
/**
* @var bool Whether the user is allowed to use mentions
*/
protected $usemention = false;
/**
* Constructor
*
@@ -177,6 +182,7 @@ class renderer implements \phpbb\textformatter\renderer_interface
$this->set_viewflash($user->optionget('viewflash'));
$this->set_viewimg($user->optionget('viewimg'));
$this->set_viewsmilies($user->optionget('viewsmilies'));
$this->set_usemention($config['allow_mentions'] && $auth->acl_get('u_mention'));
// Set the stylesheet parameters
foreach (array_keys($this->renderer->getParameters()) as $param_name)
@@ -330,4 +336,13 @@ class renderer implements \phpbb\textformatter\renderer_interface
$this->viewsmilies = $value;
$this->renderer->setParameter('S_VIEWSMILIES', $value);
}
/**
* {@inheritdoc}
*/
public function set_usemention($value)
{
$this->usemention = $value;
$this->renderer->setParameter('S_VIEWMENTION', $value);
}
}