Reformat code.

This commit is contained in:
Floorb 2021-08-22 22:05:26 -04:00
parent 7cd0aec39e
commit 9349d245a0
19 changed files with 1558 additions and 834 deletions

View file

@ -1,6 +1,6 @@
<?php <?php
define('IN_PONEPASTE', 1); define('IN_PONEPASTE', 1);
require_once(__DIR__ . '/../includes/common.php'); require_once(__DIR__ . '/../includes/common.php');
$row = $conn->querySelectOne('SELECT user, pass FROM admin LIMIT 1'); $row = $conn->querySelectOne('SELECT user, pass FROM admin LIMIT 1');
$adminid = $row['user']; $adminid = $row['user'];

View file

@ -39,6 +39,6 @@ class DatabaseHandle {
public function queryInsert(string $query, array $params = null) : int { public function queryInsert(string $query, array $params = null) : int {
$this->query($query, $params); $this->query($query, $params);
return (int)$this->conn->lastInsertId(); return (int) $this->conn->lastInsertId();
} }
} }

View file

@ -1,4 +1,5 @@
<?php <?php
class NonRetardedSSP { class NonRetardedSSP {
public static function run(DatabaseHandle $conn, array $request, string $countQuery, string $query) { public static function run(DatabaseHandle $conn, array $request, string $countQuery, string $query) {
/* Some of these parameters might not be passed; zero is an OK default */ /* Some of these parameters might not be passed; zero is an OK default */

View file

@ -6,7 +6,7 @@ class Tag {
public string $slug; public string $slug;
public function __construct(array $row) { public function __construct(array $row) {
$this->id = (int)$row['id']; $this->id = (int) $row['id'];
$this->name = $row['name']; $this->name = $row['name'];
$this->slug = $row['slug']; $this->slug = $row['slug'];
} }

View file

@ -101,7 +101,7 @@ function captcha($color, $mode, $mul, $allowed) : array {
} }
if (!function_exists('hex2rgb')) { if (!function_exists('hex2rgb')) {
function hex2rgb($hex_str) : array | null { function hex2rgb($hex_str) : array|null {
$hex_str = preg_replace("/[^0-9A-Fa-f]/", '', $hex_str); // Gets a proper hex string $hex_str = preg_replace("/[^0-9A-Fa-f]/", '', $hex_str); // Gets a proper hex string
if (strlen($hex_str) == 6) { if (strlen($hex_str) == 6) {

View file

@ -37,10 +37,12 @@ function getreports($conn, $count = 10) {
} }
function tagsToHtml(string | array $tags) : string { function tagsToHtml(string|array $tags) : string {
$output = ""; $output = "";
if (is_array($tags)) { if (is_array($tags)) {
$tagsSplit = array_map(function($tag) { return $tag['name']; }, $tags); $tagsSplit = array_map(function ($tag) {
return $tag['name'];
}, $tags);
} else { } else {
$tagsSplit = explode(",", $tags); $tagsSplit = explode(",", $tags);
} }
@ -85,7 +87,7 @@ function linkify($value, $protocols = array('http', 'mail'), array $attributes =
}, $value); }, $value);
// Extract text links for each protocol // Extract text links for each protocol
foreach ((array)$protocols as $protocol) { foreach ((array) $protocols as $protocol) {
$value = match ($protocol) { $value = match ($protocol) {
'http', 'https' => preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) { 'http', 'https' => preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', function ($match) use ($protocol, &$links, $attr) {
if ($match[1]) $protocol = $match[1]; if ($match[1]) $protocol = $match[1];

View file

@ -120,12 +120,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$p_encrypt = $_POST['encrypted']; $p_encrypt = $_POST['encrypted'];
if ($p_encrypt == "" || $p_encrypt == null) { if ($p_encrypt == "" || $p_encrypt == null) {
$p_encrypt = "0"; $p_encrypt = "0";
} else { } else {
// Encrypt option // Encrypt option
$p_encrypt = "1"; $p_encrypt = "1";
$p_content = openssl_encrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY); $p_content = openssl_encrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY);
} }
// Set expiry time // Set expiry time
$expires = calculatePasteExpiry($p_expiry); $expires = calculatePasteExpiry($p_expiry);
@ -133,7 +133,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Edit existing paste or create new? // Edit existing paste or create new?
if ($editing) { if ($editing) {
if ($current_user && if ($current_user &&
$current_user->user_id === (int)$conn->querySelectOne('SELECT user_id FROM pastes WHERE id = ?', [$_POST['paste_id']])['user_id']) { $current_user->user_id === (int) $conn->querySelectOne('SELECT user_id FROM pastes WHERE id = ?', [$_POST['paste_id']])['user_id']) {
$paste_id = intval($_POST['paste_id']); $paste_id = intval($_POST['paste_id']);
$conn->query( $conn->query(

View file

@ -47,7 +47,7 @@ if (isset($_POST['forgot'])) {
} }
} elseif (isset($_POST['signin'])) { // Login process } elseif (isset($_POST['signin'])) { // Login process
if (!empty($_POST['username']) && !empty($_POST['password'])) { if (!empty($_POST['username']) && !empty($_POST['password'])) {
$remember_me = (bool)$_POST['remember_me']; $remember_me = (bool) $_POST['remember_me'];
$username = trim($_POST['username']); $username = trim($_POST['username']);
$row = $conn->query("SELECT id, password, banned FROM users WHERE username = ?", [$username]) $row = $conn->query("SELECT id, password, banned FROM users WHERE username = ?", [$username])
->fetch(); ->fetch();
@ -72,7 +72,7 @@ if (isset($_POST['forgot'])) {
$error = $lang['banned']; $error = $lang['banned'];
} else { } else {
// Login successful // Login successful
$_SESSION['user_id'] = (string)$user_id; $_SESSION['user_id'] = (string) $user_id;
if ($remember_me) { if ($remember_me) {
$remember_token = pp_random_token(); $remember_token = pp_random_token();
@ -81,7 +81,7 @@ if (isset($_POST['forgot'])) {
$conn->query('INSERT INTO user_sessions (user_id, token, expire_at) VALUES (?, ?, FROM_UNIXTIME(?))', [$user_id, $remember_token, $expire_at->format('U')]); $conn->query('INSERT INTO user_sessions (user_id, token, expire_at) VALUES (?, ?, FROM_UNIXTIME(?))', [$user_id, $remember_token, $expire_at->format('U')]);
setcookie(User::REMEMBER_TOKEN_COOKIE, $remember_token, [ setcookie(User::REMEMBER_TOKEN_COOKIE, $remember_token, [
'expires' => (int)$expire_at->format('U'), 'expires' => (int) $expire_at->format('U'),
'secure' => !empty($_SERVER['HTTPS']), /* Local dev environment is non-HTTPS */ 'secure' => !empty($_SERVER['HTTPS']), /* Local dev environment is non-HTTPS */
'httponly' => true, 'httponly' => true,
'samesite' => 'Lax' 'samesite' => 'Lax'

View file

@ -62,12 +62,12 @@ $paste = [
'tags' => getPasteTags($conn, $paste_id) 'tags' => getPasteTags($conn, $paste_id)
]; ];
$p_member = $row['member']; $p_member = $row['member'];
$p_content = $row['content']; $p_content = $row['content'];
$p_visible = $row['visible']; $p_visible = $row['visible'];
$p_expiry = $row['expiry']; $p_expiry = $row['expiry'];
$p_password = $row['password']; $p_password = $row['password'];
$p_encrypt = (bool) $row['encrypt']; $p_encrypt = (bool) $row['encrypt'];
$is_private = $row['visible'] === '2'; $is_private = $row['visible'] === '2';
@ -85,7 +85,7 @@ $password_candidate = '';
if ($password_required) { if ($password_required) {
if (!empty($_POST['mypass'])) { if (!empty($_POST['mypass'])) {
$password_candidate = $_POST['mypass']; $password_candidate = $_POST['mypass'];
} else if (!empty($_GET['password'])) { } elseif (!empty($_GET['password'])) {
$password_candidate = @base64_decode($_GET['password']); $password_candidate = @base64_decode($_GET['password']);
} }

View file

@ -1,7 +1,7 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#archive").dataTable({ $("#archive").dataTable({
rowReorder: { selector: 'td:nth-child(2)'}, rowReorder: {selector: 'td:nth-child(2)'},
responsive: true, responsive: true,
processing: true, processing: true,
language: {processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span> '}, language: {processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span> '},

View file

@ -16,7 +16,7 @@ $start = $time;
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php echo basename($default_lang, ".php"); ?>"> <html lang="<?php echo basename($default_lang, ".php"); ?>">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title> <title>
@ -33,9 +33,9 @@ $start = $time;
<meta name="description" content="<?= pp_html_escape($global_site_info['description']) ?>"/> <meta name="description" content="<?= pp_html_escape($global_site_info['description']) ?>"/>
<meta name="keywords" content="<?= pp_html_escape($global_site_info['keywords']) ?>"/> <meta name="keywords" content="<?= pp_html_escape($global_site_info['keywords']) ?>"/>
<link rel="shortcut icon" href="<?php echo '//' . $baseurl . '/theme/' . $default_theme; ?>/img/favicon.ico"> <link rel="shortcut icon" href="<?php echo '//' . $baseurl . '/theme/' . $default_theme; ?>/img/favicon.ico">
<link href="//<?= $baseurl ?>/theme/bulma/css/paste.css" rel="stylesheet" /> <link href="//<?= $baseurl ?>/theme/bulma/css/paste.css" rel="stylesheet"/>
<link href="//<?= $baseurl ?>/theme/bulma/css/table-responsive.css" rel="stylesheet" /> <link href="//<?= $baseurl ?>/theme/bulma/css/table-responsive.css" rel="stylesheet"/>
<link href="//<?= $baseurl ?>/theme/bulma/css/table-row-orders.css" rel="stylesheet" /> <link href="//<?= $baseurl ?>/theme/bulma/css/table-row-orders.css" rel="stylesheet"/>
<script src="//<?= $baseurl ?>/theme/bulma/js/jquery.min.js"></script> <script src="//<?= $baseurl ?>/theme/bulma/js/jquery.min.js"></script>
<script src="//<?= $baseurl ?>/theme/bulma/js/jquery-ui.min.js"></script> <script src="//<?= $baseurl ?>/theme/bulma/js/jquery-ui.min.js"></script>
<script src="//<?= $baseurl ?>/theme/bulma/js/paste.js"></script> <script src="//<?= $baseurl ?>/theme/bulma/js/paste.js"></script>
@ -54,7 +54,7 @@ $start = $time;
class="navbar-item mx-1"><?php echo $site_name; ?></a> class="navbar-item mx-1"><?php echo $site_name; ?></a>
<div class="theme-switch-wrapper"> <div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox"> <label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox" /> <input type="checkbox" id="checkbox"/>
<div class="slider round"></div> <div class="slider round"></div>
</label> </label>
</div> </div>
@ -355,7 +355,6 @@ CONTENT HERE!
</footer> </footer>
<script> <script>
const whenReady = (callback) => { const whenReady = (callback) => {
if (document.readyState !== 'loading') { if (document.readyState !== 'loading') {

File diff suppressed because it is too large Load diff

View file

@ -4,11 +4,13 @@ table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty {
cursor: default !important; cursor: default !important;
background-color: #e8e8e8; background-color: #e8e8e8;
} }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.child:before, table.dataTable.dtr-inline.collapsed > tbody > tr > td.child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.child:before, table.dataTable.dtr-inline.collapsed > tbody > tr > th.child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty:before { table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty:before {
display: none !important; display: none !important;
} }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control, table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control { table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
position: relative; position: relative;
@ -16,10 +18,11 @@ table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
padding-top: 25px; padding-top: 25px;
cursor: pointer; cursor: pointer;
} }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before, table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before { table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
top: 50%; top: 50%;
left: 5px; left: 5px;
height: 1em; height: 1em;
width: 1em; width: 1em;
margin-top: -9px; margin-top: -9px;
@ -30,20 +33,23 @@ table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
box-sizing: content-box; box-sizing: content-box;
text-align: center; text-align: center;
text-indent: 0 !important; text-indent: 0 !important;
font-family: 'Font Awesome\ 5 Free'; font-family: 'Font Awesome\ 5 Free';
font-weight: 900; font-weight: 900;
line-height: 1em; line-height: 1em;
content:"\f054"; content: "\f054";
color: #3298dc; color: #3298dc;
} }
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before, table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before { table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
content:"\f078"; content: "\f078";
} }
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td.dtr-control, table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th.dtr-control { table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th.dtr-control {
padding-left: 27px; padding-left: 27px;
} }
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td.dtr-control:before, table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th.dtr-control:before { table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th.dtr-control:before {
left: 4px; left: 4px;
@ -53,6 +59,7 @@ table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th.dtr-control:befor
line-height: 14px; line-height: 14px;
text-indent: 3px; text-indent: 3px;
} }
table.dataTable.dtr-column > tbody > tr > td.dtr-control, table.dataTable.dtr-column > tbody > tr > td.dtr-control,
table.dataTable.dtr-column > tbody > tr > th.dtr-control, table.dataTable.dtr-column > tbody > tr > th.dtr-control,
table.dataTable.dtr-column > tbody > tr > td.control, table.dataTable.dtr-column > tbody > tr > td.control,
@ -60,12 +67,13 @@ table.dataTable.dtr-column > tbody > tr > th.control {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
} }
table.dataTable.dtr-column > tbody > tr > td.dtr-control:before, table.dataTable.dtr-column > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > th.dtr-control:before, table.dataTable.dtr-column > tbody > tr > th.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > td.control:before, table.dataTable.dtr-column > tbody > tr > td.control:before,
table.dataTable.dtr-column > tbody > tr > th.control:before { table.dataTable.dtr-column > tbody > tr > th.control:before {
top: 50%; top: 50%;
left: 5px; left: 5px;
height: 1em; height: 1em;
width: 1em; width: 1em;
margin-top: -9px; margin-top: -9px;
@ -76,45 +84,54 @@ table.dataTable.dtr-column > tbody > tr > th.control:before {
box-sizing: content-box; box-sizing: content-box;
text-align: center; text-align: center;
text-indent: 0 !important; text-indent: 0 !important;
font-family: 'Font Awesome\ 5 Free'; font-family: 'Font Awesome\ 5 Free';
font-weight: 900; font-weight: 900;
line-height: 1em; line-height: 1em;
content:"\f054"; content: "\f054";
color: #3298dc; color: #3298dc;
} }
table.dataTable.dtr-column > tbody > tr.parent td.dtr-control:before, table.dataTable.dtr-column > tbody > tr.parent td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.parent th.dtr-control:before, table.dataTable.dtr-column > tbody > tr.parent th.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.parent td.control:before, table.dataTable.dtr-column > tbody > tr.parent td.control:before,
table.dataTable.dtr-column > tbody > tr.parent th.control:before { table.dataTable.dtr-column > tbody > tr.parent th.control:before {
content:"\f078"; content: "\f078";
} }
table.dataTable > tbody > tr.child { table.dataTable > tbody > tr.child {
padding: 0.5em 1em; padding: 0.5em 1em;
} }
table.dataTable > tbody > tr.child:hover { table.dataTable > tbody > tr.child:hover {
background: transparent !important; background: transparent !important;
} }
table.dataTable > tbody > tr.child ul.dtr-details { table.dataTable > tbody > tr.child ul.dtr-details {
display: inline-block; display: inline-block;
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
table.dataTable > tbody > tr.child ul.dtr-details > li { table.dataTable > tbody > tr.child ul.dtr-details > li {
border-bottom: 1px solid #efefef; border-bottom: 1px solid #efefef;
padding: 0.5em 0; padding: 0.5em 0;
} }
table.dataTable > tbody > tr.child ul.dtr-details > li:first-child { table.dataTable > tbody > tr.child ul.dtr-details > li:first-child {
padding-top: 0; padding-top: 0;
} }
table.dataTable > tbody > tr.child ul.dtr-details > li:last-child { table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
border-bottom: none; border-bottom: none;
} }
table.dataTable > tbody > tr.child span.dtr-title { table.dataTable > tbody > tr.child span.dtr-title {
display: inline-block; display: inline-block;
min-width: 75px; min-width: 75px;
font-weight: bold; font-weight: bold;
} }
div.dtr-modal { div.dtr-modal {
position: fixed; position: fixed;
box-sizing: border-box; box-sizing: border-box;
@ -125,6 +142,7 @@ div.dtr-modal {
z-index: 100; z-index: 100;
padding: 10em 1em; padding: 10em 1em;
} }
div.dtr-modal div.dtr-modal-display { div.dtr-modal div.dtr-modal-display {
position: absolute; position: absolute;
top: 0; top: 0;
@ -142,10 +160,12 @@ div.dtr-modal div.dtr-modal-display {
border-radius: 0.5em; border-radius: 0.5em;
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
} }
div.dtr-modal div.dtr-modal-content { div.dtr-modal div.dtr-modal-content {
position: relative; position: relative;
padding: 1em; padding: 1em;
} }
div.dtr-modal div.dtr-modal-close { div.dtr-modal div.dtr-modal-close {
position: absolute; position: absolute;
top: 6px; top: 6px;
@ -159,9 +179,11 @@ div.dtr-modal div.dtr-modal-close {
cursor: pointer; cursor: pointer;
z-index: 12; z-index: 12;
} }
div.dtr-modal div.dtr-modal-close:hover { div.dtr-modal div.dtr-modal-close:hover {
background-color: #eaeaea; background-color: #eaeaea;
} }
div.dtr-modal div.dtr-modal-background { div.dtr-modal div.dtr-modal-background {
position: fixed; position: fixed;
top: 0; top: 0;
@ -171,6 +193,7 @@ div.dtr-modal div.dtr-modal-background {
z-index: 101; z-index: 101;
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.6);
} }
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
div.dtr-modal div.dtr-modal-display { div.dtr-modal div.dtr-modal-display {
width: 95%; width: 95%;

View file

@ -6,13 +6,16 @@ table.dt-rowReorder-float {
outline-offset: -2px; outline-offset: -2px;
z-index: 2001; z-index: 2001;
} }
tr.dt-rowReorder-moving { tr.dt-rowReorder-moving {
outline: 2px solid #555; outline: 2px solid #555;
outline-offset: -2px; outline-offset: -2px;
} }
body.dt-rowReorder-noOverflow { body.dt-rowReorder-noOverflow {
overflow-x: hidden; overflow-x: hidden;
} }
table.dataTable td.reorder { table.dataTable td.reorder {
text-align: center; text-align: center;
cursor: move; cursor: move;

View file

@ -15,9 +15,9 @@
<form action="" method="post"> <form action="" method="post">
<div class="field has-addons"> <div class="field has-addons">
<div class="control"> <div class="control">
<input type="hidden" name="id" value="<?php echo $paste_id; ?>" /> <input type="hidden" name="id" value="<?php echo $paste_id; ?>"/>
<input type="password" class="input" name="mypass" <input type="password" class="input" name="mypass"
placeholder="<?php echo $lang['enterpwd']; ?>" /> placeholder="<?php echo $lang['enterpwd']; ?>"/>
</div> </div>
</div> </div>
<button type="submit" name="submit" class="button is-info">Submit</button> <button type="submit" name="submit" class="button is-info">Submit</button>

View file

@ -2,29 +2,29 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="theme/bulma/js/bulma-tagsinput.min.js"></script> <script src="theme/bulma/js/bulma-tagsinput.min.js"></script>
<script> <script>
function setupTagsInput() { function setupTagsInput() {
const tagsInput = document.getElementById('tags-with-source'); const tagsInput = document.getElementById('tags-with-source');
new BulmaTagsInput(tagsInput, { new BulmaTagsInput(tagsInput, {
allowDuplicates: false, allowDuplicates: false,
caseSensitive: false, caseSensitive: false,
clearSelectionOnTyping: false, clearSelectionOnTyping: false,
closeDropdownOnItemSelect: true, closeDropdownOnItemSelect: true,
delimiter: ',', delimiter: ',',
freeInput: true, freeInput: true,
highlightDuplicate: true, highlightDuplicate: true,
highlightMatchesString: true, highlightMatchesString: true,
itemText: 'name', itemText: 'name',
maxTags: 10, maxTags: 10,
maxChars: 40, maxChars: 40,
minChars: 1, minChars: 1,
noResultsLabel: 'No results found', noResultsLabel: 'No results found',
placeholder: '10 Tags Maximum"', placeholder: '10 Tags Maximum"',
removable: true, removable: true,
searchMinChars: 1, searchMinChars: 1,
searchOn: 'text', searchOn: 'text',
selectable: true, selectable: true,
tagClass: 'is-info', tagClass: 'is-info',
trim: true, trim: true,
}); });
} }
@ -191,12 +191,12 @@ function setupTagsInput() {
<select data-live-search="true" name="format"> <select data-live-search="true" name="format">
<?php <?php
foreach (PP_HIGHLIGHT_FORMATS as $code => $name) { foreach (PP_HIGHLIGHT_FORMATS as $code => $name) {
if (isset($_POST['format'])) { if (isset($_POST['format'])) {
$sel = ($_POST['format'] == $code) ? 'selected="selected"' : ''; // Pre-populate if we come here on an error $sel = ($_POST['format'] == $code) ? 'selected="selected"' : ''; // Pre-populate if we come here on an error
} else { } else {
$sel = ($code == "markdown") ? 'selected="selected"' : ''; $sel = ($code == "markdown") ? 'selected="selected"' : '';
} }
echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>'; echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>';
} }
?> ?>
</select> </select>
@ -329,7 +329,7 @@ function setupTagsInput() {
<div class="column"> <div class="column">
<input type="text" class="input" name="pass" id="pass" <input type="text" class="input" name="pass" id="pass"
placeholder="<?php echo $lang['pwopt']; ?>" placeholder="<?php echo $lang['pwopt']; ?>"
value="<?php echo (isset($_POST['pass'])) ? pp_html_escape($_POST['pass']) : ''; ?>" /> value="<?php echo (isset($_POST['pass'])) ? pp_html_escape($_POST['pass']) : ''; ?>"/>
</div> </div>
</div> </div>
</div> </div>

View file

@ -34,7 +34,8 @@
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<button disabled type="submit" name="Gen_key" class="button is-info">Generate New Key</button> <button disabled type="submit" name="Gen_key" class="button is-info">Generate New Key
</button>
<br> <br>
<small>Coming soon</small> <small>Coming soon</small>
</div> </div>

View file

@ -1,8 +1,8 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#archive").dataTable({ $("#archive").dataTable({
rowReorder: { selector: 'td:nth-child(2)'}, rowReorder: {selector: 'td:nth-child(2)'},
responsive: true, responsive: true,
pageLength: 50, pageLength: 50,
autoWidth: false, autoWidth: false,
initComplete: function () { initComplete: function () {
@ -19,23 +19,23 @@
</script> </script>
<?php if ($current_user) { ?> <?php if ($current_user) { ?>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#favs").dataTable({ $("#favs").dataTable({
rowReorder: { selector: 'td:nth-child(2)'}, rowReorder: {selector: 'td:nth-child(2)'},
responsive: true, responsive: true,
pageLength: 50, pageLength: 50,
autoWidth: false, autoWidth: false,
initComplete: function () { initComplete: function () {
var search = new URLSearchParams(window.location.search); var search = new URLSearchParams(window.location.search);
var query = search.get('q'); var query = search.get('q');
if (query) { if (query) {
$("#archive_filter input") $("#archive_filter input")
.val(query) .val(query)
.trigger("input"); .trigger("input");
}
} }
} })
}) });
});
</script> </script>
<?php } ?> <?php } ?>
<main class="bd-main"> <main class="bd-main">
@ -232,7 +232,7 @@
' . strtoupper($p_code) . ' ' . strtoupper($p_code) . '
</td> </td>
<td class="td-center"> <td class="td-center">
<a href="' . $protocol . $baseurl . '/' . $p_delete_link . '" title="' . $title . '" onClick="return confirm(' . $p_delete_message. ')"><i class="far fa-trash-alt fa-lg" aria-hidden="true"></i></a> <a href="' . $protocol . $baseurl . '/' . $p_delete_link . '" title="' . $title . '" onClick="return confirm(' . $p_delete_message . ')"><i class="far fa-trash-alt fa-lg" aria-hidden="true"></i></a>
</td> </td>
</tr>'; </tr>';
} }
@ -264,7 +264,9 @@
$f_dateui = $f_date->format("d F Y"); $f_dateui = $f_date->format("d F Y");
$Recent_update = new DateTime($row['updated_at']); $Recent_update = new DateTime($row['updated_at']);
$Recent_update_u = date_format($Recent_update, 'U'); $Recent_update_u = date_format($Recent_update, 'U');
$tagArray2 = array_map(function ($tag) { return $tag['name'];}, getPasteTags($conn, $f_id)); $tagArray2 = array_map(function ($tag) {
return $tag['name'];
}, getPasteTags($conn, $f_id));
$f_tags = implode(',', $tagArray2); $f_tags = implode(',', $tagArray2);
//$p_link = ($mod_rewrite == '1') ? "$f_id" : "paste.php?favdel=$fu_id"; //$p_link = ($mod_rewrite == '1') ? "$f_id" : "paste.php?favdel=$fu_id";
//$f_delete_link = ($mod_rewrite == '1') ? "user.php?favdel&user=$profile_username&fid=$f_id" : "user.php?favdel&user=$profile_username&fid=$f_id"; //$f_delete_link = ($mod_rewrite == '1') ? "user.php?favdel&user=$profile_username&fid=$f_id" : "user.php?favdel&user=$profile_username&fid=$f_id";
@ -289,13 +291,13 @@
</td> </td>
<td class="td-left">'; <td class="td-left">';
if (strlen($f_tags) > 0) { if (strlen($f_tags) > 0) {
foreach ($tagArray2 as $tags) { foreach ($tagArray2 as $tags) {
echo '<a href="' . $protocol . $baseurl . '/user.php?user=' . $profile_username . '&q=' . $tags . '"><span class="tag is-info">' . trim($tags) . '</span></a>'; echo '<a href="' . $protocol . $baseurl . '/user.php?user=' . $profile_username . '&q=' . $tags . '"><span class="tag is-info">' . trim($tags) . '</span></a>';
} }
} else { } else {
echo ' <span class="tag is-warning">No tags</span>'; echo ' <span class="tag is-warning">No tags</span>';
} }
echo '</td> echo '</td>

View file

@ -1,7 +1,7 @@
<link rel="stylesheet" href="theme/bulma/css/bulma-tagsinput.min.css"/> <link rel="stylesheet" href="theme/bulma/css/bulma-tagsinput.min.css"/>
<script src="theme/bulma/js/bulma-tagsinput.min.js"></script> <script src="theme/bulma/js/bulma-tagsinput.min.js"></script>
<script> <script>
function setupTagsInput() { function setupTagsInput() {
const tagsInput = document.getElementById('tags-with-source'); const tagsInput = document.getElementById('tags-with-source');
if (tagsInput) { if (tagsInput) {
@ -68,7 +68,7 @@ function setupTagsInput() {
}); });
</script> </script>
<?php if ($using_highlighter): ?> <?php if ($using_highlighter): ?>
<link rel="stylesheet" href="/vendor/scrivo/highlight.php/styles/default.css" /> <link rel="stylesheet" href="/vendor/scrivo/highlight.php/styles/default.css"/>
<?php endif; ?> <?php endif; ?>
<?php <?php
$protocol = paste_protocol(); $protocol = paste_protocol();
@ -212,7 +212,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
} else { } else {
echo 'paste.php?embed&id='; echo 'paste.php?embed&id=';
} }
echo $paste_id . '"></script>'; ?>' readonly /> echo $paste_id . '"></script>'; ?>' readonly/>
</div> </div>
</div> </div>
</div> </div>
@ -245,7 +245,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<div id="paste" style="line-height:1!important;"><?= $p_content ?></div> <div id="paste" style="line-height:1!important;"><?= $p_content ?></div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<!-- Guests --> <!-- Guests -->
@ -295,7 +295,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<p class="control has-icons-left"> <p class="control has-icons-left">
<input type="text" class="input" name="title" <input type="text" class="input" name="title"
placeholder="<?= $paste['title'] ?>" placeholder="<?= $paste['title'] ?>"
value="<?= $paste['title'] ?>" /> value="<?= $paste['title'] ?>"/>
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<i class="fa fa-font"></i> <i class="fa fa-font"></i>
</span> </span>
@ -308,8 +308,8 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<select data-live-search="true" name="format"> <select data-live-search="true" name="format">
<?php // Show popular GeSHi formats <?php // Show popular GeSHi formats
foreach (PP_HIGHLIGHT_FORMATS as $code => $name) { foreach (PP_HIGHLIGHT_FORMATS as $code => $name) {
$sel = ($paste['code'] == $code) ? 'selected="selected"' : ' '; $sel = ($paste['code'] == $code) ? 'selected="selected"' : ' ';
echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>'; echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>';
} }
?> ?>
</select> </select>
@ -346,8 +346,8 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
$inputtags = $paste['tags']; $inputtags = $paste['tags'];
foreach ($inputtags as $tag) { foreach ($inputtags as $tag) {
$tagsName = ucfirst(pp_html_escape($tag['name'])); $tagsName = ucfirst(pp_html_escape($tag['name']));
echo ','.$tagsName.''; echo ',' . $tagsName . '';
}?>"> } ?>">
</div> </div>
</div> </div>
</div> </div>
@ -412,7 +412,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<input type="text" class="input" name="pass" id="pass" value="" <input type="text" class="input" name="pass" id="pass" value=""
placeholder="<?php echo $lang['pwopt']; ?>" /> placeholder="<?php echo $lang['pwopt']; ?>"/>
</div> </div>
</div> </div>
</div> </div>