From 0be9e2bb3739b67949e545f552d2da96b0bec25e Mon Sep 17 00:00:00 2001 From: e107steved Date: Sun, 23 Mar 2008 11:17:09 +0000 Subject: [PATCH] Parsing improvement --- e107_handlers/db_table_admin_class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e107_handlers/db_table_admin_class.php b/e107_handlers/db_table_admin_class.php index 218646f96..a12698e1b 100644 --- a/e107_handlers/db_table_admin_class.php +++ b/e107_handlers/db_table_admin_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $ -| $Revision: 1.1 $ -| $Date: 2007-12-08 15:11:50 $ +| $Revision: 1.2 $ +| $Date: 2008-03-23 11:17:09 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -94,11 +94,13 @@ class db_table_admin function parse_field_defs($text) { $ans = array(); - $field_lines = explode(',',$text); + $text = str_replace("\r","\n",$text); + $field_lines = explode("\n",$text); foreach ($field_lines as $fv) { unset($defs); $fv = trim(str_replace(' ',' ',$fv)); + if (substr($fv,-1) == ',') $fv = trim(substr($fv,0,-1)); // echo "Line: ".$fv."
"; if ($fv) { @@ -178,8 +180,8 @@ class db_table_admin $i++; } } + if (count($defs) > 1) $ans[] = $defs; else echo "Partial definition
"; } - if (count($defs) > 1) $ans[] = $defs; else echo "Partial definition
"; } if (!count($ans)) return FALSE; return $ans;