YaWK  24.1
Yet another WebKit
blog-edit.php
Go to the documentation of this file.
1 <?php
2 
4 use YAWK\db;
5 use YAWK\PLUGINS\BLOG\blog;
6 use YAWK\settings;
7 
8 include '../system/plugins/blog/classes/blog.php';
9 // check if blog object is set
10 if (!isset($blog)) { $blog = new blog(); }
11 // check if page object is set
12 if (!isset($page)) { $page = new \YAWK\page(); }
13 // check if language is set
14 if (!isset($language) || (!isset($lang)))
15 { // inject (add) language tags to core $lang array
16  $lang = \YAWK\language::inject(@$lang, "../system/plugins/blog/language/");
17 }
18 if (!isset($db)){
19  $db = new db();
20 }
21 // SAVE BLOG ENTRY
22 if (isset($_POST['save'])) {
23  // check if blogtitle is set
24  if ((empty($_POST['blogtitle'])))
25  { // blogtitle is empty, set unnamed as default value
26  $_POST['blogtitle'] = "unnamed";
27  }
28  // check if filename is set
29  if ((empty($_POST['filename'])))
30  { // user entered no filename, take blogtitle as filename (processing will be done in save function)
31  $_POST['filename'] = $_POST['blogtitle'];
32  }
33  // check if meta description is set
34  if ((empty($_POST['meta_local'])))
35  { // if not, take blogtitle as description
36  $_POST['meta_local'] = $_POST['blogtitle'];
37  }
38  // check if meta keywords are set
39  if ((empty($_POST['meta_keywords'])))
40  { // if not, take blogtitle as description
41  $_POST['meta_keywords'] = "";
42  }
43  // check if a teasertext is set
44  if ((empty($_POST['teasertext'])))
45  { // if not, leave old teasertext (hidden post field)
46  $_POST['teasertext'] = $_POST['oldteasertext'];
47  }
48 
49  // quote post vars
50  $blog->blogtitle = $db->quote($_POST['blogtitle']);
51  $blog->filename = $db->quote($_POST['filename']);
52  $blog->subtitle = $db->quote($_POST['subtitle']);
53  $blog->published = $db->quote($_POST['published']);
54  $blog->itemid = $db->quote($_POST['itemid']);
55  $blog->itemgid = $db->quote($_POST['itemgid']);
56  $blog->teaser = $db->quote($_POST['teaser']);
57  $blog->date_publish = $db->quote($_POST['date_publish']);
58  $blog->date_unpublish = $db->quote($_POST['date_unpublish']);
59  $blog->blogid = $db->quote($_POST['blogid']);
60  $blog->teasertext = $db->quote($_POST['teasertext']);
61  $blog->blogtext = $db->quote($_POST['blogtext']);
62  $blog->pageid = $db->quote($_POST['pageid']);
63  $blog->thumbnail = $db->quote($_POST['thumbnail']);
64  $blog->youtubeUrl = $db->quote($_POST['youtubeUrl']);
65  $blog->meta_local = $db->quote($_POST['meta_local']);
66  $blog->meta_keywords = $db->quote($_POST['meta_keywords']);
67  $blog->itemlayout = $db->quote($_POST['itemlayout']);
68  $blog->itemcomments = $db->quote($_POST['itemcomments']);
69 
70  // Summernote Editor \r\n removal
71 
72  // $blog->blogtext = stripslashes(str_replace('\r\n','&#x000D;', ($blog->blogtext)));
73  // $blog->teasertext = stripslashes(str_replace('\r\n','&#x000D;', ($blog->teasertext)));
74 
75  if ($blog->save($db))
76  { // throw success notify
77  YAWK\alert::draw("success", "$lang[SUCCESS]", "$lang[ENTRY] $lang[SAVED]", "", "800");
78  }
79  else
80  { // saving failed, throw error
81  YAWK\alert::draw("danger", "$lang[ERROR]", "$lang[BLOG] " . $_GET['blogid'] . " " . $_POST['blogtitle'] . " - " . $_POST['subtitle'] . " $lang[NOT] $lang[SAVED]","","3800");
82  }
83 }
84 
85 
86 // load blog properties
87 $blog->loadItemProperties($db, $_GET['blogid'], $_GET['itemid']);
88 
89 // path to cms
91 // get host URL
93 
94 // TEMPLATE WRAPPER - HEADER & breadcrumbs
95 echo "
96  <!-- Content Wrapper. Contains page content -->
97  <div class=\"content-wrapper\" id=\"content-FX\">
98  <!-- Content Header (Page header) -->
99  <section class=\"content-header\">";
100 /* draw Title on top */
101 blog::getBlogTitle($blog->blogtitle, $lang['EDIT'], $blog->icon);
102 echo"<ol class=\"breadcrumb\">
103  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
104  <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
105  <li class=\"active\"><a href=\"index.php?plugin=blog\" title=\"$lang[BLOG]\"> $lang[BLOG]</a></li>
106  </ol>
107  </section>
108  <!-- Main content -->
109  <section class=\"content\">";
110 /* page content start here */
111 ?>
112 <script type="text/javascript">
113  function saveHotkey() {
114  // simply disables save event for chrome
115  $(window).keypress(function (event) {
116  if (!(event.which === 115 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) && !(event.which == 19)) return true;
117  event.preventDefault();
118  formmodified=0; // do not warn user, just save.
119  return false;
120  });
121  // used to process the cmd+s and ctrl+s events
122  $(document).keydown(function (event) {
123  if (event.which === 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) {
124  event.preventDefault();
125  $('#savebutton').click(); // SAVE FORM AFTER PRESSING STRG-S hotkey
126  formmodified=0; // do not warn user, just save.
127  // save(event);
128  return false;
129  }
130  });
131  }
132  saveHotkey();
133 </script>
134 <?php
135 // get settings for editor
136 $editorSettings = settings::getEditorSettings($db, 14);
137 ?>
138 <!-- include summernote css/js-->
139 <!-- include codemirror (codemirror.css, codemirror.js, xml.js) -->
140 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/codemirror.min.css">
141 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/themes/<?php echo $editorSettings['editorTheme']; ?>.css">
142 <link rel="stylesheet" type="text/css" href="../system/engines/codemirror/show-hint.min.css">
143 <script type="text/javascript" src="../system/engines/codemirror/codemirror-compressed.js"></script>
144 <script type="text/javascript" src="../system/engines/codemirror/auto-refresh.js"></script>
145 
146 <!-- SUMMERNOTE -->
147 <link href="../system/engines/summernote/dist/summernote.css" rel="stylesheet">
148 <script src="../system/engines/summernote/dist/summernote.min.js"></script>
149 <script src="../system/engines/summernote/dist/summernote-cleaner.js"></script>
150 <script src="../system/engines/summernote/dist/summernote-image-attributes.js"></script>
151 <script src="../system/engines/summernote/dist/summernote-floats-bs.js"></script>
152 <script type="text/javascript">
153  $(document).ready(function() {
154 // textarea that will be transformed into editor
155  var editor = ('textarea#summernote');
156  var editor2 = ('textarea#summernote2');
157  var savebutton = ('#savebutton');
158  var savebuttonIcon = ('#savebuttonIcon');
159 // ok, lets go...
160 // we need to check if user clicked on save button
161  $(savebutton).click(function() {
162  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning');
163  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
164 // to save, even if the editor is currently opened in code view
165 // we need to check if codeview is currently active:
166  if ($(editor).summernote('codeview.isActivated')) {
167 // if so, turn it off.
168  $(editor).summernote('codeview.deactivate');
169  }
170 
171  if ($(editor2).summernote('codeview.isActivated')) {
172 // if so, turn it off.
173  $(editor2).summernote('codeview.deactivate');
174  }
175 // to display images in frontend correctly, we need to change the path of every image.
176 // to do that, the current value of textarea will be read into var text and search/replaced
177 // and written back into the textarea. utf-8 encoding/decoding happens in php, before saving into db.
178 // get the value of summernote textarea
179  if ( $(editor).length) { // check if element exists in dom to load editor correctly
180  var text = $(editor).val();
181  // search for <img> tags and revert src ../ to set correct path for frontend
182  var frontend = text.replace(/<img src=\x22..\/media/g,"<img src=\x22media");
183  // put the new string back into <textarea>
184  $(editor).val(frontend); // to make sure that saving works
185  }
186 
187  if ( $(editor2).length) { // check if element exists in dom to load editor correctly
188  // do the same thing for the 2nd textarea:
189  var text2 = $(editor2).val();
190  // search for <img> tags and revert src ../ to set correct path for frontend
191  var frontend2 = text2.replace(/<img src=\x22..\/media/g, "<img src=\x22media");
192  // put the new string back into <textarea>
193  $(editor2).val(frontend2); // to make sure that saving works
194  }
195  });
196 
197  // BEFORE SUMMERNOTE loads: 3 important lines of code!
198  // to display images in backend correctly, we need to change the path of every image.
199  // procedure is the same as above (see #savebutton.click)
200  // get the value of summernote textarea
201 
202  if ( $(editor).length) { // check if element exists in dom to load editor correctly
203  var text = $(editor).val();
204  // search for <img> tags and update src ../ to get images viewed in summernote
205  var backend = text.replace(/<img src=\"media/g, "<img src=\"../media");
206  // put the new string back into <textarea>
207  $(editor).val(backend); // set new value into textarea
208  }
209 
210  if ( $(editor2).length) { // check if element exists in dom to load editor correctly
211  // do the same thing for the 2nd textarea:
212  var text2 = $(editor2).val();
213  // search for <img> tags and update src ../ to get images viewed in summernote
214  var backend2 = text2.replace(/<img src=\"media/g, "<img src=\"../media");
215  // put the new string back into <textarea>
216  $(editor2).val(backend2); // set new value into textarea
217 
218  }
219  <?php
220  // check if codeview is enabled on default
221  if ($editorSettings['editorAutoCodeview'] === "true")
222  {
223  // summernote.init -
224  // LOAD SUMMERNOTE IN CODEVIEW ON STARTUP
225  echo "$(editor).on('summernote.init', function() {
226  // toggle editor to codeview
227  $(editor).summernote('codeview.toggle');
228  });";
229  echo "$(editor2).on('summernote.init', function() {
230  // toggle editor to codeview
231  $(editor2).summernote('codeview.toggle');
232  });";
233  }
234  ?>
235 
236  // INIT SUMMERNOTE EDITOR
237  $('#summernote').summernote({ // set editor itself
238  height: <?php echo $editorSettings['editorTeaserHeight']; ?>, // set editor height
239  minHeight: null, // set minimum height of editor
240  maxHeight: null, // set maximum height of editor
241  focus: true, // set focus to editable area after initializing summernote
242 
243  // popover tooltips
244  popover: {
245  image: [
246  ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']],
247  /* ['float', ['floatLeft', 'floatRight', 'floatNone']], // those are the old regular float buttons */
248  ['floatBS', ['floatBSLeft', 'floatBSNone', 'floatBSRight']], // bootstrap class buttons (float/pull)
249  ['custom', ['imageAttributes', 'imageShape']], // forked plugin: image-attributes.js
250  ['remove', ['removeMedia']]
251  ]
252  },
253  // language for plugin image-attributes.js
254  lang: '<?php echo $lang['CURRENT_LANGUAGE']; ?>',
255 
256  // powerup the codeview with codemirror theme
257  codemirror: { // codemirror options
258  theme: '<?php echo $editorSettings['editorTheme']; ?>', // codeview theme
259  lineNumbers: <?php echo $editorSettings['editorLineNumbers']; ?>, // display lineNumbers true|false
260  undoDepth: <?php echo $editorSettings['editorUndoDepth']; ?>, // how many undo steps should be saved? (default: 200)
261  smartIndent: <?php echo $editorSettings['editorSmartIndent']; ?>, // better indent
262  indentUnit: <?php echo $editorSettings['editorIndentUnit']; ?>, // how many spaces auto indent? (default: 2)
263  scrollbarStyle: null, // styling of the scrollbars
264  matchBrackets: <?php echo $editorSettings['editorMatchBrackets']; ?>, // highlight corresponding brackets
265  autoCloseBrackets: <?php echo $editorSettings['editorCloseBrackets'];?>, // auto insert close brackets
266  autoCloseTags: <?php echo $editorSettings['editorCloseTags']; ?>, // auto insert close tags after opening
267  value: "<html>\n " + document.documentElement.innerHTML + "\n</html>", // all html
268  mode: "htmlmixed", // editor mode
269  matchTags: {bothTags: <?php echo $editorSettings['editorMatchTags']; ?>}, // hightlight matching tags: both
270  extraKeys: {"Ctrl-J": "toMatchingTag", "Ctrl-Space": "autocomplete"}, // press ctrl-j to jump to next matching tab
271  styleActiveLine: <?php echo $editorSettings['editorActiveLine']; ?>, // highlight the active line (where the cursor is)
272  autoRefresh: true
273  },
274 
275  // plugin: summernote-cleaner.js
276  // this allows to copy/paste from word, browsers etc.
277  cleaner: { // does the job well: no messy code anymore!
278  action: 'both', // both|button|paste 'button' only cleans via toolbar button, 'paste' only clean when pasting content, both does both options.
279  newline: '<br>' // Summernote's default is to use '<p><br></p>'
280 
281  // silent mode:
282  // from my pov it is not necessary to notify the user about the code cleaning process.
283  // it throws just a useless, annoying bubble everytime you hit the save button.
284  // BUT: if you need this notification, you can enable it by uncommenting the following 3 lines
285  // notTime:2400, // Time to display notifications.
286  // notStyle:'position:absolute;bottom:0;left:2px', // Position of notification
287  // icon:'<i class="note-icon">[Your Button]</i>' // Display an icon
288  }
289  }); // end summernote
290 
291 
292  // INIT SUMMERNOTE 2 EDITOR
293  $('#summernote2').summernote({ // set editor itself
294  height: <?php echo $editorSettings['editorHeight']; ?>, // set editor height
295  minHeight: null, // set minimum height of editor
296  maxHeight: null, // set maximum height of editor
297  focus: false, // set focus to editable area after initializing summernote
298 
299  // popover tooltips
300  popover: {
301  image: [
302  ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']],
303  /* ['float', ['floatLeft', 'floatRight', 'floatNone']], // those are the old regular float buttons */
304  ['floatBS', ['floatBSLeft', 'floatBSNone', 'floatBSRight']], // bootstrap class buttons (float/pull)
305  ['custom', ['imageAttributes', 'imageShape']], // forked plugin: image-attributes.js
306  ['remove', ['removeMedia']]
307  ]
308  },
309  // language for plugin image-attributes.js
310  lang: '<?php echo $lang['CURRENT_LANGUAGE']; ?>',
311 
312  // powerup the codeview with codemirror theme
313  codemirror: { // codemirror options
314  theme: '<?php echo $editorSettings['editorTheme']; ?>', // codeview theme
315  lineNumbers: <?php echo $editorSettings['editorLineNumbers']; ?>, // display lineNumbers true|false
316  undoDepth: <?php echo $editorSettings['editorUndoDepth']; ?>, // how many undo steps should be saved? (default: 200)
317  smartIndent: <?php echo $editorSettings['editorSmartIndent']; ?>, // better indent
318  indentUnit: <?php echo $editorSettings['editorIndentUnit']; ?>, // how many spaces auto indent? (default: 2)
319  scrollbarStyle: null, // styling of the scrollbars
320  matchBrackets: <?php echo $editorSettings['editorMatchBrackets']; ?>, // highlight corresponding brackets
321  autoCloseBrackets: <?php echo $editorSettings['editorCloseBrackets'];?>, // auto insert close brackets
322  autoCloseTags: <?php echo $editorSettings['editorCloseTags']; ?>, // auto insert close tags after opening
323  value: "<html>\n " + document.documentElement.innerHTML + "\n</html>", // all html
324  mode: "htmlmixed", // editor mode
325  matchTags: {bothTags: <?php echo $editorSettings['editorMatchTags']; ?>}, // hightlight matching tags: both
326  extraKeys: {"Ctrl-J": "toMatchingTag", "Ctrl-Space": "autocomplete"}, // press ctrl-j to jump to next matching tab
327  styleActiveLine: <?php echo $editorSettings['editorActiveLine']; ?>, // highlight the active line (where the cursor is)
328  autoRefresh: true
329  },
330 
331  // plugin: summernote-cleaner.js
332  // this allows to copy/paste from word, browsers etc.
333  cleaner: { // does the job well: no messy code anymore!
334  action: 'both', // both|button|paste 'button' only cleans via toolbar button, 'paste' only clean when pasting content, both does both options.
335  newline: '<br>' // Summernote's default is to use '<p><br></p>'
336 
337  // silent mode:
338  // from my pov it is not necessary to notify the user about the code cleaning process.
339  // it throws just a useless, annoying bubble everytime you hit the save button.
340  // BUT: if you need this notification, you can enable it by uncommenting the following 3 lines
341  // notTime:2400, // Time to display notifications.
342  // notStyle:'position:absolute;bottom:0;left:2px', // Position of notification
343  // icon:'<i class="note-icon">[Your Button]</i>' // Display an icon
344  }
345  }); // end summernote
346  }); // end document ready
347 </script>
348 
349 <!-- bootstrap date-timepicker -->
350 <link type="text/css" href="../system/engines/datetimepicker/css/datetimepicker.min.css" rel="stylesheet"/>
351 <script type="text/javascript" src="../system/engines/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
352 <script type="text/javascript">
353  /* start own JS bootstrap function
354  ...on document ready... letsego! */
355  $(document).ready(function () {
356  $('#datetimepicker1').datetimepicker({
357  format: 'YYYY-MM-DD HH:mm:ss'
358  });
359  $('#datetimepicker2').datetimepicker({
360  format: 'YYYY-MM-DD HH:mm:ss'
361  });
362  });//]]> /* END document.ready */
363  /* ...end admin jQ controlls */
364 </script>
365 <!-- end datetimepicker -->
366 
367 <?php
368 $blog->icon = $blog->getBlogProperty($db, $blog->blogid, "icon");
369 $blog->name = $blog->getBlogProperty($db, $blog->blogid, "name");
370 $blog->layout = $blog->getBlogProperty($db, $blog->blogid, "layout");
371 /* draw Title on top */
372 
373 ?>
374 
375 <form name="form" role="form"
376  action="index.php?plugin=blog&pluginpage=blog-edit&blogid=<?php print $blog->blogid; ?>&itemid=<?php print $blog->itemid; ?>"
377  method="post">
378 
379  <div class="row">
380  <div class="col-md-9">
381  <label for="blogtitle"><?php print $lang['TITLE']; ?></label>
382  <input type="text"
383  class="form-control input-lg"
384  id="blogtitle"
385  name="blogtitle"
386  value="<?php print $blog->blogtitle; ?>">
387  <br>
388  <?php
389  if ($blog->teaser !== "0")
390  {
391  echo "
392  <!-- EDITOR -->
393  <label for=\"summernote\">$lang[TEASER_TEXT]</label>
394  <textarea
395  id=\"summernote\"
396  class=\"form-control\"
397  style=\"margin-top:10px;\"
398  name=\"teasertext\">".$blog->teasertext."</textarea>";
399  }
400  ?>
401  <!-- EDITOR -->
402  <label for="summernote2"><?php echo $lang['BLOG_TEXT']; ?></label>
403 
404  <textarea
405  id="summernote2"
406  class="form-control"
407  style="margin-top:10px;"
408  name="blogtext"
409  cols="50"
410  rows="18"><?php print $blog->blogtext; ?></textarea>
411  </div> <!-- end left col -->
412 
413  <div class="col-md-3">
414  <!-- right col -->
415  <!-- SAVE BUTTON -->
416  <button type="submit"
417  id="savebutton"
418  name="save"
419  class="btn btn-success pull-right">
420  <i id="savebuttonIcon" class="fa fa-check"></i> &nbsp;<?php print $lang['SAVE_CHANGES']; ?>
421  </button>
422 
423  <!-- CANCEL BUTTON -->
424  <a class="btn btn-default pull-right" href="index.php?plugin=blog&pluginpage=blog-entries&blogid=<?php echo $_GET['blogid']; ?>">
425  <i id="cancelbuttonIcon" class="fa fa-backward"></i> &nbsp;<?php print $lang['BACK']; ?>
426  </a>
427 
428  <br><br><br>
429 
430  <?php
431  // SETTINGS: filename + subtitle
432  $header = "<i class=\"fa fa-file-text-o\"></i>&nbsp; $lang[SETTINGS] <small>$lang[TITLE] &amp; $lang[FILENAME]</small>";
433  $content = "<label for=\"filename\">$lang[FILENAME]</label><br>
434  <input type=\"text\"
435  class=\"form-control\"
436  name=\"filename\"
437  id=\"filename\"
438  size=\"64\"
439  maxlength=\"255\"
440  value=\"$blog->filename\">
441  <label for=\"subtitle\">$lang[SUBTITLE]</label><br>
442  <input type=\"text\"
443  class=\"form-control\"
444  name=\"subtitle\"
445  id=\"subtitle\"
446  size=\"64\"
447  maxlength=\"255\"
448  value=\"$blog->subtitle\">";
449  echo AdminLTE::drawCollapsableBox($header, $content);
450  ?>
451 
452  <!-- PUBLISHING -->
453  <div class="box box-default">
454  <div class="box-header with-border">
455  <h3 class="box-title"><i class="fa fa-clock-o"></i>
456  &nbsp;<?php echo "$lang[PUBLISHING] <small>$lang[EFFECTIVE_TIME] &amp; $lang[PRIVACY]</small>"; ?>
457  </h3>
458  <!-- box-tools -->
459  <div class="box-tools pull-right">
460  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
461  </button>
462  </div>
463  <!-- /.box-tools -->
464  </div>
465  <!-- /.box-header -->
466  <div class="box-body" style="display: block;">
467 
468  <!-- start publish datetimepicker -->
469  <label for="datetimepicker1"><i class="fa fa-calendar"></i> <?php print $lang['START_PUBLISH']; ?></label><br>
470  <input
471  class="form-control"
472  id="datetimepicker1"
473  type="text"
474  name="date_publish"
475  maxlength="19"
476  value="<?php print $blog->date_publish; ?>">
477 
478  <!-- end publish datetimepicker -->
479  <label for="datetimepicker2"><i class="fa fa-ban"></i> <?php print $lang['END_PUBLISH']; ?></label><br>
480  <input
481  type="text"
482  class="form-control"
483  id="datetimepicker2"
484  name="date_unpublish"
485  maxlength="19"
486  value="<?php print $blog->date_unpublish; ?>">
487 
488  <!-- group id selector -->
489  <label for="gidselect"><i class="fa fa-users"></i> <?php print $lang['PAGE_VISIBLE']; ?></label>
490  <select id="gidselect" name="itemgid" class="form-control">
491  <option value="<?php print \YAWK\sys::getGroupId($db, $blog->pageid, "pages"); ?>" selected><?php print \YAWK\user::getGroupNameFromID($db, $blog->itemgid); ?></option>
492  <?php
493  foreach(YAWK\sys::getGroups($db, "pages") as $role) {
494  print "<option value=\"".$role['id']."\"";
495  if (isset($_POST['gid'])) {
496  if($_POST['gid'] === $role['id']) {
497  print " selected=\"selected\"";
498  }
499  else if($blog->itemgid === $role['id'] && !$_POST['itemgid']) {
500  print " selected=\"selected\"";
501  }
502  }
503  print ">".$role['value']."</option>";
504  }
505  ?>
506  </select>
507 
508  <!-- PAGE ON / OFF STATUS -->
509  <label for="published"><i class="fa fa-eye"></i> <?php print $lang['ENTRY'];print"&nbsp;";print $lang['ONLINE']; ?></label><br>
510  <?php if($blog->published == 1){
511  $publishedHtml = "<option value=\"1\" selected=\"selected\">$lang[ONLINE]</option>";
512  $publishedHtml .= "<option value=\"0\" >$lang[OFFLINE]</option>";
513  } else {
514  $publishedHtml = "<option value=\"0\" selected=\"selected\">$lang[OFFLINE]</option>";
515  $publishedHtml .= "<option value=\"1\" >$lang[ONLINE]</option>";
516  } ?>
517  <select id="published" name="published" class="form-control">
518  <?php echo $publishedHtml; ?>
519  </select>
520  </div>
521  <!-- /.box-body -->
522  </div>
523 
524  <!-- META TAGS -->
525  <div class="box box-default">
526  <div class="box-header with-border">
527  <h3 class="box-title"><i class="fa fa-google"></i>&nbsp;&nbsp;<?php echo "$lang[META_TAGS] <small>$lang[SEO]"; ?></h3>
528  <!-- box-tools -->
529  <div class="box-tools pull-right">
530  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
531  </button>
532  </div>
533  <!-- /.box-tools -->
534  </div>
535  <!-- /.box-header -->
536  <div class="box-body" style="display: block;">
537  <!-- LOCAL META SITE DESCRIPTION -->
538  <label for="meta_local"><?php echo "$lang[META_DESC]"; ?></label><br>
539  <textarea cols="64"
540  rows="2"
541  id="meta_local"
542  class="form-control"
543  maxlength="255"
544  placeholder="<?php echo "$lang[PAGE_DESC_PLACEHOLDER]"; ?>"
545  name="meta_local"><?php print $blog->meta_local ?>
546  </textarea>
547  <!-- LOCAL META SITE KEYWORDS -->
548  <label for="meta_keywords"><?php echo "$lang[META_KEYWORDS]"; ?></label>
549  <input type="text"
550  size="64"
551  id="meta_keywords"
552  class="form-control"
553  placeholder="<?php echo "$lang[KEYWORD] 1, $lang[KEYWORD] 2, $lang[KEYWORD] 3..."; ?>"
554  name="meta_keywords"
555  value="<?php print $blog->meta_keywords; ?>">
556  </div>
557  <!-- /.box-body -->
558  </div>
559 
560  <!-- blog thumbnail -->
561  <div class="box box-default">
562  <div class="box-header with-border">
563  <h3 class="box-title"><i class="fa fa-photo"></i>&nbsp;&nbsp;<?php echo "$lang[TEASER] <small>$lang[TEASER_IMG]</small>"; ?></h3>
564  <!-- box-tools -->
565  <div class="box-tools pull-right">
566  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
567  </button>
568  </div>
569  <!-- /.box-tools -->
570  </div>
571  <!-- /.box-header -->
572  <div class="box-body" style="display: block;">
573  <!-- THUMBNAIL IMAGE -->
574  <label for="thumbnail"><?php print $lang['THUMBNAIL']; ?>&nbsp;</label><br>
575  <input
576  type="text"
577  class="form-control"
578  id="thumbnail"
579  name="thumbnail"
580  size="64"
581  maxlength="255"
582  placeholder="media/images/anyfile.jpg"
583  value="<?php print $blog->thumbnail; ?>">
584  <label for="thumbnail"><i class="fa fa-youtube"></i> &nbsp;<?php print $lang['YOUTUBEURL']; ?>&nbsp;</label><br>
585  <!-- YouTube Link -->
586  <input
587  type="text"
588  class="form-control"
589  id="youtubeUrl"
590  name="youtubeUrl"
591  size="64"
592  maxlength="255"
593  placeholder="https://www.youtube.com/embed/1A2B3C4D5E6F"
594  value="<?php print $blog->youtubeUrl; ?>">
595  </div>
596  <!-- /.box-body -->
597  </div>
598 
599  <!-- blog thumbnail -->
600  <div class="box box-default">
601  <div class="box-header with-border">
602  <h3 class="box-title"><i class="fa fa-bars"></i>&nbsp;&nbsp;<?php echo "$lang[SUBMENU] <small>$lang[SUBMENU_SUBTEXT]</small>"; ?></h3>
603  <!-- box-tools -->
604  <div class="box-tools pull-right">
605  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
606  </button>
607  </div>
608  <!-- /.box-tools -->
609  </div>
610  <!-- /.box-header -->
611  <div class="box-body" style="display: block;">
612  <!-- SUB MENU SELECTOR -->
613  <label for="menu"><?php echo $lang['SUBMENU']; ?></label>
614  <select name="menu" class="form-control">
615  <option value="<?php print \YAWK\sys::getSubMenu($db, $page->id); ?>"><?php print \YAWK\sys::getMenuItem($db, $page->id); ?></option>
616  <option value="0"><?php echo $lang['NO_MENU_SELECTED']; ?></option>
617  <?php
618  foreach(YAWK\sys::getMenus($db) as $menue){
619  print "<option value=\"".$menue['id']."\"";
620  if (isset($_POST['menu'])) {
621  if($_POST['menu'] === $menue['id']){
622  print " selected=\"selected\"";
623  }
624  else if($page->menu === $menue['id'] && !$_POST['menu']){
625  print " selected=\"selected\"";
626  }
627  }
628  print ">".$menue['name']."</option>";
629  }
630  ?>
631  </select>
632  </div>
633  <!-- /.box-body -->
634  </div>
635 
636 
637  <!-- blog thumbnail -->
638  <div class="box box-default">
639  <div class="box-header with-border">
640  <h3 class="box-title"><i class="fa fa-object-ungroup"></i>&nbsp;&nbsp;<?php echo "$lang[LAYOUT] <small>$lang[AND] $lang[COMMENTS]</small>"; ?></h3>
641  <!-- box-tools -->
642  <div class="box-tools pull-right">
643  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
644  </button>
645  </div>
646  <!-- /.box-tools -->
647  </div>
648  <!-- /.box-header -->
649  <div class="box-body" style="display: block;">
650  <!-- LAYOUT -->
651  <label for="itemlayout"><?php print $lang['LAYOUT']; ?>&nbsp;</label><br>
652  <select name="itemlayout" id="itemlayout" class="form-control"><?php
655  $layouts = array(
656  "-1" => "$lang[BLOG_SETTING]",
657  "0" => "$lang[BLOG_LAYOUT_1COL_TEXTBLOG]",
658  "1" => "$lang[BLOG_LAYOUT_2COL_TEASER_L]",
659  "2" => "$lang[BLOG_LAYOUT_2COL_TEASER_R]",
660  "3" => "$lang[BLOG_LAYOUT_3COL_NEWSPAPER]",
661  "4" => "$lang[BLOG_LAYOUT_1COL_YOUTUBE]");
662  foreach ($layouts as $id => $layout)
663  {
664  if ($blog->itemlayout == $id)
665  {
666  $currentLayout = "
667  <option value=\"$blog->layout\">$layout</option>";
668  }
669  else
670  {
671  $layoutOptions .= "
672  <option value=\"$id\">$layout</option>";
673  }
674  }
675  // load option w current value
676  echo $currentLayout.$layoutOptions;
677  ?>
678 
679  </select>
680  <label for="itemcomments"><i class="fa fa-comment-o"></i> &nbsp;<?php print $lang['COMMENTS']; ?>&nbsp;</label><br>
681  <!-- Comment Settings -->
682  <select name="itemcomments" id="itemcomments" class="form-control">
683  <option value="-1"><?php echo $lang['BLOG_SETTING']; ?></option>
684  <option value="1"><?php echo $lang['COMMENTS_ALLOWED']; ?></option>
685  <option value="0"><?php echo $lang['COMMENTS_FORBIDDEN']; ?></option>
686  </select>
687  <label for="teaser"><i class="fa fa-newspaper-o"></i> &nbsp;<?php print $lang['TEASER']."&nbsp;".$lang['TEXT']; ?>&nbsp;</label><br>
688  <!-- Teaser Settings -->
689  <select name="teaser" id="teaser" class="form-control">
690  <?php
691  if ($blog->teaser === '1')
692  {
693  echo '<option value="1" selected aria-selected="true">'.$lang['ENABLED'].'</option>';
694  echo '<option value="0">'.$lang['DISABLED'].'</option>';
695  }
696  else
697  {
698  echo '<option value="0" selected aria-selected="true">'.$lang['DISABLED'].'</option>';
699  echo '<option value="1">'.$lang['ENABLED'].'</option>';
700  }
701  ?>
702  </select>
703  </div>
704  <!-- /.box-body -->
705  </div>
706  <!-- /. ADDITIONAL BOXES-->
707 
708  <!-- HIDDEN FIELDS -->
709  <input type="hidden" name="blogid" value="<?php print $blog->blogid; ?>">
710  <input type="hidden" name="itemid" value="<?php print $blog->itemid; ?>">
711  <input type="hidden" name="pageid" value="<?php print $blog->pageid; ?>">
712  <input type="hidden" name="oldteasertext" value="<?php print $blog->teasertext; ?>">
713 
714  </div>
715  </div>
716 </form>
$blog
Definition: blog.php:122
$layoutOptions
Definition: blog-edit.php:653
$dirprefix
Definition: blog-edit.php:90
print & nbsp
Definition: blog-edit.php:509
$blog name
Definition: blog-edit.php:369
$header
Definition: blog-edit.php:432
$content
Definition: blog-edit.php:433
$currentLayout
Definition: blog-edit.php:654
$host
Definition: blog-edit.php:92
$publishedHtml
Definition: blog-edit.php:515
$editorSettings
Definition: blog-edit.php:136
print $lang['TITLE']
Definition: blog-edit.php:381
$layouts
Definition: blog-edit.php:655
print $blog thumbnail
Definition: blog-edit.php:583
Backend class serves a few useful functions for the admin backend.
Definition: AdminLTE.php:23
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
Mysqli database class; returns db connection object.
Definition: db.php:16
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
Settings class: get and set YaWK system settings.
Definition: settings.php:9
static getDirPrefix($db)
if yawk is installed into a subdirectory, use this to get this prefix directory
Definition: sys.php:1104
static getHost($db)
get hostname (url where yawk is installed) from database
Definition: sys.php:1115
if(!isset($db)) $id
function window
Definition: fuckAdBlock.js:8
function a
Definition: browser.js:14
c jPlayer event
type
Definition: menu-new.php:35
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $_GET['id']
Definition: page-edit.php:357
$page
Definition: pages.php:355
if(isset($_POST['sent'])) $layout
Definition: signup.php:98
function i(e, t)
Definition: plyr.js:1
function g(e, t, n, r)
Definition: plyr.js:1
print $tourdates date
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);});})