mirror of
https://github.com/kcozens/OpenSimSearch.git
synced 2026-08-14 08:52:28 +00:00
Fixed time limits of event searches and include in-progress events.
Event searches for a given day now take timezone into account to get to start of day. Updated README with mention of the timezone usage. Updated database structure, migration file, and the pre-compiled DLL. git-svn-id: http://forge.opensimulator.org/svn/ossearch/trunk@202 109abde3-1f22-4c10-b5d7-b6b0135cd00c
This commit is contained in:
@@ -265,7 +265,11 @@ categories are as follows:
|
||||
28- Charity/Support Groups
|
||||
29- Miscellaneous
|
||||
|
||||
The dateUTC field is a timestamp for the event in UTC time.
|
||||
The dateUTC field in the database is a timestamp for the event in UTC time.
|
||||
The ossearch module operates on the assumption that the local timezone of
|
||||
the grid or standalone is the Pacific timezone. If some other timezone is
|
||||
being used, change the parameter of the date_default_timezone_set() call
|
||||
in the query.php file.
|
||||
|
||||
The covercharge field is a boolean. Set it to 0 if there is no cover charge
|
||||
for the event. When covercharge is not 0, the amount is in the coveramount
|
||||
|
||||
Binary file not shown.
+17
-7
@@ -255,7 +255,7 @@ function dir_land_query($method_name, $params, $app_data)
|
||||
else
|
||||
$where = "";
|
||||
|
||||
$sql = "SELECT *, saleprice/area AS lsq FROM parcelsales" . $where .
|
||||
$sql = "SELECT *,saleprice/area AS lsq FROM parcelsales" . $where .
|
||||
" ORDER BY " . $order . " LIMIT " .
|
||||
mysql_real_escape_string($query_start) . ",101";
|
||||
|
||||
@@ -319,21 +319,31 @@ function dir_events_query($method_name, $params, $app_data)
|
||||
else
|
||||
$search_text = $pieces[2];
|
||||
|
||||
//Get todays date/time and adjust it to UTC
|
||||
$now = time() - date_offset_get(new DateTime);
|
||||
|
||||
$terms = array();
|
||||
|
||||
if ($day == "u")
|
||||
$terms[] = "dateUTC > ".$now;
|
||||
{
|
||||
//This condition will include upcoming and in-progress events
|
||||
$terms[] = "dateUTC+duration*60 >= " . time();
|
||||
}
|
||||
else
|
||||
{
|
||||
date_default_timezone_set('America/Los_Angeles');
|
||||
|
||||
//To search for events in a given day we need to determine the
|
||||
//start time for the day. Get current time, take out UTC offset,
|
||||
//adjust time to start of day, add back the UTC time zone offset.
|
||||
$time_info = gettimeofday();
|
||||
$now = $time_info['sec'] - $time_info['minuteswest'] * 60;
|
||||
$now -= ($now % 86400); //Adjust to start of day
|
||||
$now += $time_info['minuteswest'] * 60;
|
||||
|
||||
//Is $day a number of days before or after current date?
|
||||
if ($day != 0)
|
||||
$now += $day * 86400;
|
||||
$now -= ($now % 86400);
|
||||
|
||||
$then = $now + 86400;
|
||||
$terms[] = "(dateUTC > ".$now." AND dateUTC <= ".$then.")";
|
||||
$terms[] = "(dateUTC >= $now AND dateUTC < $then)";
|
||||
}
|
||||
|
||||
if ($category != 0)
|
||||
|
||||
@@ -51,3 +51,9 @@ ALTER TABLE `parcelsales` CHANGE `parcelUUID` `parcelUUID` char(36) NOT NULL;
|
||||
ALTER TABLE `regions` CHANGE `regionUUID` `regionUUID` char(36) NOT NULL;
|
||||
ALTER TABLE `regions` CHANGE `ownerUUID` `ownerUUID` char(36) NOT NULL;
|
||||
COMMIT;
|
||||
|
||||
#SVN revision 202
|
||||
BEGIN;
|
||||
ALTER TABLE `events` CHANGE `eventid` `eventid` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `events` CHANGE `duration` `duration` INT ( 10 ) NOT NULL;
|
||||
COMMIT;
|
||||
|
||||
@@ -63,18 +63,18 @@ CREATE TABLE `classifieds` (
|
||||
CREATE TABLE `events` (
|
||||
`owneruuid` char(36) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`eventid` int(11) NOT NULL auto_increment,
|
||||
`eventid` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`creatoruuid` char(36) NOT NULL,
|
||||
`category` int(2) NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`dateUTC` int(10) NOT NULL,
|
||||
`duration` int(3) NOT NULL,
|
||||
`duration` int(10) NOT NULL,
|
||||
`covercharge` tinyint(1) NOT NULL,
|
||||
`coveramount` int(10) NOT NULL,
|
||||
`simname` varchar(255) NOT NULL,
|
||||
`globalPos` varchar(255) NOT NULL,
|
||||
`eventflags` int(1) NOT NULL,
|
||||
PRIMARY KEY (`eventid`)
|
||||
PRIMARY KEY (`eventid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8_unicode_ci AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user