[fusionregistry-commitlog] SF.net SVN: fusionregistry: [35] branches/stable_3_0_x/upload/sources/
                
                Brought to you by:
                
                    copland007
                    
                
            
            
        
        
        
    | 
      
      
      From: SVN c. <fus...@li...> - 2008-02-10 19:18:24
      
     | 
| Revision: 35
          http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=35&view=rev
Author:   copland007
Date:     2008-02-10 11:18:29 -0800 (Sun, 10 Feb 2008)
Log Message:
-----------
Check for empty cache, prevents script error.
Modified Paths:
--------------
    branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php	2008-02-10 07:19:03 UTC (rev 34)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php	2008-02-10 19:18:29 UTC (rev 35)
@@ -184,28 +184,32 @@
         $this->ipsclass->init_load_cache( array( 'registry_makemodel' ) );
 
         // Loop through all the makes
-        foreach ( $this->ipsclass->cache['registry_makemodel'] as $make_id => $make_array )
+        if ( isset( $this->ipsclass->cache['registry_makemodel'] ) &&
+             is_array( $this->ipsclass->cache['registry_makemodel'] ) )
         {
-            // Start this makes' row in the output, this is where it gets confusing!
-            $return .= 'cars["'.$make_array['name'].'"] = new Array("'.$make_id.'", new Array(';
+            foreach ( $this->ipsclass->cache['registry_makemodel'] as $make_id => $make_array )
+            {
+                // Start this makes' row in the output, this is where it gets confusing!
+                $return .= 'cars["'.$make_array['name'].'"] = new Array("'.$make_id.'", new Array(';
 
-            $model_string = '';
-            $model_id_string = '';
+                $model_string = '';
+                $model_id_string = '';
 
-            // Loop through all the models of this make
-            foreach ( $make_array['models'] as $model_id => $model_name )
-            {
-                // Create the arrays that we will use in the output
-                $model_string    .= '"'.$model_name.'",';
-                $model_id_string .= '"'.$model_id  .'",';
-            }
+                // Loop through all the models of this make
+                foreach ( $make_array['models'] as $model_id => $model_name )
+                {
+                    // Create the arrays that we will use in the output
+                    $model_string    .= '"'.$model_name.'",';
+                    $model_id_string .= '"'.$model_id  .'",';
+                }
 
-            // Strip off the last comma
-            $model_string    = substr($model_string,    0, -1);
-            $model_id_string = substr($model_id_string, 0, -1);
+                // Strip off the last comma
+                $model_string    = substr($model_string,    0, -1);
+                $model_id_string = substr($model_id_string, 0, -1);
 
-            // Finish off this makes' row in the output
-            $return .= $model_string ."), new Array(". $model_id_string ."));\n";
+                // Finish off this makes' row in the output
+                $return .= $model_string ."), new Array(". $model_id_string ."));\n";
+            }
         }
 
         return $return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |