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,13 +32,13 @@
* }} * }}
* *
*/ */
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
@ -53,25 +54,22 @@ if ($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; break;
case "CMS_HTMLHEAD": case "CMS_HTMLHEAD":
$editor_height = getEffectiveSetting("wysiwyg", "tinymce-height-head", false); $editor_height = getEffectiveSetting("wysiwyg", "tinymce-height-head", false);
if ($editor_height == false) if ($editor_height == false) {
{
$editor_height = getEffectiveSetting("tinymce", "contenido_height_head", false); $editor_height = getEffectiveSetting("tinymce", "contenido_height_head", false);
} }
break; break;
@ -79,24 +77,22 @@ switch ($type)
$editor_height = false; $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 {
@ -107,7 +103,7 @@ if ($currentuser->getField("wysi") == 1)
$editor_width = getEffectiveSetting("wysiwyg", "tinymce-width", "600"); $editor_width = getEffectiveSetting("wysiwyg", "tinymce-width", "600");
$editor_height = getEffectiveSetting("wysiwyg", "tinymce-height", "480"); $editor_height = getEffectiveSetting("wysiwyg", "tinymce-height", "480");
$oTextarea->setStyle("width: ".$editor_width."px; height: ".$editor_height."px; background-color: ".$bgColor.";"); $oTextarea->setStyle("width: " . $editor_width . "px; height: " . $editor_height . "px; background-color: " . $bgColor . ";");
echo $oTextarea->render(); echo $oTextarea->render();
} }