Revision: 1069
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1069&view=rev
Author:   cimorrison
Date:     2009-03-25 08:47:35 +0000 (Wed, 25 Mar 2009)

Log Message:
-----------
Changed some parts to use the existing function mrbsGetRoomArea instead of 
constructing their own SQL queries.

Modified Paths:
--------------
    mrbs/trunk/web/edit_area_room.php
    mrbs/trunk/web/edit_entry.php
    mrbs/trunk/web/index.php

Modified: mrbs/trunk/web/edit_area_room.php
===================================================================
--- mrbs/trunk/web/edit_area_room.php   2009-03-24 09:25:28 UTC (rev 1068)
+++ mrbs/trunk/web/edit_area_room.php   2009-03-25 08:47:35 UTC (rev 1069)
@@ -6,6 +6,7 @@
 require_once "functions.inc";
 require_once "dbsys.inc";
 require_once "mrbs_auth.inc";
+require_once "mrbs_sql.inc";
 
 // Get form variables
 $day = get_form_var('day', 'int');
@@ -83,7 +84,7 @@
 {
   if (!empty($room)) // Get the area the room is in
   {
-    $area = sql_query1("SELECT area_id from $tbl_room where id=$room");
+    $area = mrbsGetRoomArea($room);
   }
   Header("Location: admin.php?day=$day&month=$month&year=$year&area=$area");
   exit();

Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php       2009-03-24 09:25:28 UTC (rev 1068)
+++ mrbs/trunk/web/edit_entry.php       2009-03-25 08:47:35 UTC (rev 1069)
@@ -6,6 +6,7 @@
 require_once "functions.inc";
 require_once "dbsys.inc";
 require_once "mrbs_auth.inc";
+require_once "mrbs_sql.inc";
 
 global $twentyfourhour_format;
 
@@ -560,10 +561,7 @@
 
     <?php
     // Determine the area id of the room in question first
-    $sql = "select area_id from $tbl_room where id=$room_id";
-    $res = sql_query($sql);
-    $row = sql_row_keyed($res, 0);
-    $area_id = $row['area_id'];
+    $area_id = mrbsGetRoomArea($room_id);
     // determine if there is more than one area
     $sql = "select id from $tbl_area";
     $res = sql_query($sql);

Modified: mrbs/trunk/web/index.php
===================================================================
--- mrbs/trunk/web/index.php    2009-03-24 09:25:28 UTC (rev 1068)
+++ mrbs/trunk/web/index.php    2009-03-25 08:47:35 UTC (rev 1069)
@@ -10,6 +10,7 @@
 require_once "grab_globals.inc.php";
 require_once "config.inc.php";
 require_once "dbsys.inc";
+require_once "mrbs_sql.inc";
 
 $day   = date("d");
 $month = date("m");
@@ -29,18 +30,9 @@
 
 if ( ! empty($default_room) )
 {
-  $sql = "select area_id from $tbl_room where id=$default_room";
-  $res = sql_query($sql);
-  if( $res )
-  {
-    if( sql_count($res) == 1 )
-    {
-      $row = sql_row_keyed($res, 0);
-      $area = $row['area_id'];
-      $room = $default_room;
-      $redirect_str .= "&area=$area&room=$room";
-    }
-  }
+  $area = mrbsGetRoomArea($default_room);
+  $room = $default_room;
+  $redirect_str .= "&area=$area&room=$room";
 }
 
 header("Location: $redirect_str");


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to