diff --git a/conlite/classes/contenido/class.module.php b/conlite/classes/contenido/class.module.php index 8278f56..d69fff6 100644 --- a/conlite/classes/contenido/class.module.php +++ b/conlite/classes/contenido/class.module.php @@ -481,6 +481,14 @@ class cApiModule extends Item { } } + /** + * @return mixed + */ + public function getError() + { + return $this->_error; + } + protected function _shouldLoadFromFiles() { if (getSystemProperty("modules", "loadfromfiles") == "true") { return true; diff --git a/conlite/includes/include.mod_edit_form.php b/conlite/includes/include.mod_edit_form.php index 5c37554..a380473 100644 --- a/conlite/includes/include.mod_edit_form.php +++ b/conlite/includes/include.mod_edit_form.php @@ -1,4 +1,4 @@ -have_perm_area_action_anyitem($area, $action))) { + /** @var Contenido_Notification $notification */ $notification->displayNotification("error", i18n("No permission")); } else { if ($action == "mod_new") { @@ -64,6 +66,7 @@ if (($action == "mod_new") && (!$perm->have_perm_area_action_anyitem($area, $act } if ($action == "mod_importexport_module") { + /** @var string $mode */ if ($mode == "export") { $name = uplCreateFriendlyName($module->get("name")); @@ -74,7 +77,7 @@ if (($action == "mod_new") && (!$perm->have_perm_area_action_anyitem($area, $act if ($mode == "import") { if (file_exists($_FILES["upload"]["tmp_name"])) { if (!$module->import($_FILES["upload"]["tmp_name"])) { - $noti .= sprintf(i18n("Error while importing XML file: %s"), $module->_error) . "
"; + $noti .= sprintf(i18n("Error while importing XML file: %s"), $module->getError()) . "
"; } else { // Load the item again (clearing slashes from import) $module->loadByPrimaryKey($module->get($module->primaryKey)); @@ -82,7 +85,7 @@ if (($action == "mod_new") && (!$perm->have_perm_area_action_anyitem($area, $act } } } - + /** @var Contenido_Notification $notification */ if ($action == "mod_folder_create") { if ($module->createModuleFolder()) { $notification->displayNotification("info", i18n("Module folder created")); @@ -227,11 +230,12 @@ if (($action == "mod_new") && (!$perm->have_perm_area_action_anyitem($area, $act */ function insertTab(event, obj) { var tabKeyCode = 9; + var keycode; if (event.which) // mozilla - var keycode = event.which; + keycode = event.which; else // ie - var keycode = event.keyCode; + keycode = event.keyCode; if (keycode == tabKeyCode) { if (event.type == "keydown") { @@ -268,8 +272,8 @@ function insertTab(event, obj) { $typeselect = new cHTMLSelectElement("type"); $db2 = new DB_ConLite; - $sql = "SELECT type FROM " . $cfg["tab"]["mod"] . " " . - "WHERE idclient = '" . $client . "' GROUP BY type"; // This query can't be designed using GenericDB... + $sql = "SELECT type FROM " . cRegistry::getConfigValue('tab', 'mod') . " " . + "WHERE idclient = '" . cRegistry::getClientId() . "' GROUP BY type"; // @todo check: This query can't be designed using GenericDB... $db2->query($sql); $aTypes = array(); @@ -281,7 +285,7 @@ function insertTab(event, obj) { // Read existing layouts $oLayouts = new cApiLayoutCollection; - $oLayouts->setWhere("idclient", $client); + $oLayouts->setWhere("idclient", cRegistry::getClientId()); $oLayouts->query(); while ($oLayout = $oLayouts->next()) { @@ -318,6 +322,8 @@ function insertTab(event, obj) { $inputok = true; $outputok = true; + + /** @var string $modErrorMessage */ if ($modulecheck !== "false") { $outputok = modTestModule($module->get("output"), $module->get("idmod") . "o", true); if (!$outputok) { @@ -358,7 +364,7 @@ function insertTab(event, obj) { } } - if ($cfg['dceModEdit']['use']) { + if (cRegistry::getConfigValue('dceModEdit', 'use')) { // button for mod folder creation if (!$module->hasModuleFolder() && $action != "mod_new") { $aParam = array( @@ -367,6 +373,7 @@ function insertTab(event, obj) { 'idmod' => $idmod, 'frame' => $frame ); + /** @var Contenido_Session $sess */ $oCreateFolderButton = new cHTMLLink($sess->self_url($aParam)); $oCreateFolderButton->setContent(i18n("Create Folder")); $sCreateFolderButton = " " . $oCreateFolderButton->render(); @@ -481,8 +488,9 @@ window.onload = scrolltheother; $page->addScript('reload', $sReloadScript); } if (!($action == "mod_importexport_module" && $mode == "export")) { - $oEditAreaInput = new EditArea('input', 'php', substr(strtolower($belang), 0, 2), true, $cfg, (($module->isLoadedFromFile("input")) ? FALSE : !$bInUse)); - $oEditAreaOutput = new EditArea('output', 'php', substr(strtolower($belang), 0, 2), false, $cfg, (($module->isLoadedFromFile("output")) ? FALSE : !$bInUse)); + /** @var string $belang */ + $oEditAreaInput = new EditArea('input', 'php', substr(strtolower($belang), 0, 2), true, cRegistry::getConfig(), (($module->isLoadedFromFile("input")) ? FALSE : !$bInUse)); + $oEditAreaOutput = new EditArea('output', 'php', substr(strtolower($belang), 0, 2), false, cRegistry::getConfig(), (($module->isLoadedFromFile("output")) ? FALSE : !$bInUse)); $page->addScript('editarea', $oEditAreaInput->renderScript() . $oEditAreaOutput->renderScript()); $page->render(); diff --git a/setup/lib/functions.mysql.php b/setup/lib/functions.mysql.php index e4a0c12..70d90fa 100644 --- a/setup/lib/functions.mysql.php +++ b/setup/lib/functions.mysql.php @@ -114,7 +114,8 @@ function checkMySQLDatabaseCreation($db, $database) { } } -function checkMySQLDatabaseExists($db, $database) { +function checkMySQLDatabaseExists($db, $database): bool +{ $db->connect(); if (hasMySQLiExtension() && !hasMySQLExtension()) { @@ -130,7 +131,7 @@ function checkMySQLDatabaseExists($db, $database) { } } } else { - if (@mysql_select_db($database, $db->Link_ID)) { + if (mysqli_select_db($db->Link_ID, $database)) { return true; } else { $db->query("SHOW DATABASES LIKE '$database'"); @@ -154,7 +155,7 @@ function checkMySQLDatabaseUse($db, $database) { return false; } } else { - if (@mysql_select_db($database, $db->Link_ID)) { + if (@mysqli_select_db($db->Link_ID, $database)) { return true; } else { return false;