Merge branch '2.0'
authorMatthias Schmidt <gravatronics@live.com>
Tue, 19 Aug 2014 20:02:30 +0000 (22:02 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 19 Aug 2014 20:02:30 +0000 (22:02 +0200)
1  2 
wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php

index e3195f17d1cd111706de638c6b7d29a53f36ed6f,decac02b4249b4946d0530268c391aa3a42db07d..3da1dd4fb6e89a9de09e79c09f8f0c66254bb6e0
@@@ -40,22 -37,19 +40,22 @@@ class AttachmentBBCode extends Abstract
                        $attachmentID = $openingTag['attributes'][0];
                }
                
 -              // get attachment for active object
 -              $attachments = array();
 -              if (self::$attachmentList !== null) {
 -                      $attachments = self::$attachmentList->getGroupedObjects(self::$objectID);
 +              // get embedded object
 +              $attachment = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.attachment', $attachmentID);
 +              if ($attachment === null) {
 +                      if (self::$attachmentList !== null) {
 +                              $attachments = self::$attachmentList->getGroupedObjects(self::$objectID);
 +                              if (isset($attachments[$attachmentID])) {
 +                                      $attachment = $attachments[$attachmentID];
 +                                      
 +                                      // mark attachment as embedded
 +                                      $attachment->markAsEmbedded();
 +                              }
 +                      }
                }
                
 -              if (isset($attachments[$attachmentID])) {
 -                      $attachment = $attachments[$attachmentID];
 -                      
 -                      // mark attachment as embedded
 -                      $attachment->markAsEmbedded();
 -                      
 +              if ($attachment !== null) {
-                       if ($attachment->showAsImage() && $parser->getOutputType() == 'text/html') {
+                       if ($attachment->showAsImage() && $attachment->canViewPreview() && $parser->getOutputType() == 'text/html') {
                                // image
                                $linkParameters = array(
                                        'object' => $attachment