From: ArthurHoaro Date: Mon, 16 Jan 2017 11:40:00 +0000 (+0100) Subject: Merge pull request #761 from ArthurHoaro/hotfix/referrer-warning X-Git-Tag: v0.9.0~62 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=4d9fd16ddf2a7d6488c4200aca48501e9d5886fe;hp=8bbf02e0dbc60395a3ec4e8482d652011379fb60;p=github%2Fshaarli%2FShaarli.git Merge pull request #761 from ArthurHoaro/hotfix/referrer-warning Prevent warning if HTTP_REFERER isn't set --- diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ecc1e6..d2d63166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,18 +7,50 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [v0.9.0](https://github.com/shaarli/Shaarli/releases/tag/v0.9.0) - UNPUBLISHED +This release introduces the REST API, and requires updating HTTP server +configuration to enable URL rewriting, see: +- https://shaarli.github.io/api-documentation/ +- https://github.com/shaarli/Shaarli/wiki/Server-configuration + **WARNING**: Shaarli now requires PHP 5.5+. ### Added - -- REST API: see [Shaarli API documentation](http://shaarli.github.io/api-documentation/) -- The theme can now be selected in the administration page. +- REST API v1 + - [Slim](https://www.slimframework.com/) framework + - [JSON Web Token](https://jwt.io/introduction/) (JWT) authentication + - versioned API endpoints: + - `/api/v1/info`: get general information on the Shaarli instance + - `/api/v1/links`: get a list of shaared links +- Allow selecting themes/templates from the configuration page +- 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 ### Changed +- Docker: enable nginx URL rewriting for the REST API +- Move `user.css` to the `data` folder +- Move default template files to a subfolder (`default`) +- Move PubSubHub to a dedicated plugin +- Coding style: + - explicit method visibility + - safe boolean comparisons + - remove unused variables +- The updater now keeps custom theme preferences +- Simplify the COPYING information -- Default template files are moved to a subfolder (`default`). + +### Removed +- PHP < 5.5 compatibility ### Fixed +- Ignore generated release tarballs +- Hide default port when behind a reverse proxy +- Fix a typo in the Markdown plugin description +- Fix the presence of empty tags for private tags and in search results +- Fix a fatal error during the install +- Fix permalink image alignment in daily page +- Fix the delete button in `editlink` ## [v0.8.1](https://github.com/shaarli/Shaarli/releases/tag/v0.8.1) - 2016-12-12 diff --git a/index.php b/index.php index f736fcf2..b27c83b6 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@ * * Licence: http://www.opensource.org/licenses/zlib-license.php * - * Requires: PHP 5.3.x + * Requires: PHP 5.5.x */ // Set 'UTC' as the default timezone if it is not defined in php.ini @@ -83,7 +83,7 @@ use \Shaarli\ThemeUtils; // Ensure the PHP version is supported try { - ApplicationUtils::checkPHPVersion('5.3', PHP_VERSION); + ApplicationUtils::checkPHPVersion('5.5', PHP_VERSION); } catch(Exception $exc) { header('Content-Type: text/plain; charset=utf-8'); echo $exc->getMessage(); @@ -1217,15 +1217,15 @@ function renderPage($conf, $pluginManager, $LINKSDB) $needle = trim($_POST['fromtag']); // True for case-sensitive tag search. $linksToAlter = $LINKSDB->filterSearch(array('searchtags' => $needle), true); - foreach($linksToAlter as $key=>$value) - { - $tags = explode(' ',trim($value['tags'])); - $tags[array_search($needle,$tags)] = trim($_POST['totag']); // Replace tags value. - $value['tags']=trim(implode(' ',$tags)); - $LINKSDB[$key]=$value; + foreach($linksToAlter as $key=>$value) { + $tags = preg_split('/\s+/', trim($value['tags'])); + // Replace tags value. + $tags[array_search($needle, $tags)] = trim($_POST['totag']); + $value['tags'] = implode(' ', array_unique($tags)); + $LINKSDB[$key] = $value; } $LINKSDB->save($conf->get('resource.page_cache')); // Save to disk. - echo ''; + echo ''; exit; } } diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php index bf8a198a..ddf50aaf 100644 --- a/plugins/addlink_toolbar/addlink_toolbar.php +++ b/plugins/addlink_toolbar/addlink_toolbar.php @@ -40,19 +40,3 @@ function hook_addlink_toolbar_render_header($data) return $data; } - -/** - * When link list is displayed, include markdown CSS. - * - * @param array $data - includes data. - * - * @return mixed - includes data with markdown CSS file added. - */ -function hook_addlink_toolbar_render_includes($data) -{ - if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { - $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.css'; - } - - return $data; -} diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php index b77fe12a..b6239e7f 100644 --- a/tests/plugins/PluginAddlinkTest.php +++ b/tests/plugins/PluginAddlinkTest.php @@ -57,44 +57,4 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase $this->assertEquals($str, $data[$str]); $this->assertArrayNotHasKey('fields_toolbar', $data); } - - /** - * Test render_includes hook while logged in. - */ - public function testAddlinkIncludesLoggedIn() - { - $str = 'stuff'; - $data = array($str => $str); - $data['_PAGE_'] = Router::$PAGE_LINKLIST; - $data['_LOGGEDIN_'] = true; - - $data = hook_addlink_toolbar_render_includes($data); - $this->assertEquals($str, $data[$str]); - $this->assertEquals(1, count($data['css_files'])); - - $str = 'stuff'; - $data = array($str => $str); - $data['_PAGE_'] = $str; - $data['_LOGGEDIN_'] = true; - - $data = hook_addlink_toolbar_render_includes($data); - $this->assertEquals($str, $data[$str]); - $this->assertArrayNotHasKey('css_files', $data); - } - - /** - * Test render_includes hook. - * Should not affect css files while logged out. - */ - public function testAddlinkIncludesLoggedOut() - { - $str = 'stuff'; - $data = array($str => $str); - $data['_PAGE_'] = Router::$PAGE_LINKLIST; - $data['_LOGGEDIN_'] = false; - - $data = hook_addlink_toolbar_render_includes($data); - $this->assertEquals($str, $data[$str]); - $this->assertArrayNotHasKey('css_files', $data); - } }