This commit is contained in:
klaas 2025-01-15 19:59:49 +01:00
parent f86297d3ca
commit 614b597470
319 changed files with 10043 additions and 0 deletions

24
autoload.php Normal file
View File

@ -0,0 +1,24 @@
<?php
spl_autoload_register(function ($class) {
$prefix = 'App\\';
// base directory for the namespace $prefix
// __DIR__ entspricht dem aktuellen Pfad
$base_dir = __DIR__ .'/src/';
//$base_dir = "/src/";
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
$relative_class = substr($class, $len);
$file = ($base_dir . str_replace('\\', '/', $relative_class) . '.php');
if (file_exists($file)) {
require $file;
}
});

2
index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
phpinfo();

17
init.php Normal file
View File

@ -0,0 +1,17 @@
<?php
require __DIR__ . "/autoload.php";
function e($str) {
return (htmlentities($str, ENT_QUOTES, 'UTF-8'));
}
function date_german($datum) {
list($jahr, $monat, $tag) = explode("-", $datum);
return("$tag.$monat.$jahr"); // Ausgabe: 20.10.2013
}
$container = new App\Core\Container();
?>

BIN
logo_mini.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1
public/counter.txt Normal file
View File

@ -0,0 +1 @@
11

82
public/index.php Normal file
View File

@ -0,0 +1,82 @@
<?php
session_start();
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
$past = time() - 3600;
foreach ( $_COOKIE as $key => $value ) {
setcookie( $key, $value, $past, '/' );
}
session_set_cookie_params(60); // 60 sec keine Erhöhung des counters in Datei counter.text
$counterstand = htmlentities(intval(file_get_contents("counter.txt"))); //zählt die Aurufe
if(!isset($_SESSION['counter_ip'])){
$counterstand++; //echo $counterstand;
file_put_contents("counter.txt", $counterstand);
$_SESSION['counter_ip'] = true;
}
require __DIR__ . ("/../init.php");
$pathInfo = $_SERVER['PATH_INFO']; //var_dump ($pathInfo);
$routes = [
'/index' => [
'controller' => 'loginController',
'method' => 'index' // index Methode anwenden
],
'/hbc' => [
'controller' => 'loginController',
'method' => 'hbc' // index Methode anwenden
],
'/stb' => [
'controller' => 'loginController',
'method' => 'stb' // index Methode anwenden
],
'/fotos' => [
'controller' => 'loginController',
'method' => 'fotos' // index Methode anwenden
],
'/blog' => [
'controller' => 'loginController',
'method' => 'blog' // index Methode anwenden
],
'/login' => [
'controller' => 'loginController',
'method' => 'login' // index Methode anwenden
],
'/logout' => [
'controller' => 'loginController',
'method' => 'logout' // index Methode anwenden
],
'/impressum' => [
'controller' => 'loginController',
'method' => 'impressum' // index Methode anwenden
],
'/dashboard' => [
'controller' => 'loginController',
'method' => 'dashboard' // dashboard Methode anwenden
],
'/settings' => [
'controller' => 'loginController',
'method' => 'settings' // dashboard Methode anwenden
],
];
// Wenn in der PATH_INFO eine seite gespeichert wurde (z.B. /index oder /post) kann
// sie aus dem array $routes ausgelesen werden. Im array ist gespeichert, welcher
// controller zu verwenden ist und welche Methode des controllers anzuwenden ist
if (isset($routes[$pathInfo])) { // ist eine PATH_INFO gesetzt?
$route = $routes[$pathInfo]; // zwischenspeichern
$controller = $container->make($route['controller']); // make für den controller setzen
$method = $route['method']; // Methode holen
$controller->$method(); // Controller führt Methode aus
} else {
header("Location: /home/public/index.php/index");
die();
}
?>

41
scandir.php Executable file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>ScanDir-Test</title>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="gallery.css"/>
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet"> <!--FontAwesome-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php
$dir = __DIR__ . "/foto/views/images/ostfriesland/landschaft/";
echo "</br>".$dir."</br>";
$pictures = array();
var_dump($pictures);
echo "</br></br>";
$pictures = scandir($dir);
var_dump($pictures);
echo "</br></br>";
var_dump(scandir($dir));
foreach($pictures as $picture)
{
echo "".$picture."<br />";
}
?>
</body>
</html>

14
src/Core/AbstractController.php Executable file
View File

@ -0,0 +1,14 @@
<?php
namespace App\Core;
abstract class AbstractController
{
protected function render($view, $params)
{
extract($params);
include __DIR__ . "/../../views/{$view}.php";
}
}
?>

26
src/Core/AbstractModel.php Executable file
View File

@ -0,0 +1,26 @@
<?php
namespace app\Core;
use ArrayAccess;
abstract class AbstractModel implements ArrayAccess
{
public function offsetExists ($offset) {
return isset($this->$offset);
}
public function offsetGet ($offset) {
return $this->$offset;
}
public function offsetSet ($offset, $value) {
$this->$offset = $value;
}
public function offsetUnset ($offset) {
unset ($this->$offset);
}
}
?>

38
src/Core/AbstractRepository.php Executable file
View File

@ -0,0 +1,38 @@
<?php
namespace App\Core;
use PDO;
abstract class AbstractRepository {
protected $pdo;
public function __construct(PDO $pdo)
{
$this->pdo = $pdo;
}
abstract public function getTableName();
abstract public function getModelName();
function all() {
$table = $this->getTableName();
$model = $this->getModelName();
$stmt = $this->pdo->query("SELECT * FROM `$table`");
$posts = $stmt->fetchALL(PDO::FETCH_CLASS, $model);
return $posts;
}
function find($id) {
$table = $this->getTableName();
$model = $this->getModelName();
$stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE id = :id");
$stmt->execute(['id' => $id]);
$stmt->setFetchMode(PDO::FETCH_CLASS, $model);
$post = $stmt->fetch(PDO::FETCH_CLASS);
return $post;
}
}
?>

76
src/Core/Container.php Normal file
View File

@ -0,0 +1,76 @@
<?php
namespace App\Core;
use PDO;
use App\Post\PostsRepository;
use App\Post\CommentsRepository;
use App\Post\PostsController;
use App\User\UsersRepository;
use App\User\LoginController;
use App\User\LoginService;
class Container
{
private $receips = []; // Bauanleitung für verschiedene instances
private $instances = [];
public function __construct() {
$this->receips = [
'loginService' => function() {
return new LoginService(
$this->make('usersRepository')
);
},
'loginController' => function() {
return new LoginController(
$this->make('loginService')
);
},
'postsController' => function() {
return new PostsController( //neuer PostsController
$this->make('postsRepository'),
$this->make('commentsRepository')
);
},
'usersRepository' => function() {
return new UsersRepository(
$this->make("pdo")
);
},
'postsRepository' => function() {
return new PostsRepository(
$this->make("pdo")
);
},
'commentsRepository' => function() {
return new CommentsRepository(
$this->make("pdo")
);
},
'pdo' => function() {
$servername = "mysqle8e6.netcup.net";
$port = "3306";
$username = "k46054_hbc";
$password = "cXZm/E97dKvZy6Cg*";
$dbname="k46054_hbc";
$pdo = new PDO("mysql:host=$servername;dbname=$dbname;port=$port", $username, $password);
// Attribut wegen Sicherheit auf false setzen
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
return $pdo;
}
];
}
public function make($name) {
if (!empty($this->instances[$name])){
return $this->instances[$name]; // DB-Verbindung besteht
}
// sonst ERZEUGE return $this->instances[$name
if (isset($this->receips[$name])) {
$this->instances[$name] = $this->receips[$name]();
}
return $this->instances[$name];
}
}
?>

105
src/User/LoginController.php Executable file
View File

@ -0,0 +1,105 @@
<?php
namespace App\User;
use App\Core\AbstractController;
class LoginController extends AbstractController {
public function __construct(LoginService $loginService){
$this->loginService = $loginService;
}
public function index(){
$this->loginService->index();
$this->render("user/index", []);
}
public function blog(){
$this->loginService->blog();
$this->render("user/blog", []);
}
public function hbc(){
$this->loginService->hbc();
$this->render("user/hbc", []);
}
public function stb(){
// $this->loginService->stb();
$this->loginService->check();
$this->render("user/stb", []);
}
public function fotos(){
$this->loginService->fotos();
$this->render("user/fotos", []);
}
public function impressum(){
$this->loginService->impressum();
$this->render("user/impressum", []);
}
public function admin(){
$this->loginService->check();
$this->render("user/admin", []);
}
public function dashboard(){
$this->render("user/dashboard", []);
}
public function settings() {
echo "<br><br><br>";
$msg = "";
if (isset($_GET['id'])) {
$id = $_GET['id'] - 1;
$_SESSION['id'] = $id;
}
if (isset($_GET['save'])) {
$save = $_GET['save'];
echo $msg = $this->loginService->saveOneUser();
}
$users = $this->loginService->getAllUsers();
if (isset($_SESSION['id'])) { $id = $_SESSION['id']; }else{ $id=0;}
$user = $users[$id];
echo "<br>";
$this->render("user/settings", [
'users' => $users,
'user' => $user,
'msg' => $msg
]);
}
public function logout() {
$this->loginService->logout();
$this->render("user/logout", []);
}
public function login(){
$error = false;
if(!empty($_POST['username']) And !empty($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
if ($this->loginService->attempt($username, $password)) {
if ($_SESSION['rechte'] == "admin") {
$users = $this->loginService->getAllUsers();
$_SESSION['login'] = $username;
$this->render("user/admin", [
'users' => $users
]);
return;
} else {
header ("Location: dashboard");
return;
}
} else { $error = true; }
}
$this->render("user/login", [
'error' => $error // Übergabe an view
]);
} // end login
} // end class
?>

109
src/User/LoginController_1.php Executable file
View File

@ -0,0 +1,109 @@
<?php
namespace App\User;
use App\Core\AbstractController;
class LoginController extends AbstractController {
public function __construct(LoginService $loginService){
$this->loginService = $loginService;
}
public function index(){
$this->loginService->index();
$this->render("user/index", []);
}
public function blog(){
$this->loginService->blog();
$this->render("user/blog", []);
}
public function hbc(){
$this->loginService->hbc();
$this->render("user/hbc", []);
}
public function stb(){
// $this->loginService->stb();
$this->loginService->check();
$this->render("user/stb", []);
}
public function fotos(){
$this->loginService->fotos();
$this->render("user/fotos", []);
}
public function impressum(){
$this->loginService->impressum();
$this->render("user/impressum", []);
}
public function admin(){
$this->loginService->check();
//$this->loginService->admin();
$this->render("user/admin", []);
}
public function dashboard(){
//$this->loginService->check();
$this->render("user/dashboard", []);
}
public function settings() {
echo "<br><br><br>";
$msg = "";
if (isset($_GET['id'])) {
$id = $_GET['id'] - 1;
$_SESSION['id'] = $id;
}
if (isset($_GET['save'])) {
$save = $_GET['save'];
echo $msg = $this->loginService->saveOneUser();
}
$users = $this->loginService->getAllUsers(); // ok
if (isset($_SESSION['id'])) {
echo $id = $_SESSION['id'];
}else{$id=0;}
$user = $users[$id];
echo "<br>";
$this->render("user/settings", [
'users' => $users,
'user' => $user,
'msg' => $msg
]);
}
public function logout() {
$this->loginService->logout();
$this->render("user/logout", []);
//header("Location: user/login"); // weiterleitung zum login
}
public function login(){
$error = false;
if(!empty($_POST['username']) And !empty($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
if ($this->loginService->attempt($username, $password)) {
if ($_SESSION['rechte'] == "admin") {
$users = $this->loginService->getAllUsers();
$_SESSION['login'] = $username;
//$_SESSION['id'] = $user['id'];
$this->render("user/admin", [
'users' => $users
]);
return;
} else {
header ("Location: dashboard");
return;
}
} else { $error = true; }
}
$this->render("user/login", [
'error' => $error // Übergabe an view
]);
} // end login
} // end class ?>

133
src/User/LoginService.php Executable file
View File

@ -0,0 +1,133 @@
<?php
namespace App\User;
class LoginService {
public function __construct(UsersRepository $usersRepository) {
$this->usersRepository = $usersRepository; // LoginService hat jetzt Zugriff auf DB
}
public function check() {
if (isset($_SESSION['login'])) {
return true;
} else {
header("Location: login");
//die(); // hier könnte auch eine exeption ausgeführt werden
}
}
function getUser($id) {
global $pdo;
$_SESSION['userid'] = $id;
$statement = $pdo->prepare("SELECT * FROM users WHERE id = :id");
$result = $statement->execute(array('id' => $_SESSION['userid']));
$user = $statement->fetch();
return $user;
}
public function getAllUsers() {
$users = $this->usersRepository->allUserNames();
return $users;
}
public function saveOneUser() {
$msg = $this->usersRepository->saveUserData();
//echo $msg;
return $msg;
}
public function attempt($username, $password) {
$user = $this->usersRepository->findByUserName($username); // user aus db
if(empty($user)) {
return false; // Nutzer nicht vorhanden
}
if (password_verify($password, $user->password )) { //echo ("Login erfolgreich!");
$_SESSION['login'] = $user->username;
$_SESSION['id'] = $user->id;
$_SESSION['rechte'] = $user->rechte;
$_SESSION['seite'] = $user->seite;
//session_regenerate_id(true);
return true; // Login erfolgreich
} else {
return false;
}
}
public function index() {
unset($_SESSION['login']);
//unset($_SESSION['id']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function logout() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function hbc() {
unset($_SESSION['login']);
// session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function stb() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function fotos() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function blog() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function admin() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function settings() {
//unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
/*
public function ostfriesland() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function rheinruhr() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function nordpark() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function natur() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function auswahl() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
public function about() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
*/
public function impressum() {
unset($_SESSION['login']);
session_regenerate_id(true); // nicht zwingend aber schadet nicht
}
}
?>

22
src/User/UserModel.php Executable file
View File

@ -0,0 +1,22 @@
<?php
namespace App\User;
use App\Core\AbstractModel;
class UserModel extends AbstractModel
{
public $id;
public $username;
public $email;
public $seite;
public $password;
}
// nachstehende functions bedienen das ArrayAccess
// damit können in post.php Zugriffe auf ein Array aus
// der DB getätigt werden
?>

116
src/User/UsersRepository.php Executable file
View File

@ -0,0 +1,116 @@
<?php
namespace App\User;
use App\Core\AbstractRepository;
use PDO;
class UsersRepository extends AbstractRepository {
// abstract functions aus dem AbstractRepositery müssen hier definiert werden!
public function getTableName() {
return "users";
}
public function getModelName() {
return "App\\User\\UserModel";
}
// nachstehende function findet den username und gibt array des users zurück
public function findByUserID($id) {
$table = $this->getTableName();
$model = $this->getModelName();
$stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE id = :id");
$stmt->execute(['id' => $id]);
$stmt->setFetchMode(PDO::FETCH_CLASS, $model);
$user = $stmt->fetch(PDO::FETCH_CLASS);
// var_dump($user); //die();
return $user;
}
public function findByUserName($username) {
$table = $this->getTableName();
$model = $this->getModelName();
$stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE username = :username");
$stmt->execute(['username' => $username]);
$stmt->setFetchMode(PDO::FETCH_CLASS, $model);
$user = $stmt->fetch(PDO::FETCH_CLASS);
//var_dump($user); die();
return $user;
}
public function allUserNames() {
$table = $this->getTableName();
$model = $this->getModelName();
$strSQL = "SELECT * FROM `$table`";
$stmt = $this->pdo->query($strSQL);
$users = $stmt->fetchALL(PDO::FETCH_CLASS, $model);
return $users;
}
// *****************************************************************************
public function saveUserData() {
$error_msg = $success_msg = "";
if (isset($_GET['save'])) {
$save = $_GET['save'];
$userid = trim($_POST['id']);
$id = trim($_POST['id']);
$user = $this->findByUserID($id);
if ($save == 'personal_data') {
$vorname = trim($_POST['vorname']);
$nachname = trim($_POST['nachname']);
if ($vorname == "" || $nachname == "") {
$error_msg = "Bitte Vor- und Nachname ausfüllen.";
} else {
$statement = $this->pdo->prepare("UPDATE users SET vorname = :vorname, nachname = :nachname, updated_at=NOW() WHERE id = :id");
$result = $statement->execute(array('vorname' => $vorname, 'nachname'=> $nachname, 'id' => $id));
$success_msg = "Daten erfolgreich gespeichert.";
}
// emai geändert
} else if ($save == 'email') {
$passwort = $_POST['passwort'];
$email = trim($_POST['email']);
$email2 = trim($_POST['email2']);
if ($email != $email2) {
$error_msg = "Die eingegebenen E-Mail-Adressen stimmten nicht überein.";
} else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error_msg = "Bitte eine gültige E-Mail-Adresse eingeben.";
} else
if (password_verify($passwort, $user['password'])) {
$error_msg = "Bitte korrektes Passwort eingeben.";
} else {
$statement = $this->pdo->prepare("UPDATE users SET email = :email WHERE id = :userid");
$result = $statement->execute(array('email' => $email, 'userid' => $user['id'] ));
$success_msg = "E-Mail-Adresse erfolgreich gespeichert!";
}
// PW Änderung
} else if ($save == 'passwort') {
$passwortAlt = $_POST['passwortAlt'];
$passwortNeu = trim($_POST['passwortNeu']);
$passwortNeu2 = trim($_POST['passwortNeu2']);
if ($passwortNeu != $passwortNeu2) {
$error_msg = "Die eingegebenen Passwörter stimmten nicht überein.";
} else if($passwortNeu == "") {
$error_msg = "Das Passwort darf nicht leer sein.";
} else if(!password_verify($passwortAlt, $user['password'])) {
$error_msg = "Bitte korrektes Passwort eingeben";
} else {
$passwort_hash = password_hash($passwortNeu, PASSWORD_DEFAULT);
//$oasswort_hash = password_hash($passwordNeu, PASSWORD_BCRYPT);
$statement = $this->pdo->prepare("UPDATE users SET password = :password WHERE id = :userid");
$result = $statement->execute(array('password' => $passwort_hash, 'userid' => $user['id'] ));
$success_msg = "Passwort erfolgreich gespeichert.";
}
}
} // Ende if save = personel data, ...
return $error_msg." - ".$success_msg;
} // Ende Funktion
}
?>

BIN
stb/.DS_Store vendored Executable file

Binary file not shown.

BIN
stb/._.DS_Store Executable file

Binary file not shown.

38
stb/autoload.php Executable file
View File

@ -0,0 +1,38 @@
<?php
/*
* An example of a project-specific implementation.
* @param string $class The fully-qualified class name.
* @return void
*/
spl_autoload_register(function ($class) {
// project-specific namespace prefix
$prefix = 'App\\';
// base directory for the namespace $prefix
// __DIR__ entspricht dem aktuellen Pfad
$base_dir = __DIR__ .'/src/';
//$base_dir = "/src/";
// does the class use the namespace prefix?
//echo "</br>base_dir: ".$base_dir; //die();
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
//echo "</br>relative class: ".$relative_class; //die();
$file = ($base_dir . str_replace('\\', '/', $relative_class) . '.php');
//echo "</br>file: ".$file; //die();
// if the file exists, require it
if (file_exists($file)) {
require $file;
//echo "</br>file required: ".$file; //die();
} else {
//echo "</br>kein File: ".$file." vorhanden "; //die();
}
});

4
stb/exceptions.php Executable file
View File

@ -0,0 +1,4 @@
<?php
?>

BIN
stb/img/ArrowDown.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 B

BIN
stb/img/ArrowLeft.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
stb/img/ArrowRight.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

BIN
stb/img/ArrowUp.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

BIN
stb/img/ArrowUp.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 KiB

BIN
stb/img/Gendersign.svg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
stb/img/addr.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

BIN
stb/img/admArrowUp.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

BIN
stb/img/alive.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

BIN
stb/img/doc.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
stb/img/f.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

BIN
stb/img/favicon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
stb/img/female.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

BIN
stb/img/g.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
stb/img/gender_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
stb/img/iall.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
stb/img/iged.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
stb/img/ihelp.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
stb/img/ilist.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
stb/img/imail.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
stb/img/ipdf.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
stb/img/iphotos.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
stb/img/iprint.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
stb/img/isheet.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
stb/img/ixls.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
stb/img/m.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

BIN
stb/img/mail.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
stb/img/male.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

BIN
stb/img/mob.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

BIN
stb/img/nopic.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

BIN
stb/img/pic.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
stb/img/sfemale.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

BIN
stb/img/smale.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

BIN
stb/img/t.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
stb/img/tel.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

BIN
stb/img/th.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
stb/img/tng_female.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

BIN
stb/img/tng_male.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

BIN
stb/img/u.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
stb/img/u.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

147
stb/init.php Executable file
View File

@ -0,0 +1,147 @@
<?php
require __DIR__ . "/autoload.php";
//require __DIR__ . "/database.php"; wird im $container = new App\Core\Container(); gebildet
// Die Function e($str) wandelt einen string so um, dass zeichen wie ", "", '', >, <; in
// entsprechende &quot, &lt, &gt, ... gewandelt werden. XSS => cross site scripting
function e($str) {
return (htmlentities($str, ENT_QUOTES, 'UTF-8'));
}
// prüft alle Eingabefelder
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
// Die Funktion wandelt das amerikanische Datum in eine deutsche um
function date_german($datum) { // Eingabe: 2013-10-20
list($jahr, $monat, $tag) = explode("-", $datum);
return("$tag.$monat.$jahr"); // Ausgabe: 20.10.2013
}
// die Funktion wandelt ein datum in ein reines Jahr
function jahr($datum) {
if ($datum != 0) {
$jahr = date("Y",strtotime($datum));
} else { $jahr = '????';}
return $jahr;
}
// Geburtstag - Todestag
function date_period($person) { // Eingabe: 2013-10-20
list($jahr, $monat, $tag) = explode("-", $person['day_of_birth']);
$period = ("$tag.$monat.$jahr");
list($jahr, $monat, $tag) = explode("-", $person['day_of_death']);
if ($tag != 0) {$period = $period." - "."$tag.$monat.$jahr";}
$period = "(".$period.")";
return $period;
}
function periode($person){
if (($person->day_of_birth)!= 0){
$birth = DateTime::createFromFormat('Y-m-d', $person->day_of_birth);
$period = "(".$birth->format('Y')."-";
} else { $period = "( - ";}
if ($person->day_of_death >=1){$death = DateTime::createFromFormat('Y-m-d', $person->day_of_death);
$period = $period.$death->format('Y').")";
} else { $period = $period." )"; }
return $period;
}
// Alter der Person
function alter($person) {
if ($person['day_of_birth'] != 0){ // Geburtstag eingetragen
$geburtstag = new DateTime($person['day_of_birth']);
if ($person['day_of_death'] != 0){ // Todestag eingetragen
$todestag = new DateTime(date($person['day_of_death']));
$alter = $geburtstag->diff($todestag);
return $alter->format('%y'); // Alter ausgeben
} else {
if ($person['place_of_death'] != ""){ // Ort des Todes
return $alter = "† ?"; // kein Alter möglich
} else {
$heute = new DateTime(date('Y-m-d')); // Alter lebender Person
$alter = $geburtstag->diff($heute);
return $alter->format('%y');
}
}
} else {
if ($person['place_of_death'] != ""){ // Ort des Todes
return $alter = "† ?";} // kein Ort des Todes
else {return $alter = "?";} // kein Geburtstag eingetragen
}
}
//convert date from yyyy-mm-dd database format to dd MMM yyyy gedcom format
function date_ged($incoming) {
// define the months
$months = array ("00" => "00", "01" => "Jan", "02" => "Feb", "03" => "Mrz", "04" => "Apr",
"05" => "Mai", "06" => "Jun", "07" => "Jul", "08" => "Aug", "09" => "Sep",
"10" => "Okt", "11" => "Nov", "12" => "Dez");
$work = explode("-", $incoming);
if ($work[1] == "00" OR $work[2] == "00") {
$retval = "$work[0]"; // if month or day unknown, just return year
} else {
$replacemonth = strtr($work[1], $months); // reformat whole date to dd MMM yyyy
$retval = "$work[2] $replacemonth $work[0]";
}
return $retval; // return the string for gedcom DATE
}
// return GET['index'], set SESION['index'], OR return default
function getAndSetSession($index, $session, $default){
if ((isset($_GET[$index])) || !empty($_GET[$index])){
$_SESSION[$session] = $_GET[$index];
} else {
if (!isset($_SESSION[$session])){
$_SESSION[$session] = $default;
}
}
return $_SESSION[$session];
}
function getUmlauteArray() {
return array(
'ü'=>'ü',
'ä'=>'ä',
'ö'=>'ö', 'Ö'=>'Ö',
'ß'=>'ß', 'à '=>'à', 'á'=>'á', 'â'=>'â', 'ã'=>'ã',
'ù'=>'ù', 'ú'=>'ú', 'û'=>'û',
'Ù'=>'Ù', 'Ú'=>'Ú', 'Û'=>'Û', 'Ãœ'=>'Ü',
'ò'=>'ò', 'ó'=>'ó', 'ô'=>'ô',
'è'=>'è', 'é'=>'é', 'ê'=>'ê', 'ë'=>'ë',
'À'=>'À', 'Á'=>'Á', 'Â'=>'Â', 'Ã'=>'Ã', 'Ä'=>'Ä', 'Ã…'=>'Å',
'Ç'=>'Ç', 'È'=>'È', 'É'=>'É', 'Ê'=>'Ê', 'Ë'=>'Ë', 'ÃŒ'=>'Ì',
'Í'=>'Í', 'ÃŽ'=>'Î', 'Ï'=>'Ï',
'Ñ'=>'Ñ',
'Ã’'=>'Ò', 'Ó'=>'Ó', 'Ô'=>'Ô', 'Õ'=>'Õ', 'Ø'=>'Ø',
'Ã¥'=>'å',
'æ'=>'æ',
'ç'=>'ç',
'ì'=>'ì', 'í'=>'í', 'î'=>'î', 'ï'=>'ï',
'ð'=>'ð',
'ñ'=>'ñ',
'õ'=>'õ',
'ø'=>'ø',
'ý'=>'ý', 'ÿ'=>'ÿ',
'€'=>'€' );
}
function fixeUmlauteDb() {
$umlaute = $this->getUmlauteArray();
foreach ($umlaute as $key => $value){
$sql = "UPDATE table SET tracks = REPLACE(row, '{$key}', '{$value}') WHERE row LIKE '%{$key}%'";
}
}
// Container dient zur erzeugung von instances nach festgelegten Bauanleitungen (receipts)
// Hier wird eine neue class gebildet
$container = new App\Core\Container();
//var_dump($container); // erster Test, ob der code läuft
//$usersRepository = $container->make("usersRepository");
//var_dump($usersRepository); // zweiter Test, nachdem UsersRepository erzeugt wurde
//var_dump($usersRepository->all()); // dritter Test, alle user auslesen; function aus AbstractRepostory
// nächster Test, finde user "Erik"; function aus init.php
//var_dump($usersRepository->findByUserName("test"));
//die();
?>

143
stb/init_alt.php Executable file
View File

@ -0,0 +1,143 @@
<?php
require __DIR__ . "/autoload.php";
//require __DIR__ . "/database.php"; wird im $container = new App\Core\Container(); gebildet
// Die Function e($str) wandelt einen string so um, dass zeichen wie ", "", '', >, <; in
// entsprechende &quot, &lt, &gt, ... gewandelt werden. XSS => cross site scripting
function e($str) {
return (htmlentities($str, ENT_QUOTES, 'UTF-8'));
}
// prüft alle Eingabefelder
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
// Die Funktion wandelt das amerikanische Datum in eine deutsche um
function date_german($datum) { // Eingabe: 2013-10-20
list($jahr, $monat, $tag) = explode("-", $datum);
return("$tag.$monat.$jahr"); // Ausgabe: 20.10.2013
}
// die Funktion wandelt ein datum in ein reines Jahr
function jahr($datum) {
if ($datum != 0) {
$jahr = date("Y",strtotime($datum));
} else { $jahr = '????';}
return $jahr;
}
// Geburtstag - Todestag
function date_period($person) { // Eingabe: 2013-10-20
list($jahr, $monat, $tag) = explode("-", $person['day_of_birth']);
$period = ("$tag.$monat.$jahr");
list($jahr, $monat, $tag) = explode("-", $person['day_of_death']);
if ($tag != 0) {$period = $period." - "."$tag.$monat.$jahr";}
$period = "(".$period.")";
return $period;
}
function periode($person){
if (($person->day_of_birth)!= 0){
$birth = DateTime::createFromFormat('Y-m-d', $person->day_of_birth);
$period = "(".$birth->format('Y')."-";
} else { $period = "( - ";}
if ($person->day_of_death >=1){$death = DateTime::createFromFormat('Y-m-d', $person->day_of_death);
$period = $period.$death->format('Y').")";
} else { $period = $period." )"; }
return $period;
}
// Alter der Person
function alter($person) {
if ($person['day_of_birth'] != 0){ // Geburtstag eingetragen
$geburtstag = new DateTime($person['day_of_birth']);
if ($person['day_of_death'] != 0){ // Todestag eingetragen
$todestag = new DateTime(date($person['day_of_death']));
$alter = $geburtstag->diff($todestag);
return $alter->format('%y'); // Alter ausgeben
} else {
if ($person['place_of_death'] != ""){ // Ort des Todes
return $alter = "† ?"; // kein Alter möglich
} else {
$heute = new DateTime(date('Y-m-d')); // Alter lebender Person
$alter = $geburtstag->diff($heute);
return $alter->format('%y');
}
}
} else {return $alter = "?";} // kein Geburtstag eingetragen
}
//convert date from yyyy-mm-dd database format to dd MMM yyyy gedcom format
function date_ged($incoming) {
// define the months
$months = array ("00" => "00", "01" => "Jan", "02" => "Feb", "03" => "Mrz", "04" => "Apr",
"05" => "Mai", "06" => "Jun", "07" => "Jul", "08" => "Aug", "09" => "Sep",
"10" => "Okt", "11" => "Nov", "12" => "Dez");
$work = explode("-", $incoming);
if ($work[1] == "00" OR $work[2] == "00") {
$retval = "$work[0]"; // if month or day unknown, just return year
} else {
$replacemonth = strtr($work[1], $months); // reformat whole date to dd MMM yyyy
$retval = "$work[2] $replacemonth $work[0]";
}
return $retval; // return the string for gedcom DATE
}
// return GET['index'], set SESION['index'], OR return default
function getAndSetSession($index, $session, $default){
if ((isset($_GET[$index])) || !empty($_GET[$index])){
$_SESSION[$session] = $_GET[$index];
} else {
if (!isset($_SESSION[$session])){
$_SESSION[$session] = $default;
}
}
return $_SESSION[$session];
}
function getUmlauteArray() {
return array(
'ü'=>'ü',
'ä'=>'ä',
'ö'=>'ö', 'Ö'=>'Ö',
'ß'=>'ß', 'à '=>'à', 'á'=>'á', 'â'=>'â', 'ã'=>'ã',
'ù'=>'ù', 'ú'=>'ú', 'û'=>'û',
'Ù'=>'Ù', 'Ú'=>'Ú', 'Û'=>'Û', 'Ãœ'=>'Ü',
'ò'=>'ò', 'ó'=>'ó', 'ô'=>'ô',
'è'=>'è', 'é'=>'é', 'ê'=>'ê', 'ë'=>'ë',
'À'=>'À', 'Á'=>'Á', 'Â'=>'Â', 'Ã'=>'Ã', 'Ä'=>'Ä', 'Ã…'=>'Å',
'Ç'=>'Ç', 'È'=>'È', 'É'=>'É', 'Ê'=>'Ê', 'Ë'=>'Ë', 'ÃŒ'=>'Ì',
'Í'=>'Í', 'ÃŽ'=>'Î', 'Ï'=>'Ï',
'Ñ'=>'Ñ',
'Ã’'=>'Ò', 'Ó'=>'Ó', 'Ô'=>'Ô', 'Õ'=>'Õ', 'Ø'=>'Ø',
'Ã¥'=>'å',
'æ'=>'æ',
'ç'=>'ç',
'ì'=>'ì', 'í'=>'í', 'î'=>'î', 'ï'=>'ï',
'ð'=>'ð',
'ñ'=>'ñ',
'õ'=>'õ',
'ø'=>'ø',
'ý'=>'ý', 'ÿ'=>'ÿ',
'€'=>'€' );
}
function fixeUmlauteDb() {
$umlaute = $this->getUmlauteArray();
foreach ($umlaute as $key => $value){
$sql = "UPDATE table SET tracks = REPLACE(row, '{$key}', '{$value}') WHERE row LIKE '%{$key}%'";
}
}
// Container dient zur erzeugung von instances nach festgelegten Bauanleitungen (receipts)
// Hier wird eine neue class gebildet
$container = new App\Core\Container();
//var_dump($container); // erster Test, ob der code läuft
//$usersRepository = $container->make("usersRepository");
//var_dump($usersRepository); // zweiter Test, nachdem UsersRepository erzeugt wurde
//var_dump($usersRepository->all()); // dritter Test, alle user auslesen; function aus AbstractRepostory
// nächster Test, finde user "Erik"; function aus init.php
//var_dump($usersRepository->findByUserName("test"));
//die();
?>

BIN
stb/photos/female.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
stb/photos/jann_boergmann.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

BIN
stb/photos/male.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
stb/photos/thumb21_backer.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

BIN
stb/photos/thumb_alida_backer.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
stb/photos/thumb_alma_feeken.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

BIN
stb/photos/thumb_ella_posny.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Some files were not shown because too many files have changed in this diff Show More