summaryrefslogtreecommitdiffstats
path: root/contrib/feed-browser/index.php
blob: 2c984419ed2af47e875a7efc4ab718d95572dbb0 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php

/*
 * (c) Koen Kooi 2006, 2007
 * (c) Marcin Juszkiewicz 2006, 2007
 *
 * This php script is intended to do the following:
 *
 * - have searchable webfronted for the feed like packages.ubuntu.com
 *
 * ToDo:
 *
 * - search functionality
 * - provide feed-management functionality
 * - allow uploading of new software
 *
 *
 * This program is free software; you can redistribute it and/or  modify it under
 * the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License.
 * 
 * This program is distributed in the hope that it will be useful,  but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU Library General Public License along
 * with this library; see the file COPYING.LIB.  If not, write to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 * USA.
 *
 */

require_once 'includes/config.inc';
require_once 'includes/functions.inc';

if(!check_database())
{
	die("Database not found and cannot be created.");
}

$name = '';

if(isset($_GET['name']))
{
	$name = $_GET['name'];
}

$action = '';

if(isset($_GET['action']))
{
	$action = $_GET['action'];
}

if(isset($_GET['arch']))
{
	$arch = $_GET['arch'];
}


switch($action)
{
	case "details":
		$ipkgoutput = pkgdetails ($_GET['pnm']);
		break;

	case "search":
		if ( $arch == "" ) {
		    $ipkgoutput = searchpkg ("%{$name}%");
		    }
		else {
		    $ipkgoutput = searchpkgarch ("%{$name}%", "{$arch}");
		    }
		break;

	case "section":
		$ipkgoutput = searchsection($_GET['section']);
		break;

	case "letter":
		$letter = $_GET['g'];
		if ( $arch == "" ) {
		     $ipkgoutput = searchpkg ("{$letter}%");
		}
                else {
                    $ipkgoutput = searchpkgarch ("{$letter}%", "{$arch}");
                    }
                break;

	default:
		$ipkgoutput = searchpkg("a");
		break;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
	<title>Feed browser</title>
	<meta http-equiv="Content-Style-Type" content="text/css" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style type="text/css" media="all">@import "css/feed.css";</style>
    </head>
    <body >
		<div id="right">
			<?php echo searchletter(); ?>
			<form action="" method="get">
				<fieldset>
					<label for="name">Package name</label>
					<input type="text" name="name" value="<?php echo $name; ?>" />
					<select name="arch">
					   <option value="" selected="selected">all architectures</option>
					   <option value="all">noarch</option>
					   <option value="arm-oabi">arm OABI</option>
					   <option value="armv4t">armv4t EABI</option>
					   <option value="armv5te">armv5te EABI</option>
					   <option value="armv5teb">armv5teb EABI</option>
					   <option value="armv6">armv6 EABI</option>
					   <option value="avr32">avr32</option>
					   <option value="bfin">blackfin</option>
					   <option value="i486">i486</option>
					   <option value="i586">i586</option>
					   <option value="i686">i686</option>
					   <option value="iwmmxt">iwmmxt</option>
					   <option value="ppc603e">ppc603e</option>
					   <option value="sparc">sparc</option>
					</select>
					<input type="hidden" name="action" value="search" />
					<input type="submit" value="Search" />
				</fieldset>
			</form>
			<?php echo $ipkgoutput; ?>
		</div>
		<div id="left">
			<h1>Sections list</h1>
			<?php echo sectionslist(); ?>
		</div>
    </body>
</html>