Author: mike
Date: 2011-08-04 10:45:16 -0700 (Thu, 04 Aug 2011)
New Revision: 632
Log:
Fix up validation of master_id.


Modified:
   trunk/phplib/db-str.php

Modified: trunk/phplib/db-str.php
===================================================================
--- trunk/phplib/db-str.php     2011-08-03 13:11:09 UTC (rev 631)
+++ trunk/phplib/db-str.php     2011-08-04 17:45:16 UTC (rev 632)
@@ -46,8 +46,8 @@
      ."If you discover new information, please file a new STR referencing "
      ."this one."
 );
-    
 
+
 // Subsystems...
 $STR_SUBSYSTEMS = array();
 $result = db_query("SELECT * FROM strsubsystems ORDER BY subsystem");
@@ -677,7 +677,7 @@
         $priority = 0,                 // I - Priority
         $status = 0,                   // I - Status
         $scope = 0,                    // I - Scope
-        $whose = 0,                    // I - Whose 
+        $whose = 0,                    // I - Whose
         $link_id = PROJECT_LINK_ALL)   // I - Link/application ID
   {
     global $LOGIN_EMAIL, $LOGIN_LEVEL, $LOGIN_USER;
@@ -1005,15 +1005,17 @@
 
     if ($this->master_id > 0)
     {
-      //$temp = new str($this->master_id);
-
-      //if ($temp->id != $this->master_id)
-      //{
-       //$this->master_id_valid = FALSE;
-       //$valid = FALSE;
-      //}
-      // Matt: I disabled the code above as it can lead to an infinte loop and 
hange the page
-      $this->master_id_valid = TRUE;
+      // Don't use "new str($this->master_id)" since the constructor calls
+      // validate and can cause an infinite loop. Just check that the master
+      // bug number exists...
+      $result = db_query("SELECT * FROM str WHERE id=$this->master_id");
+      if ($row = db_next($result))
+        $this->master_id_valid = TRUE;
+      else
+      {
+               $this->master_id_valid = FALSE;
+               $valid = FALSE;
+         }
     }
     else if ($this->master_id < 0)
     {

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to