<?php
//http://www.cleeus.de/cms/index.php?option=com_mojo&Itemid=72&feed=atom
// --> index98ae.php/xml (hack)
//http://www.cleeus.de/cms/index.php?option=com_mojo&Itemid=72&feed=rss2
// --> index2a98.xml

function transform_feed($raw) {
	$repl = str_replace("https://cleeus.dyndns.org", "http://www.cleeus.de", $raw);
	$repl = str_replace("cleeus.dyndns.org", "www.cleeus.de", $repl);
	return $repl;
}

function get_rss2_feed() {
	$raw = file_get_contents('index2a98.xml');
	return transform_feed($raw);
}

function get_atom_feed() {
	$raw = file_get_contents('index98ae.xml');
	return transform_feed($raw);
}

function get_index_html() {
	return file_get_contents('index.html');
}

function main() {
	if (
		strcmp($_GET['option'], 'com_mojo') == 0 &&
		strcmp($_GET['Itemid'], '72') == 0
	) {
		if (strcmp($_GET['feed'], 'atom') == 0) {
			echo get_atom_feed();
		} else if (strcmp($_GET['feed'], 'rss2') == 0) {
			echo get_rss2_feed();
		}
	} else {
		echo get_index_html();
	}
}


main();
?>
