Subversion Repositories Applications.papyrus

Rev

Rev 206 | Rev 302 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
206 alex 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
276 jpm 22
// CVS : $Id: admin_auth.php,v 1.2 2005-02-28 10:32:37 jpm Exp $
206 alex 23
/**
24
* Application gérant les authentifications de Papyrus
25
*
26
* Cette application permet de gérer les authentifications de papyrus
27
* elle permet de spécifier pour un monde quel annuaire utiliser
28
* et de gérer des authentifications de spip et ou wikini
29
*
30
*@package Admin_auth
31
//Auteur original :
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
*@copyright     Tela-Botanica 2000-2004
276 jpm 34
*@version       $Revision: 1.2 $
206 alex 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTÊTE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
/** Inclusion du fichier de configuration de cette application.*/
42
require_once GEN_CHEMIN_PAP.'applications/admin_auth/configuration/adau_configuration.inc.php';
43
 
44
//Utilisation de la bibliothèque PEAR NET_URL
45
 
46
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
47
require_once ADAU_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
48
require_once ADAU_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm/select.php';
49
 
50
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
276 jpm 51
require_once ADAU_CHEMIN_BIBLIOTHEQUE_API.'debogage/BOG_sql.fonct.php';
206 alex 52
 
53
/** Inclusion des fonctions de manipulation du sql.
54
* Permet la récupération d'un nouvel identifiant d'une table.*/
276 jpm 55
require_once ADAU_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
206 alex 56
 
57
require_once ADAU_CHEMIN_BIBLIOTHEQUE_API.'html/HTML_TableFragmenteur.php' ;
58
 
59
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_site..." de Papyrus.*/
60
require_once ADAU_CHEMIN_BIBLIOTHEQUE_GEN.'pap_site.fonct.php';
61
 
62
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_menu..." de Papyrus.*/
63
require_once ADAU_CHEMIN_BIBLIOTHEQUE_GEN.'pap_menu.fonct.php';
64
 
65
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_applications..." de Papyrus.*/
66
require_once ADAU_CHEMIN_BIBLIOTHEQUE_GEN.'pap_application.fonct.php';
67
 
68
/** <BR> Inclusion de la bibliothèque de fonctions concernant l'affichage commun.*/
69
require_once ADAU_CHEMIN_BIBLIOTHEQUE.'admi_auth.fonct.php';//ok
70
 
71
 
72
require_once ADAU_CHEMIN_BIBLIOTHEQUE.'HTML_formulaireAuth.class.php' ;
73
 
74
 
75
// Inclusion des fichiers de traduction de l'appli ADME dePapyrus
76
if (file_exists(ADAU_CHEMIN_LANGUE.'adau_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
77
    /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
78
    require_once ADAU_CHEMIN_LANGUE.'adau_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
79
} else {
80
    /** Inclusion du fichier de traduction par défaut.*/
81
    require_once ADAU_CHEMIN_LANGUE.'adau_langue_'.ADAU_I18N_DEFAUT.'.inc.php';
82
}
83
 
84
// Stockage des styles de l'application
85
GEN_stockerStyleExterne('adau_standard', ADAU_CHEMIN_STYLE.'adau_standard.css');
86
 
87
// +------------------------------------------------------------------------------------------------------+
88
// |                                            CORPS du PROGRAMME                                        |
89
// +------------------------------------------------------------------------------------------------------+
90
 
91
function afficherContenuCorps()
92
{
93
    $db = &$GLOBALS['_GEN_commun']['pear_db'] ;
94
    $url = $GLOBALS['_GEN_commun']['url'] ;
95
    $auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
96
    isset ($GLOBALS['action']) ? '' : $GLOBALS['action'] = '' ; // On déclare action si elle n'existe pas
97
    if (!$auth->getAuth()) {
98
        return 'Identifiez-vous' ;
99
    }
100
    // Le lien pour une nouvelle entrée
101
    $res = '<a href="'.$url->getURL().'&amp;action=nouveau">'.ADAU_AJOUTER.'</a>'."\n<br />" ;
102
    // traitement de la suppression
103
    if (isset ($GLOBALS['action']) && $GLOBALS['action'] == 'supprimer') adau_supprimer_authentification($GLOBALS['id_auth'], $db) ;
104
 
105
    // traitement de l'ajout
106
    if (isset ($GLOBALS['action']) || isset ($GLOBALS['id_auth'])) {
107
        $formulaire = new HTML_formulaireAuth('formulaire_auth', '', str_replace ('&amp;', '&', $url->getURL())) ;
108
        $formulaire->construitFormulaire($url) ;
109
 
110
        // On ajoute un champs caché avec action=nouveau_v
111
        if ($GLOBALS['action'] == 'nouveau') {
112
            $formulaire->addElement ('hidden', 'action', 'nouveau_v') ;
113
            return $formulaire->toHTML() ;
114
        }
115
        if (isset ($GLOBALS['id_auth']) && $GLOBALS['action'] != 'modifier_v' && $GLOBALS['action'] != 'supprimer') {
116
            $formulaire->addElement ('hidden', 'action', 'modifier_v') ;
117
            $formulaire->addElement ('hidden', 'id_auth', $GLOBALS['id_auth']) ;
118
            $formulaire->setDefaults(adau_valeurs_par_defaut($GLOBALS['id_auth'], $db)) ;
119
            return $formulaire->toHTML() ;
120
        }
121
        if ($GLOBALS['action'] == 'modifier_v') {
122
            if ($formulaire->validate()) {
123
                mise_a_jour ($formulaire->getSubmitValues(), $db) ;
124
            }
125
        }
126
        if ($GLOBALS['action'] == 'nouveau_v') {
127
            if ($formulaire->validate()) {
128
                insertion ($formulaire->getSubmitValues(), $db) ;
129
            }
130
        }
131
 
132
    }
133
    // Comportement par défaut
134
    // requete sur la table gen_site_auth
135
    $requete = "select  gsa_ce_auth_bdd,gsa_nom, gsab_nom_table ".
136
                "from gen_site_auth, gen_site_auth_bdd where gsa_id_auth<>0 and gsa_ce_auth_bdd=gsab_id_auth_bdd" ;
137
 
138
    $resultat = $db->query ($requete) ;
139
    if (DB::isError ($resultat)) {
140
        $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
141
                                                                        __FILE__, __LINE__, 'admin_auth')   ;
142
        return ;
143
    }
144
    $liste = new HTML_TableFragmenteur() ;
145
    $liste->construireEntete(array (ADAU_NOM_AUTH, ADAU_NOM_TABLE, ADAU_MODIFIER, ADAU_SUPPRIMER)) ;
146
    $tableau_auth = array() ;
147
    while ($ligne = $resultat->fetchRow()) {
148
        $url->addQueryString ('id_auth', $ligne[0]) ;
149
        array_push ($tableau_auth, array ('<a href="'.$url->getURL().'">'.$ligne[1].'</a>'."\n",    // Première colonne, le nom de l'authentification
150
                                            $ligne[2],  // deuxième colonne, le nom de la table d'annuaire
151
                                            '<a href="'.$url->getURL().'">'.ADAU_MODIFIER.'</a>'."\n",   // Colonne modifier
152
                                            '<a href="'.$url->getURL().'&amp;action=supprimer" onclick="javascript:return confirm (\''.ADAU_SUPPRIMER.' ?\');">'.ADAU_SUPPRIMER.'</a>'."\n"
153
                                            ));
154
    }
155
    $liste->construireListe($tableau_auth) ;
156
    $res .= $liste->toHTML();
157
    return $res ;
158
}// Fin de la fonction afficherContenuCorps()
159
 
160
// +------------------------------------------------------------------------------------------------------+
161
// |                                            PIED du PROGRAMME                                         |
162
// +------------------------------------------------------------------------------------------------------+
163
 
164
 
165
 
166
/* +--Fin du code ----------------------------------------------------------------------------------------+
167
*
168
* $Log: not supported by cvs2svn $
276 jpm 169
* Revision 1.1  2004/12/06 11:31:59  alex
170
* version initiale
206 alex 171
*
276 jpm 172
*
206 alex 173
* +-- Fin du code ----------------------------------------------------------------------------------------+
174
*/
175
?>