Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: corrected usage of parameters used for client instances, closes #…
  • Loading branch information
thorsten committed Mar 25, 2021
1 parent 23552a7 commit e75c0cd
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions phpmyfaq/src/phpMyFAQ/Installer.php
Expand Up @@ -646,8 +646,8 @@ public function checkAvailableDatabaseTables(DatabaseDriver $database)
/**
* Starts the installation.
*
* @param array $setup
* @throws
* @param array|null $setup
* @throws Exception
*/
public function startInstall(array $setup = null)
{
Expand All @@ -660,7 +660,11 @@ public function startInstall(array $setup = null)
}

// Check database entries
$dbSetup['dbType'] = Filter::filterInput(INPUT_POST, 'sql_type', FILTER_SANITIZE_STRING, $setup['dbType']);
if (!isset($setup['dbType'])) {
$dbSetup['dbType'] = Filter::filterInput(INPUT_POST, 'sql_type', FILTER_SANITIZE_STRING);
} else {
$dbSetup['dbType'] = $setup['dbType'];
}
if (!is_null($dbSetup['dbType'])) {
$dbSetup['dbType'] = trim($dbSetup['dbType']);
if (!file_exists(PMF_SRC_DIR . '/phpMyFAQ/Instance/Database/' . ucfirst($dbSetup['dbType']) . '.php')) {
Expand Down Expand Up @@ -846,14 +850,22 @@ public function startInstall(array $setup = null)
}

// check loginname
$loginname = Filter::filterInput(INPUT_POST, 'loginname', FILTER_SANITIZE_STRING, $setup['loginname']);
if (is_null($loginname)) {
if (!isset($setup['loginname'])) {
$loginName = Filter::filterInput(INPUT_POST, 'loginname', FILTER_SANITIZE_STRING);
} else {
$loginName = $setup['loginname'];
}
if (is_null($loginName)) {
echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a loginname for your account.</p>';
System::renderFooter(true);
}

// check user entries
$password = Filter::filterInput(INPUT_POST, 'password', FILTER_SANITIZE_STRING, $setup['password']);
if (!isset($setup['password'])) {
$password = Filter::filterInput(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
} else {
$password = $setup['password'];
}
if (is_null($password)) {
echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a password for the your ' .
'account.</p>';
Expand Down Expand Up @@ -992,7 +1004,7 @@ public function startInstall(array $setup = null)

// add admin account and rights
$admin = new User($configuration);
if (!$admin->createUser($loginname, $password, null, 1)) {
if (!$admin->createUser($loginName, $password, null, 1)) {
printf(
'<p class="alert alert-danger"><strong>Fatal installation error:</strong><br>' .
"Couldn't create the admin user: %s</p>\n",
Expand Down

0 comments on commit e75c0cd

Please sign in to comment.