Revision: 1148
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1148&view=rev
Author:   cimorrison
Date:     2009-07-08 11:55:28 +0000 (Wed, 08 Jul 2009)

Log Message:
-----------
Added checking of lengths for room description in order to avoid SQL errors in 
PostgreSQL.

Modified Paths:
--------------
    mrbs/trunk/web/add.php
    mrbs/trunk/web/admin.php
    mrbs/trunk/web/config.inc.php

Modified: mrbs/trunk/web/add.php
===================================================================
--- mrbs/trunk/web/add.php      2009-07-08 10:56:26 UTC (rev 1147)
+++ mrbs/trunk/web/add.php      2009-07-08 11:55:28 UTC (rev 1148)
@@ -61,8 +61,10 @@
 
 if ($type == "room")
 {
-  // Truncate the name field to the maximum length as a precaution.
+  // Truncate the name and description fields to the maximum length as a 
precaution.
   $name = substr($name, 0, $maxlength['room.room_name']);
+  $description = substr($description, 0, $maxlength['room.description']);
+  // Add SQL escaping
   $room_name_q = addslashes($name);
   $description_q = addslashes($description);
   if (empty($capacity))

Modified: mrbs/trunk/web/admin.php
===================================================================
--- mrbs/trunk/web/admin.php    2009-07-08 10:56:26 UTC (rev 1147)
+++ mrbs/trunk/web/admin.php    2009-07-08 11:55:28 UTC (rev 1148)
@@ -177,7 +177,7 @@
         
         <div>
           <label for="room_description"><?php echo get_vocab("description") 
?>:</label>
-          <input type="text" id="room_description" name="description">
+          <input type="text" id="room_description" name="description" 
maxlength="<?php echo $maxlength['room.description'] ?>">
         </div>
         
         <div>

Modified: mrbs/trunk/web/config.inc.php
===================================================================
--- mrbs/trunk/web/config.inc.php       2009-07-08 10:56:26 UTC (rev 1147)
+++ mrbs/trunk/web/config.inc.php       2009-07-08 11:55:28 UTC (rev 1148)
@@ -43,11 +43,12 @@
 // Field lengths in the database tables
 // NOTE:  these must be kept in step with the database.   If you change the 
field
 // lengths in the database then you should change the values here, and vice 
versa.
-$maxlength['entry.name']     = 80;    // characters   (name field in entry 
table)
-$maxlength['area.area_name'] = 30;    // characters   (area_name field in area 
table)
-$maxlength['room.room_name'] = 25;    // characters   (room_name field in room 
table)
-$maxlength['users.name']     = 30;    // characters   (name field in users 
table)
-$maxlength['users.email']    = 75;    // characters   (email field in users 
table)
+$maxlength['entry.name']       = 80;  // characters   (name field in entry 
table)
+$maxlength['area.area_name']   = 30;  // characters   (area_name field in area 
table)
+$maxlength['room.room_name']   = 25;  // characters   (room_name field in room 
table)
+$maxlength['room.description'] = 60;  // characters   (room_name field in room 
table)
+$maxlength['users.name']       = 30;  // characters   (name field in users 
table)
+$maxlength['users.email']      = 75;  // characters   (email field in users 
table)
 // other values for the users table need to follow the 
$maxlength['users.fieldname'] pattern
 
 


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

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to