From: Jerome Jutteau Date: Fri, 30 Jan 2015 10:56:33 +0000 (+0100) Subject: add variable in conf to check if installation is done X-Git-Tag: 1.1~176 X-Git-Url: https://git.p6c8.net/jirafeau_project.git/commitdiff_plain/d8192d6d361c2d707bac679facce23c7167cb93b add variable in conf to check if installation is done --- diff --git a/index.php b/index.php index d267140..127d9e6 100755 --- a/index.php +++ b/index.php @@ -26,7 +26,7 @@ require (JIRAFEAU_ROOT . 'lib/functions.php'); require (JIRAFEAU_ROOT . 'lib/lang.php'); require (JIRAFEAU_ROOT . 'lib/template/header.php'); -check_errors (); +check_errors ($cfg); if (has_error ()) { show_errors (); diff --git a/install.php b/install.php index 8cae45c..ca626ab 100755 --- a/install.php +++ b/install.php @@ -118,6 +118,12 @@ jirafeau_add_ending_slash ($path) return $path . ((substr ($path, -1) == '/') ? '' : '/'); } +if ($cfg['installation_done'] === true) +{ + header('Location: index.php'); + exit; +} + if (!file_exists (JIRAFEAU_CFG)) { /* We try to create an empty one. */ @@ -135,11 +141,6 @@ if (!file_exists (JIRAFEAU_CFG)) exit; } } -#else -#{ -# header('Location: index.php'); -# exit; -#} if (!is_writable (JIRAFEAU_CFG) && !@chmod (JIRAFEAU_CFG, '0666')) { @@ -170,6 +171,7 @@ if (isset ($_POST['step']) && isset ($_POST['next'])) case 3: $cfg['web_root'] = jirafeau_add_ending_slash ($_POST['web_root']); $cfg['var_root'] = jirafeau_add_ending_slash ($_POST['var_root']); + $cfg['installation_done'] = true; jirafeau_export_cfg ($cfg); break; diff --git a/lib/config.original.php b/lib/config.original.php index 17de2bb..716675e 100644 --- a/lib/config.original.php +++ b/lib/config.original.php @@ -55,6 +55,9 @@ $cfg['link_name_lenght'] = 8; /* Upload password. Empty string disable the password. */ $cfg['upload_password'] = ''; +/* Installation is done ? */ +$cfg['installation_done'] = false; + if ((basename (__FILE__) != 'config.local.php') && file_exists (JIRAFEAU_ROOT.'lib/config.local.php')) { diff --git a/lib/functions.php b/lib/functions.php index f1f8965..c613d4a 100755 --- a/lib/functions.php +++ b/lib/functions.php @@ -503,10 +503,10 @@ show_errors () } } -function check_errors () +function check_errors ($cfg) { if (file_exists (JIRAFEAU_ROOT . 'install.php') - && !file_exists (JIRAFEAU_ROOT . 'lib/config.local.php')) + && !($cfg['installation_done'] === true)) { header('Location: install.php'); exit; diff --git a/script.php b/script.php index 19f14a8..3185de7 100755 --- a/script.php +++ b/script.php @@ -43,7 +43,7 @@ require (JIRAFEAU_ROOT . 'lib/lang.php'); if ($_SERVER['REQUEST_METHOD'] == "GET" && count ($_GET) == 0) { require (JIRAFEAU_ROOT . 'lib/template/header.php'); - check_errors (); + check_errors ($cfg); if (has_error ()) { show_errors (); @@ -252,7 +252,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET" && count ($_GET) == 0) /* Lets use interface now. */ header('Content-Type: text; charset=utf-8'); -check_errors (); +check_errors ($cfg); if (has_error ()) { echo "Error";