YaWK  24.1
Yet another WebKit
settings-robots.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 /** @var $db db */
9 /** @var $lang language */
10 
11 // SAVE tpl settings
12 if(isset($_POST['save']))
13 {
14  if (isset($_POST['robotsText-long']) && (!empty($_POST['robotsText-long'])))
15  {
16  if (settings::setLongSetting($db, "robotsText-long", $_POST['robotsText-long']))
17  {
18  // \YAWK\alert::draw("success", $lang['SUCCESS'], "$lang[ROBOTS_TXT] $lang[DATABASE] $lang[SAVED]", "", 2400);
19  }
20  else
21  {
22  alert::draw("danger", $lang['ERROR'], "$lang[ROBOTS_TXT] $lang[DATABASE] $lang[NOT_SAVED]", "", 2400);
23  }
24 
25  if (sys::setRobotsText("../", $_POST['robotsText-long']))
26  {
27  alert::draw("success", $lang['SUCCESS'], "$lang[ROBOTS_TXT] $lang[SAVED]", "", 2400);
28  }
29  else
30  {
31  alert::draw("danger", $lang['ERROR'], "$lang[ROBOTS_TXT] $lang[NOT_SAVED]", "", 3400);
32  }
33  }
34 
35 // force page reload to show changes immediately
36 // \YAWK\sys::setTimeout("index.php?page=settings-frontend", 0);
37 }
38 
39 // get settings for editor
40 $editorSettings = settings::getEditorSettings($db, 14);
41 ?>
42 <!-- include summernote css/js-->
43 <!-- include codemirror (codemirror.css, codemirror.js, xml.js) -->
44 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/codemirror.min.css">
45 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/themes/<?php echo $editorSettings['editorTheme']; ?>.css">
46 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/show-hint.min.css">
47 <script type="text/javascript" src="../system/engines/codemirror/codemirror-compressed.js"></script>
48 <script type="text/javascript" src="../system/engines/codemirror/auto-refresh.js"></script>
49 
50 <!-- SUMMERNOTE -->
51 <link href="../system/engines/summernote/dist/summernote.css" rel="stylesheet">
52 <script src="../system/engines/summernote/dist/summernote.min.js"></script>
53 <script type="text/javascript">
54  $(document).ready(function() {
55  // textarea that will be transformed into editor
56  var editor = ('textarea#summernote');
57  // summernote.init -
58  // LOAD SUMMERNOTE IN CODEVIEW ON STARTUP
59  $(editor).on('summernote.init', function() {
60  // toggle editor to codeview
61  $(editor).summernote('codeview.toggle');
62  });
63 
64  // INIT SUMMERNOTE EDITOR
65  $(editor).summernote({ // set editor itself
66  height: <?php echo $editorSettings['editorHeight']; ?>, // set editor height
67  minHeight: null, // set minimum height of editor
68  maxHeight: null, // set maximum height of editor
69  focus: true, // set focus to editable area after initializing summernote
70 
71  toolbar:
72  {
73  // no toolbar
74  },
75  // language for plugin image-attributes.js
76  lang: '<?php echo $lang['CURRENT_LANGUAGE']; ?>',
77 
78  // powerup the codeview with codemirror theme
79  codemirror: { // codemirror options
80  theme: '<?php echo $editorSettings['editorTheme']; ?>', // codeview theme
81  lineNumbers: true, // display lineNumbers true|false
82  undoDepth: <?php echo $editorSettings['editorUndoDepth']; ?>, // how many undo steps should be saved? (default: 200)
83  smartIndent: <?php echo $editorSettings['editorSmartIndent']; ?>, // better indent
84  indentUnit: <?php echo $editorSettings['editorIndentUnit']; ?>, // how many spaces auto indent? (default: 2)
85  scrollbarStyle: null, // styling of the scrollbars
86  matchBrackets: <?php echo $editorSettings['editorMatchBrackets']; ?>, // highlight corresponding brackets
87  autoCloseBrackets: <?php echo $editorSettings['editorCloseBrackets'];?>, // auto insert close brackets
88  autoCloseTags: <?php echo $editorSettings['editorCloseTags']; ?>, // auto insert close tags after opening
89  value: "<html>\n " + document.documentElement.innerHTML + "\n</html>", // all html
90  mode: "css", // editor mode
91  matchTags: {bothTags: <?php echo $editorSettings['editorMatchTags']; ?>}, // hightlight matching tags: both
92  extraKeys: {
93  "Ctrl-J": "toMatchingTag", // CTRL-J to jump to next matching tab
94  "Ctrl-Space": "autocomplete" // CTRL-SPACE to open autocomplete window
95  },
96  styleActiveLine: <?php echo $editorSettings['editorActiveLine']; ?>, // highlight the active line (where the cursor is)
97  autoRefresh: true
98  }
99  }); // end summernote
100  }); // end document ready
101 </script>
102 
103 <?php
104 // TEMPLATE WRAPPER - HEADER & breadcrumbs
105 echo "
106  <!-- Content Wrapper. Contains page content -->
107  <div class=\"content-wrapper\" id=\"content-FX\">
108  <!-- Content Header (Page header) -->
109  <section class=\"content-header\">";
110 // draw Title on top
111 echo backend::getTitle($lang['SETTINGS'], $lang['ROBOTS_TXT']);
112 echo backend::getSettingsBreadcrumbs($lang);
113 echo"</section><!-- Main content -->
114  <section class=\"content\">";
115 /* page content start here */
116 ?>
117 <form id="frontend-edit-form" action="index.php?page=settings-robots" method="POST">
118  <div class="box">
119  <div class="box-body">
120  <div class="col-md-10">
121  <?php echo "<h4><i class=\"fa fa-android\"></i> &nbsp;$lang[ROBOTS_TXT]&nbsp;<small>$lang[CONFIGURE]</small></h4>"; ?>
122  </div>
123  <div class="col-md-2">
124  <button class="btn btn-success pull-right" id="save" name="save" style="margin-top:2px;"><i id="savebuttonIcon" class="fa fa-check"></i>&nbsp;&nbsp;<?php echo $lang['SAVE_SETTINGS']; ?></button>
125  </div>
126  </div>
127  </div>
128 
129  <!-- ROBOTS.TXT -->
130  <div class="row">
131  <div class="col-md-8">
132  <div class="box">
133  <div class="box-body">
134  <label for="summernote"><?php echo $lang['DATA_PRIVACY']."&nbsp;&amp;&nbsp;".$lang['PRIVACY']; ?> - <small><?php echo $lang['ROBOTS_SUBTEXT']; ?> </small></label>
135  <?php $content = sys::getRobotsText($db, "../"); ?>
136  <textarea name="robotsText-long" cols="64" rows="28" id="summernote"><?php echo $content; ?></textarea>
137  </div>
138  </div>
139  </div>
140  <div class="col-md-4">
141  <div class="box">
142  <div class="box-header with-border">
143  <h3 class="box-title"><?php echo $lang['ROBOTS_TXT']; ?> <small> <?php echo $lang['HELP']; ?></small></h3>
144  </div>
145  <div class="box-body">
146  <?php // \YAWK\settings::getFormElements($db, $settings, 0, $lang); ?>
147  </div>
148  </div>
149  </div>
150  </div>
151 </form>
152 <script type="text/javascript">
153 $(document).ready(function() {
154  function saveHotkey() {
155  // simply disables save event for chrome
156  $(window).keypress(function (event) {
157  if (!(event.which === 115 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) && !(event.which === 19)) return true;
158  event.preventDefault();
159  $('#save').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
160  formmodified = 0; // do not warn user, just save.
161  return false;
162  });
163  // used to process the cmd+s and ctrl+s events
164  $(document).keydown(function (event) {
165  if (event.which === 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) {
166  event.preventDefault();
167  $('#save').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
168  formmodified = 0; // do not warn user, just save.
169  // save(event);
170  return false;
171  }
172  });
173  }
174  saveHotkey();
175 
176  // textarea that will be transformed into editor
177  var savebutton = ('#save');
178  var savebuttonIcon = ('#savebuttonIcon');
179  // textarea that will be transformed into editor
180  var editor = ('textarea#summernote');
181  // ok, lets go...
182  // we need to check if user clicked on save button
183  $(savebutton).click(function () {
184  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning disabled');
185  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
186 
187  if ($(editor).summernote('codeview.isActivated')) {
188  // if so, turn it off.
189  $(editor).summernote('codeview.deactivate');
190  }
191  });
192 });
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 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
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'])) $editorSettings
$template name
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);});})