YaWK  24.1
Yet another WebKit
settings-backend.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 use YAWK\sys;
8 use YAWK\template;
9 /** @var $db db */
10 /** @var $lang language */
11 
12 // SAVE tpl settings
13 if(isset($_POST['save']))
14 {
15  // loop through $_POST items
16  foreach ($_POST as $property => $value)
17  {
18  if ($property != "save")
19  {
20  // check setting and call corresponding function
21  if (substr($property, -5, 5) == '-long')
22  { // LONG VALUE SETTINGS
23  if (!settings::setLongSetting($db, $property, $value))
24  { // throw error
25  alert::draw("warning", "Error", "Long Settings: Could not set long value <b>$value</b> of property <b>$property</b>","plugin=signup","4800");
26  }
27  }
28  else
29  {
30  if ($property === "selectedTemplate")
31  {
32  template::setTemplateActive($db, $value);
33  }
34 
35  // save value of property to database
36  settings::setSetting($db, $property, $value, $lang);
37  }
38  }
39  }
40  // load page again to show changes immediately
41  sys::setTimeout("index.php?page=settings-backend", 0);
42 }
43 ?>
44 <?php
45 // get all template settings into array
46 $settings = settings::getAllSettingsIntoArray($db);
47 
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['FRONTEND']);
56 echo backend::getSettingsBreadcrumbs($lang);
57 echo"</section><!-- Main content -->
58  <section class=\"content\">";
59 /* page content start here */
60 ?>
61 <form id="backend-edit-form" action="index.php?page=settings-backend" 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-sign-in\"></i> &nbsp;$lang[BACKEND_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  <div class="row">
73  <!-- backend settings -->
74  <div class="col-md-4">
75  <div class="box">
76  <div class="box-body">
77  <!-- backend settings -->
78  <?php settings::getFormElements($db, $settings, 2, $lang); ?>
79  </div>
80  </div>
81  <div class="box">
82  <div class="box-body">
83  <?php // \YAWK\settings::getFormElements($db, $settings, 19, $lang); ?>
84  <?php settings::getFormElements($db, $settings, 20, $lang); ?>
85  </div>
86  </div>
87  </div>
88  <div class="col-md-4">
89  <div class="box">
90  <div class="box-body">
91  <!-- footer settings -->
92  <?php settings::getFormElements($db, $settings, 11, $lang); ?>
93  </div>
94  </div>
95  </div>
96  <div class="col-md-4">
97  <div class="box">
98  <div class="box-body">
99  <?php settings::getFormElements($db, $settings, 12, $lang); ?>
100  </div>
101  </div>
102  </div>
103  </div>
104 </form>
105 <script type="text/javascript">
106 $(document).ready(function()
107  {
108  function saveHotkey() {
109  // simply disables save event for chrome
110  $(window).keypress(function (event) {
111  if (!(event.which === 115 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) && !(event.which === 19)) return true;
112  event.preventDefault();
113  formmodified=0; // do not warn user, just save.
114  return false;
115  });
116  // used to process the cmd+s and ctrl+s events
117  $(document).keydown(function (event) {
118  if (event.which === 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) {
119  event.preventDefault();
120  $('#savebutton').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
121  formmodified=0; // do not warn user, just save.
122  // save(event);
123  return false;
124  }
125  });
126  }
127  saveHotkey();
128 
129 
130  const savebutton = ('#savebutton');
131  const savebuttonIcon = ('#savebuttonIcon');
132  // ok, lets go...
133  // we need to check if user clicked on save button
134  $(savebutton).click(function() {
135  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning disabled');
136  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
137  });
138  const backendFooter = $('#backendFooter');
139  const backendFooterValueLeft = $('#backendFooterValueLeft');
140  const backendFooterValueRight = $('#backendFooterValueRight');
141  const backendFooterCopyright = $('#backendFooterCopyright');
142  const backendLogoUrl = $('#backendLogoUrl');
143  const backendLogoText = $('#backendLogoText');
144  const backendLogoSubText = $('#backendLogoSubText');
145  const backendFX = $('#backendFX');
146  const backendFXtype = $('#backendFXtype');
147  const backendFXtime = $('#backendFXtime');
148 
149  /* START CHECKBOX backend footer */
150  // check backend footer checkbox STATUS ONLOAD
151  if( $(backendFooter).prop('checked')){
152  // box is checked, set input field to NOT disabled
153  $(backendFooterValueLeft).prop('disabled', false);
154  $(backendFooterValueRight).prop('disabled', false);
155  $(backendFooterCopyright).prop('disabled', false);
156  }
157  else {
158  // box is not checked, set field to disabled
159  $(backendFooterValueLeft).prop('disabled', true);
160  $(backendFooterValueRight).prop('disabled', true);
161  $(backendFooterCopyright).prop('disabled', true);
162  }
163  // check wheter the footer checkbox IS CLICKED
164  $(backendFooter).click(function(){ // if user clicked save
165  if( $('#backendFooter').prop('checked')){
166  // box is checked, set input field to NOT disabled
167  $(backendFooterValueLeft).prop('disabled', false);
168  $(backendFooterValueRight).prop('disabled', false);
169  $(backendFooterCopyright).prop('disabled', false);
170  }
171  else {
172  // set footer value input field to disabled
173  $(backendFooterValueLeft).prop('disabled', true);
174  $(backendFooterValueRight).prop('disabled', true);
175  $(backendFooterCopyright).prop('disabled', true);
176  }
177  });
178  // check whether the footer copyright checkbox is clicked
179  $(backendFooterCopyright).click(function(){ // if user clicked save
180  if( $(backendFooterCopyright).prop('checked')){
181  // box is checked, set input field to NOT disabled
182  $(backendFooterValueLeft).prop('disabled', true);
183  $(backendFooterValueRight).prop('disabled', true);
184  }
185  else {
186  // set footer value input field to disabled
187  $(backendFooterValueLeft).prop('disabled', false);
188  $(backendFooterValueRight).prop('disabled', false);
189  }
190  });
191  /* END CHECKBOX backend footer */
192 
193  /* START CHECKBOX backend logo */
194  // check backend footer checkbox onload
195  if( $(backendLogoUrl).prop('checked')){
196  // box is checked, set input field to NOT disabled
197  $(backendLogoText).prop('disabled', true);
198  $(backendLogoSubText).prop('disabled', true);
199  }
200  else {
201  // box is not checked, set field to disabled
202  $(backendLogoText).prop('disabled', false);
203  $(backendLogoSubText).prop('disabled', false);
204  }
205  // check whether the checkbox is clicked
206  $(backendLogoUrl).click(function(){ // if user clicked save
207  if( $(backendLogoUrl).prop('checked')){
208  // box is checked, set input field to NOT disabled
209  $(backendLogoText).prop('disabled', true);
210  $(backendLogoSubText).prop('disabled', true);
211  }
212  else {
213  // set footer value input field to disabled
214  $(backendLogoText.prop('disabled', false);
215  $(backendLogoSubText).prop('disabled', false);
216  }
217  });
218  /* END CHECKBOX backend logo */
219 
220  /* START CHECKBOX backend fx */
221  // check backend footer checkbox onload
222  if( $(backendFX).prop('checked')){
223  // box is checked, set input field to NOT disabled
224  $(backendFXtype).prop('disabled', false);
225  $(backendFXtime).prop('disabled', false);
226  }
227  else {
228  // box is not checked, set field to disabled
229  $(backendFXtype).prop('disabled', true);
230  $(backendFXtime).prop('disabled', true);
231  }
232  // check wheter the checkbox is clicked
233  $(backendFX).click(function(){ // if user clicked save
234  if( $(backendFX).prop('checked')){
235  // box is checked, set input field to NOT disabled
236  $(backendFXtype).prop('disabled', false);
237  $(backendFXtime).prop('disabled', false);
238  }
239  else {
240  // set footer value input field to disabled
241  $(backendFXtype).prop('disabled', true);
242  $(backendFXtime).prop('disabled', true);
243  }
244  });
245  /* END CHECKBOX backend fx */
246 
247 });
248  /* END CHECKBOX backend fx */
249 </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 sys class - handles yawk's system core functions.
Definition: sys.php:17
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
if(isset($_POST['save'])) $settings
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$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);});})