Bug 546528 - Download Directory/File browsing service Change-Id: If0617f94ee721a95d366b58ea20c52c15ff9fe05 Signed-off-by: Denis Roy <denis.roy@eclipse-foundation.org>
diff --git a/download.eclipse.org/filehandler.php b/download.eclipse.org/filehandler.php new file mode 100644 index 0000000..ff55371 --- /dev/null +++ b/download.eclipse.org/filehandler.php
@@ -0,0 +1,30 @@ +<?php +/** + * Copyright (c) 2020 Eclipse Foundation and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +# Grabs the POSTed paths_to_archive from the 404 file browser +# and shims them into the account_requests table for actioning + +if($_SERVER['REQUEST_METHOD'] == "POST") { + if(!empty($_POST['paths_to_archive'][0])) { + $dir = dirname($_SERVER['DOCUMENT_ROOT'] . $_POST['paths_to_archive'][0]); + + # Validate that paths_to_archive contains valid data + if(is_dir($dir)) { + require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/downloads/downloadDirectory.class.php"); + $DownloadDirectory = new DownloadDirectory(); + $dir_html = $DownloadDirectory->getFormOutput("", "", $dir); + header("Location: " . dirname($_POST['paths_to_archive'][0])); + exit; + } + } +} +header("Location: https://www.eclipse.org/"); +?> \ No newline at end of file