]> git.agnieray.net Git - galette.git/blob - galette/install/steps/galette.php
Don't display installer if not necessary
[galette.git] / galette / install / steps / galette.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Galette installation, Galette initialisation
7 *
8 * PHP version 5
9 *
10 * Copyright © 2013-2014 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Core
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2013-2014 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 * @since Available since 0.8 - 2013-01-12
35 */
36
37 use Galette\Core\Install as GaletteInstall;
38 use Galette\Core\Db as GaletteDb;
39 use Galette\Core\Login;
40
41 $results = array();
42 $oks = array();
43 $errs = array();
44 $install->reinitReport();
45
46 $config_file_ok = $install->writeConfFile();
47 include_once GALETTE_CONFIG_PATH . 'config.inc.php';
48
49 $objects_ok = $install->initObjects($i18n, $zdb, new Login($zdb, $i18n));
50 ?>
51 <h2><?php echo $install->getStepTitle(); ?></h2>
52 <?php
53
54 if ($config_file_ok === true && $objects_ok === true) {
55 echo '<p id="infobox">' . _T("Configuration file created!") .
56 '<br/>' . _T("Data initialized.") . '</p>';
57 } else {
58 echo '<p id="errorbox">' . _T("An error occurred :(") . '</p>';
59 }
60 ?>
61 <ul class="leaders">
62 <?php
63 foreach ($install->getInitializationReport() as $r) {
64 ?>
65 <li>
66 <span><?php echo $r['message']; ?></span>
67 <span><?php echo $install->getValidationImage($r['res']); ?></span>
68 </li>
69 <?php
70 }
71 ?>
72 </ul>
73 <form action="installer.php" method="POST">
74 <p id="btn_box">
75 <?php
76 if (!$config_file_ok || !$objects_ok) {
77 ?>
78 <button type="submit"><?php echo _T("Retry"); ?> <i class="fas fa-sync-alt"></i></button>
79 <?php
80 }
81 ?>
82
83 <button type="submit"<?php if (!$config_file_ok || !$objects_ok) { echo ' disabled="disabled"'; } ?>><?php echo _T("Next step"); ?> <i class="fas fa-forward"></i></button>
84 <?php
85 if ($config_file_ok && $objects_ok) {
86 ?>
87 <input type="hidden" name="install_prefs_ok" value="1"/>
88 <?php
89 }
90
91 if (!$config_file_ok || !$objects_ok) {
92 //once DB is installed, that does not make sense to go back
93 ?>
94 <button type="submit" id="btnback" name="stepback_btn" formnovalidate><i class="fas fa-backward"></i> <?php echo _T("Back"); ?></button>
95 <?php
96 }
97 ?>
98 </p>
99 </form>