Ich habe mir vor zwei Tagen ein kleines Script gebastelt, dass meinen kompletten htdocs-Ordner nach Projekten durchforstet und auflistet (sucht eigentlich nur nach den index.*-Dateien = Projekte). Leichen kann es zwar nicht anzeigen aber man hat eine schöne Übersicht in Form eines Verzeichnisbaums. Vielleicht bringt es dir ja was...
P.S.:
Ja ja, die Funktion "db_build_navigation" ist jenseits von Gut und Böse :-/ . Das ist eigentlich nicht mein normaler Stil. Sonst trenne ich brav Logik von Aussehen ;-)
<?php
function db_get_pages($directory = '',$pages = array()) {
foreach(glob($directory . '*') as $file) {
if($file != $directory . '.' && $file != $directory . '..') {
if(is_dir($file) && (!file_exists($file . '/index.php') &&
!file_exists($file . '/index.htm') &&
!file_exists($file . '/index.html'))) {
$pages = db_get_pages($file . '/',$pages);
}
else if(file_exists($file . '/index.php') ||
file_exists($file . '/index.htm') ||
file_exists($file . '/index.html')) {
$pages[] = $file;
}
}
}
return $pages;
}
function db_navigation_add_folders($folders,$navigation) {
$struct = array();
for($i = 0;$i < count($folders);$i++) {
$struct[$folders[$i]] = array();
}
$name = array_keys($struct);
$path = array();
for($i = count($name) - 2;$i >= 0;$i--) {
$struct[$name[$i]] = array($name[$i + 1] => $struct[$name[$i + 1]]);
if($i == 0) {
$path[$name[0]] = $struct[$name[0]];
return array_merge_recursive($navigation,$path);
}
}
}
function db_create_navigation($directories) {
$navigation = array();
$split = array();
sort($directories);
for($i = 0;$i < count($directories);$i++) {
$path = explode('/',$directories[$i]);
$split[] = $path;
}
for($i = 0;$i < count($split);$i++) {
$navigation = db_navigation_add_folders($split[$i],$navigation);
}
return $navigation;
}
function db_build_navigation($navigation,$indent = 8,$path = '') {
if(count($navigation) > 0) {
$name = array_keys($navigation);
for($i = 0;$i < count($name);$i++) {
$directory = ($path != '')? $path . '/' . $name[$i] . '/': $name[$i];
$id = md5($directory);
if(count($navigation[$name[$i]]) > 0) {
echo str_repeat(' ',$indent) . '<div style="cursor:pointer;color:rgb(0,0,0)" onClick="if(document.getElementById(\'sf_' . $id . '\').style.display == \'none\') { document.getElementById(\'sf_' . $id . '\').style.display = \'block\'; } else { document.getElementById(\'sf_' . $id . '\').style.display = \'none\'; }" onMouseMove="this.style.color=\'rgb(0,0,200)\'" onMouseOut="this.style.color=\'rgb(0,0,0)\'">' . htmlentities($name[$i]) . '</div>' . "\n";
echo str_repeat(' ',$indent) . '<div id="sf_' . $id . '" style="padding-left:1.5em;display:none">' . "\n";
db_build_navigation($navigation[$name[$i]],$indent + 2,$directory);
echo str_repeat(' ',$indent) . '</div>' . "\n";
}
else {
echo str_repeat(' ',$indent) . '<a href="' . $directory . '"><i>' . htmlentities($name[$i]) . '</i></a><br>' . "\n";
}
}
}
}
if(!empty($_GET['show']) && $_GET['show'] == 'phpinfo') {
phpinfo();
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DirBrowser</title>
<style type="text/css">
<!--
a:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: rgb(0,0,0);
}
a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: rgb(0,0,0);
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: rgb(0,0,200);
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: rgb(0,0,0);
}
a:focus {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: rgb(0,0,200);
}
body {
background-color: rgb(255,255,255);
}
body, table {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
color: rgb(0,0,0);
}
.content {
margin-left: auto;
margin-right: auto;
width: 30em;
}
-->
</style
</head>
<body>
<div class="content">
<span style="font-size:2.5em"><b>DirBrowser</b></span>
<br><br>
<b>Projektübersicht</b>
<div style="padding-left:0.5em">
<?php
$directories = db_get_pages();
$navigation = db_create_navigation($directories);
db_build_navigation($navigation);
?>
</div>
<br><br>
<a href="index.php?show=phpinfo"><span style="color:gray">über PHP</span></a>
|
<span style="color:gray"><?php echo htmlentities(date('d.m.Y - H:i')) ?></span>
</div>
</body>
</html>
--
Gruß, Daniel | In der Realität ist die Wirklichkeit ganz anders.
Gruß, Daniel | In der Realität ist die Wirklichkeit ganz anders.