-if(isset($_GET['c']))
- switch($_GET['c'])
- {
- case 'g': //Generate Only
- $filename = generate_backup($conn, $_GET['comp'], $_GET['comm']);
- header("Location: backups.php?c=gs&fn=" . urlencode($filename));
- break;
-
- case 'gd': //Generate and download
- $filename = generate_backup($conn);
- header("Location: backups.php?c=ds&fn=" . urlencode($filename));
- break;
-
- case 'd': //Download the file
- download_file(BACKUP_PATH . $_GET['fn']);
- exit;
-
- case 'df': //Delete the file
- $filename = $_GET['fn'];
- @unlink(BACKUP_PATH . $filename);
- header("Location: backups.php?c=dff&fn=" . urlencode($filename));
- break;
-
- case 'dff':
- $msg = _("File successfully deleted.")." ";
- $msg .= _("Filename") . " = " . $_GET['fn'];
- display_notification($msg);
- break;
-
- case 'ds': //Write JS script to open download window
- $filename = urlencode($_GET['fn']);
- display_notification(_("Backup is being downloaded..."));
-
- add_js_source("<script language='javascript'>
- function download_file() {location.href ='backups.php?c=d&fn=$filename'};
- Behaviour.addLoadEvent(download_file);
- </script>");
- break;
-
- case 'gs': //Print backup success message
- $msg = _("Backup successfully generated."). ' ';
- $msg .= _("Filename") . " = " . $_GET['fn'];
- display_notification($msg);
- break;
-
- case 'r': //Restore backup
- $filename=$_GET['fn'];
- if( restore_backup(BACKUP_PATH . $filename, $conn) )
- header("Location: backups.php?c=rs&fn=" . urlencode($filename));
- break;
-
- case 'rs': //Print restore success message
- display_notification(_("Restore backup completed."));
- break;
-
- case 'u':
- $filename = $_FILES['uploadfile']['tmp_name'];
- if (is_uploaded_file ($filename))
- {
- if( restore_backup($filename, $conn) )
- display_notification(_("Uploaded file has been restored."));
- else
- display_error(_("Database restore failed."));
- }
- else
- {
- display_error(_("Backup was not uploaded into the system."));
- }
- }