1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Forum plugin - now also displays file attachment when image attachment is also present

This commit is contained in:
Moc
2014-08-04 17:54:34 +02:00
parent c15c22ad7d
commit d6afec8de9
2 changed files with 11 additions and 15 deletions

View File

@@ -977,8 +977,9 @@ class e107forum
}
}
}
// check if there are images to be deleted
elseif(is_array($imgs))
if(is_array($imgs))
{
// loop through each image and delete it
foreach ($imgs as $img)
@@ -993,11 +994,6 @@ class e107forum
}
}
}
// Apparently there are attachments other than 'files' or 'images' present. Add warning to log and proceed.
else
{
$log->addError("Unknown attachments detected in post (id: ".$id.")");
}
// At this point we assume that all attachments have been deleted from the post. The log file may prove otherwise (see above).
$log->toFile('forum_delete_attachments', 'Forum plugin - Delete attachments', TRUE);

View File

@@ -101,19 +101,19 @@ class plugin_forum_view_shortcodes extends e_shortcode
$images = array();
$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;
@@ -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);
}