Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
JAVA
/
system
:
fileSystemFunctions.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /*************************************************************** * Copyright notice * * (c) 2003-2004 Tobias Bender (tobias@phpXplorer.org) * All rights reserved * * This script is part of the phpXplorer project. The phpXplorer project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * A copy is found in the textfile GPL.txt distributed with these scripts. * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ function pxp_unlink($filename, $trash = true){ if($trash and strpos($filename, "trash.pxtf") === FALSE) addToTrash($filename); return unlink($filename); } function pxp_rmdir($dirname, $trash = true){ if($trash and strpos($dirname, "trash.pxtf") === FALSE) addToTrash($dirname); return rmdir($dirname); } $trash_index_handle = null; $trash_id = null; function addToTrash($file){ GLOBAL $PXP_user; GLOBAL $PXP_createUserFolder, $PXP_user_folder; GLOBAL $trash_index_handle; GLOBAL $trash_id; if($PXP_createUserFolder){ $pxtfDir = $PXP_user_folder . "/" . $PXP_user . "/trash.pxtf"; if(!file_exists($pxtfDir)) mkdir($pxtfDir, 0755); if(!$trash_id){ if(file_exists($PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/id.txt")){ $trash_id = (integer)implode("", file($PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/id.txt")); }else{ $handle = fopen($PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/id.txt", "w"); fwrite($handle, "0"); fclose($handle); $trash_id = 0; } } if(!$trash_index_handle) $trash_index_handle = fopen($PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/index.txt", "a"); fwrite($trash_index_handle, $trash_id . " ". date("d.m.y-H:i:s") . " " . $file . "\r\n"); if(is_dir($file)){ copyRecursive($file, $PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/"); rename($PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/" . basename($file), $PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/" . $trash_id . ".pxt"); }else{ copy($file, $PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/" . $trash_id . ".pxt"); } $trash_id ++; $handle = fopen($PXP_user_folder . "/" . $PXP_user . "/trash.pxtf/id.txt", "w"); fwrite($handle, $trash_id); fclose($handle); } } function rmdirRecursive($dir, $trash = true){ if($trash and strpos($dir, "trash.pxtf") === FALSE) addToTrash($dir); if(dirname($dir) == "system" or dirname($dir) == "phpXplorer") die("Pass blos auf du Hornochse!!!!!!!!!!!!!!!!!!"); $current_dir = opendir($dir); while($entryname = readdir($current_dir)){ if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname != "..")){ rmdirRecursive("${dir}/${entryname}", false); }elseif($entryname != "." and $entryname != ".."){ pxp_unlink("${dir}/${entryname}", false); } } closedir($current_dir); pxp_rmdir("${dir}", false); } function copyRecursive($source, $dest){ GLOBAL $PXP_languages, $PXP_language; $newDest = "$dest/" . basename($source); $nr = 1; while(file_exists($newDest)){ $newDest = "$dest/" . $PXP_languages[$PXP_language]["copy"] . $nr . " " . $PXP_languages[$PXP_language]["of"] . " " . basename($source); $nr++; } if(is_dir($source)){ mkdir($newDest, 0755); $current_dir = opendir($source); while($entryname = readdir($current_dir)){ if($entryname != "." and $entryname != "..") copyRecursive("$source/$entryname", "$newDest"); } closedir($current_dir); }else{ copy($source, $newDest); } } function getPermissions($in_Perms){ $sP = ""; if(($in_Perms & 0xC000) === 0xC000) // Unix domain socket $sP = "s"; elseif(($in_Perms & 0x4000) === 0x4000) // Directory $sP = "d"; elseif(($in_Perms & 0xA000) === 0xA000) // Symbolic link $sP = "l"; elseif(($in_Perms & 0x8000) === 0x8000) // Regular file $sP = "-"; elseif(($in_Perms & 0x6000) === 0x6000) // Block special file $sP = "b"; elseif(($in_Perms & 0x2000) === 0x2000) // Character special file $sP = "c"; elseif(($in_Perms & 0x1000) === 0x1000) // Named pipe $sP = "p"; else // Unknown $sP = "?"; // owner $sP .= (($in_Perms & 0x0100) ? 'r' : '−') . (($in_Perms & 0x0080) ? 'w' : '−') . (($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) : (($in_Perms & 0x0800) ? 'S' : '−')); // group $sP .= (($in_Perms & 0x0020) ? 'r' : '−') . (($in_Perms & 0x0010) ? 'w' : '−') . (($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) : (($in_Perms & 0x0400) ? 'S' : '−')); // world $sP .= (($in_Perms & 0x0004) ? 'r' : '−') . (($in_Perms & 0x0002) ? 'w' : '−') . (($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' ) : (($in_Perms & 0x0200) ? 'T' : '−')); return $sP; } function getUnixUserName($file){ if(function_exists('posix_getpwuid')){ $arr = @posix_getpwuid(fileowner($file)); return $arr['name']; }else{ return ""; } } function getUnixGroupName($file){ if(function_exists('posix_getpwuid')){ $arr = @posix_getgrgid(filegroup($file)); return $arr['name']; }else{ return ""; } } ?>