YaWK  24.1
Yet another WebKit
settings-language.php
Go to the documentation of this file.
1 <script src="../system/engines/jquery/dropzone/dropzone.js"></script>
2 <link href="../system/engines/jquery/dropzone/dropzone.css" rel="stylesheet">
3 <?php
4 
5 use YAWK\alert;
6 use YAWK\backend;
7 use YAWK\db;
9 use YAWK\language;
10 use YAWK\settings;
11 use YAWK\sys;
12 
13 /** @var $db db */
14 /** @var $lang language */
15 
16 // user clicked on save
17 if (isset($_POST['save']))
18 {
19  // store backend language
20  if (settings::setSetting($db, "backendLanguage", $_POST['backendLanguage'], $lang) === true)
21  { $backendStatus = 1; }
22  else
23  { $backendStatus = 0; }
24 
25  // store frontend language
26  if (settings::setSetting($db, "frontendLanguage", $_POST['frontendLanguage'], $lang) === true)
27  { $frontendStatus = 1; }
28  else
29  { $frontendStatus = 0; }
30 
31  // calc status vars
32  $status = $backendStatus + $frontendStatus;
33  // check status to throw only 1 notification
34  switch ($status)
35  {
36  // ok, all good success msg
37  case 2:
38  // ensure, that new backend language gets stored as cookie
39  if (isset($_POST['backendLanguage']) && (!empty($_POST['backendLanguage'])))
40  { // we use a small line of JS to achieve this
41  echo "<script>document.cookie = 'lang=$_POST[backendLanguage]';</script>";
42  // to ensure that language switching works correctly, reload page with given POST language
43  sys::setTimeout("index.php?page=settings-language&lang=$_POST[backendLanguage]&saved=1&frontendLanguage=$_POST[frontendLanguage]", 0);
44  }
45  break;
46  case 0:
47  // false, throw error msg
48  alert::draw("danger", "$lang[LANGUAGES] $lang[NOT_SAVED]", "$lang[BACKEND] ($_GET[backendLanguage]) $lang[AND] $lang[FRONTEND] ($_GET[frontendLanguage]) $lang[LANGUAGE] $lang[NOT_SAVED].",'', 3400);
49  break;
50  }
51 }
52 // confirmed: switch language has been successful
53 if (isset($_GET['saved']) && ($_GET['saved'] == 1))
54 { // throw success msg
55  alert::draw("success", "$lang[LANGUAGES] $lang[SAVED]", "$lang[BACKEND] ($_GET[lang]) $lang[AND] $lang[FRONTEND] ($_GET[frontendLanguage]) $lang[LANGUAGE] $lang[SAVED].",'', 2400);
56 }
57 
58 // user wants to override (edit and save) one of the existing language files
59 if (isset($_POST['editLanguageBtn']))
60 { // check, which option the user have selected
61  if (isset($_POST['editLanguageSelect']))
62  { // no language selected
63  if ($_POST['editLanguageSelect'] === "null")
64  { // throw error
65  alert::draw("warning", $lang['ERROR'], $lang['LANGUAGE_SELECT_NEEDED'], "", 3400);
66  }
67  else
68  { // user selected a language, store filename
69  $file = $_POST['editLanguageSelect'];
70  // try to override the existing language file
71  if (file_put_contents($file, $_POST['languageContent']))
72  { // write ok, throw msg
73  alert::draw("success", $lang['TRANSLATION'], "$lang[FILE] <b>$file</b> $lang[SAVED]", "", 2400);
74  }
75  else
76  { // write error, throw alert
77  alert::draw("danger", $lang['TRANSLATION'], "$lang[FILE] <b>$file</b> $lang[NOT_SAVED]", "", 3400);
78  }
79  }
80  }
81 }
82 
83 // UPLOAD FRONTEND OR BACKEND LANGUAGE FILE
84 if (isset($_POST['upload']) && ($_POST['upload'] == 1) && ($_POST['action'] == true))
85 { // backend language file upload requested
86  if ($_POST['uploadFolder'] === 'frontend')
87  { // frontend settings
88  $targetPath = '../system/language/';
89  $totalLines = count(file('../system/language/lang-en-EN.ini'));
90  }
91  // backend language file upload requested
92  else if ($_POST['uploadFolder'] === 'backend')
93  { // backend settings
94  $targetPath = 'language/';
95  $totalLines = count(file('language/lang-en-EN.ini'));
96  }
97  else { $targetPath = 'language/'; $totalLines = 0; }
98 
99  // check if file array is set and not empty
100  if (isset($_FILES['file']) && (!empty($_FILES['file'])))
101  { // check file extension
102  if (substr($_FILES['file']['name'], -4) === '.ini')
103  {
104  // move file to proper target folder
105  move_uploaded_file($_FILES['file']['tmp_name'], $targetPath.$_FILES['file']['name']);
106  // check if uploaded file is there
107  if (is_file($targetPath.$_FILES['file']['name']))
108  { // uploaded file: count number of lines
109  $i = count(file($targetPath.$_FILES['file']['name']));
110  // if number of lines does not match with lang-en-EN.ini
111  if ($i !== $totalLines)
112  {
113  // throw warning
114  alert::draw("warning", "$lang[LANGUAGE] $lang[UPLOADED]", "$lang[LANGUAGE_UPLOAD_DIFFER]", "", 2400);
115  }
116  else
117  {
118  // upload complete, number of lines are consistent, all good.
119  alert::draw("success", "$lang[LANGUAGE] $lang[UPLOADED]", "$lang[LANGUAGE_UPLOAD_OK]", "", 2400);
120  }
121  }
122  else
123  {
124  // uploaded file is not here - throw error message
125  alert::draw("danger", "$lang[LANGUAGE] $lang[ERROR]", "$lang[LANGUAGE_UPLOAD_FAILED]", "", 2400);
126  }
127  }
128  else
129  {
130  // uploaded file got the wrong file extension (not an ini file)
131  alert::draw("danger", "$lang[LANGUAGE] $lang[ERROR]", "$lang[LANGUAGE_UPLOAD_EXT_ERROR]", "", 2400);
132  }
133  }
134  else
135  {
136  // no files sent - array not set or empty
137  alert::draw("danger", "$lang[LANGUAGE] $lang[ERROR]", "$lang[LANGUAGE_UPLOAD_ERROR]", "", 2400);
138  }
139 }
140 
141 // user requested to restore the language files from backup folder
142 if (isset($_GET['restore']) && ($_GET['restore'] == 1) && ($_GET['action'] == true))
143 {
144  // total amount of language files
145  $frontendFileCount = 0;
146  $backendFileCount = 0;
147  // total amount of files copied
148  $frontendCopiedTotal = 0;
149  $backendCopiedTotal = 0;
150  $copiedTotal = 0;
151  // source directory to copy from
152  $backendSource = "../system/backup/languages/backend";
153  // destination directory to copy to
154  $backendDestination = "language";
155  // build array with all language files from backup folder
156  $backendFiles = glob("../system/backup/languages/backend/*.ini");
157  // frontend settings
158  $frontendFileCount = 0;
159  $frontendSource = "../system/backup/languages/frontend";
160  $frontendDestination = "../system/language";
161  $frontendFiles = glob("../system/backup/languages/frontend/*.ini");
162 
163  // copy backend language files from backup folder
164  foreach($backendFiles as $file){
165  // add +1 to file counter
166  $backendFileCount++;
167  // prepare current file
168  $current = str_replace($backendSource,$backendDestination,$file);
169  // process file
170  if (copy($file, $current))
171  { // add +1 to total counter
172  $backendCopiedTotal++;
173  }
174  }
175 
176  // copy frontend language files from backup folder
177  foreach($frontendFiles as $file){
178  // add +1 to file counter
179  $frontendFileCount++;
180  // prepare current file
181  $current = str_replace($frontendSource,$frontendDestination,$file);
182  // process file
183  if (copy($file, $current))
184  { // add +1 to total counter
185  $frontendCopiedTotal++;
186  }
187  }
188  $totalToCopy = $backendFileCount + $frontendFileCount;
189  $copiedTotal = $frontendCopiedTotal + $backendCopiedTotal;
190 
191  // if all items are processed
192  if ($totalToCopy === $copiedTotal)
193  { // throw success msg
194  alert::draw("success", "$lang[LANGUAGES] $lang[RESTORED]", "$lang[LANGUAGE] $lang[FILES] $lang[RESTORED]", "", 2400);
195  }
196  else
197  { // throw error
198  alert::draw("danger", "$lang[LANGUAGES] $lang[NOT_RESTORED]", "$lang[LANGUAGE] $lang[FILES] $lang[NOT_RESTORED]", "", 3400);
199  }
200 } // end save routine and processing
201 // get editor settings from database
202 $editorSettings = settings::getEditorSettings($db, 14);
203 ?>
204 <!-- include codemirror -->
205 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/codemirror.min.css">
206 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/themes/<?php echo $editorSettings['editorTheme']; ?>.css">
207 <script type="text/javascript" src="../system/engines/codemirror/codemirror-compressed.js"></script>
208 
209 <?php
210 // TEMPLATE WRAPPER - HEADER & breadcrumbs
211 echo "
212  <!-- Content Wrapper. Contains page content -->
213  <div class=\"content-wrapper\" id=\"content-FX\">
214  <!-- Content Header (Page header) -->
215  <section class=\"content-header\">";
216 /* draw Title on top */
217 echo backend::getTitle($lang['LANGUAGES'], $lang['TRANSLATION']);
218 echo backend::getSettingsBreadcrumbs($lang);
219 echo"</section>
220  <!-- Main content -->
221  <section class=\"content\">";
222 /* page content start here */
223 ?>
224 <form id="template-edit-form" action="index.php?page=settings-language" method="POST">
225  <div class="box">
226  <div class="box-body">
227  <div class="col-md-10">
228  <?php echo "<h4><i class=\"fa fa-language\"></i> &nbsp;$lang[LANGUAGES]&nbsp;<small>$lang[LANGUAGES_SUBTEXT]</small></h4>"; ?>
229  </div>
230  <div class="col-md-2">
231  <button class="btn btn-success pull-right" id="savebutton" name="save" style="margin-top:2px;"><i id="savebuttonIcon" class="fa fa-check"></i>&nbsp;&nbsp;<?php echo $lang['SAVE_SETTINGS']; ?></button>
232  </div>
233  </div>
234  </div>
235 
236  <div class="row animated fadeIn">
237  <div class="col-md-8">
238  <div class="box">
239  <div class="box-body">
240  <label for="languageContent"><?php echo $lang['LANGUAGE_FILE_CONTENT']; ?> &nbsp;<small><i id="sign" class="fa fa-exclamation-triangle text-danger hidden"></i></small> &nbsp;<i id="additionalLabelInfo" class="small text-danger hidden"><?php echo $lang['LANGUAGE_FILE_WARNING']; ?></i></label>
241  <textarea id="languageContent" name="languageContent" rows="30" class="form-control"></textarea>
242  <div id="textbox"></div>
243  </div>
244  </div>
245  </div>
246  <div class="col-md-4">
247  <div class="box">
248  <div class="box-header with-border">
249  <h3 class="box-title"><?php echo $lang['LANGUAGE']; ?> <small><?php echo $lang['DETERMINE']; ?></small></h3>
250  </div>
251  <div class="box-body">
252  <?php // \YAWK\settings::getFormElements($db, $settings, 19, $lang) ?>
253  <!-- backend language -->
254  <h3><i class="fa fa-language"></i>&nbsp;<?php echo $lang['BACKENDLANGUAGE_HEADING']."&nbsp;<small>$lang[BACKENDLANGUAGE_SUBTEXT]</small>"; ?></h3>
255  <label id="backendLanguge" for="backendLanguge"><?php echo $lang['BACKENDLANGUAGE_LABEL']; ?></label>
256  <select id="backendLanguge" name="backendLanguage" class="form-control">
257  <?php
258  $dbLanguage = settings::getSetting($db, "backendLanguage");
259  echo "<option value=\"$dbLanguage\">$lang[CURRENT] $dbLanguage</option>";
260  // get all language files from folder to array
261  $backendLanguageFiles = filemanager::getFilesFromFolderToArray('language');
262  // walk through array
263  foreach ($backendLanguageFiles AS $file)
264  { // exclude .htaccess
265  if ($file != ".htaccess")
266  { // extract language tag from filename
267  $languageTag = substr($file, -9, 5); // returns eg "en-EN"
268  // create option for each language file
269  echo "<option value=\"$languageTag\">$languageTag</option>";
270  }
271  }
272  ?>
273  </select>
274  <br>
275  <!-- frontend Language selection -->
276  <h3><i class="fa fa-language"></i>&nbsp;<?php echo $lang['FRONTENDLANGUAGE_HEADING']."&nbsp;<small>$lang[FRONTENDLANGUAGE_SUBTEXT]</small>"; ?></h3>
277  <label id="frontendLanguge" for="frontendLanguge"><?php echo $lang['FRONTENDLANGUAGE_LABEL']; ?></label>
278  <select id="frontendLanguge" name="frontendLanguage" class="form-control">
279  <?php
280  $dbLanguage = settings::getSetting($db, "frontendLanguage");
281  echo "<option value=\"$dbLanguage\">$lang[CURRENT] $dbLanguage</option>";
282  // get all language files from folder to array
283  // this has been declared before - no need to get it twice from database.
284  // $languageFiles = \YAWK\filemanager::getFilesFromFolderToArray('language'); // declared before
285  // walk through array
286  foreach ($backendLanguageFiles AS $file)
287  { // exclude .htaccess
288  if ($file != ".htaccess")
289  { // extract language tag from filename
290  $languageTag = substr($file, -9, 5); // returns eg "en-EN"
291  // create option for each language file
292  echo "<option value=\"$languageTag\">$languageTag</option>";
293  }
294  }
295  ?>
296  </select>
297  <br><br>
298  </div>
299  </div>
300  <div class="box">
301  <div class="box-header with-border">
302  <h3 class="box-title"><?php echo $lang['TRANSLATION']; ?> <small><?php echo $lang['EDIT']; ?></small></h3>
303  </div>
304  <div class="box-body">
305  <label id="editLanguageSelectLabel" for="editLanguageSelect"><?php echo $lang['LANGUAGE_WHICH_EDIT']; ?></label>
306  <select id="editLanguageSelect" name="editLanguageSelect" class="form-control">
307  <option value="null"><?php echo $lang['PLEASE_SELECT']; ?></option>
308  <?php
309  // get all language files from folder to array
310  $backendLanguageFiles = filemanager::getFilesFromFolderToArray('language');
311  $frontendLanguageFiles = filemanager::getFilesFromFolderToArray('../system/language');
312  // walk through array
313  foreach ($backendLanguageFiles AS $file)
314  { // exclude .htaccess
315  if ($file != ".htaccess")
316  { // create option for each language file
317  echo "<option value=\"language/$file\">backend/$file</option>";
318  }
319  }
320  foreach ($frontendLanguageFiles AS $file)
321  { // exclude .htaccess
322  if ($file != ".htaccess")
323  { // create option for each language file
324  echo "<option value=\"../system/language/$file\">frontend/$file</option>";
325  }
326  }
327  ?>
328  </select>
329  <div id="editLanguageFooter">
330  <button id="editLanguageBtn" name="editLanguageBtn" class="btn btn-success pull-right hidden" style="margin-top:10px;"><i class="fa fa-check"></i> &nbsp;
331  <?php echo $lang['SAVE_TRANSLATION']; ?></button>
332  <a href="index.php?page=settings-language" id="cancelLanguageBtn" class="btn btn-danger pull-right hidden" style="margin-top:10px; margin-right:2px;"><i class="fa fa-times"></i> &nbsp;<?php echo $lang['CANCEL']; ?></a>
333  </div>
334  </div>
335  </div>
336  <div class="box">
337  <div class="box-header with-border">
338  <h3 class="box-title"><?php echo $lang['LANGUAGES']; ?> <small><?php echo $lang['RESTORE']; ?></small></h3>
339  </div>
340  <div class="box-body">
341  <i class="fa fa-exclamation-triangle text-danger"></i>&nbsp;&nbsp;<?php echo $lang['LANGUAGE_RESET']; ?>
342  <a class="btn btn-default pull-right" id="resetLanguageBtn" role="dialog" data-confirm="<?php echo $lang['ARE_YOU_SURE'];?>" title="<?php echo $lang['RESTORE_LANGUAGE']; ?>" href="index.php?page=settings-language&restore=1&action=true"><i class="fa fa-language text-danger"></i>&nbsp;&nbsp;Backup laden</a>
343  </div>
344  </div>
345 </form>
346 
347  <div class="box">
348  <div class="box-header with-border">
349  <h3 class="box-title"><?php echo $lang['LANGUAGES']; ?> <small><?php echo $lang['UPLOAD']; ?></small></h3>
350  </div>
351  <div class="box-body">
352  <form id="template-edit-form" enctype= "multipart/form-data" action="index.php?page=settings-language" method="POST">
353  <label for="folder"><?php echo $lang['SELECT_FOLDER']; ?></label>
354  <select name="uploadFolder" class="form-control" id="folder">
355  <option value=""><?php echo $lang['PLEASE_SELECT']; ?></option>
356  <option value="frontend">FrontEnd (system/language)</option>
357  <option value="backend">BackEnd (admin/language)</option>
358  </select>
359  <label for="file"><?php echo $lang['SELECT_FILE']; ?></label>
360  <input id="file" name="file" type="file" class="form-control">
361  <small><?php echo $lang['LANGUAGE_UPLOAD_INFO']; ?></small>
362  <button type="submit" style="margin-top:10px;" class="btn btn-default pull-right" id="uploadLanguageBtn" name="uploadLanguageBtn" role="dialog" data-confirm="<?php echo $lang['ARE_YOU_SURE'];?>" title="<?php echo $lang['LANGUAGE_UPLOAD']; ?>"><i class="fa fa-upload"></i>&nbsp;&nbsp;<?php echo $lang['LANGUAGE_UPLOAD']; ?></button>
363  <input type="hidden" name="upload" value="1">
364  <input type="hidden" name="action" value="true">
365  </form>
366  </div>
367  </div>
368  </div>
369  </div>
370 <style>
371  html, body {height: 100%;}
372  .CodeMirror {height:50em;}
373  .CodeMirror-scroll {height: 100%;}
374 </style>
375 
376 <script type="text/javascript">
377 
378 
379  $(document).ready(function() {
380  function saveHotkey() {
381  // simply disables save event for chrome
382  $(window).keypress(function (event) {
383  if (!(event.which === 115 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) && !(event.which === 19)) return true;
384  event.preventDefault();
385  formmodified = 0; // do not warn user, just save.
386  return false;
387  });
388  // used to process the cmd+s and ctrl+s events
389  $(document).keydown(function (event) {
390  if (event.which === 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) {
391  event.preventDefault();
392  $('#savebutton').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
393  formmodified = 0; // do not warn user, just save.
394  // save(event);
395  return false;
396  }
397  });
398  }
399 
400  saveHotkey();
401 
402  const savebutton = ('#savebutton');
403  const savebuttonIcon = ('#savebuttonIcon');
404  // ok, lets go...
405  // we need to check if user clicked on save button
406  $(savebutton).click(function () {
407  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning disabled');
408  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
409  });
410 
411  // init vars
412  const languageContent = $("#languageContent");
413  const editlanguageSelectLabel = $("#editLanguageSelectLabel");
414  const editLanguageSelect = $("#editLanguageSelect");
415  const cancelLanguageBtn = $("#cancelLanguageBtn");
416  const editLanguageBtn = $("#editLanguageBtn");
417  const additionalLabel = $("#additionalLabelInfo");
418  const sign = $("#sign");
419 
420  // user select a language to edit from select option
421  $(editLanguageSelect).on('change', function()
422  {
423  // get filename from select option value
424  fn = this.value; // language file
425 
426  // codemirror configuration
427  let config, editor;
428  config = {
429  theme: '<?php echo $editorSettings['editorTheme']; ?>', // codeview theme
430  lineNumbers: true, // display lineNumbers true|false
431  undoDepth: <?php echo $editorSettings['editorUndoDepth']; ?>, // how many undo steps should be saved? (default: 200)
432  smartIndent: <?php echo $editorSettings['editorSmartIndent']; ?>, // better indent
433  indentUnit: <?php echo $editorSettings['editorIndentUnit']; ?>, // how many spaces auto indent? (default: 2)
434  mode: "css",
435  styleActiveLine: <?php echo $editorSettings['editorActiveLine']; ?> // highlight the active line (where the cursor is)
436  };
437 
438  // prevent caching
439  $.ajaxSetup({ cache: false });
440  // get language from filename
441  $.get(fn, function (response) {
442  language = response;
443  // launch codemirror and load language file (value) into it
444  editor = CodeMirror.fromTextArea(document.getElementById("languageContent"), config).setValue(language);
445  });
446 
447  // show save button
448  $(editLanguageBtn).removeClass('btn btn-success pull-right hidden').addClass('btn btn-success pull-right');
449  // show exclamation sign
450  $(sign).removeClass('fa fa-exclamation-triangle text-danger hidden').addClass('fa fa-exclamation-triangle text-danger');
451  // show file edit warning
452  $(additionalLabel).removeClass('small hidden').addClass('small');
453  // make cancel button visible
454  $(cancelLanguageBtn).removeClass('btn btn-danger pull-right hidden').addClass('btn btn-danger pull-right');
455 
456  // if save language btn is clicked
457  $(editLanguageBtn).click(function() {
458  // release (enable) select options field
459  $(editLanguageSelect).prop('disabled', false);
460  // hide cancel button
461  $(cancelLanguageBtn).removeClass('btn btn-danger pull-right').addClass('btn btn-danger pull-right hidden');
462  // hide additional info
463  $(additionalLabel).removeClass('small').addClass('small hidden');
464  // hide exclamation sign
465  $(sign).removeClass('fa fa-exclamation-triangle text-danger').addClass('fa fa-exclamation-triangle text-danger hidden');
466  });
467 
468  // change label to tell user which file he is editing
469  $(editlanguageSelectLabel).empty().append('<?php // echo $lang['EDIT'].":"; ?> admin/'+fn);
470  // turn off editLangue Select field
471  $(editLanguageSelect).prop('disabled', true);
472  // change class (color) of savebutton
473  $(editLanguageBtn).removeClass('btn btn-success pull-right').addClass('btn btn-warning pull-right');
474  });
475 
476  }); // end document ready
477 </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
Basic File Manager (Backend)
Definition: filemanager.php:17
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
function window
Definition: fuckAdBlock.js:8
FuckAdBlock prototype on
Definition: fuckAdBlock.js:227
function a
Definition: browser.js:14
c jPlayer event
type
Definition: menu-new.php:35
print $page title
Definition: page-edit.php:377
print $_GET['id']
Definition: page-edit.php:357
function i(e, t)
Definition: plyr.js:1
$backendLanguageFiles
if(isset($_POST['save'])) if(isset($_GET['saved']) &&($_GET['saved']==1)) if(isset($_POST['editLanguageBtn'])) if(isset($_POST['upload']) &&($_POST['upload']==1) &&($_POST['action']==true)) if(isset($_GET['restore']) &&($_GET['restore']==1) &&($_GET['action']==true)) $editorSettings
$frontendLanguageFiles
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name
$i
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);});})