diff options
author | Jonas Kohl | 2024-07-19 13:09:00 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-07-19 13:09:00 +0200 |
commit | 3b9bb27ab9179334fe3c96ae8dbc249061649aff (patch) | |
tree | d7c612cbd9f0c3b337e0713c0507a1acae8e90c9 |
Initial commit
-rw-r--r-- | .DS_Store | bin | 0 -> 6148 bytes | |||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | README.txt | 3 | ||||
-rw-r--r-- | expand.php | 17 | ||||
-rw-r--r-- | src/includes/under-construction.php | 4 | ||||
-rw-r--r-- | src/pages/about.php | 16 | ||||
-rw-r--r-- | src/pages/index.php | 3 | ||||
-rw-r--r-- | src/pages/not_found.php | 2 | ||||
-rw-r--r-- | src/static/.DS_Store | bin | 0 -> 6148 bytes | |||
-rw-r--r-- | src/static/background.jpg | bin | 0 -> 17585 bytes | |||
-rw-r--r-- | src/static/blank.gif | bin | 0 -> 37 bytes | |||
-rw-r--r-- | src/static/hozyrossite.png | bin | 0 -> 49380 bytes | |||
-rw-r--r-- | src/static/nav.gif | bin | 0 -> 1684 bytes | |||
-rw-r--r-- | src/static/navh.gif | bin | 0 -> 1683 bytes | |||
-rw-r--r-- | src/static/style.css | 64 | ||||
-rw-r--r-- | src/static/under-construction.gif | bin | 0 -> 23388 bytes | |||
-rw-r--r-- | src/template.php | 53 |
18 files changed, 180 insertions, 0 deletions
diff --git a/.DS_Store b/.DS_Store Binary files differnew file mode 100644 index 0000000..3887b2b --- /dev/null +++ b/.DS_Store diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97a2ed4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +*.tmp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3947888 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +SRCFILES:=$(shell find src/pages/ -type f -name '*.php') +HTMLTARGETS:=$(SRCFILES:src/pages/%.php=build/%.html) + +.PHONY: build/static + +all: $(HTMLTARGETS) $(STATICFILES) build/static + +build/static: + rsync -rupE src/static build/ + +build/%.html: src/pages/%.php src/template.php + @mkdir -p $(dir $@) + php expand.php < $< > $@ + +clean: + rm -Rf build diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..7ca81d2 --- /dev/null +++ b/README.txt @@ -0,0 +1,3 @@ +This is the source code of my Neocities site at https://hozyro.neocities.org/ + +To build it, you'll need GNU Make and a recent version of PHP. Then just run `make`. To clean the output directory, run `make clean`. diff --git a/expand.php b/expand.php new file mode 100644 index 0000000..41d4dc7 --- /dev/null +++ b/expand.php @@ -0,0 +1,17 @@ +<?php + +define("SRCDIR", realpath(__DIR__ . "/src/")); + +$__page = file_get_contents("php://stdin"); +$title = ""; +$__page = preg_replace_callback(';<title>(.*?)</title>;i', function(array $matches) use(&$title): string { + $title = $matches[1]; + return ""; +}, $__page); +$page = SRCDIR . "/pages/" . bin2hex(random_bytes(8)) . ".tmp"; +file_put_contents($page, $__page); +unset($__page); + +include SRCDIR . "/template.php"; + +unlink($page); diff --git a/src/includes/under-construction.php b/src/includes/under-construction.php new file mode 100644 index 0000000..0ab79de --- /dev/null +++ b/src/includes/under-construction.php @@ -0,0 +1,4 @@ +<table class="constructionBox" cellspacing="0"><tbody><tr><td class="constructionBoxCell"> +<img src="/static/under-construction.gif" alt="Under construction" /><br /> +<strong>This page is still under construction!</strong> +</td></tr></tbody></table> diff --git a/src/pages/about.php b/src/pages/about.php new file mode 100644 index 0000000..69e772c --- /dev/null +++ b/src/pages/about.php @@ -0,0 +1,16 @@ + +<?php + +const BIRTHDATE = "2001-04-13"; +$age = date_diff(new DateTimeImmutable(), new DateTimeImmutable(BIRTHDATE))->format("%y"); + +?> + +<title>About me</title> + +<h1>About me</h1> + +<?php include SRCDIR . "/includes/under-construction.php"; ?> + +<p>Hello, I'm <strong>Jonas Kohl</strong> aka <strong>hozyro</strong>!</p> +<p>I'm <strong><?= $age ?>-year-old</strong> student and software engineer. I use <strong>they/them</strong>, <strong>she/her</strong> and <strong>he/him</strong> pronouns.</p> diff --git a/src/pages/index.php b/src/pages/index.php new file mode 100644 index 0000000..3b15088 --- /dev/null +++ b/src/pages/index.php @@ -0,0 +1,3 @@ +<title>hozyro's site</title> + +<?php include SRCDIR . "/includes/under-construction.php"; ?> diff --git a/src/pages/not_found.php b/src/pages/not_found.php new file mode 100644 index 0000000..b71d6c3 --- /dev/null +++ b/src/pages/not_found.php @@ -0,0 +1,2 @@ +<title>Not found</title> +<p>The requested page could not be found.</p> diff --git a/src/static/.DS_Store b/src/static/.DS_Store Binary files differnew file mode 100644 index 0000000..5008ddf --- /dev/null +++ b/src/static/.DS_Store diff --git a/src/static/background.jpg b/src/static/background.jpg Binary files differnew file mode 100644 index 0000000..1a16379 --- /dev/null +++ b/src/static/background.jpg diff --git a/src/static/blank.gif b/src/static/blank.gif Binary files differnew file mode 100644 index 0000000..b3aa80d --- /dev/null +++ b/src/static/blank.gif diff --git a/src/static/hozyrossite.png b/src/static/hozyrossite.png Binary files differnew file mode 100644 index 0000000..5d5fd50 --- /dev/null +++ b/src/static/hozyrossite.png diff --git a/src/static/nav.gif b/src/static/nav.gif Binary files differnew file mode 100644 index 0000000..07d1301 --- /dev/null +++ b/src/static/nav.gif diff --git a/src/static/navh.gif b/src/static/navh.gif Binary files differnew file mode 100644 index 0000000..b3788af --- /dev/null +++ b/src/static/navh.gif diff --git a/src/static/style.css b/src/static/style.css new file mode 100644 index 0000000..ba507d6 --- /dev/null +++ b/src/static/style.css @@ -0,0 +1,64 @@ +body { + background: #05456a url("background.jpg") top center no-repeat; + font: 10pt Verdana; +} +#wrapper { + width: 1024px; + margin: 0 auto; +} +#logoCell { + padding: 8px; + text-align: center; +} +#mainLayout { + border-spacing: 0; + width: 100%; +} +#navRow { + padding: 0; + background: url("nav.gif"); +} +#navCell { + border: 1px solid #000; + padding: 0; +} +#navLayout { + border-spacing: 0; +} +.navCell { + padding: 0; + border-left: 1px solid #fff; + border-right: 1px solid #000; +} +.navCell a { + display: block; + padding: 4px 32px; + text-decoration: none; + color: black; +} +.navCell a:hover { + color: #05456a; + background: url("navh.gif"); +} +#mainCell { + border: 1px solid #000; + border-top: none; + background: white; + padding: 16px; +} +#footerCell { + border: 1px solid black; + border-top: none; + background: #cfd5da; + padding: 16px; +} +.constructionBox { + margin: 0 auto; + border: 1px solid black; + background: #fffca2; +} +.constructionBoxCell { + padding: 12px; + text-align: center; + line-height: 24px; +} diff --git a/src/static/under-construction.gif b/src/static/under-construction.gif Binary files differnew file mode 100644 index 0000000..ac939c8 --- /dev/null +++ b/src/static/under-construction.gif diff --git a/src/template.php b/src/template.php new file mode 100644 index 0000000..16fa5a5 --- /dev/null +++ b/src/template.php @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> + <title><?= htmlentities($title) ?></title> + <link rel="stylesheet" href="/static/style.css" type="text/css" /> +</head> +<body> + <div id="wrapper"> + <table id="mainLayout" cellspacing="0"> + <!-- + I know, cellspacing="0" is *not* valid XHTML in + XHTML 1.0 Strict, but IE versions below 7 don't support + the 'border-spacing' CSS property, so we have no other choice. + I also don't want to use XHTML Transitional, as that would put + IE into quirks mode, but I want to stay in standards mode. + --> + <tbody> + <tr id="logoRow"> + <td id="logoCell"> + <img src="/static/blank.gif" alt="hozyro's site" width="1" height="136" /> + </td> + </tr> + <tr id="navRow"> + <td id="navCell"> + <table id="navLayout" cellspacing="0"> + <tbody> + <tr> + <td class="navCell" style="border-left:0"><a href="/">Home page</a></td> + <td class="navCell"><a href="/about.html">About me</a></td> + <td class="navCell"><a href="https://jonaskohl.de/">My actual website</a></td> + <td class="navCell" style="border-right:0"></td> + </tr> + </tbody> + </table> + </td> + </tr> + <tr id="mainRow"> + <td id="mainCell"> + <?php include $page ?> + </td> + </tr> + <tr id="footerRow"> + <td id="footerCell"> + Made by Jonas Kohl aka hozyro. + </td> + </tr> + </tbody> + </table> + </div> +</body> +</html> |