]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #761 from ArthurHoaro/hotfix/referrer-warning
authorArthurHoaro <arthur@hoa.ro>
Mon, 16 Jan 2017 11:40:00 +0000 (12:40 +0100)
committerGitHub <noreply@github.com>
Mon, 16 Jan 2017 11:40:00 +0000 (12:40 +0100)
Prevent warning if HTTP_REFERER isn't set

CHANGELOG.md
index.php
plugins/addlink_toolbar/addlink_toolbar.php
tests/plugins/PluginAddlinkTest.php

index d3ecc1e61a9c2d9e8825d81c84b82f9994d49281..d2d631667e42dca9bb2095236b1c60ef4e0c1940 100644 (file)
@@ -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
index f736fcf2fe203252aad4377612ee5ac973e9daa4..b27c83b600a8038c09d9d90d2ea3e4190d58d217 100644 (file)
--- 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 '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode($_POST['totag']).'\';</script>';
+            echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode(escape($_POST['totag'])).'\';</script>';
             exit;
         }
     }
index bf8a198a4ed41a44c86320c71117a525f085df7e..ddf50aaf3aba2b2eccd116030d355a7678f8914b 100644 (file)
@@ -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;
-}
index b77fe12a314bbb979b1cf806ef9c2c80ee126afd..b6239e7f2f09851e94caf0b3933e4c511c0157ca 100644 (file)
@@ -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);
-    }
 }