From e36ae0b4b8c0d204e200d691b052799e692ac310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Borovec?= Date: Wed, 8 May 2024 13:20:18 +0200 Subject: [PATCH] prepend and append header and footer automatically --- README.md | 31 ++++++++++++------------------- assets/.htaccess | 5 +++++ assets/errors/403.php | 17 +++++++++++++++++ assets/errors/404.php | 17 +++++++++++++++++ assets/errors/500.php | 17 +++++++++++++++++ assets/errors/503.php | 17 +++++++++++++++++ docs/www/blog/article.php | 6 ------ docs/www/blog/index.php | 5 ----- docs/www/deleteaccount.php | 5 ----- docs/www/fileupload.php | 8 -------- docs/www/index.php | 7 ------- docs/www/login.php | 8 -------- docs/www/privacy.php | 3 --- docs/www/random/conversions.php | 7 ------- docs/www/random/index.php | 7 ------- docs/www/register.php | 8 -------- 16 files changed, 85 insertions(+), 83 deletions(-) create mode 100644 assets/.htaccess create mode 100644 assets/errors/403.php create mode 100644 assets/errors/404.php create mode 100644 assets/errors/500.php create mode 100644 assets/errors/503.php diff --git a/README.md b/README.md index bbb0b5b..36dd2b2 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,17 @@ Anyways, let's get to the *how*. - SQL_USERNAME - SQL_PASSWORD - SQL_DATABASE - - Remember to enable pdo_mysql in yourr php.ini. + - Changes to php.ini should include: + - adding the /docs/common/header.hp and /docs/common/footer.php as + the auto_prepend_file and auto_append_file + - Enabling the pdo_mysql extension + - Setting the file_uploads on and setting max upload (and post) size, + if you are going to make use of that function. Please note that it is + meant for admin use only and normal users shouldn't have access to it + as it is unprotected. + - Also make sure that the folder /assets/uploads/ exists and php has write + permissions there - if you are going to use that file upload + functionality, that is. - If you have problems connecting to the database, you can try printing the PDO exception being caught there in the function `attempt_sql_connect()`, but be careful not to leave it in production, as @@ -37,30 +47,13 @@ Anyways, let's get to the *how*. - The basic skeleton for any document should be: ```php ); ?> - - ``` - Do check out the already existing css rules before adding your own, the rule for what you are trying to create might already exist. I might add a more diff --git a/assets/.htaccess b/assets/.htaccess new file mode 100644 index 0000000..dc0e7f8 --- /dev/null +++ b/assets/.htaccess @@ -0,0 +1,5 @@ +# Custom error pages +ErrorDocument 403 /errors/403.php +ErrorDocument 404 /errors/404.php +ErrorDocument 500 /errors/500.php +ErrorDocument 504 /errors/504.php diff --git a/assets/errors/403.php b/assets/errors/403.php new file mode 100644 index 0000000..545800e --- /dev/null +++ b/assets/errors/403.php @@ -0,0 +1,17 @@ + + +
+

403: Forbidden

+
+Internet meme image of a confused-looking cat with a text reading "Hey you... What are you doing here??" +
+
+ + diff --git a/assets/errors/404.php b/assets/errors/404.php new file mode 100644 index 0000000..9a52f06 --- /dev/null +++ b/assets/errors/404.php @@ -0,0 +1,17 @@ + + +
+

404: Not Found

+
+GIF of a cat hiding in a cupboard +
+
+ + diff --git a/assets/errors/500.php b/assets/errors/500.php new file mode 100644 index 0000000..df811b6 --- /dev/null +++ b/assets/errors/500.php @@ -0,0 +1,17 @@ + + +
+

500: Internal Server Error

+
+GIF of a very confused cat. +
+
+ + diff --git a/assets/errors/503.php b/assets/errors/503.php new file mode 100644 index 0000000..7d102de --- /dev/null +++ b/assets/errors/503.php @@ -0,0 +1,17 @@ + + +
+

503: Service Unavailable

+
+GIF of a cat going to work in a cardboard box. +
+
+ + diff --git a/docs/www/blog/article.php b/docs/www/blog/article.php index 5f16bad..9acd12a 100644 --- a/docs/www/blog/article.php +++ b/docs/www/blog/article.php @@ -1,8 +1,4 @@ display_comments(); - -include_once($COMMONS."/footer.php"); ?> diff --git a/docs/www/blog/index.php b/docs/www/blog/index.php index 20302f9..7954a7b 100755 --- a/docs/www/blog/index.php +++ b/docs/www/blog/index.php @@ -1,7 +1,4 @@ diff --git a/docs/www/deleteaccount.php b/docs/www/deleteaccount.php index 343d1e0..eb3b4fc 100644 --- a/docs/www/deleteaccount.php +++ b/docs/www/deleteaccount.php @@ -1,8 +1,4 @@ "); } -include_once($COMMONS."/footer.php"); ?> diff --git a/docs/www/fileupload.php b/docs/www/fileupload.php index 09a09c7..0b2784c 100644 --- a/docs/www/fileupload.php +++ b/docs/www/fileupload.php @@ -1,8 +1,4 @@ permissions & 128)) { @@ -44,7 +40,3 @@ if(isset($_POST["submit"])) { - - diff --git a/docs/www/index.php b/docs/www/index.php index 3b184ad..b1d0dce 100755 --- a/docs/www/index.php +++ b/docs/www/index.php @@ -1,7 +1,4 @@ @@ -77,7 +74,3 @@ display_header("About"); Beauty is in the eye of the beholder and while I can appreciate this look is unusual, I really dig it. You are always free to make your own custom css for my site, of course. Hmm, now I am thinking about adding built-in customisation support, but that would require user settings, and having users makes no sense until theres some kind of user interaction like a forum, or article comments, or something like that. I will save that one for later.

- - diff --git a/docs/www/login.php b/docs/www/login.php index 35c132a..aa24c2f 100644 --- a/docs/www/login.php +++ b/docs/www/login.php @@ -1,8 +1,4 @@ - - diff --git a/docs/www/privacy.php b/docs/www/privacy.php index b2b9841..df80228 100644 --- a/docs/www/privacy.php +++ b/docs/www/privacy.php @@ -1,7 +1,4 @@ diff --git a/docs/www/random/conversions.php b/docs/www/random/conversions.php index 9412ff1..73272d6 100644 --- a/docs/www/random/conversions.php +++ b/docs/www/random/conversions.php @@ -1,7 +1,4 @@ @@ -188,7 +185,3 @@ display_header("Unit conversions"); - - diff --git a/docs/www/random/index.php b/docs/www/random/index.php index d69ca20..2680dcf 100644 --- a/docs/www/random/index.php +++ b/docs/www/random/index.php @@ -1,7 +1,4 @@ @@ -15,7 +12,3 @@ display_header("Random tools"); - - diff --git a/docs/www/register.php b/docs/www/register.php index b1cbb5b..ffcd4a2 100644 --- a/docs/www/register.php +++ b/docs/www/register.php @@ -1,8 +1,4 @@ - -