YaWK  24.1
Yet another WebKit
settings-manage.php
Go to the documentation of this file.
1 <?php
2 use YAWK\alert;
3 use YAWK\backend;
4 use YAWK\db;
5 use YAWK\language;
6 use YAWK\settings;
7 /** @var $db db */
8 /** @var $lang language */
9 
10 if (isset($_GET['save']) AND $_GET['save'] === 'true') {
11 
12  foreach ($_POST as $property => $value) {
13  if ($property != "save") {
14  settings::setSetting($db, $property, $value, $lang);
15  }
16  }
17 }
18 
19 if (isset($_GET['toggle']) AND $_GET['toggle'] === 'true')
20 { /** toggle set to ON */
21  if ($_GET['set'] === '1')
22  { // de-activate
23  $activated = 0;
24  }
25  else
26  { // set to active
27  $activated = 1;
28  }
29  if(!YAWK\settings::toggleOffline($db, $_GET['property'], $activated, $lang))
30  {
31  alert::draw("danger", "$lang[ERROR]", "Could not toggle page $_GET[property]", "", 2000);
32  }
33 }
34 
35 ?>
36 <script type="text/javascript">
37  $(document).ready(function() {
38  $('#table-sort').dataTable( {
39  "bPaginate": false,
40  "bLengthChange": false,
41  "bFilter": true,
42  "bSort": true,
43  "bInfo": true,
44  "bAutoWidth": false
45  } );
46  } );
47 </script>
48 <?php
49 // TEMPLATE WRAPPER - HEADER & breadcrumbs
50 echo "
51  <!-- Content Wrapper. Contains page content -->
52  <div class=\"content-wrapper\" id=\"content-FX\">
53  <!-- Content Header (Page header) -->
54  <section class=\"content-header\">";
55 /* draw Title on top */
56 echo backend::getTitle($lang['SETTINGS_EXPERT'], $lang['SETTINGS_EXPERT_SUBTEXT']);
57 echo"<ol class=\"breadcrumb\">
58  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
59  <li><a href=\"index.php?page=settings-backend\" class=\"active\" title=\"$lang[BACKEND_SETTINGS] $lang[BACKEND_SETTINGS_SUBTEXT]\"> $lang[BACKEND_SETTINGS] $lang[BACKEND_SETTINGS_SUBTEXT]</a></li>
60  </ol>
61  </section>
62  <!-- Main content -->
63  <section class=\"content\">";
64 /* page content start here */
65 ?>
66 
67 <form name="settings" action="index.php?page=settings-manage&save=true" method="post">
68 <input type="submit" name="save" class="btn btn-success pull-right" value="<?php print $lang['SETTINGS_SAVE'];?>">
69 
70 <table style="width:100%;" class="table table-striped table-hover table-responsive" id="table-sort">
71  <thead>
72  <tr>
73  <td style="width:3%;"><strong>&nbsp;</strong></td>
74  <td style="width:20%;"><strong><i class="fa fa-caret-down"></i> <?php print $lang['SETTING']; ?></strong></td>
75  <td style="width:27%;"><strong><i class="fa fa-caret-down"></i> <?php print $lang['SETTING_VALUE']; ?></strong></td>
76  <td style="width:25%;"><strong><?php print $lang['LABEL']; ?></strong></td>
77  <td style="width:25%;"><strong><?php print $lang['DESCRIPTION']; ?></strong></td>
78  </tr>
79  </thead>
80  <tbody>
81 <?php
82 if (isset($_GET['type']) && (is_numeric($_GET['type'])))
83 {
84  $type = $_GET['type'];
85 }
86  /* query database and select settings */
87  if ($res = $db->query("SELECT * FROM {settings}"))
88  { // fetch loop
89  while($row = mysqli_fetch_assoc($res)){
90  /* check if settings is published and set badge-button text */
91  if ($row['activated']==1)
92  { $pub = "success"; $pubtext="$lang[ON_]"; }
93  else { $pub = "danger"; $pubtext="$lang[OFF_]"; }
94 
95  echo"<tr>
96  <td><a title=\"toggle&nbsp;status\" href=\"index.php?page=settings-manage&toggle=true&property=".$row['property']."&set=".$row['activated']."\">
97  <span class=\"label label-$pub\">$pubtext</span></a></td>
98  <td>".$row['property']."</td>
99  <td><input type=\"text\" name=\"".$row['property']."\" class=\"form-control\" value=\"".$row['value']."\"></td>
100  <td>".$row['label']."</td>
101  <td>".$row['description']."</td>
102 </tr>";
103  }
104  }
105 ?>
106 
107  </tbody>
108 </table>
109 </form>
110 <br><br>
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Definition: alert.php:19
Backend class serves a few useful functions for the admin backend.
Definition: backend.php:27
Mysqli database class; returns db connection object.
Definition: db.php:16
The language class - support multilingual backend.
Definition: language.php:17
Settings class: get and set YaWK system settings.
Definition: settings.php:9
type
Definition: menu-new.php:35
$type
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $_GET['id']
Definition: page-edit.php:357
function i(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
print $lang['SETTINGS_SAVE']
$template name
$value
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 &ouml;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);});})