From 71c74b1b572f3bdf00ba99009cc23f8f48072a1c Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Sat, 08 Mar 2014 11:58:49 -0500 Subject: [PATCH] Fixed: FS#3372 - Web browser password autofill function overwrites settings --- interface/web/sites/database_edit.php | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 43 insertions(+), 3 deletions(-) diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php index 126c039..0f2f5f2 100644 --- a/interface/web/sites/database_edit.php +++ b/interface/web/sites/database_edit.php @@ -275,7 +275,26 @@ } } } - + + if ($app->tform->errorMessage == '') { + // force update of the used database user + if($this->dataRecord['database_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_user_id'], $user_old_rec, $user_new_rec); + } + } + if($this->dataRecord['database_ro_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_ro_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_ro_user_id'], $user_old_rec, $user_new_rec); + } + } + } parent::onBeforeUpdate(); } @@ -344,6 +363,27 @@ } } + if ($app->tform->errorMessage == '') { + // force update of the used database user + if($this->dataRecord['database_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_user_id'], $user_old_rec, $user_new_rec); + } + } + if($this->dataRecord['database_ro_user_id']) { + $user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_ro_user_id'])); + if($user_old_rec) { + $user_new_rec = $user_old_rec; + $user_new_rec['server_id'] = $this->dataRecord['server_id']; + $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_ro_user_id'], $user_old_rec, $user_new_rec); + } + } + } + + parent::onBeforeInsert(); } @@ -381,7 +421,7 @@ //* The Database user shall be owned by the same group then the website $sys_groupid = $app->functions->intval($web['sys_groupid']); - $backup_interval = $app->functions->intval($web['backup_interval']); + $backup_interval = $app->db->quote($web['backup_interval']); $backup_copies = $app->functions->intval($web['backup_copies']); $sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id; @@ -397,7 +437,7 @@ //* The Database user shall be owned by the same group then the website $sys_groupid = $app->functions->intval($web['sys_groupid']); - $backup_interval = $app->functions->intval($web['backup_interval']); + $backup_interval = $app->db->quote($web['backup_interval']); $backup_copies = $app->functions->intval($web['backup_copies']); $sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id; -- Gitblit v1.9.1