14 if (!isset($template)) { $template =
new template(); }
17 if (isset($_POST[
'save']) && (isset(
$_GET[
'action']) && (isset(
$_GET[
'id']))))
19 if (isset($_POST) && (!empty($_POST)))
21 if (isset(
$_GET[
'action']))
26 if (
$_GET[
'action'] ===
"template-customjs")
28 if (isset($_POST[
'customJS']) && (!empty($_POST[
'customJS'])))
31 $template->setCustomJsFile(
$db, $_POST[
'customJS'], 0,
$_GET[
'id']);
33 $template->setCustomJsFile(
$db, $_POST[
'customJS'], 1,
$_GET[
'id']);
44 <!-- include summernote css/js-->
45 <!-- include codemirror (codemirror.css, codemirror.js, xml.js) -->
46 <link rel=
"stylesheet" type=
"text/css" href=
"../system/engines/codemirror/codemirror.min.css">
47 <link rel=
"stylesheet" type=
"text/css" href=
"../system/engines/codemirror/themes/<?php echo $editorSettings['editorTheme']; ?>.css">
48 <link rel=
"stylesheet" type=
"text/css" href=
"../system/engines/codemirror/show-hint.min.css">
49 <script
type=
"text/javascript" src=
"../system/engines/codemirror/codemirror-compressed.js"></script>
50 <script
type=
"text/javascript" src=
"../system/engines/codemirror/auto-refresh.js"></script>
53 <link href=
"../system/engines/summernote/dist/summernote.css" rel=
"stylesheet">
54 <script src=
"../system/engines/summernote/dist/summernote.min.js"></script>
55 <script src=
"../system/engines/summernote/dist/summernote-cleaner.js"></script>
57 <script
type=
"text/javascript">
58 $(document).
ready(
function() {
60 function saveHotkey() {
63 if (!(
event.which === 115 && (navigator.platform.match(
"Mac") ?
event.metaKey :
event.ctrlKey)) && !(
event.which === 19))
return true;
64 $(
'#savebutton').click();
65 event.preventDefault();
70 $(document).keydown(
function (
event) {
71 if (
event.which === 83 && (navigator.platform.match(
"Mac") ?
event.metaKey :
event.ctrlKey)) {
72 event.preventDefault();
73 $(
'#savebutton').click();
83 const editor = (
'textarea#summernote');
84 const savebutton = (
'#savebutton');
85 const savebuttonIcon = (
'#savebuttonIcon');
88 $(savebutton).click(
function() {
89 $(savebutton).removeClass(
'btn btn-success').addClass(
'btn btn-warning disabled');
90 $(savebuttonIcon).removeClass(
'fa fa-check').addClass(
'fa fa-spinner fa-spin fa-fw');
93 if ($(editor).summernote(
'codeview.isActivated')) {
95 $(editor).summernote(
'codeview.deactivate');
101 const text = $(editor).val();
103 const frontend = text.replace(/<img src=\
"..\/media/g,"<img src=\
"media");
105 $(editor).val(frontend);
109 var newValue = $(editor).val();
110 var replace1 = newValue.replace(/>/
g,
'>');
111 $(editor).val(replace1);
113 var newValue2 = $(editor).val();
114 var replace2 = newValue2.replace(/</
g,
'<');
115 $(editor).val(replace2);
123 const text = $(editor).val();
125 const backend = text.replace(/<img src=\
"media/g,"<img src=\
"../media");
131 $(editor).
on(
'summernote.init',
function() {
133 $(editor).summernote(
'codeview.toggle');
137 $(editor).summernote({
147 lang:
'<?php echo $lang['CURRENT_LANGUAGE
']; ?>',
151 theme:
'<?php echo $editorSettings['editorTheme
']; ?>',
156 scrollbarStyle:
null,
158 autoCloseBrackets: <?php echo
$editorSettings[
'editorCloseBrackets'];?>,
160 value:
"<html>\n " + document.documentElement.innerHTML +
"\n</html>",
162 matchTags: {bothTags: <?php echo
$editorSettings[
'editorMatchTags']; ?>},
164 "Ctrl-J":
"toMatchingTag",
165 "Ctrl-Space":
"autocomplete"
190 if (!isset($template)) { $template =
new template(); }
192 if (!isset($user)) { $user =
new user(
$db); }
204 <!-- Content Wrapper. Contains page content -->
205 <div class=\"content-wrapper\" id=\"content-FX\">
206 <!-- Content Header (Page header) -->
207 <section class=\"content-header\">";
209 echo backend::getTitle(
$lang[
'TPL'],
"custom.js");
210 echo backend::getTemplateBreadcrumbs(
$lang);
211 echo
"</section><!-- Main content -->
212 <section class=\"content\">";
215 <form
id=
"template-edit-form" action=
"index.php?page=template-customjs&action=template-customjs&id=<?php echo $getID; ?>" method=
"POST">
216 <!--
title header -->
219 <div
class=
"box-body">
220 <div
class=
"col-md-10">
221 <?php echo
"<h4><i class=\"fa fa-code\"></i> $lang[CUSTOM_JS] <small>$lang[TPL_CUSTOMJS_SUBTEXT]</small></h4>"; ?>
223 <div
class=
"col-md-2">
224 <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[
'CUSTOM_JS_SAVE']; ?></button>
231 <div
class=
"col-md-8 animated fadeIn">
233 <textarea
name=
"customJS" cols=
"64" rows=
"28" id=
"summernote"><?php echo
$customJS; ?></textarea>
234 <label
for=
"summernote"><small><?php echo
$lang[
'YOU_EDIT']; ?>:</small> &
nbsp;system/templates/<?php echo $template->name; ?>/js/custom.js</label>
236 <div
class=
"col-md-4">
237 <div
class=
"box box-default">
238 <div
class=
"box-header with-border">
239 <h3
class=
"box-title"><?php echo $template->name; ?>/js/custom.js</h3>
241 <div
class=
"box-body">
242 <?php echo
$lang[
'CUSTOM_JS_DESC']; ?>
244 <
i><?php echo
$lang[
'CUSTOM_JS_HELP']; ?></
i><br>
245 » <
a href=
"http://www.w3schools.com/js/" title=
"open JS overview in new TAB" target=
"_blank">w3schools.com/js/</
a>
248 <
b><
i class=
"fa fa-lightbulb-o"></
i> <?php echo
$lang[
'DID_YOU_KNOW']; ?></
b><br>
249 <
i><?php echo
$lang[
'TIP_STRG_S']; ?></
i>
print $lang['FILEMAN_UPLOAD']
Backend class serves a few useful functions for the admin backend.
Mysqli database class; returns db connection object.
The language class - support multilingual backend.
Settings class: get and set YaWK system settings.
The template controller - get and set template settings.
The default user class. Provide all functions to handle the user object.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
if(!isset($template)) if(isset($_POST['save']) &&(isset($_GET['action']) &&(isset($_GET['id'])))) $editorSettings
if(!isset($template)) if(!isset($user)) $getID
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);});})