[Fusionforge-commits] r15394 - branches/Branch_5_2/src/www/admin

Franck VILLAUME nerville at fusionforge.org
Fri Apr 27 10:44:45 CEST 2012


Author: nerville
Date: 2012-04-27 10:44:44 +0200 (Fri, 27 Apr 2012)
New Revision: 15394

Modified:
   branches/Branch_5_2/src/www/admin/admin_table.php
Log:
fix #401: missing check

Modified: branches/Branch_5_2/src/www/admin/admin_table.php
===================================================================
--- branches/Branch_5_2/src/www/admin/admin_table.php	2012-04-27 08:05:06 UTC (rev 15393)
+++ branches/Branch_5_2/src/www/admin/admin_table.php	2012-04-27 08:44:44 UTC (rev 15394)
@@ -254,28 +254,29 @@
 	}
 
 	$field_list = getStringFromRequest('__fields__');
-	$fields = explode(",", $field_list);
-	$values = array(); $v = array ();
-	$qpa = db_construct_qpa (false, 'INSERT INTO ' . $table . ' (' . $field_list . ') VALUES (') ;
+    if (strlen($field_list)) {
+	    $fields = explode(",", $field_list);
+	    $values = array(); $v = array ();
+	    $qpa = db_construct_qpa (false, 'INSERT INTO ' . $table . ' (' . $field_list . ') VALUES (') ;
 
-	$i = 1 ;
-	foreach ($fields as $field) {
-		$v[] = '$'.$i;
-		$i++ ;
-		$values[] = getStringFromPost($field);
-	}
+	    $i = 1 ;
+	    foreach ($fields as $field) {
+		    $v[] = '$'.$i;
+		    $i++ ;
+		    $values[] = getStringFromPost($field);
+	    }
 
-	$qpa = db_construct_qpa ($qpa, implode (',', $v).')', $values) ;
+	    $qpa = db_construct_qpa ($qpa, implode (',', $v).')', $values) ;
 
-	if (db_query_qpa($qpa)) {
-        print('<p class="feedback">');
-		printf(_('%1$s successfully added.'), ucfirst(getUnitLabel($unit)));
-        print('</p>');
-	} else {
-		form_release_key(getStringFromRequest('form_key'));
-		echo db_error();
-	}
-
+	    if (db_query_qpa($qpa)) {
+            print('<p class="feedback">');
+		    printf(_('%1$s successfully added.'), ucfirst(getUnitLabel($unit)));
+            print('</p>');
+	    } else {
+		    form_release_key(getStringFromRequest('form_key'));
+		    echo db_error();
+	    }
+    }
 }
 
 /**




More information about the Fusionforge-commits mailing list