mirror of
https://github.com/kcozens/OpenSimSearch.git
synced 2026-08-14 08:52:28 +00:00
Apply #4361 to add land search.
Applied with whitespace cleanup git-svn-id: http://forge.opensimulator.org/svn/ossearch/trunk@121 109abde3-1f22-4c10-b5d7-b6b0135cd00c
This commit is contained in:
@@ -17,394 +17,393 @@ using OpenSim.Framework.Communications.Cache;
|
||||
|
||||
namespace OpenSimSearch.Modules.OpenSearch
|
||||
{
|
||||
public class OpenSearchModule : IRegionModule
|
||||
{
|
||||
//
|
||||
// Log module
|
||||
//
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public class OpenSearchModule : IRegionModule
|
||||
{
|
||||
//
|
||||
// Log module
|
||||
//
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//
|
||||
// Module vars
|
||||
//
|
||||
private IConfigSource m_gConfig;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
private string m_SearchServer = "";
|
||||
private bool m_Enabled = true;
|
||||
//
|
||||
// Module vars
|
||||
//
|
||||
private IConfigSource m_gConfig;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
private string m_SearchServer = "";
|
||||
private bool m_Enabled = true;
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
IConfig searchConfig = config.Configs["Search"];
|
||||
IConfig searchConfig = config.Configs["Search"];
|
||||
|
||||
if (m_Scenes.Count == 0) // First time
|
||||
{
|
||||
if (searchConfig == null)
|
||||
{
|
||||
m_log.Info("[SEARCH] Not configured, disabling");
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
m_SearchServer = searchConfig.GetString("SearchURL", "");
|
||||
if (m_SearchServer == "")
|
||||
{
|
||||
m_log.Error("[SEARCH] No search server, disabling search");
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[SEARCH] Search module is activated");
|
||||
m_Enabled = true;
|
||||
}
|
||||
}
|
||||
if (m_Scenes.Count == 0) // First time
|
||||
{
|
||||
if (searchConfig == null)
|
||||
{
|
||||
m_log.Info("[SEARCH] Not configured, disabling");
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
m_SearchServer = searchConfig.GetString("SearchURL", "");
|
||||
if (m_SearchServer == "")
|
||||
{
|
||||
m_log.Error("[SEARCH] No search server, disabling search");
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[SEARCH] Search module is activated");
|
||||
m_Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_Scenes.Contains(scene))
|
||||
m_Scenes.Add(scene);
|
||||
if (!m_Scenes.Contains(scene))
|
||||
m_Scenes.Add(scene);
|
||||
|
||||
m_gConfig = config;
|
||||
m_gConfig = config;
|
||||
|
||||
// Hook up events
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
}
|
||||
// Hook up events
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
}
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "SearchModule"; }
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get { return "SearchModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
/// New Client Event Handler
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
// Subscribe to messages
|
||||
client.OnDirPlacesQuery += DirPlacesQuery;
|
||||
client.OnDirFindQuery += DirFindQuery;
|
||||
client.OnDirPopularQuery += DirPopularQuery;
|
||||
client.OnDirLandQuery += DirLandQuery;
|
||||
/// New Client Event Handler
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
// Subscribe to messages
|
||||
client.OnDirPlacesQuery += DirPlacesQuery;
|
||||
client.OnDirFindQuery += DirFindQuery;
|
||||
client.OnDirPopularQuery += DirPopularQuery;
|
||||
client.OnDirLandQuery += DirLandQuery;
|
||||
client.OnDirClassifiedQuery += DirClassifiedQuery;
|
||||
// Response after Directory Queries
|
||||
client.OnEventInfoRequest += EventInfoRequest;
|
||||
// Response after Directory Queries
|
||||
client.OnEventInfoRequest += EventInfoRequest;
|
||||
client.OnClassifiedInfoRequest += ClassifiedInfoRequest;
|
||||
client.OnMapItemRequest += HandleMapItemRequest;
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// Make external XMLRPC request
|
||||
//
|
||||
private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method)
|
||||
{
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(ReqParams);
|
||||
|
||||
//
|
||||
// Make external XMLRPC request
|
||||
//
|
||||
private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method)
|
||||
{
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(ReqParams);
|
||||
// Send Request
|
||||
XmlRpcResponse Resp;
|
||||
try
|
||||
{
|
||||
XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
|
||||
Resp = Req.Send(m_SearchServer, 30000);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
m_log.ErrorFormat("[SEARCH]: Unable to connect to Search " +
|
||||
"Server {0}. Exception {1}", m_SearchServer, ex);
|
||||
|
||||
// Send Request
|
||||
XmlRpcResponse Resp;
|
||||
try
|
||||
{
|
||||
XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
|
||||
Resp = Req.Send(m_SearchServer, 30000);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
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 Hashtable();
|
||||
ErrorHash["success"] = false;
|
||||
ErrorHash["errorMessage"] = "Unable to search at this time. ";
|
||||
ErrorHash["errorURI"] = "";
|
||||
return ErrorHash;
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[SEARCH]: Unable to connect to Search Server {0}. " +
|
||||
"Exception {1}", m_SearchServer, ex);
|
||||
|
||||
return ErrorHash;
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
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 Hashtable();
|
||||
ErrorHash["success"] = false;
|
||||
ErrorHash["errorMessage"] = "Unable to search at this time. ";
|
||||
ErrorHash["errorURI"] = "";
|
||||
return ErrorHash;
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[SEARCH]: Unable to connect to Search Server {0}. " +
|
||||
"Exception {1}", m_SearchServer, ex);
|
||||
|
||||
return ErrorHash;
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
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 Hashtable();
|
||||
ErrorHash["success"] = false;
|
||||
ErrorHash["errorMessage"] = "Unable to search at this time. ";
|
||||
ErrorHash["errorURI"] = "";
|
||||
return ErrorHash;
|
||||
}
|
||||
if (Resp.IsFault)
|
||||
{
|
||||
Hashtable ErrorHash = new Hashtable();
|
||||
ErrorHash["success"] = false;
|
||||
ErrorHash["errorMessage"] = "Unable to search at this time. ";
|
||||
ErrorHash["errorURI"] = "";
|
||||
return ErrorHash;
|
||||
}
|
||||
Hashtable RespData = (Hashtable)Resp.Value;
|
||||
|
||||
return ErrorHash;
|
||||
}
|
||||
if (Resp.IsFault)
|
||||
{
|
||||
Hashtable ErrorHash = new Hashtable();
|
||||
ErrorHash["success"] = false;
|
||||
ErrorHash["errorMessage"] = "Unable to search at this time. ";
|
||||
ErrorHash["errorURI"] = "";
|
||||
return ErrorHash;
|
||||
}
|
||||
Hashtable RespData = (Hashtable)Resp.Value;
|
||||
return RespData;
|
||||
}
|
||||
|
||||
return RespData;
|
||||
}
|
||||
protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
|
||||
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();
|
||||
|
||||
protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
|
||||
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 result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_places_query");
|
||||
|
||||
Hashtable result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_places_query");
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
DirPlacesReplyData[] data = new DirPlacesReplyData[count];
|
||||
|
||||
DirPlacesReplyData[] data = new DirPlacesReplyData[count];
|
||||
int i = 0;
|
||||
|
||||
int i = 0;
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
Hashtable d = (Hashtable)o;
|
||||
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
remoteClient.SendDirPlacesReply(queryID, data);
|
||||
}
|
||||
|
||||
remoteClient.SendDirPlacesReply(queryID, data);
|
||||
}
|
||||
public void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags)
|
||||
{
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["flags"] = queryFlags.ToString();
|
||||
|
||||
public void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags)
|
||||
{
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["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);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
DirPopularReplyData[] data = new DirPopularReplyData[count];
|
||||
|
||||
DirPopularReplyData[] data = new DirPopularReplyData[count];
|
||||
int i = 0;
|
||||
|
||||
int i = 0;
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
Hashtable d = (Hashtable)o;
|
||||
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
remoteClient.SendDirPopularReply(queryID, data);
|
||||
}
|
||||
|
||||
remoteClient.SendDirPopularReply(queryID, data);
|
||||
}
|
||||
public void DirLandQuery(IClientAPI remoteClient, UUID queryID,
|
||||
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();
|
||||
|
||||
public void DirLandQuery(IClientAPI remoteClient, UUID queryID,
|
||||
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 result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_land_query");
|
||||
|
||||
Hashtable result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_land_query");
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
DirLandReplyData[] data = new DirLandReplyData[count];
|
||||
|
||||
DirLandReplyData[] data = new DirLandReplyData[count];
|
||||
int i = 0;
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
Hashtable d = (Hashtable)o;
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
Hashtable d = (Hashtable)o;
|
||||
|
||||
if (d["name"] == 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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
|
||||
remoteClient.SendDirLandReply(queryID, data);
|
||||
}
|
||||
remoteClient.SendDirLandReply(queryID, data);
|
||||
}
|
||||
|
||||
public void DirFindQuery(IClientAPI remoteClient, UUID queryID,
|
||||
string queryText, uint queryFlags, int queryStart)
|
||||
{
|
||||
if ((queryFlags & 1) != 0)
|
||||
{
|
||||
DirPeopleQuery(remoteClient, queryID, queryText, queryFlags,
|
||||
queryStart);
|
||||
return;
|
||||
}
|
||||
else if ((queryFlags & 32) != 0)
|
||||
{
|
||||
DirEventsQuery(remoteClient, queryID, queryText, queryFlags,
|
||||
queryStart);
|
||||
return;
|
||||
}
|
||||
}
|
||||
public void DirFindQuery(IClientAPI remoteClient, UUID queryID,
|
||||
string queryText, uint queryFlags, int queryStart)
|
||||
{
|
||||
if ((queryFlags & 1) != 0)
|
||||
{
|
||||
DirPeopleQuery(remoteClient, queryID, queryText, queryFlags,
|
||||
queryStart);
|
||||
return;
|
||||
}
|
||||
else if ((queryFlags & 32) != 0)
|
||||
{
|
||||
DirEventsQuery(remoteClient, queryID, queryText, queryFlags,
|
||||
queryStart);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void DirPeopleQuery(IClientAPI remoteClient, UUID queryID,
|
||||
string queryText, uint queryFlags, int queryStart)
|
||||
{
|
||||
List<AvatarPickerAvatar> AvatarResponses =
|
||||
new List<AvatarPickerAvatar>();
|
||||
AvatarResponses = m_Scenes[0].SceneGridService.
|
||||
GenerateAgentPickerRequestResponse(queryID, queryText);
|
||||
public void DirPeopleQuery(IClientAPI remoteClient, UUID queryID,
|
||||
string queryText, uint queryFlags, int queryStart)
|
||||
{
|
||||
List<AvatarPickerAvatar> AvatarResponses =
|
||||
new List<AvatarPickerAvatar>();
|
||||
AvatarResponses = m_Scenes[0].SceneGridService.
|
||||
GenerateAgentPickerRequestResponse(queryID, queryText);
|
||||
|
||||
DirPeopleReplyData[] data =
|
||||
new DirPeopleReplyData[AvatarResponses.Count];
|
||||
DirPeopleReplyData[] data =
|
||||
new DirPeopleReplyData[AvatarResponses.Count];
|
||||
|
||||
int i = 0;
|
||||
foreach (AvatarPickerAvatar item in AvatarResponses)
|
||||
{
|
||||
data[i] = new DirPeopleReplyData();
|
||||
int i = 0;
|
||||
foreach (AvatarPickerAvatar item in AvatarResponses)
|
||||
{
|
||||
data[i] = new DirPeopleReplyData();
|
||||
|
||||
data[i].agentID = item.AvatarID;
|
||||
data[i].firstName = item.firstName;
|
||||
data[i].lastName = item.lastName;
|
||||
data[i].group = "";
|
||||
data[i].online = false;
|
||||
data[i].reputation = 0;
|
||||
i++;
|
||||
}
|
||||
data[i].agentID = item.AvatarID;
|
||||
data[i].firstName = item.firstName;
|
||||
data[i].lastName = item.lastName;
|
||||
data[i].group = "";
|
||||
data[i].online = false;
|
||||
data[i].reputation = 0;
|
||||
i++;
|
||||
}
|
||||
|
||||
remoteClient.SendDirPeopleReply(queryID, data);
|
||||
}
|
||||
remoteClient.SendDirPeopleReply(queryID, data);
|
||||
}
|
||||
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();
|
||||
|
||||
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 result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_events_query");
|
||||
|
||||
Hashtable result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_events_query");
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
DirEventsReplyData[] data = new DirEventsReplyData[count];
|
||||
|
||||
DirEventsReplyData[] data = new DirEventsReplyData[count];
|
||||
int i = 0;
|
||||
|
||||
int i = 0;
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
Hashtable d = (Hashtable)o;
|
||||
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
|
||||
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"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
|
||||
remoteClient.SendDirEventsReply(queryID, data);
|
||||
}
|
||||
remoteClient.SendDirEventsReply(queryID, data);
|
||||
}
|
||||
|
||||
public void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID,
|
||||
string queryText, uint queryFlags, uint category,
|
||||
@@ -413,7 +412,7 @@ namespace OpenSimSearch.Modules.OpenSearch
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["text"] = queryText;
|
||||
ReqHash["flags"] = queryFlags.ToString();
|
||||
ReqHash["category"] = category.ToString();
|
||||
ReqHash["category"] = category.ToString();
|
||||
ReqHash["query_start"] = queryStart.ToString();
|
||||
|
||||
Hashtable result = GenericXMLRPCRequest(ReqHash,
|
||||
@@ -445,7 +444,7 @@ namespace OpenSimSearch.Modules.OpenSearch
|
||||
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].expirationDate = Convert.ToUInt32(d["expiration_date"]);
|
||||
data[i].price = Convert.ToInt32(d["priceforlisting"]);
|
||||
i++;
|
||||
if (i >= count)
|
||||
@@ -455,85 +454,85 @@ namespace OpenSimSearch.Modules.OpenSearch
|
||||
remoteClient.SendDirClassifiedReply(queryID, data);
|
||||
}
|
||||
|
||||
public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID)
|
||||
{
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["eventID"] = queryEventID.ToString();
|
||||
public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID)
|
||||
{
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["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);
|
||||
return;
|
||||
}
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
if (dataArray.Count == 0)
|
||||
{
|
||||
// something bad happened here, if we could return an
|
||||
// event after the search,
|
||||
// we should be able to find it here
|
||||
// TODO do some (more) sensible error-handling here
|
||||
remoteClient.SendAgentAlertMessage("Couldn't find event.",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
if (dataArray.Count == 0)
|
||||
{
|
||||
// something bad happened here, if we could return an
|
||||
// event after the search,
|
||||
// we should be able to find it here
|
||||
// TODO do some (more) sensible error-handling here
|
||||
remoteClient.SendAgentAlertMessage("Couldn't find event.",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
data.eventFlags = Convert.ToUInt32(d["eventflags"]);
|
||||
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);
|
||||
data.eventFlags = Convert.ToUInt32(d["eventflags"]);
|
||||
|
||||
remoteClient.SendEventInfoReply(data);
|
||||
}
|
||||
remoteClient.SendEventInfoReply(data);
|
||||
}
|
||||
|
||||
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
|
||||
{
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["classifiedID"] = queryClassifiedID.ToString();
|
||||
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
|
||||
{
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["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);
|
||||
return;
|
||||
}
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
if (dataArray.Count == 0)
|
||||
{
|
||||
// something bad happened here, if we could return an
|
||||
// event after the search,
|
||||
// we should be able to find it here
|
||||
// TODO do some (more) sensible error-handling here
|
||||
remoteClient.SendAgentAlertMessage("Couldn't find classified.",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
if (dataArray.Count == 0)
|
||||
{
|
||||
// something bad happened here, if we could return an
|
||||
// event after the search,
|
||||
// we should be able to find it here
|
||||
// TODO do some (more) sensible error-handling here
|
||||
remoteClient.SendAgentAlertMessage("Couldn't find classified.",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
|
||||
Hashtable d = (Hashtable)dataArray[0];
|
||||
Hashtable d = (Hashtable)dataArray[0];
|
||||
|
||||
Vector3 globalPos = new Vector3();
|
||||
Vector3.TryParse(d["posglobal"].ToString(), out globalPos);
|
||||
Vector3.TryParse(d["posglobal"].ToString(), out globalPos);
|
||||
|
||||
remoteClient.SendClassifiedInfoReply(
|
||||
remoteClient.SendClassifiedInfoReply(
|
||||
new UUID(d["classifieduuid"].ToString()),
|
||||
new UUID(d["creatoruuid"].ToString()),
|
||||
Convert.ToUInt32(d["creationdate"]),
|
||||
@@ -549,6 +548,87 @@ namespace OpenSimSearch.Modules.OpenSearch
|
||||
d["parcelname"].ToString(),
|
||||
Convert.ToByte(d["classifiedflags"]),
|
||||
Convert.ToInt32(d["priceforlisting"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
|
||||
uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
|
||||
{
|
||||
if (itemtype == 7) //(land sales)
|
||||
{
|
||||
int tc = Environment.TickCount;
|
||||
Hashtable ReqHash = new Hashtable();
|
||||
ReqHash["flags"] = "163840";
|
||||
ReqHash["type"] = "4294967295 ";
|
||||
ReqHash["price"] = "0";
|
||||
ReqHash["area"] = "0";
|
||||
ReqHash["query_start"] = "0";
|
||||
|
||||
Hashtable result = GenericXMLRPCRequest(ReqHash,
|
||||
"dir_land_query");
|
||||
|
||||
if (!Convert.ToBoolean(result["success"]))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
result["errorMessage"].ToString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList dataArray = (ArrayList)result["data"];
|
||||
|
||||
int count = dataArray.Count;
|
||||
if (count > 100)
|
||||
count = 101;
|
||||
|
||||
DirLandReplyData[] Landdata = new DirLandReplyData[count];
|
||||
|
||||
int i = 0;
|
||||
List<string> ParcelLandingPoint = new List<string>();
|
||||
List<string> ParcelRegionUUID = new List<string>();
|
||||
foreach (Object o in dataArray)
|
||||
{
|
||||
Hashtable d = (Hashtable)o;
|
||||
|
||||
if (d["name"] == null)
|
||||
continue;
|
||||
Landdata[i] = new DirLandReplyData();
|
||||
Landdata[i].parcelID = new UUID(d["parcel_id"].ToString());
|
||||
Landdata[i].name = d["name"].ToString();
|
||||
Landdata[i].auction = Convert.ToBoolean(d["auction"]);
|
||||
Landdata[i].forSale = Convert.ToBoolean(d["for_sale"]);
|
||||
Landdata[i].salePrice = Convert.ToInt32(d["sale_price"]);
|
||||
Landdata[i].actualArea = Convert.ToInt32(d["area"]);
|
||||
ParcelLandingPoint[i] = d["landing_point"].ToString();
|
||||
ParcelRegionUUID[i] = d["region_UUID"].ToString();
|
||||
i++;
|
||||
if (i >= count)
|
||||
break;
|
||||
}
|
||||
i = 0;
|
||||
uint locX = 0;
|
||||
uint locY = 0;
|
||||
foreach (DirLandReplyData landDir in Landdata)
|
||||
{
|
||||
foreach(Scene scene in m_Scenes)
|
||||
{
|
||||
if(scene.RegionInfo.RegionID == ParcelRegionUUID[i])
|
||||
{
|
||||
locX = scene.RegionInfo.RegionLocX;
|
||||
locY = scene.RegionInfo.RegionLocY;
|
||||
}
|
||||
}
|
||||
string[] landingpoint = ParcelLandingPoint[i].Split('/');
|
||||
mapitem = new mapItemReply();
|
||||
mapitem.x = (uint)(locX + Convert.ToDecimal(landingpoint[0]));
|
||||
mapitem.y = (uint)(locY + Convert.ToDecimal(landingpoint[1]));
|
||||
mapitem.id = landDir.parcelID;
|
||||
mapitem.name = landDir.name;
|
||||
mapitem.Extra = landDir.actualArea;
|
||||
mapitem.Extra2 = landDir.salePrice;
|
||||
mapitems.Add(mapitem);
|
||||
i++;
|
||||
}
|
||||
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
|
||||
mapitems.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+279
-277
@@ -26,68 +26,68 @@ $xmlrpc_server = xmlrpc_server_create();
|
||||
#
|
||||
|
||||
xmlrpc_server_register_method($xmlrpc_server, "dir_places_query",
|
||||
"dir_places_query");
|
||||
"dir_places_query");
|
||||
|
||||
function dir_places_query($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$text = $req['text'];
|
||||
$category = $req['category'];
|
||||
$query_start = $req['query_start'];
|
||||
$text = $req['text'];
|
||||
$category = $req['category'];
|
||||
$query_start = $req['query_start'];
|
||||
|
||||
$pieces = split(" ", $text);
|
||||
$text = join("%", $pieces);
|
||||
|
||||
if ($text == "%%%")
|
||||
{
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => False,
|
||||
'errorMessage' => "Invalid search terms"
|
||||
));
|
||||
if ($text == "%%%")
|
||||
{
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => False,
|
||||
'errorMessage' => "Invalid search terms"
|
||||
));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($category != -1)
|
||||
{
|
||||
$result = mysql_query("select * from parcels where " .
|
||||
"(searchcategory = -1 or searchcategory = '" .
|
||||
mysql_escape_string($category) ."') and (parcelname like '%" .
|
||||
mysql_escape_string($text) . "%' or description like '%" .
|
||||
mysql_escape_string($text) . "%') order by " .
|
||||
"dwell desc, parcelname" .
|
||||
" limit ".(0+$query_start).",100");
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = mysql_query("select * from parcels where " .
|
||||
"parcelname like '%" .
|
||||
mysql_escape_string($text) . "%' or description like '%" .
|
||||
mysql_escape_string($text) . "%' order by " .
|
||||
"dwell desc, parcelname" .
|
||||
" limit ".(0+$query_start).",100");
|
||||
}
|
||||
if ($category != -1)
|
||||
{
|
||||
$result = mysql_query("select * from parcels where " .
|
||||
"(searchcategory = -1 or searchcategory = '" .
|
||||
mysql_escape_string($category) ."') and (parcelname like '%" .
|
||||
mysql_escape_string($text) . "%' or description like '%" .
|
||||
mysql_escape_string($text) . "%') order by " .
|
||||
"dwell desc, parcelname" .
|
||||
" limit ".(0+$query_start).",100");
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = mysql_query("select * from parcels where " .
|
||||
"parcelname like '%" .
|
||||
mysql_escape_string($text) . "%' or description like '%" .
|
||||
mysql_escape_string($text) . "%' order by " .
|
||||
"dwell desc, parcelname" .
|
||||
" limit ".(0+$query_start).",100");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"parcel_id" => $row["infouuid"],
|
||||
"name" => $row["parcelname"],
|
||||
"for_sale" => "False",
|
||||
"auction" => "False",
|
||||
"dwell" => $row["dwell"]);
|
||||
}
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data
|
||||
));
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"parcel_id" => $row["infouuid"],
|
||||
"name" => $row["parcelname"],
|
||||
"for_sale" => "False",
|
||||
"auction" => "False",
|
||||
"dwell" => $row["dwell"]);
|
||||
}
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data
|
||||
));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -95,43 +95,43 @@ function dir_places_query($method_name, $params, $app_data)
|
||||
#
|
||||
|
||||
xmlrpc_server_register_method($xmlrpc_server, "dir_popular_query",
|
||||
"dir_popular_query");
|
||||
"dir_popular_query");
|
||||
|
||||
function dir_popular_query($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$flags = $req['flags'];
|
||||
$flags = $req['flags'];
|
||||
|
||||
$terms = array();
|
||||
$terms = array();
|
||||
|
||||
if ($flags & 0x1000)
|
||||
$terms[] = "has_picture = 1";
|
||||
if ($flags & 0x1000)
|
||||
$terms[] = "has_picture = 1";
|
||||
|
||||
if ($flags & 0x0800)
|
||||
$terms[] = "mature = 0";
|
||||
if ($flags & 0x0800)
|
||||
$terms[] = "mature = 0";
|
||||
|
||||
$where = "";
|
||||
if (count($terms) > 0)
|
||||
$where = " where " . join(" and ", $terms);
|
||||
$where = "";
|
||||
if (count($terms) > 0)
|
||||
$where = " where " . join(" and ", $terms);
|
||||
|
||||
$result = mysql_query("select * from popularplaces" . $where);
|
||||
$result = mysql_query("select * from popularplaces" . $where);
|
||||
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"parcel_id" => $row["infoUUID"],
|
||||
"name" => $row["name"],
|
||||
"dwell" => $row["dwell"]);
|
||||
}
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"parcel_id" => $row["infoUUID"],
|
||||
"name" => $row["name"],
|
||||
"dwell" => $row["dwell"]);
|
||||
}
|
||||
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -139,84 +139,86 @@ function dir_popular_query($method_name, $params, $app_data)
|
||||
#
|
||||
|
||||
xmlrpc_server_register_method($xmlrpc_server, "dir_land_query",
|
||||
"dir_land_query");
|
||||
"dir_land_query");
|
||||
|
||||
function dir_land_query($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$flags = $req['flags'];
|
||||
$type = $req['type'];
|
||||
$price = $req['price'];
|
||||
$area = $req['area'];
|
||||
$query_start = $req['query_start'];
|
||||
$flags = $req['flags'];
|
||||
$type = $req['type'];
|
||||
$price = $req['price'];
|
||||
$area = $req['area'];
|
||||
$query_start = $req['query_start'];
|
||||
|
||||
$terms = array();
|
||||
$order = "lsq";
|
||||
if ($flags & 0x80000)
|
||||
$order = "parcelname";
|
||||
if ($flags & 0x10000)
|
||||
$order = "saleprice";
|
||||
if ($flags & 0x40000)
|
||||
$order = "area";
|
||||
if (!($flags & 0x8000))
|
||||
$order .= " desc";
|
||||
$terms = array();
|
||||
$order = "lsq";
|
||||
if ($flags & 0x80000)
|
||||
$order = "parcelname";
|
||||
if ($flags & 0x10000)
|
||||
$order = "saleprice";
|
||||
if ($flags & 0x40000)
|
||||
$order = "area";
|
||||
if (!($flags & 0x8000))
|
||||
$order .= " desc";
|
||||
|
||||
if ($flags & 0x100000)
|
||||
$terms[] = "saleprice <= '" . mysql_escape_string($price) . "'";
|
||||
if ($flags & 0x100000)
|
||||
$terms[] = "saleprice <= '" . mysql_escape_string($price) . "'";
|
||||
|
||||
if ($flags & 0x200000)
|
||||
$terms[] = "area >= '" . mysql_escape_string($area) . "'";
|
||||
if ($flags & 0x200000)
|
||||
$terms[] = "area >= '" . mysql_escape_string($area) . "'";
|
||||
|
||||
if (($type & 26) == 2) // Auction
|
||||
{
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => False,
|
||||
'errorMessage' => "No auctions listed"));
|
||||
if (($type & 26) == 2) // Auction
|
||||
{
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => False,
|
||||
'errorMessage' => "No auctions listed"));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (($type & 24) == 8)
|
||||
$terms[] = "parentestate = 1";
|
||||
if (($type & 24) == 16)
|
||||
$terms[] = "parentestate <> 1";
|
||||
if (($type & 24) == 8)
|
||||
$terms[] = "parentestate = 1";
|
||||
if (($type & 24) == 16)
|
||||
$terms[] = "parentestate <> 1";
|
||||
|
||||
if ($flags & 0x800)
|
||||
$terms[] = "mature = 'false'";
|
||||
if ($flags & 0x4000)
|
||||
$terms[] = "mature = 'true'";
|
||||
if ($flags & 0x800)
|
||||
$terms[] = "mature = 'false'";
|
||||
if ($flags & 0x4000)
|
||||
$terms[] = "mature = 'true'";
|
||||
|
||||
$where = "";
|
||||
if (count($terms) > 0)
|
||||
$where = " where " . join(" and ", $terms);
|
||||
$where = "";
|
||||
if (count($terms) > 0)
|
||||
$where = " where " . join(" and ", $terms);
|
||||
|
||||
$sql = "select *, saleprice/area as lsq from parcelsales" . $where .
|
||||
" order by " . $order . " limit " .
|
||||
mysql_escape_string($query_start) . ",101";
|
||||
$sql = "select *, saleprice/area as lsq from parcelsales" . $where .
|
||||
" order by " . $order . " limit " .
|
||||
mysql_escape_string($query_start) . ",101";
|
||||
|
||||
$result = mysql_query($sql);
|
||||
$result = mysql_query($sql);
|
||||
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"parcel_id" => $row["infoUUID"],
|
||||
"name" => $row["parcelname"],
|
||||
"auction" => "false",
|
||||
"for_sale" => "true",
|
||||
"sale_price" => $row["saleprice"],
|
||||
"area" => $row["area"]);
|
||||
}
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"parcel_id" => $row["infoUUID"],
|
||||
"name" => $row["parcelname"],
|
||||
"auction" => "false",
|
||||
"for_sale" => "true",
|
||||
"sale_price" => $row["saleprice"],
|
||||
"landing_point" => $row["landingpoint"],
|
||||
"region_UUID" => $row["regionUUID"],
|
||||
"area" => $row["area"]);
|
||||
}
|
||||
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -224,15 +226,15 @@ function dir_land_query($method_name, $params, $app_data)
|
||||
#
|
||||
|
||||
xmlrpc_server_register_method($xmlrpc_server, "dir_events_query",
|
||||
"dir_events_query");
|
||||
"dir_events_query");
|
||||
|
||||
function dir_events_query($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$text = $req['text'];
|
||||
$flags = $req['flags'];
|
||||
$query_start = $req['query_start'];
|
||||
$text = $req['text'];
|
||||
$flags = $req['flags'];
|
||||
$query_start = $req['query_start'];
|
||||
|
||||
if ($text == "%%%")
|
||||
{
|
||||
@@ -247,20 +249,20 @@ function dir_events_query($method_name, $params, $app_data)
|
||||
}
|
||||
|
||||
$pieces = explode("|", $text);
|
||||
|
||||
$day = $pieces[0];
|
||||
$category = $pieces[1];
|
||||
|
||||
$day = $pieces[0];
|
||||
$category = $pieces[1];
|
||||
|
||||
//Setting a variable for NOW
|
||||
$now = time();
|
||||
|
||||
//Setting a variable for NOW
|
||||
$now = time();
|
||||
|
||||
$terms = array();
|
||||
|
||||
if ($day == "u") $terms[] = "dateUTC > ".$now."";
|
||||
if ($day == "u") $terms[] = "dateUTC > ".$now."";
|
||||
|
||||
if ($category <> 0) $terms[] = "category = ".$category."";
|
||||
|
||||
if ($flags & 0x2000) $terms[] = "mature = 'false'";
|
||||
if ($category <> 0) $terms[] = "category = ".$category."";
|
||||
|
||||
if ($flags & 0x2000) $terms[] = "mature = 'false'";
|
||||
|
||||
$where = "";
|
||||
|
||||
@@ -270,29 +272,29 @@ function dir_events_query($method_name, $params, $app_data)
|
||||
$sql = "select * from events". $where.
|
||||
" limit " . mysql_escape_string($query_start) . ",101";
|
||||
|
||||
$result = mysql_query($sql);
|
||||
$result = mysql_query($sql);
|
||||
|
||||
$data = array();
|
||||
$data = array();
|
||||
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$date = strftime("%m/%d %I:%M %p",$row["dateUTC"]);
|
||||
|
||||
$data[] = array(
|
||||
"owner_id" => $row["owneruuid"],
|
||||
"name" => $row["name"],
|
||||
"event_id" => $row["eventid"],
|
||||
"date" => $date,
|
||||
"unix_time" => $row["dateUTC"],
|
||||
"event_flags" => $row["eventflags"]);
|
||||
}
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$date = strftime("%m/%d %I:%M %p",$row["dateUTC"]);
|
||||
|
||||
$data[] = array(
|
||||
"owner_id" => $row["owneruuid"],
|
||||
"name" => $row["name"],
|
||||
"event_id" => $row["eventid"],
|
||||
"date" => $date,
|
||||
"unix_time" => $row["dateUTC"],
|
||||
"event_flags" => $row["eventflags"]);
|
||||
}
|
||||
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -304,55 +306,55 @@ xmlrpc_server_register_method($xmlrpc_server, "dir_classified_query",
|
||||
|
||||
function dir_classified_query ($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$text = $req['text'];
|
||||
$flags = $req['flags'];
|
||||
$category = $req['category'];
|
||||
$query_start = $req['query_start'];
|
||||
$text = $req['text'];
|
||||
$flags = $req['flags'];
|
||||
$category = $req['category'];
|
||||
$query_start = $req['query_start'];
|
||||
|
||||
if ($text == "%%%")
|
||||
{
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => False,
|
||||
'errorMessage' => "Invalid search terms"
|
||||
));
|
||||
if ($text == "%%%")
|
||||
{
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => False,
|
||||
'errorMessage' => "Invalid search terms"
|
||||
));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($category <> 0) $terms[] = "category = ".$category."";
|
||||
|
||||
$where = "";
|
||||
if ($category <> 0) $terms[] = "category = ".$category."";
|
||||
|
||||
$where = "";
|
||||
|
||||
if (count($terms) > 0)
|
||||
$where = " where " . join(" and ", $terms);
|
||||
|
||||
$sql = "select * from classifieds". $where.
|
||||
" limit " . mysql_escape_string($query_start) . ",101";
|
||||
$sql = "select * from classifieds". $where.
|
||||
" limit " . mysql_escape_string($query_start) . ",101";
|
||||
|
||||
$result = mysql_query($sql);
|
||||
$result = mysql_query($sql);
|
||||
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"classifiedid" => $row["classifieduuid"],
|
||||
"name" => $row["name"],
|
||||
"classifiedflags" => $row["classifiedflags"],
|
||||
"creation_date" => $row["creationdate"],
|
||||
"expiration_date" => $row["expirationdate"],
|
||||
"priceforlisting" => $row["priceforlisting"]);
|
||||
}
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"classifiedid" => $row["classifieduuid"],
|
||||
"name" => $row["name"],
|
||||
"classifiedflags" => $row["classifiedflags"],
|
||||
"creation_date" => $row["creationdate"],
|
||||
"expiration_date" => $row["expirationdate"],
|
||||
"priceforlisting" => $row["priceforlisting"]);
|
||||
}
|
||||
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -360,58 +362,58 @@ function dir_classified_query ($method_name, $params, $app_data)
|
||||
#
|
||||
|
||||
xmlrpc_server_register_method($xmlrpc_server, "event_info_query",
|
||||
"event_info_query");
|
||||
"event_info_query");
|
||||
|
||||
function event_info_query($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$eventID = $req['eventID'];
|
||||
$eventID = $req['eventID'];
|
||||
|
||||
$sql = "select * from events where eventID = " .
|
||||
mysql_escape_string($eventID);
|
||||
$sql = "select * from events where eventID = " .
|
||||
mysql_escape_string($eventID);
|
||||
|
||||
$result = mysql_query($sql);
|
||||
$result = mysql_query($sql);
|
||||
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$date = strftime("%G-%m-%d %H:%M:%S",$row["dateUTC"]);
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$date = strftime("%G-%m-%d %H:%M:%S",$row["dateUTC"]);
|
||||
|
||||
if ($row['category'] == 18) $category = "Discussion";
|
||||
if ($row['category'] == 19) $category = "Sports";
|
||||
if ($row['category'] == 20) $category = "Live Music";
|
||||
if ($row['category'] == 22) $category = "Commercial";
|
||||
if ($row['category'] == 23) $category = "Nightlife/Entertainment";
|
||||
if ($row['category'] == 24) $category = "Games/Contests";
|
||||
if ($row['category'] == 25) $category = "Pageants";
|
||||
if ($row['category'] == 26) $category = "Education";
|
||||
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'] == 18) $category = "Discussion";
|
||||
if ($row['category'] == 19) $category = "Sports";
|
||||
if ($row['category'] == 20) $category = "Live Music";
|
||||
if ($row['category'] == 22) $category = "Commercial";
|
||||
if ($row['category'] == 23) $category = "Nightlife/Entertainment";
|
||||
if ($row['category'] == 24) $category = "Games/Contests";
|
||||
if ($row['category'] == 25) $category = "Pageants";
|
||||
if ($row['category'] == 26) $category = "Education";
|
||||
if ($row['category'] == 27) $category = "Arts and Culture";
|
||||
if ($row['category'] == 28) $category = "Charity/Support Groups";
|
||||
if ($row['category'] == 29) $category = "Miscellaneous";
|
||||
|
||||
$data[] = array(
|
||||
"event_id" => $row["eventid"],
|
||||
"creator" => $row["creatoruuid"],
|
||||
"name" => $row["name"],
|
||||
"category" => $category,
|
||||
"description" => $row["description"],
|
||||
"date" => $date,
|
||||
"dateUTC" => $row["dateUTC"],
|
||||
"duration" => $row["duration"],
|
||||
"covercharge" => $row["covercharge"],
|
||||
"coveramount" => $row["coveramount"],
|
||||
"simname" => $row["simname"],
|
||||
"globalposition" => $row["globalPos"],
|
||||
"eventflags" => $row["eventflags"]);
|
||||
}
|
||||
$data[] = array(
|
||||
"event_id" => $row["eventid"],
|
||||
"creator" => $row["creatoruuid"],
|
||||
"name" => $row["name"],
|
||||
"category" => $category,
|
||||
"description" => $row["description"],
|
||||
"date" => $date,
|
||||
"dateUTC" => $row["dateUTC"],
|
||||
"duration" => $row["duration"],
|
||||
"covercharge" => $row["covercharge"],
|
||||
"coveramount" => $row["coveramount"],
|
||||
"simname" => $row["simname"],
|
||||
"globalposition" => $row["globalPos"],
|
||||
"eventflags" => $row["eventflags"]);
|
||||
}
|
||||
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -419,48 +421,48 @@ function event_info_query($method_name, $params, $app_data)
|
||||
#
|
||||
|
||||
xmlrpc_server_register_method($xmlrpc_server, "classifieds_info_query",
|
||||
"classifieds_info_query");
|
||||
"classifieds_info_query");
|
||||
|
||||
function classifieds_info_query($method_name, $params, $app_data)
|
||||
{
|
||||
$req = $params[0];
|
||||
$req = $params[0];
|
||||
|
||||
$classifiedID = $req['classifiedID'];
|
||||
$classifiedID = $req['classifiedID'];
|
||||
|
||||
$sql = "select * from classifieds where classifieduuid = '" .
|
||||
mysql_escape_string($classifiedID). "'";
|
||||
$sql = "select * from classifieds where classifieduuid = '" .
|
||||
mysql_escape_string($classifiedID). "'";
|
||||
|
||||
$result = mysql_query($sql);
|
||||
$result = mysql_query($sql);
|
||||
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"classifieduuid" => $row["classifieduuid"],
|
||||
"creatoruuid" => $row["creatoruuid"],
|
||||
"creationdate" => $row["creationdate"],
|
||||
"expirationdate" => $row["expirationdate"],
|
||||
"category" => $row["category"],
|
||||
"name" => $row["name"],
|
||||
"description" => $row["description"],
|
||||
"parceluuid" => $row["parceluuid"],
|
||||
"parentestate" => $row["parentestate"],
|
||||
"snapshotuuid" => $row["snapshotuuid"],
|
||||
"simname" => $row["simname"],
|
||||
"posglobal" => $row["posglobal"],
|
||||
"parcelname" => $row["parcelname"],
|
||||
"classifiedflags" => $row["classifiedflags"],
|
||||
"priceforlisting" => $row["priceforlisting"]);
|
||||
}
|
||||
$data = array();
|
||||
while (($row = mysql_fetch_assoc($result)))
|
||||
{
|
||||
$data[] = array(
|
||||
"classifieduuid" => $row["classifieduuid"],
|
||||
"creatoruuid" => $row["creatoruuid"],
|
||||
"creationdate" => $row["creationdate"],
|
||||
"expirationdate" => $row["expirationdate"],
|
||||
"category" => $row["category"],
|
||||
"name" => $row["name"],
|
||||
"description" => $row["description"],
|
||||
"parceluuid" => $row["parceluuid"],
|
||||
"parentestate" => $row["parentestate"],
|
||||
"snapshotuuid" => $row["snapshotuuid"],
|
||||
"simname" => $row["simname"],
|
||||
"posglobal" => $row["posglobal"],
|
||||
"parcelname" => $row["parcelname"],
|
||||
"classifiedflags" => $row["classifiedflags"],
|
||||
"priceforlisting" => $row["priceforlisting"]);
|
||||
}
|
||||
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
$response_xml = xmlrpc_encode(array(
|
||||
'success' => True,
|
||||
'errorMessage' => "",
|
||||
'data' => $data));
|
||||
|
||||
print $response_xml;
|
||||
print $response_xml;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Process the request
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user