--- a/classes/bfw/Configuration.php
+++ b/classes/bfw/Configuration.php
@@ -1,82 +1,82 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw;
-
-use PDO;
-
-/**
- * Class Configuration
- */
-class Configuration {
-
- /**
- * Standard-Autoloader für die Basis-Klassen des Projekts
- *
- * @param $class
- * @return bool
- */
- public static function bfw_autoLoader($class) {
- $nsClass = str_replace('\\', '/', $class);
- $filename = sprintf('%s/classes/%s.php', BFW_PATH, $nsClass);
- $classPath = sprintf('classes/%s.php', $nsClass);
-
- if (file_exists($filename)) {
- require_once BFW_PATH . "/$classPath";
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Standard Konfiguration für den Logger
- *
- * @return array
- */
- public static function bfw_loggerConfiguration() {
- return array(
- 'rootLogger' => array('appenders' => array('default')),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'LoggerAppenderFile',
- 'layout' => array('class' => 'LoggerLayoutSimple'),
- 'params' => array(
- 'file' => BFW_PATH . '/logs/bfw.log',
- 'append' => true
- )
- )
- )
- );
- }
-
- /**
- * Standard Konfiguration für den PDO-Treiber
- *
- * @return array
- */
- public static function getDataSourceProperties() {
- $dataSources = array(
- 'psql' => array(
- 'dsn' => 'pgsql:host=localhost;dbname=bfw',
- 'config' => array(),
- 'username' => 'bfw',
- 'password' => 'bfw',
- ),
- 'mysql' => array(
- 'dsn' => 'mysql:host=localhost;dbname=bfw',
- 'config' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'),
- 'username' => 'bfw',
- 'password' => 'bfw',
- )
- );
-
- return $dataSources['mysql'];
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw;
+
+use PDO;
+
+/**
+ * Class Configuration
+ */
+class Configuration {
+
+ /**
+ * Standard-Autoloader für die Basis-Klassen des Projekts
+ *
+ * @param $class
+ * @return bool
+ */
+ public static function bfw_autoLoader($class) {
+ $nsClass = str_replace('\\', '/', $class);
+ $filename = sprintf('%s/classes/%s.php', BFW_PATH, $nsClass);
+ $classPath = sprintf('classes/%s.php', $nsClass);
+
+ if (file_exists($filename)) {
+ require_once BFW_PATH . "/$classPath";
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Standard Konfiguration für den Logger
+ *
+ * @return array
+ */
+ public static function bfw_loggerConfiguration() {
+ return array(
+ 'rootLogger' => array('appenders' => array('default')),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderFile',
+ 'layout' => array('class' => 'LoggerLayoutSimple'),
+ 'params' => array(
+ 'file' => BFW_PATH . '/logs/bfw.log',
+ 'append' => true
+ )
+ )
+ )
+ );
+ }
+
+ /**
+ * Standard Konfiguration für den PDO-Treiber
+ *
+ * @return array
+ */
+ public static function getDataSourceProperties() {
+ $dataSources = array(
+ 'psql' => array(
+ 'dsn' => 'pgsql:host=localhost;dbname=bfw',
+ 'config' => array(),
+ 'username' => 'bfw',
+ 'password' => 'bfw',
+ ),
+ 'mysql' => array(
+ 'dsn' => 'mysql:host=localhost;dbname=bfw',
+ 'config' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'),
+ 'username' => 'bfw',
+ 'password' => 'bfw',
+ )
+ );
+
+ return $dataSources['mysql'];
+ }
+
+}
--- a/classes/bfw/Dispatcher.php
+++ b/classes/bfw/Dispatcher.php
@@ -1,75 +1,75 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw;
-
-use bfw\core\Controller;
-use ReflectionClass;
-use ReflectionException;
-
-/**
- * Class Dispatcher
- */
-class Dispatcher {
-
- private $request;
-
- public function __construct() {
- $this->request = new Request();
- }
-
- /**
- * @param $url
- */
- public static function route($url) {
- header(sprintf("Location: %s", $url));
- exit(0);
- }
-
- /**
- * <b>Standard Request Handler für das Projekt</b>
- *
- * Diese Instanz kümmert sich selbständig um die GET- und POST Werte und
- * speichert diese in der Session.
- *
- * Einfach zu nutzende Methoden(Schnittstelle zur Session) komplettieren diesen Handler
- *
- * @return Request
- */
- public function getRequest() {
- return $this->request;
- }
-
- /**
- * <b>Führt den jeweiligen Controller aus</b>
- *
- */
- public function delegate() {
- $this->request->keepRequestData();
-
- $controllerName = $this->request->get('controller', 'home');
- $action = $this->request->get('action', 'index');
-
- $class = Controller::findControllerInNameSpace($controllerName);
-
- try {
- $reflection = new ReflectionClass($class);
- $controller = $reflection->newInstance();
-
- // Mapping vom GET-Parameter 'action' auf Controller::$action()
- if (!$reflection->hasMethod($action)) {
- $action = 'index';
- }
- } catch (ReflectionException $re) {
- $controller = new mvc\controller\ErrorController();
- $action = 'index';
- }
-
- return $controller->$action();
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw;
+
+use bfw\core\Controller;
+use ReflectionClass;
+use ReflectionException;
+
+/**
+ * Class Dispatcher
+ */
+class Dispatcher {
+
+ private $request;
+
+ public function __construct() {
+ $this->request = new Request();
+ }
+
+ /**
+ * @param $url
+ */
+ public static function route($url) {
+ header(sprintf("Location: %s", $url));
+ exit(0);
+ }
+
+ /**
+ * <b>Standard Request Handler für das Projekt</b>
+ *
+ * Diese Instanz kümmert sich selbständig um die GET- und POST Werte und
+ * speichert diese in der Session.
+ *
+ * Einfach zu nutzende Methoden(Schnittstelle zur Session) komplettieren diesen Handler
+ *
+ * @return Request
+ */
+ public function getRequest() {
+ return $this->request;
+ }
+
+ /**
+ * <b>Führt den jeweiligen Controller aus</b>
+ *
+ */
+ public function delegate() {
+ $this->request->keepRequestData();
+
+ $controllerName = $this->request->get('controller', 'home');
+ $action = $this->request->get('action', 'index');
+
+ $class = Controller::findControllerInNameSpace($controllerName);
+
+ try {
+ $reflection = new ReflectionClass($class);
+ $controller = $reflection->newInstance();
+
+ // Mapping vom GET-Parameter 'action' auf Controller::$action()
+ if (!$reflection->hasMethod($action)) {
+ $action = 'index';
+ }
+ } catch (ReflectionException $re) {
+ $controller = new mvc\controller\ErrorController();
+ $action = 'index';
+ }
+
+ return $controller->$action();
+ }
+
+}
--- a/classes/bfw/Request.php
+++ b/classes/bfw/Request.php
@@ -1,277 +1,277 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw;
-
-use Logger;
-
-/**
- * Class Request
- */
-class Request {
-
- /**
- *
- * @var Logger
- */
- protected $logger = null;
-
- /**
- * Default Constructor
- */
- public function __construct() {
- $this->logger = Logger::getLogger('__CLASS__');
-
- $this->initSession();
- }
-
- /**
- * <b>Initialisiert die Session für das jeweilige Projekt</b>
- *
- */
- public function initSession() {
- if (!isset($_SESSION['prefix'])) {
- $_SESSION['prefix'] = array(
- 'get' => array(),
- 'session' => array(),
- 'isLoggedIn' => false,
- 'user_id' => 1,
- 'group_id' => 1,
- 'error' => '',
- 'msg' => '',
- 'lastpage' => 'home',
- );
- }
- }
-
- /**
- * Liefert die komplette URL des jeweiligen Requests
- *
- * @return string
- */
- public static function getUrl() {
- return sprintf("%s%s", self::getBaseUrl(), $_SERVER['REQUEST_URI']);
- }
-
- /**
- * Liefert die Basis-URL des jeweiligen Projekts
- *
- * @return string
- */
- public static function getBaseUrl() {
- return sprintf("%s://%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME']);
- }
-
- /**
- * <b>Liefert einen gefilterten 'session' Wert
- *
- * Hierbei handelt es sich um einen zuvor gespeicherten POST-Wert,
- * der in ['prefix']['session'] gelandet ist...
- *
- * @param $param
- * @param string $default
- *
- * @return string
- */
- public static function session($param, $default = '') {
- if (isset($_SESSION['prefix']['session'][$param])) {
- return $_SESSION['prefix']['session'][$param];
- }
-
- return $default;
- }
-
- /**
- * <b>Liefert einen gefilterten 'get' Wert
- *
- * Hierbei handelt es sich um einen zuvor gespeicherten POST-Wert,
- * der in ['prefix']['session'] geladet ist...
- *
- * @param $param
- * @param string $default
- *
- * @return string
- */
- public static function getParameter($param, $default = '') {
- if (isset($_SESSION['prefix']['get'][$param])) {
- return $_SESSION['prefix']['get'][$param];
- }
-
- return $default;
- }
-
- /**
- * <b>Holt einen Session Wert aus dem jeweiligen Prefix</b>
- *
- * @param $key
- * @param string $default
- * @param null $storage
- * @return string
- */
- public static function getKey($key, $default = '', $storage = null) {
- if ($storage != null) {
- return $_SESSION['prefix'][$storage][$key];
- }
-
- if (isset($_SESSION['prefix'][$key])) {
- return $_SESSION['prefix'][$key];
- }
-
- return $default;
- }
-
- /**
- * <b>Löscht einen Get-Wert aus dem jeweiligen Prefix</b>
- *
- * @param $key
- */
- public static function deleteParameterKey($key) {
- unset($_SESSION['prefix']['get'][$key]);
- }
-
- /**
- * <b>Löscht einen Session Wert aus dem jeweiligen Prefix</b>
- *
- * @param $key
- */
- public static function deleteKey($key) {
- unset($_SESSION['prefix'][$key]);
- }
-
- /**
- * <b>Prüft, ob der aktuelle Request einen POST enthält</b>
- *
- * @return bool
- */
- public static function hasPost() {
- return (count($_POST) != 0);
- }
-
- /**
- * Keine Warnung, keine Gnade
- */
- public function destroySession() {
- unset($_SESSION['prefix']);
- @session_destroy();
-
- $this->initSession();
- }
-
- /**
- * <b>Bei jedem Seitenaufruf werden die GET/Post Anfragen in der Session separiert gespeichert</b>
- *
- * Struktur:
- * GET Sachen ins 'get' array
- * POST Sachen ins 'session' array
- */
- public function keepRequestData() {
- foreach ($_GET as $key => $value) {
- $filteredKey = $this->filter($key);
- $filteredValue = $this->filter($value);
-
- $_SESSION['prefix']['get'][$filteredKey] = $filteredValue;
- }
-
- foreach ($_POST as $key => $value) {
- $filteredKey = $this->filter($key);
- $filteredValue = $this->filter($value);
-
- $_SESSION['prefix']['session'][$filteredKey] = $filteredValue;
- }
- }
-
- /**
- * <b>Statische Filtermethode für beliebige Strings/Array of Strings</b>
- *
- * filter_input kann nur mit GET/POST umgehen, diese Methode mit Allem.
- *
- * @param string $param
- *
- * @return string|array
- */
- public static function filter($param) {
- if (is_array($param)) {
- $filtered = array();
- foreach ($param as $key => $value) {
- $filtered[self::filter($key)] = self::filter($value);
- }
-
- return $filtered;
- }
-
- return htmlspecialchars($param, ENT_QUOTES, 'utf-8');
- }
-
- /**
- * <b>Setzt einen neuen Session Wert ins jeweilige Prefix</b>
- *
- * @param $key
- * @param $value
- * @param $storage
- */
- public function setKey($key, $value, $storage = null) {
- if ($storage != null) {
- $_SESSION['prefix'][$storage][self::filter($key)] = self::filter($value);
- } else {
- $_SESSION['prefix'][self::filter($key)] = self::filter($value);
- }
- }
-
- /**
- * <b>Interne Debug-Funktion zum Anzeigen der Session Struktur</b>
- *
- * Beliebige URL mit ?debug=1 aufrufen und der Debug Mechanismus ist aktiviert.
- *
- * @return string
- */
- public function printSession() {
- $this->logger->info(sprintf('SESSION: %s', print_r($_SESSION['prefix'], true)));
-
- if ($this->get('debug') == '') {
- return '';
- }
-
- return "<br /><pre>" . print_r($_SESSION['prefix'], true) . "</pre>";
- }
-
- /**
- * <b>Liefert einen gefilterten GET-Wert</b>
- *
- * @param $param
- * @param $default
- *
- * @return string
- */
- public function get($param, $default = '') {
- $value = filter_input(INPUT_GET, $param);
-
- if ($value == '') {
- return $default;
- }
-
- return $value;
- }
-
- /**
- * <b>Liefert einen gefilterten POST-Wert</b>
- *
- * @param $param
- * @param $default
- *
- * @return string
- */
- public function post($param, $default = '') {
- $value = filter_input(INPUT_POST, $param);
-
- if ($value == '') {
- return $default;
- }
-
- return $value;
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw;
+
+use Logger;
+
+/**
+ * Class Request
+ */
+class Request {
+
+ /**
+ *
+ * @var Logger
+ */
+ protected $logger = null;
+
+ /**
+ * Default Constructor
+ */
+ public function __construct() {
+ $this->logger = Logger::getLogger('__CLASS__');
+
+ $this->initSession();
+ }
+
+ /**
+ * <b>Initialisiert die Session für das jeweilige Projekt</b>
+ *
+ */
+ public function initSession() {
+ if (!isset($_SESSION['prefix'])) {
+ $_SESSION['prefix'] = array(
+ 'get' => array(),
+ 'session' => array(),
+ 'isLoggedIn' => false,
+ 'user_id' => 1,
+ 'group_id' => 1,
+ 'error' => '',
+ 'msg' => '',
+ 'lastpage' => 'home',
+ );
+ }
+ }
+
+ /**
+ * Liefert die komplette URL des jeweiligen Requests
+ *
+ * @return string
+ */
+ public static function getUrl() {
+ return sprintf("%s%s", self::getBaseUrl(), $_SERVER['REQUEST_URI']);
+ }
+
+ /**
+ * Liefert die Basis-URL des jeweiligen Projekts
+ *
+ * @return string
+ */
+ public static function getBaseUrl() {
+ return sprintf("%s://%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME']);
+ }
+
+ /**
+ * <b>Liefert einen gefilterten 'session' Wert
+ *
+ * Hierbei handelt es sich um einen zuvor gespeicherten POST-Wert,
+ * der in ['prefix']['session'] gelandet ist...
+ *
+ * @param $param
+ * @param string $default
+ *
+ * @return string
+ */
+ public static function session($param, $default = '') {
+ if (isset($_SESSION['prefix']['session'][$param])) {
+ return $_SESSION['prefix']['session'][$param];
+ }
+
+ return $default;
+ }
+
+ /**
+ * <b>Liefert einen gefilterten 'get' Wert
+ *
+ * Hierbei handelt es sich um einen zuvor gespeicherten POST-Wert,
+ * der in ['prefix']['session'] geladet ist...
+ *
+ * @param $param
+ * @param string $default
+ *
+ * @return string
+ */
+ public static function getParameter($param, $default = '') {
+ if (isset($_SESSION['prefix']['get'][$param])) {
+ return $_SESSION['prefix']['get'][$param];
+ }
+
+ return $default;
+ }
+
+ /**
+ * <b>Holt einen Session Wert aus dem jeweiligen Prefix</b>
+ *
+ * @param $key
+ * @param string $default
+ * @param null $storage
+ * @return string
+ */
+ public static function getKey($key, $default = '', $storage = null) {
+ if ($storage != null) {
+ return $_SESSION['prefix'][$storage][$key];
+ }
+
+ if (isset($_SESSION['prefix'][$key])) {
+ return $_SESSION['prefix'][$key];
+ }
+
+ return $default;
+ }
+
+ /**
+ * <b>Löscht einen Get-Wert aus dem jeweiligen Prefix</b>
+ *
+ * @param $key
+ */
+ public static function deleteParameterKey($key) {
+ unset($_SESSION['prefix']['get'][$key]);
+ }
+
+ /**
+ * <b>Löscht einen Session Wert aus dem jeweiligen Prefix</b>
+ *
+ * @param $key
+ */
+ public static function deleteKey($key) {
+ unset($_SESSION['prefix'][$key]);
+ }
+
+ /**
+ * <b>Prüft, ob der aktuelle Request einen POST enthält</b>
+ *
+ * @return bool
+ */
+ public static function hasPost() {
+ return (count($_POST) != 0);
+ }
+
+ /**
+ * Keine Warnung, keine Gnade
+ */
+ public function destroySession() {
+ unset($_SESSION['prefix']);
+ @session_destroy();
+
+ $this->initSession();
+ }
+
+ /**
+ * <b>Bei jedem Seitenaufruf werden die GET/Post Anfragen in der Session separiert gespeichert</b>
+ *
+ * Struktur:
+ * GET Sachen ins 'get' array
+ * POST Sachen ins 'session' array
+ */
+ public function keepRequestData() {
+ foreach ($_GET as $key => $value) {
+ $filteredKey = $this->filter($key);
+ $filteredValue = $this->filter($value);
+
+ $_SESSION['prefix']['get'][$filteredKey] = $filteredValue;
+ }
+
+ foreach ($_POST as $key => $value) {
+ $filteredKey = $this->filter($key);
+ $filteredValue = $this->filter($value);
+
+ $_SESSION['prefix']['session'][$filteredKey] = $filteredValue;
+ }
+ }
+
+ /**
+ * <b>Statische Filtermethode für beliebige Strings/Array of Strings</b>
+ *
+ * filter_input kann nur mit GET/POST umgehen, diese Methode mit Allem.
+ *
+ * @param string $param
+ *
+ * @return string|array
+ */
+ public static function filter($param) {
+ if (is_array($param)) {
+ $filtered = array();
+ foreach ($param as $key => $value) {
+ $filtered[self::filter($key)] = self::filter($value);
+ }
+
+ return $filtered;
+ }
+
+ return htmlspecialchars($param, ENT_QUOTES, 'utf-8');
+ }
+
+ /**
+ * <b>Setzt einen neuen Session Wert ins jeweilige Prefix</b>
+ *
+ * @param $key
+ * @param $value
+ * @param $storage
+ */
+ public function setKey($key, $value, $storage = null) {
+ if ($storage != null) {
+ $_SESSION['prefix'][$storage][self::filter($key)] = self::filter($value);
+ } else {
+ $_SESSION['prefix'][self::filter($key)] = self::filter($value);
+ }
+ }
+
+ /**
+ * <b>Interne Debug-Funktion zum Anzeigen der Session Struktur</b>
+ *
+ * Beliebige URL mit ?debug=1 aufrufen und der Debug Mechanismus ist aktiviert.
+ *
+ * @return string
+ */
+ public function printSession() {
+ $this->logger->info(sprintf('SESSION: %s', print_r($_SESSION['prefix'], true)));
+
+ if ($this->get('debug') == '') {
+ return '';
+ }
+
+ return "<br /><pre>" . print_r($_SESSION['prefix'], true) . "</pre>";
+ }
+
+ /**
+ * <b>Liefert einen gefilterten GET-Wert</b>
+ *
+ * @param $param
+ * @param $default
+ *
+ * @return string
+ */
+ public function get($param, $default = '') {
+ $value = filter_input(INPUT_GET, $param);
+
+ if ($value == '') {
+ return $default;
+ }
+
+ return $value;
+ }
+
+ /**
+ * <b>Liefert einen gefilterten POST-Wert</b>
+ *
+ * @param $param
+ * @param $default
+ *
+ * @return string
+ */
+ public function post($param, $default = '') {
+ $value = filter_input(INPUT_POST, $param);
+
+ if ($value == '') {
+ return $default;
+ }
+
+ return $value;
+ }
+
+}
--- a/classes/bfw/Response.php
+++ b/classes/bfw/Response.php
@@ -1,76 +1,76 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw;
-
-/**
- * Class Response
- */
-class Response {
-
- /**
- *
- * @var array
- */
- private $headers;
-
- /**
- *
- * @var int
- */
- private $statusCode;
-
- /**
- *
- */
- public function __construct() {
- $this->headers = headers_list();
- $this->statusCode = http_response_code();
- }
-
- /**
- *
- * @return array
- */
- public function getHeaders() {
- return $this->headers;
- }
-
- /**
- *
- * @return int
- */
- public function getStatusCode() {
- return $this->statusCode;
- }
-
- /**
- *
- * @param int $statusCode
- *
- * @return \bfw\Response
- */
- public function setStatusCode($statusCode) {
- $this->statusCode = $statusCode;
-
- return $this;
- }
-
- /**
- * @param $key
- *
- * @return string
- */
- public function get($key) {
- if (array_key_exists($key, $this->headers)) {
- return $this->headers[$key];
- }
-
- return '';
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw;
+
+/**
+ * Class Response
+ */
+class Response {
+
+ /**
+ *
+ * @var array
+ */
+ private $headers;
+
+ /**
+ *
+ * @var int
+ */
+ private $statusCode;
+
+ /**
+ *
+ */
+ public function __construct() {
+ $this->headers = headers_list();
+ $this->statusCode = http_response_code();
+ }
+
+ /**
+ *
+ * @return array
+ */
+ public function getHeaders() {
+ return $this->headers;
+ }
+
+ /**
+ *
+ * @return int
+ */
+ public function getStatusCode() {
+ return $this->statusCode;
+ }
+
+ /**
+ *
+ * @param int $statusCode
+ *
+ * @return \bfw\Response
+ */
+ public function setStatusCode($statusCode) {
+ $this->statusCode = $statusCode;
+
+ return $this;
+ }
+
+ /**
+ * @param $key
+ *
+ * @return string
+ */
+ public function get($key) {
+ if (array_key_exists($key, $this->headers)) {
+ return $this->headers[$key];
+ }
+
+ return '';
+ }
+
+}
--- a/classes/bfw/core/Controller.php
+++ b/classes/bfw/core/Controller.php
@@ -1,138 +1,138 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\core;
-
-use bfw\Request;
-use bfw\Response;
-use Logger;
-
-/**
- * Class Controller
- */
-abstract class Controller {
-
- protected $logger;
-
- /**
- * @var Model
- */
- private $model;
-
- /**
- * @var Request
- */
- private $request;
-
- /**
- * @var Response
- */
- private $response;
-
- /**
- * @var View
- */
- private $view;
-
- /**
- * Controller constructor.
- *
- */
- public function __construct() {
- $this->request = new Request();
- $this->response = new Response();
-
- $this->model = $this->getDataModelInstance();
- $this->view = new View($this, $this->model);
-
- $this->logger = Logger::getLogger(get_class($this));
- }
-
- private function getDataModelInstance() {
- $modelName = $this->getModelName();
-
- return new $modelName();
- }
-
- private function getModelName() {
- $modelName = str_replace('controller', 'model', get_class($this));
- $modelName = strtolower($modelName);
-
- return str_replace('controller', '\DataModel', $modelName);
- }
-
- /**
- * @param $controller
- * @return string
- */
- public static function findControllerInNameSpace($controller) {
- return sprintf('bfw\mvc\controller\%sController', ucfirst($controller));
- }
-
- /**
- * @return View
- */
- public function getView() {
- return $this->view;
- }
-
- /**
- * @param $view
- * @return $this
- */
- public function setView($view) {
- $this->view = $view;
-
- return $this;
- }
-
- /**
- * @return Response
- */
- public function getResponse() {
- return $this->response;
- }
-
- /**
- * @param $response
- * @return $this
- */
- public function setResponse($response) {
- $this->response = $response;
-
- return $this;
- }
-
- /**
- * @return Model
- */
- public function getModel() {
- return $this->model;
- }
-
- /**
- * @param $model
- * @return $this
- */
- public function setModel($model) {
- $this->model = $model;
-
- return $this;
- }
-
- /**
- * @return Request
- */
- public function getRequest() {
- return $this->request;
- }
-
- /**
- * @return mixed
- */
- abstract public function index();
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\core;
+
+use bfw\Request;
+use bfw\Response;
+use Logger;
+
+/**
+ * Class Controller
+ */
+abstract class Controller {
+
+ protected $logger;
+
+ /**
+ * @var Model
+ */
+ private $model;
+
+ /**
+ * @var Request
+ */
+ private $request;
+
+ /**
+ * @var Response
+ */
+ private $response;
+
+ /**
+ * @var View
+ */
+ private $view;
+
+ /**
+ * Controller constructor.
+ *
+ */
+ public function __construct() {
+ $this->request = new Request();
+ $this->response = new Response();
+
+ $this->model = $this->getDataModelInstance();
+ $this->view = new View($this, $this->model);
+
+ $this->logger = Logger::getLogger(get_class($this));
+ }
+
+ private function getDataModelInstance() {
+ $modelName = $this->getModelName();
+
+ return new $modelName();
+ }
+
+ private function getModelName() {
+ $modelName = str_replace('controller', 'model', get_class($this));
+ $modelName = strtolower($modelName);
+
+ return str_replace('controller', '\DataModel', $modelName);
+ }
+
+ /**
+ * @param $controller
+ * @return string
+ */
+ public static function findControllerInNameSpace($controller) {
+ return sprintf('bfw\mvc\controller\%sController', ucfirst($controller));
+ }
+
+ /**
+ * @return View
+ */
+ public function getView() {
+ return $this->view;
+ }
+
+ /**
+ * @param $view
+ * @return $this
+ */
+ public function setView($view) {
+ $this->view = $view;
+
+ return $this;
+ }
+
+ /**
+ * @return Response
+ */
+ public function getResponse() {
+ return $this->response;
+ }
+
+ /**
+ * @param $response
+ * @return $this
+ */
+ public function setResponse($response) {
+ $this->response = $response;
+
+ return $this;
+ }
+
+ /**
+ * @return Model
+ */
+ public function getModel() {
+ return $this->model;
+ }
+
+ /**
+ * @param $model
+ * @return $this
+ */
+ public function setModel($model) {
+ $this->model = $model;
+
+ return $this;
+ }
+
+ /**
+ * @return Request
+ */
+ public function getRequest() {
+ return $this->request;
+ }
+
+ /**
+ * @return mixed
+ */
+ abstract public function index();
+}
--- a/classes/bfw/core/Model.php
+++ b/classes/bfw/core/Model.php
@@ -1,67 +1,67 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\core;
-
-use bfw\entities\TGroup;
-use bfw\entities\TUser;
-use Logger;
-
-/**
- * Class Model
- *
- */
-class Model {
-
- protected $logger;
-
- /**
- * @var TUser
- */
- private $user;
-
- /**
- * @var TGroup
- */
- private $group;
-
- public function __construct() {
- $this->logger = Logger::getLogger(get_class($this));
-
- $this->user = new TUser();
- $this->group = new TGroup();
- }
-
- /**
- * @return TUser
- */
- public function getUser() {
- return $this->user;
- }
-
- /**
- * @return TGroup
- */
- public function getGroup() {
- return $this->group;
- }
-
- /**
- * @return Entity[]
- */
- public function getUsers() {
- return $this->user->findAll();
- }
-
- /**
- * @return Entity[]
- */
- public function getGroups() {
- return $this->group->findAll();
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\core;
+
+use bfw\entities\TGroup;
+use bfw\entities\TUser;
+use Logger;
+
+/**
+ * Class Model
+ *
+ */
+class Model {
+
+ protected $logger;
+
+ /**
+ * @var TUser
+ */
+ private $user;
+
+ /**
+ * @var TGroup
+ */
+ private $group;
+
+ public function __construct() {
+ $this->logger = Logger::getLogger(get_class($this));
+
+ $this->user = new TUser();
+ $this->group = new TGroup();
+ }
+
+ /**
+ * @return TUser
+ */
+ public function getUser() {
+ return $this->user;
+ }
+
+ /**
+ * @return TGroup
+ */
+ public function getGroup() {
+ return $this->group;
+ }
+
+ /**
+ * @return Entity[]
+ */
+ public function getUsers() {
+ return $this->user->findAll();
+ }
+
+ /**
+ * @return Entity[]
+ */
+ public function getGroups() {
+ return $this->group->findAll();
+ }
+
+}
--- a/classes/bfw/core/ReadonlyEntity.php
+++ b/classes/bfw/core/ReadonlyEntity.php
@@ -1,60 +1,60 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\core;
-
-/**
- * Class ReadonlyEntity
- *
- * @method string getId()
- */
-class ReadonlyEntity extends Entity {
-
- /**
- * Nur Get-Methoden in dieser Entity
- *
- * @param $methodName
- * @param null $params
- * @return mixed
- */
- public function __call($methodName, $params = null) {
- $prefix = substr($methodName, 0, 3);
-
- $key = lcfirst(substr($methodName, 3));
- $key = strtolower(preg_replace('/([A-Z])/', "_$1", $key));
-
- if ($prefix == 'get') {
- if (array_key_exists($key, $this->data)) {
- return $this->data[$key];
- }
- }
-
- exit(sprintf('Unbekannte Methode %s(%s, %s) wurde aufgerufen.', $methodName, $key, $prefix));
- }
-
- /**
- * @return bool
- */
- public function store() {
- return false;
- }
-
- /**
- * @return bool
- */
- public function delete() {
- return false;
- }
-
- /**
- * @return bool
- */
- public function persist() {
- return false;
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\core;
+
+/**
+ * Class ReadonlyEntity
+ *
+ * @method string getId()
+ */
+class ReadonlyEntity extends Entity {
+
+ /**
+ * Nur Get-Methoden in dieser Entity
+ *
+ * @param $methodName
+ * @param null $params
+ * @return mixed
+ */
+ public function __call($methodName, $params = null) {
+ $prefix = substr($methodName, 0, 3);
+
+ $key = lcfirst(substr($methodName, 3));
+ $key = strtolower(preg_replace('/([A-Z])/', "_$1", $key));
+
+ if ($prefix == 'get') {
+ if (array_key_exists($key, $this->data)) {
+ return $this->data[$key];
+ }
+ }
+
+ exit(sprintf('Unbekannte Methode %s(%s, %s) wurde aufgerufen.', $methodName, $key, $prefix));
+ }
+
+ /**
+ * @return bool
+ */
+ public function store() {
+ return false;
+ }
+
+ /**
+ * @return bool
+ */
+ public function delete() {
+ return false;
+ }
+
+ /**
+ * @return bool
+ */
+ public function persist() {
+ return false;
+ }
+
+}
--- a/classes/bfw/core/View.php
+++ b/classes/bfw/core/View.php
@@ -1,139 +1,139 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\core;
-
-use Smarty;
-
-require_once 'library/smarty/libs/Smarty.class.php';
-
-/**
- * Class View
- */
-class View {
-
- /**
- * Statische Referenz auf die reale Template Engine, hier Smarty
- *
- * @var Smarty
- */
- private static $tpl = null;
-
- /**
- * @var Model
- */
- private $model;
-
- /**
- * @var Controller
- */
- private $controller;
-
- /**
- * View constructor.
- *
- * @param Controller $controller
- * @param Model $model
- */
- public function __construct(Controller $controller, Model $model) {
- $this->controller = $controller;
- $this->model = $model;
-
- self::$tpl = self::getTemplateEngine();
-
- $request = $controller->getRequest();
- $this->assign('controller', $request->get('controller', 'home'));
- $this->assign('action', $request->get('action', 'index'));
- }
-
- /**
- * <b>Liefert ein statisches Handle auf die aktuelle Template Engine zurück</b>
- *
- * Das Singleton Pattern garantiert genau eine Instanz der Template Engine im Speicher.
- *
- * <b>Verschiedene Skripte können so nacheinander Variablen zuweisen und diese bei Bedarf auslesen</b>
- *
- * @return Smarty
- */
- private static function getTemplateEngine() {
- if (self::$tpl == null) {
- self::$tpl = new Smarty();
-
- $tpl = self::$tpl;
-
- $tpl->setCompileDir('./data/templates_c/');
- $tpl->setTemplateDir('./classes/bfw/mvc/view/');
- }
-
- return self::$tpl;
- }
-
- /**
- * @param $template
- * @return string
- */
- public function fetch($template) {
- return self::$tpl->fetch($template);
- }
-
- /**
- * <b>Anzeige der komplett gerenderten Seite mit dem Layout $layout</b>
- *
- * @param string $layout
- * @return int
- */
- public function display($layout = 'layout.tpl') {
- $request = $this->controller->getRequest();
-
- $controller = $this->controller;
-
- $response = $controller->getResponse();
- $this->assign('response', $response);
-
- $this->assign('request', $request);
-
- $model = $controller->getModel();
- $user = $model->getUser();
- $group = $model->getGroup();
-
- if ($request->getKey('isLoggedIn')) {
- $user->find($request->getKey('user_id'));
- }
-
- $this->assign('user', $user);
- $this->assign('group', $group);
-
- try {
- self::$tpl->display($layout);
- } catch (SmartyException $se) {
- $response->setStatusCode(404);
-
- self::$tpl->display('layout.tpl');
- }
-
- // Msg wieder auf Null setzen...
- $request->setKey('msg', '');
-
- // Fehler wieder auf Null setzen...
- $request->setKey('error', '');
-
- return http_response_code();
- }
-
- public function assign($key, $value) {
- self::$tpl->assign($key, $value);
- }
-
- /**
- * @param string $key
- * @return string
- */
- public function get($key) {
- return self::$tpl->getTemplateVars($key);
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\core;
+
+use Smarty;
+
+require_once 'library/smarty/libs/Smarty.class.php';
+
+/**
+ * Class View
+ */
+class View {
+
+ /**
+ * Statische Referenz auf die reale Template Engine, hier Smarty
+ *
+ * @var Smarty
+ */
+ private static $tpl = null;
+
+ /**
+ * @var Model
+ */
+ private $model;
+
+ /**
+ * @var Controller
+ */
+ private $controller;
+
+ /**
+ * View constructor.
+ *
+ * @param Controller $controller
+ * @param Model $model
+ */
+ public function __construct(Controller $controller, Model $model) {
+ $this->controller = $controller;
+ $this->model = $model;
+
+ self::$tpl = self::getTemplateEngine();
+
+ $request = $controller->getRequest();
+ $this->assign('controller', $request->get('controller', 'home'));
+ $this->assign('action', $request->get('action', 'index'));
+ }
+
+ /**
+ * <b>Liefert ein statisches Handle auf die aktuelle Template Engine zurück</b>
+ *
+ * Das Singleton Pattern garantiert genau eine Instanz der Template Engine im Speicher.
+ *
+ * <b>Verschiedene Skripte können so nacheinander Variablen zuweisen und diese bei Bedarf auslesen</b>
+ *
+ * @return Smarty
+ */
+ private static function getTemplateEngine() {
+ if (self::$tpl == null) {
+ self::$tpl = new Smarty();
+
+ $tpl = self::$tpl;
+
+ $tpl->setCompileDir('./data/templates_c/');
+ $tpl->setTemplateDir('./classes/bfw/mvc/view/');
+ }
+
+ return self::$tpl;
+ }
+
+ /**
+ * @param $template
+ * @return string
+ */
+ public function fetch($template) {
+ return self::$tpl->fetch($template);
+ }
+
+ /**
+ * <b>Anzeige der komplett gerenderten Seite mit dem Layout $layout</b>
+ *
+ * @param string $layout
+ * @return int
+ */
+ public function display($layout = 'layout.tpl') {
+ $request = $this->controller->getRequest();
+
+ $controller = $this->controller;
+
+ $response = $controller->getResponse();
+ $this->assign('response', $response);
+
+ $this->assign('request', $request);
+
+ $model = $controller->getModel();
+ $user = $model->getUser();
+ $group = $model->getGroup();
+
+ if ($request->getKey('isLoggedIn')) {
+ $user->find($request->getKey('user_id'));
+ }
+
+ $this->assign('user', $user);
+ $this->assign('group', $group);
+
+ try {
+ self::$tpl->display($layout);
+ } catch (SmartyException $se) {
+ $response->setStatusCode(404);
+
+ self::$tpl->display('layout.tpl');
+ }
+
+ // Msg wieder auf Null setzen...
+ $request->setKey('msg', '');
+
+ // Fehler wieder auf Null setzen...
+ $request->setKey('error', '');
+
+ return http_response_code();
+ }
+
+ public function assign($key, $value) {
+ self::$tpl->assign($key, $value);
+ }
+
+ /**
+ * @param string $key
+ * @return string
+ */
+ public function get($key) {
+ return self::$tpl->getTemplateVars($key);
+ }
+
+}
--- a/classes/bfw/database/DBInterface.php
+++ b/classes/bfw/database/DBInterface.php
@@ -1,45 +1,45 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\database;
-
-/**
- * Interface DBInterface
- */
-interface DBInterface {
- /* fetch methods */
-
- public function fetch($table, $cond);
-
- public function fetchAll($table, $cond);
-
- /* find methoden */
-
- public function find($table, $id);
-
- public function findAll($table, $initial_id);
-
- public function findByField($table, $field, $value);
-
- function findAllByField($table, $field, $value);
-
- /* Abfrage Methoden */
-
- public function query($sql);
-
- /* Persistence Methods */
-
- public function persist($table, $array);
-
- public function store($table, $id, $array);
-
- public function delete($table, $id);
-
- /* PK Management */
-
- public function getLastInsertedId();
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\database;
+
+/**
+ * Interface DBInterface
+ */
+interface DBInterface {
+ /* fetch methods */
+
+ public function fetch($table, $cond);
+
+ public function fetchAll($table, $cond);
+
+ /* find methoden */
+
+ public function find($table, $id);
+
+ public function findAll($table, $initial_id);
+
+ public function findByField($table, $field, $value);
+
+ function findAllByField($table, $field, $value);
+
+ /* Abfrage Methoden */
+
+ public function query($sql);
+
+ /* Persistence Methods */
+
+ public function persist($table, $array);
+
+ public function store($table, $id, $array);
+
+ public function delete($table, $id);
+
+ /* PK Management */
+
+ public function getLastInsertedId();
+}
--- a/classes/bfw/mvc/controller/BenutzerverwaltungController.php
+++ b/classes/bfw/mvc/controller/BenutzerverwaltungController.php
@@ -1,141 +1,141 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\controller;
-
-use bfw\core\Controller;
-use bfw\Dispatcher;
-use bfw\entities\TGroup;
-
-/**
- * Class BenutzerverwaltungsController
- */
-class BenutzerverwaltungController extends Controller {
-
- /**
- * BenutzerverwaltungsController constructor.
- *
- */
- public function __construct() {
- parent::__construct();
- }
-
- /**
- *
- */
- public function meinProfil() {
- $request = $this->getRequest();
-
- $model = $this->getModel();
- if ($request->hasPost()) {
- $input = array(
- "username" => $request->session('username', ''),
- 'password' => md5($request->session('password', '')),
- 'firstname' => $request->session('firstname', ''),
- 'lastname' => $request->session('lastname', ''),
- );
-
- $user = $model->getUser();
- $user->find($request->getKey('user_id'));
-
- $user->merge($input);
- if (!$user->store()) {
- $request->setKey('error', 'Fehler beim Aktualisieren des Benutzers.');
- } else {
- $request->setKey('msg', 'Die Daten wurden aktualisiert.');
- }
- }
-
- $view = $this->getView();
- $view->display();
- }
-
- /**
- *
- */
- public function abmelden() {
- $request = $this->getRequest();
-
- $request->destroySession();
- $request->initSession();
-
- Dispatcher::route('/');
- }
-
- /**
- *
- */
- public function anmelden() {
- $request = $this->getRequest();
- $view = $this->getView();
-
- $this->getView()->display();
-
- if (!$request->hasPost()) {
- // nothing to do!
- return;
- }
-
- $model = $this->getModel()->getUser();
-
- $username = $request->post('username');
- $password = $request->post('password');
-
- $lastpage = $request->getKey('lastpage');
-
- $model->findByUsername($username);
-
- if ($model->getPassword() == md5($password)) {
- $request->setKey('user_id', $model->getId());
- $request->setKey('group_id', $model->getGroupId());
-
- $request->setKey('isLoggedIn', true);
-
- Dispatcher::route(sprintf('/%s/', $lastpage));
- }
- }
-
- /**
- *
- */
- public function registrieren() {
- $request = $this->getRequest();
- $view = $this->getView();
-
- $model = $this->getModel();
-
- $view->assign('currentUser', $model->getUser());
-
- $this->getView()->display();
- }
-
- public function index() {
- $request = $this->getRequest();
- $view = $this->getView();
-
- $model = $this->getModel();
-
- $group_id = $request->getKey('group_id');
-
- /**
- * Hier muss eine ACL-Schicht dazu
- *
- */
- if ($group_id != TGroup::ADMIN) {
- Dispatcher::route('/');
- }
-
- $users = $model->getUsers();
- $groups = $model->getGroups();
-
- $view->assign('users', $users);
- $view->assign('groups', $groups);
-
- $this->getView()->display();
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\controller;
+
+use bfw\core\Controller;
+use bfw\Dispatcher;
+use bfw\entities\TGroup;
+
+/**
+ * Class BenutzerverwaltungsController
+ */
+class BenutzerverwaltungController extends Controller {
+
+ /**
+ * BenutzerverwaltungsController constructor.
+ *
+ */
+ public function __construct() {
+ parent::__construct();
+ }
+
+ /**
+ *
+ */
+ public function meinProfil() {
+ $request = $this->getRequest();
+
+ $model = $this->getModel();
+ if ($request->hasPost()) {
+ $input = array(
+ "username" => $request->session('username', ''),
+ 'password' => md5($request->session('password', '')),
+ 'firstname' => $request->session('firstname', ''),
+ 'lastname' => $request->session('lastname', ''),
+ );
+
+ $user = $model->getUser();
+ $user->find($request->getKey('user_id'));
+
+ $user->merge($input);
+ if (!$user->store()) {
+ $request->setKey('error', 'Fehler beim Aktualisieren des Benutzers.');
+ } else {
+ $request->setKey('msg', 'Die Daten wurden aktualisiert.');
+ }
+ }
+
+ $view = $this->getView();
+ $view->display();
+ }
+
+ /**
+ *
+ */
+ public function abmelden() {
+ $request = $this->getRequest();
+
+ $request->destroySession();
+ $request->initSession();
+
+ Dispatcher::route('/');
+ }
+
+ /**
+ *
+ */
+ public function anmelden() {
+ $request = $this->getRequest();
+ $view = $this->getView();
+
+ $this->getView()->display();
+
+ if (!$request->hasPost()) {
+ // nothing to do!
+ return;
+ }
+
+ $model = $this->getModel()->getUser();
+
+ $username = $request->post('username');
+ $password = $request->post('password');
+
+ $lastpage = $request->getKey('lastpage');
+
+ $model->findByUsername($username);
+
+ if ($model->getPassword() == md5($password)) {
+ $request->setKey('user_id', $model->getId());
+ $request->setKey('group_id', $model->getGroupId());
+
+ $request->setKey('isLoggedIn', true);
+
+ Dispatcher::route(sprintf('/%s/', $lastpage));
+ }
+ }
+
+ /**
+ *
+ */
+ public function registrieren() {
+ $request = $this->getRequest();
+ $view = $this->getView();
+
+ $model = $this->getModel();
+
+ $view->assign('currentUser', $model->getUser());
+
+ $this->getView()->display();
+ }
+
+ public function index() {
+ $request = $this->getRequest();
+ $view = $this->getView();
+
+ $model = $this->getModel();
+
+ $group_id = $request->getKey('group_id');
+
+ /**
+ * Hier muss eine ACL-Schicht dazu
+ *
+ */
+ if ($group_id != TGroup::ADMIN) {
+ Dispatcher::route('/');
+ }
+
+ $users = $model->getUsers();
+ $groups = $model->getGroups();
+
+ $view->assign('users', $users);
+ $view->assign('groups', $groups);
+
+ $this->getView()->display();
+ }
+
+}
--- a/classes/bfw/mvc/controller/DokumentationController.php
+++ b/classes/bfw/mvc/controller/DokumentationController.php
@@ -1,30 +1,30 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\controller;
-
-use bfw\core\Controller;
-
-/**
- * Class DokumentationController
- * @package bfw\mvc\controller
- */
-class DokumentationController extends Controller {
-
- public function __construct() {
- parent::__construct();
- }
-
- public function index() {
- $request = $this->getRequest();
- $view = $this->getView();
- $model = $this->getModel();
-
- $this->getView()->display();
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\controller;
+
+use bfw\core\Controller;
+
+/**
+ * Class DokumentationController
+ * @package bfw\mvc\controller
+ */
+class DokumentationController extends Controller {
+
+ public function __construct() {
+ parent::__construct();
+ }
+
+ public function index() {
+ $request = $this->getRequest();
+ $view = $this->getView();
+ $model = $this->getModel();
+
+ $this->getView()->display();
+ }
+
+}
--- a/classes/bfw/mvc/controller/ErrorController.php
+++ b/classes/bfw/mvc/controller/ErrorController.php
@@ -1,30 +1,30 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\controller;
-
-use bfw\core\Controller;
-
-/**
- * Class ErrorController
- *
- */
-class ErrorController extends Controller {
-
- public function __construct() {
- parent::__construct();
-
- $this->getView()->assign('controller', 'error');
- $this->getView()->assign('action', 'index');
- }
-
- public function index() {
- http_response_code(404);
- return $this->getView()->display();
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\controller;
+
+use bfw\core\Controller;
+
+/**
+ * Class ErrorController
+ *
+ */
+class ErrorController extends Controller {
+
+ public function __construct() {
+ parent::__construct();
+
+ $this->getView()->assign('controller', 'error');
+ $this->getView()->assign('action', 'index');
+ }
+
+ public function index() {
+ http_response_code(404);
+ return $this->getView()->display();
+ }
+
+}
--- a/classes/bfw/mvc/controller/HomeController.php
+++ b/classes/bfw/mvc/controller/HomeController.php
@@ -1,33 +1,33 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\controller;
-
-use bfw\core\Controller;
-
-/**
- * Class HomeController
- */
-class HomeController extends Controller {
-
- /**
- * HomeController constructor.
- *
- */
- public function __construct() {
- parent::__construct();
- }
-
- /**
- * Default Index Action
- *
- */
- public function index() {
- $this->getView()->display();
- }
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\controller;
+
+use bfw\core\Controller;
+
+/**
+ * Class HomeController
+ */
+class HomeController extends Controller {
+
+ /**
+ * HomeController constructor.
+ *
+ */
+ public function __construct() {
+ parent::__construct();
+ }
+
+ /**
+ * Default Index Action
+ *
+ */
+ public function index() {
+ $this->getView()->display();
+ }
+
+}
--- a/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php
+++ b/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php
@@ -1,17 +1,17 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\model\benutzerverwaltung;
-
-use bfw\core\Model;
-
-/**
- * Class DataModel
- */
-class DataModel extends Model {
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\model\benutzerverwaltung;
+
+use bfw\core\Model;
+
+/**
+ * Class DataModel
+ */
+class DataModel extends Model {
+
+}
--- a/classes/bfw/mvc/model/dokumentation/DataModel.php
+++ b/classes/bfw/mvc/model/dokumentation/DataModel.php
@@ -1,17 +1,17 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\model\dokumentation;
-
-use bfw\core\Model;
-
-/**
- * Class DataModel
- */
-class DataModel extends Model {
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\model\dokumentation;
+
+use bfw\core\Model;
+
+/**
+ * Class DataModel
+ */
+class DataModel extends Model {
+
+}
--- a/classes/bfw/mvc/model/error/DataModel.php
+++ b/classes/bfw/mvc/model/error/DataModel.php
@@ -1,17 +1,17 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\model\error;
-
-use bfw\core\Model;
-
-/**
- * Class DataModel
- */
-class DataModel extends Model {
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\model\error;
+
+use bfw\core\Model;
+
+/**
+ * Class DataModel
+ */
+class DataModel extends Model {
+
+}
--- a/classes/bfw/mvc/model/home/DataModel.php
+++ b/classes/bfw/mvc/model/home/DataModel.php
@@ -1,17 +1,17 @@
-<?php
-
-/**
- * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
- *
- */
-
-namespace bfw\mvc\model\home;
-
-use bfw\core\Model;
-
-/**
- * Class DataModel
- */
-class DataModel extends Model {
-
-}
+<?php
+
+/**
+ * Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com>
+ *
+ */
+
+namespace bfw\mvc\model\home;
+
+use bfw\core\Model;
+
+/**
+ * Class DataModel
+ */
+class DataModel extends Model {
+
+}
--- a/config/config.php
+++ b/config/config.php
@@ -1,16 +1,16 @@
-<?php
-
-/**
- * Konfigurationsbereich des Bröker Frameworks
- */
-define('BFW_PATH', dirname(dirname(__FILE__)));
-
-require_once BFW_PATH . '/classes/bfw/Configuration.php';
-require_once BFW_PATH . '/library/log4php/Logger.php';
-
-Logger::configure(bfw\Configuration::bfw_loggerConfiguration());
-spl_autoload_register('bfw\Configuration::bfw_autoLoader');
-
-// Session Handling
-session_name('bfw-id');
-session_start();
+<?php
+
+/**
+ * Konfigurationsbereich des Bröker Frameworks
+ */
+define('BFW_PATH', dirname(dirname(__FILE__)));
+
+require_once BFW_PATH . '/classes/bfw/Configuration.php';
+require_once BFW_PATH . '/library/log4php/Logger.php';
+
+Logger::configure(bfw\Configuration::bfw_loggerConfiguration());
+spl_autoload_register('bfw\Configuration::bfw_autoLoader');
+
+// Session Handling
+session_name('bfw-id');
+session_start();
--- a/index.php
+++ b/index.php
@@ -1,14 +1,13 @@
-<?php
-
-/**
- * Bröker Framework Version 0.1
- *
- * @author Markus Bröker<broeker.markus@googlemail.com>
- */
-
-use bfw\Dispatcher;
-
-require_once 'config/config.php';
-
-$dispatcher = new Dispatcher();
-return $dispatcher->delegate();
\ No newline at end of file
+<?php
+
+/**
+ * Bröker Framework Version 0.1
+ *
+ * @author Markus Bröker<broeker.markus@googlemail.com>
+ */
+use bfw\Dispatcher;
+
+require_once 'config/config.php';
+
+$dispatcher = new Dispatcher();
+return $dispatcher->delegate();
--- a/patches/Test.php
+++ b/patches/Test.php
@@ -1,12 +1,12 @@
-<?php
-
-require_once '../config/config.php';
-
-use bfw\entities\TUser;
-
-$tuser = new TUser();
-$users = $tuser->findAll();
-
-foreach ($users as $user) {
- printf("Benutzer: %s %s", $user->getFirstname(), $user->getUsername());
+<?php
+
+require_once '../config/config.php';
+
+use bfw\entities\TUser;
+
+$tuser = new TUser();
+$users = $tuser->findAll();
+
+foreach ($users as $user) {
+ printf("Benutzer: %s %s", $user->getFirstname(), $user->getUsername());
}
\ No newline at end of file
--- a/setup/index.php
+++ b/setup/index.php
@@ -1,52 +1,52 @@
-<?php
-
-header('Content-Type: text/plain');
-
-$cfg = array(
- 'dsn' => 'mysql:host=localhost;',
- 'config' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'),
- 'username' => 'root',
- 'password' => '',
-);
-
-require_once '../config/config.php';
-
-use bfw\database\Database;
-
-$db = Database::getInstance($cfg);
-
-$dropSQLStatements = array(
- "DROP USER 'bfw'@'localhost'",
- "DROP DATABASE IF EXISTS bfw;",
-);
-
-$createSQLStatements = array(
- "CREATE DATABASE bfw CHARACTER SET utf8 COLLATE utf8_unicode_ci;",
- "CREATE USER 'bfw'@'localhost' IDENTIFIED BY 'bfw';",
- "GRANT ALL PRIVILEGES ON bfw.* TO 'bfw'@'localhost' WITH GRANT OPTION;",
-);
-
-foreach ($dropSQLStatements as $statement) {
- $status = $db->execute($statement);
- echo sprintf("%s\n", $statement);
-}
-
-foreach ($createSQLStatements as $statement) {
- $status = $db->execute($statement);
- echo sprintf("%s\n", $statement);
-}
-
-$handle = fopen(BFW_PATH . '/sql/init.sql', 'r');
-
-$sql = "USE bfw;\n\n";
-while (!feof($handle)) {
- $sql .= fgets($handle);
-}
-
-fclose($handle);
-
-if ($db->execute($sql) == 0) {
- echo sprintf("%s", $sql);
-
- header('Location: /');
-}
+<?php
+
+header('Content-Type: text/plain');
+
+$cfg = array(
+ 'dsn' => 'mysql:host=localhost;',
+ 'config' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'),
+ 'username' => 'root',
+ 'password' => '',
+);
+
+require_once '../config/config.php';
+
+use bfw\database\Database;
+
+$db = Database::getInstance($cfg);
+
+$dropSQLStatements = array(
+ "DROP USER 'bfw'@'localhost'",
+ "DROP DATABASE IF EXISTS bfw;",
+);
+
+$createSQLStatements = array(
+ "CREATE DATABASE bfw CHARACTER SET utf8 COLLATE utf8_unicode_ci;",
+ "CREATE USER 'bfw'@'localhost' IDENTIFIED BY 'bfw';",
+ "GRANT ALL PRIVILEGES ON bfw.* TO 'bfw'@'localhost' WITH GRANT OPTION;",
+);
+
+foreach ($dropSQLStatements as $statement) {
+ $status = $db->execute($statement);
+ echo sprintf("%s\n", $statement);
+}
+
+foreach ($createSQLStatements as $statement) {
+ $status = $db->execute($statement);
+ echo sprintf("%s\n", $statement);
+}
+
+$handle = fopen(BFW_PATH . '/sql/init.sql', 'r');
+
+$sql = "USE bfw;\n\n";
+while (!feof($handle)) {
+ $sql .= fgets($handle);
+}
+
+fclose($handle);
+
+if ($db->execute($sql) == 0) {
+ echo sprintf("%s", $sql);
+
+ header('Location: /');
+}
--- a/tests/bfw/DatabaseTest.php
+++ b/tests/bfw/DatabaseTest.php
@@ -1,52 +1,52 @@
-<?php
-
-require_once '../../config/config.php';
-
-use bfw\database\Database;
-
-class DatabaseTest extends \PHPUnit_Framework_TestCase {
- private $object;
-
- public function __construct() {
- $this->object = Database::getInstance();
- }
-
- public function testStore() {
- $data = array();
- $data['password'] = md5(rand(0, 255));
-
- $result = $this->object->store('t_user', 1, $data);
- $this->assertTrue($result !== false);
- }
-
- public function testFetch() {
- $data = $this->object->fetch('t_user', 'id = 1');
-
- $this->assertEquals('system@testbox.de', $data['username']);
- }
-
- public function testFetchAll() {
- $data = $this->object->fetchAll('t_user', 'id < 3');
-
- $this->assertTrue(is_array($data));
-
- foreach ($data as $row) {
- echo sprintf("%s\n", implode(', ', $row));
- }
- }
-
- public function testFind() {
- $data = $this->object->find('t_user', -1);
- $this->assertEquals(null, $data);
-
- $data = $this->object->find('t_user', 1);
- $this->assertEquals(1, $data['id']);
- }
-
- public function testFindAll() {
- $data1 = $this->object->findAll('t_user');
- $data2 = $this->object->findAll('t_user', 5);
-
- $this->assertTrue(count($data1) != count($data2));
- }
-}
+<?php
+
+require_once '../../config/config.php';
+
+use bfw\database\Database;
+
+class DatabaseTest extends \PHPUnit_Framework_TestCase {
+ private $object;
+
+ public function __construct() {
+ $this->object = Database::getInstance();
+ }
+
+ public function testStore() {
+ $data = array();
+ $data['password'] = md5(rand(0, 255));
+
+ $result = $this->object->store('t_user', 1, $data);
+ $this->assertTrue($result !== false);
+ }
+
+ public function testFetch() {
+ $data = $this->object->fetch('t_user', 'id = 1');
+
+ $this->assertEquals('system@testbox.de', $data['username']);
+ }
+
+ public function testFetchAll() {
+ $data = $this->object->fetchAll('t_user', 'id < 3');
+
+ $this->assertTrue(is_array($data));
+
+ foreach ($data as $row) {
+ echo sprintf("%s\n", implode(', ', $row));
+ }
+ }
+
+ public function testFind() {
+ $data = $this->object->find('t_user', -1);
+ $this->assertEquals(null, $data);
+
+ $data = $this->object->find('t_user', 1);
+ $this->assertEquals(1, $data['id']);
+ }
+
+ public function testFindAll() {
+ $data1 = $this->object->findAll('t_user');
+ $data2 = $this->object->findAll('t_user', 5);
+
+ $this->assertTrue(count($data1) != count($data2));
+ }
+}