Revision: 1366
http://mrbs.svn.sourceforge.net/mrbs/?rev=1366&view=rev
Author: cimorrison
Date: 2010-07-01 14:06:09 +0000 (Thu, 01 Jul 2010)
Log Message:
-----------
Modified the function get_default_room() so that if $default_room is in the
area, then it returns $default_room, otherwise it returns the first room , by
sortkey order, in the area.
Modified Paths:
--------------
mrbs/trunk/web/functions.inc
Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc 2010-07-01 13:39:28 UTC (rev 1365)
+++ mrbs/trunk/web/functions.inc 2010-07-01 14:06:09 UTC (rev 1366)
@@ -382,11 +382,22 @@
}
// Return a default room given a valid area; used if no room is already known.
-// This returns the first room in sort_key order in the database.
+// If the area contains $default_room, then it returns $default_room,
+// otherwise the first room in sort_key order in the database.
// This could be changed to implement something like per-user defaults.
function get_default_room($area)
{
- global $tbl_room;
+ global $tbl_room, $default_room;
+ // Check to see whether this area contains $default_room
+ if (isset($default_room))
+ {
+ $room = sql_query1("SELECT id FROM $tbl_room WHERE id=$default_room AND
area_id=$area LIMIT 1");
+ if ($room >= 0)
+ {
+ return $room;
+ }
+ }
+ // Otherwise just return the first room (in sortkey order) in the area
$room = sql_query1("SELECT id FROM $tbl_room WHERE area_id=$area ORDER BY
sort_key LIMIT 1");
return ($room < 0 ? 0 : $room);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits