summaryrefslogtreecommitdiffstats
path: root/install.php
diff options
context:
space:
mode:
authornashe <thomas@chauchefoin.fr>2017-10-17 09:42:31 +0200
committernashe <thomas@chauchefoin.fr>2017-10-17 09:42:31 +0200
commit1b341502ba68092b444a7870d601537eec68b344 (patch)
treec99532de86e48fb7646620c2d2a30f5b33a23528 /install.php
parentdb2ab071c73feb6ac510bfdc6ee5b9ddad1566ea (diff)
downloadplanet-1b341502ba68092b444a7870d601537eec68b344.tar
planet-1b341502ba68092b444a7870d601537eec68b344.tar.gz
planet-1b341502ba68092b444a7870d601537eec68b344.tar.bz2
planet-1b341502ba68092b444a7870d601537eec68b344.tar.xz
planet-1b341502ba68092b444a7870d601537eec68b344.zip
Cleanup install.php
Diffstat (limited to 'install.php')
-rwxr-xr-xinstall.php28
1 files changed, 9 insertions, 19 deletions
diff --git a/install.php b/install.php
index 46b2c1c..86e1123 100755
--- a/install.php
+++ b/install.php
@@ -9,33 +9,23 @@ function installStatus($str, $msg, $result) {
}
// If the config file exists and the auth variables are set, moonmoon is already installed
-include __DIR__ . '/admin/inc/pwd.inc.php';
-if (file_exists(__DIR__ . '/custom/config.yml') && isset($login) && isset($password)) {
+if (is_installed()) {
$status = 'installed';
-} elseif (isset($_REQUEST['url'])) {
+} elseif (isset($_POST['url'])) {
// Do no try to use the file of an invalid locale
- if (strstr($_REQUEST['locale'], '..') !== false
+ if (strstr($_POST['locale'], '..') !== false
|| !file_exists(__DIR__ . "/app/l10n/${_REQUEST['locale']}.lang")) {
- $_REQUEST['locale'] = 'en';
+ $_POST['locale'] = 'en';
}
$save = array();
//Save config file
- $config = array(
- 'url' => $_REQUEST['url'],
- 'name' => filter_var($_REQUEST['title'], FILTER_SANITIZE_SPECIAL_CHARS),
- 'locale' => $_REQUEST['locale'],
- 'items' => 10,
- 'shuffle' => 0,
- 'refresh' => 240,
- 'cache' => 10,
- 'nohtml' => 0,
- 'postmaxlength' => 0,
- 'cachedir' => './cache',
- 'debug' => false,
- 'checkcerts' => true,
- );
+ $config = array_merge(PlanetConfig::$defaultConfig, [
+ 'url' => $_POST['url'],
+ 'name' => filter_var($_POST['title'], FILTER_SANITIZE_SPECIAL_CHARS),
+ 'locale' => $_POST['locale'],
+ ]);
$CreatePlanetConfig = new PlanetConfig($config);
$save['config'] = file_put_contents(custom_path('config.yml'), $CreatePlanetConfig->toYaml());