From 9c91a17ba891666b46ef8c234fc3d2bc07e0a0c4 Mon Sep 17 00:00:00 2001 From: llune Date: Thu, 2 Aug 2018 20:47:47 +0200 Subject: [PATCH 01/36] Maj French translation --- inc/languages/fr/LC_MESSAGES/shaarli.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index 155eb52..5c2e213 100644 --- a/inc/languages/fr/LC_MESSAGES/shaarli.po +++ b/inc/languages/fr/LC_MESSAGES/shaarli.po @@ -1251,7 +1251,7 @@ msgstr "Changer les paramètres de Shaarli : titre, fuseau horaire, etc." #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:17 msgid "Configure your Shaarli" -msgstr "Conguration de Shaarli" +msgstr "Configurer Shaarli" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:21 msgid "Enable, disable and configure plugins" @@ -1259,11 +1259,11 @@ msgstr "Activer, désactiver et configurer les extensions" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:28 msgid "Change your password" -msgstr "Modification du mot de passe" +msgstr "Modifier le mot de passe" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:35 msgid "Rename or delete a tag in all links" -msgstr "Rename or delete a tag in all links" +msgstr "Renommer ou supprimer un tag dans tous les liens" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 msgid "" @@ -1283,7 +1283,7 @@ msgid "" "Opera, delicious...)" msgstr "" "Exporter les marques pages au format Netscape HTML (comme exportés depuis " -"Firefox, Chrome, Opera, delicious...)" +"Firefox, Chrome, Opera, delicious…)" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48 msgid "Export database" From a71d6641f6520e0c58b52d70f1c3387fe4c798d6 Mon Sep 17 00:00:00 2001 From: llune Date: Thu, 2 Aug 2018 20:49:23 +0200 Subject: [PATCH 02/36] fix boutton --- inc/languages/fr/LC_MESSAGES/shaarli.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index 5c2e213..9898dcd 100644 --- a/inc/languages/fr/LC_MESSAGES/shaarli.po +++ b/inc/languages/fr/LC_MESSAGES/shaarli.po @@ -1298,7 +1298,7 @@ msgid "" "Drag one of these button to your bookmarks toolbar or right-click it and " "\"Bookmark This Link\"" msgstr "" -"Glisser un de ces bouttons dans votre barre de favoris ou cliquer droit " +"Glisser un de ces boutons dans votre barre de favoris ou cliquer droit " "dessus et « Ajouter aux favoris »" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:82 From d0e8ca9224a092fc6b8e45bb4e2a1e741dc38d91 Mon Sep 17 00:00:00 2001 From: llune Date: Thu, 2 Aug 2018 21:11:13 +0200 Subject: [PATCH 03/36] update translation --- inc/languages/fr/LC_MESSAGES/shaarli.po | 52 ++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index 9898dcd..5fd0f77 100644 --- a/inc/languages/fr/LC_MESSAGES/shaarli.po +++ b/inc/languages/fr/LC_MESSAGES/shaarli.po @@ -48,7 +48,7 @@ msgstr "le fichier n'est pas accessible en écriture" #: application/Cache.php:16 #, php-format msgid "Cannot purge %s: no directory" -msgstr "Impossible de purger %s: le répertoire n'existe pas" +msgstr "Impossible de purger %s : le répertoire n'existe pas" #: application/FeedBuilder.php:151 msgid "Direct link" @@ -98,7 +98,7 @@ msgstr "Vous devez utiliser un entier comme clé." #: application/LinkDB.php:145 msgid "Array offset and link ID must be equal." -msgstr "La clé du tableau et l'ID du lien doivent être égaux." +msgstr "La clé du tableau et l'ID du lien doivent être identiques." #: application/LinkDB.php:251 #: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 @@ -108,7 +108,7 @@ msgstr "La clé du tableau et l'ID du lien doivent être égaux." msgid "" "The personal, minimalist, super-fast, database free, bookmarking service" msgstr "" -"Le gestionnaire de marque-page personnel, minimaliste, et sans base de " +"Le gestionnaire de marque-pages personnel, minimaliste, et sans base de " "données" #: application/LinkDB.php:253 @@ -125,11 +125,11 @@ msgstr "" "Bienvenue sur Shaarli ! Ceci est votre premier marque-page public. Pour me " "modifier ou me supprimer, vous devez d'abord vous connecter.\n" "\n" -"Pour apprendre comment utiliser Shaarli, consultez le lien « Documentation » " +"Pour apprendre à utiliser Shaarli, consultez le lien « Documentation » " "en bas de page.\n" "\n" "Vous utilisez la version supportée par la communauté du projet original " -"Shaarli, de Sébastien Sauvage." +"Shaarli de Sébastien Sauvage." #: application/LinkDB.php:267 msgid "My secret stuff... - Pastebin.com" @@ -185,8 +185,8 @@ 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." +"l'extension php-gd doit être chargée pour utiliser les miniatures. Les miniatures sont désormais " +"désactivées. Rechargez la page." #: application/Updater.php:86 msgid "Couldn't retrieve Updater class methods." @@ -286,7 +286,7 @@ msgstr "NON. Vous êtes banni pour le moment. Revenez plus tard." #: index.php:273 msgid "Wrong login/password." -msgstr "Nom d'utilisateur ou mot de passe incorrects." +msgstr "Nom d'utilisateur ou mot de passe incorrect(s)." #: index.php:483 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:46 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:46 @@ -343,11 +343,11 @@ msgstr "Votre mot de passe a été modifié" #: tmp/changepassword.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:29 msgid "Change password" -msgstr "Modification du mot de passe" +msgstr "Modifier le mot de passe" #: index.php:1043 msgid "Configuration was saved." -msgstr "La configuration a été sauvegardé." +msgstr "La configuration a été sauvegardée." #: index.php:1068 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 msgid "Configure" @@ -411,7 +411,7 @@ msgstr "" #: index.php:1471 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22 msgid "Plugin administration" -msgstr "Administration des extensions" +msgstr "Administration des plugins" #: index.php:1523 tmp/thumbnails.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 msgid "Thumbnails update" @@ -431,9 +431,9 @@ msgid "" "custom hostname without a dot causes cookie storage to fail. We recommend " "accessing your server via it's IP address or Fully Qualified Domain Name.
" msgstr "" -"
Les sesssions ne semble pas fonctionner sur ce serveur.
Assurez vous " +"
Les sesssions ne semblent pas fonctionner sur ce serveur.
Assurez vous " "que la variable « session.save_path » est correctement définie dans votre " -"fichier de configuration PHP, et que vous y avez les droits d'écriture." +"fichier de configuration PHP, et que vous avez les droits d'écriture dessus." "
Ce paramètre pointe actuellement sur %s.
Sur certains navigateurs, " "accéder à votre serveur depuis un nom d'hôte comme « localhost » ou autre " "nom personnalisé sans point '.' entraine l'échec de la sauvegarde des " @@ -455,7 +455,7 @@ msgstr "Shaare" #: plugins/addlink_toolbar/addlink_toolbar.php:50 msgid "Adds the addlink input on the linklist page." -msgstr "Ajout le formulaire d'ajout de liens sur la page principale." +msgstr "Ajoute le formulaire d'ajout de liens sur la page principale." #: plugins/archiveorg/archiveorg.php:23 msgid "View on archive.org" @@ -471,7 +471,7 @@ msgid "" "developers." msgstr "" "Une extension de démonstration couvrant tous les cas d'utilisation pour les " -"designers et les développeurs." +"designers de thèmes et les développeurs d'extensions." #: plugins/isso/isso.php:20 msgid "" @@ -484,7 +484,7 @@ msgstr "" #: plugins/isso/isso.php:63 msgid "Let visitor comment your shaares on permalinks with Isso." msgstr "" -"Permet aux visiteurs de commenter vos shaares sur les permaliens avec Isso." +"Permettre aux visiteurs de commenter vos shaares sur les permaliens avec Isso." #: plugins/isso/isso.php:64 msgid "Isso server URL (without 'http://')" @@ -578,7 +578,7 @@ msgstr "Active la publication de flux vers PubSubHubbub." #: plugins/qrcode/qrcode.php:69 plugins/wallabag/wallabag.php:68 msgid "For each link, add a QRCode icon." -msgstr "Pour chaque liens, ajouter une icône de QRCode." +msgstr "Pour chaque lien, ajouter une icône de QRCode." #: plugins/wallabag/wallabag.php:21 msgid "" @@ -752,7 +752,7 @@ msgstr "Activer l'API REST" #: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:170 msgid "Allow third party software to use Shaarli such as mobile application" msgstr "" -"Permets aux applications tierces d'utiliser Shaarli, par exemple les " +"Permet aux applications tierces d'utiliser Shaarli, par exemple les " "applications mobiles" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:263 @@ -854,7 +854,7 @@ msgstr "Privé" #: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72 msgid "Apply Changes" -msgstr "Appliquer" +msgstr "Appliquer les changements" #: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16 msgid "Export Database" @@ -870,7 +870,7 @@ msgstr "Publics" #: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:52 msgid "Prepend note permalinks with this Shaarli instance's URL" -msgstr "Préfixer les liens de notes avec l'URL de l'instance de Shaarli" +msgstr "Préfixer les liens de note avec l'URL de l'instance de Shaarli" #: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:53 msgid "Useful to import bookmarks in a web browser" @@ -1066,7 +1066,7 @@ msgstr "Liens par page" msgid "" "You have been banned after too many failed login attempts. Try again later." msgstr "" -"Vous avez été banni après trop d'échec d'authentification. Merci de " +"Vous avez été banni après trop d'échecs d'authentification. Merci de " "réessayer plus tard." #: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 @@ -1268,10 +1268,10 @@ msgstr "Renommer ou supprimer un tag dans tous les liens" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 msgid "" "Import Netscape HTML bookmarks (as exported from Firefox, Chrome, Opera, " -"delicious...)" +"delicious…)" msgstr "" "Importer des marques pages au format Netscape HTML (comme exportés depuis " -"Firefox, Chrome, Opera, delicious...)" +"Firefox, Chrome, Opera, delicious…)" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:42 msgid "Import links" @@ -1280,7 +1280,7 @@ msgstr "Importer des liens" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:47 msgid "" "Export Netscape HTML bookmarks (which can be imported in Firefox, Chrome, " -"Opera, delicious...)" +"Opera, delicious…)" msgstr "" "Exporter les marques pages au format Netscape HTML (comme exportés depuis " "Firefox, Chrome, Opera, delicious…)" @@ -1304,7 +1304,7 @@ msgstr "" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:82 msgid "then click on the bookmarklet in any page you want to share." msgstr "" -"puis cliquer sur le marque page depuis un site que vous souhaitez partager." +"puis cliquer sur le marque-page depuis un site que vous souhaitez partager." #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:86 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:110 @@ -1450,7 +1450,7 @@ msgstr "" #~ "\n" #~ msgid "Sessions do not seem to work correctly on your server." -#~ msgstr "Les sessions ne semblent " +#~ msgstr "Les sessions ne semblent pas fonctionner correctement sur votre serveur." #~ msgid "Tag was renamed in " #~ msgstr "Le tag a été renommé dans " From 5de61c2ca74e1c43ebcd4aa2664d3b8875e3b712 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 11 Aug 2018 14:39:03 +0200 Subject: [PATCH 04/36] badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ff5460..0e23e33 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ _It is designed to be personal (single-user), fast and handy._ [![](https://img.shields.io/badge/stable-v0.9.7-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.9.7) [![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli) • -[![](https://img.shields.io/badge/latest-v0.10.1-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.10.1) +[![](https://img.shields.io/badge/latest-v0.10.2-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.10.2) [![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli) • [![](https://img.shields.io/badge/master-v0.10.x-blue.svg)](https://github.com/shaarli/Shaarli) From d94e6e69dd16e1dcf56f42ee97e0bcfb48214db2 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 13 Aug 2018 10:55:13 +0200 Subject: [PATCH 05/36] Fix input size for dropdown search form --- assets/default/scss/shaarli.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss index 6b286f1..b8578ea 100644 --- a/assets/default/scss/shaarli.scss +++ b/assets/default/scss/shaarli.scss @@ -381,8 +381,6 @@ body, box-shadow: 0 1px 0 $light-shadow, 0 1px 4px $dark-shadow inset; background: $almost-white; padding: 5px 5px 3px 15px; - width: 20%; - height: 20px; color: $dark-grey; } From a120fb2977331e0f7d7ffe05861ba179fdae8764 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 13 Aug 2018 10:42:27 +0200 Subject: [PATCH 06/36] Add OpenGraph meta tags on permalink page Includes: - og:title - og:type -> article - og:image -> if there is a thumbnail - og:url -> permalink - og:description -> first 300 chars of raw description - article:published_time - article:modified_time - article:tag -> one OG meta tag for each shaare tag Fixes #258 --- application/PageBuilder.php | 2 +- plugins/markdown/markdown.php | 1 + tests/plugins/PluginMarkdownTest.php | 2 ++ tpl/default/includes.html | 20 ++++++++++++++++++++ tpl/vintage/includes.html | 20 ++++++++++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/application/PageBuilder.php b/application/PageBuilder.php index b1abe0d..0efd24c 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -101,7 +101,7 @@ class PageBuilder 'version_hash', ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) ); - $this->tpl->assign('scripturl', index_url($_SERVER)); + $this->tpl->assign('index_url', index_url($_SERVER)); $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; $this->tpl->assign('visibility', $visibility); $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 821bb12..d4fb1f7 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -28,6 +28,7 @@ function hook_markdown_render_linklist($data, $conf) $value = stripNoMarkdownTag($value); continue; } + $value['description_src'] = $value['description']; $value['description'] = process_markdown( $value['description'], $conf->get('security.markdown_escape', true), diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index b31e817..31c1f8b 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -47,6 +47,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $data = hook_markdown_render_linklist($data, $this->conf); $this->assertNotFalse(strpos($data['links'][0]['description'], '

')); $this->assertNotFalse(strpos($data['links'][0]['description'], '

')); + + $this->assertEquals($markdown, $data['links'][0]['description_src']); } /** diff --git a/tpl/default/includes.html b/tpl/default/includes.html index 5ccacaa..0427e22 100644 --- a/tpl/default/includes.html +++ b/tpl/default/includes.html @@ -15,3 +15,23 @@ {/if} +{if="! empty($links) && count($links) === 1"} + {$link=reset($links)} + + + + {$ogDescription=isset($link.description_src) ? $link.description_src : $link.description} + + {if="$link.thumbnail"} + + {/if} + {if="!$hide_timestamps || $is_logged_in"} + + {if="$link.updated"} + + {/if} + {/if} + {loop="link.taglist"} + + {/loop} +{/if} diff --git a/tpl/vintage/includes.html b/tpl/vintage/includes.html index 410b466..df09349 100644 --- a/tpl/vintage/includes.html +++ b/tpl/vintage/includes.html @@ -12,3 +12,23 @@ {/loop} {if="is_file('data/user.css')"}{/if} +{if="! empty($links) && count($links) === 1"} + {$link=reset($links)} + + + + {$ogDescription=isset($link.description_src) ? $link.description_src : $link.description} + + {if="$link.thumbnail"} + + {/if} + {if="!$hide_timestamps || $is_logged_in"} + + {if="$link.updated"} + + {/if} + {/if} + {loop="link.taglist"} + + {/loop} +{/if} From 5d9bc40d7e48b8ac4829f9101f85b849d9199fa3 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 13 Aug 2018 12:21:10 +0200 Subject: [PATCH 07/36] Add CORS headers to REST API responses Fixes #1174 --- index.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.php b/index.php index 4b86a3e..9c1e499 100644 --- a/index.php +++ b/index.php @@ -1858,6 +1858,7 @@ $app->group('/api/v1', function() { })->add('\Shaarli\Api\ApiMiddleware'); $response = $app->run(true); + // Hack to make Slim and Shaarli router work together: // If a Slim route isn't found and NOT API call, we call renderPage(). if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v1') === false) { @@ -1865,5 +1866,12 @@ if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v header('Content-Type: text/html; charset=utf-8'); renderPage($conf, $pluginManager, $linkDb, $history, $sessionManager, $loginManager); } else { + $response = $response + ->withHeader('Access-Control-Allow-Origin', '*') + ->withHeader( + 'Access-Control-Allow-Headers', + 'X-Requested-With, Content-Type, Accept, Origin, Authorization' + ) + ->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); $app->respond($response); } From fc574e64544db2f7b56443a827e17d58c7561804 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 13 Aug 2018 13:13:26 +0200 Subject: [PATCH 08/36] Add a button to toggle all checkboxes of displayed links Related to #1160 --- assets/default/js/base.js | 27 +++++++++++++++++++++++---- assets/default/scss/shaarli.scss | 2 +- tpl/default/linklist.html | 2 +- tpl/default/linklist.paging.html | 3 +++ 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/assets/default/js/base.js b/assets/default/js/base.js index 8bf79d3..951e3f4 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js @@ -422,12 +422,12 @@ function init(description) { /** * Bulk actions */ - const linkCheckboxes = document.querySelectorAll('.delete-checkbox'); + const linkCheckboxes = document.querySelectorAll('.link-checkbox'); const bar = document.getElementById('actions'); [...linkCheckboxes].forEach((checkbox) => { checkbox.style.display = 'inline-block'; - checkbox.addEventListener('click', () => { - const linkCheckedCheckboxes = document.querySelectorAll('.delete-checkbox:checked'); + checkbox.addEventListener('change', () => { + const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked'); const count = [...linkCheckedCheckboxes].length; if (count === 0 && bar.classList.contains('open')) { bar.classList.toggle('open'); @@ -444,7 +444,7 @@ function init(description) { event.preventDefault(); const links = []; - const linkCheckedCheckboxes = document.querySelectorAll('.delete-checkbox:checked'); + const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked'); [...linkCheckedCheckboxes].forEach((checkbox) => { links.push({ id: checkbox.value, @@ -466,6 +466,25 @@ function init(description) { }); } + /** + * Select all button + */ + const selectAllButtons = document.querySelectorAll('.select-all-button'); + [...selectAllButtons].forEach((selectAllButton) => { + selectAllButton.addEventListener('click', (e) => { + e.preventDefault(); + const checked = selectAllButton.classList.contains('filter-off'); + [...selectAllButtons].forEach((selectAllButton2) => { + selectAllButton2.classList.toggle('filter-off'); + selectAllButton2.classList.toggle('filter-on'); + }); + [...linkCheckboxes].forEach((linkCheckbox) => { + linkCheckbox.checked = checked; + linkCheckbox.dispatchEvent(new Event('change')); + }); + }); + }); + /** * Tag list operations * diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss index b8578ea..7e7302f 100644 --- a/assets/default/scss/shaarli.scss +++ b/assets/default/scss/shaarli.scss @@ -740,7 +740,7 @@ body, font-size: 1em; } - .delete-checkbox { + .link-checkbox { display: none; } } diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index 8ea2ce6..97730c2 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html @@ -190,7 +190,7 @@ {if="$is_logged_in"}

diff --git a/tpl/default/picwall.html b/tpl/default/picwall.html index 9a0b10d..4c32548 100644 --- a/tpl/default/picwall.html +++ b/tpl/default/picwall.html @@ -37,7 +37,7 @@
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} thumbnail {$value.title} {loop="$value.picwall_plugin"} diff --git a/tpl/vintage/daily.html b/tpl/vintage/daily.html index 00148a5..71d8447 100644 --- a/tpl/vintage/daily.html +++ b/tpl/vintage/daily.html @@ -71,7 +71,7 @@ {if="$thumbnails_enabled && !empty($link.thumbnail)"}
thumbnail
{/if} diff --git a/tpl/vintage/linklist.html b/tpl/vintage/linklist.html index 3f20284..dcb14e9 100644 --- a/tpl/vintage/linklist.html +++ b/tpl/vintage/linklist.html @@ -85,7 +85,7 @@ {ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} thumbnail
diff --git a/tpl/vintage/picwall.html b/tpl/vintage/picwall.html index 5f1d266..b3a1679 100644 --- a/tpl/vintage/picwall.html +++ b/tpl/vintage/picwall.html @@ -17,7 +17,7 @@
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} thumbnail {$value.title} {loop="$value.picwall_plugin"} From cb7940e2deacba66f2510816732be654b255cc70 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 14 Aug 2018 12:26:51 +0200 Subject: [PATCH 11/36] Fix hashtags with markdown escape enabled They're now transformed to markdown syntax links before processing them through Parsedown. Fixes #1210 --- plugins/markdown/markdown.php | 9 +++++++++ tests/plugins/PluginMarkdownTest.php | 14 +++++++++++++- tests/plugins/resources/hashtags.md | 10 ++++++++++ tests/plugins/resources/hashtags.raw | 10 ++++++++++ tests/plugins/resources/markdown.html | 8 ++++---- tests/plugins/resources/markdown.md | 2 +- 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 tests/plugins/resources/hashtags.md create mode 100644 tests/plugins/resources/hashtags.raw diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 821bb12..2197281 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -215,6 +215,15 @@ function reverse_text2clickable($description) $descriptionLine ); + // Make hashtag links markdown ready, otherwise the links will be ignored with escape set to true + if (!$codeBlockOn && !$codeLineOn) { + $descriptionLine = preg_replace( + '#([^<]+)#m', + '[$2]($1)', + $descriptionLine + ); + } + $descriptionOut .= $descriptionLine; if ($lineCount++ < count($descriptionLines) - 1) { $descriptionOut .= PHP_EOL; diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index b31e817..319a94b 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -106,6 +106,18 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $this->assertEquals($text, $reversedText); } + /** + * Test reverse_text2clickable(). + */ + public function testReverseText2clickableHashtags() + { + $text = file_get_contents('tests/plugins/resources/hashtags.raw'); + $md = file_get_contents('tests/plugins/resources/hashtags.md'); + $clickableText = hashtag_autolink($text); + $reversedText = reverse_text2clickable($clickableText); + $this->assertEquals($md, $reversedText); + } + /** * Test reverse_nl2br(). */ @@ -246,7 +258,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $this->conf->get('security.markdown_escape', true), $this->conf->get('security.allowed_protocols') ); - $this->assertEquals($html, $data); + $this->assertEquals($html, $data . PHP_EOL); } /** diff --git a/tests/plugins/resources/hashtags.md b/tests/plugins/resources/hashtags.md new file mode 100644 index 0000000..46326de --- /dev/null +++ b/tests/plugins/resources/hashtags.md @@ -0,0 +1,10 @@ +[#lol](?addtag=lol) + + #test + +`#test2` + +``` +bla #bli blo +#bla +``` diff --git a/tests/plugins/resources/hashtags.raw b/tests/plugins/resources/hashtags.raw new file mode 100644 index 0000000..9d2dc98 --- /dev/null +++ b/tests/plugins/resources/hashtags.raw @@ -0,0 +1,10 @@ +#lol + + #test + +`#test2` + +``` +bla #bli blo +#bla +``` diff --git a/tests/plugins/resources/markdown.html b/tests/plugins/resources/markdown.html index f1df4e7..c3460bf 100644 --- a/tests/plugins/resources/markdown.html +++ b/tests/plugins/resources/markdown.html @@ -12,11 +12,11 @@
  • two
  • three
  • four
  • -
  • foo <a href="?addtag=foobar" title="Hashtag foobar">#foobar</a>
  • +
  • foo #foobar
  • -

    <a href="?addtag=foobar" title="Hashtag foobar">#foobar</a> foo lol #foo <a href="?addtag=bar" title="Hashtag bar">#bar</a>

    -

    fsdfs http://link.tld <a href="?addtag=foobar" title="Hashtag foobar">#foobar</a> http://link.tld

    +

    #foobar foo lol #foo #bar

    +

    fsdfs http://link.tld #foobar http://link.tld

    http://link.tld #foobar
     next #foo

    Block:

    @@ -30,4 +30,4 @@ next #foo

    link
    link
    link
    -link

    \ No newline at end of file +link

    diff --git a/tests/plugins/resources/markdown.md b/tests/plugins/resources/markdown.md index b8ebd93..9350a8c 100644 --- a/tests/plugins/resources/markdown.md +++ b/tests/plugins/resources/markdown.md @@ -31,4 +31,4 @@ lorem ipsum #foobar http://link.tld [link](ftp://test.tld/path/?query=value#hash) [link](magnet:test.tld/path/?query=value#hash) [link](javascript:alert('xss')) -[link](other://test.tld/path/?query=value#hash) \ No newline at end of file +[link](other://test.tld/path/?query=value#hash) From 0e54e1059f3c3aa353a448567a9314ad694abbe1 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 14 Aug 2018 13:39:31 +0200 Subject: [PATCH 12/36] Isso plugin: add an icon in linklist if enabled Fixes #1075 --- plugins/isso/comment.png | Bin 0 -> 277 bytes plugins/isso/isso.php | 31 +++++++++++++++++++++++++++++-- plugins/isso/isso_button.html | 5 +++++ tests/plugins/PluginIssoTest.php | 16 ++++++++++------ 4 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 plugins/isso/comment.png create mode 100644 plugins/isso/isso_button.html diff --git a/plugins/isso/comment.png b/plugins/isso/comment.png new file mode 100644 index 0000000000000000000000000000000000000000..0158c03b44c92f13681fb235597451d34406d1a1 GIT binary patch literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|mn3BBRT^LHc9xZDG@;D1TB8wRq zxP?KOkzv*x37{Z*iKnkC`y(bMAuiRIHx38_g_e1`IEHAP@10=C*W@7La(~?&W+D9t zj6OSpcnp;Z(1>5FK^jaTwdGhJNyH+*J#NTrkbG!1k@)Ry_ zYnp7zSp7k%{X|0Wr;f=M3|Yq_dwV|X>?jF2c)VJVVRyvWYqFwS^1iy8B}?1QjaS$z TykfZp(8Ua%u6{1-oD!M<^$TO} literal 0 HcmV?d00001 diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index 5bc1cce..378c11a 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php @@ -46,9 +46,36 @@ function hook_isso_render_linklist($data, $conf) $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); $data['plugin_end_zone'][] = $isso; + } else { + $button = ''; + // For the default theme we use a FontAwesome icon which is better than an image + if ($conf->get('resource.theme') === 'default') { + $button .= ''; + } else { + $button .= ' + + archive.org + + diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index 0ae7318..2c9efbc 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php @@ -21,7 +21,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test Isso init without errors. */ - public function testWallabagInitNoError() + public function testIssoInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -32,7 +32,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test Isso init with errors. */ - public function testWallabagInitError() + public function testIssoInitError() { $conf = new ConfigManager(''); $errors = isso_init($conf); @@ -96,19 +96,22 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase array( 'id' => 12, 'url' => $str, + 'shorturl' => $short1 = 'abcd', 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date1), ), array( 'id' => 13, 'url' => $str . '2', + 'shorturl' => $short2 = 'efgh', 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date2), ), ) ); $processed = hook_isso_render_linklist($data, $conf); - // data shouldn't be altered - $this->assertEquals($data, $processed); + // link_plugin should be added for the icon + $this->assertContains('', $processed['links'][0]['link_plugin'][0]); + $this->assertContains('', $processed['links'][1]['link_plugin'][0]); } /** @@ -127,6 +130,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase array( 'id' => 12, 'url' => $str, + 'shorturl' => $short1 = 'abcd', 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date), ) ), @@ -135,8 +139,8 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase $processed = hook_isso_render_linklist($data, $conf); - // data shouldn't be altered - $this->assertEquals($data, $processed); + // link_plugin should be added for the icon + $this->assertContains('', $processed['links'][0]['link_plugin'][0]); } /** From 4fa9a3c5d83a1024678596a586afe5df14a345b5 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 16 Aug 2018 17:25:47 +0200 Subject: [PATCH 13/36] Fix a JS bug preventing AJAX tag deletion to work Fixes #1214 --- assets/default/js/base.js | 2 +- index.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/default/js/base.js b/assets/default/js/base.js index 8bf79d3..1b8d8c3 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js @@ -548,7 +548,7 @@ function init(description) { event.preventDefault(); const block = findParent(event.target, 'div', { class: 'tag-list-item' }); const tag = block.getAttribute('data-tag'); - const refreshedToken = document.getElementById('token'); + const refreshedToken = document.getElementById('token').value; if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) { const xhr = new XMLHttpRequest(); diff --git a/index.php b/index.php index 8f6ee50..eb71753 100644 --- a/index.php +++ b/index.php @@ -1084,7 +1084,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, die(t('Wrong token.')); } - $alteredLinks = $LINKSDB->renameTag(escape($_POST['fromtag']), escape($_POST['totag'])); + $toTag = isset($_POST['totag']) ? escape($_POST['totag']) : null; + $alteredLinks = $LINKSDB->renameTag(escape($_POST['fromtag']), $toTag); $LINKSDB->save($conf->get('resource.page_cache')); foreach ($alteredLinks as $link) { $history->updateLink($link); From b817fb0d95f576a33d6582aa6e9b51f85e0ef345 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Thu, 30 Aug 2018 20:37:52 +0200 Subject: [PATCH 14/36] documentation: refactor documentation homepage - simplify/organize feature list and contributing section - move bug reporting/contact information to Contributing section - unclutter Ref https://github.com/shaarli/Shaarli/issues/1148#issuecomment-397871451 and https://github.com/shaarli/Shaarli/issues/598 --- doc/md/index.md | 120 +++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 72 deletions(-) diff --git a/doc/md/index.md b/doc/md/index.md index c18332b..725d33a 100644 --- a/doc/md/index.md +++ b/doc/md/index.md @@ -1,25 +1,19 @@ -# [Shaarli](https://github.com/shaarli/Shaarli/) documentation +# Shaarli The personal, minimalist, super-fast, database free, bookmarking service. Do you want to share the links you discover? -Shaarli is a minimalist link sharing service that you can install on your own server. +Shaarli is a minimalist bookmark manager and link sharing service that you can install on your own server. It is designed to be personal (single-user), fast and handy. -Here you can find some info on how to use, configure, tweak and solve problems with your Shaarli. -For general information, read the [README](https://github.com/shaarli/Shaarli/blob/master/README.md). +Visit the pages in the sidebar to find information on how to setup, use, configure, tweak and troubleshoot Shaarli. -If you have any questions or ideas, please join the [chat](https://gitter.im/shaarli/Shaarli) (also reachable via [IRC](https://irc.gitter.im/)), post them in our [general discussion](https://github.com/shaarli/Shaarli/issues/308) or read the current [issues](https://github.com/shaarli/Shaarli/issues). - -If you've found a bug, please create a [new issue](https://github.com/shaarli/Shaarli/issues/new). - -If you would like a feature added to Shaarli, check the issues labeled [`feature`](https://github.com/shaarli/Shaarli/labels/feature), [`enhancement`](https://github.com/shaarli/Shaarli/labels/enhancement), and [`plugin`](https://github.com/shaarli/Shaarli/labels/plugin). * [GitHub project page](https://github.com/shaarli/Shaarli) -* [Online documentation](https://shaarli.readthedocs.io/) (this page) -* [Latest Shaarli releases](https://github.com/shaarli/Shaarli/releases) +* [Online documentation](https://shaarli.readthedocs.io/) +* [Latest releases](https://github.com/shaarli/Shaarli/releases) * [Changelog](https://github.com/shaarli/Shaarli/blob/master/CHANGELOG.md) @@ -30,87 +24,70 @@ It runs the latest development version of Shaarli and is updated/reset daily. Login: `demo`; Password: `demo` - - - ## Features Shaarli can be used: -- to share, comment and save interesting links and news. -- to bookmark useful/frequent personal links (as private links) and share them between computers. -- as a minimal blog/microblog/writing platform (no character limit). -- as a read-it-later list (for example items tagged `readlater`). -- to draft and save articles/posts/ideas. -- to keep code snippets. -- to keep notes and documentation. -- as a shared clipboard/notepad/pastebin between machines. -- as a todo list. -- to store playlists (e.g. with the `music` or `video` tags). +- to share, comment and save interesting links and news +- to bookmark useful/frequent links and share them between computers +- as a minimal blog/microblog/writing platform +- as a read-it-later list +- to draft and save articles/posts/ideas +- to keep notes, documentation and code snippets +- as a shared clipboard/notepad/pastebin between machines +- as a todo list +- to store media playlists - to keep extracts/comments from webpages that may disappear. -- to keep track of ongoing discussions (for example items tagged `discussion`). -- [to feed RSS aggregators](http://shaarli.chassegnouf.net/?9Efeiw) (planets) with specific tags. -- to feed other social networks, blogs... using RSS feeds and external services (dlvr.it, ifttt.com ...). +- to keep track of ongoing discussions +- to feed other blogs, aggregators, social networks... using RSS feeds -### Interface +### Edit, view and search your links -- minimalist design (simple is beautiful) +- Minimalist design - FAST -- ATOM and RSS feeds -- views: - - paginated link list (with image and video thumbnails) - - tag cloud - - picture wall: image and video thumbnails (with lazy loading) - - daily: newspaper-like daily digest - - daily RSS feed -- permalinks for easy reference -- links can be public or private -- thumbnail generation for images and video services +- Customizable link titles and descriptions +- Tags to organize your links (features tag autocompletion, renaming, merging and deletion) +- Search by tag or using the full-text search +- Public and private links (visible only to logged-in users) +- Unique permalinks for easy reference +- Paginated link list (with image and video thumbnails) +- Tag cloud and list views +- Picture wall: image and video thumbnails view (with lazy loading) +- ATOM and RSS feeds (can also be filtered using tags or text search) +- Daily: newspaper-like daily digest (and daily RSS feed) - URL cleanup: automatic removal of `?utm_source=...`, `fb=...` -- extensible through [plugins](https://shaarli.readthedocs.io/en/master/Plugins/#plugin-usage) - -### Tag, view and search your links - -- add a custom title and description to archived links -- add tags to classify and search links - - features tag autocompletion, renaming, merging and deletion -- full-text and tag search +- Extensible through [plugins](https://shaarli.readthedocs.io/en/master/Plugins/#plugin-usage) ### Easy setup -- dead-simple installation: drop the files, open the page -- links are stored in a file - - compact storage - - no database required - - easy backup: simply copy the datastore file -- import and export links as Netscape bookmarks +- Dead-simple installation: drop the files, open the page +- Links are stored in a file (no database required, easy backup: simply copy the datastore file) +- Import and export links as Netscape bookmarks compatible with most Web browsers ### Accessibility -- bookmarlet to share links in one click -- support for mobile browsers -- degrades gracefully with Javascript disabled -- easy page customization through HTML/CSS/RainTPL +- Bookmarklet and other tools to share links in one click +- Support for mobile browsers +- Degrades gracefully with Javascript disabled +- Easy page customization through HTML/CSS/RainTPL ### Security -- discreet pop-up notification when a new release is available -- bruteforce protection on the login form -- protected against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and session cookie hijacking +- Discreet pop-up notification when a new release is available +- Bruteforce protection on the login form +- Protected against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and session cookie hijacking ### REST API -Easily extensible by any client using the REST API exposed by Shaarli. - -See the [API documentation](http://shaarli.github.io/api-documentation/). +- Easily extensible by any client using the REST API exposed by Shaarli ([API documentation](http://shaarli.github.io/api-documentation/)). ## About ### Shaarli community fork -This friendly fork is maintained by the Shaarli community at https://github.com/shaarli/Shaarli +This friendly fork is maintained by the Shaarli community at This is a community fork of the original [Shaarli](https://github.com/sebsauvage/Shaarli/) project by [Sébastien Sauvage](http://sebsauvage.net/). @@ -123,16 +100,15 @@ in this repository, and will keep maintaining the project for the foreseeable future, while keeping Shaarli simple and efficient. -### Contributing +### Contributing and getting help -If you'd like to help, please: +Feedback is very appreciated! -- have a look at the open [issues](https://github.com/shaarli/Shaarli/issues) -and [pull requests](https://github.com/shaarli/Shaarli/pulls) -- feel free to report bugs (feedback is much appreciated) -- suggest new features and improvements to both code and [documentation](https://github.com/shaarli/Shaarli/tree/master/doc/md/) -- propose solutions to existing problems -- submit pull requests :-) +- If you have any questions or ideas, please join the [chat](https://gitter.im/shaarli/Shaarli) (also reachable via [IRC](https://irc.gitter.im/)), post them in our [general discussion](https://github.com/shaarli/Shaarli/issues/308) or read the current [issues](https://github.com/shaarli/Shaarli/issues). +- Have a look at the open [issues](https://github.com/shaarli/Shaarli/issues) and [pull requests](https://github.com/shaarli/Shaarli/pulls) +- If you would like a feature added to Shaarli, check the issues labeled [`feature`](https://github.com/shaarli/Shaarli/labels/feature), [`enhancement`](https://github.com/shaarli/Shaarli/labels/enhancement), and [`plugin`](https://github.com/shaarli/Shaarli/labels/plugin). +- If you've found a bug, please create a [new issue](https://github.com/shaarli/Shaarli/issues/new). +- Feel free to propose solutions to existing problems, help us improve the documentation and translations, and submit pull requests :-) ### License From 2b4f391559586af734d5d5cb5886aa78c4f9557d Mon Sep 17 00:00:00 2001 From: nodiscc Date: Thu, 30 Aug 2018 19:36:22 +0200 Subject: [PATCH 15/36] add "noindex, nofollow" HTML robots meta-tag to documentation pages - Customize the "readthedocs" mkdocs theme: https://www.mkdocs.org/user-guide/styling-your-docs/#customizing-a-theme - Adds a '' HTML tag on each page - Do not include robots directive on readthedocs.org, only in local builds --- doc/custom_theme/main.html | 25 +++++++++++++++++++++++++ mkdocs.yml | 4 +++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 doc/custom_theme/main.html diff --git a/doc/custom_theme/main.html b/doc/custom_theme/main.html new file mode 100644 index 0000000..69b398f --- /dev/null +++ b/doc/custom_theme/main.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} + +{# +The entry point for the ReadTheDocs Theme. + +Any theme customisations should override this file to redefine blocks defined in +the various templates. The custom theme should only need to define a main.html +which `{% extends "base.html" %}` and defines various blocks which will replace +the blocks defined in base.html and its included child templates. +#} + +{%- block site_meta %} + + + + +{%- if 'media.readthedocs.org' not in config.extra_css[0] %} + +{%- endif %} + +{% if page and page.is_homepage %}{% endif %} +{% if config.site_author %}{% endif %} +{% if config.site_favicon %} +{% else %}{% endif %} +{%- endblock %} diff --git a/mkdocs.yml b/mkdocs.yml index 941fce3..248fdbf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,7 +2,9 @@ site_name: Shaarli Documentation repo_url: https://github.com/shaarli/Shaarli edit_uri: edit/master/doc/md site_description: The personal, minimalist, super-fast, database free, bookmarking service -theme: readthedocs +theme: + name: readthedocs + custom_dir: doc/custom_theme/ docs_dir: doc/md site_dir: doc/html # Disable strict mode until ReadTheDocs provides up-to-date MkDocs settings: From 6c44d604a1ee0360a2eaf24b9cac18ca95edcb5f Mon Sep 17 00:00:00 2001 From: nodiscc Date: Thu, 30 Aug 2018 20:03:00 +0200 Subject: [PATCH 16/36] doc: server config: basic usage of robots.txt/HTML robots meta-tag/crawler control mechanisms --- doc/md/Server-configuration.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index e281dc8..cf44ecf 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -397,6 +397,7 @@ http { ``` ## Proxies + If Shaarli is served behind a proxy (i.e. there is a proxy server between clients and the web server hosting Shaarli), please refer to the proxy server documentation for proper configuration. In particular, you have to ensure that the following server variables are properly set: - `X-Forwarded-Proto` @@ -405,6 +406,12 @@ If Shaarli is served behind a proxy (i.e. there is a proxy server between client See also [proxy-related](https://github.com/shaarli/Shaarli/issues?utf8=%E2%9C%93&q=label%3Aproxy+) issues. +## Robots and crawlers + +Shaarli disallows indexing and crawling of your local documentation pages by search engines, using `` HTML tags. +Your Shaarli instance and other pages you host may still be indexed by various robots on the public Internet. +You may want to setup a robots.txt file or other crawler control mechanism on your server. +See [[1]](https://en.wikipedia.org/wiki/Robots_exclusion_standard), [[2]](https://support.google.com/webmasters/answer/6062608?hl=en) and [[3]](https://developers.google.com/search/reference/robots_meta_tag) ## See also From 4154c25b5f2f8044a37d7f84e04173bb54f2375b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 May 2018 22:44:38 +0200 Subject: [PATCH 17/36] Add a button to set links as sticky Meaning that they always appear on top of all links Fixes #186 --- application/LinkDB.php | 3 + application/Router.php | 6 ++ application/Updater.php | 20 ++++++ assets/default/scss/shaarli.scss | 12 ++++ index.php | 19 ++++++ tests/FeedBuilderTest.php | 18 +++--- tests/LinkDBTest.php | 10 +-- .../BookmarkExportTest.php | 4 +- tests/Updater/UpdaterTest.php | 61 +++++++++++++++++++ tests/api/controllers/links/GetLinksTest.php | 21 ++++--- tests/utils/ReferenceLinkDB.php | 45 +++++++++++++- tpl/default/linklist.html | 6 ++ 12 files changed, 199 insertions(+), 26 deletions(-) diff --git a/application/LinkDB.php b/application/LinkDB.php index cd0f296..cdd68cf 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -537,6 +537,9 @@ You use the community supported version of the original Shaarli project, by Seba $order = $order === 'ASC' ? -1 : 1; // Reorder array by dates. usort($this->links, function($a, $b) use ($order) { + if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { + return $a['sticky'] ? -1 : 1; + } return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; }); diff --git a/application/Router.php b/application/Router.php index bf86b88..beb3165 100644 --- a/application/Router.php +++ b/application/Router.php @@ -37,6 +37,8 @@ class Router public static $PAGE_DELETELINK = 'delete_link'; + public static $PAGE_PINLINK = 'pin'; + public static $PAGE_EXPORT = 'export'; public static $PAGE_IMPORT = 'import'; @@ -146,6 +148,10 @@ class Router return self::$PAGE_DELETELINK; } + if (startsWith($query, 'do='. self::$PAGE_PINLINK)) { + return self::$PAGE_PINLINK; + } + if (startsWith($query, 'do='. self::$PAGE_EXPORT)) { return self::$PAGE_EXPORT; } diff --git a/application/Updater.php b/application/Updater.php index 480bff8..5dde47c 100644 --- a/application/Updater.php +++ b/application/Updater.php @@ -517,6 +517,26 @@ class Updater return true; } + + /** + * Set sticky = false on all links + * + * @return bool true if the update is successful, false otherwise. + */ + public function updateMethodSetSticky() + { + foreach ($this->linkDB as $key => $link) { + if (isset($link['sticky'])) { + return true; + } + $link['sticky'] = false; + $this->linkDB[$key] = $link; + } + + $this->linkDB->save($this->conf->get('resource.page_cache')); + + return true; + } } /** diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss index b8578ea..037183d 100644 --- a/assets/default/scss/shaarli.scss +++ b/assets/default/scss/shaarli.scss @@ -755,6 +755,14 @@ body, font-size: 1.3em; } +.pin-link { + font-size: 1.3em; +} + +.pinned-link { + color: #0b5ea6 !important; +} + .linklist-item-description { position: relative; padding: 0 10px; @@ -848,6 +856,10 @@ body, margin: 0 7px; } +.ctrl-delete { + margin: 0 7px 0 0; +} + // 64em -> lg @media screen and (max-width: 64em) { .linklist-item-infos-url { diff --git a/index.php b/index.php index 0ef3363..b702bd1 100644 --- a/index.php +++ b/index.php @@ -1353,6 +1353,25 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, exit; } + if ($targetPage == Router::$PAGE_PINLINK) { + if (! isset($_GET['id']) || empty($LINKSDB[$_GET['id']])) { + // FIXME! Use a proper error system. + $msg = t('Invalid link ID provided'); + echo ''; + exit; + } + if (! $sessionManager->checkToken($_GET['token'])) { + die('Wrong token.'); + } + + $link = $LINKSDB[$_GET['id']]; + $link['sticky'] = ! $link['sticky']; + $LINKSDB[(int) $_GET['id']] = $link; + $LINKSDB->save($conf->get('resource.page_cache')); + header('Location: '.index_url($_SERVER)); + exit; + } + if ($targetPage == Router::$PAGE_EXPORT) { // Export links as a Netscape Bookmarks file diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index a590306..4ca58e5 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php @@ -82,8 +82,8 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase $this->assertFalse($data['usepermalinks']); $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); - // Test first link (note link) - $link = reset($data['links']); + // Test first not pinned link (note link) + $link = $data['links'][array_keys($data['links'])[2]]; $this->assertEquals(41, $link['id']); $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); @@ -119,7 +119,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase $data = $feedBuilder->buildData(); $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']); - $link = reset($data['links']); + $link = $data['links'][array_keys($data['links'])[2]]; $this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']); $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']); } @@ -148,13 +148,13 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase public function testBuildDataCount() { $criteria = array( - 'nb' => '1', + 'nb' => '3', ); $feedBuilder = new FeedBuilder(self::$linkDB, FeedBuilder::$FEED_ATOM, self::$serverInfo, $criteria, false); $feedBuilder->setLocale(self::$LOCALE); $data = $feedBuilder->buildData(); - $this->assertEquals(1, count($data['links'])); - $link = array_shift($data['links']); + $this->assertEquals(3, count($data['links'])); + $link = $data['links'][array_keys($data['links'])[2]]; $this->assertEquals(41, $link['id']); $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); } @@ -171,7 +171,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); $this->assertTrue($data['usepermalinks']); // First link is a permalink - $link = array_shift($data['links']); + $link = $data['links'][array_keys($data['links'])[2]]; $this->assertEquals(41, $link['id']); $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); @@ -179,7 +179,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase $this->assertContains('Direct link', $link['description']); $this->assertContains('http://host.tld/?WDWyig', $link['description']); // Second link is a direct link - $link = array_shift($data['links']); + $link = $data['links'][array_keys($data['links'])[3]]; $this->assertEquals(8, $link['id']); $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); $this->assertEquals('http://host.tld/?RttfEw', $link['guid']); @@ -237,7 +237,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase ); // Test first link (note link) - $link = array_shift($data['links']); + $link = $data['links'][array_keys($data['links'])[2]]; $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); $this->assertContains('http://host.tld:8080/~user/shaarli/?addtag=hashtag', $link['description']); diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 3b98087..fcab76f 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -239,12 +239,12 @@ class LinkDBTest extends PHPUnit_Framework_TestCase public function testDays() { $this->assertEquals( - array('20100310', '20121206', '20130614', '20150310'), + array('20100309', '20100310', '20121206', '20121207', '20130614', '20150310'), self::$publicLinkDB->days() ); $this->assertEquals( - array('20100310', '20121206', '20130614', '20141125', '20150310'), + array('20100309', '20100310', '20121206', '20121207', '20130614', '20141125', '20150310'), self::$privateLinkDB->days() ); } @@ -475,13 +475,15 @@ class LinkDBTest extends PHPUnit_Framework_TestCase public function testReorderLinksDesc() { self::$privateLinkDB->reorder('ASC'); - $linkIds = array(42, 4, 9, 1, 0, 7, 6, 8, 41); + $stickyIds = [11, 10]; + $standardIds = [42, 4, 9, 1, 0, 7, 6, 8, 41]; + $linkIds = array_merge($stickyIds, $standardIds); $cpt = 0; foreach (self::$privateLinkDB as $key => $value) { $this->assertEquals($linkIds[$cpt++], $key); } self::$privateLinkDB->reorder('DESC'); - $linkIds = array_reverse($linkIds); + $linkIds = array_merge(array_reverse($stickyIds), array_reverse($standardIds)); $cpt = 0; foreach (self::$privateLinkDB as $key => $value) { $this->assertEquals($linkIds[$cpt++], $key); diff --git a/tests/NetscapeBookmarkUtils/BookmarkExportTest.php b/tests/NetscapeBookmarkUtils/BookmarkExportTest.php index 6a47bbb..77fbd5f 100644 --- a/tests/NetscapeBookmarkUtils/BookmarkExportTest.php +++ b/tests/NetscapeBookmarkUtils/BookmarkExportTest.php @@ -110,7 +110,7 @@ class BookmarkExportTest extends PHPUnit_Framework_TestCase $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'public', false, ''); $this->assertEquals( '?WDWyig', - $links[0]['url'] + $links[2]['url'] ); } @@ -128,7 +128,7 @@ class BookmarkExportTest extends PHPUnit_Framework_TestCase ); $this->assertEquals( $indexUrl . '?WDWyig', - $links[0]['url'] + $links[2]['url'] ); } } diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index cacee2d..870f169 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php @@ -688,6 +688,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; } /** +<<<<<<< HEAD * Test updateMethodWebThumbnailer with thumbnails enabled. */ public function testUpdateMethodWebThumbnailerEnabled() @@ -732,4 +733,64 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; $this->assertEquals(53, $this->conf->get('thumbnails.height')); $this->assertTrue(empty($_SESSION['warnings'])); } + + /** + * Test updateMethodSetSticky(). + */ + public function testUpdateStickyValid() + { + $blank = [ + 'id' => 1, + 'url' => 'z', + 'title' => '', + 'description' => '', + 'tags' => '', + 'created' => new DateTime(), + ]; + $links = [ + 1 => ['id' => 1] + $blank, + 2 => ['id' => 2] + $blank, + ]; + $refDB = new ReferenceLinkDB(); + $refDB->setLinks($links); + $refDB->write(self::$testDatastore); + $linkDB = new LinkDB(self::$testDatastore, true, false); + + $updater = new Updater(array(), $linkDB, $this->conf, true); + $this->assertTrue($updater->updateMethodSetSticky()); + + $linkDB = new LinkDB(self::$testDatastore, true, false); + foreach ($linkDB as $link) { + $this->assertFalse($link['sticky']); + } + } + + /** + * Test updateMethodSetSticky(). + */ + public function testUpdateStickyNothingToDo() + { + $blank = [ + 'id' => 1, + 'url' => 'z', + 'title' => '', + 'description' => '', + 'tags' => '', + 'created' => new DateTime(), + ]; + $links = [ + 1 => ['id' => 1, 'sticky' => true] + $blank, + 2 => ['id' => 2] + $blank, + ]; + $refDB = new ReferenceLinkDB(); + $refDB->setLinks($links); + $refDB->write(self::$testDatastore); + $linkDB = new LinkDB(self::$testDatastore, true, false); + + $updater = new Updater(array(), $linkDB, $this->conf, true); + $this->assertTrue($updater->updateMethodSetSticky()); + + $linkDB = new LinkDB(self::$testDatastore, true, false); + $this->assertTrue($linkDB[1]['sticky']); + } } diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php index d22ed3b..64f0277 100644 --- a/tests/api/controllers/links/GetLinksTest.php +++ b/tests/api/controllers/links/GetLinksTest.php @@ -95,7 +95,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->refDB->countLinks(), count($data)); // Check order - $order = [41, 8, 6, 7, 0, 1, 9, 4, 42]; + $order = [10, 11, 41, 8, 6, 7, 0, 1, 9, 4, 42]; $cpt = 0; foreach ($data as $link) { $this->assertEquals(self::NB_FIELDS_LINK, count($link)); @@ -103,7 +103,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase } // Check first element fields - $first = $data[0]; + $first = $data[2]; $this->assertEquals('http://domain.tld/?WDWyig', $first['url']); $this->assertEquals('WDWyig', $first['shorturl']); $this->assertEquals('Link title: @website', $first['title']); @@ -120,7 +120,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->assertEmpty($first['updated']); // Multi tags - $link = $data[1]; + $link = $data[3]; $this->assertEquals(7, count($link['tags'])); // Update date @@ -138,7 +138,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase { $env = Environment::mock([ 'REQUEST_METHOD' => 'GET', - 'QUERY_STRING' => 'offset=1&limit=1' + 'QUERY_STRING' => 'offset=3&limit=1' ]); $request = Request::createFromEnvironment($env); $response = $this->controller->getLinks($request, new Response()); @@ -164,7 +164,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $data = json_decode((string) $response->getBody(), true); $this->assertEquals($this->refDB->countLinks(), count($data)); // Check order - $order = [41, 8, 6, 7, 0, 1, 9, 4, 42]; + $order = [10, 11, 41, 8, 6, 7, 0, 1, 9, 4, 42]; $cpt = 0; foreach ($data as $link) { $this->assertEquals(self::NB_FIELDS_LINK, count($link)); @@ -205,7 +205,8 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->assertEquals(200, $response->getStatusCode()); $data = json_decode((string)$response->getBody(), true); $this->assertEquals($this->refDB->countLinks(), count($data)); - $this->assertEquals(41, $data[0]['id']); + $this->assertEquals(10, $data[0]['id']); + $this->assertEquals(41, $data[2]['id']); $this->assertEquals(self::NB_FIELDS_LINK, count($data[0])); } @@ -243,7 +244,8 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->assertEquals(200, $response->getStatusCode()); $data = json_decode((string)$response->getBody(), true); $this->assertEquals($this->refDB->countPublicLinks(), count($data)); - $this->assertEquals(41, $data[0]['id']); + $this->assertEquals(10, $data[0]['id']); + $this->assertEquals(41, $data[2]['id']); $this->assertEquals(self::NB_FIELDS_LINK, count($data[0])); } @@ -413,8 +415,9 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $response = $this->controller->getLinks($request, new Response()); $this->assertEquals(200, $response->getStatusCode()); $data = json_decode((string) $response->getBody(), true); - $this->assertEquals(9, count($data)); - $this->assertEquals(41, $data[0]['id']); + $this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, count($data)); + $this->assertEquals(10, $data[0]['id']); + $this->assertEquals(41, $data[2]['id']); // wildcard: optional ('*' does not need to expand) $env = Environment::mock([ diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php index e887aa7..7426ad0 100644 --- a/tests/utils/ReferenceLinkDB.php +++ b/tests/utils/ReferenceLinkDB.php @@ -4,7 +4,7 @@ */ class ReferenceLinkDB { - public static $NB_LINKS_TOTAL = 9; + public static $NB_LINKS_TOTAL = 11; private $_links = array(); private $_publicCount = 0; @@ -15,6 +15,32 @@ class ReferenceLinkDB */ public function __construct() { + $this->addLink( + 11, + 'Pined older', + '?PCRizQ', + 'This is an older pinned link', + 0, + DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20100309_101010'), + '', + null, + 'PCRizQ', + true + ); + + $this->addLink( + 10, + 'Pined', + '?0gCTjQ', + 'This is a pinned link', + 0, + DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121207_152312'), + '', + null, + '0gCTjQ', + true + ); + $this->addLink( 41, 'Link title: @website', @@ -114,7 +140,17 @@ class ReferenceLinkDB /** * Adds a new link */ - protected function addLink($id, $title, $url, $description, $private, $date, $tags, $updated = '', $shorturl = '') + protected function addLink( + $id, + $title, + $url, + $description, + $private, + $date, + $tags, + $updated = '', + $shorturl = '', + $pinned = false) { $link = array( 'id' => $id, @@ -126,6 +162,7 @@ class ReferenceLinkDB 'created' => $date, 'updated' => $updated, 'shorturl' => $shorturl ? $shorturl : smallHash($date->format(LinkDB::LINK_DATE_FORMAT) . $id), + 'sticky' => $pinned ); $this->_links[$id] = $link; @@ -165,6 +202,10 @@ class ReferenceLinkDB $order = $order === 'ASC' ? -1 : 1; // Reorder array by dates. usort($this->_links, function($a, $b) use ($order) { + if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { + return $a['sticky'] ? -1 : 1; + } + return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; }); } diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index 8ea2ce6..aaa9bc7 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html @@ -201,6 +201,12 @@ + + + + + {/if} From d9bf5b31ff9e2d007ddfb7f7756184f0ca9676c8 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 6 Oct 2018 13:09:11 +0200 Subject: [PATCH 18/36] Sticky feature - Add translation and display for logged out users --- assets/default/scss/shaarli.scss | 6 +- inc/languages/fr/LC_MESSAGES/shaarli.po | 446 +++++++++++------------- tpl/default/linklist.html | 14 +- 3 files changed, 212 insertions(+), 254 deletions(-) diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss index 037183d..55f9f0a 100644 --- a/assets/default/scss/shaarli.scss +++ b/assets/default/scss/shaarli.scss @@ -756,11 +756,11 @@ body, } .pin-link { - font-size: 1.3em; + font-size: 1.3em; } .pinned-link { - color: #0b5ea6 !important; + color: $blue !important; } .linklist-item-description { @@ -857,7 +857,7 @@ body, } .ctrl-delete { - margin: 0 7px 0 0; + margin: 0 7px 0 0; } // 64em -> lg diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index 5fd0f77..102c80d 100644 --- a/inc/languages/fr/LC_MESSAGES/shaarli.po +++ b/inc/languages/fr/LC_MESSAGES/shaarli.po @@ -1,15 +1,15 @@ msgid "" msgstr "" "Project-Id-Version: Shaarli\n" -"POT-Creation-Date: 2018-07-17 13:04+0200\n" -"PO-Revision-Date: 2018-07-17 13:07+0200\n" +"POT-Creation-Date: 2018-10-06 13:08+0200\n" +"PO-Revision-Date: 2018-10-06 13:08+0200\n" "Last-Translator: \n" "Language-Team: Shaarli\n" "Language: fr_FR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.9\n" +"X-Generator: Poedit 2.1.1\n" "X-Poedit-Basepath: ../../../..\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Poedit-SourceCharset: UTF-8\n" @@ -101,8 +101,6 @@ msgid "Array offset and link ID must be equal." msgstr "La clé du tableau et l'ID du lien doivent être identiques." #: application/LinkDB.php:251 -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:14 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:48 msgid "" @@ -125,8 +123,8 @@ msgstr "" "Bienvenue sur Shaarli ! Ceci est votre premier marque-page public. Pour me " "modifier ou me supprimer, vous devez d'abord vous connecter.\n" "\n" -"Pour apprendre à utiliser Shaarli, consultez le lien « Documentation » " -"en bas de page.\n" +"Pour apprendre à utiliser Shaarli, consultez le lien « Documentation » en " +"bas de page.\n" "\n" "Vous utilisez la version supportée par la communauté du projet original " "Shaarli de Sébastien Sauvage." @@ -185,14 +183,14 @@ msgid "" "php-gd extension must be loaded to use thumbnails. Thumbnails are now " "disabled. Please reload the page." msgstr "" -"l'extension php-gd doit être chargée pour utiliser les miniatures. Les miniatures sont désormais " -"désactivées. Rechargez la page." +"l'extension php-gd doit être chargée pour utiliser les miniatures. Les " +"miniatures sont désormais désactivées. Rechargez la page." #: application/Updater.php:86 msgid "Couldn't retrieve Updater class methods." msgstr "Impossible de récupérer les méthodes de la classe Updater." -#: application/Updater.php:514 index.php:1023 +#: application/Updater.php:514 index.php:1022 msgid "" "You have enabled or changed thumbnails mode. Please synchronize them." @@ -200,17 +198,17 @@ msgstr "" "Vous avez activé ou changé le mode de miniatures. Merci de les synchroniser." -#: application/Updater.php:566 +#: application/Updater.php:586 msgid "An error occurred while running the update " msgstr "Une erreur s'est produite lors de l'exécution de la mise à jour " -#: application/Updater.php:606 +#: application/Updater.php:626 msgid "Updates file path is not set, can't write updates." msgstr "" "Le chemin vers le fichier de mise à jour n'est pas défini, impossible " "d'écrire les mises à jour." -#: application/Updater.php:611 +#: application/Updater.php:631 msgid "Unable to write updates in " msgstr "Impossible d'écrire les mises à jour dans " @@ -288,72 +286,64 @@ msgstr "NON. Vous êtes banni pour le moment. Revenez plus tard." msgid "Wrong login/password." msgstr "Nom d'utilisateur ou mot de passe incorrect(s)." -#: index.php:483 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:46 -#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:46 +#: index.php:482 tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:46 msgid "Daily" msgstr "Quotidien" -#: index.php:589 tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:28 +#: index.php:588 tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:28 #: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:44 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:75 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:99 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:75 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:99 msgid "Login" msgstr "Connexion" -#: index.php:606 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 -#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:41 +#: index.php:605 tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:41 msgid "Picture wall" msgstr "Mur d'images" -#: index.php:683 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 -#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:36 +#: index.php:682 tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:36 #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19 msgid "Tag cloud" msgstr "Nuage de tags" -#: index.php:716 tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19 +#: index.php:715 tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19 msgid "Tag list" msgstr "Liste des tags" -#: index.php:941 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:31 -#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:31 +#: index.php:940 tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:31 msgid "Tools" msgstr "Outils" -#: index.php:950 +#: index.php:949 msgid "You are not supposed to change a password on an Open Shaarli." msgstr "" "Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert." -#: index.php:955 index.php:997 index.php:1085 index.php:1116 index.php:1221 +#: index.php:954 index.php:996 index.php:1084 index.php:1116 index.php:1221 msgid "Wrong token." msgstr "Jeton invalide." -#: index.php:960 +#: index.php:959 msgid "The old password is not correct." msgstr "L'ancien mot de passe est incorrect." -#: index.php:980 +#: index.php:979 msgid "Your password has been changed" msgstr "Votre mot de passe a été modifié" -#: index.php:985 -#: tmp/changepassword.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13 -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:29 +#: index.php:984 tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:29 msgid "Change password" msgstr "Modifier le mot de passe" -#: index.php:1043 +#: index.php:1042 msgid "Configuration was saved." msgstr "La configuration a été sauvegardée." -#: index.php:1068 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 +#: index.php:1067 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 msgid "Configure" msgstr "Configurer" -#: index.php:1079 tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13 +#: index.php:1078 tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 msgid "Manage tags" msgstr "Gérer les tags" @@ -381,7 +371,6 @@ msgid "Edit" msgstr "Modifier" #: index.php:1281 index.php:1351 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:26 msgid "Shaare" msgstr "Shaare" @@ -390,15 +379,19 @@ msgstr "Shaare" msgid "Note: " msgstr "Note : " -#: index.php:1360 tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65 +#: index.php:1359 +msgid "Invalid link ID provided" +msgstr "" + +#: index.php:1379 msgid "Export" msgstr "Exporter" -#: index.php:1422 tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:83 +#: index.php:1441 msgid "Import" msgstr "Importer" -#: index.php:1432 +#: index.php:1451 #, php-format msgid "" "The file you are trying to upload is probably bigger than what this " @@ -408,20 +401,20 @@ msgstr "" "le serveur web peut accepter (%s). Merci de l'envoyer en parties plus " "légères." -#: index.php:1471 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26 +#: index.php:1490 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22 msgid "Plugin administration" msgstr "Administration des plugins" -#: index.php:1523 tmp/thumbnails.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 +#: index.php:1542 tmp/thumbnails.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 msgid "Thumbnails update" msgstr "Mise à jour des miniatures" -#: index.php:1695 +#: index.php:1714 msgid "Search: " msgstr "Recherche : " -#: index.php:1735 +#: index.php:1754 #, php-format msgid "" "
    Sessions do not seem to work correctly on your server.
    Make sure the " @@ -431,16 +424,16 @@ msgid "" "custom hostname without a dot causes cookie storage to fail. We recommend " "accessing your server via it's IP address or Fully Qualified Domain Name.
    " msgstr "" -"
    Les sesssions ne semblent pas fonctionner sur ce serveur.
    Assurez vous " -"que la variable « session.save_path » est correctement définie dans votre " -"fichier de configuration PHP, et que vous avez les droits d'écriture dessus." -"
    Ce paramètre pointe actuellement sur %s.
    Sur certains navigateurs, " -"accéder à votre serveur depuis un nom d'hôte comme « localhost » ou autre " -"nom personnalisé sans point '.' entraine l'échec de la sauvegarde des " -"cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse " -"IP ou un Fully Qualified Domain Name.
    " +"
    Les sesssions ne semblent pas fonctionner sur ce serveur.
    Assurez " +"vous que la variable « session.save_path » est correctement définie dans " +"votre fichier de configuration PHP, et que vous avez les droits d'écriture " +"dessus.
    Ce paramètre pointe actuellement sur %s.
    Sur certains " +"navigateurs, accéder à votre serveur depuis un nom d'hôte comme « localhost " +"» ou autre nom personnalisé sans point '.' entraine l'échec de la sauvegarde " +"des cookies. Nous vous recommandons d'accéder à votre serveur depuis son " +"adresse IP ou un Fully Qualified Domain Name.
    " -#: index.php:1745 +#: index.php:1764 msgid "Click to try again." msgstr "Cliquer ici pour réessayer." @@ -481,12 +474,13 @@ msgstr "" "Erreur de l'extension Isso : Merci de définir le paramètre « ISSO_SERVER » " "dans la page d'administration des extensions." -#: plugins/isso/isso.php:63 +#: plugins/isso/isso.php:90 msgid "Let visitor comment your shaares on permalinks with Isso." msgstr "" -"Permettre aux visiteurs de commenter vos shaares sur les permaliens avec Isso." +"Permettre aux visiteurs de commenter vos shaares sur les permaliens avec " +"Isso." -#: plugins/isso/isso.php:64 +#: plugins/isso/isso.php:91 msgid "Isso server URL (without 'http://')" msgstr "URL du serveur Isso (sans 'http://')" @@ -603,35 +597,17 @@ msgstr "Version de l'API Wallabag (1 ou 2)" #: tests/LanguagesTest.php:214 tests/LanguagesTest.php:227 #: tests/languages/fr/LanguagesFrTest.php:160 #: tests/languages/fr/LanguagesFrTest.php:173 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:85 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:85 msgid "Search" msgid_plural "Search" msgstr[0] "Rechercher" msgstr[1] "Rechercher" -#: tmp/404.b91ef64efc3688266305ea9b42e5017e.rtpl.php:12 -msgid "Sorry, nothing to see here." -msgstr "Désolé, il y a rien à voir ici." - #: tmp/addlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16 msgid "URL or leave empty to post a note" msgstr "URL ou laisser vide pour créer une note" -#: tmp/changepassword.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16 -msgid "Current password" -msgstr "Mot de passe actuel" - -#: tmp/changepassword.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19 -msgid "New password" -msgstr "Nouveau mot de passe" - -#: tmp/changepassword.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23 -msgid "Change" -msgstr "Changer" - #: tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16 -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:77 msgid "Tag" msgstr "Tag" @@ -661,6 +637,34 @@ msgstr "Vous pouvez aussi modifier les tags dans la" msgid "tag list" msgstr "liste des tags" +#: tmp/configure.90100d2eaf5d3705e14b9b4f78ecddc9.rtpl.php:143 +#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:296 +msgid "All" +msgstr "Tous" + +#: tmp/configure.90100d2eaf5d3705e14b9b4f78ecddc9.rtpl.php:147 +#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:300 +msgid "Only common media hosts" +msgstr "Seulement les hébergeurs de média connus" + +#: tmp/configure.90100d2eaf5d3705e14b9b4f78ecddc9.rtpl.php:151 +#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:304 +msgid "None" +msgstr "Aucune" + +#: tmp/configure.90100d2eaf5d3705e14b9b4f78ecddc9.rtpl.php:158 +#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:281 +msgid "You need to enable the extension php-gd to use thumbnails." +msgstr "" +"Vous devez activer l'extension php-gd pour utiliser les " +"miniatures." + +#: tmp/configure.90100d2eaf5d3705e14b9b4f78ecddc9.rtpl.php:162 +#, fuzzy +#| msgid "Enable thumbnails" +msgid "Synchonize thumbnails" +msgstr "Activer les miniatures" + #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:29 msgid "title" msgstr "titre" @@ -678,22 +682,18 @@ msgid "Theme" msgstr "Thème" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:87 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:78 msgid "Language" msgstr "Langue" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:116 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:102 msgid "Timezone" msgstr "Fuseau horaire" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:117 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:103 msgid "Continent" msgstr "Continent" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:117 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:103 msgid "City" msgstr "Ville" @@ -734,22 +734,18 @@ msgid "Do not show any links if the user is not logged in" msgstr "N'afficher aucun lien sans être connecté" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:231 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:150 msgid "Check updates" msgstr "Vérifier les mises à jour" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:232 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:152 msgid "Notify me when a new release is ready" msgstr "Me notifier lorsqu'une nouvelle version est disponible" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:247 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:169 msgid "Enable REST API" msgstr "Activer l'API REST" #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:248 -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:170 msgid "Allow third party software to use Shaarli such as mobile application" msgstr "" "Permet aux applications tierces d'utiliser Shaarli, par exemple les " @@ -763,30 +759,11 @@ msgstr "Clé d'API secrète" msgid "Enable thumbnails" msgstr "Activer les miniatures" -#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:281 -msgid "You need to enable the extension php-gd to use thumbnails." -msgstr "" -"Vous devez activer l'extension php-gd pour utiliser les " -"miniatures." - #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:285 #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:56 msgid "Synchronize thumbnails" msgstr "Synchroniser les miniatures" -#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:296 -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:31 -msgid "All" -msgstr "Tous" - -#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:300 -msgid "Only common media hosts" -msgstr "Seulement les hébergeurs de média connus" - -#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:304 -msgid "None" -msgstr "Aucune" - #: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:312 #: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72 #: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:139 @@ -847,7 +824,6 @@ msgid "Tags" msgstr "Tags" #: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:57 -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:167 msgid "Private" msgstr "Privé" @@ -856,99 +832,6 @@ msgstr "Privé" msgid "Apply Changes" msgstr "Appliquer les changements" -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16 -msgid "Export Database" -msgstr "Exporter les données" - -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 -msgid "Selection" -msgstr "Choisir" - -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 -msgid "Public" -msgstr "Publics" - -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:52 -msgid "Prepend note permalinks with this Shaarli instance's URL" -msgstr "Préfixer les liens de note avec l'URL de l'instance de Shaarli" - -#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:53 -msgid "Useful to import bookmarks in a web browser" -msgstr "Utile pour importer les marques-pages dans un navigateur" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16 -msgid "Import Database" -msgstr "Importer des données" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23 -msgid "Maximum size allowed:" -msgstr "Taille maximum autorisée :" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:29 -msgid "Visibility" -msgstr "Visibilité" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 -msgid "Use values from the imported file, default to public" -msgstr "" -"Utiliser les valeurs présentes dans le fichier d'import, public par défaut" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 -msgid "Import all bookmarks as private" -msgstr "Importer tous les liens comme privés" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:46 -msgid "Import all bookmarks as public" -msgstr "Importer tous les liens comme publics" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:57 -msgid "Overwrite existing bookmarks" -msgstr "Remplacer les liens existants" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:58 -msgid "Duplicates based on URL" -msgstr "Les doublons s'appuient sur les URL" - -#: tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72 -msgid "Add default tags" -msgstr "Ajouter des tags par défaut" - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22 -msgid "Install Shaarli" -msgstr "Installation de Shaarli" - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:25 -msgid "It looks like it's the first time you run Shaarli. Please configure it." -msgstr "" -"Il semblerait que ça soit la première fois que vous lancez Shaarli. Merci de " -"le configurer." - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:33 -#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:30 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:151 -#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:151 -msgid "Username" -msgstr "Nom d'utilisateur" - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48 -#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:34 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:152 -#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:152 -msgid "Password" -msgstr "Mot de passe" - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:63 -msgid "Shaarli title" -msgstr "Titre du Shaarli" - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:69 -msgid "My links" -msgstr "Mes liens" - -#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:182 -msgid "Install" -msgstr "Installer" - #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:79 msgid "shaare" @@ -964,13 +847,11 @@ msgstr[0] "lien privé" msgstr[1] "liens privés" #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:30 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:121 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:121 msgid "Search text" msgstr "Recherche texte" #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:37 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:128 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:128 #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:64 @@ -1011,7 +892,6 @@ msgid "without any tag" msgstr "sans tag" #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:173 -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:42 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:42 msgid "Fold" msgstr "Replier" @@ -1028,36 +908,36 @@ msgstr "permalien" msgid "Add tag" msgstr "Ajouter un tag" -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:7 +#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:183 +msgid "Toggle sticky" +msgstr "Changer statut épinglé" + +#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:185 +msgid "Sticky" +msgstr "Épinglé" + #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:7 msgid "Filters" msgstr "Filtres" -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:12 #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:12 msgid "Only display private links" msgstr "Afficher uniquement les liens privés" -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:15 #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:15 msgid "Only display public links" msgstr "Afficher uniquement les liens publics" -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:20 #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:20 msgid "Filter untagged links" msgstr "Filtrer par liens privés" -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:76 #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:24 #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:76 -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43 msgid "Fold all" msgstr "Replier tout" -#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:69 #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:69 msgid "Links per page" msgstr "Liens par page" @@ -1069,59 +949,56 @@ msgstr "" "Vous avez été banni après trop d'échecs d'authentification. Merci de " "réessayer plus tard." +#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:30 +#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:151 +msgid "Username" +msgstr "Nom d'utilisateur" + +#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:34 +#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:152 +msgid "Password" +msgstr "Mot de passe" + #: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:155 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:155 msgid "Remember me" msgstr "Rester connecté" -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14 -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:14 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:48 msgid "by the Shaarli community" msgstr "par la communauté Shaarli" -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:15 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:15 msgid "Documentation" msgstr "Documentation" -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:44 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:44 msgid "Expand" msgstr "Déplier" -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:45 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:45 msgid "Expand all" msgstr "Déplier tout" -#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:46 #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:46 msgid "Are you sure you want to delete this link?" msgstr "Êtes-vous sûr de vouloir supprimer ce lien ?" -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:90 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:65 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:90 msgid "RSS Feed" msgstr "Flux RSS" -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:70 -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:106 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:70 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:106 msgid "Logout" msgstr "Déconnexion" -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:173 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:173 msgid "is available" msgstr "est disponible" -#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:180 #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:180 msgid "Error" msgstr "Erreur" @@ -1221,22 +1098,18 @@ msgstr "tags" msgid "List all links with those tags" msgstr "Lister tous les liens avec ces tags" -#: tmp/tag.sort.b91ef64efc3688266305ea9b42e5017e.rtpl.php:3 #: tmp/tag.sort.cedf684561d925457130839629000a81.rtpl.php:3 msgid "Sort by:" msgstr "Trier par :" -#: tmp/tag.sort.b91ef64efc3688266305ea9b42e5017e.rtpl.php:5 #: tmp/tag.sort.cedf684561d925457130839629000a81.rtpl.php:5 msgid "Cloud" msgstr "Nuage" -#: tmp/tag.sort.b91ef64efc3688266305ea9b42e5017e.rtpl.php:6 #: tmp/tag.sort.cedf684561d925457130839629000a81.rtpl.php:6 msgid "Most used" msgstr "Plus utilisés" -#: tmp/tag.sort.b91ef64efc3688266305ea9b42e5017e.rtpl.php:7 #: tmp/tag.sort.cedf684561d925457130839629000a81.rtpl.php:7 msgid "Alphabetical" msgstr "Alphabétique" @@ -1266,9 +1139,13 @@ msgid "Rename or delete a tag in all links" msgstr "Renommer ou supprimer un tag dans tous les liens" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41 +#, fuzzy +#| msgid "" +#| "Import Netscape HTML bookmarks (as exported from Firefox, Chrome, Opera, " +#| "delicious…)" msgid "" "Import Netscape HTML bookmarks (as exported from Firefox, Chrome, Opera, " -"delicious…)" +"delicious...)" msgstr "" "Importer des marques pages au format Netscape HTML (comme exportés depuis " "Firefox, Chrome, Opera, delicious…)" @@ -1278,9 +1155,13 @@ msgid "Import links" msgstr "Importer des liens" #: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:47 +#, fuzzy +#| msgid "" +#| "Export Netscape HTML bookmarks (which can be imported in Firefox, Chrome, " +#| "Opera, delicious…)" msgid "" "Export Netscape HTML bookmarks (which can be imported in Firefox, Chrome, " -"Opera, delicious…)" +"Opera, delicious...)" msgstr "" "Exporter les marques pages au format Netscape HTML (comme exportés depuis " "Firefox, Chrome, Opera, delicious…)" @@ -1339,33 +1220,16 @@ msgstr "" msgid "Add Note" msgstr "Ajouter une Note" -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:139 -msgid "" -"You need to browse your Shaarli over HTTPS to use this " -"functionality." -msgstr "" -"Vous devez utiliser Shaarli en HTTPS pour utiliser cette " -"fonctionalité." - -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:144 -msgid "Add to" -msgstr "Ajouter à" - -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:155 +#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:136 msgid "3rd party" msgstr "Applications tierces" -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:157 -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:163 -msgid "Plugin" -msgstr "Extension" - -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:158 -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:164 +#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:139 +#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:144 msgid "plugin" msgstr "extension" -#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:191 +#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:169 msgid "" "Drag this link to your bookmarks toolbar, or right-click it and choose " "Bookmark This Link" @@ -1373,10 +1237,91 @@ msgstr "" "Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « " "Ajouter aux favoris »" -#, fuzzy -#~| msgid "Enable thumbnails" -#~ msgid "Synchonize thumbnails" -#~ msgstr "Activer les miniatures" +#~ msgid "Sorry, nothing to see here." +#~ msgstr "Désolé, il y a rien à voir ici." + +#~ msgid "Current password" +#~ msgstr "Mot de passe actuel" + +#~ msgid "New password" +#~ msgstr "Nouveau mot de passe" + +#~ msgid "Change" +#~ msgstr "Changer" + +#~ msgid "Export Database" +#~ msgstr "Exporter les données" + +#~ msgid "Selection" +#~ msgstr "Choisir" + +#~ msgid "Public" +#~ msgstr "Publics" + +#~ msgid "Prepend note permalinks with this Shaarli instance's URL" +#~ msgstr "Préfixer les liens de note avec l'URL de l'instance de Shaarli" + +#~ msgid "Useful to import bookmarks in a web browser" +#~ msgstr "Utile pour importer les marques-pages dans un navigateur" + +#~ msgid "Import Database" +#~ msgstr "Importer des données" + +#~ msgid "Maximum size allowed:" +#~ msgstr "Taille maximum autorisée :" + +#~ msgid "Visibility" +#~ msgstr "Visibilité" + +#~ msgid "Use values from the imported file, default to public" +#~ msgstr "" +#~ "Utiliser les valeurs présentes dans le fichier d'import, public par défaut" + +#~ msgid "Import all bookmarks as private" +#~ msgstr "Importer tous les liens comme privés" + +#~ msgid "Import all bookmarks as public" +#~ msgstr "Importer tous les liens comme publics" + +#~ msgid "Overwrite existing bookmarks" +#~ msgstr "Remplacer les liens existants" + +#~ msgid "Duplicates based on URL" +#~ msgstr "Les doublons s'appuient sur les URL" + +#~ msgid "Add default tags" +#~ msgstr "Ajouter des tags par défaut" + +#~ msgid "Install Shaarli" +#~ msgstr "Installation de Shaarli" + +#~ msgid "" +#~ "It looks like it's the first time you run Shaarli. Please configure it." +#~ msgstr "" +#~ "Il semblerait que ça soit la première fois que vous lancez Shaarli. Merci " +#~ "de le configurer." + +#~ msgid "Shaarli title" +#~ msgstr "Titre du Shaarli" + +#~ msgid "My links" +#~ msgstr "Mes liens" + +#~ msgid "Install" +#~ msgstr "Installer" + +#~ msgid "" +#~ "You need to browse your Shaarli over HTTPS to use this " +#~ "functionality." +#~ msgstr "" +#~ "Vous devez utiliser Shaarli en HTTPS pour utiliser cette " +#~ "fonctionalité." + +#~ msgid "Add to" +#~ msgstr "Ajouter à" + +#~ msgid "Plugin" +#~ msgstr "Extension" #~ msgid "Warning: " #~ msgstr "Attention : " @@ -1450,7 +1395,8 @@ msgstr "" #~ "\n" #~ msgid "Sessions do not seem to work correctly on your server." -#~ msgstr "Les sessions ne semblent pas fonctionner correctement sur votre serveur." +#~ msgstr "" +#~ "Les sessions ne semblent pas fonctionner correctement sur votre serveur." #~ msgid "Tag was renamed in " #~ msgstr "Le tag a été renommé dans " diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index aaa9bc7..c04f478 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html @@ -125,6 +125,8 @@ {$strPermalink=t('Permalink')} {$strPermalinkLc=t('permalink')} {$strAddTag=t('Add tag')} + {$strToggleSticky=t('Toggle sticky')} + {$strSticky=t('Sticky')} {ignore}End of translations{/ignore} {loop="links"}
    @@ -203,11 +205,21 @@ + title="{$strToggleSticky}" class="pin-link {if="$value.sticky"}pinned-link{/if} pure-u-0 pure-u-lg-visible"> + {else} + {if="$value.sticky"} + + {/if} {/if} {if="!$hide_timestamps || $is_logged_in"} From b41c5ab04ca68aa0e9556c011bddc6d0873d70a2 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 6 Oct 2018 17:29:44 +0200 Subject: [PATCH 19/36] Composer: bump netscape-bookmark-parser to 2.1 Relates to https://github.com/shaarli/Shaarli/issues/1227 Signed-off-by: VirtualTam --- composer.json | 2 +- composer.lock | 117 +++++++++++++++++++++++++------------------------- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/composer.json b/composer.json index 99ef0b5..f5e7a9c 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require": { "php": ">=5.6", - "shaarli/netscape-bookmark-parser": "^2.0", + "shaarli/netscape-bookmark-parser": "^2.1", "erusev/parsedown": "^1.6", "slim/slim": "^3.0", "arthurhoaro/web-thumbnailer": "^1.1", diff --git a/composer.lock b/composer.lock index 22c97fa..bdf1861 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "da7a0c081b61d949154c5d2e5370cbab", + "content-hash": "0dc33ee0b7d9f47868d4fa961f0d13b4", "packages": [ { "name": "arthurhoaro/web-thumbnailer", @@ -133,16 +133,16 @@ }, { "name": "gettext/gettext", - "version": "v4.6.0", + "version": "v4.6.1", "source": { "type": "git", "url": "https://github.com/oscarotero/Gettext.git", - "reference": "cae84aff39a87e07bd6e5cddb5adb720a0ffa357" + "reference": "854ff5f5aaf92d2af7080ba8fc15718b27b5c89a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/cae84aff39a87e07bd6e5cddb5adb720a0ffa357", - "reference": "cae84aff39a87e07bd6e5cddb5adb720a0ffa357", + "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/854ff5f5aaf92d2af7080ba8fc15718b27b5c89a", + "reference": "854ff5f5aaf92d2af7080ba8fc15718b27b5c89a", "shasum": "" }, "require": { @@ -191,7 +191,7 @@ "po", "translation" ], - "time": "2018-06-26T16:51:09+00:00" + "time": "2018-08-27T15:40:19+00:00" }, { "name": "gettext/languages", @@ -593,15 +593,16 @@ "source": { "type": "git", "url": "https://github.com/pubsubhubbub/php-publisher.git", - "reference": "5008fc529b057251b48f4d17a10fdb20047ea8f5" + "reference": "e8a7cf52a2c86b0c364da56f7192ec020c83b8f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pubsubhubbub/php-publisher/zipball/5008fc529b057251b48f4d17a10fdb20047ea8f5", - "reference": "5008fc529b057251b48f4d17a10fdb20047ea8f5", + "url": "https://api.github.com/repos/pubsubhubbub/php-publisher/zipball/e8a7cf52a2c86b0c364da56f7192ec020c83b8f7", + "reference": "e8a7cf52a2c86b0c364da56f7192ec020c83b8f7", "shasum": "" }, "require": { + "ext-curl": "*", "php": "~5.4 || ~7.0" }, "type": "library", @@ -628,28 +629,28 @@ "publishers", "pubsubhubbub" ], - "time": "2018-05-22T11:56:26+00:00" + "time": "2018-10-05T12:31:04+00:00" }, { "name": "shaarli/netscape-bookmark-parser", - "version": "v2.0.5", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/shaarli/netscape-bookmark-parser.git", - "reference": "ea6911a0ea3dd372fa7002593c5aef9c15a49315" + "reference": "819008ee42c4dd7e45d988176a4a22d6ed689577" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/shaarli/netscape-bookmark-parser/zipball/ea6911a0ea3dd372fa7002593c5aef9c15a49315", - "reference": "ea6911a0ea3dd372fa7002593c5aef9c15a49315", + "url": "https://api.github.com/repos/shaarli/netscape-bookmark-parser/zipball/819008ee42c4dd7e45d988176a4a22d6ed689577", + "reference": "819008ee42c4dd7e45d988176a4a22d6ed689577", "shasum": "" }, "require": { "katzgrau/klogger": "~1.0", - "php": ">=5.3.4" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "4.8.*" + "phpunit/phpunit": "^5.0" }, "type": "library", "autoload": { @@ -681,22 +682,22 @@ "bookmark", "link", "netscape", - "parse" + "parser" ], - "time": "2018-01-30T17:34:48+00:00" + "time": "2018-10-06T14:43:38+00:00" }, { "name": "slim/slim", - "version": "3.10.0", + "version": "3.11.0", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "d8aabeacc3688b25e2f2dd2db91df91ec6fdd748" + "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/d8aabeacc3688b25e2f2dd2db91df91ec6fdd748", - "reference": "d8aabeacc3688b25e2f2dd2db91df91ec6fdd748", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/d378e70431e78ee92ee32ddde61ecc72edf5dc0a", + "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a", "shasum": "" }, "require": { @@ -754,7 +755,7 @@ "micro", "router" ], - "time": "2018-04-19T19:29:08+00:00" + "time": "2018-09-16T10:54:21+00:00" } ], "packages-dev": [ @@ -2255,16 +2256,16 @@ }, { "name": "symfony/config", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "7b08223b7f6abd859651c56bcabf900d1627d085" + "reference": "e5389132dc6320682de3643091121c048ff796b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/7b08223b7f6abd859651c56bcabf900d1627d085", - "reference": "7b08223b7f6abd859651c56bcabf900d1627d085", + "url": "https://api.github.com/repos/symfony/config/zipball/e5389132dc6320682de3643091121c048ff796b3", + "reference": "e5389132dc6320682de3643091121c048ff796b3", "shasum": "" }, "require": { @@ -2315,20 +2316,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-09-08T13:15:14+00:00" }, { "name": "symfony/console", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73" + "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73", - "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73", + "url": "https://api.github.com/repos/symfony/console/zipball/3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", + "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", "shasum": "" }, "require": { @@ -2384,20 +2385,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { "name": "symfony/debug", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc" + "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/d5a058ff6ecad26b30c1ba452241306ea34c65cc", - "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc", + "url": "https://api.github.com/repos/symfony/debug/zipball/0a612e9dfbd2ccce03eb174365f31ecdca930ff6", + "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6", "shasum": "" }, "require": { @@ -2440,20 +2441,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1" + "reference": "aea20fef4e92396928b5db175788b90234c0270d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1c0e679e522591fd744fdf242fec41a43d62b2b1", - "reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/aea20fef4e92396928b5db175788b90234c0270d", + "reference": "aea20fef4e92396928b5db175788b90234c0270d", "shasum": "" }, "require": { @@ -2511,20 +2512,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2018-07-29T15:19:31+00:00" + "time": "2018-10-02T12:28:39+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "a59f917e3c5d82332514cb4538387638f5bde2d6" + "reference": "d69930fc337d767607267d57c20a7403d0a822a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/a59f917e3c5d82332514cb4538387638f5bde2d6", - "reference": "a59f917e3c5d82332514cb4538387638f5bde2d6", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d69930fc337d767607267d57c20a7403d0a822a4", + "reference": "d69930fc337d767607267d57c20a7403d0a822a4", "shasum": "" }, "require": { @@ -2561,20 +2562,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-10-02T12:28:39+00:00" }, { "name": "symfony/finder", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "8a84fcb207451df0013b2c74cbbf1b62d47b999a" + "reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8a84fcb207451df0013b2c74cbbf1b62d47b999a", - "reference": "8a84fcb207451df0013b2c74cbbf1b62d47b999a", + "url": "https://api.github.com/repos/symfony/finder/zipball/54ba444dddc5bd5708a34bd095ea67c6eb54644d", + "reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d", "shasum": "" }, "require": { @@ -2610,7 +2611,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-10-03T08:46:40+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2731,16 +2732,16 @@ }, { "name": "symfony/yaml", - "version": "v3.4.14", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2" + "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", - "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/640b6c27fed4066d64b64d5903a86043f4a4de7f", + "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f", "shasum": "" }, "require": { @@ -2786,7 +2787,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { "name": "theseer/fdomdocument", From 8b2afee16bf5a4df4323ad89c1e9a68ae4756014 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Tue, 9 Oct 2018 17:31:39 +0000 Subject: [PATCH 20/36] Revert part of #1220 Fixes #1177 The `url` template filter is [only supported in Mkdocs 1.0+](https://github.com/mkdocs/mkdocs/blob/master/docs/about/release-notes.md#internal-refactor-of-pages-files-and-navigation) Readthedocs.org uses Mkdocs `0.17.3 ` while `make htmldoc` fetches the [latest version from pypi](https://pypi.org/project/mkdocs/) which is `1.0.4`. Following https://github.com/shaarli/Shaarli/pull/1220, building the docs fails with https://readthedocs.org/projects/shaarli/builds/7886340/ --- doc/custom_theme/main.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/custom_theme/main.html b/doc/custom_theme/main.html index 69b398f..cc2a703 100644 --- a/doc/custom_theme/main.html +++ b/doc/custom_theme/main.html @@ -20,6 +20,4 @@ the blocks defined in base.html and its included child templates. {% if page and page.is_homepage %}{% endif %} {% if config.site_author %}{% endif %} -{% if config.site_favicon %} -{% else %}{% endif %} {%- endblock %} From 37bbfb5f65f2d36e00042f233abdc27a7de341e9 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Thu, 11 Oct 2018 09:51:14 +0200 Subject: [PATCH 21/36] remove firefox share documentation Firefox Share integration has been removed in https://github.com/shaarli/Shaarli/pull/1026 Firefox Share is not available anymore in any ESR/release versions of Firefox --- doc/md/Sharing-content.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/doc/md/Sharing-content.md b/doc/md/Sharing-content.md index 4910ff6..9a16fc6 100644 --- a/doc/md/Sharing-content.md +++ b/doc/md/Sharing-content.md @@ -15,7 +15,6 @@ While logged in to your Shaarli, you can add new Shaares in several ways: * [+Shaare button](#shaare-button) * [Bookmarklet](#bookmarklet) - * [Firefox Share](#firefox-share) * Third-party [apps and browser addons](Community-&-Related-software.md#mobile-apps) * [REST API](https://shaarli.github.io/api-documentation/) @@ -52,22 +51,6 @@ bookmarklet in your browser! The same `New Shaare` dialog as above is displayed. ![](images/bookmarklet.png) -### Firefox Share - -Before using Firefox Share, you must first add Shaarli as a sharing provider: - -- Click the `Tools` button in the top bar -- Click the `✚Add to Firefox social` button and accept the activation. - -Once this is done, you can share any URL you are visiting by clicking the Firefox -_Share_ button ![images/firefoxshare.png](images/firefoxshare.png) - -| Note | Firefox Share is no longer available for Firefox 57 and later versions. | -|---------|---------| - -| Note | Your Shaarli instance must be hosted on an HTTPS (SSL/TLS secure connection) enabled server for Firefox Share to work. Firefox Share will not work over plaintext HTTP connections. | -|---------|---------| - -------------------------------------------------------------------------------- ## Editing Shaares From 6fd287a0a24c1930f4e9eed834a689748d21e69d Mon Sep 17 00:00:00 2001 From: "Alexandre G.-Raymond" Date: Sat, 20 Oct 2018 11:58:49 +0200 Subject: [PATCH 22/36] Dead link on dead link detector tool Author's repo moved to Framagit --- doc/md/Community-&-Related-software.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/md/Community-&-Related-software.md b/doc/md/Community-&-Related-software.md index 49c20c9..67fdd70 100644 --- a/doc/md/Community-&-Related-software.md +++ b/doc/md/Community-&-Related-software.md @@ -51,7 +51,7 @@ See [Theming](Theming) for a list of community-contributed themes, and an instal - [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features (a very popular running instance among French shaarliers: [shaarli.fr](http://shaarli.fr/)) - [Shaarlimages](https://github.com/BoboTiG/shaarlimages) - An image-oriented aggregator for Shaarlis - [mknexen/shaarli-api](https://github.com/mknexen/shaarli-api) - A REST API for Shaarli -- [Self dead link](https://github.com/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php) - Detect dead links on shaarli. This version use the database of shaarli. [Another version](https://github.com/qwertygc/shaarli-dev-code/blob/master/dead-link.php), can be used for other shaarli instances (but is more resource consuming). +- [Self dead link](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php) - Detect dead links on shaarli. This version use the database of shaarli. [Another version](https://framagit.org/qwertygc/shaarli-dev-code/blob/master/dead-link.php), can be used for other shaarli instances (but is more resource consuming). - [Bookmark Archiver](https://github.com/pirate/bookmark-archiver) - Save an archived copy of all websites starred using browser bookmarks/Shaarli/Delicious/Instapaper/Unmark.it/Pocket/Pinboard. Outputs browseable html. ## Alternatives to Shaarli From f6380409ac0b6ae1368d89ca749c139183e7b02e Mon Sep 17 00:00:00 2001 From: Bish Erbas <42714627+bisherbas@users.noreply.github.com> Date: Wed, 31 Oct 2018 09:09:35 -0400 Subject: [PATCH 23/36] Update session start condition Recommended method for PHP >= 5.4.0 as seen here https://stackoverflow.com/questions/6249707/check-if-php-session-has-already-started Per https://shaarli.readthedocs.io/en/master/Server-configuration/ Shaarli supports PHP >= 5.6 --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index b702bd1..82285dd 100644 --- a/index.php +++ b/index.php @@ -111,7 +111,7 @@ ini_set('session.use_trans_sid', false); session_name('shaarli'); // Start session if needed (Some server auto-start sessions). -if (session_id() == '') { +if (session_status() == PHP_SESSION_NONE) { session_start(); } From db06c261f65199e03245ae704a56e1057f2f7c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luce=20Carevi=C4=87?= Date: Fri, 30 Nov 2018 20:36:10 +0100 Subject: [PATCH 24/36] fix translation string --- tpl/default/page.header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/default/page.header.html b/tpl/default/page.header.html index 3b43a61..4f6dd4d 100644 --- a/tpl/default/page.header.html +++ b/tpl/default/page.header.html @@ -118,7 +118,7 @@ From 0c42c5e3597215949a8c374802f8f25be485f267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luce=20Carevi=C4=87?= Date: Fri, 30 Nov 2018 20:39:13 +0100 Subject: [PATCH 25/36] add label to form - accessibility issue Don't use placeholder instead of label for form input. --- tpl/default/addlink.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tpl/default/addlink.html b/tpl/default/addlink.html index 2f956e0..55864a0 100644 --- a/tpl/default/addlink.html +++ b/tpl/default/addlink.html @@ -11,7 +11,8 @@

    {"Shaare a new link"|t}

    - + +
    From 37c9c6b4e62ba25f889ebb6486fe5c442acc9095 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 12 Oct 2018 23:47:59 +0200 Subject: [PATCH 26/36] lint: remove unused tools Signed-off-by: VirtualTam --- Makefile | 56 -------- composer.json | 6 +- composer.lock | 357 ++------------------------------------------------ 3 files changed, 10 insertions(+), 409 deletions(-) diff --git a/Makefile b/Makefile index 56cf09b..2874069 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ BIN = vendor/bin PHP_SOURCE = index.php application tests plugins -PHP_COMMA_SOURCE = index.php,application,tests,plugins all: static_analysis_summary check_permissions test @@ -17,14 +16,6 @@ docker_%: rsync -az /shaarli/ ~/shaarli/ cd ~/shaarli && make $* -## -# Concise status of the project -# These targets are non-blocking: || exit 0 -## - -static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary - @echo - ## # PHP_CodeSniffer # Detects PHP syntax errors @@ -32,7 +23,6 @@ static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary # - http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php # - http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php ## - code_sniffer: code_sniffer_full ### - errors filtered by coding standard: PEAR, PSR1, PSR2, Zend... @@ -51,52 +41,6 @@ code_sniffer_full: code_sniffer_source: @$(BIN)/phpcs $(PHP_SOURCE) --report-source || exit 0 -## -# PHP Copy/Paste Detector -# Detects code redundancy -# Documentation: https://github.com/sebastianbergmann/phpcpd -## - -copy_paste: - @echo "-----------------------" - @echo "PHP COPY/PASTE DETECTOR" - @echo "-----------------------" - @$(BIN)/phpcpd $(PHP_SOURCE) || exit 0 - @echo - -## -# PHP Mess Detector -# Detects PHP syntax errors, sorted by category -# Rules documentation: http://phpmd.org/rules/index.html -## -MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode - -mess_title: - @echo "-----------------" - @echo "PHP MESS DETECTOR" - @echo "-----------------" - -### - all warnings -mess_detector: mess_title - @$(BIN)/phpmd $(PHP_COMMA_SOURCE) text $(MESS_DETECTOR_RULES) | sed 's_.*\/__' - -### - all warnings + HTML output contains links to PHPMD's documentation -mess_detector_html: - @$(BIN)/phpmd $(PHP_COMMA_SOURCE) html $(MESS_DETECTOR_RULES) \ - --reportfile phpmd.html || exit 0 - -### - warnings grouped by message, sorted by descending frequency order -mess_detector_grouped: mess_title - @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) \ - | cut -f 2 | sort | uniq -c | sort -nr - -### - summary: number of warnings by rule set -mess_detector_summary: mess_title - @for rule in $$(echo $(MESS_DETECTOR_RULES) | tr ',' ' '); do \ - warnings=$$($(BIN)/phpmd $(PHP_COMMA_SOURCE) text $$rule | wc -l); \ - printf "$$warnings\t$$rule\n"; \ - done; - ## # Checks source file & script permissions ## diff --git a/composer.json b/composer.json index f5e7a9c..dccf83b 100644 --- a/composer.json +++ b/composer.json @@ -24,11 +24,9 @@ "gettext/gettext": "^4.4" }, "require-dev": { - "phpmd/phpmd" : "@stable", + "phpunit/phpcov": "*", "phpunit/phpunit": "^5.0", - "sebastian/phpcpd": "*", - "squizlabs/php_codesniffer": "2.*", - "phpunit/phpcov": "*" + "squizlabs/php_codesniffer": "2.*" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index bdf1861..c43dad6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0dc33ee0b7d9f47868d4fa961f0d13b4", + "content-hash": "3876b34296fedb365517b785af8384de", "packages": [ { "name": "arthurhoaro/web-thumbnailer", @@ -593,12 +593,12 @@ "source": { "type": "git", "url": "https://github.com/pubsubhubbub/php-publisher.git", - "reference": "e8a7cf52a2c86b0c364da56f7192ec020c83b8f7" + "reference": "047b0faf6219071527a45942d6fef4dbc6d1d884" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pubsubhubbub/php-publisher/zipball/e8a7cf52a2c86b0c364da56f7192ec020c83b8f7", - "reference": "e8a7cf52a2c86b0c364da56f7192ec020c83b8f7", + "url": "https://api.github.com/repos/pubsubhubbub/php-publisher/zipball/047b0faf6219071527a45942d6fef4dbc6d1d884", + "reference": "047b0faf6219071527a45942d6fef4dbc6d1d884", "shasum": "" }, "require": { @@ -627,9 +627,10 @@ "data", "feeds", "publishers", - "pubsubhubbub" + "pubsubhubbub", + "websub" ], - "time": "2018-10-05T12:31:04+00:00" + "time": "2018-10-09T05:20:28+00:00" }, { "name": "shaarli/netscape-bookmark-parser", @@ -858,46 +859,6 @@ ], "time": "2017-10-19T19:58:43+00:00" }, - { - "name": "pdepend/pdepend", - "version": "2.5.2", - "source": { - "type": "git", - "url": "https://github.com/pdepend/pdepend.git", - "reference": "9daf26d0368d4a12bed1cacae1a9f3a6f0adf239" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/9daf26d0368d4a12bed1cacae1a9f3a6f0adf239", - "reference": "9daf26d0368d4a12bed1cacae1a9f3a6f0adf239", - "shasum": "" - }, - "require": { - "php": ">=5.3.7", - "symfony/config": "^2.3.0|^3|^4", - "symfony/dependency-injection": "^2.3.0|^3|^4", - "symfony/filesystem": "^2.3.0|^3|^4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8|^5.7", - "squizlabs/php_codesniffer": "^2.0.0" - }, - "bin": [ - "src/bin/pdepend" - ], - "type": "library", - "autoload": { - "psr-4": { - "PDepend\\": "src/main/php/PDepend" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Official version of pdepend to be handled with Composer", - "time": "2017-12-13T13:21:38+00:00" - }, { "name": "phpdocumentor/reflection-common", "version": "1.0.1", @@ -1044,72 +1005,6 @@ ], "time": "2017-07-14T14:27:02+00:00" }, - { - "name": "phpmd/phpmd", - "version": "2.6.0", - "source": { - "type": "git", - "url": "https://github.com/phpmd/phpmd.git", - "reference": "4e9924b2c157a3eb64395460fcf56b31badc8374" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/4e9924b2c157a3eb64395460fcf56b31badc8374", - "reference": "4e9924b2c157a3eb64395460fcf56b31badc8374", - "shasum": "" - }, - "require": { - "ext-xml": "*", - "pdepend/pdepend": "^2.5", - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.0" - }, - "bin": [ - "src/bin/phpmd" - ], - "type": "project", - "autoload": { - "psr-0": { - "PHPMD\\": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Manuel Pichler", - "email": "github@manuel-pichler.de", - "homepage": "https://github.com/manuelpichler", - "role": "Project Founder" - }, - { - "name": "Other contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", - "role": "Contributors" - }, - { - "name": "Marc Würth", - "email": "ravage@bluewin.ch", - "homepage": "https://github.com/ravage84", - "role": "Project Maintainer" - } - ], - "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", - "homepage": "http://phpmd.org/", - "keywords": [ - "mess detection", - "mess detector", - "pdepend", - "phpmd", - "pmd" - ], - "time": "2017-01-20T14:41:10+00:00" - }, { "name": "phpspec/prophecy", "version": "1.8.0", @@ -1988,56 +1883,6 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "time": "2017-02-18T15:18:39+00:00" }, - { - "name": "sebastian/phpcpd", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpcpd.git", - "reference": "dfed51c1288790fc957c9433e2f49ab152e8a564" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/dfed51c1288790fc957c9433e2f49ab152e8a564", - "reference": "dfed51c1288790fc957c9433e2f49ab152e8a564", - "shasum": "" - }, - "require": { - "php": "^5.6|^7.0", - "phpunit/php-timer": "^1.0.6", - "sebastian/finder-facade": "^1.1", - "sebastian/version": "^1.0|^2.0", - "symfony/console": "^2.7|^3.0|^4.0" - }, - "bin": [ - "phpcpd" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Copy/Paste Detector (CPD) for PHP code.", - "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2017-11-16T08:49:28+00:00" - }, { "name": "sebastian/recursion-context", "version": "2.0.0", @@ -2254,70 +2099,6 @@ ], "time": "2017-05-22T02:43:20+00:00" }, - { - "name": "symfony/config", - "version": "v3.4.17", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "e5389132dc6320682de3643091121c048ff796b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/e5389132dc6320682de3643091121c048ff796b3", - "reference": "e5389132dc6320682de3643091121c048ff796b3", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2018-09-08T13:15:14+00:00" - }, { "name": "symfony/console", "version": "v3.4.17", @@ -2443,127 +2224,6 @@ "homepage": "https://symfony.com", "time": "2018-10-02T16:33:53+00:00" }, - { - "name": "symfony/dependency-injection", - "version": "v3.4.17", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "aea20fef4e92396928b5db175788b90234c0270d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/aea20fef4e92396928b5db175788b90234c0270d", - "reference": "aea20fef4e92396928b5db175788b90234c0270d", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2018-10-02T12:28:39+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v3.4.17", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "d69930fc337d767607267d57c20a7403d0a822a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/d69930fc337d767607267d57c20a7403d0a822a4", - "reference": "d69930fc337d767607267d57c20a7403d0a822a4", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2018-10-02T12:28:39+00:00" - }, { "name": "symfony/finder", "version": "v3.4.17", @@ -2883,8 +2543,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "pubsubhubbub/publisher": 20, - "phpmd/phpmd": 0 + "pubsubhubbub/publisher": 20 }, "prefer-stable": false, "prefer-lowest": false, From 04ec8fedd91642d4c0fc96258868086b8a51c899 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 13 Oct 2018 00:05:04 +0200 Subject: [PATCH 27/36] lint: setup PHPCS for PSR-1 and PSR-2 Relates to https://github.com/shaarli/Shaarli/issues/95 See: - https://github.com/squizlabs/PHP_CodeSniffer - https://github.com/squizlabs/PHP_CodeSniffer/blob/master/phpcs.xml.dist - https://www.php-fig.org/psr/psr-1/ - https://www.php-fig.org/psr/psr-2/ Signed-off-by: VirtualTam --- Makefile | 14 ++++++++------ phpcs.xml | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 phpcs.xml diff --git a/Makefile b/Makefile index 2874069..b758d1f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ # Makefile for PHP code analysis & testing, documentation and release generation BIN = vendor/bin -PHP_SOURCE = index.php application tests plugins all: static_analysis_summary check_permissions test @@ -23,23 +22,26 @@ docker_%: # - http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php # - http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php ## -code_sniffer: code_sniffer_full +PHPCS := $(BIN)/phpcs + +code_sniffer: + @$(PHPCS) ### - errors filtered by coding standard: PEAR, PSR1, PSR2, Zend... PHPCS_%: - @$(BIN)/phpcs $(PHP_SOURCE) --report-full --report-width=200 --standard=$* + @$(PHPCS) --report-full --report-width=200 --standard=$* ### - errors by Git author code_sniffer_blame: - @$(BIN)/phpcs $(PHP_SOURCE) --report-gitblame + @$(PHPCS) --report-gitblame ### - all errors/warnings code_sniffer_full: - @$(BIN)/phpcs $(PHP_SOURCE) --report-full --report-width=200 + @$(PHPCS) --report-full --report-width=200 ### - errors grouped by kind code_sniffer_source: - @$(BIN)/phpcs $(PHP_SOURCE) --report-source || exit 0 + @$(PHPCS) --report-source || exit 0 ## # Checks source file & script permissions diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..29b95d5 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,17 @@ + + + The Shaarli coding standards + + index.php + application + plugins + tests + + */*.css + */*.js + + + + + + From f211e417bf637b8a83988175c29ee072c69f7642 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 13 Oct 2018 00:19:03 +0200 Subject: [PATCH 28/36] lint: apply phpcbf to application/ Signed-off-by: VirtualTam --- application/ApplicationUtils.php | 17 ++++++------ application/Base64Url.php | 7 ++--- application/FeedBuilder.php | 4 +-- application/HttpUtils.php | 26 +++++++++---------- application/Languages.php | 11 +++++--- application/LinkDB.php | 14 +++++----- application/LinkFilter.php | 25 +++++++++--------- application/LinkUtils.php | 5 ++-- application/NetscapeBookmarkUtils.php | 11 ++++---- application/PageBuilder.php | 3 +-- application/PluginManager.php | 3 +-- application/Updater.php | 2 +- application/Url.php | 19 ++++++++------ application/Utils.php | 16 +++++++----- application/api/ApiMiddleware.php | 5 ++-- application/api/controllers/ApiController.php | 2 +- application/api/controllers/History.php | 3 +-- application/api/controllers/Info.php | 4 +-- application/api/exceptions/ApiException.php | 8 +++--- .../exceptions/ApiLinkNotFoundException.php | 1 - .../exceptions/ApiTagNotFoundException.php | 1 - application/config/ConfigPlugin.php | 3 +-- application/security/LoginManager.php | 1 - 23 files changed, 98 insertions(+), 93 deletions(-) diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index 911873a..a3b2dcb 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -24,7 +24,7 @@ class ApplicationUtils * * @return mixed the version code from the repository if available, else 'false' */ - public static function getLatestGitVersionCode($url, $timeout=2) + public static function getLatestGitVersionCode($url, $timeout = 2) { list($headers, $data) = get_http_response($url, $timeout); @@ -86,13 +86,14 @@ class ApplicationUtils * * @return mixed the new version code if available and greater, else 'false' */ - public static function checkUpdate($currentVersion, - $updateFile, - $checkInterval, - $enableCheck, - $isLoggedIn, - $branch='stable') - { + public static function checkUpdate( + $currentVersion, + $updateFile, + $checkInterval, + $enableCheck, + $isLoggedIn, + $branch = 'stable' + ) { // Do not check versions for visitors // Do not check if the user doesn't want to // Do not check with dev version diff --git a/application/Base64Url.php b/application/Base64Url.php index 61590e4..54d0fcd 100644 --- a/application/Base64Url.php +++ b/application/Base64Url.php @@ -2,7 +2,6 @@ namespace Shaarli; - /** * URL-safe Base64 operations * @@ -17,7 +16,8 @@ class Base64Url * * @return string Base64Url-encoded data */ - public static function encode($data) { + public static function encode($data) + { return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); } @@ -28,7 +28,8 @@ class Base64Url * * @return string Decoded data */ - public static function decode($data) { + public static function decode($data) + { return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); } } diff --git a/application/FeedBuilder.php b/application/FeedBuilder.php index ebae18b..73fafcb 100644 --- a/application/FeedBuilder.php +++ b/application/FeedBuilder.php @@ -163,7 +163,8 @@ class FeedBuilder $upDate = $link['updated']; $link['up_iso_date'] = $this->getIsoDate($upDate, DateTime::ATOM); } else { - $link['up_iso_date'] = $this->getIsoDate($pubDate, DateTime::ATOM);; + $link['up_iso_date'] = $this->getIsoDate($pubDate, DateTime::ATOM); + ; } // Save the more recent item. @@ -261,7 +262,6 @@ class FeedBuilder } if ($this->feedType == self::$FEED_RSS) { return $date->format(DateTime::RSS); - } return $date->format(DateTime::ATOM); } diff --git a/application/HttpUtils.php b/application/HttpUtils.php index e928250..ef6f326 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php @@ -64,29 +64,30 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304, $curlWriteF } // General cURL settings - curl_setopt($ch, CURLOPT_AUTOREFERER, true); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_HEADER, true); + curl_setopt($ch, CURLOPT_AUTOREFERER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Accept-Language: ' . $acceptLanguage) ); - curl_setopt($ch, CURLOPT_MAXREDIRS, $maxRedirs); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); + curl_setopt($ch, CURLOPT_MAXREDIRS, $maxRedirs); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); + curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); if (is_callable($curlWriteFunction)) { curl_setopt($ch, CURLOPT_WRITEFUNCTION, $curlWriteFunction); } // Max download size management - curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16); - curl_setopt($ch, CURLOPT_NOPROGRESS, false); - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, - function($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes) - { + curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16); + curl_setopt($ch, CURLOPT_NOPROGRESS, false); + curl_setopt( + $ch, + CURLOPT_PROGRESSFUNCTION, + function ($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes) { if (version_compare(phpversion(), '5.5', '<')) { // PHP version lower than 5.5 // Callback has 4 arguments @@ -232,7 +233,6 @@ function get_redirected_headers($url, $redirectionLimit = 3) && !empty($headers) && (strpos($headers[0], '301') !== false || strpos($headers[0], '302') !== false) && !empty($headers['Location'])) { - $redirection = is_array($headers['Location']) ? end($headers['Location']) : $headers['Location']; if ($redirection != $url) { $redirection = getAbsoluteUrl($url, $redirection); diff --git a/application/Languages.php b/application/Languages.php index 4fa3242..6a6247c 100644 --- a/application/Languages.php +++ b/application/Languages.php @@ -92,7 +92,7 @@ class Languages /** * Initialize the translator using php gettext extension (gettext dependency act as a wrapper). */ - protected function initGettextTranslator () + protected function initGettextTranslator() { $this->translator = new GettextTranslator(); $this->translator->setLanguage($this->language); @@ -125,7 +125,8 @@ class Languages $translations = $translations->addFromPoFile('inc/languages/'. $this->language .'/LC_MESSAGES/shaarli.po'); $translations->setDomain('shaarli'); $this->translator->loadTranslations($translations); - } catch (\InvalidArgumentException $e) {} + } catch (\InvalidArgumentException $e) { + } // Default extension translation from the current theme $theme = $this->conf->get('theme'); @@ -137,7 +138,8 @@ class Languages ); $translations->setDomain($theme); $this->translator->loadTranslations($translations); - } catch (\InvalidArgumentException $e) {} + } catch (\InvalidArgumentException $e) { + } } // Extension translations (plugins, themes, etc.). @@ -150,7 +152,8 @@ class Languages $extension = Translations::fromPoFile($translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po'); $extension->setDomain($domain); $this->translator->loadTranslations($extension); - } catch (\InvalidArgumentException $e) {} + } catch (\InvalidArgumentException $e) { + } } } diff --git a/application/LinkDB.php b/application/LinkDB.php index cdd68cf..1f7c28c 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -107,8 +107,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess $hidePublicLinks, $redirector = '', $redirectorEncode = true - ) - { + ) { $this->datastore = $datastore; $this->loggedIn = $isLoggedIn; $this->hidePublicLinks = $hidePublicLinks; @@ -317,8 +316,7 @@ You use the community supported version of the original Shaarli project, by Seba } else { $link['real_url'] .= $link['url']; } - } - else { + } else { $link['real_url'] = $link['url']; } @@ -403,7 +401,8 @@ You use the community supported version of the original Shaarli project, by Seba * * @return array list of shaare found. */ - public function filterDay($request) { + public function filterDay($request) + { $linkFilter = new LinkFilter($this->links); return $linkFilter->filter(LinkFilter::$FILTER_DAY, $request); } @@ -492,8 +491,7 @@ You use the community supported version of the original Shaarli project, by Seba $delete = empty($to); // True for case-sensitive tag search. $linksToAlter = $this->filterSearch(['searchtags' => $from], true); - foreach($linksToAlter as $key => &$value) - { + foreach ($linksToAlter as $key => &$value) { $tags = preg_split('/\s+/', trim($value['tags'])); if (($pos = array_search($from, $tags)) !== false) { if ($delete) { @@ -536,7 +534,7 @@ You use the community supported version of the original Shaarli project, by Seba { $order = $order === 'ASC' ? -1 : 1; // Reorder array by dates. - usort($this->links, function($a, $b) use ($order) { + usort($this->links, function ($a, $b) use ($order) { if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { return $a['sticky'] ? -1 : 1; } diff --git a/application/LinkFilter.php b/application/LinkFilter.php index e52239b..8f14797 100644 --- a/application/LinkFilter.php +++ b/application/LinkFilter.php @@ -62,7 +62,7 @@ class LinkFilter $visibility = 'all'; } - switch($type) { + switch ($type) { case self::$FILTER_HASH: return $this->filterSmallHash($request); case self::$FILTER_TAG | self::$FILTER_TEXT: // == "vuotext" @@ -205,7 +205,6 @@ class LinkFilter // Iterate over every stored link. foreach ($this->links as $id => $link) { - // ignore non private links when 'privatonly' is on. if ($visibility !== 'all') { if (! $link['private'] && $visibility === 'private') { @@ -257,11 +256,11 @@ class LinkFilter private static function tag2regex($tag) { $len = strlen($tag); - if(!$len || $tag === "-" || $tag === "*"){ + if (!$len || $tag === "-" || $tag === "*") { // nothing to search, return empty regex return ''; } - if($tag[0] === "-") { + if ($tag[0] === "-") { // query is negated $i = 1; // use offset to start after '-' character $regex = '(?!'; // create negative lookahead @@ -271,14 +270,14 @@ class LinkFilter } $regex .= '.*(?:^| )'; // before tag may only be a space or the beginning // iterate over string, separating it into placeholder and content - for(; $i < $len; $i++){ - if($tag[$i] === '*'){ + for (; $i < $len; $i++) { + if ($tag[$i] === '*') { // placeholder found $regex .= '[^ ]*?'; } else { // regular characters $offset = strpos($tag, '*', $i); - if($offset === false){ + if ($offset === false) { // no placeholder found, set offset to end of string $offset = $len; } @@ -310,19 +309,19 @@ class LinkFilter { // get single tags (we may get passed an array, even though the docs say different) $inputTags = $tags; - if(!is_array($tags)) { + if (!is_array($tags)) { // we got an input string, split tags $inputTags = preg_split('/(?:\s+)|,/', $inputTags, -1, PREG_SPLIT_NO_EMPTY); } - if(!count($inputTags)){ + if (!count($inputTags)) { // no input tags return $this->noFilter($visibility); } // build regex from all tags $re = '/^' . implode(array_map("self::tag2regex", $inputTags)) . '.*$/'; - if(!$casesensitive) { + if (!$casesensitive) { // make regex case insensitive $re .= 'i'; } @@ -342,7 +341,7 @@ class LinkFilter } } $search = $link['tags']; // build search string, start with tags of current link - if(strlen(trim($link['description'])) && strpos($link['description'], '#') !== false){ + if (strlen(trim($link['description'])) && strpos($link['description'], '#') !== false) { // description given and at least one possible tag found $descTags = array(); // find all tags in the form of #tag in the description @@ -351,13 +350,13 @@ class LinkFilter $link['description'], $descTags ); - if(count($descTags[1])){ + if (count($descTags[1])) { // there were some tags in the description, add them to the search string $search .= ' ' . implode(' ', $descTags[1]); } }; // match regular expression with search string - if(!preg_match($re, $search)){ + if (!preg_match($re, $search)) { // this entry does _not_ match our regex continue; } diff --git a/application/LinkUtils.php b/application/LinkUtils.php index 4df5c0c..d56e019 100644 --- a/application/LinkUtils.php +++ b/application/LinkUtils.php @@ -23,7 +23,7 @@ function get_curl_download_callback(&$charset, &$title, $curlGetInfo = 'curl_get * * @return int|bool length of $data or false if we need to stop the download */ - return function(&$ch, $data) use ($curlGetInfo, &$charset, &$title, &$isRedirected) { + return function (&$ch, $data) use ($curlGetInfo, &$charset, &$title, &$isRedirected) { $responseCode = $curlGetInfo($ch, CURLINFO_RESPONSE_CODE); if (!empty($responseCode) && in_array($responseCode, [301, 302])) { $isRedirected = true; @@ -201,7 +201,8 @@ function space2nbsp($text) * @return string formatted description. */ -function format_description($description, $redirector = '', $urlEncode = true, $indexUrl = '') { +function format_description($description, $redirector = '', $urlEncode = true, $indexUrl = '') +{ return nl2br(space2nbsp(hashtag_autolink(text2clickable($description, $redirector, $urlEncode), $indexUrl))); } diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index b4d16d0..e147d32 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php @@ -72,12 +72,11 @@ class NetscapeBookmarkUtils private static function importStatus( $filename, $filesize, - $importCount=0, - $overwriteCount=0, - $skipCount=0, - $duration=0 - ) - { + $importCount = 0, + $overwriteCount = 0, + $skipCount = 0, + $duration = 0 + ) { $status = sprintf(t('File %s (%d bytes) '), $filename, $filesize); if ($importCount == 0 && $overwriteCount == 0 && $skipCount == 0) { $status .= t('has an unknown file format. Nothing was imported.'); diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 0efd24c..2ca9583 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -78,7 +78,6 @@ class PageBuilder ); $this->tpl->assign('newVersion', escape($version)); $this->tpl->assign('versionError', ''); - } catch (Exception $exc) { logm($this->conf->get('resource.log'), $_SERVER['REMOTE_ADDR'], $exc->getMessage()); $this->tpl->assign('newVersion', ''); @@ -163,7 +162,7 @@ class PageBuilder $this->initialize(); } - if (empty($data) || !is_array($data)){ + if (empty($data) || !is_array($data)) { return false; } diff --git a/application/PluginManager.php b/application/PluginManager.php index cf60384..1ed4db4 100644 --- a/application/PluginManager.php +++ b/application/PluginManager.php @@ -75,8 +75,7 @@ class PluginManager try { $this->loadPlugin($dirs[$index], $plugin); - } - catch (PluginFileNotFoundException $e) { + } catch (PluginFileNotFoundException $e) { error_log($e->getMessage()); } } diff --git a/application/Updater.php b/application/Updater.php index 5dde47c..6b94c5e 100644 --- a/application/Updater.php +++ b/application/Updater.php @@ -183,7 +183,7 @@ class Updater } } - try{ + try { $this->conf->write($this->isLoggedIn); return true; } catch (IOException $e) { diff --git a/application/Url.php b/application/Url.php index 6b9870f..3b7f19c 100644 --- a/application/Url.php +++ b/application/Url.php @@ -34,8 +34,8 @@ function unparse_url($parsedUrl) */ function cleanup_url($url) { - $obj_url = new Url($url); - return $obj_url->cleanup(); + $obj_url = new Url($url); + return $obj_url->cleanup(); } /** @@ -47,8 +47,8 @@ function cleanup_url($url) */ function get_url_scheme($url) { - $obj_url = new Url($url); - return $obj_url->getScheme(); + $obj_url = new Url($url); + return $obj_url->getScheme(); } /** @@ -217,7 +217,7 @@ class Url } $this->parts['query'] = implode('&', $queryParams); - } + } /** * Removes undesired fragments @@ -269,7 +269,8 @@ class Url * * @return string the URL scheme or false if none is provided. */ - public function getScheme() { + public function getScheme() + { if (!isset($this->parts['scheme'])) { return false; } @@ -281,7 +282,8 @@ class Url * * @return string the URL host or false if none is provided. */ - public function getHost() { + public function getHost() + { if (empty($this->parts['host'])) { return false; } @@ -293,7 +295,8 @@ class Url * * @return true is HTTP, false otherwise. */ - public function isHttp() { + public function isHttp() + { return strpos(strtolower($this->parts['scheme']), 'http') !== false; } } diff --git a/application/Utils.php b/application/Utils.php index 97b12fc..925e1a2 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -97,7 +97,7 @@ function escape($input) if (is_array($input)) { $out = array(); - foreach($input as $key => $value) { + foreach ($input as $key => $value) { $out[$key] = escape($value); } return $out; @@ -355,10 +355,13 @@ function return_bytes($val) $val = trim($val); $last = strtolower($val[strlen($val)-1]); $val = intval(substr($val, 0, -1)); - switch($last) { - case 'g': $val *= 1024; - case 'm': $val *= 1024; - case 'k': $val *= 1024; + switch ($last) { + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; } return $val; } @@ -452,6 +455,7 @@ function alphabetical_sort(&$data, $reverse = false, $byKeys = false) * * @return string Text translated. */ -function t($text, $nText = '', $nb = 1, $domain = 'shaarli') { +function t($text, $nText = '', $nb = 1, $domain = 'shaarli') +{ return dn__($domain, $text, $nText, $nb); } diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index ff20939..66eac13 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php @@ -65,7 +65,7 @@ class ApiMiddleware try { $this->checkRequest($request); $response = $next($request, $response); - } catch(ApiException $e) { + } catch (ApiException $e) { $e->setResponse($response); $e->setDebug($this->conf->get('dev.debug', false)); $response = $e->getApiResponse(); @@ -98,7 +98,8 @@ class ApiMiddleware * * @throws ApiAuthorizationException The token couldn't be validated. */ - protected function checkToken($request) { + protected function checkToken($request) + { if (! $request->hasHeader('Authorization')) { throw new ApiAuthorizationException('JWT token not provided'); } diff --git a/application/api/controllers/ApiController.php b/application/api/controllers/ApiController.php index 3be85b9..9edefcf 100644 --- a/application/api/controllers/ApiController.php +++ b/application/api/controllers/ApiController.php @@ -41,7 +41,7 @@ abstract class ApiController /** * ApiController constructor. - * + * * Note: enabling debug mode displays JSON with readable formatting. * * @param Container $ci Slim container. diff --git a/application/api/controllers/History.php b/application/api/controllers/History.php index 5cc453b..4582e8b 100644 --- a/application/api/controllers/History.php +++ b/application/api/controllers/History.php @@ -35,8 +35,7 @@ class History extends ApiController $offset = $request->getParam('offset'); if (empty($offset)) { $offset = 0; - } - elseif (ctype_digit($offset)) { + } elseif (ctype_digit($offset)) { $offset = (int) $offset; } else { throw new ApiBadParametersException('Invalid offset'); diff --git a/application/api/controllers/Info.php b/application/api/controllers/Info.php index 25433f7..f37dcae 100644 --- a/application/api/controllers/Info.php +++ b/application/api/controllers/Info.php @@ -7,7 +7,7 @@ use Slim\Http\Response; /** * Class Info - * + * * REST API Controller: /info * * @package Api\Controllers @@ -17,7 +17,7 @@ class Info extends ApiController { /** * Service providing various information about Shaarli instance. - * + * * @param Request $request Slim request. * @param Response $response Slim response. * diff --git a/application/api/exceptions/ApiException.php b/application/api/exceptions/ApiException.php index c8490e0..d6b6632 100644 --- a/application/api/exceptions/ApiException.php +++ b/application/api/exceptions/ApiException.php @@ -10,7 +10,8 @@ use Slim\Http\Response; * Parent Exception related to the API, able to generate a valid Response (ResponseInterface). * Also can include various information in debug mode. */ -abstract class ApiException extends \Exception { +abstract class ApiException extends \Exception +{ /** * @var Response instance from Slim. @@ -27,7 +28,7 @@ abstract class ApiException extends \Exception { * * @return Response Final response to give. */ - public abstract function getApiResponse(); + abstract public function getApiResponse(); /** * Creates ApiResponse body. @@ -36,7 +37,8 @@ abstract class ApiException extends \Exception { * * @return array|string response body */ - protected function getApiResponseBody() { + protected function getApiResponseBody() + { if ($this->debug !== true) { return $this->getMessage(); } diff --git a/application/api/exceptions/ApiLinkNotFoundException.php b/application/api/exceptions/ApiLinkNotFoundException.php index de7e14f..c727f4f 100644 --- a/application/api/exceptions/ApiLinkNotFoundException.php +++ b/application/api/exceptions/ApiLinkNotFoundException.php @@ -2,7 +2,6 @@ namespace Shaarli\Api\Exceptions; - use Slim\Http\Response; /** diff --git a/application/api/exceptions/ApiTagNotFoundException.php b/application/api/exceptions/ApiTagNotFoundException.php index eed5afa..eee152f 100644 --- a/application/api/exceptions/ApiTagNotFoundException.php +++ b/application/api/exceptions/ApiTagNotFoundException.php @@ -2,7 +2,6 @@ namespace Shaarli\Api\Exceptions; - use Slim\Http\Response; /** diff --git a/application/config/ConfigPlugin.php b/application/config/ConfigPlugin.php index b3d9752..dbb2493 100644 --- a/application/config/ConfigPlugin.php +++ b/application/config/ConfigPlugin.php @@ -34,8 +34,7 @@ function save_plugin_config($formData) // If there is no order, it means a disabled plugin has been enabled. if (isset($formData['order_' . $key])) { $plugins[(int) $formData['order_' . $key]] = $key; - } - else { + } else { $newEnabledPlugins[] = $key; } } diff --git a/application/security/LoginManager.php b/application/security/LoginManager.php index d6784d6..0f31548 100644 --- a/application/security/LoginManager.php +++ b/application/security/LoginManager.php @@ -95,7 +95,6 @@ class LoginManager // The user client has a valid stay-signed-in cookie // Session information is updated with the current client information $this->sessionManager->storeLoginInfo($clientIpId); - } elseif ($this->sessionManager->hasSessionExpired() || $this->sessionManager->hasClientIpChanged($clientIpId) ) { From a0ab3c3f68ed3bca7d218e6e5847820b82b086ca Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 13 Oct 2018 00:22:45 +0200 Subject: [PATCH 29/36] lint: apply phpcbf to plugins/ Signed-off-by: VirtualTam --- plugins/archiveorg/archiveorg.php | 2 +- plugins/demo_plugin/demo_plugin.php | 4 +--- plugins/markdown/markdown.php | 16 +++++++++------- plugins/pubsubhubbub/pubsubhubbub.php | 5 +++-- plugins/qrcode/qrcode.php | 3 ++- plugins/wallabag/wallabag.php | 1 - 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index cda3575..5dcea5a 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php @@ -17,7 +17,7 @@ function hook_archiveorg_render_linklist($data) $archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html'); foreach ($data['links'] as &$value) { - if($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { + if ($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { continue; } $archive = sprintf($archive_html, $value['url'], t('View on archive.org')); diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index f3a63b6..bdbc719 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php @@ -73,7 +73,6 @@ function hook_demo_plugin_render_header($data) { // Only execute when linklist is rendered. if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { - // If loggedin if ($data['_LOGGEDIN_'] === true) { /* @@ -448,8 +447,7 @@ function hook_demo_plugin_render_feed($data) foreach ($data['links'] as &$link) { if ($data['_PAGE_'] == Router::$PAGE_FEED_ATOM) { $link['description'] .= ' - ATOM Feed' ; - } - elseif ($data['_PAGE_'] == Router::$PAGE_FEED_RSS) { + } elseif ($data['_PAGE_'] == Router::$PAGE_FEED_RSS) { $link['description'] .= ' - RSS Feed'; } } diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 08e64da..8823af9 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -139,7 +139,6 @@ function hook_markdown_render_includes($data) || $data['_PAGE_'] == Router::$PAGE_DAILY || $data['_PAGE_'] == Router::$PAGE_EDITLINK ) { - $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/markdown/markdown.css'; } @@ -195,8 +194,7 @@ function reverse_text2clickable($description) // Detect and toggle block of code if (!$codeBlockOn) { $codeBlockOn = preg_match('/^```/', $descriptionLine) > 0; - } - elseif (preg_match('/^```/', $descriptionLine) > 0) { + } elseif (preg_match('/^```/', $descriptionLine) > 0) { $codeBlockOn = false; } @@ -302,13 +300,17 @@ function sanitize_html($description) foreach ($escapeTags as $tag) { $description = preg_replace_callback( '#<\s*'. $tag .'[^>]*>(.*]*>)?#is', - function ($match) { return escape($match[0]); }, - $description); + function ($match) { + return escape($match[0]); + }, + $description + ); } $description = preg_replace( '#(<[^>]+\s)on[a-z]*="?[^ "]*"?#is', '$1', - $description); + $description + ); return $description; } @@ -341,7 +343,7 @@ function process_markdown($description, $escape = true, $allowedProtocols = []) ->text($processedDescription); $processedDescription = sanitize_html($processedDescription); - if(!empty($processedDescription)){ + if (!empty($processedDescription)) { $processedDescription = '
    '. $processedDescription . '
    '; } diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php index 184b588..9f0342a 100644 --- a/plugins/pubsubhubbub/pubsubhubbub.php +++ b/plugins/pubsubhubbub/pubsubhubbub.php @@ -6,7 +6,7 @@ * PubSub is a protocol which fasten up RSS fetching: * - Every time a new link is posted, Shaarli notify the hub. * - The hub notify all feed subscribers that a new link has been posted. - * - Subscribers retrieve the new link. + * - Subscribers retrieve the new link. */ use pubsubhubbub\publisher\Publisher; @@ -82,7 +82,8 @@ function hook_pubsubhubbub_save_link($data, $conf) * * @throws Exception An error occurred. */ -function nocurl_http_post($url, $postString) { +function nocurl_http_post($url, $postString) +{ $params = array('http' => array( 'method' => 'POST', 'content' => $postString, diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index 0f96a10..4b59caa 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php @@ -17,7 +17,8 @@ function hook_qrcode_render_linklist($data) $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); foreach ($data['links'] as &$value) { - $qrcode = sprintf($qrcode_html, + $qrcode = sprintf( + $qrcode_html, urlencode($value['url']), $value['url'], PluginManager::$PLUGINS_PATH diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 9dfd079..a6476c7 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php @@ -69,4 +69,3 @@ function wallabag_dummy_translation() t('Wallabag API URL'); t('Wallabag API version (1 or 2)'); } - From 93bf0918fa7bb1efb39d1540d7e46e52767270df Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 13 Oct 2018 00:31:11 +0200 Subject: [PATCH 30/36] lint: apply phpcbf to index.php Signed-off-by: VirtualTam --- index.php | 231 +++++++++++++++++++++++++++--------------------------- 1 file changed, 115 insertions(+), 116 deletions(-) diff --git a/index.php b/index.php index 82285dd..2e350fc 100644 --- a/index.php +++ b/index.php @@ -28,7 +28,7 @@ if (date_default_timezone_get() == '') { define('WEB_PATH', substr($_SERVER['REQUEST_URI'], 0, 1+strrpos($_SERVER['REQUEST_URI'], '/', 0))); // High execution time in case of problematic imports/exports. -ini_set('max_input_time','60'); +ini_set('max_input_time', '60'); // Try to set max upload file size and read ini_set('memory_limit', '128M'); @@ -85,7 +85,7 @@ use \Shaarli\Thumbnailer; // Ensure the PHP version is supported try { ApplicationUtils::checkPHPVersion('5.5', PHP_VERSION); -} catch(Exception $exc) { +} catch (Exception $exc) { header('Content-Type: text/plain; charset=utf-8'); echo $exc->getMessage(); exit; @@ -223,7 +223,6 @@ if (isset($_POST['login'])) { $expirationTime, WEB_PATH ); - } else { // Standard session expiration (=when browser closes) $expirationTime = 0; @@ -257,7 +256,8 @@ if (isset($_POST['login'])) { exit; } } - header('Location: ?'); exit; + header('Location: ?'); + exit; } else { $loginManager->handleFailedLogin($_SERVER); $redir = '&username='. urlencode($_POST['login']); @@ -278,7 +278,9 @@ if (isset($_POST['login'])) { // ------------------------------------------------------------------------------------------ // Token management for XSRF protection // Token should be used in any form which acts on data (create,update,delete,import...). -if (!isset($_SESSION['tokens'])) $_SESSION['tokens']=array(); // Token are attached to the session. +if (!isset($_SESSION['tokens'])) { + $_SESSION['tokens']=array(); // Token are attached to the session. +} /** * Daily RSS feed: 1 RSS entry per day giving all the links on that day. @@ -288,13 +290,14 @@ if (!isset($_SESSION['tokens'])) $_SESSION['tokens']=array(); // Token are atta * @param ConfigManager $conf Configuration Manager instance * @param LoginManager $loginManager LoginManager instance */ -function showDailyRSS($conf, $loginManager) { +function showDailyRSS($conf, $loginManager) +{ // Cache system $query = $_SERVER['QUERY_STRING']; $cache = new CachedPage( $conf->get('config.PAGE_CACHE'), page_url($_SERVER), - startsWith($query,'do=dailyrss') && !$loginManager->isLoggedIn() + startsWith($query, 'do=dailyrss') && !$loginManager->isLoggedIn() ); $cached = $cache->cachedVersion(); if (!empty($cached)) { @@ -395,7 +398,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager) { $day = date('Ymd', strtotime('-1 day')); // Yesterday, in format YYYYMMDD. if (isset($_GET['day'])) { - $day = $_GET['day']; + $day = $_GET['day']; } $days = $LINKSDB->days(); @@ -413,7 +416,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager) $previousday=$days[$i - 1]; } if ($i < count($days) - 1) { - $nextday = $days[$i + 1]; + $nextday = $days[$i + 1]; } } try { @@ -424,8 +427,8 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager) } // We pre-format some fields for proper output. - foreach($linksToDisplay as $key => $link) { - $taglist = explode(' ',$link['tags']); + foreach ($linksToDisplay as $key => $link) { + $taglist = explode(' ', $link['tags']); uasort($taglist, 'strcasecmp'); $linksToDisplay[$key]['taglist']=$taglist; $linksToDisplay[$key]['formatedDescription'] = format_description( @@ -457,14 +460,14 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager) */ $columns = array(array(), array(), array()); // Entries to display, for each column. $fill = array(0, 0, 0); // Rough estimate of columns fill. - foreach($data['linksToDisplay'] as $key => $link) { + foreach ($data['linksToDisplay'] as $key => $link) { // Roughly estimate length of entry (by counting characters) // Title: 30 chars = 1 line. 1 line is 30 pixels height. // Description: 836 characters gives roughly 342 pixel height. // This is not perfect, but it's usually OK. $length = strlen($link['title']) + (342 * strlen($link['description'])) / 836; if ($link['thumbnail']) { - $length += 100; // 1 thumbnails roughly takes 100 pixels height. + $length += 100; // 1 thumbnails roughly takes 100 pixels height. } // Then put in column which is the less filled: $smallest = min($fill); // find smallest value in array. @@ -492,8 +495,9 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager) * @param ConfigManager $conf Configuration Manager instance. * @param PluginManager $pluginManager Plugin Manager instance. */ -function showLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager) { - buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager, $loginManager); +function showLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager) +{ + buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager); $PAGE->renderPage('linklist'); } @@ -524,8 +528,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $updater->getDoneUpdates() ); } - } - catch(Exception $e) { + } catch (Exception $e) { die($e->getMessage()); } @@ -538,8 +541,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $query = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : ''; $targetPage = Router::findPage($query, $_GET, $loginManager->isLoggedIn()); - if ( - // if the user isn't logged in + if (// if the user isn't logged in !$loginManager->isLoggedIn() && // and Shaarli doesn't have public content... $conf->get('privacy.hide_public_links') && @@ -563,9 +565,11 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, 'footer', ); - foreach($common_hooks as $name) { + foreach ($common_hooks as $name) { $plugin_data = array(); - $pluginManager->executeHooks('render_' . $name, $plugin_data, + $pluginManager->executeHooks( + 'render_' . $name, + $plugin_data, array( 'target' => $targetPage, 'loggedin' => $loginManager->isLoggedIn() @@ -575,13 +579,15 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- Display login form. - if ($targetPage == Router::$PAGE_LOGIN) - { - if ($conf->get('security.open_shaarli')) { header('Location: ?'); exit; } // No need to login for open Shaarli + if ($targetPage == Router::$PAGE_LOGIN) { + if ($conf->get('security.open_shaarli')) { + header('Location: ?'); + exit; + } // No need to login for open Shaarli if (isset($_GET['username'])) { $PAGE->assign('username', escape($_GET['username'])); } - $PAGE->assign('returnurl',(isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']):'')); + $PAGE->assign('returnurl', (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']):'')); // add default state of the 'remember me' checkbox $PAGE->assign('remember_user_default', $conf->get('privacy.remember_user_default')); $PAGE->assign('user_can_login', $loginManager->canLogin($_SERVER)); @@ -590,8 +596,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, exit; } // -------- User wants to logout. - if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=logout')) - { + if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=logout')) { invalidateCaches($conf->get('resource.page_cache')); $sessionManager->logout(); setcookie(LoginManager::$STAY_SIGNED_IN_COOKIE, 'false', 0, WEB_PATH); @@ -600,8 +605,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- Picture wall - if ($targetPage == Router::$PAGE_PICWALL) - { + if ($targetPage == Router::$PAGE_PICWALL) { $PAGE->assign('pagetitle', t('Picture wall') .' - '. $conf->get('general.title', 'Shaarli')); if (! $conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) === Thumbnailer::MODE_NONE) { $PAGE->assign('linksToDisplay', []); @@ -615,8 +619,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, // Get only links which have a thumbnail. // Note: we do not retrieve thumbnails here, the request is too heavy. - foreach($links as $key => $link) - { + foreach ($links as $key => $link) { if (isset($link['thumbnail']) && $link['thumbnail'] !== false) { $linksToDisplay[] = $link; // Add to array. } @@ -637,8 +640,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- Tag cloud - if ($targetPage == Router::$PAGE_TAGCLOUD) - { + if ($targetPage == Router::$PAGE_TAGCLOUD) { $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); @@ -653,7 +655,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, alphabetical_sort($tags, false, true); $tagList = array(); - foreach($tags as $key => $value) { + foreach ($tags as $key => $value) { if (in_array($key, $filteringTags)) { continue; } @@ -685,8 +687,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- Tag list - if ($targetPage == Router::$PAGE_TAGLIST) - { + if ($targetPage == Router::$PAGE_TAGLIST) { $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); @@ -732,7 +733,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $cache = new CachedPage( $conf->get('resource.page_cache'), page_url($_SERVER), - startsWith($query,'do='. $targetPage) && !$loginManager->isLoggedIn() + startsWith($query, 'do='. $targetPage) && !$loginManager->isLoggedIn() ); $cached = $cache->cachedVersion(); if (!empty($cached)) { @@ -770,11 +771,14 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User clicks on a tag in a link: The tag is added to the list of searched tags (searchtags=...) - if (isset($_GET['addtag'])) - { + if (isset($_GET['addtag'])) { // Get previous URL (http_referer) and add the tag to the searchtags parameters in query. - if (empty($_SERVER['HTTP_REFERER'])) { header('Location: ?searchtags='.urlencode($_GET['addtag'])); exit; } // In case browser does not send HTTP_REFERER - parse_str(parse_url($_SERVER['HTTP_REFERER'],PHP_URL_QUERY), $params); + if (empty($_SERVER['HTTP_REFERER'])) { + // In case browser does not send HTTP_REFERER + header('Location: ?searchtags='.urlencode($_GET['addtag'])); + exit; + } + parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $params); // Prevent redirection loop if (isset($params['addtag'])) { @@ -798,8 +802,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, // Append the tag if necessary if (empty($params['searchtags'])) { $params['searchtags'] = trim($_GET['addtag']); - } - elseif ($addtag) { + } elseif ($addtag) { $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']); } @@ -828,7 +831,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $tags = explode(' ', $params['searchtags']); // Remove value from array $tags. $tags = array_diff($tags, array($_GET['removetag'])); - $params['searchtags'] = implode(' ',$tags); + $params['searchtags'] = implode(' ', $tags); if (empty($params['searchtags'])) { unset($params['searchtags']); @@ -897,12 +900,10 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- Handle other actions allowed for non-logged in users: - if (!$loginManager->isLoggedIn()) - { + if (!$loginManager->isLoggedIn()) { // User tries to post new link but is not logged in: // Show login screen, then redirect to ?post=... - if (isset($_GET['post'])) - { + if (isset($_GET['post'])) { header( // Redirect to login page, then back to post link. 'Location: ?do=login&post='.urlencode($_GET['post']). (!empty($_GET['title'])?'&title='.urlencode($_GET['title']):''). @@ -925,8 +926,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, // -------- All other functions are reserved for the registered user: // -------- Display the Tools menu if requested (import/export/bookmarklet...) - if ($targetPage == Router::$PAGE_TOOLS) - { + if ($targetPage == Router::$PAGE_TOOLS) { $data = [ 'pageabsaddr' => index_url($_SERVER), 'sslenabled' => is_https($_SERVER), @@ -943,15 +943,15 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User wants to change his/her password. - if ($targetPage == Router::$PAGE_CHANGEPASSWORD) - { + if ($targetPage == Router::$PAGE_CHANGEPASSWORD) { if ($conf->get('security.open_shaarli')) { die(t('You are not supposed to change a password on an Open Shaarli.')); } - if (!empty($_POST['setpassword']) && !empty($_POST['oldpassword'])) - { - if (!$sessionManager->checkToken($_POST['token'])) die(t('Wrong token.')); // Go away! + if (!empty($_POST['setpassword']) && !empty($_POST['oldpassword'])) { + if (!$sessionManager->checkToken($_POST['token'])) { + die(t('Wrong token.')); // Go away! + } // Make sure old password is correct. $oldhash = sha1($_POST['oldpassword'].$conf->get('credentials.login').$conf->get('credentials.salt')); @@ -965,8 +965,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $conf->set('credentials.hash', sha1($_POST['setpassword'] . $conf->get('credentials.login') . $conf->get('credentials.salt'))); try { $conf->write($loginManager->isLoggedIn()); - } - catch(Exception $e) { + } catch (Exception $e) { error_log( 'ERROR while writing config file after changing password.' . PHP_EOL . $e->getMessage() @@ -978,9 +977,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } echo ''; exit; - } - else // show the change password form. - { + } else { + // show the change password form. $PAGE->assign('pagetitle', t('Change password') .' - '. $conf->get('general.title', 'Shaarli')); $PAGE->renderPage('changepassword'); exit; @@ -988,10 +986,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User wants to change configuration - if ($targetPage == Router::$PAGE_CONFIGURE) - { - if (!empty($_POST['title']) ) - { + if ($targetPage == Router::$PAGE_CONFIGURE) { + if (!empty($_POST['title'])) { if (!$sessionManager->checkToken($_POST['token'])) { die(t('Wrong token.')); // Go away! } @@ -1028,8 +1024,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $conf->write($loginManager->isLoggedIn()); $history->updateSettings(); invalidateCaches($conf->get('resource.page_cache')); - } - catch(Exception $e) { + } catch (Exception $e) { error_log( 'ERROR while writing config file after configuration update.' . PHP_EOL . $e->getMessage() @@ -1041,9 +1036,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } echo ''; exit; - } - else // Show the configuration form. - { + } else { + // Show the configuration form. $PAGE->assign('title', $conf->get('general.title')); $PAGE->assign('theme', $conf->get('resource.theme')); $PAGE->assign('theme_available', ThemeUtils::getThemes($conf->get('resource.raintpl_tpl'))); @@ -1071,8 +1065,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User wants to rename a tag or delete it - if ($targetPage == Router::$PAGE_CHANGETAG) - { + if ($targetPage == Router::$PAGE_CHANGETAG) { if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { $PAGE->assign('fromtag', ! empty($_GET['fromtag']) ? escape($_GET['fromtag']) : ''); $PAGE->assign('pagetitle', t('Manage tags') .' - '. $conf->get('general.title', 'Shaarli')); @@ -1101,16 +1094,14 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User wants to add a link without using the bookmarklet: Show form. - if ($targetPage == Router::$PAGE_ADDLINK) - { + if ($targetPage == Router::$PAGE_ADDLINK) { $PAGE->assign('pagetitle', t('Shaare a new link') .' - '. $conf->get('general.title', 'Shaarli')); $PAGE->renderPage('addlink'); exit; } // -------- User clicked the "Save" button when editing a link: Save link to database. - if (isset($_POST['save_edit'])) - { + if (isset($_POST['save_edit'])) { // Go away! if (! $sessionManager->checkToken($_POST['token'])) { die(t('Wrong token.')); @@ -1197,14 +1188,16 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User clicked the "Cancel" button when editing a link. - if (isset($_POST['cancel_edit'])) - { + if (isset($_POST['cancel_edit'])) { $id = isset($_POST['lf_id']) ? (int) escape($_POST['lf_id']) : false; if (! isset($LINKSDB[$id])) { header('Location: ?'); } // If we are called from the bookmarklet, we must close the popup: - if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo ''; exit; } + if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { + echo ''; + exit; + } $link = $LINKSDB[$id]; $returnurl = ( isset($_POST['returnurl']) ? $_POST['returnurl'] : '?' ); // Scroll to the link which has been edited. @@ -1215,8 +1208,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User clicked the "Delete" button when editing a link: Delete link from database. - if ($targetPage == Router::$PAGE_DELETELINK) - { + if ($targetPage == Router::$PAGE_DELETELINK) { if (! $sessionManager->checkToken($_GET['token'])) { die(t('Wrong token.')); } @@ -1230,7 +1222,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $ids = [$ids]; } // assert at least one id is given - if(!count($ids)){ + if (!count($ids)) { die('no id provided'); } foreach ($ids as $id) { @@ -1243,15 +1235,18 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $LINKSDB->save($conf->get('resource.page_cache')); // save to disk // If we are called from the bookmarklet, we must close the popup: - if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo ''; exit; } + if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { + echo ''; + exit; + } $location = '?'; if (isset($_SERVER['HTTP_REFERER'])) { // Don't redirect to where we were previously if it was a permalink or an edit_link, because it would 404. $location = generateLocation( - $_SERVER['HTTP_REFERER'], - $_SERVER['HTTP_HOST'], - ['delete_link', 'edit_link', $link['shorturl']] + $_SERVER['HTTP_REFERER'], + $_SERVER['HTTP_HOST'], + ['delete_link', 'edit_link', $link['shorturl']] ); } @@ -1260,11 +1255,13 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // -------- User clicked the "EDIT" button on a link: Display link edit form. - if (isset($_GET['edit_link'])) - { + if (isset($_GET['edit_link'])) { $id = (int) escape($_GET['edit_link']); $link = $LINKSDB[$id]; // Read database - if (!$link) { header('Location: ?'); exit; } // Link not found in database. + if (!$link) { + header('Location: ?'); + exit; + } // Link not found in database. $link['linkdate'] = $link['created']->format(LinkDB::LINK_DATE_FORMAT); $data = array( 'link' => $link, @@ -1290,8 +1287,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $link_is_new = false; // Check if URL is not already in database (in this case, we will edit the existing link) $link = $LINKSDB->getLinkFromUrl($url); - if (! $link) - { + if (! $link) { $link_is_new = true; $linkdate = strval(date(LinkDB::LINK_DATE_FORMAT)); // Get title if it was provided in URL (by the bookmarklet). @@ -1408,7 +1404,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, header('Content-Type: text/html; charset=utf-8'); header( 'Content-disposition: attachment; filename=bookmarks_' - .$selection.'_'.$now->format(LinkDB::LINK_DATE_FORMAT).'.html' + .$selection.'_'.$now->format(LinkDB::LINK_DATE_FORMAT).'.html' ); $PAGE->assign('date', $now->format(DateTime::RFC822)); $PAGE->assign('eol', PHP_EOL); @@ -1476,14 +1472,20 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $pluginMeta = $pluginManager->getPluginsMeta(); // Split plugins into 2 arrays: ordered enabled plugins and disabled. - $enabledPlugins = array_filter($pluginMeta, function($v) { return $v['order'] !== false; }); + $enabledPlugins = array_filter($pluginMeta, function ($v) { + return $v['order'] !== false; + }); // Load parameters. $enabledPlugins = load_plugin_parameter_values($enabledPlugins, $conf->get('plugins', array())); uasort( $enabledPlugins, - function($a, $b) { return $a['order'] - $b['order']; } + function ($a, $b) { + return $a['order'] - $b['order']; + } ); - $disabledPlugins = array_filter($pluginMeta, function($v) { return $v['order'] === false; }); + $disabledPlugins = array_filter($pluginMeta, function ($v) { + return $v['order'] === false; + }); $PAGE->assign('enabledPlugins', $enabledPlugins); $PAGE->assign('disabledPlugins', $disabledPlugins); @@ -1500,14 +1502,12 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, foreach ($_POST as $param => $value) { $conf->set('plugins.'. $param, escape($value)); } - } - else { + } else { $conf->set('general.enabled_plugins', save_plugin_config($_POST)); } $conf->write($loginManager->isLoggedIn()); $history->updateSettings(); - } - catch (Exception $e) { + } catch (Exception $e) { error_log( 'ERROR while saving plugin configuration:.' . PHP_EOL . $e->getMessage() @@ -1635,8 +1635,7 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager) } $linkDisp = array(); - while ($i<$end && $iSessions do not seem to work correctly on your server.
    '. @@ -1764,19 +1765,18 @@ function install($conf, $sessionManager, $loginManager) { echo '
    '. t('Click to try again.') .'
    '; die; } - if (!isset($_SESSION['session_tested'])) - { // Step 1 : Try to store data in session and reload page. + if (!isset($_SESSION['session_tested'])) { + // Step 1 : Try to store data in session and reload page. $_SESSION['session_tested'] = 'Working'; // Try to set a variable in session. header('Location: '.index_url($_SERVER).'?test_session'); // Redirect to check stored data. } - if (isset($_GET['test_session'])) - { // Step 3: Sessions are OK. Remove test parameter from URL. + if (isset($_GET['test_session'])) { + // Step 3: Sessions are OK. Remove test parameter from URL. header('Location: '.index_url($_SERVER)); } - if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) - { + if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) { $tz = 'UTC'; if (!empty($_POST['continent']) && !empty($_POST['city']) && isTimeZoneValid($_POST['continent'], $_POST['city']) @@ -1807,12 +1807,11 @@ function install($conf, $sessionManager, $loginManager) { try { // Everything is ok, let's create config file. $conf->write($loginManager->isLoggedIn()); - } - catch(Exception $e) { + } catch (Exception $e) { error_log( - 'ERROR while writing config file after installation.' . PHP_EOL . + 'ERROR while writing config file after installation.' . PHP_EOL . $e->getMessage() - ); + ); // TODO: do not handle exceptions/errors in JS. echo ''; @@ -1842,7 +1841,7 @@ if (!isset($_SESSION['LINKS_PER_PAGE'])) { try { $history = new History($conf->get('resource.history')); -} catch(Exception $e) { +} catch (Exception $e) { die($e->getMessage()); } @@ -1861,7 +1860,7 @@ $container['history'] = $history; $app = new \Slim\App($container); // REST API routes -$app->group('/api/v1', function() { +$app->group('/api/v1', function () { $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo')->setName('getInfo'); $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks')->setName('getLinks'); $this->get('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:getLink')->setName('getLink'); From 067c2dd8f5f6eb6cc808ddc4bd30aec104caf73d Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 13 Oct 2018 00:35:47 +0200 Subject: [PATCH 31/36] lint: apply phpcbf to tests/ Signed-off-by: VirtualTam --- tests/ApplicationUtilsTest.php | 6 +++--- tests/CacheTest.php | 2 +- tests/HttpUtils/GetIpAdressFromProxyTest.php | 3 ++- tests/LinkDBTest.php | 6 +++--- tests/LinkFilterTest.php | 2 +- tests/LinkUtilsTest.php | 1 - tests/RouterTest.php | 1 - tests/ThumbnailerTest.php | 8 +++++--- tests/Updater/DummyUpdater.php | 8 ++++---- tests/Url/CleanupUrlTest.php | 1 - tests/Url/GetUrlSchemeTest.php | 1 - tests/Url/UnparseUrlTest.php | 1 - tests/Url/UrlTest.php | 6 +++--- tests/UtilsTest.php | 9 ++++++--- tests/api/ApiUtilsTest.php | 3 +-- tests/api/controllers/history/HistoryTest.php | 1 - tests/api/controllers/info/InfoTest.php | 4 ++-- tests/api/controllers/links/PostLinkTest.php | 1 - tests/api/controllers/links/PutLinkTest.php | 1 - tests/api/controllers/tags/PutTagTest.php | 1 - tests/languages/de/UtilsDeTest.php | 2 +- tests/languages/fr/LanguagesFrTest.php | 1 - tests/plugins/PluginQrcodeTest.php | 3 ++- tests/security/SessionManagerTest.php | 1 - tests/utils/ReferenceLinkDB.php | 6 +++--- tests/utils/config/configPhp.php | 2 +- 26 files changed, 38 insertions(+), 43 deletions(-) diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index ff4c9e1..fe5f84c 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php @@ -17,7 +17,7 @@ class FakeApplicationUtils extends ApplicationUtils /** * Toggle HTTP requests, allow overriding the version code */ - public static function getVersion($url, $timeout=0) + public static function getVersion($url, $timeout = 0) { return self::$VERSION_CODE; } @@ -67,7 +67,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase '0.5.4', ApplicationUtils::getVersion( 'https://raw.githubusercontent.com/shaarli/Shaarli/' - .'v0.5.4/shaarli_version.php', + .'v0.5.4/shaarli_version.php', $testTimeout ) ); @@ -75,7 +75,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase self::$versionPattern, ApplicationUtils::getVersion( 'https://raw.githubusercontent.com/shaarli/Shaarli/' - .'latest/shaarli_version.php', + .'latest/shaarli_version.php', $testTimeout ) ); diff --git a/tests/CacheTest.php b/tests/CacheTest.php index 992e26a..f60fad9 100644 --- a/tests/CacheTest.php +++ b/tests/CacheTest.php @@ -84,7 +84,7 @@ class CacheTest extends PHPUnit_Framework_TestCase invalidateCaches(self::$testCacheDir); foreach (self::$pages as $page) { $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); - } + } $this->assertArrayNotHasKey('tags', $_SESSION); } diff --git a/tests/HttpUtils/GetIpAdressFromProxyTest.php b/tests/HttpUtils/GetIpAdressFromProxyTest.php index 6a74a45..7af5bd9 100644 --- a/tests/HttpUtils/GetIpAdressFromProxyTest.php +++ b/tests/HttpUtils/GetIpAdressFromProxyTest.php @@ -5,7 +5,8 @@ require_once 'application/HttpUtils.php'; /** * Unitary tests for getIpAddressFromProxy() */ -class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase { +class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase +{ /** * Test without proxy diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index fcab76f..c763c0c 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -362,7 +362,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase public function testLinkRealUrlWithoutRedirector() { $db = new LinkDB(self::$testDatastore, false, false); - foreach($db as $link) { + foreach ($db as $link) { $this->assertEquals($link['url'], $link['real_url']); } } @@ -374,13 +374,13 @@ class LinkDBTest extends PHPUnit_Framework_TestCase { $redirector = 'http://redirector.to?'; $db = new LinkDB(self::$testDatastore, false, false, $redirector); - foreach($db as $link) { + foreach ($db as $link) { $this->assertStringStartsWith($redirector, $link['real_url']); $this->assertNotFalse(strpos($link['real_url'], urlencode('://'))); } $db = new LinkDB(self::$testDatastore, false, false, $redirector, false); - foreach($db as $link) { + foreach ($db as $link) { $this->assertStringStartsWith($redirector, $link['real_url']); $this->assertFalse(strpos($link['real_url'], urlencode('://'))); } diff --git a/tests/LinkFilterTest.php b/tests/LinkFilterTest.php index 9cd6dbd..250046f 100644 --- a/tests/LinkFilterTest.php +++ b/tests/LinkFilterTest.php @@ -297,7 +297,7 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase $this->assertEquals( 3, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, '"free software"')) - ); + ); } /** diff --git a/tests/LinkUtilsTest.php b/tests/LinkUtilsTest.php index 7fbd59b..ca062f0 100644 --- a/tests/LinkUtilsTest.php +++ b/tests/LinkUtilsTest.php @@ -410,4 +410,3 @@ function ut_curl_getinfo_rs_ct_ko($ch, $type) return 'text/plain'; } } - diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 544bcf9..abf1bd5 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -218,7 +218,6 @@ class RouterTest extends PHPUnit_Framework_TestCase Router::$PAGE_CHANGEPASSWORD, Router::findPage('do=changepasswd&stuff', array(), true) ); - } /** diff --git a/tests/ThumbnailerTest.php b/tests/ThumbnailerTest.php index 0831154..c01849f 100644 --- a/tests/ThumbnailerTest.php +++ b/tests/ThumbnailerTest.php @@ -98,15 +98,17 @@ class ThumbnailerTest extends TestCase ini_set('error_log', $oldlog); } - protected function rrmdirContent($dir) { + protected function rrmdirContent($dir) + { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { - if (is_dir($dir."/".$object)) + if (is_dir($dir."/".$object)) { $this->rrmdirContent($dir."/".$object); - else + } else { unlink($dir."/".$object); + } } } } diff --git a/tests/Updater/DummyUpdater.php b/tests/Updater/DummyUpdater.php index a0be441..a805ab5 100644 --- a/tests/Updater/DummyUpdater.php +++ b/tests/Updater/DummyUpdater.php @@ -31,7 +31,7 @@ class DummyUpdater extends Updater * * @return bool true. */ - private final function updateMethodDummy1() + final private function updateMethodDummy1() { return true; } @@ -41,7 +41,7 @@ class DummyUpdater extends Updater * * @return bool true. */ - private final function updateMethodDummy2() + final private function updateMethodDummy2() { return true; } @@ -51,7 +51,7 @@ class DummyUpdater extends Updater * * @return bool true. */ - private final function updateMethodDummy3() + final private function updateMethodDummy3() { return true; } @@ -61,7 +61,7 @@ class DummyUpdater extends Updater * * @throws Exception error. */ - private final function updateMethodException() + final private function updateMethodException() { throw new Exception('whatever'); } diff --git a/tests/Url/CleanupUrlTest.php b/tests/Url/CleanupUrlTest.php index 1407d7d..2479194 100644 --- a/tests/Url/CleanupUrlTest.php +++ b/tests/Url/CleanupUrlTest.php @@ -107,4 +107,3 @@ class CleanupUrlTest extends PHPUnit_Framework_TestCase ); } } - diff --git a/tests/Url/GetUrlSchemeTest.php b/tests/Url/GetUrlSchemeTest.php index 72d80b3..18b932d 100644 --- a/tests/Url/GetUrlSchemeTest.php +++ b/tests/Url/GetUrlSchemeTest.php @@ -28,4 +28,3 @@ class GetUrlSchemeTest extends PHPUnit_Framework_TestCase $this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout')); } } - diff --git a/tests/Url/UnparseUrlTest.php b/tests/Url/UnparseUrlTest.php index edde73e..e314b48 100644 --- a/tests/Url/UnparseUrlTest.php +++ b/tests/Url/UnparseUrlTest.php @@ -28,4 +28,3 @@ class UnparseUrlTest extends PHPUnit_Framework_TestCase $this->assertEquals($ref, unparse_url(parse_url($ref))); } } - diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php index aa2f223..db229ce 100644 --- a/tests/Url/UrlTest.php +++ b/tests/Url/UrlTest.php @@ -16,7 +16,7 @@ class UrlTest extends PHPUnit_Framework_TestCase /** * Helper method */ - private function assertUrlIsCleaned($query='', $fragment='') + private function assertUrlIsCleaned($query = '', $fragment = '') { $url = new Url(self::$baseUrl.$query.$fragment); $url->cleanup(); @@ -135,13 +135,13 @@ class UrlTest extends PHPUnit_Framework_TestCase 'about://reader?url=' . urlencode(self::$baseUrl .'?my=stuff&is=kept') ); $this->assertEquals(self::$baseUrl.'?my=stuff&is=kept', $url->cleanup()); - } /** * Test default http scheme. */ - public function testDefaultScheme() { + public function testDefaultScheme() + { $url = new Url(self::$baseUrl); $this->assertEquals('http', $url->getScheme()); $url = new Url('domain.tld'); diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 6cd37a7..d0abd99 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -187,7 +187,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase /** * Test generate location with valid data. */ - public function testGenerateLocation() { + public function testGenerateLocation() + { $ref = 'http://localhost/?test'; $this->assertEquals($ref, generateLocation($ref, 'localhost')); $ref = 'http://localhost:8080/?test'; @@ -199,7 +200,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase /** * Test generate location - anti loop. */ - public function testGenerateLocationLoop() { + public function testGenerateLocationLoop() + { $ref = 'http://localhost/?test'; $this->assertEquals('?', generateLocation($ref, 'localhost', array('test'))); } @@ -207,7 +209,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase /** * Test generate location - from other domain. */ - public function testGenerateLocationOut() { + public function testGenerateLocationOut() + { $ref = 'http://somewebsite.com/?test'; $this->assertEquals('?', generateLocation($ref, 'localhost')); } diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php index 62baf4c..df4e189 100644 --- a/tests/api/ApiUtilsTest.php +++ b/tests/api/ApiUtilsTest.php @@ -4,7 +4,6 @@ namespace Shaarli\Api; use Shaarli\Base64Url; - /** * Class ApiUtilsTest */ @@ -34,7 +33,7 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase $payload = Base64Url::encode('{ "iat": '. time() .' }'); - $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload , $secret, true)); + $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload, $secret, true)); return $header .'.'. $payload .'.'. $signature; } diff --git a/tests/api/controllers/history/HistoryTest.php b/tests/api/controllers/history/HistoryTest.php index 61046d9..ff34e16 100644 --- a/tests/api/controllers/history/HistoryTest.php +++ b/tests/api/controllers/history/HistoryTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; - use Shaarli\Config\ConfigManager; use Slim\Container; use Slim\Http\Environment; diff --git a/tests/api/controllers/info/InfoTest.php b/tests/api/controllers/info/InfoTest.php index f7e63bf..e437082 100644 --- a/tests/api/controllers/info/InfoTest.php +++ b/tests/api/controllers/info/InfoTest.php @@ -10,9 +10,9 @@ use Slim\Http\Response; /** * Class InfoTest - * + * * Test REST API controller Info. - * + * * @package Api\Controllers */ class InfoTest extends \PHPUnit_Framework_TestCase diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 100a917..3761761 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -2,7 +2,6 @@ namespace Shaarli\Api\Controllers; - use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Slim\Container; diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index 8a56257..72b895f 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; - use Shaarli\Config\ConfigManager; use Slim\Container; use Slim\Http\Environment; diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index 6f7dec2..3801724 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; - use Shaarli\Api\Exceptions\ApiBadParametersException; use Shaarli\Config\ConfigManager; use Slim\Container; diff --git a/tests/languages/de/UtilsDeTest.php b/tests/languages/de/UtilsDeTest.php index 4569c92..588c9fd 100644 --- a/tests/languages/de/UtilsDeTest.php +++ b/tests/languages/de/UtilsDeTest.php @@ -20,7 +20,7 @@ class UtilsDeTest extends UtilsTest public function testDateFormatNoTime() { $date = DateTime::createFromFormat('Ymd_His', '20170101_101112'); - $this->assertRegExp('/1\. Januar 2017/', format_date($date, false,true)); + $this->assertRegExp('/1\. Januar 2017/', format_date($date, false, true)); } /** diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php index 0cf7489..38347de 100644 --- a/tests/languages/fr/LanguagesFrTest.php +++ b/tests/languages/fr/LanguagesFrTest.php @@ -3,7 +3,6 @@ namespace Shaarli; - use Shaarli\Config\ConfigManager; /** diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php index ebfaddd..dd632ee 100644 --- a/tests/plugins/PluginQrcodeTest.php +++ b/tests/plugins/PluginQrcodeTest.php @@ -15,7 +15,8 @@ class PluginQrcodeTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - public function setUp() { + public function setUp() + { PluginManager::$PLUGINS_PATH = 'plugins'; } diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index 9bd868f..7961e77 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php @@ -8,7 +8,6 @@ ReferenceSessionIdHashes::genAllHashes(); use \Shaarli\Security\SessionManager; use \PHPUnit\Framework\TestCase; - /** * Test coverage for SessionManager */ diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php index 7426ad0..59679e3 100644 --- a/tests/utils/ReferenceLinkDB.php +++ b/tests/utils/ReferenceLinkDB.php @@ -150,8 +150,8 @@ class ReferenceLinkDB $tags, $updated = '', $shorturl = '', - $pinned = false) - { + $pinned = false + ) { $link = array( 'id' => $id, 'title' => $title, @@ -201,7 +201,7 @@ class ReferenceLinkDB $order = $order === 'ASC' ? -1 : 1; // Reorder array by dates. - usort($this->_links, function($a, $b) use ($order) { + usort($this->_links, function ($a, $b) use ($order) { if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { return $a['sticky'] ? -1 : 1; } diff --git a/tests/utils/config/configPhp.php b/tests/utils/config/configPhp.php index 0e03417..34b11fc 100644 --- a/tests/utils/config/configPhp.php +++ b/tests/utils/config/configPhp.php @@ -1,4 +1,4 @@ - Date: Sat, 13 Oct 2018 01:40:04 +0200 Subject: [PATCH 32/36] lint: fix line-length warnings Signed-off-by: VirtualTam --- application/HttpUtils.php | 3 +- application/Languages.php | 4 +- application/LinkDB.php | 15 ++++-- application/NetscapeBookmarkUtils.php | 5 +- application/Thumbnailer.php | 5 +- application/config/ConfigPhp.php | 12 ++++- index.php | 49 +++++++++++++++----- plugins/demo_plugin/demo_plugin.php | 8 ++-- tests/LinkFilterTest.php | 16 +++++-- tests/LinkUtilsTest.php | 23 ++++++--- tests/Updater/UpdaterTest.php | 20 ++++++-- tests/api/controllers/links/PostLinkTest.php | 8 +++- tests/api/controllers/links/PutLinkTest.php | 8 +++- 13 files changed, 132 insertions(+), 44 deletions(-) diff --git a/application/HttpUtils.php b/application/HttpUtils.php index ef6f326..9c43816 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php @@ -7,7 +7,8 @@ * @param int $timeout network timeout (in seconds) * @param int $maxBytes maximum downloaded bytes (default: 4 MiB) * @param callable|string $curlWriteFunction Optional callback called during the download (cURL CURLOPT_WRITEFUNCTION). - * Can be used to add download conditions on the headers (response code, content type, etc.). + * Can be used to add download conditions on the + * headers (response code, content type, etc.). * * @return array HTTP response headers, downloaded content * diff --git a/application/Languages.php b/application/Languages.php index 6a6247c..b9c5d0e 100644 --- a/application/Languages.php +++ b/application/Languages.php @@ -149,7 +149,9 @@ class Languages } try { - $extension = Translations::fromPoFile($translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po'); + $extension = Translations::fromPoFile( + $translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po' + ); $extension->setDomain($domain); $this->translator->loadTranslations($extension); } catch (\InvalidArgumentException $e) { diff --git a/application/LinkDB.php b/application/LinkDB.php index 1f7c28c..4bbc295 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -249,11 +249,14 @@ class LinkDB implements Iterator, Countable, ArrayAccess 'id' => 1, 'title'=> t('The personal, minimalist, super-fast, database free, bookmarking service'), 'url'=>'https://shaarli.readthedocs.io', - 'description'=>t('Welcome to Shaarli! This is your first public bookmark. To edit or delete me, you must first login. + 'description'=>t( + 'Welcome to Shaarli! This is your first public bookmark. ' + .'To edit or delete me, you must first login. To learn how to use Shaarli, consult the link "Documentation" at the bottom of this page. -You use the community supported version of the original Shaarli project, by Sebastien Sauvage.'), +You use the community supported version of the original Shaarli project, by Sebastien Sauvage.' + ), 'private'=>0, 'created'=> new DateTime(), 'tags'=>'opensource software' @@ -419,8 +422,12 @@ You use the community supported version of the original Shaarli project, by Seba * * @return array filtered links, all links if no suitable filter was provided. */ - public function filterSearch($filterRequest = array(), $casesensitive = false, $visibility = 'all', $untaggedonly = false) - { + public function filterSearch( + $filterRequest = array(), + $casesensitive = false, + $visibility = 'all', + $untaggedonly = false + ) { // Filter link database according to parameters. $searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; $searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index e147d32..84dd2b2 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php @@ -82,7 +82,10 @@ class NetscapeBookmarkUtils $status .= t('has an unknown file format. Nothing was imported.'); } else { $status .= vsprintf( - t('was successfully processed in %d seconds: %d links imported, %d links overwritten, %d links skipped.'), + t( + 'was successfully processed in %d seconds: ' + .'%d links imported, %d links overwritten, %d links skipped.' + ), [$duration, $importCount, $overwriteCount, $skipCount] ); } diff --git a/application/Thumbnailer.php b/application/Thumbnailer.php index 7d0d9c3..37ed97a 100644 --- a/application/Thumbnailer.php +++ b/application/Thumbnailer.php @@ -58,7 +58,10 @@ class Thumbnailer $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.')); + die(t( + 'php-gd extension must be loaded to use thumbnails. ' + .'Thumbnails are now disabled. Please reload the page.' + )); } $this->wt = new WebThumbnailer(); diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index 8add8bc..9625fe1 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php @@ -104,12 +104,20 @@ class ConfigPhp implements ConfigIO // Store all $conf['config'] foreach ($conf['config'] as $key => $value) { - $configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL; + $configStr .= '$GLOBALS[\'config\'][\'' + . $key + .'\'] = ' + .var_export($conf['config'][$key], true).';' + . PHP_EOL; } if (isset($conf['plugins'])) { foreach ($conf['plugins'] as $key => $value) { - $configStr .= '$GLOBALS[\'plugins\'][\''. $key .'\'] = '.var_export($conf['plugins'][$key], true).';'. PHP_EOL; + $configStr .= '$GLOBALS[\'plugins\'][\'' + . $key + .'\'] = ' + .var_export($conf['plugins'][$key], true).';' + . PHP_EOL; } } diff --git a/index.php b/index.php index 2e350fc..acfcc66 100644 --- a/index.php +++ b/index.php @@ -806,7 +806,10 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']); } - unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different) + // We also remove page (keeping the same page has no sense, since the + // results are different) + unset($params['page']); + header('Location: ?'.http_build_query($params)); exit; } @@ -837,7 +840,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, unset($params['searchtags']); } - unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different) + // We also remove page (keeping the same page has no sense, since + // the results are different) + unset($params['page']); } header('Location: ?'.http_build_query($params)); exit; @@ -954,15 +959,26 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, } // Make sure old password is correct. - $oldhash = sha1($_POST['oldpassword'].$conf->get('credentials.login').$conf->get('credentials.salt')); - if ($oldhash!= $conf->get('credentials.hash')) { - echo ''; + $oldhash = sha1( + $_POST['oldpassword'].$conf->get('credentials.login').$conf->get('credentials.salt') + ); + if ($oldhash != $conf->get('credentials.hash')) { + echo ''; exit; } // Save new password // Salt renders rainbow-tables attacks useless. $conf->set('credentials.salt', sha1(uniqid('', true) .'_'. mt_rand())); - $conf->set('credentials.hash', sha1($_POST['setpassword'] . $conf->get('credentials.login') . $conf->get('credentials.salt'))); + $conf->set( + 'credentials.hash', + sha1( + $_POST['setpassword'] + . $conf->get('credentials.login') + . $conf->get('credentials.salt') + ) + ); try { $conf->write($loginManager->isLoggedIn()); } catch (Exception $e) { @@ -1015,7 +1031,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, && $thumbnailsMode !== $conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) ) { $_SESSION['warnings'][] = t( - 'You have enabled or changed thumbnails mode. Please synchronize them.' + 'You have enabled or changed thumbnails mode. ' + .'Please synchronize them.' ); } $conf->set('thumbnails.mode', $thumbnailsMode); @@ -1296,7 +1313,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $description = empty($_GET['description']) ? '' : escape($_GET['description']); $tags = empty($_GET['tags']) ? '' : escape($_GET['tags']); $private = !empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0; - // If this is an HTTP(S) link, we try go get the page to extract the title (otherwise we will to straight to the edit form.) + + // If this is an HTTP(S) link, we try go get the page to extract + // the title (otherwise we will to straight to the edit form.) if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) { // Short timeout to keep the application responsive // The callback will fill $charset and $title with data from the downloaded page. @@ -1514,7 +1533,11 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, ); // TODO: do not handle exceptions/errors in JS. - echo ''; + echo ''; exit; } header('Location: ?do='. Router::$PAGE_PLUGINSADMIN); @@ -1749,7 +1772,8 @@ function install($conf, $sessionManager, $loginManager) // This part makes sure sessions works correctly. // (Because on some hosts, session.save_path may not be set correctly, // or we may not have write access to it.) - if (isset($_GET['test_session']) && ( !isset($_SESSION) || !isset($_SESSION['session_tested']) || $_SESSION['session_tested']!='Working')) { + if (isset($_GET['test_session']) + && ( !isset($_SESSION) || !isset($_SESSION['session_tested']) || $_SESSION['session_tested']!='Working')) { // Step 2: Check if data in session is correct. $msg = t( '
    Sessions do not seem to work correctly on your server.
    '. @@ -1817,7 +1841,10 @@ function install($conf, $sessionManager, $loginManager) echo ''; exit; } - echo ''; + echo ''; exit; } diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index bdbc719..ca520d1 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php @@ -108,10 +108,10 @@ function hook_demo_plugin_render_header($data) * ], * ] * This example renders as: - * - * - * - * + *
    + * + * + *
    */ $form = array( 'attr' => array( diff --git a/tests/LinkFilterTest.php b/tests/LinkFilterTest.php index 250046f..eb54c35 100644 --- a/tests/LinkFilterTest.php +++ b/tests/LinkFilterTest.php @@ -76,7 +76,15 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase $this->assertEquals( self::$refDB->countUntaggedLinks(), - count(self::$linkFilter->filter(LinkFilter::$FILTER_TAG, /*$request=*/'', /*$casesensitive=*/false, /*$visibility=*/'all', /*$untaggedonly=*/true)) + count( + self::$linkFilter->filter( + LinkFilter::$FILTER_TAG, + /*$request=*/'', + /*$casesensitive=*/false, + /*$visibility=*/'all', + /*$untaggedonly=*/true + ) + ) ); $this->assertEquals( @@ -246,7 +254,7 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase 2, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, 'ars.userfriendly.org')) ); - + $this->assertEquals( 2, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, 'ars org')) @@ -288,12 +296,12 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase 1, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, 'publishing media')) ); - + $this->assertEquals( 1, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, 'mercurial w3c')) ); - + $this->assertEquals( 3, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, '"free software"')) diff --git a/tests/LinkUtilsTest.php b/tests/LinkUtilsTest.php index ca062f0..5407159 100644 --- a/tests/LinkUtilsTest.php +++ b/tests/LinkUtilsTest.php @@ -83,7 +83,9 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase 'Date: Sat, 28 Oct 2017 12:01:33 GMT', 'Content-Type: text/html; charset=utf-8', 'Status: 200 OK', - 'end' => 'th=device-width">Refactoring · GitHub' + .'Refactoring · GitHub' + .'Refactoring · GitHub' + .'Refactoring · GitHub' + .'', - 'end' => 'th=device-width">Refactoring · GitHub' + .'Refactoring · GitHub' + .'http://hello.there/is=someone#here otherstuff'; + $expectedText = 'stuff ' + .'http://hello.there/is=someone#here otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); $text = 'stuff http://hello.there/is=someone#here(please) otherstuff'; - $expectedText = 'stuff http://hello.there/is=someone#here(please) otherstuff'; + $expectedText = 'stuff ' + .'http://hello.there/is=someone#here(please) otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); $text = 'stuff http://hello.there/is=someone#here(please)&no otherstuff'; - $expectedText = 'stuff http://hello.there/is=someone#here(please)&no otherstuff'; + $expectedText = 'stuff ' + .'http://hello.there/is=someone#here(please)&no otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); } /** - * Test text2clickable a redirector set. + * Test text2clickable with a redirector set. */ public function testText2clickableWithRedirector() { diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index 870f169..c4a6e7e 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php @@ -393,20 +393,32 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']); $this->assertEquals('samba cartoon web', $linkDB[0]['tags']); $this->assertTrue($linkDB[0]['private']); - $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), $linkDB[0]['created']); + $this->assertEquals( + DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), + $linkDB[0]['created'] + ); $this->assertTrue(isset($linkDB[1])); $this->assertFalse(isset($linkDB[1]['linkdate'])); $this->assertEquals(1, $linkDB[1]['id']); $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']); - $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), $linkDB[1]['created']); + $this->assertEquals( + DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), + $linkDB[1]['created'] + ); $this->assertTrue(isset($linkDB[2])); $this->assertFalse(isset($linkDB[2]['linkdate'])); $this->assertEquals(2, $linkDB[2]['id']); $this->assertEquals('Geek and Poke', $linkDB[2]['title']); - $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), $linkDB[2]['created']); - $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_190301'), $linkDB[2]['updated']); + $this->assertEquals( + DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), + $linkDB[2]['created'] + ); + $this->assertEquals( + DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_190301'), + $linkDB[2]['updated'] + ); } /** diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 3761761..5c2b562 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -127,7 +127,9 @@ class PostLinkTest extends TestCase $this->assertEquals('', $data['description']); $this->assertEquals([], $data['tags']); $this->assertEquals(false, $data['private']); - $this->assertTrue(new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created'])); + $this->assertTrue( + new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) + ); $this->assertEquals('', $data['updated']); $historyEntry = $this->history->getHistory()[0]; @@ -170,7 +172,9 @@ class PostLinkTest extends TestCase $this->assertEquals($link['description'], $data['description']); $this->assertEquals($link['tags'], $data['tags']); $this->assertEquals(true, $data['private']); - $this->assertTrue(new \DateTime('2 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created'])); + $this->assertTrue( + new \DateTime('2 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) + ); $this->assertEquals('', $data['updated']); } diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index 72b895f..f276b4c 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php @@ -114,7 +114,9 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase \DateTime::createFromFormat('Ymd_His', '20150310_114651'), \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) ); - $this->assertTrue(new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['updated'])); + $this->assertTrue( + new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['updated']) + ); $historyEntry = $this->history->getHistory()[0]; $this->assertEquals(\History::UPDATED, $historyEntry['event']); @@ -159,7 +161,9 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase \DateTime::createFromFormat('Ymd_His', '20150310_114651'), \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) ); - $this->assertTrue(new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['updated'])); + $this->assertTrue( + new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['updated']) + ); } /** From 7062ef4ddd1864f0d5eaff7146de54ea1fd9fe1e Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 9 Dec 2018 14:40:04 +0000 Subject: [PATCH 33/36] doc: update PHP compatibility table Ref https://github.com/shaarli/Shaarli/issues/1249 --- doc/md/Server-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index cf44ecf..78083a4 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md @@ -18,7 +18,7 @@ Version | Status | Shaarli compatibility 7.2 | Supported | Yes 7.1 | Supported | Yes 7.0 | Supported | Yes -5.6 | Supported | Yes +5.6 | EOL: 2018-12-31 | Yes (up to Shaarli 0.10.x) 5.5 | EOL: 2016-07-10 | Yes 5.4 | EOL: 2015-09-14 | Yes (up to Shaarli 0.8.x) 5.3 | EOL: 2014-08-14 | Yes (up to Shaarli 0.8.x) From 02c70f624ef314ac5d4692fe9c1b70aa8a3a440d Mon Sep 17 00:00:00 2001 From: nodiscc Date: Thu, 11 Oct 2018 08:16:52 +0000 Subject: [PATCH 34/36] doc: fix homepage icon The icon did not display properly on https://shaarli.readthedocs.io/en/master/ --- doc/md/images/icon.png | Bin 0 -> 1266 bytes doc/md/index.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 doc/md/images/icon.png diff --git a/doc/md/images/icon.png b/doc/md/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..530d746948db180be50933e27ef24f629452e3b8 GIT binary patch literal 1266 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>l9uE^-aZI%D7ctmf|d-2LBc=RKdJ*AjAPRdFTX{qsLhEB@&|TbC}I zAQAPejNwsUj=g*rx5VrJC2qWDMKbD&c~7u2?2ud}&-5XoO6ox2S)DBXH*>;{8!uZm z{lO7Q&C|SfHGlN%?ds-FdCE39wWqVlZRX5#H@9Sp3MiShJPp!kPg;9z$yD}8Yxza@ zSDn~d@^tNreb&GJYpDp{Sa!#Y!~fW-S<4kP7(VU`PO3Pxb&EmL*ZaEP-`?k8sCaf& zUm$CGn8#CjHio<$i!;5v&a1dq{!!ki5ti~c_fB;Jx7BvL>RiLM`L^eRLc5Rt&g(5? z3=v;_Lh0i_vyTg>&(*f{zUKIF$(n7Q-#M+z=ghTbdNkRkWKxgi(azt!bFC9ikNiIR zTQ@POXkpcSEr$iCPp3am*z~5_?~XZ_f#83J2XefLnH-6lA&w1`N~bQZnQ_A=J#?%4 zp7(vill}IxFZG-&y(#$3osPnH{@{#^C(>ZBL7?LJqhdqkQ}*sQrc zPf`7(689m6jgjXvH<@)A^k`ZX>fd_yY<=v!@YKK)r^2@-+HHNXx%~Ry8Ry?x*c5)- za&_Y)#%@$NO*yN9$~t=FWNt9WxwYIn5a+?cs-CADy*b`h zL9t}@5lgL4`~j{Dgr3Lsah{m9-l9-iwPn$_UvWChyI%3lyjb;HSNvewln#cePOit& z?rxb9#TIrxUoztE*9Xh)22A`MpxME3Buyv&LaAU4Yx4SkLPsxboYNo|+Ipm-&naVf z!IK-o0kNzO`)Xb;jAi)d*#iu2X@~PyW)}Cd#O&hZ2+inOE0w%FOit>sPzMjwmIzl4 zhK`@94)T*%WjTc?cYV`Cwe%!y^bkl;+FGu`B@by=GNP#T1<0d=dQKp^WiR0 zNUmGj6}GY1=UNZL1>x^@^=Ct(?#ES2wVZu*m`^~{`up>%%fFgGP5z}n|KQzm0Xkxq!^403@vpH40R36LJW+o49u-eEVT^`tqcsR`^(OvXvob^$xN%n Vt%2*(xk8`@22WQ%mvv4FO#tZaBFq2) literal 0 HcmV?d00001 diff --git a/doc/md/index.md b/doc/md/index.md index 725d33a..220eeec 100644 --- a/doc/md/index.md +++ b/doc/md/index.md @@ -1,4 +1,4 @@ -# Shaarli +# Shaarli The personal, minimalist, super-fast, database free, bookmarking service. From 2c16e8e9a80dae221a9d7a1907f37129ee3bc2a1 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 18 Jan 2019 22:58:09 +0100 Subject: [PATCH 35/36] fix: ensure HTML tags are stripped from OpenGraph description Fixes https://github.com/shaarli/Shaarli/issues/1250 Relates to https://github.com/shaarli/Shaarli/issues/1242 Signed-off-by: VirtualTam --- tpl/default/includes.html | 2 +- tpl/vintage/includes.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tpl/default/includes.html b/tpl/default/includes.html index 0427e22..6c30d1b 100644 --- a/tpl/default/includes.html +++ b/tpl/default/includes.html @@ -21,7 +21,7 @@ {$ogDescription=isset($link.description_src) ? $link.description_src : $link.description} - + {if="$link.thumbnail"} {/if} diff --git a/tpl/vintage/includes.html b/tpl/vintage/includes.html index df09349..2efb6b1 100644 --- a/tpl/vintage/includes.html +++ b/tpl/vintage/includes.html @@ -18,7 +18,7 @@ {$ogDescription=isset($link.description_src) ? $link.description_src : $link.description} - + {if="$link.thumbnail"} {/if} From 1c03b65e2ea722b39e54b22c46014f35e34b575b Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 23 Feb 2019 16:33:36 +0100 Subject: [PATCH 36/36] Release v0.10.3 Signed-off-by: VirtualTam --- AUTHORS | 12 +++++++----- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++-- shaarli_version.php | 2 +- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index db23ad3..8d06b93 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,6 @@ - 687 ArthurHoaro - 355 VirtualTam - 195 nodiscc + 715 ArthurHoaro + 370 VirtualTam + 208 nodiscc 56 Sébastien Sauvage 15 Florian Eula 13 Emilien Klein @@ -8,6 +8,7 @@ 9 Willi Eggeling 8 Christophe HENRY 6 B. van Berkum + 6 llune 5 Lucas Cimon 5 Mark Schmitz 5 kalvn @@ -15,10 +16,11 @@ 4 David Sferruzza 4 Immánuel Fodor 3 Teromene - 3 llune + 2 Alexandre G.-Raymond 2 Chris Kuethe 2 Felix Bartels 2 Knah Tsaeb + 2 Luce Carević 2 Mathieu Chabanon 2 Miloš Jovanović 2 Qwerty @@ -29,9 +31,9 @@ 2 pips 1 Adrien Oliva 1 Adrien le Maire - 1 Alexandre G.-Raymond 1 Alexis J 1 Angristan + 1 Bish Erbas <42714627+bisherbas@users.noreply.github.com> 1 BoboTiG 1 Bronco 1 Buster One <37770318+buster-one@users.noreply.github.com> diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1f0d8..ada0f10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + +## [v0.10.3](https://github.com/shaarli/Shaarli/releases/tag/v0.10.3) - 2019-02-23 +### Added +- Add OpenGraph metadata tags on permalink page +- Add CORS headers to REST API reponses +- Add a button to toggle checkboxes of displayed links +- Add an icon to the link list when the Isso plugin is enabled +- Add noindex, nofollow to documentation pages +- Document usage of robots.txt +- Add a button to set links as sticky + +### Changed +- Update French translation +- Refactor the documentation homepage +- Bump netscape-bookmark-parser +- Update session_start condition +- Improve accessibility +- Cleanup and refactor lint tooling + +### Fixed +- Fix input size for dropdown search form +- Fix history for bulk link deletion +- Fix thumbnail requests +- Fix hashtag rendering when markdown escaping is enabled +- Fix AJAX tag deletion +- Fix lint errors and improve PSR-1 and PSR-2 compliance + +### Removed +- Remove Firefox Share documentation + ## [v0.10.2](https://github.com/shaarli/Shaarli/releases/tag/v0.10.2) - 2018-08-11 ### Fixed @@ -12,7 +42,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [v0.10.1](https://github.com/shaarli/Shaarli/releases/tag/v0.10.1) - 2018-08-11 -### Changed +### Changed - Accessibility: - Remove alt text on the logo @@ -46,7 +76,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Use Travis matrix and stages to run Javascript tests in a dedicated environment - Add tag endpoint in the REST API - Build the documentation in Travis builds -- Provide a Docker Compose example +- Provide a Docker Compose example ### Changed - Use web-thumbnailer to retrieve thumbnails (see #687) diff --git a/shaarli_version.php b/shaarli_version.php index 912ca53..215fc76 100644 --- a/shaarli_version.php +++ b/shaarli_version.php @@ -1 +1 @@ - +