This commit properly fixes searching for classified ads regardless of type

(PG, Mature, or Adult). The previous commit didn't handle Adult rated ads.

NOTE: For searches of classified ads to work correctly you must use revision
106 of profile.php from the osprofile addon module. Any classifieds that were
created before using revision 106 of profile.php will need to be updated to
ensure that the PG bit is set in the classifiedflags field in the database.


git-svn-id: http://forge.opensimulator.org/svn/ossearch/trunk@190 109abde3-1f22-4c10-b5d7-b6b0135cd00c
This commit is contained in:
kcozens
2012-07-02 18:09:01 +00:00
parent 5da0311d08
commit 79bfe13c35
+16 -12
View File
@@ -423,20 +423,24 @@ function dir_classified_query ($method_name, $params, $app_data)
$type = "";
//Viewer only allows setting classifieds as PG or Mature but not both.
//Restrict search based on classifiedflags when just one flag is set.
if (($flags & 12) != 12)
{
if ($flags & 4) //PG (1 << 2)
$type = "classifiedflags & 8 = 0";
if ($flags & 8) //Mature (1 << 3)
$type = "classifiedflags & 8 = 8";
}
//Renew Weekly flag is bit 5 (32) in $flags.
$terms = array();
if ($flags & 4) //PG (1 << 2)
$terms[] = "classifiedflags & 4 = 4";
if ($flags & 8) //Mature (1 << 3)
$terms[] = "classifiedflags & 8 = 8";
if ($flags & 64) //Adult (1 << 6)
$terms[] = "classifiedflags & 64 = 64";
if ($category <> 0)
$category = "category = ".$category."";
else
//Was there at least one PG, Mature, or Adult flag?
if (count($terms) > 0)
$type = join_terms(" OR ", $terms, True);
//Don't restrict results based on category if it is 0 (Any Category)
if ($category == 0)
$category = "";
else
$category = "category = " . $category;
if ($type == "" || $category == "")
$where = " WHERE " . $type . $category;