diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index dfe0770..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ad5f84b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+vendor/
+.projectroot
diff --git a/.phpunit.result.cache b/.phpunit.result.cache
new file mode 100644
index 0000000..5e1e6fc
--- /dev/null
+++ b/.phpunit.result.cache
@@ -0,0 +1 @@
+C:37:"PHPUnit\Runner\DefaultTestResultCache":508:{a:2:{s:7:"defects";a:4:{s:47:"TestUser::testCanBeCreatedFromValidEmailAddress";i:4;s:48:"TestEmail::testCanBeCreatedFromValidEmailAddress";i:4;s:53:"TestEmail::testCannotBeCreatedFromInvalidEmailAddress";i:4;s:32:"TestEmail::testCanBeUsedAsString";i:4;}s:5:"times";a:4:{s:48:"TestEmail::testCanBeCreatedFromValidEmailAddress";d:0.005;s:53:"TestEmail::testCannotBeCreatedFromInvalidEmailAddress";d:0.001;s:32:"TestEmail::testCanBeUsedAsString";d:0;s:47:"TestUser::testCanBeCreatedFromValidEmailAddress";d:0;}}}
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index abe5e15..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Listen for XDebug",
- "type": "php",
- "request": "launch",
- "port": 9000
- },
- {
- "name": "Launch currently open script",
- "type": "php",
- "request": "launch",
- "program": "${file}",
- "cwd": "${fileDirname}",
- "port": 9000
- }
- ],
- "php.executablePath": "C:/xampp/php/php.exe",
- "php.suggest.basic": "false"
-}
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..1242738
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,10 @@
+{
+ "autoload": {
+ "classmap": [
+ "dev_mvc/"
+ ]
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8"
+ }
+}
\ No newline at end of file
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 0000000..ebeb7bc
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,1535 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "7ac69bab358a14faafdf4864a1b16e05",
+ "packages": [],
+ "packages-dev": [
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "a2c590166b2133a4633738648b6b064edae0814a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
+ "reference": "a2c590166b2133a4633738648b6b064edae0814a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpbench/phpbench": "^0.13",
+ "phpstan/phpstan-phpunit": "^0.11",
+ "phpstan/phpstan-shim": "^0.11",
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://www.doctrine-project.org/projects/instantiator.html",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2019-03-17T17:37:11+00:00"
+ },
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.9.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea",
+ "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "replace": {
+ "myclabs/deep-copy": "self.version"
+ },
+ "require-dev": {
+ "doctrine/collections": "^1.0",
+ "doctrine/common": "^2.6",
+ "phpunit/phpunit": "^7.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ },
+ "files": [
+ "src/DeepCopy/deep_copy.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "time": "2019-08-09T12:45:53+00:00"
+ },
+ {
+ "name": "phar-io/manifest",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/manifest.git",
+ "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
+ "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-phar": "*",
+ "phar-io/version": "^2.0",
+ "php": "^5.6 || ^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Heuer",
+ "email": "sebastian@phpeople.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
+ "time": "2018-07-08T19:23:20+00:00"
+ },
+ {
+ "name": "phar-io/version",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/version.git",
+ "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
+ "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Heuer",
+ "email": "sebastian@phpeople.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "Library for handling version information and constraints",
+ "time": "2018-07-08T19:19:57+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-common",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
+ "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
+ "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jaap van Otterdijk",
+ "email": "opensource@ijaap.nl"
+ }
+ ],
+ "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "FQSEN",
+ "phpDocumentor",
+ "phpdoc",
+ "reflection",
+ "static analysis"
+ ],
+ "time": "2018-08-07T13:53:10+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "4.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
+ "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0",
+ "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
+ "phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
+ "webmozart/assert": "^1.0"
+ },
+ "require-dev": {
+ "doctrine/instantiator": "^1.0.5",
+ "mockery/mockery": "^1.0",
+ "phpunit/phpunit": "^6.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
+ "time": "2019-09-12T14:27:41+00:00"
+ },
+ {
+ "name": "phpdocumentor/type-resolver",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/TypeResolver.git",
+ "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
+ "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1",
+ "phpdocumentor/reflection-common": "^2.0"
+ },
+ "require-dev": {
+ "ext-tokenizer": "^7.1",
+ "mockery/mockery": "~1",
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
+ "time": "2019-08-22T18:11:29+00:00"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "1.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203",
+ "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": "^5.3|^7.0",
+ "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
+ "sebastian/comparator": "^1.1|^2.0|^3.0",
+ "sebastian/recursion-context": "^1.0|^2.0|^3.0"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "^2.5|^3.2",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.8.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Prophecy\\": "src/Prophecy"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2019-10-03T11:07:50+00:00"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "7.0.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f",
+ "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-xmlwriter": "*",
+ "php": "^7.2",
+ "phpunit/php-file-iterator": "^2.0.2",
+ "phpunit/php-text-template": "^1.2.1",
+ "phpunit/php-token-stream": "^3.1.1",
+ "sebastian/code-unit-reverse-lookup": "^1.0.1",
+ "sebastian/environment": "^4.2.2",
+ "sebastian/version": "^2.0.1",
+ "theseer/tokenizer": "^1.1.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8.2.2"
+ },
+ "suggest": {
+ "ext-xdebug": "^2.7.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "7.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "time": "2019-09-17T06:24:36+00:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "2.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "050bedf145a257b1ff02746c31894800e5122946"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946",
+ "reference": "050bedf145a257b1ff02746c31894800e5122946",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2018-09-13T20:33:42+00:00"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21T13:50:34+00:00"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "2.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "1038454804406b0b5f5f520358e78c1c2f71501e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e",
+ "reference": "1038454804406b0b5f5f520358e78c1c2f71501e",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "time": "2019-06-07T04:22:29+00:00"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "3.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff",
+ "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Wrapper around PHP's tokenizer extension.",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+ "keywords": [
+ "tokenizer"
+ ],
+ "time": "2019-09-17T06:23:10+00:00"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "8.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "57e5e77b62086033528ee1f4063ae03035f57894"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/57e5e77b62086033528ee1f4063ae03035f57894",
+ "reference": "57e5e77b62086033528ee1f4063ae03035f57894",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.2.0",
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "ext-xmlwriter": "*",
+ "myclabs/deep-copy": "^1.9.1",
+ "phar-io/manifest": "^1.0.3",
+ "phar-io/version": "^2.0.1",
+ "php": "^7.2",
+ "phpspec/prophecy": "^1.8.1",
+ "phpunit/php-code-coverage": "^7.0.7",
+ "phpunit/php-file-iterator": "^2.0.2",
+ "phpunit/php-text-template": "^1.2.1",
+ "phpunit/php-timer": "^2.1.2",
+ "sebastian/comparator": "^3.0.2",
+ "sebastian/diff": "^3.0.2",
+ "sebastian/environment": "^4.2.2",
+ "sebastian/exporter": "^3.1.1",
+ "sebastian/global-state": "^3.0.0",
+ "sebastian/object-enumerator": "^3.0.3",
+ "sebastian/resource-operations": "^2.0.1",
+ "sebastian/type": "^1.1.3",
+ "sebastian/version": "^2.0.1"
+ },
+ "require-dev": {
+ "ext-pdo": "*"
+ },
+ "suggest": {
+ "ext-soap": "*",
+ "ext-xdebug": "*",
+ "phpunit/php-invoker": "^2.0.0"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "8.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2019-10-04T03:12:25+00:00"
+ },
+ {
+ "name": "sebastian/code-unit-reverse-lookup",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
+ "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
+ "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.7 || ^6.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Looks up which function or method a line of code belongs to",
+ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
+ "time": "2017-03-04T06:30:41+00:00"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "3.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
+ "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1",
+ "sebastian/diff": "^3.0",
+ "sebastian/exporter": "^3.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "https://github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2018-07-12T15:12:46+00:00"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "3.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
+ "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.5 || ^8.0",
+ "symfony/process": "^2 || ^3.3 || ^4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "https://github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff",
+ "udiff",
+ "unidiff",
+ "unified diff"
+ ],
+ "time": "2019-02-04T06:01:07+00:00"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "4.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
+ "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.5"
+ },
+ "suggest": {
+ "ext-posix": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.2-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2019-05-05T09:05:15+00:00"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "3.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e",
+ "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0",
+ "sebastian/recursion-context": "^3.0"
+ },
+ "require-dev": {
+ "ext-mbstring": "*",
+ "phpunit/phpunit": "^6.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2019-09-14T09:02:43+00:00"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4",
+ "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2",
+ "sebastian/object-reflector": "^1.1.1",
+ "sebastian/recursion-context": "^3.0"
+ },
+ "require-dev": {
+ "ext-dom": "*",
+ "phpunit/phpunit": "^8.0"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2019-02-01T05:30:01+00:00"
+ },
+ {
+ "name": "sebastian/object-enumerator",
+ "version": "3.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-enumerator.git",
+ "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5",
+ "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0",
+ "sebastian/object-reflector": "^1.1.1",
+ "sebastian/recursion-context": "^3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Traverses array structures and object graphs to enumerate all referenced objects",
+ "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
+ "time": "2017-08-03T12:35:26+00:00"
+ },
+ {
+ "name": "sebastian/object-reflector",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-reflector.git",
+ "reference": "773f97c67f28de00d397be301821b06708fca0be"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be",
+ "reference": "773f97c67f28de00d397be301821b06708fca0be",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Allows reflection of object attributes, including inherited and non-public ones",
+ "homepage": "https://github.com/sebastianbergmann/object-reflector/",
+ "time": "2017-03-29T09:07:27+00:00"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8",
+ "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2017-03-03T06:23:57+00:00"
+ },
+ {
+ "name": "sebastian/resource-operations",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/resource-operations.git",
+ "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
+ "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides a list of PHP built-in functions that operate on resources",
+ "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
+ "time": "2018-10-04T04:07:39+00:00"
+ },
+ {
+ "name": "sebastian/type",
+ "version": "1.1.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/type.git",
+ "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3",
+ "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Collection of value objects that represent the types of the PHP type system",
+ "homepage": "https://github.com/sebastianbergmann/type",
+ "time": "2019-07-02T08:10:15+00:00"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2016-10-03T07:35:21+00:00"
+ },
+ {
+ "name": "symfony/polyfill-ctype",
+ "version": "v1.12.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-ctype.git",
+ "reference": "550ebaac289296ce228a706d0867afc34687e3f4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4",
+ "reference": "550ebaac289296ce228a706d0867afc34687e3f4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-ctype": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.12-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Ctype\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gert de Pagter",
+ "email": "BackEndTea@gmail.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for ctype functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "ctype",
+ "polyfill",
+ "portable"
+ ],
+ "time": "2019-08-06T08:03:45+00:00"
+ },
+ {
+ "name": "theseer/tokenizer",
+ "version": "1.1.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/theseer/tokenizer.git",
+ "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
+ "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": "^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
+ "time": "2019-06-13T22:48:21+00:00"
+ },
+ {
+ "name": "webmozart/assert",
+ "version": "1.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/webmozart/assert.git",
+ "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4",
+ "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.3 || ^7.0",
+ "symfony/polyfill-ctype": "^1.8"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.36 || ^7.5.13"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Webmozart\\Assert\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Assertions to validate method input/output with nice error messages.",
+ "keywords": [
+ "assert",
+ "check",
+ "validate"
+ ],
+ "time": "2019-08-24T08:43:50+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
+}
diff --git a/dev/app/HUtils.php b/dev/app/HUtils.php
deleted file mode 100644
index b620cac..0000000
--- a/dev/app/HUtils.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
\ No newline at end of file
diff --git a/dev/app/assets/AssetHandler.php b/dev/app/assets/AssetHandler.php
deleted file mode 100644
index 05dad34..0000000
--- a/dev/app/assets/AssetHandler.php
+++ /dev/null
@@ -1,17 +0,0 @@
-';
- }
- else{
- echo ' prepare("SELECT * FROM users where email = :email");
- //Bind parameters
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- //Voer de query uit
- $query->execute();
- //Check de hoeveelheid rijen die de database returnt.
- if($query->rowCount() == 0){
- //Email adres is niet in gebruik, return false
- return false;
- }
- else{
- //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
- return true;
- }
- }
- //Controleert of de gebruikersnaam al in de database voorkomt. Returnt true indien wel.
- static function checkUsedUsername($username){
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM users where username = :username");
- //Bind parameters
- $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
- //Voer de query uit
- $query->execute();
- //Check de hoeveelheid rijen die de database returnt.
- if($query->rowCount() == 0){
- //Username adres is niet in gebruik, return false
- return false;
- }
- else{
- //Username is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
- return true;
- }
- }
- //Registreert een gebruiker. Neemt als invoer email, wachtwoord, gebruikersnaam.
- static function registerUser($email, $password, $username){
- $ip = $_SERVER['REMOTE_ADDR'];
- //Initit db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("INSERT INTO users (username, email, password, reg_ip) VALUES (:username, :email, :password, :ip)");
- //Bind parameters
- $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- $query->bindParam(':ip', $ip, PDO::PARAM_STR, 256);
- //Voer query uit
- $query->execute();
- }
- //Check of gegeven login info in de database voorkomt
- static function isLoginValid($email, $password){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM users where email = :email AND password = :password");
- //Bind params
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- //login correct (komt voor in de db)
- return true;
- }
- else{
- //Incorrect
- return false;
- }
- }
- //Vraag gebruikers ID op doormiddel van email en pass
- static function getUID($email, $password){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT id FROM users where email = :email AND password = :password");
- //Bind params
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return -1;
- }
- }
- static function getUsername($uid){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT username FROM users where id = :uid");
- $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return "dbfetcherror";
- }
- }
- static function isSessionTokenInUse($token){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM usersessions where token = :token");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 0){
- return false;
- }
- else{
- return true;
- }
- }
- static function registerNewSession($uid, $token, $expires){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("INSERT INTO usersessions (uid, token, expires) VALUES (:uid, :token, :expires)");
- //Bind params
- $query->bindParam(':uid', $uid, PDO::PARAM_INT);
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->bindParam(':expires', $expires, PDO::PARAM_STR);
- //Voer query it
- $query->execute();
- }
- static function isSessionValid($token, $uid){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM usersessions where token = :token AND uid = :uid AND expires > NOW()");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- return true;
- }
- else{
- return false;
- }
- }
- static function invalidateSession($token){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE token = :token");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- }
- static function invalidateSessionByUID($uid){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE uid = :uid");
- //Bind params
- $query->bindParam(':token', $uid, PDO::PARAM_INT);
- //Voer query it
- $query->execute();
- }
- static function deleteExpiredSessions(){
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE expires < NOW()");
- $query->execute();
- }
- static function getSessionExpiryDate($token){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT expires FROM usersessions where token = :token");
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return "2000-01-01 00:00:00";
- }
- }
- static function createThread(){
-
- }
-}
-?>
\ No newline at end of file
diff --git a/dev/app/login/UserSession.php b/dev/app/login/UserSession.php
deleted file mode 100644
index c795add..0000000
--- a/dev/app/login/UserSession.php
+++ /dev/null
@@ -1,92 +0,0 @@
-username = $username;
- $this->uid = $uid;
- $this->token = $token;
- $this->setExpiry();
- //echo($username." ");
- //echo($loginSessionToken);
- $_SESSION['usersession'] = $this;
- setcookie('usersession', $this->token);
- setcookie('uid', $this->uid);
- }
- public function setSessionToken($token){
- $this->token = $token;
- }
- public function getSessionToken(){
- return $this->token;
- }
- public function getFormattedExpiry(){
- return $this->expires->format('Y-m-d H:i:s');
- }
- public function setExpiry(){
- $this->expires = new DateTime();
- $this->expires->modify("+ 1 hour");
- }
- public static function generateToken(){
- $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $token = "";
- for ($i=0; $i < 32 ; $i++) {
- $token .= $chars[rand(0, strlen($chars) - 1)];
- }
- return $token;
- }
- public static function isSessionValid(){
- if(isset($_SESSION['usersession'])){
- if(!UserSession::isSessionExpired($_SESSION['usersession'])){
- //check if session also exists in database
- return true;
- }
- }
- else{
- if(isset($_COOKIE['usersession'])){
- $token = $_COOKIE['usersession'];
- $uid = $_COOKIE['uid'];
- if(Database::isSessionValid($token,$uid)){
- $username = Database::getUsername($uid);
- $session = new UserSession($username, $uid, $token);
- $session->expires = new DateTime(Database::getSessionExpiryDate($token));
- }
- else{
- return false;
- }
- if(!UserSession::isSessionExpired($session)){
- return true;
- }
- }
- return false;
- }
- }
- public static function getSession()
- {
- return $_SESSION['usersession'];
- }
- public static function isSessionExpired($session){
- //session is expired
- if(new DateTime() > $session->expires){
- return true;
- }
- //session is not expired
- else{
- return false;
- }
- }
- public static function isUserSignedIn(){
- if(UserSession::isSessionValid()){
- if(!UserSession::isSessionExpired(UserSession::getSession())){
- if(Database::isSessionValid(UserSession::getSession()->token, UserSession::getSession()->uid)){
- return true;
- }
- }
- else{
- return false;
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/dev/app/login/attempt_login.php b/dev/app/login/attempt_login.php
deleted file mode 100644
index cae9861..0000000
--- a/dev/app/login/attempt_login.php
+++ /dev/null
@@ -1,46 +0,0 @@
-getSessionToken();
- echo " ";
- echo $a->uid;
- echo " ";
- echo $a->username;
- }
- //clean up expired sessions from ANY users
- Database::deleteExpiredSessions();
- Database::registerNewSession($a->uid, $a->token, $a->getFormattedExpiry());
- //logged in, time to continue with other stuff
- }
- else{
- echo "uid returned -1 from db interface";
- }
- }
- else{
- echo("login invalid");
- }
- }
-}
-else{
- //we're done, don't even need to log in, session already active
- //echo($_SESSION['usersession']->uid);
-}
-?>
\ No newline at end of file
diff --git a/dev/app/login/attempt_logout.php b/dev/app/login/attempt_logout.php
deleted file mode 100644
index 456fc0f..0000000
--- a/dev/app/login/attempt_logout.php
+++ /dev/null
@@ -1,12 +0,0 @@
-token);
- session_destroy();
-}
-
-
-
-
-
-?>
\ No newline at end of file
diff --git a/dev/app/login/destroy.php b/dev/app/login/destroy.php
deleted file mode 100644
index ecf6762..0000000
--- a/dev/app/login/destroy.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/content_header.php b/dev/app/pagecontent/content_header.php
deleted file mode 100644
index 1c07e88..0000000
--- a/dev/app/pagecontent/content_header.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- log in register home
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/content_header_signedin.php b/dev/app/pagecontent/content_header_signedin.php
deleted file mode 100644
index 76343dd..0000000
--- a/dev/app/pagecontent/content_header_signedin.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- log out home simulate browser session expiry
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/content_index.php b/dev/app/pagecontent/content_index.php
deleted file mode 100644
index 852160d..0000000
--- a/dev/app/pagecontent/content_index.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Welkom op hForumPHP. Log in of registreer om iets te doen.
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/content_page.php b/dev/app/pagecontent/content_page.php
deleted file mode 100644
index ed57278..0000000
--- a/dev/app/pagecontent/content_page.php
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
- =$sSiteTitle?>
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/login/content_destroy.php b/dev/app/pagecontent/login/content_destroy.php
deleted file mode 100644
index dc3cd8b..0000000
--- a/dev/app/pagecontent/login/content_destroy.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- You're still signed in thanks to our cookies!
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/login/content_login.php b/dev/app/pagecontent/login/content_login.php
deleted file mode 100644
index dd07475..0000000
--- a/dev/app/pagecontent/login/content_login.php
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/login/content_login_succesful.php b/dev/app/pagecontent/login/content_login_succesful.php
deleted file mode 100644
index ea09f68..0000000
--- a/dev/app/pagecontent/login/content_login_succesful.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
- Login succesful :DDDDDDDD
-
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/login/content_login_unsuccesful.php b/dev/app/pagecontent/login/content_login_unsuccesful.php
deleted file mode 100644
index a9a1ae8..0000000
--- a/dev/app/pagecontent/login/content_login_unsuccesful.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- UNEXPECTED LOGIN ERROR. OUR CODEMONKEYS DID SOMETHING VERY WRONG :(
-
\ No newline at end of file
diff --git a/dev/app/pagecontent/login/content_register.php b/dev/app/pagecontent/login/content_register.php
deleted file mode 100644
index 9bdc0ac..0000000
--- a/dev/app/pagecontent/login/content_register.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/dev/app/registration/attempt_register.php b/dev/app/registration/attempt_register.php
deleted file mode 100644
index 1441324..0000000
--- a/dev/app/registration/attempt_register.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
\ No newline at end of file
diff --git a/dev/css/main.css b/dev/css/main.css
deleted file mode 100644
index e69de29..0000000
diff --git a/dev/img/logo.png b/dev/img/logo.png
deleted file mode 100644
index 5837651..0000000
Binary files a/dev/img/logo.png and /dev/null differ
diff --git a/dev/index.php b/dev/index.php
deleted file mode 100644
index d2d3c64..0000000
--- a/dev/index.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/.buildpath b/dev_mvc/.buildpath
new file mode 100644
index 0000000..8bcb4b5
--- /dev/null
+++ b/dev_mvc/.buildpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/dev_mvc/.phpunit.result.cache b/dev_mvc/.phpunit.result.cache
new file mode 100644
index 0000000..bde2669
--- /dev/null
+++ b/dev_mvc/.phpunit.result.cache
@@ -0,0 +1 @@
+C:30:"PHPUnit\Runner\TestResultCache":44:{a:2:{s:7:"defects";a:0:{}s:5:"times";a:0:{}}}
\ No newline at end of file
diff --git a/dev_mvc/.project b/dev_mvc/.project
new file mode 100644
index 0000000..3b1a44b
--- /dev/null
+++ b/dev_mvc/.project
@@ -0,0 +1,22 @@
+
+
+ dev
+
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.dltk.core.scriptbuilder
+
+
+
+
+
+ org.eclipse.php.core.PHPNature
+
+
diff --git a/dev_mvc/controller/AssetHandler.php b/dev_mvc/controller/AssetHandler.php
deleted file mode 100644
index 0718470..0000000
--- a/dev_mvc/controller/AssetHandler.php
+++ /dev/null
@@ -1,12 +0,0 @@
-';
- }
- else{
- echo ' prepare("SELECT * FROM users where email = :email");
- //Bind parameters
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- //Voer de query uit
- $query->execute();
- //Check de hoeveelheid rijen die de database returnt.
- if($query->rowCount() == 0){
- //Email adres is niet in gebruik, return false
- return false;
- }
- else{
- //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
- return true;
- }
- }
- //Controleert of de gebruikersnaam al in de database voorkomt. Returnt true indien wel.
- static function checkUsedUsername($username){
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM users where username = :username");
- //Bind parameters
- $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
- //Voer de query uit
- $query->execute();
- //Check de hoeveelheid rijen die de database returnt.
- if($query->rowCount() == 0){
- //Username adres is niet in gebruik, return false
- return false;
- }
- else{
- //Username is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
- return true;
- }
- }
- //Registreert een gebruiker. Neemt als invoer email, wachtwoord, gebruikersnaam.
- static function registerUser($email, $password, $username){
- $ip = $_SERVER['REMOTE_ADDR'];
- //Initit db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("INSERT INTO users (username, email, password, reg_ip) VALUES (:username, :email, :password, :ip)");
- //Bind parameters
- $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- $query->bindParam(':ip', $ip, PDO::PARAM_STR, 256);
- //Voer query uit
- $query->execute();
- }
- //Check of gegeven login info in de database voorkomt
- static function isLoginValid($email, $password){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM users where email = :email AND password = :password");
- //Bind params
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- //login correct (komt voor in de db)
- return true;
- }
- else{
- //Incorrect
- return false;
- }
- }
- //Vraag gebruikers ID op doormiddel van email en pass
- static function getUID($email, $password){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT id FROM users where email = :email AND password = :password");
- //Bind params
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return -1;
- }
- }
- static function getUsername($uid){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT username FROM users where id = :uid");
- $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return "dbfetcherror";
- }
- }
- static function isSessionTokenInUse($token){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM usersessions where token = :token");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 0){
- return false;
- }
- else{
- return true;
- }
- }
- static function registerNewSession($uid, $token, $expires){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("INSERT INTO usersessions (uid, token, expires) VALUES (:uid, :token, :expires)");
- //Bind params
- $query->bindParam(':uid', $uid, PDO::PARAM_INT);
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->bindParam(':expires', $expires, PDO::PARAM_STR);
- //Voer query it
- $query->execute();
- }
- static function isSessionValid($token, $uid){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM usersessions where token = :token AND uid = :uid AND expires > NOW()");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- return true;
- }
- else{
- return false;
- }
- }
- static function invalidateSession($token){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE token = :token");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- }
- static function invalidateSessionByUID($uid){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE uid = :uid");
- //Bind params
- $query->bindParam(':token', $uid, PDO::PARAM_INT);
- //Voer query it
- $query->execute();
- }
- static function deleteExpiredSessions(){
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE expires < NOW()");
- $query->execute();
- }
- static function getSessionExpiryDate($token){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT expires FROM usersessions where token = :token");
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return "2000-01-01 00:00:00";
- }
- }
- static function createThread(){
-
- }
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/controller/HUtils.php b/dev_mvc/controller/HUtils.php
index e44ae28..8f295a3 100644
--- a/dev_mvc/controller/HUtils.php
+++ b/dev_mvc/controller/HUtils.php
@@ -1,4 +1,5 @@
\ No newline at end of file
diff --git a/dev_mvc/controller/MVCController.php b/dev_mvc/controller/MVCController.php
new file mode 100644
index 0000000..48e83fa
--- /dev/null
+++ b/dev_mvc/controller/MVCController.php
@@ -0,0 +1,111 @@
+view = ROOT_DIR."/view/webcontent/content_".$_GET['p'].".php";
+ $this->viewmodel = ROOT_DIR."/viewmodel/viewmodel_".$_GET['p'].".php";
+ }
+ else{
+ $this->view = ROOT_DIR."/view/webcontent/content_home.php";
+ $this->viewmodel = ROOT_DIR."/viewmodel/viewmodel_home.php";
+ }
+
+ //prepare current action model
+ if(isset($_POST['action'])){
+ $this->model = ROOT_DIR."/model/actions/model_".$_POST['action'].".php";
+ }
+ else if(isset($_GET['action'])){
+ $this->model = ROOT_DIR."/model/actions/model_".$_GET['action'].".php";
+ }
+ else{
+ $this->model = ROOT_DIR."/model/actions/model_empty.php";
+ }
+
+
+ if(isset($_POST['testaction'])){
+ $this->testaction = ROOT_DIR."/model/testactions/TA_".$_POST['testaction'].".php";
+ }
+
+
+ }
+ static function getMVCController():MVCController
+ {
+ return self::$mvcController;
+ }
+ function overrideView($view_target):void
+ {
+ $this->view = ROOT_DIR."/view/webcontent/content_".$view_target.".php";
+ $this->viewmodel = ROOT_DIR."/viewmodel/viewmodel_".$view_target.".php";
+ $this->viewOverridden = true;
+ }
+ function executeAction():void
+ {
+ //check if action model is valid
+ if(file_exists($this->model)){
+ //execute action model
+ include_once($this->model);
+ }
+ //model doesn't exist and will not be called
+ else{
+ //debug message
+ echo("caught call on non-existant model file.");
+ }
+
+
+ //TESTACTION LAYER
+
+
+ //check if testaction is valid
+ if(file_exists($this->testaction)){
+ //execute testaction
+ //require_once($this->testaction);
+ $testactionClassname = '\model\testactions\\'. "TA_".$_POST['testaction'];
+ $testactionInstance = new $testactionClassname();
+ }
+
+ }
+ function executeViewmodel():void
+ {
+ if(file_exists($this->viewmodel))
+ {
+ include_once($this->viewmodel);
+ }
+ }
+ function executeModel():void
+ {
+ $this->executeAction();
+ //check if the view was overridden by action.
+ if($this->viewOverridden){
+ //don't need to run the viewmodel twice if it was overridden by action
+ $this->viewOverridden = false;
+ }
+ //run viewmodel
+ $this->executeViewmodel();
+ //run viewmodel again if overridden by viewmodel
+ if($this->viewOverridden)
+ {
+ $this->executeViewmodel();
+ }
+ }
+ function loadView(){
+ if(file_exists($this->view)){
+ include_once($this->view);
+ }
+ else{
+ include_once(ROOT_DIR."/view/webcontent/content_404.php");
+ echo("view: ".$this->view." not found.");
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/dev_mvc/controller/UserSession.php b/dev_mvc/controller/UserSession.php
index 7b76eeb..854e05f 100644
--- a/dev_mvc/controller/UserSession.php
+++ b/dev_mvc/controller/UserSession.php
@@ -1,96 +1,127 @@
username = $username;
- $this->uid = $uid;
- $this->token = $token;
- $this->setExpiry();
- //echo($username." ");
- //echo($loginSessionToken);
- $_SESSION['usersession'] = $this;
- setcookie('usersession', $this->token);
- setcookie('uid', $this->uid);
- }
- public function setSessionToken($token){
- $this->token = $token;
- }
- public function getSessionToken(){
- return $this->token;
- }
- public function getFormattedExpiry(){
- return $this->expires->format('Y-m-d H:i:s');
- }
- public function setExpiry(){
- $this->expires = new DateTime();
- $this->expires->modify("+ 1 hour");
- }
- public static function generateToken(){
- $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $token = "";
- for ($i=0; $i < 32 ; $i++) {
- $token .= $chars[rand(0, strlen($chars) - 1)];
- }
- return $token;
- }
- public static function isSessionValid(){
- if(isset($_SESSION['usersession'])){
- if(!Database::isSessionValid($_SESSION['usersession']->token, $_SESSION['usersession']->uid)){
- include_once("./model/model_attempt_logout.php");
- return false;
- }
- if(!UserSession::isSessionExpired($_SESSION['usersession'])){
- //check if session also exists in database
- return true;
- }
- }
- else{
- if(isset($_COOKIE['usersession'])){
- $token = $_COOKIE['usersession'];
- $uid = $_COOKIE['uid'];
- if(Database::isSessionValid($token,$uid)){
- $username = Database::getUsername($uid);
- $session = new UserSession($username, $uid, $token);
- $session->expires = new DateTime(Database::getSessionExpiryDate($token));
- }
- else{
- return false;
- }
- if(!UserSession::isSessionExpired($session)){
- return true;
- }
- }
- return false;
- }
- }
- public static function getSession()
- {
- return $_SESSION['usersession'];
- }
- public static function isSessionExpired($session){
- //session is expired
- if(new DateTime() > $session->expires){
- return true;
- }
- //session is not expired
- else{
- return false;
- }
- }
- public static function isUserSignedIn(){
- if(UserSession::isSessionValid()){
- if(!UserSession::isSessionExpired(UserSession::getSession())){
- if(Database::isSessionValid(UserSession::getSession()->token, UserSession::getSession()->uid)){
- return true;
- }
- }
- else{
- return false;
- }
- }
- }
+ public $uid = -1;
+ public $token = "undefined";
+ public $expires;
+ public static $session;
+ public function __construct($uid, $token = "undefined"){
+ $this->uid = $uid;
+ $this->token = $token;
+ $this->setExpiry();
+ //echo($loginSessionToken);
+ $_SESSION['usersession'] = $this;
+ setcookie('usersession', $this->token);
+ setcookie('uid', $this->uid);
+ }
+ public function setSessionToken($token){
+ $this->token = $token;
+ }
+ public function getSessionToken(){
+ return $this->token;
+ }
+ public function getFormattedExpiry(){
+ return $this->expires->format('Y-m-d H:i:s');
+ }
+ public function setExpiry(){
+ $this->expires = new DateTime();
+ $this->expires->modify("+ 1 hour");
+ }
+ public static function generateToken(){
+ $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ $token = "";
+ for ($i=0; $i < 32 ; $i++) {
+ $token .= $chars[rand(0, strlen($chars) - 1)];
+ }
+ return $token;
+ }
+ public static function isSessionValid(){
+ if(isset($_SESSION['usersession'])){
+ if(!Database::isSessionValid($_SESSION['usersession']->token, $_SESSION['usersession']->uid)){
+ return false;
+ }
+ if(!UserSession::isSessionExpired($_SESSION['usersession'])){
+ //check if session also exists in database
+ return true;
+ }
+ }
+ else{
+ if(isset($_COOKIE['usersession'])){
+ $token = $_COOKIE['usersession'];
+ $uid = $_COOKIE['uid'];
+ if(Database::isSessionValid($token,$uid)){
+ $session = new UserSession($uid, $token);
+ $session->expires = new DateTime(Database::getSessionExpiryDate($token));
+ }
+ else{
+ return false;
+ }
+ if(!UserSession::isSessionExpired($session)){
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ public static function getSession()
+ {
+ if(isset($_SESSION['usersession'])){
+ return $_SESSION['usersession'];
+ }
+ }
+ public static function isSessionExpired($session){
+ //session is expired
+ if(new DateTime() > $session->expires){
+ return true;
+ }
+ //session is not expired
+ else{
+ return false;
+ }
+ }
+ public static function isUserSignedIn(){
+ /*
+ if(UserSession::isSessionValid()){
+ if(!UserSession::isSessionExpired(UserSession::getSession())){
+ if(Database::isSessionValid(UserSession::getSession()->token, UserSession::getSession()->uid)){
+ return true;
+ }
+
+ }
+ else{
+ return false;
+ }
+ }
+ else{
+ return false;
+ }
+ */
+ //session exists, no need to do anything
+ if(isset($_SESSION['usersession'])){
+ return true;
+ }
+ else{
+ if(isset($_COOKIE['usersession'])){
+ //check if the session exists in the database
+ if(Database::isSessionTokenInUse($_COOKIE['usersession'])){
+ //check if database expiration datetime is still valid
+ $expirationDateTime = Database::getSessionExpiryDate($_COOKIE['usersession']);
+ if(new DateTime($expirationDateTime) >= new DateTime()){
+ //user is signed in. Restore session
+ $userSession = new UserSession($_COOKIE['uid'], $_COOKIE['usersession']);
+ return true;
+ }
+ else{
+ //remove session from the database
+ Database::invalidateSession($_COOKIE['usersession']);
+ }
+ }
+ }
+ }
+ //session either doesn't exist, doesn't exist in cookie, doesn't exist in database, or is expired in the database.
+ return false;
+ }
}
?>
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBBoard.php b/dev_mvc/controller/db/DBBoard.php
new file mode 100644
index 0000000..3f014ed
--- /dev/null
+++ b/dev_mvc/controller/db/DBBoard.php
@@ -0,0 +1,33 @@
+prepare("SELECT * FROM board");
+ $query->execute();
+ $boardArray = [];
+ while($result = $query->fetch(PDO::FETCH_BOTH)){
+ $board = new Board($result['ID'], $result['name'], $result['description'], $result['permLevel']);
+ array_push($boardArray, $board);
+ }
+ return $boardArray;
+ }
+ static function registerBoard(Board $board)
+ {
+ $con = self::connectToDB();
+
+ $name = $board->getName();
+ $description = $board->getDescription();
+ $permLevel = $board->getPermLevel();
+
+ $query = $con->prepare("INSERT INTO board (name, description, permLevel) VALUES (:name, :description, :permLevel)");
+ $query->bindParam(":name", $name);
+ $query->bindParam(":description", $description);
+ $query->bindParam(":permLevel", $permLevel);
+ $query->execute();
+ }
+
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBReply.php b/dev_mvc/controller/db/DBReply.php
new file mode 100644
index 0000000..fe9a459
--- /dev/null
+++ b/dev_mvc/controller/db/DBReply.php
@@ -0,0 +1,53 @@
+prepare("INSERT INTO reply (thread_ID, users_ID, content) VALUES (:tid, :uid, :content);");
+ $query->bindParam(":uid", $uid);
+ $query->bindParam(":tid", $threadID);
+ $query->bindParam(":content", $content);
+ echo "$uid, $threadID, $content";
+ $query->execute();
+ }
+ static function getAllReplies():array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply");
+ $query->bindParam(":id", $id);
+ $query->execute();
+ $replyArray = [];
+ while ($result = $query->fetch(PDO::FETCH_BOTH)) {
+ $reply = new Reply($result['ID'], $result['thread_ID'], $result['users_ID'], $result['content'], $result['date_created']);
+ array_push($replyArray, $reply);
+ }
+ return $replyArray;
+ }
+ static function getReplyByID($id):array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply WHERE id = :id");
+ $query->bindParam(":id", $id);
+ $query->execute();
+ return $query->fetch(PDO::FETCH_BOTH);
+
+ }
+ static function getRepliesByThreadID($tid):array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply WHERE thread_ID = :tid");
+ $query->bindParam(":tid", $tid);
+ $query->execute();
+ return $query->fetchAll(PDO::FETCH_BOTH);
+ }
+ static function getLastReplyByThreadID():array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply WHERE thread_ID = :tid ORDER BY date_created DESC LIMIT 1");
+ $query->bindParam(":tid", $tid);
+ $query->execute();
+ return $query->fetch(PDO::FETCH_BOTH);
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBTables.php b/dev_mvc/controller/db/DBTables.php
new file mode 100644
index 0000000..9ba7206
--- /dev/null
+++ b/dev_mvc/controller/db/DBTables.php
@@ -0,0 +1,94 @@
+query(
+ " CREATE TABLE `users` (
+ `ID` int(11) NOT NULL AUTO_INCREMENT,
+ `username` varchar(256) NOT NULL,
+ `email` varchar(256) NOT NULL,
+ `password` varchar(256) NOT NULL,
+ `reg_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `login_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `reg_ip` varchar(256) NOT NULL DEFAULT '127.0.0.1',
+ `permissions` int(11) NOT NULL DEFAULT '-1',
+ `active` tinyint(1) DEFAULT '0',
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ }
+ }
+ static function createEmailActivationKeyTable($con){
+ $table = 'email_activation_keys';
+ if(!self::checkTableExists($table, $con)){
+ $query = $con->query(
+ " CREATE TABLE `email_activation_keys` (
+ `id` int(16) NOT NULL AUTO_INCREMENT,
+ `users_id` int(16) NOT NULL,
+ `activationkey` varchar(256) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ }
+ }
+ static function createBoardTable($con){
+ $table = 'board';
+ if(!self::checkTableExists($table, $con)){
+ $query = $con->query(
+ " CREATE TABLE `board` (
+ `ID` int(16) NOT NULL AUTO_INCREMENT,
+ `name` varchar(256) NOT NULL,
+ `description` text NOT NULL,
+ `permLevel` int(16) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ }
+ }
+ static function createThreadTable($con){
+ $table = 'thread';
+ if(!self::checkTableExists($table, $con)){
+ $query = $con->query(
+ " CREATE TABLE `thread` (
+ `ID` int(16) NOT NULL AUTO_INCREMENT,
+ `users_ID` int(16) NOT NULL,
+ `board_ID` int(16) NOT NULL,
+ `title` varchar(256) NOT NULL,
+ `text` text NOT NULL,
+ `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ }
+ }
+ static function createReplyTable($con){
+ $table = 'reply';
+ if(!self::checkTableExists($table, $con)){
+ $query = $con->query(
+ " CREATE TABLE `reply` (
+ `ID` int(16) NOT NULL AUTO_INCREMENT,
+ `thread_ID` int(16) NOT NULL,
+ `users_ID` int(16) NOT NULL,
+ `content` text NOT NULL,
+ `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ }
+ }
+ static function checkTableExists($table, $con){
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ //table doesn't exist
+ if($query->fetchColumn() != 1){
+ return false;
+ }else{
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBThread.php b/dev_mvc/controller/db/DBThread.php
new file mode 100644
index 0000000..45aa9ef
--- /dev/null
+++ b/dev_mvc/controller/db/DBThread.php
@@ -0,0 +1,56 @@
+prepare("SELECT * FROM thread WHERE ID = :id");
+ $query->bindParam(":id", $id);
+ $query->execute();
+ $result = $query->fetch(PDO::FETCH_BOTH);
+ return new Thread($result['ID'], $result['users_ID'], $result['board_ID'], $result['title'], $result['text'], $result['date_created']);
+ }
+ static function getAllThreads(){
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM thread");
+ $query->execute();
+ $threadArray = [];
+ while($result = $query->fetch(PDO::FETCH_BOTH)){
+ $thread = new Thread($result['ID'], $result['users_ID'], $result['board_ID'], $result['title'], $result['text'], $result['date_created']);
+ array_push($threadArray, $thread);
+ }
+ return $threadArray;
+ }
+ static function getThreadsByBoard($boardID){
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM thread WHERE board_ID = :boardID");
+ $query->bindParam(":boardID", $boardID);
+ $query->execute();
+ $threadArray = [];
+ while($result = $query->fetch(PDO::FETCH_BOTH)){
+ $thread = new Thread($result['ID'], $result['users_ID'], $result['board_ID'], $result['title'], $result['text'], $result['date_created']);
+ array_push($threadArray, $thread);
+ }
+ return $threadArray;
+ }
+ static function createThread($threadObject){
+ $con = self::connectToDB();
+ $query = $con->prepare( "INSERT INTO thread" .
+ "(users_ID, board_ID, title, text)" .
+ "VALUES (:uid, :bid, :title, :content);");
+
+ $uid = $threadObject->getUserID();
+ $bid = $threadObject->getBoardID();
+ $title = $threadObject->getTitle();
+ $content = $threadObject->getContent();
+
+ $query->bindParam(":uid", $uid);
+ $query->bindParam(":bid", $bid);
+ $query->bindParam(":title", $title);
+ $query->bindParam(":content", $content);
+ $query->execute();
+ }
+
+}
+
diff --git a/dev_mvc/controller/db/DBUser.php b/dev_mvc/controller/db/DBUser.php
new file mode 100644
index 0000000..6b36bf9
--- /dev/null
+++ b/dev_mvc/controller/db/DBUser.php
@@ -0,0 +1,168 @@
+prepare("SELECT * FROM users WHERE ID = :uid");
+ $query->bindParam(":uid", $uid);
+ $query->execute();
+ $result = $query->fetch(PDO::FETCH_BOTH);
+ $user = new User($result['ID'], $result['username'], $result['email'], $result['password'], $result['reg_date'], $result['login_date'], $result['reg_ip'], $result['permissions'], $result['active']);
+ return $user;
+ }
+
+ /**
+ * @return array
+ */
+ static function getAllUsers():array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM users");
+ $query->bindParam(":uid", $uid);
+ $query->execute();
+ $query->rowCount();
+ $userArray = [];
+ while ($result = $query->fetch(PDO::FETCH_BOTH)) {
+ $user = new User($result['ID'], $result['username'], $result['email'], $result['password'], $result['reg_date'], $result['login_date'], $result['reg_ip'], $result['permissions'], $result['active']);
+ array_push($userArray, $user);
+ }
+ return $userArray;
+ }
+ static function getUserByEmail($email){
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM users WHERE email = :email");
+ $query->bindParam(":email", $email);
+ $query->execute();
+ $result = $query->fetch(PDO::FETCH_BOTH);
+ $user = new User($result['ID'], $result['username'], $result['email'], $result['password'], $result['reg_date'], $result['login_date'], $result['reg_ip'], $result['permissions'], $result['active']);
+ if($query->rowCount() == 1){
+ //Email adres is niet in gebruik, return false
+ return $user;
+ }
+ else if($query->rowCount() == 0){
+ trigger_error("Email $email not found in DB", E_USER_ERROR);
+ }
+ else{
+ //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
+ trigger_error("Multiple users for email $email returned by DB, value should be unique", E_USER_ERROR);
+ }
+
+ }
+
+
+ //Controleert of het email adres al in de database voorkomt. Returnt true indien wel.
+ static function checkUsedEmail($email){
+ //Verbind met de database
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM users where email = :email");
+ //Bind parameters
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ //Voer de query uit
+ $query->execute();
+ //Check de hoeveelheid rijen die de database returnt.
+ if($query->rowCount() == 0){
+ //Email adres is niet in gebruik, return false
+ return false;
+ }
+ else{
+ //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
+ return true;
+ }
+ }
+ //Controleert of de gebruikersnaam al in de database voorkomt. Returnt true indien wel.
+ static function checkUsedUsername($username){
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM users where username = :username");
+ //Bind parameters
+ $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
+ //Voer de query uit
+ $query->execute();
+ //Check de hoeveelheid rijen die de database returnt.
+ if($query->rowCount() == 0){
+ //Username adres is niet in gebruik, return false
+ return false;
+ }
+ else{
+ //Username is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
+ return true;
+ }
+ }
+ //Registreert een gebruiker. Neemt als invoer email, wachtwoord, gebruikersnaam. en email activation key. Nog niet volledig geimplementeerd
+ static function registerUser($email, $password, $username){
+ $ip = $_SERVER['REMOTE_ADDR'];
+ //Initit db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("INSERT INTO users (username, email, password, reg_ip) VALUES (:username, :email, :password, :ip)");
+ //Bind parameters
+ $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
+ $query->bindParam(':ip', $ip, PDO::PARAM_STR, 256);
+ //Voer query uit
+ $query->execute();
+ }
+ //Check of gegeven login info in de database voorkomt
+ static function isLoginValid($email, $password){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM users where email = :email AND password = :password");
+ //Bind params
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 1){
+ //login correct (komt voor in de db)
+ return true;
+ }
+ else{
+ //Incorrect
+ return false;
+ }
+ }
+ //Vraag gebruikers ID op doormiddel van email en pass
+ static function getUID($email, $password){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT id FROM users where email = :email AND password = :password");
+ //Bind params
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ return $result;
+ }
+ else{
+ //something went wrong, return -1
+ return -1;
+ }
+ }
+ static function getUsername($uid){
+ $con = Database::connectToDB();
+ $query = $con->prepare("SELECT username FROM users where id = :uid");
+ $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
+ $query->execute();
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ return $result;
+ }
+ else{
+ //something went wrong, return -1
+ return "db_user_invalid";
+ }
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/Database.php b/dev_mvc/controller/db/Database.php
new file mode 100644
index 0000000..d453b25
--- /dev/null
+++ b/dev_mvc/controller/db/Database.php
@@ -0,0 +1,226 @@
+query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = $dbName");
+ $result = (bool) $query;
+ if($result == 1){
+ echo('db exists');
+ }
+ else{
+ $query = $con->query("CREATE DATABASE $dbName");
+ DBTables::createAllTables();
+ }
+ }
+ /***
+ * ______ __ __ _____ _ _____ _______ _______ __ _______ _____ ____ _ _
+ * | ____| \/ | /\ |_ _| | /\ / ____|__ __|_ _\ \ / /\|__ __|_ _/ __ \| \ | |
+ * | |__ | \ / | / \ | | | | / \ | | | | | | \ \ / / \ | | | || | | | \| |
+ * | __| | |\/| | / /\ \ | | | | / /\ \| | | | | | \ \/ / /\ \ | | | || | | | . ` |
+ * | |____| | | |/ ____ \ _| |_| |____ / ____ \ |____ | | _| |_ \ / ____ \| | _| || |__| | |\ |
+ * |______|_| |_/_/ \_\_____|______| /_/ \_\_____| |_| |_____| \/_/ \_\_| |_____\____/|_| \_|
+ *
+ *
+ ***/
+
+ //Kijk of de user activation key al bestaat in de databse.
+ static function doesUserActivationKeyExist($activationKey){
+ $con = Database::connectToDB();
+ $query = $con->prepare("SELECT * FROM email_activation_keys WHERE activationkey = :activationKey");
+ $query->bindParam(':activationKey', $activationKey, PDO::PARAM_STR, 256);
+ $query->execute();
+ if($query->rowCount() == 0){
+ //bestaat nog niet
+ return false;
+ }
+ else{
+ //bestaat al
+ return true;
+ }
+ }
+ static function registerActivationKey($users_id, $activationKey){
+ $con = Database::connectToDB();
+ $query = $con->prepare("INSERT INTO email_activation_keys (users_id, activationkey) VALUES (:users_id, :activationkey)");
+ $query->bindParam(':users_id', $users_id);
+ $query->bindParam(':activationkey', $activationKey);
+ $query->execute();
+ }
+
+
+
+ //Activeer gebruiker en verwijder activation key uit de activation key tabel
+ static function activateUser($activationKey){
+ $con = Database::connectToDb();
+ $query = $con->prepare("SELECT users_id FROM email_activation_keys WHERE activationKey = :activationKey");
+ $query->bindParam('activationKey', $activationKey);
+ $query->execute();
+ $result = -1;
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ }
+ else{
+ //activation key komt niet voor in de db, return -1
+ return -1;
+ }
+ $id = $result;
+ $query = null;
+ $query = $con->prepare("UPDATE users SET active = 1 WHERE id = :id and active = 0");
+ $query->bindParam(':id',$id,PDO::PARAM_INT);
+ $query->execute();
+ }
+
+ /***
+ * _____ ______ _____ _____ _____ ____ _ _ _______ ____ _ ________ _ _ _____
+ * / ____| ____|/ ____/ ____|_ _/ __ \| \ | | |__ __/ __ \| |/ / ____| \ | |/ ____|
+ * | (___ | |__ | (___| (___ | || | | | \| | | | | | | | ' /| |__ | \| | (___
+ * \___ \| __| \___ \\___ \ | || | | | . ` | | | | | | | < | __| | . ` |\___ \
+ * ____) | |____ ____) |___) |_| || |__| | |\ | | | | |__| | . \| |____| |\ |____) |
+ * |_____/|______|_____/_____/|_____\____/|_| \_| |_| \____/|_|\_\______|_| \_|_____/
+ *
+ ***/
+
+
+ static function isSessionTokenInUse($token){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM usersessions where token = :token");
+ //Bind params
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 0){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ static function registerNewSession($uid, $token, $expires){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("INSERT INTO usersessions (uid, token, expires) VALUES (:uid, :token, :expires)");
+ //Bind params
+ $query->bindParam(':uid', $uid, PDO::PARAM_INT);
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ $query->bindParam(':expires', $expires, PDO::PARAM_STR);
+ //Voer query it
+ $query->execute();
+ }
+ static function isSessionValid($token, $uid){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM usersessions where token = :token AND uid = :uid AND expires > NOW()");
+ //Bind params
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 1){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+ static function invalidateSession($token){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("DELETE FROM usersessions WHERE token = :token");
+ //Bind params
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ }
+ static function invalidateSessionByUID($uid){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("DELETE FROM usersessions WHERE uid = :uid");
+ //Bind params
+ $query->bindParam(':token', $uid, PDO::PARAM_INT);
+ //Voer query it
+ $query->execute();
+ }
+ static function deleteExpiredSessions(){
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("DELETE FROM usersessions WHERE expires < NOW()");
+ $query->execute();
+ }
+ static function getSessionExpiryDate($token){
+ $con = Database::connectToDB();
+ $query = $con->prepare("SELECT expires FROM usersessions where token = :token");
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ $query->execute();
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ return $result;
+ }
+ else{
+ //something went wrong, return an invalid date.
+ return "2000-01-01 00:00:00";
+ }
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/index.php b/dev_mvc/index.php
index f439505..b8e36c0 100644
--- a/dev_mvc/index.php
+++ b/dev_mvc/index.php
@@ -1,27 +1,59 @@
connect('sc-redis','6379');
+$redis->auth("password");
+$redis->set('DB_CREATED', false);
+echo $redis->get('DB_CREATED');
+if(!$redis->get('DB_CREATED') || $redis->get('DB_CREATED') == ''){
+ Database::createDBIfNotPresent();
+ $redis->set('DB_CREATED', true);
+}
+
+
+//date_default_timezone_set('Europe/Amsterdam');
+
+$mvcController = new MVCController();
+$mvcController->executeModel();
+if(!isset($_POST['testaction'])){
+ include_once(ROOT_DIR."/view/content_pagetemplate.php");
+}
+//require_once('aaaadea');
+//http_response_code(200);
+TestAction::returnLogAsText();
?>
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_create_reply.php b/dev_mvc/model/actions/model_create_reply.php
new file mode 100644
index 0000000..70561d0
--- /dev/null
+++ b/dev_mvc/model/actions/model_create_reply.php
@@ -0,0 +1,15 @@
+uid;
+if(HUtils::issetPost(['thread', 'content']));
+{
+ $reply = new Reply(-1, $_POST['thread'], $uid, $_POST['content']);
+ print_r($reply);
+ DBReply::createReply($reply->getUserid(), $reply->getThreadID(), $reply->getContent());
+}
+?>
diff --git a/dev_mvc/model/actions/model_create_thread.php b/dev_mvc/model/actions/model_create_thread.php
new file mode 100644
index 0000000..485b994
--- /dev/null
+++ b/dev_mvc/model/actions/model_create_thread.php
@@ -0,0 +1,14 @@
+uid;
+if(HUtils::issetPost(['title', 'content', 'board']));
+{
+ $thread = new Thread(-1, $uid, $_POST['board'], $_POST['title'], $_POST['content']);
+ DBThread::createThread($thread);
+}
+?>
diff --git a/dev_mvc/model/actions/model_do_register.php b/dev_mvc/model/actions/model_do_register.php
new file mode 100644
index 0000000..a8bf1b8
--- /dev/null
+++ b/dev_mvc/model/actions/model_do_register.php
@@ -0,0 +1,39 @@
+getId(),$verificationKey);
+ $message = 'Please follow the link to verify your account: http://localhost/webforum_redux/hforumphp/dev_mvc/index.php?p=verify&key='.$verificationKey;
+ $headers = 'From: webmaster@example.com' . "\r\n" .
+ 'Reply-To: webmaster@example.com' . "\r\n" .
+ 'X-Mailer: PHP/' . phpversion();
+ mail($email, "Account Verification", $message, $headers);
+ }
+ }
+ else{
+ echo("REGISTRATION FAILED: PASSWORD VERIFICATION MISSMATCH");
+ }
+}
+else{
+ echo "POST UNSUCCESFUL: POST DATA INCOMPLETE OR NOT FOUND";
+}
+?>
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_empty.php b/dev_mvc/model/actions/model_empty.php
new file mode 100644
index 0000000..6ea33cc
--- /dev/null
+++ b/dev_mvc/model/actions/model_empty.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_login.php b/dev_mvc/model/actions/model_login.php
new file mode 100644
index 0000000..3128862
--- /dev/null
+++ b/dev_mvc/model/actions/model_login.php
@@ -0,0 +1,62 @@
+getActive()){
+ //obtain username
+ //$username = DBUser::getUsername($uid);
+ //gen unique session token
+ $token = UserSession::generateToken();
+ //regen if already in use
+ while(Database::isSessionTokenInUse($token)){
+ $token = UserSession::generateToken();
+ }
+ $a = new UserSession($uid, $token);
+ if($debuginfo){
+ echo $a->getSessionToken();
+ echo " ";
+ echo $a->uid;
+ echo " ";
+ echo $a->username;
+ }
+ //clean up expired sessions from ANY users
+ Database::deleteExpiredSessions();
+ Database::registerNewSession($a->uid, $a->token, $a->getFormattedExpiry());
+ //logged in, time to continue with other stuff
+ }
+ else{
+ MVCController::getMVCController()->overrideView("account_inactive");
+ $skipoverride = true;
+ echo('ree');
+ }
+ }
+ else{
+ echo "uid returned -1 from db interface";
+ }
+ }
+ else{
+ echo("login invalid");
+ }
+ }
+}
+else{
+ //we're done, don't even need to log in, session already active
+}
+
+if(!UserSession::isUserSignedIn() &&!$skipoverride){
+ MVCController::getMVCController()->overrideView("error_login");
+}
+
+?>
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_signout.php b/dev_mvc/model/actions/model_signout.php
new file mode 100644
index 0000000..2313cef
--- /dev/null
+++ b/dev_mvc/model/actions/model_signout.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/dev_mvc/model/forum/Board.php b/dev_mvc/model/forum/Board.php
new file mode 100644
index 0000000..5cbf2aa
--- /dev/null
+++ b/dev_mvc/model/forum/Board.php
@@ -0,0 +1,40 @@
+id = $id;
+ $this->name = $name;
+ $this->description = $description;
+ $this->permLevel = $permLevel;
+ }
+ function setId($id){
+ $this->id = $id;
+ }
+ function setName($name){
+ $this->name = $name;
+ }
+ function setDescription($description){
+ $this->description = $description;
+ }
+ function setPermLevel($permLevel){
+ $this->permLevel = $permLevel;
+ }
+ function getId(){
+ return $this->id;
+ }
+ function getName(){
+ return $this->name;
+ }
+ function getDescription(){
+ return $this->description;
+ }
+ function getPermLevel(){
+ return $this->permLevel;
+ }
+
+}
+
diff --git a/dev_mvc/model/forum/Email.php b/dev_mvc/model/forum/Email.php
new file mode 100644
index 0000000..6e1b8c1
--- /dev/null
+++ b/dev_mvc/model/forum/Email.php
@@ -0,0 +1,28 @@
+email = $sanitized_email;
+ $this->valid = true;
+ }
+ else{
+ $this->email = 'invalid';
+ $this->valid = false;
+ }
+ }
+ public function getEmail(){
+ return $this->email;
+ }
+ public function getValid(){
+ return $this->valid;
+ }
+ public function __toString(): string
+ {
+ return $this->email;
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/model/forum/Reply.php b/dev_mvc/model/forum/Reply.php
new file mode 100644
index 0000000..dbf5154
--- /dev/null
+++ b/dev_mvc/model/forum/Reply.php
@@ -0,0 +1,104 @@
+id = $id;
+ $this->threadID = $threadID;
+ $this->userID = $userID;
+ $this->content = $content;
+ $dateTime = new DateTime($date);
+ $this->date = $dateTime;
+ }
+ /**
+ * @return mixed
+ */
+ public function getOwner():User {
+ return $this->owner;
+ }
+
+ /**
+ * @param mixed $owner
+ */
+ public function setOwner($owner) {
+ $this->owner = $owner;
+ }
+ /**
+ * @return mixed
+ */
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getThreadID() {
+ return $this->threadID;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getUserID() {
+ return $this->userID;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getContent() {
+ return $this->content;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDate() {
+ return $this->date;
+ }
+
+ /**
+ * @param mixed $id
+ */
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ /**
+ * @param mixed $threadID
+ */
+ public function setThreadID($threadID) {
+ $this->threadID = $threadID;
+ }
+
+ /**
+ * @param mixed $userID
+ */
+ public function setUserID($userID) {
+ $this->userID = $userID;
+ }
+
+ /**
+ * @param mixed $content
+ */
+ public function setContent($content) {
+ $this->content = $content;
+ }
+
+ /**
+ * @param mixed $date
+ */
+ public function setDate($date) {
+ $this->date = $date;
+ }
+
+}
+
diff --git a/dev_mvc/model/forum/Thread.php b/dev_mvc/model/forum/Thread.php
new file mode 100644
index 0000000..9571de3
--- /dev/null
+++ b/dev_mvc/model/forum/Thread.php
@@ -0,0 +1,145 @@
+id = $id;
+ $this->title = $title;
+ $this->boardID = $boardID;
+ $this->userID = $userID;
+ $this->content = $content;
+
+ $dateTime = new DateTime($date_created);
+ $this->date_created = $dateTime;
+
+ /*
+ if(isset($threadData)){
+ $this->id = $threadData['id'];
+ $this->title = $threadData['title'];
+ $this->boardID = $threadData['boardID'];
+ $this->userID = $threadData['userID'];
+ $this->content = $threadData['content'];
+ }
+ */
+ }
+ /**
+ * @return multitype:
+ */
+ public function getReplies() {
+ return $this->replies;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getOwner():User {
+ return $this->owner;
+ }
+
+ /**
+ * @param multitype: $replies
+ */
+ public function setReplies($replies) {
+ $this->replies = $replies;
+ }
+
+ /**
+ * @param mixed $owner
+ */
+ public function setOwner($owner) {
+ $this->owner = $owner;
+ }
+
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * @return string $title
+ */
+ public function getTitle():string {
+ return $this->title;
+ }
+
+ /**
+ * @return int $boardID
+ */
+ public function getBoardID() {
+ return $this->boardID;
+ }
+
+ /**
+ * @return int $userID
+ */
+ public function getUserID() {
+ return $this->userID;
+ }
+
+ /**
+ * @return string $content
+ */
+ public function getContent():string {
+ return $this->content;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ /**
+ * @param string $title
+ */
+ public function setTitle($title) {
+ $this->title = $title;
+ }
+
+ /**
+ * @param string $boardID
+ */
+ public function setBoardID($boardID) {
+ $this->boardID = $boardID;
+ }
+
+ /**
+ * @param string $userID
+ */
+ public function setUserID($userID) {
+ $this->userID = $userID;
+ }
+
+ /**
+ * @param string $content
+ */
+ public function setContent($content) {
+ $this->content = $content;
+ }
+ /**
+ * @return DateTime
+ */
+ public function getDate_created() {
+ return $this->date_created;
+ }
+
+ /**
+ * @param DateTime $date_created
+ */
+ public function setDate_created($date_created) {
+ $this->date_created = $date_created;
+ }
+
+}
+
diff --git a/dev_mvc/model/forum/User.php b/dev_mvc/model/forum/User.php
new file mode 100644
index 0000000..cb74281
--- /dev/null
+++ b/dev_mvc/model/forum/User.php
@@ -0,0 +1,153 @@
+id = $id;
+ $this->username = $username;
+ $this->email = $email;
+ $this->password = $password;
+ $this->reg_date = $reg_date;
+ $this->login_date = $login_date;
+ $this->reg_ip=$reg_ip;
+ $this->permissions=$permissions;
+ $this->active = $active;
+ }
+ /**
+ * @return mixed
+ */
+ public function getId():int {
+ return $this->id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getUsername():string {
+ return $this->username;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getEmail():string {
+ return $this->email;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPassword():string {
+ return $this->password;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getReg_date() {
+ return $this->reg_date;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLogin_date() {
+ return $this->login_date;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getReg_ip() {
+ return $this->reg_ip;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPermissions() {
+ return $this->permissions;
+ }
+
+ /**
+ * @param mixed
+ */
+ public function getActive() {
+ return $this->active;
+ }
+
+ /**
+ * @param mixed $id
+ */
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ /**
+ * @param mixed $username
+ */
+ public function setUsername($username) {
+ $this->username = $username;
+ }
+
+ /**
+ * @param mixed $email
+ */
+ public function setEmail($email) {
+ $this->email = $email;
+ }
+
+ /**
+ * @param mixed $password
+ */
+ public function setPassword($password) {
+ $this->password = $password;
+ }
+
+ /**
+ * @param mixed $reg_date
+ */
+ public function setReg_date($reg_date) {
+ $this->reg_date = $reg_date;
+ }
+
+ /**
+ * @param mixed $login_date
+ */
+ public function setLogin_date($login_date) {
+ $this->login_date = $login_date;
+ }
+
+ /**
+ * @param mixed $reg_ip
+ */
+ public function setReg_ip($reg_ip) {
+ $this->reg_ip = $reg_ip;
+ }
+
+ /**
+ * @param mixed $permissions
+ */
+ public function setPermissions($permissions) {
+ $this->permissions = $permissions;
+ }
+ /**
+ * @param mixed $active
+ */
+ public function setActive($active) {
+ $this->active = $active;
+ }
+
+
+
+
+}
+
diff --git a/dev_mvc/model/model_attempt_login.php b/dev_mvc/model/model_attempt_login.php
deleted file mode 100644
index 383faa1..0000000
--- a/dev_mvc/model/model_attempt_login.php
+++ /dev/null
@@ -1,46 +0,0 @@
-getSessionToken();
- echo " ";
- echo $a->uid;
- echo " ";
- echo $a->username;
- }
- //clean up expired sessions from ANY users
- Database::deleteExpiredSessions();
- Database::registerNewSession($a->uid, $a->token, $a->getFormattedExpiry());
- //logged in, time to continue with other stuff
- }
- else{
- echo "uid returned -1 from db interface";
- }
- }
- else{
- echo("login invalid");
- }
- }
-}
-else{
- //we're done, don't even need to log in, session already active
- //echo($_SESSION['usersession']->uid);
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/model/model_attempt_logout.php b/dev_mvc/model/model_attempt_logout.php
deleted file mode 100644
index 27dac87..0000000
--- a/dev_mvc/model/model_attempt_logout.php
+++ /dev/null
@@ -1,12 +0,0 @@
-token);
- session_destroy();
-}
-
-
-
-
-
-?>
\ No newline at end of file
diff --git a/dev_mvc/model/model_attempt_register.php b/dev_mvc/model/model_attempt_register.php
deleted file mode 100644
index dceb18a..0000000
--- a/dev_mvc/model/model_attempt_register.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/model/model_destroy.php b/dev_mvc/model/model_destroy.php
deleted file mode 100644
index ecf6762..0000000
--- a/dev_mvc/model/model_destroy.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/model/testactions/TA_CreateDB.php b/dev_mvc/model/testactions/TA_CreateDB.php
new file mode 100644
index 0000000..f9e10bb
--- /dev/null
+++ b/dev_mvc/model/testactions/TA_CreateDB.php
@@ -0,0 +1,186 @@
+query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$db'");
+ //db exists
+ if($query->fetchColumn() != 1){
+ $query = $con->query("CREATE DATABASE $db");
+ self::logMessage('db doesnt exist');
+ }
+ //db doesn't exist
+ else{
+ self::logMessage('db already exists, skipping');
+ }
+ //select db
+ $con->exec("USE $db");
+ //test if table exists
+
+ $table = 'users';
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ self::logMessage($query->fetchColumn());
+ //table doesn't exist
+ if($query->fetchColumn() != 4){
+ self::logMessage('table doesnt exist');
+ $query = $con->query(
+ " CREATE TABLE `users` (
+ `ID` int(11) NOT NULL AUTO_INCREMENT,
+ `username` varchar(256) NOT NULL,
+ `email` varchar(256) NOT NULL,
+ `password` varchar(256) NOT NULL,
+ `reg_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `login_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `reg_ip` varchar(256) NOT NULL DEFAULT '127.0.0.1',
+ `permissions` int(11) NOT NULL DEFAULT '-1',
+ `active` tinyint(1) DEFAULT '0',
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ self::logMessage("created table $table");
+ }
+ //table exists
+ else{
+ self::logMessage("table $table already exists, skipping");
+ }
+
+ $table = 'usersessions';
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ if($query->fetchColumn() != 4){
+ self::logMessage('table doesnt exist');
+ $query = $con->query(
+ " CREATE TABLE `usersessions` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `uid` int(11) NOT NULL,
+ `token` varchar(256) NOT NULL,
+ `expires` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ self::logMessage("created table $table");
+ }
+ //table exists
+ else{
+ self::logMessage("table $table already exists, skipping");
+ }
+
+ $table = 'email_activation_keys';
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ if($query->fetchColumn() != 4){
+ self::logMessage('table doesnt exist');
+ $query = $con->query(
+ " CREATE TABLE `email_activation_keys` (
+ `id` int(16) NOT NULL AUTO_INCREMENT,
+ `users_id` int(16) NOT NULL,
+ `activationkey` varchar(256) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ self::logMessage("created table $table");
+ }
+ //table exists
+ else{
+ self::logMessage("table $table already exists, skipping");
+ }
+
+ $table = 'board';
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ if($query->fetchColumn() != 4){
+ self::logMessage('table doesnt exist');
+ $query = $con->query(
+ " CREATE TABLE `board` (
+ `ID` int(16) NOT NULL AUTO_INCREMENT,
+ `name` varchar(256) NOT NULL,
+ `description` text NOT NULL,
+ `permLevel` int(16) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ self::logMessage("created table $table");
+ }
+ //table exists
+ else{
+ self::logMessage("table $table already exists, skipping");
+ }
+
+
+ $table = 'thread';
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ if($query->fetchColumn() != 4){
+ self::logMessage('table doesnt exist');
+ $query = $con->query(
+ " CREATE TABLE `thread` (
+ `ID` int(16) NOT NULL AUTO_INCREMENT,
+ `users_ID` int(16) NOT NULL,
+ `board_ID` int(16) NOT NULL,
+ `title` varchar(256) NOT NULL,
+ `text` text NOT NULL,
+ `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ self::logMessage("created table $table");
+ }
+ //table exists
+ else{
+ self::logMessage("table $table already exists, skipping");
+ }
+
+ $table = 'reply';
+ $query = $con->query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table'");
+ if($query->fetchColumn() != 4){
+ self::logMessage('table doesnt exist');
+ $query = $con->query(
+ " CREATE TABLE `reply` (
+ `ID` int(16) NOT NULL AUTO_INCREMENT,
+ `thread_ID` int(16) NOT NULL,
+ `users_ID` int(16) NOT NULL,
+ `content` text NOT NULL,
+ `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1");
+ self::logMessage("created table $table");
+ }
+ //table exists
+ else{
+ self::logMessage("table $table already exists, skipping");
+ }
+
+
+
+ }
+ catch(PDOException $e){
+ self::logMessage('PDO ERROR', "FAILURE");
+ die("pdo exception, cannot connect to sql: $e");
+ }
+ }
+}
+
+
+
+
+
+
+
+ ?>
\ No newline at end of file
diff --git a/dev_mvc/model/testactions/TA_PopulateDB.php b/dev_mvc/model/testactions/TA_PopulateDB.php
new file mode 100644
index 0000000..23fafe7
--- /dev/null
+++ b/dev_mvc/model/testactions/TA_PopulateDB.php
@@ -0,0 +1,66 @@
+getId(), $username);
+ Database::activateUser($username);
+ }
+
+
+ function execute(){
+ try{
+ //connect to sql server
+ $con = Database::connectToDB();
+
+
+ self::logMessage('table doesnt exist', "OK");
+
+
+ $this->registerUser('andreas@andreas.nl','jenk', 'andreas');
+ $this->registerUser('bram@bram.nl','jenk', 'bram');
+
+
+ self::logMessage("created test users", "OK");
+
+ DBBoard::registerBoard(new Board(-1, 'General Discussion', 'Plek om algemene discussie te voeren.', 0));
+ DBBoard::registerBoard(new Board(-1, 'Off Topic', 'Voor alle irrelevante zooi.', 0));
+
+
+
+
+ self::logMessage("created test boards", "OK");
+
+
+ DBThread::createThread(new Thread(-1, 1, 1, 'Test Thread', 'Deze thread is een test.', '1337-04-20 13:37:00'));
+ DBThread::createThread(new Thread(-1, 1, 2, 'Frits', 'Frits niffo', '1337-04-20 13:37:00'));
+
+ self::logMessage("created test threads", "OK");
+
+ DBReply::createReply(1, 1, 'heehee eks dee');
+ DBReply::createReply(1, 1, 'sup');
+ DBReply::createReply(2, 2, 'fritselitsel');
+ DBReply::createReply(2, 1, 'heb je daar prebleem mee ofzo');
+
+ self::logMessage("created test replies", "OK");
+ }
+ catch(PDOException $e){
+ self::logMessage("created test replies", "FAILURE");
+ die("pdo exception, cannot connect to sql: $e");
+ //test change 7
+ }
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/model/testactions/TA_TestDBReply.php b/dev_mvc/model/testactions/TA_TestDBReply.php
new file mode 100644
index 0000000..e618844
--- /dev/null
+++ b/dev_mvc/model/testactions/TA_TestDBReply.php
@@ -0,0 +1,17 @@
+";
+ echo (json_encode($replies));
+ echo "";
+ }
+}
diff --git a/dev_mvc/model/testactions/TA_TestDBThread.php b/dev_mvc/model/testactions/TA_TestDBThread.php
new file mode 100644
index 0000000..75028bf
--- /dev/null
+++ b/dev_mvc/model/testactions/TA_TestDBThread.php
@@ -0,0 +1,15 @@
+";
+ echo (json_encode($threads));
+ echo "";
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/model/testactions/TA_TestDBUser.php b/dev_mvc/model/testactions/TA_TestDBUser.php
new file mode 100644
index 0000000..d2d1738
--- /dev/null
+++ b/dev_mvc/model/testactions/TA_TestDBUser.php
@@ -0,0 +1,17 @@
+";
+ echo (json_encode($users));
+ echo "";
+ }
+}
diff --git a/dev_mvc/model/testactions/TA_TestSQLConnection.php b/dev_mvc/model/testactions/TA_TestSQLConnection.php
new file mode 100644
index 0000000..40418ba
--- /dev/null
+++ b/dev_mvc/model/testactions/TA_TestSQLConnection.php
@@ -0,0 +1,39 @@
+testSQLConnection();
+ }
+ function testSQLConnection(){
+ $connectionStatus = false;
+ try{
+ //Defineer vars
+ if(getenv("SQL_CREDENTIALS") !== false){
+ $sql_server = getenv("SQL_SERVER");
+ $sql_username = getenv("SQL_USERNAME");
+ $sql_password = getenv("SQL_PASSWORD");
+ }
+ else{
+ //test
+ $sql_server = "localhost";
+ $sql_username = "root";
+ $sql_password = "kankerlow";
+ }
+ $dsn = "mysql:host=$sql_server";
+ //Maak verbinding
+ $con = new PDO($dsn, $sql_username, $sql_password);
+ $connectionStatus = true;
+ }
+ catch(PDOException $e){
+ echo("PDO Exception, can't connect to database.");
+ die($e);
+ $connectionStatus = false;
+ }
+ return $connectionStatus;
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/model/testactions/TestAction.php b/dev_mvc/model/testactions/TestAction.php
new file mode 100644
index 0000000..7d5574a
--- /dev/null
+++ b/dev_mvc/model/testactions/TestAction.php
@@ -0,0 +1,41 @@
+execute();
+ }else{
+ self::logMessage('you have no authorization to do that', 'FAILURE');
+ }
+ }else{
+ self::logMessage('you have no authorization to do that', 'FAILURE');
+ }
+ }
+ function execute(){
+ self::logMessage('Unoverridden execute called on TestAction: '.$this, 'FAILURE');
+ }
+ public static $log = [];
+ public static $status;
+ public static function logMessage($message, $status = "OK"){
+ $loginput = [];
+ $loginput['message'] = $message;
+ $loginput['status'] = $status;
+ array_push(self::$log, $loginput);
+ return;
+ }
+ public static function returnLogAsJson(){
+ echo(json_encode(self::$log));
+ return;
+ }
+ public static function returnLogAsText(){
+ for($i = 0; $iACTION FAILED');
+ return;
+ }
+ }
+ echo('ACTION SUCCESSFUL
');
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/view/content_pagetemplate.php b/dev_mvc/view/content_pagetemplate.php
new file mode 100644
index 0000000..07c0007
--- /dev/null
+++ b/dev_mvc/view/content_pagetemplate.php
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+loadView();
+?>
+
+
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/css/main.css b/dev_mvc/view/css/main.css
index 2973018..1bac85d 100644
--- a/dev_mvc/view/css/main.css
+++ b/dev_mvc/view/css/main.css
@@ -1,10 +1,123 @@
*{
- font-family: Arial, Helvetica, sans-serif;
+ font-family: Arial, Helvetica, sans-serif;
+}
+html, body{
+
+ width: 100%;
+ height: 100%;
+ padding: 0;
+ margin: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ background-color: #333333;
+}
+body{
+
+}
+
+loginForm{
+
+}
+.logo{
+ height: 100px;
+ width: 100px;
+ box-sizing: border-box;
+ border-radius: 10px;
+ justify-self: left;
+ font-size: 50pt;
+ padding: 10pt;
+ color: white;
+ margin-right: 10px;
+ /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#1e5799+0,45427a+100 */
+ background: #1e5799; /* Old browsers */
+ background: -moz-linear-gradient(-45deg, #1e5799 0%, #45427a 100%); /* FF3.6-15 */
+ background: -webkit-linear-gradient(-45deg, #1e5799 0%,#45427a 100%); /* Chrome10-25,Safari5.1-6 */
+ background: linear-gradient(135deg, #1e5799 0%,#45427a 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#45427a',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
+
+ -webkit-touch-callout: none; /* iOS Safari */
+ -webkit-user-select: none; /* Safari */
+ -khtml-user-select: none; /* Konqueror HTML */
+ -moz-user-select: none; /* Firefox */
+ -ms-user-select: none; /* Internet Explorer/Edge */
+ user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
+ box-shadow: 0px 0px 20px black;
+}
+.row{
+ display: flex;
+ flex-direction: row;
+ flex-basis: auto;
}
header{
- background-color: bisque;
+ margin-top: 10px;
+}
+nav{
+ border-radius: 10px;
+ display:flex;
+ flex-direction: flex-row;
+ flex-basis: auto;
+ flex-shrink: 0;
+ flex-grow: 0;
+ background-color: gray;
+ width: 80%;
+ height: 100px;
+ max-height: 100px;
+
+
+
+ align-items: center;
+ justify-items: center;
+ align-content: center;
+ justify-content: center;
+ align-self: center;
+ justify-self: center;
+ box-shadow: 0px 0px 20px black;
+}
+nav a{
+ padding-left: 10px;
+ padding-right: 10px;
+ text-decoration: none;
+ font-size: 20pt;
+ font-weight: bold;
+ color: white;
+}
+.main{
+ border-radius: 15px;
+ margin-top: 10px;
+ display: flex;
+ flex-direction: column;
+ flex-grow: 0;
+ flex-shrink: 1;
+ background-color: white;
+ padding: 15px;
+ margin-bottom: 20px;
+ box-shadow: 0px 0px 20px black;
+}
+input{
+ padding: 5px;
+ margin: 5px;
+}
+textarea{
+ padding: 5px;
+ margin: 5px;
+ resize: none;
+ width: 50vw;
+ height: 20vw;
+}
+table {
+ font-family: arial, sans-serif;
+ border-collapse: collapse;
+ width: 100%;
+ width: 80vw;
+}
+
+td, th {
+ border: 1px solid #dddddd;
+ text-align: left;
+ padding: 8px;
+}
+
+tr:nth-child(even) {
+ background-color: #dddddd;
}
-a{
- margin-right: 10px;
- text-decoration: none;
-}
\ No newline at end of file
diff --git a/dev_mvc/view/img/logo.png b/dev_mvc/view/img/logo.png
deleted file mode 100644
index 5837651..0000000
Binary files a/dev_mvc/view/img/logo.png and /dev/null differ
diff --git a/dev_mvc/view/pagecontent/content_404.php b/dev_mvc/view/pagecontent/content_404.php
deleted file mode 100644
index ceb7af1..0000000
--- a/dev_mvc/view/pagecontent/content_404.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- This page does not exist!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_attempt_login.php b/dev_mvc/view/pagecontent/content_attempt_login.php
deleted file mode 100644
index 0b12f34..0000000
--- a/dev_mvc/view/pagecontent/content_attempt_login.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_attempt_logout.php b/dev_mvc/view/pagecontent/content_attempt_logout.php
deleted file mode 100644
index 6a047ec..0000000
--- a/dev_mvc/view/pagecontent/content_attempt_logout.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- You've been succesfully logged out
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_attempt_register.php b/dev_mvc/view/pagecontent/content_attempt_register.php
deleted file mode 100644
index f8b887e..0000000
--- a/dev_mvc/view/pagecontent/content_attempt_register.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Successfully registered!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_createthread.php b/dev_mvc/view/pagecontent/content_createthread.php
deleted file mode 100644
index 176c8a7..0000000
--- a/dev_mvc/view/pagecontent/content_createthread.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_destroy.php b/dev_mvc/view/pagecontent/content_destroy.php
deleted file mode 100644
index dc3cd8b..0000000
--- a/dev_mvc/view/pagecontent/content_destroy.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- You're still signed in thanks to our cookies!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_header.php b/dev_mvc/view/pagecontent/content_header.php
deleted file mode 100644
index 184e0d0..0000000
--- a/dev_mvc/view/pagecontent/content_header.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_index.php b/dev_mvc/view/pagecontent/content_index.php
deleted file mode 100644
index 852160d..0000000
--- a/dev_mvc/view/pagecontent/content_index.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Welkom op hForumPHP. Log in of registreer om iets te doen.
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_login.php b/dev_mvc/view/pagecontent/content_login.php
deleted file mode 100644
index dd07475..0000000
--- a/dev_mvc/view/pagecontent/content_login.php
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_page.php b/dev_mvc/view/pagecontent/content_page.php
deleted file mode 100644
index 6482fbb..0000000
--- a/dev_mvc/view/pagecontent/content_page.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
- =HUtils::getSiteTitle();?>
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_register.php b/dev_mvc/view/pagecontent/content_register.php
deleted file mode 100644
index 6f23196..0000000
--- a/dev_mvc/view/pagecontent/content_register.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/header/content_header_signedin.php b/dev_mvc/view/pagecontent/header/content_header_signedin.php
deleted file mode 100644
index 0ba7d68..0000000
--- a/dev_mvc/view/pagecontent/header/content_header_signedin.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- log out home simulate $_SESSION expiry
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/header/content_header_signedout.php b/dev_mvc/view/pagecontent/header/content_header_signedout.php
deleted file mode 100644
index 02bda45..0000000
--- a/dev_mvc/view/pagecontent/header/content_header_signedout.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- log in register home
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/login/content_login_succesful.php b/dev_mvc/view/pagecontent/login/content_login_succesful.php
deleted file mode 100644
index f86a96c..0000000
--- a/dev_mvc/view/pagecontent/login/content_login_succesful.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Successfully logged in!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/login/content_login_unsuccesful.php b/dev_mvc/view/pagecontent/login/content_login_unsuccesful.php
deleted file mode 100644
index a9a1ae8..0000000
--- a/dev_mvc/view/pagecontent/login/content_login_unsuccesful.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- UNEXPECTED LOGIN ERROR. OUR CODEMONKEYS DID SOMETHING VERY WRONG :(
-
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_404.php b/dev_mvc/view/webcontent/content_404.php
new file mode 100644
index 0000000..11ec629
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_404.php
@@ -0,0 +1,6 @@
+
+
+404
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_account_inactive.php b/dev_mvc/view/webcontent/content_account_inactive.php
new file mode 100644
index 0000000..068797f
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_account_inactive.php
@@ -0,0 +1,5 @@
+
+
+ Your account appears to be inactive. Check your email for the verification mail.
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_boards.php b/dev_mvc/view/webcontent/content_boards.php
new file mode 100644
index 0000000..d17b295
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_boards.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_createreply.php b/dev_mvc/view/webcontent/content_createreply.php
new file mode 100644
index 0000000..738f5d7
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_createreply.php
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_createthread.php b/dev_mvc/view/webcontent/content_createthread.php
new file mode 100644
index 0000000..1fdaeb5
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_createthread.php
@@ -0,0 +1,7 @@
+
+
+
+
+ ">
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_error_login.php b/dev_mvc/view/webcontent/content_error_login.php
new file mode 100644
index 0000000..62d3c16
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_error_login.php
@@ -0,0 +1,4 @@
+Incorrect Email or Password.
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_header.php b/dev_mvc/view/webcontent/content_header.php
new file mode 100644
index 0000000..f1ea9f8
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_header.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_home.php b/dev_mvc/view/webcontent/content_home.php
new file mode 100644
index 0000000..a48a9b9
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_home.php
@@ -0,0 +1,3 @@
+
+ Please sign in to access our forum
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_register.php b/dev_mvc/view/webcontent/content_register.php
new file mode 100644
index 0000000..9411e07
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_register.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/app/pagecontent/content_createthread.php b/dev_mvc/view/webcontent/content_reply.php
similarity index 50%
rename from dev/app/pagecontent/content_createthread.php
rename to dev_mvc/view/webcontent/content_reply.php
index 176c8a7..b3d9bbc 100644
--- a/dev/app/pagecontent/content_createthread.php
+++ b/dev_mvc/view/webcontent/content_reply.php
@@ -1,6 +1 @@
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_showthread.php b/dev_mvc/view/webcontent/content_showthread.php
new file mode 100644
index 0000000..2056839
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_showthread.php
@@ -0,0 +1,46 @@
+getReplies();
+?>
+
+
+ =$thread->getTitle()?>
+
+
+ user
+ content
+ date
+
+
+
+ =$thread->getOwner()->getUsername();?>
+
+
+ =$thread->getContent()?>
+
+
+ =$thread->getDate_created()->format("Y M d H:i:s")?>
+
+
+getOwner()->getUsername();
+ $content = $reply->getContent();
+ $date_created = $reply->getDate()->format("Y M d H:i:s");
+ echo("");
+ echo("$owner ");
+ echo("$content ");
+ echo("$date_created ");
+ echo(" ");
+}
+?>
+
+getId();
+echo "Create Reply "
+?>
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_signin.php b/dev_mvc/view/webcontent/content_signin.php
new file mode 100644
index 0000000..48b427e
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_signin.php
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_signout.php b/dev_mvc/view/webcontent/content_signout.php
new file mode 100644
index 0000000..3b0d91d
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_signout.php
@@ -0,0 +1 @@
+Signed out succesfully!
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_verify.php b/dev_mvc/view/webcontent/content_verify.php
new file mode 100644
index 0000000..03097a9
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_verify.php
@@ -0,0 +1,2 @@
+
+ hF
+
+
+ Home
+ Sign out
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/header/header_signedout.php b/dev_mvc/view/webcontent/header/header_signedout.php
new file mode 100644
index 0000000..7c9c059
--- /dev/null
+++ b/dev_mvc/view/webcontent/header/header_signedout.php
@@ -0,0 +1,8 @@
+
+ hF
+
+
+ Home
+ Register
+ Sign in
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/modules/modules_boards/module_boardtable.php b/dev_mvc/view/webcontent/modules/modules_boards/module_boardtable.php
new file mode 100644
index 0000000..6c33854
--- /dev/null
+++ b/dev_mvc/view/webcontent/modules/modules_boards/module_boardtable.php
@@ -0,0 +1,52 @@
+
+ =$board->name?>
+ Create Thread
+
+
+ Thread
+ Started by
+ Last reply
+
+getBoardID() == $board->id){
+ $currentRow = [];
+ $currentRow['threadID'] = $thread->getID();
+ $currentRow['threadTitle'] = $thread->getTitle();
+ foreach(MVCController::$viewData['users'] as $user){
+ if($user->getID() == $thread->getUserID()){
+ $currentRow['username'] = $user->getUsername();
+ break;
+ }
+ }
+ foreach(MVCController::$viewData['replies'] as $reply){
+ if(isset($reply)){
+ if($reply->getThreadID() == $thread->getId())
+ {
+ break;
+ }else{
+ $currentRow['lastUpdated'] = $thread->getDate_created()->format("Y M d H:i:s");
+ }
+ }
+ }
+?>
+
+
+ =$currentRow['threadTitle']?>
+
+
+ =$currentRow['username'] ?>
+
+
+
+ =$currentRow['lastUpdated']?>
+
+
+
+
+
diff --git a/dev_mvc/viewmodel/viewmodel_boards.php b/dev_mvc/viewmodel/viewmodel_boards.php
new file mode 100644
index 0000000..c571193
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_boards.php
@@ -0,0 +1,33 @@
+getId()));
+}
+foreach($threads as $thread)
+{
+ array_push($users, DBUser::getUserByUID($thread->getUserID()));
+}
+
+
+
+
+//MVCController::$viewData['boards'] = [new Board(0, "General", 0),new Board(1, "Admin board", 10)];
+MVCController::$viewData['boards'] = $boards;
+MVCController::$viewData['threads'] = $threads;
+MVCController::$viewData['users'] = $users;
+MVCController::$viewData['replies'] = [new Reply(0, 0, 0, "op is gay","01-01-1990")];
+?>
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_createreply.php b/dev_mvc/viewmodel/viewmodel_createreply.php
new file mode 100644
index 0000000..2daf956
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_createreply.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_home.php b/dev_mvc/viewmodel/viewmodel_home.php
new file mode 100644
index 0000000..e0d2c05
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_home.php
@@ -0,0 +1,6 @@
+overrideView("boards");
+}
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_showthread.php b/dev_mvc/viewmodel/viewmodel_showthread.php
new file mode 100644
index 0000000..0b6c19f
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_showthread.php
@@ -0,0 +1,38 @@
+getUserID());
+ $reply->setOwner($replyOwner);
+}
+
+// get the person who started the thread
+$threadOwner = DBUser::getUserByUID($thread->getUserID());
+// assign owner and replies
+$thread->setReplies($replies);
+$thread->setOwner($threadOwner);
+
+// Store data so it can be used in the view
+MVCController::$viewData['thread'] = $thread;
diff --git a/dev_mvc/viewmodel/viewmodel_signout.php b/dev_mvc/viewmodel/viewmodel_signout.php
new file mode 100644
index 0000000..7bab5b6
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_signout.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_verify.php b/dev_mvc/viewmodel/viewmodel_verify.php
new file mode 100644
index 0000000..cbe5944
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_verify.php
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/globalvars.php b/globalvars.php
deleted file mode 100644
index 95f8a62..0000000
--- a/globalvars.php
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..c2cf9e1
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ tests
+
+
+
+
\ No newline at end of file
diff --git a/tests/unit/Test.php b/tests/unit/Test.php
new file mode 100644
index 0000000..99aafc6
--- /dev/null
+++ b/tests/unit/Test.php
@@ -0,0 +1,3 @@
+assertInstanceOf(
+ Email::class,
+ new Email('user@example.com')
+ );
+ }
+
+ public function testCannotBeCreatedFromInvalidEmailAddress(): void
+ {
+ $email = new Email('user');
+ $this->assertFalse($email->getValid());
+ $this->assertEquals($email->getEmail(), 'invalid');
+ }
+
+ public function testCanBeUsedAsString(): void
+ {
+ $this->assertEquals(
+ 'user@example.com',
+ new Email('user@example.com')
+ );
+ }
+}
\ No newline at end of file
diff --git a/tests/unit/TestUser.php b/tests/unit/TestUser.php
new file mode 100644
index 0000000..08ab5af
--- /dev/null
+++ b/tests/unit/TestUser.php
@@ -0,0 +1,16 @@
+assertInstanceOf(
+ User::class,
+ new User(1, 'andreas', 'andreas@example.com', 'password', '10-04-2019 12:00:00', '10-04-2019 12:00:00', '94.212.253.51', -1, 1)
+ );
+ }
+}
\ No newline at end of file