Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=homepage-ng.git;a=commitdiff;h=731b3843b1673fc3f4bf304b793fc52d4cfd0490

commit 731b3843b1673fc3f4bf304b793fc52d4cfd0490
Author: Krisztian VASAS <[EMAIL PROTECTED]>
Date:   Mon Oct 8 13:14:01 2007 +0200

fwng: reworked pkg search part && changed doQuery() error reporting

diff --git a/frugalware/db.inc.php b/frugalware/db.inc.php
index 97e0776..f975928 100644
--- a/frugalware/db.inc.php
+++ b/frugalware/db.inc.php
@@ -94,7 +94,7 @@ class FwDB
}
if (!$result)
{
-                       die("Query ".$query." failed with the following error: 
".$this->db->ErrorMsg());
+                       $result = -1;
}
return $result;
}
diff --git a/frugalware/packages.php b/frugalware/packages.php
index 4ed9e55..a5ccdd1 100644
--- a/frugalware/packages.php
+++ b/frugalware/packages.php
@@ -151,7 +151,7 @@ function search_pkg()
return;
}
$search = $_GET['srch'];
-       $srch = str_replace( '+', '\+', addcslashes( $search, '+' ) );
+       //$srch = str_replace( '+', '\+', addcslashes( $search, '+' ) );
$arch = $_GET['arch'];
$fwver = $_GET['ver'];
$sub = ($_GET['sub'] == "on") ? 1 : 0; # whether the search is for a substring 
or exact match
@@ -159,7 +159,7 @@ function search_pkg()
$query = "select id, pkgname, pkgver, fwver, arch from packages where ";
# if the 'desc' is set (searching in description, too) I have to put
# the restrictions between brackets, because of the 'arch' below...
-       ($_GET['desc'] == "on" || $_GET['desc'] == 1) ? $query .= "(pkgname 
rlike '$srch' or `desc` rlike '$srch')" : $query .= "(pkgname rlike '$srch')";
+       ($_GET['desc'] == "on" || $_GET['desc'] == 1) ? $query .= "(pkgname 
rlike '$search' or `desc` rlike '$search')" : $query .= "(pkgname rlike 
'$search')";
if ($arch != "" and $arch != "all")
{
$query .= " and arch='$arch'";
@@ -172,7 +172,7 @@ function search_pkg()
$db = new FwDB();
$db->doConnect($sqlhost, $sqluser, $sqlpass, "frugalware2");
$res = $db->doQuery($query);
-       if ($db->doCountRows($res) > 0)
+       if ($res != -1 && $db->doCountRows($res) > 0)
{
while ($i = $db->doFetchRow($res))
{
@@ -181,6 +181,12 @@ function search_pkg()
$db->doClose();
res_show($res_set, 'p', $search);
}
+       elseif
+       {
+               print '<h3>' . gettext( 'Error in the query, please change the 
searching conditions' ) . '</h3>';
+               $db->doClose();
+               main();
+       }
else
{
print "<h3>".gettext("No package found")."</h3>";
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to