Overview
Comment:Gestion plus simple des droits
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2a52f7577e17f0e671f6c0aeaa2052bf44e495d3
User & Date: bohwaz on 2011-12-12 18:18:23
Other Links: manifest | tags
Context
2011-12-13
00:52
Mise à jour liste pays, ordonnée alphabétiquement check-in: 681fad1a51 user: bohwaz tags: trunk
2011-12-12
18:18
Gestion plus simple des droits check-in: 2a52f7577e user: bohwaz tags: trunk
04:13
+ mini design de base + correction bug fetchresult + on évolue dans les droits + récup des droits au login check-in: 0091b53a43 user: bohwaz tags: trunk
Changes

Modified DB_SCHEMA from [07e959014f] to [44face765a].

11
12
13
14
15
16
17
18





19
20
21
22
23
24
25

-- Catégories de membres
CREATE TABLE membres_categories (
    id INTEGER PRIMARY KEY,
    nom TEXT,
    description TEXT,
    montant_cotisation REAL,
    duree_cotisation INTEGER DEFAULT 12 -- En mois





);

-- Droits affectés à chaque catégorie de membres
CREATE TABLE membres_categories_droits (
    id_categorie INTEGER,
    droit INTEGER,
    PRIMARY KEY (id_categorie, droit)







|
>
>
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

-- Catégories de membres
CREATE TABLE membres_categories (
    id INTEGER PRIMARY KEY,
    nom TEXT,
    description TEXT,
    montant_cotisation REAL,
    duree_cotisation INTEGER DEFAULT 12, -- En mois
    droit_wiki INT DEFAULT 1,
    droit_membres INT DEFAULT 1,
    droit_compta INT DEFAULT 1,
    droit_inscription INT DEFAULT 0,
    droit_connexion INT DEFAULT 1
);

-- Droits affectés à chaque catégorie de membres
CREATE TABLE membres_categories_droits (
    id_categorie INTEGER,
    droit INTEGER,
    PRIMARY KEY (id_categorie, droit)

Modified include/class.db.php from [dcfb6370d3] to [43a2014608].

168
169
170
171
172
173
174







175
176
177
178
179
180
181
                $pos = strpos($query, '?');
                $query = substr_replace($query, $arg, $pos, 1);
            }
        }

        return $query;
    }








    /**
     * Formats and escapes a statement and then returns the result of exec()
     */
    public function simpleExec($query)
    {
        $args = array_slice(func_get_args(), 1);







>
>
>
>
>
>
>







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
                $pos = strpos($query, '?');
                $query = substr_replace($query, $arg, $pos, 1);
            }
        }

        return $query;
    }

    public function simpleInsert($table, $fields)
    {
        $fields_names = array_keys($fields);
        return $this->simpleExec('INSERT INTO '.$table.' ('.implode(', ', $fields_names).')
            VALUES (:'.implode(', :', $fields_names).');', $fields);
    }

    /**
     * Formats and escapes a statement and then returns the result of exec()
     */
    public function simpleExec($query)
    {
        $args = array_slice(func_get_args(), 1);

Modified include/class.membres.php from [1d7cbd6bad] to [9206070c41].

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
<?php

class Garradin_Membres
{
    const DROIT_CONNEXION = 1;
    const DROIT_INSCRIPTION = 2;

    const DROIT_WIKI_LIRE = 10;
    const DROIT_WIKI_ECRIRE = 11;
    const DROIT_WIKI_FICHIERS = 12;
    const DROIT_WIKI_ADMIN = 13;

    const DROIT_MEMBRE_LISTER = 20;
    const DROIT_MEMBRE_GESTION = 21;
    const DROIT_MEMBRE_ADMIN = 22;

    const DROIT_COMPTA_GESTION = 30;
    const DROIT_COMPTA_ADMIN = 31;

    protected function _getSalt($length)
    {
        $str = str_split('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
        shuffle($str);

        return implode('',




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







1
2
3
4
5
6

7










8
9
10
11
12
13
14
<?php

class Garradin_Membres
{
    const DROIT_AUCUN = 0;
    const DROIT_ACCES = 1;

    const DROIT_ADMIN = 9;











    protected function _getSalt($length)
    {
        $str = str_split('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
        shuffle($str);

        return implode('',
50
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

    protected function _login($user)
    {
        $this->_sessionStart(true);
        $db = Garradin_DB::getInstance();

        $_SESSION['logged_user'] = $user;
        $_SESSION['logged_user']['rights'] = $db->queryFetchAssoc('SELECT droit, droit FROM membres_categories_droits
            WHERE id_categorie = '.(int)$user['id_categorie'].';', SQLITE3_ASSOC);

        return true;
    }

    public function login($email, $passe)
    {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL))
            return false;

        $db = Garradin_DB::getInstance();
        $r = $db->querySingle('SELECT * FROM membres WHERE email=\''.$db->escapeString($email).'\' LIMIT 1;', true);

        if (empty($r))
            return false;

        if (!$this->_checkPassword($passe, $r['passe']))
            return false;





















        return $this->_login($r);
    }

    public function isLogged()
    {
        $this->_sessionStart();







<
<

















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

    protected function _login($user)
    {
        $this->_sessionStart(true);
        $db = Garradin_DB::getInstance();

        $_SESSION['logged_user'] = $user;



        return true;
    }

    public function login($email, $passe)
    {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL))
            return false;

        $db = Garradin_DB::getInstance();
        $r = $db->querySingle('SELECT * FROM membres WHERE email=\''.$db->escapeString($email).'\' LIMIT 1;', true);

        if (empty($r))
            return false;

        if (!$this->_checkPassword($passe, $r['passe']))
            return false;

        $droits = $db->simpleQuerySingle(
            'SELECT * FROM membres_categories WHERE id = ?;',
            true, (int)$r['id_categorie']);

        foreach ($droits as $key=>$value)
        {
            unset($droits[$key]);
            $key = str_replace('droit_', '', $key, $found);

            if ($found)
            {
                $droits[$key] = (int) $value;
            }
        }

        if ($droits['connexion'] == self::DROIT_AUCUN)
            return false;

        $r['droits'] = $droits;

        return $this->_login($r);
    }

    public function isLogged()
    {
        $this->_sessionStart();

Modified include/class.membres_categories.php from [e729145e71] to [5b96deae11].

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
<?php

require_once GARRADIN_ROOT . '/include/class.membres.php';

class Garradin_Membres_Categories
{
    public function add($data)
    {
        if (!isset($data['nom']) || !trim($data['nom']))
        {
            throw new UserException('Le nom de catégorie ne peut rester vide.');
        }

        if (!isset($data['montant_cotisation']) || !is_numeric($data['montant_cotisation']))
        {
            throw new UserException('Le montant de cotisation doit être un chiffre.');
        }

        $db = Garradin_DB::getInstance();

        $db->simpleExec(
            'INSERT INTO membres_categories (nom, description, montant_cotisation, duree_cotisation) VALUES (?, ?, ?, ?);',

            $data['nom'],
            !empty($data['description']) ? trim($data['description']) : '',

            (float) $data['montant_cotisation'],

            12






        );

















        return $db->lastInsertRowID();
    }

    public function edit($id, $data)
    {
        if (!isset($data['nom']) || !trim($data['nom']))
        {
            throw new UserException('Le nom ne peut rester vide.');
        }

        if (!isset($data['montant_cotisation']) || !is_numeric($data['montant_cotisation']))
        {
            throw new UserException('Le montant de cotisation doit être un chiffre.');
        }

        $db = Garradin_DB::getInstance();

        return $db->simpleExec(
            'UPDATE membres_categories SET nom = ?, description = ?, montant_cotisation = ?, duree_cotisation = ?) WHERE id = ?',
            $data['nom'],
            !empty($data['description']) ? trim($data['description']) : '',
            (float) $data['montant_cotisation'],






|











|
|
<
|
>
|
|
>
|
>
|
>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





<
<
<
<
|
<
<
<
<
<







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
52
53
54
55
56
57




58





59
60
61
62
63
64
65
<?php

require_once GARRADIN_ROOT . '/include/class.membres.php';

class Garradin_Membres_Categories
{
    protected function _checkData(&$data)
    {
        if (!isset($data['nom']) || !trim($data['nom']))
        {
            throw new UserException('Le nom de catégorie ne peut rester vide.');
        }

        if (!isset($data['montant_cotisation']) || !is_numeric($data['montant_cotisation']))
        {
            throw new UserException('Le montant de cotisation doit être un chiffre.');
        }

        if (!isset($data['duree_cotisation']) || !is_numeric($data['duree_cotisation']))
        {

            $data['duree_cotisation'] = 12;
        }

        if (!isset($data['description']))
        {
            $data['description'] = '';
        }

        $droits = array(
            'wiki'      =>  Garradin_Membres::DROIT_ACCES,
            'membres'   =>  Garradin_Membres::DROIT_ACCES,
            'compta'    =>  Garradin_Membres::DROIT_ACCES,
            'inscription'=> Garradin_Membres::DROIT_ACCES,
            'connexion' =>  Garradin_Membres::DROIT_ACCES,
        );

        foreach ($droits as $key=>$value)
        {
            if (!isset($data['droit_'.$key]))
                $data['droit_'.$key] = $value;
            else
                $data['droit_'.$key] = (int)$data['droit_'.$key];
        }
    }

    public function add($data)
    {
        $this->_checkData($data);

        $db = Garradin_DB::getInstance();
        $db->simpleInsert('membres_categories', $data);

        return $db->lastInsertRowID();
    }

    public function edit($id, $data)
    {




        $this->_checkData($data);





        $db = Garradin_DB::getInstance();

        return $db->simpleExec(
            'UPDATE membres_categories SET nom = ?, description = ?, montant_cotisation = ?, duree_cotisation = ?) WHERE id = ?',
            $data['nom'],
            !empty($data['description']) ? trim($data['description']) : '',
            (float) $data['montant_cotisation'],
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
        if ($db->simpleQuerySingle('SELECT 1 FROM membres WHERE id_categorie = ?;', false, (int)$id))
        {
            throw new UserException('La catégorie contient encore des membres, il n\'est pas possible de la supprimer.');
        }

        return $db->simpleExec('DELETE FROM membres_categories WHERE id = ?;', (int) $id);
    }

    public function setAccess($cat)
    {
        for ($i = 1; $i < func_num_args(); $i++)
        {
            $access = func_get_arg($i);
            if (!is_int($access))
            {
                throw new UnexpectedValueException($access . ' is not a valid access right');
            }

            $db = Garradin_DB::getInstance();
            $db->simpleExec('INSERT OR REPLACE INTO membres_categories_droits (id_categorie, droit) VALUES (?, ?);',
                (int)$cat,
                (int)$access);
        }

        return true;
    }
}

?>







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



83
84
85
86
87
88
89



















90
91
92
        if ($db->simpleQuerySingle('SELECT 1 FROM membres WHERE id_categorie = ?;', false, (int)$id))
        {
            throw new UserException('La catégorie contient encore des membres, il n\'est pas possible de la supprimer.');
        }

        return $db->simpleExec('DELETE FROM membres_categories WHERE id = ?;', (int) $id);
    }



















}

?>

Modified include/init.php from [eabca5af92] to [e1167b6957].

65
66
67
68
69
70
71

72
73
74
75
76
77
78

    if (!empty($_SERVER['HTTP_HOST']))
        $error .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n";

    $error .= $e->getTraceAsString();
    //$error .= print_r($_SERVER, true);


    echo $error;
    exit;
}

set_error_handler("exception_error_handler");
set_exception_handler("exception_handler");








>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

    if (!empty($_SERVER['HTTP_HOST']))
        $error .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n";

    $error .= $e->getTraceAsString();
    //$error .= print_r($_SERVER, true);

    echo '<pre>';
    echo $error;
    exit;
}

set_error_handler("exception_error_handler");
set_exception_handler("exception_handler");

Modified include/template.php from [549d03128c] to [97de6e82ed].

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
52
53
54
$tpl->reserved_template_varname = 'tpl';

$tpl->assign('www_url', WWW_URL);
$tpl->assign('self_url', utils::getSelfUrl());

$tpl->assign('is_logged', false);



$tpl->assign('config', Garradin_Config::getInstance()->getConfig());






function tpl_csrf_field($params)
{
    $name = utils::CSRF_field_name($params['key']);
    $value = utils::CSRF_create($params['key']);

    return '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
}

function tpl_form_field($params)
{
    $name = $params['name'];

    if (!empty($_POST[$name]))
        $value = $_POST[$name];
    elseif (!empty($params['default']) && !empty($params['default'][$name]))
        $value = $params['default'][$name];
    else
        $value = '';

    return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}

function has_right($right, $check)
{
    $right = constant('Garradin_Membres::DROIT_'.strtoupper($right));
    return array_key_exists($right, $check);
}

$tpl->register_function('csrf_field', 'tpl_csrf_field');
$tpl->register_function('form_field', 'tpl_form_field');

?>







>
>
|
>
>
>
>
>













|

|







<
<
<
<
<
<




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






52
53
54
55
$tpl->reserved_template_varname = 'tpl';

$tpl->assign('www_url', WWW_URL);
$tpl->assign('self_url', utils::getSelfUrl());

$tpl->assign('is_logged', false);

if (class_exists('Garradin_Config'))
{
    $tpl->assign('config', Garradin_Config::getInstance()->getConfig());
}
else
{
    $tpl->assign('config', false);
}

function tpl_csrf_field($params)
{
    $name = utils::CSRF_field_name($params['key']);
    $value = utils::CSRF_create($params['key']);

    return '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
}

function tpl_form_field($params)
{
    $name = $params['name'];

    if (isset($_POST[$name]))
        $value = $_POST[$name];
    elseif (isset($params['default']) && isset($params['default'][$name]))
        $value = $params['default'][$name];
    else
        $value = '';

    return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}







$tpl->register_function('csrf_field', 'tpl_csrf_field');
$tpl->register_function('form_field', 'tpl_form_field');

?>

Modified templates/admin/_head.tpl from [3218c14ed1] to [0ec89e9959].

11
12
13
14
15
16
17
18



19


20
21



22






23


24
25




26

27
28
29
30
31
32

<div class="header">
    <h1>{$title|escape}</h1>

    {if $is_logged}
    <ul class="menu">
        <li class="home{if $self_page == ''} current{/if}"><a href="{$www_url}admin/">Accueil</a></li>
        {if has_right('MEMBRE_GESTION', $user.rights)}



            <li class="add_member{if $self_page == 'membres/ajouter.php'} current{/if}"><a href="{$www_url}admin/membres/ajouter.php">Ajouter un membre</a></li>


        {/if}
        {if has_right('MEMBRE_GESTION', $user.rights) || has_right('MEMBRE_ADMIN', $user.rights) || has_right('MEMBRE_LISTER', $user.rights)}



            <li class="list_members{if $self_page == 'membres/'} current{/if}"><a href="{$www_url}admin/membres/liste.php">Liste</a></li>






        {/if}


        {if has_right('MEMBRE_ADMIN', $user.rights)}
            <li class="member_cats{if $self_page == 'membres/categories.php'} current{/if}"><a href="{$www_url}admin/membres/categories.php">Gérer les catégories de membres</a></li>




        {/if}

        <li class="logout"><a href="{$www_url}admin/logout.php">Déconnexion</a></li>
    </ul>
    {/if}
</div>

<div class="page">







|
>
>
>
|
>
>
|
<
>
>
>
|
>
>
>
>
>
>
|
>
>
|
|
>
>
>
>

>






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
52

<div class="header">
    <h1>{$title|escape}</h1>

    {if $is_logged}
    <ul class="menu">
        <li class="home{if $self_page == ''} current{/if}"><a href="{$www_url}admin/">Accueil</a></li>
        {if $user.droits.membres >= Garradin_Membres::DROIT_ACCES}
            <li class="list_members{if $self_page == 'membres/'} current{/if}"><a href="{$www_url}admin/membres/">Membres</a>
            {if $user.droits.membres >= Garradin_Membres::DROIT_ADMIN}
            <ul>
                <li class="add_member{if $self_page == 'membres/ajouter.php'} current{/if}"><a href="{$www_url}admin/membres/ajouter.php">Ajouter</a></li>
                <li class="member_cats{if $self_page == 'membres/categories.php'} current{/if}"><a href="{$www_url}admin/membres/categories.php">Catégories</a></li>
            </ul>
            {/if}

            </li>
        {/if}
        {if $user.droits.compta >= Garradin_Membres::DROIT_ACCES}
            <li class="compta{if $self_page == 'compta/'} current{/if}"><a href="{$www_url}compta/">Comptabili</a>
            {if $user.droits.compta >= Garradin_Membres::DROIT_ADMIN}
            <ul>
                <li class="compta_gestion{if $self_page == 'compta/gestion/'} current{/if}"><a href="{$www_url}admin/compta/operations.php">Opérations</a></li>
                <li class="compta_cats{if $self_page == 'compta/categories.php'} current{/if}"><a href="{$www_url}admin/compta/categories.php">Catégories</a></li>
                <li class="compta_comptes{if $self_page == 'compta/comptes.php'} current{/if}"><a href="{$www_url}admin/compta/comptes.php">Comptes</a></li>
            </ul>
            {/if}
            </li>
        {/if}
        {if $user.droits.wiki >= Garradin_Membres::DROIT_ACCES}
            <li class="wiki{if $self_page == 'wiki/'} current{/if}"><a href="{$www_url}wiki/">Wiki</a>
            <ul>
                <li class="wiki_my{if $self_page == 'wiki/suivi/'} current{/if}"><a href="{$www_url}wiki/suivi/">Mes pages suivies</a>
            </ul>
            </li>
        {/if}
        <li class="wiki{if $self_page == 'wiki/'} current{/if}"><a href="{$www_url}wiki/">Wiki</a>
        <li class="logout"><a href="{$www_url}admin/logout.php">Déconnexion</a></li>
    </ul>
    {/if}
</div>

<div class="page">

Modified templates/admin/install.tpl from [a2cb6bcfe9] to [ec60fa3984].

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
52
53
54
55
56
57
58
59
60

    <form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Informations sur l'association</legend>
        <dl>
            <dt><label for="f_nom_asso">Nom</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="nom_asso" id="f_nom_asso" value="{form_field name='nom_asso'}" /></dd>
            <dt><label for="f_email_asso">Adresse E-Mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="email" name="email_asso" id="f_email_asso" value="{form_field name='email_asso'}" /></dd>
            <dt><label for="f_adresse_asso">Adresse postale</label></dt>
            <dd><textarea cols="50" rows="5" name="adresse_asso" id="f_adresse_asso">{form_field name='adresse_asso'}</textarea></dd>
            <dt><label for="f_site_asso">Site web</label></dt>
            <dd><input type="url" name="site_asso" id="f_site_asso" value="{form_field name='site_asso'}" /></dd>
        </dl>
    </fieldset>

    <fieldset>
        <legend>Informations sur le premier membre</legend>
        <dl>
            <dt><label for="f_nom_membre">Nom et prénom</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="nom_membre" id="f_nom_membre" value="{form_field name='nom_membre'}" /></dd>
            <dt><label for="f_cat_membre">Catégorie du membre</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd class="tip">Par exemple : bureau, conseil d'administration, présidente, trésorier, etc.</dd>
            <dd><input type="text" name="cat_membre" id="f_cat_membre" value="{form_field name='cat_membre'}" /></dd>
            <dt><label for="f_email_membre">Adresse E-Mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="email" name="email_membre" id="f_email_membre" value="{form_field name='email_membre'}" /></dd>
            <dt><label for="f_passe_membre">Mot de passe</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd class="help">Pas d'idée ? Voici une suggestion choisie au hasard : <tt>{$passphrase|escape}</tt></dd>
            <dd><input type="password" name="passe_membre" id="f_passe_membre" value="{form_field name='passe_membre'}" /></dd>
            <dt><label for="f_repasse_membre">Encore le mot de passe</label> (vérification) <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="password" name="repasse_membre" id="f_repasse_membre" value="{form_field name='repasse_membre'}" /></dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="install"}
        <input type="submit" name="save" value="Terminer l'installation &rarr;" />
    </p>

    </form>
{/if}

{include file="admin/_foot.tpl"}







|

|

|

|







|


|

|


|

|












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
52
53
54
55
56
57
58
59
60

    <form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Informations sur l'association</legend>
        <dl>
            <dt><label for="f_nom_asso">Nom</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="nom_asso" id="f_nom_asso" value="{form_field name=nom_asso}" /></dd>
            <dt><label for="f_email_asso">Adresse E-Mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="email" name="email_asso" id="f_email_asso" value="{form_field name=email_asso}" /></dd>
            <dt><label for="f_adresse_asso">Adresse postale</label></dt>
            <dd><textarea cols="50" rows="5" name="adresse_asso" id="f_adresse_asso">{form_field name=adresse_asso}</textarea></dd>
            <dt><label for="f_site_asso">Site web</label></dt>
            <dd><input type="url" name="site_asso" id="f_site_asso" value="{form_field name=site_asso}" /></dd>
        </dl>
    </fieldset>

    <fieldset>
        <legend>Informations sur le premier membre</legend>
        <dl>
            <dt><label for="f_nom_membre">Nom et prénom</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="nom_membre" id="f_nom_membre" value="{form_field name=nom_membre}" /></dd>
            <dt><label for="f_cat_membre">Catégorie du membre</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd class="tip">Par exemple : bureau, conseil d'administration, présidente, trésorier, etc.</dd>
            <dd><input type="text" name="cat_membre" id="f_cat_membre" value="{form_field name=cat_membre}" /></dd>
            <dt><label for="f_email_membre">Adresse E-Mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="email" name="email_membre" id="f_email_membre" value="{form_field name=email_membre}" /></dd>
            <dt><label for="f_passe_membre">Mot de passe</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd class="help">Pas d'idée ? Voici une suggestion choisie au hasard : <tt>{$passphrase|escape}</tt></dd>
            <dd><input type="password" name="passe_membre" id="f_passe_membre" value="{form_field name=passe_membre}" /></dd>
            <dt><label for="f_repasse_membre">Encore le mot de passe</label> (vérification) <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="password" name="repasse_membre" id="f_repasse_membre" value="{form_field name=repasse_membre}" /></dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="install"}
        <input type="submit" name="save" value="Terminer l'installation &rarr;" />
    </p>

    </form>
{/if}

{include file="admin/_foot.tpl"}

Modified templates/admin/login.tpl from [ec86fd08d4] to [ccc6abedf0].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Connexion</legend>
        <dl>
            <dt><label for="f_email">Adresse E-Mail</label></dt>
            <dd><input type="email" name="email" id="f_email" value="{form_field name='email'}" /></dd>
            <dt><label for="f_passe">Mot de passe</label></dt>
            <dd><input type="password" name="passe" id="f_passe" value="" /></dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="login"}
        <input type="submit" name="login" value="Se connecter &rarr;" />
    </p>

</form>

{include file="admin/_foot.tpl"}







|













12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Connexion</legend>
        <dl>
            <dt><label for="f_email">Adresse E-Mail</label></dt>
            <dd><input type="email" name="email" id="f_email" value="{form_field name=email}" /></dd>
            <dt><label for="f_passe">Mot de passe</label></dt>
            <dd><input type="password" name="passe" id="f_passe" value="" /></dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="login"}
        <input type="submit" name="login" value="Se connecter &rarr;" />
    </p>

</form>

{include file="admin/_foot.tpl"}

Modified www/admin/install.php from [85fe587e0e] to [ed66856c98].

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110

                require_once GARRADIN_ROOT . '/include/class.membres_categories.php';

                $cats = new Garradin_Membres_Categories;
                $id = $cats->add(array(
                    'nom' => 'Membres actifs',
                    'montant_cotisation' => 10));
                $cats->setAccess($id,
                    Garradin_Membres::DROIT_CONNEXION,
                    Garradin_Membres::DROIT_WIKI_LIRE,
                    Garradin_Membres::DROIT_WIKI_ECRIRE);
                $config->set('categorie_membres', $id);

                $id = $cats->add(array(
                    'nom' => ucfirst(utils::post('cat_membre')),
                    'montant_cotisation' => 0));
                $cats->setAccess($id,
                    Garradin_Membres::DROIT_CONNEXION,
                    Garradin_Membres::DROIT_WIKI_ADMIN,
                    Garradin_Membres::DROIT_MEMBRE_ADMIN,
                    Garradin_Membres::DROIT_COMPTA_ADMIN);


                $membres = new Garradin_Membres;
                $membres->add(array(
                    'id_categorie'  =>  $id,
                    'nom'           =>  utils::post('nom_membre'),
                    'email'         =>  utils::post('email_membre'),
                    'passe'         =>  utils::post('passe_membre'),







<
<
<
<




|
<
|
|
|
|
>







83
84
85
86
87
88
89




90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106

                require_once GARRADIN_ROOT . '/include/class.membres_categories.php';

                $cats = new Garradin_Membres_Categories;
                $id = $cats->add(array(
                    'nom' => 'Membres actifs',
                    'montant_cotisation' => 10));




                $config->set('categorie_membres', $id);

                $id = $cats->add(array(
                    'nom' => ucfirst(utils::post('cat_membre')),
                    'montant_cotisation' => 0,

                    'droit_inscription' => Garradin_Membres::DROIT_AUCUN,
                    'droit_wiki' => Garradin_Membres::DROIT_ADMIN,
                    'droit_membres' => Garradin_Membres::DROIT_ADMIN,
                    'droit_compta' => Garradin_Membres::DROIT_ADMIN,
                    ));

                $membres = new Garradin_Membres;
                $membres->add(array(
                    'id_categorie'  =>  $id,
                    'nom'           =>  utils::post('nom_membre'),
                    'email'         =>  utils::post('email_membre'),
                    'passe'         =>  utils::post('passe_membre'),

Modified www/style/admin.css from [952e29b84e] to [141f91b4aa].

16
17
18
19
20
21
22
23
24
25
26
27
28
29















30
31
32
33
34
35
36
    color: #9c4f15;
    margin-left: 180px;
    margin-bottom: 0.4em;
}

.header .menu {
    float: left;
    max-width: 167px;
    margin-left: 2em;
}

.header .menu a {
    color: #fff;
    font-weight: bold;















}

.page {
    margin-left: 180px;
}

p.error {







|
|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
    color: #9c4f15;
    margin-left: 180px;
    margin-bottom: 0.4em;
}

.header .menu {
    float: left;
    width: 168px;
    list-style-type: none;
}

.header .menu a {
    color: #fff;
    font-weight: bold;
    padding: 0.2em 0.4em;
    display: block;
    background: rgba(156, 79, 21, 0.7);
    margin-bottom: 0.2em;
    text-decoration: underline;
}

.header .menu a:hover {
    text-decoration: none;
    background: rgba(156, 79, 21, 0.5);
}

.header .menu li li a {
    padding-left: 1.5em;
    font-size: 0.8em;
}

.page {
    margin-left: 180px;
}

p.error {