diff --git a/CSS/style.css b/CSS/style.css new file mode 100644 index 0000000..39f584f --- /dev/null +++ b/CSS/style.css @@ -0,0 +1,145 @@ +/* + Created on : 04.01.2018, 15:39:10 + Author : reich +*/ + +*, *:before, *:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + } + + body { + font-size: 18px; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + } + + .wrapper { + max-width: 1000px; + margin: 0 auto; + } + + /*** Allgemeine Definitionen ***/ + h1 { + /* margin: 10px; */ + color: #F2F2F2; + font-size: 48px; + font-weight: 100; + text-align: center; + } + + h1 span { + margin-left: -2px; + color: #FDBD02; + font-size: 24px; + font-weight: 600; + } + + h2 { + padding: 10px 0 10px 0; + text-align: center; + color: #011448; + font-size: 36px; + font-weight: 100; + } + + main { + background-color: #e6e6e6; + color: #000; + padding-bottom: 20px; + } + + /*** Standard-Button ***/ + + .button { + text-align: right; + } + + .button a { + display: inline-block; + background: #FDBD02; + color:#303E64; + border: none; + width: 100px; + margin: 5px; + padding: 2px; + border-radius: 5px; + cursor:pointer; + font-size: 12px; + text-decoration: none; + text-align: center; + } + + .button a:hover { + color:#fff; + } + + .clear { + clear: both; + } + + /*** Header-Bereich mit Navigationsleiste ***/ + header { + width: 100%; + background-color: #303E64; + } + + nav { + text-align: center; + position: sticky; + top: 0; + background-color: #303E64; + } + + nav ul { + list-style-type: none; + padding: 0; + display: inline-block; + } + + nav li { + float: left; + text-align: center; + } + + nav li a { + display: block; + width: 120px; + height: 35px; + border: 1px solid #000; + background-color: #e6e6e6; + color: #000; + text-decoration: none; + margin: 5px; + text-align: center; + line-height: 35px; + } + + nav li a:hover { + background-color: #F2C608; + } + + + #metanavi { + color: lightskyblue; + font-weight: bold; + margin-bottom: 5px; + } + +.container { + display: flex; + flex-wrap: wrap; +} + +.item-4-12 { + flex: 0 0 33.3333333333%; +} + +img { + width: 100%; +} + +[class*="item-"] { + padding: 0 10px 0 10px; +} \ No newline at end of file diff --git a/Controller/GalleryController.php b/Controller/GalleryController.php new file mode 100644 index 0000000..4fba4bb --- /dev/null +++ b/Controller/GalleryController.php @@ -0,0 +1,27 @@ +galleryModel = new GalleryModel(); + $this->view = $view; + } + + public function showPhotos() + { + $this->view->setVars([ + "photos" => $this->galleryModel->selectPhotos() + ]); + + } + +} \ No newline at end of file diff --git a/Controller/WelcomeController.php b/Controller/WelcomeController.php new file mode 100644 index 0000000..79997cd --- /dev/null +++ b/Controller/WelcomeController.php @@ -0,0 +1,20 @@ +view = $view; + } + + function showWelcome() + { + } +} diff --git a/Library/ErrorMsg.php b/Library/ErrorMsg.php new file mode 100644 index 0000000..901263e --- /dev/null +++ b/Library/ErrorMsg.php @@ -0,0 +1,25 @@ +view = new \ppa\Library\View(dirname(__DIR__).DIRECTORY_SEPARATOR.'Views' + , 'Error', 'showErrMsg'); + $this->view->setVars([ + 'error' => $msg, + 'debug' => $ex + + ]); + $this->view->render(); + } + + + +} \ No newline at end of file diff --git a/Library/View.php b/Library/View.php new file mode 100644 index 0000000..188b45d --- /dev/null +++ b/Library/View.php @@ -0,0 +1,58 @@ +path = $path; + $this->controller = $controllerName; + $this->do = $doMethodName; + } + + /** + * Set view vars. The keys will be added, to existing keys. + * + * @param array $vars + */ + public function setVars(array $vars) + { + foreach ($vars as $key => $val) { + $this->vars[$key] = $val; + } + } + + public function setDoMethodName($doMethodName) + { + $this->do = $doMethodName; + } + + /** + * Render the view. + * + * @throws NotFoundException + */ + public function render() + { + $filename = $this->path.DIRECTORY_SEPARATOR.$this->controller.DIRECTORY_SEPARATOR.$this->do.'.phtml'; + + if (!file_exists($filename)) { + new \ppa\Library\ErrorMsg("View not found: $filename"); + exit(); + } + + // spare the view the bloat of using "$this->vars[]" for every variable + foreach ($this->vars as $key => $val) { + $$key = $val; + } + + include $filename; + } +} \ No newline at end of file diff --git a/Model/Database.php b/Model/Database.php new file mode 100644 index 0000000..94241c4 --- /dev/null +++ b/Model/Database.php @@ -0,0 +1,45 @@ +dbName;host=$this->linkName" + , $this->user + , $this->pw + , array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); + return $pdo; + } catch (\PDOException $e) { + new \ppa\Library\ErrorMsg("Verbindung konnte nicht aufgebaut werden.", $e); + die; + } + } + + /** + * Zum serverseitigen generieren einer UUID + * + * @return string Liefert eine UUID + */ + public function createUUID() + { + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); + return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + } +} \ No newline at end of file diff --git a/Model/GalleryModel.php b/Model/GalleryModel.php new file mode 100644 index 0000000..c9aa084 --- /dev/null +++ b/Model/GalleryModel.php @@ -0,0 +1,28 @@ +linkDB(); + + try { + $res = $pdo->query($sql); + } catch (\PDOException $e) { + new \ppa\Library\ErrorMsg("Ihre Anfrage konnte nicht verarbeitet werden", $e); + die; + } + + return $res->fetchAll(\PDO::FETCH_ASSOC); + } +} \ No newline at end of file diff --git a/Views/Error/showErrMsg.phtml b/Views/Error/showErrMsg.phtml new file mode 100644 index 0000000..024862b --- /dev/null +++ b/Views/Error/showErrMsg.phtml @@ -0,0 +1,9 @@ + + +

+

+ + + + + diff --git a/Views/Gallery/showPhotos.phtml b/Views/Gallery/showPhotos.phtml new file mode 100644 index 0000000..958fbf0 --- /dev/null +++ b/Views/Gallery/showPhotos.phtml @@ -0,0 +1,17 @@ + + +

Galerie

+ +
+'; + echo '

' . $p["title"] . '

' + . ''; + echo '
'; + } +?> + + + \ No newline at end of file diff --git a/Views/Welcome/showWelcome.phtml b/Views/Welcome/showWelcome.phtml new file mode 100644 index 0000000..c42c663 --- /dev/null +++ b/Views/Welcome/showWelcome.phtml @@ -0,0 +1,6 @@ + + +

Baustelle

+ + + diff --git a/Views/footer.phtml b/Views/footer.phtml new file mode 100644 index 0000000..2f43e1a --- /dev/null +++ b/Views/footer.phtml @@ -0,0 +1,5 @@ + + + + + diff --git a/Views/header.phtml b/Views/header.phtml new file mode 100644 index 0000000..4a2ee52 --- /dev/null +++ b/Views/header.phtml @@ -0,0 +1,27 @@ + + + + Gallery View Vorlage + + + + + +
+
+
+ Anmelden +
+

Fotofreun.de OWLe.V.

+
+
+ +
+
\ No newline at end of file diff --git a/fotoclub.sql b/fotoclub.sql new file mode 100644 index 0000000..f9201a2 --- /dev/null +++ b/fotoclub.sql @@ -0,0 +1,107 @@ +-- phpMyAdmin SQL Dump +-- version 4.5.1 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Erstellungszeit: 09. Dez 2017 um 16:39 +-- Server-Version: 10.1.16-MariaDB +-- PHP-Version: 7.0.9 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Datenbank: `ppb` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `user` +-- + +CREATE TABLE `user` ( + `id` varchar(36) NOT NULL, + `username` varchar(8) NOT NULL, + `firstname` varchar(40) NOT NULL, + `lastname` varchar(40) NOT NULL, + `email` varchar(300) NOT NULL, + `pw` varchar(255) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `gallery` ( + `id` varchar(36) NOT NULL, + `userId` varchar(36) NOT NULL, + `categoryId` varchar(36) NOT NULL, + `title` varchar(80) NOT NULL, + `filename` varchar(200) NOT NULL, + `description` varchar(300) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `category` ( + `id` varchar(36) NOT NULL, + `description` varchar(200) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +-- +-- Indizes für die Tabelle `user` +-- +ALTER TABLE `user` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `username` (`username`); + +ALTER TABLE `category` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `gallery` + ADD PRIMARY KEY (`id`), + ADD CONSTRAINT `FK_EventUser` FOREIGN KEY (`userId`) REFERENCES `user`(`id`), + ADD CONSTRAINT `FK_EventCategory` FOREIGN KEY (`categoryId`) REFERENCES `category`(`id`); + +-- +-- Daten für Tabelle `user` +-- +-- pw: 12345 -> $2y$10$IeMpvUuMIrnxFHN.j94tEe.T1rjsTga1yYoyt5JAAXYUwbbjh1km6 + +INSERT INTO `user` (`id`, `username`, `firstname`, `lastname`, `email`, `pw`, `created`) VALUES +('0bb28278-d28a-11e7-b93f-2c4d544f8fe0', 'stefan78', 'Stefan', 'Stativ', +'test@test.de', '$2y$10$IeMpvUuMIrnxFHN.j94tEe.T1rjsTga1yYoyt5JAAXYUwbbjh1km6', '2017-11-26 09:13:20'), +('4f141df7-3c0a-11e8-b046-2c4d544f8fe0', 'fiona84', 'Fiona', 'Filter', +'fiona@test.de', '$2y$10$IeMpvUuMIrnxFHN.j94tEe.T1rjsTga1yYoyt5JAAXYUwbbjh1km6', '2018-01-12 11:11:51'); + +INSERT INTO `category` (`id`, `description`, `created`) VALUES +('23911087-3420-11e8-be39-2c4d544f8fe0', 'Portrait', '2018-04-14 12:11:31'), +('4a952637-3422-11e8-be39-2c4d544f8fe0', 'Natur', '2018-04-14 12:11:31'), +('999e18d3-3420-11e8-be39-2c4d544f8fe0', 'Landschaft', '2018-04-14 12:11:31'), +('dc3a66d9-3c0a-11e8-b046-2c4d544f8fe0', 'Urban', '2018-04-14 12:11:31'); + +INSERT INTO `gallery`(`id`, `userId`, `categoryId`, `title`, `filename`, `description`, `created`) VALUES +('b164bc94-eaf1-11e7-a313-2c4d544f8fe0', '0bb28278-d28a-11e7-b93f-2c4d544f8fe0', '23911087-3420-11e8-be39-2c4d544f8fe0', + 'Ich selbst', 'stefan78-001.jpeg', 'Foto eines jungen Mannes mit Kamera', '2018-04-14 12:11:31'), +('7519223c-3429-11e8-be39-2c4d544f8fe0', '0bb28278-d28a-11e7-b93f-2c4d544f8fe0', '23911087-3420-11e8-be39-2c4d544f8fe0' +, 'Licht', 'stefan78-003.jpeg', 'Foto einer jungen Frau bei Nacht', '2018-03-12 09:31:12'), +('d746f216-eaf1-11e7-a313-2c4d544f8fe0', '0bb28278-d28a-11e7-b93f-2c4d544f8fe0', '4a952637-3422-11e8-be39-2c4d544f8fe0' +, 'Flowers', 'stefan78-002.jpeg', 'Weiße und rote Blumen', '2018-03-12 09:33:32'), +('0ccef76b-3da0-11e8-9afe-2c4d544f8fe0', '4f141df7-3c0a-11e8-b046-2c4d544f8fe0', 'dc3a66d9-3c0a-11e8-b046-2c4d544f8fe0', + 'Endlos', 'fiona84-001.jpeg', 'Eine spiralförmige Treppe', '2018-05-12 12:11:31'), +('61f52468-3da0-11e8-9afe-2c4d544f8fe0', '4f141df7-3c0a-11e8-b046-2c4d544f8fe0', '999e18d3-3420-11e8-be39-2c4d544f8fe0' +, 'Morgenrot', 'fiona84-002.jpeg', 'Sonnenaufgang am Strand', '2018-01-11 09:31:12'), +('68f78c36-3da0-11e8-9afe-2c4d544f8fe0', '4f141df7-3c0a-11e8-b046-2c4d544f8fe0', 'dc3a66d9-3c0a-11e8-b046-2c4d544f8fe0' +, 'Tiefe Wolken', 'fiona84-003.jpeg', 'Eine Brücke im Nebel', '2018-02-23 09:33:32'); + + +-- ------------------------------------------------------- + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/images/fiona84-001.jpeg b/images/fiona84-001.jpeg new file mode 100644 index 0000000..dd286b2 Binary files /dev/null and b/images/fiona84-001.jpeg differ diff --git a/images/fiona84-002.jpeg b/images/fiona84-002.jpeg new file mode 100644 index 0000000..3e6d93a Binary files /dev/null and b/images/fiona84-002.jpeg differ diff --git a/images/fiona84-003.jpeg b/images/fiona84-003.jpeg new file mode 100644 index 0000000..d2e3e94 Binary files /dev/null and b/images/fiona84-003.jpeg differ diff --git a/images/fiona84-004.jpeg b/images/fiona84-004.jpeg new file mode 100644 index 0000000..092a279 Binary files /dev/null and b/images/fiona84-004.jpeg differ diff --git a/images/stefan78-001.jpeg b/images/stefan78-001.jpeg new file mode 100644 index 0000000..bf98427 Binary files /dev/null and b/images/stefan78-001.jpeg differ diff --git a/images/stefan78-002.jpeg b/images/stefan78-002.jpeg new file mode 100644 index 0000000..e3ad9a6 Binary files /dev/null and b/images/stefan78-002.jpeg differ diff --git a/images/stefan78-003.jpeg b/images/stefan78-003.jpeg new file mode 100644 index 0000000..4ce3ab5 Binary files /dev/null and b/images/stefan78-003.jpeg differ diff --git a/images/stefan78-004.jpeg b/images/stefan78-004.jpeg new file mode 100644 index 0000000..904955d Binary files /dev/null and b/images/stefan78-004.jpeg differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..5ad5c21 --- /dev/null +++ b/index.php @@ -0,0 +1,39 @@ +$doMethodName(); + + $view->render(); + } else { + http_response_code(404); + new \ppa\Library\ErrorMsg('Page not found: '.$controllerClassName.'::'.$doMethodName); + + } + +?>