From b3dbc2cb65bd3e6d8cf04816082db888e4edc9d4 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 1 Nov 2022 12:36:37 +0000 Subject: [PATCH] Moving to conf.json from manifest.json --- account.php | 80 +++++++++++++++++++-------------------- app/app.json | 2 +- app/app.php | 26 ++++++++----- app/required.php | 4 +- app/settings.php | 17 ++++++++- css/main.css | 19 ++++------ css/scss/_body.scss | 20 +++++----- css/scss/_navigation.scss | 3 -- index.php | 5 +-- usr/conf.default.json | 17 +++++++++ usr/conf/manifest.json | 39 ------------------- 11 files changed, 113 insertions(+), 119 deletions(-) create mode 100644 usr/conf.default.json delete mode 100644 usr/conf/manifest.json diff --git a/account.php b/account.php index 3e9af78..7a75fce 100644 --- a/account.php +++ b/account.php @@ -159,8 +159,9 @@ if ($user_info->is_admin($conn, $_SESSION['id'])) { $sql_start = microtime(true); ?> -
-

Admin

+
+

Website

+

Invite Codes

-
- +

Admin

@@ -378,48 +378,46 @@ evt.currentTarget.className += " active-tab"; } -
-
-

Sanity check

- get_results(); +

Sanity check

+ get_results(); - if (empty($check_sanity)) { - echo "

No errors! Lookin' good :3

"; - } else { - ?> - - - - ".$result['message']." -

"; - } elseif ($result['type'] == 'warning') { - echo "

- - ".$result['message']." -

"; - } else { - echo "

- - ".$result['message']." -

"; + if (empty($check_sanity)) { + echo "

No errors! Lookin' good :3

"; + } else { + ?> + + + + ".$result['message']." +

"; + } elseif ($result['type'] == 'warning') { + echo "

+ + ".$result['message']." +

"; + } else { + echo "

+ + ".$result['message']." +

"; } - - echo "
"; } - ?> + + echo ""; + } + ?>
"Only Legs", "website_description" => "A simple PHP gallery with multiple users in mind", @@ -392,7 +392,7 @@ class Setup { "allowed_extensions" => array("jpg", "jpeg", "png", "webp") ) ); - file_put_contents(__DIR__."/../usr/conf/manifest.json", json_encode($manifest)); + file_put_contents(__DIR__."/../usr/conf/conf.json", json_encode($manifest)); } } } @@ -402,17 +402,25 @@ class Sanity { { $results = array(); - if (!is_file(__DIR__."/../usr/conf/manifest.json")) { - $results[] = array('type'=>'critical', 'message'=>'manifest.json is missing'); + if (!is_file(__DIR__."/../usr/conf/msg.json")) { + $results[] = array('type'=>'warning', 'message'=>'msg.json is missing'); + } + + if (!is_file(__DIR__."/../usr/conf/conf.json")) { + if (is_file(__DIR__."/../usr/conf/manifest.json")) { + $results[] = array('type'=>'critical', 'message'=>'manifest.json is deprecated, please rename it to conf.json'); + } else { + $results[] = array('type'=>'critical', 'message'=>'conf.json is missing, using conf.default.json instead'); + } } else { - $manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true); + $manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true); if (empty($manifest['user_name']) || $manifest['user_name'] == "[your name]") { - $results[] = array('type'=>'warning', 'message'=>'manifest.json is missing your name'); + $results[] = array('type'=>'warning', 'message'=>'conf.json is missing your name'); } if ($manifest['upload']['rename_on_upload']) { if (empty($manifest['upload']['rename_to'])) { - $results[] = array('type'=>'critical', 'message'=>'manifest.json doesnt know what to rename your files to'); + $results[] = array('type'=>'critical', 'message'=>'conf.json doesnt know what to rename your files to'); } else { $rename_to = $manifest['upload']['rename_to']; $rename_rate = 0; @@ -426,9 +434,9 @@ class Sanity { if (str_contains($rename_to, '{{username}}') || str_contains($rename_to, '{{userid}}')) $rename_rate += 1; if ($rename_rate < 2) { - $results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your manifest.json'); + $results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your conf.json'); } elseif ($rename_rate < 5 && $rename_rate > 2) { - $results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your manifest.json'); + $results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your conf.json'); } } } diff --git a/app/required.php b/app/required.php index aa5c5d7..372a6aa 100644 --- a/app/required.php +++ b/app/required.php @@ -5,8 +5,8 @@ require_once dirname(__DIR__)."/app/conn.php"; require_once dirname(__DIR__)."/app/app.php"; require_once dirname(__DIR__)."/app/settings.php"; -ini_set('post_max_size', $upload_conf['max_filesize']."M"); -ini_set('upload_max_filesize', ($upload_conf['upload_max'] + 1)."M"); +ini_set('post_max_size', $upload_conf['max_filesize']); +ini_set('upload_max_filesize', $upload_conf['max_filesize']); if ($user_settings['is_testing']) { ini_set('display_errors', 1); diff --git a/app/settings.php b/app/settings.php index 9f355de..b203a80 100644 --- a/app/settings.php +++ b/app/settings.php @@ -8,7 +8,22 @@ | the default background and accent colour |------------------------------------------------------------- */ -$user_settings = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true); +$user_settings = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true); + +if (!is_file(__DIR__."/../usr/conf/conf.json")) { + $settings = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true); +} else { + $settings = json_decode(file_get_contents(__DIR__."/../usr/conf.default.json"), true); +} + +if (!is_file(__DIR__."/../usr/conf/msg.json")) { + $user_welcome = json_decode(file_get_contents(__DIR__."/../usr/conf/msg.json"), true); + $user_welcome = $user_welcome['welcome']; +} else { + $user_welcome = array('Welcome to your new Only Legs installation! You can change this message in the settings page.'); +} + + $web_info = json_decode(file_get_contents(__DIR__."/app.json"), true); $upload_conf = $user_settings["upload"]; \ No newline at end of file diff --git a/css/main.css b/css/main.css index b1bc3bc..2e9b228 100644 --- a/css/main.css +++ b/css/main.css @@ -114,8 +114,6 @@ nav .btn { @media (max-width: 550px) { nav { margin: 0; - width: calc(100% - 1rem); - height: 2.5rem; position: fixed; top: auto; bottom: 0; @@ -542,6 +540,7 @@ nav .btn { .group-name { margin: 0; + max-width: 90%; position: absolute; top: 50%; left: 50%; @@ -553,6 +552,8 @@ nav .btn { font-family: "Secular One", sans-serif; text-decoration: none; text-align: center; + text-overflow: ellipsis; + overflow-x: hidden; } .gallery-group { @@ -585,6 +586,7 @@ nav .btn { position: relative; overflow: hidden; flex: 1 0 150px; + text-overflow: ellipsis; transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1); } .group-make:hover { @@ -620,7 +622,9 @@ nav .btn { cursor: pointer; } .group-make button span { + max-width: 90%; text-align: center; + text-overflow: ellipsis; } .group-make button img { margin: 0.25rem; @@ -628,16 +632,9 @@ nav .btn { height: 2.5rem; } -@media (max-width: 800px) { - .group-make { - max-width: calc(25% - 0.5rem); - min-width: calc(25% - 0.5rem); - } -} @media (max-width: 550px) { - .group-make { - max-width: calc(33.33% - 0.5rem); - min-width: calc(33.33% - 0.5rem); + .group-make > button > span { + display: none; } } /* diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 4754958..208d6e6 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -481,6 +481,8 @@ .group-name { margin: 0; + max-width: 90%; + position: absolute; top: 50%; left: 50%; @@ -495,6 +497,9 @@ font-family: $font-body; text-decoration: none; text-align: center; + text-overflow: ellipsis; + + overflow-x: hidden; } .gallery-group { @@ -540,6 +545,8 @@ flex: 1 0 150px; + text-overflow: ellipsis; + transition: outline 0.1s cubic-bezier(.19, 1, .22, 1); &:hover { @@ -587,7 +594,9 @@ } span { + max-width: 90%; text-align: center; + text-overflow: ellipsis; } img { @@ -598,16 +607,9 @@ } } } -@media (max-width: 800px) { - .group-make { - max-width: calc(25% - 0.5rem); - min-width: calc(25% - 0.5rem); - } -} @media (max-width: 550px) { - .group-make { - max-width: calc(33.33% - 0.5rem); - min-width: calc(33.33% - 0.5rem); + .group-make > button > span { + display: none; } } /* diff --git a/css/scss/_navigation.scss b/css/scss/_navigation.scss index 87a6e90..f8fc725 100644 --- a/css/scss/_navigation.scss +++ b/css/scss/_navigation.scss @@ -85,9 +85,6 @@ nav { nav { margin: 0; - width: calc(100% - 1rem); - height: 2.5rem; - position: fixed; top: auto; bottom: 0; diff --git a/index.php b/index.php index fa99424..935d5c6 100644 --- a/index.php +++ b/index.php @@ -95,9 +95,8 @@ echo "

".$time_welc."!

"; } - // Random welcome message - $welcome_message = $user_settings['welcome_msg']; - echo "

".$welcome_message[array_rand($welcome_message, 1)]."

"; + // Random welcome message + echo "

".$user_welcome[array_rand($user_welcome, 1)]."

"; ?>
Just like Minecraft!", - "If I were you, I'd run now", - "This is the part where I kill you", - "SILICA GEL \"DO NOT EAT\".", - "This was supposed to be a simple project", - "AAAAAAAAAAAAAAAAAAAA", - "Let me out", - "nice", - "I'm glad you're here", - "The weather is dry", - "Need me a man 👀", - "Gods die too.", - "Eat hotchip and lie" - ], - "user_name": "[your name]", - "is_testing": true, - "upload": { - "max_filesize": "32", - "rename_on_upload": true, - "rename_to": "IMG_{{username}}_{{time}}", - "allowed_extentions": [ - "jpg", - "jpeg", - "png", - "webp" - ] - } -} \ No newline at end of file