YaWK  24.1
Yet another WebKit
settings-frontend.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 
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'], $lang['FRONTEND']);
57 echo backend::getSettingsBreadcrumbs($lang);
58 echo"</section><!-- Main content -->
59  <section class=\"content\">";
60 /* page content start here */
61 ?>
62 <form id="frontend-edit-form" action="index.php?page=settings-frontend" method="POST">
63  <div class="box">
64  <div class="box-body">
65  <div class="col-md-10">
66  <?php echo "<h4><i class=\"fa fa-globe\"></i> &nbsp;".$lang['FRONTEND_SUBTEXT']."</h4>"; ?>
67  </div>
68  <div class="col-md-2">
69  <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>
70  </div>
71  </div>
72  </div>
73  <div class="row">
74  <!-- frontend settings -->
75  <div class="col-md-4">
76  <!-- theme selector -->
77  <div class="box">
78  <div class="box-body">
79  <?php settings::getFormElements($db, $settings, 3, $lang); ?>
80  </div>
81  </div>
82  </div>
83  <div class="col-md-4">
84  <div class="box">
85  <div class="box-body">
86  <!-- publish settings -->
87  <?php settings::getFormElements($db, $settings, 7, $lang); ?>
88  <!-- user login settings -->
89  <?php settings::getFormElements($db, $settings, 17, $lang); ?>
90  </div>
91  </div>
92  </div>
93  <div class="col-md-4">
94  <div class="box">
95  <div class="box-body">
96  <!-- maintenance mode -->
97  <?php settings::getFormElements($db, $settings, 8, $lang); ?>
98  </div>
99  </div>
100  </div>
101  </div>
102 </form>
103 <script type="text/javascript">
104  $(document).ready(function() {
105  function saveHotkey() {
106  // simply disables save event for chrome
107  $(window).keypress(function (event) {
108  if (!(event.which === 115 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) && !(event.which === 19)) return true;
109  event.preventDefault();
110  formmodified = 0; // do not warn user, just save.
111  return false;
112  });
113  // used to process the cmd+s and ctrl+s events
114  $(document).keydown(function (event) {
115  if (event.which === 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) {
116  event.preventDefault();
117  $('#savebutton').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
118  formmodified = 0; // do not warn user, just save.
119  // save(event);
120  return false;
121  }
122  });
123  }
124 
125  saveHotkey();
126 
127  var savebutton = ('#savebutton');
128  var savebuttonIcon = ('#savebuttonIcon');
129  // ok, lets go...
130  // we need to check if user clicked on save button
131  $(savebutton).click(function () {
132  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning disabled');
133  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
134  });
135 
136  const timediff = $('#timediff');
137  const timedifftext = $('#timedifftext');
138  const offline = $('#offline');
139  const offlinemsg = $('#offlinemsg');
140  const offlineimage = $('#offlineimage');
141 
142  /* START CHECKBOX timediff */
143  // check backend footer checkbox onload
144  if( $(timediff).prop('checked')){
145  // box is checked, set input field to NOT disabled
146  $(timedifftext).prop('disabled', false);
147  }
148  else {
149  // box is not checked, set field to disabled
150  $(timedifftext).prop('disabled', true);
151  }
152  // check wheter the checkbox is clicked
153  $(timediff).click(function(){ // if user clicked save
154  if( $(timediff).prop('checked')){
155  // box is checked, set input field to NOT disabled
156  $(timedifftext).prop('disabled', false);
157  }
158  else {
159  // set footer value input field to disabled
160  $(timedifftext).prop('disabled', true);
161  }
162  });
163  /* END CHECKBOX backend footer */
164 
165  /* START CHECKBOX offline mode */
166  // check backend footer checkbox onload
167  if( $(offline).prop('checked')){
168  // box is checked, set input field to NOT disabled
169  $(offlinemsg).prop('disabled', false);
170  $(offlineimage).prop('disabled', false);
171  }
172  else {
173  // box is not checked, set field to disabled
174  $(offlinemsg).prop('disabled', true);
175  $(offlineimage).prop('disabled', true);
176  }
177  // check wheter the checkbox is clicked
178  $(offline).click(function(){ // if user clicked save
179  if( $(offline).prop('checked')){
180  // box is checked, set input field to NOT disabled
181  $(offlinemsg).prop('disabled', false);
182  $(offlineimage).prop('disabled', false);
183  }
184  else {
185  // set footer value input field to disabled
186  $(offlinemsg).prop('disabled', true);
187  $(offlineimage).prop('disabled', true);
188  }
189  });
190  /* END CHECKBOX backend fx */
191 });
192  /* END CHECKBOX backend fx */
193 </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
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);});})