mirror of
https://github.com/e107inc/e107.git
synced 2025-08-11 00:54:49 +02:00
Forum plugin - now also displays file attachment when image attachment is also present
This commit is contained in:
@@ -99,22 +99,22 @@ class plugin_forum_view_shortcodes extends e_shortcode
|
||||
$baseDir = $this->forum->getAttachmentPath($this->postInfo['post_user']);
|
||||
|
||||
$images = array();
|
||||
|
||||
$attachArray = e107::unserialize($this->postInfo['post_attachments']);
|
||||
|
||||
$attachArray = e107::unserialize($this->postInfo['post_attachments']);
|
||||
//print_a($attachArray);
|
||||
foreach($attachArray as $type=>$vals)
|
||||
{
|
||||
foreach($vals as $key=>$file)
|
||||
{
|
||||
list($date,$user,$tmp,$name) = explode("_", $file, 4); // FIXME $name is empty when there are just 3 parts to the filename (e.g. 1407153763_1_abbas.zip)
|
||||
list($date,$user, $name) = explode("_", $file, 3);
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'file':
|
||||
|
||||
|
||||
$url = e_SELF."?id=".$this->postInfo['post_id']."&dl=".$key;
|
||||
$txt .= IMAGE_attachment." <a href='".$url."'>{$name}</a><br />";
|
||||
|
||||
$txt = IMAGE_attachment." <a href='".$url."'>{$name}</a><br />";
|
||||
|
||||
break;
|
||||
|
||||
case 'img': //Always use thumb to hide the hash.
|
||||
@@ -142,9 +142,9 @@ class plugin_forum_view_shortcodes extends e_shortcode
|
||||
|
||||
}
|
||||
|
||||
if(count($images) )
|
||||
if(count($images))
|
||||
{
|
||||
return (deftrue('BOOTSTRAP')) ? "<ul class='thumbnails'><li>".implode("</li><li>",$images)."</li></ul>" : implode("<br />",$images);
|
||||
return (deftrue('BOOTSTRAP')) ? "<ul class='thumbnails'><li>".implode("</li><li>",$images)."</li></ul>".vartrue($txt) : implode("<br />",$images).vartrue($txt);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user