Some checks failed
Run unit tests / run-unit-tests (push) Has been cancelled
Since the base URL and base path are user inputs, I'd like tkr to be resilient to any combination of leading and trailing slashes so people don't have to worry about that. This adds some helper functions to normalize URLs and adds tests to confirm that all combinations are handled correctly. Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/38 Co-authored-by: Greg Sarjeant <greg@subcultureofone.org> Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
55 lines
2.6 KiB
PHP
55 lines
2.6 KiB
PHP
<?php /** @var bool $isLoggedIn */ ?>
|
|
<?php /** @var ConfigModel $config */ ?>
|
|
<?php /** @var UserModel $user */ ?>
|
|
<?php /** @var string $tickList */ ?>
|
|
<div class="home-container">
|
|
<aside id="sidebar" class="home-sidebar">
|
|
<dl class="profile-data">
|
|
<dt>Current Status</dt>
|
|
<dd class="profile-greeting">
|
|
<span class="profile-greeting-content">
|
|
<span class="profile-greeting-content-text">Hi, I'm <?php echo Util::escape_html($user->displayName) ?></span>
|
|
<span class="profile-greeting-content-mood"><?php echo Util::escape_html($user->mood) ?></span>
|
|
</span>
|
|
<?php if (Session::isLoggedIn()): ?>
|
|
<a
|
|
<?php if($config->strictAccessibility): ?>tabindex="0"<?php endif; ?>
|
|
href="<?= Util::escape_html(Util::buildRelativeUrl($config->basePath, 'mood')) ?>"
|
|
class="change-mood">Change mood</a>
|
|
<?php endif ?>
|
|
</dd>
|
|
<?php if (!empty($user->about)): ?>
|
|
<dt>About</dt>
|
|
<dd class="profile-about">
|
|
<?php echo Util::escape_html($user->about) ?>
|
|
</dd>
|
|
<?php endif ?>
|
|
<?php if (!empty($user->website)): ?>
|
|
<dt>Website</dt>
|
|
<dd class="profile-website">
|
|
<?php echo Util::linkify(Util::escape_html($user->website)) ?>
|
|
</dd>
|
|
<?php endif ?>
|
|
</dl>
|
|
<?php if (Session::isLoggedIn()): ?>
|
|
<div class="profile-tick">
|
|
<form class="profile-tick-form" method="post">
|
|
<input type="hidden" name="csrf_token" value="<?= Util::escape_html($_SESSION['csrf_token']) ?>">
|
|
<input type="hidden" name="tick_mood" value="<?= Util::escape_html($user->mood) ?>">
|
|
<textarea name="new_tick"
|
|
aria-label="What's ticking?"
|
|
placeholder="What's ticking?"
|
|
minlength="1"
|
|
maxlength="200"
|
|
rows="3"></textarea>
|
|
<button type="submit" class="submit-btn">Tick</button>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
</aside>
|
|
<main id="ticks">
|
|
<h1 class="site-description"><?= Util::escape_html($config->siteDescription) ?></h1>
|
|
<?php echo $tickList ?>
|
|
</main>
|
|
</div>
|