Compare commits
No commits in common. "5bcba0b6896b5278492894a7b0a11ce71b429aa1" and "54a16cc77ee608ad1bf1aea7e1b65e114310b215" have entirely different histories.
5bcba0b689
...
54a16cc77e
|
@ -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
|
|
6
.htaccess
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_URI} !^/?static/.*
|
||||||
|
RewriteRule (.*) router.php
|
0
www/composer.lock → composer.lock
generated
|
@ -1,7 +1,7 @@
|
||||||
FROM composer
|
FROM composer
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY www/composer.* .
|
COPY composer.* .
|
||||||
RUN composer install
|
RUN composer install
|
||||||
|
|
||||||
FROM php:apache
|
FROM php:apache
|
||||||
|
@ -12,7 +12,6 @@ RUN chmod -R a+r ./vendor
|
||||||
|
|
||||||
RUN a2enmod rewrite
|
RUN a2enmod rewrite
|
||||||
RUN a2enmod headers
|
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)
|
RUN chmod -R a+r $(ls -I vendor)
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM mysql:8.0-debian
|
|
||||||
|
|
||||||
WORKDIR /docker-entrypoint-initdb.d
|
|
||||||
COPY mysql_schema.sql ./
|
|
|
@ -9,28 +9,18 @@ services:
|
||||||
watch:
|
watch:
|
||||||
- path: ./
|
- path: ./
|
||||||
action: rebuild
|
action: rebuild
|
||||||
- path: ../www/
|
- path: ../.
|
||||||
action: sync
|
action: sync
|
||||||
target: /var/www/html
|
target: /usr/local/apache2/htdocs/
|
||||||
ignore:
|
|
||||||
- ../.git
|
|
||||||
- mysql_schema.sql
|
|
||||||
mysql:
|
mysql:
|
||||||
build:
|
image: mysql:8.0-debian
|
||||||
dockerfile: MysqlDockerfile
|
|
||||||
# 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
|
# 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)
|
# (this is just an example, not intended to be a production configuration)
|
||||||
command: --default-authentication-plugin=mysql_native_password
|
command: --default-authentication-plugin=mysql_native_password
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: example
|
MYSQL_ROOT_PASSWORD: example
|
||||||
ports:
|
volumes:
|
||||||
- 3306:3306
|
- sqlvolume:/var/lib/mysql
|
||||||
develop:
|
|
||||||
watch:
|
|
||||||
- path: mysql_schema.sql
|
|
||||||
action: rebuild
|
|
||||||
# volumes:
|
|
||||||
# - sqlvolume:/var/lib/mysql
|
|
||||||
volumes:
|
volumes:
|
||||||
sqlvolume: {}
|
sqlvolume: {}
|
||||||
|
|
|
@ -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!
|
|
||||||
'
|
|
||||||
);
|
|
|
@ -2,31 +2,6 @@
|
||||||
|
|
||||||
require_once 'vendor/autoload.php';
|
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<br>';
|
|
||||||
// echo 'Error number: ' . mysqli_connect_errno() . '<br>';
|
|
||||||
// echo 'Error message: ' . mysqli_connect_error() . '<br>';
|
|
||||||
// die();
|
|
||||||
// }
|
|
||||||
|
|
||||||
$loader = new \Twig\Loader\FilesystemLoader(['./templates', './user_content']);
|
$loader = new \Twig\Loader\FilesystemLoader(['./templates', './user_content']);
|
||||||
|
|
||||||
$twig = new \Twig\Environment($loader,['debug' => true]);
|
$twig = new \Twig\Environment($loader,['debug' => true]);
|
||||||
|
@ -46,11 +21,6 @@ $twig->addRuntimeLoader(new class implements RuntimeLoaderInterface {
|
||||||
|
|
||||||
if($_SERVER['REQUEST_URI'] == '/') {
|
if($_SERVER['REQUEST_URI'] == '/') {
|
||||||
echo $twig->render('root.html');
|
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'])) {
|
} elseif(preg_match('/^\/about(.html)?$/', $_SERVER['REQUEST_URI'])) {
|
||||||
echo $twig->render('about.html');
|
echo $twig->render('about.html');
|
||||||
} elseif(preg_match('/^\/gallery\/([^\?]+)/', $_SERVER['REQUEST_URI'])) {
|
} elseif(preg_match('/^\/gallery\/([^\?]+)/', $_SERVER['REQUEST_URI'])) {
|
Before Width: | Height: | Size: 527 KiB After Width: | Height: | Size: 527 KiB |
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
1
www/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
vendor/
|
|
|
@ -1,6 +1 @@
|
||||||
|
Allow from all
|
||||||
RewriteEngine On
|
|
||||||
RewriteBase /
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !^/?static/.*
|
|
||||||
RewriteRule (.*) router.php
|
|
||||||
|
|
42
www/dergstyle.css
Normal file
|
@ -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;
|
||||||
|
}
|
11
www/index.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../vendor/autoload.php';
|
||||||
|
|
||||||
|
$loader = new \Twig\Loader\FilesystemLoader('../templates');
|
||||||
|
$twig = new \Twig\Environment($loader);
|
||||||
|
|
||||||
|
echo $twig->render('index.html',[
|
||||||
|
"a_variable" => "is very spicy. In a good way."
|
||||||
|
]);
|
||||||
|
?>
|