Overview
Comment:Ne pas laisser la possibilité d'automatiser comme ça, c'est trop bancal
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 249da9228ebc6d527ad0551ac6efa50469530153
User & Date: bohwaz on 2014-04-18 03:48:54
Other Links: manifest | tags
Context
2014-04-18
04:08
identité, pas identifiant check-in: 346ce111fe user: bohwaz tags: trunk
03:48
Ne pas laisser la possibilité d'automatiser comme ça, c'est trop bancal check-in: 249da9228e user: bohwaz tags: trunk
00:13
Possibilité d'automatiser l'installation check-in: 35f1482326 user: bohwaz tags: trunk
Changes

Modified src/templates/admin/_head.tpl from [d322c7d535] to [5bde3176cb].

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
        </li>
    {else}
        <li class="home{if $current == 'home'} current{/if}"><a href="{$admin_url}">Accueil <b class="icn">⌂</b></a></li>
        {if !empty($plugins_menu)}
            <li class="plugins">
                <ul>
                {foreach from=$plugins_menu key="id" item="name"}
                    <li class="plugins {$id|escape}{if $current == 'plugin_`$id`'} current{/if}"><a href="{plugin_url id=$id}">{$name|escape}</a></li>
                {/foreach}
                </ul>
            </li>
        {/if}
        {if $user.droits.membres >= Garradin\Membres::DROIT_ACCES}
            <li class="member list{if $current == 'membres'} current{/if}"><a href="{$admin_url}membres/">Membres <b class="icn">👪</b></a>
            {if $user.droits.membres >= Garradin\Membres::DROIT_ECRITURE}







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
        </li>
    {else}
        <li class="home{if $current == 'home'} current{/if}"><a href="{$admin_url}">Accueil <b class="icn">⌂</b></a></li>
        {if !empty($plugins_menu)}
            <li class="plugins">
                <ul>
                {foreach from=$plugins_menu key="id" item="name"}
                    <li class="plugins {if $current == "plugin_`$id`"} current{/if}"><a href="{plugin_url id=$id}">{$name|escape}</a></li>
                {/foreach}
                </ul>
            </li>
        {/if}
        {if $user.droits.membres >= Garradin\Membres::DROIT_ACCES}
            <li class="member list{if $current == 'membres'} current{/if}"><a href="{$admin_url}membres/">Membres <b class="icn">👪</b></a>
            {if $user.droits.membres >= Garradin\Membres::DROIT_ECRITURE}

Modified src/www/admin/install.php from [e5c3b5dcb2] to [a61438fd4d].

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const INSTALL_PROCESS = true;

require_once __DIR__ . '/../../include/init.php';

// Vérifier que les répertoires vides existent, sinon les créer
$paths = [DATA_ROOT . '/cache', DATA_ROOT . '/cache/static', DATA_ROOT . '/cache/compiled'];


foreach ($paths as $path)
{
    if (!file_exists($path))
        mkdir($path);

    test_requis(
        file_exists($path) && is_dir($path),







<







64
65
66
67
68
69
70

71
72
73
74
75
76
77
const INSTALL_PROCESS = true;

require_once __DIR__ . '/../../include/init.php';

// Vérifier que les répertoires vides existent, sinon les créer
$paths = [DATA_ROOT . '/cache', DATA_ROOT . '/cache/static', DATA_ROOT . '/cache/compiled'];


foreach ($paths as $path)
{
    if (!file_exists($path))
        mkdir($path);

    test_requis(
        file_exists($path) && is_dir($path),
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
else
{
    $tpl->assign('disabled', false);
    $error = false;

    if (!empty($_POST['save']))
    {
        if (!defined('Garradin\AUTOMATED_INSTALL') && !utils::CSRF_check('install'))
        {
            $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
        }
        elseif (utils::post('passe_membre') != utils::post('repasse_membre'))
        {
            $error = 'La vérification ne correspond pas au mot de passe.';
        }







|







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
else
{
    $tpl->assign('disabled', false);
    $error = false;

    if (!empty($_POST['save']))
    {
        if (!utils::CSRF_check('install'))
        {
            $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
        }
        elseif (utils::post('passe_membre') != utils::post('repasse_membre'))
        {
            $error = 'La vérification ne correspond pas au mot de passe.';
        }
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
                    'libelle'   =>  'Premier exercice',
                    'debut'     =>  date('Y-01-01'),
                    'fin'       =>  date('Y-12-31')
                ]);

                $config->save();

                // Installation automatique des plugins fournis
                $plugins = Plugin::listDownloaded();

                if (!empty($plugins))
                {
                    foreach ($plugins as $plugin)
                    {
                        Plugin::install($plugin);
                    }
                }

                if (!defined('Garradin\AUTOMATED_INSTALL'))
                {
                    utils::redirect('/admin/login.php');
                }
            }
            catch (UserException $e)
            {
                @unlink(DB_FILE);

                if (defined('Garradin\AUTOMATED_INSTALL'))
                {
                    throw $e;
                }
                else
                {
                    $error = $e->getMessage();
                }
            }
        }
    }

    $tpl->assign('error', $error);
}

if (!defined('Garradin\AUTOMATED_INSTALL'))
{
    $tpl->assign('passphrase', utils::suggestPassword());
    $tpl->display('admin/install.tpl');
}







<
<
<
<
<
<
<
<
<
<
<
<
<
|
<





<
<
<
<
<
<
|
<







<
<
|
|
<
224
225
226
227
228
229
230













231

232
233
234
235
236






237

238
239
240
241
242
243
244


245
246

                    'libelle'   =>  'Premier exercice',
                    'debut'     =>  date('Y-01-01'),
                    'fin'       =>  date('Y-12-31')
                ]);

                $config->save();














                utils::redirect('/admin/login.php');

            }
            catch (UserException $e)
            {
                @unlink(DB_FILE);







                $error = $e->getMessage();

            }
        }
    }

    $tpl->assign('error', $error);
}



$tpl->assign('passphrase', utils::suggestPassword());
$tpl->display('admin/install.tpl');