diff options
| author | 2021-12-31 13:50:32 +0100 | |
|---|---|---|
| committer | 2021-12-31 13:50:32 +0100 | |
| commit | 09c84fb3bc44bf8e45619c27acc15b967aea14ce (patch) | |
| tree | c815185794c7dfdc6de6c58e1efb3db13bd7b335 /app/install.php | |
| parent | 0e683ee5d223a32dbe9a2d63d583a95d248bfc94 (diff) | |
Improved: install.php code quality (#4099)
* delete unused $user_default_config
* move inner named function
* moved $auth_type
* improve readability
* phpcs fixes
Diffstat (limited to 'app/install.php')
| -rw-r--r-- | app/install.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/app/install.php b/app/install.php index 402de91a3..295be8b76 100644 --- a/app/install.php +++ b/app/install.php @@ -183,7 +183,6 @@ function saveStep2() { } function saveStep3() { - $user_default_config = Minz_Configuration::get('default_user'); if (!empty($_POST)) { $system_default_config = Minz_Configuration::get('default_system'); Minz_Session::_params([ @@ -447,8 +446,8 @@ function printStep1() { function printStep2() { $system_default_config = Minz_Configuration::get('default_system'); -?> - <?php $s2 = checkStep2(); if ($s2['all'] == 'ok') { ?> + $s2 = checkStep2(); + if ($s2['all'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?= _t('gen.short.ok') ?></span> <?= _t('install.bdd.conf.ok') ?></p> <?php } elseif ($s2['conn'] == 'ko') { ?> <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('install.bdd.conf.ko'), @@ -541,10 +540,14 @@ function printStep2() { <?php } +function no_auth($auth_type) { + return !in_array($auth_type, array('form', 'http_auth', 'none')); +} + function printStep3() { - $user_default_config = Minz_Configuration::get('default_user'); -?> - <?php $s3 = checkStep3(); if ($s3['all'] == 'ok') { ?> + $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : ''; + $s3 = checkStep3(); + if ($s3['all'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?= _t('gen.short.ok') ?></span> <?= _t('install.conf.ok') ?></p> <?php } elseif (!empty($_POST)) { ?> <p class="alert alert-error"><?= _t('install.fix_errors_before') ?></p> @@ -566,12 +569,6 @@ function printStep3() { <label class="group-name" for="auth_type"><?= _t('install.auth.type') ?></label> <div class="group-controls"> <select id="auth_type" name="auth_type" required="required" tabindex="4"> - <?php - function no_auth($auth_type) { - return !in_array($auth_type, array('form', 'http_auth', 'none')); - } - $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : ''; - ?> <option value="form"<?= $auth_type === 'form' || (no_auth($auth_type) && cryptAvailable()) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"' ?>><?= _t('install.auth.form') ?></option> <option value="http_auth"<?= $auth_type === 'http_auth' ? ' selected="selected"' : '', |
