diff --git a/README.md b/README.md index 6e68a70..28c89d5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Currently very much a work in progress, but it's baically functional. Deploy the `/tkr` directory to a web server that supports php. It will work either as the root of a (sub)domain (e.g. tky.mydomain.com) or if served from a subdirectory (e.g. mydomain.com/tkr). -If you serve it from a subdirectory, set the value of `$basePath` in `/app/config.php` to the subdirectory name, excluding the trailing slash (e.g. `/tkr`) +If you serve it from a subdirectory, set the value of `$basePath` in `/app/Config.php` to the subdirectory name, excluding the trailing slash (e.g. `/tkr`) It provides an rss feed at `/rss` relative to where it's being served (e.g. `/tkr/rss` if served from `/tkr/`). Each rss entry links to an individual post (which I call "ticks"). diff --git a/tkr/bootstrap.php b/tkr/bootstrap.php index b5c2aa1..1594fee 100644 --- a/tkr/bootstrap.php +++ b/tkr/bootstrap.php @@ -1,7 +1,8 @@ getTimezone()); + $diff = $now->diff($datetime); + + if ($diff->y > 0) { + return $diff->y . ' year' . ($diff->y > 1 ? 's' : '') . ' ago'; + } + if ($diff->m > 0) { + return $diff->m . ' month' . ($diff->m > 1 ? 's' : '') . ' ago'; + } + if ($diff->d > 0) { + return $diff->d . ' day' . ($diff->d > 1 ? 's' : '') . ' ago'; + } + if ($diff->h > 0) { + return $diff->h . ' hour' . ($diff->h > 1 ? 's' : '') . ' ago'; + } + if ($diff->i > 0) { + return $diff->i . ' minute' . ($diff->i > 1 ? 's' : '') . ' ago'; + } + return $diff->s . ' second' . ($diff->s != 1 ? 's' : '') . ' ago'; +} diff --git a/tkr/public/admin.php b/tkr/public/admin.php index 1f8c011..c5fadd0 100644 --- a/tkr/public/admin.php +++ b/tkr/public/admin.php @@ -3,14 +3,14 @@ require_once __DIR__ . '/../bootstrap.php'; confirm_setup(); -require_once LIB_ROOT . '/config.php'; -require LIB_ROOT . '/session.php'; +require_once CLASSES_DIR . '/Config.php'; +require LIB_DIR . '/session.php'; if (!$isLoggedIn){ header('Location: ' . $config->basePath . 'login.php'); } -require LIB_ROOT . '/user.php'; +require CLASSES_DIR . '/User.php'; $config = Config::load(); $user = User::load(); diff --git a/tkr/public/css/tkr.css b/tkr/public/css/tkr.css index 78dea3c..73d39a7 100644 --- a/tkr/public/css/tkr.css +++ b/tkr/public/css/tkr.css @@ -8,13 +8,17 @@ body { color: black; } +a { + font-weight: bold; +} + /* The two common display options for responsive layouts are flex and grid. flex (aka Flexbox) aligns items either horizontally or vertically. grid can align items in two dimensions. grid also allows more precise positioning of elements, so I'm using that. */ -.container { +.home-container { display: grid; } @@ -25,7 +29,7 @@ body { Once the width exceeds that (e.g. desktops), it will convert to horizontal alignment */ @media (min-width: 600px) { - .container { + .home-container { grid-template-columns: 1fr 2fr; grid-gap: 2em; } @@ -143,3 +147,15 @@ body { background-color: #ddeeff; outline: 2px solid #339; } + +#timezones { + max-height: 300px; + overflow-y: auto; + border: 1px solid #ccc; + padding: 1em; +} + +.timezone-option { + display: block; + margin-bottom: 0.5em; +} diff --git a/tkr/public/index.php b/tkr/public/index.php index 0baa4a5..d6afff5 100644 --- a/tkr/public/index.php +++ b/tkr/public/index.php @@ -3,11 +3,11 @@ require_once __DIR__ . '/../bootstrap.php'; confirm_setup(); -require_once LIB_ROOT . '/config.php'; -require_once LIB_ROOT . '/user.php'; -require LIB_ROOT . '/session.php'; -require LIB_ROOT . '/ticks.php'; -require LIB_ROOT . '/util.php'; +require_once CLASSES_DIR . '/Config.php'; +require_once CLASSES_DIR . '/User.php'; +require LIB_DIR . '/session.php'; +require LIB_DIR . '/ticks.php'; +require LIB_DIR . '/util.php'; $config = Config::load(); // I can get away with this before login because there's only one user. @@ -28,9 +28,20 @@ $ticks = iterator_to_array(stream_ticks($limit, $offset)); -
-