From 17caa109011938ca533d5c7bb7cfa38606c0645e Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 00:12:54 +0200 Subject: Rename config.tmp to config.php --- config/filemgr/rbfminc/config.php | 95 +++++++++++++++++++++++++++++++++++++++ config/filemgr/rbfminc/config.tmp | 95 --------------------------------------- 2 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 config/filemgr/rbfminc/config.php delete mode 100644 config/filemgr/rbfminc/config.tmp (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/config.php b/config/filemgr/rbfminc/config.php new file mode 100644 index 00000000..405514f8 --- /dev/null +++ b/config/filemgr/rbfminc/config.php @@ -0,0 +1,95 @@ +Security issue: Please change your username or password"; +//} +$security_issues = "
"; +?> 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 @@ -Security issue: Please change your username or password"; -//} -$security_issues = "
"; -?> -- cgit v1.2.3 From af566daf06605f67b6cc9e60906ff7690134526f Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 00:14:51 +0200 Subject: Rename download.tmp to download.php --- config/filemgr/rbfminc/download.php | 49 +++++++++++++++++++++++++++++++++++++ config/filemgr/rbfminc/download.tmp | 49 ------------------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) create mode 100644 config/filemgr/rbfminc/download.php delete mode 100644 config/filemgr/rbfminc/download.tmp (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/download.php b/config/filemgr/rbfminc/download.php new file mode 100644 index 00000000..172ec896 --- /dev/null +++ b/config/filemgr/rbfminc/download.php @@ -0,0 +1,49 @@ + 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 @@ - \ No newline at end of file -- cgit v1.2.3 From c0f717ffab5beb2206d21d1107077a55f34c8f94 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 00:15:38 +0200 Subject: Rename functions.tmp to functions.php --- config/filemgr/rbfminc/functions.php | 189 +++++++++++++++++++++++++++++++++++ config/filemgr/rbfminc/functions.tmp | 189 ----------------------------------- 2 files changed, 189 insertions(+), 189 deletions(-) create mode 100644 config/filemgr/rbfminc/functions.php delete mode 100644 config/filemgr/rbfminc/functions.tmp (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/functions.php b/config/filemgr/rbfminc/functions.php new file mode 100644 index 00000000..8dffd5e4 --- /dev/null +++ b/config/filemgr/rbfminc/functions.php @@ -0,0 +1,189 @@ + '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 @@ - '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 -- cgit v1.2.3 From 5444a37af5a09032bd4332f64423787c2473cb8f Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 00:16:09 +0200 Subject: Rename rename.tmp to rename.php --- config/filemgr/rbfminc/rename.php | 41 +++++++++++++++++++++++++++++++++++++++ config/filemgr/rbfminc/rename.tmp | 41 --------------------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 config/filemgr/rbfminc/rename.php delete mode 100644 config/filemgr/rbfminc/rename.tmp (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/rename.php b/config/filemgr/rbfminc/rename.php new file mode 100644 index 00000000..5a2096ca --- /dev/null +++ b/config/filemgr/rbfminc/rename.php @@ -0,0 +1,41 @@ + + + +Rename + + + + + + 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 @@ - - - -Rename - - - - - - \ No newline at end of file -- cgit v1.2.3 From d97ed5ab8182728c78b03ab6ea94d57effa7722a Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 00:16:37 +0200 Subject: Rename session.tmp to session.php --- config/filemgr/rbfminc/session.php | 32 ++++++++++++++++++++++++++++++++ config/filemgr/rbfminc/session.tmp | 32 -------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 config/filemgr/rbfminc/session.php delete mode 100644 config/filemgr/rbfminc/session.tmp (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/session.php b/config/filemgr/rbfminc/session.php new file mode 100644 index 00000000..7cfc133d --- /dev/null +++ b/config/filemgr/rbfminc/session.php @@ -0,0 +1,32 @@ + 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 @@ - -- cgit v1.2.3 From 98bcc4f2a0f9864ea3d80955eb3fe003b0e1b677 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 15:33:54 +0200 Subject: config.php - code style fixes --- config/filemgr/rbfminc/config.php | 100 ++++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 36 deletions(-) (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/config.php b/config/filemgr/rbfminc/config.php index 405514f8..776abf58 100644 --- a/config/filemgr/rbfminc/config.php +++ b/config/filemgr/rbfminc/config.php @@ -1,29 +1,56 @@ + 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: -$initial_folder = "/"; //initial folder -$only_below = 0; // 0=you can brows all server; 1=you can brows only the $initial_folder and below + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. -//Login info {Please change the initial username and password} -$username = 'admin'; -$password = 'admin'; + 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'; -/***********************************/ -// Protect against GLOBALS tricks -if (isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_GET['GLOBALS']) || isset($_COOKIE['GLOBALS'])){ +/* ==================================== */ +/* 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)){ +if (isset($_SESSION) && !is_array($_SESSION)) { die("Hacking attempt"); } -if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on'){ +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)){ + if (!isset($_SESSION) || !is_array($_SESSION)) { $_SESSION = array(); } $input = array_merge($_GET, $_POST, $_COOKIE, $HTTP_SERVER_VARS, $_SESSION, $HTTP_ENV_VARS, $_FILES); @@ -31,8 +58,8 @@ if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals unset($input['input']); unset($input['not_unset']); - while (list($var,) = @each($input)){ - if (in_array($var, $not_unset)){ + while (list($var,) = @each($input)) { + if (in_array($var, $not_unset)) { die('Hacking attempt!'); } unset($$var); @@ -41,55 +68,56 @@ if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals 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]) ){ +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{ + } 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]) ){ + 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{ + } 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]) ){ + 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{ + } else { $_COOKIE[$k] = addslashes($v); } } @reset($_COOKIE); } } -//END Protect against GLOBALS tricks -/***********************************/ -//if($username == 'admin' and $password == 'admin'){ - //$security_issues = "
Security issue: Please change your username or password
"; -//} +/* END Protect against GLOBALS tricks */ +/* ==================================== */ + +/* +if ($username == 'admin' and $password == 'admin') { + $security_issues = "
Security issue: Please change your username or password
"; +} +*/ $security_issues = "
"; ?> -- cgit v1.2.3 From 81b0f0d2b3b72dc8f092bd83538f353bb1a266ea Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 15:43:22 +0200 Subject: download.php - code style fixes --- config/filemgr/rbfminc/download.php | 76 +++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 28 deletions(-) (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/download.php b/config/filemgr/rbfminc/download.php index 172ec896..88ff1788 100644 --- a/config/filemgr/rbfminc/download.php +++ b/config/filemgr/rbfminc/download.php @@ -1,29 +1,54 @@ + 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 +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 +header("Pragma: no-cache"); + +// Gets the parameters $_GET['file_name'] = urldecode($_GET['file_name']); $_GET['p'] = urldecode($_GET['p']); -//Check Authentication + +// 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']){ +$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']); + 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)); @@ -31,19 +56,14 @@ if ($candownload) flush(); readfile($filepath); exit; + } else { + echo "File not found"; } - else - { - echo("File not found"); - } - } - else - { - echo("File Unknown"); + } else { + echo "File Unknown"; } +} else { + echo "Session Expired"; } -else -{ - echo("Session Expired"); -} + ?> -- cgit v1.2.3 From 61d5ab638e42232bf4bc22a2e2074f152f6a47d7 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 16:04:20 +0200 Subject: functions.php - code style fixes --- config/filemgr/rbfminc/functions.php | 174 +++++++++++++++++++++-------------- 1 file changed, 103 insertions(+), 71 deletions(-) (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/functions.php b/config/filemgr/rbfminc/functions.php index 8dffd5e4..bab912a7 100644 --- a/config/filemgr/rbfminc/functions.php +++ b/config/filemgr/rbfminc/functions.php @@ -1,118 +1,149 @@ + 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 (is_dir($value)) { + RecursiveFolderDelete($value); + } elseif (is_file($value)) { + @unlink($value); } } } - if(!@rmdir ( $folderPath )){ + if (!@rmdir($folderPath)) { return FALSE; - }else{ + } else { return TRUE; } - } - else - { + } 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; -} + $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']) ) + 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]) ){ + if (isset($wp_filter[$tag])) { reset($wp_filter[$tag]); uksort($wp_filter[$tag], "strnatcasecmp"); } - $merged_filters[ $tag ] = true; + $merged_filters[$tag] = true; } - function apply_filters($tag, $string) { global $wp_filter, $merged_filters; - if ( !isset( $merged_filters[ $tag ] ) ) + if (!isset($merged_filters[$tag])) { merge_filters($tag); + } - if ( !isset($wp_filter[$tag]) ) + if (!isset($wp_filter[$tag])) { return $string; + } - reset( $wp_filter[ $tag ] ); + reset($wp_filter[$tag]); $args = func_get_args(); - do{ - foreach( (array) current($wp_filter[$tag]) as $the_ ) - if ( !is_null($the_['function']) ){ + 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 ); + } 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 ( + $mimes = is_array($mimes) ? $mimes : apply_filters('upload_mimes', array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', @@ -165,7 +196,7 @@ function wp_check_filetype($filename, $mimes = null) { foreach ($mimes as $ext_preg => $mime_match) { $ext_preg = '!\.(' . $ext_preg . ')$!i'; - if ( preg_match($ext_preg, $filename, $ext_matches) ) { + if (preg_match($ext_preg, $filename, $ext_matches)) { $type = $mime_match; $ext = $ext_matches[1]; break; @@ -177,13 +208,14 @@ function wp_check_filetype($filename, $mimes = null) { -function roundsize($size){ +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]); + $size=$size/1024; + $i++; + } + return(round($size, 1) . " " . $iec[$i]); } ?> -- cgit v1.2.3 From f485cfb1c4ffc973f1c09074c3fb025e8f522285 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 16:12:34 +0200 Subject: rename.php - code style fixes --- config/filemgr/rbfminc/rename.php | 51 ++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/rename.php b/config/filemgr/rbfminc/rename.php index 5a2096ca..27553f18 100644 --- a/config/filemgr/rbfminc/rename.php +++ b/config/filemgr/rbfminc/rename.php @@ -1,12 +1,39 @@ + Copyright (C) 2015 ESF, LLC + All rights reserved. -if($user_login == 'ok'){ + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - include "functions.php"; + 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"); ?> + Rename @@ -15,19 +42,18 @@ if($user_login == 'ok'){ + -- cgit v1.2.3 From cad6ed23f5dfb5145beaf4f224121c731fb1097c Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 16:17:05 +0200 Subject: session.php - code style fixes --- config/filemgr/rbfminc/session.php | 48 +++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'config/filemgr/rbfminc') diff --git a/config/filemgr/rbfminc/session.php b/config/filemgr/rbfminc/session.php index 7cfc133d..b616643f 100644 --- a/config/filemgr/rbfminc/session.php +++ b/config/filemgr/rbfminc/session.php @@ -1,17 +1,43 @@ + 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(); - -/*************************************************************************************************/ -//create session -if($_POST['login'] == 'login' and $_POST['username'] and $_POST['password']){ +if (($_POST['login'] == 'login') && ($_POST['username']) && ($_POST['password'])) { $_SESSION = array(); - $_SESSION['username']=$_POST['username']; - $_SESSION['password']=$_POST['password']; + $_SESSION['username'] = $_POST['username']; + $_SESSION['password'] = $_POST['password']; } -if($_GET['logout'] == "logout"){ +if ($_GET['logout'] == "logout") { setcookie('url_field', '', time()-3600); setcookie('current_folder', '', time()-3600); $_SESSION = array(); @@ -21,11 +47,11 @@ if($_GET['logout'] == "logout"){ } -if($_SESSION['username'] and $_SESSION['password']){ - if($_SESSION['username'] == $username and $_SESSION['password'] == $password){ +if (($_SESSION['username']) && ($_SESSION['password'])) { + if (($_SESSION['username'] == $username) && ($_SESSION['password'] == $password)) { $user_login = 'ok'; - }else{ - $error_message = "Incorect username or password!"; + } else { + $error_message = "Incorrect username or password!"; } } -- cgit v1.2.3