setFname($file); $this->setFext($file); $this->setFsize($file); $this->setFdate($file); $this->setFicon_type(); } // Set file name function setFname($file) { $this->file_name = basename($file); } // set file extension function setFext($file) { $this->file_ext = array_pop(explode('.', $file)); } // set file size function setFsize($file) { $kbs = filesize($file) / 1024; $this->file_size = round($kbs, 2); } // set date modified function setFdate($file) { $modified = filectime($file); $this->file_date = date("m/d/Y H:i A", $modified); } // set file type function setFicon_type() { list($this->file_type, $this->file_icon) = split("\?", GetExt($this->file_ext), 2); } // setup all get/return methods for class vars function getFname() { return $this->file_name; } function getFext() { return $this->file_ext; } function getFsize() { return $this->file_size; } function getFdate() { return $this->file_date; } function getFicon() { return $this->file_icon; } function getFtype() { return $this->file_type; } } // setup folder properties class class Folder_Properties { var $dir_name; // just the directory name var $dir_date; // date modified var $dir_icon = "folder.gif"; // icon for directory var $dir_type = "File Folder"; // short description for file type // constructor method - build object function Build($dir) { $this->setFname($dir); $this->setFdate($dir); } // Set file name function setFname($dir) { $this->dir_name = basename($dir); } // set date modified function setFdate($dir) { $modified = filectime($dir); $this->dir_date = date("m/d/Y H:i A", $modified); } // setup all get/return methods for class vars function getFname() { return $this->dir_name; } function getFdate() { return $this->dir_date; } function getFicon() { return $this->dir_icon; } function getFtype() { return $this->dir_type; } } // initialize file and folder arrays $file_array = array(); $dir_array = array(); $Fname_array = array(); $Dname_array = array(); // open directory $dir = opendir($fdir); // Read files into array while(false !== ($file = readdir($dir))) { if($file != "." && $file != "..") { $type = filetype($fdir.$file); $info = pathinfo($file); if($type != "dir") { if(isset($info["extension"])) { $file_extension = $info["extension"]; } } if($type == "dir" && !in_array($file, $Exclude_Folder)) { // setup folder object $This_Dir = new Folder_Properties; $This_Dir->Build($fdir.$file); $dir_array[] = $This_Dir; } elseif($type == "file" && !in_array($file, $Exclude_File) && !in_array($file_extension, $Exclude_Extension)) { // setup file object $This_File = new File_Properties; $This_File->Build($fdir.$file); $file_array[] = $This_File; } } } closedir($dir); // Set default sort by method if(!isset($SortBy) || $SortBy != 0 && $SortBy != 1) { $SortBy = 0; } // Number of the column to sort by (0-3) set default to 0 if(!isset($NumSort) || $NumSort != 0 && $NumSort != 1 && $NumSort != 2 && $NumSort != 3) { $NumSort = 0; } // determin object sorting methods switch($NumSort) { case 0; $Fsort_method = "file_name"; $Dsort_method = "dir_name"; break; case 1; $Fsort_method = "file_size"; $Dsort_method = "dir_name"; break; case 2; $Fsort_method = "file_type"; $Dsort_method = "dir_name"; break; case 3; $Fsort_method = "file_date"; $Dsort_method = "dir_date"; break; default: $Fsort_method = "file_name"; $Dsort_method = "dir_name"; } // object sorting functions function ASC_sort_file_objects($a, $b) { global $Fsort_method; $obj1 = strtolower($a->$Fsort_method); $obj2 = strtolower($b->$Fsort_method); if ($obj1 == $obj2) return 0; return ($obj1 < $obj2) ? -1 : 1; } function ASC_sort_dir_objects($a, $b) { global $Dsort_method; $obj1 = strtolower($a->$Dsort_method); $obj2 = strtolower($b->$Dsort_method); if ($obj1 == $obj2) return 0; return ($obj1 < $obj2) ? -1 : 1; } function DESC_sort_file_objects($a, $b) { global $Fsort_method; $obj1 = strtolower($a->$Fsort_method); $obj2 = strtolower($b->$Fsort_method); if ($obj1 == $obj2) return 0; return ($obj1 > $obj2) ? -1 : 1; } function DESC_sort_dir_objects($a, $b) { global $Dsort_method; $obj1 = strtolower($a->$Dsort_method); $obj2 = strtolower($b->$Dsort_method); if ($obj1 == $obj2) return 0; return ($obj1 > $obj2) ? -1 : 1; } // sort ascending if($SortBy == 0) { // sort arrays (ASCENDING) usort($file_array, 'ASC_sort_file_objects'); usort($dir_array, 'ASC_sort_dir_objects'); $arrow = "▲"; $SortBy = 1; } // sort descending else { // sort arrays (DESCENDING) usort($file_array, 'DESC_sort_file_objects'); usort($dir_array, 'DESC_sort_dir_objects'); $arrow = "▼"; $SortBy = 0; } ?> Untitled Document

Overview
_______________

Institution

Unit

___________________

CEHS NCATE Home

Wright State Home

CEHS Home

NCATE Webpage

Overview

Undergraduate Catalog

Graduate Catalog

// //TotalIndex echo ""; echo ""; // // //"; //fortest->phpinfo(); // description file $desc_file = $fdir.$Readme_File; if($Allow_Readme == 1 && file_exists($desc_file)) { echo "     "; // output description if(file_exists($desc_file)) { $handle = fopen ($desc_file, "r"); $dir_desc = fread ($handle, filesize ($desc_file)); fclose ($handle); $dir_desc = str_replace("\n", "
", $dir_desc); echo "

".$dir_desc."

"; } echo "   "; } echo "
"; // directory is not the base dir if($fdir != "./") { // Make every other row a color $othernum = 1; // Get folder one level up $UpPath = dirname($fdir)."/"; echo " "; } else { $othernum = 0; } // alternate row counter $count = 0; // Output folder information for($y = 0; $y < count($dir_array); $y++) { // alternate row colors if($count % 2 != $othernum) { $special = "bgcolor='$RowColor'"; } else { $special = ""; } $count++; echo " "; } // output file info for($y = 0; $y < count($file_array); $y++) //while (list($key, $val) = each($Fname_array)) { // alternate row colors if($count % 2 != 0) { $special = "bgcolor='$RowColor'"; } else { $special = ""; } $count++; echo " "; } echo "
  Name $arrow     Size     Type  
  Up One Level                      
  getFname()."/\" class=\"link01\">getFicon()."\" border=\"0\"> ".$dir_array[$y]->getFname()."           ".$dir_array[$y]->getFtype()."
  getFname()."\" class=\"link01\" target=\"_blank\">getFicon()."\" border=\"0\"> ".$file_array[$y]->getFname()."     ".$file_array[$y]->getFsize()." kb     ".$file_array[$y]->getFtype()."
 

"; ?>