mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
Make markup more valid
This commit is contained in:
parent
d55c382fe8
commit
584ef2f40a
10 changed files with 106 additions and 129 deletions
|
@ -10,6 +10,16 @@ require_once(__DIR__ . '/User.class.php');
|
|||
require_once(__DIR__ . '/ViewBag.class.php');
|
||||
|
||||
/* View functions */
|
||||
function urlForPage($page = '') : string {
|
||||
if (!PP_MOD_REWRITE) {
|
||||
$page .= '.php';
|
||||
}
|
||||
|
||||
return (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/' . $page;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function urlForPaste($paste_id) : string {
|
||||
if (PP_MOD_REWRITE) {
|
||||
return "/${paste_id}";
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
<th>Tags</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Filled by DataTables -->
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
|
@ -51,8 +54,6 @@
|
|||
<th>Tags</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
|
|
@ -7,7 +7,6 @@ if (!in_array($page_template . '.php', $template_candidates)) {
|
|||
|
||||
$start = microtime(true);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -61,107 +60,71 @@ $start = microtime(true);
|
|||
<div id="navMenuDocumentation" class="navbar-menu">
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item">
|
||||
<?php if ($current_user !== null) {
|
||||
if (!$site_is_private) {
|
||||
if (PP_MOD_REWRITE) {
|
||||
echo ' <a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/">
|
||||
<?php if ($current_user !== null): ?>
|
||||
<?php if (!$site_is_private): ?>
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage() ?>">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span><span>New Paste</span>
|
||||
</a><a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/archive">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Discover</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span></a>';
|
||||
} else {
|
||||
echo '
|
||||
</span>
|
||||
<span>Archive</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/archive">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Lightmode</span>
|
||||
<span>New Paste</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Lightmode</span>
|
||||
</a>
|
||||
<span>Discover</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span></a>';
|
||||
}
|
||||
}
|
||||
echo '<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link" role="presentation">' . pp_html_escape($current_user->username) . '</a>
|
||||
<div class="navbar-dropdown">';
|
||||
if (PP_MOD_REWRITE) {
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/user/' . urlencode($current_user->username) . '">Pastes</a>';
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/profile">Settings</a>';
|
||||
} else {
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/user.php?user=' . urlencode($current_user->username) . '">Pastes</a>';
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/profile.php">Settings</a>';
|
||||
}
|
||||
?>
|
||||
<hr class="navbar-divider"/>
|
||||
<form action="../logout.php" method="POST">
|
||||
<input class="button navbar-link" type="submit" value="Logout"
|
||||
style="border:none;padding: 0.375rem 1rem;"/>
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
<div class="buttons">
|
||||
<?php
|
||||
if (!$site_is_private) {
|
||||
if (PP_MOD_REWRITE) {
|
||||
echo '<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/archive">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span></a>
|
||||
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Discover</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span>';
|
||||
} else {
|
||||
echo '<a class="button" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover.php">
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage('archive') ?>">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event.php">
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage('discover') ?>">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Discover</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage('event') ?>">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<span>Events</span>
|
||||
</a>
|
||||
<?php endif; /* !$site_is_private */ ?>
|
||||
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link" role="presentation"><?= pp_html_escape($current_user->username) ?></a>
|
||||
<div class="navbar-dropdown">
|
||||
<a class="navbar-item" href="<?= urlForMember($current_user->username) ?>">Pastes</a>
|
||||
<a class="navbar-item" href="<?= urlForPage('profile') ?>">Settings</a>
|
||||
<hr class="navbar-divider"/>
|
||||
<form action="<?= urlForPage('logout') ?>" method="POST">
|
||||
<input class="button navbar-link" type="submit" value="Logout"
|
||||
style="border:none;padding: 0.375rem 1rem;" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: /* $current_user !== null */ ?>
|
||||
<div class="buttons">
|
||||
<?php if (!$site_is_private): ?>
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage('archive') ?>">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage('discover') ?>r">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Discover</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="<?= urlForPage('event') ?>">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a class="button is-info modal-button" data-target="#signin">Sign In</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -250,7 +213,7 @@ $start = microtime(true);
|
|||
</div>
|
||||
<div class="field">
|
||||
<div class="notification">
|
||||
<span class="tags are-large"><?= '<img src="' . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA" class="imagever">'; ?></span>
|
||||
<span class="tags are-large"><img src="<?= $_SESSION['captcha']['image_src'] ?>" alt="CAPTCHA" class="imagever" /></span>
|
||||
<input type="text" class="input" name="scode" value=""
|
||||
placeholder="Enter the CAPTCHA">
|
||||
<p class="is-size-6 has-text-grey-light has-text-left mt-2">and press
|
||||
|
@ -282,8 +245,8 @@ $start = microtime(true);
|
|||
<div class="columns is-mobile is-centered">
|
||||
<h5 class="title is-5">Support PonePaste</h5>
|
||||
</div>
|
||||
<a href='https://liberapay.com/Ponepaste/donate' target='_blank'><img src='../img/lib.png'/></a>
|
||||
<a href='https://ko-fi.com/V7V02K3I2' target='_blank'><img src='../img/kofi.png'/></a>
|
||||
<a href='https://liberapay.com/Ponepaste/donate' target='_blank'><img src='../img/lib.png' alt="LiberaPay logo" /></a>
|
||||
<a href='https://ko-fi.com/V7V02K3I2' target='_blank'><img src='../img/kofi.png' alt="Ko-Fi logo" /></a>
|
||||
</div>
|
||||
<div class="column">
|
||||
<hr>
|
||||
|
|
|
@ -211,6 +211,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<b> What do I win? </b>
|
||||
<p style="color:green;"> >A fucking badge, plus the best pony game the host can
|
||||
find.</p>
|
||||
<img src="/img/prize.png">
|
||||
<img src="/img/prize.png" alt="Prize" />
|
||||
<p>Note: This is a steam game, winner will be sent a cdkey</p>
|
||||
<br>
|
||||
<b> What do I have to do? </b>
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
</div>
|
||||
<div class="field">
|
||||
<div class="notification">
|
||||
<span class="tags are-large"><?php echo '<img src="' . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA" class="imagever">'; ?></span>
|
||||
<span class="tags are-large"><img src="<?= $_SESSION['captcha']['image_src'] ?>" alt="CAPTCHA" class="imagever" /></span>
|
||||
<input type="text" class="input" name="scode" value=""
|
||||
placeholder="Enter the CAPTCHA">
|
||||
<p class="is-size-6 has-text-grey-light has-text-left mt-2">and
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
</div>
|
||||
<div class="level-item is-pulled-left mx-1">
|
||||
<a class="button" onclick="highlight(document.getElementById('code')); return false;"><i
|
||||
class="fas fa-indent"></i> Highlight</a>
|
||||
class="fas fa-indent"></i> Highlight</a>
|
||||
</div>
|
||||
<div class="level-item is-pulled-left mx-1">
|
||||
<input class="button is-info" type="submit" name="submit" id="submit" value="Paste"/>
|
||||
|
@ -183,10 +183,10 @@
|
|||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Tags</label>
|
||||
<label class="label" for="field_tags">Tags</label>
|
||||
<div class="control">
|
||||
<input name="tag_input" class="input js-tag-input"
|
||||
value="<?php echo (isset($_POST['tag_input'])) ? pp_html_escape($_POST['tag_input']) : ''; // Pre-populate if we come here on an error" ?>">
|
||||
<input name="tag_input" class="input js-tag-input" id="field_tags"
|
||||
value="<?= (isset($_POST['tag_input'])) ? pp_html_escape($_POST['tag_input']) : ''; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -315,7 +315,7 @@
|
|||
<?php if ($captcha_config['enabled'] && $current_user === null): ?>
|
||||
<div class="is-one-quarter">
|
||||
<div class="notification">
|
||||
<span class="tags are-large"><?php echo '<img src="' . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA" class="imagever">'; ?></span>
|
||||
<span class="tags are-large"><img src="<?= $_SESSION['captcha']['image_src'] ?>" alt="CAPTCHA" class="imagever" /></span>
|
||||
<input type="text" class="input" name="scode" value=""
|
||||
placeholder="Enter the CAPTCHA">
|
||||
<p class="is-size-6 has-text-grey-light has-text-left mt-2">and press
|
||||
|
@ -325,6 +325,7 @@
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -147,20 +147,7 @@
|
|||
} ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="td-center">Title</td>
|
||||
<td class="td-center">Paste Time</td>
|
||||
<?php if ($is_current_user) {
|
||||
echo "<td class='td-center'>Visibility</td>";
|
||||
} ?>
|
||||
<td class="td-center">Views</td>
|
||||
<td class="td-center">Tags</td>
|
||||
<?php if ($is_current_user) {
|
||||
echo "<td class='td-center'>Delete</td>";
|
||||
} ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($profile_pastes as $row) {
|
||||
|
@ -237,6 +224,20 @@
|
|||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="td-center">Title</td>
|
||||
<td class="td-center">Paste Time</td>
|
||||
<?php if ($is_current_user) {
|
||||
echo "<td class='td-center'>Visibility</td>";
|
||||
} ?>
|
||||
<td class="td-center">Views</td>
|
||||
<td class="td-center">Tags</td>
|
||||
<?php if ($is_current_user) {
|
||||
echo "<td class='td-center'>Delete</td>";
|
||||
} ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($is_current_user) { ?>
|
||||
|
|
|
@ -323,7 +323,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
|
|||
<div class="level-item is-pulled-left mx-1">
|
||||
<a class="button"
|
||||
onclick="highlight(document.getElementById('code')); return false;"><i
|
||||
class="fa fa-indent"></i> Highlight</a>
|
||||
class="fa fa-indent"></i> Highlight</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
6
user.php
6
user.php
|
@ -40,9 +40,9 @@ $total_yfav = intval($query->fetch(PDO::FETCH_NUM)[0]);
|
|||
|
||||
// Badges
|
||||
$profile_badge = match ($profile_info['badge']) {
|
||||
1 => '<img src = "/img/badges/donate.png" title="[Donated] Donated to Ponepaste" style="margin:5px">',
|
||||
2 => '<img src = "/img/badges/spoon.png" title="[TheWoodenSpoon] You had one job" style="margin:5px">',
|
||||
3 => '<img src = "/img/badges/abadge.png" title="[>AFuckingBadge] Won a PasteJam Competition" style="margin:5px">',
|
||||
1 => '<img src="/img/badges/donate.png" title="[Donated] Donated to Ponepaste" style="margin:5px" alt="Donated to PonePaste" />',
|
||||
2 => '<img src="/img/badges/spoon.png" title="[TheWoodenSpoon] You had one job" style="margin:5px" alt="You had one job" />',
|
||||
3 => '<img src="/img/badges/abadge.png" title="[>AFuckingBadge] Won a PasteJam Competition" style="margin:5px" alt="Won a PasteJam competition" />',
|
||||
default => '',
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue