From a3a6471cedffde9ad08cbd5f3235ebc305ccf586 Mon Sep 17 00:00:00 2001 From: Greg Sarjeant <1686767+gsarjeant@users.noreply.github.com> Date: Tue, 17 Jun 2025 22:08:50 -0400 Subject: [PATCH] Remove a bunch of trailing whitespace. --- .htaccess | 2 +- README.md | 2 +- config/bootstrap.php | 4 +- examples/apache/shared-hosting/.htaccess | 2 +- .../apache/vps/root/tkr.my-domain.com.conf | 8 +-- .../vps/root/tkr.my-domain.com.ssl.conf | 8 +-- .../apache/vps/subfolder/my-domain.com.conf | 22 ++++---- .../vps/subfolder/my-domain.com.ssl.conf | 24 ++++----- examples/nginx/root/nginx.conf | 8 +-- examples/nginx/root/nginx.ssl.conf | 8 +-- examples/nginx/subfolder/nginx.conf | 8 +-- examples/nginx/subfolder/nginx.ssl.conf | 10 ++-- public/css/tkr.css | 54 +++++++++---------- .../AdminController/AdminController.php | 20 +++---- .../AuthController/AuthController.php | 4 +- src/Controller/Controller.php | 2 +- .../CssController/CssController.php | 14 ++--- .../MoodController/MoodController.php | 4 +- .../TickController/TickController.php | 2 +- src/Framework/Util/Util.php | 4 +- src/Model/ConfigModel/ConfigModel.php | 4 +- src/Model/TickModel/TickModel.php | 8 +-- src/Model/UserModel/UserModel.php | 2 +- templates/feed/rss.php | 2 +- templates/main.php | 4 +- templates/partials/admin.php | 10 ++-- templates/partials/css.php | 14 ++--- templates/partials/emoji.php | 6 +-- templates/partials/home.php | 2 +- 29 files changed, 131 insertions(+), 131 deletions(-) diff --git a/.htaccess b/.htaccess index c57d4fa..9fd4083 100644 --- a/.htaccess +++ b/.htaccess @@ -39,7 +39,7 @@ RewriteCond %{REQUEST_URI} !^/css/custom/ RewriteRule ^css/tkr\.css$ public/css/tkr.css [L] # 404 all other static files (images, js, fonts, etc.) -# so those requests don't hit the PHP app +# so those requests don't hit the PHP app # (this is to reduce load on the PHP app from bots and scanners) RewriteRule \.(js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|pdf|zip|mp3|mp4|avi|mov)$ - [R=404,L] diff --git a/README.md b/README.md index bd9b5b2..348f032 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ A lightweight, HTML-only status feed for self-hosted personal websites. Written * PHP 8.2+ with the PDO and PDO_SQLITE extensions * The PDO and PDO_SQLITE extensions are usually included by default * This might work with earlier PHP versions, but I've only tested 8.2 - + ## Installation 1. Download the latest tkr archive from https://subcultureofone.org/files/tkr/tkr.0.6.0.zip diff --git a/config/bootstrap.php b/config/bootstrap.php index 71951bb..5302ec2 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -18,12 +18,12 @@ define('DB_FILE', DATA_DIR . '/tkr.sqlite'); // Define an exception for validation errors class SetupException extends Exception { private $setupIssue; - + public function __construct(string $message, string $setupIssue = '', int $code = 0, Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->setupIssue = $setupIssue; } - + public function getSetupIssue(): string { return $this->setupIssue; } diff --git a/examples/apache/shared-hosting/.htaccess b/examples/apache/shared-hosting/.htaccess index c57d4fa..9fd4083 100644 --- a/examples/apache/shared-hosting/.htaccess +++ b/examples/apache/shared-hosting/.htaccess @@ -39,7 +39,7 @@ RewriteCond %{REQUEST_URI} !^/css/custom/ RewriteRule ^css/tkr\.css$ public/css/tkr.css [L] # 404 all other static files (images, js, fonts, etc.) -# so those requests don't hit the PHP app +# so those requests don't hit the PHP app # (this is to reduce load on the PHP app from bots and scanners) RewriteRule \.(js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|pdf|zip|mp3|mp4|avi|mov)$ - [R=404,L] diff --git a/examples/apache/vps/root/tkr.my-domain.com.conf b/examples/apache/vps/root/tkr.my-domain.com.conf index 334225e..afd8c06 100644 --- a/examples/apache/vps/root/tkr.my-domain.com.conf +++ b/examples/apache/vps/root/tkr.my-domain.com.conf @@ -9,13 +9,13 @@ # Replace localhost with your subdomain, e.g. tkr.my-domain.com ServerName localhost DocumentRoot /var/www/tkr/public - + # Security headers Header always set X-Frame-Options "SAMEORIGIN" Header always set X-XSS-Protection "1; mode=block" Header always set X-Content-Type-Options "nosniff" Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" - + # Block access to sensitive directories Require all denied @@ -44,7 +44,7 @@ Alias /css/tkr.css /var/www/tkr/public/css/tkr.css # 404 all non-css static files (images, js, fonts, etc.) - # so those requests don't hit the PHP app + # so those requests don't hit the PHP app # (this is to reduce load on the PHP app from bots and scanners) @@ -69,7 +69,7 @@ RewriteCond %{REQUEST_URI} !^/css/custom/ RewriteRule ^css/tkr\.css$ css/tkr.css [L] - # Everything else to front controller + # Everything else to front controller RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] diff --git a/examples/apache/vps/root/tkr.my-domain.com.ssl.conf b/examples/apache/vps/root/tkr.my-domain.com.ssl.conf index d1d967f..eb07edb 100644 --- a/examples/apache/vps/root/tkr.my-domain.com.ssl.conf +++ b/examples/apache/vps/root/tkr.my-domain.com.ssl.conf @@ -24,13 +24,13 @@ # Replace with the actual paths to your cert and key SSLCertificateFile /etc/letsencrypt/live/tkr.my-domain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/tkr.my-domain.com/privkey.pem - + # Security headers Header always set X-Frame-Options "SAMEORIGIN" Header always set X-XSS-Protection "1; mode=block" Header always set X-Content-Type-Options "nosniff" Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" - + # Block access to sensitive directories Require all denied @@ -59,7 +59,7 @@ Alias /css/tkr.css /var/www/tkr/public/css/tkr.css # 404 all non-css static files (images, js, fonts, etc.) - # so those requests don't hit the PHP app + # so those requests don't hit the PHP app # (this is to reduce load on the PHP app from bots and scanners) @@ -84,7 +84,7 @@ RewriteCond %{REQUEST_URI} !^/css/custom/ RewriteRule ^css/tkr\.css$ css/tkr.css [L] - # Everything else to front controller + # Everything else to front controller RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] diff --git a/examples/apache/vps/subfolder/my-domain.com.conf b/examples/apache/vps/subfolder/my-domain.com.conf index 5c6989b..a7287f9 100644 --- a/examples/apache/vps/subfolder/my-domain.com.conf +++ b/examples/apache/vps/subfolder/my-domain.com.conf @@ -9,18 +9,18 @@ # Replace localhost with your subdomain, e.g. tkr.my-domain.com ServerName localhost DocumentRoot /var/www/html - + # Security headers Header always set X-Frame-Options "SAMEORIGIN" Header always set X-XSS-Protection "1; mode=block" Header always set X-Content-Type-Options "nosniff" Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" - + # tkr Application at /tkr # NOTE: If you change the directory name, - # remember to update all instances of /var/www/tkr in this file to match + # remember to update all instances of /var/www/tkr in this file to match Alias /tkr /var/www/tkr/public - + # Block access to sensitive TKR directories Require all denied @@ -34,28 +34,28 @@ Require all denied - + # 404 all non-css static files in /tkr (images, js, fonts, etc.) - # so those requests don't hit the PHP app + # so those requests don't hit the PHP app # (this is to reduce load on the PHP app from bots and scanners) Require all denied - + # tkr application directory Options -Indexes AllowOverride None Require all granted - + RewriteEngine On - + # Block direct PHP access RewriteCond %{THE_REQUEST} \s/[^?\s]*\.php[\s?] [NC] RewriteRule ^.*$ - [R=404,L] - + # Serve the one static file that exists: css/tkr.css # (Pass requests to css/custom/ through to the PHP app) RewriteCond %{REQUEST_URI} !^/tkr/css/custom/ @@ -66,7 +66,7 @@ RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] - + # Error and access logs ErrorLog ${APACHE_LOG_DIR}/my-domain_error.log CustomLog ${APACHE_LOG_DIR}/my-domain_access.log combined diff --git a/examples/apache/vps/subfolder/my-domain.com.ssl.conf b/examples/apache/vps/subfolder/my-domain.com.ssl.conf index 22b8ffa..53ff1c1 100644 --- a/examples/apache/vps/subfolder/my-domain.com.ssl.conf +++ b/examples/apache/vps/subfolder/my-domain.com.ssl.conf @@ -17,7 +17,7 @@ # Replace localhost with your subdomain, e.g. tkr.my-domain.com ServerName localhost DocumentRoot /var/www/html - + # SSL Configuration SSLEngine on @@ -25,18 +25,18 @@ # Replace with the actual paths to your cert and key SSLCertificateFile /etc/letsencrypt/live/my-domain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/my-domain.com/privkey.pem - + # Security headers Header always set X-Frame-Options "SAMEORIGIN" Header always set X-XSS-Protection "1; mode=block" Header always set X-Content-Type-Options "nosniff" Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" - + # tkr Application at /tkr # NOTE: If you change the directory name, - # remember to update all instances of /var/www/tkr in this file to match + # remember to update all instances of /var/www/tkr in this file to match Alias /tkr /var/www/tkr/public - + # Block access to sensitive TKR directories Require all denied @@ -50,28 +50,28 @@ Require all denied - + # 404 all non-css static files in /tkr (images, js, fonts, etc.) - # so those requests don't hit the PHP app + # so those requests don't hit the PHP app # (this is to reduce load on the PHP app from bots and scanners) Require all denied - + # tkr application directory Options -Indexes AllowOverride None Require all granted - + RewriteEngine On - + # Block direct PHP access RewriteCond %{THE_REQUEST} \s/[^?\s]*\.php[\s?] [NC] RewriteRule ^.*$ - [R=404,L] - + # Serve the one static file that exists: css/tkr.css # (Pass requests to css/custom/ through to the PHP app) RewriteCond %{REQUEST_URI} !^/tkr/css/custom/ @@ -82,7 +82,7 @@ RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] - + # Error and access logs ErrorLog ${APACHE_LOG_DIR}/my-domain_error.log CustomLog ${APACHE_LOG_DIR}/my-domain_access.log combined diff --git a/examples/nginx/root/nginx.conf b/examples/nginx/root/nginx.conf index 74c65ba..2282843 100644 --- a/examples/nginx/root/nginx.conf +++ b/examples/nginx/root/nginx.conf @@ -10,7 +10,7 @@ server { # replace localhost with your subdomain # e.g. tkr.my-domain.com server_name localhost; - + root /var/www/tkr/public; index index.php; @@ -63,7 +63,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; @@ -73,7 +73,7 @@ server { # (these are bots and scanners) location ~ ^/.+\.php$ { return 404; - } + } # forward other requests to the fallback block, # which sends them to php-fpm for handling @@ -88,7 +88,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; diff --git a/examples/nginx/root/nginx.ssl.conf b/examples/nginx/root/nginx.ssl.conf index 3208bcb..c680602 100644 --- a/examples/nginx/root/nginx.ssl.conf +++ b/examples/nginx/root/nginx.ssl.conf @@ -17,7 +17,7 @@ server { # Replace with the actual paths to your cert and key ssl_certificate /etc/letsencrypt/live/tkr.my-domain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/tkr.my-domain.com/privkey.pem; - + root /var/www/tkr/public; index index.php; @@ -61,7 +61,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; @@ -71,7 +71,7 @@ server { # (these are bots and scanners) location ~ ^/.+\.php$ { return 404; - } + } # forward other requests to the fallback block, # which sends them to php-fpm for handling @@ -86,7 +86,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; diff --git a/examples/nginx/subfolder/nginx.conf b/examples/nginx/subfolder/nginx.conf index 8352289..b6f8d84 100644 --- a/examples/nginx/subfolder/nginx.conf +++ b/examples/nginx/subfolder/nginx.conf @@ -12,7 +12,7 @@ server { # replace localhost with your subdomain # e.g. tkr.my-domain.com server_name localhost; - + root /var/www/html; index index.html; @@ -65,7 +65,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; @@ -75,7 +75,7 @@ server { # (these are bots and scanners) location ~ ^/tkr/.+\.php$ { return 404; - } + } # forward other requests to the fallback block, # which sends them to php-fpm for handling @@ -87,7 +87,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; diff --git a/examples/nginx/subfolder/nginx.ssl.conf b/examples/nginx/subfolder/nginx.ssl.conf index a5b5076..71718a8 100644 --- a/examples/nginx/subfolder/nginx.ssl.conf +++ b/examples/nginx/subfolder/nginx.ssl.conf @@ -8,11 +8,11 @@ server { listen 443 ssl; listen [::]:443 ssl; - + # Replace localhost with your domain # e.g. my-domain.com server_name localhost; - + root /var/www/html; index index.html; @@ -56,7 +56,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; @@ -66,7 +66,7 @@ server { # (these are bots and scanners) location ~ ^/tkr/.+\.php$ { return 404; - } + } # forward other requests to the fallback block, # which sends them to php-fpm for handling @@ -78,7 +78,7 @@ server { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME /var/www/tkr/public/index.php; include fastcgi_params; - + fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; diff --git a/public/css/tkr.css b/public/css/tkr.css index ae92a33..3624f2a 100644 --- a/public/css/tkr.css +++ b/public/css/tkr.css @@ -8,7 +8,7 @@ --color-primary-light: #bae6fd; --color-primary-lighter: #ebf8ff; --color-primary-lightest: #f0f9ff; - + /* Text colors */ --color-text-primary: #374151; --color-text-secondary: #1e40af; @@ -16,25 +16,25 @@ --color-text-muted: gray; --color-text-black: black; --color-text-dark: #333; - + /* Background colors */ --color-bg-body: whitesmoke; --color-bg-white: white; --color-bg-light: #fefefe; --color-bg-file: #f8fafc; - + /* Border colors */ --color-border-light: #e5e7eb; --color-border-medium: #d1d5db; --color-border-file: #cbd5e0; - + /* State colors */ --color-required: #dc2626; --color-hover-light: #dbeafe; --color-hover-medium: #bfdbfe; --color-emoji-bg: #ddeeff; --color-emoji-border: #339; - + /* Shadow colors */ --shadow-primary: rgba(66, 153, 225, 0.1); --shadow-primary-strong: rgba(66, 153, 225, 0.3); @@ -108,9 +108,9 @@ h1.site-description { width: auto; } -input[type="text"], -input[type="number"], -input[type="password"], +input[type="text"], +input[type="number"], +input[type="password"], textarea, select { width: 100%; @@ -124,9 +124,9 @@ select { box-sizing: border-box; } -input[type="text"]:focus, -input[type="number"]:focus, -input[type="password"]:focus, +input[type="text"]:focus, +input[type="number"]:focus, +input[type="password"]:focus, textarea:focus, select:focus { outline: none; @@ -205,14 +205,14 @@ label.description { .navbar { overflow: visible; - background: var(--color-bg-white); + background: var(--color-bg-white); display: flex; align-items: center; } .navbar a { font-size: 16px; - color: var(--color-text-secondary); + color: var(--color-text-secondary); text-align: center; padding: 14px 16px; text-decoration: none; @@ -229,9 +229,9 @@ label.description { box-shadow: 0 0 0 2px var(--shadow-primary); } -/* +/* Using details/summary tags to build dropdowm nmenus. - They have to be clicked open and closed, but they allow + They have to be clicked open and closed, but they allow me to have semantically appropriate pure HTML dropdowms that work on mobile devices. */ @@ -241,7 +241,7 @@ label.description { } .dropdown summary.dropbtn { - font-size: 16px; + font-size: 16px; border: none; border-radius: 0px; outline: none; @@ -424,13 +424,13 @@ label.description { /* Styling for flash messages */ .flash-messages { - background: var(--color-bg-white); + background: var(--color-bg-white); margin-top: 10px; padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px var(--shadow-primary); } - + .flash-message { padding: 12px 16px; margin: 5px 0; @@ -462,7 +462,7 @@ label.description { border-left-color: var(--color-flash-info-border-left); color: var(--color-flash-info); } - + .fieldset-items { margin-bottom: 14px; display: grid; @@ -532,7 +532,7 @@ label.description { } .tick-time { - color: var(--color-text-muted); + color: var(--color-text-muted); font-size: 0.8em; margin-bottom: 0.4em; } @@ -543,9 +543,9 @@ label.description { display: block; } -.tick-pagination a { - margin: 0 5px; - text-decoration: none; +.tick-pagination a { + margin: 0 5px; + text-decoration: none; } .emoji-option input { @@ -616,7 +616,7 @@ label.description { box-shadow: 0 0 0 2px var(--shadow-primary); } -/* +/* Responsive layout - adjusts from 1 to 2 columns based on screen width - min-width makes the mobile (stacked) view the default - 600px covers most mobile devices in portrait mode @@ -633,7 +633,7 @@ label.description { padding-top: 10px; margin-bottom: 0; } - + .home-container { grid-template-columns: 1fr 2fr; grid-gap: 2em; @@ -646,7 +646,7 @@ label.description { gap: 16px; align-items: start; } - + .file-info { grid-column: 2; } @@ -654,7 +654,7 @@ label.description { .navbar { flex-wrap: wrap; } - + .dropdown-menu { position: fixed; left: 1em; diff --git a/src/Controller/AdminController/AdminController.php b/src/Controller/AdminController/AdminController.php index 869f89c..7bbd735 100644 --- a/src/Controller/AdminController/AdminController.php +++ b/src/Controller/AdminController/AdminController.php @@ -51,13 +51,13 @@ class AdminController extends Controller { // handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $errors = []; - + // UserModel profile $username = trim($_POST['username'] ?? ''); $displayName = trim($_POST['display_name'] ?? ''); $about = trim($_POST['about'] ?? ''); $website = trim($_POST['website'] ?? ''); - + // Site settings $siteTitle = trim($_POST['site_title']) ?? ''; $siteDescription = trim($_POST['site_description']) ?? ''; @@ -68,7 +68,7 @@ class AdminController extends Controller { // Password $password = $_POST['password'] ?? ''; $confirmPassword = $_POST['confirm_password'] ?? ''; - + // Validate user profile if (!$username) { $errors[] = "Username is required."; @@ -87,7 +87,7 @@ class AdminController extends Controller { $errors[] = "URL must start with http:// or https://."; } } - + // Validate site settings if (!$siteTitle) { $errors[] = "Site title is required."; @@ -98,12 +98,12 @@ class AdminController extends Controller { if ($itemsPerPage < 1 || $itemsPerPage > 50) { $errors[] = "Items per page must be a number between 1 and 50."; } - + // If a password was sent, make sure it matches the confirmation if ($password && !($password === $confirmPassword)){ $errors[] = "Passwords do not match"; } - + // Validation complete if (empty($errors)) { // Update site settings @@ -112,21 +112,21 @@ class AdminController extends Controller { $config->baseUrl = $baseUrl; $config->basePath = $basePath; $config->itemsPerPage = $itemsPerPage; - + // Save site settings and reload config from database // TODO - raise and handle exception on failure $config = $config->save(); - + // Update user profile $user->username = $username; $user->displayName = $displayName; $user->about = $about; $user->website = $website; - + // Save user profile and reload user from database // TODO - raise and handle exception on failure $user = $user->save(); - + // Update the password if one was sent // TODO - raise and handle exception on failure if($password){ diff --git a/src/Controller/AuthController/AuthController.php b/src/Controller/AuthController/AuthController.php index 4efbfcd..b13264b 100644 --- a/src/Controller/AuthController/AuthController.php +++ b/src/Controller/AuthController/AuthController.php @@ -19,13 +19,13 @@ class AuthController extends Controller { if ($_SERVER['REQUEST_METHOD'] === 'POST') { $username = $_POST['username'] ?? ''; $password = $_POST['password'] ?? ''; - + // TODO: move into user model global $db; $stmt = $db->prepare("SELECT id, username, password_hash FROM user WHERE username = ?"); $stmt->execute([$username]); $user = $stmt->fetch(); - + if ($user && password_verify($password, $user['password_hash'])) { session_regenerate_id(true); // TODO: move into session.php diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index 6c26b94..043acf2 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -24,5 +24,5 @@ class Controller { extract($vars, EXTR_SKIP); include $templatePath; - } + } } \ No newline at end of file diff --git a/src/Controller/CssController/CssController.php b/src/Controller/CssController/CssController.php index 32660fa..44f80cf 100644 --- a/src/Controller/CssController/CssController.php +++ b/src/Controller/CssController/CssController.php @@ -76,7 +76,7 @@ class CssController extends Controller { http_response_code(400); exit("Cannot delete default theme"); } - + // Get the data for the selected CSS file $cssId = $_POST['selectCssFile']; $cssModel = new CssModel(); @@ -87,7 +87,7 @@ class CssController extends Controller { http_response_code(400); exit("No entry found for css id $cssId"); } - + // get the filename $cssFilename = $cssRow["filename"]; @@ -151,7 +151,7 @@ class CssController extends Controller { // Validate file extension $filename = $file['name']; $fileExtension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - + if ($fileExtension !== 'css') { throw new Exception('File must have a .css extension'); } @@ -186,7 +186,7 @@ class CssController extends Controller { // Add upload to database $cssModel = new CssModel(); $cssModel->save($safeFilename, $description); - + // Set success flash message Session::setFlashMessage('success', 'Theme uploaded as ' . $safeFilename); @@ -200,11 +200,11 @@ class CssController extends Controller { private function validateCssContent($content) { // Remove comments $content = preg_replace('/\/\*.*?\*\//s', '', $content); - + // Basic CSS validation - check for balanced braces $openBraces = substr_count($content, '{'); $closeBraces = substr_count($content, '}'); - + if ($openBraces !== $closeBraces) { throw new Exception('Invalid CSS: Unbalanced braces detected'); } @@ -261,7 +261,7 @@ class CssController extends Controller { // Remove path information and dangerous characters $fileName = basename($originalName); $fileName = preg_replace('/[^a-zA-Z0-9._-]/', '_', $fileName); - + return $fileName; } diff --git a/src/Controller/MoodController/MoodController.php b/src/Controller/MoodController/MoodController.php index 3a23912..c15cfae 100644 --- a/src/Controller/MoodController/MoodController.php +++ b/src/Controller/MoodController/MoodController.php @@ -11,7 +11,7 @@ 'config' => $config, 'moodPicker' => $moodPicker, ]; - + $this->render("mood.php", $vars); } @@ -33,7 +33,7 @@ // set or clear the mood $user->mood = $mood; $user = $user->save(); - + // go back to the index and show the updated mood header('Location: ' . $config->basePath); exit; diff --git a/src/Controller/TickController/TickController.php b/src/Controller/TickController/TickController.php index 22ddc61..c708799 100644 --- a/src/Controller/TickController/TickController.php +++ b/src/Controller/TickController/TickController.php @@ -4,7 +4,7 @@ class TickController extends Controller{ // every tick is identified by its timestamp public function index(string $year, string $month, string $day, string $hour, string $minute, string $second){ $model = new TickModel(); - $tick = $model->get($year, $month, $day, $hour, $minute, $second); + $tick = $model->get($year, $month, $day, $hour, $minute, $second); $this->render('tick.php', $tick); } } \ No newline at end of file diff --git a/src/Framework/Util/Util.php b/src/Framework/Util/Util.php index 54af536..4a74b97 100644 --- a/src/Framework/Util/Util.php +++ b/src/Framework/Util/Util.php @@ -24,7 +24,7 @@ class Util { }, $text ); - } + } // For relative time display, compare the stored time to the current time // and display it as "X seconds/minutes/hours/days etc." ago @@ -59,6 +59,6 @@ class Util { [$year, $month, $day] = $dateParts; [$hour, $minute, $second] = $timeParts; - return "$year/$month/$day/$hour/$minute/$second"; + return "$year/$month/$day/$hour/$minute/$second"; } } \ No newline at end of file diff --git a/src/Model/ConfigModel/ConfigModel.php b/src/Model/ConfigModel/ConfigModel.php index f111c39..4735d70 100644 --- a/src/Model/ConfigModel/ConfigModel.php +++ b/src/Model/ConfigModel/ConfigModel.php @@ -36,11 +36,11 @@ class ConfigModel { if (empty($this->cssId)) { return null; } - + // Fetch filename from css table using cssId $cssModel = new CssModel(); $cssRecord = $cssModel->getById($this->cssId); - + return $cssRecord ? $cssRecord['filename'] : null; } diff --git a/src/Model/TickModel/TickModel.php b/src/Model/TickModel/TickModel.php index bcfe9cc..d8b44a7 100644 --- a/src/Model/TickModel/TickModel.php +++ b/src/Model/TickModel/TickModel.php @@ -20,7 +20,7 @@ class TickModel { // split the path to the current file into the date components $pathParts = explode('/', str_replace('\\', '/', $file)); - // assign the different components to the appropriate part of the date + // assign the different components to the appropriate part of the date $year = $pathParts[count($pathParts) - 3]; $month = $pathParts[count($pathParts) - 2]; $day = pathinfo($pathParts[count($pathParts) - 1], PATHINFO_FILENAME); @@ -75,18 +75,18 @@ class TickModel { $content = $time . "|" . $tick . "\n"; file_put_contents($filename, $content, FILE_APPEND); } - + public static function get(string $y, string $m, string $d, string $H, string $i, string $s): array{ $tickTime = new DateTime("$y-$m-$d $H:$i:$s"); $timestamp = "$H:$i:$s"; $file = TICKS_DIR . "/$y/$m/$d.txt"; - + if (!file_exists($file)) { http_response_code(404); echo "Tick not found: $file."; exit; } - + $lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($lines as $line) { if (str_starts_with($line, $timestamp)) { diff --git a/src/Model/UserModel/UserModel.php b/src/Model/UserModel/UserModel.php index ca07c76..d6676bc 100644 --- a/src/Model/UserModel/UserModel.php +++ b/src/Model/UserModel/UserModel.php @@ -46,7 +46,7 @@ class UserModel { // loading the password into memory public function set_password(string $password): void { global $db; - + $hash = password_hash($password, PASSWORD_DEFAULT); $stmt = $db->prepare("UPDATE user SET password_hash=? WHERE id=1"); $stmt->execute([$hash]); diff --git a/templates/feed/rss.php b/templates/feed/rss.php index 294516d..cfef4ac 100644 --- a/templates/feed/rss.php +++ b/templates/feed/rss.php @@ -12,7 +12,7 @@ echo '' . "\n"; <?php echo Util::escape_xml($config->siteTitle . 'RSS Feed') ?> baseUrl . $config->basePath)?> - siteDescription) ?> diff --git a/templates/main.php b/templates/main.php index 2d96a0c..e5b2d5d 100644 --- a/templates/main.php +++ b/templates/main.php @@ -18,11 +18,11 @@ + href="baseUrl . $config->basePath)?>feed/rss/"> + href="baseUrl . $config->basePath)?>feed/atom/"> diff --git a/templates/partials/admin.php b/templates/partials/admin.php index e81a52c..e5ef650 100644 --- a/templates/partials/admin.php +++ b/templates/partials/admin.php @@ -4,7 +4,7 @@

SetupAdmin

@@ -16,7 +16,7 @@ value="username) ?>" required> - @@ -36,7 +36,7 @@ - + Change password
-