diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index a92525c54..5659c80f4 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -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); diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index be7c5024d..4f435d53f 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -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." {$name}
"; - + $txt = IMAGE_attachment." {$name}
"; + 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')) ? "" : implode("
",$images); + return (deftrue('BOOTSTRAP')) ? "".vartrue($txt) : implode("
",$images).vartrue($txt); }