diff options
author | Renato Botelho <renato@netgate.com> | 2016-09-08 07:15:46 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-09-08 07:15:46 -0300 |
commit | 39aa6d811938b42e0d110ef3295a2f2f4acb5995 (patch) | |
tree | 6654f07da71d3e4e41722bf525ca3ec088b81e35 /src | |
parent | 81299b5c4ec66f76eea0a0a368b586ff65b49170 (diff) | |
download | pfsense-39aa6d811938b42e0d110ef3295a2f2f4acb5995.zip pfsense-39aa6d811938b42e0d110ef3295a2f2f4acb5995.tar.gz |
Revert "Remove unused file browser.php"
This reverts commit 8dee84f4cef55a2f008a319022a762b92e00117e.
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/pfSense.obsoletedfiles | 1 | ||||
-rw-r--r-- | src/usr/local/www/vendor/filebrowser/browser.php | 164 |
2 files changed, 164 insertions, 1 deletions
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles index 4f8ff61..ff07481 100644 --- a/src/etc/pfSense.obsoletedfiles +++ b/src/etc/pfSense.obsoletedfiles @@ -933,7 +933,6 @@ /usr/local/www/tree-images /usr/local/www/treeview.css /usr/local/www/upload_progress.php -/usr/local/www/vendor/filebrowser/browser.php /usr/local/www/vpn_ipsec_ca.php /usr/local/www/vpn_ipsec_ca_edit.php /usr/local/www/vpn_ipsec_ca_edit_create_cert.php diff --git a/src/usr/local/www/vendor/filebrowser/browser.php b/src/usr/local/www/vendor/filebrowser/browser.php new file mode 100644 index 0000000..54ab942 --- /dev/null +++ b/src/usr/local/www/vendor/filebrowser/browser.php @@ -0,0 +1,164 @@ +<?php + +require_once("guiconfig.inc"); + +/* + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + +*/ +// Fetch a list of directories and files inside a given directory +function get_content($dir) { + $dirs = array(); + $files = array(); + + clearstatcache(); + $fd = @opendir($dir); + + while ($entry = @readdir($fd)) { + if ($entry == ".") { + continue; + } + if ($entry == ".." && $dir == "/") { + continue; + } + if (is_dir("{$dir}/{$entry}")) { + array_push($dirs, $entry); + } else { + array_push($files, $entry); + } + } + + @closedir($fd); + + natsort($dirs); + natsort($files); + + return array($dirs, $files); +} + +$path = realpath(strlen($_GET['path']) > 0 ? $_GET['path'] : "/"); +if (is_file($path)) { + $path = dirname($path); +} + +// ----- header ----- +?> +<table width="100%"> + <tr> + <td class="fbHome text-left" width="25px"> + <img onClick="$('#fbTarget').val('<?=$realDir?>'); fbBrowse('/');" src="/vendor/filebrowser/images/icon_home.gif" alt="Home" title="Home" /> + </td> + <td><b><?=$path;?></b></td> + <td class="fbClose text-right"> + <img onClick="$('#fbBrowser').fadeOut();" border="0" src="/vendor/filebrowser/images/icon_cancel.gif" alt="Close" title="Close" /> + </td> + </tr> + <tr> + <td id="fbCurrentDir" colspan="3" class="vexpl text-left"> +<?php + +// ----- read contents ----- +if (is_dir($path)) { + list($dirs, $files) = get_content($path); +?> + + </td> + </tr> +<?php +} else { +?> + Directory does not exist. + </td> + </tr> +</table> +<?php + exit; +} + +// ----- directories ----- +foreach ($dirs as $dir): + $realDir = realpath("{$path}/{$dir}"); +?> + <tr> + <td></td> + <td class="fbDir vexpl text-left" id="<?=$realDir;?>"> + <div onClick="$('#fbTarget').val('<?=$realDir?>'); fbBrowse('<?=$realDir?>');"> + <img src="/vendor/filebrowser/images/folder_generic.gif" /> + <?=$dir;?> + </div> + </td> + <td></td> + </tr> +<?php +endforeach; + +// ----- files ----- +foreach ($files as $file): + $ext = strrchr($file, "."); + + switch ($ext) { + case ".css": + case ".html": + case ".xml": + $type = "code"; + break; + case ".rrd": + $type = "database"; + break; + case ".gif": + case ".jpg": + case ".png": + $type = "image"; + break; + case ".js": + $type = "js"; + break; + case ".pdf": + $type = "pdf"; + break; + case ".inc": + case ".php": + $type = "php"; + break; + case ".conf": + case ".pid": + case ".sh": + $type = "system"; + break; + case ".bz2": + case ".gz": + case ".tgz": + case ".zip": + $type = "zip"; + break; + default: + $type = "generic"; + } + + $fqpn = "{$path}/{$file}"; + + if (is_file($fqpn)) { + $fqpn = realpath($fqpn); + $size = sprintf("%.2f KiB", filesize($fqpn) / 1024); + } else { + $size = ""; + } + +?> + <tr> + <td></td> + <td class="fbFile vexpl text-left" id="<?=$fqpn;?>"> + <?php $filename = str_replace("//","/", "{$path}/{$file}"); ?> + <div onClick="$('#fbTarget').val('<?=$filename?>'); loadFile(); $('#fbBrowser').fadeOut();"> + <img src="/vendor/filebrowser/images/file_<?=$type;?>.gif" alt="" title=""> + <?=$file;?> + </div> + </td> + <td class="vexpl text-right"> + <?=$size;?> + </td> + </tr> +<?php +endforeach; +?> +</table> |