aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--README.md11
-rw-r--r--application/PageBuilder.php3
-rw-r--r--application/Updater.php16
-rw-r--r--application/config/ConfigJson.php10
-rw-r--r--application/config/ConfigManager.php8
-rw-r--r--tests/Updater/UpdaterTest.php45
-rw-r--r--tests/config/ConfigJsonTest.php2
-rw-r--r--tpl/default/page.footer.html6
-rw-r--r--tpl/default/page.header.html4
10 files changed, 94 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d9f2f4f3..f0813b97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ Theming:
25 - Introduce a new theme 25 - Introduce a new theme
26 - Allow selecting themes/templates from the configuration page 26 - Allow selecting themes/templates from the configuration page
27 - New/Edit link form can be submitted using CTRL+Enter in the textarea 27 - New/Edit link form can be submitted using CTRL+Enter in the textarea
28 - Shaarli version is displayed in the footer when logged in
28- Add plugin placeholders to Atom/RSS feed templates 29- Add plugin placeholders to Atom/RSS feed templates
29- Add OpenSearch to feed templates 30- Add OpenSearch to feed templates
30- Add `campaign_` to the URL cleanup pattern list 31- Add `campaign_` to the URL cleanup pattern list
diff --git a/README.md b/README.md
index db1b901f..cfdefc66 100644
--- a/README.md
+++ b/README.md
@@ -6,13 +6,18 @@ _Do you want to share the links you discover?_
6_Shaarli is a minimalist delicious clone that you can install on your own server._ 6_Shaarli is a minimalist delicious clone that you can install on your own server._
7_It is designed to be personal (single-user), fast and handy._ 7_It is designed to be personal (single-user), fast and handy._
8 8
9[![](https://img.shields.io/travis/shaarli/Shaarli.svg?label=master)](https://travis-ci.org/shaarli/Shaarli) 9[![](https://img.shields.io/badge/stable-v0.7.1-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.7.1)
10[![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli) 10[![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli)
11[![](https://img.shields.io/github/release/shaarli/shaarli.svg)](https://github.com/shaarli/Shaarli/releases/latest/) 11•
12[![Docker repository](https://img.shields.io/docker/pulls/shaarli/shaarli.svg)](https://hub.docker.com/r/shaarli/shaarli/) 12[![](https://img.shields.io/badge/latest-v0.8.4-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.8.4)
13[![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli)
14•
15[![](https://img.shields.io/badge/master-v0.9.x-blue.svg)](https://github.com/shaarli/Shaarli)
16[![](https://img.shields.io/travis/shaarli/Shaarli.svg?label=master)](https://travis-ci.org/shaarli/Shaarli)
13 17
14[![Join the chat at https://gitter.im/shaarli/Shaarli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shaarli/Shaarli) 18[![Join the chat at https://gitter.im/shaarli/Shaarli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shaarli/Shaarli)
15[![Bountysource](https://www.bountysource.com/badge/team?team_id=19583&style=bounties_received)](https://www.bountysource.com/teams/shaarli/issues) 19[![Bountysource](https://www.bountysource.com/badge/team?team_id=19583&style=bounties_received)](https://www.bountysource.com/teams/shaarli/issues)
20[![Docker repository](https://img.shields.io/docker/pulls/shaarli/shaarli.svg)](https://hub.docker.com/r/shaarli/shaarli/)
16 21
17## Quickstart 22## Quickstart
18- [Wiki/documentation](https://github.com/shaarli/Shaarli/wiki) 23- [Wiki/documentation](https://github.com/shaarli/Shaarli/wiki)
diff --git a/application/PageBuilder.php b/application/PageBuilder.php
index 544aba7c..b133dee8 100644
--- a/application/PageBuilder.php
+++ b/application/PageBuilder.php
@@ -75,7 +75,8 @@ class PageBuilder
75 } 75 }
76 $this->tpl->assign('shaarlititle', $this->conf->get('general.title', 'Shaarli')); 76 $this->tpl->assign('shaarlititle', $this->conf->get('general.title', 'Shaarli'));
77 $this->tpl->assign('openshaarli', $this->conf->get('security.open_shaarli', false)); 77 $this->tpl->assign('openshaarli', $this->conf->get('security.open_shaarli', false));
78 $this->tpl->assign('showatom', $this->conf->get('feed.show_atom', false)); 78 $this->tpl->assign('showatom', $this->conf->get('feed.show_atom', true));
79 $this->tpl->assign('feed_type', $this->conf->get('feed.show_atom', true) !== false ? 'atom' : 'rss');
79 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); 80 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
80 $this->tpl->assign('token', getToken($this->conf)); 81 $this->tpl->assign('token', getToken($this->conf));
81 // To be removed with a proper theme configuration. 82 // To be removed with a proper theme configuration.
diff --git a/application/Updater.php b/application/Updater.php
index 1bc5be0c..0fb68c5a 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -378,6 +378,22 @@ class Updater
378 378
379 $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL')); 379 $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL'));
380 $this->conf->write($this->isLoggedIn); 380 $this->conf->write($this->isLoggedIn);
381
382 return true;
383 }
384
385 /**
386 * Use ATOM feed as default.
387 */
388 public function updateMethodAtomDefault()
389 {
390 if (!$this->conf->exists('feed.show_atom') || $this->conf->get('feed.show_atom') === true) {
391 return true;
392 }
393
394 $this->conf->set('feed.show_atom', true);
395 $this->conf->write($this->isLoggedIn);
396
381 return true; 397 return true;
382 } 398 }
383 399
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
21 $data = str_replace(self::getPhpSuffix(), '', $data); 21 $data = str_replace(self::getPhpSuffix(), '', $data);
22 $data = json_decode($data, true); 22 $data = json_decode($data, true);
23 if ($data === null) { 23 if ($data === null) {
24 $error = json_last_error(); 24 $errorCode = json_last_error();
25 throw new \Exception('An error occurred while parsing JSON file: error code #'. $error); 25 $error = 'An error occurred while parsing JSON configuration file ('. $filepath .'): error code #';
26 $error .= $errorCode. '<br>➜ <code>' . json_last_error_msg() .'</code>';
27 if ($errorCode === JSON_ERROR_SYNTAX) {
28 $error .= '<br>Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as ';
29 $error .= '<a href="http://jsonlint.com/">jsonlint.com</a>.';
30 }
31 throw new \Exception($error);
26 } 32 }
27 return $data; 33 return $data;
28 } 34 }
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php
index f2097410..7bfbfc72 100644
--- a/application/config/ConfigManager.php
+++ b/application/config/ConfigManager.php
@@ -81,7 +81,11 @@ class ConfigManager
81 */ 81 */
82 protected function load() 82 protected function load()
83 { 83 {
84 $this->loadedConfig = $this->configIO->read($this->getConfigFileExt()); 84 try {
85 $this->loadedConfig = $this->configIO->read($this->getConfigFileExt());
86 } catch (\Exception $e) {
87 die($e->getMessage());
88 }
85 $this->setDefaultValues(); 89 $this->setDefaultValues();
86 } 90 }
87 91
@@ -317,7 +321,7 @@ class ConfigManager
317 $this->setEmpty('updates.check_updates_interval', 86400); 321 $this->setEmpty('updates.check_updates_interval', 86400);
318 322
319 $this->setEmpty('feed.rss_permalinks', true); 323 $this->setEmpty('feed.rss_permalinks', true);
320 $this->setEmpty('feed.show_atom', false); 324 $this->setEmpty('feed.show_atom', true);
321 325
322 $this->setEmpty('privacy.default_private_links', false); 326 $this->setEmpty('privacy.default_private_links', false);
323 $this->setEmpty('privacy.hide_public_links', false); 327 $this->setEmpty('privacy.hide_public_links', false);
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index b522d616..11b6444a 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -615,4 +615,49 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
615 $this->assertTrue($updater->updateMethodPiwikUrl()); 615 $this->assertTrue($updater->updateMethodPiwikUrl());
616 $this->assertEquals($url, $this->conf->get('plugins.PIWIK_URL')); 616 $this->assertEquals($url, $this->conf->get('plugins.PIWIK_URL'));
617 } 617 }
618
619 /**
620 * Test updateMethodAtomDefault with show_atom set to false
621 * => update to true.
622 */
623 public function testUpdateMethodAtomDefault()
624 {
625 $sandboxConf = 'sandbox/config';
626 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
627 $this->conf = new ConfigManager($sandboxConf);
628 $this->conf->set('feed.show_atom', false);
629 $updater = new Updater([], [], $this->conf, true);
630 $this->assertTrue($updater->updateMethodAtomDefault());
631 $this->assertTrue($this->conf->get('feed.show_atom'));
632 // reload from file
633 $this->conf = new ConfigManager($sandboxConf);
634 $this->assertTrue($this->conf->get('feed.show_atom'));
635 }
636 /**
637 * Test updateMethodAtomDefault with show_atom not set.
638 * => nothing to do
639 */
640 public function testUpdateMethodAtomDefaultNoExist()
641 {
642 $sandboxConf = 'sandbox/config';
643 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
644 $this->conf = new ConfigManager($sandboxConf);
645 $updater = new Updater([], [], $this->conf, true);
646 $this->assertTrue($updater->updateMethodAtomDefault());
647 $this->assertTrue($this->conf->get('feed.show_atom'));
648 }
649 /**
650 * Test updateMethodAtomDefault with show_atom set to true.
651 * => nothing to do
652 */
653 public function testUpdateMethodAtomDefaultAlreadyTrue()
654 {
655 $sandboxConf = 'sandbox/config';
656 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
657 $this->conf = new ConfigManager($sandboxConf);
658 $this->conf->set('feed.show_atom', true);
659 $updater = new Updater([], [], $this->conf, true);
660 $this->assertTrue($updater->updateMethodAtomDefault());
661 $this->assertTrue($this->conf->get('feed.show_atom'));
662 }
618} 663}
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php
index 3527f83d..d237bc80 100644
--- a/tests/config/ConfigJsonTest.php
+++ b/tests/config/ConfigJsonTest.php
@@ -40,7 +40,7 @@ class ConfigJsonTest extends \PHPUnit_Framework_TestCase
40 * Read a non existent config file -> empty array. 40 * Read a non existent config file -> empty array.
41 * 41 *
42 * @expectedException \Exception 42 * @expectedException \Exception
43 * @expectedExceptionMessage An error occurred while parsing JSON file: error code #4 43 * @expectedExceptionMessageRegExp /An error occurred while parsing JSON configuration file \([\w\/\.]+\): error code #4/
44 */ 44 */
45 public function testReadInvalidJson() 45 public function testReadInvalidJson()
46 { 46 {
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 @@
3<div class="pure-g"> 3<div class="pure-g">
4 <div class="pure-u-2-24"></div> 4 <div class="pure-u-2-24"></div>
5 <div id="footer" class="pure-u-20-24"> 5 <div id="footer" class="pure-u-20-24">
6 <strong><a href="https://github.com/shaarli/Shaarli">Shaarli</a></strong> &middot; 6 <strong><a href="https://github.com/shaarli/Shaarli">Shaarli</a></strong>
7 {if="isLoggedIn()===true"}
8 {$version}
9 {/if}
10 &middot;
7 The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community &middot; 11 The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community &middot;
8 <a href="doc/Home.html" rel="nofollow">Documentation</a> 12 <a href="doc/Home.html" rel="nofollow">Documentation</a>
9 {loop="$plugins_footer.text"} 13 {loop="$plugins_footer.text"}
diff --git a/tpl/default/page.header.html b/tpl/default/page.header.html
index 03ca6843..9388ef79 100644
--- a/tpl/default/page.header.html
+++ b/tpl/default/page.header.html
@@ -48,7 +48,7 @@
48 </li> 48 </li>
49 {/loop} 49 {/loop}
50 <li class="pure-menu-item pure-u-lg-0"> 50 <li class="pure-menu-item pure-u-lg-0">
51 <a href="?do=atom{$searchcrits}" class="pure-menu-link">{'RSS Feed'|t}</a> 51 <a href="?do={$feed_type}{$searchcrits}" class="pure-menu-link">{'RSS Feed'|t}</a>
52 </li> 52 </li>
53 {if="isLoggedIn()"} 53 {if="isLoggedIn()"}
54 <li class="pure-menu-item pure-u-lg-0"> 54 <li class="pure-menu-item pure-u-lg-0">
@@ -70,7 +70,7 @@
70 </a> 70 </a>
71 </li> 71 </li>
72 <li class="pure-menu-item"> 72 <li class="pure-menu-item">
73 <a href="?do=atom{$searchcrits}" class="pure-menu-link" title="{'RSS Feed'|t}"> 73 <a href="?do={$feed_type}{$searchcrits}" class="pure-menu-link" title="{'RSS Feed'|t}">
74 <i class="fa fa-rss"></i> 74 <i class="fa fa-rss"></i>
75 </a> 75 </a>
76 </li> 76 </li>