Skip to content

Commit

Permalink
Automatically detect installation path during installation (NamelessM…
Browse files Browse the repository at this point in the history
  • Loading branch information
supercrafter100 authored and Derkades committed Sep 27, 2022
1 parent a68d079 commit b7f1548
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions core/installation/steps/general_configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@
$_SESSION['install_path'] = $_POST['install_path'] ?? '';
$_SESSION['friendly_urls'] = $_POST['friendly'] ?? false;

if (getenv('NAMELESS_PATH')) {
$_SESSION['install_path'] = getenv('NAMELESS_PATH');
} else {
$requestPathParts = explode('/', $_SERVER['REQUEST_URI']);
array_pop($requestPathParts); // remove /install.php
$path = implode('/', $requestPathParts);
if (substr($path, 0, 1) == "/") {
$path = substr($path, 1);
}
$_SESSION['install_path'] = $path;

}
Redirect::to('?step=database_configuration');
}

}
}
?>

Expand All @@ -39,13 +51,6 @@
<p><?php echo $language->get('installer', 'host_help'); ?></p>
<div class="ui divider"></div>
</div>

<div <?php if (getenv('NAMELESS_PATH_HIDE') !== false) echo 'style="display: none"' ?>>
<?php create_field('text', $language->get('installer', 'nameless_path'), 'install_path', 'inputPath', getenv('NAMELESS_PATH') ?: Output::getClean($install_path)); ?>
<p><?php echo $language->get('installer', 'nameless_path_info'); ?></p>
<div class="ui divider"></div>
</div>

<div <?php if (getenv('NAMELESS_FRIENDLY_URLS_HIDE') !== false) echo 'style="display: none"' ?>>
<?php create_field('select', $language->get('installer', 'friendly_urls'), 'friendly', 'inputFriendly', getenv('NAMELESS_FRIENDLY_URLS') ?: 'false', [
'true' => $language->get('installer', 'enabled'),
Expand Down

0 comments on commit b7f1548

Please sign in to comment.