aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-08-15 23:58:09 -0500
committerChris Buechler <cmb@pfsense.org>2015-08-15 23:58:09 -0500
commit0d8788110a27ab87ef4e6a4c0cc6ea148ff8b3ca (patch)
tree366be1ad6f20823ab4bc7b2b663e30d411eea20b /config
parent368de2c92306ad2e19890c0d30d15cc968022232 (diff)
parentcad6ed23f5dfb5145beaf4f224121c731fb1097c (diff)
downloadpfsense-packages-0d8788110a27ab87ef4e6a4c0cc6ea148ff8b3ca.tar.gz
pfsense-packages-0d8788110a27ab87ef4e6a4c0cc6ea148ff8b3ca.tar.bz2
pfsense-packages-0d8788110a27ab87ef4e6a4c0cc6ea148ff8b3ca.zip
Merge pull request #995 from doktornotor/patch-9
Diffstat (limited to 'config')
-rw-r--r--config/filemgr/file_manager.php497
-rw-r--r--config/filemgr/file_manager.tmp595
-rw-r--r--config/filemgr/filemgr.inc152
-rw-r--r--config/filemgr/filemgr.xml191
-rw-r--r--config/filemgr/index.php44
-rw-r--r--config/filemgr/index.tmp11
-rw-r--r--config/filemgr/rbfminc/config.php123
-rw-r--r--config/filemgr/rbfminc/config.tmp95
-rw-r--r--config/filemgr/rbfminc/download.php69
-rw-r--r--config/filemgr/rbfminc/download.tmp49
-rw-r--r--config/filemgr/rbfminc/functions.php221
-rw-r--r--config/filemgr/rbfminc/functions.tmp189
-rw-r--r--config/filemgr/rbfminc/rename.php68
-rw-r--r--config/filemgr/rbfminc/rename.tmp41
-rw-r--r--config/filemgr/rbfminc/session.php58
-rw-r--r--config/filemgr/rbfminc/session.tmp32
16 files changed, 1149 insertions, 1286 deletions
diff --git a/config/filemgr/file_manager.php b/config/filemgr/file_manager.php
new file mode 100644
index 00000000..5e858591
--- /dev/null
+++ b/config/filemgr/file_manager.php
@@ -0,0 +1,497 @@
+<?php
+/*
+ file_manager.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+include("rbfminc/config.php");
+//include("rbfminc/session.php");
+require_once('config.inc');
+require("guiconfig.inc");
+
+$closehead = false;
+include("head.inc");
+
+global $config;
+if ('ok' == 'ok') {
+ set_time_limit(1800); //30 min
+ include("rbfminc/functions.php");
+
+ clearstatcache();
+ $_GET['p'] = urldecode($_GET['p']);
+
+ if ($_COOKIE['current_folder']) {
+ $initial_folder_cookie = $_COOKIE['current_folder'];
+ }
+
+ if ($_GET['url_field']) {
+ setcookie('url_field', $_GET['url_field']);
+ $url_field = $_GET['url_field'];
+ } else {
+ $url_field = $_COOKIE['url_field'];
+ }
+
+ if ($_GET['p']) {
+ if (substr($_GET['p'], -1) != "/") {
+ $_GET['p'] = $_GET['p']."/";
+ }
+ $current_folder = $_GET['p'];
+ } elseif (($initial_folder_cookie) && (file_exists($initial_folder_cookie))) {
+ if (substr($initial_folder_cookie, -1) != "/") {
+ $initial_folder_cookie = $initial_folder_cookie."/";
+ }
+ $current_folder = $initial_folder_cookie;
+ } elseif (($initial_folder) && (file_exists($initial_folder))) {
+ if (substr($initial_folder, -1) != "/") {
+ $initial_folder = $initial_folder."/";
+ }
+ $current_folder = $initial_folder;
+ } else {
+ $current_folder = $_SERVER['DOCUMENT_ROOT']."/";
+ }
+
+ if (($only_below) && (strlen($current_folder) < strlen($initial_folder))) {
+ setcookie('current_folder', '', time()-3600);
+ header("Location: file_manager.php");
+ exit();
+ }
+
+ //setcookie('current_folder', $current_folder);
+
+ if (substr($current_folder, 0, strlen($_SERVER['DOCUMENT_ROOT'])) == $_SERVER['DOCUMENT_ROOT']) {
+ $url_path = "http://" . $_SERVER['HTTP_HOST'] . "/" . substr($current_folder, strlen($_SERVER['DOCUMENT_ROOT']));
+ }
+
+ if (($_POST['save_file'] == 'save_file') && ($_GET['f'])) {
+ if ($handle = fopen($current_folder.$_GET['f'] , 'w')) {
+ if (fwrite($handle, stripslashes($_POST['file_content'])) === FALSE) {
+ $alert_info .= "Cannot write to file ({$current_folder}{$_GET['f']})";
+ } else {
+ $alert_info .= "File ({$current_folder}{$_GET['f']}) successfully saved";
+ $redirect = "file_manager.php?p=".urlencode($current_folder);
+ }
+ } else {
+ $alert_info .= "Invalid file!!!";
+ }
+ }
+
+
+ if ($_POST['upload_file'] == 'upload_file') {
+ if ($_FILES['file']['error'] == 8) {
+ $alert_info .= "File upload stopped by extension!!!";
+ }
+ if ($_FILES['file']['error'] == 7) {
+ $alert_info .= "Failed to write file to disk!!!";
+ }
+ if ($_FILES['file']['error'] == 6) {
+ $alert_info .= "Missing a temporary folder!!!";
+ }
+ if ($_FILES['file']['error'] == 4) {
+ $alert_info .= "No image was uploaded!!!";
+ }
+ if ($_FILES['file']['error'] == 3) {
+ $alert_info .= "The uploaded file was only partially uploaded!!!";
+ }
+ if ($_FILES['file']['error'] == 2) {
+ $alert_info .= "The uploaded file exceeds the MAX_FILE_SIZE!!!";
+ }
+ if ($_FILES['file']['error'] == 1) {
+ $alert_info .= "The uploaded file exceeds the upload_max_filesize!!!";
+ }
+
+
+ if (!$alert_info) {
+ if ((file_exists($current_folder.$_FILES['file']['name'])) && (!$_POST['replace_file'])) {
+ $alert_info .= "A file with the same name already exist in this folder\\nTo replace this file check \"Replace existing file\" in upload form!";
+ $redirect = "file_manager.php?p=".urlencode($current_folder);
+ } else {
+ if (!@move_uploaded_file($_FILES["file"]["tmp_name"], $current_folder.$_FILES['file']['name'])) {
+ $alert_info .= "Failed to upload file!!!";
+ } else {
+ $alert_info .= "File successfully uploaded!";
+ $redirect = "file_manager.php?p=".urlencode($current_folder);
+ }
+ }
+ }
+ }
+
+ if (($_GET['do'] == 'delete') && ($_GET['file']) && ($_GET['type'] == 'file')) {
+ if (file_exists($current_folder.$_GET['file'])) {
+ if (!@unlink($current_folder.$_GET['file'])) {
+ $alert_info = "You cannot delete this file\\nThe relevant permissions must permit this.";
+ } else {
+ $alert_info = "File deleted";
+ $redirect = "file_manager.php?p=".urlencode($current_folder);
+ }
+ } else {
+ $alert_info = "You cannot delete this file\\nInvalid file";
+ }
+ }
+
+ if (($_GET['do'] == 'delete') && ($_GET['file']) && ($_GET['type'] == 'directory')) {
+ if (file_exists($current_folder.$_GET['file'])) {
+ if (!RecursiveFolderDelete($current_folder.$_GET['file'])) {
+ $alert_info = "You cannot delete this directory\\nThe relevant permissions must permit this.";
+ } else {
+ $alert_info = "Folder deleted";
+ $redirect = "file_manager.php?p=".urlencode($current_folder);
+ }
+ } else {
+ $alert_info = "You cannot delete this directory\\nInvalid directory";
+ }
+ }
+
+ if ($_POST['create_folder'] == "Create folder") {
+ if (@mkdir($current_folder.$_POST['folder_name'])) {
+ $alert_info = "Folder created successfully!";
+ } else {
+ $alert_info = "Invalid folder name!";
+ }
+ }
+
+
+ preg_match_all("/\//", $current_folder, $m);
+ if (count($m[0]) > 1) {
+ $up_one_level = " ondblclick=\"document.location='{$_SERVER['PHP_SELF']}?p=".urlencode(substr($current_folder, 0, strrpos(substr($current_folder, 0, -1), "/"))."/")."'\"";
+ }
+
+
+ if ($handle = @opendir($current_folder)) {
+ while (false !== ($folder_content = readdir($handle))) {
+ if ((is_dir($current_folder . '/' . $folder_content)) && ($folder_content != '.' && $folder_content != '..')) {
+ $folders[] = $folder_content;
+ } elseif ((!is_dir($current_folder . '/' . $folder_content)) && ($folder != '.') && ($folder_content != '..')) {
+ $files[] = $folder_content;
+ }
+ }
+ closedir($handle);
+ } else {
+ $error = "<h1 style=\"color:red\" align=\"center\">Invalid directory</h1>";
+ }
+
+ $container .= <<<EOF
+<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"list\" width=\"100%\" summary=\"file manager\">
+ <tr>
+ <th style=\"padding:0;width:18px\">&nbsp;</th>
+ <th>Name</th>
+ <th colspan=\"5\">&nbsp;</th>
+ <th>Ext.</th>
+ <th>Size</th>
+ <th>Date</th>
+ <th>Attributes</th>
+ </tr>
+ <tr>
+ <td style=\"padding:0;width:18px\" title=\"UP one level\"><img width=\"16\" height=\"16\" src=\"rbfmimg/folder.png\" alt=\"F\" {$up_one_level} /></td>
+ <td colspan=\"11\"><b title=\"UP one level\"{$up_one_level}>[..]</b></td>
+ </tr>
+EOF;
+
+ $id = 1;
+
+ if (is_array($folders)) {
+ array_multisort($folders, SORT_ASC, SORT_REGULAR);
+ foreach ($folders as $v) {
+ if ($v) {
+ $vf = $v.'/';
+ $last_updated_time = date("Y.m.d H:i:s", filemtime($current_folder.$v));
+ $fileperms = GetFilePerms($current_folder.$v);
+
+ if ($url_path) {
+ $browser = "<a href=\"{$url_path}{$v}\" target=\"_blank\"><img src=\"rbfmimg/ico_open_as_web.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"W\" title=\"Open as web page\" /></a>";
+ if ($url_field) {
+ $use_url = "<img src=\"rbfmimg/ico_use_file.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL ({$url_path}{$v})\" onclick=\"window.opener.document.getElementById('{$url_field}').value='{$url_path}{$v}'; window.close()\" style=\"cursor: pointer\" />";
+ } else {
+ $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
+ }
+ } else {
+ $browser = "&nbsp;";
+ $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
+ }
+
+
+ $container .= <<<EOF
+ <tr>
+ <td style=\"padding:0;width:18px\">
+ <img width=\"16\" height=\"16\" src=\"rbfmimg/folder.png\" alt=\"Folder\" ondblclick=\"document.location='{$_SERVER['PHP_SELF']}?p=".urlencode($current_folder.$vf)."'\" />
+ </td>
+ <td>
+ <div style=\"padding-top:2px;\" id=\"f{$id}\" ondblclick=\"document.location='{$_SERVER['PHP_SELF']}?p=".urlencode($current_folder.$vf)."'\">
+ {$v}
+ </div>
+
+ <form class=\"rename_field\" id=\"r{$id}\" name=\"r{$id}\" method=\"post\" action=\"rbfminc/rename.php\" target=\"results\" onsubmit=\"this.n.blur(); return false\">
+ <input class=\"input_name rename_input\" name=\"n\" type=\"text\" value=\"{$v}\" id=\"rf{$id}\" onblur=\"document.form{$id}.submit(); document.getElementById('f{$id}').style.display = 'block'; document.getElementById('r{$id}').style.display = 'none'; document.getElementById('f{$id}').innerHTML = this.value; document.form{$id}.o.value = this.value;\" />
+ <input name=\"cf\" type=\"hidden\" value=\"{$current_folder}\" />
+ <input name=\"o\" type=\"hidden\" value=\"{$v}\" />
+ <input name=\"t\" type=\"hidden\" value=\"d\" />
+ <input name=\"submitS\" type=\"submit\" value=\"submitS\" style='display: none; width:0;height:0' />
+ </form>
+ </td>
+ <!--<td>{$use_url}</td>-->
+ <td>{$browser}</td>
+ <td>&nbsp;</td>
+ <td>
+ <img width=\"16\" height=\"16\" src=\"rbfmimg/ico_rename.png\" alt=\"Rename\" title=\"Rename\" onclick=\" document.getElementById('r{$id}').style.display = 'block'; document.getElementById('f{$id}').style.display = 'none'; document.getElementById('rf{$id}').focus(); document.getElementById('rf{$id}').select()\" />
+ </td>
+ <td>&nbsp;</td>
+ <td>
+ <img width=\"16\" height=\"16\" src=\"rbfmimg/ico_delete.png\" alt=\"D\" title=\"Delete\" onclick=\"if(confirm('Delete folder &quot;{$v}&quot;?') &amp;&amp; confirm('You cannot undo this operation!!!') &amp;&amp; confirm('To delete this folder &quot;{$v}&quot; press OK\\nTo cancel this operation press CANCEL')){document.location = 'file_manager.php?p=".urlencode($current_folder)."&amp;do=delete&amp;file=".urlencode($v)."&amp;type=directory'}\" />
+ </td>
+ <td class=\"srow\">&nbsp;</td>
+ <td><b>&lt;DIR&gt;</b></td>
+ <td class=\"srow\">{$last_updated_time}</td>
+ <td class=\"fileperms\">{$fileperms}</td>
+ </tr>
+EOF;
+
+ $id++;
+ }
+ }
+ }
+
+ if (is_array($files)) {
+ array_multisort($files, SORT_ASC, SORT_REGULAR);
+ foreach ($files as $v) {
+ if ($v) {
+ $extension = substr(strrchr($v, "."), 1);
+
+ $file_image = "ico_file.png";
+ if (($extension == 'php') || ($extension == 'php3')) {
+ $file_image = "ico_php.png";
+ }
+ if (($extension == 'htm') || ($extension == 'HTM') || ($extension == 'html') || ($extension == 'HTML')) {
+ $file_image = "ico_html.png";
+ }
+ if (($extension == 'jpg') || ($extension == 'JPG') || ($extension == 'jpeg') || ($extension == 'JPEG') ||
+ ($extension == 'gif') || ($extension == 'GIF') || ($extension == 'png') || ($extension == 'PNG')) {
+ $file_image = "ico_picture.png";
+ }
+
+ $last_updated_time = date("Y.m.d H:i:s", filemtime($current_folder.$v));
+ $file_size = roundsize(filesize($current_folder.$v));
+
+ if (($extension == 'txt') || ($extension == 'inc') || ($extension == 'sh') || ($extension == 'js') || ($extension == 'xml') ||
+ ($extension == 'conf') || ($extension == 'config') || ($extension == 'ini') || ($extension == 'php') || ($extension == 'php3') ||
+ ($extension == 'htm') || ($extension == 'HTM') || ($extension == 'html') || ($extension == 'HTML') || ($extension == 'css') || ($extension == 'CSS')) {
+ $edit_file_content = "<a href=\"file_manager.php?p=".urlencode($current_folder)."&amp;f=".urlencode($v)."&amp;do=edit#file_edit\"><img width=\"16\" height=\"16\" src=\"rbfmimg/ico_script_edit.png\" alt=\"Edit\" title=\"View/Edit\" border=\"0\" /></a>";
+ } else {
+ $edit_file_content = "&nbsp;";
+ }
+
+ $fileperms = GetFilePerms($current_folder.$v);
+
+ if ($url_path) {
+ $browser = "<a href=\"{$url_path}{$v}\" target=\"_blank\"><img src=\"rbfmimg/ico_open_as_web.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"W\" title=\"Open as web page\" /></a>";
+ if ($url_field) {
+ $use_url = "<img src=\"rbfmimg/ico_use_file.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL ({$url_path}{$v})\" onclick=\"window.opener.document.getElementById('{$url_field}').value='{$url_path}{$v}'; window.close()\" style=\"cursor: pointer\" />";
+ } else {
+ $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
+ }
+ } else {
+ $browser = "&nbsp;";
+ $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
+ }
+
+ $container .= <<<EOF
+ <tr>
+ <td style=\"padding:0;width:18px\">
+ <img width=\"16\" height=\"16\" src=\"rbfmimg/{$file_image}\" alt=\"File\" ondblclick=\"document.location = 'rbfminc/download.php?p=".urlencode($current_folder)."&amp;file_name=".urlencode($v)."'\" />
+ </td>
+ <td>
+ <div style=\"padding-top:2px;\" id=\"f{$id}\" ondblclick=\"document.location = 'rbfminc/download.php?p=".urlencode($current_folder)."&amp;file_name=".urlencode($v)."'\">
+ {$v}
+ </div>
+
+ <form class=\"rename_field\" id=\"r{$id}\" name=\"r{$id}\" method=\"post\" action=\"rbfminc/rename.php\" target=\"results\" onsubmit=\"this.n.blur(); return false\">
+ <input name=\"cf\" type=\"hidden\" value=\"{$current_folder}\" />
+ <input name=\"o\" type=\"hidden\" value=\"{$v}\" />
+ <input name=\"t\" type=\"hidden\" value=\"f\" />
+ <input class=\"input_name\" name=\"n\" type=\"text\" value=\"{$v}\" id=\"rf{$id}\" onblur=\"document.form{$id}.submit(); document.getElementById('f{$id}').style.display = 'block'; document.getElementById('r{$id}').style.display = 'none'; document.getElementById('f{$id}').innerHTML = this.value; document.form{$id}.o.value = this.value;\" />
+ <input name=\"submitS\" type=\"submit\" value=\"submitS\" style=\"display: none; width:0;height:0\" />
+ </form>
+ </td>
+ <!--<td>{$use_url}</td>-->
+ <td>{$browser}</td>
+ <td>
+ <a href=\"rbfminc/download.php?p=".urlencode($current_folder)."&amp;file_name=".urlencode($v)."\"><img width=\"16\" height=\"16\" src=\"rbfmimg/ico_download.png\" alt=\"Download\" title=\"Download\" border=\"0\"/></a>
+ </td>
+ <td>
+ <img width=\"16\" height=\"16\" src=\"rbfmimg/ico_rename.png\" alt=\"Rename\" title=\"Rename\" onclick=\"document.getElementById('f{$id}').style.display = 'none'; document.getElementById('r{$id}').style.display = 'block'; document.getElementById('rf{$id}').focus(); document.getElementById('rf{$id}').select()\" />
+ </td>
+ <td>{$edit_file_content}</td>
+ <td>
+ <img width=\"16\" height=\"16\" src=\"rbfmimg/ico_delete.png\" alt=\"D\" title=\"Delete\" onclick=\"if(confirm('Delete file &quot;{$v}&quot;?') &amp;&amp; confirm('You cannot undo this operation!!!') &amp;&amp; confirm('To delete this file &quot;{$v}&quot; press OK\\nTo cancel this operation press CANCEL')){document.location = 'file_manager.php?p=".urlencode($current_folder)."&amp;do=delete&amp;file=".urlencode($v)."&amp;type=file'}\" />
+ </td>
+ <td class=\"srow\">{$extension}</td>
+ <td>{$file_size}</td>
+ <td class=\"srow\">{$last_updated_time}</td>
+ <td class=\"fileperms\">{$fileperms}</td>
+ </tr>
+EOF;
+
+ $id++;
+ }
+ }
+ }
+
+ $container .= "</table>";
+
+ $container = preg_replace("/\s+/m", " ", $container);
+
+?>
+
+<link href="rbfminc/file_editor_style.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+
+<?php include("fbegin.inc"); ?>
+
+<?php echo $security_issues; ?>
+<div class="file_editor">
+ <div class="header"></div>
+ <form id="path" name="path" method="get" action="" class="path">
+ <input name="p" type="text" id="location" value="<?php echo $current_folder; ?>" />
+ <input name="go" type="image" id="go" value="Go" src="rbfmimg/go.png" style="width:35; height:18" />
+ </form>
+ <div class="url_path"><br />URL path: <a href="/<?php echo $url_path; ?>" target="_blank"><?php echo $url_path; ?></a></div>
+ <div class="container"> <?php echo $container; ?> <?php echo $error; ?> </div>
+ <form action="" method="post" enctype="multipart/form-data" name="form_upload" id="form_upload" class="form_upload">
+ Upload a file in current folder:
+ <input type="file" name="file" id="file" />
+ &nbsp;&nbsp;
+ <input name="replace_file" type="checkbox" value="1" />
+ Replace existing file &nbsp;&nbsp;
+ <input type="submit" name="upload" id="upload" value="Upload" />
+ <input name="upload_file" type="hidden" id="upload_file" value="upload_file" />
+ </form>
+ <form action="" method="post" enctype="multipart/form-data" name="form_create" id="form_create" class="form_create">
+ &nbsp;&nbsp;&nbsp;&nbsp;Create new folder here;&nbsp;Folder name:
+ <input name="folder_name" type="text" style="width:290" />
+ <input type="submit" name="create_folder" id="create_folder" value="Create folder" />
+ </form>
+ <iframe name="results" frameborder="0" scrolling="auto" class='results'></iframe>
+ <div align="center" style="margin-top:5px"> [ <img src="rbfmimg/ico_open_as_web.png" width="16" height="16" align="middle" alt="open" /> OPEN IN BROWSER ] &nbsp; &nbsp;
+ [ <img src="rbfmimg/ico_download.png" width="16" height="16" align="middle" alt="download" /> DOWNLOAD ] &nbsp; &nbsp;
+ [ <img src="rbfmimg/ico_rename.png" width="16" height="16" align="middle" alt="rename" /> RENAME ] &nbsp; &nbsp;
+ [ <img src="rbfmimg/ico_script_edit.png" width="16" height="16" align="middle" alt="view" /> VIEW/EDIT ] &nbsp; &nbsp;
+ [ <img src="rbfmimg/ico_delete.png" width="16" height="16" align="middle" alt="delete" /> DELETE ] </div>
+ <?php
+ if ($_GET['do'] == 'edit') {
+
+ $file_content = file_get_contents($current_folder.$_GET['f']);
+ echo <<<EOD
+<form id=\"form_edit\" name=\"form_edit\" method=\"post\" action=\"\" style='width: 670px;margin: 10px auto 0;border-top: 1px #999999 solid'>
+ <a name=\"file_edit\"></a>
+ File: <b>{$current_folder}{$_GET['f']}</b><br />
+ <textarea name=\"file_content\" id=\"file_content\" cols=\"1\" rows=\"1\" style=\"width: 99%; height: 400px\">".htmlentities ($file_content)."</textarea><br />
+ <input name=\"save\" type=\"submit\" value=\"Save\" />
+ <input name=\"close\" type=\"button\" value=\"Close file editor\" onclick=\"document.location = 'file_manager.php?f=".urlencode($current_folder)."'\" />
+ <input name=\"save_file\" type=\"hidden\" value=\"save_file\" />
+</form>
+EOD;
+
+ }
+
+?>
+ <div class="footer"></div>
+</div>
+<small>Created by <a href="http://www.tomschaefer.org/pfsense">TomSchaefer</a></small>
+<?php
+if ($alert_info) {
+ echo <<<EOD
+ <script type=\"text/javascript\">
+ //<![CDATA[
+ alert('{$alert_info}');
+ //]]>
+ </script>
+EOD;
+}
+
+if ($redirect) {
+ echo <<<EOD
+ <script type=\"text/javascript\">
+ //<![CDATA[
+ document.location = '{$redirect}';
+ //]]>
+ </script>
+EOD;
+}
+?>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
+<?php
+} else {
+?>
+
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Login</title>
+ <style type="text/css">
+ /*<![CDATA[*/
+ body,td,th,input {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ }
+ body {
+ background-color: #EEEEEE;
+ }
+ /*]]>*/
+ </style>
+ </head>
+ <body>
+ <div class="login"><br /><br /><br /><br />
+ <div style="color:red" align="center"><?php echo $error_message; ?></div>
+ <form id="login_form" name="login_form" method="post" action="">
+ <table border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#FFFFFF" style="border:1px solid #999999; padding:10px" summary="login">
+ <tr>
+ <td align="right">Username:</td>
+ <td><input type="text" name="username" id="username" class="login_input" style="width:230px" /></td>
+ </tr>
+ <tr>
+ <td align="right">Password:</td>
+ <td><input type="password" name="password" id="password" class="login_input" style="width:100px" />
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right"><input type="submit" name="button" id="button" value="Login &raquo;" /></td>
+ </tr>
+ </table>
+ <input name="login" type="hidden" value="login" />
+ </form>
+ </div>
+ </body>
+ </html>
+
+<?php
+}
+?>
diff --git a/config/filemgr/file_manager.tmp b/config/filemgr/file_manager.tmp
deleted file mode 100644
index 8c5ee1c5..00000000
--- a/config/filemgr/file_manager.tmp
+++ /dev/null
@@ -1,595 +0,0 @@
-<?php
-include "rbfminc/config.php";
-//include "rbfminc/session.php";
-require_once('config.inc');
-require("guiconfig.inc");
-
-$closehead = false;
-include("head.inc");
-
-global $config;
-if('ok' == 'ok'){
- set_time_limit(1800); //30 min
- include "rbfminc/functions.php";
-
- clearstatcache ();
- $_GET['p'] = urldecode($_GET['p']);
-
- if($_COOKIE['current_folder']){
- $initial_folder_cookie = $_COOKIE['current_folder'];
- }
-
- if($_GET['url_field']){
- setcookie('url_field', $_GET['url_field']);
- $url_field = $_GET['url_field'];
- }else{
- $url_field = $_COOKIE['url_field'];
- }
-
- if($_GET['p']){
- if(substr($_GET['p'], -1) != "/"){$_GET['p'] = $_GET['p']."/";}
- $current_folder = $_GET['p'];
- }elseif($initial_folder_cookie and file_exists($initial_folder_cookie)){
- if(substr($initial_folder_cookie, -1) != "/"){$initial_folder_cookie = $initial_folder_cookie."/";}
- $current_folder = $initial_folder_cookie;
- }elseif($initial_folder and file_exists($initial_folder)){
- if(substr($initial_folder, -1) != "/"){$initial_folder = $initial_folder."/";}
- $current_folder = $initial_folder;
- }else{
- $current_folder = $_SERVER['DOCUMENT_ROOT']."/";
- }
-
-
- if($only_below and strlen($current_folder) < strlen($initial_folder)){
- setcookie('current_folder', '', time()-3600);
- header("Location: file_manager.php");
- exit();
- }
-
-
- //setcookie('current_folder', $current_folder);
-
- if(substr($current_folder, 0, strlen($_SERVER['DOCUMENT_ROOT'])) == $_SERVER['DOCUMENT_ROOT']){
- $url_path = "http://".$_SERVER['HTTP_HOST']."/".substr($current_folder, strlen($_SERVER['DOCUMENT_ROOT']));
- }
-
-
- if($_POST['save_file'] == 'save_file' and $_GET['f']){
- if($handle = fopen($current_folder.$_GET['f'] , 'w')){
- if (fwrite($handle, stripslashes($_POST['file_content'])) === FALSE) {
- $alert_info .= "Cannot write to file ({$current_folder}{$_GET['f']})";
- }else{
- $alert_info .= "File ({$current_folder}{$_GET['f']}) successfully saved";
- $redirect = "file_manager.php?p=".urlencode($current_folder);
- }
- }else{
- $alert_info .= "Invalid file!!!";
- }
- }
-
-
- if($_POST['upload_file'] == 'upload_file'){
- if($_FILES['file']['error'] == 8){
- $alert_info .= "File upload stopped by extension!!!";
- }
- if($_FILES['file']['error'] == 7){
- $alert_info .= "Failed to write file to disk!!!";
- }
- if($_FILES['file']['error'] == 6){
- $alert_info .= "Missing a temporary folder!!!";
- }
- if($_FILES['file']['error'] == 4){
- $alert_info .= "No image was uploaded!!!";
- }
- if($_FILES['file']['error'] == 3){
- $alert_info .= "The uploaded file was only partially uploaded!!!";
- }
- if($_FILES['file']['error'] == 2){
- $alert_info .= "The uploaded file exceeds the MAX_FILE_SIZE!!!";
- }
- if($_FILES['file']['error'] == 1){
- $alert_info .= "The uploaded file exceeds the upload_max_filesize!!!";
- }
-
-
- if(!$alert_info){
- if(file_exists($current_folder.$_FILES['file']['name']) and !$_POST['replace_file']){
- $alert_info .= "A file with the same name already exist in this folder\\nTo replace this file check \"Replace existing file\" in upload form!";
- $redirect = "file_manager.php?p=".urlencode($current_folder);
- }else{
- if(!@move_uploaded_file($_FILES["file"]["tmp_name"], $current_folder.$_FILES['file']['name'])){
- $alert_info .= "Failed to upload file!!!";
- }else{
- $alert_info .= "File successfully uploaded!";
- $redirect = "file_manager.php?p=".urlencode($current_folder);
- }
- }
- }
- }
-
- if($_GET['do'] == 'delete' and $_GET['file'] and $_GET['type'] == 'file'){
- if(file_exists($current_folder.$_GET['file'])){
- if(!@unlink($current_folder.$_GET['file'])){
- $alert_info = "You cannot delete this file\\nThe relevant permissions must permit this.";
- }else{
- $alert_info = "File deleted";
- $redirect = "file_manager.php?p=".urlencode($current_folder);
- }
- }else{
- $alert_info = "You cannot delete this file\\nInvalid file";
- }
- }
-
- if($_GET['do'] == 'delete' and $_GET['file'] and $_GET['type'] == 'directory'){
- if(file_exists($current_folder.$_GET['file'])){
- if(!RecursiveFolderDelete($current_folder.$_GET['file'])){
- $alert_info = "You cannot delete this directory\\nThe relevant permissions must permit this.";
- }else{
- $alert_info = "Folder deleted";
- $redirect = "file_manager.php?p=".urlencode($current_folder);
- }
- }else{
- $alert_info = "You cannot delete this directory\\nInvalid directory";
- }
- }
-
- if($_POST['create_folder'] == "Create folder"){
- if(@mkdir($current_folder.$_POST['folder_name'])){
- $alert_info = "Folder created successfully!";
- }else{
- $alert_info = "Invalid folder bane!";
- }
- }
-
-
- preg_match_all("/\//", $current_folder, $m);
- if(count($m[0]) > 1){
- $up_one_level = " ondblclick=\"document.location='{$_SERVER['PHP_SELF']}?p=".urlencode(substr($current_folder, 0, strrpos(substr($current_folder, 0, -1), "/"))."/")."'\"";
- }
-
-
- if ($handle = @opendir($current_folder)) {
- while (false !== ($folder_content = readdir($handle))) {
- if(is_dir($current_folder.'/'.$folder_content) and $folder_content!='.' and $folder_content!='..'){
- $folders[] = $folder_content;
- }elseif(!is_dir($current_folder.'/'.$folder_content) and $folder!='.' and $folder_content!='..'){
- $files[] = $folder_content;
- }
- }
- closedir($handle);
- }else{
- $error = "<h1 style=\"color:red\" align=\"center\">Invalid directory</h1>";
- }
-
- $container .= "
-<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"list\" width=\"100%\" summary=\"file manager\">
- <tr>
- <th style=\"padding:0;width:18px\">&nbsp;</th>
- <th>Name</th>
- <th colspan=\"5\">&nbsp;</th>
- <th>Ext.</th>
- <th>Size</th>
- <th>Date</th>
- <th>Attributes</th>
- </tr>
- <tr>
- <td style=\"padding:0;width:18px\" title=\"UP one level\"><img width=\"16\" height=\"16\" src=\"rbfmimg/folder.png\" alt=\"F\" {$up_one_level} /></td>
- <td colspan=\"11\"><b title=\"UP one level\"{$up_one_level}>[..]</b></td>
- </tr>
-";
-
- $id = 1;
-
- if(is_array($folders)){
- array_multisort($folders, SORT_ASC, SORT_REGULAR);
- foreach($folders as $v){
- if($v){
-
- $vf = $v.'/';
-
- $last_updated_time = date("Y.m.d H:i:s", filemtime($current_folder.$v));
-
- $fileperms = GetFilePerms($current_folder.$v);
-
- if($url_path){
- $browser = "<a href=\"{$url_path}{$v}\" target=\"_blank\"><img src=\"rbfmimg/ico_open_as_web.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"W\" title=\"Open as web page\" /></a>";
- if($url_field){
- $use_url = "<img src=\"rbfmimg/ico_use_file.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL ({$url_path}{$v})\" onclick=\"window.opener.document.getElementById('{$url_field}').value='{$url_path}{$v}'; window.close()\" style=\"cursor: pointer\" />";
- }else{
- $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
- }
- }else{
- $browser = "&nbsp;";
- $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
- }
-
-
- $container .= "
- <tr>
- <td style=\"padding:0;width:18px\">
- <img width=\"16\" height=\"16\"
- src=\"rbfmimg/folder.png\"
- alt=\"Folder\"
- ondblclick=\"document.location='{$_SERVER['PHP_SELF']}?p=".urlencode($current_folder.$vf)."'\"
- />
- </td>
- <td>
-
- <div style=\"padding-top:2px;\"
- id=\"f{$id}\"
- ondblclick=\"document.location='{$_SERVER['PHP_SELF']}?p=".urlencode($current_folder.$vf)."'\"
- >
- {$v}
- </div>
-
- <form
- class=\"rename_field\"
- id=\"r{$id}\"
- name=\"r{$id}\"
- method=\"post\"
- action=\"rbfminc/rename.php\"
- target=\"results\"
- onsubmit=\"
- this.n.blur();
- return false
- \"
- >
-
- <input
- class=\"input_name rename_input\"
- name=\"n\"
- type=\"text\"
- value=\"{$v}\"
- id=\"rf{$id}\"
- onblur=\"
- document.form{$id}.submit();
- document.getElementById('f{$id}').style.display = 'block';
- document.getElementById('r{$id}').style.display = 'none';
- document.getElementById('f{$id}').innerHTML = this.value;
- document.form{$id}.o.value = this.value;
- \"
- />
-
- <input name=\"cf\" type=\"hidden\" value=\"{$current_folder}\" />
- <input name=\"o\" type=\"hidden\" value=\"{$v}\" />
- <input name=\"t\" type=\"hidden\" value=\"d\" />
- <input name=\"submitS\" type=\"submit\" value=\"submitS\" style='display: none; width:0;height:0' />
- </form>
- </td>
- <!--<td>{$use_url}</td>-->
- <td>{$browser}</td>
- <td>&nbsp;</td>
- <td>
- <img width=\"16\" height=\"16\"
- src=\"rbfmimg/ico_rename.png\"
- alt=\"Rename\" title=\"Rename\"
- onclick=\"
- document.getElementById('r{$id}').style.display = 'block';
- document.getElementById('f{$id}').style.display = 'none';
- document.getElementById('rf{$id}').focus();
- document.getElementById('rf{$id}').select()
- \"
- />
- </td>
- <td>&nbsp;</td>
- <td>
- <img width=\"16\" height=\"16\"
- src=\"rbfmimg/ico_delete.png\"
- alt=\"D\"
- title=\"Delete\"
- onclick=\"
- if(
- confirm('Delete folder &quot;{$v}&quot;?') &amp;&amp;
- confirm('You cannot undo this operation!!!') &amp;&amp;
- confirm('To delete this folder &quot;{$v}&quot; press OK\\nTo cancel this operation press CANCEL')
- ){
- document.location = 'file_manager.php?p=".urlencode($current_folder)."&amp;do=delete&amp;file=".urlencode($v)."&amp;type=directory'
- }
- \"
- />
- </td>
- <td class=\"srow\">&nbsp;</td>
- <td><b>&lt;DIR&gt;</b></td>
- <td class=\"srow\">{$last_updated_time}</td>
- <td class=\"fileperms\">{$fileperms}</td>
- </tr>
- ";
- $id++;
- }
- }
- }
- if(is_array($files)){
- array_multisort($files, SORT_ASC, SORT_REGULAR);
- foreach($files as $v){
- if($v){
-
- $extension = substr(strrchr($v, "."), 1);
-
- $file_image = "ico_file.png";
- if($extension == 'php' or $extension == 'php3'){$file_image = "ico_php.png";}
- if(
- $extension == 'htm' or
- $extension == 'HTM' or
- $extension == 'html' or
- $extension == 'HTML'
- ){$file_image = "ico_html.png";}
- if(
- $extension == 'jpg' or
- $extension == 'JPG' or
- $extension == 'jpeg' or
- $extension == 'JPEG' or
- $extension == 'gif' or
- $extension == 'GIF' or
- $extension == 'png' or
- $extension == 'PNG'
- ){$file_image = "ico_picture.png";}
-
- $last_updated_time = date("Y.m.d H:i:s", filemtime($current_folder.$v));
-
- $file_size = roundsize(filesize($current_folder.$v));
-
- if(
- $extension == 'txt' or
- $extension == 'inc' or
- $extension == 'sh' or
- $extension == 'js' or
- $extension == 'xml' or
- $extension == 'conf' or
- $extension == 'config' or
- $extension == 'ini' or
- $extension == 'php' or
- $extension == 'php3' or
- $extension == 'htm' or
- $extension == 'HTM' or
- $extension == 'html' or
- $extension == 'HTML' or
- $extension == 'css' or
- $extension == 'CSS'
- ){
- $edit_file_content = "<a href=\"file_manager.php?p=".urlencode($current_folder)."&amp;f=".urlencode($v)."&amp;do=edit#file_edit\"><img width=\"16\" height=\"16\" src=\"rbfmimg/ico_script_edit.png\" alt=\"Edit\" title=\"View/Edit\" border=\"0\" /></a>";
- }else{
- $edit_file_content = "&nbsp;";
- }
-
- $fileperms = GetFilePerms($current_folder.$v);
-
- if($url_path){
- $browser = "<a href=\"{$url_path}{$v}\" target=\"_blank\"><img src=\"rbfmimg/ico_open_as_web.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"W\" title=\"Open as web page\" /></a>";
- if($url_field){
- $use_url = "<img src=\"rbfmimg/ico_use_file.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL ({$url_path}{$v})\" onclick=\"window.opener.document.getElementById('{$url_field}').value='{$url_path}{$v}'; window.close()\" style=\"cursor: pointer\" />";
- }else{
- $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
- }
- }else{
- $browser = "&nbsp;";
- $use_url = "<img src=\"rbfmimg/ico_use_file_inactive.png\" border=\"0\" width=\"16\" height=\"16\" alt=\"U\" title=\"Use URL (Inactive!!!)\" />";
- }
-
-
- $container .= "
- <tr>
- <td style=\"padding:0;width:18px\">
- <img width=\"16\" height=\"16\" src=\"rbfmimg/{$file_image}\" alt=\"File\" ondblclick=\"document.location = 'rbfminc/download.php?p=".urlencode($current_folder)."&amp;file_name=".urlencode($v)."'\" />
- </td>
- <td>
- <div style=\"padding-top:2px;\"
- id=\"f{$id}\"
- ondblclick=\"document.location = 'rbfminc/download.php?p=".urlencode($current_folder)."&amp;file_name=".urlencode($v)."'\"
- >
- {$v}
- </div>
-
- <form
- class=\"rename_field\"
- id=\"r{$id}\"
- name=\"r{$id}\"
- method=\"post\"
- action=\"rbfminc/rename.php\"
- target=\"results\"
- onsubmit=\"this.n.blur(); return false\"
- >
- <input name=\"cf\" type=\"hidden\" value=\"{$current_folder}\" />
- <input name=\"o\" type=\"hidden\" value=\"{$v}\" />
- <input name=\"t\" type=\"hidden\" value=\"f\" />
- <input
- class=\"input_name\"
- name=\"n\"
- type=\"text\"
- value=\"{$v}\"
- id=\"rf{$id}\"
- onblur=\"
- document.form{$id}.submit();
- document.getElementById('f{$id}').style.display = 'block';
- document.getElementById('r{$id}').style.display = 'none';
- document.getElementById('f{$id}').innerHTML = this.value;
- document.form{$id}.o.value = this.value;
- \"
- />
- <input name=\"submitS\" type=\"submit\" value=\"submitS\" style=\"display: none; width:0;height:0\" />
- </form>
- </td>
- <!--<td>{$use_url}</td>-->
- <td>{$browser}</td>
- <td>
- <a href=\"rbfminc/download.php?p=".urlencode($current_folder)."&amp;file_name=".urlencode($v)."\"><img width=\"16\" height=\"16\"
- src=\"rbfmimg/ico_download.png\"
- alt=\"Download\"
- title=\"Download\"
- border=\"0\"
- /></a>
- </td>
- <td>
- <img width=\"16\" height=\"16\"
- src=\"rbfmimg/ico_rename.png\"
- alt=\"Rename\"
- title=\"Rename\"
- onclick=\"document.getElementById('f{$id}').style.display = 'none';
- document.getElementById('r{$id}').style.display = 'block';
- document.getElementById('rf{$id}').focus();
- document.getElementById('rf{$id}').select()\"
- />
- </td>
- <td>{$edit_file_content}</td>
- <td>
- <img width=\"16\" height=\"16\"
- src=\"rbfmimg/ico_delete.png\"
- alt=\"D\"
- title=\"Delete\"
- onclick=\"
- if(
- confirm('Delete file &quot;{$v}&quot;?') &amp;&amp;
- confirm('You cannot undo this operation!!!') &amp;&amp;
- confirm('To delete this file &quot;{$v}&quot; press OK\\nTo cancel this operation press CANCEL')
- ){
- document.location = 'file_manager.php?p=".urlencode($current_folder)."&amp;do=delete&amp;file=".urlencode($v)."&amp;type=file'
- }
- \"
- />
- </td>
- <td class=\"srow\">{$extension}</td>
- <td>{$file_size}</td>
- <td class=\"srow\">{$last_updated_time}</td>
- <td class=\"fileperms\">{$fileperms}</td>
- </tr>
- ";
- $id++;
- }
- }
- }
-
- $container .= "</table>";
-
- $container = preg_replace("/\s+/m", " ", $container);
-
-?>
-
-<link href="rbfminc/file_editor_style.css" rel="stylesheet" type="text/css" />
-</head>
-
-<body>
-
-
-<?php include("fbegin.inc"); ?>
-
-<?php echo $security_issues; ?>
-<div class="file_editor">
- <div class="header">
-
- </div>
- <form id="path" name="path" method="get" action="" class="path">
- <input name="p" type="text" id="location" value="<?php echo $current_folder; ?>" />
- <input name="go" type="image" id="go" value="Go" src="rbfmimg/go.png" style="width:35;height:18" />
- </form>
- <div class="url_path"><br />URL path: <a href="/<?php echo $url_path; ?>" target="_blank"><?php echo $url_path; ?></a></div>
- <div class="container"> <?php echo $container; ?> <?php echo $error; ?> </div>
- <form action="" method="post" enctype="multipart/form-data" name="form_upload" id="form_upload" class="form_upload">
- Upload a file in current folder:
- <input type="file" name="file" id="file" />
- &nbsp; &nbsp;
- <input name="replace_file" type="checkbox" value="1" />
- Replace existing file &nbsp; &nbsp;
- <input type="submit" name="upload" id="upload" value="Upload" />
- <input name="upload_file" type="hidden" id="upload_file" value="upload_file" />
- </form>
- <form action="" method="post" enctype="multipart/form-data" name="form_create" id="form_create" class="form_create">
- &nbsp;&nbsp;&nbsp;&nbsp;Create new folder here;&nbsp;Folder name:
- <input name="folder_name" type="text" style="width:290" />
- <input type="submit" name="create_folder" id="create_folder" value="Create folder" />
- </form>
- <iframe name="results" frameborder="0" scrolling="auto" class='results'></iframe>
- <div align="center" style="margin-top:5px"> [ <img src="rbfmimg/ico_open_as_web.png" width="16" height="16" align="middle" alt="open" /> OPEN IN BROWSER ] &nbsp; &nbsp;
- [ <img src="rbfmimg/ico_download.png" width="16" height="16" align="middle" alt="download" /> DOWNLOAD ] &nbsp; &nbsp;
- [ <img src="rbfmimg/ico_rename.png" width="16" height="16" align="middle" alt="rename" /> RENAME ] &nbsp; &nbsp;
- [ <img src="rbfmimg/ico_script_edit.png" width="16" height="16" align="middle" alt="view" /> VIEW/EDIT ] &nbsp; &nbsp;
- [ <img src="rbfmimg/ico_delete.png" width="16" height="16" align="middle" alt="delete" /> DELETE ] </div>
- <?php
- if($_GET['do'] == 'edit'){
-
- $file_content = file_get_contents($current_folder.$_GET['f']);
- echo "
-<form id=\"form_edit\" name=\"form_edit\" method=\"post\" action=\"\" style='width: 670px;margin: 10px auto 0;border-top: 1px #999999 solid'>
- <a name=\"file_edit\"></a>
- File: <b>{$current_folder}{$_GET['f']}</b><br />
- <textarea name=\"file_content\" id=\"file_content\" cols=\"1\" rows=\"1\" style=\"width: 99%; height: 400px\">".htmlentities ($file_content)."</textarea><br />
- <input name=\"save\" type=\"submit\" value=\"Save\" />
- <input name=\"close\" type=\"button\" value=\"Close file editor\" onclick=\"document.location = 'file_manager.php?f=".urlencode($current_folder)."'\" />
- <input name=\"save_file\" type=\"hidden\" value=\"save_file\" />
-</form>
-";
- }
-
-?>
- <div class="footer"></div>
-</div>
-<small>Created by <a href="http://www.tomschaefer.org/pfsense">TomSchaefer</a></small>
-<?php
-if($alert_info){
- echo "
-<script type=\"text/javascript\">
-//<![CDATA[
- alert('{$alert_info}');
-//]]>
-</script>
- ";
-}
-if($redirect){
- echo "
-<script type=\"text/javascript\">
-//<![CDATA[
- document.location = '{$redirect}';
-//]]>
-</script>
- ";
-}
-?>
-<?php include("fend.inc"); ?>
-</body>
-</html>
-<?php
-}else{
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>Login</title>
-<style type="text/css">
-/*<![CDATA[*/
-body,td,th,input {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
-}
-body {
- background-color: #EEEEEE;
-}
-/*]]>*/
-</style></head>
-<body><br /><br /><br /><br />
-<div class="login">
- <div style="color:red" align="center"><?php echo $error_message; ?></div>
- <form id="login_form" name="login_form" method="post" action="">
- <table border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#FFFFFF" style="border:1px solid #999999; padding:10px" summary="login">
- <tr>
- <td align="right">Username:</td>
- <td><input type="text" name="username" id="username" class="login_input" style="width:230px" /></td>
- </tr>
- <tr>
- <td align="right">Password:</td>
- <td><input type="password" name="password" id="password" class="login_input" style="width:100px" />
- </td>
- </tr>
- <tr>
- <td colspan="2" align="right"><input type="submit" name="button" id="button" value="Login &raquo;" /></td>
- </tr>
- </table>
- <input name="login" type="hidden" value="login" />
- </form>
-</div>
-</body>
-</html>
-
-
-<?php
-}
-?>
diff --git a/config/filemgr/filemgr.inc b/config/filemgr/filemgr.inc
deleted file mode 100644
index 64186637..00000000
--- a/config/filemgr/filemgr.inc
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-/* $Id$ */
-/*
-/* ========================================================================== */
-/*
- filemgr.inc
-
- All rights reserved.
- */
-/* ========================================================================== */
-/*
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-
-function php_sync_package_fm()
-{
- global $config;
-}
-
-
-function php_install_command_fm()
-{
-
- global $config;
- conf_mount_rw();
-
- if (!is_dir('/usr/local/www/packages/')) {
- exec("mkdir /usr/local/www/packages/");
- }
-
- if (!is_dir('/usr/local/www/packages/filemgr/')) {
- exec("mkdir /usr/local/www/packages/filemgr/");
- }
-
- if (!is_dir('/usr/local/www/packages/filemgr/rbfmimg/')) {
- exec("mkdir /usr/local/www/packages/filemgr/rbfmimg/");
- }
-
- if (!is_dir('/usr/local/www/packages/filemgr/rbfminc/')) {
- exec("mkdir /usr/local/www/packages/filemgr/rbfminc/");
- }
-
-
-
-
-
- //rename PHP files from .tmp to .php
- exec("cp /tmp/file_manager.tmp /usr/local/www/packages/filemgr/file_manager.php");
- unlink_if_exists("/tmp/file_manager.tmp");
-
- exec("cp /tmp/filemgr.inc /usr/local/www/packages/filemgr/filemgr.inc");
- unlink_if_exists("/tmp/filemgr.inc");
-
- exec("cp /tmp/filemgr.xml /usr/local/www/packages/filemgr/filemgr.xml");
- unlink_if_exists("/tmp/filemgr.xml");
-
- exec("cp /tmp/index.tmp /usr/local/www/packages/filemgr/index.php");
- unlink_if_exists("/tmp/index.tmp");
-
- exec("cp /tmp/bg_footer.png /usr/local/www/packages/filemgr/rbfmimg/bg_footer.png");
- unlink_if_exists("/tmp/bg_footer.png");
-
- exec("cp /tmp/bg_header.png /usr/local/www/packages/filemgr/rbfmimg/bg_header.png");
- unlink_if_exists("/tmp/bg_header.png");
- exec("cp /tmp/bg_page.png /usr/local/www/packages/filemgr/rbfmimg/bg_page.png");
- unlink_if_exists("/tmp/bg_page.png");
- exec("cp /tmp/file_editor_bg.png /usr/local/www/packages/filemgr/rbfmimg/file_editor_bg.png");
- unlink_if_exists("/tmp/file_editor_bg.png");
- exec("cp /tmp/folder.png /usr/local/www/packages/filemgr/rbfmimg/folder.png");
- unlink_if_exists("/tmp/folder.png");
- exec("cp /tmp/folder_go.png /usr/local/www/packages/filemgr/rbfmimg/folder_go.png");
- unlink_if_exists("/tmp/folder_go.png");
- exec("cp /tmp/folder_up.png /usr/local/www/packages/filemgr/rbfmimg/folder_up.png");
- unlink_if_exists("/tmp/folder_up.png");
- exec("cp /tmp/go.png /usr/local/www/packages/filemgr/rbfmimg/go.png");
- unlink_if_exists("/tmp/go.png");
- exec("cp /tmp/ico_delete.png /usr/local/www/packages/filemgr/rbfmimg/ico_delete.png");
- unlink_if_exists("/tmp/ico_delete.png");
- exec("cp /tmp/ico_download.png /usr/local/www/packages/filemgr/rbfmimg/ico_download.png");
- unlink_if_exists("/tmp/ico_download.png");
- exec("cp /tmp/ico_file.png /usr/local/www/packages/filemgr/rbfmimg/ico_file.png");
- unlink_if_exists("/tmp/ico_file.png");
- exec("cp /tmp/ico_html.png /usr/local/www/packages/filemgr/rbfmimg/ico_html.png");
- unlink_if_exists("/tmp/ico_html.png");
- exec("cp /tmp/ico_open_as_web.png /usr/local/www/packages/filemgr/rbfmimg/ico_open_as_web.png");
- unlink_if_exists("/tmp/ico_open_as_web.png");
- exec("cp /tmp/ico_php.png /usr/local/www/packages/filemgr/rbfmimg/ico_php.png");
- unlink_if_exists("/tmp/ico_php.png");
- exec("cp /tmp/ico_picture.png /usr/local/www/packages/filemgr/rbfmimg/ico_picture.png");
- unlink_if_exists("/tmp/ico_picture.png");
- exec("cp /tmp/ico_rename.png /usr/local/www/packages/filemgr/rbfmimg/ico_rename.png");
- unlink_if_exists("/tmp/ico_rename.png");
- exec("cp /tmp/ico_script_edit.png /usr/local/www/packages/filemgr/rbfmimg/ico_script_edit.png");
- unlink_if_exists("/tmp/ico_script_edit.png");
- exec("cp /tmp/ico_use_file.png /usr/local/www/packages/filemgr/rbfmimg/ico_use_file.png");
- unlink_if_exists("/tmp/ico_use_file.png");
- exec("cp /tmp/ico_use_file_inactive.png /usr/local/www/packages/filemgr/rbfmimg/ico_use_file_inactive.png");
- unlink_if_exists("/tmp/ico_use_file_inactive.png");
- exec("cp /tmp/index.html /usr/local/www/packages/filemgr/rbfmimg/index.html");
- unlink_if_exists("/tmp/index.html");
- exec("cp /tmp/new.png /usr/local/www/packages/filemgr/rbfmimg/new.png");
- unlink_if_exists("/tmp/new.png");
-
- exec("cp /tmp/config.tmp /usr/local/www/packages/filemgr/rbfminc/config.php");
- unlink_if_exists("/tmp/config.tmp");
- exec("cp /tmp/download.tmp /usr/local/www/packages/filemgr/rbfminc/download.php");
- unlink_if_exists("/tmp/download.tmp");
- exec("cp /tmp/file_editor_style.css /usr/local/www/packages/filemgr/rbfminc/file_editor_style.css");
- unlink_if_exists("/tmp/file_editor_style.css");
- exec("cp /tmp/functions.tmp /usr/local/www/packages/filemgr/rbfminc/functions.php");
- unlink_if_exists("/tmp/functions.tmp");
- exec("cp /tmp/index.html /usr/local/www/packages/filemgr/rbfminc/index.html");
- unlink_if_exists("/tmp/index.html");
- exec("cp /tmp/rename.tmp /usr/local/www/packages/filemgr/rbfminc/rename.php");
- unlink_if_exists("/tmp/rename.tmp");
- exec("cp /tmp/session.tmp /usr/local/www/packages/filemgr/rbfminc/session.php");
- unlink_if_exists("/tmp/session.tmp");
-
-
-
- conf_mount_ro();
-}
-
-
-function deinstall_command_fm()
-{
- conf_mount_rw();
- $handle = popen("/usr/local/etc/rc.d/filemgr.sh stop", "r");
- unlink_if_exists("/usr/local/pkg/filemgr.xml");
- unlink_if_exists("/usr/local/pkg/filemgr.inc");
- exec("rm -R /usr/local/www/packages/filemgr/filemgrs");
- exec("rm -R /usr/local/www/packages/filemgr");
- exec("rm /usr/local/etc/rc.d/filemgr.sh");
- exec("pfctl -t filemgr -T kill");
- exec("sed -i -e '/filemgr/d' /tmp/rules.debug");
- exec("pfctl -o basic -f /tmp/rules.debug");
- conf_mount_ro();
-}
-
-?>
diff --git a/config/filemgr/filemgr.xml b/config/filemgr/filemgr.xml
index c2a7ac42..fdcf46d0 100644
--- a/config/filemgr/filemgr.xml
+++ b/config/filemgr/filemgr.xml
@@ -1,18 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
-<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
+<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
<copyright>
- <![CDATA[
+<![CDATA[
/* $Id$ */
-/* ========================================================================== */
+/* ====================================================================================== */
/*
filemgr.xml
-
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
All rights reserved.
- */
-/* ========================================================================== */
+*/
+/* ====================================================================================== */
/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -23,27 +37,24 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
- */
-/* ========================================================================== */
- ]]>
- </copyright>
+*/
+/* ====================================================================================== */
+ ]]>
+ </copyright>
<description>PHP File Manager</description>
- <requirements>none</requirements>
<faq>https://forum.pfsense.org/index.php/topic,26974.0.html</faq>
<name>File Manager</name>
- <version>0.1.4</version>
- <title>Settings</title>
- <include_file>/usr/local/pkg/filemgr.inc</include_file>
+ <version>0.2.0</version>
+ <title>Diagnostics: File Manager</title>
<menu>
<name>File Manager</name>
- <tooltiptext>File Manager settings</tooltiptext>
<section>Diagnostics</section>
<configfile>filemgr.xml</configfile>
<url>/packages/filemgr/file_manager.php</url>
</menu>
<tabs>
<tab>
- <text>Settings</text>
+ <text>File Manager</text>
<url>/packages/filemgr/file_manager.php</url>
<active/>
</tab>
@@ -51,190 +62,126 @@
<configpath>installedpackages->package->$packagename->configuration->filemgr</configpath>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
<item>https://packages.pfsense.org/packages/config/filemgr/filemgr.xml</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/filemgr.inc</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/file_manager.tmp</item>
+ <prefix>/usr/local/www/packages/filemgr/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/file_manager.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/index.tmp</item>
+ <prefix>/usr/local/www/packages/filemgr/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/index.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/bg_footer.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/bg_header.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/bg_page.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/file_editor_bg.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/folder.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/folder_go.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/folder_up.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/go.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_delete.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_download.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_file.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_html.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_open_as_web.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_php.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_picture.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_rename.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_script_edit.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_use_file.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/ico_use_file_inactive.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/index.html</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfmimg/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfmimg/new.png</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/config.tmp</item>
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/config.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/download.tmp</item>
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/download.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/file_editor_style.css</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/functions.tmp</item>
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/functions.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
<item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/index.html</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/rename.tmp</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/session.tmp</item>
- </additional_files_needed>
- <fields>
- <field>
- <fielddescr>Variable One</fielddescr>
- <fieldname>var1</fieldname>
- <description>Enter the variable one here.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Variable Two</fielddescr>
- <fieldname>var1</fieldname>
- <description>Enter the variable one here.</description>
- <type>input</type>
- </field>
- </fields>
- <custom_add_php_command>
- </custom_add_php_command>
- <custom_php_resync_config_command>
- php_sync_package_fm();
- </custom_php_resync_config_command>
- <custom_delete_php_command>
- php_sync_package_fm();
- </custom_delete_php_command>
- <custom_php_install_command>
- php_install_command_fm();
- </custom_php_install_command>
- <custom_php_deinstall_command>
- deinstall_command_fm();
- </custom_php_deinstall_command>
-</packagegui> \ No newline at end of file
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/rename.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/packages/filemgr/rbfminc/</prefix>
+ <item>https://packages.pfsense.org/packages/config/filemgr/rbfminc/session.php</item>
+ </additional_files_needed>
+</packagegui>
diff --git a/config/filemgr/index.php b/config/filemgr/index.php
new file mode 100644
index 00000000..156ade3d
--- /dev/null
+++ b/config/filemgr/index.php
@@ -0,0 +1,44 @@
+<?php
+/*
+ index.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Redirect</title>
+ <script type="text/javascript">
+ //<![CDATA[
+ window.parent.location="../../index.php";
+ //]]>
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/config/filemgr/index.tmp b/config/filemgr/index.tmp
deleted file mode 100644
index 47092a0c..00000000
--- a/config/filemgr/index.tmp
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
-<SCRIPT type="text/javascript">
-//<![CDATA[
-window.parent.location="../../index.php";
-//]]>
-</SCRIPT>
-</head>
-
-
-</html> \ No newline at end of file
diff --git a/config/filemgr/rbfminc/config.php b/config/filemgr/rbfminc/config.php
new file mode 100644
index 00000000..776abf58
--- /dev/null
+++ b/config/filemgr/rbfminc/config.php
@@ -0,0 +1,123 @@
+<?php
+/*
+ config.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+// Initial folder
+$initial_folder = "/";
+// 0 = you can browse all files on the server;
+// 1= you can browse only the $initial_folder and below
+$only_below = 0;
+
+// Login info {Please change the initial username and password}
+$username = 'admin';
+$password = 'admin';
+
+/* ==================================== */
+/* BEGIN Protect against GLOBALS tricks */
+if (isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_GET['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
+ die("Hacking attempt");
+}
+
+if (isset($_SESSION) && !is_array($_SESSION)) {
+ die("Hacking attempt");
+}
+
+if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') {
+ $not_unset = array('_GET', '_POST', '_COOKIE', 'HTTP_SERVER_VARS', '_SESSION', 'HTTP_ENV_VARS', '_FILES');
+
+ if (!isset($_SESSION) || !is_array($_SESSION)) {
+ $_SESSION = array();
+ }
+ $input = array_merge($_GET, $_POST, $_COOKIE, $HTTP_SERVER_VARS, $_SESSION, $HTTP_ENV_VARS, $_FILES);
+
+ unset($input['input']);
+ unset($input['not_unset']);
+
+ while (list($var,) = @each($input)) {
+ if (in_array($var, $not_unset)) {
+ die('Hacking attempt!');
+ }
+ unset($$var);
+ }
+
+ unset($input);
+}
+
+if (!get_magic_quotes_gpc()) {
+ if (is_array($_GET)) {
+ while (list($k, $v) = each($_GET)) {
+ if (is_array($_GET[$k])) {
+ while (list($k2, $v2) = each($_GET[$k])) {
+ $_GET[$k][$k2] = addslashes($v2);
+ }
+ @reset($_GET[$k]);
+ } else {
+ $_GET[$k] = addslashes($v);
+ }
+ }
+ @reset($_GET);
+ }
+
+ if (is_array($_POST)) {
+ while (list($k, $v) = each($_POST)) {
+ if (is_array($_POST[$k])) {
+ while (list($k2, $v2) = each($_POST[$k])) {
+ $_POST[$k][$k2] = addslashes($v2);
+ }
+ @reset($_POST[$k]);
+ } else {
+ $_POST[$k] = addslashes($v);
+ }
+ }
+ @reset($_POST);
+ }
+
+ if (is_array($_COOKIE)) {
+ while (list($k, $v) = each($_COOKIE)) {
+ if (is_array($_COOKIE[$k])) {
+ while (list($k2, $v2) = each($_COOKIE[$k])) {
+ $_COOKIE[$k][$k2] = addslashes($v2);
+ }
+ @reset($_COOKIE[$k]);
+ } else {
+ $_COOKIE[$k] = addslashes($v);
+ }
+ }
+ @reset($_COOKIE);
+ }
+}
+/* END Protect against GLOBALS tricks */
+/* ==================================== */
+
+/*
+if ($username == 'admin' and $password == 'admin') {
+ $security_issues = "<div align=\"center\" style=\"color: red;\"><strong>Security issue</strong>: Please change your username or password</div>";
+}
+*/
+$security_issues = "<br />";
+?>
diff --git a/config/filemgr/rbfminc/config.tmp b/config/filemgr/rbfminc/config.tmp
deleted file mode 100644
index 405514f8..00000000
--- a/config/filemgr/rbfminc/config.tmp
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-
-
-$initial_folder = "/"; //initial folder
-$only_below = 0; // 0=you can brows all server; 1=you can brows only the $initial_folder and below
-
-//Login info {Please change the initial username and password}
-$username = 'admin';
-$password = 'admin';
-
-
-
-/***********************************/
-// Protect against GLOBALS tricks
-if (isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_GET['GLOBALS']) || isset($_COOKIE['GLOBALS'])){
- die("Hacking attempt");
-}
-
-if (isset($_SESSION) && !is_array($_SESSION)){
- die("Hacking attempt");
-}
-
-if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on'){
- $not_unset = array('_GET', '_POST', '_COOKIE', 'HTTP_SERVER_VARS', '_SESSION', 'HTTP_ENV_VARS', '_FILES');
-
- if (!isset($_SESSION) || !is_array($_SESSION)){
- $_SESSION = array();
- }
- $input = array_merge($_GET, $_POST, $_COOKIE, $HTTP_SERVER_VARS, $_SESSION, $HTTP_ENV_VARS, $_FILES);
-
- unset($input['input']);
- unset($input['not_unset']);
-
- while (list($var,) = @each($input)){
- if (in_array($var, $not_unset)){
- die('Hacking attempt!');
- }
- unset($$var);
- }
-
- unset($input);
-}
-
-if( !get_magic_quotes_gpc() ){
- if( is_array($_GET) ){
- while( list($k, $v) = each($_GET) ){
- if( is_array($_GET[$k]) )
- {
- while( list($k2, $v2) = each($_GET[$k]) ){
- $_GET[$k][$k2] = addslashes($v2);
- }
- @reset($_GET[$k]);
- }else{
- $_GET[$k] = addslashes($v);
- }
- }
- @reset($_GET);
- }
-
- if( is_array($_POST) ){
- while( list($k, $v) = each($_POST) ){
- if( is_array($_POST[$k]) )
- {
- while( list($k2, $v2) = each($_POST[$k]) ){
- $_POST[$k][$k2] = addslashes($v2);
- }
- @reset($_POST[$k]);
- }else{
- $_POST[$k] = addslashes($v);
- }
- }
- @reset($_POST);
- }
-
- if( is_array($_COOKIE) ){
- while( list($k, $v) = each($_COOKIE) ){
- if( is_array($_COOKIE[$k]) ){
- while( list($k2, $v2) = each($_COOKIE[$k]) ){
- $_COOKIE[$k][$k2] = addslashes($v2);
- }
- @reset($_COOKIE[$k]);
- }else{
- $_COOKIE[$k] = addslashes($v);
- }
- }
- @reset($_COOKIE);
- }
-}
-//END Protect against GLOBALS tricks
-/***********************************/
-//if($username == 'admin' and $password == 'admin'){
- //$security_issues = "<div align=\"center\" style=\"color: red;\"><b>Security issue</b>: Please change your username or password</div>";
-//}
-$security_issues = "<br />";
-?>
diff --git a/config/filemgr/rbfminc/download.php b/config/filemgr/rbfminc/download.php
new file mode 100644
index 00000000..88ff1788
--- /dev/null
+++ b/config/filemgr/rbfminc/download.php
@@ -0,0 +1,69 @@
+<?php
+/*
+ download.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+include_once("auth.inc");
+include("functions.php");
+
+// Set the cache policy
+ob_end_clean();
+header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+// Gets the parameters
+$_GET['file_name'] = urldecode($_GET['file_name']);
+$_GET['p'] = urldecode($_GET['p']);
+
+// Check Authentication
+$candownload = false;
+$candownload = session_auth();
+if ($candownload) {
+ if (($_GET['file_name']) && ($_GET['p'])) {
+ $filepath = $_GET['p'].$_GET['file_name'];
+ if (file_exists($filepath)) {
+ $type = wp_check_filetype($_GET['file_name']);
+ header('Content-type: ' . $type[$_GET['file_name']]);
+ header('Content-Disposition: attachment; filename="'.$_GET['file_name'].'"');
+ header('Content-Length: ' . filesize($filepath));
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($filepath)).' GMT', true, 200);
+ flush();
+ readfile($filepath);
+ exit;
+ } else {
+ echo "File not found";
+ }
+ } else {
+ echo "File Unknown";
+ }
+} else {
+ echo "Session Expired";
+}
+
+?>
diff --git a/config/filemgr/rbfminc/download.tmp b/config/filemgr/rbfminc/download.tmp
deleted file mode 100644
index badc6d19..00000000
--- a/config/filemgr/rbfminc/download.tmp
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-include_once("auth.inc");
-include "functions.php";
-//Set the cache policy
-ob_end_clean();
-header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
-header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
-header("Cache-Control: post-check=0, pre-check=0", false);
-header("Pragma: no-cache");
-//Gets the parameters
-$_GET['file_name'] = urldecode($_GET['file_name']);
-$_GET['p'] = urldecode($_GET['p']);
-//Check Authentication
-$candownload = false;
-if (function_exists("session_auth"))
- {//pfSense 2.X
- $candownload = session_auth();}
-else
- {//pfSense 1.2.3
- $candownload = htpasswd_backed_basic_auth();}
-if ($candownload)
-{
- if($_GET['file_name'] and $_GET['p']){
- $filepath = $_GET['p'].$_GET['file_name'];
- if(file_exists($filepath)){
- $type = wp_check_filetype($_GET['file_name']);
- header('Content-type: ' . $type[$_GET['file_name']]);
- header('Content-Disposition: attachment; filename="'.$_GET['file_name'].'"');
- header('Content-Length: ' . filesize($filepath));
- header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($filepath)).' GMT', true, 200);
- flush();
- readfile($filepath);
- exit;
- }
- else
- {
- echo("File not found");
- }
- }
- else
- {
- echo("File Unknown");
- }
-}
-else
-{
- echo("Session Expired");
-}
-?> \ No newline at end of file
diff --git a/config/filemgr/rbfminc/functions.php b/config/filemgr/rbfminc/functions.php
new file mode 100644
index 00000000..bab912a7
--- /dev/null
+++ b/config/filemgr/rbfminc/functions.php
@@ -0,0 +1,221 @@
+<?php
+/*
+ functions.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+function RecursiveFolderDelete($folderPath) {
+ if (is_dir($folderPath )) {
+ foreach (scandir($folderPath) as $value) {
+ if ($value != "." && $value != "..") {
+ $value = $folderPath . "/" . $value;
+ if (is_dir($value)) {
+ RecursiveFolderDelete($value);
+ } elseif (is_file($value)) {
+ @unlink($value);
+ }
+ }
+ }
+ if (!@rmdir($folderPath)) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+ } else {
+ return FALSE;
+ }
+}
+
+
+function GetFilePerms($file) {
+ $perms = fileperms($file);
+
+ if (($perms & 0xC000) == 0xC000) {
+ // Socket
+ $info = 's';
+ } elseif (($perms & 0xA000) == 0xA000) {
+ // Symbolic Link
+ $info = 'l';
+ } elseif (($perms & 0x8000) == 0x8000) {
+ // Regular
+ $info = '-';
+ } elseif (($perms & 0x6000) == 0x6000) {
+ // Block special
+ $info = 'b';
+ } elseif (($perms & 0x4000) == 0x4000) {
+ // Directory
+ $info = 'd';
+ } elseif (($perms & 0x2000) == 0x2000) {
+ // Character special
+ $info = 'c';
+ } elseif (($perms & 0x1000) == 0x1000) {
+ // FIFO pipe
+ $info = 'p';
+ } else {
+ // Unknown
+ $info = '?';
+ }
+
+ // Owner
+ $info .= " " . (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
+ // Group
+ $info .= " " . (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
+ // World
+ $info .= " ".(($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
+
+ $info = "[" . substr(sprintf('%o', fileperms($file)), -4) . "] " . $info;
+ return $info;
+}
+
+
+function merge_filters($tag) {
+ global $wp_filter, $merged_filters;
+
+ if (isset($wp_filter['all']) && is_array($wp_filter['all'])) {
+ $wp_filter[$tag] = array_merge($wp_filter['all'], (array) $wp_filter[$tag]);
+ }
+
+ if (isset($wp_filter[$tag])) {
+ reset($wp_filter[$tag]);
+ uksort($wp_filter[$tag], "strnatcasecmp");
+ }
+ $merged_filters[$tag] = true;
+}
+
+
+function apply_filters($tag, $string) {
+ global $wp_filter, $merged_filters;
+
+ if (!isset($merged_filters[$tag])) {
+ merge_filters($tag);
+ }
+
+ if (!isset($wp_filter[$tag])) {
+ return $string;
+ }
+
+ reset($wp_filter[$tag]);
+
+ $args = func_get_args();
+
+ do {
+ foreach ((array)current($wp_filter[$tag]) as $the_) {
+ if (!is_null($the_['function'])) {
+ $args[1] = $string;
+ $string = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
+ }
+ }
+
+ } while (next($wp_filter[$tag]) !== false);
+
+ return $string;
+}
+
+
+function wp_check_filetype($filename, $mimes = null) {
+ // Accepted MIME types are set here as PCRE unless provided.
+ $mimes = is_array($mimes) ? $mimes : apply_filters('upload_mimes', array(
+ 'jpg|jpeg|jpe' => 'image/jpeg',
+ 'gif' => 'image/gif',
+ 'png' => 'image/png',
+ 'bmp' => 'image/bmp',
+ 'tif|tiff' => 'image/tiff',
+ 'ico' => 'image/x-icon',
+ 'asf|asx|wax|wmv|wmx' => 'video/asf',
+ 'avi' => 'video/avi',
+ 'mov|qt' => 'video/quicktime',
+ 'mpeg|mpg|mpe' => 'video/mpeg',
+ 'txt|c|cc|h' => 'text/plain',
+ 'rtx' => 'text/richtext',
+ 'css' => 'text/css',
+ 'htm|html' => 'text/html',
+ 'php|php3|' => 'application/php',
+ 'mp3|mp4' => 'audio/mpeg',
+ 'ra|ram' => 'audio/x-realaudio',
+ 'wav' => 'audio/wav',
+ 'ogg' => 'audio/ogg',
+ 'mid|midi' => 'audio/midi',
+ 'wma' => 'audio/wma',
+ 'rtf' => 'application/rtf',
+ 'js' => 'application/javascript',
+ 'pdf' => 'application/pdf',
+ 'doc' => 'application/msword',
+ 'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
+ 'wri' => 'application/vnd.ms-write',
+ 'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
+ 'mdb' => 'application/vnd.ms-access',
+ 'mpp' => 'application/vnd.ms-project',
+ 'swf' => 'application/x-shockwave-flash',
+ 'class' => 'application/java',
+ 'tar' => 'application/x-tar',
+ 'zip' => 'application/zip',
+ 'gz|gzip' => 'application/x-gzip',
+ 'exe' => 'application/x-msdownload',
+ // openoffice formats
+ 'odt' => 'application/vnd.oasis.opendocument.text',
+ 'odp' => 'application/vnd.oasis.opendocument.presentation',
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+ 'odg' => 'application/vnd.oasis.opendocument.graphics',
+ 'odc' => 'application/vnd.oasis.opendocument.chart',
+ 'odb' => 'application/vnd.oasis.opendocument.database',
+ 'odf' => 'application/vnd.oasis.opendocument.formula',
+
+ ));
+
+ $type = false;
+ $ext = false;
+
+ foreach ($mimes as $ext_preg => $mime_match) {
+ $ext_preg = '!\.(' . $ext_preg . ')$!i';
+ if (preg_match($ext_preg, $filename, $ext_matches)) {
+ $type = $mime_match;
+ $ext = $ext_matches[1];
+ break;
+ }
+ }
+
+ return compact('ext', 'type');
+}
+
+
+
+function roundsize($size) {
+ $i=0;
+ $iec = array("B", "Kb", "Mb", "Gb", "Tb");
+ while (($size/1024)>1) {
+ $size=$size/1024;
+ $i++;
+ }
+ return(round($size, 1) . " " . $iec[$i]);
+}
+
+?>
diff --git a/config/filemgr/rbfminc/functions.tmp b/config/filemgr/rbfminc/functions.tmp
deleted file mode 100644
index f06ee69c..00000000
--- a/config/filemgr/rbfminc/functions.tmp
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-function RecursiveFolderDelete ( $folderPath )
-{
- if ( is_dir ( $folderPath ) )
- {
- foreach ( scandir ( $folderPath ) as $value )
- {
- if ( $value != "." && $value != ".." )
- {
- $value = $folderPath . "/" . $value;
- if ( is_dir ( $value ) )
- {
- RecursiveFolderDelete ( $value );
- }
- elseif ( is_file ( $value ) )
- {
- @unlink ( $value );
- }
- }
- }
- if(!@rmdir ( $folderPath )){
- return FALSE;
- }else{
- return TRUE;
- }
- }
- else
- {
- return FALSE;
- }
-}
-
-
-
-function GetFilePerms($file) {
- $perms = fileperms($file);
- if (($perms & 0xC000) == 0xC000) {$info = 's'; } // Socket
- elseif (($perms & 0xA000) == 0xA000) {$info = 'l'; } // Symbolic Link
- elseif (($perms & 0x8000) == 0x8000) {$info = '-'; } // Regular
- elseif (($perms & 0x6000) == 0x6000) {$info = 'b'; } // Block special
- elseif (($perms & 0x4000) == 0x4000) {$info = 'd'; } // Directory
- elseif (($perms & 0x2000) == 0x2000) {$info = 'c'; } // Character special
- elseif (($perms & 0x1000) == 0x1000) {$info = 'p'; } // FIFO pipe
- else {$info = '?';} // Unknown
- // Owner
- $info .= " ".(($perms & 0x0100) ? 'r' : '-');
- $info .= (($perms & 0x0080) ? 'w' : '-');
- $info .= (($perms & 0x0040) ?
- (($perms & 0x0800) ? 's' : 'x' ) :
- (($perms & 0x0800) ? 'S' : '-'));
- // Group
- $info .= " ".(($perms & 0x0020) ? 'r' : '-');
- $info .= (($perms & 0x0010) ? 'w' : '-');
- $info .= (($perms & 0x0008) ?
- (($perms & 0x0400) ? 's' : 'x' ) :
- (($perms & 0x0400) ? 'S' : '-'));
- // World
- $info .= " ".(($perms & 0x0004) ? 'r' : '-');
- $info .= (($perms & 0x0002) ? 'w' : '-');
- $info .= (($perms & 0x0001) ?
- (($perms & 0x0200) ? 't' : 'x' ) :
- (($perms & 0x0200) ? 'T' : '-'));
-
- $info = "[".substr(sprintf('%o', fileperms($file)), -4)."] ".$info;
-
- return $info;
-}
-
-
-
-function merge_filters($tag) {
- global $wp_filter, $merged_filters;
-
- if ( isset($wp_filter['all']) && is_array($wp_filter['all']) )
- $wp_filter[$tag] = array_merge($wp_filter['all'], (array) $wp_filter[$tag]);
-
- if ( isset($wp_filter[$tag]) ){
- reset($wp_filter[$tag]);
- uksort($wp_filter[$tag], "strnatcasecmp");
- }
- $merged_filters[ $tag ] = true;
-}
-
-
-
-function apply_filters($tag, $string) {
- global $wp_filter, $merged_filters;
-
- if ( !isset( $merged_filters[ $tag ] ) )
- merge_filters($tag);
-
- if ( !isset($wp_filter[$tag]) )
- return $string;
-
- reset( $wp_filter[ $tag ] );
-
- $args = func_get_args();
-
- do{
- foreach( (array) current($wp_filter[$tag]) as $the_ )
- if ( !is_null($the_['function']) ){
- $args[1] = $string;
- $string = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
- }
-
- } while ( next($wp_filter[$tag]) !== false );
-
- return $string;
-}
-
-
-
-function wp_check_filetype($filename, $mimes = null) {
- // Accepted MIME types are set here as PCRE unless provided.
- $mimes = is_array($mimes) ? $mimes : apply_filters('upload_mimes', array (
- 'jpg|jpeg|jpe' => 'image/jpeg',
- 'gif' => 'image/gif',
- 'png' => 'image/png',
- 'bmp' => 'image/bmp',
- 'tif|tiff' => 'image/tiff',
- 'ico' => 'image/x-icon',
- 'asf|asx|wax|wmv|wmx' => 'video/asf',
- 'avi' => 'video/avi',
- 'mov|qt' => 'video/quicktime',
- 'mpeg|mpg|mpe' => 'video/mpeg',
- 'txt|c|cc|h' => 'text/plain',
- 'rtx' => 'text/richtext',
- 'css' => 'text/css',
- 'htm|html' => 'text/html',
- 'php|php3|' => 'application/php',
- 'mp3|mp4' => 'audio/mpeg',
- 'ra|ram' => 'audio/x-realaudio',
- 'wav' => 'audio/wav',
- 'ogg' => 'audio/ogg',
- 'mid|midi' => 'audio/midi',
- 'wma' => 'audio/wma',
- 'rtf' => 'application/rtf',
- 'js' => 'application/javascript',
- 'pdf' => 'application/pdf',
- 'doc' => 'application/msword',
- 'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
- 'wri' => 'application/vnd.ms-write',
- 'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
- 'mdb' => 'application/vnd.ms-access',
- 'mpp' => 'application/vnd.ms-project',
- 'swf' => 'application/x-shockwave-flash',
- 'class' => 'application/java',
- 'tar' => 'application/x-tar',
- 'zip' => 'application/zip',
- 'gz|gzip' => 'application/x-gzip',
- 'exe' => 'application/x-msdownload',
- // openoffice formats
- 'odt' => 'application/vnd.oasis.opendocument.text',
- 'odp' => 'application/vnd.oasis.opendocument.presentation',
- 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
- 'odg' => 'application/vnd.oasis.opendocument.graphics',
- 'odc' => 'application/vnd.oasis.opendocument.chart',
- 'odb' => 'application/vnd.oasis.opendocument.database',
- 'odf' => 'application/vnd.oasis.opendocument.formula',
-
- ));
-
- $type = false;
- $ext = false;
-
- foreach ($mimes as $ext_preg => $mime_match) {
- $ext_preg = '!\.(' . $ext_preg . ')$!i';
- if ( preg_match($ext_preg, $filename, $ext_matches) ) {
- $type = $mime_match;
- $ext = $ext_matches[1];
- break;
- }
- }
-
- return compact('ext', 'type');
-}
-
-
-
-function roundsize($size){
- $i=0;
- $iec = array("B", "Kb", "Mb", "Gb", "Tb");
- while (($size/1024)>1) {
- $size=$size/1024;
- $i++;}
- return(round($size,1)." ".$iec[$i]);
-}
-
-?> \ No newline at end of file
diff --git a/config/filemgr/rbfminc/rename.php b/config/filemgr/rbfminc/rename.php
new file mode 100644
index 00000000..27553f18
--- /dev/null
+++ b/config/filemgr/rbfminc/rename.php
@@ -0,0 +1,68 @@
+<?php
+/*
+ rename.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+include("config.php");
+include("session.php");
+
+if ($user_login == 'ok') {
+ include("functions.php");
+?>
+
+<html>
+<head>
+<title>Rename</title>
+</head>
+<body>
+<script type="text/javascript">
+//<![CDATA[
+<?php
+if ($_POST['o'] != $_POST['n']) {
+ if (@rename($_POST['cf'].$_POST['o'], $_POST['cf'].$_POST['n'])) {
+ if ($_POST['t'] == 'd') {
+ echo "alert('Directory successfuly renamed from \"{$_POST['o']}\" to \"{$_POST['n']}\"');";
+ } else {
+ echo "alert('File successfuly renamed from \"{$_POST['o']}\" to \"{$_POST['n']}\"');";
+ }
+ } else {
+ echo <<<EOD
+ alert('Rename error');
+ window.parent.location.href = window.parent.location.href;
+EOD;
+ }
+}
+
+?>
+//]]>
+</script>
+</body>
+</html>
+
+<?php
+}
+?>
diff --git a/config/filemgr/rbfminc/rename.tmp b/config/filemgr/rbfminc/rename.tmp
deleted file mode 100644
index 266e38d4..00000000
--- a/config/filemgr/rbfminc/rename.tmp
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-include "config.php";
-include "session.php";
-
-if($user_login == 'ok'){
-
- include "functions.php";
-
-?>
-<html>
-<head>
-<title>Rename</title>
-</head>
-<body>
-<script type="text/javascript">
-//<![CDATA[
-<?php
-//print_r($_POST);
-if($_POST['o'] != $_POST['n']){
- if(@rename($_POST['cf'].$_POST['o'], $_POST['cf'].$_POST['n'])){
- if($_POST['t'] == 'd'){
- echo "alert('Directory successfuly renamed from \"{$_POST['o']}\" to \"{$_POST['n']}\"');";
- }else{
- echo "alert('File successfuly renamed from \"{$_POST['o']}\" to \"{$_POST['n']}\"');";
- }
- }else{
- echo "
- alert('Rename error');
- window.parent.location.href = window.parent.location.href;
- ";
- }
-}
-
-?>
-//]]>
-</script>
-</body>
-</html>
-<?php
-}
-?> \ No newline at end of file
diff --git a/config/filemgr/rbfminc/session.php b/config/filemgr/rbfminc/session.php
new file mode 100644
index 00000000..b616643f
--- /dev/null
+++ b/config/filemgr/rbfminc/session.php
@@ -0,0 +1,58 @@
+<?php
+/*
+ session.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Tom Schaefer <tom@tomschaefer.org>
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+session_name("file_manager_session");
+
+// Create session
+session_start();
+if (($_POST['login'] == 'login') && ($_POST['username']) && ($_POST['password'])) {
+ $_SESSION = array();
+ $_SESSION['username'] = $_POST['username'];
+ $_SESSION['password'] = $_POST['password'];
+}
+
+if ($_GET['logout'] == "logout") {
+ setcookie('url_field', '', time()-3600);
+ setcookie('current_folder', '', time()-3600);
+ $_SESSION = array();
+ session_destroy();
+ session_unset();
+ header("Location: file_manager.php");
+}
+
+
+if (($_SESSION['username']) && ($_SESSION['password'])) {
+ if (($_SESSION['username'] == $username) && ($_SESSION['password'] == $password)) {
+ $user_login = 'ok';
+ } else {
+ $error_message = "Incorrect username or password!";
+ }
+}
+
+?>
diff --git a/config/filemgr/rbfminc/session.tmp b/config/filemgr/rbfminc/session.tmp
deleted file mode 100644
index 7cfc133d..00000000
--- a/config/filemgr/rbfminc/session.tmp
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-session_name("file_manager_session");
-
-session_start();
-
-/*************************************************************************************************/
-//create session
-if($_POST['login'] == 'login' and $_POST['username'] and $_POST['password']){
- $_SESSION = array();
- $_SESSION['username']=$_POST['username'];
- $_SESSION['password']=$_POST['password'];
-}
-
-if($_GET['logout'] == "logout"){
- setcookie('url_field', '', time()-3600);
- setcookie('current_folder', '', time()-3600);
- $_SESSION = array();
- session_destroy();
- session_unset();
- header("Location: file_manager.php");
-}
-
-
-if($_SESSION['username'] and $_SESSION['password']){
- if($_SESSION['username'] == $username and $_SESSION['password'] == $password){
- $user_login = 'ok';
- }else{
- $error_message = "Incorect username or password!";
- }
-}
-
-?>