Overview
Comment:Passage des tableaux en syntaxe courte
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 458d0edb83e6da86095172c078877735bdadb354
User & Date: bohwaz on 2014-03-14 18:44:03
Other Links: manifest | tags
Context
2014-03-20
18:29
Petit outil rapide pour packager une extension check-in: d59b16e23e user: bohwaz tags: trunk
2014-03-14
18:44
Passage des tableaux en syntaxe courte check-in: 458d0edb83 user: bohwaz tags: trunk
18:43
teste la syntaxe des fichiers php check-in: d790e59035 user: bohwaz tags: trunk
Changes

Modified src/www/admin/compta/banques/ajouter.php from [157d630661] to [e30c487fb2].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $banque->add(array(
                'libelle'       =>  utils::post('libelle'),
                'banque'        =>  utils::post('banque'),
                'iban'          =>  utils::post('iban'),
                'bic'           =>  utils::post('bic'),
            ));

            utils::redirect('/admin/compta/banques/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|




|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $banque->add([
                'libelle'       =>  utils::post('libelle'),
                'banque'        =>  utils::post('banque'),
                'iban'          =>  utils::post('iban'),
                'bic'           =>  utils::post('bic'),
            ]);

            utils::redirect('/admin/compta/banques/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/compta/banques/modifier.php from [2d8b19f471] to [9c6ce7f204].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $banque->edit($compte['id'], array(
                'libelle'       =>  utils::post('libelle'),
                'banque'        =>  utils::post('banque'),
                'iban'          =>  utils::post('iban'),
                'bic'           =>  utils::post('bic'),
            ));

            utils::redirect('/admin/compta/banques/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|




|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $banque->edit($compte['id'], [
                'libelle'       =>  utils::post('libelle'),
                'banque'        =>  utils::post('banque'),
                'iban'          =>  utils::post('iban'),
                'bic'           =>  utils::post('bic'),
            ]);

            utils::redirect('/admin/compta/banques/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/compta/categories/ajouter.php from [e88782f185] to [79075d4431].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $cats->add(array(
                'intitule'      =>  utils::post('intitule'),
                'description'   =>  utils::post('description'),
                'compte'        =>  utils::post('compte'),
                'type'          =>  utils::post('type'),
            ));

            if (utils::post('type') == Compta_Categories::DEPENSES)
                $type = 'depenses';
            elseif (utils::post('type') == Compta_Categories::AUTRES)
                $type = 'autres';
            else
                $type = 'recettes';







|




|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $cats->add([
                'intitule'      =>  utils::post('intitule'),
                'description'   =>  utils::post('description'),
                'compte'        =>  utils::post('compte'),
                'type'          =>  utils::post('type'),
            ]);

            if (utils::post('type') == Compta_Categories::DEPENSES)
                $type = 'depenses';
            elseif (utils::post('type') == Compta_Categories::AUTRES)
                $type = 'autres';
            else
                $type = 'recettes';

Modified src/www/admin/compta/categories/modifier.php from [ada5e96d69] to [91c6ea40ba].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $cats->edit($id,
                array(
                'intitule'      =>  utils::post('intitule'),
                'description'   =>  utils::post('description'),
            ));

            if ($cat['type'] == Compta_Categories::DEPENSES)
                $type = 'depenses';
            elseif ($cat['type'] == Compta_Categories::AUTRES)
                $type = 'autres';
            else
                $type = 'recettes';







|
<


|







26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $cats->edit($id, [

                'intitule'      =>  utils::post('intitule'),
                'description'   =>  utils::post('description'),
            ]);

            if ($cat['type'] == Compta_Categories::DEPENSES)
                $type = 'depenses';
            elseif ($cat['type'] == Compta_Categories::AUTRES)
                $type = 'autres';
            else
                $type = 'recettes';

Modified src/www/admin/compta/comptes/ajouter.php from [c130f35679] to [d37401b2ac].

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $comptes->add(array(
                'id'            =>  utils::post('numero'),
                'libelle'       =>  utils::post('libelle'),
                'parent'        =>  utils::post('parent'),
                'position'      =>  utils::post('position'),
            ));

            utils::redirect('/admin/compta/comptes/?classe='.$classe);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|




|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $comptes->add([
                'id'            =>  utils::post('numero'),
                'libelle'       =>  utils::post('libelle'),
                'parent'        =>  utils::post('parent'),
                'position'      =>  utils::post('position'),
            ]);

            utils::redirect('/admin/compta/comptes/?classe='.$classe);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/compta/comptes/modifier.php from [6b5daa24ea] to [f47f82b5ec].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $comptes->edit($compte['id'], array(
                'libelle'       =>  utils::post('libelle'),
                'position'      =>  utils::post('position'),
            ));

            utils::redirect('/admin/compta/comptes/?classe='.substr($compte['id'], 0, 1));
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|


|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $comptes->edit($compte['id'], [
                'libelle'       =>  utils::post('libelle'),
                'position'      =>  utils::post('position'),
            ]);

            utils::redirect('/admin/compta/comptes/?classe='.substr($compte['id'], 0, 1));
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/compta/exercices/ajouter.php from [3a802d8ee5] to [0b5b6e8f75].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $e->add(array(
                'libelle'   =>  utils::post('libelle'),
                'debut'     =>  utils::post('debut'),
                'fin'       =>  utils::post('fin'),
            ));

            utils::redirect('/admin/compta/exercices/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|



|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $e->add([
                'libelle'   =>  utils::post('libelle'),
                'debut'     =>  utils::post('debut'),
                'fin'       =>  utils::post('fin'),
            ]);

            utils::redirect('/admin/compta/exercices/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/compta/exercices/modifier.php from [9539ce9833] to [4e866894e2].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $e->edit($exercice['id'], array(
                'libelle'   =>  utils::post('libelle'),
                'debut'     =>  utils::post('debut'),
                'fin'       =>  utils::post('fin'),
            ));

            utils::redirect('/admin/compta/exercices/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|



|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $e->edit($exercice['id'], [
                'libelle'   =>  utils::post('libelle'),
                'debut'     =>  utils::post('debut'),
                'fin'       =>  utils::post('fin'),
            ]);

            utils::redirect('/admin/compta/exercices/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/compta/graph.php from [79c2b4054b] to [31e9cec4e4].

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

if (!in_array(utils::get('g'), array('recettes_depenses', 'banques_caisses')))
{
	throw new UserException('Graphique inconnu.');
}

$graph = utils::get('g');

if (Static_Cache::expired('graph_' . $graph))





|







1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

if (!in_array(utils::get('g'), ['recettes_depenses', 'banques_caisses']))
{
	throw new UserException('Graphique inconnu.');
}

$graph = utils::get('g');

if (Static_Cache::expired('graph_' . $graph))
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	{
		$r = new \SVGPlot_Data($stats->recettes());
		$r->title = 'Recettes';

		$d = new \SVGPlot_Data($stats->depenses());
		$d->title = 'Dépenses';

		$data = array($d, $r);

		$plot->setTitle('Recettes et dépenses de l\'exercice courant');
	}
	elseif ($graph == 'banques_caisses')
	{
		$banques = new Compta_Comptes_Bancaires;

		$data = array();

		$r = new \SVGPlot_Data($stats->soldeCompte(Compta_Comptes::CAISSE));
		$r->title = 'Caisse';

		$data[] = $r;

		foreach ($banques->getList() as $banque)
		{
			$r = new \SVGPlot_Data($stats->soldeCompte($banque['id']));
			$r->title = $banque['libelle'];
			$data[] = $r;
		}

		$plot->setTitle('Solde des comptes et caisses');
	}

	if (!empty($data))
	{
		$labels = array();

		foreach ($data[0]->get() as $k=>$v)
		{
			$labels[] = utils::date_fr('M y', strtotime(substr($k, 0, 4) . '-' . substr($k, 4, 2) .'-01'));
		}

		$plot->setLabels($labels);

		$i = 0;
		$colors = array('#c71', '#941', '#fa4', '#fd9', '#ffc', '#cc9');

		foreach ($data as $line)
		{
			$line->color = $colors[$i++];
			$line->width = 2;
			$plot->add($line);








|







|


















|









|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	{
		$r = new \SVGPlot_Data($stats->recettes());
		$r->title = 'Recettes';

		$d = new \SVGPlot_Data($stats->depenses());
		$d->title = 'Dépenses';

		$data = [$d, $r];

		$plot->setTitle('Recettes et dépenses de l\'exercice courant');
	}
	elseif ($graph == 'banques_caisses')
	{
		$banques = new Compta_Comptes_Bancaires;

		$data = [];

		$r = new \SVGPlot_Data($stats->soldeCompte(Compta_Comptes::CAISSE));
		$r->title = 'Caisse';

		$data[] = $r;

		foreach ($banques->getList() as $banque)
		{
			$r = new \SVGPlot_Data($stats->soldeCompte($banque['id']));
			$r->title = $banque['libelle'];
			$data[] = $r;
		}

		$plot->setTitle('Solde des comptes et caisses');
	}

	if (!empty($data))
	{
		$labels = [];

		foreach ($data[0]->get() as $k=>$v)
		{
			$labels[] = utils::date_fr('M y', strtotime(substr($k, 0, 4) . '-' . substr($k, 4, 2) .'-01'));
		}

		$plot->setLabels($labels);

		$i = 0;
		$colors = ['#c71', '#941', '#fa4', '#fd9', '#ffc', '#cc9'];

		foreach ($data as $line)
		{
			$line->color = $colors[$i++];
			$line->width = 2;
			$plot->add($line);

Modified src/www/admin/compta/operations/modifier.php from [0db663cc75] to [a7a0ab58d0].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    }
    else
    {
        try
        {
            if (is_null($type))
            {
                $journal->edit($operation['id'], array(
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'compte_credit' =>  utils::post('compte_credit'),
                    'compte_debit'  =>  utils::post('compte_debit'),
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                ));
            }
            else
            {
                $cat = $cats->get(utils::post('id_categorie'));

                if (!$cat)
                {







|







|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    }
    else
    {
        try
        {
            if (is_null($type))
            {
                $journal->edit($operation['id'], [
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'compte_credit' =>  utils::post('compte_credit'),
                    'compte_debit'  =>  utils::post('compte_debit'),
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                ]);
            }
            else
            {
                $cat = $cats->get(utils::post('id_categorie'));

                if (!$cat)
                {
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
                }
                elseif ($type == Compta_Categories::RECETTES)
                {
                    $debit = $a;
                    $credit = $b;
                }

                $journal->edit($operation['id'], array(
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'moyen_paiement'=>  utils::post('moyen_paiement'),
                    'numero_cheque' =>  utils::post('numero_cheque'),
                    'compte_credit' =>  $credit,
                    'compte_debit'  =>  $debit,
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_categorie'  =>  (int)$cat['id'],
                ));
            }

            utils::redirect('/admin/compta/operations/voir.php?id='.(int)$operation['id']);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();







|










|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
                }
                elseif ($type == Compta_Categories::RECETTES)
                {
                    $debit = $a;
                    $credit = $b;
                }

                $journal->edit($operation['id'], [
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'moyen_paiement'=>  utils::post('moyen_paiement'),
                    'numero_cheque' =>  utils::post('numero_cheque'),
                    'compte_credit' =>  $credit,
                    'compte_debit'  =>  $debit,
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_categorie'  =>  (int)$cat['id'],
                ]);
            }

            utils::redirect('/admin/compta/operations/voir.php?id='.(int)$operation['id']);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();

Modified src/www/admin/compta/operations/saisir.php from [f93b97fdd6] to [6bd2225100].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
    }
    else
    {
        try
        {
            if (is_null($type))
            {
                $id = $journal->add(array(
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'compte_credit' =>  utils::post('compte_credit'),
                    'compte_debit'  =>  utils::post('compte_debit'),
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_auteur'     =>  $user['id'],
                ));
            }
            elseif ($type === 'virement')
            {
                $id = $journal->add(array(
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'compte_credit' =>  utils::post('compte1'),
                    'compte_debit'  =>  utils::post('compte2'),
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_auteur'     =>  $user['id'],
                ));
            }
            else
            {
                $cat = $cats->get(utils::post('categorie'));

                if (!$cat)
                {







|








|



|








|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
    }
    else
    {
        try
        {
            if (is_null($type))
            {
                $id = $journal->add([
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'compte_credit' =>  utils::post('compte_credit'),
                    'compte_debit'  =>  utils::post('compte_debit'),
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_auteur'     =>  $user['id'],
                ]);
            }
            elseif ($type === 'virement')
            {
                $id = $journal->add([
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'compte_credit' =>  utils::post('compte1'),
                    'compte_debit'  =>  utils::post('compte2'),
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_auteur'     =>  $user['id'],
                ]);
            }
            else
            {
                $cat = $cats->get(utils::post('categorie'));

                if (!$cat)
                {
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
                }
                elseif ($type === 'dette')
                {
                    $debit = $cat['compte'];
                    $credit = utils::post('compte');
                }

                $id = $journal->add(array(
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'moyen_paiement'=>  ($type === 'dette') ? null : utils::post('moyen_paiement'),
                    'numero_cheque' =>  ($type === 'dette') ? null : utils::post('numero_cheque'),
                    'compte_credit' =>  $credit,
                    'compte_debit'  =>  $debit,
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_categorie'  =>  ($type === 'dette') ? null : (int)$cat['id'],
                    'id_auteur'     =>  $user['id'],
                ));
            }

            $membres->sessionStore('compta_date', utils::post('date'));

            if ($type == Compta_Categories::DEPENSES)
                $type = 'depense';
            elseif (is_null($type))







|











|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
                }
                elseif ($type === 'dette')
                {
                    $debit = $cat['compte'];
                    $credit = utils::post('compte');
                }

                $id = $journal->add([
                    'libelle'       =>  utils::post('libelle'),
                    'montant'       =>  utils::post('montant'),
                    'date'          =>  utils::post('date'),
                    'moyen_paiement'=>  ($type === 'dette') ? null : utils::post('moyen_paiement'),
                    'numero_cheque' =>  ($type === 'dette') ? null : utils::post('numero_cheque'),
                    'compte_credit' =>  $credit,
                    'compte_debit'  =>  $debit,
                    'numero_piece'  =>  utils::post('numero_piece'),
                    'remarques'     =>  utils::post('remarques'),
                    'id_categorie'  =>  ($type === 'dette') ? null : (int)$cat['id'],
                    'id_auteur'     =>  $user['id'],
                ]);
            }

            $membres->sessionStore('compta_date', utils::post('date'));

            if ($type == Compta_Categories::DEPENSES)
                $type = 'depense';
            elseif (is_null($type))

Modified src/www/admin/compta/pie.php from [e452ea3f35] to [7c03ac3ef3].

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

if (!in_array(utils::get('g'), array('recettes', 'depenses')))
{
	throw new UserException('Graphique inconnu.');
}

$graph = utils::get('g');

if (Static_Cache::expired('graph_' . $graph))





|







1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

if (!in_array(utils::get('g'), ['recettes', 'depenses']))
{
	throw new UserException('Graphique inconnu.');
}

$graph = utils::get('g');

if (Static_Cache::expired('graph_' . $graph))
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
	{
		$data = $stats->repartitionDepenses();
		$categories = $categories->getList(Compta_Categories::DEPENSES);
		$pie->setTitle('Répartition des dépenses');
	}

	$others = 0;
	$colors = array('#c71', '#941', '#fa4', '#fd9', '#ffc', '#cc9');
	$max = count($colors);
	$i = 0;

	foreach ($data as $row)
	{
		if ($i++ >= $max)
		{







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
	{
		$data = $stats->repartitionDepenses();
		$categories = $categories->getList(Compta_Categories::DEPENSES);
		$pie->setTitle('Répartition des dépenses');
	}

	$others = 0;
	$colors = ['#c71', '#941', '#fa4', '#fd9', '#ffc', '#cc9'];
	$max = count($colors);
	$i = 0;

	foreach ($data as $row)
	{
		if ($i++ >= $max)
		{

Modified src/www/admin/config/index.php from [3ad54e6d14] to [3cf4b11b92].

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

$tpl->assign('pays', utils::getCountryList());

$cats = new Membres_Categories;
$tpl->assign('membres_cats', $cats->listSimple());

$champs_liste = array_merge(
    array('id' => array('title' => 'Numéro unique', 'type' => 'number')),
    $config->get('champs_membres')->getList()
);
$tpl->assign('champs', $champs_liste);

$tpl->display('admin/config/index.tpl');

?>







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

$tpl->assign('pays', utils::getCountryList());

$cats = new Membres_Categories;
$tpl->assign('membres_cats', $cats->listSimple());

$champs_liste = array_merge(
    ['id' => ['title' => 'Numéro unique', 'type' => 'number']],
    $config->get('champs_membres')->getList()
);
$tpl->assign('champs', $champs_liste);

$tpl->display('admin/config/index.tpl');

?>

Modified src/www/admin/config/membres.php from [7233ffcadf] to [6af05d6c44].

77
78
79
80
81
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
100
                    $new = utils::post('new');

                    if (array_key_exists($new, $presets))
                    {
                        throw new UserException('Le champ personnalisé ne peut avoir le même nom qu\'un champ pré-défini.');
                    }

                    $config = array(
                        'type'  =>  utils::post('new_type'),
                        'title' =>  utils::post('new_title'),
                        'editable'  =>  true,
                        'mandatory' =>  false,
                    );


                    if ($config['type'] == 'select' || $config['type'] == 'multiple')
                    {
                        $config['options'] = array('Première option');
                    }

                    $champs->add($new, $config);
                }

                $membres->sessionStore('champs_membres', (string) $champs);








|




<
>



|







77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
                    $new = utils::post('new');

                    if (array_key_exists($new, $presets))
                    {
                        throw new UserException('Le champ personnalisé ne peut avoir le même nom qu\'un champ pré-défini.');
                    }

                    $config = [
                        'type'  =>  utils::post('new_type'),
                        'title' =>  utils::post('new_title'),
                        'editable'  =>  true,
                        'mandatory' =>  false,

                    ];

                    if ($config['type'] == 'select' || $config['type'] == 'multiple')
                    {
                        $config['options'] = ['Première option'];
                    }

                    $champs->add($new, $config);
                }

                $membres->sessionStore('champs_membres', (string) $champs);

Modified src/www/admin/config/site.php from [c9a6330cc6] to [b7ce7813a6].

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
            else
            {
                $error = "Impossible d'enregistrer le squelette.";
            }
        }
    }

    $tpl->assign('edit', array('file' => trim(utils::get('edit')), 'content' => $source));
    $tpl->assign('csrf_key', $csrf_key);
    $tpl->assign('sources_json', json_encode(Squelette::listSources()));
}
else
{
    $tpl->assign('sources', Squelette::listSources());
}

$tpl->assign('error', $error);
$tpl->display('admin/config/site.tpl');

?>







|












59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
            else
            {
                $error = "Impossible d'enregistrer le squelette.";
            }
        }
    }

    $tpl->assign('edit', ['file' => trim(utils::get('edit')), 'content' => $source]);
    $tpl->assign('csrf_key', $csrf_key);
    $tpl->assign('sources_json', json_encode(Squelette::listSources()));
}
else
{
    $tpl->assign('sources', Squelette::listSources());
}

$tpl->assign('error', $error);
$tpl->display('admin/config/site.tpl');

?>

Modified src/www/admin/install.php from [d249453e50] to [72a3857c93].

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

224



225
226
227
228
229
230
231
                // Création catégories
                $cats = new Membres_Categories;
                $id = $cats->add([
                    'nom' => 'Membres actifs',
                ]);
                $config->set('categorie_membres', $id);

                $id = $cats->add(array(
                    'nom' => 'Anciens membres',
                    'droit_inscription' => Membres::DROIT_AUCUN,
                    'droit_wiki' => Membres::DROIT_AUCUN,
                    'droit_membres' => Membres::DROIT_AUCUN,
                    'droit_compta' => Membres::DROIT_AUCUN,
                    'droit_config' => Membres::DROIT_AUCUN,
                    'droit_connexion' => Membres::DROIT_AUCUN,
                    'cacher' => 1,
                    ));

                $id = $cats->add(array(
                    'nom' => ucfirst(utils::post('cat_membre')),
                    'droit_inscription' => Membres::DROIT_AUCUN,
                    'droit_wiki' => Membres::DROIT_ADMIN,
                    'droit_membres' => Membres::DROIT_ADMIN,
                    'droit_compta' => Membres::DROIT_ADMIN,
                    'droit_config' => Membres::DROIT_ADMIN,
                    ));

                // Création premier membre
                $membres = new Membres;
                $id_membre = $membres->add(array(
                    'id_categorie'  =>  $id,
                    'nom'           =>  utils::post('nom_membre'),
                    'email'         =>  utils::post('email_membre'),
                    'passe'         =>  utils::post('passe_membre'),
                    'pays'          =>  'FR',
                ));

                // Création wiki
                $page = Wiki::transformTitleToURI(utils::post('nom_asso'));
                $config->set('accueil_wiki', $page);
                $wiki = new Wiki;
                $id_page = $wiki->create(array(
                    'titre' =>  utils::post('nom_asso'),
                    'uri'   =>  $page,
                ));

                $wiki->editRevision($id_page, 0, array(
                    'id_auteur' =>  $id_membre,
                    'contenu'   =>  "Bienvenue dans le wiki de ".utils::post('nom_asso')." !\n\nCliquez sur le bouton « éditer » pour modifier cette page.",
                ));

                // Création page wiki connexion
                $page = Wiki::transformTitleToURI('Bienvenue');
                $config->set('accueil_connexion', $page);
                $id_page = $wiki->create(array(
                    'titre' =>  'Bienvenue',
                    'uri'   =>  $page,
                ));

                $wiki->editRevision($id_page, 0, array(
                    'id_auteur' =>  $id_membre,
                    'contenu'   =>  "Bienvenue dans l'administration de ".utils::post('nom_asso')." !\n\n"
                        .   "Utilisez le menu à gauche pour accéder aux différentes rubriques.",
                ));                

                // Mise en place compta
                $comptes = new Compta_Comptes;
                $comptes->importPlan();

                $comptes = new Compta_Categories;
                $comptes->importCategories();

                $ex = new Compta_Exercices;

                $ex->add(array('libelle' => 'Premier exercice', 'debut' => date('Y-01-01'), 'fin' => date('Y-12-31')));




                $config->save();

                utils::redirect('/admin/login.php');
            }
            catch (UserException $e)
            {







|








|

|






|



|





|





|


|

|


|




|


|

|



|









>
|
>
>
>







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
                // Création catégories
                $cats = new Membres_Categories;
                $id = $cats->add([
                    'nom' => 'Membres actifs',
                ]);
                $config->set('categorie_membres', $id);

                $id = $cats->add([
                    'nom' => 'Anciens membres',
                    'droit_inscription' => Membres::DROIT_AUCUN,
                    'droit_wiki' => Membres::DROIT_AUCUN,
                    'droit_membres' => Membres::DROIT_AUCUN,
                    'droit_compta' => Membres::DROIT_AUCUN,
                    'droit_config' => Membres::DROIT_AUCUN,
                    'droit_connexion' => Membres::DROIT_AUCUN,
                    'cacher' => 1,
                ]);

                $id = $cats->add([
                    'nom' => ucfirst(utils::post('cat_membre')),
                    'droit_inscription' => Membres::DROIT_AUCUN,
                    'droit_wiki' => Membres::DROIT_ADMIN,
                    'droit_membres' => Membres::DROIT_ADMIN,
                    'droit_compta' => Membres::DROIT_ADMIN,
                    'droit_config' => Membres::DROIT_ADMIN,
                ]);

                // Création premier membre
                $membres = new Membres;
                $id_membre = $membres->add([
                    'id_categorie'  =>  $id,
                    'nom'           =>  utils::post('nom_membre'),
                    'email'         =>  utils::post('email_membre'),
                    'passe'         =>  utils::post('passe_membre'),
                    'pays'          =>  'FR',
                ]);

                // Création wiki
                $page = Wiki::transformTitleToURI(utils::post('nom_asso'));
                $config->set('accueil_wiki', $page);
                $wiki = new Wiki;
                $id_page = $wiki->create([
                    'titre' =>  utils::post('nom_asso'),
                    'uri'   =>  $page,
                ]);

                $wiki->editRevision($id_page, 0, [
                    'id_auteur' =>  $id_membre,
                    'contenu'   =>  "Bienvenue dans le wiki de ".utils::post('nom_asso')." !\n\nCliquez sur le bouton « éditer » pour modifier cette page.",
                ]);

                // Création page wiki connexion
                $page = Wiki::transformTitleToURI('Bienvenue');
                $config->set('accueil_connexion', $page);
                $id_page = $wiki->create([
                    'titre' =>  'Bienvenue',
                    'uri'   =>  $page,
                ]);

                $wiki->editRevision($id_page, 0, [
                    'id_auteur' =>  $id_membre,
                    'contenu'   =>  "Bienvenue dans l'administration de ".utils::post('nom_asso')." !\n\n"
                        .   "Utilisez le menu à gauche pour accéder aux différentes rubriques.",
                ]);

                // Mise en place compta
                $comptes = new Compta_Comptes;
                $comptes->importPlan();

                $comptes = new Compta_Categories;
                $comptes->importCategories();

                $ex = new Compta_Exercices;
                $ex->add([
                    'libelle'   =>  'Premier exercice',
                    'debut'     =>  date('Y-01-01'),
                    'fin'       =>  date('Y-12-31')
                ]);

                $config->save();

                utils::redirect('/admin/login.php');
            }
            catch (UserException $e)
            {

Modified src/www/admin/membres/ajouter.php from [fef2b088e2] to [60b2a14cea].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
                $id_categorie = utils::post('id_categorie');
            }
            else
            {
                $id_categorie = $config->get('categorie_membres');
            }

            $data = array('id_categorie' => $id_categorie);

            foreach ($champs->getAll() as $key=>$dismiss)
            {
                $data[$key] = utils::post($key);
            }

            $id = $membres->add($data);







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
                $id_categorie = utils::post('id_categorie');
            }
            else
            {
                $id_categorie = $config->get('categorie_membres');
            }

            $data = ['id_categorie' => $id_categorie];

            foreach ($champs->getAll() as $key=>$dismiss)
            {
                $data[$key] = utils::post($key);
            }

            $id = $membres->add($data);

Modified src/www/admin/membres/cat_modifier.php from [f8f45fcb9d] to [bdc34c67d3].

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    if (!utils::CSRF_check('edit_cat_'.$id))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $cats->edit($id, array(
                'nom'           =>  utils::post('nom'),
                'description'   =>  utils::post('description'),
                'droit_wiki'    =>  (int) utils::post('droit_wiki'),
                'droit_compta'  =>  (int) utils::post('droit_compta'),
                'droit_config'  =>  (int) utils::post('droit_config'),
                'droit_membres' =>  (int) utils::post('droit_membres'),
                'droit_connexion' => (int) utils::post('droit_connexion'),
                'droit_inscription' => (int) utils::post('droit_inscription'),
                'cacher'        =>  (int) utils::post('cacher'),
                'id_cotisation_obligatoire' => (int) utils::post('id_cotisation_obligatoire'),
            ));

            if ($id == $user['id_categorie'])
            {
                $membres->updateSessionData();
            }

            utils::redirect('/admin/membres/categories.php');







|










|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    if (!utils::CSRF_check('edit_cat_'.$id))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $cats->edit($id, [
                'nom'           =>  utils::post('nom'),
                'description'   =>  utils::post('description'),
                'droit_wiki'    =>  (int) utils::post('droit_wiki'),
                'droit_compta'  =>  (int) utils::post('droit_compta'),
                'droit_config'  =>  (int) utils::post('droit_config'),
                'droit_membres' =>  (int) utils::post('droit_membres'),
                'droit_connexion' => (int) utils::post('droit_connexion'),
                'droit_inscription' => (int) utils::post('droit_inscription'),
                'cacher'        =>  (int) utils::post('cacher'),
                'id_cotisation_obligatoire' => (int) utils::post('id_cotisation_obligatoire'),
            ]);

            if ($id == $user['id_categorie'])
            {
                $membres->updateSessionData();
            }

            utils::redirect('/admin/membres/categories.php');

Modified src/www/admin/membres/categories.php from [bde267818a] to [497ff3f034].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    if (!utils::CSRF_check('new_cat'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $cats->add(array(
                'nom'           =>  utils::post('nom'),
            ));

            utils::redirect('/admin/membres/categories.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|

|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    if (!utils::CSRF_check('new_cat'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $cats->add([
                'nom'           =>  utils::post('nom'),
            ]);

            utils::redirect('/admin/membres/categories.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/membres/cotisations/gestion/modifier.php from [f3131b49eb] to [43742910c5].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    {
        try {
            $duree = utils::post('periodicite') == 'jours' ? (int) utils::post('duree') : null;
            $debut = utils::post('periodicite') == 'date' ? utils::post('debut') : null;
            $fin = utils::post('periodicite') == 'date' ? utils::post('fin') : null;
            $id_cat = utils::post('categorie') ? (int) utils::post('id_categorie_compta') : null;

            $cotisations->edit($co['id'], array(
                'intitule'          =>  utils::post('intitule'),
                'description'       =>  utils::post('description'),
                'montant'           =>  (float) utils::post('montant'),
                'duree'             =>  $duree,
                'debut'             =>  $debut,
                'fin'               =>  $fin,
                'id_categorie_compta'=> $id_cat,
            ));

            utils::redirect('/admin/membres/cotisations/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    {
        try {
            $duree = utils::post('periodicite') == 'jours' ? (int) utils::post('duree') : null;
            $debut = utils::post('periodicite') == 'date' ? utils::post('debut') : null;
            $fin = utils::post('periodicite') == 'date' ? utils::post('fin') : null;
            $id_cat = utils::post('categorie') ? (int) utils::post('id_categorie_compta') : null;

            $cotisations->edit($co['id'], [
                'intitule'          =>  utils::post('intitule'),
                'description'       =>  utils::post('description'),
                'montant'           =>  (float) utils::post('montant'),
                'duree'             =>  $duree,
                'debut'             =>  $debut,
                'fin'               =>  $fin,
                'id_categorie_compta'=> $id_cat,
            ]);

            utils::redirect('/admin/membres/cotisations/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/membres/cotisations/gestion/rappels.php from [0a1abba845] to [4e1ead9eee].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    }
    else
    {
        try {
        	$delai = (int) utils::post('delai');
            $delai = utils::post('delai_pre') ? -$delai : $delai;

            $rappels->add(array(
                'sujet'		=>	utils::post('sujet'),
                'texte'		=>	utils::post('texte'),
                'delai'		=>	$delai,
                'id_cotisation'	=>	utils::post('id_cotisation'),
            ));

            utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|




|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    }
    else
    {
        try {
        	$delai = (int) utils::post('delai');
            $delai = utils::post('delai_pre') ? -$delai : $delai;

            $rappels->add([
                'sujet'		=>	utils::post('sujet'),
                'texte'		=>	utils::post('texte'),
                'delai'		=>	$delai,
                'id_cotisation'	=>	utils::post('id_cotisation'),
            ]);

            utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/membres/cotisations/index.php from [1398fb493e] to [d6edc8b919].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	    {
	        try {
	            $duree = utils::post('periodicite') == 'jours' ? (int) utils::post('duree') : null;
	            $debut = utils::post('periodicite') == 'date' ? utils::post('debut') : null;
	            $fin = utils::post('periodicite') == 'date' ? utils::post('fin') : null;
	            $id_cat = utils::post('categorie') ? (int) utils::post('id_categorie_compta') : null;

	            $cotisations->add(array(
	                'intitule'          =>  utils::post('intitule'),
	                'description'       =>  utils::post('description'),
	                'montant'           =>  (float) utils::post('montant'),
	                'duree'             =>  $duree,
	                'debut'             =>  $debut,
	                'fin'               =>  $fin,
	                'id_categorie_compta'=> $id_cat,
	            ));

	            utils::redirect('/admin/membres/cotisations/');
	        }
	        catch (UserException $e)
	        {
	            $error = $e->getMessage();
	        }







|







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	    {
	        try {
	            $duree = utils::post('periodicite') == 'jours' ? (int) utils::post('duree') : null;
	            $debut = utils::post('periodicite') == 'date' ? utils::post('debut') : null;
	            $fin = utils::post('periodicite') == 'date' ? utils::post('fin') : null;
	            $id_cat = utils::post('categorie') ? (int) utils::post('id_categorie_compta') : null;

	            $cotisations->add([
	                'intitule'          =>  utils::post('intitule'),
	                'description'       =>  utils::post('description'),
	                'montant'           =>  (float) utils::post('montant'),
	                'duree'             =>  $duree,
	                'debut'             =>  $debut,
	                'fin'               =>  $fin,
	                'id_categorie_compta'=> $id_cat,
	            ]);

	            utils::redirect('/admin/membres/cotisations/');
	        }
	        catch (UserException $e)
	        {
	            $error = $e->getMessage();
	        }

Modified src/www/admin/membres/modifier.php from [fdf4f97274] to [0a04bb4489].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    elseif (utils::post('passe') != utils::post('repasse'))
    {
        $error = 'La vérification ne correspond pas au mot de passe.';
    }
    else
    {
        try {
            $data = array();

            foreach ($champs->getAll() as $key=>$config)
            {
                $data[$key] = utils::post($key);
            }

            if ($user['droits']['membres'] == Membres::DROIT_ADMIN)







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    elseif (utils::post('passe') != utils::post('repasse'))
    {
        $error = 'La vérification ne correspond pas au mot de passe.';
    }
    else
    {
        try {
            $data = [];

            foreach ($champs->getAll() as $key=>$config)
            {
                $data[$key] = utils::post($key);
            }

            if ($user['droits']['membres'] == Membres::DROIT_ADMIN)

Modified src/www/admin/membres/recherche.php from [08f4098cce] to [a632ab936f].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        utils::redirect('/admin/membres/fiche.php?id=' . (int)$result[0]['id']);
    }
}

$champs_liste = $champs->getList();

$champs_liste = array_merge(
    array('id' => array('title' => 'Numéro unique', 'type' => 'number')),
    $champs_liste
);

$champs_entete = $champs->getListedFields();

if (!array_key_exists($champ, $champs_entete))
{
    $champs_entete = array_merge(
        array($champ => $champs_liste[$champ]),
        $champs_entete
    );
}

$tpl->assign('champs_entete', $champs_entete);
$tpl->assign('champs_liste', $champs_liste);
$tpl->assign('champ', $champ);







|








|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        utils::redirect('/admin/membres/fiche.php?id=' . (int)$result[0]['id']);
    }
}

$champs_liste = $champs->getList();

$champs_liste = array_merge(
    ['id' => ['title' => 'Numéro unique', 'type' => 'number']],
    $champs_liste
);

$champs_entete = $champs->getListedFields();

if (!array_key_exists($champ, $champs_entete))
{
    $champs_entete = array_merge(
        [$champ => $champs_liste[$champ]],
        $champs_entete
    );
}

$tpl->assign('champs_entete', $champs_entete);
$tpl->assign('champs_liste', $champs_liste);
$tpl->assign('champ', $champ);

Modified src/www/admin/mes_infos.php from [0327b2efde] to [865fb1c656].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    elseif (utils::post('passe') != utils::post('repasse'))
    {
        $error = 'La vérification ne correspond pas au mot de passe.';
    }
    else
    {
        try {
            $data = array();

            foreach ($config->get('champs_membres')->getAll() as $key=>$c)
            {
                if (!empty($c['editable']))
                {
                    $data[$key] = utils::post($key);
                }







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    elseif (utils::post('passe') != utils::post('repasse'))
    {
        $error = 'La vérification ne correspond pas au mot de passe.';
    }
    else
    {
        try {
            $data = [];

            foreach ($config->get('champs_membres')->getAll() as $key=>$c)
            {
                if (!empty($c['editable']))
                {
                    $data[$key] = utils::post($key);
                }

Modified src/www/admin/upgrade.php from [2611040d38] to [4d845201ed].

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    // Création page wiki connexion
    $wiki = new Wiki;
    $page = Wiki::transformTitleToURI('Bienvenue');
    $config->set('accueil_connexion', $page);

    if (!$wiki->getByUri($page))
    {
        $id_page = $wiki->create(array(
            'titre' =>  'Bienvenue',
            'uri'   =>  $page,
        ));

        $wiki->editRevision($id_page, 0, array(
            'id_auteur' =>  null,
            'contenu'   =>  "Bienvenue dans l'administration de ".$config->get('nom_asso')." !\n\n"
                .   "Utilisez le menu à gauche pour accéder aux différentes rubriques.",
        ));
    }

    $config->set('accueil_connexion', $page);
    $config->save();
}

if (version_compare($v, '0.5.0', '<'))
{
    // Récupération de l'ancienne config
    $champs_modifiables_membre = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_modifiables_membre";');
    $champs_modifiables_membre = !empty($champs_modifiables_membre) ? explode(',', $champs_modifiables_membre) : array();

    $champs_obligatoires = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_obligatoires";');
    $champs_obligatoires = !empty($champs_obligatoires) ? explode(',', $champs_obligatoires) : array();

    // Import des champs membres par défaut
    $champs = Champs_Membres::importInstall();

    // Application de l'ancienne config aux nouveaux champs membres
    foreach ($champs_obligatoires as $name)
    {







|


|

|



|










|


|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    // Création page wiki connexion
    $wiki = new Wiki;
    $page = Wiki::transformTitleToURI('Bienvenue');
    $config->set('accueil_connexion', $page);

    if (!$wiki->getByUri($page))
    {
        $id_page = $wiki->create([
            'titre' =>  'Bienvenue',
            'uri'   =>  $page,
        ]);

        $wiki->editRevision($id_page, 0, [
            'id_auteur' =>  null,
            'contenu'   =>  "Bienvenue dans l'administration de ".$config->get('nom_asso')." !\n\n"
                .   "Utilisez le menu à gauche pour accéder aux différentes rubriques.",
        ]);
    }

    $config->set('accueil_connexion', $page);
    $config->save();
}

if (version_compare($v, '0.5.0', '<'))
{
    // Récupération de l'ancienne config
    $champs_modifiables_membre = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_modifiables_membre";');
    $champs_modifiables_membre = !empty($champs_modifiables_membre) ? explode(',', $champs_modifiables_membre) : [];

    $champs_obligatoires = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_obligatoires";');
    $champs_obligatoires = !empty($champs_obligatoires) ? explode(',', $champs_obligatoires) : [];

    // Import des champs membres par défaut
    $champs = Champs_Membres::importInstall();

    // Application de l'ancienne config aux nouveaux champs membres
    foreach ($champs_obligatoires as $name)
    {

Modified src/www/admin/wiki/creer.php from [e5fd55da62] to [039b7f7a3f].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    if (!utils::CSRF_check('wiki_create'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $id = $wiki->create(array(
                'titre'         =>  utils::post('titre'),
                'parent'        =>  $parent,
            ));

            utils::redirect('/admin/wiki/editer.php?id='.$id);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }







|


|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    if (!utils::CSRF_check('wiki_create'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $id = $wiki->create([
                'titre'         =>  utils::post('titre'),
                'parent'        =>  $parent,
            ]);

            utils::redirect('/admin/wiki/editer.php?id='.$id);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }

Modified src/www/admin/wiki/editer.php from [2ee6bcb3c6] to [b911107db9].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
    elseif ($page['date_modification'] > (int) utils::post('debut_edition'))
    {
        $error = 'La page a été modifiée par quelqu\'un d\'autre depuis que vous avez commencé l\'édition.';
    }
    else
    {
        try {
            $wiki->edit($page['id'], array(
                'titre'         =>  utils::post('titre'),
                'uri'           =>  utils::post('uri'),
                'parent'        =>  utils::post('parent'),
                'droit_lecture' =>  utils::post('droit_lecture'),
                'droit_ecriture'=>  utils::post('droit_ecriture'),
                'date_creation' =>  $date,
            ));

            $wiki->editRevision($page['id'], (int) utils::post('revision_edition'), array(
                'contenu'       =>  utils::post('contenu'),
                'modification'  =>  utils::post('modification'),
                'id_auteur'     =>  $user['id'],
                'chiffrement'   =>  utils::post('chiffrement'),
            ));

            $page = $wiki->getById($page['id']);

            utils::redirect('/admin/wiki/?'.$page['uri']);
        }
        catch (UserException $e)
        {







|






|

|




|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
    elseif ($page['date_modification'] > (int) utils::post('debut_edition'))
    {
        $error = 'La page a été modifiée par quelqu\'un d\'autre depuis que vous avez commencé l\'édition.';
    }
    else
    {
        try {
            $wiki->edit($page['id'], [
                'titre'         =>  utils::post('titre'),
                'uri'           =>  utils::post('uri'),
                'parent'        =>  utils::post('parent'),
                'droit_lecture' =>  utils::post('droit_lecture'),
                'droit_ecriture'=>  utils::post('droit_ecriture'),
                'date_creation' =>  $date,
            ]);

            $wiki->editRevision($page['id'], (int) utils::post('revision_edition'), [
                'contenu'       =>  utils::post('contenu'),
                'modification'  =>  utils::post('modification'),
                'id_auteur'     =>  $user['id'],
                'chiffrement'   =>  utils::post('chiffrement'),
            ]);

            $page = $wiki->getById($page['id']);

            utils::redirect('/admin/wiki/?'.$page['uri']);
        }
        catch (UserException $e)
        {