Initial commit: Backup der Webseiten

- zoesch.de
- blitzkiste.net
- gruene-hassberge (norbert.zoesch.de)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Felix Zösch
2025-12-13 01:17:15 +01:00
commit 07c290a453
4607 changed files with 1202735 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<?php
class Page_Data
{
public $title = "";
public $content = "";
public $css = "";
public $embeddedStyle = "";
public $scriptElements = "";
//declare methods
public function addScript( $src ){
$this->scriptElements .= "<script src='$src'></script>";
}
public function addCSS( $href ){
$this->css .= "<link href='$href' rel='stylesheet' />";
}
}

View File

@@ -0,0 +1,33 @@
<?php
class Uploader
{
private $filename;
private $fileData;
private $destination;
//declare a constructor method
public function __construct($key)
{
$this->filename = $_FILES[$key]['name'];
$this->fileData = $_FILES[$key]['tmp_name'];
}
public function saveIn($folder)
{
$this->destination = $folder;
}
public function save()
{
$folderIsWriteAble = is_writable($this->destination);
if ($folderIsWriteAble) {
$name = "$this->destination/$this->filename";
$succes = move_uploaded_file($this->fileData, $name);
} else {
trigger_error("cannot write to $this->destination");
$succes = false;
}
return $succes;
}
}

View File

@@ -0,0 +1 @@
h1 {color:red;}

View File

@@ -0,0 +1,5 @@
nav a {
text-decoration: none;
color: black;
}
nav a:hover {text-decoration: underline;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

View File

@@ -0,0 +1,20 @@
<?php
//complete code for index.php
error_reporting(E_ALL);
ini_set("display_errors", 1);
include_once "classes/Page_Data.class.php";
$pageData = new Page_Data();
$pageData->addScript("js/lightbox.js");
$pageData->title = "Dynamic image gallery";
$pageData->addCSS("css/layout.css");
$pageData->addCSS("css/navigation.css");
$pageData->content = include_once "views/navigation.php";
$userClicked = isset($_GET["page"]);
if ($userClicked) {
$fileToLoad = $_GET["page"];
} else {
$fileToLoad = "gallery";
}
$pageData->content .= include_once "views/$fileToLoad.php";
$page = include_once "templates/page.php";
echo $page;

View File

View File

@@ -0,0 +1,15 @@
<?php
return "<!DOCTYPE html>
<html>
<head>
<title>$pageData->title</title>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
$pageData->css
$pageData->embeddedStyle
</head>
<body>
$pageData->content
$pageData->scriptElements
</body>
</html>";

View File

@@ -0,0 +1,25 @@
<?php
//function call
return showImages();
//function defintion
function showImages()
{
$out = '<h1>Image Gallery</h1>';
$out .= "<ul id='images'>";
$folder = 'img';
$filesInFolder = new DirectoryIterator($folder);
while ($filesInFolder->valid()) {
$file = $filesInFolder->current();
$filename = $file->getFilename();
$src = "$folder/$filename";
$fileInfo = new Finfo(FILEINFO_MIME_TYPE);
$mimeType = $fileInfo->file($src);
if ($mimeType === 'image/jpeg') {
$out .= "<li><img src='$src' /></li>";
}
$filesInFolder->next();
}
$out .= '</ul>';
return $out;
}

View File

@@ -0,0 +1,7 @@
<?php
return "
<nav>
<a href='index.php?page=gallery'>Gallery</a>
<a href='index.php?page=upload'>Upload new image</a>
</nav>
";

View File

@@ -0,0 +1,8 @@
<?php
return "
Upload new jpg images</h1>
<form method='post' action='index.php?page=upload' enctype='multipart/form-data' >
<label>Find a jpg image to upload</label>
<input type='file' name='image-data' accept='image/jpeg'/>
<input type='submit' value='upload' name='new-image' />
</form>";

View File

@@ -0,0 +1,29 @@
<?php
//complete source code for views/upload.php
//$newImageSubmitted is TRUE if form was submitted, otherwise FALSE
$newImageSubmitted = isset($_POST['new-image']);
if ($newImageSubmitted) {
//this code runs if form was submitted
$output = upload();
} else {
//this runs if form was NOT submitted
$output = include_once 'views/upload-form.php';
}
return $output;
//declare new function
function upload()
{
include_once 'classes/Uploader.class.php';
//image-data is the name attribute used in <input type='file' />
$uploader = new Uploader('image-data');
$uploader->saveIn('img');
$fileUploaded = $uploader->save();
if ($fileUploaded) {
$out = 'new file uploaded';
} else {
$out = 'something went wrong';
}
return $out;
}