foreach ($index_files as $index_file) { $index_data = json_decode(file_get_contents($index_file), true); $json_repos['repos'][basename($index_file, '.index')] = array('title' => basename($index_file, '.index'), 'generated' => $index_data['main']['generated']); } echo json_encode($json_repos); } else { if (isset($_GET['test'])) { $repo = str_replace(array('..', '/'), null, $_GET['repo']); $test = str_replace(array('..', '/'), null, $_GET['test']); if (pts_openbenchmarking::is_repository($repo)) { pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' requested a copy of the ' . $repo . '/' . $test . ' test profile'); $realpath_file = realpath(PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo . '/' . $test . '.zip'); if (is_file($realpath_file) && strpos($realpath_file, PTS_OPENBENCHMARKING_SCRATCH_PATH) === 0) { echo base64_encode(file_get_contents($realpath_file)); } } } else { if (isset($_GET['suite'])) { $repo = str_replace(array('..', '/'), null, $_GET['repo']); $test = str_replace(array('..', '/'), null, $_GET['test']); if (pts_openbenchmarking::is_repository($repo)) { pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' requested a copy of the ' . $repo . '/' . $test . ' test suite'); $realpath_file = realpath(PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo . '/' . $test . '.zip'); if (is_file($realpath_file) && strpos($realpath_file, PTS_OPENBENCHMARKING_SCRATCH_PATH) === 0) { echo base64_encode(file_get_contents($realpath_file)); } } } } } }