public function insertUploadedAttachmentData(XenForo_Upload $file, $userId, array $extra = array())
 {
     $filename = $file->getFileName();
     $extension = XenForo_Helper_File::getFileExtension($filename);
     if ($extension == 'svg') {
         list($svgfile, $dimensions) = $this->extractDimensionsForSVG($file->getTempFile(), XenForo_Application::getOptions()->SV_RejectAttachmentWithBadTags);
         if (!empty($svgfile) && !empty($dimensions)) {
             if ($dimensions['thumbnail_width'] && $dimensions['thumbnail_height']) {
                 $tempThumbFile = tempnam(XenForo_Helper_File::getTempDir(), 'xf');
                 if ($tempThumbFile) {
                     // update the width/height attributes
                     $svgfile['width'] = (string) $dimensions['thumbnail_width'];
                     $svgfile['height'] = (string) $dimensions['thumbnail_height'];
                     $svgfile->asXML($tempThumbFile);
                     SV_AttachmentImprovements_Globals::$tempThumbFile = $tempThumbFile;
                 }
             }
             SV_AttachmentImprovements_Globals::$forcedDimensions = $dimensions;
         }
     }
     return parent::insertUploadedAttachmentData($file, $userId, $extra);
 }
Exemplo n.º 2
0
 public function canUploadAndManageAttachment(array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null)
 {
     SV_AttachmentImprovements_Globals::$nodePermissionsForAttachments = $nodePermissions;
     return parent::canUploadAndManageAttachment($forum, $errorPhraseKey, $nodePermissions, $viewingUser);
 }