From 8d9aa8ae517e064fb70e1ca7a8741704b6bdb571 Mon Sep 17 00:00:00 2001 From: Pavel Skipenes Date: Thu, 7 Jul 2022 19:41:22 +0200 Subject: [PATCH 01/53] capitalized CamelCase for dirs and php source --- .../Exceptions/Authentication.php | 0 .../store.php => Library/Exceptions/Store.php | 0 .../user.php => Library/Exceptions/User.php | 0 .../admin.php => Library/Helpers/Admin.php | 29 ++++++------- .../Templates/Content.php | 0 .../Templates/Footer.php | 0 .../Templates/Header.php | 2 +- .../menu.php => Library/Templates/Menu.php | 0 .../Templates/MenuPopup.php | 0 .../modal.php => Library/Templates/Modal.php | 0 .../Templates/NotFound.php | 0 .../store.php => Library/Templates/Store.php | 0 .../Util/AccessControl.php | 3 +- library/util/api.php => Library/Util/Api.php | 0 .../Util/Authenticator.php | 4 +- library/util/db.php => Library/Util/Db.php | 0 .../Util/Enrollment.php | 0 library/util/log.php => Library/Util/Log.php | 0 .../member.php => Library/Util/Member.php | 2 +- .../request.php => Library/Util/Request.php | 0 .../settings.php => Library/Util/Settings.php | 2 +- .../util/store.php => Library/Util/Store.php | 6 +-- .../Util/Translator.php | 10 ++--- .../access.php => Private/Admin/Access.php | 2 +- .../autopay.php => Private/Admin/Autopay.php | 2 +- .../admin/cin.php => Private/Admin/Cin.php | 2 +- .../Admin/FridayBeer.php | 0 .../Admin/Gavekort.php | 0 .../Admin/IsMember.php | 2 +- .../Admin/MemberRegister.php | 2 +- .../store.php => Private/Admin/Store.php | 2 +- .../admin/test.php => Private/Admin/Test.php | 6 +-- .../Admin/Translations.php | 0 .../users.php => Private/Admin/Users.php | 0 .../Admin/Volunteer.php | 0 .../api/charge.php => Private/Api/Charge.php | 4 +- private/api/cin.php => Private/Api/Cin.php | 4 +- .../api/dugnad.php => Private/Api/Dugnad.php | 2 +- .../Api/Enrollment.php | 4 +- .../Api/FridayBeer.php | 0 .../gavekort.php => Private/Api/Gavekort.php | 0 .../Api/Inventory.php | 4 +- .../isMember.php => Private/Api/IsMember.php | 2 +- .../Api/MemberRegister.php | 4 +- .../Api/Memberlist.php | 0 .../api/order.php => Private/Api/Order.php | 2 +- .../Api/OrderStatus.php | 2 +- .../api/store.php => Private/Api/Store.php | 8 ++-- .../Api/StoreItem.php | 2 +- .../Api/StripeCallback.php | 2 +- .../Api/Translations.php | 0 .../Api/UpdateKid.php | 2 +- .../activities.php => Public/Activities.php | 2 +- public/admin.php => Public/Admin.php | 2 +- public/board.php => Public/Board.php | 2 +- public/checkout.php => Public/Checkout.php | 2 +- .../enrollment.php => Public/Enrollment.php | 10 ++--- public/equipment.php => Public/Equipment.php | 2 +- {public => Public}/FAQ.php | 2 +- .../fredagspils.php => Public/Fredagspils.php | 0 public/mainpage.php => Public/Mainpage.php | 2 +- public/practices.php => Public/Practices.php | 2 +- public/store.php => Public/Store.php | 6 +-- docker-compose.yml | 22 +++++----- index.php | 42 +++++++++---------- js/admin/fredagspils.js | 2 +- 66 files changed, 107 insertions(+), 109 deletions(-) rename library/exceptions/authentication.php => Library/Exceptions/Authentication.php (100%) rename library/exceptions/store.php => Library/Exceptions/Store.php (100%) rename library/exceptions/user.php => Library/Exceptions/User.php (100%) rename library/helpers/admin.php => Library/Helpers/Admin.php (84%) mode change 100755 => 100644 rename library/templates/content.php => Library/Templates/Content.php (100%) rename library/templates/footer.php => Library/Templates/Footer.php (100%) rename library/templates/header.php => Library/Templates/Header.php (97%) rename library/templates/menu.php => Library/Templates/Menu.php (100%) rename library/templates/menu_popup.php => Library/Templates/MenuPopup.php (100%) rename library/templates/modal.php => Library/Templates/Modal.php (100%) rename library/templates/not_found.php => Library/Templates/NotFound.php (100%) rename library/templates/store.php => Library/Templates/Store.php (100%) rename library/util/access_control.php => Library/Util/AccessControl.php (98%) rename library/util/api.php => Library/Util/Api.php (100%) rename library/util/authenticator.php => Library/Util/Authenticator.php (99%) rename library/util/db.php => Library/Util/Db.php (100%) rename library/util/enrollment.php => Library/Util/Enrollment.php (100%) rename library/util/log.php => Library/Util/Log.php (100%) rename library/util/member.php => Library/Util/Member.php (98%) rename library/util/request.php => Library/Util/Request.php (100%) rename library/util/settings.php => Library/Util/Settings.php (93%) rename library/util/store.php => Library/Util/Store.php (99%) rename library/util/translator.php => Library/Util/Translator.php (90%) rename private/admin/access.php => Private/Admin/Access.php (99%) rename private/admin/autopay.php => Private/Admin/Autopay.php (96%) rename private/admin/cin.php => Private/Admin/Cin.php (98%) rename private/admin/friday_beer.php => Private/Admin/FridayBeer.php (100%) rename private/admin/gavekort.php => Private/Admin/Gavekort.php (100%) rename private/admin/isMember.php => Private/Admin/IsMember.php (93%) rename private/admin/member_register.php => Private/Admin/MemberRegister.php (97%) rename private/admin/store.php => Private/Admin/Store.php (99%) rename private/admin/test.php => Private/Admin/Test.php (83%) rename private/admin/translations.php => Private/Admin/Translations.php (100%) rename private/admin/users.php => Private/Admin/Users.php (100%) rename private/admin/volunteer.php => Private/Admin/Volunteer.php (100%) rename private/api/charge.php => Private/Api/Charge.php (97%) rename private/api/cin.php => Private/Api/Cin.php (98%) rename private/api/dugnad.php => Private/Api/Dugnad.php (98%) rename private/api/enrollment.php => Private/Api/Enrollment.php (99%) rename private/api/friday_beer.php => Private/Api/FridayBeer.php (100%) rename private/api/gavekort.php => Private/Api/Gavekort.php (100%) rename private/api/inventory.php => Private/Api/Inventory.php (96%) rename private/api/isMember.php => Private/Api/IsMember.php (96%) rename private/api/member_register.php => Private/Api/MemberRegister.php (94%) rename private/api/memberlist.php => Private/Api/Memberlist.php (100%) rename private/api/order.php => Private/Api/Order.php (97%) rename private/api/order_status.php => Private/Api/OrderStatus.php (79%) rename private/api/store.php => Private/Api/Store.php (98%) rename private/api/store_item.php => Private/Api/StoreItem.php (94%) rename private/api/stripe_callback.php => Private/Api/StripeCallback.php (97%) rename private/api/translations.php => Private/Api/Translations.php (100%) rename private/api/update_kid.php => Private/Api/UpdateKid.php (98%) rename public/activities.php => Public/Activities.php (91%) rename public/admin.php => Public/Admin.php (97%) rename public/board.php => Public/Board.php (92%) rename public/checkout.php => Public/Checkout.php (97%) rename public/enrollment.php => Public/Enrollment.php (94%) rename public/equipment.php => Public/Equipment.php (90%) rename {public => Public}/FAQ.php (90%) rename public/fredagspils.php => Public/Fredagspils.php (100%) rename public/mainpage.php => Public/Mainpage.php (94%) rename public/practices.php => Public/Practices.php (88%) rename public/store.php => Public/Store.php (84%) diff --git a/library/exceptions/authentication.php b/Library/Exceptions/Authentication.php similarity index 100% rename from library/exceptions/authentication.php rename to Library/Exceptions/Authentication.php diff --git a/library/exceptions/store.php b/Library/Exceptions/Store.php similarity index 100% rename from library/exceptions/store.php rename to Library/Exceptions/Store.php diff --git a/library/exceptions/user.php b/Library/Exceptions/User.php similarity index 100% rename from library/exceptions/user.php rename to Library/Exceptions/User.php diff --git a/library/helpers/admin.php b/Library/Helpers/Admin.php old mode 100755 new mode 100644 similarity index 84% rename from library/helpers/admin.php rename to Library/Helpers/Admin.php index b39e51c..90a7ab5 --- a/library/helpers/admin.php +++ b/Library/Helpers/Admin.php @@ -12,22 +12,22 @@ function redirect($action) return; } if ($action != "") { - $side = "private/admin/${action}_$language.php"; + $side = "Private/Admin/" . ucfirst("${action}_$language.php"); if (file_exists($side)) { require_once($side); return; } - $side = "private/admin/${action}_no.php"; + $side = "Private/Admin/" . ucfirst("${action}_no.php"); if (file_exists($side)) { require_once($side); return; } - $side = "private/admin/${action}.php"; + $side = "Private/Admin/" . ucfirst("${action}.php"); if (file_exists($side)) { require_once($side); return; } - print("Page $action not found"); + print("Page " . ucfirst("$action not found")); } print_section("web"); print_section("member"); @@ -100,18 +100,18 @@ function print_section($section) $inline = true; switch ($section) { case "member": - access_link("member_register", $inline); - access_link("volunteer", $inline); - access_link("cin", $inline); - access_link("isMember", $inline); + access_link("MemberRegister", $inline); + access_link("Volunteer", $inline); + access_link("Cin", $inline); + access_link("IsMember", $inline); break; case "web": - access_link("users", $inline); - access_link("access", $inline); - access_link("translations", $inline); - access_link("store", $inline); - access_link("friday_beer", $inline); - access_link("test", $inline); + access_link("Users", $inline); + access_link("Access", $inline); + access_link("Translations", $inline); + access_link("Store", $inline); + access_link("FridayBeer", $inline); + access_link("Test", $inline); break; default: log::die("Wrong parameter: $section", __FILE__, __LINE__); @@ -123,6 +123,7 @@ function print_section($section) function access_link($page, $inline = false) { global $t, $access_control; + $page = strtolower($page); $link = $t->get_url("admin/$page"); $text = $t->get_translation("admin_$page"); $text = $text ? $text : $page; diff --git a/library/templates/content.php b/Library/Templates/Content.php similarity index 100% rename from library/templates/content.php rename to Library/Templates/Content.php diff --git a/library/templates/footer.php b/Library/Templates/Footer.php similarity index 100% rename from library/templates/footer.php rename to Library/Templates/Footer.php diff --git a/library/templates/header.php b/Library/Templates/Header.php similarity index 97% rename from library/templates/header.php rename to Library/Templates/Header.php index a39f9db..f69918e 100755 --- a/library/templates/header.php +++ b/Library/Templates/Header.php @@ -47,7 +47,7 @@
\ No newline at end of file diff --git a/library/templates/menu.php b/Library/Templates/Menu.php similarity index 100% rename from library/templates/menu.php rename to Library/Templates/Menu.php diff --git a/library/templates/menu_popup.php b/Library/Templates/MenuPopup.php similarity index 100% rename from library/templates/menu_popup.php rename to Library/Templates/MenuPopup.php diff --git a/library/templates/modal.php b/Library/Templates/Modal.php similarity index 100% rename from library/templates/modal.php rename to Library/Templates/Modal.php diff --git a/library/templates/not_found.php b/Library/Templates/NotFound.php similarity index 100% rename from library/templates/not_found.php rename to Library/Templates/NotFound.php diff --git a/library/templates/store.php b/Library/Templates/Store.php similarity index 100% rename from library/templates/store.php rename to Library/Templates/Store.php diff --git a/library/util/access_control.php b/Library/Util/AccessControl.php similarity index 98% rename from library/util/access_control.php rename to Library/Util/AccessControl.php index 9085f85..28ba9f6 100755 --- a/library/util/access_control.php +++ b/Library/Util/AccessControl.php @@ -2,7 +2,7 @@ declare(strict_types=1); -require_once("library/util/db.php"); +require_once("Library/Util/Db.php"); class AccessControl { private $user, $group_rules; @@ -78,5 +78,4 @@ public function can_access(string $page, $action): bool return $result; } - } diff --git a/library/util/api.php b/Library/Util/Api.php similarity index 100% rename from library/util/api.php rename to Library/Util/Api.php diff --git a/library/util/authenticator.php b/Library/Util/Authenticator.php similarity index 99% rename from library/util/authenticator.php rename to Library/Util/Authenticator.php index baa94f1..aeeb3b8 100755 --- a/library/util/authenticator.php +++ b/Library/Util/Authenticator.php @@ -2,8 +2,8 @@ declare(strict_types=1); -require_once("library/exceptions/user.php"); -require_once("library/exceptions/authentication.php"); +require_once("Library/Exceptions/User.php"); +require_once("Library/Exceptions/Authentication.php"); // TODO: new function: Generate random password // TODO: new function: require password reset on user_id // TODO: merge with access_control class diff --git a/library/util/db.php b/Library/Util/Db.php similarity index 100% rename from library/util/db.php rename to Library/Util/Db.php diff --git a/library/util/enrollment.php b/Library/Util/Enrollment.php similarity index 100% rename from library/util/enrollment.php rename to Library/Util/Enrollment.php diff --git a/library/util/log.php b/Library/Util/Log.php similarity index 100% rename from library/util/log.php rename to Library/Util/Log.php diff --git a/library/util/member.php b/Library/Util/Member.php similarity index 98% rename from library/util/member.php rename to Library/Util/Member.php index 6daca50..4d6d9f4 100755 --- a/library/util/member.php +++ b/Library/Util/Member.php @@ -2,7 +2,7 @@ declare(strict_types=1); -require_once("library/util/db.php"); +require_once("Library/Util/Db.php"); class Member { diff --git a/library/util/request.php b/Library/Util/Request.php similarity index 100% rename from library/util/request.php rename to Library/Util/Request.php diff --git a/library/util/settings.php b/Library/Util/Settings.php similarity index 93% rename from library/util/settings.php rename to Library/Util/Settings.php index 23eaf70..24b7182 100755 --- a/library/util/settings.php +++ b/Library/Util/Settings.php @@ -27,7 +27,7 @@ function test_settings(){ log::die("$dir is not writable", __FILE__, __LINE__); } } - foreach(["css", "js", "library", "private", "public", "vendor", "assets"] as $dir){ + foreach(["css", "js", "Library", "Private", "Public", "vendor", "assets"] as $dir){ if (!is_readable($dir)){ log::die("$dir is not readable", __FILE__, __LINE__); } diff --git a/library/util/store.php b/Library/Util/Store.php similarity index 99% rename from library/util/store.php rename to Library/Util/Store.php index c5e249e..a2986d8 100755 --- a/library/util/store.php +++ b/Library/Util/Store.php @@ -2,9 +2,9 @@ declare(strict_types=1); // TODO: split this class into product and order -require_once("library/util/db.php"); -require_once("library/exceptions/store.php"); -require_once("library/util/member.php"); +require_once("Library/Exceptions/Store.php"); +require_once("Library/Util/Db.php"); +require_once("Library/Util/Member.php"); class Store { diff --git a/library/util/translator.php b/Library/Util/Translator.php similarity index 90% rename from library/util/translator.php rename to Library/Util/Translator.php index c6200f3..67f9246 100755 --- a/library/util/translator.php +++ b/Library/Util/Translator.php @@ -5,19 +5,18 @@ class Translator { private $page; // page name private $language; // language code. Currently supporting "no" and "en" - private $directory; // path to translation directory private $translations; // global array of all translations - function __construct(string $page, string $lang = "no", string $dir = "translations") + function __construct(string $page, string $lang = "no", private string $directory = "translations") { - $this->page = $page; + $this->page = lcfirst($page); $this->language = $lang; - $this->directory = $dir; - $this->load_translation($page); + $this->load_translation($this->page); } public function load_translation($page) { + $page = lcfirst($page); $file = "$this->directory/$page.json"; if ($page == "api") { @@ -39,6 +38,7 @@ public function load_translation($page) public function get_translation($key, $page = ""): string { + $page = lcfirst($page); $ret = ""; $language = $this->language; diff --git a/private/admin/access.php b/Private/Admin/Access.php similarity index 99% rename from private/admin/access.php rename to Private/Admin/Access.php index 4faf392..88b9745 100755 --- a/private/admin/access.php +++ b/Private/Admin/Access.php @@ -2,7 +2,7 @@ declare(strict_types=1); // Fuck this mess... -require_once("library/util/db.php"); +require_once("Library/Util/Db.php"); // get roles $roles = array(); { diff --git a/private/admin/autopay.php b/Private/Admin/Autopay.php similarity index 96% rename from private/admin/autopay.php rename to Private/Admin/Autopay.php index c6c4786..a7b6363 100755 --- a/private/admin/autopay.php +++ b/Private/Admin/Autopay.php @@ -2,7 +2,7 @@ declare(strict_types=1); global $settings; -require_once("library/templates/modal.php"); +require_once("Library/Templates/Modal.php"); ?> diff --git a/private/admin/cin.php b/Private/Admin/Cin.php similarity index 98% rename from private/admin/cin.php rename to Private/Admin/Cin.php index 53c6358..2782e0f 100755 --- a/private/admin/cin.php +++ b/Private/Admin/Cin.php @@ -2,7 +2,7 @@ declare(strict_types=1); global $settings; -require_once("library/templates/modal.php"); +require_once("Library/Templates/Modal.php"); ?> diff --git a/private/admin/friday_beer.php b/Private/Admin/FridayBeer.php similarity index 100% rename from private/admin/friday_beer.php rename to Private/Admin/FridayBeer.php diff --git a/private/admin/gavekort.php b/Private/Admin/Gavekort.php similarity index 100% rename from private/admin/gavekort.php rename to Private/Admin/Gavekort.php diff --git a/private/admin/isMember.php b/Private/Admin/IsMember.php similarity index 93% rename from private/admin/isMember.php rename to Private/Admin/IsMember.php index e09e602..5299408 100755 --- a/private/admin/isMember.php +++ b/Private/Admin/IsMember.php @@ -2,7 +2,7 @@ declare(strict_types=1); global $settings; -require_once("library/templates/modal.php"); +require_once("Library/Templates/Modal.php"); ?>
diff --git a/private/admin/member_register.php b/Private/Admin/MemberRegister.php similarity index 97% rename from private/admin/member_register.php rename to Private/Admin/MemberRegister.php index 310a779..725b34b 100755 --- a/private/admin/member_register.php +++ b/Private/Admin/MemberRegister.php @@ -2,7 +2,7 @@ declare(strict_types=1); global $settings; -require_once("library/templates/content.php"); +require_once("Library/Templates/Content.php"); print_content_header( "Membership requests " . date('Y'), diff --git a/private/admin/store.php b/Private/Admin/Store.php similarity index 99% rename from private/admin/store.php rename to Private/Admin/Store.php index dcbc459..d38fa4b 100755 --- a/private/admin/store.php +++ b/Private/Admin/Store.php @@ -2,7 +2,7 @@ declare(strict_types=1); global $settings; -require_once("library/templates/modal.php"); +require_once("Library/Templates/Modal.php"); // TODO: remove unused html classes // TODO: implement translations ?> diff --git a/private/admin/test.php b/Private/Admin/Test.php similarity index 83% rename from private/admin/test.php rename to Private/Admin/Test.php index 4d0d15b..bb9b264 100755 --- a/private/admin/test.php +++ b/Private/Admin/Test.php @@ -1,9 +1,9 @@ can_access("api", "volunteer")) { log::forbidden("Access denied", __FILE__, __LINE__); } diff --git a/private/api/enrollment.php b/Private/Api/Enrollment.php similarity index 99% rename from private/api/enrollment.php rename to Private/Api/Enrollment.php index e8faa5e..476ab02 100755 --- a/private/api/enrollment.php +++ b/Private/Api/Enrollment.php @@ -1,8 +1,8 @@ 99999999){ diff --git a/public/activities.php b/Public/Activities.php similarity index 91% rename from public/activities.php rename to Public/Activities.php index dc2e2ba..227c6b3 100755 --- a/public/activities.php +++ b/Public/Activities.php @@ -1,7 +1,7 @@ get_translation("mainHeader"), diff --git a/public/checkout.php b/Public/Checkout.php similarity index 97% rename from public/checkout.php rename to Public/Checkout.php index 7d5246f..45efacc 100755 --- a/public/checkout.php +++ b/Public/Checkout.php @@ -2,7 +2,7 @@ declare(strict_types=1); // Libs -require_once("library/util/store.php"); +require_once("Library/Util/Store.php"); global $settings; $store = new Store($language); diff --git a/public/enrollment.php b/Public/Enrollment.php similarity index 94% rename from public/enrollment.php rename to Public/Enrollment.php index 52a6728..1d62819 100755 --- a/public/enrollment.php +++ b/Public/Enrollment.php @@ -1,11 +1,11 @@ get_translation("mainHeader"), diff --git a/public/FAQ.php b/Public/FAQ.php similarity index 90% rename from public/FAQ.php rename to Public/FAQ.php index 0c5e112..0fd9305 100755 --- a/public/FAQ.php +++ b/Public/FAQ.php @@ -1,7 +1,7 @@ get_translation("mainHeader"), diff --git a/public/fredagspils.php b/Public/Fredagspils.php similarity index 100% rename from public/fredagspils.php rename to Public/Fredagspils.php diff --git a/public/mainpage.php b/Public/Mainpage.php similarity index 94% rename from public/mainpage.php rename to Public/Mainpage.php index 9b07923..0003f47 100755 --- a/public/mainpage.php +++ b/Public/Mainpage.php @@ -1,7 +1,7 @@ get_translation("mainHeader"), diff --git a/public/practices.php b/Public/Practices.php similarity index 88% rename from public/practices.php rename to Public/Practices.php index c87ab7f..617dbe7 100755 --- a/public/practices.php +++ b/Public/Practices.php @@ -1,7 +1,7 @@ get_translation("mainHeader"), diff --git a/public/store.php b/Public/Store.php similarity index 84% rename from public/store.php rename to Public/Store.php index 3f52274..5856095 100755 --- a/public/store.php +++ b/Public/Store.php @@ -1,9 +1,9 @@ get_translation("mainHeader"), diff --git a/docker-compose.yml b/docker-compose.yml index 9371fdb..20b315f 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,21 +21,21 @@ services: - ${DB_HOSTNAME} - self_signed_certificate volumes: - - ./private:/var/www/localhost/htdocs/private:ro - - ./public:/var/www/localhost/htdocs/public:ro - - ./js:/var/www/localhost/htdocs/js:ro - - ./css:/var/www/localhost/htdocs/css:ro - - ./assets:/var/www/localhost/htdocs/assets:ro - - ./library:/var/www/localhost/htdocs/library:ro - - ./assets:/var/www/localhost/assets:ro - - ./index.php:/var/www/localhost/htdocs/index.php:ro - ./.env:/var/www/localhost/htdocs/.env:ro + - ./assets:/var/www/localhost/assets:ro + - ./assets:/var/www/localhost/htdocs/assets:ro + - ./css:/var/www/localhost/htdocs/css:ro - ./docker/app/conf/.htaccess:/var/www/localhost/htdocs/.htaccess:ro - - ./docker/app/conf/settings.json:/var/www/localhost/htdocs/settings/settings.json:ro - ./docker/app/conf/httpd.conf:/etc/apache2/httpd.conf:ro - - ./docker/storage/vendor:/var/www/localhost/htdocs/vendor:ro - - ./docker/storage/self_signed_certificate/server.key:/etc/apache2/conf.d/server.key + - ./docker/app/conf/settings.json:/var/www/localhost/htdocs/settings/settings.json:ro - ./docker/storage/self_signed_certificate/server.crt:/etc/apache2/conf.d/server.crt + - ./docker/storage/self_signed_certificate/server.key:/etc/apache2/conf.d/server.key + - ./docker/storage/vendor:/var/www/localhost/htdocs/vendor:ro + - ./index.php:/var/www/localhost/htdocs/index.php:ro + - ./js:/var/www/localhost/htdocs/js:ro + - ./Library:/var/www/localhost/htdocs/Library:ro + - ./Private:/var/www/localhost/htdocs/Private:ro + - ./Public:/var/www/localhost/htdocs/Public:ro self_signed_certificate: build: diff --git a/index.php b/index.php index 004d481..72e4c0a 100755 --- a/index.php +++ b/index.php @@ -19,7 +19,7 @@ session_start(); // Load settings and environments -require_once("library/util/settings.php"); +require_once("Library/Util/Settings.php"); $settings = load_settings("./settings/settings.json"); $dotenv = Dotenv\Dotenv::createImmutable(__DIR__); @@ -37,58 +37,56 @@ )->notEmpty(); // Libraries -require_once("library/util/db.php"); -require_once("library/util/translator.php"); -require_once("library/util/access_control.php"); -require_once("library/util/request.php"); -require_once("library/util/log.php"); -require_once("library/util/authenticator.php"); +require_once("Library/Util/AccessControl.php"); +require_once("Library/Util/Authenticator.php"); +require_once("Library/Util/Db.php"); +require_once("Library/Util/Log.php"); +require_once("Library/Util/Request.php"); +require_once("Library/Util/Translator.php"); // Check write permissions test_settings(); // Get request -$language = argsURL("REQUEST", "lang"); -$page = argsURL("REQUEST", "side"); +$language = argsURL("REQUEST", "lang") ?? $settings["defaults"]["language"]; +$page = argsURL("REQUEST", "side") ?? $settings["defaults"]["landing-page"]; $action = argsURL("REQUEST", "action"); $user = argsURL("SESSION", "username"); -// Defaults -if ($language == "") $language = $settings["defaults"]["language"]; -if ($page == "") $page = $settings["defaults"]["landing-page"]; - // Translator $t = new Translator($page, $language); // Get access rules $access_control = new AccessControl($user); // handle the request if (isValidURL($page)) { + $page = ucfirst($page); + $action = ucfirst($action); switch ($page) { case "api": // file does not exist - if (!file_exists("private/api/$action.php")) { + if (!file_exists("Private/Api/$action.php")) { break; } - require_once("private/api/$action.php"); + require_once("Private/Api/$action.php"); return; default: // file does not exist - if (!file_exists("public/$page.php")) { + if (!file_exists("Public/$page.php")) { break; } // valid file, accept request - require_once("library/templates/header.php"); - require_once("public/$page.php"); - require_once("library/templates/footer.php"); + require_once("Library/Templates/Header.php"); + require_once("Public/$page.php"); + require_once("Library/Templates/Footer.php"); return; } } // Illegal request, page not found -require_once("library/templates/header.php"); -require_once("library/templates/not_found.php"); -require_once("library/templates/footer.php"); +require_once("Library/Templates/Header.php"); +require_once("Library/Templates/NotFound.php"); +require_once("Library/Templates/Footer.php"); return; diff --git a/js/admin/fredagspils.js b/js/admin/fredagspils.js index ec8fad0..871cb4f 100755 --- a/js/admin/fredagspils.js +++ b/js/admin/fredagspils.js @@ -1,6 +1,6 @@ "use strict"; function register(username) { - fetch(BASEURL + "/api/friday_beer?register=" + username) + fetch(BASEURL + "/api/fridayBeer?register=" + username) .then((response) => response.json()) .then((json) => { if (json.error && json.error != "Already drank beer") { From 8b0277bc95c035733e3807ce1b11fed92067f479 Mon Sep 17 00:00:00 2001 From: Pavel Skipenes Date: Fri, 8 Jul 2022 15:18:57 +0200 Subject: [PATCH 02/53] refactor(Settings class): Settings is now a class - transform global settings var into a singleton class - add input validation to settings - add type hinted getters for settings class - translator will no longer load the same translation file more than once - argsURL function will now return NULL instead of empty string - global settings variable now removed --- Library/Helpers/Admin.php | 2 +- Library/Templates/Content.php | 17 ++- Library/Templates/Footer.php | 3 +- Library/Templates/Header.php | 20 ++-- Library/Templates/Menu.php | 15 +-- Library/Templates/Modal.php | 4 +- Library/Templates/Store.php | 6 +- Library/Util/Db.php | 29 +++-- Library/Util/Enrollment.php | 15 ++- Library/Util/Log.php | 3 +- Library/Util/Request.php | 8 +- Library/Util/Settings.php | 185 ++++++++++++++++++++++++++----- Library/Util/Store.php | 6 +- Library/Util/Translator.php | 94 ++++++++-------- Private/Admin/Autopay.php | 3 +- Private/Admin/Cin.php | 21 ++-- Private/Admin/FridayBeer.php | 5 +- Private/Admin/Gavekort.php | 5 +- Private/Admin/IsMember.php | 3 +- Private/Admin/MemberRegister.php | 4 +- Private/Admin/Store.php | 7 +- Private/Admin/Test.php | 7 +- Private/Admin/Translations.php | 8 +- Private/Admin/Users.php | 5 +- Private/Admin/Volunteer.php | 5 +- Private/Api/Enrollment.php | 10 +- Private/Api/Inventory.php | 3 +- Private/Api/Translations.php | 3 +- Private/Api/UpdateKid.php | 3 +- Public/Admin.php | 2 +- Public/Checkout.php | 6 +- Public/Enrollment.php | 11 +- Public/{FAQ.php => Faq.php} | 0 Public/Mainpage.php | 2 +- Public/Store.php | 5 +- docker/app/conf/settings.json | 2 +- index.php | 46 +++----- 37 files changed, 342 insertions(+), 231 deletions(-) rename Public/{FAQ.php => Faq.php} (100%) diff --git a/Library/Helpers/Admin.php b/Library/Helpers/Admin.php index 90a7ab5..35491ca 100644 --- a/Library/Helpers/Admin.php +++ b/Library/Helpers/Admin.php @@ -123,7 +123,7 @@ function print_section($section) function access_link($page, $inline = false) { global $t, $access_control; - $page = strtolower($page); + $page = lcfirst($page); $link = $t->get_url("admin/$page"); $text = $t->get_translation("admin_$page"); $text = $text ? $text : $page; diff --git a/Library/Templates/Content.php b/Library/Templates/Content.php index 6e356aa..4af2e77 100755 --- a/Library/Templates/Content.php +++ b/Library/Templates/Content.php @@ -16,7 +16,6 @@ */ function print_content_block(string $header, string $description, string $image_path, string $image_text, string $email = "", string $image_class = "", string $image_license = "NTNUI (CC BY 4.0)") { - global $settings; ?>
contents"> @@ -33,7 +32,7 @@ function print_content_block(string $header, string $description, string $image_ if ($image_path && file_exists($image_path)) { ?>
- " alt=""> + " alt=""> get_baseurl() . "js/" . $caller . ".js"; + $css_path = $settings->get_baseurl() . "css/" . $caller . ".css"; + if (file_exists($js_path)) { - print(""); + print(""); } if (file_exists($css_path)) { - print(""); + print(""); } } diff --git a/Library/Templates/Footer.php b/Library/Templates/Footer.php index 81d0278..c350e02 100755 --- a/Library/Templates/Footer.php +++ b/Library/Templates/Footer.php @@ -7,8 +7,9 @@ get_baseurl() . "/" . $file; $name = basename($url, ".svg"); $link = $t->get_translation("link_$name", "sponsors"); diff --git a/Library/Templates/Header.php b/Library/Templates/Header.php index f69918e..c9c6ff7 100755 --- a/Library/Templates/Header.php +++ b/Library/Templates/Header.php @@ -4,7 +4,7 @@ global $t; global $page; -global $settings; +$settings = Settings::get_instance(); $title = $t->get_translation("page_title"); if ($title == "") $title = $t->get_translation($page); if ($title == "") $title = ucwords($page); @@ -19,26 +19,26 @@ NTNUI Svømming - <?php print $title; ?> - - - - - - - + + + + + + + - + diff --git a/Library/Templates/Menu.php b/Library/Templates/Menu.php index 9ec714d..0e517e2 100755 --- a/Library/Templates/Menu.php +++ b/Library/Templates/Menu.php @@ -2,15 +2,16 @@ declare(strict_types=1); -global $t, $settings, $page; +global $t, $page; +$settings = Settings::get_instance(); $t->load_translation('menu'); -function menu_entry($url, $name = '') +function menu_entry($url, $key = '') { global $t; - if ($name == '') $name = $url; + if ($key == '') $key = $url; $link = $t->get_url($url); - $title = $t->get_translation($name, 'menu'); + $title = $t->get_translation($key, 'menu'); print("
  • $title
  • "); } ?> @@ -21,15 +22,15 @@ function menu_entry($url, $name = '') menu_entry('activities'); menu_entry('enrollment'); menu_entry('board'); - menu_entry('FAQ'); + menu_entry('faq'); menu_entry('store'); ?>
  • - '> + '> get_translation('switchLanguage', 'menu') ?>
  • \ No newline at end of file diff --git a/Library/Templates/Modal.php b/Library/Templates/Modal.php index 336b99a..dff330e 100755 --- a/Library/Templates/Modal.php +++ b/Library/Templates/Modal.php @@ -2,8 +2,8 @@ declare(strict_types=1); -global $settings; -print(""); +$base_url = Settings::get_instance()->get_baseurl(); +print(""); ?> - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/Library/Util/Db.php b/Library/Util/Db.php index 535e0ef..6671ebf 100755 --- a/Library/Util/Db.php +++ b/Library/Util/Db.php @@ -10,12 +10,9 @@ class DB private mysqli $conn; public mysqli_stmt $stmt; /** - * Connect to a database. Credentials are automatically retrieved from global $settings. - * Create a new instance like so - * $conn = new DB(); - * @see __destruct method. It automatically disconnects form the database when this instance gets out of scope. + * Connect to a database. Credentials are automatically retrieved from environment variables. * @param string $database name - * @throws mysqli_sql_exception on failed connection + * @throws Exception on failed connection */ public function __construct(string $database) { @@ -28,7 +25,7 @@ public function __construct(string $database) # TODO: remove "svommer_" from table names in database $this->conn = new mysqli($hostname, $username, $password, "svommer_" . $database); if (!$this->conn->set_charset("utf8")) { - throw new mysqli_sql_exception("Failed to set charset"); + throw new Exception($this->conn->error); } } @@ -36,7 +33,7 @@ public function prepare(string $sql) { $this->stmt = $this->conn->prepare($sql); if (!$this->stmt) { - throw new mysqli_sql_exception("Could not prepare statement"); + throw new Exception($this->conn->error); } } @@ -44,21 +41,21 @@ public function bind_param(string $types, &$var1, &...$_) { $this->stmt->bind_param($types, $var1, ...$_); if (!$this->stmt) { - throw new mysqli_sql_exception("Could not bind params"); + throw new Exception($this->conn->error); } } public function execute() { if (!$this->stmt->execute()) { - throw new mysqli_sql_exception("Could not execute statement"); + throw new Exception($this->conn->error); } } public function store_result() { if (!$this->stmt->store_result()) { - throw new mysqli_sql_exception("Could not store result"); + throw new Exception($this->conn->error); } } @@ -83,7 +80,7 @@ public function execute_and_fetch(string $sql, string $types, &$var1, &...$_): a $this->execute(); $meta = $this->stmt->result_metadata(); if ($meta === false) { - throw new mysqli_sql_exception("Could not retrieve metadata"); + throw new Exception($this->conn->error); } $params = []; $row = []; @@ -111,14 +108,14 @@ public function execute_and_fetch(string $sql, string $types, &$var1, &...$_): a public function bind_result(&$var1, &...$_) { if (!$this->stmt->bind_result($var1, $_)) { - throw new mysqli_sql_exception($this->error); + throw new Exception($this->conn->error); } } public function fetch() { $ret = $this->stmt->fetch(); if ($ret === false) { - throw new mysqli_sql_exception("Could not fetch data"); + throw new Exception($this->conn->error); } return $ret; } @@ -132,7 +129,7 @@ public function reset() { $ret = $this->stmt->reset(); if ($ret === false) { - throw new mysqli_sql_exception("Could not reset statement"); + throw new Exception($this->conn->error); } return $ret; } @@ -145,12 +142,12 @@ public function __destruct() // close statement if present if (isset($this->stmt)) { if (!$this->stmt->close()) { - throw new mysqli_sql_exception("Could not close prepared statement"); + throw new Exception($this->conn->error); } } if (isset($this->conn)) { if (!$this->conn->close()) { - throw new mysqli_sql_exception("Could not close connection to db"); + throw new Exception($this->conn->error); } } } diff --git a/Library/Util/Enrollment.php b/Library/Util/Enrollment.php index 62b576d..038308f 100755 --- a/Library/Util/Enrollment.php +++ b/Library/Util/Enrollment.php @@ -2,16 +2,15 @@ declare(strict_types=1); -function enrollment_is_active(): bool +function enrollment_is_active(array $enrollment_settings): bool { - global $settings; - if ($settings["enrollment"]["open"] !== "auto") { - return $settings["enrollment"]["open"]; + if ($enrollment_settings["open"] !== "auto") { + return $enrollment_settings["open"]; } - $start_month = $settings["enrollment"]["start_month"]; - $start_day = $settings["enrollment"]["start_day"]; - $end_month = $settings["enrollment"]["end_month"]; - $end_day = $settings["enrollment"]["end_day"]; + $start_month = $enrollment_settings["start_month"]; + $start_day = $enrollment_settings["start_day"]; + $end_month = $enrollment_settings["end_month"]; + $end_day = $enrollment_settings["end_day"]; $date_format = "j F"; // day month $start_date = DateTime::createFromFormat($date_format, $start_day . " " . $start_month); diff --git a/Library/Util/Log.php b/Library/Util/Log.php index 43abd37..60f7691 100755 --- a/Library/Util/Log.php +++ b/Library/Util/Log.php @@ -21,12 +21,11 @@ static function message($message, $file = __FILE__, $line = __LINE__) // Crash the server, write a log and alert the developer about the incident. static function die($message, $file = __FILE__, $line = __LINE__, bool $api = false) { - global $settings; http_response_code(500); error_log(basename($file) . ":" . $line . " " . $message); error_log(print_r(debug_backtrace(), true)); mail( - $settings["emails"]["developer"], + Settings::get_instance()->get_email_address("developer"), "Error on web server", "Error occurred. Please check the logs. Have fun fixing bugs btw." ); diff --git a/Library/Util/Request.php b/Library/Util/Request.php index 251fa30..0486320 100755 --- a/Library/Util/Request.php +++ b/Library/Util/Request.php @@ -22,22 +22,22 @@ function argsURL($type, $key) { switch ($type) { case "REQUEST": - if (isset($_REQUEST[$key])) { + if (!empty($_REQUEST[$key])) { return $_REQUEST[$key]; } break; case "SESSION": - if (isset($_SESSION[$key])) { + if (!empty($_SESSION[$key])) { return $_SESSION[$key]; } break; case "GET": - if (isset($_GET[$key])) { + if (!empty($_GET[$key])) { return $_GET[$key]; } break; case "POST": - if (isset($_POST[$key])) { + if (!empty($_POST[$key])) { return $_POST[$key]; } break; diff --git a/Library/Util/Settings.php b/Library/Util/Settings.php index 24b7182..cb3d313 100755 --- a/Library/Util/Settings.php +++ b/Library/Util/Settings.php @@ -2,37 +2,172 @@ declare(strict_types=1); -function load_settings($path){ - $settings_raw = file_get_contents($path); - if(!$settings_raw){ - print("error reading settings file"); - die(); +class Settings +{ + private array $emails; + private array $enrollment_settings; + private string $base_url; + private string $landing_page; + private string $language; + private string $license_product_hash; + private string $translation_directory; + private const COOKIE_LIFETIME = 14400; // 4 hours + private self $instance = NULL; + + + /** + * Create a new instance of Settings class. First call will run constructor + * and require @param $config_path. Subsequent calls will not use @param + * $config_path + * + * @param string|null $config_path path to `settings.json`. Required on first call. + * @return self the instance of Settings class + */ + public static function get_instance(?string $config_path = NULL): self + { + if (empty(self::$instance)) { + self::$instance = new self($config_path); + } + return self::$instance; } - $settings = json_decode($settings_raw,true); - if($settings == ""){ - print("empty settings file"); - die(); + private function __construct(string $path) + { + if (!file_exists($path)) { + throw new Exception("file $path does not exists"); + } + + $file_content = file_get_contents($path); + if (!$file_content) { + throw new Exception("could not read contents of $path"); + } + + $decoded = json_decode($file_content, true, flags: JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR); + $REQUIRED_KEYS = [ + "emails", + "baseurl", + "translations_dir", + "emails", + "enrollment", + "defaults", + "license_product_hash", + ]; + foreach ($REQUIRED_KEYS as $key) { + if (!array_key_exists($key, $decoded)) { + throw new Exception("key $key does not exists in settings"); + } + } + $REQUIRED_EMAIL_ROLES = [ + "analyst", + "bot", + "coach", + "developer", + "leader", + ]; + if (0 !== strpos($decoded["baseurl"], "https://")) { + throw new Exception("decoded[baseurl] does not start with 'https://'. This will break links. decoded[baseurl] contains: " . $decoded["baseurl"]); + } + $this->base_url = $decoded["baseurl"]; + + $emails_array = $decoded["emails"]; + foreach ($REQUIRED_EMAIL_ROLES as $role) { + if (!array_key_exists($role, $emails_array)) { + throw new Exception("key $role does not exists in emails"); + } + if (NULL === filter_var($emails_array[$role], FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) { + throw new Exception("email " . $emails_array[$role] . " is not valid for role $role"); + } + } + $this->emails = $emails_array; + + $REQUIRED_DEFAULT_KEYS = [ + "landing-page", + "language", + ]; + foreach ($REQUIRED_DEFAULT_KEYS as $key) { + if (!array_key_exists($key, $decoded["defaults"])) { + throw new Exception("key $key does not exists in settings['defaults']"); + } + } + $this->language = $decoded["defaults"]["language"]; + $this->landing_page = $decoded["defaults"]["landing-page"]; + + $this->enrollment_settings = $decoded["enrollment"]; + $this->license_product_hash = $decoded["license_product_hash"]; + $this->translation_directory = $decoded["translations_dir"]; } - if(0 !== strpos($settings["baseurl"], "https://")){ - throw new Exception("Error: settings[hosting][baseurl] does not start with 'https://'. This will break links. settings[hosting][baseurl] contains: ". $settings["baseurl"]); + + public function init_session(): void + { + $err = session_save_path("sessions"); + if ($err === false) { + throw new Exception("could not start session"); + } + $err = session_set_cookie_params(["lifetime" => self::COOKIE_LIFETIME]); + if ($err === false) { + throw new Exception("could not start session"); + } + $err = ini_set("session.gc_maxlifetime", (string)self::COOKIE_LIFETIME); + if ($err === false) { + throw new Exception("could not start session"); + } + $err = ini_set("session.gc_probability", "1"); + if ($err === false) { + throw new Exception("could not start session"); + } + $err = ini_set("session.gc_divisor", "100"); + if ($err === false) { + throw new Exception("could not start session"); + } + $err = session_start(); + if ($err === false) { + throw new Exception("could not start session"); + } } - return $settings; -} -function test_settings(){ - // test access - foreach(["img/store", "/tmp", "sessions", "translations"] as $dir){ - if (!is_writable($dir)){ - log::die("$dir is not writable", __FILE__, __LINE__); + public function test_settings(): void + { + // test access + foreach (["img/store", "/tmp", "sessions", "translations"] as $dir) { + if (!is_writable($dir)) { + throw new Exception("$dir is not writable"); + } + } + foreach (["css", "js", "Library", "Private", "Public", "vendor", "assets"] as $dir) { + if (!is_readable($dir)) { + throw new Exception("$dir is not readable"); + } } } - foreach(["css", "js", "Library", "Private", "Public", "vendor", "assets"] as $dir){ - if (!is_readable($dir)){ - log::die("$dir is not readable", __FILE__, __LINE__); + public function get_language(): string + { + return $this->language; + } + public function get_landing_page(): string + { + return $this->landing_page; + } + public function get_baseurl(): string + { + return $this->base_url; + } + public function get_email_address(string $role): string + { + if (!array_key_exists($role, ["developer", "analyst", "coach", "bot", "leader"])) { + throw new Exception("email does not exists"); } + return $this->emails[$role]; } - // -} - -?> + public function get_enrollment(): array + { + return $this->enrollment_settings; + } + public function get_license_product_hash(): string + { + return $this->license_product_hash; + } + public function get_translations_dir(): string + { + return $this->translation_directory; + } +}; diff --git a/Library/Util/Store.php b/Library/Util/Store.php index a2986d8..1ce2d7e 100755 --- a/Library/Util/Store.php +++ b/Library/Util/Store.php @@ -12,10 +12,9 @@ class Store private $license_key; function __construct($lang) { - global $settings; \Stripe\Stripe::setApiKey($_ENV["STRIPE_SECRET_KEY"]); $this->language = $lang; - $this->license_key = $settings["license_product_hash"]; + $this->license_key = Settings::get_instance()->get_license_product_hash(); } /** @@ -627,8 +626,7 @@ function create_order(string $product_hash, string $payment_method_id, object $c } if ($price >= 2000) { // 2000 NOK failsafe - global $settings; - mail($settings["email"]["developer"], "Charge blocked", "A charge of $price NOK has been blocked. Check the logs"); + mail(Settings::get_instance()->get_email_address("developer"), "Charge blocked", "A charge of $price NOK has been blocked. Check the logs"); throw \StoreException::PriceError("Cannot charge this amount. Contact developers if this is a mistake"); } diff --git a/Library/Util/Translator.php b/Library/Util/Translator.php index 67f9246..9708e09 100755 --- a/Library/Util/Translator.php +++ b/Library/Util/Translator.php @@ -1,93 +1,97 @@ page = lcfirst($page); - $this->language = $lang; $this->load_translation($this->page); } - public function load_translation($page) + public function load_translation(string $page): void { $page = lcfirst($page); - $file = "$this->directory/$page.json"; - - if ($page == "api") { + if ($page === "api") { + return; + } + if (!empty($this->translations[$page])) { + log::message("translations for $page is already loaded", __FILE__, __LINE__); + // translations already loaded return; } + $file = "$this->directory/$page.json"; if (!file_exists($file)) { log::message("Warning: Requesting a non existing page: $page", __FILE__, __LINE__); return; } - - $decoded = json_decode(file_get_contents($file)); + $file_content = file_get_contents($file); + if ($file_content === false) { + log::message("Warning: Could not read file contents", __FILE__, __LINE__); + return; + } + // json_decode needs increased depth. Otherwise some translations will not load + $decoded = json_decode($file_content, true, depth: 2024, flags: JSON_OBJECT_AS_ARRAY); if ($decoded === NULL) { - log::message("Warning: Could not decode json file: $file, for page: $page", __FILE__, __LINE__); + log::message(json_last_error_msg(), __FILE__, __LINE__); return; } $this->translations[$page] = $decoded; } - public function get_translation($key, $page = ""): string + public function get_translation(string $key, ?string $page = NULL): string { + if (empty($page)) { + $page = $this->page; + } $page = lcfirst($page); - $ret = ""; $language = $this->language; - if ($page == "") { - $page = $this->page; - } + $ret = ""; // if translations for this page is not loaded, try to load them. - if (!isset($this->translations[$page])) { + if (empty($this->translations[$page])) { $this->load_translation($page); } - // if translations for this page is still not loaded return. - if (!isset($this->translations[$page])) { - // loading translation for a file that does not exist - return ""; + // if translations for this page is still not loaded throw an exception. + if (empty($this->translations[$page])) { + throw new Exception("Could not load translation for page $page"); } $translations_this_page = $this->translations[$page]; // try to get requested language - if (property_exists($translations_this_page->$language, $key)) { - $ret = $translations_this_page->$language->$key; - } - - // if requested language is not set use norwegian as fallback - if ($ret == "") { - if (property_exists($translations_this_page->no, $key)) { - $ret = $translations_this_page->no->$key; - } - } - - if ($ret == "") { + if (array_key_exists($key, $translations_this_page[$language])) { + $ret = $translations_this_page[$language][$key]; + } elseif (array_key_exists($key, $translations_this_page["no"])) { + // norwegian as fallback + $ret = $translations_this_page["no"][$key]; + } else { log::message("Warning: page: $page does not have translations for $key", __FILE__, __LINE__); $ret = ""; } - - // Expand array keys - if (is_array($ret)) { - return implode("\n", $ret); - } return $ret; } - public function get_url($url) + public function get_url(string $page_name): string { - global $settings; - $ret = $settings["baseurl"] . "/"; - if ($this->language != "no") $ret .= $this->language . "/"; - return $ret . ($url == "mainpage" ? "" : $url); + $ret = Settings::get_instance()->get_baseurl() . "/"; + if ($this->language != "no") { + $ret .= $this->language . "/"; + } + return $ret . ($page_name === "mainpage" ? "" : $page_name); } } diff --git a/Private/Admin/Autopay.php b/Private/Admin/Autopay.php index a7b6363..2cf8654 100755 --- a/Private/Admin/Autopay.php +++ b/Private/Admin/Autopay.php @@ -1,10 +1,9 @@ - +

    Generate Kantu script for bank transfer

    diff --git a/Private/Admin/Cin.php b/Private/Admin/Cin.php index 2782e0f..79f9485 100755 --- a/Private/Admin/Cin.php +++ b/Private/Admin/Cin.php @@ -1,25 +1,24 @@ - - + +
    -

    Generate UI Vision script for bank transfer

    +

    Generate UI Vision script for bank transfer

    - - + + - + - Total pending payments: 0
    - - + Total pending payments: 0
    + +
    diff --git a/Private/Admin/FridayBeer.php b/Private/Admin/FridayBeer.php index 06085ec..56fdc94 100755 --- a/Private/Admin/FridayBeer.php +++ b/Private/Admin/FridayBeer.php @@ -1,7 +1,6 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/Private/Admin/Gavekort.php b/Private/Admin/Gavekort.php index 3410ef2..55677fb 100755 --- a/Private/Admin/Gavekort.php +++ b/Private/Admin/Gavekort.php @@ -1,7 +1,6 @@
    @@ -23,5 +22,5 @@
    - - \ No newline at end of file + \ No newline at end of file diff --git a/Private/Admin/MemberRegister.php b/Private/Admin/MemberRegister.php index 725b34b..d81cc54 100755 --- a/Private/Admin/MemberRegister.php +++ b/Private/Admin/MemberRegister.php @@ -1,7 +1,6 @@ DATE('y') ORDER BY id DESC"; @@ -70,4 +68,4 @@ function createTime($year, $month, $day) } ?> - \ No newline at end of file + \ No newline at end of file diff --git a/Private/Admin/Store.php b/Private/Admin/Store.php index d38fa4b..3cce8cd 100755 --- a/Private/Admin/Store.php +++ b/Private/Admin/Store.php @@ -1,18 +1,17 @@ - + - +