From 975ceaa0bc10e81232128f94d514946f42bee36a Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 27 Dec 2008 02:15:03 +0000 Subject: TFTP package add file size, adjust wording, fix backup. --- packages/tftp/tftp_files.tmp | 77 +++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'packages/tftp/tftp_files.tmp') diff --git a/packages/tftp/tftp_files.tmp b/packages/tftp/tftp_files.tmp index 750a1c72..fa7a521e 100644 --- a/packages/tftp/tftp_files.tmp +++ b/packages/tftp/tftp_files.tmp @@ -31,14 +31,13 @@ require("guiconfig.inc"); require("/usr/local/pkg/tftp.inc"); -if (($_GET['a'] == "download") && file_exists("/tftpboot/".$_GET['filename'])) { - - $filename = $_GET['filename']; - if ($_GET['t'] == "backup") { - $tmp = '/tmp/'; - $filename = 'tftp.bak.tgz'; - system('cd /;tar cvzf /tmp/tftp.bak.tgz tftpboot'); - } +$filename = $_GET['filename']; +if (($_GET['a'] == "download") && $_GET['t'] == "backup") { + $tmp = '/tmp/'; + $filename = 'tftp.bak.tgz'; + system('cd /;tar cvzf /tmp/tftp.bak.tgz tftpboot'); +} +if (($_GET['a'] == "download") && file_exists("/tftpboot/".$filename)) { session_cache_limiter('public'); $fd = fopen("/tftpboot/".$filename, "rb"); @@ -77,7 +76,7 @@ if ($_GET['a'] == "other") { if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tftpboot/" . $_FILES['ulfile']['name']); - $ulmsg = "Uploaded file to /tftpboot/" . htmlentities($_FILES['ulfile']['name']); + $savemsg = "Uploaded file to /tftpboot/" . htmlentities($_FILES['ulfile']['name']); unset($_POST['txtCommand']); } @@ -127,39 +126,17 @@ if ($savemsg) { Trivial File Transport Protocol is a very simple file transfer protocol. Use the file upload to add files to the /tftpboot directory. - + Click on the file from the file list below to download it.


-\n"; -echo "\n"; -echo "\n"; -echo "Backup / Restore
\n"; -echo "The 'backup' button will tar gzip /tftpboot/ to /tmp/tftp.bak.tgz it then presents a file to download. \n"; -echo "If the backup file does not exist in /tmp/tftp.bak.tgz then the 'restore' button will be hidden. \n"; -echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n"; -echo "

\n"; -echo "\n"; -echo "\n"; -echo " \n"; -if (file_exists('/tmp/tftp.bak.tgz')) { - echo " \n"; -} -echo "\n"; -echo "\n"; -echo "\n"; -echo "

\n\n"; -?> +
- - - \n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Click on the file to download it.
File to upload: @@ -178,13 +155,35 @@ echo "

\n\n";

+ + \n"; + echo "
\n"; + echo "Backup / Restore
\n"; + echo "The 'backup' button will tar gzip /tftpboot/ to /tmp/tftp.bak.tgz it then presents a file to download. \n"; + echo "If the backup file does not exist in /tmp/tftp.bak.tgz then the 'restore' button will be hidden. \n"; + echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n"; + echo "

\n"; + echo "
\n"; + echo " \n"; + if (file_exists('/tmp/tftp.bak.tgz')) { + echo " \n"; + } + echo "
\n"; + echo "

\n\n"; + ?> - - + + +
\n\n"; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { + $tftp_filesize = filesize('/tftpboot/'.$file); + $tftp_filesize = byte_convert($tftp_filesize); + echo "\n"; echo " \n"; echo " \n"; + echo " \n"; + echo " \n"; echo "
File NameLast ModifiedFile NameLast ModifiedSize
\n"; echo " \n"; @@ -200,7 +202,10 @@ echo "

\n\n"; echo "
\n"; echo date ("F d Y H:i:s", filemtime('/tftpboot/'.$file)); - echo " \n"; + echo " ".$tftp_filesize; + echo " \n"; echo " \n"; echo " \n"; -- cgit v1.2.3