commit c62209a33045d12fe763d1a3b0c777b0f46f2681 Author: Jay Date: Fri Nov 12 16:23:48 2021 +0100 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..61ead866 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..0a00c4dc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "php-docblocker.author": { + "name": "Jay Trees", + "email": "github.jay@grandel.anonaddy.me" + }, +} diff --git a/README.md b/README.md new file mode 100644 index 00000000..46dd0eff --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# wishthis + +A simple wishlist plattform. + +This project is a work in progress and not ready for production use. + +## Requirements +* PHP 8 + +## Contributing +Install dependencies +``` +composer install +``` diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..5e302827 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..0fc6d623 --- /dev/null +++ b/composer.lock @@ -0,0 +1,145 @@ +{ + "_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": "7be6c4a10877152fb055dc27901cb0a6", + "packages": [], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.1", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2020-12-07T18:04:37+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.6.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2021-10-11T04:00:11+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.1.0" +} diff --git a/includes/assets/css/default.css b/includes/assets/css/default.css new file mode 100644 index 00000000..beac8137 --- /dev/null +++ b/includes/assets/css/default.css @@ -0,0 +1,52 @@ +:root { + --color-primary: blue; + + --radius-default: 4px; +} + +body { + margin: 0; + + font-family: sans-serif; + font-size: 14pt; + + background-color: #f4f4f4; +} + +h1 { + margin-top: 0; +} + +p { + font-size: inherit; +} + +form { + display: inline-block; +} + +/** + * Buttons + */ +button, +.button, +input[type="submit"], +input[type="button"] { + padding: 0.4em 1.6em; + + font-size: inherit; + + cursor: pointer; + border: none; + border-radius: var(--radius-default); +} + +.button.primary, +input[type="submit"] { + color: #fff; + background-color: var(--color-primary); +} + +a.button { + text-decoration: none; +} diff --git a/includes/assets/css/install.css b/includes/assets/css/install.css new file mode 100644 index 00000000..0bdda91b --- /dev/null +++ b/includes/assets/css/install.css @@ -0,0 +1,11 @@ +main { + display: flex; + justify-content: center; + align-items: center; + + height: 100vh; +} + +section { + max-width: 768px; +} diff --git a/includes/classes/page.php b/includes/classes/page.php new file mode 100644 index 00000000..46b21cdd --- /dev/null +++ b/includes/classes/page.php @@ -0,0 +1,67 @@ +name = pathinfo($filepath, PATHINFO_FILENAME); + } + + public function header(): void + { + ?> + + + + + + + + '; + + /** Page */ + $stylesheetPage = 'includes/assets/css/' . $this->name . '.css'; + + if (file_exists($stylesheetPage)) { + $stylesheetPageModified = filemtime($stylesheetPage); + + echo ''; + } + ?> + + <?= $this->title ?> + + + + + + + */ diff --git a/includes/config/config.php b/includes/config/config.php new file mode 100644 index 00000000..636f0fbb --- /dev/null +++ b/includes/config/config.php @@ -0,0 +1,7 @@ + + */ diff --git a/includes/functions/auto-include.php b/includes/functions/auto-include.php new file mode 100644 index 00000000..70fea62f --- /dev/null +++ b/includes/functions/auto-include.php @@ -0,0 +1,23 @@ + + */ + +function autoInclude(string $directoryToInclude) +{ + foreach (scandir($directoryToInclude) as $filename) { + $filepath = str_replace('\\', '/', $directoryToInclude . '/' . $filename); + $filepathThis = str_replace('\\', '/', __FILE__); + + if (is_file($filepath) && $filepathThis !== $filepath) { + require $filepath; + } + } +} diff --git a/includes/pages/home.php b/includes/pages/home.php new file mode 100644 index 00000000..8c6b7c39 --- /dev/null +++ b/includes/pages/home.php @@ -0,0 +1,19 @@ + + */ + +use wishthis\Page; + +$page = new page(__FILE__, 'Home'); +$page->header(); +?> + +

Hello

+ +footer(); +?> diff --git a/includes/pages/install.php b/includes/pages/install.php new file mode 100644 index 00000000..785f3b78 --- /dev/null +++ b/includes/pages/install.php @@ -0,0 +1,51 @@ + + */ + +use wishthis\Page; + +$page = new page(__FILE__, 'Home'); +$page->header(); + +if (isset($_POST['action']) && 'install' === $_POST['action']) { + $configDirectory = 'includes/config'; + $configPath = $configDirectory . '/config.php'; + $configSamplePath = $configDirectory . '/config-sample.php'; + $configContents = file_get_contents($configSamplePath); + + file_put_contents($configPath, $configContents); + + ?> +
+
+

Success

+

wishthis has been successfully installed.

+ + Continue +
+
+ +
+
+

Install

+

Welcome to the wishthis installer.

+ +

Click Install to begin the installation.

+ +
+ + + +
+
+
+ footer(); diff --git a/index.php b/index.php new file mode 100644 index 00000000..cff51e40 --- /dev/null +++ b/index.php @@ -0,0 +1,36 @@ + + */ + + /** + * Include + */ +require 'includes/functions/auto-include.php'; + +autoInclude(__DIR__ . '/includes/classes'); +autoInclude(__DIR__ . '/includes/functions'); + +/** + * Install + */ +$configPath = 'includes/config/config.php'; + +if (!file_exists($configPath)) { + $page = 'install'; +} + +/** + * Page + */ +if (!isset($page)) { + $page = isset($_GET['page']) ? $_GET['page'] : 'home'; +} +$pagePath = 'includes/pages/' . $page . '.php'; + +if (file_exists($pagePath)) { + require $pagePath; +} diff --git a/wishthis.code-workspace b/wishthis.code-workspace new file mode 100644 index 00000000..39ad471f --- /dev/null +++ b/wishthis.code-workspace @@ -0,0 +1,13 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "php-docblocker.author": { + "name": "Jay Trees", + "email": "github.jay@grandel.anonaddy.me" + } + } +}