/**
* © 2011-2018 Higi Bigler (nullnulleins.ch). All rights reserved.
*
* This file is part of glorya.
*
* glorya is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* glorya is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with glorya. If not, see .
*/
include_once 'system/init.php';
try {
$response = new XMLResponse ();
$user->setResponse ($response);
$response->sendHeader ();
echo ''."\n";
$r = $user->initialiseWWWRequest ('/');
$pathMap = $r['pathmap'];
$url = ((isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$r['urlprefix'];
foreach ($pathMap as $k => $v) {
// avoid aliasses
if ($v->isP == 1 && $v->isN == 1 && $v->path == $k) {
$pen = $v->pe.'PageEngine';
$pe = new $pen ($v->id, $v->nl, $v->pUID, $v->pgID);
echo $pe->getSitemapXML ($url);
}
}
// @todo add videos/files/etc
echo ''."\n";
} catch (Exception $ex) {
try {
if ($fh = fopen ('./logs/sitemap.log', 'a')) {
fwrite ($fh, date ('d-m-Y H:i:s').' - FATAL - '.get_class ($ex).' - '.$ex->getMessage ());
fwrite ($fh, $ex->getTraceAsString ()."\n");
fclose ($fh);
}
} catch (Exception $ex) {
echo 'Hoppla! Da ist leider ein Fehler passiert, bitte versuchen sie es spaeter wieder.';
$_SESSION[Util::getSessionName ()] = null;
session_destroy ();
}
}