diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-08-30 23:38:15 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-08-30 23:38:15 +0000 |
commit | 9dd502adcb9998bd1cb5a7974a117fa8910d78ae (patch) | |
tree | bc4061d555d379f3f4113a75ac1f2067c63b4c88 /usr/local | |
parent | 0d6a185a727a8e68255e0b6687120bb5fa0bb643 (diff) | |
download | pfsense-9dd502adcb9998bd1cb5a7974a117fa8910d78ae.zip pfsense-9dd502adcb9998bd1cb5a7974a117fa8910d78ae.tar.gz |
Add missing files
Diffstat (limited to 'usr/local')
22 files changed, 175 insertions, 0 deletions
diff --git a/usr/local/www/filebrowser/browser.js b/usr/local/www/filebrowser/browser.js new file mode 100644 index 0000000..61b9e69 --- /dev/null +++ b/usr/local/www/filebrowser/browser.js @@ -0,0 +1,42 @@ +Event.observe( + window, "load", + function() { + Event.observe( + "fbOpen", "click", + function() { + Effect.Appear("fbBrowser", { duration: 0.75 }); + fbBrowse($("fbTarget").value); + } + ); + } +); + +function fbBrowse(path) { + if($("fbCurrentDir")) + $("fbCurrentDir").innerHTML = "Loading ..."; + + new Ajax.Request( + "/filebrowser/browser.php?path=" + encodeURI(path ? path : "/"), + { method: "get", onComplete: fbComplete } + ); +} + +function fbComplete(req) { + $("fbBrowser").innerHTML = req.responseText; + + var actions = { + fbHome: function() { fbBrowse("/"); }, + fbClose: function() { Effect.Fade("fbBrowser", { duration: 0.75 }); }, + fbDir: function() { fbBrowse(this.id); }, + fbFile: function() { $("fbTarget").value = this.id; } + } + + for(var type in actions) { + $A(Element.getElementsByClassName("fbBrowser", type)).each( + function(element) { + Event.observe(element, "click", actions[type]); + element.style.cursor = "pointer"; + } + ); + } +} diff --git a/usr/local/www/filebrowser/browser.php b/usr/local/www/filebrowser/browser.php new file mode 100644 index 0000000..f61bf92 --- /dev/null +++ b/usr/local/www/filebrowser/browser.php @@ -0,0 +1,133 @@ +<?php +// 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" width="25px" align="left"> + <img src="/filebrowser/images/icon_home.gif" alt="Home" title="Home" /> + </td> + <td></td> + <td class="fbClose" align="right"> + <img onClick="new Effect.Fade($('fbBrowser'));" border="0" src="/filebrowser/images/icon_cancel.gif" alt="Close" title="Close" /> + </td> + </tr> + <tr> + <td id="fbCurrentDir" colspan="3" class="vexpl" align="left"> +<?php + +// ----- read contents ----- +if(is_dir($path)) { + list($dirs, $files) = get_content($path); +?> + <?=$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" id="<?=$realDir;?>" align="left"> + <div onClick="$('fbTarget').value='<?=$realDir?>'; fbBrowse('<?=$realDir?>');"> + <img src="/filebrowser/images/folder_generic.gif" /> + <?=$dir;?> + </div> + </td> + <td></td> + </tr> +<?php +endforeach; + +// ----- files ----- +foreach($files as $file): + $ext = strrchr($file, "."); + + if($ext == ".css" ) $type = "code"; + elseif($ext == ".html") $type = "code"; + elseif($ext == ".xml" ) $type = "code"; + elseif($ext == ".rrd" ) $type = "database"; + elseif($ext == ".gif" ) $type = "image"; + elseif($ext == ".jpg" ) $type = "image"; + elseif($ext == ".png" ) $type = "image"; + elseif($ext == ".js" ) $type = "js"; + elseif($ext == ".pdf" ) $type = "pdf"; + elseif($ext == ".inc" ) $type = "php"; + elseif($ext == ".php" ) $type = "php"; + elseif($ext == ".conf") $type = "system"; + elseif($ext == ".pid" ) $type = "system"; + elseif($ext == ".sh" ) $type = "system"; + elseif($ext == ".bz2" ) $type = "zip"; + elseif($ext == ".gz" ) $type = "zip"; + elseif($ext == ".tgz" ) $type = "zip"; + elseif($ext == ".zip" ) $type = "zip"; + else $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" id="<?=$fqpn;?>" align="left"> + <div onClick="$('fbTarget').value='<?=$path?><?=$file?>'; loadFile(); new Effect.Fade($('fbBrowser'));"> + <img src="/filebrowser/images/file_<?=$type;?>.gif" alt="" title=""> + <?=$file;?> + </div> + </td> + <td align="right" class="vexpl"> + <?=$size;?> + </td> + </tr> +<?php +endforeach; +?> +</table> diff --git a/usr/local/www/filebrowser/images/file_code.gif b/usr/local/www/filebrowser/images/file_code.gif Binary files differnew file mode 100644 index 0000000..f06a205 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_code.gif diff --git a/usr/local/www/filebrowser/images/file_database.gif b/usr/local/www/filebrowser/images/file_database.gif Binary files differnew file mode 100644 index 0000000..d479c91 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_database.gif diff --git a/usr/local/www/filebrowser/images/file_doc.gif b/usr/local/www/filebrowser/images/file_doc.gif Binary files differnew file mode 100644 index 0000000..222c31b --- /dev/null +++ b/usr/local/www/filebrowser/images/file_doc.gif diff --git a/usr/local/www/filebrowser/images/file_flash.gif b/usr/local/www/filebrowser/images/file_flash.gif Binary files differnew file mode 100644 index 0000000..e565c37 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_flash.gif diff --git a/usr/local/www/filebrowser/images/file_generic.gif b/usr/local/www/filebrowser/images/file_generic.gif Binary files differnew file mode 100644 index 0000000..5f39482 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_generic.gif diff --git a/usr/local/www/filebrowser/images/file_image.gif b/usr/local/www/filebrowser/images/file_image.gif Binary files differnew file mode 100644 index 0000000..4960683 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_image.gif diff --git a/usr/local/www/filebrowser/images/file_js.gif b/usr/local/www/filebrowser/images/file_js.gif Binary files differnew file mode 100644 index 0000000..9b6601f --- /dev/null +++ b/usr/local/www/filebrowser/images/file_js.gif diff --git a/usr/local/www/filebrowser/images/file_pdf.gif b/usr/local/www/filebrowser/images/file_pdf.gif Binary files differnew file mode 100644 index 0000000..b01bb23 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_pdf.gif diff --git a/usr/local/www/filebrowser/images/file_php.gif b/usr/local/www/filebrowser/images/file_php.gif Binary files differnew file mode 100644 index 0000000..ab7f459 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_php.gif diff --git a/usr/local/www/filebrowser/images/file_ppt.gif b/usr/local/www/filebrowser/images/file_ppt.gif Binary files differnew file mode 100644 index 0000000..0383c98 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_ppt.gif diff --git a/usr/local/www/filebrowser/images/file_system.gif b/usr/local/www/filebrowser/images/file_system.gif Binary files differnew file mode 100644 index 0000000..f1997c7 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_system.gif diff --git a/usr/local/www/filebrowser/images/file_xls.gif b/usr/local/www/filebrowser/images/file_xls.gif Binary files differnew file mode 100644 index 0000000..d004013 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_xls.gif diff --git a/usr/local/www/filebrowser/images/file_zip.gif b/usr/local/www/filebrowser/images/file_zip.gif Binary files differnew file mode 100644 index 0000000..ec98255 --- /dev/null +++ b/usr/local/www/filebrowser/images/file_zip.gif diff --git a/usr/local/www/filebrowser/images/folder_generic.gif b/usr/local/www/filebrowser/images/folder_generic.gif Binary files differnew file mode 100644 index 0000000..45b191d --- /dev/null +++ b/usr/local/www/filebrowser/images/folder_generic.gif diff --git a/usr/local/www/filebrowser/images/icon_cancel.gif b/usr/local/www/filebrowser/images/icon_cancel.gif Binary files differnew file mode 100644 index 0000000..246a819 --- /dev/null +++ b/usr/local/www/filebrowser/images/icon_cancel.gif diff --git a/usr/local/www/filebrowser/images/icon_contract.gif b/usr/local/www/filebrowser/images/icon_contract.gif Binary files differnew file mode 100644 index 0000000..cf82159 --- /dev/null +++ b/usr/local/www/filebrowser/images/icon_contract.gif diff --git a/usr/local/www/filebrowser/images/icon_expand.gif b/usr/local/www/filebrowser/images/icon_expand.gif Binary files differnew file mode 100644 index 0000000..06c0c68 --- /dev/null +++ b/usr/local/www/filebrowser/images/icon_expand.gif diff --git a/usr/local/www/filebrowser/images/icon_home.gif b/usr/local/www/filebrowser/images/icon_home.gif Binary files differnew file mode 100644 index 0000000..f888434 --- /dev/null +++ b/usr/local/www/filebrowser/images/icon_home.gif diff --git a/usr/local/www/filebrowser/images/icon_left.gif b/usr/local/www/filebrowser/images/icon_left.gif Binary files differnew file mode 100644 index 0000000..0d1137c --- /dev/null +++ b/usr/local/www/filebrowser/images/icon_left.gif diff --git a/usr/local/www/filebrowser/images/icon_magnifier.gif b/usr/local/www/filebrowser/images/icon_magnifier.gif Binary files differnew file mode 100644 index 0000000..e96e548 --- /dev/null +++ b/usr/local/www/filebrowser/images/icon_magnifier.gif |