[oe-commits] org.oe.dev feed-browser: use read_vars_from_get to handle HTTP GET params

hrw commit openembedded-commits at lists.openembedded.org
Thu Jul 5 17:06:38 UTC 2007


feed-browser: use read_vars_from_get to handle HTTP GET params

Author: hrw at openembedded.org
Branch: org.openembedded.dev
Revision: 958b4439c90908a21e42ec69bb3c538fd32e6422
ViewMTN: http://monotone.openembedded.org/revision.psp?id=958b4439c90908a21e42ec69bb3c538fd32e6422
Files:
1
contrib/feed-browser/includes/functions.inc
contrib/feed-browser/index.php
Diffs:

#
# mt diff -re5a2779756b70dbc13f98b38567a8102d5dc4f35 -r958b4439c90908a21e42ec69bb3c538fd32e6422
#
# 
# 
# patch "contrib/feed-browser/includes/functions.inc"
#  from [aeed6bb36934047f2ab9fc0ffceada5f612be130]
#    to [95453cbdd9652ae2bcc87d9b4cba36b4f74dbd93]
# 
# patch "contrib/feed-browser/index.php"
#  from [3273f63c5af8e53d9d65850a61d916ea29255dcc]
#    to [37f8acf6f82930c0ad591ed43115b87e30b22874]
# 
============================================================
--- contrib/feed-browser/includes/functions.inc	aeed6bb36934047f2ab9fc0ffceada5f612be130
+++ contrib/feed-browser/includes/functions.inc	95453cbdd9652ae2bcc87d9b4cba36b4f74dbd93
@@ -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];
+	}
+    }
+}
 
 ?>
============================================================
--- contrib/feed-browser/index.php	3273f63c5af8e53d9d65850a61d916ea29255dcc
+++ contrib/feed-browser/index.php	37f8acf6f82930c0ad591ed43115b87e30b22874
@@ -38,30 +38,12 @@ if(!check_database())
 	die("Database not found and cannot be created.");
 }
 
-$name = '';
+read_vars_from_get(array('name', 'arch', 'action', 'letter', 'pnm', 'section'));
 
-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']);
+		$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}%");
 		}






More information about the Openembedded-commits mailing list