read()) { if (!is_dir( $entry)) { // read file contents $entryfile = $dbdir."/".$entry; $aentry = filedb_read( $entryfile); if ($aentry[ 1] != "") $aaentry[] = $aentry; } } return $aaentry; } // -------------------------------------------------------------------- function filedb_querycommitstatus( $dbdir) { $commit = "CURRENT"; // read database $dir = dir( $dbdir); while ($entry = $dir->read()) { if (!is_dir( $entry)) { // read file contents $entryfile = $dbdir."/".$entry; // check for commit files if ( substr( $entry, strlen( $entry) - 7) == ".commit") $commit = "COMMIT"; } } return $commit; } // -------------------------------------------------------------------- function filedb_sorttitle( $aa, $ab) { $index = 2; $a = $aa[ $index]; $b = $ab[ $index]; return strcmp( strtoupper( $a), strtoupper( $b)); return $result; } // -------------------------------------------------------------------- function filedb_sortcategory( $aa, $ab) { $index = 1; $a = $aa[ $index]; $b = $ab[ $index]; return strcmp( strtoupper( $a), strtoupper( $b)); return $result; } // -------------------------------------------------------------------- function filedb_sortprio( $aa, $ab) { $index = 3; $a = $aa[ $index]; $b = $ab[ $index]; if ($a == $b) $result = 0; else $result = ($a > $b) ? 1 : -1; return $result; } // -------------------------------------------------------------------- function filedb_sortstatus( $aa, $ab) { $index = 4; $as = trim( $aa[ $index]); $bs = trim( $ab[ $index]); // check for equal status already here if ($as == $bs) return 0; // read index file and search status keywords // NOTE: the lines contain CRLF, so we need to append // CRLF to the keywords when searching $astatus = file( "status.lst"); $a = array_search( $as."\r\n", $astatus); $b = array_search( $bs."\r\n", $astatus); if ($a == $b) $result = 0; else $result = ($a > $b) ? 1 : -1; return $result; } // -------------------------------------------------------------------- function filedb_sortmodified( $aa, $ab) { $index = 7; $a = $aa[ $index]; $b = $ab[ $index]; // reverse order ! return strcmp( strtoupper( $b), strtoupper( $a)); return $result; } // -------------------------------------------------------------------- function filedb_getcommitfile( $file) { return $file.".commit"; } // -------------------------------------------------------------------- function filedb_getstatuscolor( $status) { $status = strtoupper( trim( $status)); if ($status == "COMMIT") return "#aa0000"; else return "#007700"; } ?>