aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2014-10-21 15:31:20 +0200
committernodiscc <nodiscc@gmail.com>2014-10-23 18:00:21 +0200
commit1a663a0f2c9d54deeda7dd6f44de472f70ef19bb (patch)
treefb0cc9d35e1fe5ec19e4bd37af0e5e49691b7900 /index.php
parent57dbbe51a613b31f84071a22897857b81cd9e2ec (diff)
downloadShaarli-1a663a0f2c9d54deeda7dd6f44de472f70ef19bb.tar.gz
Shaarli-1a663a0f2c9d54deeda7dd6f44de472f70ef19bb.tar.zst
Shaarli-1a663a0f2c9d54deeda7dd6f44de472f70ef19bb.zip
thumbnails: force HTTPS for youtube, imgur, vimeo
* other services also provide thumbs over HTTPS, but the rewrite expression is more complex, so left out for now
Diffstat (limited to 'index.php')
-rw-r--r--index.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/index.php b/index.php
index 6fae2f8b..b0cd430f 100644
--- a/index.php
+++ b/index.php
@@ -1891,13 +1891,13 @@ function computeThumbnail($url,$href=false)
1891 if ($domain=='youtube.com' || $domain=='www.youtube.com') 1891 if ($domain=='youtube.com' || $domain=='www.youtube.com')
1892 { 1892 {
1893 parse_str(parse_url($url,PHP_URL_QUERY), $params); // Extract video ID and get thumbnail 1893 parse_str(parse_url($url,PHP_URL_QUERY), $params); // Extract video ID and get thumbnail
1894 if (!empty($params['v'])) return array('src'=>'http://img.youtube.com/vi/'.$params['v'].'/default.jpg', 1894 if (!empty($params['v'])) return array('src'=>'https://img.youtube.com/vi/'.$params['v'].'/default.jpg',
1895 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail'); 1895 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail');
1896 } 1896 }
1897 if ($domain=='youtu.be') // Youtube short links 1897 if ($domain=='youtu.be') // Youtube short links
1898 { 1898 {
1899 $path = parse_url($url,PHP_URL_PATH); 1899 $path = parse_url($url,PHP_URL_PATH);
1900 return array('src'=>'http://img.youtube.com/vi'.$path.'/default.jpg', 1900 return array('src'=>'https://img.youtube.com/vi'.$path.'/default.jpg',
1901 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail'); 1901 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail');
1902 } 1902 }
1903 if ($domain=='pix.toile-libre.org') // pix.toile-libre.org image hosting 1903 if ($domain=='pix.toile-libre.org') // pix.toile-libre.org image hosting
@@ -1911,18 +1911,18 @@ function computeThumbnail($url,$href=false)
1911 { 1911 {
1912 $path = parse_url($url,PHP_URL_PATH); 1912 $path = parse_url($url,PHP_URL_PATH);
1913 if (startsWith($path,'/a/')) return array(); // Thumbnails for albums are not available. 1913 if (startsWith($path,'/a/')) return array(); // Thumbnails for albums are not available.
1914 if (startsWith($path,'/r/')) return array('src'=>'http://i.imgur.com/'.basename($path).'s.jpg', 1914 if (startsWith($path,'/r/')) return array('src'=>'https://i.imgur.com/'.basename($path).'s.jpg',
1915 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1915 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1916 if (startsWith($path,'/gallery/')) return array('src'=>'http://i.imgur.com'.substr($path,8).'s.jpg', 1916 if (startsWith($path,'/gallery/')) return array('src'=>'https://i.imgur.com'.substr($path,8).'s.jpg',
1917 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1917 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1918 1918
1919 if (substr_count($path,'/')==1) return array('src'=>'http://i.imgur.com/'.substr($path,1).'s.jpg', 1919 if (substr_count($path,'/')==1) return array('src'=>'https://i.imgur.com/'.substr($path,1).'s.jpg',
1920 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1920 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1921 } 1921 }
1922 if ($domain=='i.imgur.com') 1922 if ($domain=='i.imgur.com')
1923 { 1923 {
1924 $pi = pathinfo(parse_url($url,PHP_URL_PATH)); 1924 $pi = pathinfo(parse_url($url,PHP_URL_PATH));
1925 if (!empty($pi['filename'])) return array('src'=>'http://i.imgur.com/'.$pi['filename'].'s.jpg', 1925 if (!empty($pi['filename'])) return array('src'=>'https://i.imgur.com/'.$pi['filename'].'s.jpg',
1926 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1926 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1927 } 1927 }
1928 if ($domain=='dailymotion.com' || $domain=='www.dailymotion.com') 1928 if ($domain=='dailymotion.com' || $domain=='www.dailymotion.com')
@@ -2353,7 +2353,7 @@ function genThumbnail()
2353 // This is more complex: we have to perform a HTTP request, then parse the result. 2353 // This is more complex: we have to perform a HTTP request, then parse the result.
2354 // Maybe we should deport this to JavaScript ? Example: http://stackoverflow.com/questions/1361149/get-img-thumbnails-from-vimeo/4285098#4285098 2354 // Maybe we should deport this to JavaScript ? Example: http://stackoverflow.com/questions/1361149/get-img-thumbnails-from-vimeo/4285098#4285098
2355 $vid = substr(parse_url($url,PHP_URL_PATH),1); 2355 $vid = substr(parse_url($url,PHP_URL_PATH),1);
2356 list($httpstatus,$headers,$data) = getHTTP('http://vimeo.com/api/v2/video/'.htmlspecialchars($vid).'.php',5); 2356 list($httpstatus,$headers,$data) = getHTTP('https://vimeo.com/api/v2/video/'.htmlspecialchars($vid).'.php',5);
2357 if (strpos($httpstatus,'200 OK')!==false) 2357 if (strpos($httpstatus,'200 OK')!==false)
2358 { 2358 {
2359 $t = unserialize($data); 2359 $t = unserialize($data);