X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fbackups.php;h=cf2ef1cf3e4a4a1b5a48a86372d165a2ff9711fa;hb=bc426821d8ae6319bd9394ac275bb700e6394fc3;hp=4fcc453fe44516c0313b5ccf7abb469537bed312;hpb=6183e9450dcd7e4c747889c10903f6ff1b0add33;p=fa-stable.git
diff --git a/admin/backups.php b/admin/backups.php
index 4fcc453f..cf2ef1cf 100644
--- a/admin/backups.php
+++ b/admin/backups.php
@@ -9,7 +9,7 @@ include_once($path_to_root . "/admin/db/maintenance_db.inc");
$valid_paths = valid_paths();
//$valid_paths = '';
-if ($valid_paths != "")
+if ($valid_paths != "")
{
page(_("Backup and Restore Database - Error"));
display_error (_("Backup paths have not been set correctly.") ." " . _("Please contact System Administrator.") . "
" .$valid_paths);
@@ -45,7 +45,7 @@ echo "
if (ext != 'sql') {
alert('" . _('This extension can not be be viewed: ') . "' + ext)
return
- }
+ }
window.open('" . BACKUP_PATH . "'+pFilename, '', 'toolbar=no,scrollbars=yes')
}
function deleteBackup() {
@@ -71,31 +71,31 @@ echo "
$msg |
- " . _("Backup scripts") . " |
+ " . _("Backup scripts") . " |
- $cmb |
+ $cmb |
|
- " . _("Comments") . " (" . _("Create Backup") . ") |
+ " . _("Comments") . " (" . _("Create Backup") . ") |
- |
+ |
";
@@ -106,47 +106,47 @@ end_form();
end_page();
-function handle_form($conn)
+function handle_form($conn)
{
global $path_to_root;
//Generate Only
if (isset($_GET['c']))
{
- if ($_GET['c']=='g')
+ if ($_GET['c']=='g')
{
$filename = generate_backup($conn, $_GET['comp'], $_GET['comm']);
header("Location: backups.php?c=gs&fn=" . urlencode($filename));
return "";
}
//Generate and download
- if ($_GET['c']=='gd')
+ if ($_GET['c']=='gd')
{
$filename = generate_backup($conn);
header("Location: backups.php?c=ds&fn=" . urlencode($filename));
return "";
}
//Download the file
- if ($_GET['c']=='d')
+ if ($_GET['c']=='d')
{
download_file(BACKUP_PATH . $_GET['fn']);
exit;
}
//Delete the file
- if ($_GET['c']=='df')
+ if ($_GET['c']=='df')
{
$filename = $_GET['fn'];
@unlink(BACKUP_PATH . $filename);
header("Location: backups.php?c=dff&fn=" . urlencode($filename));
return "";
}
- if ($_GET['c']=='dff')
+ if ($_GET['c']=='dff')
{
$msg = _("File successfully deleted.")." ";
$msg .= _("Filename") . " = " . $_GET['fn'];
return $msg;
}
//Write JS script to open download window
- if ($_GET['c']=='ds')
+ if ($_GET['c']=='ds')
{
$filename = urlencode($_GET['fn']);
$msg = _("Backup is being downloaded...");
@@ -156,14 +156,14 @@ function handle_form($conn)
return $msg;
}
//Print backup success message
- if ($_GET['c']=='gs')
+ if ($_GET['c']=='gs')
{
$msg = _("Backup successfully generated.")." ";
$msg .= _("Filename") . " = " . $_GET['fn'];
return $msg;
}
//Restore backup
- if ($_GET['c']=='r')
+ if ($_GET['c']=='r')
{
$filename=$_GET['fn'];
restore_backup(BACKUP_PATH . $filename, $conn);
@@ -171,48 +171,48 @@ function handle_form($conn)
return "";
}
//Print restore success message
- if ($_GET['c']=='rs')
+ if ($_GET['c']=='rs')
{
$msg = _("Restore backup completed.")." ";
return $msg;
}
- if ($_GET['c']=='u')
+ if ($_GET['c']=='u')
{
$filename = $_FILES['uploadfile']['tmp_name'];
- if (is_uploaded_file ($filename))
+ if (is_uploaded_file ($filename))
{
restore_backup($filename, $conn);
$msg = _("Uploaded file has been restored.");
- }
- else
+ }
+ else
{
$msg = _("Backup was not uploaded into the system.");
}
return $msg;
}
- }
+ }
return "";
}
-function generate_backup($conn, $ext='no', $comm='')
+function generate_backup($conn, $ext='no', $comm='')
{
if ($conn['tbpref'] != "")
$filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
- else
+ else
$filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
-
- $filename = db_export($conn, $filename, $ext, $comm);
-
+
+ $filename = db_export($conn, $filename, $ext, $comm);
+
return $filename;
}
-function restore_backup($filename, $conn)
+function restore_backup($filename, $conn)
{
return db_import($filename, $conn);
-}
+}
-function get_backup_file_combo()
+function get_backup_file_combo()
{
global $path_to_root;
$ar_files = array();
@@ -225,31 +225,31 @@ function get_backup_file_combo()
rsort($ar_files);
$opt_files = "";
foreach ($ar_files as $file)
- if (strpos($file, ".sql") || strpos($file, ".sql"))
+ if (strpos($file, ".sql") || strpos($file, ".sql"))
$opt_files .= "";
- return "";
+ return "";
}
-function get_compr_combo()
+function get_compr_combo()
{
$ar_comps = array();
-
+
$ar_comps[] = _("No");
- if (function_exists("gzcompress"))
+ if (function_exists("gzcompress"))
$ar_comps[] = "zip";
- if (function_exists("gzopen"))
+ if (function_exists("gzopen"))
$ar_comps[] = "gzip";
$opt_comps = "";
foreach ($ar_comps as $file)
$opt_comps .= "";
return "";
-}
-
-function download_file($filename)
+}
+
+function download_file($filename)
{
- if (empty($filename) || !file_exists($filename))
+ if (empty($filename) || !file_exists($filename))
{
return FALSE;
}
@@ -261,12 +261,12 @@ function download_file($filename)
return true;
}
-function valid_paths()
+function valid_paths()
{
global $path_to_root;
-
+
$st = "";
- if (!file_exists(BACKUP_PATH))
+ if (!file_exists(BACKUP_PATH))
$st .= " - " . _("cannot find backup directory") . " - " . BACKUP_PATH . "
";
return $st;
}