From 0df40f3cfd92f9cf00db602604fe9b77830841a2 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 27 Apr 2024 14:11:31 -0400 Subject: [PATCH] Add version to page header --- src/public/assets/style.css | 6 ++++++ src/start.php | 13 +++++++++--- src/util/user.php | 41 +++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/public/assets/style.css b/src/public/assets/style.css index 9518ea3..ef5f9e9 100644 --- a/src/public/assets/style.css +++ b/src/public/assets/style.css @@ -30,6 +30,12 @@ header { font-size: 1.5rem; } + .version { + font-size: .85rem; + padding-left: .5rem; + color: rgba(255, 255, 255, .75); + } + a:link, a:visited { color: white; } diff --git a/src/start.php b/src/start.php index ba8a5a3..f2caea0 100644 --- a/src/start.php +++ b/src/start.php @@ -43,7 +43,14 @@ function add_info(string $message): void { * @param string $title The title of the page being displayed */ function page_head(string $title): void { - ?> + if (str_ends_with(FRC_VERSION, '.0.0')) { + $version = substr(FRC_VERSION, 0, strlen(FRC_VERSION) - 4); + } elseif (str_ends_with(FRC_VERSION, '.0')) { + $version = substr(FRC_VERSION, 0, strlen(FRC_VERSION) - 2); + } else { + $version = FRC_VERSION; + } ?> + @@ -52,7 +59,7 @@ function page_head(string $title): void {
- Feed Reader Central +
Feed Reader Centralv
Add Feed | Log Off'; @@ -75,7 +82,7 @@ function page_head(string $title): void { * Render the end of the page */ function page_foot(): void { - ?>'; session_commit(); } diff --git a/src/util/user.php b/src/util/user.php index 3244963..03d27c0 100644 --- a/src/util/user.php +++ b/src/util/user.php @@ -5,26 +5,6 @@ require __DIR__ . '/../cli-start.php'; cli_title('USER MAINTENANCE'); -/** - * Display the options for this utility and exit - */ -#[NoReturn] -function display_help(): void { - printfn('Options:'); - printfn(' - add-user [e-mail] [password]'); - printfn(' Adds a new user to this instance'); - printfn(' - set-password [e-mail] [password]'); - printfn(' Sets the password for the given user'); - printfn(' - delete-user [e-mail]'); - printfn(' Deletes a user and all their data' . PHP_EOL); - printfn('To assist with migrating from single-user to multi-user mode:'); - printfn(' - migrate-single-user [e-mail] [password]'); - printfn(' Changes the e-mail address and password for the single-user mode user'); - printfn(' - remove-single-user'); - printfn(' Removes the single-user mode user and its data'); - exit(0); -} - if ($argc < 2) display_help(); switch ($argv[1]) { @@ -65,11 +45,32 @@ switch ($argv[1]) { } +/** + * Display the options for this utility and exit + */ +#[NoReturn] +function display_help(): void { + printfn('Options:'); + printfn(' - add-user [e-mail] [password]'); + printfn(' Adds a new user to this instance'); + printfn(' - set-password [e-mail] [password]'); + printfn(' Sets the password for the given user'); + printfn(' - delete-user [e-mail]'); + printfn(' Deletes a user and all their data' . PHP_EOL); + printfn('To assist with migrating from single-user to multi-user mode:'); + printfn(' - migrate-single-user [e-mail] [password]'); + printfn(' Changes the e-mail address and password for the single-user mode user'); + printfn(' - remove-single-user'); + printfn(' Removes the single-user mode user and its data'); + exit(0); +} + /** * Add a new user */ function add_user(): void { global $argv; + $db = Data::getConnection(); try {