From 10725d72341ddaaaa6e4c402d396b8378c2e1c0f Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Tue, 25 Oct 2022 20:28:00 +0200 Subject: [PATCH] modify mod modFileEdit --- conlite/classes/contenido/class.module.php | 17 +++++++----- conlite/includes/functions.con2.php | 31 ++++++---------------- conlite/includes/include.mod_edit_form.php | 4 +-- conlite/plugins/cl-mod-rewrite | 2 +- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/conlite/classes/contenido/class.module.php b/conlite/classes/contenido/class.module.php index 3e2cff4..79f9009 100644 --- a/conlite/classes/contenido/class.module.php +++ b/conlite/classes/contenido/class.module.php @@ -119,7 +119,8 @@ class cApiModule extends Item { * @param mixed $mId Specifies the ID of item to load */ public function __construct($mId = false) { - global $cfg, $cfgClient, $client; + $cfg = cRegistry::getConfig(); + $cfgClient = cRegistry::getClientConfig(cRegistry::getClientId()); parent::__construct($cfg["tab"]["mod"], "idmod"); @@ -129,15 +130,17 @@ class cApiModule extends Item { // (data not from a form field) $this->setFilters(array(), array()); - $this->_packageStructure = array("jsfiles" => $cfgClient[$client]["js"]["path"], - "tplfiles" => $cfgClient[$client]["tpl"]["path"], - "cssfiles" => $cfgClient[$client]["css"]["path"]); + $this->_packageStructure = array( + "jsfiles" => $cfgClient["js"]["path"], + "tplfiles" => $cfgClient["tpl"]["path"], + "cssfiles" => $cfgClient["css"]["path"] + ); if (isset($cfg['dceModEdit']) && is_array($cfg['dceModEdit'])) { - $this->_aModFileEditConf['clientPath'] = $cfgClient[$client]["path"]["frontend"]; + $this->_aModFileEditConf['clientPath'] = $cfgClient["path"]["frontend"]; $this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $cfg['dceModEdit']); if (!isset($cfg['dceModEdit']['modPath']) || empty($cfg['dceModEdit']['modPath'])) { - $this->_aModFileEditConf['modPath'] = $cfgClient[$client]["path"]["frontend"] + $this->_aModFileEditConf['modPath'] = $cfgClient["path"]["frontend"] . $this->_aModFileEditConf['modFolderName'] . "/"; } } @@ -376,6 +379,8 @@ class cApiModule extends Item { /** * Checks if the module is a pre-4.3 module * @return boolean true if this module is an old one + * + * @deprecated since version 2.0 */ public function isOldModule() { // Keywords to scan diff --git a/conlite/includes/functions.con2.php b/conlite/includes/functions.con2.php index 647ae79..7183c4c 100644 --- a/conlite/includes/functions.con2.php +++ b/conlite/includes/functions.con2.php @@ -237,32 +237,17 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { $a_container = explode("&", $tmp_returnstring); foreach ($a_container as $key => $value) { - - $sql = "SELECT output, template, name FROM " . $cfg["tab"]["mod"] . " WHERE idmod='" . $a_d[$value] . "'"; - - $db->query($sql); - $db->next_record(); - + if (is_numeric($a_d[$value])) { $thisModule = ''; $thisContainer = ''; } - /* dceModFileEdit (c)2009 www.dceonline.de */ - if ($cfg['dceModEdit']['use'] - && ($cfg['dceModEdit']['allModsFromFile'] == true - || in_array((int) $a_d[$value], $cfg['dceModEdit']['modsFromFile']))) { - cInclude('classes', 'contenido/class.module.php'); - $tmpModule = new cApiModule; - $tmpModule->loadByPrimaryKey($a_d[$value]); - $output = $thisModule . $thisContainer . $tmpModule->get("output"); - unset($tmpModule); - } else { - $output = $thisModule . $thisContainer . $db->f("output"); - } - /* dceModFileEdit (c)2009 www.dceonline.de */ - $output = AddSlashes($output) . "\n"; - $template = $db->f("template"); + $oModule = new cApiModule($a_d[$value]); + $output = $thisModule . $thisContainer . $oModule->get("output"); + $template = $oModule->get("template"); + + $output = AddSlashes($output) . "\n"; $varstring = array(); if (!empty($a_c[$value])) { @@ -297,7 +282,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { $fedebug .= "Container: CMS_CONTAINER[$value]" . '\\\\n'; } if ($frontend_debug["module_display"] == true) { - $fedebug .= "Modul: " . $db->f("name") . '\\\\n'; + $fedebug .= "Modul: " . $oModule->get("name") . '\\\\n'; } if ($frontend_debug["module_timing_summary"] == true || $frontend_debug["module_timing"] == true) { $fedebug .= 'Eval-Time: $modtime' . $value . '\\\\n'; @@ -311,7 +296,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { if ($frontend_debug["module_timing_summary"] == true) { $output .= addslashes(' '); - $output .= addslashes(' f("name")) . '"; ?>'); + $output .= addslashes(' get("name")) . '"; ?>'); } /* Replace new containers */ $code = preg_replace("/(.*)<\/container>/Uis", "CMS_CONTAINER[$value]", $code); diff --git a/conlite/includes/include.mod_edit_form.php b/conlite/includes/include.mod_edit_form.php index 89fd223..5c37554 100644 --- a/conlite/includes/include.mod_edit_form.php +++ b/conlite/includes/include.mod_edit_form.php @@ -357,7 +357,7 @@ function insertTab(event, obj) { $page->setReload(); } } - /* dceModFileEdit (c)2009-2011 www.dceonline.de */ + if ($cfg['dceModEdit']['use']) { // button for mod folder creation if (!$module->hasModuleFolder() && $action != "mod_new") { @@ -380,7 +380,7 @@ function insertTab(event, obj) { } else { $form->add(i18n("Name"), $name->render()); } - /* End dceModFileEdit (c)2009-2011 www.dceonline.de */ + $form->add(i18n("Type"), $typeselect->render() . $custom->render()); $form->add(i18n("Description"), $descr->render()); diff --git a/conlite/plugins/cl-mod-rewrite b/conlite/plugins/cl-mod-rewrite index 06cc337..3217b73 160000 --- a/conlite/plugins/cl-mod-rewrite +++ b/conlite/plugins/cl-mod-rewrite @@ -1 +1 @@ -Subproject commit 06cc337092ed649df1ec738816ba6a3e59a8af0b +Subproject commit 3217b73d08e1b76193f02d2d912134320ef40bfe