1 <script
type=
"text/javascript">
2 $(document).
ready(
function() {
3 $(
'#table-sort').dataTable( {
5 "bLengthChange":
false,
15 function dismissNotification(
id) {
17 url:
'js/dismiss-singleNotification.php',
22 success:
function (data) {
24 alert(
'Something went wrong!');
30 var currentIcon =
'#envelope-'+
id;
32 var currentLink =
'#link'+
id;
34 var bellLabel =
'#bell-label';
36 var notificationCounterSpan =
'#notificationsMenuCounter';
38 var notificationItem =
'#note-'+
id;
40 $(currentIcon).removeClass(
'fa fa-envelope-o');
42 $(currentIcon).addClass(
'fa fa-envelope-open-o text-gray');
44 $(currentLink).attr(
"onclick",
"reopenNotification("+
id+
")");
46 var notificationCounter = $(bellLabel).text();
48 var notificationCounterMenu = $(notificationCounterSpan).text();
50 notificationCounter--;
51 notificationCounterMenu--;
53 if (!notificationCounter)
55 $(bellLabel).fadeOut();
56 $(notificationCounterSpan).text(notificationCounterMenu);
57 $(notificationItem).fadeOut();
61 $(bellLabel).text(notificationCounter);
62 $(notificationCounterSpan).text(notificationCounterMenu);
63 $(notificationItem).fadeOut();
72 function reopenNotification(
id) {
74 url:
'js/reopen-singleNotification.php',
79 success:
function (data) {
81 alert(
'Something went wrong!');
88 var currentIcon =
'#envelope-'+
id;
90 var currentLink =
'#link'+
id;
92 var bellLabel =
'#bell-label';
94 var notificationCounterSpan =
'#notificationsMenuCounter';
96 $(currentIcon).removeClass(
'fa fa-envelope-open-o text-gray');
98 $(currentIcon).addClass(
'fa fa-envelope-o');
100 $(currentLink).attr(
"onclick",
"dismissNotification("+
id+
")");
102 var notificationCounter = $(bellLabel).text();
104 var notificationCounterMenu = $(notificationCounterSpan).text();
106 notificationCounter++;
107 notificationCounterMenu++;
109 $(bellLabel).text(notificationCounter);
110 $(notificationCounterSpan).text(notificationCounterMenu);
131 if (settings::getSetting(
$db,
"syslogEnable") ==
false)
133 echo alert::draw(
"danger",
$lang[
'SYSLOG_DISABLED'],
$lang[
'SYSLOG_DISABLED_MSG'],
"", 0);
138 <!-- Content Wrapper. Contains page content -->
139 <div class=\"content-wrapper\" id=\"content-FX\">
140 <!-- Content Header (Page header) -->
141 <section class=\"content-header\">";
143 echo backend::getTitle(
$lang[
'SYSLOG'],
$lang[
'SYSLOG_SUBTEXT']);
144 echo
"<ol class=\"breadcrumb\">
145 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
146 <li><a href=\"index.php?page=syslog\" class=\"active\" title=\"$lang[SYSLOG]\"> $lang[SYSLOG]</a></li>
149 <!-- Main content -->
150 <section class=\"content\">";
155 if (
$sql =
$db->query(
"TRUNCATE TABLE {syslog}"))
157 if (
$db->query(
"TRUNCATE TABLE {notifications}"))
159 alert::draw(
"success",
"$lang[SYSLOG_DATA_DEL]",
"$lang[SYSLOG_DATA_DEL_SUBTEXT]",
"",3600);
164 alert::draw(
"warning",
"$lang[WARNING]",
"$lang[SYSLOG_DATA_DEL_SUBTEXT]",
"",4200);
169 <div
class=
"box box-default">
170 <div
class=
"box-header with-border">
171 <h3
class=
"box-title"><?php echo
"$lang[SYSTEM_LOGFILES]"; ?></h3>
173 <div
class=
"box-body">
175 <!-- btn clear log -->
176 <
a class=
"btn btn-danger pull-right" role=
"dialog" title=
"<?php echo $lang['SYSLOG_CLEAR'];?>" data-confirm=
"<?php echo $lang['SYSLOG_DEL_CONFIRM']; ?>" href=
"index.php?page=syslog&clear=1">
177 <
i class=
"fa fa-trash-o"></
i> &
nbsp;<?php print
$lang[
'SYSLOG_CLEAR']; ?>
180 <
a class=
"btn btn-default pull-right" title=
"<?php echo $lang['SETTINGS'];?>" href=
"index.php?page=syslog-config">
184 <table style=
"width:100%;" class=
"table table-striped table-hover table-responsive" id=
"table-sort">
187 <td style=
"width:3%;" class=
"text-center"><strong><small><
i class=
"fa fa-bell-o"></
i></small></strong></td>
188 <td style=
"width:8%;" class=
"text-center"><strong><?php echo
$lang[
'TYPE']; ?></strong></td>
189 <td style=
"width:10%;" class=
"text-center"><strong><?php echo
$lang[
'TIMESTAMP']; ?></strong></td>
190 <td style=
"width:8%;" class=
"text-center"><strong><?php echo
$lang[
'USER']; ?></strong></td>
191 <td style=
"width:61%;"><strong><?php echo
$lang[
'ENTRY']; ?></strong></td>
192 <td style=
"width:10%;" class=
"text-center"><strong><?php
203 $affected_user = user::getUserNameFromID(
$db, $log[
'toUID']);
205 $log[
'property'] = strtoupper(substr($log[
'property'], 0, strpos($log[
'property'],
'-')));
207 $time_ago = sys::time_ago($log[
'log_date'],
$lang);
209 if ($log[
'log_type'] == 0)
212 $category =
"<b>".$log[
'property'].
"</b><br><span class=\"label label-default\">Info</span>";
215 elseif ($log[
'log_type'] == 1)
218 $category =
"<b>".$log[
'property'].
"</b><br><span class=\"label label-warning\">WARNING</span>";
220 elseif ($log[
'log_type'] == 2)
222 $textMarkup =
" class=\"text-red\"";
223 $category =
"<b>".$log[
'property'].
"</b><br><span class=\"label label-danger\">ERROR</span>";
225 elseif ($log[
'log_type'] == 3)
228 $category =
"<b>".$log[
'property'].
"</b><br><span class=\"label label-success\">SUCCESS</span>";
233 $category =
"<b>".$log[
'property'].
"</b><br><span class=\"label label-default\">LOG</span>";
236 if ($log[
'seen'] == 0)
238 $labelMarkup =
"<a href=\"#\" onclick=\"dismissNotification('".$log[
'log_id'].
"')\" id=\"link".$log[
'log_id'].
"\" data-id=\"$log[log_id]\"><i class=\"fa fa-envelope-o\" id=\"envelope-$log[log_id]\" title=\"$lang[ID]: $log[log_id]\"></i></a>";
242 $labelMarkup =
"<a href=\"#\" onclick=\"reopenNotification('".$log[
'log_id'].
"')\" id=\"link".$log[
'log_id'].
"\" data-id=\"$log[log_id]\"><i class=\"fa fa-envelope-open-o text-gray\" id=\"envelope-$log[log_id]\" title=\"$lang[ID]: $log[log_id]\"></i></a>";
245 echo
"<tr class=\"".$log[
'type'].
"\">
246 <td class=\"text-center\">$labelMarkup</td>
247 <td class=\"text-center\">".$category.
"</td>
248 <td class=\"text-center\"><small>$log[log_date]<br><small>".$time_ago.
"</small></td>
249 <td class=\"text-center\"><a href=\"index.php?page=user-edit&user=$log[username]\" title=\"$log[username] ($lang[IN_NEW_WINDOW])\" target=\"_blank\"$textMarkup>".$log[
'username'].
"</a></td>
250 <td$textMarkup><i class=\"".$log[
'icon'].
"\"></i> ".$log[
'message'].
"</td>
251 <td class=\"text-center\"><span$textMarkup>".$affected_user.
"</span></td>
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.
Settings class: get and set YaWK system settings.
The sys class - handles yawk's system core functions.
The default user class. Provide all functions to handle the user object.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
</tr ></thead >< tbody > $syslog
print $lang['SYSLOG_CLEAR']
if(!isset($template)) if(!isset($user)) $template id
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);});})