[]]; $string_keys = ['name', 'email']; foreach ($_POST as $key => $v) { if (($key == 'city' && in_array($v, $CITIES)) || ($key == 'count' && is_numeric($v)) || (in_array($key, $string_keys))) { $data[$key] = $v; } else if (preg_match('/^date_(\d\d\d\d-\d\d-\d\d)$/', $key, $matches) && $v == "on") { $data['dates'][] = $matches[1]; } else if ($key == "tagx" && $v == "on") { $data['dates'][] = $key; } else { echo "Invalid value " . htmlspecialchars($v) . " for key " . htmlspecialchars($key); exit; } } if (!$file || !fwrite($file, json_encode($data))) { echo "Leider konnte deine Anmeldung nicht gespeichert werden. Bitte melde dich bei luetzi-vernetzung-bb@systemli.org damit wir den Fehler beheben können!"; exit; } echo "Danke für deine Anmeldung."; if ($_POST['email']) { echo " Wir schreiben dir eine E-Mail falls der Solibus in einem von dir gewählten Zeitraum fährt."; } exit; } $ONE_DAY = new DateInterval("P1D"); function get_days_of_week() { global $ONE_DAY; $res = []; $date = (new DateTime())->setTimestamp(strtotime("this week")); for ($n = 0; $n < 7; ++$n) { $res[] = IntlDateFormatter::formatObject($date, "ccc"); $date->add($ONE_DAY); } return $res; } $DAYS_OF_WEEK = get_days_of_week(); function print_month($start) { global $DAYS_OF_WEEK, $ONE_DAY, $EVENTS; $month_start = (new DateTimeImmutable())->setTimestamp(strtotime("first day of this month", $start->getTimestamp())); $week_start = (new DateTimeImmutable())->setTimestamp(strtotime("this week", $month_start->getTimestamp())); $month_end = (new DateTimeImmutable())->setTimestamp(strtotime("+1 month", $month_start->getTimestamp())); $month_name = IntlDateFormatter::formatObject($month_start, "MMMM yyyy"); ?>
"; $label = IntlDateFormatter::formatObject($date, "dd"); if ($invalid) { echo $label; } else { $id = IntlDateFormatter::formatObject($date, "yyyy-MM-dd"); echo ""; } echo " | "; $date->add($ONE_DAY); } } ?>