Реструктура стилей, страница логина, уведомления

This commit is contained in:
2024-01-13 03:24:42 +03:00
parent 6958b75414
commit 4e1c36d670
29 changed files with 612 additions and 94 deletions

View File

@@ -1,11 +1,20 @@
<?php
// Main page posts counter
if (!$IS_FRONTEND) {
http_response_code(500);
die();
}
// Includes
require_once("api/post/index.php");
$totalPostsAmount = Post_GetPostsAmount();
$totalPostsAmount = strval($totalPostsAmount);

View File

@@ -0,0 +1,5 @@
<?php
require_once("front/pages/index/random_meme.php");
require_once("front/pages/index/searchbox.php");
require_once("front/pages/index/counter.php");
?>

View File

@@ -2,5 +2,5 @@
// TODO: picking random meme
?>
<div class="visualbox">
<img src="test.png">
<img style="max-width: 90%; max-height: 240px;" src="test.png">
</div>

View File

@@ -1,11 +1,20 @@
<?php
// Main page search box
if (!$IS_FRONTEND) {
http_response_code(500);
die();
}
// Includes
require_once("api/user/index.php");
?>
<div class="visualbox searchbox">
<a class="title" href=".">E949</a>
@@ -17,25 +26,25 @@ if (!$IS_FRONTEND) {
if ($res->IsError())
$res->ThrowJSONError();
$uname = $res->GetData()["login"];
echo "<a class=\"useraccount\" title=\"Account page\" href=\"./?do=view_user&id=$THIS_USER\">$uname</a>";
echo "<a class=\"useraccount\" title=\"Account page\" href=\"./?do=user_info&id=$THIS_USER\">$uname</a>";
unset($res);
} else { // If user is NOT logged in
?>
<a title="Login in existing account" href="./?do=login">Login</a>
<a title="Create new account" href="./?do=signup">Signup</a>
<a title="Create new account" href="./?do=register">Register</a>
<?php
}
?>
<a title="A paginated list of every post" href="./?do=view_all_posts">Posts</a>
<a title="A paginated list of every tag" href="./?do=view_all_tags">Tags</a>
<a title="A paginated list of every post" href="./?do=search_posts">Posts</a>
<a title="A paginated list of every tag" href="./?do=view_tags">Tags</a>
<a title="Statistics of current instance" href="./?do=view_stats">Statistics</a>
<a title="A site map" href="./?do=view_sitemap">Site map</a>
</div>
<div>
<form action="." accept-charset="UTF-8" method="get">
<input type="hidden" name="do" value="search_posts">
<input type="text" name="tags" id="tags" value="" size="36" autofocus="autofocus" autocomplete="on"><br>
<input type="submit" value="Search">
<input type="hidden" name="do" value="search_posts">
<!-- TODO: JS
<input type="button" value="Show random meme" id="random-meme">
-->

View File

@@ -0,0 +1,48 @@
<?php
// Login page
// Includes
require_once("api/user/login.php");
require_once("front/pages/main_nav.php");
require_once("front/notifications.php");
// If there is attempt to login in
if (isset($_POST["login"]) || isset($_POST["password"])) {
$result = User_Login_Method($_POST);
if ($result->IsError()) {
NTFY_AddNotice("Failed to log into account! Check your credentials and try again.<br>" . $result->GetError());
} else {
header("Location: index.php");
exit();
}
}
NTFY_EchoAllNotices();
?>
<div class="visualbox">
<h1>Login</h1>
<form class="login" action="./?do=login" accept-charset="UTF-8" method="post">
<div>
<label for="login">Username</label><br>
<input type="text" name="login" id="login">
</div>
<div>
<label for="password">Password</label><br>
<input type="password" name="password" id="password">
<a href="./?do=reset_password">Reset</a>
</div>
<div>
<input type="submit" value="Submit">
</div>
</form>
<div class="loginmisc">
<p>Don&#39;t have an account? <a href="./?do=register">Register here</a></p>
</div>
</div>

53
front/pages/main_nav.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
// Main navigation bar
$MARKUP_CURRENT_PAGE = "class=\"current\"";
$MARKUP_CURRENT_PAGE_LOGIN = "";
if ($WHAT_PAGE_IS_CURRENT["login"])
$MARKUP_CURRENT_PAGE_LOGIN = $MARKUP_CURRENT_PAGE;
?>
<nav class="main">
<ul>
<li <?php echo $MARKUP_CURRENT_PAGE_LOGIN; ?>>
<p><a title="Login in existing account" href="./?do=login">Login</p></a>
</li>
<span>|</span>
<li>
<p><a title="Create new account" href="./?do=register">Register</p></a>
</li>
<span>|</span>
<li>
<p><a title="A paginated list of every post" href="./?do=search_posts">Posts</p></a>
</li>
<span>|</span>
<li>
<p><a title="A paginated list of every tag" href="./?do=view_tags">Tags</p></a>
</li>
<span>|</span>
<li>
<p><a title="Statistics of current instance" href="./?do=view_stats">Stats</p></a>
</li>
<span>|</span>
<li>
<p><a title="Contacts" href="./?do=show_contacts">Contacts</p></a>
</li>
<span>|</span>
<li>
<p><a title="Terms of service" href="./?do=show_tos">ToS</p></a>
</li>
<span>|</span>
<li>
<p><a title="Privacy policy" href="./?do=there_are_my_data">Privacy</p></a>
</li>
<span>|</span>
<li>
<p><a title="A site map" href="./?do=view_sitemap">Site map</p></a>
</li>
</ul>
</nav>