diff options
author | Jonas Kohl | 2024-10-17 10:56:01 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-10-17 10:56:01 +0200 |
commit | fe0f414dc0211a4014581dc03fcfd514ed7ed02d (patch) | |
tree | cd86fc00cd9b7a97eabb9668e0a39e2b4b3e5357 /src/application/views | |
parent | e0e89b9fdbf301e0ead944636023947a67aca57d (diff) |
Transition templating to Twig
Diffstat (limited to 'src/application/views')
28 files changed, 0 insertions, 1447 deletions
diff --git a/src/application/views/alert_error.php b/src/application/views/alert_error.php deleted file mode 100644 index e3b48ba..0000000 --- a/src/application/views/alert_error.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -if (str_starts_with($message, "?!HTML::")) - $message = substr($message, 8); -else - $message = htmlentities($message); -?> -<div class="alert alert-danger" role="alert"> -<span class="fa fa-exclamation-circle" aria-hidden="true"></span> -<?= $message; ?> -</div> diff --git a/src/application/views/alert_info.php b/src/application/views/alert_info.php deleted file mode 100644 index 7bf2e7b..0000000 --- a/src/application/views/alert_info.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php -if (str_starts_with($message, "?!HTML::")) - $message = substr($message, 8); -else - $message = htmlentities($message); -?> -<div class="alert alert-info" role="alert"> -<?= $message; ?> -</div> diff --git a/src/application/views/alert_success.php b/src/application/views/alert_success.php deleted file mode 100644 index de3e023..0000000 --- a/src/application/views/alert_success.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php -if (str_starts_with($message, "?!HTML::")) - $message = substr($message, 8); -else - $message = htmlentities($message); -?> -<div class="alert alert-success" role="alert"> -<?= $message; ?> -</div> diff --git a/src/application/views/form_addpost.php b/src/application/views/form_addpost.php deleted file mode 100644 index b2fb2f2..0000000 --- a/src/application/views/form_addpost.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<h3 id="form"><?= __("Reply to this topic") ?></h3> -<?php -if (($_formError = RequestUtils::getAndClearFormError("addpost")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>#form" method="post" enctype="multipart/form-data"> -<input type="hidden" name="form_id" value="addpost"> -<div class="form-group"> - <label for="i_message"><?= __("Message:") ?></label> - <div class="panel panel-default"> - <div class="panel-heading" style="padding:4px"> - <div class="btn-toolbar" role="toolbar"> - <div class="btn-group" role="group"> - <button data-area="#i_message" title="<?= __("Bold") ?>" data-editor-command="bold" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-bold"></i></button> - <button data-area="#i_message" title="<?= __("Italic") ?>" data-editor-command="italic" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-italic"></i></button> - <button data-area="#i_message" title="<?= __("Underlined") ?>" data-editor-command="underline" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-underline"></i></button> - <button data-area="#i_message" title="<?= __("Strikethrough") ?>" data-editor-command="strikethrough" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-strikethrough"></i></button> - </div> - <div class="btn-group" role="group"> - <button data-area="#i_message" title="<?= __("Superscript") ?>" data-editor-command="sup" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-superscript"></i></button> - <button data-area="#i_message" title="<?= __("Subscript") ?>" data-editor-command="sub" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-subscript"></i></button> - </div> - <div class="btn-group" role="group"> - <button data-area="#i_message" title="<?= __("Quote") ?>" data-editor-command="quote" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-quote-left"></i></button> - <button data-area="#i_message" title="<?= __("Spoiler") ?>" data-editor-command="spoiler" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-eye"></i></button> - </div> - </div> - </div> - <div class="panel-body" style="padding:0"> - <textarea class="form-control" id="i_message" name="message" required rows="12" cols="60" style="resize:vertical;max-height:499px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;margin:-1px;width:calc(100% + 2px)"></textarea> - </div> - </div> -</div> -<div class="form-group"> - <label for="i_files"><?= __("Attachments: <small>(max. %max_attachment_count% files, max. %max_attachment_size% MiB each)</small>", [ - "max_attachment_count" => strval(MAX_ATTACHMENT_COUNT), - "max_attachment_size" => strval(MAX_ATTACHMENT_SIZE >> 20) - ]) ?></label> - <input type="file" name="files[]" id="i_files" multiple accept="*/*"> -</div> -<button type="submit" class="btn btn-success"><?= __("Post reply") ?> <span class="fa fa-send" aria-hidden="true"></span></button> -</form> diff --git a/src/application/views/form_delete_post_confirm.php b/src/application/views/form_delete_post_confirm.php deleted file mode 100644 index e127235..0000000 --- a/src/application/views/form_delete_post_confirm.php +++ /dev/null @@ -1,26 +0,0 @@ -<div class="panel panel-danger"> - <div class="panel-heading"> - <h3 class="panel-title"><?= __("Do you want to delete this post?") ?></h3> - </div> - <div class="panel-body"> - <?= __("Are you sure you want to delete the following post:") ?><br> - <?php _view("view_post", [ - ...$___PARAMS, - "hide_actions" => true - ]) ?> - </div> - <div class="panel-footer"> - <div class="text-right"> - <form action=".#post-<?= htmlentities(urlencode($post->id)) ?>" method="get" class="seamless-inline"> - <input type="hidden" name="_action" value="viewtopic"> - <input type="hidden" name="topic" value="<?= htmlentities($post->topicId) ?>"> - <button class="btn btn-default"><?= __("Keep post") ?></button> - </form> - <form action="?_action=deletepost" method="post" class="seamless-inline"> - <input type="hidden" name="post" value="<?= htmlentities($post->id) ?>"> - <input type="hidden" name="confirm" value="<?= htmlentities(base64_encode(hash("sha256", "confirm" . $post->id, true))); ?>"> - <button class="btn btn-danger"><?= __("Delete post") ?></button> - </form> - </div> - </div> -</div> diff --git a/src/application/views/form_delete_topic_confirm.php b/src/application/views/form_delete_topic_confirm.php deleted file mode 100644 index 4f9deec..0000000 --- a/src/application/views/form_delete_topic_confirm.php +++ /dev/null @@ -1,24 +0,0 @@ -<div class="panel panel-danger"> - <div class="panel-heading"> - <h3 class="panel-title"><?= __("Do you want to delete this topic?") ?></h3> - </div> - <div class="panel-body"> - <?= __("Are you sure you want to delete the topic <em>%topic%</em> including <strong>all posts and attachments</strong>?", [ - "topic" => htmlentities($topic->title), - ]) ?> - </div> - <div class="panel-footer"> - <div class="text-right"> - <form action="." method="get" class="seamless-inline"> - <input type="hidden" name="_action" value="viewtopic"> - <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> - <button class="btn btn-default"><?= __("Keep topic") ?></button> - </form> - <form action="?_action=deletetopic" method="post" class="seamless-inline"> - <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> - <input type="hidden" name="confirm" value="<?= htmlentities(base64_encode(hash("sha256", "confirm" . $topic->id, true))); ?>"> - <button class="btn btn-danger"><?= __("Delete topic & posts") ?></button> - </form> - </div> - </div> -</div> diff --git a/src/application/views/form_login.php b/src/application/views/form_login.php deleted file mode 100644 index 5fa79ad..0000000 --- a/src/application/views/form_login.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -use mystic\forum\Messaging; -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<div class="page-header margin-top-0"> - <h1><?= __("Log in") ?></h1> -</div> -<div class="col-md-4"></div> -<div class="well col-md-4"> -<?php -if (($_formError = RequestUtils::getAndClearFormError("login")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post"> -<input type="hidden" name="form_id" value="login"> -<input type="hidden" name="token" value="<?= htmlentities($token) ?>"> -<input type="hidden" name="sig" value="<?= htmlentities($signature) ?>"> -<div class="form-group"> - <label for="i_username"><?= __("Username:") ?></label> - <input class="form-control" type="text" id="i_username" name="username" value="<?= htmlentities($lastForm["username"] ?? "") ?>" required autofocus> -</div> - -<div class="form-group"> - <label for="i_password"><?= __("Password:") ?></label> - <input class="form-control" type="password" id="i_password" name="password" required> -</div> - -<div class="form-group"> - <button class="btn btn-primary" type="submit"><?= __("Log in") ?></button> - <a class="btn btn-link" href="?_action=pwreset"><?= __("I forgot my password") ?></a> -</div> - -<?php if (REGISTRATION_ENABLED): ?> -<div class="form-group"> - <?= __("Don't have an account? %link%Register now%/link%", [ - "link" => '<a href="?_action=register">', - "/link" => '</a>', - ]) ?> -</div> -<?php endif; ?> -</form> -</div> -<div class="col-md-4"></div> diff --git a/src/application/views/form_new_password.php b/src/application/views/form_new_password.php deleted file mode 100644 index 7431bd5..0000000 --- a/src/application/views/form_new_password.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<div class="page-header margin-top-0"> - <h1><?= __("Reset password") ?></h1> -</div> -<div class="col-md-4"></div> -<div class="well col-md-4"> -<?php -if (($_formError = RequestUtils::getAndClearFormError("pwnew")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post"> -<input type="hidden" name="form_id" value="pwnew"> -<div class="form-group"> - <label for="i_new_password"><?= __("New password:") ?></label> - <input class="form-control" type="password" id="i_new_password" name="new_password" required autofocus> -</div> - -<div class="form-group"> - <label for="i_retype_password"><?= __("Retype password:") ?></label> - <input class="form-control" type="password" id="i_retype_password" name="retype_password" required> -</div> - -<div class="form-group"> - <button class="btn btn-primary" type="submit"><?= __("Set new password") ?></button> -</div> -</form> -</div> -<div class="col-md-4"></div> diff --git a/src/application/views/form_newtopic.php b/src/application/views/form_newtopic.php deleted file mode 100644 index e7050c7..0000000 --- a/src/application/views/form_newtopic.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -use mystic\forum\Messaging; -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<div class="page-header margin-top-0"> - <h1><?= __("New topic") ?></h1> -</div> -<?php -if (($_formError = RequestUtils::getAndClearFormError("newtopic")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>#form" method="post" enctype="multipart/form-data"> -<input type="hidden" name="form_id" value="newtopic"> -<div class="form-group"> - <label for="i_message"><?= __("Topic title:") ?></label> - <input type="text" class="form-control" id="i_title" name="title" value="<?= htmlentities($lastForm["title"] ?? "") ?>" required autofocus> -</div> -<div class="form-group"> - <label for="i_message"><?= __("Message:") ?></label> - <div class="panel panel-default"> - <div class="panel-heading" style="padding:4px"> - <div class="btn-toolbar" role="toolbar"> - <div class="btn-group" role="group"> - <button data-area="#i_message" title="<?= __("Bold") ?>" data-editor-command="bold" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-bold"></i></button> - <button data-area="#i_message" title="<?= __("Italic") ?>" data-editor-command="italic" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-italic"></i></button> - <button data-area="#i_message" title="<?= __("Underlined") ?>" data-editor-command="underline" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-underline"></i></button> - <button data-area="#i_message" title="<?= __("Strikethrough") ?>" data-editor-command="strikethrough" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-strikethrough"></i></button> - </div> - <div class="btn-group" role="group"> - <button data-area="#i_message" title="<?= __("Superscript") ?>" data-editor-command="sup" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-superscript"></i></button> - <button data-area="#i_message" title="<?= __("Subscript") ?>" data-editor-command="sub" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-subscript"></i></button> - </div> - <div class="btn-group" role="group"> - <button data-area="#i_message" title="<?= __("Quote") ?>" data-editor-command="quote" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-quote-left"></i></button> - <button data-area="#i_message" title="<?= __("Spoiler") ?>" data-editor-command="spoiler" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-eye"></i></button> - </div> - </div> - </div> - <div class="panel-body" style="padding:0"> - <textarea class="form-control" id="i_message" name="message" required rows="12" cols="60" style="resize:vertical;max-height:499px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;margin:-1px;width:calc(100% + 2px)"><?= htmlentities($lastForm["message"] ?? "") ?></textarea> - </div> - </div> -</div> -<div class="form-group"> - <label for="i_files"><?= __("Attachments: <small>(max. %max_attachment_count% files, max. %max_attachment_size% MiB each)</small>", [ - "max_attachment_count" => strval(MAX_ATTACHMENT_COUNT), - "max_attachment_size" => strval(MAX_ATTACHMENT_SIZE >> 20) - ]) ?></label> - <input type="file" name="files[]" id="i_files" multiple accept="*/*"> -</div> -<button type="submit" class="btn btn-success"><?= __("Create topic") ?> <span class="fa fa-send" aria-hidden="true"></span></button> -</form> diff --git a/src/application/views/form_password_reset.php b/src/application/views/form_password_reset.php deleted file mode 100644 index 57d8ed2..0000000 --- a/src/application/views/form_password_reset.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -use mystic\forum\Messaging; -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<div class="page-header margin-top-0"> - <h1><?= __("Reset password") ?></h1> -</div> -<div class="col-md-4"></div> -<div class="well col-md-4"> -<?php -if (($_formError = RequestUtils::getAndClearFormError("pwreset")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post"> -<input type="hidden" name="form_id" value="pwreset"> -<div class="form-group"> - <label for="i_username"><?= __("Email address:") ?></label> - <input class="form-control" type="email" id="i_email" name="email" value="<?= htmlentities($lastForm["email"] ?? "") ?>" required autofocus> -</div> - -<div class="form-group"> - <button class="btn btn-primary" type="submit"><?= __("Reset password") ?></button> -</div> - -<div class="form-group"> - <?= __("I know my password and I want to %link%log in%/link%!", [ - "link" => '<a href="?_action=auth">', - "/link" => '</a>', - ]) ?> -</div> -</form> -</div> -<div class="col-md-4"></div> diff --git a/src/application/views/form_register.php b/src/application/views/form_register.php deleted file mode 100644 index 54da2c4..0000000 --- a/src/application/views/form_register.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -use mystic\forum\Messaging; -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<div class="page-header margin-top-0"> - <h1><?= __("Register") ?></h1> -</div> -<div class="col-md-4"></div> -<div class="well col-md-4"> -<?php -if (($_formError = RequestUtils::getAndClearFormError("register")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post"> -<input type="hidden" name="form_id" value="register"> -<div class="form-group" id="group0"> - <label for="i_username"><?= __("Username:") ?></label> - <input class="form-control" id="i_username" type="text" name="username" value="" required> -</div> - -<div class="form-group" id="group1"> - <label for="i_username"><?= __("Username:") ?></label> - <input class="form-control" id="i_username" type="text" name="df82a9bc21" value="<?= htmlentities($lastForm["df82a9bc21"] ?? "") ?>" required autofocus> -</div> - -<div class="form-group" id="group2"> - <label for="i_display_name"><?= __("Display name:") ?></label> - <input class="form-control" id="i_display_name" type="text" name="display_name" value="<?= htmlentities($lastForm["display_name"] ?? "") ?>" required> -</div> - -<div class="form-group" id="group3"> - <label for="i_password"><?= __("Choose password:") ?></label> - <input class="form-control" id="i_password" type="password" name="password" required> -</div> - -<div class="form-group" id="group4"> - <label for="i_password_retype"><?= __("Repeat password:") ?></label> - <input class="form-control" id="i_password_retype" type="password" name="password_retype" required> -</div> - -<div class="form-group" id="group5"> - <label for="i_email"><?= __("Email address:") ?></label> - <input class="form-control" id="i_email" type="email" name="email" value="<?= htmlentities($lastForm["email"] ?? "") ?>" required> -</div> - -<div class="form-group" id="group6"> - <label for="i_email"><?= __("CAPTCHA:") ?></label> - <div class="text-center margin-bottom"> - <img src="?_action=captcha&t=<?= htmlentities(strval(microtime(true) * 1000)) ?>" alt="CAPTCHA" width="192" height="48" id="captcha-img"> - </div> - <div class="input-group"> - <input type="text" name="captcha" id="i_captcha" class="form-control" required> - <div class="input-group-btn"> - <button class="btn btn-default" type="button" id="btn-refresh-captcha"><span class="fa fa-refresh" aria-hidden="true"></span><span class="sr-only"><?= __("New CAPTCHA") ?></span></button> - </div> - </div> -</div> - -<div class="form-group"> - <button class="btn btn-primary" type="submit"><?= __("Register now") ?></button> -</div> - -<div class="form-group"> - <?= __("Already have an account? %link%Sign in now%/link%", [ - "link" => '<a href="?_action=auth">', - "/link" => '</a>', - ]) ?> -</div> -</form> -</div> -<div class="col-md-4"></div> - -<script> -$(function() { - $("#btn-refresh-captcha").click(function() { - $("#captcha-img").attr("src", "?_action=captcha&t=" + new Date().getTime().toString()); - }); - $("#i_username").prop("disabled", true).prop("required", false); -}); -</script> diff --git a/src/application/views/form_search.php b/src/application/views/form_search.php deleted file mode 100644 index 394a0e7..0000000 --- a/src/application/views/form_search.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -use mystic\forum\utils\RequestUtils; - -$lastFormUri = ""; -$lastForm = RequestUtils::getLastForm($lastFormUri) ?? []; -if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; -RequestUtils::clearLastForm(); - -?> -<div class="page-header margin-top-0"> - <h1><?= __("Search") ?></h1> -</div> -<?php -if (($_formError = RequestUtils::getAndClearFormError("search")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="." method="get"> - <input type="hidden" name="form_id" value="search"> - <input type="hidden" name="_action" value="search"> - <div class="form-group"> - <div class="input-group"> - <input class="form-control" type="search" id="i_query" name="query" value="<?= htmlentities($lastForm["query"] ?? $query ?? "") ?>" required autofocus placeholder="<?= htmlentities(__("Enter your search query...")) ?>"> - <div class="input-group-btn"> - <button class="btn btn-primary" type="submit"><?= __("Search") ?></button> - </div> - </div> - </div> -</form> diff --git a/src/application/views/nav_guest.php b/src/application/views/nav_guest.php deleted file mode 100644 index 95c236e..0000000 --- a/src/application/views/nav_guest.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -$nextParam = ""; - -switch ($GLOBALS["action"]) { - case "auth": - case "register": - $nextParam = $_GET["next"] ?? ""; - break; - default: - $nextParam = $_SERVER["REQUEST_URI"]; -} - -if ($GLOBALS["action"] === "login") - -?> -<ul class="nav navbar-nav navbar-right"> -<li<?= $GLOBALS["action"] === "search" ? ' class="active"' : '' ?>><a href="?_action=search"><span class="fa fa-search" aria-hidden="true"></span><span class="sr-only"><?= __("Search") ?></span></a></li> -<li<?= $GLOBALS["action"] === "auth" ? ' class="active"' : '' ?>><a href="?_action=auth&next=<?= htmlentities(urlencode($nextParam)) ?>"><?= __("Log in") ?></a></li> -<?php if (REGISTRATION_ENABLED): ?> -<li<?= $GLOBALS["action"] === "register" ? ' class="active"' : '' ?>><a href="?_action=register&next=<?= htmlentities(urlencode($nextParam)) ?>"><?= __("Register") ?></a></li> -<?php endif; ?> -</ul>
\ No newline at end of file diff --git a/src/application/views/nav_logged_in.php b/src/application/views/nav_logged_in.php deleted file mode 100644 index 8dbb325..0000000 --- a/src/application/views/nav_logged_in.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -use mystic\forum\orm\User; -?> -<ul class="nav navbar-nav navbar-right"> -<li><p class="navbar-text"><?= __("Welcome, %user%!", [ - "user" => ($user->id === User::SUPERUSER_ID) ? ('<strong class="text-danger">' . htmlentities($user->displayName) . '</strong>') : ('<strong>' . htmlentities($user->displayName) . '</strong>') -]) ?> -</p></li> -<li<?= $GLOBALS["action"] === "search" ? ' class="active"' : '' ?>><a href="?_action=search"><span class="fa fa-search" aria-hidden="true"></span><span class="sr-only"><?= __("Search") ?></span></a></li> -<li<?= ($isViewingOwnProfile ?? false) ? ' class="active"' : '' ?>><a href="?_action=viewuser&user=<?= htmlentities(urlencode($user->id)) ?>"><span class="fa fa-user" aria-hidden="true"></span><span class="sr-only">View profile</span></a></li> -<li><a href="?_action=logout&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>"><span class="fa fa-sign-out" aria-hidden="true"></span><span class="sr-only">Log out</span></a></li> -</ul> diff --git a/src/application/views/template_end.php b/src/application/views/template_end.php deleted file mode 100644 index b162def..0000000 --- a/src/application/views/template_end.php +++ /dev/null @@ -1,165 +0,0 @@ -</div> -<footer class="footer"> -<div class="container"> -<div class="panel panel-default"> -<div class="panel-body"> - <table style="border-collapse: collapse; width: 100%; background: none"> - <tbody> - <tr> - <td style="padding: 0; vertical-align: middle; text-align: left; width: 100%" class="text-normal"> - © <?= date("Y") ?> <?= htmlentities(env("MYSTIC_FORUM_COPYRIGHT") ?? env("MYSTIC_FORUM_TITLE") ?? "Forum") ?>. - Powered by <a href="https://git.jkohl.link/mystic-forum.git/tag/?h=v<?= htmlentities(urlencode(MYSTICBB_VERSION)) ?>">mysticBB v<?= htmlentities(MYSTICBB_VERSION) ?></a>. - </td> - <td style="padding: 0; vertical-align: middle; text-align: right; white-space: nowrap" class="text-normal"> - <form action="?_action=settheme" class="form-inline seamless-inline" method="post"> - <input type="hidden" name="next" value="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>"> - <div class="form-group"> - <label for="theme-select"><?= __("Theme:") ?></label> - <select class="form-control input-sm auto-submit" id="theme-select" name="theme"> - <?php foreach ($availableThemes as $themeKey => $themeInfo): ?> - <option value="<?= htmlentities($themeKey) ?>" <?= $themeKey === $currentTheme ? " selected" : "" ?>><?= htmlentities($themeInfo->name) ?></option> - <?php endforeach; ?> - </select> - </div> - </form> - - <form action="?_action=setlang" class="form-inline seamless-inline" method="post"> - <input type="hidden" name="next" value="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>"> - <div class="form-group"> - <label for="lang-select"><?= __("Language:") ?></label> - <select class="form-control input-sm auto-submit" id="lang-select" name="lang"> - <?php foreach ($availableLangs as $langKey => $langName): ?> - <option value="<?= htmlentities($langKey) ?>" <?= $langKey === $currentLang ? " selected" : "" ?>><?= htmlentities($langName) ?></option> - <?php endforeach; ?> - </select> - </div> - </form> - </td> - </tr> - </tbody> - </table> -</div> -</div> -</div> -</footer> - -<script type="text/javascript"> - $(function() { - function insertAroundSelection(textarea, before, after) { - var start = textarea.selectionStart; - var end = textarea.selectionEnd; - var text = textarea.value; - var pre = text.substring(0, start); - var inner = text.substring(start, end); - var post = text.substring(end); - start += before.length; - end += before.length; - text = pre + before + inner + after + post; - textarea.value = text; - textarea.focus(); - textarea.selectionStart = start; - textarea.selectionEnd = end; - } - - function getTextarea(btn) { - return $($(btn).attr("data-area"))[0]; - } - - var commands = { - bold: function(textarea) { - insertAroundSelection(textarea, "[b]", "[/b]"); - }, - italic: function(textarea) { - insertAroundSelection(textarea, "[i]", "[/i]"); - }, - underline: function(textarea) { - insertAroundSelection(textarea, "[u]", "[/u]"); - }, - strikethrough: function(textarea) { - insertAroundSelection(textarea, "[s]", "[/s]"); - }, - sup: function(textarea) { - insertAroundSelection(textarea, "[^]", "[/^]"); - }, - sub: function(textarea) { - insertAroundSelection(textarea, "[_]", "[/_]"); - }, - quote: function(textarea) { - insertAroundSelection(textarea, "> ", ""); - }, - spoiler: function(textarea) { - insertAroundSelection(textarea, "[spoiler]", "[/spoiler]"); - } - } - - $("button[data-editor-command]").attr("data-toggle", "tooltip").attr("data-placement", "bottom").click(function() { - var command = $(this).attr("data-editor-command"); - var textarea = getTextarea(this); - commands[command](textarea); - }).tooltip(); - }); -</script> - -<script> -$(function() { - var _messages = <?= json_encode([ - "selectFiles" => [ - ___("Select file", "Select files", 1), - ___("Select file", "Select files", 2), - ], - "filesSelected" => [ - ___("%n% file selected", "No files selected", 0), - ___("%n% file selected", "%n% files selected", 1), - ___("%n% file selected", "%n% files selected", 2), - ], - ]) ?> - - $(".auto-submit").on("change", function() { - $(this)[0].form.submit(); - }); - - $("._time").each(function(i, e) { - var date = new Date($(e).text()); - $(e).text(date.toLocaleString()); - }); - $("._date").each(function(i, e) { - var date = new Date($(e).text()); - $(e).text(date.toLocaleDateString()); - }); - $("._time-only").each(function(i, e) { - var date = new Date($(e).text()); - $(e).text(date.toLocaleTimeString()); - }); - - $("input[type=file]").each(function(i, e) { - var isMultiple = !!$(e).prop("multiple"); - var isSmall = !!$(e).hasClass("small"); - var $input = $('<input type="text" readonly class="form-control" />').attr("placeholder", _messages.filesSelected[0]).css("text-overflow", "ellipsis"); - var $btn = $('<button class="btn btn-default" type="button"></button>'); - if (isSmall) { - $input.addClass("input-sm"); - $btn.addClass("btn-sm"); - } - $(e).after($('<div class="input-group file-input-group"></div>').append( - $input, - $('<span class="input-group-btn"></span>').append( - $btn.text(_messages.selectFiles[isMultiple ? 1 : 0]).click(function() { - $(e).click(); - }) - ) - )).addClass("sr-only"); - $(e).on("change", function() { - var files = $(e)[0].files; - if (files.length < 1) - $input.val(""); - else if (files.length === 1) - $input.val(files[0].name); - else - $input.val(_messages.filesSelected[2].replace("%n%", files.length)); - }); - }) -}); -</script> - -</body> -</html> diff --git a/src/application/views/template_navigation.php b/src/application/views/template_navigation.php deleted file mode 100644 index ff0752b..0000000 --- a/src/application/views/template_navigation.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php -if ($user) { - _view("nav_logged_in", [ - "user" => $user, - "isViewingOwnProfile" => $isViewingOwnProfile ?? false, - ]); -} else { - _view("nav_guest"); -} diff --git a/src/application/views/template_navigation_end.php b/src/application/views/template_navigation_end.php deleted file mode 100644 index a43919c..0000000 --- a/src/application/views/template_navigation_end.php +++ /dev/null @@ -1,4 +0,0 @@ -</div> -</div> -</nav> -<div class="container"> diff --git a/src/application/views/template_navigation_start.php b/src/application/views/template_navigation_start.php deleted file mode 100644 index bd2b3a5..0000000 --- a/src/application/views/template_navigation_start.php +++ /dev/null @@ -1,15 +0,0 @@ -<nav class="navbar navbar-default navbar-static-top"> - <div class="container"> - <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav-collapse" aria-expanded="false"> - <span class="sr-only">Toggle navigation</span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="navbar-brand" href="."> - <span class="myb-icon mybblogo" aria-hidden="false"></span> - <?= htmlentities(env("MYSTIC_FORUM_TITLE") ?? "Forum") ?> - </a> - </div> - <div class="collapse navbar-collapse" id="nav-collapse"> diff --git a/src/application/views/template_start.php b/src/application/views/template_start.php deleted file mode 100644 index cf3daf6..0000000 --- a/src/application/views/template_start.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -$pageTitle = ""; -if (isset($_title) && $_title !== null) - $pageTitle = "$_title | "; -$pageTitle .= env("MYSTIC_FORUM_TITLE") ?? "Forum"; - -?> -<!DOCTYPE html> -<!--[if lt IE 7]> <html lang="de" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> -<!--[if IE 7]> <html lang="de" class="no-js lt-ie9 lt-ie8"> <![endif]--> -<!--[if IE 8]> <html lang="de" class="no-js lt-ie9"> <![endif]--> -<!--[if gt IE 8]><!--> <html lang="de" class="no-js"> <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width,initial-scale=1"> - <meta name="generator" content="mysticBB <?= htmlentities(MYSTICBB_VERSION) ?>"> - <title><?= htmlentities($pageTitle) ?></title> - <link rel="stylesheet" href="?_action=ctheme"> - <script src="/ui/jquery-1.12.4.min.js"></script> - <script src="/ui/dist/js/bootstrap.min.js"></script> - <script src="/ui/modernizr-2.6.2.min.js"></script> - <script src="?_action=ji18n"></script> - <!--[if lt IE 9]> - <script src="/ui/html5shiv.min.js"></script> - <script src="/ui/respond.min.js"></script> - <![endif]--> -</head> -<body> diff --git a/src/application/views/view_logintoreply.php b/src/application/views/view_logintoreply.php deleted file mode 100644 index 1b5983a..0000000 --- a/src/application/views/view_logintoreply.php +++ /dev/null @@ -1,7 +0,0 @@ -<div class="well margin-top-4x text-center"> - <div class="h3 margin-top-0"><?= __("Log in to reply to this topic") ?></div> - <a href="?_action=auth&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>" class="btn btn-success"> - <span class="fa fa-user" aria-hidden="true"></span> - <?= __("Log in") ?> - </a> -</div>
\ No newline at end of file diff --git a/src/application/views/view_post.php b/src/application/views/view_post.php deleted file mode 100644 index e2fcc36..0000000 --- a/src/application/views/view_post.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php - -use mystic\forum\orm\UserPermissions; -use mystic\forum\orm\Attachment; - -/** @var mystic\forum\orm\Post $post */ -/** @var mystic\forum\orm\User $postAuthor */ -/** @var mystic\forum\orm\Topic $topic */ - -$isImage = fn(string $m) => str_starts_with($m, "image/") || str_starts_with($m, "video/"); - -$fileAttachments = array_filter($attachments, fn(Attachment $a) => !$isImage($a->mimeType)); -$imageAttachments = array_filter($attachments, fn(Attachment $a) => $isImage($a->mimeType)); - -$canReply = !$topic->isLocked && ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_POST) ?? false); - -$canEdit = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?->hasPermission(UserPermissions::EDIT_OWN_POST)) - || ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::EDIT_OTHER_POST)); - -$canEdit = $canEdit && !$topic->isLocked; - -$canDelete = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?->hasPermission(UserPermissions::DELETE_OWN_POST)) - || ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::DELETE_OTHER_POST)); - -$canViewAttachments = $GLOBALS["currentUser"] !== null; - -$hide_actions ??= false; -$hide_pfp ??= false; -$your_are_the_author = $GLOBALS["currentUser"]?->id === $postAuthor?->id; -$is_op = $postAuthor?->id === $topicAuthor?->id && $postAuthor?->id !== null; - -?> - -<?php if ($post->deleted): ?> -<div class="media" id="post-<?= htmlentities($post->id) ?>"> -<div class="media-left hidden-sm hidden-xs"> - <div class="media-object" style="width:64px"></div> -</div> -<div class="media-body"> - <div class="well icon-well text-warning"> - <span class="fa fa-exclamation-triangle text-warning" aria-hidden="true"></span> - <em><?= __("This post has been deleted") ?></em> - </div> -</div> -</div> -<?php else: ?> -<div class="media" id="post-<?= htmlentities($post->id) ?>" data-text="<?= htmlentities($post->content) ?>" style="overflow: visible;"> -<?php if (!$hide_pfp): ?> - <div class="media-left hidden-sm hidden-xs"> - <?php if ($postAuthor): ?> - <?php if ($hide_actions): ?> - <img class="media-object" alt="<?= __("Profile picture") ?>" src="?_action=profilepicture&user=<?= htmlentities(urlencode($postAuthor->id)) ?>" width="64" height="64"> - <?php else: ?> - <a href="?_action=viewuser&user=<?= htmlentities(urlencode($postAuthor->id)) ?>"> - <img class="media-object" alt="<?= __("Profile picture") ?>" src="?_action=profilepicture&user=<?= htmlentities(urlencode($postAuthor->id)) ?>" width="64" height="64"> - </a> - <?php endif; ?> - <?php else: ?> - <div class="media-object" style="width:64px;height:64px"></div> - <?php endif; ?> - </div> -<?php endif; ?> - <div class="media-body" style="overflow: visible;"> - <div class="panel panel-default"> - <div class="panel-heading"> - <div class="panel-title h3"> - <?php if (!$hide_actions): ?> - <div class="pull-right"> - <a href="#post-<?= htmlentities(urlencode($post->id)) ?>" class="btn btn-default"><span class="fa fa-link" aria-hidden="true"></span><span class="sr-only"><?= __("Permalink") ?></span></a> - <?php if ($canReply): ?> - <button data-post-id="<?= htmlentities($post->id) ?>" class="btn btn-default js-only _reply-post"><span class="fa fa-comment" aria-hidden="true"></span><span class="sr-only"><?= __("Reply to post") ?></span></button> - <?php endif; ?> - <?php if ($canEdit): ?> - <button data-post-id="<?= htmlentities($post->id) ?>" class="btn btn-default js-only _edit-post"><span class="fa fa-pencil" aria-hidden="true"></span><span class="sr-only"><?= __("Edit post") ?></span></button> - <?php endif; ?> - <?php if ($canDelete): ?> - <form action="?_action=deletepost" method="post" class="seamless-inline"> - <input type="hidden" name="post" value="<?= htmlentities($post->id) ?>"> - <button type="submit" class="btn btn-danger"><span class="fa fa-trash" aria-hidden="true"></span><span class="sr-only"><?= __("Delete post") ?></span></button> - </form> - <?php endif; ?> - </div> - <?php endif; ?> - <?php if ($postAuthor): ?> - <?php if ($hide_actions): ?> - <?= htmlentities($postAuthor->displayName) ?> - <?php else: ?> - <a href="?_action=viewuser&user=<?= htmlentities(urlencode($postAuthor->id)) ?>"><?= htmlentities($postAuthor->displayName) ?></a> - <?php if ($is_op): ?> - <span title="<?= __("Created this topic") ?>" class="text-info fa fa-user-circle"></span> - <?php endif; ?> - <?php endif; ?> - <?php if ($your_are_the_author): ?> - <span class="text-normal label label-primary"><?= __("You") ?></span> - <?php endif; ?> - <?php else: ?> - <em class="text-muted"><?= __("(deleted)") ?></em> - <?php endif; ?> - </div> - <span class="_time"><?= $post->postDate->format("c"); ?></span> - <?php if ($post->edited): ?> - <em class="text-muted"><?= __("(edited)") ?></em> - <?php endif; ?> - </div> - <div class="panel-body"> - <div class="post-content"><?= renderPost($post->content) ?></div> - <?php if (count($imageAttachments) > 0): ?> - <div class="post-images clearfix"> - <?php /** @var Attachment $attachment */ foreach ($imageAttachments as $attachment): ?> - <?php if ($hide_actions): ?> - <span class="image-attachment" title="<?= htmlentities($attachment->name) ?>"> - <img class="image-attachment-image" src="?_action=thumb&attachment=<?= htmlentities(urlencode($attachment->id)) ?>" alt="" width="100"> - </span> - <?php else: ?> - <a class="image-attachment attachment<?php if (str_starts_with($attachment->mimeType, "video/")): ?> video-attachment<?php endif; ?>" href="?_action=attachment&attachment=<?= htmlentities(urlencode($attachment->id)) ?>" title="<?= htmlentities($attachment->name) ?>" data-attachment-id="<?= htmlentities($attachment->id) ?>"> - <img class="image-attachment-image" src="?_action=thumb&attachment=<?= htmlentities(urlencode($attachment->id)) ?>" alt="" width="100"> - <?php if (!$canViewAttachments): ?> - <span class="attachment-lock fa fa-ban" aria-hidden="true"></span> - <?php elseif (str_starts_with($attachment->mimeType, "video/")): ?> - <span class="video-player-icon fa fa-play-circle" aria-hidden="true"></span> - <?php endif; ?> - </a> - <?php endif; ?> - <?php endforeach; ?> - </div> - <?php endif; ?> - </div> - <?php if (count($fileAttachments) > 0): ?> - <div class="panel-footer"> - <div class="btn-group"> - <?php /** @var Attachment $attachment */ foreach ($fileAttachments as $attachment): ?> - <?php if ($hide_actions): ?> - <button class="btn btn-default"><?= htmlentities($attachment->name) ?></button> - <?php else: ?> - <a class="btn btn-default attachment" href="?_action=attachment&attachment=<?= htmlentities(urlencode($attachment->id)) ?>"> - <?php if (!$canViewAttachments): ?> - <span class="fa fa-ban" aria-hidden="true"></span> - <?php endif; ?> - <?= htmlentities($attachment->name) ?> - </a> - <?php endif; ?> - <?php endforeach; ?> - </div> - </div> - <?php endif; ?> - </div> - </div> -</div> - -<?php endif; ?> diff --git a/src/application/views/view_search_results.php b/src/application/views/view_search_results.php deleted file mode 100644 index 660284d..0000000 --- a/src/application/views/view_search_results.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -use mystic\forum\utils\StringUtils; -?> - -<?php if (count($posts) > 0): ?> - <p><?= __("%result_count% result(s) in %search_duration% second(s)", [ - "result_count" => count($posts), - "search_duration" => number_format($search_duration, 2, __(".", context: "Number formatting"), __(",", context: "Number formatting")), - ]) ?></p> - <div class="list-group margin-top"> - <?php foreach ($posts as $post): - if ($post->deleted) continue; - $hasAttachments = count($attachments[$post->id]) > 0; - ?> - <a href="?_action=viewtopic&topic=<?= htmlentities(urlencode($post->topicId)) ?>#post-<?= htmlentities(urlencode($post->id)) ?>" class="list-group-item"> - <?php if ($hasAttachments): ?> - <span class="badge"><span class="fa fa-paperclip"></span></span> - <?php endif; ?> - <?= renderPostSummary($post->content) ?><br> - <span class="text-muted"><?= __("posted by %author% on %post_date% in %topic%", [ - "author" => '<em>' . htmlentities($users[$post->authorId]?->displayName ?? __("unknown")) . '</em>', - "post_date" => '<span class="_time">' . htmlentities($post->postDate->format("c")) . '</span>', - "topic" => '<em>' - . ($topics[$post->topicId]?->isLocked ? '<span class="fa fa-lock text-muted" aria-hidden="true"></span> ' : '') - . htmlentities($topics[$post->topicId]?->title ?? "unknown") . '</em>', - ]) ?></span> - </a> - <?php endforeach; ?> - </div> -<?php else: ?> - <div class="well icon-well text-info margin-top margin-bottom"> - <span class="fa fa-info-circle text-info" aria-hidden="true"></span> - <em><?= __("No results for this search") ?></em> - </div> -<?php endif; ?> diff --git a/src/application/views/view_topic_end.php b/src/application/views/view_topic_end.php deleted file mode 100644 index e69de29..0000000 --- a/src/application/views/view_topic_end.php +++ /dev/null diff --git a/src/application/views/view_topic_locked.php b/src/application/views/view_topic_locked.php deleted file mode 100644 index b3eb99e..0000000 --- a/src/application/views/view_topic_locked.php +++ /dev/null @@ -1,4 +0,0 @@ -<div class="well icon-well text-warning margin-top-4x"> - <span class="fa fa-lock text-warning" aria-hidden="true"></span> - <em><?= __("This topic has been locked") ?></em> -</div> diff --git a/src/application/views/view_topic_start.php b/src/application/views/view_topic_start.php deleted file mode 100644 index 7f62986..0000000 --- a/src/application/views/view_topic_start.php +++ /dev/null @@ -1,254 +0,0 @@ -<?php -use mystic\forum\orm\UserPermissions; -use mystic\forum\utils\RequestUtils; - -$canReply = !$topic->isLocked && ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_POST) ?? false); - -$canEdit = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor->hasPermission(UserPermissions::EDIT_OWN_TOPIC)) - || ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::EDIT_OTHER_TOPIC)); - -$canDelete = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor->hasPermission(UserPermissions::DELETE_OWN_TOPIC)) - || ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::DELETE_OTHER_TOPIC)); -?> -<?php if ($canEdit): ?> - <div class="modal fade" tabindex="-1" role="dialog" id="diag-edit-post"> - <form class="modal-dialog" role="document" action="?_action=updatepost" method="post"> - <input type="hidden" id="i_edit_post" name="post"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title"><?= __("Edit post") ?></h4> - </div> - <div class="modal-body"> - <label class="sr-only" for="i_edit_message"><?= __("Message:") ?></label> - <div class="panel panel-default"> - <div class="panel-heading" style="padding:4px"> - <div class="btn-toolbar" role="toolbar"> - <div class="btn-group" role="group"> - <button data-area="#i_edit_message" title="<?= __("Bold") ?>" data-editor-command="bold" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-bold"></i></button> - <button data-area="#i_edit_message" title="<?= __("Italic") ?>" data-editor-command="italic" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-italic"></i></button> - <button data-area="#i_edit_message" title="<?= __("Underlined") ?>" data-editor-command="underline" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-underline"></i></button> - <button data-area="#i_edit_message" title="<?= __("Strikethrough") ?>" data-editor-command="strikethrough" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-strikethrough"></i></button> - </div> - <div class="btn-group" role="group"> - <button data-area="#i_edit_message" title="<?= __("Superscript") ?>" data-editor-command="sup" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-superscript"></i></button> - <button data-area="#i_edit_message" title="<?= __("Subscript") ?>" data-editor-command="sub" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-subscript"></i></button> - </div> - <div class="btn-group" role="group"> - <button data-area="#i_edit_message" title="<?= __("Quote") ?>" data-editor-command="quote" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-quote-left"></i></button> - <button data-area="#i_edit_message" title="<?= __("Spoiler") ?>" data-editor-command="spoiler" type="button" class="btn btn-default btn-xs"><i class="fa fa-fw fa-eye"></i></button> - </div> - </div> - </div> - <div class="panel-body" style="padding:0"> - <textarea class="form-control" id="i_edit_message" name="message" required rows="12" cols="60" style="resize:vertical;max-height:500px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;margin:-1px;width:calc(100% + 2px)"></textarea> - </div> - </div> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove" aria-hidden="true"></span> <?= __("Cancel") ?></button> - <button type="submit" class="btn btn-success"><span class="fa fa-save" aria-hidden="true"></span> <?= __("Save changes") ?></button> - </div> - </div> - </form> - </div> -<?php endif; ?> -<?php if ($GLOBALS["currentUser"] === null): ?> - <div class="modal fade" tabindex="-1" role="dialog" id="diag-cant-view-attachment"> - <div class="modal-dialog modal-danger" role="document"> - <div class="modal-content panel-danger"> - <div class="modal-header panel-heading"> - <h4 class="modal-title"><span class="fa fa-exclamation-circle" aria-hidden="true"></span> <?= __("Permission denied") ?></h4> - </div> - <div class="modal-body"> - <?= __("You must be logged in to view attachments") ?> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-close" aria-hidden="true"></span> <?= __("Close") ?></button> - <a href="?_action=auth&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>" class="btn btn-success"><span class="fa fa-user" aria-hidden="true"></span> <?= __("Log in") ?></a> - </div> - </div> - </div> - </div> - <script> - $(function() { - $(".attachment").click(function(e) { - e.preventDefault(); - $("#diag-cant-view-attachment").modal(); - }); - }); - </script> -<?php else: ?> - <div class="modal fade" tabindex="-1" role="dialog" id="diag-image-attachment"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title"><?= __("Attachment") ?></h4> - </div> - <div class="modal-body"> - <img class="image-attachment-view attachment-view" id="image-attachment-view" alt=""> - </div> - <div class="modal-footer"> - <a href="" download id="image-attachment-dl-btn" class="btn btn-default"><span class="fa fa-download" aria-hidden="true"></span> <?= __("Download") ?></a> - </div> - </div> - </div> - </div> - <div class="modal fade" tabindex="-1" role="dialog" id="diag-video-attachment"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title"><?= __("Attachment") ?></h4> - </div> - <div class="modal-body"> - <video class="video-attachment-view attachment-view" id="video-attachment-view" controls></video> - </div> - <div class="modal-footer"> - <a href="" download id="video-attachment-dl-btn" class="btn btn-default"><span class="fa fa-download" aria-hidden="true"></span> <?= __("Download") ?></a> - </div> - </div> - </div> - </div> - <script> - $(function() { - $(".image-attachment:not(.video-attachment)").click(function(e) { - e.preventDefault(); - var attUrl = "?_action=attachment&attachment=" + encodeURIComponent($(this).attr("data-attachment-id")); - $("#image-attachment-view").attr("src", attUrl); - $("#image-attachment-dl-btn").attr("href", attUrl); - $("#diag-image-attachment").modal(); - }); - $(".image-attachment.video-attachment").click(function(e) { - e.preventDefault(); - var attUrl = "?_action=attachment&attachment=" + encodeURIComponent($(this).attr("data-attachment-id")); - $("#video-attachment-view").attr("src", attUrl); - $("#video-attachment-dl-btn").attr("href", attUrl); - $("#diag-video-attachment").modal(); - }); - $("#diag-video-attachment").on("hide.bs.modal", function() { - $("#video-attachment-view")[0].pause(); - }); - }); - </script> -<?php endif; ?> - -<?php -if (($_formError = RequestUtils::getAndClearFormError("updatetopic")) !== null) { - _view("alert_error", ["message" => $_formError]); -} - -if (($_formError = RequestUtils::getAndClearFormError("locktopic")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> - -<div class="page-header margin-top-0 clearfix"> - <div id="displayHeading"> - <div role="heading" class="h1 seamless-inline"> - <?php if ($topic->isLocked): ?> - <span class="fa fa-lock text-muted" aria-hidden="true"></span> - <?php endif; ?> - <?= htmlentities($topic->title) ?> - <div class="pull-right text-normal"> - <?php if ($canEdit && !$topic->isLocked): ?> - <button id="btn-edit-title" class="btn btn-default js-only"><span class="fa fa-pencil" aria-hidden="true"></span> <?= __("Edit title") ?></button> - <?php endif; ?> - <?php if ($canReply): ?> - <button id="btn-reply" class="btn btn-default js-only"><span class="fa fa-comment" aria-hidden="true"></span> <?= __("Reply") ?></button> - <?php endif; ?> - <?php if ($canEdit): ?> - <?php if ($topic->isLocked): ?> - <form action="?_action=locktopic" method="post" class="seamless-inline"> - <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> - <input type="hidden" name="locked" value="false"> - <button type="submit" class="btn btn-success"><span class="fa fa-unlock" aria-hidden="true"></span> <?= __("Unlock topic") ?></button> - </form> - <?php else: ?> - <form action="?_action=locktopic" method="post" class="seamless-inline"> - <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> - <input type="hidden" name="locked" value="true"> - <button type="submit" class="btn btn-warning"><span class="fa fa-lock" aria-hidden="true"></span> <?= __("Lock topic") ?></button> - </form> - <?php endif; ?> - <?php endif; ?> - <?php if ($canDelete): ?> - <form action="?_action=deletetopic" method="post" class="seamless-inline"> - <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> - <button type="submit" class="btn btn-danger"><span class="fa fa-trash" aria-hidden="true"></span> <?= __("Delete topic") ?></button> - </form> - <?php endif; ?> - </div> - </div><br> - <?= __("Started by %user% on %date%", [ - "user" => ($topicAuthor !== null) ? ('<a href="?_action=viewuser&user=' . htmlentities(urlencode($topicAuthor->id)) . '">' . htmlentities($topicAuthor->displayName) . '</a>') : __("(deleted)"), - "date" => '<span class="_time">' . htmlentities($topic->creationDate->format("c")) . '</span>', - ]); ?> - </div> - <?php if ($canEdit): ?> - <form action="?_action=updatetopic" method="post" id="editHeading" style="display: none;" class="form-inline seamless-inline"> - <input type="hidden" name="topic" value="<?= htmlentities(urlencode($topic->id)) ?>"> - <div class="row"> - <div class="col-md-8"> - <input type="text" class="form-control" name="title" id="i_edit_title" data-original-value="<?= htmlentities($topic->title) ?>" value="<?= htmlentities($topic->title) ?>" style="box-sizing: border-box; width: 100%; font-size: 36px; height: 56px"> - </div> - <div class="col-md-4 text-right"> - <button type="button" id="topicTitleEditCancel" class="btn btn-default"><span class="fa fa-close" aria-hidden="true"></span> <?= __("Cancel") ?></button> - <button type="submit" class="btn btn-success"><span class="fa fa-save" aria-hidden="true"></span> <?= __("Save changes") ?></button> - </div> - </div> - </form> - <?php endif; ?> -</div> -<script> -<?php if ($canEdit): ?> -$(function() { - $("#btn-edit-title").click(function() { - $("#displayHeading").hide(); - $("#editHeading").show(); - $("#i_edit_title").val($("#i_edit_title").attr("data-original-value")).focus(); - }); - $("#topicTitleEditCancel").click(function() { - $("#displayHeading").show(); - $("#editHeading").hide(); - }); -}); -<?php endif; ?> -<?php if ($canReply): ?> -$(function() { - function focusReplyBox() { - var msgInput = $("#i_message"); - msgInput[0].scrollIntoView(); - msgInput.focus(); - } - $("#btn-reply").click(function() { - focusReplyBox(); - }); - $("._reply-post").click(function() { - var text = $("#post-" + $(this).attr("data-post-id")).attr("data-text"); - var val = $("#i_message").val(); - var lines = text.split("\n"); - for (var i = 0; i < lines.length; ++i) - val += "\n> " + lines[i]; - val += "\n\n"; - $("#i_message").val(val.replace(/^\n+/, "")); - focusReplyBox(); - }); -}); -<?php endif; ?> -<?php if ($canEdit): ?> -$(function() { - $("._edit-post").click(function() { - var $post = $("#post-" + $(this).attr("data-post-id")); - var $postContent = $post.find(".post-content"); - $("#i_edit_message").css("height", "").val($post.attr("data-text")); - $("#i_edit_post").val($(this).attr("data-post-id")); - $("#diag-edit-post").modal(); - }); - $("#diag-edit-post").on("shown.bs.modal", function() { - $("#i_edit_message").focus(); - }); -}); -<?php endif; ?> -</script> diff --git a/src/application/views/view_topiclog.php b/src/application/views/view_topiclog.php deleted file mode 100644 index 291dada..0000000 --- a/src/application/views/view_topiclog.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -/** @var \mystic\forum\orm\TopicLogMessage $logMessage */ -/** @var ?\mystic\forum\orm\User $postAuthor */ - -use mystic\forum\orm\TopicLogMessage; - -$hide_actions ??= false; -$hide_pfp ??= false; - -$user = ""; -if ($postAuthor === null) { - $user = __("(deleted)"); -} else { - $user = '<a href="?_action=viewuser&user=' . htmlentities(urlencode($postAuthor->id)) . '">' . htmlentities($postAuthor->displayName) . '</a>'; -} - -?> -<div class="media" id="post-<?= htmlentities($logMessage->id) ?>"> -<div class="media-left hidden-sm hidden-xs"> - <?php if ($postAuthor): ?> - <?php if ($hide_actions): ?> - <img class="media-object" alt="<?= __("Profile picture") ?>" src="?_action=profilepicture&user=<?= htmlentities(urlencode($postAuthor->id)) ?>" width="64" height="64"> - <?php else: ?> - <a href="?_action=viewuser&user=<?= htmlentities(urlencode($postAuthor->id)) ?>"> - <img class="media-object" alt="<?= __("Profile picture") ?>" src="?_action=profilepicture&user=<?= htmlentities(urlencode($postAuthor->id)) ?>" width="64" height="64"> - </a> - <?php endif; ?> - <?php else: ?> - <div class="media-object" style="width:64px;height:64px"></div> - <?php endif; ?> -</div> -<div class="media-body"> - <?php if ($logMessage->type === TopicLogMessage::LOCKED): ?> - <div class="well icon-well text-info"> - <span class="fa fa-lock text-info" aria-hidden="true"></span> - <em><?= __("%user% locked this topic", [ - "user" => $user, - ]) ?></em> - <br> - <small class="_time"><?= $logMessage->postDate->format("c") ?></small> - </div> - <?php elseif ($logMessage->type === TopicLogMessage::UNLOCKED): ?> - <div class="well icon-well text-success"> - <span class="fa fa-unlock text-success" aria-hidden="true"></span> - <em><?= __("%user% unlocked this topic", [ - "user" => $user, - ]) ?></em> - <br> - <small class="_time"><?= $logMessage->postDate->format("c") ?></small> - </div> - <?php elseif ($logMessage->type === TopicLogMessage::TITLE_CHANGED): ?> - <div class="well icon-well text-info"> - <span class="fa fa-pencil text-info" aria-hidden="true"></span> - <em><?= __("%user% changed the title of this topic from %old_title% to %new_title%", [ - "user" => $user, - "old_title" => '<strong>' . htmlentities($logMessage->params["old_value"] ?? __("unknown")) . '</strong>', - "new_title" => '<strong>' . htmlentities($logMessage->params["new_value"] ?? __("unknown")) . '</strong>', - ]) ?></em> - <br> - <small class="_time"><?= $logMessage->postDate->format("c") ?></small> - </div> - <?php else: ?> - <?= __("unknown") ?> - <?php endif; ?> -</div> -</div> diff --git a/src/application/views/view_topics.php b/src/application/views/view_topics.php deleted file mode 100644 index 8a94775..0000000 --- a/src/application/views/view_topics.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -use mystic\forum\orm\User; -use mystic\forum\orm\UserPermissions; - -if ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_TOPIC)): -?> -<p class="text-right"> -<a href="?_action=newtopic" class="btn btn-success"><span class="fa fa-plus" aria-hidden="true"></span> <?= __("New topic") ?></a> -</p> -<?php endif; ?> -<div class="list-group"> -<?php /** @var Topic $topic */ foreach ($topics as $topic): ?> -<a class="list-group-item" href="?_action=viewtopic&topic=<?= htmlentities(urlencode($topic->id)) ?>"> - <h4 class="list-group-item-heading"> - <?php if ($topic->isLocked): ?> - <span class="fa fa-lock text-muted" aria-hidden="true"></span> - <?php endif; ?> - <?= htmlentities($topic->title) ?> - </h4> - <p class="list-group-item-text _time"><?= htmlentities($topic->creationDate->format("c")) ?></p> -</a> -<?php endforeach; ?> -</div> diff --git a/src/application/views/view_user.php b/src/application/views/view_user.php deleted file mode 100644 index e7c9753..0000000 --- a/src/application/views/view_user.php +++ /dev/null @@ -1,209 +0,0 @@ -<?php - -use mystic\forum\orm\UserPermissions; -use mystic\forum\utils\RequestUtils; -use mystic\forum\utils\StringUtils; - -/** @var mystic\forum\orm\User $user */ -/** @var bool $lastNameChangeTooRecent */ - -$canEdit = ($user->id === $GLOBALS["currentUser"]?->id && $user->hasPermission(UserPermissions::EDIT_OWN_USER)) - || $GLOBALS["currentUser"]?->hasPermission(UserPermissions::EDIT_OTHER_USER); - -$isOwnProfile = $user->id === $GLOBALS["currentUser"]?->id; - -$sUserPossessive = ""; -if ($isOwnProfile) - $sUserPossessive = "Your posts"; -else - $sUserPossessive = "%display_name%'s posts"; - -$dateJoined = DateTime::createFromImmutable($user->created); -$dateJoined->setTime(0, 0, 0, 0); - -$emailPending = $isOwnProfile && $user->pendingEmail !== null; -?> - -<div class="clearfix page-header margin-top-0"> - <img class="pull-left margin-right" src="?_action=profilepicture&user=<?= htmlentities(urlencode($user->id)) ?>" alt="<?= __("Profile picture") ?>" width="64" height="64"> - <span class="h1"><?= htmlentities($user->displayName) ?></span> - <?php if ($isOwnProfile): ?> - <span class="label label-primary"><?= __("You") ?></span> - <?php endif; ?><br> - @<?= htmlentities($user->name) ?> • <span class="text-muted"><?= __("Member since %join_date%", [ - "join_date" => '<span class="_date">' . htmlentities($dateJoined->format("c")) . '</span>', - ]) ?></span> -</div> - -<?php if ($canEdit): ?> -<div class="row"> -<div class="col-md-9"> -<?php endif; ?> - -<h3><?= __($sUserPossessive, [ - "display_name" => $user->displayName, -]) ?></h3> - -<?php if (count($posts) > 0): ?> - <div class="post-container"> - <div class="post-container-posts"> - <div class="list-group margin-top"> - <?php foreach ($posts as $post): - if ($post->deleted) continue; - $hasAttachments = count($attachments[$post->id]) > 0; - ?> - <a href="?_action=viewtopic&topic=<?= htmlentities(urlencode($post->topicId)) ?>#post-<?= htmlentities(urlencode($post->id)) ?>" class="list-group-item"> - <?php if ($hasAttachments): ?> - <span class="badge"><span class="fa fa-paperclip"></span></span> - <?php endif; ?> - <?= renderPostSummary($post->content) ?><br> - <span class="text-muted"><?= __("posted on %post_date% in %topic%", [ - "post_date" => '<span class="_time">' . htmlentities($post->postDate->format("c")) . '</span>', - "topic" => '<em>' . - ($topics[$post->topicId]?->isLocked ? '<span class="fa fa-lock text-muted" aria-hidden="true"></span> ' : '') . - htmlentities($topics[$post->topicId]?->title ?? "unknown") . '</em>', - ]) ?></span> - </a> - <?php endforeach; ?> - </div> - </div> - <div class="post-container-controls"> - <button class="btn btn-default"><?= __("Show all posts") ?></button> - </div> - </div> -<?php else: ?> - <div class="well icon-well text-info margin-top margin-bottom"> - <span class="fa fa-info-circle text-info" aria-hidden="true"></span> - <em><?= __("This user has not posted anything yet") ?></em> - </div> -<?php endif; ?> - -<?php if ($canEdit): ?> -</div> - -<div class="col-md-3"> -<h3><?= __("Edit profile") ?></h3> -<?php -if (($_formError = RequestUtils::getAndClearFormError("update_profile")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post" enctype="multipart/form-data"> - <input type="hidden" name="form_id" value="update_profile"> - <div class="form-group"> - <label for="i_display_name"><?= __("Display name:") ?></label> - <input required class="form-control" type="text" name="display_name" id="i_display_name" value="<?= htmlentities($user->displayName) ?>"> - </div> - <div class="form-group"> - <label for="i_name"><?= __("Username:") ?></label> - <?php if ($lastNameChangeTooRecent): ?> - <input class="form-control" type="text" id="i_name" value="<?= htmlentities($user->name) ?>" disabled> - <small class="text-danger"><strong><?= __("You can only change your username every 30 days!") ?></strong></small> - <?php else: ?> - <input required class="form-control" type="text" name="name" id="i_name" value="<?= htmlentities($user->name) ?>"> - <?php endif; ?> - </div> - <div class="form-group"> - <label for="i_email"><?= __("Email address:") ?></label> - <?php if ($emailPending): ?> - <input class="form-control" type="email" id="i_email" value="<?= htmlentities($user->email) ?>" disabled> - <?php else: ?> - <input required class="form-control" type="email" id="i_email" name="email" value="<?= htmlentities($user->email) ?>"> - <?php endif; ?> - </div> - <div class="form-group"> - <label><?= __("Profile picture:") ?></label> -<?php -$_checkbox_disabled = empty($user->profilePicture); -$_checkbox_disabled_class = $_checkbox_disabled ? " disabled text-muted" : ""; -?> - <div class="radio margin-top-0 <?= $_checkbox_disabled_class ?>"> - <label> - <input type="radio" name="pfp_action" id="pfp_action_1" value="keep"<?= !empty($user->profilePicture) ? ' checked' : ' disabled' ?>> - <?= __("Keep current profile picture") ?> - </label> - </div> - <div class="radio"> - <label> - <input type="radio" name="pfp_action" id="pfp_action_2" value="remove"<?= empty($user->profilePicture) ? ' checked' : '' ?>> - <?php if (empty($user->profilePicture)): ?> - <?= __("No profile picture") ?> - <?php else: ?> - <?= __("Remove profile picture") ?> - <?php endif; ?> - </label> - </div> - <div class="radio"> - <label> - <input type="radio" name="pfp_action" value="replace" id="pfp_action_3"> - <?= __("Upload new profile picture") ?> - </label> - </div> - <input type="file" name="pfp" id="i_pfp" accept="image/png,image/jpeg" class="margin-left-3x small"> - </div> - <div class="form-group"> - <button type="submit" class="btn btn-success"><?= __("Save changes") ?></button> - </div> -</form> -<?php if ($isOwnProfile): ?> -<h3><?= __("Change password") ?></h3> -<?php -if (($_formError = RequestUtils::getAndClearFormError("update_password")) !== null) { - _view("alert_error", ["message" => $_formError]); -} -?> -<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>" method="post"> - <input type="hidden" name="form_id" value="update_password"> - <div class="form-group"> - <label for="i_current_password"><?= __("Current password:") ?></label> - <input autocomplete="current-password" required class="form-control" type="password" name="current_password" id="i_current_password" required> - </div> - <div class="form-group"> - <label for="i_new_password"><?= __("New password:") ?></label> - <input autocomplete="new-password" required class="form-control" type="password" name="new_password" id="i_new_password" required> - </div> - <div class="form-group"> - <label for="i_retype_password"><?= __("Retype password:") ?></label> - <input autocomplete="new-password" required class="form-control" type="password" name="retype_password" id="i_retype_password" required> - </div> - <div class="form-group"> - <button type="submit" class="btn btn-success"><?= __("Change password") ?></button> - </div> -</form> -<?php endif; ?> - -</div> - -</div> -<?php endif; ?> - -<script> -$(function() { - $(".post-container").each(function(i, e) { - if ($(e).height() > 900) { // more than 800 so it doesn't collapse just a few pixels - $(e).addClass("collapsed"); - } - $(e).find(".post-container-controls button").click(function() { - $(e).removeClass("collapsed"); - }); - }); -}); -<?php if ($canEdit): ?> -$(function() { - function _hide() { - $("#i_pfp").hide().prop("disabled", true).prop("required", false); - $("#i_pfp + .file-input-group").hide().find("button").prop("disabled", true); - } - _hide(); - setTimeout(_hide, 10); - $("[name='pfp_action']").on("change input check click", function() { - if ($("#pfp_action_3").is(":checked")) { - $("#i_pfp").show().prop("disabled", false).prop("required", true); - $("#i_pfp + .file-input-group").show().find("button").prop("disabled", false); - } else { - _hide(); - } - }) -}); -<?php endif; ?> -</script> |