diff --git a/admin/install.php b/admin/install.php
index 4fbec15..21e3bcb 100644
--- a/admin/install.php
+++ b/admin/install.php
@@ -20,23 +20,9 @@
use Framadate\Services\InstallService;
use Framadate\Utils;
-// Define values in place of config.php (that does not exists yet)
-const NOMAPPLICATION = 'Framadate';
-const DEFAULT_LANGUAGE = 'fr';
-const IMAGE_TITRE = 'images/logo-framadate.png';
-const LOG_FILE = 'admin/stdout.log';
-$ALLOWED_LANGUAGES = [
- 'fr' => 'Français',
- 'en' => 'English',
- 'es' => 'Español',
- 'de' => 'Deutsch',
- 'it' => 'Italiano',
-];
-
require_once '../app/inc/init.php';
-define('CONF_FILENAME', ROOT_DIR . '/app/inc/config.php');
-if (file_exists(CONF_FILENAME)) {
+if (is_file(CONF_FILENAME)) {
header(('Location: ' . Utils::get_server_name()));
exit;
}
@@ -48,7 +34,7 @@ if (!empty($_POST)) {
$result = $installService->install($_POST, $smarty);
if ($result['status'] === 'OK') {
- header(('Location: ' . Utils::get_server_name() . '/admin/migration.php'));
+ header(('Location: ' . Utils::get_server_name() . 'admin/migration.php'));
exit;
} else {
$error = __('Error', $result['code']);
diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php
index 5eec8b5..aca9b9b 100644
--- a/app/classes/Framadate/Utils.php
+++ b/app/classes/Framadate/Utils.php
@@ -75,7 +75,7 @@ class Utils {
';
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/nav/nav.js")) {
+ if (is_file($_SERVER['DOCUMENT_ROOT'] . "/nav/nav.js")) {
echo '';
}
diff --git a/app/inc/init.php b/app/inc/init.php
index ef31bdf..8879bae 100644
--- a/app/inc/init.php
+++ b/app/inc/init.php
@@ -32,17 +32,31 @@ if (ini_get('date.timezone') == '') {
}
define('ROOT_DIR', __DIR__ . '/../../');
+define('CONF_FILENAME', ROOT_DIR . '/app/inc/config.php');
-require_once __DIR__ . '/constants.php';
-@include_once __DIR__ . '/config.php';
-require_once __DIR__ . '/i18n.php';
+if (is_file(CONF_FILENAME)) {
-// Smarty
-require_once __DIR__ . '/smarty.php';
+ require_once __DIR__ . '/constants.php';
+ @include_once __DIR__ . '/config.php';
-// Connection to database
-if (is_file(__DIR__ . '/config.php')) {
+ // Connection to database
$connect = new FramaDB(DB_CONNECTION_STRING, DB_USER, DB_PASSWORD);
RepositoryFactory::init($connect);
+ $err = 0;
+} else {
+ define('NOMAPPLICATION', 'Framadate');
+ define('DEFAULT_LANGUAGE', 'fr');
+ define('IMAGE_TITRE', 'images/logo-framadate.png');
+ define('LOG_FILE', 'admin/stdout.log');
+ $ALLOWED_LANGUAGES = [
+ 'fr' => 'Français',
+ 'en' => 'English',
+ 'es' => 'Español',
+ 'de' => 'Deutsch',
+ 'it' => 'Italiano',
+ ];
}
-$err = 0;
+
+require_once __DIR__ . '/i18n.php';
+// Smarty
+require_once __DIR__ . '/smarty.php';
\ No newline at end of file
diff --git a/app/inc/smarty.php b/app/inc/smarty.php
index 83ddded..26be0b3 100644
--- a/app/inc/smarty.php
+++ b/app/inc/smarty.php
@@ -29,7 +29,7 @@ $smarty->assign('APPLICATION_NAME', NOMAPPLICATION);
$smarty->assign('SERVER_URL', Utils::get_server_name());
$smarty->assign('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
$smarty->assign('TITLE_IMAGE', IMAGE_TITRE);
-$smarty->assign('use_nav_js', file_exists($_SERVER['DOCUMENT_ROOT'] . '/nav/nav.js'));
+$smarty->assign('use_nav_js', is_file($_SERVER['DOCUMENT_ROOT'] . '/nav/nav.js'));
$smarty->assign('locale', $locale);
$smarty->assign('langs', $ALLOWED_LANGUAGES);
$smarty->assign('date_format', $date_format);
diff --git a/create_classic_poll.php b/create_classic_poll.php
index 21c652b..1c1f213 100644
--- a/create_classic_poll.php
+++ b/create_classic_poll.php
@@ -32,7 +32,7 @@ $pollService = new PollService($connect, $logService);
$mailService = new MailService($config['use_smtp']);
$purgeService = new PurgeService($connect, $logService);
-if (file_exists('bandeaux_local.php')) {
+if (is_file('bandeaux_local.php')) {
include_once('bandeaux_local.php');
} else {
include_once('bandeaux.php');
diff --git a/index.php b/index.php
index 364c90c..8ee6b6f 100644
--- a/index.php
+++ b/index.php
@@ -18,9 +18,15 @@
*/
use Framadate\Services\PollService;
+use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php';
+if (!is_file(CONF_FILENAME)) {
+ header(('Location: ' . Utils::get_server_name() . 'admin/install.php'));
+ exit;
+}
+
/* SERVICES */
/* -------- */
$logService = '\Framadate\Services\LogService';
diff --git a/install/install.mysql.auto.sql b/install/install.mysql.auto.sqlXX
similarity index 100%
rename from install/install.mysql.auto.sql
rename to install/install.mysql.auto.sqlXX