Small form cleanup, re-add loader

This commit is contained in:
Floorb 2022-04-18 13:54:01 -04:00
parent 3d11577eed
commit 837d9dfe6c
10 changed files with 43 additions and 23 deletions

View file

@ -242,20 +242,20 @@ $total_page_views = PageView::select('tpage')->orderBy('id', 'desc')->first()->t
$total_unique_views = PageView::select('tvisit')->orderBy('id', 'desc')->first()->tvisit;
$current_user = SessionHelper::currentUser();
$current_ability = new AbilityHelper($current_user);
function can(string $action, mixed $subject) : bool {
global $current_ability;
global $current_user;
static $current_ability = null;
if ($current_ability === null) {
$current_ability = new AbilityHelper($current_user);
}
return $current_ability->can($action, $subject);
}
//SessionHelper::setupCsrfToken();
$script_bundles = [];
/* Security headers */
header('X-Frame-Options: SAMEORIGIN');
header('X-Content-Type-Options: nosniff');
//ob_start();

View file

@ -147,6 +147,7 @@ class DataTable {
_loadEntries() {
new Promise(this.ajaxCallback)
.then(data => {
this.element.classList.remove('hidden');
this.unfilteredData = data.data;
this._updateFilter(this.options.preFilter);
});

View file

@ -7,11 +7,6 @@ use PonePaste\Helpers\SessionHelper;
use PonePaste\Models\User;
use PonePaste\Models\UserSession;
// Current Date & User IP
$date = date('jS F Y');
$ip = $_SERVER['REMOTE_ADDR'];
// Check if already logged in
if ($current_user !== null) {
header("Location: ./");

View file

@ -25,6 +25,29 @@
padding-left: 0.25rem;
content: '▲';
}
.hidden {
display: none;
visibility: hidden;
opacity: 0;
}
table.hidden + .loading_container {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100vh;
z-index: 99999999;
background-image: url('/img/loader<?= random_int(1, 3) ?>.gif'); /* your icon gif file path */
background-repeat: no-repeat;
background-color: #FFF;
background-position: center;
}
</style>
<main class="bd-main">
@ -55,7 +78,7 @@
</select>
&nbsp;per page
</div>
<table id="archive" class="table is-fullwidth is-hoverable">
<table id="archive" class="table is-fullwidth is-hoverable hidden">
<thead>
<tr class="paginator__sort">
<th data-sort-field="title">Title</th>
@ -64,7 +87,6 @@
</tr>
</thead>
<tbody>
<!-- <i class="fa fa-spinner fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span>-->
<!-- Filled by DataTables -->
</tbody>
<tfoot>
@ -75,6 +97,8 @@
</tr>
</tfoot>
</table>
<div class="loading_container">
</div>
<div class="paginator"></div>
</div>

View file

@ -145,7 +145,7 @@ $flashes = getFlashes();
</header>
<div id="logid" class="content-tab">
<section class="modal-card-body">
<form method="POST" action="../login.php">
<form method="POST" action="/login">
<div class="field">
<label class="label">Username</label>
<div class="control has-icons-left has-icons-right">
@ -181,7 +181,7 @@ $flashes = getFlashes();
</div>
<div id="regid" class="content-tab" style="display:none">
<section class="modal-card-body">
<form method="POST" action="../login.php?register">
<form method="POST" action="/register">
<div class="field">
<label class="label">Username</label>
<div class="control has-icons-left has-icons-right">

View file

@ -7,7 +7,7 @@
<p class="help is-danger subtitle is-6"><?= pp_html_escape($error) ?></p>
<?php if ($password_required): ?>
<h1 class="title is-5">This paste is password-protected.</h1>
<form action="" method="post">
<form method="post">
<div class="field has-addons">
<div class="control">
<input type="hidden" name="id" value="<?= $paste_id; ?>"/>

View file

@ -24,7 +24,7 @@
// Login page
if (isset($_GET['login'])) {
?>
<form action="../login.php?login" method="post">
<form action="/login" method="post">
<div class="columns">
<div class="column">
<h1 class="title is-4">Login</h1>
@ -69,7 +69,7 @@
<?php // Registration page
} elseif (isset($_GET['registeraccount'])) {
?>
<form action="../login.php?registeraccount" method="post">
<form action="/register" method="post">
<div class="columns">
<div class="column">
<h1 class="title is-4">Register</h1>
@ -126,7 +126,7 @@
<?php // Forgot password
} elseif (isset($_GET['forgotpassw'])) {
?>
<form action="../login.php?forgotpassw" method="post">
<form action="/forgot" method="post">
<div class="columns">
<div class="column">
<h1 class="title is-4">Forgot Password</h1>

View file

@ -131,7 +131,7 @@
<h1 class="subtitle is-4">
New Paste
</h1>
<form name="mainForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<form method="POST">
<nav class="level">
<div class="level-left">
<!-- Title -->

View file

@ -22,7 +22,7 @@
?>
<hr>
<h1 class="title is-5">My Profile</h1>
<form action="<?= $_SERVER['PHP_SELF']; ?>" method="post">
<form method="post">
<div class="columns">
<div class="column">
<div class="field">

View file

@ -135,7 +135,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div class="">
<div class="panel-tools">
<?php if ($current_user !== null): ?>
<form action="" method="POST" class="form--inline">
<form method="POST" class="form--inline">
<?php if (isset($csrf_token)): ?>
<input type="hidden" name="csrf_token" value="<?= $csrf_token ?>" />
<?php endif; ?>
@ -228,7 +228,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<!-- Paste Panel -->
<hr>
<h1 class="title is-6 mx-1">Edit Paste</h1>
<form class="form-horizontal" name="mainForm" action="index.php" method="POST">
<form class="form-horizontal" action="/" method="POST">
<nav class="level">
<div class="level-left">
<!-- Title -->