]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Fix bug #3097187: Using opensearch with two tags does not work in Firefox
authorChristian Weiske <cweiske@cweiske.de>
Fri, 15 Apr 2011 05:55:06 +0000 (07:55 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 15 Apr 2011 05:55:06 +0000 (07:55 +0200)
doc/ChangeLog
tests/www/searchTest.php [new file with mode: 0644]
www/search.php

index 273e84bae64f4bb82239648974f62a03ab6d2f57..a7374e2a653ffd009d6d3b777529215ee0c5f769 100644 (file)
@@ -6,6 +6,7 @@ ChangeLog for SemantiScuttle
 - Switch to jQuery and drop dojo
 - Fix bug #3187177: Wrong URL / Export XML Bookmarks
 - Fix bug in getTagsForBookmarks() that fetched all tags
+- Fix bug #3097187: Using opensearch with two tags does not work in Firefox
 - Implement request #3054906: Show user's full name instead of nickname
 - Implement patch #3059829: update FR_CA translation
 - Show error message on mysqli connection errors
diff --git a/tests/www/searchTest.php b/tests/www/searchTest.php
new file mode 100644 (file)
index 0000000..81eb2cc
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+class www_SearchTest extends TestBaseApi
+{
+    protected $urlPart = 'search.php';
+
+
+    /**
+     * Some browsers using opensearch do "urlencode" on the terms,
+     * for example Firefox. Multiple terms separated with space
+     * appear as "foo+bar" in the URL.
+     */
+    public function testMultipleTermsUrlEncoded()
+    {
+        $this->addBookmark(null, null, 0, null, 'unittest foo bar');
+        $res = $this->getRequest('/all/foo+bar')->send();
+        $this->assertSelectCount(
+            '.xfolkentry', true, $res->getBody(),
+            'No bookmark found'
+        );
+
+        $res = $this->getRequest('/all/baz+bat')->send();
+        $this->assertSelectCount(
+            '.xfolkentry', false, $res->getBody(),
+            'Bookmarks found'
+        );
+    }
+
+
+    /**
+     * Some browsers using opensearch do "rawurlencode" on the terms,
+     * for example Opera. Multiple terms separated with space
+     * appear as "foo%20bar" in the URL.
+     */
+    public function testMultipleTermsRawUrlEncoded()
+    {
+        $this->addBookmark(null, null, 0, null, 'unittest foo bar');
+        $res = $this->getRequest('/all/foo bar')->send();
+        $this->assertSelectCount(
+            '.xfolkentry', true, $res->getBody(),
+            'No bookmark found'
+        );
+
+        $res = $this->getRequest('/all/baz bat')->send();
+        $this->assertSelectCount(
+            '.xfolkentry', false, $res->getBody(),
+            'Bookmarks found'
+        );
+    }
+
+}
+
+?>
\ No newline at end of file
index 3cff550781a22d4b13d48710faed161fdf4bf7a9..a5c13e3e0bd80c36d5f81df33e624763ddec9d2e 100644 (file)
@@ -40,8 +40,8 @@ if (POST_TERMS != '') {
 }
 
 /* Service creation: only useful services are created */
-$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
-$searchhistoryservice =SemanticScuttle_Service_Factory::get('SearchHistory');
+$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
+$searchhistoryservice = SemanticScuttle_Service_Factory::get('SearchHistory');
 
 /* Managing current logged user */
 $currentUserId = $userservice->getCurrentUserId();
@@ -53,11 +53,13 @@ if(count($exploded) == 4) {
     list($url, $range, $terms, $page) = $exploded;
 } else if (count($exploded) == 2) {
     list($url, $range) = $exploded;
-    $terms = $page= NULL;
+    $terms = $page = NULL;
 } else {
     list($url, $range, $terms) = $exploded;
-    $page= NULL;
+    $page = NULL;
 }
+//some OpenSearch clients need that
+$terms = urldecode($terms);
 
 $tplVars['loadjs'] = true;