Merge branch 'ticket/14850' into 3.1.x

This commit is contained in:
Marc Alexander 2016-11-20 12:57:17 +01:00
commit 6d58c4a4b5
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 20 additions and 1 deletions

View file

@ -980,7 +980,7 @@ function bbcode_nl2br($text)
*/ */
function smiley_text($text, $force_option = false) function smiley_text($text, $force_option = false)
{ {
global $config, $user, $phpbb_path_helper; global $config, $user, $phpbb_path_helper, $phpbb_dispatcher;
if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies'))
{ {
@ -989,6 +989,16 @@ function smiley_text($text, $force_option = false)
else else
{ {
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path();
/**
* Event to override the root_path for smilies
*
* @event core.smiley_text_root_path
* @var string root_path root_path for smilies
* @since 3.1.11-RC1
*/
$vars = array('root_path');
extract($phpbb_dispatcher->trigger_event('core.smiley_text_root_path', compact($vars)));
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text); return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
} }
} }

View file

@ -119,6 +119,15 @@ function generate_smilies($mode, $forum_id)
foreach ($smilies as $row) foreach ($smilies as $row)
{ {
/**
* Modify smiley root path before populating smiley list
*
* @event core.generate_smilies_before
* @var string root_path root_path for smilies
* @since 3.1.11-RC1
*/
$vars = array('root_path');
extract($phpbb_dispatcher->trigger_event('core.generate_smilies_before', compact($vars)));
$template->assign_block_vars('smiley', array( $template->assign_block_vars('smiley', array(
'SMILEY_CODE' => $row['code'], 'SMILEY_CODE' => $row['code'],
'A_SMILEY_CODE' => addslashes($row['code']), 'A_SMILEY_CODE' => addslashes($row['code']),