X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fdb%2Fmaintenance_db.inc;h=c4a8b9ef66cfc77eec14117124aac5a00992922b;hb=fbb4134bff475538b3477ef6b9ce1768799707c1;hp=7520e359979d20759f852b120f471bdcd4ace52b;hpb=c9beff6c3e07034db5e7d7c70887a90889160012;p=fa-stable.git diff --git a/admin/db/maintenance_db.inc b/admin/db/maintenance_db.inc index 7520e359..c4a8b9ef 100644 --- a/admin/db/maintenance_db.inc +++ b/admin/db/maintenance_db.inc @@ -96,7 +96,7 @@ function db_drop_db($connection) // get table structures foreach ($all_tables as $table) { - if (strpos($table['Name'], $connection["tbpref"]) !== false) + if (strpos($table['Name'], $connection["tbpref"]) === 0) db_query("DROP TABLE `".$table['Name'] . "`"); } //deleting the tables, how?? @@ -136,6 +136,12 @@ function db_import($filename, $connection) { $data_queries[] = substr($line, 0, strlen($line) - 1); + // this line does not, too + } + elseif (strtolower(substr($line,0,6)) == "update") + { + $data_queries[] = substr($line, 0, strlen($line) - 1); + // this line does not, too } elseif (strtolower(substr($line, 0, 20)) == "drop table if exists") @@ -307,7 +313,7 @@ function db_export($conn, $filename, $zip='no', $comment='') $out.="# Backup Date and Time: ".date("Y-m-d H:i")."\n"; $out.="# Built by " . $app_title . " " . $version ."\n"; $out.="# ".$power_url."\n"; - $out.="# Company: ".$company."\n"; + $out.="# Company: ". @html_entity_decode($company, ENT_COMPAT, $_SESSION['language']->encoding)."\n"; $out.="# User: ".$_SESSION["wa_current_user"]->name."\n\n"; // write users comment @@ -405,11 +411,7 @@ function db_export($conn, $filename, $zip='no', $comment='') // run through each field for ($k = 0; $k < $nf = db_num_fields($res2); $k++) { - // identify null values and save them as null instead of '' - if ($field_type[$k] != "" && $field_type[$k] != "NO" && $row2[$k] == "") - $out .= "NULL"; - else - $out .= "'" . db_escape($row2[$k]) . "'"; + $out .= db_escape(@html_entity_decode($row2[$k], ENT_COMPAT, $_SESSION['language']->encoding)); if ($k < ($nf - 1)) $out .= ", "; } @@ -429,7 +431,7 @@ function db_export($conn, $filename, $zip='no', $comment='') } elseif ($error) { - @unlink($path_to_root . BACKUP_PATH . $backupfile); + @unlink(BACKUP_PATH . $backupfile); return false; } @@ -447,7 +449,7 @@ function db_export($conn, $filename, $zip='no', $comment='') } else { - @unlink($path_to_root . BACKUP_PATH . $backupfile); + @unlink(BACKUP_PATH . $backupfile); return false; } @@ -462,7 +464,7 @@ function db_export($conn, $filename, $zip='no', $comment='') } else { - @unlink($path_to_root . BACKUP_PATH . $backupfile); + @unlink(BACKUP_PATH . $backupfile); return false; } return $backupfile; @@ -525,7 +527,7 @@ function save_to_file($backupfile, $zip, $fileData) if ($zip == "gzip") { - if ($zp = @gzopen($path_to_root . BACKUP_PATH . $backupfile, "a9")) + if ($zp = @gzopen(BACKUP_PATH . $backupfile, "a9")) { @gzwrite($zp, $fileData); @gzclose($zp); @@ -601,7 +603,7 @@ function save_to_file($backupfile, $zip, $fileData) // total # of entries "on this disk", total # of entries overall, size of central dir, offset to start of central dir, .zip file comment length $fileData .= pack('v', 1) . pack('v', 1) . pack('V', strlen($cdrec)) . pack('V', strlen($fr)) . "\x00\x00"; - if ($zp = @fopen($path_to_root . BACKUP_PATH . $backupfile, "a")) + if ($zp = @fopen(BACKUP_PATH . $backupfile, "a")) { @fwrite($zp, $fileData); @fclose($zp); @@ -616,7 +618,7 @@ function save_to_file($backupfile, $zip, $fileData) } else { - if ($zp = @fopen($path_to_root . BACKUP_PATH . $backupfile, "a")) + if ($zp = @fopen(BACKUP_PATH . $backupfile, "a")) { @fwrite($zp, $fileData); @fclose($zp);