7 use YAWK\PLUGINS\BLOG\blog;
10 include
'../system/classes/editor.php';
11 include
'../system/plugins/blog/classes/blog.php';
15 if (!isset($language) || (!isset(
$lang)))
17 $lang = language::inject(@
$lang,
"../system/plugins/blog/language/");
23 if (isset($_POST[
'create']) && isset($_POST[
'blogid']))
26 $blog->blogid =
$db->quote($_POST[
'blogid']);
27 $blog->title =
$db->quote($_POST[
'title']);
28 $blog->subtitle =
$db->quote($_POST[
'subtitle']);
29 $blog->published =
$db->quote($_POST[
'published']);
30 $blog->teasertext =
$db->quote($_POST[
'teasertext']);
31 $blog->blogtext =
$db->quote($_POST[
'blogtext']);
32 $blog->date_publish =
$db->quote($_POST[
'date_publish']);
33 $blog->date_unpublish =
$db->quote($_POST[
'date_unpublish']);
34 $blog->thumbnail =
$db->quote($_POST[
'thumbnail']);
35 $blog->youtubeUrl =
$db->quote($_POST[
'youtubeUrl']);
36 $blog->weblink =
$db->quote($_POST[
'weblink']);
37 $blog->meta_local =
"Meta Tag Description";
38 $blog->meta_keywords =
"Keyword 1, Keyword2, ...";
40 if (
$blog->createItem(
$db,
$blog->blogid,
$blog->title,
$blog->subtitle,
$blog->published,
$blog->teasertext,
$blog->blogtext,
$blog->date_publish,
$blog->date_unpublish,
$blog->thumbnail,
$blog->youtubeUrl,
$blog->weblink,
$blog->meta_local,
$blog->meta_keywords)) {
42 alert::draw(
"success",
"$lang[SUCCESS]",
"$blog->title $lang[SAVED]",
"plugin=blog&pluginpage=blog-entries&blogid=".
$blog->blogid.
"", 1200);
43 sys::setSyslog(
$db, 5, 0,
"blog item $blog->title saved", 0, 0, 0, 0);
47 alert::draw(
"danger",
"$lang[ERROR]",
"$lang[BLOG_ADD_ITEM_FAILED]",
"",
"3800");
48 sys::setSyslog(
$db, 7, 1,
"unable to save blog item $blog->title", 0, 0, 0, 0);
56 <!-- bootstrap
date-timepicker -->
57 <link
type=
"text/css" href=
"../system/engines/datetimepicker/css/datetimepicker.min.css" rel=
"stylesheet"/>
58 <script
type=
"text/javascript" src=
"../system/engines/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
60 <script
type=
"text/javascript">
63 $(document).
ready(
function () {
65 $(
'#datetimepicker1').datetimepicker({
66 format:
'YYYY-MM-DD HH:mm:ss'
69 $(
'#datetimepicker2').datetimepicker({
70 format:
'YYYY-MM-DD HH:mm:ss'
76 <!-- end datetimepicker -->
81 <!-- Content Wrapper. Contains page content -->
82 <div class=\"content-wrapper\" id=\"content-FX\">
83 <!-- Content Header (Page header) -->
84 <section class=\"content-header\">";
87 echo
"<ol class=\"breadcrumb\">
88 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
89 <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
90 <li><a href=\"index.php?plugin=blog\" title=\"$lang[BLOG]\"> $lang[BLOG]</a></li>
91 <li class=\"active\"><a href=\"index.php?plugin=blog&pluginpage=blog-newitem\" title=\"$lang[ADD_ENTRY]\"> $lang[ADD_ENTRY]</a></li>
95 <section class=\"content\">";
102 <!-- include summernote css/js-->
103 <!-- include codemirror (codemirror.css, codemirror.js, xml.js) -->
104 <link rel=
"stylesheet" type=
"text/css" href=
"../system/engines/codemirror/codemirror.min.css">
105 <link rel=
"stylesheet" type=
"text/css" href=
"../system/engines/codemirror/themes/<?php echo $editorSettings['editorTheme']; ?>.css">
106 <link rel=
"stylesheet" type=
"text/css" href=
"../system/engines/codemirror/show-hint.min.css">
107 <script
type=
"text/javascript" src=
"../system/engines/codemirror/codemirror-compressed.js"></script>
108 <script
type=
"text/javascript" src=
"../system/engines/codemirror/auto-refresh.js"></script>
111 <link href=
"../system/engines/summernote/dist/summernote.css" rel=
"stylesheet">
112 <script src=
"../system/engines/summernote/dist/summernote.min.js"></script>
113 <script src=
"../system/engines/summernote/dist/summernote-cleaner.js"></script>
114 <script src=
"../system/engines/summernote/dist/summernote-image-attributes.js"></script>
115 <script src=
"../system/engines/summernote/dist/summernote-floats-bs.js"></script>
116 <script
type=
"text/javascript">
117 $(document).
ready(
function() {
119 var editor = (
'textarea#summernote');
120 var editor2 = (
'textarea#summernote2');
121 var savebutton = (
'#savebutton');
122 var savebuttonIcon = (
'#savebuttonIcon');
125 $(savebutton).click(
function() {
126 $(savebutton).removeClass(
'btn btn-success').addClass(
'btn btn-warning');
127 $(savebuttonIcon).removeClass(
'fa fa-check').addClass(
'fa fa-spinner fa-spin fa-fw');
130 if ($(editor).summernote(
'codeview.isActivated')) {
132 $(editor).summernote(
'codeview.deactivate');
135 if ($(editor2).summernote(
'codeview.isActivated')) {
137 $(editor2).summernote(
'codeview.deactivate');
143 if ( $(editor).length) {
144 var text = $(editor).val();
146 var frontend = text.replace(/<img src=\x22..\/media/
g,
"<img src=\x22media");
148 $(editor).val(frontend);
151 if ( $(editor2).length) {
153 var text2 = $(editor2).val();
155 var frontend2 = text2.replace(/<img src=\x22..\/media/
g,
"<img src=\x22media");
157 $(editor2).val(frontend2);
166 if ( $(editor).length) {
167 var text = $(editor).val();
169 var backend = text.replace(/<img src=\
"media/g, "<img src=\
"../media");
171 $(editor).val(backend);
174 if ( $(editor2).length) {
176 var text2 = $(editor2).val();
178 var backend2 = text2.replace(/<img src=\
"media/g, "<img src=\
"../media");
180 $(editor2).val(backend2);
188 echo
"$(editor).on('summernote.init', function() {
189 // toggle editor to codeview
190 $(editor).summernote('codeview.toggle');
192 echo
"$(editor2).on('summernote.init', function() {
193 // toggle editor to codeview
194 $(editor2).summernote('codeview.toggle');
200 $(
'#summernote').summernote({
209 [
'imagesize', [
'imageSize100',
'imageSize50',
'imageSize25']],
211 [
'floatBS', [
'floatBSLeft',
'floatBSNone',
'floatBSRight']],
212 [
'custom', [
'imageAttributes',
'imageShape']],
213 [
'remove', [
'removeMedia']]
217 lang:
'<?php echo $lang['CURRENT_LANGUAGE
']; ?>',
221 theme:
'<?php echo $editorSettings['editorTheme
']; ?>',
226 scrollbarStyle:
null,
228 autoCloseBrackets: <?php echo
$editorSettings[
'editorCloseBrackets'];?>,
230 value:
"<html>\n " + document.documentElement.innerHTML +
"\n</html>",
232 matchTags: {bothTags: <?php echo
$editorSettings[
'editorMatchTags']; ?>},
233 extraKeys: {
"Ctrl-J":
"toMatchingTag",
"Ctrl-Space":
"autocomplete"},
256 $(
'#summernote2').summernote({
265 [
'imagesize', [
'imageSize100',
'imageSize50',
'imageSize25']],
267 [
'floatBS', [
'floatBSLeft',
'floatBSNone',
'floatBSRight']],
268 [
'custom', [
'imageAttributes',
'imageShape']],
269 [
'remove', [
'removeMedia']]
273 lang:
'<?php echo $lang['CURRENT_LANGUAGE
']; ?>',
277 theme:
'<?php echo $editorSettings['editorTheme
']; ?>',
282 scrollbarStyle:
null,
284 autoCloseBrackets: <?php echo
$editorSettings[
'editorCloseBrackets'];?>,
286 value:
"<html>\n " + document.documentElement.innerHTML +
"\n</html>",
288 matchTags: {bothTags: <?php echo
$editorSettings[
'editorMatchTags']; ?>},
289 extraKeys: {
"Ctrl-J":
"toMatchingTag",
"Ctrl-Space":
"autocomplete"},
311 <form
name=
"form" role=
"form" action=
"index.php?plugin=blog&pluginpage=blog-newitem" method=
"post">
314 <div
class=
"col-md-9">
315 <label
for=
"blogtitle"><?php print
$lang[
'TITLE']; ?></label>
317 class=
"form-control input-lg"
321 <?php
if (
$blog->layout !==
"0")
325 <label for=\"summernote\">$lang[TEASER_TEXT]</label>
328 class=\"form-control\"
329 style=\"margin-top:10px;\"
330 name=\"teasertext\"></textarea>";
334 <label
for=
"summernote2"><?php echo
$lang[
'BLOG_TEXT']; ?></label>
338 style=
"margin-top:10px;"
341 rows=
"18"></textarea>
342 </div> <!-- end left col -->
344 <div
class=
"col-md-3">
347 <button
type=
"submit"
350 class=
"btn btn-success pull-right">
351 <
i id=
"savebuttonIcon" class=
"fa fa-check"></
i> &
nbsp;<?php print
$lang[
'ADD_ENTRY']; ?>
354 <!-- CANCEL BUTTON -->
355 <
a class=
"btn btn-default pull-right" href=
"index.php?plugin=blog&pluginpage=blog-entries&blogid=<?php echo $_GET['blogid']; ?>">
356 <
i id=
"cancelbuttonIcon" class=
"fa fa-backward"></
i> &
nbsp;<?php print
$lang[
'BACK']; ?>
363 $header =
"<i class=\"fa fa-file-text-o\"></i> $lang[SETTINGS] <small>$lang[TITLE] & $lang[FILENAME]</small>";
364 $content =
"<label for=\"filename\">$lang[FILENAME]</label><br>
366 class=\"form-control\"
371 <label for=\"subtitle\">$lang[SUBTITLE]</label><br>
373 class=\"form-control\"
382 <div
class=
"box box-default">
383 <div
class=
"box-header with-border">
384 <h3
class=
"box-title"><
i class=
"fa fa-clock-o"></
i>
385 &
nbsp;<?php echo
"$lang[PUBLISHING] <small>$lang[EFFECTIVE_TIME] & $lang[PRIVACY]</small>"; ?>
388 <div
class=
"box-tools pull-right">
389 <button
type=
"button" class=
"btn btn-box-tool" data-widget=
"collapse"><
i class=
"fa fa-minus"></
i>
394 <!-- /.box-header -->
395 <div
class=
"box-body" style=
"display: block;">
397 <!-- start publish datetimepicker -->
398 <label
for=
"datetimepicker1"><
i class=
"fa fa-calendar"></
i> <?php print
$lang[
'START_PUBLISH']; ?></label><br>
405 value=
"<?php echo date("Y-
m-
d H:
i:
s"); ?>"
407 <!-- end publish datetimepicker -->
408 <label
for=
"datetimepicker2"><
i class=
"fa fa-ban"></
i> <?php print
$lang[
'END_PUBLISH']; ?></label><br>
413 name=
"date_unpublish"
417 <!-- group
id selector -->
418 <label
for=
"gidselect"><
i class=
"fa fa-users"></
i> <?php print
$lang[
'PAGE_VISIBLE']; ?></label>
419 <select
id=
"gidselect" name=
"itemgid" class=
"form-control">
421 foreach(
YAWK\sys::getGroups(
$db,
"pages") as $role) {
422 print
"<option value=\"".$role[
'id'].
"\"";
423 if (isset($_POST[
'gid'])) {
424 if($_POST[
'gid'] === $role[
'id']) {
425 print
" selected=\"selected\"";
427 else if(
$blog->itemgid === $role[
'id'] && !$_POST[
'itemgid']) {
428 print
" selected=\"selected\"";
431 print
">".$role[
'value'].
"</option>";
436 <!-- PAGE ON / OFF STATUS -->
437 <label
for=
"published"><
i class=
"fa fa-eye"></
i> <?php print
$lang[
'ENTRY'];print
" ";print
$lang[
'ONLINE']; ?></label><br>
438 <?php
if(
$blog->published == 1){
439 $publishedHtml =
"<option value=\"1\" selected=\"selected\">$lang[ONLINE]</option>";
442 $publishedHtml =
"<option value=\"0\" selected=\"selected\">$lang[OFFLINE]</option>";
445 <select
id=
"published" name=
"published" class=
"form-control">
453 <div
class=
"box box-default">
454 <div
class=
"box-header with-border">
455 <h3
class=
"box-title"><
i class=
"fa fa-google"></
i>&
nbsp;&
nbsp;<?php echo
"$lang[META_TAGS] <small>$lang[SEO]"; ?></h3>
457 <div
class=
"box-tools pull-right">
458 <button
type=
"button" class=
"btn btn-box-tool" data-widget=
"collapse"><
i class=
"fa fa-minus"></
i>
463 <!-- /.box-header -->
464 <div
class=
"box-body" style=
"display: block;">
465 <!-- LOCAL META SITE DESCRIPTION -->
466 <label
for=
"metadescription"><?php echo
"$lang[META_DESC]"; ?></label><br>
472 placeholder=
"<?php echo "$lang[PAGE_DESC_PLACEHOLDER]
"; ?>"
473 name=
"metadescription"></textarea>
474 <!-- LOCAL META SITE KEYWORDS -->
475 <label
for=
"metakeywords"><?php echo
"$lang[META_KEYWORDS]"; ?></label>
480 placeholder=
"<?php echo "$lang[KEYWORD] 1,
$lang[KEYWORD] 2,
$lang[KEYWORD] 3...
"; ?>"
487 <div
class=
"box box-default">
488 <div
class=
"box-header with-border">
489 <h3
class=
"box-title"><
i class=
"fa fa-photo"></
i>&
nbsp;&
nbsp;<?php echo
"$lang[TEASER] <small>$lang[TEASER_IMG]</small>"; ?></h3>
491 <div
class=
"box-tools pull-right">
492 <button
type=
"button" class=
"btn btn-box-tool" data-widget=
"collapse"><
i class=
"fa fa-minus"></
i>
497 <!-- /.box-header -->
498 <div
class=
"box-body" style=
"display: block;">
499 <!-- THUMBNAIL IMAGE -->
500 <label
for=
"thumbnail"><?php print
$lang[
'THUMBNAIL']; ?>&
nbsp;</label><br>
508 placeholder=
"media/images/anyfile.jpg">
509 <label
for=
"thumbnail"><
i class=
"fa fa-youtube"></
i> &
nbsp;<?php print
$lang[
'YOUTUBEURL']; ?>&
nbsp;</label><br>
510 <!-- YouTube Link -->
518 placeholder=
"https://www.youtube.com/embed/1A2B3C4D5E6F">
524 <div
class=
"box box-default">
525 <div
class=
"box-header with-border">
526 <h3
class=
"box-title"><
i class=
"fa fa-bars"></
i>&
nbsp;&
nbsp;<?php echo
"$lang[SUBMENU] <small>$lang[SUBMENU_SUBTEXT]</small>"; ?></h3>
528 <div
class=
"box-tools pull-right">
529 <button
type=
"button" class=
"btn btn-box-tool" data-widget=
"collapse"><
i class=
"fa fa-minus"></
i>
534 <!-- /.box-header -->
535 <div
class=
"box-body" style=
"display: block;">
536 <!-- SUB MENU SELECTOR -->
537 <label
for=
"menu"><?php echo
$lang[
'SUBMENU']; ?></label>
538 <select
name=
"menu" class=
"form-control">
539 <option value=
"0"><?php echo
$lang[
'NO_MENU_SELECTED']; ?></option>
542 print
"<option value=\"".$menue[
'id'].
"\"";
543 if (isset($_POST[
'menu'])) {
544 if($_POST[
'menu'] === $menue[
'id']){
545 print
" selected=\"selected\"";
547 else if(
$page->menu === $menue[
'id'] && !$_POST[
'menu']){
548 print
" selected=\"selected\"";
551 print
">".$menue[
'name'].
"</option>";
561 <div
class=
"box box-default">
562 <div
class=
"box-header with-border">
563 <h3
class=
"box-title"><
i class=
"fa fa-object-ungroup"></
i>&
nbsp;&
nbsp;<?php echo
"$lang[LAYOUT] <small>$lang[AND] $lang[COMMENTS]</small>"; ?></h3>
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>
571 <!-- /.box-header -->
572 <div
class=
"box-body" style=
"display: block;">
574 <label
for=
"itemlayout"><?php print
$lang[
'LAYOUT']; ?>&
nbsp;</label><br>
575 <select
name=
"itemlayout" id=
"itemlayout" class=
"form-control">
576 <option value=
"-1"><?php echo
$lang[
'BLOG_SETTING']; ?></option>
577 <option value=
"0"><?php echo
$lang[
'BLOG_LAYOUT_1COL_TEXTBLOG']; ?></option>
578 <option value=
"1"><?php echo
$lang[
'BLOG_LAYOUT_2COL_TEASER_L']; ?></option>
579 <option value=
"2"><?php echo
$lang[
'BLOG_LAYOUT_2COL_TEASER_R']; ?></option>
580 <option value=
"3"><?php echo
$lang[
'BLOG_LAYOUT_3COL_NEWSPAPER']; ?></option>
581 <option value=
"4"><?php echo
$lang[
'BLOG_LAYOUT_1COL_YOUTUBE']; ?></option>
585 <label
for=
"itemcomments"><
i class=
"fa fa-comment-o"></
i> &
nbsp;<?php print
$lang[
'COMMENTS']; ?>&
nbsp;</label><br>
586 <select
name=
"itemcomments" id=
"itemcomments" class=
"form-control">
587 <option value=
"-1"><?php echo
$lang[
'BLOG_SETTING']; ?></option>
588 <option value=
"1"><?php echo
$lang[
'COMMENTS_ALLOWED']; ?></option>
589 <option value=
"0"><?php echo
$lang[
'COMMENTS_FORBIDDEN']; ?></option>
594 <!-- /. ADDITIONAL BOXES-->
596 if (!isset(
$_GET[
'blogid']))
608 <!-- HIDDEN FIELDS -->
609 <input
type=
"hidden" name=
"create" value=
"1">
610 <input
type=
"hidden" name=
"blogid" value=
"<?php print $blog->id; ?>">
611 <input
type=
"hidden" name=
"itemid" value=
"<?php print $blog->itemid; ?>">
612 <input
type=
"hidden" name=
"pageid" value=
"<?php print $blog->pageid; ?>">
613 <input
type=
"hidden" name=
"oldteasertext" value=
"<?php print $blog->teasertext; ?>">
Backend class serves a few useful functions for the admin backend.
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Mysqli database class; returns db connection object.
The language class - support multilingual backend.
static getEditorSettings($db, $typeID=0)
Returns an associative array containing the editor settings.
The sys class - handles yawk's system core functions.
This class serves methods to create backup from files.
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 ö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);});})