mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
Format
This commit is contained in:
parent
f1742c65d9
commit
e7ad8bdde1
12 changed files with 97 additions and 72 deletions
|
@ -157,67 +157,81 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
action="<?= $_SERVER['PHP_SELF']; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_name">Site Name</label>
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_name">Site
|
||||
Name</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="site_info[site_name]" id="site_info_name"
|
||||
<input type="text" class="form-control" name="site_info[site_name]"
|
||||
id="site_info_name"
|
||||
placeholder="The name of your site"
|
||||
value="<?= pp_html_escape($current_site_info['site_name']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_title">Site Title</label>
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_title">Site
|
||||
Title</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="site_info[title]" id="site_info_title"
|
||||
<input type="text" class="form-control" name="site_info[title]"
|
||||
id="site_info_title"
|
||||
placeholder="Site title tag"
|
||||
value="<?= pp_html_escape($current_site_info['title']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_baseurl">Domain name</label>
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_baseurl">Domain
|
||||
name</label>
|
||||
<div class="col-sm-1" style="padding:5px;">
|
||||
<span class="badge">
|
||||
<?= !empty($_SERVER['HTTPS']) ? 'https://' : 'http://' ?>;
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="site_info[baseurl]" id="site_info_baseurl"
|
||||
<input type="text" class="form-control" name="site_info[baseurl]"
|
||||
id="site_info_baseurl"
|
||||
placeholder="eg: ponepaste.org (no trailing slash)"
|
||||
value="<?= pp_html_escape($current_site_info['baseurl']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_description">Site Description</label>
|
||||
<label class="col-sm-2 control-label form-label"
|
||||
for="site_info_description">Site Description</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="site_info[description]" id="site_info_description"
|
||||
<input type="text" class="form-control" name="site_info[description]"
|
||||
id="site_info_description"
|
||||
placeholder="Site description"
|
||||
value="<?= pp_html_escape($current_site_info['description']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_keywords">Site Keywords</label>
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_keywords">Site
|
||||
Keywords</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="site_info[keywords]" id="site_info_keywords"
|
||||
<input type="text" class="form-control" name="site_info[keywords]"
|
||||
id="site_info_keywords"
|
||||
placeholder="Keywords (separated by a comma)"
|
||||
value="<?= pp_html_escape($current_site_info['keywords']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_email">Admin Email</label>
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_email">Admin
|
||||
Email</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="site_info[email]" placeholder="Email" id="site_info_email"
|
||||
<input type="text" class="form-control" name="site_info[email]"
|
||||
placeholder="Email" id="site_info_email"
|
||||
value="<?= pp_html_escape($current_site_info['email']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label form-label" for="site_info_additional_scripts">Additional Site
|
||||
<label class="col-sm-2 control-label form-label"
|
||||
for="site_info_additional_scripts">Additional Site
|
||||
Scripts</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" id="additional_scripts" id="site_info_additional_scripts"
|
||||
<textarea class="form-control" id="additional_scripts"
|
||||
id="site_info_additional_scripts"
|
||||
name="site_info[additional_scripts]"
|
||||
rows="8"><?= pp_html_escape($current_site_info['title']); ?></textarea>
|
||||
</div>
|
||||
|
@ -274,7 +288,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
action="<?= $_SERVER['PHP_SELF']; ?>">
|
||||
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input <?php if ($current_captcha['enabled']) echo 'checked="true"'; ?> type="checkbox"
|
||||
<input <?php if ($current_captcha['enabled']) echo 'checked="true"'; ?>
|
||||
type="checkbox"
|
||||
name="captcha[enabked]"
|
||||
id="captcha_enabled">
|
||||
<label for="captcha_enabled">Enable Captcha</label>
|
||||
|
@ -282,7 +297,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
<br/>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="captcha_mode" class="col-sm-1 col-form-label">Captcha Type</label>
|
||||
<label for="captcha_mode" class="col-sm-1 col-form-label">Captcha
|
||||
Type</label>
|
||||
<select id="captcha_mode" class="selectpicker" name="captcha[mode]">
|
||||
<?php
|
||||
if ($current_captcha['mode'] == "Easy") {
|
||||
|
@ -311,7 +327,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
Internal Captcha Settings:
|
||||
</div>
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input <?php if ($current_captcha['multiple']) echo 'checked="checked"'; ?> type="checkbox"
|
||||
<input <?php if ($current_captcha['multiple']) echo 'checked="checked"'; ?>
|
||||
type="checkbox"
|
||||
name="captcha[multiple]"
|
||||
id="captcha_multiple">
|
||||
<label for="captcha_multiple">Enable multiple backgrounds</label>
|
||||
|
@ -322,7 +339,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
Characters</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="captcha_allowed" name="captcha[allowed]"
|
||||
placeholder="Allowed Characters" value="<?php echo $current_captcha['allowed']; ?>">
|
||||
placeholder="Allowed Characters"
|
||||
value="<?php echo $current_captcha['allowed']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -331,7 +349,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
Colour</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="captcha_colour" name="captcha[colour]"
|
||||
placeholder="Captcha Text Colour" value="<?= $current_captcha['colour']; ?>">
|
||||
placeholder="Captcha Text Colour"
|
||||
value="<?= $current_captcha['colour']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class Tag {
|
|||
]);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -27,7 +27,7 @@ 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;
|
||||
|
@ -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(
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
function setupTagsInput() {
|
||||
const tagsInput = document.getElementById('tags-with-source');
|
||||
new BulmaTagsInput(tagsInput, {
|
||||
source: async function(value) {
|
||||
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) {
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
@ -124,7 +124,9 @@
|
|||
<div class="list-widget pagination-content">
|
||||
<?php
|
||||
$res = getrandom($conn, 10);
|
||||
foreach ($res as $index => $row) {
|
||||
foreach ($res
|
||||
|
||||
as $index => $row) {
|
||||
$title = Trim($row['title']);
|
||||
$titlehov = ($row['title']);
|
||||
$p_member = Trim($row['member']);
|
||||
|
@ -242,8 +244,10 @@
|
|||
<div class="field">
|
||||
<label class="label">Tags</label>
|
||||
<div class="control">
|
||||
<input id="tags-with-source" name="tag_input" class="input" data-max-tags="10"
|
||||
data-max-chars="40" type="text" data-item-text="name" data-item-value="name"
|
||||
<input id="tags-with-source" name="tag_input" class="input"
|
||||
data-max-tags="10"
|
||||
data-max-chars="40" type="text" data-item-text="name"
|
||||
data-item-value="name"
|
||||
data-case-sensitive="false" placeholder="10 Tags Maximum"
|
||||
value="<?php echo (isset($_POST['tag_input'])) ? $_POST['tag_input'] : ''; // Pre-populate if we come here on an error" ?>">
|
||||
</div>
|
||||
|
|
|
@ -143,7 +143,7 @@ $protocol = paste_protocol();
|
|||
<table id="archive" class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="td-right" ><?php echo $lang['pastetitle']; ?></td>
|
||||
<td class="td-right"><?php echo $lang['pastetitle']; ?></td>
|
||||
<td class="td-center"><?php echo $lang['pastetime']; ?></td>
|
||||
<?php if ($is_current_user) {
|
||||
echo "<td class='td-center'>" . $lang['visibility'] . "</td>";
|
||||
|
@ -179,7 +179,9 @@ $protocol = paste_protocol();
|
|||
$p_dateui = $p_date->format("d F Y");
|
||||
$p_views = Trim($row['views']);
|
||||
$p_visible = intval($row['visible']);
|
||||
$tagArray = array_map(function($tag) { return $tag['name']; }, getPasteTags($conn, $p_id));
|
||||
$tagArray = array_map(function ($tag) {
|
||||
return $tag['name'];
|
||||
}, getPasteTags($conn, $p_id));
|
||||
$p_tags = implode(',', $tagArray);
|
||||
|
||||
|
||||
|
@ -262,7 +264,7 @@ $protocol = paste_protocol();
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($profile_favs as $index => $row) {
|
||||
foreach ($profile_favs as $row) {
|
||||
$ftitle = Trim($row['title']);
|
||||
$f_id = Trim($row['paste_id']);
|
||||
$f_date = new DateTime($row['f_time']);
|
||||
|
|
Loading…
Add table
Reference in a new issue