webroot/query.php

- Include text string from the viewer (if any) in searches for popular places.


git-svn-id: http://forge.opensimulator.org/svn/ossearch/trunk@175 109abde3-1f22-4c10-b5d7-b6b0135cd00c
This commit is contained in:
kcozens
2011-11-18 01:18:55 +00:00
parent eee9f83659
commit 4cbbd3c94c
+12 -3
View File
@@ -109,9 +109,10 @@ function dir_places_query($method_name, $params, $app_data)
else
$category = "";
$text = mysql_real_escape_string($text);
$result = mysql_query("SELECT * FROM parcels WHERE $category " .
"(parcelname LIKE '%" . mysql_real_escape_string($text) . "%'" .
" OR description LIKE '%" . mysql_real_escape_string($text) . "%')" .
"(parcelname LIKE '%$text%'" .
" OR description LIKE '%$text%')" .
$type . " ORDER BY $order parcelname" .
" LIMIT ".(0+$query_start).",101");
@@ -135,7 +136,7 @@ function dir_places_query($method_name, $params, $app_data)
}
#
# Popular Place Query
# Popular Places Query
#
xmlrpc_server_register_method($xmlrpc_server, "dir_popular_query",
@@ -145,6 +146,7 @@ function dir_popular_query($method_name, $params, $app_data)
{
$req = $params[0];
$text = $req['text'];
$flags = $req['flags'];
$terms = array();
@@ -155,6 +157,13 @@ function dir_popular_query($method_name, $params, $app_data)
if ($flags & 0x0800) //PgSimsOnly (1 << 11)
$terms[] = "mature = 0";
if ($text != "")
{
$text = mysql_real_escape_string($text);
$terms[] = "(name LIKE '%$text%' OR " .
"description LIKE '%$text%')";
}
if (count($terms) > 0)
$where = " WHERE " . join_terms(" AND ", $terms, False);
else