forked from L4nz/gazelle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensearch.php
60 lines (55 loc) · 2.4 KB
/
opensearch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?
header('Content-type: application/opensearchdescription+xml');
require('classes/config.php');
$SSL = ($_SERVER['SERVER_PORT'] === '443');
$Type = ((!empty($_GET['type']) && in_array($_GET['type'],array('torrents','requests','forums','users','log')))?$_GET['type']:'torrents');
/*
$FH = fopen(SERVER_ROOT.'/favicon.ico','r');
$Image = base64_encode(fread($FH,filesize(SERVER_ROOT.'/favicon.ico')));
fclose($FH);
*/
echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName><?=SITE_NAME.' '.ucfirst($Type)?> </ShortName>
<Description>Search <?=SITE_NAME?> for <?=ucfirst($Type)?></Description>
<Developer></Developer>
<Image width="16" height="16" type="image/x-icon">http<?=($SSL?'s':'')?>://<?=SITE_URL?>/favicon.ico</Image>
<?
switch ($Type) {
case 'torrents':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=basic&searchstr={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php</moz:SearchForm>
<?
break;
case 'requests':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/requests.php?search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/requests.php</moz:SearchForm>
<?
break;
case 'forums':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search&search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search</moz:SearchForm>
<?
break;
case 'users':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search&search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search</moz:SearchForm>
<?
break;
case 'log':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/log.php?search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/log.php</moz:SearchForm>
<?
break;
}
?>
<Url type="application/opensearchdescription+xml" rel="self" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/opensearch.php?type=<?=$Type?>" />
<Language>en-us</Language>
<OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>