mirror of
https://github.com/kcozens/OpenSimSearch.git
synced 2026-08-14 00:47:59 +00:00
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:
+16
-12
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user