This repository has been archived on 2022-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
md-cms/apiMirror.php

34 lines
917 B
PHP
Raw Permalink Normal View History

<?PHP
/**
2018-06-19 18:02:04 +02:00
* This file directly mirrors data from the MD api.
* In some cases, links are rewritten, to allow navigation on site.
*
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
*/
// Include functions and settings.
require_once __DIR__ . "/inc/functions.php";
// Check validity of request.
if (!isset($_GET['args']) || !isset($_GET['area'])) {
echo printErrorPage($settings, "File does not exist.");
return;
}
if (!in_array($_GET['area'], ['events', 'exhibitions'])) {
echo printErrorPage($settings, "Using a disallowed value for area.");
return;
}
// Ensure working environment for frontend.
ensureEnvironment();
$output = queryCachePage($settings['mdVersion'] . "?" . urldecode($_GET['args']), $_GET['area'], $settings);
$output = str_replace("index.php?t=exhibition&", "exhibition.php?", $output);
$output = str_replace("index.php?t=event&", "event.php?", $output);
echo $output;