aboutsummaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2016-02-11 22:43:34 +0100
committerChristian Weiske <cweiske@cweiske.de>2016-02-11 22:43:34 +0100
commitd6c817be8dfb9d41ea3f19cecd90619cde97209d (patch)
treee511903d2bfcf87f8d26da68fd4df529d33eaa3a /www
parente43db7fd25798616ad38a959bd378bb765b9323c (diff)
downloadphinde-0.1.0.tar.gz
phinde-0.1.0.zip
opensearch supportv0.1.0
Diffstat (limited to 'www')
-rw-r--r--www/index.php11
-rw-r--r--www/opensearchdescription.php17
-rw-r--r--www/www-header.php2
3 files changed, 28 insertions, 2 deletions
diff --git a/www/index.php b/www/index.php
index 54d5da8..dbdcfd2 100644
--- a/www/index.php
+++ b/www/index.php
@@ -137,11 +137,20 @@ $urlSortRelevance = buildLink(
);
$urlSortDate = $urlSortRelevance . '&sort=date';
+if (isset($_GET['format']) && $_GET['format'] == 'opensearch') {
+ $template = 'opensearch';
+ $baseLink .= '&format=opensearch';
+ header('Content-type: application/atom+xml');
+} else {
+ $template = 'search';
+}
+
render(
- 'search',
+ $template,
array(
'queryTime' => round($timeEnd - $timeBegin, 2) . 's',
'query' => $query,
+ 'fullUrl' => Helper::fullUrl($baseLink),
'cleanQuery' => $cleanQuery,
'urlNoSite' => $urlNoSite,
'site' => $site,
diff --git a/www/opensearchdescription.php b/www/opensearchdescription.php
new file mode 100644
index 0000000..443546e
--- /dev/null
+++ b/www/opensearchdescription.php
@@ -0,0 +1,17 @@
+<?php
+namespace phinde;
+/**
+ * OpenSearch XML description element
+ *
+ * @link http://www.opensearch.org/
+ */
+require 'www-header.php';
+
+header('Content-type: application/opensearchdescription+xml');
+render(
+ 'opensearchdescription',
+ array(
+ 'absBaseUrl' => Helper::fullUrl('/'),
+ )
+);
+?> \ No newline at end of file
diff --git a/www/www-header.php b/www/www-header.php
index da0d74c..e7c4542 100644
--- a/www/www-header.php
+++ b/www/www-header.php
@@ -27,7 +27,7 @@ function render($tplname, $vars = array(), $return = false)
//$vars['htmlhelper'] = new HtmlHelper();
}
$vars['apptitle'] = 'cweiske.de search';
- $vars['baseurl'] = '/';
+ $vars['baseUrl'] = '/';
$template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
if ($return) {