aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/tftp/tftp_files.tmp8
1 files changed, 8 insertions, 0 deletions
diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp
index 92d34e70..3141b8fa 100644
--- a/config/tftp/tftp_files.tmp
+++ b/config/tftp/tftp_files.tmp
@@ -33,9 +33,11 @@ require("/usr/local/pkg/tftp.inc");
$filename = $_GET['filename'];
if (($_GET['a'] == "download") && $_GET['t'] == "backup") {
+ conf_mount_rw();
$tmp = '/root/backup/';
$filename = 'tftp.bak.tgz';
system('cd /;tar cvzf /root/backup/tftp.bak.tgz tftpboot');
+ conf_mount_ro();
}
if (($_GET['a'] == "download") && file_exists("/root/backup/".$filename)) {
@@ -62,9 +64,11 @@ if ($_GET['a'] == "other") {
//extract a specific directory to /tftpboot
if (file_exists('/root/backup/'.$filename)) {
//echo "The file $filename exists";
+ conf_mount_rw();
system('cd /; tar xvpfz /root/backup/'.$filename);
system('chmod -R 744 /tftpboot/*');
header( 'Location: tftp_files.php?savemsg=Backup+has+been+restored.' ) ;
+ conf_mount_ro();
}
else {
header( 'Location: tftp_files.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
@@ -76,16 +80,20 @@ if ($_GET['a'] == "other") {
if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
+ conf_mount_rw();
move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tftpboot/" . $_FILES['ulfile']['name']);
$savemsg = "Uploaded file to /tftpboot/" . htmlentities($_FILES['ulfile']['name']);
system('chmod -R 744 /tftpboot/*');
unset($_POST['txtCommand']);
+ conf_mount_ro();
}
if ($_GET['act'] == "del") {
if ($_GET['type'] == 'tftp') {
+ conf_mount_rw();
unlink_if_exists("/tftpboot/".$_GET['filename']);
+ conf_mount_ro();
header("Location: tftp_files.php");
exit;
}