diff --git a/admin/configuration.php b/admin/configuration.php
index b823f17..cb6f63c 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -75,8 +75,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
';
} elseif ($action === 'captcha') {
$new_captcha = [
- 'enabled' => ($_POST['captcha']['enabled'] === '1'),
- 'multiple' => ($_POST['captcha']['multiple'] === '1')
+ 'enabled' => ($_POST['captcha']['enabled'] === '1'),
+ 'multiple' => ($_POST['captcha']['multiple'] === '1')
];
$current_config['captcha'] = $new_captcha;
@@ -157,67 +157,81 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
action="= $_SERVER['PHP_SELF']; ?>">
diff --git a/admin/js/bootstrap-select.js b/admin/js/bootstrap-select.js
index 4354411..5006159 100644
--- a/admin/js/bootstrap-select.js
+++ b/admin/js/bootstrap-select.js
@@ -721,7 +721,7 @@
that.setSelected(clickedIndex, true);
} else {
var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ?
- that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
+ that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
$notify = $('');
diff --git a/includes/DatabaseHandle.class.php b/includes/DatabaseHandle.class.php
index 44a474b..8a552e8 100644
--- a/includes/DatabaseHandle.class.php
+++ b/includes/DatabaseHandle.class.php
@@ -26,7 +26,7 @@ class DatabaseHandle {
return $stmt;
}
- public function querySelectOne(string $query, array $params = null) : array | null {
+ public function querySelectOne(string $query, array $params = null) : array|null {
$stmt = $this->query($query, $params);
if ($row = $stmt->fetch()) {
@@ -39,6 +39,6 @@ class DatabaseHandle {
public function queryInsert(string $query, array $params = null) : int {
$this->query($query, $params);
- return (int) $this->conn->lastInsertId();
+ return (int)$this->conn->lastInsertId();
}
}
diff --git a/includes/Tag.class.php b/includes/Tag.class.php
index ab0c978..aa50c37 100644
--- a/includes/Tag.class.php
+++ b/includes/Tag.class.php
@@ -6,7 +6,7 @@ class Tag {
public string $slug;
public function __construct(array $row) {
- $this->id = (int) $row['id'];
+ $this->id = (int)$row['id'];
$this->name = $row['name'];
$this->slug = $row['slug'];
}
@@ -22,13 +22,13 @@ class Tag {
$new_tag_id = $conn->queryInsert('INSERT INTO tags (name, slug) VALUES (?, ?)', [$name, $new_slug]);
return new Tag([
- 'id' => $new_tag_id,
- 'name' => $name,
- 'slug' => $new_slug
+ 'id' => $new_tag_id,
+ 'name' => $name,
+ 'slug' => $new_slug
]);
}
- public static function findBySlug(DatabaseHandle $conn, string $slug) : Tag | null {
+ public static function findBySlug(DatabaseHandle $conn, string $slug) : Tag|null {
if ($row = $conn->querySelectOne('SELECT id, name, slug FROM tags WHERE slug = ?', [$slug])) {
return new Tag($row);
}
@@ -72,7 +72,7 @@ class Tag {
$cleanTags = [];
foreach (explode(',', $tagInput) as $tagName) {
- $cleanName = Tag::cleanTagName($tagName);
+ $cleanName = Tag::cleanTagName($tagName);
if (!empty($cleanName)) {
array_push($cleanTags, $cleanName);
@@ -85,7 +85,7 @@ class Tag {
private static function encodeSlug(string $name) : string {
/* This one's a doozy. */
$name = str_replace(
- ['-', '/', '\\', ':', '.', '+'],
+ ['-', '/', '\\', ':', '.', '+'],
['-dash-', '-fwslash-', '-bwslash-', '-colon-', '-dot-', '-plus-'],
$name
);
diff --git a/includes/common.php b/includes/common.php
index ebb2ea6..dd124e1 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -130,7 +130,7 @@ $noguests = $disableguest;
// CAPTCHA configuration
$captcha_config = $site_info['captcha'];
-$captcha_enabled = (bool) $captcha_config['enabled'];
+$captcha_enabled = (bool)$captcha_config['enabled'];
// Prevent a potential LFI (you never know :p)
$lang_file = "${default_lang}.php";
diff --git a/includes/functions.php b/includes/functions.php
index bf9ea81..db2566d 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -73,7 +73,7 @@ function sandwitch($str) {
function getevent($conn, $event_name, $count) {
- $query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member, tagsys FROM pastes WHERE visible='1' AND tagsys LIKE '%?%'
+ $query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member FROM pastes WHERE visible='1' AND tagsys LIKE '%?%'
ORDER BY RAND () LIMIT 0, ?");
$query->execute([$event_name, $count]);
return $query->fetchAll();
diff --git a/index.php b/index.php
index aa7357c..c32bf6b 100644
--- a/index.php
+++ b/index.php
@@ -27,17 +27,17 @@ require_once('includes/captcha.php');
require_once('includes/functions.php');
require_once('includes/Tag.class.php');
-function verifyCaptcha() : string | bool {
+function verifyCaptcha() : string|bool {
global $captcha_config;
global $lang;
global $current_user;
if ($captcha_config['enabled'] && !$current_user) {
- $scode = strtolower(htmlentities(Trim($_POST['scode'])));
- $cap_code = strtolower($_SESSION['captcha']['code']);
- if ($cap_code !== $scode) {
- return $lang['image_wrong']; // Wrong captcha.
- }
+ $scode = strtolower(htmlentities(Trim($_POST['scode'])));
+ $cap_code = strtolower($_SESSION['captcha']['code']);
+ if ($cap_code !== $scode) {
+ return $lang['image_wrong']; // Wrong captcha.
+ }
}
return true;
@@ -157,7 +157,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Edit existing paste or create new?
if ($editing) {
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']);
$conn->query(
diff --git a/paste.php b/paste.php
index 7bea66f..44b6d0a 100644
--- a/paste.php
+++ b/paste.php
@@ -39,7 +39,7 @@ $fav_count = intval($query->fetch(PDO::FETCH_NUM)[0]);
// Get paste info
$row = $conn->querySelectOne(
- 'SELECT title, content, visible, code, expiry, pastes.password AS password, created_at, updated_at, encrypt, views, tagsys, users.username AS member, users.id AS user_id
+ 'SELECT title, content, visible, code, expiry, pastes.password AS password, created_at, updated_at, encrypt, views, users.username AS member, users.id AS user_id
FROM pastes
INNER JOIN users ON users.id = pastes.user_id
WHERE pastes.id = ?', [$paste_id]);
diff --git a/theme/bulma/js/bootstrap-select.js b/theme/bulma/js/bootstrap-select.js
index 4354411..5006159 100644
--- a/theme/bulma/js/bootstrap-select.js
+++ b/theme/bulma/js/bootstrap-select.js
@@ -721,7 +721,7 @@
that.setSelected(clickedIndex, true);
} else {
var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ?
- that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
+ that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
$notify = $('');
diff --git a/theme/bulma/js/tokenize2.js b/theme/bulma/js/tokenize2.js
index b37732a..bdb30aa 100644
--- a/theme/bulma/js/tokenize2.js
+++ b/theme/bulma/js/tokenize2.js
@@ -2341,8 +2341,8 @@
}
var distances = sortByDistanceDesc(this.getContainerDimensions(),
- pointer,
- lastPointer),
+ pointer,
+ lastPointer),
i = distances.length
while (i--) {
@@ -2513,8 +2513,8 @@
},
searchValidTarget: function (pointer, lastPointer) {
var distances = sortByDistanceDesc(this.getItemDimensions(),
- pointer,
- lastPointer),
+ pointer,
+ lastPointer),
i = distances.length,
rootGroup = this.rootGroup,
validTarget = !rootGroup.options.isValidTarget ||
diff --git a/theme/bulma/main.php b/theme/bulma/main.php
index dd4d9c7..1a64e8f 100644
--- a/theme/bulma/main.php
+++ b/theme/bulma/main.php
@@ -22,14 +22,14 @@
function setupTagsInput() {
const tagsInput = document.getElementById('tags-with-source');
new BulmaTagsInput(tagsInput, {
- source: async function(value) {
- // Value equal input value
- // We can then use it to request data from external API
- return await fetch("/api/tags_autocomplete.php?tag=" + encodeURIComponent(value))
- .then(function(response) {
- return response.json();
- });
- }
+ source: async function (value) {
+ // Value equal input value
+ // We can then use it to request data from external API
+ return await fetch("/api/tags_autocomplete.php?tag=" + encodeURIComponent(value))
+ .then(function (response) {
+ return response.json();
+ });
+ }
});
}
@@ -124,7 +124,9 @@