Merge branch 'master' into next
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 6 Jun 2016 15:28:59 +0000 (17:28 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 6 Jun 2016 15:28:59 +0000 (17:28 +0200)
1  2 
wcfsetup/install/files/lib/data/style/StyleAction.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/setup/db/install.sql

index ca698d852e60cf1fb8b71a5534e15e650d40a945,7a07ab60826d07771c60dd2daa041e9fb7b78ea2..e6b18c6745d69426644b78dd9928af2861fc4b17
@@@ -476,34 -451,37 +476,34 @@@ 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_JPG:
 -                                                              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 IMG_PNG:
-                                                                       case IMG_JPEG:
-                                                                       case IMG_JPG:
-                                                                       case IMG_GIF:
++                                                                      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
 +                                              }
                                        }
                                }
                        }
index 2f02131c9cc9661c9d44e5bb012ecc9ca1ae7090,162c5bd86690e915976e332401131b281420f24b..1a99576fed4b74c66f0fcd59c47f0a28dd81c6f3
@@@ -2126,13 -1876,9 +2126,11 @@@ INSERT INTO wcf1_template_group (parent
  -- media providers
  -- Videos
        -- Youtube
 -      INSERT INTO wcf1_bbcode_media_provider (title, regex, html) VALUES ('YouTube', 'https?://(?:.+?\\.)?youtu(?:\\.be/|be\\.com/(?:#/)?watch\\?(?:.*?&)?v=)(?P<ID>[a-zA-Z0-9_-]+)(?:(?:\\?|&)t=(?P<start>\\d+)$)?', '<iframe style="max-width:100%;" width="560" height="315" src="https://www.youtube.com/embed/{$ID}?wmode=transparent&amp;start={$start}" allowfullscreen></iframe>');
 +      INSERT INTO wcf1_bbcode_media_provider (title, regex, html) VALUES ('YouTube', 'https?://(?:.+?\\.)?youtu(?:\\.be/|be\\.com/(?:#/)?watch\\?(?:.*?&)?v=)(?P<ID>[a-zA-Z0-9_-]+)(?:(?:\\?|&)t=(?P<start>\\d+)$)?', '<div class="videoContainer"><iframe src="https://www.youtube.com/embed/{$ID}?wmode=transparent&amp;start={$start}" allowfullscreen></iframe></div>');
 +      -- Youtube playlist
 +      INSERT INTO wcf1_bbcode_media_provider (title, regex, html) VALUES ('YouTube Playlist', 'https?://(?:.+?\\.)?youtu(?:\\.be/|be\\.com/)playlist\\?(?:.*?&)?list=(?P<ID>[a-zA-Z0-9_-]+)', '<div class="videoContainer"><iframe src="https://www.youtube.com/embed/videoseries?list={$ID}" allowfullscreen></iframe></div>');
        -- Vimeo
        INSERT INTO wcf1_bbcode_media_provider (title, regex, html) VALUES ('Vimeo', 'https?://vimeo\\.com/(?P<ID>\\d+)', '<iframe src="https://player.vimeo.com/video/{$ID}" width="400" height="225" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
-       -- MyVideo
-       INSERT INTO wcf1_bbcode_media_provider (title, regex, html) VALUES ('MyVideo', 'http://(?:www\\.)?myvideo\\.de/watch/(?P<ID>\\d+)', '<object width="611" height="383" type="application/x-shockwave-flash" data="http://www.myvideo.de/movie/{$ID}"><param name="movie" value="http://www.myvideo.de/movie/{$ID}" /><param name="AllowFullscreen" value="true" /><param name="AllowScriptAccess" value="always" /><param name="wmode" value="transparent" /></object>');
        -- Clipfish
        INSERT INTO wcf1_bbcode_media_provider (title, regex, html) VALUES ('Clipfish', 'http://(?:www\\.)?clipfish\\.de/(?:.*?/)?video/(?P<ID>\\d+)/', '<div style="width:464px; height:404px;"><div style="width:464px; height:384px;"><iframe src="http://www.clipfish.de/embed_video/?vid={$ID}&amp;as=0&amp;col=990000" name="Clipfish Embedded Video" width="464" height="384" align="left" marginheight="0" marginwidth="0" scrolling="no"></iframe></div></div>');
        -- Veoh