YaWK  24.1
Yet another WebKit
settings-system.php
Go to the documentation of this file.
1 <?php
2 
3 use YAWK\alert;
4 use YAWK\backend;
5 use YAWK\db;
6 use YAWK\language;
7 use YAWK\settings;
8 use YAWK\template;
9 
10 /** @var $db db */
11 /** @var $lang language */
12 
13 // SAVE tpl settings
14 if(isset($_POST['save']))
15 {
16  // loop through $_POST items
17  foreach ($_POST as $property => $value)
18  {
19  if ($property != "save")
20  {
21  // check setting and call corresponding function
22  if (substr($property, -5, 5) == '-long')
23  { // LONG VALUE SETTINGS
24  if (!settings::setLongSetting($db, $property, $value))
25  { // throw error
26  alert::draw("warning", "Error", "Long Settings: Could not set long value <b>$value</b> of property <b>$property</b>","plugin=signup","4800");
27  }
28  }
29  else
30  {
31  if ($property === "selectedTemplate")
32  {
33  template::setTemplateActive($db, $value);
34  }
35 
36  // save value of property to database
37  settings::setSetting($db, $property, $value, $lang);
38  }
39  }
40  }
41  // force page reload to show changes immediately
42  // \YAWK\sys::setTimeout("index.php?page=settings-frontend", 0);
43 }
44 ?>
45 <?php
46 // get all template settings into array
47 $settings = settings::getAllSettingsIntoArray($db);
48 // TEMPLATE WRAPPER - HEADER & breadcrumbs
49 echo "
50  <!-- Content Wrapper. Contains page content -->
51  <div class=\"content-wrapper\" id=\"content-FX\">
52  <!-- Content Header (Page header) -->
53  <section class=\"content-header\">";
54 // draw Title on top
55 echo backend::getTitle($lang['SETTINGS'], $lang['SYSTEM']);
56 echo backend::getSettingsBreadcrumbs($lang);
57 echo"</section><!-- Main content -->
58  <section class=\"content\">";
59 /* page content start here */
60 ?>
61 <form id="frontend-edit-form" action="index.php?page=settings-system" method="POST">
62  <div class="box">
63  <div class="box-body">
64  <div class="col-md-10">
65  <?php echo "<h4><i class=\"fa fa-cogs\"></i> &nbsp;".$lang['SYSTEM_SUBTEXT']."</h4>"; ?>
66  </div>
67  <div class="col-md-2">
68  <button class="btn btn-success pull-right" id="savebutton" name="save" style="margin-top:2px;"><i class="fa fa-check" id="savebuttonIcon"></i>&nbsp;&nbsp;<?php echo $lang['SAVE_SETTINGS']; ?></button>
69  </div>
70  </div>
71  </div>
72  <!-- SYSTEM TAB -->
73  <!-- system settings -->
74  <div class="row animated fadeIn">
75  <div class="col-md-4">
76  <!-- server settings -->
77  <div class="box">
78  <div class="box-body">
79  <h3><?php echo $lang['SERVER']; ?> <small> <?php echo $lang['SERVER_SUBTEXT']; ?></small></h3>
80  <?php settings::getFormElements($db, $settings, 9, $lang); ?>
81  <?php settings::getFormElements($db, $settings, 16, $lang); ?>
82  </div>
83  </div>
84  </div>
85  <div class="col-md-4">
86  <!-- database settings -->
87  <div class="box">
88  <div class="box-body">
89  <?php settings::getFormElements($db, $settings, 13, $lang); ?>
90  </div>
91  </div>
92  </div>
93  <div class="col-md-4">
94  <!-- syslog settings -->
95  <div class="box">
96  <div class="box-body">
97  <h3><i class="fa fa-code"></i> <?php echo $lang['EDITOR']; ?> <small> <?php echo $lang['EDITOR_SUBTEXT']; ?></small></h3>
98  <?php settings::getFormElements($db, $settings, 14, $lang); ?>
99  </div>
100  </div>
101  </div>
102  </div>
103 </form>
104 <script type="text/javascript">
105  /* START CHECKBOX timediff */
106  $(document).ready(function() {
107  function saveHotkey() {
108  // simply disables save event for chrome
109  $(window).keypress(function (event) {
110  if (!(event.which === 115 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) && !(event.which === 19)) return true;
111  event.preventDefault();
112  formmodified = 0; // do not warn user, just save.
113  return false;
114  });
115  // used to process the cmd+s and ctrl+s events
116  $(document).keydown(function (event) {
117  if (event.which === 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) {
118  event.preventDefault();
119  $('#savebutton').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
120  formmodified = 0; // do not warn user, just save.
121  // save(event);
122  return false;
123  }
124  });
125  }
126 
127  saveHotkey();
128 
129  var savebutton = ('#savebutton');
130  var savebuttonIcon = ('#savebuttonIcon');
131  // ok, lets go...
132  // we need to check if user clicked on save button
133  $(savebutton).click(function () {
134  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning disabled');
135  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
136  });
137  });
138  /* END CHECKBOX backend fx */
139 </script>
print $lang['FILEMAN_UPLOAD']
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
The template controller - get and set template settings.
Definition: template.php:16
function window
Definition: fuckAdBlock.js:8
c jPlayer event
type
Definition: menu-new.php:35
function i(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
if(isset($_POST['save'])) $settings
$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);});})