Overview
Comment:Merge avec trunk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: e9ab0666a3f6f34c6596b569b8ff1cd375978cad
User & Date: bohwaz on 2018-08-02 22:58:47
Other Links: branch diff | manifest | tags
Context
2018-08-02
23:49
Affichage du statut de l'adresse email si invalide dans la fiche de membre check-in: b267668fe4 user: bohwaz tags: dev
22:58
Merge avec trunk check-in: e9ab0666a3 user: bohwaz tags: dev
22:52
Erreur plus explicite quand on essaye de modifier une écriture qui n'existe pas check-in: a0c15d9d73 user: bohwaz tags: trunk, stable
2018-07-30
03:15
Possibilité de définir une condition d'affichage (en SQL) du plugin dans le menu, permettant de ne pas l'afficher à tous les membres check-in: a92458a4b5 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Config.php from [14cb7536d2] to [868d015351].

1
2
3
4


5
6
7
8
9
10
11
<?php

namespace Garradin;



class Config
{
    protected $fields_types = null;
    protected $config = null;
    protected $modified = [];

    static protected $_instance = null;




>
>







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

namespace Garradin;

use KD2\SMTP;

class Config
{
    protected $fields_types = null;
    protected $config = null;
    protected $modified = [];

    static protected $_instance = null;
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
                    $key = str_replace('accueil_', '', $key);
                    throw new UserException('Le nom de la page d\'accueil ' . $key . ' ne peut rester vide.');
                }
                break;
            }
            case 'email_asso':
            {
                if (!filter_var($value, FILTER_VALIDATE_EMAIL))
                {
                    throw new UserException('Adresse e-mail invalide.');
                }
                break;
            }
            case 'champs_membres':
            {







|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
                    $key = str_replace('accueil_', '', $key);
                    throw new UserException('Le nom de la page d\'accueil ' . $key . ' ne peut rester vide.');
                }
                break;
            }
            case 'email_asso':
            {
                if (!SMTP::checkEmailIsValid($value, false))
                {
                    throw new UserException('Adresse e-mail invalide.');
                }
                break;
            }
            case 'champs_membres':
            {

Modified src/include/lib/Garradin/Install.php from [3900ff2e28] to [e286e959c9].

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
		// Vérifier que les répertoires vides existent, sinon les créer
		$paths = [DATA_ROOT, PLUGINS_ROOT, CACHE_ROOT, CACHE_ROOT . '/static', CACHE_ROOT . '/compiled'];

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

		    if (!is_dir($path))
		    {
		    	throw new UserException('Le répertoire '.$path.' n\'existe pas ou n\'est pas un répertoire.');
		    }








|







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
		// Vérifier que les répertoires vides existent, sinon les créer
		$paths = [DATA_ROOT, PLUGINS_ROOT, CACHE_ROOT, CACHE_ROOT . '/static', CACHE_ROOT . '/compiled'];

		foreach ($paths as $path)
		{
		    if (!file_exists($path))
		    {
		        mkdir($path, 0777, true);
		    }

		    if (!is_dir($path))
		    {
		    	throw new UserException('Le répertoire '.$path.' n\'existe pas ou n\'est pas un répertoire.');
		    }

Modified src/include/lib/Garradin/Membres/Cotisations.php from [7d3964d0a7] to [05dee5b004].

275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
		}

		$desc = $desc ? 'DESC' : 'ASC';

		return $db->get('SELECT cm.id_membre, cm.date, cm.id, m.numero,
			m.'.$champ_id.' AS nom, c.montant,
			CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date()
			WHEN c.fin IS NOT NULL THEN c.fin <= date() ELSE 1 END AS a_jour
			FROM cotisations_membres AS cm
				INNER JOIN cotisations AS c ON c.id = cm.id_cotisation
				INNER JOIN membres AS m ON m.id = cm.id_membre
			WHERE
				cm.id_cotisation = ?
				AND m.id_categorie NOT IN (SELECT mc.id FROM membres_categories AS mc WHERE mc.cacher = 1)
			GROUP BY cm.id_membre ORDER BY '.$order.' '.$desc.' LIMIT ?,?;',







|







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
		}

		$desc = $desc ? 'DESC' : 'ASC';

		return $db->get('SELECT cm.id_membre, cm.date, cm.id, m.numero,
			m.'.$champ_id.' AS nom, c.montant,
			CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date()
			WHEN c.fin IS NOT NULL THEN (date() <= c.fin AND date() >= c.debut) ELSE 1 END AS a_jour
			FROM cotisations_membres AS cm
				INNER JOIN cotisations AS c ON c.id = cm.id_cotisation
				INNER JOIN membres AS m ON m.id = cm.id_membre
			WHERE
				cm.id_cotisation = ?
				AND m.id_categorie NOT IN (SELECT mc.id FROM membres_categories AS mc WHERE mc.cacher = 1)
			GROUP BY cm.id_membre ORDER BY '.$order.' '.$desc.' LIMIT ?,?;',

Modified src/include/lib/Garradin/Sauvegarde.php from [b8d932eaa5] to [ba865c4dc1].

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
		return $return;
	}

	/**
	 * Taille de la base de données actuelle
	 * @return integer Taille en octets du fichier SQLite
	 */
	public function getDBSize()
	{
		return filesize(DB_FILE);
	}

	/**
	 * Taille occupée par les fichiers dans la base de données
	 * @return integer Taille en octets
	 */
	public function getDBFilesSize()
	{
		$db = DB::getInstance();
		return (int) $db->firstColumn('SELECT SUM(taille) FROM fichiers_contenu;');
	}
}







|

|












396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
		return $return;
	}

	/**
	 * Taille de la base de données actuelle
	 * @return integer Taille en octets du fichier SQLite
	 */
	public function getDBSize($signed = false)
	{
		return filesize(DB_FILE) + ($signed ? 40 : 0);
	}

	/**
	 * Taille occupée par les fichiers dans la base de données
	 * @return integer Taille en octets
	 */
	public function getDBFilesSize()
	{
		$db = DB::getInstance();
		return (int) $db->firstColumn('SELECT SUM(taille) FROM fichiers_contenu;');
	}
}

Modified src/include/lib/Garradin/Squelette.php from [63f2767bad] to [a6a2b8cd25].

878
879
880
881
882
883
884
885
886
887
888
889
890
891
892

    static private function compile_store($tpl, $content)
    {
        $path = self::compile_get_path($tpl);

        if (!file_exists(dirname($path)))
        {
            mkdir(dirname($path));
        }

        file_put_contents($path, $content);
        return true;
    }

    static public function compile_clear($tpl)







|







878
879
880
881
882
883
884
885
886
887
888
889
890
891
892

    static private function compile_store($tpl, $content)
    {
        $path = self::compile_get_path($tpl);

        if (!file_exists(dirname($path)))
        {
            mkdir(dirname($path), 0777, true);
        }

        file_put_contents($path, $content);
        return true;
    }

    static public function compile_clear($tpl)

Modified src/include/lib/Garradin/Static_Cache.php from [29cb9a9906] to [453588f5aa].

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

	protected static function _getCacheDir()
	{
		$dir = CACHE_ROOT . '/static';

		if (!file_exists($dir))
		{
			mkdir(CACHE_ROOT . '/static');
		}

		return CACHE_ROOT . '/static';
	}

	protected static function _getCachePath($id)
	{







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

	protected static function _getCacheDir()
	{
		$dir = CACHE_ROOT . '/static';

		if (!file_exists($dir))
		{
			mkdir(CACHE_ROOT . '/static', 0777, true);
		}

		return CACHE_ROOT . '/static';
	}

	protected static function _getCachePath($id)
	{

Modified src/include/lib/Garradin/Template.php from [7c31943209] to [8050b58d78].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
	{
	}

	public function __construct()
	{
		if (!file_exists(CACHE_ROOT . '/compiled'))
		{
			mkdir(CACHE_ROOT . '/compiled');
		}

		self::setCompileDir(CACHE_ROOT . '/compiled');
		self::setTemplateDir(ROOT . '/templates');

		parent::__construct();








|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
	{
	}

	public function __construct()
	{
		if (!file_exists(CACHE_ROOT . '/compiled'))
		{
			mkdir(CACHE_ROOT . '/compiled', 0777, true);
		}

		self::setCompileDir(CACHE_ROOT . '/compiled');
		self::setTemplateDir(ROOT . '/templates');

		parent::__construct();

Modified src/include/lib/Garradin/Utils.php from [f5f31ae435] to [c92830dc0e].

643
644
645
646
647
648
649
650
651
652
653
654
655
656
        }
    }

    static public function row_to_csv($row)
    {
        $row = (array) $row;

        array_walk($row, function ($field) {
            return strtr($field, ['"' => '""', "\r\n" => "\n"]);
        });

        return sprintf("\"%s\"\r\n", implode('","', $row));
    }
}







|
|





643
644
645
646
647
648
649
650
651
652
653
654
655
656
        }
    }

    static public function row_to_csv($row)
    {
        $row = (array) $row;

        array_walk($row, function (&$field) {
            $field = strtr($field, ['"' => '""', "\r\n" => "\n"]);
        });

        return sprintf("\"%s\"\r\n", implode('","', $row));
    }
}

Modified src/templates/admin/membres/recherche.tpl from [a917988cc5] to [3886f956f8].

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
98

    <form method="post" action="{$admin_url}membres/action.php" class="memberList">

    {if !empty($liste)}
    <table class="list search">
        <thead>
            {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" value="Tout cocher / décocher" onclick="checkUncheck();" /></td>{/if}
            <td></td>
            {foreach from=$champs_entete key="c" item="cfg"}
                {if $champ == $c}
                    <th><strong>{$cfg.title}</strong></th>
                {else}
                    <td>{$cfg.title}</td>
                {/if}
            {/foreach}
            <td></td>
        </thead>
        <tbody>
            {foreach from=$liste item="membre"}
                <tr>
                    {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id}" /></td>{/if}
                    <td class="num"><a href="{$admin_url}membres/fiche.php?id={$membre.id}">{$membre.id}</a></th>
                    {foreach from=$champs_entete key="c" item="cfg"}
                        {if $champ == $c}
                            <th><strong>{$membre->$c|raw|display_champ_membre:$cfg}</strong></th>
                        {else}
                            <td>{$membre->$c|raw|display_champ_membre:$cfg}</td>
                        {/if}
                    {/foreach}
                    <td class="actions">
                        {if !empty($membre.email)}<a class="icn" href="{$admin_url}membres/message.php?id={$membre.id}" title="Envoyer un message"></a> {/if}
                        <a class="icn" href="modifier.php?id={$membre.id}" title="Modifier la fiche membre">✎</a>
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>

    {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}







<













<








|
|







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

    <form method="post" action="{$admin_url}membres/action.php" class="memberList">

    {if !empty($liste)}
    <table class="list search">
        <thead>
            {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" value="Tout cocher / décocher" onclick="checkUncheck();" /></td>{/if}

            {foreach from=$champs_entete key="c" item="cfg"}
                {if $champ == $c}
                    <th><strong>{$cfg.title}</strong></th>
                {else}
                    <td>{$cfg.title}</td>
                {/if}
            {/foreach}
            <td></td>
        </thead>
        <tbody>
            {foreach from=$liste item="membre"}
                <tr>
                    {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id}" /></td>{/if}

                    {foreach from=$champs_entete key="c" item="cfg"}
                        {if $champ == $c}
                            <th><strong>{$membre->$c|raw|display_champ_membre:$cfg}</strong></th>
                        {else}
                            <td>{$membre->$c|raw|display_champ_membre:$cfg}</td>
                        {/if}
                    {/foreach}
                    <td class="actions">
                    	<a class="icn" href="{$admin_url}membres/fiche.php?id={$membre.id}" title="Fiche membre">👤</a>
                        <a class="icn" href="{$admin_url}membres/modifier.php?id={$membre.id}" title="Modifier la fiche membre">✎</a>
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>

    {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}

Modified src/www/admin/config/donnees.php from [7a456875f0] to [37588fe983].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
    $form->check('backup_download');

    if (!$form->hasErrors())
    {
        header('Content-type: application/octet-stream');
        header('Content-Disposition: attachment; filename="' . $config->get('nom_asso') . ' - Sauvegarde données - ' . date('Y-m-d') . '.sqlite"');
        header('Content-Length: ' . $s->getDBSize());

        $s->dump();
        exit;
    }
}
elseif (f('restore'))
{







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
    $form->check('backup_download');

    if (!$form->hasErrors())
    {
        header('Content-type: application/octet-stream');
        header('Content-Disposition: attachment; filename="' . $config->get('nom_asso') . ' - Sauvegarde données - ' . date('Y-m-d') . '.sqlite"');
        header('Content-Length: ' . $s->getDBSize(true));

        $s->dump();
        exit;
    }
}
elseif (f('restore'))
{