1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge branch '3.2.x'

This commit is contained in:
Máté Bartus
2017-09-07 15:09:40 +02:00
7 changed files with 127 additions and 11 deletions

View File

@@ -499,7 +499,10 @@ class bbcode
// Turn template blocks into PHP assignment statements for the values of $bbcode_tpl..
$this->bbcode_template = array();
$matches = preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match);
// Capture the BBCode template matches
// Allow phpBB template or the Twig syntax
$matches = (preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match)) ?:
preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $tpl, $match);
for ($i = 0; $i < $matches; $i++)
{

View File

@@ -557,6 +557,7 @@ function strip_bbcode(&$text, $uid = '')
function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true)
{
static $bbcode;
global $auth, $config, $user;
global $phpbb_dispatcher, $phpbb_container;
if ($text === '')
@@ -584,6 +585,13 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text
// Temporarily switch off viewcensors if applicable
$old_censor = $renderer->get_viewcensors();
// Check here if the user is having viewing censors disabled (and also allowed to do so).
if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors'))
{
$censor_text = false;
}
if ($old_censor !== $censor_text)
{
$renderer->set_viewcensors($censor_text);

View File

@@ -137,6 +137,10 @@ class redis extends \phpbb\cache\driver\memory
*/
function _write($var, $data, $ttl = 2592000)
{
if ($ttl == 0)
{
return $this->redis->set($var, $data);
}
return $this->redis->setex($var, $ttl, $data);
}

View File

@@ -521,7 +521,9 @@ class factory implements \phpbb\textformatter\cache_interface
protected function extract_templates($template)
{
// Capture the template fragments
preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER);
// Allow either phpBB template or the Twig syntax
preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER) ?:
preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $template, $matches, PREG_SET_ORDER);
$fragments = array();
foreach ($matches as $match)