Skip to content

Commit

Permalink
[K6.0] Undefined array key 0 in /kunena/bbcode/bbcode.php on line 2863
Browse files Browse the repository at this point in the history
  • Loading branch information
xillibit committed Dec 21, 2022
1 parent b10c80b commit 6ab7b20
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libraries/kunena/src/BBCode/KunenaBBCode.php
Expand Up @@ -2642,16 +2642,21 @@ public function DoImage($bbcode, $action, $name, $default, $params, $content)
}
}

// Get the words set on alt params when alt is used like that : alt=my words; see issue #6751
$matches = array();
$altText = null;
preg_match('/[img(\s*(?!alt)([\w\-\.]+\s*\/?]/', $params['_tag'], $matches);
$matches = rtrim($matches[0], "]");
if (count($matches) > 0) {
$altText = rtrim($matches[0], "]");
};

$config = KunenaFactory::getConfig();
$layout = KunenaLayout::factory('BBCode/Image')
->set('title', Text::_('COM_KUNENA_FILEATTACH'))
->set('url', null)
->set('filename', null)
->set('size', isset($params['size']) ? $params['size'] : 0)
->set('alt', isset($params['alt']) ? $matches : 0)
->set('alt', count($matches) > 0 ? $altText : 0)
->set('canLink', $bbcode->autoLink_disable == 0);

if (Factory::getApplication()->getIdentity()->id == 0 && $config->showImgForGuest == 0) {
Expand Down

0 comments on commit 6ab7b20

Please sign in to comment.