diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/index.php | 11 | ||||
| -rw-r--r-- | www/opensearchdescription.php | 17 | ||||
| -rw-r--r-- | www/www-header.php | 2 |
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) { |
