diff --git a/Dockerfile b/Dockerfile index 12e923c..108052c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,4 @@ RUN apk add --no-cache php COPY . /app EXPOSE 8080 -CMD [ "php", "-S", "0.0.0.0:8080", "routing.php" ] \ No newline at end of file +CMD [ "php", "-S", "0.0.0.0:8080", "routing.php" ] diff --git a/LICENSE b/LICENSE index 42324cc..664d8fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 André "Kody" Fernandes +Copyright (c) 2023-2025, Kody (rita.moe) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index dd39dbe..1959a07 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ php -S 127.0.0.1:8080 routing.php ```bash # Build it locally if you want, or skip this step to pull from my packages -docker build . -t git.rita.moe/kody/tz:latest +docker build . -t git.rita.moe/Rita/tz:latest # Change the first "8080" with the port you want to have on your host # Or omit "-p 8080:8080" if you're using a reverse-proxy within the docker network -docker run -d -p 8080:8080 --name tz git.rita.moe/kody/tz:latest +docker run -d -p 8080:8080 --name tz git.rita.moe/Rita/tz:latest ``` diff --git a/css/styles.css b/css/styles.css index 77077af..8d43a66 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1 +1 @@ -body{background-color:#efefef;color:#000;font-family:"Trebuchet MS","Lucida Sans Unicode","Lucida Grande","Lucida Sans",Arial,sans-serif;margin:0 auto;max-width:900px}header{background-color:#fff;border-radius:10px;margin:1rem .5rem 0;padding:1rem 1.5rem}header h1{font-size:1.5rem;margin:0}@media screen and (min-width: 500px){header h1{font-size:2rem}}header a{color:inherit;text-decoration:none}header svg{height:1.7rem;vertical-align:-0.3rem;width:1.7rem}@media screen and (min-width: 500px){header svg{height:2rem;width:2rem}}main{padding:1rem 2rem}main h2{font-size:1.5rem;margin:1rem 0;text-align:center}main h2 span{font-size:1.2rem}main form{line-height:2rem}main form label{cursor:pointer;margin-right:.2rem}@media screen and (max-width: 499px){main form label{display:block}main form input,main form select{width:100%}}main button{cursor:pointer;margin-top:1rem}main .tz-table{display:flex;flex-wrap:wrap;justify-content:center;text-align:center}main .tz-table .tz-table-element{flex:0 0 calc(100% - 1rem);margin:.5rem}@media screen and (min-width: 440px){main .tz-table .tz-table-element{flex:0 0 calc(50% - 1rem)}}@media screen and (min-width: 630px){main .tz-table .tz-table-element{flex:0 0 calc(33% - 1rem)}}@media screen and (min-width: 820px){main .tz-table .tz-table-element{flex:0 0 calc(25% - 1rem)}}main .share{display:none;margin-top:1rem;text-align:center}footer{color:#444;font-size:.7rem;margin-top:1rem;padding:1rem;text-align:center}footer a{color:inherit}@media screen and (prefers-color-scheme: dark){body{background-color:#111;color:#fff}header{background-color:#000}footer{color:#b5b5b5}}/*# sourceMappingURL=styles.css.map */ +body{background-color:#efefef;color:#000;font-family:"Trebuchet MS","Lucida Sans Unicode","Lucida Grande","Lucida Sans",Arial,sans-serif;margin:0 auto;max-width:900px}header{background-color:#fff;border-radius:10px;margin:1rem .5rem 0;padding:1rem 1.5rem}header h1{font-size:1.5rem;margin:0}@media screen and (min-width: 500px){header h1{font-size:2rem}}header a{color:inherit;text-decoration:none}header svg{height:1.7rem;vertical-align:-0.3rem;width:1.7rem}@media screen and (min-width: 500px){header svg{height:2rem;width:2rem}}main{padding:1rem 2rem}main h2{font-size:1.5rem;margin:1rem 0;text-align:center}main h2 span{font-size:1.2rem}main form{line-height:2rem}main form label{cursor:pointer;margin-right:.2rem}@media screen and (max-width: 499px){main form label{display:block}main form input,main form select{width:100%}}main button{cursor:pointer;margin-top:1rem}main .tz-table{display:flex;flex-wrap:wrap;justify-content:center;text-align:center}main .tz-table .tz-table-element{flex:0 0 calc(100% - 1rem);margin:.5rem}@media screen and (min-width: 440px){main .tz-table .tz-table-element{flex:0 0 calc(50% - 1rem)}}@media screen and (min-width: 630px){main .tz-table .tz-table-element{flex:0 0 calc(33% - 1rem)}}@media screen and (min-width: 820px){main .tz-table .tz-table-element{flex:0 0 calc(25% - 1rem)}}main .share{margin-top:1rem;text-align:center}footer{color:#444;font-size:.7rem;margin-top:1rem;padding:1rem;text-align:center}footer a{color:inherit}@media screen and (prefers-color-scheme: dark){body{background-color:#111;color:#fff}header{background-color:#000}footer{color:#b5b5b5}}/*# sourceMappingURL=styles.css.map */ diff --git a/css/styles.css.map b/css/styles.css.map index 2075f29..8dbefb7 100644 --- a/css/styles.css.map +++ b/css/styles.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAAA,KACE,yBACA,WACA,gGACA,cACA,gBAGF,OACE,sBACA,mBACA,oBACA,oBAEA,UACE,iBACA,SAEA,qCAJF,UAKI,gBAIJ,SACE,cACA,qBAGF,WACE,cACA,uBACA,aAEA,qCALF,WAMI,YACA,YAKN,KACE,kBAEA,QACE,iBACA,cACA,kBAEA,aACE,iBAIJ,UACE,iBAEA,gBACE,eACA,mBAGF,qCACE,gBACE,cAGF,iCAEE,YAKN,YACE,eACA,gBAGF,eACE,aACA,eACA,uBACA,kBAIA,iCACE,2BACA,OAJQ,MAMR,qCAJF,iCAKI,2BAGF,qCARF,iCASI,2BAGF,qCAZF,iCAaI,2BAKN,YACE,aACA,gBACA,kBAIJ,OACE,WACA,gBACA,gBACA,aACA,kBAEA,SACE,cAIJ,+CACE,KACE,sBACA,WAGF,OACE,sBAGF,OACE","file":"styles.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAAA,KACE,yBACA,WACA,gGACA,cACA,gBAGF,OACE,sBACA,mBACA,oBACA,oBAEA,UACE,iBACA,SAEA,qCAJF,UAKI,gBAIJ,SACE,cACA,qBAGF,WACE,cACA,uBACA,aAEA,qCALF,WAMI,YACA,YAKN,KACE,kBAEA,QACE,iBACA,cACA,kBAEA,aACE,iBAIJ,UACE,iBAEA,gBACE,eACA,mBAGF,qCACE,gBACE,cAGF,iCAEE,YAKN,YACE,eACA,gBAGF,eACE,aACA,eACA,uBACA,kBAIA,iCACE,2BACA,OAJQ,MAMR,qCAJF,iCAKI,2BAGF,qCARF,iCASI,2BAGF,qCAZF,iCAaI,2BAKN,YACE,gBACA,kBAIJ,OACE,WACA,gBACA,gBACA,aACA,kBAEA,SACE,cAIJ,+CACE,KACE,sBACA,WAGF,OACE,sBAGF,OACE","file":"styles.css"} \ No newline at end of file diff --git a/css/styles.scss b/css/styles.scss index 17bf3a2..a0718c4 100644 --- a/css/styles.scss +++ b/css/styles.scss @@ -103,7 +103,6 @@ main { } .share { - display: none; margin-top: 1rem; text-align: center; } diff --git a/index.php b/index.php index d689d04..57f8b36 100644 --- a/index.php +++ b/index.php @@ -23,12 +23,10 @@ $popTZ = [ ]; // User sets timezone cookie -if (isset($_POST['user-tz'])) { - // Just check it's valid - if (in_array($_POST['user-tz'], timezone_identifiers_list(DateTimeZone::ALL))) { - setcookie('user-tz', $_POST['user-tz'], time() + 60 * 60 * 24 * 365); - $_COOKIE['user-tz'] = $_POST['user-tz']; - } +if (isset($_POST['user-tz']) && + in_array($_POST['user-tz'], timezone_identifiers_list(DateTimeZone::ALL))) { + setcookie('user-tz', $_POST['user-tz'], time() + 60 * 60 * 24 * 365); + $_COOKIE['user-tz'] = $_POST['user-tz']; } // User sets 24 hours @@ -62,7 +60,7 @@ if (isset($_POST['datetime']) && isset($_POST['timezone'])) { // Redirect, with the "+" replaced by "_" header('Location: /' . str_replace('+', '_', $dateObj->format('c'))); exit; -} else if ($_SERVER['REQUEST_URI'] !== '/') { +} elseif ($_SERVER['REQUEST_URI'] !== '/') { // Remove leading "/" $req = substr($_SERVER['REQUEST_URI'], 1); @@ -80,7 +78,7 @@ if (isset($_POST['datetime']) && isset($_POST['timezone'])) { ?> @@ -116,7 +114,7 @@ if (isset($_POST['datetime']) && isset($_POST['timezone'])) {
- +