Take code review into account

Upgrade web-thumbnailer and display thumbs right after download
This commit is contained in:
ArthurHoaro 2018-04-06 18:21:47 +02:00
parent 8b5b7dcc83
commit 787faa42f3
8 changed files with 133 additions and 89 deletions

View File

@ -32,6 +32,14 @@ class Thumbnailer
public function __construct($conf) public function __construct($conf)
{ {
$this->conf = $conf; $this->conf = $conf;
if (! $this->checkRequirements()) {
$this->conf->set('thumbnails.enabled', false);
$this->conf->write(true);
// TODO: create a proper error handling system able to catch exceptions...
die(t('php-gd extension must be loaded to use thumbnails. Thumbnails are now disabled. Please reload the page.'));
}
$this->wt = new WebThumbnailer(); $this->wt = new WebThumbnailer();
WTConfigManager::addFile('inc/web-thumbnailer.json'); WTConfigManager::addFile('inc/web-thumbnailer.json');
$this->wt->maxWidth($this->conf->get('thumbnails.width')) $this->wt->maxWidth($this->conf->get('thumbnails.width'))
@ -57,4 +65,13 @@ class Thumbnailer
return false; return false;
} }
} }
/**
* Make sure that requirements are match to use thumbnails:
* - php-gd is loaded
*/
protected function checkRequirements()
{
return extension_loaded('gd');
}
} }

View File

@ -19,7 +19,7 @@
"shaarli/netscape-bookmark-parser": "^2.0", "shaarli/netscape-bookmark-parser": "^2.0",
"erusev/parsedown": "^1.6", "erusev/parsedown": "^1.6",
"slim/slim": "^3.0", "slim/slim": "^3.0",
"arthurhoaro/web-thumbnailer": "^1.0", "arthurhoaro/web-thumbnailer": "^1.1",
"pubsubhubbub/publisher": "dev-master", "pubsubhubbub/publisher": "dev-master",
"gettext/gettext": "^4.4" "gettext/gettext": "^4.4"
}, },

130
composer.lock generated
View File

@ -1,30 +1,35 @@
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "efa8b74ec9a15bb8c18e4a36fd13d480", "content-hash": "da7a0c081b61d949154c5d2e5370cbab",
"packages": [ "packages": [
{ {
"name": "arthurhoaro/web-thumbnailer", "name": "arthurhoaro/web-thumbnailer",
"version": "v1.0.1", "version": "v1.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ArthurHoaro/web-thumbnailer.git", "url": "https://github.com/ArthurHoaro/web-thumbnailer.git",
"reference": "10e2919c2aa0bf55f4593c8b05508a98c79d6706" "reference": "21cf6493014cb0949a7485bfc170763d964aefd4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ArthurHoaro/web-thumbnailer/zipball/10e2919c2aa0bf55f4593c8b05508a98c79d6706", "url": "https://api.github.com/repos/ArthurHoaro/web-thumbnailer/zipball/21cf6493014cb0949a7485bfc170763d964aefd4",
"reference": "10e2919c2aa0bf55f4593c8b05508a98c79d6706", "reference": "21cf6493014cb0949a7485bfc170763d964aefd4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.6" "php": ">=5.6"
}, },
"conflict": {
"phpunit/php-timer": ">=2"
},
"require-dev": { "require-dev": {
"phpunit/phpunit": "5.2.*" "php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "5.2.*",
"squizlabs/php_codesniffer": "^3.2"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -45,7 +50,8 @@
"homepage": "http://hoa.ro" "homepage": "http://hoa.ro"
} }
], ],
"time": "2017-11-11T15:39:49+00:00" "description": "PHP library which will retrieve a thumbnail for any given URL",
"time": "2018-05-05T10:32:59+00:00"
}, },
{ {
"name": "container-interop/container-interop", "name": "container-interop/container-interop",
@ -126,16 +132,16 @@
}, },
{ {
"name": "gettext/gettext", "name": "gettext/gettext",
"version": "v4.4.4", "version": "v4.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/oscarotero/Gettext.git", "url": "https://github.com/oscarotero/Gettext.git",
"reference": "ab5e863de2f60806d02e6e6081e21efd45249168" "reference": "81c05cb213e8e4828db7aabd9dd363367ebca9f2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/oscarotero/Gettext/zipball/ab5e863de2f60806d02e6e6081e21efd45249168", "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/81c05cb213e8e4828db7aabd9dd363367ebca9f2",
"reference": "ab5e863de2f60806d02e6e6081e21efd45249168", "reference": "81c05cb213e8e4828db7aabd9dd363367ebca9f2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -184,7 +190,7 @@
"po", "po",
"translation" "translation"
], ],
"time": "2018-02-21T18:49:59+00:00" "time": "2018-04-23T17:22:10+00:00"
}, },
{ {
"name": "gettext/languages", "name": "gettext/languages",
@ -639,16 +645,16 @@
}, },
{ {
"name": "slim/slim", "name": "slim/slim",
"version": "3.9.2", "version": "3.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/slimphp/Slim.git", "url": "https://github.com/slimphp/Slim.git",
"reference": "4086d0106cf5a7135c69fce4161fe355a8feb118" "reference": "d8aabeacc3688b25e2f2dd2db91df91ec6fdd748"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/4086d0106cf5a7135c69fce4161fe355a8feb118", "url": "https://api.github.com/repos/slimphp/Slim/zipball/d8aabeacc3688b25e2f2dd2db91df91ec6fdd748",
"reference": "4086d0106cf5a7135c69fce4161fe355a8feb118", "reference": "d8aabeacc3688b25e2f2dd2db91df91ec6fdd748",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -706,7 +712,7 @@
"micro", "micro",
"router" "router"
], ],
"time": "2017-11-26T19:13:09+00:00" "time": "2018-04-19T19:29:08+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -1063,23 +1069,23 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "1.7.5", "version": "1.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2", "doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0", "php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"sebastian/comparator": "^1.1|^2.0", "sebastian/comparator": "^1.1|^2.0|^3.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0" "sebastian/recursion-context": "^1.0|^2.0|^3.0"
}, },
"require-dev": { "require-dev": {
@ -1122,7 +1128,7 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2018-02-19T10:16:54+00:00" "time": "2018-04-18T13:57:24+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -2248,16 +2254,16 @@
}, },
{ {
"name": "symfony/config", "name": "symfony/config",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/config.git", "url": "https://github.com/symfony/config.git",
"reference": "05e10567b529476a006b00746c5f538f1636810e" "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/05e10567b529476a006b00746c5f538f1636810e", "url": "https://api.github.com/repos/symfony/config/zipball/7c2a9d44f4433863e9bca682e7f03609234657f9",
"reference": "05e10567b529476a006b00746c5f538f1636810e", "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2307,20 +2313,20 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-02-14T10:03:57+00:00" "time": "2018-03-19T22:32:39+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "067339e9b8ec30d5f19f5950208893ff026b94f7" "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/067339e9b8ec30d5f19f5950208893ff026b94f7", "url": "https://api.github.com/repos/symfony/console/zipball/5b1fdfa8eb93464bcc36c34da39cedffef822cdf",
"reference": "067339e9b8ec30d5f19f5950208893ff026b94f7", "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2341,7 +2347,7 @@
"symfony/process": "~3.3|~4.0" "symfony/process": "~3.3|~4.0"
}, },
"suggest": { "suggest": {
"psr/log": "For using the console logger", "psr/log-implementation": "For using the console logger",
"symfony/event-dispatcher": "", "symfony/event-dispatcher": "",
"symfony/lock": "", "symfony/lock": "",
"symfony/process": "" "symfony/process": ""
@ -2376,20 +2382,20 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-02-26T15:46:28+00:00" "time": "2018-04-30T01:22:56+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
"reference": "9b1071f86e79e1999b3d3675d2e0e7684268b9bc" "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/9b1071f86e79e1999b3d3675d2e0e7684268b9bc", "url": "https://api.github.com/repos/symfony/debug/zipball/1b95888cfd996484527cb41e8952d9a5eaf7454f",
"reference": "9b1071f86e79e1999b3d3675d2e0e7684268b9bc", "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2432,20 +2438,20 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-02-28T21:49:22+00:00" "time": "2018-04-30T16:53:52+00:00"
}, },
{ {
"name": "symfony/dependency-injection", "name": "symfony/dependency-injection",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dependency-injection.git", "url": "https://github.com/symfony/dependency-injection.git",
"reference": "12e901abc1cb0d637a0e5abe9923471361d96b07" "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/12e901abc1cb0d637a0e5abe9923471361d96b07", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54ff9d78b56429f9a1ac12e60bfb6d169c0468e3",
"reference": "12e901abc1cb0d637a0e5abe9923471361d96b07", "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2503,11 +2509,11 @@
], ],
"description": "Symfony DependencyInjection Component", "description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-03-04T03:54:53+00:00" "time": "2018-04-29T14:04:08+00:00"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
@ -2556,16 +2562,16 @@
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "a479817ce0a9e4adfd7d39c6407c95d97c254625" "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/a479817ce0a9e4adfd7d39c6407c95d97c254625", "url": "https://api.github.com/repos/symfony/finder/zipball/bd14efe8b1fabc4de82bf50dce62f05f9a102433",
"reference": "a479817ce0a9e4adfd7d39c6407c95d97c254625", "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2601,20 +2607,20 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-03-05T18:28:11+00:00" "time": "2018-04-04T05:07:11+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.7.0", "version": "v1.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" "reference": "3296adf6a6454a050679cde90f95350ad604b171"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", "reference": "3296adf6a6454a050679cde90f95350ad604b171",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2626,7 +2632,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.7-dev" "dev-master": "1.8-dev"
} }
}, },
"autoload": { "autoload": {
@ -2660,20 +2666,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-01-30T19:27:44+00:00" "time": "2018-04-26T10:06:28+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.4.6", "version": "v3.4.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "6af42631dcf89e9c616242c900d6c52bd53bd1bb" "reference": "033cfa61ef06ee0847e056e530201842b6e926c3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/6af42631dcf89e9c616242c900d6c52bd53bd1bb", "url": "https://api.github.com/repos/symfony/yaml/zipball/033cfa61ef06ee0847e056e530201842b6e926c3",
"reference": "6af42631dcf89e9c616242c900d6c52bd53bd1bb", "reference": "033cfa61ef06ee0847e056e530201842b6e926c3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2718,7 +2724,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-02-16T09:50:28+00:00" "time": "2018-04-08T08:21:29+00:00"
}, },
{ {
"name": "theseer/fdomdocument", "name": "theseer/fdomdocument",

View File

@ -29,7 +29,7 @@ Extension | Required? | Usage
---|:---:|--- ---|:---:|---
[`openssl`](http://php.net/manual/en/book.openssl.php) | All | OpenSSL, HTTPS [`openssl`](http://php.net/manual/en/book.openssl.php) | All | OpenSSL, HTTPS
[`php-mbstring`](http://php.net/manual/en/book.mbstring.php) | CentOS, Fedora, RHEL, Windows, some hosting providers | multibyte (Unicode) string support [`php-mbstring`](http://php.net/manual/en/book.mbstring.php) | CentOS, Fedora, RHEL, Windows, some hosting providers | multibyte (Unicode) string support
[`php-gd`](http://php.net/manual/en/book.image.php) | optional | thumbnail resizing [`php-gd`](http://php.net/manual/en/book.image.php) | optional | required to use thumbnails
[`php-intl`](http://php.net/manual/en/book.intl.php) | optional | localized text sorting (e.g. `e->è->f`) [`php-intl`](http://php.net/manual/en/book.intl.php) | optional | localized text sorting (e.g. `e->è->f`)
[`php-curl`](http://php.net/manual/en/book.curl.php) | optional | using cURL for fetching webpages and thumbnails in a more robust way [`php-curl`](http://php.net/manual/en/book.curl.php) | optional | using cURL for fetching webpages and thumbnails in a more robust way
[`php-gettext`](http://php.net/manual/en/book.gettext.php) | optional | Use the translation system in gettext mode (faster) [`php-gettext`](http://php.net/manual/en/book.gettext.php) | optional | Use the translation system in gettext mode (faster)

View File

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Shaarli\n" "Project-Id-Version: Shaarli\n"
"POT-Creation-Date: 2018-05-05 12:47+0200\n" "POT-Creation-Date: 2018-05-05 12:48+0200\n"
"PO-Revision-Date: 2018-05-05 12:47+0200\n" "PO-Revision-Date: 2018-05-05 12:49+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: Shaarli\n" "Language-Team: Shaarli\n"
"Language: fr_FR\n" "Language: fr_FR\n"
@ -180,6 +180,14 @@ msgstr "404 Introuvable"
msgid "Plugin \"%s\" files not found." msgid "Plugin \"%s\" files not found."
msgstr "Les fichiers de l'extension \"%s\" sont introuvables." msgstr "Les fichiers de l'extension \"%s\" sont introuvables."
#: application/Thumbnailer.php:40
msgid ""
"php-gd extension must be loaded to use thumbnails. Thumbnails are now "
"disabled. Please reload the page."
msgstr ""
"php-gd extension must be loaded to use thumbnails. Thumbnails are now "
"disabled. Please reload the page."
#: application/Updater.php:76 #: application/Updater.php:76
msgid "Couldn't retrieve Updater class methods." msgid "Couldn't retrieve Updater class methods."
msgstr "Impossible de récupérer les méthodes de la classe Updater." msgstr "Impossible de récupérer les méthodes de la classe Updater."
@ -311,7 +319,7 @@ msgid "You are not supposed to change a password on an Open Shaarli."
msgstr "" msgstr ""
"Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert." "Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert."
#: index.php:1070 index.php:1112 index.php:1189 index.php:1220 index.php:1325 #: index.php:1070 index.php:1112 index.php:1190 index.php:1221 index.php:1326
msgid "Wrong token." msgid "Wrong token."
msgstr "Jeton invalide." msgstr "Jeton invalide."
@ -333,56 +341,56 @@ msgstr "Modification du mot de passe"
msgid "Configuration was saved." msgid "Configuration was saved."
msgstr "La configuration a été sauvegardé." msgstr "La configuration a été sauvegardé."
#: index.php:1172 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 #: index.php:1173 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24
msgid "Configure" msgid "Configure"
msgstr "Configurer" msgstr "Configurer"
#: index.php:1183 tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13 #: index.php:1184 tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
msgid "Manage tags" msgid "Manage tags"
msgstr "Gérer les tags" msgstr "Gérer les tags"
#: index.php:1201 #: index.php:1202
#, php-format #, php-format
msgid "The tag was removed from %d link." msgid "The tag was removed from %d link."
msgid_plural "The tag was removed from %d links." msgid_plural "The tag was removed from %d links."
msgstr[0] "Le tag a été supprimé de %d lien." msgstr[0] "Le tag a été supprimé de %d lien."
msgstr[1] "Le tag a été supprimé de %d liens." msgstr[1] "Le tag a été supprimé de %d liens."
#: index.php:1202 #: index.php:1203
#, php-format #, php-format
msgid "The tag was renamed in %d link." msgid "The tag was renamed in %d link."
msgid_plural "The tag was renamed in %d links." msgid_plural "The tag was renamed in %d links."
msgstr[0] "Le tag a été renommé dans %d lien." msgstr[0] "Le tag a été renommé dans %d lien."
msgstr[1] "Le tag a été renommé dans %d liens." msgstr[1] "Le tag a été renommé dans %d liens."
#: index.php:1210 tmp/addlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13 #: index.php:1211 tmp/addlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
msgid "Shaare a new link" msgid "Shaare a new link"
msgstr "Partager un nouveau lien" msgstr "Partager un nouveau lien"
#: index.php:1385 tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:169 #: index.php:1386 tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:169
msgid "Edit" msgid "Edit"
msgstr "Modifier" msgstr "Modifier"
#: index.php:1385 index.php:1455 #: index.php:1386 index.php:1456
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26 #: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:26 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:26
msgid "Shaare" msgid "Shaare"
msgstr "Shaare" msgstr "Shaare"
#: index.php:1424 #: index.php:1425
msgid "Note: " msgid "Note: "
msgstr "Note : " msgstr "Note : "
#: index.php:1464 tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65 #: index.php:1465 tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65
msgid "Export" msgid "Export"
msgstr "Exporter" msgstr "Exporter"
#: index.php:1526 tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:83 #: index.php:1527 tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:83
msgid "Import" msgid "Import"
msgstr "Importer" msgstr "Importer"
#: index.php:1536 #: index.php:1537
#, php-format #, php-format
msgid "" msgid ""
"The file you are trying to upload is probably bigger than what this " "The file you are trying to upload is probably bigger than what this "
@ -392,16 +400,16 @@ msgstr ""
"le serveur web peut accepter (%s). Merci de l'envoyer en parties plus " "le serveur web peut accepter (%s). Merci de l'envoyer en parties plus "
"légères." "légères."
#: index.php:1575 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26 #: index.php:1576 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26
#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22
msgid "Plugin administration" msgid "Plugin administration"
msgstr "Administration des extensions" msgstr "Administration des extensions"
#: index.php:1759 #: index.php:1761
msgid "Search: " msgid "Search: "
msgstr "Recherche : " msgstr "Recherche : "
#: index.php:1798 #: index.php:1800
#, php-format #, php-format
msgid "" msgid ""
"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the " "<pre>Sessions do not seem to work correctly on your server.<br>Make sure the "
@ -420,7 +428,7 @@ msgstr ""
"cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse " "cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse "
"IP ou un <em>Fully Qualified Domain Name</em>.<br>" "IP ou un <em>Fully Qualified Domain Name</em>.<br>"
#: index.php:1808 #: index.php:1810
msgid "Click to try again." msgid "Click to try again."
msgstr "Cliquer ici pour réessayer." msgstr "Cliquer ici pour réessayer."
@ -747,20 +755,26 @@ msgstr "Activer les miniatures"
msgid "Warning: " msgid "Warning: "
msgstr "Attention : " msgstr "Attention : "
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:281 #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:283
msgid "It's recommended to visit the picture wall after enabling this feature." msgid "It's recommended to visit the picture wall after enabling this feature."
msgstr "" msgstr ""
"Il est recommandé de visiter le Mur d'images après avoir activé cette " "Il est recommandé de visiter le Mur d'images après avoir activé cette "
"fonctionnalité." "fonctionnalité."
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:283 #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:285
msgid "" msgid ""
"If you have a large database, the first retrieval may take a few minutes." "If you have a large database, the first retrieval may take a few minutes."
msgstr "" msgstr ""
"Si vous avez beaucoup de liens, la première récupération peut prendre " "Si vous avez beaucoup de liens, la première récupération peut prendre "
"plusieurs minutes." "plusieurs minutes."
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:297 #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:289
msgid "You need to enable the extension <code>php-gd</code> to use thumbnails."
msgstr ""
"Vous devez activer l'extension <code>php-gd</code> pour utiliser les "
"miniatures."
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:305
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72 #: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:139 #: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:139
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:199 #: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:199

View File

@ -1,6 +1,7 @@
{ {
"settings": { "settings": {
"default": { "default": {
"download_mode": "HOTLINK",
"_comment": "infinite cache", "_comment": "infinite cache",
"cache_duration": -1, "cache_duration": -1,
"timeout": 10 "timeout": 10

View File

@ -1036,7 +1036,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
$conf->set('api.enabled', !empty($_POST['enableApi'])); $conf->set('api.enabled', !empty($_POST['enableApi']));
$conf->set('api.secret', escape($_POST['apiSecret'])); $conf->set('api.secret', escape($_POST['apiSecret']));
$conf->set('translation.language', escape($_POST['language'])); $conf->set('translation.language', escape($_POST['language']));
$conf->set('thumbnails.enabled', !empty($_POST['enableThumbnails'])); $conf->set('thumbnails.enabled', extension_loaded('gd') && !empty($_POST['enableThumbnails']));
try { try {
$conf->write($loginManager->isLoggedIn()); $conf->write($loginManager->isLoggedIn());
@ -1076,6 +1076,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
$PAGE->assign('api_secret', $conf->get('api.secret')); $PAGE->assign('api_secret', $conf->get('api.secret'));
$PAGE->assign('languages', Languages::getAvailableLanguages()); $PAGE->assign('languages', Languages::getAvailableLanguages());
$PAGE->assign('language', $conf->get('translation.language')); $PAGE->assign('language', $conf->get('translation.language'));
$PAGE->assign('gd_enabled', extension_loaded('gd'));
$PAGE->assign('pagetitle', t('Configure') .' - '. $conf->get('general.title', 'Shaarli')); $PAGE->assign('pagetitle', t('Configure') .' - '. $conf->get('general.title', 'Shaarli'));
$PAGE->renderPage('configure'); $PAGE->renderPage('configure');
exit; exit;
@ -1618,6 +1619,7 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
$elem['thumbnail'] = $thumbnailer->get($link['url']); $elem['thumbnail'] = $thumbnailer->get($link['url']);
$LINKSDB[$keys[$i]] = $elem; $LINKSDB[$keys[$i]] = $elem;
$updateDB = true; $updateDB = true;
$link['thumbnail'] = $elem['thumbnail'];
} }
// Check for both signs of a note: starting with ? and 7 chars long. // Check for both signs of a note: starting with ? and 7 chars long.

View File

@ -249,8 +249,12 @@
<span class="label-name">{'Enable thumbnails'|t}</span><br> <span class="label-name">{'Enable thumbnails'|t}</span><br>
<span class="label-desc"> <span class="label-desc">
{'Warning: '|t} {'Warning: '|t}
{'It\'s recommended to visit the picture wall after enabling this feature.'|t} {if="$gd_enabled"}
{'If you have a large database, the first retrieval may take a few minutes.'|t} {'It\'s recommended to visit the picture wall after enabling this feature.'|t}
{'If you have a large database, the first retrieval may take a few minutes.'|t}
{else}
{'You need to enable the extension <code>php-gd</code> to use thumbnails.'|t}
{/if}
</span> </span>
</label> </label>
</div> </div>
@ -258,7 +262,7 @@
<div class="pure-u-lg-{$ratioInput} pure-u-{$ratioInputMobile}"> <div class="pure-u-lg-{$ratioInput} pure-u-{$ratioInputMobile}">
<div class="form-input"> <div class="form-input">
<input type="checkbox" name="enableThumbnails" id="enableThumbnails" <input type="checkbox" name="enableThumbnails" id="enableThumbnails"
{if="$thumbnails_enabled"}checked{/if}/> {if="$thumbnails_enabled"}checked{/if} {if="!$gd_enabled"}disabled{/if} />
</div> </div>
</div> </div>
</div> </div>