r20151010
Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
parent
f0e2ba317f
commit
7305267c35
16 changed files with 213 additions and 30 deletions
|
@ -3030,6 +3030,42 @@
|
||||||
"user": "Flashwave"
|
"user": "Flashwave"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
"20151010": [
|
||||||
|
|
||||||
|
"eminence",
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Limited comment indentation to 4 layers to prevent overflow.",
|
||||||
|
"user": "Flashwave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Fixed reply box appearing at the end of the already made replies.",
|
||||||
|
"user": "Flashwave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Fixed profile comments not showing when a user doesn't have a userpage.",
|
||||||
|
"user": "Flashwave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Fixed friends in friendslisting going all over the place.",
|
||||||
|
"user": "Flashwave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ADD",
|
||||||
|
"change": "Added sitelogo configuration variable.",
|
||||||
|
"user": "Flashwave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ADD",
|
||||||
|
"change": "Added permissions to commenting.",
|
||||||
|
"user": "Flashwave"
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ class Comments
|
||||||
|
|
||||||
// Attach the poster
|
// Attach the poster
|
||||||
$comment['comment_poster'] = $this->commenters[$comment['comment_poster']];
|
$comment['comment_poster'] = $this->commenters[$comment['comment_poster']];
|
||||||
|
$comment['comment_text'] = Main::parseEmotes(Main::cleanString($comment['comment_text']));
|
||||||
|
|
||||||
// Add post to posts array
|
// Add post to posts array
|
||||||
$layer[$comment['comment_id']] = $comment;
|
$layer[$comment['comment_id']] = $comment;
|
||||||
|
@ -75,7 +76,18 @@ class Comments
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sorting
|
// Getting a single comment
|
||||||
|
public function getComment($cid)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Get from database
|
||||||
|
return Database::fetch('comments', false, [
|
||||||
|
'comment_id' => [$cid, '='],
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating
|
||||||
public function makeComment($uid, $reply, $content)
|
public function makeComment($uid, $reply, $content)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -102,4 +114,15 @@ class Comments
|
||||||
return [1, 'SUCCESS'];
|
return [1, 'SUCCESS'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deleting
|
||||||
|
public function removeComment($cid)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Remove from database
|
||||||
|
return Database::delete('comments', [
|
||||||
|
'comment_id' => [$cid, '='],
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,9 @@ class Permissions
|
||||||
'MULTIPLE_GROUPS' => 33554432, // Can create multiple groups (requires single group perm)
|
'MULTIPLE_GROUPS' => 33554432, // Can create multiple groups (requires single group perm)
|
||||||
'CHANGE_NAMECOLOUR' => 67108864, // Can change their username colour
|
'CHANGE_NAMECOLOUR' => 67108864, // Can change their username colour
|
||||||
'STATIC_PREMIUM' => 134217728, // User has static premium status
|
'STATIC_PREMIUM' => 134217728, // User has static premium status
|
||||||
|
'CREATE_COMMENTS' => 268435456, // User can make comments
|
||||||
|
'DELETE_COMMENTS' => 536870912, // User can delete own comments
|
||||||
|
'VOTE_COMMENTS' => 1073741824, // User can vote on comments
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -248,8 +248,8 @@ class Urls
|
||||||
'/comments?id=%u&mode=dislike&session=%s',
|
'/comments?id=%u&mode=dislike&session=%s',
|
||||||
],
|
],
|
||||||
'COMMENT_DELETE' => [
|
'COMMENT_DELETE' => [
|
||||||
'/settings.php?comment-action=true&id=%u&mode=delete&session=%s',
|
'/settings.php?comment-action=true&id=%u&category=%s&mode=delete&session=%s',
|
||||||
'/comments?id=%u&mode=delete&session=%s',
|
'/comments?id=%u&mode=delete&category=%s&session=%s',
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20151006');
|
define('SAKURA_VERSION', '20151010');
|
||||||
define('SAKURA_VLABEL', 'Eminence');
|
define('SAKURA_VLABEL', 'Eminence');
|
||||||
define('SAKURA_COLOUR', '#6C3082');
|
define('SAKURA_COLOUR', '#6C3082');
|
||||||
define('SAKURA_STABLE', false);
|
define('SAKURA_STABLE', false);
|
||||||
|
@ -148,6 +148,7 @@ if (!defined('SAKURA_NO_TPL')) {
|
||||||
|
|
||||||
'charset' => Configuration::getConfig('charset'),
|
'charset' => Configuration::getConfig('charset'),
|
||||||
'siteName' => Configuration::getConfig('sitename'),
|
'siteName' => Configuration::getConfig('sitename'),
|
||||||
|
'siteLogo' => Configuration::getConfig('sitelogo'),
|
||||||
'siteDesc' => Configuration::getConfig('sitedesc'),
|
'siteDesc' => Configuration::getConfig('sitedesc'),
|
||||||
'siteTags' => implode(", ", json_decode(Configuration::getConfig('sitetags'), true)),
|
'siteTags' => implode(", ", json_decode(Configuration::getConfig('sitetags'), true)),
|
||||||
'dateFormat' => Configuration::getConfig('date_format'),
|
'dateFormat' => Configuration::getConfig('date_format'),
|
||||||
|
|
|
@ -5,16 +5,19 @@
|
||||||
<div class="comment-content">
|
<div class="comment-content">
|
||||||
<div class="comment-controls">
|
<div class="comment-controls">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{{ urls.format('USER_REPORT', [comment.comment_poster.data.id]) }}" class="underline">Report</a></li>
|
{% if comment.comment_poster.data.id == user.data.id %}
|
||||||
<li><a href="{{ urls.format('COMMENT_DELETE', [comment.comment_id, php.sessionid])}}" class="underline">Delete</a></li>
|
<li><a href="{{ urls.format('COMMENT_DELETE', [comment.comment_id, comment.comment_category, php.sessionid])}}" class="clean fa fa-trash-o comment-deletion-link" title="Delete" id="comment-delete-{{ comment.comment_id }}"></a></li>
|
||||||
<li><a href="javascript:void(0);" onclick="commentReply({{ comment.comment_id }}, '{{ php.sessionid }}', '{{ comment.comment_category }}', '{{ urls.format('COMMENT_POST') }}', '{{ urls.format('IMAGE_AVATAR', [user.data.id]) }}');" class="underline">Reply</a></li>
|
{% else %}
|
||||||
<li class="shown voting like"><a href="{{ urls.format('COMMENT_LIKE', [comment.comment_id, php.sessionid])}}" class="clean"><span class="fa fa-thumbs-up"></span> {{ comment.comment_likes }}</a></li>
|
<li><a href="{{ urls.format('USER_REPORT', [comment.comment_poster.data.id]) }}" class="clean fa fa-exclamation-circle" title="Report" id="comment-report-{{ comment.comment_id }}"></a></li>
|
||||||
<li class="shown voting dislike"><a href="{{ urls.format('COMMENT_DISLIKE', [comment.comment_id, php.sessionid])}}" class="clean"><span class="fa fa-thumbs-down"></span> {{ comment.comment_dislikes }}</a></li>
|
{% endif %}
|
||||||
|
<li><a href="javascript:void(0);" onclick="commentReply({{ comment.comment_id }}, '{{ php.sessionid }}', '{{ comment.comment_category }}', '{{ urls.format('COMMENT_POST') }}', '{{ urls.format('IMAGE_AVATAR', [user.data.id]) }}');" class="clean fa fa-reply" title="Reply" id="comment-reply-{{ comment.comment_id }}"></a></li>
|
||||||
|
<li class="shown voting like"><a href="{{ urls.format('COMMENT_LIKE', [comment.comment_id, php.sessionid])}}" class="clean" id="comment-link-{{ comment.comment_id }}"><span class="fa fa-thumbs-up"></span> {{ comment.comment_likes }}</a></li>
|
||||||
|
<li class="shown voting dislike" id="comment-dislike-{{ comment.comment_id }}"><a href="{{ urls.format('COMMENT_DISLIKE', [comment.comment_id, php.sessionid])}}" class="clean"><span class="fa fa-thumbs-down"></span> {{ comment.comment_dislikes }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-text">
|
<div class="comment-text">
|
||||||
{{ comment.comment_text|nl2br }}
|
{{ comment.comment_text|raw|nl2br }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,6 +13,11 @@
|
||||||
<input class="comment-submit new" name="submit" type="submit" value="" />
|
<input class="comment-submit new" name="submit" type="submit" value="" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener("load", function() {
|
||||||
|
prepareAjaxForm('commentsForm', 'Posting comment...');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1 class="stylised" style="text-align: center; padding: 10px 0">Log in to comment!</h1>
|
<h1 class="stylised" style="text-align: center; padding: 10px 0">Log in to comment!</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -29,8 +34,13 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener("load", function() {
|
var deletionLinks = document.querySelectorAll('.comment-deletion-link');
|
||||||
prepareAjaxForm('commentsForm', 'Posting comment...');
|
|
||||||
});
|
for(var link in deletionLinks) {
|
||||||
|
prepareAjaxLink(deletionLinks[link].id, 'submitPost', ', true, "Deleting..."');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<span id="top"></span>
|
<span id="top"></span>
|
||||||
<div class="header" id="header">
|
<div class="header" id="header">
|
||||||
<a class="logo" href="{{ urls.format('SITE_HOME') }}">{{ sakura.siteName }}</a>
|
<a class="logo" href="{{ urls.format('SITE_HOME') }}">{% if sakura.siteLogo %}<img src="{{ sakura.siteLogo }}" alt="{{ sakura.siteName }}" />{% else %}{{ sakura.siteName }}{% endif %}</a>
|
||||||
<div class="menu fa">
|
<div class="menu fa">
|
||||||
<div class="menu-nav" id="navMenuSite">
|
<div class="menu-nav" id="navMenuSite">
|
||||||
<!-- Navigation menu, displayed on left side of the bar. -->
|
<!-- Navigation menu, displayed on left side of the bar. -->
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.id != profile.data.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
|
{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.id != profile.data.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
|
||||||
|
|
||||||
{% set sidePanel = profile.userPage|length > 1 %}
|
{% set noUserpage = profile.userPage|length < 1 %}
|
||||||
|
|
||||||
|
{% set profileView = noUserpage and profileView == 'index' ? 'comments' : profileView %}
|
||||||
|
|
||||||
{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.data.username }}{% endif %}{% endblock %}
|
{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.data.username }}{% endif %}{% endblock %}
|
||||||
|
|
||||||
|
@ -20,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="content profile">
|
<div class="content profile">
|
||||||
<div class="{% if sidePanel %}content-right {% endif %}content-column">
|
<div class="content-right content-column">
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<img src="{{ urls.format('IMAGE_AVATAR', [profile.data.id]) }}" alt="{{ profile.data.username }}'s Avatar" class="default-avatar-setting" style="box-shadow: 0 3px 7px #{% if profile.checkOnline %}484{% else %}844{% endif %};" /><br />
|
<img src="{{ urls.format('IMAGE_AVATAR', [profile.data.id]) }}" alt="{{ profile.data.username }}'s Avatar" class="default-avatar-setting" style="box-shadow: 0 3px 7px #{% if profile.checkOnline %}484{% else %}844{% endif %};" /><br />
|
||||||
{% if profile.data.rank_main > 1 and profile.checkBan|length < 1 %}
|
{% if profile.data.rank_main > 1 and profile.checkBan|length < 1 %}
|
||||||
|
@ -40,7 +42,9 @@
|
||||||
<a class="fa fa-file-text-o" title="View {{ profile.data.username }}'s profile page" href="{{ urls.format('USER_PROFILE', [profile.data.id]) }}"></a>
|
<a class="fa fa-file-text-o" title="View {{ profile.data.username }}'s profile page" href="{{ urls.format('USER_PROFILE', [profile.data.id]) }}"></a>
|
||||||
<a class="fa fa-plus-square" title="View {{ profile.data.username }} threads" href="{{ urls.format('USER_THREADS', [profile.data.id]) }}"></a>
|
<a class="fa fa-plus-square" title="View {{ profile.data.username }} threads" href="{{ urls.format('USER_THREADS', [profile.data.id]) }}"></a>
|
||||||
<a class="fa fa-reply" title="View {{ profile.data.username }} posts" href="{{ urls.format('USER_POSTS', [profile.data.id]) }}"></a>
|
<a class="fa fa-reply" title="View {{ profile.data.username }} posts" href="{{ urls.format('USER_POSTS', [profile.data.id]) }}"></a>
|
||||||
|
{% if not noUserpage %}
|
||||||
<a class="fa fa-comments-o" title="View {{ profile.data.username }}'s profile comments" href="{{ urls.format('USER_COMMENTS', [profile.data.id]) }}"></a>
|
<a class="fa fa-comments-o" title="View {{ profile.data.username }}'s profile comments" href="{{ urls.format('USER_COMMENTS', [profile.data.id]) }}"></a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr class="default" />
|
<hr class="default" />
|
||||||
|
@ -106,7 +110,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-left content-column{% if not sidePanel %} hidden{% endif %}">
|
<div class="content-left content-column">
|
||||||
{% include 'profile/' ~ profileView ~ '.tpl' %}
|
{% include 'profile/' ~ profileView ~ '.tpl' %}
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
0
_sakura/templates/yuuno/profile/posts.tpl
Normal file
0
_sakura/templates/yuuno/profile/posts.tpl
Normal file
0
_sakura/templates/yuuno/profile/threads.tpl
Normal file
0
_sakura/templates/yuuno/profile/threads.tpl
Normal file
|
@ -42,7 +42,7 @@ if (Auth::getPageType() == AUTH_FETCH) {
|
||||||
// Check if session is active else deny
|
// Check if session is active else deny
|
||||||
if (Session::checkSession($uid, $sid)) {
|
if (Session::checkSession($uid, $sid)) {
|
||||||
// Check if they can access the chat
|
// Check if they can access the chat
|
||||||
if (Permissions::check('SITE', 'DEACTIVATED', $uid, 1) && Permissions::check('SITE', 'RESTRICTED', $uid, 1)) {
|
if (Permissions::check('SITE', 'DEACTIVATED', $uid, 1) || Permissions::check('SITE', 'RESTRICTED', $uid, 1)) {
|
||||||
Auth::Deny();
|
Auth::Deny();
|
||||||
Auth::Serve();
|
Auth::Serve();
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
/* Import Font Awesome */
|
/* Import Font Awesome */
|
||||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
|
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
|
||||||
|
|
||||||
/* Import Segoe UI */
|
/* Import Segoe UI */
|
||||||
@import url('/content/fonts/segoeui/font.css');
|
@import url('/content/fonts/segoeui/font.css');
|
||||||
|
@ -1149,7 +1149,7 @@ a.default:active {
|
||||||
margin-top: -20px;
|
margin-top: -20px;
|
||||||
float: right;
|
float: right;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 140px;
|
min-width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.news-poster img {
|
.news-poster img {
|
||||||
|
@ -1387,17 +1387,20 @@ a.default:active {
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings .friends-list {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.settings .friends-list > div:not(:last-child) {
|
.settings .friends-list > div:not(:last-child) {
|
||||||
display: block;
|
display: inline-block;
|
||||||
border: 1px solid #9475B2;
|
border: 1px solid #9475B2;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 220px;
|
width: 220px;
|
||||||
margin: 0 2px 40px;
|
margin: 0 2px 40px;
|
||||||
float: left;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-shadow: inset 0 0 1px #9475B2;
|
box-shadow: inset 0 0 1px #9475B2;
|
||||||
background: #E4CFFF;
|
background: #E4CFFF;
|
||||||
transition: .2s;
|
transition: background .2s, box-shadow .2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings .friends-list > div:not(:last-child):hover {
|
.settings .friends-list > div:not(:last-child):hover {
|
||||||
|
@ -2066,7 +2069,6 @@ textarea.inputStyling {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 0;
|
border: 0;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
height: 50px;
|
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
flex-grow: 2;
|
flex-grow: 2;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
@ -2074,6 +2076,10 @@ textarea.inputStyling {
|
||||||
background: #F6F6F6;
|
background: #F6F6F6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#comments .comment > textarea.comment-content {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
#comments .comment > .comment-content > .comment-controls {
|
#comments .comment > .comment-content > .comment-controls {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
@ -2135,7 +2141,10 @@ textarea.inputStyling {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#comments ul > li > ul {
|
#comments .comments-list > li > ul,
|
||||||
|
#comments .comments-list > li > ul > li > ul,
|
||||||
|
#comments .comments-list > li > ul > li > ul > li > ul,
|
||||||
|
#comments .comments-list > li > ul > li > ul > li > ul > li > ul {
|
||||||
margin-left: 40px;
|
margin-left: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2148,5 +2157,8 @@ textarea.inputStyling {
|
||||||
|
|
||||||
#comments ul > li > ul .comment > .comment-content {
|
#comments ul > li > ul .comment > .comment-content {
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#comments ul > li > ul .comment > textarea.comment-content {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -863,8 +863,18 @@ function commentReply(id, session, category, action, avatar) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attempt to get previously created box
|
||||||
|
var replyBox = document.getElementById('comment-reply-container-' + id);
|
||||||
|
|
||||||
|
// Remove it if it already exists
|
||||||
|
if(replyBox) {
|
||||||
|
removeId('comment-reply-container-' + id);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Container
|
// Container
|
||||||
var replyContainer = document.createElement('li');
|
var replyContainer = document.createElement('li');
|
||||||
|
replyContainer.id = 'comment-reply-container-' + id;
|
||||||
|
|
||||||
// Form
|
// Form
|
||||||
var replyForm = document.createElement('form');
|
var replyForm = document.createElement('form');
|
||||||
|
@ -936,7 +946,11 @@ function commentReply(id, session, category, action, avatar) {
|
||||||
replyContainer.appendChild(replyForm);
|
replyContainer.appendChild(replyForm);
|
||||||
|
|
||||||
// Insert the HTML
|
// Insert the HTML
|
||||||
|
if(replyingTo.children[1].children.length > 0) {
|
||||||
|
replyingTo.children[1].insertBefore(replyContainer, replyingTo.children[1].firstChild);
|
||||||
|
} else {
|
||||||
replyingTo.children[1].appendChild(replyContainer);
|
replyingTo.children[1].appendChild(replyContainer);
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare AJAX submission
|
// Prepare AJAX submission
|
||||||
prepareAjaxForm(replyForm.id, 'Replying...');
|
prepareAjaxForm(replyForm.id, 'Replying...');
|
||||||
|
|
|
@ -15,6 +15,8 @@ $profile = new User(isset($_GET['u']) ? $_GET['u'] : 0);
|
||||||
// Views array
|
// Views array
|
||||||
$views = [
|
$views = [
|
||||||
'index',
|
'index',
|
||||||
|
'threads',
|
||||||
|
'posts',
|
||||||
'comments',
|
'comments',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,24 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
||||||
$continue = false;
|
$continue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Match session ids for the same reason
|
||||||
|
if (!isset($_REQUEST['category'])) {
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'No category was set.',
|
||||||
|
'success' => 0,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// Prevent
|
||||||
|
$continue = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Select the right action
|
// Select the right action
|
||||||
if ($continue) {
|
if ($continue) {
|
||||||
|
$comments = new Comments($_REQUEST['category']);
|
||||||
|
|
||||||
switch (isset($_REQUEST['mode']) ? $_REQUEST['mode'] : false) {
|
switch (isset($_REQUEST['mode']) ? $_REQUEST['mode'] : false) {
|
||||||
case 'like':
|
case 'like':
|
||||||
break;
|
break;
|
||||||
|
@ -78,11 +94,70 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
$comment = $comments->getComment(isset($_REQUEST['id']) ? $_REQUEST['id'] : 0);
|
||||||
|
|
||||||
|
// Check if the comment was actually made by the current user
|
||||||
|
if (!$comment) {
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'The requested comment does not exist.',
|
||||||
|
'success' => 0,
|
||||||
|
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the user can delete comments
|
||||||
|
if (!$currentUser->checkPermission('SITE', 'DELETE_COMMENTS')) {
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'You aren\'t allowed delete to comments.',
|
||||||
|
'success' => 0,
|
||||||
|
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the comment was actually made by the current user
|
||||||
|
if ($comment['comment_poster'] !== $currentUser->data['id']) {
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'You can\'t delete the comments of others.',
|
||||||
|
'success' => 0,
|
||||||
|
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$comments->removeComment(isset($_REQUEST['id']) ? $_REQUEST['id'] : 0);
|
||||||
|
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'The comment has been deleted!',
|
||||||
|
'success' => 1,
|
||||||
|
|
||||||
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'comment':
|
case 'comment':
|
||||||
|
// Check if the user can delete comments
|
||||||
|
if (!$currentUser->checkPermission('SITE', 'CREATE_COMMENTS')) {
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'You aren\'t allowed to comment.',
|
||||||
|
'success' => 0,
|
||||||
|
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to make a new comment
|
// Attempt to make a new comment
|
||||||
$comment = (new Comments($_POST['category']))->makeComment($currentUser->data['id'], $_POST['replyto'], $_POST['comment']);
|
$comment = $comments->makeComment($currentUser->data['id'], $_POST['replyto'], $_POST['comment']);
|
||||||
|
|
||||||
// Messages
|
// Messages
|
||||||
$messages = [
|
$messages = [
|
||||||
|
|
Reference in a new issue