From f93b6f4590d459f3aa7951ebdbcd4faa191fd366 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 21 May 2014 08:16:59 -0400
Subject: [PATCH] Fixed a syntax error in mail_user_password_edit.php
---
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