From c989e2eda557d7a7d5b7fb70db3a8af46f159feb Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 14 Feb 2019 09:47:22 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B0941=20-=20Check=20DB=20password=20also?= =?UTF-8?q?=20in=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datamodels/2.x/itop-config/config.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/datamodels/2.x/itop-config/config.php b/datamodels/2.x/itop-config/config.php index e91412c63..6559a9b8c 100644 --- a/datamodels/2.x/itop-config/config.php +++ b/datamodels/2.x/itop-config/config.php @@ -74,6 +74,17 @@ function TestConfig($sContents, $oP) } } +function ConfigCheckDBPassword(iTopWebPage $oP, &$iEditorTopMargin) +{ + $bIsWindows = (array_key_exists('WINDIR', $_SERVER) || array_key_exists('windir', $_SERVER)); + $sDBPwd = MetaModel::GetConfig()->Get('db_pwd'); + if ($bIsWindows && (strpos($sDBPwd, '%') !== false)) + { + // Unsupported Password + $iEditorTopMargin += 5; + $oP->add("
Database password should not contain % character (backups won't work)...
"); + } +} ///////////////////////////////////////////////////////////////////// // Main program @@ -94,6 +105,7 @@ $oP->add_linked_script(utils::GetCurrentModuleUrl().'/js/ext-searchbox.js'); try { $sOperation = utils::ReadParam('operation', ''); + $iEditorTopMargin = 0; $oP->add("

".Dict::S('config-edit-title')."

"); @@ -104,18 +116,20 @@ try else if (MetaModel::GetModuleSetting('itop-config', 'config_editor', '') == 'disabled') { $oP->add("
iTop interactive edition of the configuration as been disabled. See 'config_editor' => 'disabled' in the configuration file.
"); + ConfigCheckDBPassword($oP, $iEditorTopMargin); } else { + ConfigCheckDBPassword($oP, $iEditorTopMargin); $sConfigFile = APPROOT.'conf/'.utils::GetCurrentEnvironment().'/config-itop.php'; - $iEditorTopMargin = 9; + $iEditorTopMargin += 9; $sConfig = str_replace("\r\n", "\n", file_get_contents($sConfigFile)); $sOrginalConfig = $sConfig; if (!empty($sOperation)) { - $iEditorTopMargin = 14; + $iEditorTopMargin += 5; $sConfig = utils::ReadParam('new_config', '', false, 'raw_data'); $sOrginalConfig = utils::ReadParam('prev_config', '', false, 'raw_data'); }