handle empty or nulled content

Dieser Commit ist enthalten in:
o.pinke 2023-03-03 09:02:11 +01:00
Ursprung 606f48500f
Commit fc6ea7746d
1 geänderte Dateien mit 45 neuen und 49 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -31,84 +32,79 @@
* }} * }}
* *
*/ */
if(!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
// include editor config/combat file // include editor config/combat file
include (dirname(__FILE__).DIRECTORY_SEPARATOR."config.php"); // CONTENIDO include (dirname(__FILE__) . DIRECTORY_SEPARATOR . "config.php"); // CONTENIDO
cInclude("external", "wysiwyg/tinymce3/editorclass.php"); cInclude("external", "wysiwyg/tinymce3/editorclass.php");
// name of textarea element // name of textarea element
if (isset($type)) { if (isset($type)) {
$editor_name = "CMS_HTML"; // this should be $type (might be a contenido bug) $editor_name = "CMS_HTML"; // this should be $type (might be a contenido bug)
} else { } else {
$editor_name = "content"; $editor_name = "content";
} }
// if editor is called from any include.CMS_*.html file use available content from $a_content // if editor is called from any include.CMS_*.html file use available content from $a_content
if ($a_content[$type][$typenr]) { if ($a_content[$type][$typenr]) {
$editor_content = $a_content[$type][$typenr]; $editor_content = $a_content[$type][$typenr];
// if not set it is possible to use available content from var $editor_content // if not set it is possible to use available content from var $editor_content
} }
$editor_content = clHtmlSpecialChars($editor_content); $editor_content = is_null($editor_content) ? '' : clHtmlSpecialChars($editor_content);
$cTinyMCEEditor = new cTinyMCEEditor($editor_name, $editor_content); $cTinyMCEEditor = new cTinyMCEEditor($editor_name, $editor_content);
switch ($type) switch ($type) {
{ case "CMS_HTML":
case "CMS_HTML": $editor_height = getEffectiveSetting("wysiwyg", "tinymce-height-html", false);
$editor_height = getEffectiveSetting("wysiwyg", "tinymce-height-html", false);
if ($editor_height == false) {
if ($editor_height == false) $editor_height = getEffectiveSetting("tinymce", "contenido_height_html", false);
{ }
$editor_height = getEffectiveSetting("tinymce", "contenido_height_html", false); break;
} case "CMS_HTMLHEAD":
break; $editor_height = getEffectiveSetting("wysiwyg", "tinymce-height-head", false);
case "CMS_HTMLHEAD":
$editor_height = getEffectiveSetting("wysiwyg", "tinymce-height-head", false); if ($editor_height == false) {
$editor_height = getEffectiveSetting("tinymce", "contenido_height_head", false);
if ($editor_height == false) }
{ break;
$editor_height = getEffectiveSetting("tinymce", "contenido_height_head", false); default:
} $editor_height = false;
break;
default:
$editor_height = false;
} }
if ($editor_height !== false) if ($editor_height !== false) {
{ $cTinyMCEEditor->setSetting("height", $editor_height, true);
$cTinyMCEEditor->setSetting("height", $editor_height, true);
} }
/* /*
TODO: TODO:
-> see editor_template.js -> see editor_template.js
-> create own theme template engine -> create own theme template engine
-> maybe change the way icons are displayed -> maybe change the way icons are displayed
*/ */
$currentuser = new User; $currentuser = new User;
$currentuser->loadUserByUserID($auth->auth["uid"]); $currentuser->loadUserByUserID($auth->auth["uid"]);
if ($currentuser->getField("wysi") == 1) if ($currentuser->getField("wysi") == 1) {
{ echo $cTinyMCEEditor->getScripts();
echo $cTinyMCEEditor->getScripts(); echo $cTinyMCEEditor->getEditor();
echo $cTinyMCEEditor->getEditor();
} else { } else {
$oTextarea = new cHTMLTextarea($editor_name, $editor_content); $oTextarea = new cHTMLTextarea($editor_name, $editor_content);
$oTextarea->setId($editor_name); $oTextarea->setId($editor_name);
$bgColor = getEffectiveSetting("wysiwyg", "tinymce-backgroundcolor", "white");
$editor_width = getEffectiveSetting("wysiwyg", "tinymce-width", "600");
$editor_height = getEffectiveSetting("wysiwyg", "tinymce-height", "480");
$oTextarea->setStyle("width: ".$editor_width."px; height: ".$editor_height."px; background-color: ".$bgColor.";");
echo $oTextarea->render(); $bgColor = getEffectiveSetting("wysiwyg", "tinymce-backgroundcolor", "white");
$editor_width = getEffectiveSetting("wysiwyg", "tinymce-width", "600");
$editor_height = getEffectiveSetting("wysiwyg", "tinymce-height", "480");
$oTextarea->setStyle("width: " . $editor_width . "px; height: " . $editor_height . "px; background-color: " . $bgColor . ";");
echo $oTextarea->render();
} }
?> ?>