diff options
author | Tom Schaefer <tom@tomschaefer.org> | 2010-07-26 11:55:01 -0400 |
---|---|---|
committer | Tom Schaefer <tom@tomschaefer.org> | 2010-07-26 11:55:01 -0400 |
commit | df7c02eb588a9a5f4b14401ea9bde564132b4e0e (patch) | |
tree | cb3f412ec78ae8b97ac5a245338f407eba4fbd90 /config/filemgr/rbfminc | |
parent | 0e9d556a1c497f9f3bf52e710447541325d69ec6 (diff) | |
download | pfsense-packages-df7c02eb588a9a5f4b14401ea9bde564132b4e0e.tar.gz pfsense-packages-df7c02eb588a9a5f4b14401ea9bde564132b4e0e.tar.bz2 pfsense-packages-df7c02eb588a9a5f4b14401ea9bde564132b4e0e.zip |
Add filemgr package
new file: config/filemgr/file_manager.tmp
new file: config/filemgr/filemgr.inc
new file: config/filemgr/filemgr.xml
new file: config/filemgr/index.tmp
new file: config/filemgr/rbfmimg/bg_footer.png
new file: config/filemgr/rbfmimg/bg_header.png
new file: config/filemgr/rbfmimg/bg_page.png
new file: config/filemgr/rbfmimg/file_editor_bg.png
new file: config/filemgr/rbfmimg/folder.png
new file: config/filemgr/rbfmimg/folder_go.png
new file: config/filemgr/rbfmimg/folder_up.png
new file: config/filemgr/rbfmimg/go.png
new file: config/filemgr/rbfmimg/ico_delete.png
new file: config/filemgr/rbfmimg/ico_download.png
new file: config/filemgr/rbfmimg/ico_file.png
new file: config/filemgr/rbfmimg/ico_html.png
new file: config/filemgr/rbfmimg/ico_open_as_web.png
new file: config/filemgr/rbfmimg/ico_php.png
new file: config/filemgr/rbfmimg/ico_picture.png
new file: config/filemgr/rbfmimg/ico_rename.png
new file: config/filemgr/rbfmimg/ico_script_edit.png
new file: config/filemgr/rbfmimg/ico_use_file.png
new file: config/filemgr/rbfmimg/ico_use_file_inactive.png
new file: config/filemgr/rbfmimg/index.html
new file: config/filemgr/rbfmimg/new.png
new file: config/filemgr/rbfminc/config.tmp
new file: config/filemgr/rbfminc/download.tmp
new file: config/filemgr/rbfminc/file_editor_style.css
new file: config/filemgr/rbfminc/functions.tmp
new file: config/filemgr/rbfminc/index.html
new file: config/filemgr/rbfminc/rename.tmp
new file: config/filemgr/rbfminc/session.tmp
modified: pkg_config.7.xml
modified: pkg_config.8.xml
new file: pkg_config.8.xml.amd64~
Diffstat (limited to 'config/filemgr/rbfminc')
-rw-r--r-- | config/filemgr/rbfminc/config.tmp | 95 | ||||
-rw-r--r-- | config/filemgr/rbfminc/download.tmp | 22 | ||||
-rw-r--r-- | config/filemgr/rbfminc/file_editor_style.css | 148 | ||||
-rw-r--r-- | config/filemgr/rbfminc/functions.tmp | 189 | ||||
-rw-r--r-- | config/filemgr/rbfminc/index.html | 0 | ||||
-rw-r--r-- | config/filemgr/rbfminc/rename.tmp | 38 | ||||
-rw-r--r-- | config/filemgr/rbfminc/session.tmp | 32 |
7 files changed, 524 insertions, 0 deletions
diff --git a/config/filemgr/rbfminc/config.tmp b/config/filemgr/rbfminc/config.tmp new file mode 100644 index 00000000..47a7563a --- /dev/null +++ b/config/filemgr/rbfminc/config.tmp @@ -0,0 +1,95 @@ +<?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 />"; +?>
\ No newline at end of file diff --git a/config/filemgr/rbfminc/download.tmp b/config/filemgr/rbfminc/download.tmp new file mode 100644 index 00000000..232e90d0 --- /dev/null +++ b/config/filemgr/rbfminc/download.tmp @@ -0,0 +1,22 @@ +<?php +include "config.php"; +include "session.php"; + +if($user_login == 'ok'){ + + include "functions.php"; + + $_GET['file_name'] = urldecode($_GET['file_name']); + $_GET['p'] = urldecode($_GET['p']); + + if($_GET['file_name'] and $_GET['p']){ + if(file_exists($_GET['p'].$_GET['file_name'])){ + $file = file_get_contents($_GET['p'].$_GET['file_name']); + $type = wp_check_filetype($_GET['file_name']); + header('Content-type: {$type[type]}'); + header('Content-Disposition: attachment; filename="'.$_GET['file_name'].'"'); + echo $file; + } + } +} +?>
\ No newline at end of file diff --git a/config/filemgr/rbfminc/file_editor_style.css b/config/filemgr/rbfminc/file_editor_style.css new file mode 100644 index 00000000..93b34ca7 --- /dev/null +++ b/config/filemgr/rbfminc/file_editor_style.css @@ -0,0 +1,148 @@ +@charset "utf-8"; +/* CSS Document */ + +body,td,th { + font-family: Arial, Helvetica, sans-serif; + + color: #000000; +} + +body { + background-color: #999999; +} + +img { + vertical-align: middle; +} +.file_editor { + width: 710px; + /*height: 410px;*/ + margin: 0px auto; + padding: 0px; + background: url(../rbfmimg/bg_page.png) repeat-y center top; +} +.file_editor .header { + height: 35px; + margin: 0px 0px 3px; + padding: 0px; + background: url(../rbfmimg/bg_header.png) repeat-y center top; +} +.file_editor .footer { + background: url(../rbfmimg/bg_footer.png) no-repeat center bottom; + height: 12px; +} +.file_editor .header .close { + width: 41px; + height: 17px; + margin: 5px 0px 0px 645px; + padding: 0px; + cursor:pointer; +} +.file_editor #path { + margin: 0px auto; + padding: 0px; + width: 670px; + height: 20px; +} +.file_editor #path #location { + width: 625px; + vertical-align: middle; + border-top: 1px solid #878787; + border-right: 1px solid #878787; + border-bottom: 1px solid #878787; + border-left: 2px solid #878787; + padding-left: 2px; +} +.file_editor #path #go { + vertical-align: middle; + cursor:pointer; +} +.file_editor .container { + margin: 5px auto; + padding: 5px; + height: 280px; + overflow: auto; + position: relative; + border: 1px solid #878787; + width: 670px; +} +.file_editor .container .list tr td{ + cursor: default; + white-space: nowrap; + padding-right: 5px; + height: 20px; + text-align: left; + vertical-align: top; + padding-left: 5px; +} +.file_editor .container .list tr th{ + cursor: default; + text-align: left; + background: #f0f0f0; +} +.file_editor .container .list tr{ + background: #FFFFFF; +} +.file_editor .container .list tr:hover { + background: #9AE6FC; +} +.rename_field { + display:none; + margin: 0px; + padding: 0px; +} +.rename_field .input_name { + background: #FFFFFF; + width: 99%; + border-top: 1px solid #666666; + border-right: 1px solid #CCCCCC; + border-bottom: 1px solid #CCCCCC; + border-left: 1px solid #666666; + margin: 0px; + padding: 0px; + font: 11px Arial, Helvetica, sans-serif; +} +.column1 { + margin: 0px; + padding: 0px; + height: 20px; + width: 16px; +} +.file_editor .results { + height: 0px; + display: none; + width: 0px; + border-top: none; + border-right: none; + border-bottom: none; + border-left: none; + margin: 0px; + padding: 0px; +} +.fileperms{ + font-family: "Courier New", Courier, monospace; +} +.form_upload{ + display: block; + padding: 5px; + background: #C6EBFD; + text-align: left; + border: 1px solid #878787; + width: 670px; + margin: 3px auto; +} +.form_upload input{ + vertical-align: middle; +} +.url_path { + margin-left: 20px; +} +.file_editor .header .logout { + float: right; + margin-top: 5px; + padding-right: 15px; + color: #FF0000; +} +.file_editor .header .logout a{ + color: #FF0000; +} diff --git a/config/filemgr/rbfminc/functions.tmp b/config/filemgr/rbfminc/functions.tmp new file mode 100644 index 00000000..f06ee69c --- /dev/null +++ b/config/filemgr/rbfminc/functions.tmp @@ -0,0 +1,189 @@ +<?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/index.html b/config/filemgr/rbfminc/index.html new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/config/filemgr/rbfminc/index.html diff --git a/config/filemgr/rbfminc/rename.tmp b/config/filemgr/rbfminc/rename.tmp new file mode 100644 index 00000000..6d56c449 --- /dev/null +++ b/config/filemgr/rbfminc/rename.tmp @@ -0,0 +1,38 @@ +<?php +include "config.php"; +include "session.php"; + +if($user_login == 'ok'){ + + include "functions.php"; + +?><html> +<head> +<title>Rename</title> +</head> +<body> +<script language="javascript"> +<? +//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.tmp b/config/filemgr/rbfminc/session.tmp new file mode 100644 index 00000000..8f3a666e --- /dev/null +++ b/config/filemgr/rbfminc/session.tmp @@ -0,0 +1,32 @@ +<?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!"; + } +} + +?>
\ No newline at end of file |