From b096ef360693d469343a816dbf3dc028b6430c55 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 1 Jun 2012 17:16:46 +0100 Subject: [PATCH] Files, folders & bytes now counted up Count of files & folders are running as files & folders are found Bytes of files also totalled onLoad, a new function is called to update the server info display --- files.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/files.php b/files.php index a06f946..2603ad2 100644 --- a/files.php +++ b/files.php @@ -74,6 +74,7 @@ function fileManager_dir($directory, $return_link, $first_call=true) { if( $this_file != "." && $this_file != ".." && $bannedFile == false) { if( is_dir("$directory/$this_file") ) { // Directory + $dirCount++; $dirRep = str_replace("\\","/",$directory); $link = str_replace("[link]", "$dirRep/" . urlencode($this_file), $return_link); $link = str_replace("//","/",$link); @@ -99,6 +100,8 @@ function fileManager_dir($directory, $return_link, $first_call=true) { } } else { // File + $fileCount++; + $fileBytes+=filesize($link); // Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers) $ext = "ext-" . substr($this_file, strrpos($this_file, ".") + 1); $dirRep = str_replace("\\","/",$directory); @@ -127,7 +130,12 @@ function fileManager_dir($directory, $return_link, $first_call=true) { } $fileManager .= ""; } - return $fileManager; + $varOutput = ""; + if ($dirCount) {$varOutput .= "top.ICEcoder.dirCount+=".$dirCount.";".PHP_EOL;}; + if ($fileCount) {$varOutput .= "top.ICEcoder.fileCount+=".$fileCount.";".PHP_EOL;}; + if ($fileBytes) {$varOutput .= "top.ICEcoder.fileBytes+=".$fileBytes.";".PHP_EOL;}; + // After outputting the fileManager, output the JS vars, but only the first time + return $fileManager.""; } // For PHP4 compatibility @@ -156,9 +164,15 @@ function php4_scandir($dir) { - +
+