diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f744573 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: https://gumroad.com/l/hGYGh diff --git a/ajaximportfile.php b/ajaximportfile.php index 7171d6c..de9a035 100644 --- a/ajaximportfile.php +++ b/ajaximportfile.php @@ -61,20 +61,20 @@ function stripCommentLines($in) { if (isset($file) && is_uploaded_file($file)) { if (isset($format) && $format == "SQL") { - $lines = file($file); + $lines = file_get_contents($file); + $lines = str_replace( array("\r\n", "\n"), "\n", $lines ); // window/linux compat + $lines = str_replace( "\"\n", "\"\"\n", $lines ); // quickndirty way to make multiline explode on next line go fine + $statements = explode("\"\n",$lines ); - // the file() function doesn't handle mac line endings correctly - if (sizeof($lines) == 1 && strpos($lines[0], "\r") > 0) { - $lines = explode("\r", $lines[0]); - } - - $commentFree = array_map("stripCommentLines", $lines); - - $contents = trim(implode('', $commentFree)); - - $statements = splitQueryText($contents); } else { - $statements = file($file); + // coderofsalvation@ Tue Dec 24 11:42:20 CET 2013 + // file() doesnt work with multiline csv columns + // actually, it should be questioned whether csv need + // to be parsed manually instead of fgetcsv in the firstplace :) + $csv = file_get_contents($file); + $csv = str_replace( array("\r\n", "\n"), "\n", $csv ); // window/linux compat + $csv = str_replace( "\"\n", "\"\"\n", $csv ); // quickndirty way to make multiline explode on next line go fine + $statements = explode("\"\n",$csv ); // see previous comment if (sizeof($statements) == 1 && strpos($statements[0], "\r") > 0) { @@ -167,4 +167,4 @@ function stripCommentLines($in) { } -?> \ No newline at end of file +?> diff --git a/ajaxsaveedit.php b/ajaxsaveedit.php index bfe0482..854fa26 100644 --- a/ajaxsaveedit.php +++ b/ajaxsaveedit.php @@ -61,7 +61,7 @@ if ($conn->getAdapter() == "mysql") { if (isset($types) && substr($value, 0, 2) == "0x" && isset($binaryDTs) && in_array($types[$keyname], $binaryDTs)) { $updates .= "`" . $keyname . "`=" . $value . ","; - } else if (!$value && $nulls[$keyname] == "YES") { + } else if (!$value && !($value != '' && (int)$value == 0) && $nulls[$keyname] == "YES") { $updates .= "`" . $keyname . "`=NULL,"; } else { $updates .= "`" . $keyname . "`='" . $value . "',"; @@ -127,4 +127,4 @@ } } -?> \ No newline at end of file +?> diff --git a/editcolumn.php b/editcolumn.php index 9154447..a9afac2 100644 --- a/editcolumn.php +++ b/editcolumn.php @@ -133,7 +133,7 @@ echo "