From: ArthurHoaro Date: Tue, 21 Mar 2017 19:10:49 +0000 (+0100) Subject: Merge pull request #804 from ArthurHoaro/feature/atom-default X-Git-Tag: v0.9.0~30 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=c4c655d9bfe68a914898d76bb9c479eea1b04f72;hp=2ea89aba4faa5509ca68c7e9b6b9ab71c1929935;p=github%2Fshaarli%2FShaarli.git Merge pull request #804 from ArthurHoaro/feature/atom-default Fixes #304: use atom feed as default --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a87a8ca..f0813b97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,10 +24,13 @@ configuration to enable URL rewriting, see: Theming: - Introduce a new theme - Allow selecting themes/templates from the configuration page + - New/Edit link form can be submitted using CTRL+Enter in the textarea + - Shaarli version is displayed in the footer when logged in - Add plugin placeholders to Atom/RSS feed templates - Add OpenSearch to feed templates - Add `campaign_` to the URL cleanup pattern list - Add an AUTHORS file and Makefile target to list authors from Git commit data +- Link imports are now logged in `data/` folder, and can be debug using `dev.debug=true` setting. ### Changed - Docker: enable nginx URL rewriting for the REST API @@ -35,6 +38,8 @@ Theming: - Move `user.css` to the `data` folder - Move default template files to a subfolder (`default`) - Rename the legacy theme to `vintage` + - Private only filter is now displayed as a search parameter + - Autocomplete: pre-select the first element - Move PubSubHub to a dedicated plugin - Coding style: - explicit method visibility @@ -42,6 +47,9 @@ Theming: - remove unused variables - The updater now keeps custom theme preferences - Simplify the COPYING information +- Improved client locale detection +- Improved date time display depending on the locale +- Partial namespace support for Shaarli classes ### Removed - PHP < 5.5 compatibility @@ -57,6 +65,8 @@ Theming: - Fix redirection after link deletion - Do not access LinkDB links by ID before the Updater applies migrations - Remove extra spaces in the bookmarklet's name +- Piwik plugin: Piwik URL protocol can now be set (http or https) +- All inline JS has been moved to dedicated JS files ### Security - Markdown plugin: escape HTML entities by default diff --git a/COPYING b/COPYING index 4bbdf2b3..05202152 100644 --- a/COPYING +++ b/COPYING @@ -46,6 +46,10 @@ Files: plugins/wallabag/wallabag.png License: MIT License (http://opensource.org/licenses/MIT) Copyright: (C) 2015 Nicolas Lœuillet - https://github.com/wallabag/wallabag +Files: tpl/default/sad_star.png +License: MIT License (http://opensource.org/licenses/MIT) +Copyright: (C) 2015 kalvn - https://github.com/kalvn/Shaarli-Material + ---------------------------------------------------- ZLIB/LIBPNG LICENSE diff --git a/README.md b/README.md index 21062b9b..db1b901f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ _It is designed to be personal (single-user), fast and handy._ - [Bugs/Feature requests/Discussion](https://github.com/shaarli/Shaarli/issues/) ### Demo -You can use this [public demo instance of Shaarli](http://shaarlidemo.tuxfamily.org/Shaarli). +You can use this [public demo instance of Shaarli](https://demo.shaarli.org). It runs the latest development version of Shaarli and is updated/reset daily. Login: `demo`; Password: `demo` diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index e7148d00..ab346f81 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php @@ -1,7 +1,13 @@ get('resource.data_dir') // log path, will be overridden + ); + $logger = new Logger( + $conf->get('resource.data_dir'), + ! $conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG, + [ + 'prefix' => 'import.', + 'extension' => 'log', + ] ); + $parser->setLogger($logger); $bookmarks = $parser->parseString($data); $importCount = 0; @@ -179,7 +195,7 @@ class NetscapeBookmarkUtils $importCount++; } - $linkDb->save($pagecache); + $linkDb->save($conf->get('resource.page_cache')); return self::importStatus( $filename, $filesize, diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php index 30908d90..9ef2ef56 100644 --- a/application/config/ConfigJson.php +++ b/application/config/ConfigJson.php @@ -21,8 +21,14 @@ class ConfigJson implements ConfigIO $data = str_replace(self::getPhpSuffix(), '', $data); $data = json_decode($data, true); if ($data === null) { - $error = json_last_error(); - throw new \Exception('An error occurred while parsing JSON file: error code #'. $error); + $errorCode = json_last_error(); + $error = 'An error occurred while parsing JSON configuration file ('. $filepath .'): error code #'; + $error .= $errorCode. '
➜ ' . json_last_error_msg() .''; + if ($errorCode === JSON_ERROR_SYNTAX) { + $error .= '
Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as '; + $error .= 'jsonlint.com.'; + } + throw new \Exception($error); } return $data; } diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index c5eeda08..7bfbfc72 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -81,7 +81,11 @@ class ConfigManager */ protected function load() { - $this->loadedConfig = $this->configIO->read($this->getConfigFileExt()); + try { + $this->loadedConfig = $this->configIO->read($this->getConfigFileExt()); + } catch (\Exception $e) { + die($e->getMessage()); + } $this->setDefaultValues(); } diff --git a/composer.json b/composer.json index 57851e53..792c43d3 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "keywords": ["bookmark", "link", "share", "web"], "require": { "php": ">=5.5", - "shaarli/netscape-bookmark-parser": "1.*", + "shaarli/netscape-bookmark-parser": "^2.0", "erusev/parsedown": "1.6", "slim/slim": "^3.0", "pubsubhubbub/publisher": "dev-master" diff --git a/inc/awesomplete-multiple-tags.js b/inc/awesomplete-multiple-tags.js index faecb417..c38dc38e 100644 --- a/inc/awesomplete-multiple-tags.js +++ b/inc/awesomplete-multiple-tags.js @@ -1,3 +1,31 @@ +/** @licstart The following is the entire license notice for the + * JavaScript code in this page. + * + * Copyright: (c) 2011-2015 Sébastien SAUVAGE + * (c) 2011-2017 The Shaarli Community, see AUTHORS + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would + * be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must + * not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + * + * @licend The above is the entire license notice + * for the JavaScript code in this page. + */ + var awp = Awesomplete.$; var autocompleteFields = document.querySelectorAll('input[data-multiple]'); [].forEach.call(autocompleteFields, function(autocompleteField) { diff --git a/inc/plugin_admin.js b/inc/plugin_admin.js index 055ac285..4b55e0f3 100644 --- a/inc/plugin_admin.js +++ b/inc/plugin_admin.js @@ -1,3 +1,31 @@ +/** @licstart The following is the entire license notice for the + * JavaScript code in this page. + * + * Copyright: (c) 2011-2015 Sébastien SAUVAGE + * (c) 2011-2017 The Shaarli Community, see AUTHORS + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would + * be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must + * not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + * + * @licend The above is the entire license notice + * for the JavaScript code in this page. + */ + /** * Change the position counter of a row. * diff --git a/index.php b/index.php index 3c2bb1d2..cc7f3ca3 100644 --- a/index.php +++ b/index.php @@ -1528,7 +1528,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) $_POST, $_FILES, $LINKSDB, - $conf->get('resource.page_cache') + $conf ); echo ''; diff --git a/plugins/piwik/piwik.html b/plugins/piwik/piwik.html index 0881d7c8..f4bc358a 100644 --- a/plugins/piwik/piwik.html +++ b/plugins/piwik/piwik.html @@ -1,5 +1,33 @@ diff --git a/tpl/default/css/shaarli.css b/tpl/default/css/shaarli.css index d33e9066..8fcd13af 100644 --- a/tpl/default/css/shaarli.css +++ b/tpl/default/css/shaarli.css @@ -832,6 +832,7 @@ pre { .page-form-complete .form-label label, .page-form-complete .form-input input, +.page-form-complete .form-input select.align, .page-form-complete .timezone { position: absolute; top: 50%; @@ -908,6 +909,10 @@ div.awesomplete > ul { color: black; } +form[name="linkform"].page-form { + overflow: visible; +} + @media screen and (max-width: 64em) { .page-form-complete .form-label { height: inherit; diff --git a/tpl/default/editlink.html b/tpl/default/editlink.html index 2180c080..354499a4 100644 --- a/tpl/default/editlink.html +++ b/tpl/default/editlink.html @@ -4,11 +4,7 @@ {include="includes"} - {if="$source !== 'firefoxsocialapi' && $source !== 'bookmarklet'"} - {include="page.header"} - {else} -
Shaare to: {$shaarlititle}
- {/if} + {include="page.header"}
@@ -21,26 +17,26 @@
- +
- +
- +
- +
@@ -74,18 +70,6 @@ {/if}
- {if="$source !== 'firefoxsocialapi' && $source !== 'bookmarklet'"} - {include="page.footer"} - {/if} - + {include="page.footer"} diff --git a/tpl/default/install.html b/tpl/default/install.html index 0bd8a635..33f8a453 100644 --- a/tpl/default/install.html +++ b/tpl/default/install.html @@ -105,18 +105,5 @@ {include="page.footer"} - diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index f7de0a49..30d8ed6f 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -1,3 +1,31 @@ +/** @licstart The following is the entire license notice for the + * JavaScript code in this page. + * + * Copyright: (c) 2011-2015 Sébastien SAUVAGE + * (c) 2011-2017 The Shaarli Community, see AUTHORS + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would + * be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must + * not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + * + * @licend The above is the entire license notice + * for the JavaScript code in this page. + */ + window.onload = function () { /** @@ -185,9 +213,13 @@ window.onload = function () { /** * Autofocus text fields */ - var autofocusElements = document.querySelector('.autofocus'); - if (autofocusElements != null) { - autofocusElements.focus(); + // ES6 syntax + let autofocusElements = document.querySelectorAll('.autofocus'); + for (let autofocusElement of autofocusElements) { + if (autofocusElement.value == '') { + autofocusElement.focus(); + break; + } } /** @@ -266,4 +298,96 @@ window.onload = function () { } }); } + + /** + * TimeZome select + * FIXME! way too hackish + */ + var toRemove = document.getElementById('timezone-remove'); + if (toRemove != null) { + var firstSelect = toRemove.getElementsByTagName('select')[0]; + var secondSelect = toRemove.getElementsByTagName('select')[1]; + toRemove.parentNode.removeChild(toRemove); + var toAdd = document.getElementById('timezone-add'); + var newTimezone = 'Continent ' + firstSelect.outerHTML + ''; + newTimezone += ' Country ' + secondSelect.outerHTML + ''; + toAdd.innerHTML = newTimezone; + } + + /** + * Awesomplete trigger. + */ + var tags = document.getElementById('lf_tags'); + if (tags != null) { + awesompleteUniqueTag('#lf_tags'); + } + + /** + * bLazy trigger + */ + var picwall = document.getElementById('picwall_container'); + if (picwall != null) { + var bLazy = new Blazy(); + } + + /** + * Bookmarklet alert + */ + var bookmarkletLinks = document.querySelectorAll('.bookmarklet-link'); + var bkmMessage = document.getElementById('bookmarklet-alert'); + [].forEach.call(bookmarkletLinks, function(link) { + link.addEventListener('click', function(event) { + event.preventDefault(); + alert(bkmMessage.value); + }); + }); + + /** + * Firefox Social + */ + var ffButton = document.getElementById('ff-social-button'); + if (ffButton != null) { + ffButton.addEventListener('click', function(event) { + activateFirefoxSocial(event.target); + }); + } + + /** + * Plugin admin order + */ + var orderPA = document.querySelectorAll('.order'); + [].forEach.call(orderPA, function(link) { + link.addEventListener('click', function(event) { + event.preventDefault(); + if (event.target.classList.contains('order-up')) { + return orderUp(event.target.parentNode.parentNode.getAttribute('data-order')); + } else if (event.target.classList.contains('order-down')) { + return orderDown(event.target.parentNode.parentNode.getAttribute('data-order')); + } + }); + }); }; + +function activateFirefoxSocial(node) { + var loc = location.href; + var baseURL = loc.substring(0, loc.lastIndexOf("/")); + + // Keeping the data separated (ie. not in the DOM) so that it's maintainable and diffable. + var data = { + name: "{$shaarlititle}", + description: "The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community.", + author: "Shaarli", + version: "1.0.0", + + iconURL: baseURL + "/images/favicon.ico", + icon32URL: baseURL + "/images/favicon.ico", + icon64URL: baseURL + "/images/favicon.ico", + + shareURL: baseURL + "{noparse}?post=%{url}&title=%{title}&description=%{text}&source=firefoxsocialapi{/noparse}", + homepageURL: baseURL + }; + node.setAttribute("data-service", JSON.stringify(data)); + + var activate = new CustomEvent("ActivateSocialFeature"); + node.dispatchEvent(activate); +} diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index 94370203..57ef4567 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html @@ -34,7 +34,7 @@ {if="!empty($search_tags)"} value="{$search_tags}" {/if} - autocomplete="off" data-multiple data-minChars="1" + autocomplete="off" data-multiple data-autofirst data-minChars="1" data-list="{loop="$tags"}{$key}, {/loop}" > diff --git a/tpl/default/loginform.html b/tpl/default/loginform.html index 2ad3fe9c..eb6d8378 100644 --- a/tpl/default/loginform.html +++ b/tpl/default/loginform.html @@ -26,7 +26,7 @@ {if="!empty($username)"}value="{$username}"{/if} class="autofocus" tabindex="20">
- +
- {if="ban_canLogin($conf) && ! empty($username)"} - // Focus password on load if the username is set. - var passwords = document.getElementsByName('password'); - if (passwords.length == 2) { - passwords[1].focus(); - } - {/if} - diff --git a/tpl/default/page.footer.html b/tpl/default/page.footer.html index f7b80b68..77fc65dd 100644 --- a/tpl/default/page.footer.html +++ b/tpl/default/page.footer.html @@ -3,7 +3,11 @@