Merge pull request #1199 from ArthurHoaro/hotfix/thumbnails-edit-link

Fix issue 'You are not authorized to add a link' with thumbnails enabled
This commit is contained in:
ArthurHoaro 2018-08-11 13:36:47 +02:00 committed by GitHub
commit 1c88a7b33e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -502,7 +502,7 @@ public function updateMethodWebThumbnailer()
return true; return true;
} }
$thumbnailsEnabled = $this->conf->get('thumbnail.enable_thumbnails', true); $thumbnailsEnabled = extension_loaded('gd') && $this->conf->get('thumbnail.enable_thumbnails', true);
$this->conf->set('thumbnails.mode', $thumbnailsEnabled ? Thumbnailer::MODE_ALL : Thumbnailer::MODE_NONE); $this->conf->set('thumbnails.mode', $thumbnailsEnabled ? Thumbnailer::MODE_ALL : Thumbnailer::MODE_NONE);
$this->conf->set('thumbnails.width', 125); $this->conf->set('thumbnails.width', 125);
$this->conf->set('thumbnails.height', 90); $this->conf->set('thumbnails.height', 90);

View file

@ -1635,9 +1635,9 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
uasort($taglist, 'strcasecmp'); uasort($taglist, 'strcasecmp');
$link['taglist'] = $taglist; $link['taglist'] = $taglist;
// Thumbnails enabled, not a note, // Logged in, thumbnails enabled, not a note,
// and (never retrieved yet or no valid cache file) // and (never retrieved yet or no valid cache file)
if ($thumbnailsEnabled && $link['url'][0] != '?' if ($loginManager->isLoggedIn() && $thumbnailsEnabled && $link['url'][0] != '?'
&& (! isset($link['thumbnail']) || ($link['thumbnail'] !== false && ! is_file($link['thumbnail']))) && (! isset($link['thumbnail']) || ($link['thumbnail'] !== false && ! is_file($link['thumbnail'])))
) { ) {
$elem = $LINKSDB[$keys[$i]]; $elem = $LINKSDB[$keys[$i]];