aboutsummaryrefslogtreecommitdiffstats
blob: 9915128553ec6a5b86cad8c417234633ee5c6ce0 (plain) (blame)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<html>
<head>
<title>${project.name}</title>
</head>
<body>
<div style="max-width: 900px;">
<hr />
<img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right;"/>
<h1>Welcome!</h1>
This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
<br style="clear: both;" />
<hr />
</div>
#[[
<?php
	$pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
	printDir($pathElements, 0);

	function printDir($pathElements, $pathDepth) {
		$rootdir = getDirectory($pathElements, $pathDepth);
		$files = readFiles("./".$rootdir);
		$dirs = readDirectories("./".$rootdir);
		sort($files);
		sort($dirs);

		echo "<ul>";

		foreach($dirs as $dir) {
			echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';

			if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
				printDir($pathElements, $pathDepth+1);
			}
		}

		foreach($files as $file) {
			echo '<li>'.$file.'</li>';
		}

		echo "</ul>";
	}

	function printIndent($depth) {
		for($i=0; $i<$depth; $i++)
			echo "&nbsp;";
	}

	function getDirectory($pathElements, $pathDepth) {
		$dir = "";
		for($i=0; $i<$pathDepth; $i++) {
			$dir .= $pathElements[$i]."/";
		}
		return $dir;
	}

	function readDirectories($dir) {
		$dirs = array();
		if ($handle = opendir($dir)) {
			while (false !== ($file = readdir($handle))) {
				if($file == "." || $file=="..")
					continue;
				if(is_dir($dir.$file))
					$dirs[] = $file;
			}
		}
		return $dirs;
	}

	function readFiles($dir) {
		$files = array();
		if ($handle = opendir($dir)) {
			while (false !== ($file = readdir($handle))) {
				if($file == "." || $file=="..")
					continue;
				if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
					$files[] = $file;
			}
		}
		return $files;
	}
?>
]]#
</body>