');
$jsonraw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json");
if ($this::isJson($jsonraw)) {
$json = json_decode($jsonraw);
$eventlist = [];
foreach ($json->events as $event) {
if (isset($event->timestamp)) {
array_push($eventlist, $event->timestamp);
}
}
sort($eventlist);
$pos = 1;
$shown = 0;
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/calendar_events")) {
$calevn = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/calendar_events");
} else {
$calevn = "3";
}
foreach ($eventlist as $event) {
if ($pos == ($calevn + 1)) {} else {
foreach ($json->events as $el) {
if (isset($el->timestamp)) {
if ($el->timestamp == $event) {
(int)$currentDate = date("Ymd");
if ($currentDate < $el->timestamp) {
$shown = $shown + 1;
if (isset($el->link)) {
if ($el->link != "" && $el->link != "http://") {
echo("- link . "\">" . $el->datestr . " : " . $el->name . "
");
} else {
echo("- " . $el->datestr . " : " . $el->name . "
");
}
} else {
echo("- " . $el->datestr . " : " . $el->name . "
");
}
$pos = $pos + 1;
}
if ($currentDate == $el->timestamp) {
$shown = $shown + 1;
echo("- {$lang["widgets"]["calendar"]["today"]} : " . $el->name . "
");
$pos = $pos + 1;
}
}
}
}
}
}
if ($shown == "0") {
echo("
{$lang["widgets"]["calendar"]["nothing"]}
");
}
} else {
echo("{$lang["widgets"]["calendar"]["corrupt"]}");
}
if ($_RENDERER === "Neutron Titanium") {
echo("{$lang["widgets"]["calendar"]["more"]}");
} else {
echo("{$lang["widgets"]["calendar"]["more"]}");
}
}
}