aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorEmilien Klein <emilien@klein.st>2014-10-23 20:06:29 +0200
committerEmilien Klein <emilien@klein.st>2014-10-23 20:06:29 +0200
commit39e41053ad307c160a4dbca41a445c29b88ae0ca (patch)
treee5ebd74bbb9a3b134588b4ba0763d810bd88dc82 /index.php
parenta4355279cb60e3fee7e87b2ffffd3f4c6465b9f4 (diff)
parent1a663a0f2c9d54deeda7dd6f44de472f70ef19bb (diff)
downloadShaarli-39e41053ad307c160a4dbca41a445c29b88ae0ca.tar.gz
Shaarli-39e41053ad307c160a4dbca41a445c29b88ae0ca.tar.zst
Shaarli-39e41053ad307c160a4dbca41a445c29b88ae0ca.zip
Merge pull request #36 from nodiscc/https-thumbnails
thumbnails: force HTTPS for youtube, imgur, vimeo
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 c91ae23b..01931198 100644
--- a/index.php
+++ b/index.php
@@ -1892,13 +1892,13 @@ function computeThumbnail($url,$href=false)
1892 if ($domain=='youtube.com' || $domain=='www.youtube.com') 1892 if ($domain=='youtube.com' || $domain=='www.youtube.com')
1893 { 1893 {
1894 parse_str(parse_url($url,PHP_URL_QUERY), $params); // Extract video ID and get thumbnail 1894 parse_str(parse_url($url,PHP_URL_QUERY), $params); // Extract video ID and get thumbnail
1895 if (!empty($params['v'])) return array('src'=>'http://img.youtube.com/vi/'.$params['v'].'/default.jpg', 1895 if (!empty($params['v'])) return array('src'=>'https://img.youtube.com/vi/'.$params['v'].'/default.jpg',
1896 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail'); 1896 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail');
1897 } 1897 }
1898 if ($domain=='youtu.be') // Youtube short links 1898 if ($domain=='youtu.be') // Youtube short links
1899 { 1899 {
1900 $path = parse_url($url,PHP_URL_PATH); 1900 $path = parse_url($url,PHP_URL_PATH);
1901 return array('src'=>'http://img.youtube.com/vi'.$path.'/default.jpg', 1901 return array('src'=>'https://img.youtube.com/vi'.$path.'/default.jpg',
1902 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail'); 1902 'href'=>$href,'width'=>'120','height'=>'90','alt'=>'YouTube thumbnail');
1903 } 1903 }
1904 if ($domain=='pix.toile-libre.org') // pix.toile-libre.org image hosting 1904 if ($domain=='pix.toile-libre.org') // pix.toile-libre.org image hosting
@@ -1912,18 +1912,18 @@ function computeThumbnail($url,$href=false)
1912 { 1912 {
1913 $path = parse_url($url,PHP_URL_PATH); 1913 $path = parse_url($url,PHP_URL_PATH);
1914 if (startsWith($path,'/a/')) return array(); // Thumbnails for albums are not available. 1914 if (startsWith($path,'/a/')) return array(); // Thumbnails for albums are not available.
1915 if (startsWith($path,'/r/')) return array('src'=>'http://i.imgur.com/'.basename($path).'s.jpg', 1915 if (startsWith($path,'/r/')) return array('src'=>'https://i.imgur.com/'.basename($path).'s.jpg',
1916 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1916 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1917 if (startsWith($path,'/gallery/')) return array('src'=>'http://i.imgur.com'.substr($path,8).'s.jpg', 1917 if (startsWith($path,'/gallery/')) return array('src'=>'https://i.imgur.com'.substr($path,8).'s.jpg',
1918 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1918 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1919 1919
1920 if (substr_count($path,'/')==1) return array('src'=>'http://i.imgur.com/'.substr($path,1).'s.jpg', 1920 if (substr_count($path,'/')==1) return array('src'=>'https://i.imgur.com/'.substr($path,1).'s.jpg',
1921 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1921 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1922 } 1922 }
1923 if ($domain=='i.imgur.com') 1923 if ($domain=='i.imgur.com')
1924 { 1924 {
1925 $pi = pathinfo(parse_url($url,PHP_URL_PATH)); 1925 $pi = pathinfo(parse_url($url,PHP_URL_PATH));
1926 if (!empty($pi['filename'])) return array('src'=>'http://i.imgur.com/'.$pi['filename'].'s.jpg', 1926 if (!empty($pi['filename'])) return array('src'=>'https://i.imgur.com/'.$pi['filename'].'s.jpg',
1927 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail'); 1927 'href'=>$href,'width'=>'90','height'=>'90','alt'=>'imgur.com thumbnail');
1928 } 1928 }
1929 if ($domain=='dailymotion.com' || $domain=='www.dailymotion.com') 1929 if ($domain=='dailymotion.com' || $domain=='www.dailymotion.com')
@@ -2354,7 +2354,7 @@ function genThumbnail()
2354 // This is more complex: we have to perform a HTTP request, then parse the result. 2354 // This is more complex: we have to perform a HTTP request, then parse the result.
2355 // Maybe we should deport this to JavaScript ? Example: http://stackoverflow.com/questions/1361149/get-img-thumbnails-from-vimeo/4285098#4285098 2355 // Maybe we should deport this to JavaScript ? Example: http://stackoverflow.com/questions/1361149/get-img-thumbnails-from-vimeo/4285098#4285098
2356 $vid = substr(parse_url($url,PHP_URL_PATH),1); 2356 $vid = substr(parse_url($url,PHP_URL_PATH),1);
2357 list($httpstatus,$headers,$data) = getHTTP('http://vimeo.com/api/v2/video/'.htmlspecialchars($vid).'.php',5); 2357 list($httpstatus,$headers,$data) = getHTTP('https://vimeo.com/api/v2/video/'.htmlspecialchars($vid).'.php',5);
2358 if (strpos($httpstatus,'200 OK')!==false) 2358 if (strpos($httpstatus,'200 OK')!==false)
2359 { 2359 {
2360 $t = unserialize($data); 2360 $t = unserialize($data);