2 include
'../system/plugins/blog/classes/blog.php';
4 if (!isset(
$blog)) {
$blog = new \YAWK\PLUGINS\BLOG\blog(); }
6 if (!isset($language) || (!isset(
$lang)))
12 if (isset(
$_GET[
'toggle']))
14 if (isset(
$_GET[
'published']) && (isset(
$_GET[
'id'])))
16 if (
$_GET[
'published'] ===
'1')
17 {
$_GET[
'published'] = 0; $status =
"offline"; }
19 {
$_GET[
'published'] = 1; $status =
"online"; }
23 print \YAWK\alert::draw(
"success",
"Comment is now $status.",
"Comment is now $status",
"", 800);
27 print \YAWK\alert::draw(
"danger",
"Error: Could not toggle comment status.",
"Comment is still $status",
"", 5800);
33 if (isset(
$_GET[
'deletecomment']))
35 if (
$_GET[
'deletecomment'] ===
"true") {
37 if (isset(
$_GET[
'commentid']) && (isset(
$_GET[
'itemid']) && (isset(
$_GET[
'blogid'])))) {
44 \YAWK\alert::draw(
"danger",
"Error: ",
"Could not delete comment ID: " .
$_GET[
'commentid'] .
" from Blog: ".
$_GET[
'blogid'].
" ",
"",
"5800");
50 if (isset(
$_GET[
'blogid'])) {
52 if (isset(
$_GET[
'itemid'])){
54 $sqlAddon =
"AND itemid = ".$blog->itemid.
"";
55 $refreshBtnAddon =
"&itemid=".$blog->itemid.
"";
58 $refreshBtnAddon =
'';
69 <script
type=
"text/javascript">
70 $(document).
ready(
function () {
71 $(
'#table-sort').dataTable({
73 "bLengthChange":
false,
84 <!-- Content Wrapper. Contains page content -->
85 <div class=\"content-wrapper\" id=\"content-FX\">
86 <!-- Content Header (Page header) -->
87 <section class=\"content-header\">";
89 \YAWK\PLUGINS\BLOG\blog::getBlogTitle(
$lang[
'COMMENTS'],
"$lang[IN_BLOG] $blog->name",
$blog->icon);
90 echo
"<ol class=\"breadcrumb\">
91 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
92 <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
93 <li><a href=\"index.php?plugin=blog\" title=\"$lang[BLOG]\"> $lang[BLOG]</a></li>
94 <li class=\"active\"><a href=\"index.php?plugin=&pluginpage=blog-comments\" title=\"$lang[COMMENTS]\"> $lang[COMMENTS]</a></li>
98 <section class=\"content\">";
101 <div
class=
"box box-default">
102 <div
class=
"box-body">
104 <
a class=
"btn btn-success" href=
"index.php?plugin=blog&pluginpage=blog-comments<?php echo $refreshBtnAddon; ?>&blogid=<?php echo $blog->id; ?>" style=
"float:right;">
105 <
i class=
"glyphicon glyphicon-repeat"></
i> &
nbsp;<?php print
$lang[
'REFRESH']; ?></
a>
106 <
a class=
"btn btn-default" href=
"index.php?plugin=blog" style=
"float:right;">
107 <
i class=
"glyphicon glyphicon-backward"></
i> &
nbsp;<?php print
$lang[
'BACK']; ?></
a>
109 <table width=
"100%" cellpadding=
"4" cellspacing=
"0" border=
"0" class=
"table table-hover" id=
"table-sort">
112 <td width=
"3%"><strong>&
nbsp;</strong></td>
113 <td width=
"3%" class=\
"text-left\"><strong><?php echo $lang['GROUP']; ?></strong></td>
114 <td width="13%
" class=\"text-left\"><strong><?php echo $lang['USER']; ?></strong></td>
115 <td width="14%
" class=\"text-center\"><strong><?php echo $lang['DATE']; ?></strong></td>
116 <td width="57%
"><strong><?php echo $lang['COMMENT']; ?></strong></td>
117 <td width="5%
" class=\"text-center\"><strong><?php echo $lang['ID']; ?></strong></td>
118 <td width="5%
" class=\"text-center\"><strong><?php echo $lang['ACTIONS']; ?></strong></td>
124 $res = mysqli_query($connection, "SELECT ci.*, cu.username as username, cg.value as
gid FROM
" . $dbprefix . "blog_comments as ci
125 INNER JOIN
" . $dbprefix . "users as cu
on ci.uid = cu.id
126 INNER JOIN
" . $dbprefix . "user_groups as cg
on ci.gid = cg.id WHERE
blogid =
'" . $blog->id . "'".$sqlAddon." ORDER BY date_created DESC
");
129 $res = $db->query("SELECT * FROM {blog_comments}
130 WHERE
blogid =
'".$blog->id."' ".$sqlAddon." ORDER BY date_created DESC
");
131 while ($row = mysqli_fetch_assoc($res)) {
133 if ($row['uid'] === '0' && ($row['gid'] === '0')){
134 $comment_user = $row['name'];
139 $user = new \YAWK\user($db);
141 $comment_user = $user->getProperty($db, $row['uid'], "username
");
144 // on / off badge logic
145 switch ($row['published']) {
148 $pubtext = "$lang[OFFLINE]
";
152 $pubtext = "$lang[ONLINE]
";
156 // group id badge logic
157 switch ($row['gid']) {
183 // draw table and badges
185 <td
class=\
"text-left\">
186 <a href=\"index.php?plugin=blog&pluginpage=blog-comments&toggle=1&published=" . $row[
'published'] .
"&blogid=" .
$blog->id .
"&id=" . $row[
'id'] .
"\">
187 <span class=\"label label-$pub\">".$pubtext.
"</span></a> </td>
189 <td class=\"text-leftcleft>
190 <span class=\"label label-$color\">".$label.
"</span></td>
192 <td class=\"text-center\">".$comment_user.
"</td>
194 <td><a href=\"index.php?plugin=blog&pluginpage=blog-edit&itemid=" . $row[
'id'] .
"&blogid=" .
$blog->id .
"\"><div style=\"width:100%\">" . $row[
'date_created'] .
"</div></a></td>
195 <td><a href=\"index.php?plugin=blog&pluginpage=blog-edit&itemid=" . $row[
'id'] .
"&blogid=" .
$blog->id .
"\" style=\"color: #7A7376;\"><div style=\"width:100%\">" . $row[
'comment'] .
"</div></a></td>
197 <td>" . $row[
'id'] .
"</td>
199 <td class=\"text-center\">
201 <a class=\"icon icon-trash\" data-confirm=\"$lang[DEL_COMMENT] «" . $comment_user .
" - " . $row[
'comment'] .
"»\" title=\"DELETE " . $row[
'id'] .
"\" href=\"index.php?plugin=blog&pluginpage=blog-deletecomment&item=kill&commentid=".$row[
'id'].
"&blogid=".
$blog->id.
"&itemid=".$row[
'itemid'].
"&delete=true\">
204 <a class=\"fa fa-trash-o\" role=\"dialog\" data-confirm=\"$lang[DEL_ENTRY] «" . $row[
'id'] .
" / " . $row[
'comment'] .
"»\"
205 title=\"" .
$lang[
'DEL'] .
"\" href=\"index.php?plugin=blog&pluginpage=blog-comments&blogid=" .
$blog->id .
"&commentid=" . $row[
'id'] .
"&itemid=" . $row[
'itemid'] .
"&deletecomment=true\">
static draw($type, $title, $text, $redirect, $delay)
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L öschen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})