diff options
author | ArthurHoaro <arthur@hoa.ro> | 2019-02-09 14:13:08 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2019-02-24 12:25:50 +0100 |
commit | a8e7da01146455f13ef06b151a7dafedd3acf769 (patch) | |
tree | b8278b8fb78fd40183e4273e880b85555358c6de /index.php | |
parent | 905f8675a728841b03b300d2c7dc909a1c4f7f03 (diff) | |
download | Shaarli-a8e7da01146455f13ef06b151a7dafedd3acf769.tar.gz Shaarli-a8e7da01146455f13ef06b151a7dafedd3acf769.tar.zst Shaarli-a8e7da01146455f13ef06b151a7dafedd3acf769.zip |
Do not try to retrieve thumbnails for internal link
Also adds a helper function to determine if a link is a note and apply it across multiple files.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -362,7 +362,7 @@ function showDailyRSS($conf, $loginManager) | |||
362 | $conf->get('redirector.encode_url') | 362 | $conf->get('redirector.encode_url') |
363 | ); | 363 | ); |
364 | $link['timestamp'] = $link['created']->getTimestamp(); | 364 | $link['timestamp'] = $link['created']->getTimestamp(); |
365 | if (startsWith($link['url'], '?')) { | 365 | if (is_note($link['url'])) { |
366 | $link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute | 366 | $link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute |
367 | } | 367 | } |
368 | } | 368 | } |
@@ -1176,7 +1176,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1176 | $link['title'] = $link['url']; | 1176 | $link['title'] = $link['url']; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | if ($conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE) { | 1179 | if ($conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE |
1180 | && ! is_note($link['url']) | ||
1181 | ) { | ||
1180 | $thumbnailer = new Thumbnailer($conf); | 1182 | $thumbnailer = new Thumbnailer($conf); |
1181 | $link['thumbnail'] = $thumbnailer->get($url); | 1183 | $link['thumbnail'] = $thumbnailer->get($url); |
1182 | } | 1184 | } |
@@ -1558,7 +1560,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1558 | $ids = []; | 1560 | $ids = []; |
1559 | foreach ($LINKSDB as $link) { | 1561 | foreach ($LINKSDB as $link) { |
1560 | // A note or not HTTP(S) | 1562 | // A note or not HTTP(S) |
1561 | if ($link['url'][0] === '?' || ! startsWith(strtolower($link['url']), 'http')) { | 1563 | if (is_note($link['url']) || ! startsWith(strtolower($link['url']), 'http')) { |
1562 | continue; | 1564 | continue; |
1563 | } | 1565 | } |
1564 | $ids[] = $link['id']; | 1566 | $ids[] = $link['id']; |