mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Forum plugin - now also displays file attachment when image attachment is also present
This commit is contained in:
parent
c15c22ad7d
commit
d6afec8de9
@ -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,12 +994,7 @@ 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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user