summaryrefslogtreecommitdiff
path: root/contrib/feed-browser
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openembedded.org>2007-07-05 15:56:42 +0000
committerMarcin Juszkiewicz <hrw@openembedded.org>2007-07-05 15:56:42 +0000
commit61b4b0bb672b02698aa4ee479b69ab5f7264dd42 (patch)
tree7af46c565c2a1d0a2436fc6600f556185aa6730a /contrib/feed-browser
parent6b985e6bcc2504e46d18159a02fa554bda63f28d (diff)
feed-browser: use read_vars_from_get to handle HTTP GET params
Diffstat (limited to 'contrib/feed-browser')
-rw-r--r--contrib/feed-browser/includes/functions.inc15
-rw-r--r--contrib/feed-browser/index.php25
2 files changed, 16 insertions, 24 deletions
diff --git a/contrib/feed-browser/includes/functions.inc b/contrib/feed-browser/includes/functions.inc
index 03947c9998..80e4256b5e 100644
--- a/contrib/feed-browser/includes/functions.inc
+++ b/contrib/feed-browser/includes/functions.inc
@@ -112,11 +112,11 @@ function searchletter($searchletter = '')
}
else
{
- $ipkgoutput .= sprintf(" <a href='?action=letter&amp;g=%s' title='packages which names begins with \"%s\"'>%s</a> |", $letter, $letter, $letter );
+ $ipkgoutput .= sprintf(" <a href='?action=letter&amp;letter=%s' title='packages which names begins with \"%s\"'>%s</a> |", $letter, $letter, $letter );
}
}
- $ipkgoutput .= " <a href='?action=letter&amp;g=z' title='packages which names begins with \"z\"'>z</a></div>";
+ $ipkgoutput .= " <a href='?action=letter&amp;letter=z' title='packages which names begins with \"z\"'>z</a></div>";
return $ipkgoutput;
}
@@ -469,6 +469,17 @@ function check_database()
return $db_exists;
}
+function read_vars_from_get($array_of_vars)
+{
+ foreach($array_of_vars as $name_of_var)
+ {
+ $GLOBALS[$name_of_var] = '';
+ if(isset($_GET[$name_of_var]))
+ {
+ $GLOBALS[$name_of_var] = $_GET[$name_of_var];
+ }
+ }
+}
?>
diff --git a/contrib/feed-browser/index.php b/contrib/feed-browser/index.php
index 2c984419ed..0c9f17edc2 100644
--- a/contrib/feed-browser/index.php
+++ b/contrib/feed-browser/index.php
@@ -38,30 +38,12 @@ 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'];
-}
-
+read_vars_from_get(array('name', 'arch', 'action', 'letter', 'pnm', 'section'));
switch($action)
{
case "details":
- $ipkgoutput = pkgdetails ($_GET['pnm']);
+ $ipkgoutput = pkgdetails ($pnm);
break;
case "search":
@@ -74,11 +56,10 @@ switch($action)
break;
case "section":
- $ipkgoutput = searchsection($_GET['section']);
+ $ipkgoutput = searchsection($section);
break;
case "letter":
- $letter = $_GET['g'];
if ( $arch == "" ) {
$ipkgoutput = searchpkg ("{$letter}%");
}