15 if (isset($_POST[
'active']))
17 foreach ($_POST[
'active'] as $property =>
$value)
28 if (!
$db->query(
"UPDATE {syslog_categories} SET active = '".$value.
"' WHERE id = '".$property.
"' "))
30 sys::setSyslog(
$db, 3, 1,
"Unable to update syslog configuration - unable to set state of field: $property to value: $value",
"", 0, 0, 0);
35 if (isset($_POST[
'notify']))
37 foreach ($_POST[
'notify'] as $property =>
$value)
48 if (!
$db->query(
"UPDATE {syslog_categories} SET notify = '".$value.
"' WHERE id = '".$property.
"' "))
50 sys::setSyslog(
$db, 3, 1,
"Unable to update syslog configuration - unable to set state of field: $property to value: $value",
"", 0, 0, 0);
56 <script
type=
"text/javascript">
57 $(document).
ready(
function() {
58 $(
'#table-sort').dataTable( {
60 "bLengthChange":
false,
68 <script
type=
"text/javascript">
69 $(document).
ready(
function() {
71 function saveHotkey() {
74 if (!(
event.which === 115 && (navigator.platform.match(
"Mac") ?
event.metaKey :
event.ctrlKey)) && !(
event.which === 19))
return true;
75 event.preventDefault();
80 $(document).keydown(
function (
event) {
81 if (
event.which === 83 && (navigator.platform.match(
"Mac") ?
event.metaKey :
event.ctrlKey)) {
82 event.preventDefault();
83 $(
'#savebutton').click();
93 var savebutton = (
'#savebutton');
94 var savebuttonIcon = (
'#savebuttonIcon');
97 $(savebutton).click(
function() {
98 $(savebutton).removeClass(
'btn btn-success').addClass(
'btn btn-warning disabled');
99 $(savebuttonIcon).removeClass(
'fa fa-save').addClass(
'fa fa-spinner fa-spin fa-fw');
105 $(
':checkbox').change(
function()
109 var
id = $(
this).attr(
'id');
111 var notifyCheckbox =
'#notify'+
id;
113 if ($this.is(
':checked'))
115 $(notifyCheckbox).bootstrapToggle(
'enable');
116 $(notifyCheckbox).bootstrapToggle(
'on');
120 $(notifyCheckbox).bootstrapToggle(
'off');
121 $(notifyCheckbox).bootstrapToggle(
'disable');
127 $(
'#toggleAllBtn').click(
function(
e)
132 var table = $(
"#table-sort");
134 var selected = $(
'td input:checkbox',table);
136 $(selected).each(
function()
141 var currentCheckbox =
'#'+this.
id;
143 if ($this.is(
':checked'))
145 $(currentCheckbox).bootstrapToggle(
'toggle');
150 $(currentCheckbox).bootstrapToggle(
'toggle');
158 <!-- Bootstrap toggle css -->
159 <link rel=
"stylesheet" href=
"../system/engines/bootstrap-toggle/css/bootstrap-toggle.css">
160 <!-- Bootstrap toggle js -->
161 <script
type=
"text/javascript" src=
"../system/engines/bootstrap-toggle/js/bootstrap-toggle.min.js"></script>
167 echo alert::draw(
"danger",
$lang[
'SYSLOG_DISABLED'],
$lang[
'SYSLOG_DISABLED_MSG'],
"", 0);
172 <!-- Content Wrapper. Contains page content -->
173 <div class=\"content-wrapper\" id=\"content-FX\">
174 <!-- Content Header (Page header) -->
175 <section class=\"content-header\">";
177 echo backend::getTitle(
$lang[
'SYSLOG'],
$lang[
'SYSLOG_CONFIG']);
178 echo
"<ol class=\"breadcrumb\">
179 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
180 <li><a href=\"index.php?page=syslog\" class=\"active\" title=\"$lang[SYSLOG]\"> $lang[SYSLOG]</a></li>
181 <li><a href=\"index.php?page=syslog-config\" class=\"active\" title=\"$lang[CONFIGURATION]\"> $lang[CONFIGURATION]</a></li>
184 <!-- Main content -->
185 <section class=\"content\">";
190 if (
$sql =
$db->query(
"TRUNCATE TABLE {syslog}"))
192 if (
$db->query(
"TRUNCATE TABLE {notifications}"))
194 alert::draw(
"success",
"$lang[SYSLOG_DATA_DEL]",
"$lang[SYSLOG_DATA_DEL_SUBTEXT]",
"",3600);
199 alert::draw(
"warning",
"$lang[WARNING]",
"$lang[SYSLOG_DATA_DEL_SUBTEXT]",
"",4200);
204 <div
class=
"box box-default">
205 <div
class=
"box-header with-border">
206 <h3
class=
"box-title"><?php echo
"$lang[SETTINGS]"; ?></h3>
208 <div
class=
"box-body">
211 <form
name=
"form" id=
"form" role=
"form" action=
"index.php?page=syslog-config" method=
"post">
214 <button
class=
"btn btn-success pull-right" type=
"submit" title=
"<?php echo $lang['SAVE'];?>" id=
"savebutton">
215 <
i class=
"fa fa-save" id=
"savebuttonIcon"></
i> &
nbsp;&
nbsp;<?php print
$lang[
'SAVE']; ?>
218 <!-- link to syslog -->
219 <
a href=
"index.php?page=syslog" class=
"btn btn-default pull-right">
223 <button
class=
"btn btn-default pull-right" id=
"toggleAllBtn" href=
"#" title=
"<?php print $lang['TOGGLE_ALL']; ?>">
224 <
i class=
"fa fa-toggle-on"></
i>
227 <table style=
"width:100%;" class=
"table table-striped table-hover table-responsive" id=
"table-sort">
230 <td style=
"width:35%;" class=
"text-left"><strong><?php echo
$lang[
'CATEGORY']; ?></strong></td>
231 <td style=
"width:20%;" class=
"text-center"><
i class=
"fa fa-code"></
i> &
nbsp;<strong><?php echo
$lang[
'LOG']; ?></strong></td>
232 <td style=
"width:25%;" class=
"text-center"><
i class=
"fa fa-bell-o"></
i> &
nbsp;<strong><?php echo
$lang[
'NOTIFY']; ?></strong></td>
233 <td style=
"width:10%;" class=
"text-center">&
nbsp;</td>
244 if (strstr($category[
'property'],
"success"))
246 $color =
" text-green";
248 elseif (strstr($category[
'property'],
"warning"))
250 $color =
" text-orange";
252 elseif (strstr($category[
'property'],
"error"))
254 $color =
" text-red";
258 $color =
" text-gray";
263 $disabled =
" disabled readonly";
271 if ($category[
'active'] == 1)
273 $log_active =
" checked".$disabled;
280 if ($category[
'notify'] == 1)
282 $notify_active =
" checked".$disabled;
289 <td class=\"text-left\"><i class=\"".$category[
'icon'].
"$color\"></i> <b>".ucfirst($category[
'property']).
"</b></td>
290 <td class=\"text-center\">
291 <input type=\"hidden\" name=\"active[".$category[
'id'].
"]\" id=\"hidden-".$category[
'id'].
"\" value=\"off\">
292 <input type=\"checkbox\" data-on=\"$lang[ON_]\" data-off=\"$lang[OFF_]\" data-toggle=\"toggle\" data-onstyle=\"success\" data-offstyle=\"danger\" class=\"checkbox\" data-activeID=\"".$category[
'id'].
"\" name=\"active[".$category[
'id'].
"]\" id=\"".$category[
'id'].
"\"$log_active>
294 <td class=\"text-center\">
295 <input type=\"hidden\" name=\"notify[".$category[
'id'].
"]\" id=\"hidden-".$category[
'id'].
"\" value=\"off\">
296 <input type=\"checkbox\" data-on=\"<i class='fa fa-bell-o'>\" data-off=\"<i class='fa fa-bell-slash-o'>\" data-toggle=\"toggle\" data-onstyle=\"success\" data-offstyle=\"danger\" data-notifyID=\"".$category[
'id'].
"\" class=\"checkbox\" name=\"notify[".$category[
'id'].
"]\" id=\"notify".$category[
'id'].
"\"$notify_active>
298 <td class=\"text-center\"> </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.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
if(isset($_POST)) $syslogEnabled
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);});})