diff options
-rw-r--r-- | CHANGELOG.md | 40 | ||||
-rw-r--r-- | index.php | 18 | ||||
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.php | 16 | ||||
-rw-r--r-- | tests/plugins/PluginAddlinkTest.php | 40 |
4 files changed, 45 insertions, 69 deletions
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/). | |||
7 | 7 | ||
8 | ## [v0.9.0](https://github.com/shaarli/Shaarli/releases/tag/v0.9.0) - UNPUBLISHED | 8 | ## [v0.9.0](https://github.com/shaarli/Shaarli/releases/tag/v0.9.0) - UNPUBLISHED |
9 | 9 | ||
10 | This release introduces the REST API, and requires updating HTTP server | ||
11 | configuration to enable URL rewriting, see: | ||
12 | - https://shaarli.github.io/api-documentation/ | ||
13 | - https://github.com/shaarli/Shaarli/wiki/Server-configuration | ||
14 | |||
10 | **WARNING**: Shaarli now requires PHP 5.5+. | 15 | **WARNING**: Shaarli now requires PHP 5.5+. |
11 | 16 | ||
12 | ### Added | 17 | ### Added |
13 | 18 | - REST API v1 | |
14 | - REST API: see [Shaarli API documentation](http://shaarli.github.io/api-documentation/) | 19 | - [Slim](https://www.slimframework.com/) framework |
15 | - The theme can now be selected in the administration page. | 20 | - [JSON Web Token](https://jwt.io/introduction/) (JWT) authentication |
21 | - versioned API endpoints: | ||
22 | - `/api/v1/info`: get general information on the Shaarli instance | ||
23 | - `/api/v1/links`: get a list of shaared links | ||
24 | - Allow selecting themes/templates from the configuration page | ||
25 | - Add plugin placeholders to Atom/RSS feed templates | ||
26 | - Add OpenSearch to feed templates | ||
27 | - Add `campaign_` to the URL cleanup pattern list | ||
28 | - Add an AUTHORS file and Makefile target to list authors from Git commit data | ||
16 | 29 | ||
17 | ### Changed | 30 | ### Changed |
31 | - Docker: enable nginx URL rewriting for the REST API | ||
32 | - Move `user.css` to the `data` folder | ||
33 | - Move default template files to a subfolder (`default`) | ||
34 | - Move PubSubHub to a dedicated plugin | ||
35 | - Coding style: | ||
36 | - explicit method visibility | ||
37 | - safe boolean comparisons | ||
38 | - remove unused variables | ||
39 | - The updater now keeps custom theme preferences | ||
40 | - Simplify the COPYING information | ||
18 | 41 | ||
19 | - Default template files are moved to a subfolder (`default`). | 42 | |
43 | ### Removed | ||
44 | - PHP < 5.5 compatibility | ||
20 | 45 | ||
21 | ### Fixed | 46 | ### Fixed |
47 | - Ignore generated release tarballs | ||
48 | - Hide default port when behind a reverse proxy | ||
49 | - Fix a typo in the Markdown plugin description | ||
50 | - Fix the presence of empty tags for private tags and in search results | ||
51 | - Fix a fatal error during the install | ||
52 | - Fix permalink image alignment in daily page | ||
53 | - Fix the delete button in `editlink` | ||
22 | 54 | ||
23 | 55 | ||
24 | ## [v0.8.1](https://github.com/shaarli/Shaarli/releases/tag/v0.8.1) - 2016-12-12 | 56 | ## [v0.8.1](https://github.com/shaarli/Shaarli/releases/tag/v0.8.1) - 2016-12-12 |
@@ -13,7 +13,7 @@ | |||
13 | * | 13 | * |
14 | * Licence: http://www.opensource.org/licenses/zlib-license.php | 14 | * Licence: http://www.opensource.org/licenses/zlib-license.php |
15 | * | 15 | * |
16 | * Requires: PHP 5.3.x | 16 | * Requires: PHP 5.5.x |
17 | */ | 17 | */ |
18 | 18 | ||
19 | // Set 'UTC' as the default timezone if it is not defined in php.ini | 19 | // Set 'UTC' as the default timezone if it is not defined in php.ini |
@@ -83,7 +83,7 @@ use \Shaarli\ThemeUtils; | |||
83 | 83 | ||
84 | // Ensure the PHP version is supported | 84 | // Ensure the PHP version is supported |
85 | try { | 85 | try { |
86 | ApplicationUtils::checkPHPVersion('5.3', PHP_VERSION); | 86 | ApplicationUtils::checkPHPVersion('5.5', PHP_VERSION); |
87 | } catch(Exception $exc) { | 87 | } catch(Exception $exc) { |
88 | header('Content-Type: text/plain; charset=utf-8'); | 88 | header('Content-Type: text/plain; charset=utf-8'); |
89 | echo $exc->getMessage(); | 89 | echo $exc->getMessage(); |
@@ -1217,15 +1217,15 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1217 | $needle = trim($_POST['fromtag']); | 1217 | $needle = trim($_POST['fromtag']); |
1218 | // True for case-sensitive tag search. | 1218 | // True for case-sensitive tag search. |
1219 | $linksToAlter = $LINKSDB->filterSearch(array('searchtags' => $needle), true); | 1219 | $linksToAlter = $LINKSDB->filterSearch(array('searchtags' => $needle), true); |
1220 | foreach($linksToAlter as $key=>$value) | 1220 | foreach($linksToAlter as $key=>$value) { |
1221 | { | 1221 | $tags = preg_split('/\s+/', trim($value['tags'])); |
1222 | $tags = explode(' ',trim($value['tags'])); | 1222 | // Replace tags value. |
1223 | $tags[array_search($needle,$tags)] = trim($_POST['totag']); // Replace tags value. | 1223 | $tags[array_search($needle, $tags)] = trim($_POST['totag']); |
1224 | $value['tags']=trim(implode(' ',$tags)); | 1224 | $value['tags'] = implode(' ', array_unique($tags)); |
1225 | $LINKSDB[$key]=$value; | 1225 | $LINKSDB[$key] = $value; |
1226 | } | 1226 | } |
1227 | $LINKSDB->save($conf->get('resource.page_cache')); // Save to disk. | 1227 | $LINKSDB->save($conf->get('resource.page_cache')); // Save to disk. |
1228 | echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode($_POST['totag']).'\';</script>'; | 1228 | echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode(escape($_POST['totag'])).'\';</script>'; |
1229 | exit; | 1229 | exit; |
1230 | } | 1230 | } |
1231 | } | 1231 | } |
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) | |||
40 | 40 | ||
41 | return $data; | 41 | return $data; |
42 | } | 42 | } |
43 | |||
44 | /** | ||
45 | * When link list is displayed, include markdown CSS. | ||
46 | * | ||
47 | * @param array $data - includes data. | ||
48 | * | ||
49 | * @return mixed - includes data with markdown CSS file added. | ||
50 | */ | ||
51 | function hook_addlink_toolbar_render_includes($data) | ||
52 | { | ||
53 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { | ||
54 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.css'; | ||
55 | } | ||
56 | |||
57 | return $data; | ||
58 | } | ||
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 | |||
57 | $this->assertEquals($str, $data[$str]); | 57 | $this->assertEquals($str, $data[$str]); |
58 | $this->assertArrayNotHasKey('fields_toolbar', $data); | 58 | $this->assertArrayNotHasKey('fields_toolbar', $data); |
59 | } | 59 | } |
60 | |||
61 | /** | ||
62 | * Test render_includes hook while logged in. | ||
63 | */ | ||
64 | public function testAddlinkIncludesLoggedIn() | ||
65 | { | ||
66 | $str = 'stuff'; | ||
67 | $data = array($str => $str); | ||
68 | $data['_PAGE_'] = Router::$PAGE_LINKLIST; | ||
69 | $data['_LOGGEDIN_'] = true; | ||
70 | |||
71 | $data = hook_addlink_toolbar_render_includes($data); | ||
72 | $this->assertEquals($str, $data[$str]); | ||
73 | $this->assertEquals(1, count($data['css_files'])); | ||
74 | |||
75 | $str = 'stuff'; | ||
76 | $data = array($str => $str); | ||
77 | $data['_PAGE_'] = $str; | ||
78 | $data['_LOGGEDIN_'] = true; | ||
79 | |||
80 | $data = hook_addlink_toolbar_render_includes($data); | ||
81 | $this->assertEquals($str, $data[$str]); | ||
82 | $this->assertArrayNotHasKey('css_files', $data); | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * Test render_includes hook. | ||
87 | * Should not affect css files while logged out. | ||
88 | */ | ||
89 | public function testAddlinkIncludesLoggedOut() | ||
90 | { | ||
91 | $str = 'stuff'; | ||
92 | $data = array($str => $str); | ||
93 | $data['_PAGE_'] = Router::$PAGE_LINKLIST; | ||
94 | $data['_LOGGEDIN_'] = false; | ||
95 | |||
96 | $data = hook_addlink_toolbar_render_includes($data); | ||
97 | $this->assertEquals($str, $data[$str]); | ||
98 | $this->assertArrayNotHasKey('css_files', $data); | ||
99 | } | ||
100 | } | 60 | } |