Addition of files
This commit is contained in:
16
admin/add.php
Normal file
16
admin/add.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/edit.php
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
if(!defined("BLUDIT")){ die("Go directly to Jail. Do not pass Go. Do not collect 200 Cookies!"); }
|
||||
|
||||
// Add Formular 4 Admins
|
||||
|
||||
?>
|
||||
106
admin/css/admin.snicker.css
Normal file
106
admin/css/admin.snicker.css
Normal file
@@ -0,0 +1,106 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/css/admin.snicker.css
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
|
||||
/* @start GENERAL */
|
||||
.shadow-sm-both{
|
||||
box-shadow: 0 0 0.25rem rgba(0,0,0,.075) !important;
|
||||
}
|
||||
.table-hover-light tr:hover{
|
||||
background-color: #f0f3f6;
|
||||
}
|
||||
/* @end GENERAL */
|
||||
|
||||
/* @start Admin Navigation */
|
||||
.nav.nav-pills .nav-link{
|
||||
color: #343a40;
|
||||
font-weight: 400;
|
||||
font-weight: 600;
|
||||
background-color: #e9ecef;
|
||||
transition: color 142ms linear, background 142ms linear;
|
||||
}
|
||||
.nav.nav-pills .nav-link:hover{
|
||||
background-color: #d9dcdf;
|
||||
}
|
||||
.nav.nav-pills .nav-link.active{
|
||||
color: #ffffff;
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75);
|
||||
background-color: #343a40;
|
||||
}
|
||||
.nav.nav-pills .nav-link .badge{
|
||||
margin-top: 3px;
|
||||
text-shadow: none;
|
||||
vertical-align: top;
|
||||
}
|
||||
.nav.nav-pills .nav-link.active .badge{
|
||||
text-shadow: none;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.nav.nav-pills .nav-link.nav-pending{
|
||||
border-top-right-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-pending.active{
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
|
||||
background-color: #007bff;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-pending.active .badge{
|
||||
color: #007bff;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-approved{
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-approved.active{
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
|
||||
background-color: #28A745;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-rejected{
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-rejected.active{
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
|
||||
background-color: #FFC107;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-spam{
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-spam.active{
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
|
||||
background-color: #DC3545;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-spam.active .badge{
|
||||
color: #DC3545;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-config{
|
||||
font-weight: 400;
|
||||
}
|
||||
.nav.nav-pills .nav-link.nav-config .oi{
|
||||
margin-right: 3px;
|
||||
line-height: 1.5;
|
||||
vertical-align: top;
|
||||
}
|
||||
/* @end Admin Navigation */
|
||||
|
||||
/* @start Admin Pagination */
|
||||
.btn-group.btn-group-pagination .btn{
|
||||
width: 34px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 7px;
|
||||
font-size: 20px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.btn-group.btn-group-pagination .btn.disabled{
|
||||
cursor: not-allowed;
|
||||
}
|
||||
/* @end Admin Pagination */
|
||||
93
admin/edit.php
Normal file
93
admin/edit.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/edit.php
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
if(!defined("BLUDIT")){ die("Go directly to Jail. Do not pass Go. Do not collect 200 Cookies!"); }
|
||||
|
||||
global $login, $pages, $security, $SnickerIndex;
|
||||
|
||||
$data = $SnickerIndex->getComment($_GET["uid"]);
|
||||
$comment = new Comment($_GET["uid"], $data["page_uuid"]);
|
||||
$page = new Page($pages->getByUUID($data["page_uuid"]));
|
||||
|
||||
?><h2 class="mt-0 mb-3">
|
||||
<span class="oi oi-comment-square" style="font-size: 0.7em;"></span> Snicker <?php sn_e("Comments"); ?> / <?php sn_e("Edit"); ?>
|
||||
</h2>
|
||||
<form method="post" action="<?php echo HTML_PATH_ADMIN_ROOT; ?>snicker">
|
||||
<div class="card" style="margin: 1.5rem 0;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<input type="hidden" id="tokenUser" name="tokenUser" value="<?php echo $login->username(); ?>" />
|
||||
<input type="hidden" id="tokenCSRF" name="tokenCSRF" value="<?php echo $security->getTokenCSRF(); ?>" />
|
||||
<input type="hidden" id="sn-action" name="action" value="snicker" />
|
||||
<input type="hidden" id="sn-snicker" name="snicker" value="edit" />
|
||||
<input type="hidden" id="sn-unique" name="uid" value="<?php echo $comment->uid(); ?>" />
|
||||
<button class="btn btn-primary" name="type" value="edit"><?php sn_e("Update Comment"); ?></button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 text-right">
|
||||
<button class="btn btn-danger" name="type" value="delete"><?php sn_e("Delete Comment"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<input type="text" name="comment[title]" value="<?php echo $comment->title(); ?>"
|
||||
class="form-control form-control-lg" placeholder="<?php sn_e("Comment Title"); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<textarea name="comment[comment]" class="form-control" placeholder="<?php sn_e("Comment Text"); ?>"
|
||||
style="min-height: 275px;"><?php echo $comment->commentRaw(); ?></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="card">
|
||||
<div class="card-header"><?php sn_e("Meta Settings"); ?></div>
|
||||
<div class="card-body">
|
||||
|
||||
<?php if(strpos($comment->getValue("author"), "bludit") === 0){ ?>
|
||||
<p>
|
||||
<input type="text" value="<?php echo $comment->username(); ?>" class="form-control" disabled />
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" value="<?php sn_e("Registered User"); ?>" class="form-control" disabled />
|
||||
</p>
|
||||
<?php } else { ?>
|
||||
<p>
|
||||
<input type="text" name="comment[username]" value="<?php echo $comment->username(); ?>"
|
||||
class="form-control" placeholder="<?php sn_e("Comment Username"); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" name="comment[email]" value="<?php echo $comment->email(); ?>"
|
||||
class="form-control" placeholder="<?php sn_e("Comment eMail"); ?>" />
|
||||
</p>
|
||||
<?php } ?>
|
||||
<p>
|
||||
<select name="comment[status]" class="custom-select">
|
||||
<option value="pending"<?php echo ($comment->isPending())? ' selected="selected"': ''; ?>><?php sn_e("Pending"); ?></option>
|
||||
<option value="approved"<?php echo ($comment->isApproved())? ' selected="selected"': ''; ?>><?php sn_e("Approved"); ?></option>
|
||||
<option value="rejected"<?php echo ($comment->isRejected())? ' selected="selected"': ''; ?>><?php sn_e("Rejected"); ?></option>
|
||||
<option value="spam"<?php echo ($comment->isSpam())? ' selected="selected"': ''; ?>><?php sn_e("Spam"); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mt-4 text-center">
|
||||
<a href="<?php echo $page->permalink(); ?>" target="_blank" class="btn btn-primary"><?php sn_e("View Page"); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
188
admin/index-comments.php
Normal file
188
admin/index-comments.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/index-comments.php
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
if(!defined("BLUDIT")){ die("Go directly to Jail. Do not pass Go. Do not collect 200 Cookies!"); }
|
||||
|
||||
global $pages, $security, $Snicker, $SnickerIndex, $SnickerPlugin, $SnickerUsers;
|
||||
|
||||
// Get Data
|
||||
$limit = $SnickerPlugin->getValue("frontend_per_page");
|
||||
if($limit === 0){
|
||||
$limit = 15;
|
||||
}
|
||||
$current = isset($_GET["tab"])? $_GET["tab"]: "pending";
|
||||
|
||||
// Get View
|
||||
$view = "index";
|
||||
if(isset($_GET["view"]) && in_array($_GET["view"], array("search", "single", "uuid", "user"))){
|
||||
$view = $current = $_GET["view"];
|
||||
$tabs = array($view);
|
||||
} else {
|
||||
$tabs = array("pending", "approved", "rejected", "spam");
|
||||
}
|
||||
|
||||
// Render Comemnts Tab
|
||||
foreach($tabs AS $status){
|
||||
if(isset($_GET["tab"]) && $_GET["tab"] === $status){
|
||||
$page = max((isset($_GET["page"])? (int) $_GET["page"]: 1), 1);
|
||||
} else {
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
// Get Comments
|
||||
if($view === "index"){
|
||||
$comments = $SnickerIndex->getList($status, $page, $limit);
|
||||
$total = $SnickerIndex->count($status);
|
||||
} else if($view === "search"){
|
||||
$comments = $SnickerIndex->searchComments(isset($_GET["search"])? $_GET["search"]: "");
|
||||
$total = count($comments);
|
||||
} else if($view === "single"){
|
||||
$comments = $SnickerIndex->getListByParent(isset($_GET["single"])? $_GET["single"]: "");
|
||||
$total = count($comments);
|
||||
} else if($view === "uuid"){
|
||||
$comments = $SnickerIndex->getListByUUID(isset($_GET["uuid"])? $_GET["uuid"]: "");
|
||||
$total = count($comments);
|
||||
} else if($view === "user"){
|
||||
$comments = $SnickerIndex->getListByUser(isset($_GET["user"])? $_GET["user"]: "");
|
||||
$total = count($comments);
|
||||
}
|
||||
|
||||
// Render Tab Content
|
||||
$link = DOMAIN_ADMIN . "snicker?page=%d&tab={$status}#{$status}";
|
||||
?>
|
||||
<div id="snicker-<?php echo $status; ?>" class="tab-pane <?php echo($current === $status)? "active": ""; ?>">
|
||||
<div class="card shadow-sm" style="margin: 1.5rem 0;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<form class="col-sm-6" method="get" action="<?php echo DOMAIN_ADMIN; ?>snicker">
|
||||
<div class="form-row align-items-center">
|
||||
<div class="col-sm-8">
|
||||
<?php $search = isset($_GET["search"])? $_GET["search"]: ""; ?>
|
||||
<input type="text" name="search" value="<?php echo $search; ?>" class="form-control" placeholder="<?php sn_e("Comment Title or Excerpt"); ?>" />
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button class="btn btn-primary" name="view" value="search"><?php sn_e("Search Comments"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="col-sm-6 text-right">
|
||||
<?php if($total > $limit){ ?>
|
||||
<div class="btn-group btn-group-pagination">
|
||||
<?php if($page <= 1){ ?>
|
||||
<span class="btn btn-secondary disabled">«</span>
|
||||
<span class="btn btn-secondary disabled">‹</span>
|
||||
<?php } else { ?>
|
||||
<a href="<?php printf($link, 1); ?>" class="btn btn-secondary">«</a>
|
||||
<a href="<?php printf($link, $page-1); ?>" class="btn btn-secondary">‹</a>
|
||||
<?php } ?>
|
||||
<?php if(($page * $limit) < $total){ ?>
|
||||
<a href="<?php printf($link, $page+1); ?>" class="btn btn-secondary">›</a>
|
||||
<a href="<?php printf($link, ceil($total / $limit)); ?>" class="btn btn-secondary">»</a>
|
||||
<?php } else { ?>
|
||||
<span class="btn btn-secondary disabled">›</span>
|
||||
<span class="btn btn-secondary disabled">»</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php /* No Comments available */ ?>
|
||||
<?php if(count($comments) < 1){ ?>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-sm-6">
|
||||
<div class="card w-100 shadow-sm bg-light">
|
||||
<div class="card-body text-center p-4"><i><?php sn_e("No Comments available"); ?></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php continue; ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php /* Comments Table */ ?>
|
||||
<?php $link = DOMAIN_ADMIN . "snicker?action=snicker&snicker=%s&uid=%s&status=%s&tokenCSRF=" . $security->getTokenCSRF(); ?>
|
||||
<table class="table table-bordered table-hover-light shadow-sm mt-3">
|
||||
<?php foreach(array("thead", "tfoot") AS $tag){ ?>
|
||||
<<?php echo $tag; ?>>
|
||||
<tr class="thead-light">
|
||||
<th width="56%" class="border-0 p-3 text-uppercase text-muted"><?php sn_e("Comment"); ?></th>
|
||||
<th width="22%" class="border-0 p-3 text-uppercase text-muted text-center"><?php sn_e("Author"); ?></th>
|
||||
<th width="22%" class="border-0 p-3 text-uppercase text-muted text-center"><?php sn_e("Actions"); ?></th>
|
||||
</tr>
|
||||
</<?php echo $tag; ?>>
|
||||
<?php } ?>
|
||||
<tbody class="shadow-sm-both">
|
||||
<?php foreach($comments AS $uid){ ?>
|
||||
<?php
|
||||
$data = $SnickerIndex->getComment($uid, $status);
|
||||
if(!(isset($data["page_uuid"]) && is_string($data["page_uuid"]))){
|
||||
continue;
|
||||
}
|
||||
$user = $SnickerUsers->getByString($data["author"]);
|
||||
?>
|
||||
<tr>
|
||||
<td class="pt-3 pb-3 pl-3 pr-3">
|
||||
<?php
|
||||
if($SnickerPlugin->getValue("comment_title") !== "disabled" && !empty($data["title"])){
|
||||
echo '<b class="d-inline-block">' . $data["title"] . '</b>';
|
||||
}
|
||||
echo '<p class="text-muted m-0" style="font-size:12px;">' . (isset($data["excerpt"])? $data["excerpt"]: "") . '</p>';
|
||||
if(!empty($data["parent_uid"]) && $SnickerIndex->exists($data["parent_uid"]) && $view !== "single"){
|
||||
$reply = DOMAIN_ADMIN . "snicker?view=single&single={$uid}";
|
||||
$reply = '<a href="'.$reply.'" title="'.sn__("Show all replies").'">' . $SnickerIndex->getComment($data["parent_uid"])["title"] . '</a>';
|
||||
echo "<div class='text-muted mt-1' style='font-size:12px;'>" . sn__("Reply To") . ": " . $reply . "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="align-middle pt-2 pb-2 pl-3 pr-3">
|
||||
<span class="d-inline-block"><?php echo $user["username"]; ?></span>
|
||||
<small class='d-block'><?php echo $user["email"]; ?></small>
|
||||
</td>
|
||||
<td class="text-center align-middle pt-2 pb-2 pl-1 pr-1">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||
<?php sn_e("Change"); ?>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item text-primary" href="<?php echo DOMAIN_ADMIN . "snicker/edit/?uid=" . $uid; ?>"><?php sn_e("Edit Comment"); ?></a>
|
||||
<a class="dropdown-item text-danger" href="<?php printf($link, "delete", $uid, "delete"); ?>"><?php sn_e("Delete Comment"); ?></a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
<?php if($status !== "approved"){ ?>
|
||||
<a class="dropdown-item" href="<?php printf($link, "moderate", $uid, "approved"); ?>"><?php sn_e("Approve Comment"); ?></a>
|
||||
<?php } ?>
|
||||
<?php if($status !== "rejected"){ ?>
|
||||
<a class="dropdown-item" href="<?php printf($link, "moderate", $uid, "rejected"); ?>"><?php sn_e("Reject Comment"); ?></a>
|
||||
<?php } ?>
|
||||
<?php if($status !== "spam"){ ?>
|
||||
<a class="dropdown-item" href="<?php printf($link, "moderate", $uid, "spam"); ?>"><?php sn_e("Mark as Spam"); ?></a>
|
||||
<?php } ?>
|
||||
<?php if($status !== "pending"){ ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php printf($link, "moderate", $uid, "pending"); ?>"><?php sn_e("Back to Pending"); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $page = new Page($pages->getByUUID($data["page_uuid"])); ?>
|
||||
<a href="<?php echo $page->permalink(); ?>#comment-<?php echo $uid; ?>" class="btn btn-outline-primary btn-sm" target="_blank"><?php sn_e("View"); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
484
admin/index-config.php
Normal file
484
admin/index-config.php
Normal file
@@ -0,0 +1,484 @@
|
||||
<?php
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/index-config.php
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
if(!defined("BLUDIT")){ die("Go directly to Jail. Do not pass Go. Do not collect 200 Cookies!"); }
|
||||
|
||||
global $L, $login, $pages, $security, $Snicker, $SnickerPlugin;
|
||||
|
||||
// Get Static Pages
|
||||
$static = $pages->getStaticDB(false);
|
||||
|
||||
?>
|
||||
<div id="snicker-configure" class="tab-pane">
|
||||
<form method="post" action="<?php echo HTML_PATH_ADMIN_ROOT; ?>snicker#configure">
|
||||
<div class="card shadow-sm" style="margin: 1.5rem 0;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<input type="hidden" id="tokenUser" name="tokenUser" value="<?php echo $login->username(); ?>" />
|
||||
<input type="hidden" id="tokenCSRF" name="tokenCSRF" value="<?php echo $security->getTokenCSRF(); ?>" />
|
||||
<input type="hidden" id="sn-action" name="action" value="snicker" />
|
||||
<button class="btn btn-primary" name="snicker" value="configure"><?php sn_e("Save Settings"); ?></button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="accordion shadow-sm" id="accordion-settings">
|
||||
<div class="card">
|
||||
<div class="card-header text-uppercase pt-3 pb-3 pl-4 pr-4" data-toggle="collapse" data-target="#accordion-general"><?php sn_e("General Settings"); ?></div>
|
||||
<div id="accordion-general" class="collapse show" data-parent="#accordion-settings">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label for="sn-moderation" class="col-sm-3 col-form-label"><?php sn_e("Comment Moderation"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-moderation" name="moderation" class="custom-select custom-select-sm w-auto">
|
||||
<option value="true" <?php sn_selected("moderation", true); ?>><?php sn_e("Moderate"); ?></option>
|
||||
<option value="false" <?php sn_selected("moderation", false); ?>><?php sn_e("Pass"); ?></option>
|
||||
</select>
|
||||
<label for="sn-moderation" class="col-form-label-sm ml-2 align-top"><?php sn_e("each Comment") ?></label>
|
||||
|
||||
<div class="custom-control custom-checkbox pl-5 mt-1">
|
||||
<input type="checkbox" id="sn-moderation-loggedin" name="moderation_loggedin" value="true"
|
||||
class="custom-control-input" <?php sn_checked("moderation_loggedin"); ?> />
|
||||
<label class="custom-control-label" for="sn-moderation-loggedin"><?php sn_e("Unless the user is logged in"); ?></label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox pl-5">
|
||||
<input type="checkbox" value="true" class="custom-control-input" checked="checked" disabled="disabled" />
|
||||
<label class="custom-control-label"><?php sn_e("Unless the user is admin or the content author"); ?></label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox pl-5 mb-2">
|
||||
<input type="checkbox" id="sn-moderation-approved" name="moderation_approved" value="true"
|
||||
class="custom-control-input" <?php sn_checked("moderation_approved"); ?> />
|
||||
<label class="custom-control-label" for="sn-moderation-approved"><?php sn_e("Unless the user has an already approved comment"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-comment-title" class="col-sm-3 col-form-label"><?php sn_e("Allow Comments"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-comment-on-public" name="comment_on_public" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_on_public"); ?> />
|
||||
<label class="custom-control-label" for="sn-comment-on-public"><?php sn_e("... on Public Pages"); ?></label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-comment-on-sticky" name="comment_on_sticky" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_on_sticky"); ?> />
|
||||
<label class="custom-control-label" for="sn-comment-on-sticky"><?php sn_e("... on Sticky Pages"); ?></label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-comment-on-static" name="comment_on_static" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_on_static"); ?> />
|
||||
<label class="custom-control-label" for="sn-comment-on-static"><?php sn_e("... on Static Pages"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-comment-title" class="col-sm-3 col-form-label"><?php sn_e("Comment Title"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-comment-title" name="comment_title" class="form-control custom-select">
|
||||
<option value="optional" <?php sn_selected("comment_title", "optional"); ?>><?php sn_e("Enable (Optional)"); ?></option>
|
||||
<option value="required" <?php sn_selected("comment_title", "required"); ?>><?php sn_e("Enable (Required)"); ?></option>
|
||||
<option value="disabled" <?php sn_selected("comment_title", "disabled"); ?>><?php sn_e("Disable"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-comment-limit" class="col-sm-3 col-form-label"><?php sn_e("Comment Limit"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" id="sn-comment-limit" name="comment_limit" value="<?php echo sn_config("comment_limit"); ?>"
|
||||
class="form-control" min="0" placeholder="<?php sn_e("Use '0' to disable any limit!"); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-comment-depth" class="col-sm-3 col-form-label"><?php sn_e("Comment Depth"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" id="sn-comment-depth" name="comment_depth" value="<?php echo sn_config("comment_depth"); ?>"
|
||||
class="form-control" min="0" placeholder="<?php sn_e("Use '0' to disable any limit!"); ?>" />
|
||||
<small class="form-text text-muted"><?php sn_e("Use '0' to disable any limit!"); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label"><?php sn_e("Comment Markup"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-markup-html" name="comment_markup_html" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_markup_html"); ?> />
|
||||
<label class="custom-control-label" for="sn-markup-html"><?php sn_e("Allow Basic HTML"); ?></label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-markup-markdown" name="comment_markup_markdown" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_markup_markdown"); ?> />
|
||||
<label class="custom-control-label" for="sn-markup-markdown"><?php sn_e("Allow Markdown"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label"><?php sn_e("Comment Voting"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<label for="sn-vote-storage" class="col-form-label-sm mr-2 align-top"><?php sn_e("Store Votes made by Guests in the") ?></label>
|
||||
<select id="sn-vote-storage" name="comment_vote_storage" class="custom-select custom-select-sm w-auto">
|
||||
<option value="cookie" <?php sn_selected("comment_vote_storage", "cookie"); ?>><?php sn_e("Cookie Storage"); ?></option>
|
||||
<option value="session" <?php sn_selected("comment_vote_storage", "session"); ?>><?php sn_e("Session Storage"); ?></option>
|
||||
<option value="database" <?php sn_selected("comment_vote_storage", "database"); ?>><?php sn_e("Database Storage"); ?></option>
|
||||
</select>
|
||||
<a href="#" class="ml-2 align-top" data-container="body" data-toggle="popover" data-placement="left"
|
||||
data-trigger="focus" data-target="#help-content">(<?php sn_e("What?"); ?>)</a>
|
||||
<div id="help-content" class="hide d-none" style="width: 100%;">
|
||||
<p>
|
||||
<?php sn_e("The <b>Cookie Storage</b> is located on the Computer of the user. So you don't have the full control AND you require the appropriate permissions from the user."); ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php sn_e("The <b>Session Storage</b> is just stored temporary on the server, it gets cleaned up when the user closes the browser. Therefore you don't need any permissions from the user."); ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php sn_e("The <b>Database Storage</b> generates and stores an anonymized but assignable value of the user, which also requires the appropriate permissions from the user."); ?>
|
||||
</p>
|
||||
<p class="bg-light border-top" style="margin: -.5rem -.75rem;padding: .5rem .75rem;border-radius: 0 0 3px 3px;">
|
||||
<?php sn_e("<b>Please Note:</b> You are responsible for obtaining the appropriate permissions, Snicker just handles the permissions for data send (and stored) via the comment form!"); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-like" name="comment_enable_like" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_enable_like"); ?> />
|
||||
<label class="custom-control-label" for="sn-like"><?php sn_e("Allow to %s comments", array("<b>".sn__("Like")."</b>")); ?></label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="sn-dislike" name="comment_enable_dislike" value="true"
|
||||
class="custom-control-input" <?php sn_checked("comment_enable_dislike"); ?>/>
|
||||
<label class="custom-control-label" for="sn-dislike"><?php sn_e("Allow to %s comments", array("<b>".sn__("Dislike")."</b>")); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header text-uppercase pt-3 pb-3 pl-4 pr-4" data-toggle="collapse" data-target="#accordion-frontend"><?php sn_e("Frontend Settings"); ?></div>
|
||||
<div id="accordion-frontend" class="collapse" data-parent="#accordion-settings">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label for="sn-filter" class="col-sm-3 col-form-label"><?php sn_e("Page Filter"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-filter" name="frontend_filter" class="form-control custom-select">
|
||||
<option value="disabled" <?php sn_selected("frontend_filter", "disabled"); ?>><?php sn_e("Disable Page Filter"); ?></option>
|
||||
<option value="pageBegin" <?php sn_selected("frontend_filter", "pageBegin"); ?>><?php sn_e("Use 'pageBegin'"); ?></option>
|
||||
<option value="pageEnd" <?php sn_selected("frontend_filter", "pageEnd"); ?>><?php sn_e("Use 'pageEnd'"); ?></option>
|
||||
<option value="siteBodyBegin" <?php sn_selected("frontend_filter", "siteBodyBegin"); ?>><?php sn_e("Use 'siteBodyBegin'"); ?></option>
|
||||
<option value="siteBodyEnd" <?php sn_selected("frontend_filter", "siteBodyEnd"); ?>><?php sn_e("Use 'siteBodyEnd'"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-captcha" class="col-sm-3 col-form-label"><?php sn_e("Comment Captcha"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-captcha" name="frontend_captcha" class="form-control custom-select">
|
||||
<option value="disabled" <?php sn_selected("frontend_captcha", "disabled"); ?>><?php sn_e("Disable Captcha"); ?></option>
|
||||
<option value="purecaptcha" <?php sn_selected("frontend_captcha", "purecaptcha"); ?>><?php sn_e("Use OWASP's PureCaptcha"); ?></option>
|
||||
<?php if(function_exists("imagettfbbox")){ ?>
|
||||
<option value="gregwar" <?php sn_selected("frontend_captcha", "gregwar"); ?>><?php sn_e("Use Gregway's Captcha"); ?></option>
|
||||
<?php } else { ?>
|
||||
<option disabled="disabled"><?php sn_e("Use Gregway's Captcha (GD library is missing!)"); ?></option>
|
||||
<?php } ?>
|
||||
<option value="recaptcha" <?php sn_selected("frontend_captcha", "recaptcha"); ?> disabled="disabled"><?php sn_e("Use Googles reCaptcha (Not available yet)"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-template" class="col-sm-3 col-form-label"><?php sn_e("Comment Template"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-template" name="frontend_template" class="form-control custom-select">
|
||||
<?php
|
||||
foreach($Snicker->themes AS $key => $theme){
|
||||
?>
|
||||
<option value="<?php echo $key; ?>" <?php sn_selected("frontend_template", $key); ?>><?php echo $theme::SNICKER_NAME; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-order" class="col-sm-3 col-form-label"><?php sn_e("Comment Order"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-order" name="frontend_order" class="form-control custom-select">
|
||||
<option value="date_desc" <?php sn_selected("frontend_order", "date_desc"); ?>><?php sn_e("Newest Comments First"); ?></option>
|
||||
<option value="date_asc" <?php sn_selected("frontend_order", "date_asc"); ?>><?php sn_e("Oldest Comments First"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-order" class="col-sm-3 col-form-label"><?php sn_e("Comment Form Position"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-order" name="frontend_form" class="form-control custom-select">
|
||||
<option value="top" <?php sn_selected("frontend_form", "top"); ?>><?php sn_e("Show Comment Form above Comments"); ?></option>
|
||||
<option value="bottom" <?php sn_selected("frontend_form", "bottom"); ?>><?php sn_e("Show Comment Form below Comments"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-per-page" class="col-sm-3 col-form-label"><?php sn_e("Comments Per Page"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" id="sn-per-page" name="frontend_per_page" value="<?php echo sn_config("frontend_per_page"); ?>"
|
||||
class="form-control" min="0" step="1" placheolder="<?php sn_e("Use '0' to show all available comments!"); ?>" />
|
||||
<small class="form-text text-muted"><?php sn_e("Use '0' to show all available comments!"); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-terms" class="col-sm-3 col-form-label"><?php sn_e("Terms of Use Checkbox"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-terms" name="frontend_terms" class="form-control custom-select">
|
||||
<option value="disabled" <?php sn_selected("frontend_terms", "disabled"); ?>><?php sn_e("Disable this field"); ?></option>
|
||||
<option value="default" <?php sn_selected("frontend_terms", "default"); ?>><?php sn_e("Show Message (See Strings)"); ?></option>
|
||||
|
||||
<?php foreach($static AS $key => $value){ ?>
|
||||
<option value="<?php echo $key; ?>" <?php sn_selected("frontend_terms", $key); ?>><?php sn_e("Page"); ?>: <?php echo $value["title"]; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<small class="form-text text-muted"><?php sn_e("Show the default GDPR Text or Select your own static 'Terms of Use' page!"); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-ajax" class="col-sm-3 col-form-label"><?php sn_e("AJAX Script"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-ajax" name="frontend_ajax" class="form-control custom-select">
|
||||
<option value="true" <?php sn_selected("frontend_ajax", true); ?>><?php sn_e("Embed AJAX Script"); ?></option>
|
||||
<option value="false" <?php sn_selected("frontend_ajax", false); ?>><?php sn_e("Don't use AJAX"); ?></option>
|
||||
</select>
|
||||
<small class="form-text text-muted"><?php sn_e("The AJAX Script hands over the request (comment, like, dislike) directly without reloading the page!"); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr style="margin: 30px -20px;" />
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-avatar" class="col-sm-3 col-form-label"><?php sn_e("Comment Avatar"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-avatar" name="frontend_avatar" class="form-control custom-select">
|
||||
<option value="gravatar" <?php sn_selected("frontend_avatar", "gravatar"); ?>><?php sn_e("Use Gravatar"); ?></option>
|
||||
<option value="identicon" <?php sn_selected("frontend_avatar", "identicon"); ?>><?php sn_e("Use Identicon"); ?></option>
|
||||
<option value="static" <?php sn_selected("frontend_avatar", "static"); ?>><?php sn_e("Use Mystery Men"); ?></option>
|
||||
</select>
|
||||
|
||||
<div class="custom-control custom-checkbox mt-1">
|
||||
<input type="checkbox" id="sn-moderation-users" name="frontend_avatar_users" value="true"
|
||||
class="custom-control-input" <?php sn_checked("frontend_avatar_users"); ?> />
|
||||
<label class="custom-control-label" for="sn-moderation-users"><?php sn_e("Use & Prefer profile pictures on logged-in Users"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-gravatar" class="col-sm-3 col-form-label"><?php sn_e("Comment Gravatar"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-gravatar" name="frontend_gravatar" class="form-control custom-select">
|
||||
<option value="mp" <?php sn_selected("frontend_gravatar", "mp"); ?>><?php sn_e("Show Mystery Person"); ?></option>
|
||||
<option value="identicon" <?php sn_selected("frontend_gravatar", "identicon"); ?>><?php sn_e("Show"); ?> Identicon</option>
|
||||
<option value="monsterid" <?php sn_selected("frontend_gravatar", "monsterid"); ?>><?php sn_e("Show"); ?> Monster ID</option>
|
||||
<option value="wavatar" <?php sn_selected("frontend_gravatar", "wavatar"); ?>><?php sn_e("Show"); ?> WAvatar</option>
|
||||
</select>
|
||||
<small class="form-text text-muted"><?php sn_e("The default Gravatar image, if the user has no Gravatar!"); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header text-uppercase pt-3 pb-3 pl-4 pr-4" data-toggle="collapse" data-target="#accordion-subscripton"><?php sn_e("Subscription Settings"); ?></div>
|
||||
<div id="accordion-subscripton" class="collapse" data-parent="#accordion-settings">
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info"><?php sn_e("The Subscription system isn't available yet!"); ?> :(</div>
|
||||
<div class="form-group row">
|
||||
<label for="sn-subscription" class="col-sm-3 col-form-label text-muted"><?php sn_e("eMail Subscription"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-subscription" name="subscription" class="form-control custom-select" disabled="disabled">
|
||||
<option value="true" <?php sn_selected("subscription", true); ?> disabled="disabled"><?php sn_e("Enable"); ?></option>
|
||||
<option value="false" <?php sn_selected("subscription", false); ?>><?php sn_e("Disable"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-subscription-from" class="col-sm-3 col-form-label text-muted"><?php sn_e("eMail 'From' Address"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-subscription-from" name="subscription_from" value="<?php echo sn_config("subscription_from"); ?>"
|
||||
class="form-control" placeholder="<?php sn_e("eMail 'From' Address"); ?>" disabled="disabled" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-subscription-reply" class="col-sm-3 col-form-label text-muted"><?php sn_e("eMail 'ReplyTo' Address"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-subscription-reply" name="subscription_reply" value="<?php echo sn_config("subscription_reply"); ?>"
|
||||
class="form-control" placeholder="<?php sn_e("eMail 'ReplyTo' Address"); ?>" disabled="disabled" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-subscription-optin" class="col-sm-3 col-form-label text-muted"><?php sn_e("eMail Body (Opt-In)"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-subscription-optin" name="subscription_optin" class="form-control custom-select" disabled="disabled">
|
||||
<option value="default" <?php sn_selected("subscription_optin", "default"); ?>><?php sn_e("Use default Subscription eMail"); ?></option>
|
||||
<?php foreach($static AS $key => $value){ ?>
|
||||
<option value="<?php echo $key; ?>" <?php sn_selected("subscription_optin", $key); ?>><?php sn_e("Page"); ?>: <?php echo $value["title"]; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-subscription-ticker" class="col-sm-3 col-form-label text-muted"><?php sn_e("eMail Body (Notification)"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<select id="sn-subscription-ticker" name="subscription_ticker" class="form-control custom-select" disabled="disabled">
|
||||
<option value="default" <?php sn_selected("subscription_ticker", "default"); ?>><?php sn_e("Use default Notification eMail"); ?></option>
|
||||
<?php foreach($static AS $key => $value){ ?>
|
||||
<option value="<?php echo $key; ?>" <?php sn_selected("subscription_ticker", $key); ?>><?php sn_e("Page"); ?>: <?php echo $value["title"]; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<small class="form-text text-muted"><?php sn_e("Read more about a custom Notification eMails %s!", array('<a href="#" target="_blank">'.sn__("here").'</a>')); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header text-uppercase pt-3 pb-3 pl-4 pr-4" data-toggle="collapse" data-target="#accordion-strings"><?php sn_e("Strings"); ?></div>
|
||||
<div id="accordion-strings" class="collapse" data-parent="#accordion-settings">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label for="sn-success-1" class="col-sm-3 col-form-label"><?php sn_e("Default Thanks Message"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-success-1" name="string_success_1" value="<?php echo sn_config("string_success_1"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_success_1"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-success-2" class="col-sm-3 col-form-label"><?php sn_e("Thanks Message with Subscription"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-success-2" name="string_success_2" value="<?php echo sn_config("string_success_2"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_success_2"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-success-3" class="col-sm-3 col-form-label"><?php sn_e("Thanks Message for Voting"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-success-3" name="string_success_3" value="<?php echo sn_config("string_success_3"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_success_3"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-1" class="col-sm-3 col-form-label"><?php sn_e("Error: Unknown Error, Try again"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-1" name="string_error_1" value="<?php echo sn_config("string_error_1"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_1"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-2" class="col-sm-3 col-form-label"><?php sn_e("Error: Username is invalid"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-2" name="string_error_2" value="<?php echo sn_config("string_error_2"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_2"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-3" class="col-sm-3 col-form-label"><?php sn_e("Error: eMail Address is invalid"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-3" name="string_error_3" value="<?php echo sn_config("string_error_3"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_3"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-4" class="col-sm-3 col-form-label"><?php sn_e("Error: Comment Text is missing"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-4" name="string_error_4" value="<?php echo sn_config("string_error_4"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_4"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-5" class="col-sm-3 col-form-label"><?php sn_e("Error: Comment Title is missing"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-5" name="string_error_5" value="<?php echo sn_config("string_error_5"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_5"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-6" class="col-sm-3 col-form-label"><?php sn_e("Error: Terms not accepted"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-6" name="string_error_6" value="<?php echo sn_config("string_error_6"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_6"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-7" class="col-sm-3 col-form-label"><?php sn_e("Error: Marked as SPAM"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-7" name="string_error_7" value="<?php echo sn_config("string_error_7"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_7"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-error-8" class="col-sm-3 col-form-label"><?php sn_e("Error: Already Voted"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-error-8" name="string_error_8" value="<?php echo sn_config("string_error_8"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_error_8"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sn-terms-of-use" class="col-sm-3 col-form-label"><?php sn_e("Terms of Use"); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="sn-terms-of-use" name="string_terms_of_use" value="<?php echo sn_config("string_terms_of_use"); ?>"
|
||||
class="form-control" placeholder="<?php echo $SnickerPlugin->dbFields["string_terms_of_use"]; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm mt-4 mb-4">
|
||||
<div class="card-body">
|
||||
<button class="btn btn-primary" name="snicker" value="configure"><?php sn_e("Save Settings"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
133
admin/index-users.php
Normal file
133
admin/index-users.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/index-users.php
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
if(!defined("BLUDIT")){ die("Go directly to Jail. Do not pass Go. Do not collect 200 Cookies!"); }
|
||||
|
||||
global $SnickerUsers;
|
||||
|
||||
// Get Data
|
||||
$page = max((isset($_GET["page"])? (int) $_GET["page"]: 1), 1);
|
||||
$limit = sn_config("frontend_per_page");
|
||||
$total = count($SnickerUsers->db);
|
||||
|
||||
// Get Users
|
||||
$search = null;
|
||||
if(isset($_GET["view"]) && $_GET["view"] === "users"){
|
||||
$page = 1;
|
||||
$limit = -1;
|
||||
$search = isset($_GET["search"])? $_GET["search"]: null;
|
||||
}
|
||||
$users = $SnickerUsers->getList($search, $page, $limit);
|
||||
|
||||
// Link
|
||||
$link = DOMAIN_ADMIN . "snicker?page=%d&tab=users#users";
|
||||
|
||||
?>
|
||||
<div id="snicker-users" class="tab-pane">
|
||||
<div class="card shadow-sm" style="margin: 1.5rem 0;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<form class="col-sm-6" method="get" action="<?php echo DOMAIN_ADMIN; ?>snicker#users">
|
||||
<div class="form-row align-items-center">
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="search" value="<?php echo $search; ?>" class="form-control" placeholder="<?php sn_e("Username or eMail Address"); ?>" />
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button class="btn btn-primary" name="view" value="users"><?php sn_e("Search Users"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="col-sm-6 text-right">
|
||||
<?php if($total > $limit){ ?>
|
||||
<div class="btn-group btn-group-pagination">
|
||||
<?php if($page <= 1){ ?>
|
||||
<span class="btn btn-secondary disabled">«</span>
|
||||
<span class="btn btn-secondary disabled">‹</span>
|
||||
<?php } else { ?>
|
||||
<a href="<?php printf($link, 1); ?>" class="btn btn-secondary">«</a>
|
||||
<a href="<?php printf($link, $page-1); ?>" class="btn btn-secondary">‹</a>
|
||||
<?php } ?>
|
||||
<?php if(($page * $limit) < $total){ ?>
|
||||
<a href="<?php printf($link, $page+1); ?>" class="btn btn-secondary">›</a>
|
||||
<a href="<?php printf($link, ceil($total / $limit)); ?>" class="btn btn-secondary">»</a>
|
||||
<?php } else { ?>
|
||||
<span class="btn btn-secondary disabled">›</span>
|
||||
<span class="btn btn-secondary disabled">»</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(!$users || count($users) === 0){ ?>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-sm-6">
|
||||
<div class="card w-100 shadow-sm bg-light">
|
||||
<div class="card-body text-center p-4"><i><?php sn_e("No Users available"); ?></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<?php $link = DOMAIN_ADMIN . "snicker?action=snicker&snicker=users&uuid=%s&handle=%s&tokenCSRF=" . $security->getTokenCSRF(); ?>
|
||||
<table class="table table-bordered table-hover-light shadow-sm mt-3">
|
||||
<?php foreach(array("thead", "tfoot") AS $tag){ ?>
|
||||
<<?php echo $tag; ?>>
|
||||
<tr class="thead-light">
|
||||
<th width="38%" class="border-0 p-3 text-uppercase text-muted"><?php sn_e("Username"); ?></th>
|
||||
<th width="15%" class="border-0 p-3 text-uppercase text-muted"><?php sn_e("eMail"); ?></th>
|
||||
<th width="22%" class="border-0 p-3 text-uppercase text-muted"><?php sn_e("Comments"); ?></th>
|
||||
<th width="25%" class="border-0 p-3 text-uppercase text-muted text-center"><?php sn_e("Actions"); ?></th>
|
||||
</tr>
|
||||
</<?php echo $tag; ?>>
|
||||
<?php } ?>
|
||||
|
||||
<tbody class="shadow-sm-both">
|
||||
<?php foreach($users AS $uuid => $user){ ?>
|
||||
<tr>
|
||||
<td class="p-3">
|
||||
<?php echo $user["username"]; ?>
|
||||
</td>
|
||||
<td class="p-3">
|
||||
<?php echo $user["email"]; ?>
|
||||
</td>
|
||||
<td class="text-center align-middle pt-2 pb-2 pl-1 pr-1">
|
||||
<a href="<?php echo DOMAIN_ADMIN; ?>snicker?view=user&user=<?php echo $uuid; ?>">
|
||||
<?php echo count(isset($user["comments"])? $user["comments"]: array()); ?>
|
||||
<?php sn_e("Comments"); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center align-middle pt-2 pb-2 pl-1 pr-1">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||
<?php sn_e("Handle"); ?>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item text-danger" href="<?php printf($link, $uuid, "delete"); ?>&anonymize=true"><?php sn_e("Delete (Anonymize)"); ?></a>
|
||||
<a class="dropdown-item text-danger" href="<?php printf($link, $uuid, "delete"); ?>&anonymize=false"><?php sn_e("Delete (Completely)"); ?></a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
<?php if($user["blocked"]){ ?>
|
||||
<a class="dropdown-item" href="<?php printf($link, $uuid, "unblock"); ?>"><?php sn_e("Unblock User"); ?></a>
|
||||
<?php } else { ?>
|
||||
<a class="dropdown-item" href="<?php printf($link, $uuid, "block"); ?>"><?php sn_e("Block User"); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</div>
|
||||
85
admin/index.php
Normal file
85
admin/index.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/index.php
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
if(!defined("BLUDIT")){ die("Go directly to Jail. Do not pass Go. Do not collect 200 Cookies!"); }
|
||||
|
||||
global $L, $Snicker;
|
||||
|
||||
// Pending Counter
|
||||
$count = count($Snicker->getIndex("pending"));
|
||||
$count = ($count > 99)? "99+": $count;
|
||||
$spam = count($Snicker->getIndex("spam"));
|
||||
|
||||
// Tab Strings
|
||||
$strings = array(
|
||||
"pending" => sn__("Pending"),
|
||||
"approved" => sn__("Approved"),
|
||||
"rejected" => sn__("Rejected"),
|
||||
"spam" => sn__("Spam"),
|
||||
"search" => sn__("Search Comments"),
|
||||
"single" => sn__("Single Comment"),
|
||||
"uuid" => sn__("Page Comments"),
|
||||
"user" => sn__("User Comments")
|
||||
);
|
||||
|
||||
// Current Tab
|
||||
$view = "index";
|
||||
if(isset($_GET["view"]) && in_array($_GET["view"], array("search", "single", "uuid", "user"))){
|
||||
$view = $current = $_GET["view"];
|
||||
$tabs = array($view);
|
||||
} else {
|
||||
$current = isset($_GET["tab"])? $_GET["tab"]: "pending";
|
||||
$tabs = array("pending", "approved", "rejected", "spam");
|
||||
}
|
||||
?>
|
||||
<h2 class="mt-0 mb-3">
|
||||
<span class="oi oi-comment-square" style="font-size: 0.7em;"></span> Snicker <?php sn_e("Comments"); ?>
|
||||
</h2>
|
||||
|
||||
<ul class="nav nav-pills" data-handle="tabs">
|
||||
<?php foreach($tabs AS $tab){ ?>
|
||||
<?php $class = "nav-link nav-{$tab}" . ($current === $tab? " active": ""); ?>
|
||||
<li class="nav-item">
|
||||
<a id="<?php echo $tab; ?>-tab" href="#snicker-<?php echo $tab; ?>" class="<?php echo $class; ?>" data-toggle="tab">
|
||||
<?php
|
||||
echo $strings[$tab];
|
||||
if($tab === "pending" && !empty($count)){
|
||||
?> <span class="badge badge-primary"><?php echo $count; ?></span><?php
|
||||
}
|
||||
if($tab === "spam" && !empty($spam)){
|
||||
?> <span class="badge badge-danger"><?php echo $spam; ?></span><?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<li class="nav-item flex-grow-1"></li>
|
||||
|
||||
<li class="nav-item mr-2">
|
||||
<a id="users-tab" href="#snicker-users" class="nav-link nav-config" data-toggle="tab">
|
||||
<span class="oi oi-people"></span> <?php sn_e("Users"); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a id="configure-tab" href="#snicker-configure" class="nav-link nav-config" data-toggle="tab">
|
||||
<span class="oi oi-cog"></span> <?php sn_e("Configuration"); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<?php
|
||||
include "index-comments.php";
|
||||
include "index-users.php";
|
||||
include "index-config.php";
|
||||
?>
|
||||
</div>
|
||||
125
admin/js/admin.snicker.js
Normal file
125
admin/js/admin.snicker.js
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
| Snicker The first native FlatFile Comment Plugin 4 Bludit
|
||||
| @file ./admin/js/admin.snicker.js
|
||||
| @author SamBrishes <sam@pytes.net>
|
||||
| @version 0.1.2 [0.1.0] - Alpha
|
||||
|
|
||||
| @website https://github.com/pytesNET/snicker
|
||||
| @license X11 / MIT License
|
||||
| @copyright Copyright © 2019 SamBrishes, pytesNET <info@pytes.net>
|
||||
*/
|
||||
;(function(root){
|
||||
"use strict";
|
||||
var w = root, d = root.document;
|
||||
|
||||
/*
|
||||
| HELPER :: LOOP
|
||||
| @since 0.1.0
|
||||
*/
|
||||
var each = function(elements, callback){
|
||||
if(elements instanceof HTMLElement){
|
||||
callback.call(elements, elements);
|
||||
} else if(elements.length && elements.length > 0){
|
||||
for(var l = elements.length, i = 0; i < l; i++){
|
||||
callback.call(elements[i], elements[i], i);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Ready?
|
||||
d.addEventListener("DOMContentLoaded", function(){
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
| BOOTSTRAP POPOVER
|
||||
| @since 0.1.0
|
||||
*/
|
||||
jQuery('[data-toggle="popover"]').popover({
|
||||
content: function(){
|
||||
var data = d.querySelector(this.getAttribute("data-target"));
|
||||
return data.innerHTML;
|
||||
},
|
||||
html: true
|
||||
}).click(function(event){
|
||||
event.preventDefault();
|
||||
}).on("inserted.bs.popover", function(event){
|
||||
d.querySelector("#" + this.getAttribute("aria-describedby")).style.width = "410px";
|
||||
d.querySelector("#" + this.getAttribute("aria-describedby")).style.maxWidth = "410px";
|
||||
})
|
||||
|
||||
/*
|
||||
| MAIN MENU LINK HANDLER
|
||||
| @since 0.1.0
|
||||
*/
|
||||
var mainMenu = d.querySelector("[data-handle='tabs']");
|
||||
if(mainMenu){
|
||||
var menuLink = function(link){
|
||||
if(typeof(link) === "undefined"){
|
||||
if(w.location.hash.length == 0){
|
||||
var link = mainMenu.querySelector("li a");
|
||||
} else {
|
||||
var link = mainMenu.querySelector("[href='#snicker-" + w.location.hash.substr(1) + "']");
|
||||
}
|
||||
}
|
||||
if(!(link instanceof Element)){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle
|
||||
if(link && !link.classList.contains("active")){
|
||||
link.click();
|
||||
}
|
||||
if(link){
|
||||
w.location.hash = link.getAttribute("href").replace("snicker-", "");
|
||||
}
|
||||
};
|
||||
|
||||
// Current Hash Handler
|
||||
if(w.location.hash.length > 0){
|
||||
menuLink();
|
||||
}
|
||||
|
||||
// Local Hash Handler
|
||||
each(mainMenu.querySelectorAll("li > a"), function(){
|
||||
this.addEventListener("click", function(event){
|
||||
menuLink(this);
|
||||
});
|
||||
});
|
||||
|
||||
// History Hash Handler
|
||||
w.onhashchange = function(event){
|
||||
if(w.location.hash.length == 0){
|
||||
var link = mainMenu.querySelector("li a");
|
||||
} else {
|
||||
var link = mainMenu.querySelector("[href='#snicker-" + w.location.hash.substr(1) + "']");
|
||||
}
|
||||
menuLink(link);
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
| MAIN MENU LINK HANDLER
|
||||
| @since 0.1.1
|
||||
*/
|
||||
var avatar = document.getElementById("sn-avatar"),
|
||||
gravatar = document.getElementById("sn-gravatar");
|
||||
if(avatar && gravatar){
|
||||
var GravatarOption = function(){
|
||||
console.log(avatar.value)
|
||||
|
||||
if(avatar.value == "gravatar"){
|
||||
gravatar.disabled = false;
|
||||
document.querySelector("label[for='sn-gravatar']").classList.remove("text-muted");
|
||||
} else {
|
||||
gravatar.disabled = true;
|
||||
document.querySelector("label[for='sn-gravatar']").classList.add("text-muted");
|
||||
}
|
||||
};
|
||||
|
||||
avatar.addEventListener("change", function(){
|
||||
GravatarOption();
|
||||
});
|
||||
GravatarOption();
|
||||
}
|
||||
});
|
||||
})(window);
|
||||
Reference in New Issue
Block a user