Overview
Comment:Modernisation code: passage de Utils::get à qg()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 9103d3b2c1dd752f239fcd02226e3161f9ac4a21
User & Date: bohwaz on 2017-07-14 06:24:16
Other Links: branch diff | manifest | tags
Context
2017-07-14
06:34
Élimination des $_GET pour utiliser qg et qv() check-in: da2139e72e user: bohwaz tags: dev
06:24
Modernisation code: passage de Utils::get à qg() check-in: 9103d3b2c1 user: bohwaz tags: dev
2017-07-04
14:31
Amélioration ergonomie info bulles cf [602d0a6511] check-in: 70257ac725 user: bohwaz tags: dev
Changes

Modified src/www/admin/compta/banques/modifier.php from [f7a2ede23e] to [4cf6c6d28b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$banque = new Compta\Comptes_Bancaires;

$compte = $banque->get(Utils::get('id'));

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

$error = false;












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$banque = new Compta\Comptes_Bancaires;

$compte = $banque->get(qg('id'));

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

$error = false;

Modified src/www/admin/compta/banques/rapprocher.php from [7a20b617d6] to [4d947870a5].

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
}

$banques = new Compta\Comptes_Bancaires;
$rapprochement = new Compta\Rapprochement;
$exercices = new Compta\Exercices;
$exercice = $exercices->getCurrent();

$compte = $banques->get(Utils::get('id'));

if (!$compte)
{
    throw new UserException("Le compte demandé n'existe pas.");
}

$error = false;

$solde_initial = $solde_final = 0;

$debut = Utils::get('debut');
$fin = Utils::get('fin');

if ($debut && $fin)
{
    if (!Utils::checkDate($debut) || !Utils::checkDate($fin))
    {
        $error = 'La date donnée est invalide.';
        $debut = $fin = false;







|










|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
}

$banques = new Compta\Comptes_Bancaires;
$rapprochement = new Compta\Rapprochement;
$exercices = new Compta\Exercices;
$exercice = $exercices->getCurrent();

$compte = $banques->get(qg('id'));

if (!$compte)
{
    throw new UserException("Le compte demandé n'existe pas.");
}

$error = false;

$solde_initial = $solde_final = 0;

$debut = qg('debut');
$fin = qg('fin');

if ($debut && $fin)
{
    if (!Utils::checkDate($debut) || !Utils::checkDate($fin))
    {
        $error = 'La date donnée est invalide.';
        $debut = $fin = false;

Modified src/www/admin/compta/banques/supprimer.php from [05db61cd3e] to [2ce8ab68ad].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$banque = new Compta\Comptes_Bancaires;

$compte = $banque->get(Utils::get('id'));

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

$error = false;












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$banque = new Compta\Comptes_Bancaires;

$compte = $banque->get(qg('id'));

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

$error = false;

Modified src/www/admin/compta/categories/modifier.php from [e4556a0002] to [7b001b4932].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$cats = new Compta\Categories;

$id = (int)Utils::get('id');
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette catégorie n\'existe pas.');
}













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$cats = new Compta\Categories;

$id = (int)qg('id');
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette catégorie n\'existe pas.');
}

Modified src/www/admin/compta/categories/supprimer.php from [6efa2ae0e7] to [9fe2dc2696].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$cats = new Compta\Categories;

$id = (int)Utils::get('id');
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette catégorie n\'existe pas.');
}













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$cats = new Compta\Categories;

$id = (int)qg('id');
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette catégorie n\'existe pas.');
}

Modified src/www/admin/compta/comptes/ajouter.php from [165f7a5abc] to [bf33114fea].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$classe = (int) Utils::get('classe');

if (!$classe || $classe < 1 || $classe > 9)
{
    throw new UserException("Cette classe de compte n'existe pas.");
}

$error = false;










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$classe = (int) qg('classe');

if (!$classe || $classe < 1 || $classe > 9)
{
    throw new UserException("Cette classe de compte n'existe pas.");
}

$error = false;

Modified src/www/admin/compta/comptes/index.php from [f0dee20a60] to [fa3fc772b1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$classe = (int) Utils::get('classe');

$tpl->assign('classe', $classe);

if (!$classe)
{
    $tpl->assign('classes', $comptes->listTree(0, false));
}










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$classe = (int) qg('classe');

$tpl->assign('classe', $classe);

if (!$classe)
{
    $tpl->assign('classes', $comptes->listTree(0, false));
}

Modified src/www/admin/compta/comptes/journal.php from [1c7098d6f2] to [d5dfdbe319].

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

require_once __DIR__ . '/../_inc.php';

$compte = $comptes->get(Utils::get('id'));

if (!$compte)
{
    throw new UserException("Le compte demandé n'existe pas.");
}

$journal = new Compta\Journal;





|







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

require_once __DIR__ . '/../_inc.php';

$compte = $comptes->get(qg('id'));

if (!$compte)
{
    throw new UserException("Le compte demandé n'existe pas.");
}

$journal = new Compta\Journal;

Modified src/www/admin/compta/comptes/modifier.php from [48c7edb5a4] to [ef5895a765].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$id = Utils::get('id');
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$id = qg('id');
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

Modified src/www/admin/compta/comptes/supprimer.php from [212afafa33] to [87319b8fc7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$id = Utils::get('id');
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$id = qg('id');
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

Modified src/www/admin/compta/exercices/supprimer.php from [13b3821ac6] to [1c0f44070c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$e = new Compta\Exercices;

$exercice = $e->get((int)Utils::get('id'));

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

if ($exercice['cloture'])












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$e = new Compta\Exercices;

$exercice = $e->get((int)qg('id'));

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

if ($exercice['cloture'])

Modified src/www/admin/compta/graph.php from [30e9fb5def] to [5c5372d696].

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

require_once __DIR__ . '/_inc.php';

qv(['g' => 'required|in:recettes_depenses:banques_caisses']);

$graph = qg('g');

if (Static_Cache::expired('graph_' . $graph))
{
	$stats = new Compta\Stats;






|







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

require_once __DIR__ . '/_inc.php';

qv(['g' => 'required|in:recettes_depenses,banques_caisses']);

$graph = qg('g');

if (Static_Cache::expired('graph_' . $graph))
{
	$stats = new Compta\Stats;

Modified src/www/admin/compta/operations/index.php from [fdbe6b0e19] to [717885fe51].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$cats = new Compta\Categories;
$cat = $type = false;

if (Utils::get('cat'))
{
	$cat = $cats->get(Utils::get('cat'));

	if (!$cat)
	{
		throw new UserException("La catégorie demandée n'existe pas.");
	}

	$type = $cat['type'];








|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

$cats = new Compta\Categories;
$cat = $type = false;

if (qg('cat'))
{
	$cat = $cats->get(qg('cat'));

	if (!$cat)
	{
		throw new UserException("La catégorie demandée n'existe pas.");
	}

	$type = $cat['type'];

Modified src/www/admin/compta/operations/membre.php from [69c3dfa4f9] to [a1ca776a55].

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

require_once __DIR__ . '/../_inc.php';

$exercices = new Compta\Exercices;
$journal = new Compta\Journal;

$exercice = Utils::get('exercice') ?: $exercices->getCurrentId();

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

if (empty($_GET['id']) || !is_numeric($_GET['id']))








|







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

require_once __DIR__ . '/../_inc.php';

$exercices = new Compta\Exercices;
$journal = new Compta\Journal;

$exercice = qg('exercice') ?: $exercices->getCurrentId();

if (!$exercice)
{
	throw new UserException('Exercice inconnu.');
}

if (empty($_GET['id']) || !is_numeric($_GET['id']))

Modified src/www/admin/compta/operations/modifier.php from [03beca1507] to [a00ae8b874].

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$journal = new Compta\Journal;
$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;

$operation = $journal->get(Utils::get('id'));

if (!$operation)
{
    throw new UserException("L'opération demandée n'existe pas.");
}

if ($operation['id_categorie'])







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$journal = new Compta\Journal;
$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;

$operation = $journal->get(qg('id'));

if (!$operation)
{
    throw new UserException("L'opération demandée n'existe pas.");
}

if ($operation['id_categorie'])

Modified src/www/admin/compta/operations/recherche_sql.php from [6de43c5825] to [2c30e18af2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$journal = new Compta\Journal;

$query = trim(Utils::get('query'));

$tpl->assign('schema', $journal->schemaSQL());
$tpl->assign('query', $query);

if ($query != '')
{
    try {












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$journal = new Compta\Journal;

$query = trim(qg('query'));

$tpl->assign('schema', $journal->schemaSQL());
$tpl->assign('query', $query);

if ($query != '')
{
    try {

Modified src/www/admin/compta/operations/saisir.php from [1a3761f88e] to [8d05da860f].

183
184
185
186
187
188
189
190
191
192
    else
    {
        $membres->sessionStore('compta_date', date('Y-m-d'));
    }
}

$tpl->assign('date', $membres->sessionGet('compta_date') ?: false);
$tpl->assign('ok', (int) Utils::get('ok'));

$tpl->display('admin/compta/operations/saisir.tpl');







|


183
184
185
186
187
188
189
190
191
192
    else
    {
        $membres->sessionStore('compta_date', date('Y-m-d'));
    }
}

$tpl->assign('date', $membres->sessionGet('compta_date') ?: false);
$tpl->assign('ok', (int) qg('ok'));

$tpl->display('admin/compta/operations/saisir.tpl');

Modified src/www/admin/compta/operations/supprimer.php from [c39d3c30ab] to [af94791960].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$journal = new Compta\Journal;

$operation = $journal->get(Utils::get('id'));

if (!$operation)
{
    throw new UserException("L'opération demandée n'existe pas.");
}

$error = false;












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$journal = new Compta\Journal;

$operation = $journal->get(qg('id'));

if (!$operation)
{
    throw new UserException("L'opération demandée n'existe pas.");
}

$error = false;

Modified src/www/admin/compta/operations/voir.php from [47024bd16b] to [458ff3e2ef].

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

require_once __DIR__ . '/../_inc.php';

$journal = new Compta\Journal;

$operation = $journal->get(Utils::get('id'));

if (!$operation)
{
    throw new UserException("L'opération demandée n'existe pas.");
}
$exercices = new Compta\Exercices;








|







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

require_once __DIR__ . '/../_inc.php';

$journal = new Compta\Journal;

$operation = $journal->get(qg('id'));

if (!$operation)
{
    throw new UserException("L'opération demandée n'existe pas.");
}
$exercices = new Compta\Exercices;

Modified src/www/admin/compta/pie.php from [d1d8e8011c] to [485262b8ec].

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

require_once __DIR__ . '/_inc.php';

qv(['g' => 'required|in:recettes:depenses']);

$graph = qg('g');

if (Static_Cache::expired('pie_' . $graph))
{
	$stats = new Compta\Stats;
	$categories = new Compta\Categories;





|







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

require_once __DIR__ . '/_inc.php';

qv(['g' => 'required|in:recettes,depenses']);

$graph = qg('g');

if (Static_Cache::expired('pie_' . $graph))
{
	$stats = new Compta\Stats;
	$categories = new Compta\Categories;

Modified src/www/admin/config/donnees.php from [2149017aea] to [b1d0abed2c].

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
            $code = $e->getCode();
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('code', $code);
$tpl->assign('ok_code', Utils::get('code'));
$tpl->assign('ok', Utils::get('ok'));
$tpl->assign('liste', $s->getList());
$tpl->assign('max_file_size', Utils::getMaxUploadSize());

$tpl->assign('db_size', $s->getDBSize());
$tpl->assign('files_size', $s->getDBFilesSize());

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







|
|







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
            $code = $e->getCode();
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('code', $code);
$tpl->assign('ok_code', qg('code'));
$tpl->assign('ok', qg('ok'));
$tpl->assign('liste', $s->getList());
$tpl->assign('max_file_size', Utils::getMaxUploadSize());

$tpl->assign('db_size', $s->getDBSize());
$tpl->assign('files_size', $s->getDBFilesSize());

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

Modified src/www/admin/config/plugins.php from [692d092f7d] to [c5914916c1].

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
            $error = $e->getMessage();
        }
    }
}

if (Utils::post('delete'))
{
    if (!Utils::CSRF_check('delete_plugin_' . Utils::get('delete')))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $plugin = new Plugin(Utils::get('delete'));
            $plugin->uninstall();
            
            Utils::redirect('/admin/config/plugins.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

if (Utils::get('delete'))
{
    $plugin = new Plugin(Utils::get('delete'));
    $tpl->assign('plugin', $plugin->getInfos());
    $tpl->assign('delete', true);
}
else
{
    $tpl->assign('liste_telecharges', Plugin::listDownloaded());
    $tpl->assign('liste_installes', Plugin::listInstalled());
}

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







|






|













|

|










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
            $error = $e->getMessage();
        }
    }
}

if (Utils::post('delete'))
{
    if (!Utils::CSRF_check('delete_plugin_' . qg('delete')))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $plugin = new Plugin(qg('delete'));
            $plugin->uninstall();
            
            Utils::redirect('/admin/config/plugins.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

if (qg('delete'))
{
    $plugin = new Plugin(qg('delete'));
    $tpl->assign('plugin', $plugin->getInfos());
    $tpl->assign('delete', true);
}
else
{
    $tpl->assign('liste_telecharges', Plugin::listDownloaded());
    $tpl->assign('liste_installes', Plugin::listInstalled());
}

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

Modified src/www/admin/config/site.php from [548ea357b2] to [112b75f1e2].

51
52
53
54
55
56
57
58
59
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
        {
            $error = $e->getMessage();
        }
    }
}


if (Utils::get('edit'))
{
    $source = Squelette::getSource(Utils::get('edit'));

    if (!$source)
    {
        throw new UserException("Ce squelette n'existe pas.");
    }

    $csrf_key = 'edit_skel_'.md5(Utils::get('edit'));

    if (Utils::post('save'))
    {
        if (!Utils::CSRF_check($csrf_key))
        {
            $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
        }
        else
        {
            if (Squelette::editSource(Utils::get('edit'), Utils::post('content')))
            {
                $fullscreen = isset($_GET['fullscreen']) ? '#fullscreen' : '';
                Utils::redirect('/admin/config/site.php?edit='.rawurlencode(Utils::get('edit')).'&ok'.$fullscreen);
            }
            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', Squelette::listSources());

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







|

|






|









|


|








|





|


51
52
53
54
55
56
57
58
59
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
        {
            $error = $e->getMessage();
        }
    }
}


if (qg('edit'))
{
    $source = Squelette::getSource(qg('edit'));

    if (!$source)
    {
        throw new UserException("Ce squelette n'existe pas.");
    }

    $csrf_key = 'edit_skel_'.md5(qg('edit'));

    if (Utils::post('save'))
    {
        if (!Utils::CSRF_check($csrf_key))
        {
            $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
        }
        else
        {
            if (Squelette::editSource(qg('edit'), Utils::post('content')))
            {
                $fullscreen = isset($_GET['fullscreen']) ? '#fullscreen' : '';
                Utils::redirect('/admin/config/site.php?edit='.rawurlencode(qg('edit')).'&ok'.$fullscreen);
            }
            else
            {
                $error = "Impossible d'enregistrer le squelette.";
            }
        }
    }

    $tpl->assign('edit', ['file' => trim(qg('edit')), 'content' => $source]);
    $tpl->assign('csrf_key', $csrf_key);
}

$tpl->assign('sources', Squelette::listSources());

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

Modified src/www/admin/membres/cotisations/ajout.php from [9893f3db2f] to [14398346e2].

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

$tpl->assign('moyens_paiement', $cats->listMoyensPaiement());
$tpl->assign('moyen_paiement', Utils::post('moyen_paiement') ?: 'ES');
$tpl->assign('comptes_bancaires', $banques->getList());
$tpl->assign('banque', Utils::post('banque'));


if (Utils::get('cotisation'))
{
    $co = $cotisations->get(Utils::get('cotisation'));

    if (!$co)
    {
        throw new UserException("La cotisation indiquée en paramètre n'existe pas.");
    }

    $tpl->assign('default_co', $co->id);







|

|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

$tpl->assign('moyens_paiement', $cats->listMoyensPaiement());
$tpl->assign('moyen_paiement', Utils::post('moyen_paiement') ?: 'ES');
$tpl->assign('comptes_bancaires', $banques->getList());
$tpl->assign('banque', Utils::post('banque'));


if (qg('cotisation'))
{
    $co = $cotisations->get(qg('cotisation'));

    if (!$co)
    {
        throw new UserException("La cotisation indiquée en paramètre n'existe pas.");
    }

    $tpl->assign('default_co', $co->id);

Modified src/www/admin/membres/cotisations/gestion/modifier.php from [e36b905d94] to [644f361485].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!Utils::get('id') || !is_numeric(Utils::get('id')))
{
    throw new UserException("Argument du numéro de cotisation manquant.");
}

$cotisations = new Cotisations;

$co = $cotisations->get(Utils::get('id'));
$cats = new Compta\Categories;

if (!$co)
{
    throw new UserException("Cette cotisation n'existe pas.");
}








|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!qg('id') || !is_numeric(qg('id')))
{
    throw new UserException("Argument du numéro de cotisation manquant.");
}

$cotisations = new Cotisations;

$co = $cotisations->get(qg('id'));
$cats = new Compta\Categories;

if (!$co)
{
    throw new UserException("Cette cotisation n'existe pas.");
}

Modified src/www/admin/membres/cotisations/gestion/rappel_modifier.php from [ca9a91b7b8] to [0c22168424].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!Utils::get('id') || !is_numeric(Utils::get('id')))
{
    throw new UserException("Argument du numéro de rappel manquant.");
}

$rappels = new Rappels;

$rappel = $rappels->get(Utils::get('id'));

if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$cotisations = new Cotisations;







|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!qg('id') || !is_numeric(qg('id')))
{
    throw new UserException("Argument du numéro de rappel manquant.");
}

$rappels = new Rappels;

$rappel = $rappels->get(qg('id'));

if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$cotisations = new Cotisations;

Modified src/www/admin/membres/cotisations/gestion/rappel_supprimer.php from [4e4905ac77] to [cb00bde925].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!Utils::get('id') || !is_numeric(Utils::get('id')))
{
    throw new UserException("Argument du numéro de rappel manquant.");
}

$rappels = new Rappels;

$rappel = $rappels->get(Utils::get('id'));

if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$error = false;







|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!qg('id') || !is_numeric(qg('id')))
{
    throw new UserException("Argument du numéro de rappel manquant.");
}

$rappels = new Rappels;

$rappel = $rappels->get(qg('id'));

if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$error = false;

Modified src/www/admin/membres/cotisations/gestion/supprimer.php from [7d60f16901] to [7dd927668a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!Utils::get('id') || !is_numeric(Utils::get('id')))
{
    throw new UserException("Argument du numéro de cotisation manquant.");
}

$cotisations = new Cotisations;

$co = $cotisations->get(Utils::get('id'));

if (!$co)
{
    throw new UserException("Cette cotisation n'existe pas.");
}

$error = false;







|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

if (!qg('id') || !is_numeric(qg('id')))
{
    throw new UserException("Argument du numéro de cotisation manquant.");
}

$cotisations = new Cotisations;

$co = $cotisations->get(qg('id'));

if (!$co)
{
    throw new UserException("Cette cotisation n'existe pas.");
}

$error = false;

Modified src/www/admin/membres/cotisations/voir.php from [b49f8dfa2f] to [2fa458fb02].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$co = $cotisations->get($id);

if (!$co)
{
    throw new UserException("Cette cotisation n'existe pas.");
}

$page = (int) Utils::get('p') ?: 1;

$tpl->assign('page', $page);
$tpl->assign('bypage', Membres\Cotisations::ITEMS_PER_PAGE);
$tpl->assign('total', $m_cotisations->countMembersForCotisation($co->id));
$tpl->assign('pagination_url', Utils::getSelfUrl(true) . '?id=' . $co->id . '&amp;p=[ID]');

$tpl->assign('cotisation', $co);
$tpl->assign('order', Utils::get('o') ?: 'date');
$tpl->assign('desc', !isset($_GET['a']));
$tpl->assign('liste', $m_cotisations->listMembersForCotisation(
	$co->id, $page, Utils::get('o'), isset($_GET['a']) ? false : true));

$tpl->display('admin/membres/cotisations/voir.tpl');







|







|


|


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$co = $cotisations->get($id);

if (!$co)
{
    throw new UserException("Cette cotisation n'existe pas.");
}

$page = (int) qg('p') ?: 1;

$tpl->assign('page', $page);
$tpl->assign('bypage', Membres\Cotisations::ITEMS_PER_PAGE);
$tpl->assign('total', $m_cotisations->countMembersForCotisation($co->id));
$tpl->assign('pagination_url', Utils::getSelfUrl(true) . '?id=' . $co->id . '&amp;p=[ID]');

$tpl->assign('cotisation', $co);
$tpl->assign('order', qg('o') ?: 'date');
$tpl->assign('desc', !isset($_GET['a']));
$tpl->assign('liste', $m_cotisations->listMembersForCotisation(
	$co->id, $page, qg('o'), isset($_GET['a']) ? false : true));

$tpl->display('admin/membres/cotisations/voir.tpl');

Modified src/www/admin/membres/index.php from [b79c4341ba] to [8d17730d0b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

// Recherche de membre (pour ceux qui n'ont qu'un accès à la liste des membres)
if (Utils::get('r'))
{
	$recherche = trim(Utils::get('r'));

	$result = $membres->search($config->get('champ_identite'), $recherche);
    $tpl->assign('liste', $result);
	$tpl->assign('recherche', $recherche);
}
else
{
	$cats = new Membres\Categories;
	$champs = $config->get('champs_membres');

	$membres_cats = $cats->listSimple();
	$membres_cats_cachees = $cats->listHidden();

	$cat_id = (int) Utils::get('cat') ?: 0;
	$page = (int) Utils::get('p') ?: 1;

	if ($cat_id)
	{
	    if ($session->canAccess('membres', Membres::DROIT_ECRITURE) && array_key_exists($cat_id, $membres_cats_cachees))
	    {
	    	$cat_id = 0;
	    }
	}

	if (!$cat_id)
	{
	    $cat_id = array_diff(array_keys((array) $membres_cats), array_keys((array) $membres_cats_cachees));
	}

	// Par défaut le champ de tri c'est l'identité
	$order = $config->get('champ_identite');
	$desc = false;

	if (Utils::get('o'))
	    $order = Utils::get('o');

	if (isset($_GET['d']))
	    $desc = true;

	$fields = $champs->getListedFields();

	// Vérifier que le champ de tri existe bien dans la table






|

|













|
|


















|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

// Recherche de membre (pour ceux qui n'ont qu'un accès à la liste des membres)
if (qg('r'))
{
	$recherche = trim(qg('r'));

	$result = $membres->search($config->get('champ_identite'), $recherche);
    $tpl->assign('liste', $result);
	$tpl->assign('recherche', $recherche);
}
else
{
	$cats = new Membres\Categories;
	$champs = $config->get('champs_membres');

	$membres_cats = $cats->listSimple();
	$membres_cats_cachees = $cats->listHidden();

	$cat_id = (int) qg('cat') ?: 0;
	$page = (int) qg('p') ?: 1;

	if ($cat_id)
	{
	    if ($session->canAccess('membres', Membres::DROIT_ECRITURE) && array_key_exists($cat_id, $membres_cats_cachees))
	    {
	    	$cat_id = 0;
	    }
	}

	if (!$cat_id)
	{
	    $cat_id = array_diff(array_keys((array) $membres_cats), array_keys((array) $membres_cats_cachees));
	}

	// Par défaut le champ de tri c'est l'identité
	$order = $config->get('champ_identite');
	$desc = false;

	if (qg('o'))
	    $order = qg('o');

	if (isset($_GET['d']))
	    $desc = true;

	$fields = $champs->getListedFields();

	// Vérifier que le champ de tri existe bien dans la table
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	$tpl->assign('desc', $desc);

	$tpl->assign('champs', $fields);

	$tpl->assign('liste', $membres->listByCategory($cat_id, array_keys((array) $fields), $page, $order, $desc));
	$tpl->assign('total', $membres->countByCategory($cat_id));

	$tpl->assign('pagination_url', Utils::getSelfUrl(true) . '?p=[ID]&amp;o=' . $order . ($desc ? '&amp;d' : '') . ($cat_id? '&amp;cat='. (int) Utils::get('cat') : ''));

	$tpl->assign('membres_cats', $membres_cats);
	$tpl->assign('membres_cats_cachees', $membres_cats_cachees);
	$tpl->assign('current_cat', $cat_id);

	$tpl->assign('page', $page);
	$tpl->assign('bypage', Membres::ITEMS_PER_PAGE);

}

$tpl->assign('sent', isset($_GET['sent']));

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







|













59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	$tpl->assign('desc', $desc);

	$tpl->assign('champs', $fields);

	$tpl->assign('liste', $membres->listByCategory($cat_id, array_keys((array) $fields), $page, $order, $desc));
	$tpl->assign('total', $membres->countByCategory($cat_id));

	$tpl->assign('pagination_url', Utils::getSelfUrl(true) . '?p=[ID]&amp;o=' . $order . ($desc ? '&amp;d' : '') . ($cat_id? '&amp;cat='. (int) qg('cat') : ''));

	$tpl->assign('membres_cats', $membres_cats);
	$tpl->assign('membres_cats_cachees', $membres_cats_cachees);
	$tpl->assign('current_cat', $cat_id);

	$tpl->assign('page', $page);
	$tpl->assign('bypage', Membres::ITEMS_PER_PAGE);

}

$tpl->assign('sent', isset($_GET['sent']));

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

Modified src/www/admin/membres/recherche.php from [d54744adc2] to [f10ab087dd].

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

require_once __DIR__ . '/_inc.php';

$session->requireAccess('membres', Membres::DROIT_ECRITURE);

$recherche = trim(Utils::get('r'));
$champ = trim(Utils::get('c'));

$champs = $config->get('champs_membres');

$auto = false;

// On détermine magiquement quel champ on recherche
if (!$champ)







|
|







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

require_once __DIR__ . '/_inc.php';

$session->requireAccess('membres', Membres::DROIT_ECRITURE);

$recherche = trim(qg('r'));
$champ = trim(qg('c'));

$champs = $config->get('champs_membres');

$auto = false;

// On détermine magiquement quel champ on recherche
if (!$champ)

Modified src/www/admin/membres/recherche_sql.php from [7fb10d435a] to [d0f26422b0].

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

require_once __DIR__ . '/_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

$query = trim(Utils::get('query'));

$tpl->assign('schema', $membres->schemaSQL());
$tpl->assign('query', $query);

if ($query != '')
{
    try {







|







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

require_once __DIR__ . '/_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

$query = trim(qg('query'));

$tpl->assign('schema', $membres->schemaSQL());
$tpl->assign('query', $query);

if ($query != '')
{
    try {

Modified src/www/admin/membres/supprimer.php from [9fa9721159] to [e78880eacc].

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

require_once __DIR__ . '/_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

$membre = $membres->get(Utils::get('id'));

if (!$membre)
{
    throw new UserException("Ce membre n'existe pas.");
}

$error = false;







|







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

require_once __DIR__ . '/_inc.php';

$session->requireAccess('membres', Membres::DROIT_ADMIN);

$membre = $membres->get(qg('id'));

if (!$membre)
{
    throw new UserException("Ce membre n'existe pas.");
}

$error = false;

Modified src/www/admin/password.php from [08fa661eb0] to [7da509eab2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
namespace Garradin;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';

$error = false;

if (trim(Utils::get('c')))
{
    if ($membres->recoverPasswordConfirm(Utils::get('c')))
    {
        Utils::redirect('/admin/password.php?new_sent');
    }

    $error = 'EXPIRED';
}
elseif (!empty($_POST['recover']))









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
namespace Garradin;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';

$error = false;

if (trim(qg('c')))
{
    if ($membres->recoverPasswordConfirm(qg('c')))
    {
        Utils::redirect('/admin/password.php?new_sent');
    }

    $error = 'EXPIRED';
}
elseif (!empty($_POST['recover']))

Modified src/www/admin/plugin.php from [a60a417923] to [3c55898e96].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';

$page = Utils::get('_u') ?: 'index.php';

$plugin = new Plugin(Utils::get('_p'));

define('Garradin\PLUGIN_ROOT', $plugin->path());
define('Garradin\PLUGIN_URL', WWW_URL . 'admin/plugin/' . $plugin->id() . '/');
define('Garradin\PLUGIN_QSP', '?');

$tpl->assign('plugin', $plugin->getInfos());
$tpl->assign('plugin_root', PLUGIN_ROOT);

$plugin->call('admin/' . $page);






|

|









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';

$page = qg('_u') ?: 'index.php';

$plugin = new Plugin(qg('_p'));

define('Garradin\PLUGIN_ROOT', $plugin->path());
define('Garradin\PLUGIN_URL', WWW_URL . 'admin/plugin/' . $plugin->id() . '/');
define('Garradin\PLUGIN_QSP', '?');

$tpl->assign('plugin', $plugin->getInfos());
$tpl->assign('plugin_root', PLUGIN_ROOT);

$plugin->call('admin/' . $page);