aboutsummaryrefslogtreecommitdiffstats
path: root/packages/tftp/tftp_files.tmp
diff options
context:
space:
mode:
authorMark Crane <mcrane@pfsense.org>2008-12-27 02:15:03 +0000
committerMark Crane <mcrane@pfsense.org>2008-12-27 02:15:03 +0000
commit975ceaa0bc10e81232128f94d514946f42bee36a (patch)
tree55bfa71fd16c211ed5d033d374f598394ce0bb6c /packages/tftp/tftp_files.tmp
parent9ba11c79e570b185bb598ed4d46823fb7ac5cfa5 (diff)
downloadpfsense-packages-975ceaa0bc10e81232128f94d514946f42bee36a.tar.gz
pfsense-packages-975ceaa0bc10e81232128f94d514946f42bee36a.tar.bz2
pfsense-packages-975ceaa0bc10e81232128f94d514946f42bee36a.zip
TFTP package add file size, adjust wording, fix backup.
Diffstat (limited to 'packages/tftp/tftp_files.tmp')
-rw-r--r--packages/tftp/tftp_files.tmp77
1 files changed, 41 insertions, 36 deletions
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) {
</strong></span>
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.
</span></p></td>
</tr>
</table>
<br />
-<?php
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='80%'>\n";
-echo "<b>Backup / Restore</b><br />\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 "<br /><br />\n";
-echo "</td>\n";
-echo "<td width='20%' valign='middle' align='right'>\n";
-echo " <input type='button' value='backup' onclick=\"document.location.href='/tftp/tftp_files.php?a=download&t=backup';\" />\n";
-if (file_exists('/tmp/tftp.bak.tgz')) {
- echo " <input type='button' value='restore' onclick=\"document.location.href='/tftp/tftp_files.php?a=other&t=restore';\" />\n";
-}
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-?>
+
<div id="niftyOutter">
<form action="tftp_files.php" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
<table>
- <tr>
- <td colspan="2" valign="top" class="">Click on the file to download it.</td>
- </tr>
<tr>
<td align="right">File to upload:</td>
<td valign="top" class="label">
@@ -178,13 +155,35 @@ echo "<br /><br />\n\n";
<br />
<br />
+
+ <?php
+ echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
+ echo "<tr>\n";
+ echo "<td width='80%'>\n";
+ echo "<b>Backup / Restore</b><br />\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 "<br /><br />\n";
+ echo "</td>\n";
+ echo "<td width='20%' valign='middle' align='right'>\n";
+ echo " <input type='button' value='backup' onclick=\"document.location.href='/tftp/tftp_files.php?a=download&t=backup';\" />\n";
+ if (file_exists('/tmp/tftp.bak.tgz')) {
+ echo " <input type='button' value='restore' onclick=\"document.location.href='/tftp/tftp_files.php?a=other&t=restore';\" />\n";
+ }
+ echo "</td>\n";
+ echo "</tr>\n";
+ echo "</table>\n";
+ echo "<br /><br />\n\n";
+ ?>
<form action="tftp_files.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
- <td width="25%" class="listhdrr">File Name</td>
- <td width="50%" class="listhdr">Last Modified</td>
+ <td width="25%" class="listhdrr">File Name</td>
+ <td width="50%" class="listhdr">Last Modified</td>
+ <td width="50%" class="listhdr">Size</td>
</tr>
<?php
@@ -192,6 +191,9 @@ echo "<br /><br />\n\n";
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
+ $tftp_filesize = filesize('/tftpboot/'.$file);
+ $tftp_filesize = byte_convert($tftp_filesize);
+
echo "<tr>\n";
echo " <td class=\"listlr\" ondblclick=\"\">\n";
echo " <a href=\"tftp_files.php?a=download&filename=".$file."\">\n";
@@ -200,7 +202,10 @@ echo "<br /><br />\n\n";
echo " </td>\n";
echo " <td class=\"listlr\" ondblclick=\"\">\n";
echo date ("F d Y H:i:s", filemtime('/tftpboot/'.$file));
- echo " </td>\n";
+ echo " </td>\n";
+ echo " <td class=\"listlr\" ondblclick=\"\">\n";
+ echo " ".$tftp_filesize;
+ echo " </td>\n";
echo " <td valign=\"middle\" nowrap class=\"list\">\n";
echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
echo " <tr>\n";