diff --git a/.forgejo/workflows/lint.yaml b/.forgejo/workflows/lint.yaml deleted file mode 100644 index 46a5a88..0000000 --- a/.forgejo/workflows/lint.yaml +++ /dev/null @@ -1,14 +0,0 @@ -on: [push] - -jobs: - phplint: - runs-on: docker - steps: - - uses: actions/checkout@v3 - - uses: docker://cytopia/phplint:alpine - with: - cmd: -i ./vendor/.* *.php - - uses: github.com/DavidAnson/markdownlint-cli2-action@v13 - with: - globs: '**/*.md' - continue-on-error: true \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..094dd6c --- /dev/null +++ b/.htaccess @@ -0,0 +1,6 @@ + +RewriteEngine On +RewriteBase / + +RewriteCond %{REQUEST_URI} !^/?static/.* +RewriteRule (.*) router.php diff --git a/www/composer.json b/composer.json similarity index 100% rename from www/composer.json rename to composer.json diff --git a/www/composer.lock b/composer.lock similarity index 100% rename from www/composer.lock rename to composer.lock diff --git a/docker_dev/Dockerfile b/docker_dev/Dockerfile index 4f96be7..60a6a66 100644 --- a/docker_dev/Dockerfile +++ b/docker_dev/Dockerfile @@ -1,7 +1,7 @@ FROM composer WORKDIR /app -COPY www/composer.* . +COPY composer.* . RUN composer install FROM php:apache @@ -12,7 +12,6 @@ RUN chmod -R a+r ./vendor RUN a2enmod rewrite RUN a2enmod headers -RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli -COPY www/ . +COPY . . RUN chmod -R a+r $(ls -I vendor) diff --git a/docker_dev/MysqlDockerfile b/docker_dev/MysqlDockerfile deleted file mode 100644 index be3c855..0000000 --- a/docker_dev/MysqlDockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mysql:8.0-debian - -WORKDIR /docker-entrypoint-initdb.d -COPY mysql_schema.sql ./ \ No newline at end of file diff --git a/docker_dev/compose.yaml b/docker_dev/compose.yaml index e1a79b0..5e8c99b 100644 --- a/docker_dev/compose.yaml +++ b/docker_dev/compose.yaml @@ -9,28 +9,18 @@ services: watch: - path: ./ action: rebuild - - path: ../www/ + - path: ../. action: sync - target: /var/www/html - ignore: - - ../.git - - mysql_schema.sql + target: /usr/local/apache2/htdocs/ mysql: - build: - dockerfile: MysqlDockerfile + image: mysql:8.0-debian # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password # (this is just an example, not intended to be a production configuration) command: --default-authentication-plugin=mysql_native_password restart: always environment: MYSQL_ROOT_PASSWORD: example - ports: - - 3306:3306 - develop: - watch: - - path: mysql_schema.sql - action: rebuild -# volumes: -# - sqlvolume:/var/lib/mysql + volumes: + - sqlvolume:/var/lib/mysql volumes: sqlvolume: {} diff --git a/docker_dev/mysql_schema.sql b/docker_dev/mysql_schema.sql deleted file mode 100644 index 6b954b7..0000000 --- a/docker_dev/mysql_schema.sql +++ /dev/null @@ -1,48 +0,0 @@ - -CREATE DATABASE dragon_fire; - -USE dragon_fire; - -CREATE TABLE posts ( - post_id INTEGER AUTO_INCREMENT, - - post_path VARCHAR(255) NOT NULL, - post_path_depth INTEGER NOT NULL DEFAULT 0, - - post_title TEXT, - post_description TEXT, - post_brief TEXT, - - post_content MEDIUMTEXT, - post_content_type TEXT, - - PRIMARY KEY(post_id), - CONSTRAINT unique_post_path UNIQUE (post_path), - - INDEX(post_path), - INDEX(post_path_depth, post_path) -); - -CREATE TABLE post_tags ( - post_id INTEGER, - tag VARCHAR(255), - - CONSTRAINT post_fkey - FOREIGN KEY(post_id) REFERENCES posts(post_id) - ON DELETE CASCADE, - - INDEX(post_id), - INDEX(tag) -); - - -INSERT INTO posts (post_path, post_title, post_content) -VALUES ( - '/about', - 'About the Dergs', -' -# About the dergs indeed - -This is just a simple test. Might be nice, though! -' -); \ No newline at end of file diff --git a/www/router.php b/router.php similarity index 66% rename from www/router.php rename to router.php index 7d76a83..9e2c99d 100644 --- a/www/router.php +++ b/router.php @@ -2,31 +2,6 @@ require_once 'vendor/autoload.php'; - -$sql = mysqli_connect('mysql', 'root', 'example', 'dragon_fire'); - -function get_post_by_path($path) { - global $sql; - - $qry = "SELECT * FROM posts WHERE post_path = ?"; - - $stmt = $sql->prepare($qry); - $stmt->bind_param("s", $path); - $stmt->execute(); - - // $result = $stmt->get_result(); - - return $stmt->get_result()->fetch_assoc(); -} - -//if (!$sql) -// { -// echo 'Connection failed
'; -// echo 'Error number: ' . mysqli_connect_errno() . '
'; -// echo 'Error message: ' . mysqli_connect_error() . '
'; -// die(); -// } - $loader = new \Twig\Loader\FilesystemLoader(['./templates', './user_content']); $twig = new \Twig\Environment($loader,['debug' => true]); @@ -46,11 +21,6 @@ $twig->addRuntimeLoader(new class implements RuntimeLoaderInterface { if($_SERVER['REQUEST_URI'] == '/') { echo $twig->render('root.html'); -} elseif(preg_match('/^\/api\/posts(.*)$/', $_SERVER['REQUEST_URI'], $match)) { - - header('Content-Type: application/json'); - echo json_encode(get_post_by_path($match[1])); - } elseif(preg_match('/^\/about(.html)?$/', $_SERVER['REQUEST_URI'])) { echo $twig->render('about.html'); } elseif(preg_match('/^\/gallery\/([^\?]+)/', $_SERVER['REQUEST_URI'])) { diff --git a/www/static/.htaccess b/static/.htaccess similarity index 100% rename from www/static/.htaccess rename to static/.htaccess diff --git a/www/static/banner.js b/static/banner.js similarity index 100% rename from www/static/banner.js rename to static/banner.js diff --git a/www/static/banner/0.png b/static/banner/0.png similarity index 100% rename from www/static/banner/0.png rename to static/banner/0.png diff --git a/www/static/banner/1.png b/static/banner/1.png similarity index 100% rename from www/static/banner/1.png rename to static/banner/1.png diff --git a/www/static/banner/banner0.jpeg b/static/banner/banner0.jpeg similarity index 100% rename from www/static/banner/banner0.jpeg rename to static/banner/banner0.jpeg diff --git a/www/static/dergstyle.css b/static/dergstyle.css similarity index 100% rename from www/static/dergstyle.css rename to static/dergstyle.css diff --git a/www/static/gallerystyle.css b/static/gallerystyle.css similarity index 100% rename from www/static/gallerystyle.css rename to static/gallerystyle.css diff --git a/www/static/icon.jpeg b/static/icon.jpeg similarity index 100% rename from www/static/icon.jpeg rename to static/icon.jpeg diff --git a/www/static/rrrorstyle.css b/static/rrrorstyle.css similarity index 100% rename from www/static/rrrorstyle.css rename to static/rrrorstyle.css diff --git a/www/templates/about.html b/templates/about.html similarity index 100% rename from www/templates/about.html rename to templates/about.html diff --git a/www/templates/gallery/gallery_entry.html b/templates/gallery/gallery_entry.html similarity index 100% rename from www/templates/gallery/gallery_entry.html rename to templates/gallery/gallery_entry.html diff --git a/www/templates/gallery/gallery_overview.html b/templates/gallery/gallery_overview.html similarity index 100% rename from www/templates/gallery/gallery_overview.html rename to templates/gallery/gallery_overview.html diff --git a/www/templates/index.html b/templates/index.html similarity index 100% rename from www/templates/index.html rename to templates/index.html diff --git a/www/templates/root.dergplate b/templates/root.dergplate similarity index 100% rename from www/templates/root.dergplate rename to templates/root.dergplate diff --git a/www/templates/root.html b/templates/root.html similarity index 100% rename from www/templates/root.html rename to templates/root.html diff --git a/www/templates/rrror.html b/templates/rrror.html similarity index 100% rename from www/templates/rrror.html rename to templates/rrror.html diff --git a/www/user_content/about.md b/user_content/about.md similarity index 100% rename from www/user_content/about.md rename to user_content/about.md diff --git a/www/.gitignore b/www/.gitignore deleted file mode 100644 index a725465..0000000 --- a/www/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ \ No newline at end of file diff --git a/www/.htaccess b/www/.htaccess index 094dd6c..605d2f4 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -1,6 +1 @@ - -RewriteEngine On -RewriteBase / - -RewriteCond %{REQUEST_URI} !^/?static/.* -RewriteRule (.*) router.php +Allow from all diff --git a/www/dergstyle.css b/www/dergstyle.css new file mode 100644 index 0000000..1c31397 --- /dev/null +++ b/www/dergstyle.css @@ -0,0 +1,42 @@ + +body { + color: #B0B0B0; + background: #302A3F; +} + +:link { + color: cyan; + font-style: italic; + text-decoration: none; + + transition: color 0.2s; +} +:link:hover { + color: lightblue; +} + +ul { + display: flex; + flex-direction: row; + justify-content: center; + + list-style-type: none; + margin-top: 1em; + padding: 0px; +} +ul li { + padding: 0em 0.3em 0em 0.3em; +} + +#big_title { + text-align: center; + font-size: 2.5em; + margin-bottom: 0.2em; +} +#title_separator { + height: 1.5px; + background-color: #ddd; + opacity: 0.5; + margin-left: 2em; + margin-right: 2em; +} diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..6084dcf --- /dev/null +++ b/www/index.php @@ -0,0 +1,11 @@ +render('index.html',[ + "a_variable" => "is very spicy. In a good way." +]); +?>