Skip to content

Commit 9483230

Browse files
committed
Init db input fields with dbconfig.php on install
Pre-populate the database configuration values of the first installation step with data from dbconfig.php.
1 parent ff17ecd commit 9483230

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

install.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ function install($type, $host, $user, $pass, $dbname, $lang, $mysqlcon, &$err_ms
409409
}
410410

411411
if ((!isset($_POST['install']) && !isset($_POST['confweb'])) || $err_lvl == 1 || $err_lvl == 2 || $err_lvl == 3) {
412+
$dbtype = "";
413+
$dbhost = "";
414+
$dbname = "";
415+
$dbuser = "";
416+
$dbpass = "";
417+
412418
if(isset($show_warning)) {
413419
$dbhost = $_POST['dbhost'];
414420
$dbname = $_POST['dbname'];
@@ -420,10 +426,17 @@ function install($type, $host, $user, $pass, $dbname, $lang, $mysqlcon, &$err_ms
420426
$dbuser = $_GET['dbuser'];
421427
$dbpass = $_GET['dbpass'];
422428
} else {
423-
$dbhost = "";
424-
$dbname = "";
425-
$dbuser = "";
426-
$dbpass = "";
429+
try {
430+
include "other/dbconfig.php";
431+
$dbtype = $db['type'];
432+
$dbhost = $db['host'];
433+
$dbname = $db['dbname'];
434+
$dbuser = $db['user'];
435+
$dbpass = $db['pass'];
436+
}
437+
catch (ErrorException $ex) {
438+
439+
}
427440
}
428441
?>
429442
<div id="page-wrapper">
@@ -446,7 +459,7 @@ function install($type, $host, $user, $pass, $dbname, $lang, $mysqlcon, &$err_ms
446459
<div class="form-group">
447460
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#isntwidbtypedesc"><?php echo $lang['isntwidbtype']; ?><i class="help-hover fas fa-question-circle"></i></label>
448461
<div class="col-sm-8">
449-
<select class="selectpicker show-tick form-control required" id="basic" name="dbtype" required>
462+
<select class="selectpicker show-tick form-control required" id="basic" name="dbtype" value="<?php echo $dbtype; ?>" required>
450463
<option disabled value=""> -- select database -- </option>
451464
<option data-subtext="Cubrid" value="cubrid">cubrid</option>
452465
<option data-subtext="FreeTDS / Microsoft SQL Server / Sybase" value="dblib">dblib</option>

0 commit comments

Comments
 (0)