Compare commits

8 Commits

Author SHA1 Message Date
lickx
089e57e172 Merge branch 'lickx' of https://github.com/lickx/OpenSimSearch into lickx 2025-11-26 07:47:23 +01:00
lickx
a5269a9d5a postgresql (untested) and use case insensitive search 2025-11-26 07:40:16 +01:00
lickx
ee0d538499 Remove a collation, add a 'purge' stored procedure 2025-11-26 07:39:16 +01:00
lickx
231437ade5 Cleanup *.sql's for table creation 2024-09-06 06:35:09 +02:00
lickx
98aa794b4f Add parcel picture uuid
This obviously is a jpeg2k texture asset, so if you want to use it
in a website (for example a land sales page), it needs converting
to regular jpeg or png, after retrieving it from the asset server
2024-07-19 19:19:03 +02:00
lickx
605baca88d .NET 8.0 2024-04-21 03:52:31 +02:00
lickx
931da38bd4 Use default mariadb collation 2023-08-26 02:56:54 +00:00
lickx
5ad11ae533 Mostly changes and suggestions from Tampa 2023-08-06 10:16:13 +00:00
10 changed files with 284 additions and 313 deletions

View File

@@ -37,7 +37,7 @@ namespace OpenSimSearch.Modules.OpenSearch
//
// Module vars
//
private List<Scene> m_Scenes = new List<Scene>();
private List<Scene> m_Scenes = new();
private string m_SearchServer = "";
private bool m_Enabled = true;
@@ -46,7 +46,7 @@ namespace OpenSimSearch.Modules.OpenSearch
{
IConfig searchConfig = config.Configs["Search"];
if (searchConfig == null)
if (searchConfig is null)
{
m_Enabled = false;
return;
@@ -123,7 +123,7 @@ namespace OpenSimSearch.Modules.OpenSearch
get { return "OpenSimSearch"; }
}
public bool IsSharedModule
public static bool IsSharedModule
{
get { return true; }
}
@@ -149,14 +149,16 @@ namespace OpenSimSearch.Modules.OpenSearch
//
private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method)
{
ArrayList SendParams = new ArrayList();
SendParams.Add(ReqParams);
ArrayList SendParams = new()
{
ReqParams
};
// Send Request
XmlRpcResponse Resp;
try
{
XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
XmlRpcRequest Req = new(method, SendParams);
Resp = Req.Send(m_SearchServer, 30000);
}
catch (WebException ex)
@@ -164,10 +166,12 @@ namespace OpenSimSearch.Modules.OpenSearch
m_log.ErrorFormat("[SEARCH]: Unable to connect to Search " +
"Server {0}. Exception {1}", m_SearchServer, ex);
Hashtable ErrorHash = new Hashtable();
ErrorHash["success"] = false;
ErrorHash["errorMessage"] = "Unable to search at this time. ";
ErrorHash["errorURI"] = "";
Hashtable ErrorHash = new()
{
["success"] = false,
["errorMessage"] = "Unable to search at this time. ",
["errorURI"] = ""
};
return ErrorHash;
}
@@ -177,10 +181,12 @@ namespace OpenSimSearch.Modules.OpenSearch
"[SEARCH]: Unable to connect to Search Server {0}. " +
"Exception {1}", m_SearchServer, ex);
Hashtable ErrorHash = new Hashtable();
ErrorHash["success"] = false;
ErrorHash["errorMessage"] = "Unable to search at this time. ";
ErrorHash["errorURI"] = "";
Hashtable ErrorHash = new()
{
["success"] = false,
["errorMessage"] = "Unable to search at this time. ",
["errorURI"] = ""
};
return ErrorHash;
}
@@ -190,19 +196,23 @@ namespace OpenSimSearch.Modules.OpenSearch
"[SEARCH]: Unable to connect to Search Server {0}. " +
"Exception {1}", m_SearchServer, ex);
Hashtable ErrorHash = new Hashtable();
ErrorHash["success"] = false;
ErrorHash["errorMessage"] = "Unable to search at this time. ";
ErrorHash["errorURI"] = "";
Hashtable ErrorHash = new()
{
["success"] = false,
["errorMessage"] = "Unable to search at this time. ",
["errorURI"] = ""
};
return ErrorHash;
}
if (Resp.IsFault)
{
Hashtable ErrorHash = new Hashtable();
ErrorHash["success"] = false;
ErrorHash["errorMessage"] = "Unable to search at this time. ";
ErrorHash["errorURI"] = "";
Hashtable ErrorHash = new()
{
["success"] = false,
["errorMessage"] = "Unable to search at this time. ",
["errorURI"] = ""
};
return ErrorHash;
}
Hashtable RespData = (Hashtable)Resp.Value;
@@ -214,28 +224,26 @@ namespace OpenSimSearch.Modules.OpenSearch
string queryText, int queryFlags, int category, string simName,
int queryStart)
{
Hashtable ReqHash = new Hashtable();
ReqHash["text"] = queryText;
ReqHash["flags"] = queryFlags.ToString();
ReqHash["category"] = category.ToString();
ReqHash["sim_name"] = simName;
ReqHash["query_start"] = queryStart.ToString();
Hashtable ReqHash = new()
{
["text"] = queryText,
["flags"] = queryFlags.ToString(),
["category"] = category.ToString(),
["sim_name"] = simName,
["query_start"] = queryStart.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_places_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_places_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
ArrayList dataArray = (ArrayList)result["data"];
int count = dataArray.Count;
if (count > 100)
count = 101;
int count = (dataArray.Count > 100) ? 101 : dataArray.Count;
DirPlacesReplyData[] data = new DirPlacesReplyData[count];
@@ -245,12 +253,14 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
data[i] = new DirPlacesReplyData();
data[i].parcelID = new UUID(d["parcel_id"].ToString());
data[i].name = d["name"].ToString();
data[i].forSale = Convert.ToBoolean(d["for_sale"]);
data[i].auction = Convert.ToBoolean(d["auction"]);
data[i].dwell = Convert.ToSingle(d["dwell"]);
data[i] = new DirPlacesReplyData
{
parcelID = new UUID(d["parcel_id"].ToString()),
name = d["name"].ToString(),
forSale = Convert.ToBoolean(d["for_sale"]),
auction = Convert.ToBoolean(d["auction"]),
dwell = Convert.ToSingle(d["dwell"])
};
if (++i >= count)
break;
@@ -261,24 +271,22 @@ namespace OpenSimSearch.Modules.OpenSearch
public void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags)
{
Hashtable ReqHash = new Hashtable();
ReqHash["flags"] = queryFlags.ToString();
Hashtable ReqHash = new()
{
["flags"] = queryFlags.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_popular_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_popular_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
ArrayList dataArray = (ArrayList)result["data"];
int count = dataArray.Count;
if (count > 100)
count = 101;
int count = (dataArray.Count > 100) ? 101 : dataArray.Count;
DirPopularReplyData[] data = new DirPopularReplyData[count];
@@ -288,10 +296,12 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
data[i] = new DirPopularReplyData();
data[i].parcelID = new UUID(d["parcel_id"].ToString());
data[i].name = d["name"].ToString();
data[i].dwell = Convert.ToSingle(d["dwell"]);
data[i] = new DirPopularReplyData
{
parcelID = new UUID(d["parcel_id"].ToString()),
name = d["name"].ToString(),
dwell = Convert.ToSingle(d["dwell"])
};
if (++i >= count)
break;
@@ -304,20 +314,20 @@ namespace OpenSimSearch.Modules.OpenSearch
uint queryFlags, uint searchType, int price, int area,
int queryStart)
{
Hashtable ReqHash = new Hashtable();
ReqHash["flags"] = queryFlags.ToString();
ReqHash["type"] = searchType.ToString();
ReqHash["price"] = price.ToString();
ReqHash["area"] = area.ToString();
ReqHash["query_start"] = queryStart.ToString();
Hashtable ReqHash = new()
{
["flags"] = queryFlags.ToString(),
["type"] = searchType.ToString(),
["price"] = price.ToString(),
["area"] = area.ToString(),
["query_start"] = queryStart.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_land_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_land_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
@@ -330,12 +340,11 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
if (d["name"] != null)
if (d["name"] is not null)
++count;
}
if (count > 100)
count = 101;
count = (count > 100) ? 101 : count;
DirLandReplyData[] data = new DirLandReplyData[count];
@@ -345,16 +354,18 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
if (d["name"] == null)
if (d["name"] is null)
continue;
data[i] = new DirLandReplyData();
data[i].parcelID = new UUID(d["parcel_id"].ToString());
data[i].name = d["name"].ToString();
data[i].auction = Convert.ToBoolean(d["auction"]);
data[i].forSale = Convert.ToBoolean(d["for_sale"]);
data[i].salePrice = Convert.ToInt32(d["sale_price"]);
data[i].actualArea = Convert.ToInt32(d["area"]);
data[i] = new DirLandReplyData
{
parcelID = new UUID(d["parcel_id"].ToString()),
name = d["name"].ToString(),
auction = Convert.ToBoolean(d["auction"]),
forSale = Convert.ToBoolean(d["for_sale"]),
salePrice = Convert.ToInt32(d["sale_price"]),
actualArea = Convert.ToInt32(d["area"])
};
if (++i >= count)
break;
@@ -377,26 +388,24 @@ namespace OpenSimSearch.Modules.OpenSearch
public void DirEventsQuery(IClientAPI remoteClient, UUID queryID,
string queryText, uint queryFlags, int queryStart)
{
Hashtable ReqHash = new Hashtable();
ReqHash["text"] = queryText;
ReqHash["flags"] = queryFlags.ToString();
ReqHash["query_start"] = queryStart.ToString();
Hashtable ReqHash = new()
{
["text"] = queryText,
["flags"] = queryFlags.ToString(),
["query_start"] = queryStart.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_events_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_events_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
ArrayList dataArray = (ArrayList)result["data"];
int count = dataArray.Count;
if (count > 100)
count = 101;
int count = (dataArray.Count > 100) ? 101 : dataArray.Count;
DirEventsReplyData[] data = new DirEventsReplyData[count];
@@ -406,13 +415,15 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
data[i] = new DirEventsReplyData();
data[i].ownerID = new UUID(d["owner_id"].ToString());
data[i].name = d["name"].ToString();
data[i].eventID = Convert.ToUInt32(d["event_id"]);
data[i].date = d["date"].ToString();
data[i].unixTime = Convert.ToUInt32(d["unix_time"]);
data[i].eventFlags = Convert.ToUInt32(d["event_flags"]);
data[i] = new DirEventsReplyData
{
ownerID = new UUID(d["owner_id"].ToString()),
name = d["name"].ToString(),
eventID = Convert.ToUInt32(d["event_id"]),
date = d["date"].ToString(),
unixTime = Convert.ToUInt32(d["unix_time"]),
eventFlags = Convert.ToUInt32(d["event_flags"])
};
if (++i >= count)
break;
@@ -425,27 +436,25 @@ namespace OpenSimSearch.Modules.OpenSearch
string queryText, uint queryFlags, uint category,
int queryStart)
{
Hashtable ReqHash = new Hashtable();
ReqHash["text"] = queryText;
ReqHash["flags"] = queryFlags.ToString();
ReqHash["category"] = category.ToString();
ReqHash["query_start"] = queryStart.ToString();
Hashtable ReqHash = new()
{
["text"] = queryText,
["flags"] = queryFlags.ToString(),
["category"] = category.ToString(),
["query_start"] = queryStart.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_classified_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_classified_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
ArrayList dataArray = (ArrayList)result["data"];
int count = dataArray.Count;
if (count > 100)
count = 101;
int count = (dataArray.Count > 100) ? 101 : dataArray.Count;
DirClassifiedReplyData[] data = new DirClassifiedReplyData[count];
@@ -455,13 +464,15 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
data[i] = new DirClassifiedReplyData();
data[i].classifiedID = new UUID(d["classifiedid"].ToString());
data[i].name = d["name"].ToString();
data[i].classifiedFlags = Convert.ToByte(d["classifiedflags"]);
data[i].creationDate = Convert.ToUInt32(d["creation_date"]);
data[i].expirationDate = Convert.ToUInt32(d["expiration_date"]);
data[i].price = Convert.ToInt32(d["priceforlisting"]);
data[i] = new DirClassifiedReplyData
{
classifiedID = new UUID(d["classifiedid"].ToString()),
name = d["name"].ToString(),
classifiedFlags = Convert.ToByte(d["classifiedflags"]),
creationDate = Convert.ToUInt32(d["creation_date"]),
expirationDate = Convert.ToUInt32(d["expiration_date"]),
price = Convert.ToInt32(d["priceforlisting"])
};
if (++i >= count)
break;
@@ -472,16 +483,16 @@ namespace OpenSimSearch.Modules.OpenSearch
public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID)
{
Hashtable ReqHash = new Hashtable();
ReqHash["eventID"] = queryEventID.ToString();
Hashtable ReqHash = new()
{
["eventID"] = queryEventID.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"event_info_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "event_info_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
@@ -498,19 +509,21 @@ namespace OpenSimSearch.Modules.OpenSearch
}
Hashtable d = (Hashtable)dataArray[0];
EventData data = new EventData();
data.eventID = Convert.ToUInt32(d["event_id"]);
data.creator = d["creator"].ToString();
data.name = d["name"].ToString();
data.category = d["category"].ToString();
data.description = d["description"].ToString();
data.date = d["date"].ToString();
data.dateUTC = Convert.ToUInt32(d["dateUTC"]);
data.duration = Convert.ToUInt32(d["duration"]);
data.cover = Convert.ToUInt32(d["covercharge"]);
data.amount = Convert.ToUInt32(d["coveramount"]);
data.simName = d["simname"].ToString();
Vector3.TryParse(d["globalposition"].ToString(), out data.globalPos);
EventData data = new()
{
eventID = Convert.ToUInt32(d["event_id"]),
creator = d["creator"].ToString(),
name = d["name"].ToString(),
category = d["category"].ToString(),
description = d["description"].ToString(),
date = d["date"].ToString(),
dateUTC = Convert.ToUInt32(d["dateUTC"]),
duration = Convert.ToUInt32(d["duration"]),
cover = Convert.ToUInt32(d["covercharge"]),
amount = Convert.ToUInt32(d["coveramount"]),
simName = d["simname"].ToString()
};
data.globalPos = (Vector3.TryParse(d["globalposition"].ToString(), out data.globalPos)) ? data.globalPos : new();
data.eventFlags = Convert.ToUInt32(d["eventflags"]);
remoteClient.SendEventInfoReply(data);
@@ -518,16 +531,16 @@ namespace OpenSimSearch.Modules.OpenSearch
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
{
Hashtable ReqHash = new Hashtable();
ReqHash["classifiedID"] = queryClassifiedID.ToString();
Hashtable ReqHash = new()
{
["classifiedID"] = queryClassifiedID.ToString()
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"classifieds_info_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "classifieds_info_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
@@ -547,8 +560,7 @@ namespace OpenSimSearch.Modules.OpenSearch
Hashtable d = (Hashtable)dataArray[0];
Vector3 globalPos = new Vector3();
Vector3.TryParse(d["posglobal"].ToString(), out globalPos);
Vector3 globalPos = (Vector3.TryParse(d["posglobal"].ToString(), out globalPos)) ? globalPos : new();
remoteClient.SendClassifiedInfoReply(
new UUID(d["classifieduuid"].ToString()),
@@ -576,32 +588,27 @@ namespace OpenSimSearch.Modules.OpenSearch
//defined in OpenMetaverse/GridManager.cs of libopenmetaverse.
if (itemtype == (uint)OpenMetaverse.GridItemType.LandForSale)
{
Hashtable ReqHash = new Hashtable();
Hashtable ReqHash = new()
{
//The flags are: SortAsc (1 << 15), PerMeterSort (1 << 17)
["flags"] = "163840",
["type"] = "4294967295", //This is -1 in 32 bits
["price"] = "0",
["area"] = "0",
["query_start"] = "0"
};
//The flags are: SortAsc (1 << 15), PerMeterSort (1 << 17)
ReqHash["flags"] = "163840";
ReqHash["type"] = "4294967295"; //This is -1 in 32 bits
ReqHash["price"] = "0";
ReqHash["area"] = "0";
ReqHash["query_start"] = "0";
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_land_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_land_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
ArrayList dataArray = (ArrayList)result["data"];
int count = dataArray.Count;
if (count > 100)
count = 101;
List<mapItemReply> mapitems = new List<mapItemReply>();
List<mapItemReply> mapitems = new();
string ParcelRegionUUID;
string[] landingpoint;
@@ -609,10 +616,10 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
if (d["name"] == null)
if (d["name"] is null)
continue;
mapItemReply mapitem = new mapItemReply();
mapItemReply mapitem = new();
ParcelRegionUUID = d["region_UUID"].ToString();
@@ -646,7 +653,6 @@ namespace OpenSimSearch.Modules.OpenSearch
itemtype == (uint)OpenMetaverse.GridItemType.MatureEvent ||
itemtype == (uint)OpenMetaverse.GridItemType.AdultEvent)
{
Hashtable ReqHash = new Hashtable();
//Find the maturity level
int maturity = (1 << 24);
@@ -666,23 +672,24 @@ namespace OpenSimSearch.Modules.OpenSearch
//When character before | is a u get upcoming/in-progress events
//Character before | is number of days before/after current date
//Characters after | is the number for a category
ReqHash["text"] = "u|0";
ReqHash["flags"] = maturity.ToString();
ReqHash["query_start"] = "0";
Hashtable ReqHash = new()
{
["text"] = "u|0",
["flags"] = maturity.ToString(),
["query_start"] = "0"
};
Hashtable result = GenericXMLRPCRequest(ReqHash,
"dir_events_query");
Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_events_query");
if (!Convert.ToBoolean(result["success"]))
{
remoteClient.SendAgentAlertMessage(
result["errorMessage"].ToString(), false);
remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
return;
}
ArrayList dataArray = (ArrayList)result["data"];
List<mapItemReply> mapitems = new List<mapItemReply>();
List<mapItemReply> mapitems = new();
int event_id;
string[] landingpoint;
@@ -690,10 +697,10 @@ namespace OpenSimSearch.Modules.OpenSearch
{
Hashtable d = (Hashtable)o;
if (d["name"] == null)
if (d["name"] is null)
continue;
mapItemReply mapitem = new mapItemReply();
mapItemReply mapitem = new();
//Events use a comma separator in the landing point
landingpoint = d["landing_point"].ToString().Split(',');

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<Project frameworkVersion="v4_6" name="OpenSimSearch.Modules" path="addon-modules/OpenSimSearch/Modules" type="Library">
<Project name="OpenSimSearch.Modules" path="addon-modules/OpenSimSearch/Modules" type="Library" version="0.5.0-$Rev$" frameworkVersion="net8_0">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
@@ -12,8 +12,6 @@
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference localCopy="false" name="System"/>
<Reference name="System.Xml"/>
<Reference name="OpenMetaverseTypes"/>
<Reference name="OpenMetaverse"/>
<Reference name="OpenSim.Framework"/>
@@ -26,7 +24,7 @@
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="obj" pattern="obj"/>
<Exclude name="obj" pattern="obj"/>
</Match>
</Files>
</Project>

View File

@@ -1,4 +1,6 @@
<?php
$DB_DRIVER = "mysql";
//$DB_DRIVER = "pgsql";
$DB_HOST = "localhost";
$DB_USER = "root";
$DB_PASSWORD = "";

View File

@@ -8,7 +8,7 @@ $now = time();
// Attempt to connect to the search database
try {
$db = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
$db = new PDO("$DB_DRIVER:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
@@ -190,6 +190,7 @@ function parse($hostname, $port, $xml)
//The image tag will only exist if the parcel has a snapshot image
$has_pic = 0;
$image = "00000000-0000-0000-0000-000000000000";
$image_node = $value->getElementsByTagName("image");
if ($image_node->length > 0)
@@ -251,7 +252,7 @@ function parse($hostname, $port, $xml)
$query = $db->prepare("INSERT INTO search_parcels VALUES(" .
":r_uuid, :p_name, :p_uuid, :landing, " .
":desc, :cat, :build, :script, :public, ".
":dwell, :i_uuid, :r_cat)");
":dwell, :i_uuid, :r_cat, :pic_uuid)");
$query->execute( array("r_uuid" => $regionuuid,
"p_name" => $parcelname,
"p_uuid" => $parceluuid,
@@ -263,7 +264,8 @@ function parse($hostname, $port, $xml)
"public" => $parcelpublic,
"dwell" => $dwell,
"i_uuid" => $infouuid,
"r_cat" => $regioncategory) );
"r_cat" => $regioncategory,
"pic_uuid" => $image) );
$query = $db->prepare("INSERT INTO search_popularplaces VALUES(" .
":p_uuid, :p_name, :dwell, " .

View File

@@ -7,7 +7,7 @@ include("databaseinfo.php");
// Attempt to connect to the database
try {
$db = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
$db = new PDO("$DB_DRIVER:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
@@ -126,14 +126,17 @@ function dir_places_query($method_name, $params, $app_data)
$sqldata['text2'] = $text;
//Prevent SQL injection by checking that $query_start is a number
if (!is_int($query_start))
$query_start = 0;
$query_start = (int)$query_start;
if ($query_start != 0 && ($query_start%100 != 0))
$query_start = 0;
$query_end = 101;
$sql = "SELECT * FROM search_parcels WHERE $cat_where" .
" (parcelname LIKE :text1" .
" OR description LIKE :text2)" .
" (LOWER(parcelname) LIKE LOWER(:text1)" .
" OR LOWER(description) LIKE LOWER(:text2))" .
$type . " ORDER BY $order parcelname" .
" LIMIT $query_start,101";
" LIMIT ".$query_start.",".$query_end.";";
$query = $db->prepare($sql);
$result = $query->execute($sqldata);
@@ -184,7 +187,7 @@ function dir_popular_query($method_name, $params, $app_data)
if ($text != "")
{
$terms[] = "(name LIKE :text)";
$terms[] = "(LOWER(name) LIKE LOWER(:text))";
$text = "%text%";
$sqldata['text'] = $text;
@@ -414,8 +417,8 @@ function dir_events_query($method_name, $params, $app_data)
if ($search_text != "")
{
$terms[] = "(name LIKE :text1 OR " .
"description LIKE :text2)";
$terms[] = "(LOWER(name) LIKE LOWER(:text1) OR " .
"LOWER(description) LIKE LOWER(:text2))";
$search_text = "%$search_text%";
$sqldata['text1'] = $search_text;
@@ -518,8 +521,8 @@ function dir_classified_query ($method_name, $params, $app_data)
if ($text != "")
{
$terms[] = "(name LIKE :text1" .
" OR description LIKE :text2)";
$terms[] = "(LOWER(name) LIKE LOWER(:text1)" .
" OR LOWER(description) LIKE LOWER(:text2))";
$text = "%$text%";
$sqldata['text1'] = $text;
@@ -605,6 +608,7 @@ function event_info_query($method_name, $params, $app_data)
if ($row['category'] == 27) $category = "Arts and Culture";
if ($row['category'] == 28) $category = "Charity/Support Groups";
if ($row['category'] == 29) $category = "Miscellaneous";
if ($row['category'] == 30) $category = "Live DJ";
$data[] = array(
"event_id" => $row["eventid"],

View File

@@ -26,7 +26,7 @@ if ($hostname == "" || $port == "")
// Attempt to connect to the database
try {
$db = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
$db = new PDO("$DB_DRIVER:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)

View File

@@ -1,70 +0,0 @@
#This file updates the tables used by OpenSimSearch to the latest schema.
#Use this file if you are updating an existing installation of the search
#module. If you are doing a first time install, use the ossearch.sql file.
#SVN revision 126
BEGIN;
ALTER TABLE `search_parcelsales` CHANGE `mature` `mature` varchar(32) NOT NULL DEFAULT 'PG';
COMMIT;
#SVN revision 142
BEGIN;
ALTER TABLE `search_hostsregister` DROP `lastcheck`;
ALTER TABLE `search_hostsregister` ADD `nextcheck` int(10) NOT NULL AFTER `register`;
ALTER TABLE `search_hostsregister` ADD `checked` tinyint(1) NOT NULL AFTER `nextcheck`;
ALTER TABLE `search_hostsregister` CHANGE `failcounter` `failcounter` int(10) NOT NULL;
COMMIT;
#SVN revision 149
BEGIN;
ALTER TABLE `search_events` DROP `mature`;
ALTER TABLE `search_events` CHANGE `eventflags` `eventflags` tinyint(1) NOT NULL;
ALTER TABLE `search_parcels` ADD `mature` VARCHAR( 10 ) NOT NULL;
ALTER TABLE `search_parcelsales` CHANGE `mature` `mature` VARCHAR( 10 ) NOT NULL DEFAULT 'PG';
ALTER TABLE `search_popularplaces` CHANGE `has_picture` `has_picture` tinyint(1) NOT NULL;
COMMIT;
#SVN revision 153
BEGIN;
ALTER TABLE `search_parcels` CHANGE `mature` `mature` VARCHAR( 10 ) NOT NULL DEFAULT 'PG';
COMMIT;
#SVN revision 154
BEGIN;
ALTER TABLE `search_events` CHANGE `dateUTC` `dateUTC` int(10) NOT NULL;
ALTER TABLE `search_events` CHANGE `covercharge` `covercharge` tinyint(1) NOT NULL;
COMMIT;
#SVN revision 199
BEGIN;
ALTER TABLE `search_allparcels` CHANGE `regionUUID` `regionUUID` char(36) NOT NULL;
ALTER TABLE `search_events` CHANGE `owneruuid` `owneruuid` char(36) NOT NULL;
ALTER TABLE `search_events` CHANGE `creatoruuid` `creatoruuid` char(36) NOT NULL;
ALTER TABLE `search_objects` CHANGE `objectuuid` `objectuuid` char(36) NOT NULL;
ALTER TABLE `search_objects` CHANGE `parcelUUID` `parcelUUID` char(36) NOT NULL;
ALTER TABLE `search_objects` CHANGE `regionuuid` `regionuuid` char(36) NOT NULL default '';
ALTER TABLE `search_parcels` CHANGE `regionUUID` `regionUUID` char(36) NOT NULL;
ALTER TABLE `search_parcels` CHANGE `parcelUUID` `parcelUUID` char(36) NOT NULL;
ALTER TABLE `search_parcels` CHANGE `infouuid` `infouuid` char(36) NOT NULL default '';
ALTER TABLE `search_parcelsales` CHANGE `regionUUID` `regionUUID` char(36) NOT NULL;
ALTER TABLE `search_parcelsales` CHANGE `parcelUUID` `parcelUUID` char(36) NOT NULL;
ALTER TABLE `search_regions` CHANGE `regionUUID` `regionUUID` char(36) NOT NULL;
ALTER TABLE `search_regions` CHANGE `ownerUUID` `ownerUUID` char(36) NOT NULL;
COMMIT;
#SVN revision 202
BEGIN;
ALTER TABLE `search_events` CHANGE `eventid` `eventid` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `search_events` CHANGE `duration` `duration` INT ( 10 ) NOT NULL;
COMMIT;
#SVN revision 208
BEGIN;
ALTER TABLE `search_events` ADD `parcelUUID` CHAR( 36 ) NOT NULL AFTER `simname`;
COMMIT;
#Revision 9
BEGIN;
ALTER TABLE `search_popularplaces` CHANGE `mature` `mature` varchar(10) COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `search_popularplaces` ADD PRIMARY KEY (`parcelUUID`);
COMMIT;

View File

@@ -1,38 +1,20 @@
CREATE TABLE IF NOT EXISTS `search_allparcels` (
DROP TABLE IF EXISTS `search_allparcels`;
CREATE TABLE `search_allparcels` (
`regionUUID` char(36) NOT NULL,
`parcelname` varchar(255) NOT NULL,
`ownerUUID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`groupUUID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`ownerUUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`groupUUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`landingpoint` varchar(255) NOT NULL,
`parcelUUID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`infoUUID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`parcelUUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`infoUUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`parcelarea` int(11) NOT NULL,
PRIMARY KEY (`parcelUUID`),
PRIMARY KEY (`parcelUUID`),
KEY `regionUUID` (`regionUUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);
# No search_ prefix, table has to be same as what the builtin profile module uses
CREATE TABLE IF NOT EXISTS `classifieds` (
`classifieduuid` char(36) NOT NULL,
`creatoruuid` char(36) NOT NULL,
`creationdate` int(20) NOT NULL,
`expirationdate` int(20) NOT NULL,
`category` varchar(20) NOT NULL,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`parceluuid` char(36) NOT NULL,
`parentestate` int(11) NOT NULL,
`snapshotuuid` char(36) NOT NULL,
`simname` varchar(255) NOT NULL,
`posglobal` varchar(255) NOT NULL,
`parcelname` varchar(255) NOT NULL,
`classifiedflags` int(8) NOT NULL,
`priceforlisting` int(5) NOT NULL,
PRIMARY KEY (`classifieduuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `search_events` (
DROP TABLE IF EXISTS `search_events`;
CREATE TABLE `search_events` (
`owneruuid` char(36) NOT NULL,
`name` varchar(255) NOT NULL,
`eventid` int(11) unsigned NOT NULL AUTO_INCREMENT,
@@ -48,9 +30,10 @@ CREATE TABLE IF NOT EXISTS `search_events` (
`globalPos` varchar(255) NOT NULL,
`eventflags` int(1) NOT NULL,
PRIMARY KEY (`eventid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
);
CREATE TABLE IF NOT EXISTS `search_hostsregister` (
DROP TABLE IF EXISTS `search_hostsregister`;
CREATE TABLE `search_hostsregister` (
`host` varchar(255) NOT NULL,
`port` int(5) NOT NULL,
`register` int(10) NOT NULL,
@@ -58,19 +41,21 @@ CREATE TABLE IF NOT EXISTS `search_hostsregister` (
`checked` tinyint(1) NOT NULL,
`failcounter` int(10) NOT NULL,
PRIMARY KEY (`host`,`port`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);
CREATE TABLE IF NOT EXISTS `search_objects` (
DROP TABLE IF EXISTS `search_objects`;
CREATE TABLE `search_objects` (
`objectuuid` char(36) NOT NULL,
`parceluuid` char(36) NOT NULL,
`location` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`regionuuid` char(36) NOT NULL default '',
PRIMARY KEY (`objectuuid`,`parceluuid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
`regionuuid` char(36) NOT NULL DEFAULT '',
PRIMARY KEY (`objectuuid`,`parceluuid`)
);
CREATE TABLE IF NOT EXISTS `search_parcels` (
DROP TABLE IF EXISTS `search_parcels`;
CREATE TABLE `search_parcels` (
`regionUUID` char(36) NOT NULL,
`parcelname` varchar(255) NOT NULL,
`parcelUUID` char(36) NOT NULL,
@@ -80,46 +65,51 @@ CREATE TABLE IF NOT EXISTS `search_parcels` (
`build` enum('true','false') NOT NULL,
`script` enum('true','false') NOT NULL,
`public` enum('true','false') NOT NULL,
`dwell` float NOT NULL default '0',
`infouuid` varchar(36) NOT NULL default '',
`mature` varchar(10) NOT NULL default 'PG',
PRIMARY KEY (`regionUUID`,`parcelUUID`),
`dwell` float NOT NULL DEFAULT 0,
`infouuid` varchar(36) NOT NULL DEFAULT '',
`mature` varchar(10) NOT NULL DEFAULT 'PG',
`pictureUUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
PRIMARY KEY (`regionUUID`,`parcelUUID`),
KEY `name` (`parcelname`),
KEY `description` (`description`),
KEY `searchcategory` (`searchcategory`),
KEY `dwell` (`dwell`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);
CREATE TABLE IF NOT EXISTS `search_parcelsales` (
DROP TABLE IF EXISTS `search_parcelsales`;
CREATE TABLE `search_parcelsales` (
`regionUUID` char(36) NOT NULL,
`parcelname` varchar(255) NOT NULL,
`parcelUUID` char(36) NOT NULL,
`area` int(6) NOT NULL,
`saleprice` int(11) NOT NULL,
`landingpoint` varchar(255) NOT NULL,
`infoUUID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`infoUUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`dwell` int(11) NOT NULL,
`parentestate` int(11) NOT NULL default '1',
`mature` varchar(10) NOT NULL default 'PG',
PRIMARY KEY (`regionUUID`,`parcelUUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
`parentestate` int(11) NOT NULL DEFAULT 1,
`mature` varchar(10) NOT NULL DEFAULT 'PG',
PRIMARY KEY (`regionUUID`,`parcelUUID`)
);
CREATE TABLE IF NOT EXISTS `search_popularplaces` (
DROP TABLE IF EXISTS `search_popularplaces`;
CREATE TABLE `search_popularplaces` (
`parcelUUID` char(36) NOT NULL,
`name` varchar(255) NOT NULL,
`dwell` float NOT NULL,
`infoUUID` char(36) NOT NULL,
`has_picture` tinyint(1) NOT NULL,
`mature` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`parcelUUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
`mature` varchar(10) NOT NULL,
PRIMARY KEY (`parcelUUID`)
);
CREATE TABLE IF NOT EXISTS `search_regions` (
DROP TABLE IF EXISTS `search_regions`;
CREATE TABLE `search_regions` (
`regionname` varchar(255) NOT NULL,
`regionUUID` char(36) NOT NULL,
`regionhandle` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`owner` varchar(255) NOT NULL,
`owneruuid` char(36) NOT NULL,
PRIMARY KEY (`regionUUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
PRIMARY KEY (`regionUUID`)
);

View File

@@ -0,0 +1,37 @@
-- Purge all search entries related to a permanently deleted region
-- Prerequisites: OpenSimSearch, lickx branch
-- https://github.com/lickx/OpenSimSearch/tree/lickx
-- To be sourced into your robust database.
-- Usage example: CALL sp_searchpurge('2ef309ab-dc66-4123-85e8-873d00b8acc9');
DELIMITER //
CREATE OR REPLACE PROCEDURE sp_searchpurge (IN pRegionID CHAR(36))
BEGIN
-- classifieds (note, classifieds is the only table that isn't prefixed with search_ because Robust expects and queries it under this name)
DELETE classifieds FROM classifieds INNER JOIN search_parcels ON classifieds.parceluuid = search_parcels.parcelUUID WHERE search_parcels.regionUUID=pRegionID;
-- events
DELETE search_events FROM search_events INNER JOIN search_parcels ON search_events.parcelUUID = search_parcels.parcelUUID WHERE search_parcels.regionUUID=pRegionID;
-- objects
DELETE FROM search_objects WHERE regionuuid=pRegionID;
-- regionsales
DELETE FROM search_parcelsales WHERE regionUUID=pRegionID;
-- popularplaces
DELETE search_popularplaces FROM search_popularplaces INNER JOIN search_parcels ON search_popularplaces.parcelUUID = search_parcels.parcelUUID WHERE search_parcels.regionUUID=pRegionID;
-- allparcels
DELETE FROM search_allparcels WHERE regionUUID=pRegionID;
-- parcels
DELETE FROM search_parcels WHERE regionUUID=pRegionID;
-- regions
DELETE FROM search_regions WHERE regionUUID=pRegionID;
END //
DELIMITER ;

View File

@@ -233,6 +233,7 @@ function checklength(obj,warning_div)
<option value="23" >Nightlife/Entertainment</option>
<option value="25" >Pageants</option>
<option value="19" >Sports</option>
<option value="30" >Live DJ</option>
</select>
</td>
</tr>
@@ -329,4 +330,4 @@ function checklength(obj,warning_div)
</FORM>
<?php
}
?>
?>