aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/tftp/tftp.inc85
-rw-r--r--packages/tftp/tftp.xml2
-rw-r--r--packages/tftp/tftp_files.tmp12
3 files changed, 90 insertions, 9 deletions
diff --git a/packages/tftp/tftp.inc b/packages/tftp/tftp.inc
index 32c11f8b..b731a9ac 100644
--- a/packages/tftp/tftp.inc
+++ b/packages/tftp/tftp.inc
@@ -131,7 +131,90 @@ function php_install_command()
unset($contents);
fclose($handle);
unset($filename);
-
+
+
+ // add a TFTP DHCP Option to the DHCP Server
+ $filename = "/usr/local/www/services_dhcp.php";
+ $fout = fopen($filename,"r");
+ $tmp = fread($fout, filesize($filename));
+ fclose($fout);
+
+ //tftp was not found in the string
+ if (strpos($tmp, "tftp") === false) {
+ $tmpsearch = "\$pconfig['netmask'] = \$config['dhcpd'][\$if]['netmask'];";
+ $tmpreplace = "\$pconfig['netmask'] = \$config['dhcpd'][\$if]['netmask'];\n";
+ $tmpreplace .= "\$pconfig['tftp'] = \$config['dhcpd'][\$if]['options']['tftp-server-name'];";
+ $tmp = str_replace($tmpsearch, $tmpreplace, $tmp);
+ unset($tmpsearch, $tmpreplace);
+
+ $tmpsearch = "\$config['dhcpd'][\$if]['filename'] = \$_POST['filename'];";
+ $tmpreplace = "\$config['dhcpd'][\$if]['filename'] = \$_POST['filename'];\n";
+ $tmpreplace .= " \$config['dhcpd'][\$if]['options']['tftp-server-name'] = \$_POST['tftp'];";
+ $tmp = str_replace($tmpsearch, $tmpreplace, $tmp);
+ unset($tmpsearch, $tmpreplace);
+
+ $tmpsearch = "function show_netboot_config() {";
+ $tmpreplace = "function show_tftp_config() {\n";
+ $tmpreplace .= " document.getElementById(\"showtftpbox\").innerHTML=''\n";
+ $tmpreplace .= " aodiv = document.getElementById('showtftp');\n";
+ $tmpreplace .= " aodiv.style.display = \"block\";\n";
+ $tmpreplace .= "}\n";
+ $tmpreplace .= "\n";
+ $tmpreplace .= "function show_netboot_config() {";
+ $tmp = str_replace($tmpsearch, $tmpreplace, $tmp);
+ unset($tmpsearch, $tmpreplace);
+
+ $tmpsearch = "<td width=\"22%\" valign=\"top\" class=\"vncell\">Enable Network booting</td>";
+ $tmpreplace .= "";
+ //$tmpreplace = " <tr>\n";
+ $tmpreplace .= "<td width=\"22%\" valign=\"top\" class=\"vncell\">TFTP server</td>\n";
+ $tmpreplace .= " <td width=\"78%\" class=\"vtable\">\n";
+ $tmpreplace .= " <div id=\"showtftpbox\">\n";
+ $tmpreplace .= " <input type=\"button\" onClick=\"show_tftp_config()\" value=\"Advanced\"></input> - Show TFTP configuration</a>\n";
+ $tmpreplace .= " </div>\n";
+ $tmpreplace .= " <div id=\"showtftp\" style=\"display:none\">\n";
+ $tmpreplace .= " <input name=\"tftp\" type=\"text\" class=\"formfld\" id=\"tftp\" size=\"20\" value=\"<"."?=htmlspecialchars(\$pconfig['tftp']);?".">\"><br>\n";
+ $tmpreplace .= " </div>\n";
+ $tmpreplace .= " </td>\n";
+ $tmpreplace .= " </tr>\n";
+ $tmpreplace .= "\n";
+ $tmpreplace .= " <tr>\n";
+ $tmpreplace .= " <td width=\"22%\" valign=\"top\" class=\"vncell\">Enable Network booting</td>";
+ $tmpreplace .= "\n";
+ $tmp = str_replace($tmpsearch, $tmpreplace, $tmp);
+ unset($tmpsearch, $tmpreplace);
+
+ $fout = fopen($filename,"w");
+ fwrite($fout, $tmp);
+ unset($tmp);
+ fclose($fout);
+ }
+ unset($tmp, $filename);
+
+
+
+ $filename = "/etc/inc/services.inc";
+ $fout = fopen($filename,"r");
+ $tmp = fread($fout, filesize($filename));
+ fclose($fout);
+
+ //tftp was not found in the string
+ if (strpos($tmp, "tftp") === false) {
+ $tmpsearch = "if (is_array(\$dhcpifconf['ntpserver']) && \$dhcpifconf['ntpserver'][0])";
+ $tmpreplace = "if (isset(\$dhcpifconf['options']['tftp-server-name'])) {\n";
+ $tmpreplace .= " \$dhcpdconf .= \" option tftp-server-name \\\"\".\$dhcpifconf['options']['tftp-server-name'].\"\\\";\".\"\\n\";\n";
+ $tmpreplace .= " }\n";
+ $tmpreplace .= " \n";
+ $tmpreplace .= " if (is_array(\$dhcpifconf['ntpserver']) && \$dhcpifconf['ntpserver'][0])";
+ $tmp = str_replace($tmpsearch, $tmpreplace, $tmp);
+ unset($tmpsearch, $tmpreplace);
+
+ $fout = fopen($filename,"w");
+ fwrite($fout, $tmp);
+ fclose($fout);
+ }
+ unset($tmp, $filename);
+
// if backup file exists restore it
$filename = 'tftp.bak.tgz';
diff --git a/packages/tftp/tftp.xml b/packages/tftp/tftp.xml
index dadfd37a..cf2bb680 100644
--- a/packages/tftp/tftp.xml
+++ b/packages/tftp/tftp.xml
@@ -41,7 +41,7 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>tftp Settings</name>
- <version>0.8.5</version>
+ <version>1.0</version>
<title>TFTP: Settings</title>
<include_file>/usr/local/pkg/tftp.inc</include_file>
<menu>
diff --git a/packages/tftp/tftp_files.tmp b/packages/tftp/tftp_files.tmp
index 1d4b6d21..f49ea76e 100644
--- a/packages/tftp/tftp_files.tmp
+++ b/packages/tftp/tftp_files.tmp
@@ -179,11 +179,10 @@ if ($savemsg) {
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>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="25%" class="listhdrr">File Name (download)</td>
<td width="50%" class="listhdr">Last Modified</td>
<td width="50%" class="listhdr">Size</td>
</tr>
@@ -211,7 +210,7 @@ if ($savemsg) {
echo " <td valign=\"middle\" nowrap class=\"list\">\n";
echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"tftp_files_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
+ echo " <td valign=\"middle\"><form method='POST' action='/edit.php' target='_blank'><input type='hidden' name='savetopath' value='/tftpboot/".$file."'><input type='hidden' name='submit' value='Load'><input type='image' src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></form></td>\n";
echo " <td><a href=\"tftp_files.php?type=tftp&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
echo " </tr>\n";
echo " </table>\n";
@@ -229,8 +228,7 @@ if ($savemsg) {
<td class="list"></td>
</tr>
</table>
-
-</form>
+
<br>
<br>