-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebroot.php
More file actions
58 lines (56 loc) · 1.69 KB
/
Copy pathwebroot.php
File metadata and controls
58 lines (56 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!--
Web Root Listing
Dynamically Lists the folders in the webroot, to avoid having to memorize subfolders for projects
Version 0.1
6/13/2011
Kacey Cole via PurpleState
-->
<!DOCTYPE html>
<html>
<head>
<title>PurpleState Web Root</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<?php
$dir = '/var/www/htdocs'; // Set directory to parse => Make dynamic
?>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>PurpleState Local Project Listing</h1>
</div>
<div id="content">
<?php
$iterator = new DirectoryIterator($dir);// Declare search object
foreach ($iterator as $test){ // Check each file in directory
if ($test->isDir() && !$test->isDot()){ // If file is a directory, and NOT a root folder
//echo $test->getPathname()."<br />";
$projectCheck = new DirectoryIterator($test->getPathname()); // Declare subfolder search object
$docText = null;
$file = $iterator->getFilename();
foreach ($projectCheck as $projIterator){ // List each file in subfolder
if ($projIterator->getFilename() == "define.txt"){ // Looking for define.txt
$docText = file_get_contents($projIterator->getPathname()); // Parse file
}
}
if ($docText == null){
echo "<a href='/$file/'>$file</a><br />";
}
elseif ($docText == "null" || $docText == "null " ){}//Do nothing if set to skip.
else{
echo "<a href='/$file/'>$docText</a><br />";
}
}
}
?>
</div>
<div id="footer">
<h6>Version 0.1</h6>
<p class="brand">
Powered by PurpleState;
</p>
</div>
</div>
</body>
</html>