summaryrefslogtreecommitdiff
path: root/contrib/feed-browser/index.php
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openembedded.org>2006-08-24 15:26:56 +0000
committerMarcin Juszkiewicz <hrw@openembedded.org>2006-08-24 15:26:56 +0000
commite4a01aea93c22898fb93db4e3fda041bcf55a7ca (patch)
tree1212833cbb0abf3c3b0565a0b0d9028396d577be /contrib/feed-browser/index.php
parent5af48bb75ef7787123cab9b050cdca47ce2397b7 (diff)
feed-browser: no need to keep two copies of package listing generation code
Diffstat (limited to 'contrib/feed-browser/index.php')
-rw-r--r--contrib/feed-browser/index.php42
1 files changed, 11 insertions, 31 deletions
diff --git a/contrib/feed-browser/index.php b/contrib/feed-browser/index.php
index c34fa4ffb8..809e2c7b8d 100644
--- a/contrib/feed-browser/index.php
+++ b/contrib/feed-browser/index.php
@@ -239,12 +239,18 @@ function searchletter($searchletter = '')
function searchpkg ($searchword)
{
- $result = db_query("SELECT DISTINCT p_name,p_desc,p_section FROM packages WHERE p_name LIKE '$searchword' ORDER BY p_name ASC;");
+ if($result = db_query("SELECT DISTINCT p_name,p_desc,p_section FROM packages WHERE p_name LIKE '$searchword' ORDER BY p_name ASC"))
+ {
+ return generate_list_of_packages($result);
+ }
+}
+function generate_list_of_packages($query_result)
+{
$ipkgoutput = "<table>\n";
$ipkgoutput .="<tr><th>Package</th><th>Section</th><th>Description</th></tr>\n";
- foreach($result as $package)
+ foreach($query_result as $package)
{
if (!strstr ($package['p_name'], 'locale'))
{
@@ -272,36 +278,10 @@ function searchpkg ($searchword)
function searchsection($section)
{
- $result= db_query("SELECT DISTINCT p_name,p_desc,p_section FROM packages WHERE p_section like '$section%' order by p_section asc, p_name asc;");
-
- $ipkgoutput = "<table>\n";
- $ipkgoutput .="<tr><th>Package</th><th>Section</th><th>Description</th></tr>\n";
-
- foreach($result as $package)
- {
- if (!strstr ($package['p_name'], 'locale'))
- {
- if(strlen($package['p_desc'])> 40)
- {
- $pos = strpos($package['p_desc'],' ', 40);
-
- if($pos)
- {
- $package['p_desc'] = substr($package['p_desc'], 0, $pos) . '...';
- }
- }
-
- $ipkgoutput .= sprintf ("<tr><td><a href='?action=details&amp;pnm=%s'>%s</a></td><td><a href=\"?action=section&amp;section=%s\">%s</a></td><td>%s</td></tr>",
- urlencode($package['p_name']),
- $package['p_name'],
- $package['p_section'], $package['p_section'],
- htmlentities($package['p_desc']));
- }//if strstr
+ if($result = db_query("SELECT DISTINCT p_name,p_desc,p_section FROM packages WHERE p_section LIKE '$section%' ORDER BY p_section ASC, p_name ASC"))
+ {
+ return generate_list_of_packages($result);
}
-
- $ipkgoutput .= "</table>\n";
-
- return $ipkgoutput;
}
function pkgdetails ($package)