diff --git a/index.html b/index.html
index c31547e..5a3daf1 100644
--- a/index.html
+++ b/index.html
@@ -1,1575 +1,1527 @@
-window.location.href="' . $url . '";';
- }
- exit();
-}
-
-// Hauptlogik
-$oldDomains = [
- 'www.aurora-wetter-lifecam.ch',
- 'www.aurora-wetter-livecam.ch'
-];
-$newDomain = 'www.aurora-weather-livecam.com';
-
-if (in_array($_SERVER['HTTP_HOST'], $oldDomains)) {
- $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
- $newUrl = $protocol . '://' . $newDomain . $_SERVER['REQUEST_URI'];
-
- // Logging für Debugging
- error_log("Umleitung von {$_SERVER['HTTP_HOST']} nach $newUrl");
-
- if (!headers_sent()) {
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: " . $newUrl);
- } else {
- echo '';
- }
- exit();
-}
-
-
-
-
-
-
-session_start();
+';
-
-
- }
-
-
- public function captureSnapshot() {
-
- $outputFile = 'snapshot_' . date('YmdHis') . '.jpg';
- $command = "ffmpeg -i {$this->videoSrc} -i {$this->logoPath} -filter_complex 'overlay=main_w-overlay_w-10:10' -vframes 1 -q:v 2 {$outputFile}";
-
-
- exec($command, $output, $returnVar);
-
- if ($returnVar !== 0) {
- return "Fehler beim Erstellen des Snapshots.";
- }
-
- // Kopieren des Snapshots in den Uploads-Ordner
- $uploadDir = "uploads/";
- if (!file_exists($uploadDir)) {
- mkdir($uploadDir, 0777, true);
-
- }
-
- $uploadFile = $uploadDir . $outputFile;
- if (copy($outputFile, $uploadFile)) {
-
- } else {
-
- }
-
-
-
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="' . $outputFile . '"');
- readfile($outputFile);
- unlink($outputFile);
- exit;
- }
- public function getImageFiles() {
- $imageFiles = glob("image/*.{jpg,jpeg,png,gif}", GLOB_BRACE);
- return json_encode($imageFiles);
- }
-
- public function captureVideoSequence($duration = 10) {
- $outputFile = 'sequence_' . date('YmdHis') . '.mp4';
- $command = "ffmpeg -i {$this->videoSrc} -i {$this->logoPath} -filter_complex 'overlay=10:10' -t {$duration} -c:v libx264 -preset fast -crf 23 {$outputFile}";
-
- exec($command, $output, $returnVar);
-
- if ($returnVar !== 0) {
- return "Fehler beim Erstellen der Video-Sequenz.";
- }
-
- // Kopieren des Videoclips in den Uploads-Ordner
- $uploadDir = "uploads/";
- if (!file_exists($uploadDir)) {
- mkdir($uploadDir, 0777, true);
- echo "Uploads-Ordner erstellt.
";
- }
-
- $uploadFile = $uploadDir . $outputFile;
- if (copy($outputFile, $uploadFile)) {
-
- } else {
- echo "Fehler beim Kopieren des Videoclips in den Uploads-Ordner.
";
- }
-
-
-
- header('Content-Type: video/mp4');
- header('Content-Disposition: attachment; filename="' . $outputFile . '"');
- readfile($outputFile);
- unlink($outputFile);
- exit;
- }
-
- public function getJavaScript() {
- return "
- document.addEventListener('DOMContentLoaded', function () {
- var video = document.getElementById('webcam-player');
- var videoSrc = '{$this->videoSrc}';
- if (Hls.isSupported()) {
- var hls = new Hls();
- hls.loadSource(videoSrc);
- hls.attachMedia(video);
- hls.on(Hls.Events.MANIFEST_PARSED, function () {
- video.play();
- });
+ini_set("display_errors", 1);
+class WebcamManager
+{
+ private $videoSource = "/test_video.m3u8";
+ private $imageDir = "./image";
+ private $uploadDir = "./uploads";
+ private $galleryDir = "./gallery";
+ private $commentsFile = "comments.json";
+ private $lang = "de";
+ public function __construct()
+ {
+ foreach (
+ [$this->uploadDir, $this->imageDir, $this->galleryDir]
+ as $dir
+ ) {
+ if (!file_exists($dir)) {
+ mkdir($dir, 0777, true);
}
- else if (video.canPlayType('application/vnd.apple.mpegurl')) {
- video.src = videoSrc;
- video.addEventListener('loadedmetadata', function () {
- video.play();
- });
- }
- });
- ";
- }
-
- public function setVideoSrc($src) {
- $this->videoSrc = $src;
- }
-}
-
-class GuestbookManager {
- private $entries = [];
- private $dbFile = 'guestbook.json';
-
- public function __construct() {
- if (file_exists($this->dbFile)) {
- $this->entries = json_decode(file_get_contents($this->dbFile), true);
}
- }
-
- public function handleFormSubmission() {
- if (isset($_POST['guestbook'], $_POST['guest-name'], $_POST['guest-message'])) {
- $this->addEntry($_POST['guest-name'], $_POST['guest-message']);
- $this->saveEntries();
+ if (!file_exists($this->commentsFile)) {
+ file_put_contents($this->commentsFile, "[]");
}
+ $this->lang = $_SESSION["lang"] ?? "de";
}
-
- private function addEntry($name, $message) {
- $this->entries[] = [
- 'name' => $name,
- 'message' => $message,
- 'date' => date('Y-m-d H:i:s')
- ];
- }
-
- public function deleteEntry($index) {
- if (isset($this->entries[$index])) {
- unset($this->entries[$index]);
- $this->entries = array_values($this->entries); // Re-indizieren des Arrays
- $this->saveEntries();
- return true;
- }
- return false;
- }
-
-
-
- private function saveEntries() {
- file_put_contents($this->dbFile, json_encode($this->entries));
- }
-
- public function displayForm() {
+ public function getVideoPlayer()
+ {
return '
-
';
- foreach ($this->entries as $index => $entry) {
- $output .= "
-
-
{$entry['name']}
-
{$entry['message']}
-
{$entry['date']}";
- if ($isAdmin) {
- $output .= "
";
- }
-
- }
- $output .= '
';
- return $output;
-}
-
-
-}
-
-class ContactManager {
- public function displayForm() {
- return '
-
';
- }
-
- public function handleSubmission($name, $email, $message) {
- $feedback = [
- 'name' => $name,
- 'email' => $email,
- 'message' => $message,
- 'date' => date('Y-m-d H:i:s')
- ];
- $feedbacks = json_decode(file_get_contents('feedbacks.json') ?: '[]', true);
- $feedbacks[] = $feedback;
- file_put_contents('feedbacks.json', json_encode($feedbacks));
- }
-}
-
-class AdminManager {
- public function isAdmin() {
- return isset($_SESSION['admin']) && $_SESSION['admin'] === true;
- }
- public function handleLogin($username, $password) {
- echo "Login-Versuch: Username = $username, Passwort = $password"; // Debugging
- if ($username === 'admin' && $password === 'sonne4000') {
- $_SESSION['admin'] = true;
- return true;
- }
- return false;
- }
-
- public function handleImageUpload($file) {
- if (!$this->isAdmin()) {
- return false; // Nur Admins dürfen Bilder hochladen
- }
+ public function getImageFiles()
+ {
+ $files = glob($this->imageDir . "/screenshot_*.jpg");
- if (!isset($file['tmp_name']) || empty($file['tmp_name'])) {
- echo "Keine Datei hochgeladen.";
- return false;
+ rsort($files);
+ return json_encode($files);
+ }
+ public function getGalleryImages()
+ {
+ $images = [];
+ foreach (
+ glob($this->galleryDir . "/*.{jpg,jpeg,png,gif}", GLOB_BRACE)
+ as $img
+ ) {
+ $images[] = [
+ "src" => $img,
+ "thumb" => $img,
+ "date" => filemtime($img),
+ ];
}
-
- $target_dir = "uploads/";
- if (!file_exists($target_dir)) {
- mkdir($target_dir, 0777, true);
+ usort($images, function ($a, $b) {
+ return $b["date"] - $a["date"];
+ });
+ return $images;
+ }
+ public function getLatestVideo()
+ {
+ $videos = glob($this->imageDir . "/daily_video_*.mp4");
+ if (empty($videos)) {
+ return null;
}
-
- $target_file = $target_dir . basename($file["name"]);
- $uploadOk = 1;
- $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
-
-
- $check = @getimagesize($file["tmp_name"]);
- if($check === false) {
- echo "Die Datei ist kein Bild.";
- return false;
- }
-
-
- if ($file["size"] > 5000000) { // 5MB Limit
- echo "Die Datei ist zu groß.";
- return false;
- }
-
- // Erlauben Sie nur bestimmte Dateiformate
- if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
- && $imageFileType != "gif" ) {
- echo "Nur JPG, JPEG, PNG & GIF Dateien sind erlaubt.";
- return false;
- }
-
- // Wenn alles in Ordnung ist, versuchen Sie, die Datei hochzuladen
- if (move_uploaded_file($file["tmp_name"], $target_file)) {
- echo "Die Datei ". basename( $file["name"]). " wurde hochgeladen.";
- return true;
- } else {
- echo "Es gab einen Fehler beim Hochladen der Datei.";
- return false;
+ usort($videos, function ($a, $b) {
+ return filemtime($b) - filemtime($a);
+ });
+ return $videos[0];
+ }
+ public function addComment($name, $comment, $rating = 5)
+ {
+ $comments =
+ json_decode(file_get_contents($this->commentsFile), true) ?: [];
+ $comments[] = [
+ "name" => htmlspecialchars($name),
+ "comment" => htmlspecialchars($comment),
+ "rating" => intval($rating),
+ "time" => time(),
+ "id" => uniqid(),
+ ];
+ file_put_contents($this->commentsFile, json_encode($comments));
+ return true;
+ }
+ public function getComments()
+ {
+ $comments =
+ json_decode(file_get_contents($this->commentsFile), true) ?: [];
+ usort($comments, function ($a, $b) {
+ return $b["time"] - $a["time"];
+ });
+ return array_slice($comments, 0, 50);
+ }
+}
+class TranslationManager
+{
+ private $translations = [
+ "de" => [
+ "live" => "Live",
+ "timelapse" => "Zeitraffer",
+ "archive" => "Archiv",
+ "gallery" => "Galerie",
+ "comments" => "Kommentare",
+ "info" => "Info",
+ "chat" => "Chat",
+ "send" => "Senden",
+ "download" => "Herunterladen",
+ "screenshot" => "Bildschirmfoto",
+ "fullscreen" => "Vollbild",
+ "welcome" => 'Willkommen
+bei Aurora Webcam',
+ "rules" => "Nutzungsbedingungen",
+ "accept" => "Akzeptieren",
+ "decline" => "Ablehnen",
+ "contact" => "Kontakt",
+ "abuse" => 'Missbrauch
+melden',
+ "rating" => "Bewertung",
+ "name" => "Name",
+ "comment" => "Kommentar",
+ "submit" => "Absenden",
+ "loading" => "Lädt...",
+ "error" => "Fehler",
+ "success" => "Erfolgreich",
+ "darkmode" => "Dunkler Modus",
+ "lightmode" => "Heller Modus",
+ ],
+ "fr" => [
+ "live" => 'En
+direct',
+ "timelapse" => "Accéléré",
+ "archive" => "Archive",
+ "gallery" => "Galerie",
+ "comments" => "Commentaires",
+ "info" => "Info",
+ "chat" => "Chat",
+ "send" => "Envoyer",
+ "download" => "Télécharger",
+ "screenshot" => 'Capture d\'écran',
+ "fullscreen" => 'Plein
+écran',
+ "welcome" => "Bienvenue à Aurora Webcam",
+ "rules" => 'Conditions d\'utilisation',
+ "accept" => "Accepter",
+ "decline" => "Refuser",
+ "contact" => "Contact",
+ "abuse" => 'Signaler un
+abus',
+ "rating" => "Évaluation",
+ "name" => "Nom",
+ "comment" => "Commentaire",
+ "submit" => "Envoyer",
+ "darkmode" => "Mode sombre",
+ "lightmode" => "Mode clair",
+ ],
+ "it" => [
+ "live" => 'Dal
+vivo',
+ "timelapse" => "Time-lapse",
+ "archive" => "Archivio",
+ "gallery" => "Galleria",
+ "comments" => "Commenti",
+ "info" => "Info",
+ "chat" => "Chat",
+ "send" => "Invia",
+ "download" => "Scarica",
+ "screenshot" => "Screenshot",
+ "fullscreen" => 'Schermo
+intero',
+ "welcome" => "Benvenuti a Aurora Webcam",
+ "rules" => "Termini di utilizzo",
+ "accept" => "Accetta",
+ "decline" => "Rifiuta",
+ "contact" => "Contatto",
+ "abuse" => 'Segnala
+abuso',
+ "rating" => "Valutazione",
+ "name" => "Nome",
+ "comment" => "Commento",
+ "submit" => "Invia",
+ "darkmode" => "Modalità scura",
+ "lightmode" => 'Modalità
+chiara',
+ ],
+ "en" => [
+ "live" => "Live",
+ "timelapse" => "Timelapse",
+ "archive" => "Archive",
+ "gallery" => "Gallery",
+ "comments" => "Comments",
+ "info" => "Info",
+ "chat" => "Chat",
+ "send" => "Send",
+ "download" => "Download",
+ "screenshot" => "Screenshot",
+ "fullscreen" => "Fullscreen",
+ "welcome" => 'Welcome
+to Aurora Webcam',
+ "rules" => "Terms of Use",
+ "accept" => "Accept",
+ "decline" => "Decline",
+ "contact" => "Contact",
+ "abuse" => "Report Abuse",
+ "rating" => "Rating",
+ "name" => "Name",
+ "comment" => "Comment",
+ "submit" => "Submit",
+ "darkmode" => 'Dark
+Mode',
+ "lightmode" => 'Light
+Mode',
+ ],
+ "zh" => [
+ "live" => "直播",
+ "timelapse" => "延时摄影",
+ "archive" => "档案",
+ "gallery" => "图库",
+ "comments" => "评论",
+ "info" => "信息",
+ "chat" => "聊天",
+ "send" => "发送",
+ "download" => "下载",
+ "screenshot" => "截图",
+ "fullscreen" => "全屏",
+ "welcome" => "欢迎来到Aurora网络摄像头",
+ "rules" => "使用条款",
+ "accept" => "接受",
+ "decline" => "拒绝",
+ "contact" => "联系",
+ "abuse" => "举报滥用",
+ "rating" => "评分",
+ "name" => "姓名",
+ "comment" => "评论",
+ "submit" => "提交",
+ "darkmode" => "深色模式",
+ "lightmode" => "浅色模式",
+ ],
+ ];
+ private $currentLang = "de";
+ public function __construct($lang = "de")
+ {
+ $this->currentLang = $lang;
+ }
+ public function t($key)
+ {
+ return $this->translations[$this->currentLang][$key] ??
+ ($this->translations["de"][$key] ?? $key);
+ }
+ public function getLang()
+ {
+ return $this->currentLang;
+ }
+ public function setLang($lang)
+ {
+ if (isset($this->translations[$lang])) {
+ $this->currentLang = $lang;
+ $_SESSION["lang"] = $lang;
}
}
-
-
- public function displayLoginForm() {
- return '
-
';
+}
+class ChatManager
+{
+ private $chatFile = "chat.json";
+ private $maxMessages = 100;
+ public function __construct()
+ {
+ if (!file_exists($this->chatFile)) {
+ file_put_contents($this->chatFile, json_encode([]));
+ }
}
+ public function addMessage($user, $message)
+ {
+ $messages = $this->getMessages();
+ $messages[] = [
+ "user" => htmlspecialchars($user),
+ "message" => htmlspecialchars($message),
+ "time" => time(),
+ "id" => uniqid(),
+ ];
+ if (count($messages) > $this->maxMessages) {
+ array_shift($messages);
+ }
+ file_put_contents($this->chatFile, json_encode($messages));
+ return true;
+ }
+ public function getMessages()
+ {
+ $messages = json_decode(file_get_contents($this->chatFile), true) ?: [];
+ return array_filter($messages, function ($msg) {
+ return time() - $msg["time"] < 86400;
+ });
+ }
+}
+class CalendarManager
+{
+ private $videoDir = "./image";
+ public function getVideosForMonth($year, $month)
+ {
+ $videos = [];
+ $startDate = sprintf("%04d%02d01", $year, $month);
+ $endDate = sprintf("%04d%02d31", $year, $month);
+ foreach (glob($this->videoDir . "/daily_video_*.mp4") as $video) {
+ $filename = basename($video);
+ if (preg_match("/daily_video_(\d{8})/", $filename, $matches)) {
+ $videoDate = $matches[1];
+ if ($videoDate >= $startDate && $videoDate <= $endDate) {
+ $day = intval(substr($videoDate, 6, 2));
+ if (!isset($videos[$day])) {
+ $videos[$day] = [];
+ }
+ $videos[$day][] = $video;
+ }
+ }
+ }
+ return $videos;
+ }
+}
+$lang = $_GET["lang"] ?? ($_SESSION["lang"] ?? "de");
+$_SESSION["lang"] = $lang;
+$t = new TranslationManager($lang);
+$webcam = new WebcamManager();
+$chat = new ChatManager();
+$calendar = new CalendarManager();
+if (isset($_POST["chat_message"])) {
+ $chat->addMessage($_POST["chat_user"] ?? "Anonym", $_POST["chat_message"]);
+ header("Content-Type:application/json");
+ echo json_encode(["success" => true]);
+ exit();
+}
- public function displayAdminContent() {
- $feedbacks = json_decode(file_get_contents('feedbacks.json') ?: '[]', true);
- $output = '
Admin-Bereich
';
- foreach ($feedbacks as $feedback) {
- $output .= "
";
- $output .= "
{$feedback['name']} ({$feedback['email']})
";
- $output .= "
{$feedback['message']}
";
- $output .= "
{$feedback['date']}";
- $output .= "
";
+// Nach den anderen POST-Handlern
+if (isset($_POST['action']) && $_POST['action'] === 'upload_screenshot') {
+ if (isset($_FILES['screenshot'])) {
+ // In BEIDE Ordner speichern
+ $galleries = ['./gallery/', './image/'];
+ $success = false;
+
+ foreach ($galleries as $uploadDir) {
+ if (!file_exists($uploadDir)) mkdir($uploadDir, 0777, true);
+
+ $filename = 'screenshot_' . date('Ymd_His') . '.jpg';
+ $uploadFile = $uploadDir . $filename;
+
+ if (move_uploaded_file($_FILES['screenshot']['tmp_name'], $uploadFile)) {
+ $success = true;
+ break;
+ }
}
- $output .= '
';
-
- $output .= '
-
Social Media Links verwalten
-
';
- $output .= '
-
Bild hochladen
-
';
- return $output;
- }
-
- public function displayGalleryImages() {
- $output = '
';
- $files = glob("uploads/*.*");
- foreach($files as $file) {
- $filename = basename($file);
- $output .= '

';
- }
- $output .= '
';
- return $output;
- }
- public function handleSocialMediaUpdate($platform, $url) {
- $socialLinks = json_decode(file_get_contents('social_links.json') ?: '{}', true);
- $socialLinks[$platform] = $url;
- file_put_contents('social_links.json', json_encode($socialLinks));
+
+ header('Content-Type: application/json');
+ echo json_encode(['success' => $success, 'file' => $filename]);
+ exit;
}
}
-$webcamManager = new WebcamManager();
-$imageFilesJson = $webcamManager->getImageFiles();
-$guestbookManager = new GuestbookManager();
-$contactManager = new ContactManager();
-$adminManager = new AdminManager();
-if (isset($_GET['action'])) {
- switch ($_GET['action']) {
- case 'snapshot':
- $webcamManager->captureSnapshot();
-
- break;
- case 'sequence':
- $webcamManager->captureVideoSequence();
-
- break;
-
- }
-
+if (isset($_GET["get_messages"])) {
+ header("Content-Type:application/json");
+ echo json_encode($chat->getMessages());
+ exit();
}
-
-
-if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'delete_guestbook') {
- if ($adminManager->isAdmin() && isset($_POST['delete_entry'])) {
- $index = $_POST['delete_entry'];
- if ($guestbookManager->deleteEntry($index)) {
- $_SESSION['message'] = "Eintrag erfolgreich gelöscht.";
- } else {
- $_SESSION['error'] = "Fehler beim Löschen des Eintrags.";
- }
- // Umleitung zur gleichen Seite, um Neuladen des Formulars zu verhindern
- header("Location: " . $_SERVER['PHP_SELF'] . "#guestbook");
+if (isset($_POST["add_comment"])) {
+ $webcam->addComment(
+ $_POST["comment_name"] ?? "Anonym",
+ $_POST["comment_text"],
+ $_POST["rating"] ?? 5,
+ );
+ header("Content-Type:application/json");
+ echo json_encode(["success" => true]);
+ exit();
+}
+if (isset($_GET["get_comments"])) {
+ header("Content-Type:application/json");
+ echo json_encode($webcam->getComments());
+ exit();
+}
+if (isset($_GET["get_gallery"])) {
+ header("Content-Type:application/json");
+ echo json_encode($webcam->getGalleryImages());
+ exit();
+}
+if (isset($_GET["get_calendar_videos"])) {
+ $month = $_GET["month"] ?? date("n");
+ $year = $_GET["year"] ?? date("Y");
+ header("Content-Type:application/json");
+ echo json_encode($calendar->getVideosForMonth($year, $month));
+ exit();
+}
+if (isset($_GET["download_video"])) {
+ $video = $webcam->getLatestVideo();
+ if ($video && file_exists($video)) {
+ header("Content-Type:video/mp4");
+ header(
+ 'Content-Disposition:attachment;filename="' .
+ basename($video) .
+ '"',
+ );
+ readfile($video);
exit();
}
-}
-
-
-if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- if (isset($_POST['guestbook'])) {
- $guestbookManager->handleFormSubmission();
- } elseif (isset($_POST['contact'])) {
- $contactManager->handleSubmission($_POST['name'], $_POST['email'], $_POST['message']);
- } elseif (isset($_POST['admin-login'])) {
- $adminManager->handleLogin($_POST['username'], $_POST['password']);
- } elseif (isset($_POST['update-social-media'])) {
- $adminManager->handleSocialMediaUpdate($_POST['social-platform'], $_POST['social-url']);
-
-
- } elseif (isset($_FILES["fileToUpload"]) && $adminManager->isAdmin()) {
- $adminManager->handleImageUpload($_FILES["fileToUpload"]);
-}}
-?>
-
-
-
+} ?>
-
-
-
-
-
Aurora Livecam - Einzigartige Live-Webcam und Wetter>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-

-
Willkommen bei Aurora Wetter Livecam
-

-
-
Erleben Sie faszinierende Ausblicke der Züricher Region - in Echtzeit!
-
-
-
-