From 7c69afa32641fe5e25f6e95f36245b3958e8d72b Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Wed, 22 Feb 2023 20:10:59 +0100 Subject: [PATCH] temporary fix for inuse message if a module is used for body tag in layout --- conlite/classes/class.inuse.php | 2 +- .../external/backendedit/front_content.php | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/conlite/classes/class.inuse.php b/conlite/classes/class.inuse.php index d217cb7..d995f5a 100644 --- a/conlite/classes/class.inuse.php +++ b/conlite/classes/class.inuse.php @@ -255,7 +255,7 @@ class InUseCollection extends ItemCollection } if (!is_object($notification)) { - $notification = new Contenido_Notification; + $notification = new Contenido_Notification(); } $noti = $notification->messageBox("warning", $message.$override, 0); diff --git a/conlite/external/backendedit/front_content.php b/conlite/external/backendedit/front_content.php index aa37f37..848cd38 100644 --- a/conlite/external/backendedit/front_content.php +++ b/conlite/external/backendedit/front_content.php @@ -92,7 +92,7 @@ if ($cfg["use_pseudocron"] == true) { * PHPLIB application development toolkit * @see http://sourceforge.net/projects/phplib */ -if (!empty($contenido)) { +if (isset($contenido)) { //Backend page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang); @@ -130,9 +130,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') { exit(); } -// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07 -CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins'); - if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) { // get encodings of all languages $encoding = array(); @@ -241,7 +238,7 @@ $errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams); * Note: These variables can be set via http globals e.g. front_content.php?idcat=41&idart=34&idcatart=35&idartlang=42 * If not the values will be computed. */ -if ($idart && !$idcat && !$idcatart) { +if (!empty($idart) && empty($idcat) && empty($idcatart)) { /* Try to fetch the first idcat */ $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "'"; $db->query($sql); @@ -410,7 +407,7 @@ if ($cfg["cache"]["disable"] != '1') { * The reason is to avoid cross-site scripting errors in the backend, if the backend domain differs from * the frontend domain. */ -if ($contenido) { +if (isset($contenido)) { $perm->load_permissions(); /* Change mode edit / view */ @@ -533,7 +530,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p ############################################## /* Mark submenuitem 'Preview' in the Contenido Backend (Area: Contenido --> Articles --> Preview) */ - if ($contenido) { + if (isset($contenido)) { $markscript = markSubMenuItem(4, true); } @@ -610,9 +607,11 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p /* If article is in use, display notification */ if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) { $code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n", $code, 1); - $code = preg_replace("/(]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1); + if(!preg_match("/(]*)>.*/i", $code)) { + $code = preg_replace("/(]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1); + $bInUseSet = true; + } } - /* Check if category is public */ $sql = "SELECT public FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; @@ -651,7 +650,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '" . Contenido_Security::escapeDB($user_id, $db2) . "' AND A.idcat = '" . Contenido_Security::toInteger($idcat) . "' AND A.idarea = C.idarea AND B.idaction = A.idaction"; - $db2 = new DB_ConLite; + $db2 = new DB_ConLite(); $db2->query($sql); if ($db2->num_rows() > 0) { @@ -795,12 +794,16 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p if (in_array(Contenido_Security::toInteger($idart), $aExclude)) { eval("?>\n" . $code . "\n\n" . $code . "\n]*)>/i", "\${1}> \n $sHtmlInUseMessage", $htmlCode, 1); + } // process CEC to do some preparations before output $htmlCode = CEC_Hook::executeAndReturn('Contenido.Frontend.HTMLCodeOutput', $htmlCode);