aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-11-13 19:32:35 +0100
committerArthurHoaro <arthur@hoa.ro>2015-11-17 20:19:44 +0100
commit8f8113b94beb46f5deb84e393a95237f59969bbb (patch)
tree7c25239ad5bfa817c26d514785c83796e36b53c7
parent44d60adc5e2fa547bc49620f7e647794f0cad631 (diff)
downloadShaarli-8f8113b94beb46f5deb84e393a95237f59969bbb.tar.gz
Shaarli-8f8113b94beb46f5deb84e393a95237f59969bbb.tar.zst
Shaarli-8f8113b94beb46f5deb84e393a95237f59969bbb.zip
Fixes #176 - Add opensearch functionality
* add a new page in Router: do=opensearch which displays the opensearch plugin * using base64 compressed image to avoid issue encountered with HTTPS
-rw-r--r--application/Router.php6
-rw-r--r--index.php8
-rw-r--r--tpl/includes.html3
-rw-r--r--tpl/opensearch.html45
4 files changed, 61 insertions, 1 deletions
diff --git a/application/Router.php b/application/Router.php
index 82b2b858..1e6a3983 100644
--- a/application/Router.php
+++ b/application/Router.php
@@ -29,6 +29,8 @@ class Router
29 29
30 public static $PAGE_IMPORT = 'import'; 30 public static $PAGE_IMPORT = 'import';
31 31
32 public static $PAGE_OPENSEARCH = 'opensearch';
33
32 public static $PAGE_LINKLIST = 'linklist'; 34 public static $PAGE_LINKLIST = 'linklist';
33 35
34 /** 36 /**
@@ -63,6 +65,10 @@ class Router
63 return self::$PAGE_TAGCLOUD; 65 return self::$PAGE_TAGCLOUD;
64 } 66 }
65 67
68 if (startswith($query, 'do='. self::$PAGE_OPENSEARCH)) {
69 return self::$PAGE_OPENSEARCH;
70 }
71
66 // At this point, only loggedin pages. 72 // At this point, only loggedin pages.
67 if (!$loggedIn) { 73 if (!$loggedIn) {
68 return self::$PAGE_LINKLIST; 74 return self::$PAGE_LINKLIST;
diff --git a/index.php b/index.php
index b06dd50c..01816947 100644
--- a/index.php
+++ b/index.php
@@ -1204,6 +1204,14 @@ function renderPage()
1204 exit; 1204 exit;
1205 } 1205 }
1206 1206
1207 // Display openseach plugin (XML)
1208 if ($targetPage == Router::$PAGE_OPENSEARCH) {
1209 header('Content-Type: application/xml; charset=utf-8');
1210 $PAGE->assign('serverurl', index_url($_SERVER));
1211 $PAGE->renderPage('opensearch');
1212 exit;
1213 }
1214
1207 // -------- User clicks on a tag in a link: The tag is added to the list of searched tags (searchtags=...) 1215 // -------- User clicks on a tag in a link: The tag is added to the list of searched tags (searchtags=...)
1208 if (isset($_GET['addtag'])) 1216 if (isset($_GET['addtag']))
1209 { 1217 {
diff --git a/tpl/includes.html b/tpl/includes.html
index bdf3a07d..f94ce1be 100644
--- a/tpl/includes.html
+++ b/tpl/includes.html
@@ -10,4 +10,5 @@
10{if="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="../inc/user.css" />{/if} 10{if="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="../inc/user.css" />{/if}
11{loop="$plugins_includes.css_files"} 11{loop="$plugins_includes.css_files"}
12<link type="text/css" rel="stylesheet" href="{$value}#"/> 12<link type="text/css" rel="stylesheet" href="{$value}#"/>
13{/loop} \ No newline at end of file 13{/loop}
14<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle|htmlspecialchars}"/> \ No newline at end of file
diff --git a/tpl/opensearch.html b/tpl/opensearch.html
new file mode 100644
index 00000000..3fcc30b7
--- /dev/null
+++ b/tpl/opensearch.html
@@ -0,0 +1,45 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
3 <ShortName>Shaarli search - {$pagetitle}</ShortName>
4 <Description>Shaarli search - {$pagetitle}</Description>
5 <Url type="text/html" template="{$serverurl}?searchterm={searchTerms}" />
6 <Url type="application/atom+xml" template="{$serverurl}?do=atom&amp;searchterm={searchTerms}"/>
7 <Url type="application/rss+xml" template="{$serverurl}?do=rss&amp;searchterm={searchTerms}"/>
8 <InputEncoding>UTF-8</InputEncoding>
9 <Developer>Shaarli Community - https://github.com/shaarli/Shaarli/</Developer>
10 <Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAHRklE
11 QVRIx5WWaWxU5xWG3++7986dfYYZb+MN2xiMDRiDFePUiQsNoiwpUNpAmhInJVEqpa0oQUlbJVKq
12 olaiqpLKUtOKhAJRm1BKRVWctuykpFjAgPcFx/uMl5mxPTOeuXPv3O3rjyiV0lIpfX+dc36c55xf
13 70vwP9TZ2fFpSQCwT5u6unX4f0QeNLx27RoMQwfRveTd11T23M+8S9w+Z3NRma1W4Hk6/nEimFpM
14 Xnun9Xpmz1MPY+feOhBi/fwAAOjq7iJEqmQqCZf5i7NvyNZ/bJPYgAjCiJc2Zmhyw68SM/T1+NlK
15 uf61BPoH+tHU1PT5ACMjI8RXvACvpZ5NT0+fmrG+2TKqtDLV0BgA2AUfXS3+UtfDX2ixCf73E+oA
16 rat92CTkv9fRBwEkSaLDt/JZR/v0Q7qjb8dQ5hjSqmYSOCkzBbogL+ij2RN8bik9wK88Al9tH4tG
17 ow88lvb19yEyPwfGGLq6OungYD9fUlosrqwoQVVVUeOU8qE/mU0ZTq6KNvreNort+5hugkayQUgY
18 qQld/u6qnVRhkciscOdOkNy5E0RnZ+e/AbwsZxAaHyORZA+prW01CTlnGppOqAcwUnCmlDAkAyin
19 Dapb2t7lNeRijpwvTGlJROXugoKS+upz/S19Kj9lJjxXGY1VU49tGevt7WOCSMHTeAXclePsQts9
20 Jq9oLR7rPVkHxpUYkK2c07ZDiieRNcAx3ZlNphcnsxbiMuEsXFSTZpabp+VVS17UNSV/8n7+gN75
21 +C1DM6VEjkgatiz/5IOCAheiUdeyr+198keKZXLzTKYjMDk/ZzGJhkV9AiPSdWaYIAY4U7TYNJMR
22 pugMqgHcXTiJqDK8ycMv2+TPWyWtKFw3KEdtJxNz8u8+/PNYIqeUgY/Oz+Z7q5X3gtqvG7q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