getCurrentDirectory();
$dir_html = "";
$is_p2 = false;
if(is_dir($dir)) {
$files = array();
$dirs = array();
if ($dh = opendir($dir)) {
$dir_html = "
Directory Contents
";
while (($file = readdir($dh)) !== false) {
if (filetype($dir . $file) == "dir") {
$dirs[] = $file;
}
else {
$files[] = $file;
if(strpos($file, "artifacts.jar") !== FALSE
|| strpos($file, "artifacts.xml") !== FALSE
|| strpos($file, "compositeArtifacts.jar") !== FALSE
|| strpos($file, "compositeArtifacts.xml") !== FALSE) {
# p2 repo
$is_p2 = true;
}
}
}
closedir($dh);
asort($dirs);
asort($files);
$dir_html .= $DownloadDirectory->getFormOutput($files, $dirs);
$dir_html .= "
";
}
if($is_p2) {
# p2
$html = file_get_contents("404_p2.html");
}
else {
$html = file_get_contents("404.html");
}
$html = str_replace("", $dir_html, $html);
}
else {
# Check archives
$html = file_get_contents("404_nodoc.html");
$message_html = "Not Found
";
$message_html .= "We're sorry, the page or file cannot be found. Here are some reasons why:
";
$message_html .= "- A file may have moved to the archives. Please contact the project members on their user forum.
";
$message_html .= "- Your file was part of a nightly or integration build which is no longer there. Simply download the latest version.
- The project is uploading a new build, and this file is not there yet. Try again later.
";
$archive_dir = str_replace("download.eclipse.org", "archive.eclipse.org", $dir);
if(is_dir($archive_dir)) {
$message_html = "Moved to archives
";
$message_html .= "It appears this content was moved to the archives. You can try accessing this URL instead:
";
$message_html .= " https://archive.eclipse.org" . $_SERVER['REQUEST_URI'] . "
";
# doc title
$html = str_replace("Not Found", "Moved", $html);
# breadcrumb
$html = str_replace("Not Found", "Moved", $html);
}
$html = str_replace("", $message_html, $html);
}
echo $html;
}