From cd072acba40b59634cf43fc61681b42ebca69eaa Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 24 Jan 2014 06:21:25 -0500
Subject: [PATCH] changed the regex; new line at the end is allowed - prevents problems when using cut&paste for the private-key in the interface
---
interface/web/sites/database_edit.php | 42 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 139c971..2249351 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -302,7 +302,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();
}
@@ -371,6 +390,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();
}
--
Gitblit v1.9.1