From: Tim Düsterhus Date: Mon, 6 Jun 2016 15:35:30 +0000 (+0200) Subject: Merge branch 'master' into next X-Git-Tag: 3.0.0_Beta_1~1511 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=09e08ad31b16faa9406507f07905ac899e71bac8;p=GitHub%2FWoltLab%2FWCF.git Merge branch 'master' into next --- 09e08ad31b16faa9406507f07905ac899e71bac8 diff --cc wcfsetup/install/files/lib/data/style/StyleEditor.class.php index e6b18c6745,4d9bd8e142..55fe062f6f --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@@ -476,34 -451,36 +476,33 @@@ class StyleEditor extends DatabaseObjec } // save style - if ($style !== null) { - $style->update($styleData); - } - else { + if ($style === null) { $styleData['packageID'] = $packageID; $style = new StyleEditor(self::create($styleData)); - } - - // import preview image - if (!empty($data['image'])) { - $fileExtension = mb_substr($data['image'], mb_strrpos($data['image'], '.')); - $index = $tar->getIndexByFilename($data['image']); - if ($index !== false) { - $filename = WCF_DIR.'images/stylePreview-'.$style->styleID.$fileExtension; - $tar->extract($index, $filename); - FileUtil::makeWritable($filename); - - if (file_exists($filename)) { - try { - if (($imageData = getimagesize($filename)) !== false) { - switch ($imageData[2]) { - case IMAGETYPE_PNG: - case IMAGETYPE_JPEG: - case IMAGETYPE_GIF: - $style->update(array('image' => 'stylePreview-'.$style->styleID.$fileExtension)); + + // import preview image + if (!empty($data['image'])) { + $fileExtension = mb_substr($data['image'], mb_strrpos($data['image'], '.')); + $index = $tar->getIndexByFilename($data['image']); + if ($index !== false) { + $filename = WCF_DIR.'images/stylePreview-'.$style->styleID.$fileExtension; + $tar->extract($index, $filename); + FileUtil::makeWritable($filename); + + if (file_exists($filename)) { + try { + if (($imageData = getimagesize($filename)) !== false) { + switch ($imageData[2]) { + case IMAGETYPE_PNG: + case IMAGETYPE_JPEG: - case IMAGETYPE_JPG: + case IMAGETYPE_GIF: + $style->update(['image' => 'stylePreview-'.$style->styleID.$fileExtension]); + } } } - } - catch (SystemException $e) { - // broken image + catch (SystemException $e) { + // broken image + } } } }