7 use YAWK\PLUGINS\BLOG\blog;
9 include
'../system/plugins/blog/classes/blog.php';
13 if (!isset($language) || (!isset(
$lang)))
15 $lang = language::inject(@
$lang,
"../system/plugins/blog/language/");
22 if (isset(
$_GET[
'addblog']))
24 if (
$_GET[
'addblog'] ==
"1")
26 if (!empty($_POST[
'name']) || (!empty($_POST[
'description'])))
29 $description =
$db->quote($_POST[
'description']);
37 if (!empty($_POST[
'menuID'])) { $menuID =
$db->quote($_POST[
'menuID']); }
else { $menuID =
''; }
38 if (!empty($_POST[
'icon'])) { $icon =
$db->quote($_POST[
'icon']); }
else { $icon =
''; }
40 if (
$blog->create(
$db,
$name, $description, $menuID, $icon) ===
true)
44 alert::draw(
"info",
"$lang[DID_YOU_KNOW]",
"$lang[BLOG_TIP_ICONS]",
"", 12400);
46 print alert::draw(
"success",
"$lang[SUCCESS]",
"$lang[BLOG_ADD_OK]",
"", 800);
50 print alert::draw(
"danger",
"$lang[ERROR]",
"$lang[BLOG_ADD_FAILED] $name",
"",3800);
59 if (isset(
$_GET[
'all']) && (
$_GET[
'all'] ===
"true"))
61 if (isset(
$_GET[
'blog']))
65 alert::draw(
"warning",
"$lang[ERROR]",
"$lang[BLOG_DEL_FAILED] " .
$_GET[
'itemid'] .
" ",
"plugin=blog", 5800);
71 <script
type=
"text/javascript">
72 $(document).
ready(
function () {
73 $(
'#table-sort').dataTable({
75 "bLengthChange":
false,
86 <!-- Content Wrapper. Contains page content -->
87 <div class=\"content-wrapper\" id=\"content-FX\">
88 <!-- Content Header (Page header) -->
89 <section class=\"content-header\">";
91 echo backend::getTitle(
$lang[
'BLOG'],
$lang[
'BLOGS_SUBTEXT']);
92 echo
"<ol class=\"breadcrumb\">
93 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
94 <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
95 <li class=\"active\"><a href=\"index.php?plugin=blog\" title=\"$lang[BLOG]\"> $lang[BLOG]</a></li>
99 <section class=\"content\">";
102 <div
class=
"box box-default">
103 <div
class=
"box-body">
105 <
a class=
"btn btn-success" href=
"index.php?plugin=blog&pluginpage=blog-new" style=
"float:right;">
106 <
i class=
"glyphicon glyphicon-plus"></
i> &
nbsp;<?php print
$lang[
'BLOG_ADD']; ?></
a>
108 <table width=
"100%" cellpadding=
"4" cellspacing=
"0" border=
"0" class=
"table table-hover" id=
"table-sort">
111 <td width=
"3%"><strong>&
nbsp;</strong></td>
112 <td width=
"5%" class=
"text-center"><strong><?php echo
$lang[
'ID']; ?></strong></td>
113 <td width=
"3%" class=
"text-center"><strong>&
nbsp;</strong></td>
114 <td width=
"15%"><strong><?php echo
$lang[
'BLOG']; ?></strong></td>
115 <td width=
"57%"><strong><?php echo
$lang[
'DESCRIPTION']; ?></strong></td>
116 <td width=
"7%" class=
"text-center"><strong><?php echo
$lang[
'ENTRIES']; ?></strong></td>
117 <td width=
"10%" class=
"text-center"><strong><?php echo
$lang[
'ACTIONS']; ?></strong></td>
124 if (
$res =
$db->query(
"SELECT * FROM {blog} ORDER BY id"))
126 while ($row = mysqli_fetch_assoc(
$res)) {
127 $blog->blogid = $row[
'id'];
128 $blog->name = $row[
'name'];
129 $blog->description = $row[
'description'];
130 $blog->icon = $row[
'icon'];
131 $blog->comments = $row[
'comments'];
133 if (!empty(
$blog->icon)) {
134 $iconHtml =
"<i class=\"fa " .
$blog->icon .
"\"></i>";
136 $iconHtml =
" ";
139 if ($row[
'published'] == 1) {
141 $pubtext =
"$lang[ONLINE]";
144 $pubtext =
"$lang[OFFLINE]";
147 if (isset(
$blog->comments) && (
$blog->comments ===
'1')) {
148 $commentIcon =
"<a href=\"index.php?plugin=blog&pluginpage=blog-comments&blogid=".$blog->blogid.
"\"><i class=\"fa fa-comments-o\"></i></a> ";
150 $commentIcon =
' ';
153 if ($res2 =
$db->query(
"SELECT COUNT(id) FROM {blog_items} WHERE blogid = '".$blog->blogid.
"'"))
155 $item_count = mysqli_fetch_row($res2);
156 $items = $item_count[0];
159 <td class=\"text-center\">
160 <a title=\"toggle status\" href=\"index.php?plugin=blog&pluginpage=blog-toggle&blog=" . $row[
'id'] .
"&published=" . $row[
'published'] .
"\">
161 <span class=\"label label-$pub\">$pubtext</span></a> </td>
162 <td class=\"text-center\">" . $row[
'id'] .
"</td>
163 <td>" . $iconHtml .
"</td>
164 <td><a href=\"index.php?plugin=blog&pluginpage=blog-entries&blogid=" . $row[
'id'] .
"\"><div style=\"width:100%\">" . $row[
'name'] .
"</div></a></td>
165 <td><a href=\"index.php?plugin=blog&pluginpage=blog-entries&blogid=" . $row[
'id'] .
"\" style=\"color: #7A7376;\"><div style=\"width:100%\">" . $row[
'description'] .
"</div></a></td>
167 <td class=\"text-center\">" . $items .
"</td>
168 <td class=\"text-center\">
171 <a href=\"index.php?plugin=blog&pluginpage=blog-setup&blogid=" . $row[
'id'] .
"\" title=\"" . $row[
'name'] .
" " .
$lang[
'CONFIGURE'] .
"\"><i class=\"fa fa-wrench\"></i></a>
172 <a class=\"fa fa-trash-o\" role=\"dialog\" data-confirm=\"$lang[BLOG_DEL_REQUEST] $lang[BLOG] # «" . $row[
'id'] .
" - " . $row[
'name'] .
"»\" title=\"" .
$lang[
'BLOG_DELETE'] .
" " . $row[
'name'] .
"\" href=\"index.php?plugin=blog&delete=1&blog=" . $row[
'id'] .
"&all=true\">
179 alert::draw(
"warning",
"$lang[WARNING]",
"$lang[BLOG_FETCH_FAILED]",
"",
"3800");
185 alert::draw(
"warning",
"$lang[WARNING]",
"$lang[BLOG_FETCH_FAILED]",
"",
"3800");
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Backend class serves a few useful functions for the admin backend.
Mysqli database class; returns db connection object.
The language class - support multilingual backend.
<!-- 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);});})