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 | |
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')
32 files changed, 1524 insertions, 0 deletions
diff --git a/config/filemgr/file_manager.tmp b/config/filemgr/file_manager.tmp new file mode 100644 index 00000000..c4bcaa19 --- /dev/null +++ b/config/filemgr/file_manager.tmp @@ -0,0 +1,595 @@ +<?php +include "rbfminc/config.php"; +//include "rbfminc/session.php"; +require_once('config.inc'); + require("guiconfig.inc"); + 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%\"> + <tr> + <th style='padding:0;width:18px'> </th> + <th>Name</th> + <!--<th> </th>--> + <th> </th> + <th> </th> + <th> </th> + <th> </th> + <th> </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 = " "; + $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=\"form{$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' onsubmit=\"this.n.blur(); return false\" /> + </form> + </td> + <!--<td>{$use_url}</td>--> + <td>{$browser}</td> + <td> </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> </td> + <td> + <img width='16' height='16' + src='rbfmimg/ico_delete.png' + alt='D' + title='Delete' + onclick=\" + if( + confirm('Delete folder "{$v}"?') && + confirm('You cannot undo this operation!!!') && + confirm('To delete this folder "{$v}" press OK\\nTo cancel this operation press CANCEL') + ){ + document.location = 'file_manager.php?p=".urlencode($current_folder)."&do=delete&file=".urlencode($v)."&type=directory' + } + \" + /> + </td> + <td class='srow'> </td> + <td><b><DIR></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)."&f=".urlencode($v)."&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 = " "; + } + + $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 = " "; + $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)."&file_name=".urlencode($v)."'\" /> + </td> + <td> + <div style='padding-top:2px;' + id='f{$id}' + ondblclick=\"document.location = 'rbfminc/download.php?p=".urlencode($current_folder)."&file_name=".urlencode($v)."'\" + > + {$v} + </div> + + <form + class='rename_field' + id='r{$id}' + name=\"form{$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' onsubmit=\"this.n.blur(); return false\" /> + </form> + </td> + <!--<td>{$use_url}</td>--> + <td>{$browser}</td> + <td> + <a href='rbfminc/download.php?p=".urlencode($current_folder)."&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 "{$v}"?') && + confirm('You cannot undo this operation!!!') && + confirm('To delete this file "{$v}" press OK\\nTo cancel this operation press CANCEL') + ){ + document.location = 'file_manager.php?p=".urlencode($current_folder)."&do=delete&file=".urlencode($v)."&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); + +?> + +<!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"> + +<head> +<?php include("fbegin.inc"); ?> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>File editor</title> + +<link href="rbfminc/file_editor_style.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<?php echo $security_issues; ?> +<div class="file_editor"> + <div class="header"> + + </div> + <form id="path" name="path" method="get" action="" class="path"> + <input type="text" name="p" id="location" value="<?php echo $current_folder; ?>" /> + <img src="rbfmimg/go.png" name="go" width="35" height="18" id="go" alt="go" title="go" /> + </form> + <div class="url_path">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" /> + + <input name="replace_file" type="checkbox" value="1" /> + Replace existing file + <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_upload" id="form_upload" class="form_upload"> + Create new folder here; Folder name: + <input name="folder_name" type="text" style="width:290px" /> + <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" /> OPEN IN BROWSER ] + [ <img src="rbfmimg/ico_download.png" width="16" height="16" align="middle" /> DOWNLOAD ] + [ <img src="rbfmimg/ico_rename.png" width="16" height="16" align="middle" /> RENAME ] + [ <img src="rbfmimg/ico_script_edit.png" width="16" height="16" align="middle" /> VIEW/EDIT ] + [ <img src="rbfmimg/ico_delete.png" width="16" height="16" align="middle" /> 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=\"\" rows=\"\" 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> +<?php +if($alert_info){ + echo " +<script language=\"javascript\"> + alert('{$alert_info}'); +</script> + "; +} +if($redirect){ + echo " +<script language=\"javascript\"> + document.location = '{$redirect}'; +</script> + "; +} +?> +<?php include("fend.inc"); ?> +</body> +</html> +<?php +}else{ +?> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>Login</title> +<style type="text/css"> +<!-- +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"> + <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 »" /></td> + </tr> + </table> + <input name="login" type="hidden" value="login" /> + </form> +</div> +</body> +</html> + + +<?php +} +?>
\ No newline at end of file diff --git a/config/filemgr/filemgr.inc b/config/filemgr/filemgr.inc new file mode 100644 index 00000000..9e8539ba --- /dev/null +++ b/config/filemgr/filemgr.inc @@ -0,0 +1,154 @@ +<?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() +{ + global $config; +} + + +function php_install_command() +{ + + global $config; + conf_mount_rw(); + config_lock(); + + 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(); + config_unlock(); +} + + +function deinstall_command() +{ + 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(); +} + +?>
\ No newline at end of file diff --git a/config/filemgr/filemgr.xml b/config/filemgr/filemgr.xml new file mode 100644 index 00000000..0082fc29 --- /dev/null +++ b/config/filemgr/filemgr.xml @@ -0,0 +1,240 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + filemgr.xml + + 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. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>PHP File Manager</description> + <requirements>none</requirements> + <faq>http://forum.pfsense.org/index.php/topic,26974.0.html</faq> + <name>File Manager</name> + <version>0.1.0</version> + <title>Settings</title> + <include_file>/usr/local/pkg/filemgr.inc</include_file> + <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> + <url>/packages/filemgr/file_manager.php</url> + <active/> + </tab> + </tabs> + <configpath>installedpackages->package->$packagename->configuration->filemgr</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/filemgr.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/filemgr.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/file_manager.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/index.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/bg_footer.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/bg_header.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/bg_page.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/file_editor_bg.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/folder.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/folder_go.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/folder_up.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/go.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_delete.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_download.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_file.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_html.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_open_as_web.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_php.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_picture.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_rename.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_script_edit.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_use_file.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/ico_use_file_inactive.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/index.html</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfmimg/new.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfminc/config.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfminc/download.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfminc/file_editor_style.css</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfminc/functions.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfminc/index.html</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/filemgr/rbfminc/rename.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/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(); + </custom_php_resync_config_command> + <custom_delete_php_command> + php_sync_package(); + </custom_delete_php_command> + <custom_php_install_command> + php_install_command(); + </custom_php_install_command> + <custom_php_deinstall_command> + deinstall_command(); + </custom_php_deinstall_command> +</packagegui>
\ No newline at end of file diff --git a/config/filemgr/index.tmp b/config/filemgr/index.tmp new file mode 100644 index 00000000..7c768af6 --- /dev/null +++ b/config/filemgr/index.tmp @@ -0,0 +1,11 @@ +<html> +<HEAD> +<SCRIPT language="JavaScript"> +<!-- +window.parent.location="../../index.php"; +//--> +</SCRIPT> +</HEAD> + + +</html>
\ No newline at end of file diff --git a/config/filemgr/rbfmimg/bg_footer.png b/config/filemgr/rbfmimg/bg_footer.png Binary files differnew file mode 100644 index 00000000..0f4b93d7 --- /dev/null +++ b/config/filemgr/rbfmimg/bg_footer.png diff --git a/config/filemgr/rbfmimg/bg_header.png b/config/filemgr/rbfmimg/bg_header.png Binary files differnew file mode 100644 index 00000000..7c520393 --- /dev/null +++ b/config/filemgr/rbfmimg/bg_header.png diff --git a/config/filemgr/rbfmimg/bg_page.png b/config/filemgr/rbfmimg/bg_page.png Binary files differnew file mode 100644 index 00000000..ed260257 --- /dev/null +++ b/config/filemgr/rbfmimg/bg_page.png diff --git a/config/filemgr/rbfmimg/file_editor_bg.png b/config/filemgr/rbfmimg/file_editor_bg.png Binary files differnew file mode 100644 index 00000000..7ff27977 --- /dev/null +++ b/config/filemgr/rbfmimg/file_editor_bg.png diff --git a/config/filemgr/rbfmimg/folder.png b/config/filemgr/rbfmimg/folder.png Binary files differnew file mode 100644 index 00000000..784e8fa4 --- /dev/null +++ b/config/filemgr/rbfmimg/folder.png diff --git a/config/filemgr/rbfmimg/folder_go.png b/config/filemgr/rbfmimg/folder_go.png Binary files differnew file mode 100644 index 00000000..34a736f7 --- /dev/null +++ b/config/filemgr/rbfmimg/folder_go.png diff --git a/config/filemgr/rbfmimg/folder_up.png b/config/filemgr/rbfmimg/folder_up.png Binary files differnew file mode 100644 index 00000000..7985834d --- /dev/null +++ b/config/filemgr/rbfmimg/folder_up.png diff --git a/config/filemgr/rbfmimg/go.png b/config/filemgr/rbfmimg/go.png Binary files differnew file mode 100644 index 00000000..cd365c1e --- /dev/null +++ b/config/filemgr/rbfmimg/go.png diff --git a/config/filemgr/rbfmimg/ico_delete.png b/config/filemgr/rbfmimg/ico_delete.png Binary files differnew file mode 100644 index 00000000..e54630e1 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_delete.png diff --git a/config/filemgr/rbfmimg/ico_download.png b/config/filemgr/rbfmimg/ico_download.png Binary files differnew file mode 100644 index 00000000..8eda43bc --- /dev/null +++ b/config/filemgr/rbfmimg/ico_download.png diff --git a/config/filemgr/rbfmimg/ico_file.png b/config/filemgr/rbfmimg/ico_file.png Binary files differnew file mode 100644 index 00000000..5a492c28 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_file.png diff --git a/config/filemgr/rbfmimg/ico_html.png b/config/filemgr/rbfmimg/ico_html.png Binary files differnew file mode 100644 index 00000000..b0099161 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_html.png diff --git a/config/filemgr/rbfmimg/ico_open_as_web.png b/config/filemgr/rbfmimg/ico_open_as_web.png Binary files differnew file mode 100644 index 00000000..de95b9b7 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_open_as_web.png diff --git a/config/filemgr/rbfmimg/ico_php.png b/config/filemgr/rbfmimg/ico_php.png Binary files differnew file mode 100644 index 00000000..7868a259 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_php.png diff --git a/config/filemgr/rbfmimg/ico_picture.png b/config/filemgr/rbfmimg/ico_picture.png Binary files differnew file mode 100644 index 00000000..4a158fef --- /dev/null +++ b/config/filemgr/rbfmimg/ico_picture.png diff --git a/config/filemgr/rbfmimg/ico_rename.png b/config/filemgr/rbfmimg/ico_rename.png Binary files differnew file mode 100644 index 00000000..91ec290c --- /dev/null +++ b/config/filemgr/rbfmimg/ico_rename.png diff --git a/config/filemgr/rbfmimg/ico_script_edit.png b/config/filemgr/rbfmimg/ico_script_edit.png Binary files differnew file mode 100644 index 00000000..b4d31ce2 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_script_edit.png diff --git a/config/filemgr/rbfmimg/ico_use_file.png b/config/filemgr/rbfmimg/ico_use_file.png Binary files differnew file mode 100644 index 00000000..fdff9338 --- /dev/null +++ b/config/filemgr/rbfmimg/ico_use_file.png diff --git a/config/filemgr/rbfmimg/ico_use_file_inactive.png b/config/filemgr/rbfmimg/ico_use_file_inactive.png Binary files differnew file mode 100644 index 00000000..4aabc26e --- /dev/null +++ b/config/filemgr/rbfmimg/ico_use_file_inactive.png diff --git a/config/filemgr/rbfmimg/index.html b/config/filemgr/rbfmimg/index.html new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/config/filemgr/rbfmimg/index.html diff --git a/config/filemgr/rbfmimg/new.png b/config/filemgr/rbfmimg/new.png Binary files differnew file mode 100644 index 00000000..6a9bf037 --- /dev/null +++ b/config/filemgr/rbfmimg/new.png 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 |