0)
{
$pct = round(( $kbytes / $totalsize ) * 100, 2);
}
else
{
$pct = get_lang("unavailable");
}
#echo "Percent is $pct";
return "$totalsize;$mbytes;$pct";
}
return "0;0;0";
}
function show_back($home_id)
{
if( isset($_SESSION['fm_cwd_'.$home_id]) && preg_match("/^\/*$/",$_SESSION['fm_cwd_'.$home_id]) == 0 )
return "
| .. ".get_lang("level_up")." |
";
}
function litefm_check($home_id)
{
if (isset($_GET['item']) and !isset($_GET['upload']) and !isset( $_POST['delete'] ) and !isset( $_POST['create_folder'] ) and !isset( $_POST['secureButton'] ) and !isset( $_POST['delete_check'] ) and !isset( $_POST['secure_check'] ))
{
$fileName = !empty($_POST['name']) ? litefm_decode_name_param($_POST['name']) : litefm_decode_name_param(isset($_GET['name']) ? $_GET['name'] : '');
if (!litefm_is_valid_path_component($fileName))
{
print_failure("Path decode failed");
return FALSE;
}
if(isset($_GET['type'])){
$type = $_GET['type'];
}else{
$type = "file";
}
if(!isset($_SESSION['fm_files_'.$home_id][$_GET['item']]))
return FALSE;
$path = $_SESSION['fm_files_'.$home_id][$_GET['item']];
if($path == $fileName){
if($type != "file"){
$nextPath = trim((string)@$_SESSION['fm_cwd_'.$home_id], '/');
$nextPath = $nextPath === '' ? $path : $nextPath . '/' . $path;
$normalizedNext = litefm_normalize_relative_path($nextPath);
if($normalizedNext === false)
{
print_failure(get_lang("unallowed_char"));
$_SESSION['fm_cwd_'.$home_id] = NULL;
return FALSE;
}
$_SESSION['fm_cwd_'.$home_id] = $normalizedNext;
}else{
if((isset($_SESSION['fm_cwd_'.$home_id]) and !endsWith($_SESSION['fm_cwd_'.$home_id], $path)) or !isset($_SESSION['fm_cwd_'.$home_id])){
$nextPath = trim((string)@$_SESSION['fm_cwd_'.$home_id], '/');
$nextPath = $nextPath === '' ? $path : $nextPath . '/' . $path;
$normalizedNext = litefm_normalize_relative_path($nextPath);
if($normalizedNext === false)
{
print_failure(get_lang("unallowed_char"));
$_SESSION['fm_cwd_'.$home_id] = NULL;
return FALSE;
}
$_SESSION['fm_cwd_'.$home_id] = $normalizedNext;
}
}
}
}
// To go back a dir, we just use dirname to strip the last directory or file off the path
if (isset($_GET['back']) and !isset($_GET['upload']) and !isset( $_POST['delete'] ) and !isset( $_POST['create_folder'] ) and !isset( $_POST['secureButton'] ) and !isset( $_POST['delete_check'] ) and !isset( $_POST['secure_check'] ))
{
$_SESSION['fm_cwd_'.$home_id] = dirname( $_SESSION['fm_cwd_'.$home_id] );
}
return TRUE;
}
?>