Skip to content

Commit 25bbb3c

Browse files
committed
Improved code + Changed behavouir /edit/db to keep in sync with /add/db
1 parent 4b2e457 commit 25bbb3c

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

web/edit/db/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
// Parse database
2929
$v_username = $user;
30-
$v_dbuser = $data[$v_database]['DBUSER'];
30+
$v_dbuser = preg_replace("/^".$user."_/", "", $data[$v_database]['DBUSER']);
3131
$v_password = "";
3232
$v_host = $data[$v_database]['HOST'];
3333
$v_type = $data[$v_database]['TYPE'];
@@ -53,7 +53,7 @@
5353

5454
// Change database user
5555
if (($v_dbuser != $_POST['v_dbuser']) && (empty($_SESSION['error_msg']))) {
56-
$v_dbuser = preg_replace("/^".$user."_/", "", $_POST['v_dbuser']);
56+
//$v_dbuser = preg_replace("/^".$user."_/", "", $_POST['v_dbuser']);
5757
$v_dbuser = escapeshellarg($v_dbuser);
5858
exec (HESTIA_CMD."v-change-database-user ".$v_username." ".escapeshellarg($v_database)." ".$v_dbuser, $output, $return_var);
5959
check_return_code($return_var,$output);

web/js/pages/add_db.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ App.Actions.DB.update_db_username_hint = function(elm, hint) {
55
if (hint.trim() == '') {
66
$(elm).parent().find('.hint').html('');
77
}
8-
// remove prefix from value in order to eliminate duplicates
9-
//if (hint.indexOf(GLOBAL.DB_USER_PREFIX) == 0) {
10-
// hint = hint.slice(GLOBAL.DB_USER_PREFIX.length, hint.length);
11-
//}
12-
138
$(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);
149
}
1510

@@ -20,10 +15,6 @@ App.Actions.DB.update_db_databasename_hint = function(elm, hint) {
2015
if (hint.trim() == '') {
2116
$(elm).parent().find('.hint').html('');
2217
}
23-
// remove prefix from value in order to eliminate duplicates
24-
//if (hint.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) {
25-
// hint = hint.slice(GLOBAL.DB_DBNAME_PREFIX.length, hint.length);
26-
//}
2718
$(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);
2819
}
2920

web/js/pages/edit_db.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ App.Actions.DB.update_db_databasename_hint = function(elm, hint) {
2323
App.Listeners.DB.keypress_db_username = function() {
2424
var ref = $('input[name="v_dbuser"]');
2525
var current_val = ref.val();
26-
if (current_val.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) {
27-
current_val = current_val.slice(GLOBAL.DB_DBNAME_PREFIX.length, current_val.length);
28-
ref.val(current_val);
29-
}
3026
if (current_val.trim() != '') {
3127
App.Actions.DB.update_db_username_hint(ref, current_val);
3228
}

0 commit comments

Comments
 (0)