1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Parsing improvement

This commit is contained in:
e107steved
2008-03-23 11:17:09 +00:00
parent d11cb307b3
commit 0be9e2bb37

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $
| $Revision: 1.1 $ | $Revision: 1.2 $
| $Date: 2007-12-08 15:11:50 $ | $Date: 2008-03-23 11:17:09 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -94,11 +94,13 @@ class db_table_admin
function parse_field_defs($text) function parse_field_defs($text)
{ {
$ans = array(); $ans = array();
$field_lines = explode(',',$text); $text = str_replace("\r","\n",$text);
$field_lines = explode("\n",$text);
foreach ($field_lines as $fv) foreach ($field_lines as $fv)
{ {
unset($defs); unset($defs);
$fv = trim(str_replace(' ',' ',$fv)); $fv = trim(str_replace(' ',' ',$fv));
if (substr($fv,-1) == ',') $fv = trim(substr($fv,0,-1));
// echo "Line: ".$fv."<br />"; // echo "Line: ".$fv."<br />";
if ($fv) if ($fv)
{ {
@@ -178,8 +180,8 @@ class db_table_admin
$i++; $i++;
} }
} }
if (count($defs) > 1) $ans[] = $defs; else echo "Partial definition<br />";
} }
if (count($defs) > 1) $ans[] = $defs; else echo "Partial definition<br />";
} }
if (!count($ans)) return FALSE; if (!count($ans)) return FALSE;
return $ans; return $ans;