[BUGFIX] Use correct url schema in MediaWizardProvider 45/22345/2
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 16 Jul 2013 05:00:18 +0000 (07:00 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 17 Jul 2013 09:37:01 +0000 (11:37 +0200)
If the media provider supports https, the video should be
embedded using https instead of http.

Change-Id: Id6f1677acfd82ba071c2425f345ea20b48de9cfe
Resolves: #50041
Releases: 6.2
Reviewed-on: https://review.typo3.org/22345
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/frontend/Classes/MediaWizard/MediaWizardProvider.php

index f687264..dfaa689 100644 (file)
@@ -122,7 +122,7 @@ class MediaWizardProvider implements \TYPO3\CMS\Frontend\MediaWizard\MediaWizard
                        $videoId = $matches[2];
                }
                if ($videoId) {
-                       $url = 'http://www.youtube.com/v/' . $videoId . '?fs=1';
+                       $url = $this->getUrlSchema() . 'www.youtube.com/v/' . $videoId . '?fs=1';
                }
                return $url;
        }
@@ -149,7 +149,7 @@ class MediaWizardProvider implements \TYPO3\CMS\Frontend\MediaWizard\MediaWizard
                if (strpos($videoId, '/') !== FALSE) {
                        $videoId = substr($videoId, 0, strpos($videoId, '/'));
                }
-               return 'http://www.dailymotion.com/swf/' . $videoId;
+               return $this->getUrlSchema() . 'www.dailymotion.com/swf/' . $videoId;
        }
 
        /**
@@ -181,7 +181,7 @@ class MediaWizardProvider implements \TYPO3\CMS\Frontend\MediaWizard\MediaWizard
        protected function process_vimeo($url) {
                if (preg_match('/[\\/#](\\d+)$/', $url, $matches)) {
                        $videoId = $matches[1];
-                       $url = 'http://vimeo.com/moogaloop.swf?clip_id=' . $videoId . '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1';
+                       $url = $this->getUrlSchema() . 'vimeo.com/moogaloop.swf?clip_id=' . $videoId . '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1';
                }
                return $url;
        }
@@ -210,7 +210,7 @@ class MediaWizardProvider implements \TYPO3\CMS\Frontend\MediaWizard\MediaWizard
        protected function process_google($url) {
                if (preg_match('/docid=([^(\\&|$)]*)/', $url, $matches)) {
                        $videoId = $matches[1];
-                       $url = 'http://video.google.com/googleplayer.swf?docid=' . $videoId;
+                       $url = $this->getUrlSchema() . 'video.google.com/googleplayer.swf?docid=' . $videoId;
                }
                return $url;
        }
@@ -240,7 +240,7 @@ class MediaWizardProvider implements \TYPO3\CMS\Frontend\MediaWizard\MediaWizard
                preg_match('/watch([^(\\&|$)]*)/', $url, $matches);
                $parts = explode('/', $matches[1]);
                $videoId = $parts[1];
-               return 'http://www.myvideo.de/movie/' . $videoId . '/';
+               return $this->getUrlSchema() . 'www.myvideo.de/movie/' . $videoId . '/';
        }
 
        /**
@@ -267,6 +267,15 @@ class MediaWizardProvider implements \TYPO3\CMS\Frontend\MediaWizard\MediaWizard
                return 'http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId=' . $videoId;
        }
 
+       /**
+        * Get the correct url schema
+        *
+        * @return string
+        */
+       protected function getUrlSchema() {
+               return \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
+       }
+
 }