Subversion Repositories Applications.papyrus

Rev

Rev 1524 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1524 Rev 2145
Line 80... Line 80...
80
while ($ligne_auth = $resultat_auth->fetchRow(DB_FETCHMODE_OBJECT)) {
80
while ($ligne_auth = $resultat_auth->fetchRow(DB_FETCHMODE_OBJECT)) {
81
    // Ajout des valeurs communes aux différents type d'auth
81
    // Ajout des valeurs communes aux différents type d'auth
82
    $GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_nom'] = $ligne_auth->gsa_nom;
82
    $GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_nom'] = $ligne_auth->gsa_nom;
83
    $GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_abreviation'] = $ligne_auth->gsa_abreviation;
83
    $GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_abreviation'] = $ligne_auth->gsa_abreviation;
84
    $GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_ce_type_auth'] = $ligne_auth->gsa_ce_type_auth;
84
    $GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_ce_type_auth'] = $ligne_auth->gsa_ce_type_auth;
85
    
85
 
86
    
86
 
87
    if ($ligne_auth->gsa_id_auth == $GLOBALS['_GEN_commun']['info_site']->gs_ce_auth) {
87
    if ($ligne_auth->gsa_id_auth == $GLOBALS['_GEN_commun']['info_site']->gs_ce_auth) {
88
        $GLOBALS['_GEN_commun']['info_auth'] = $ligne_auth;
88
        $GLOBALS['_GEN_commun']['info_auth'] = $ligne_auth;
89
    }
89
    }
90
    
90
 
91
    if ($ligne_auth->gsa_ce_auth_bdd != 0) {
91
    if ($ligne_auth->gsa_ce_auth_bdd != 0) {
92
        //Identification via une base de donnée :
92
        //Identification via une base de donnée :
93
        $requete_auth_bdd = 'SELECT * '.
93
        $requete_auth_bdd = 'SELECT * '.
94
                            'FROM gen_site_auth_bdd '.
94
                            'FROM gen_site_auth_bdd '.
95
                            'WHERE gsab_id_auth_bdd = '.$ligne_auth->gsa_ce_auth_bdd;
95
                            'WHERE gsab_id_auth_bdd = '.$ligne_auth->gsa_ce_auth_bdd;
96
        
96
 
97
        $resultat_auth_bdd = $db->query($requete_auth_bdd);
97
        $resultat_auth_bdd = $db->query($requete_auth_bdd);
98
        (DB::isError($resultat_auth_bdd))
98
        (DB::isError($resultat_auth_bdd))
99
            ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_auth_bdd->getMessage(), $requete_auth_bdd))
99
            ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_auth_bdd->getMessage(), $requete_auth_bdd))
100
            : '';
100
            : '';
101
        $tab_auth_bdd = $resultat_auth_bdd->fetchRow(DB_FETCHMODE_OBJECT) ;
101
        $tab_auth_bdd = $resultat_auth_bdd->fetchRow(DB_FETCHMODE_OBJECT) ;
Line 105... Line 105...
105
            if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres)) {
105
            if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres)) {
106
                $arguments = explode(' ', $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres);
106
                $arguments = explode(' ', $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres);
107
                for ($i = 0; $i < count($arguments); $i++) {
107
                for ($i = 0; $i < count($arguments); $i++) {
108
                    $attr = explode('=', $arguments[$i]);
108
                    $attr = explode('=', $arguments[$i]);
109
                    if ($attr[0] != '') {
109
                    if ($attr[0] != '') {
-
 
110
                        $cle = array_shift($attr);
-
 
111
                        $valeur = '';
-
 
112
                        if (count($attr) == 1) {
-
 
113
                           $valeur = $attr[0];
-
 
114
                        } else if (count($attr) > 1) {
-
 
115
                           $valeur = implode('=', $attr);
-
 
116
                        }
110
                        $GLOBALS['_GEN_commun']['info_auth_bdd']->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
117
                        $GLOBALS['_GEN_commun']['info_auth_bdd']->$cle = $valeur;
111
                    }
118
                    }
112
                }
119
                }
113
            }
120
            }
114
        }
121
        }
115
        
122
 
116
       	$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth] = array_merge((array)$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth], (array) $tab_auth_bdd);
123
       	$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth] = array_merge((array)$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth], (array) $tab_auth_bdd);
117
        $resultat_auth_bdd->free();
124
        $resultat_auth_bdd->free();
118
    } else if ($ligne_auth->gsa_ce_auth_ldap != 0) {
125
    } else if ($ligne_auth->gsa_ce_auth_ldap != 0) {
119
        //Identification via LDAP :
126
        //Identification via LDAP :
120
        $requete_auth_ldap =    'SELECT * '.
127
        $requete_auth_ldap =    'SELECT * '.
121
                                'FROM gen_site_auth_ldap '.
128
                                'FROM gen_site_auth_ldap '.
122
                                'WHERE gsal_id_auth_ldap = '.$ligne_auth->gsa_ce_auth_ldap;
129
                                'WHERE gsal_id_auth_ldap = '.$ligne_auth->gsa_ce_auth_ldap;
123
        
130
 
124
        $resultat_auth_ldap = $db->query($requete_auth_ldap);
131
        $resultat_auth_ldap = $db->query($requete_auth_ldap);
125
        (DB::isError($resultat_auth_ldap))
132
        (DB::isError($resultat_auth_ldap))
126
            ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_auth_ldap->getMessage(), $requete_auth_ldap))
133
            ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_auth_ldap->getMessage(), $requete_auth_ldap))
127
            : '';
134
            : '';
128
        $tab_auth_ldap = $resultat_auth_ldap->fetchRow(DB_FETCHMODE_OBJECT);
135
        $tab_auth_ldap = $resultat_auth_ldap->fetchRow(DB_FETCHMODE_OBJECT);
Line 135... Line 142...
135
        die('ERREUR Papyrus : impossible de trouver les information authentification. <br />'.
142
        die('ERREUR Papyrus : impossible de trouver les information authentification. <br />'.
136
            'Identifiant auth : '.$ligne_auth->gs_ce_auth.'<br />'.
143
            'Identifiant auth : '.$ligne_auth->gs_ce_auth.'<br />'.
137
            'Ligne n° : '. __LINE__ .'<br />'.
144
            'Ligne n° : '. __LINE__ .'<br />'.
138
            'Fichier : '. __FILE__ );
145
            'Fichier : '. __FILE__ );
139
    }
146
    }
140
    
147
 
141
    // On teste le type d'authentification
148
    // On teste le type d'authentification
142
    $tab_type_site = GEN_retournerTableauTypeSiteExterne($db);
149
    $tab_type_site = GEN_retournerTableauTypeSiteExterne($db);
143
    $types_site = '';
150
    $types_site = '';
144
    foreach ($tab_type_site as $val) {
151
    foreach ($tab_type_site as $val) {
145
        $types_site .= $val['id'].', ';
152
        $types_site .= $val['id'].', ';
Line 176... Line 183...
176
                        'passwordcol' => $auth_courante['gsab_nom_champ_mdp'],
183
                        'passwordcol' => $auth_courante['gsab_nom_champ_mdp'],
177
                        'cryptType' => $auth_courante['gsab_cryptage_mdp'],
184
                        'cryptType' => $auth_courante['gsab_cryptage_mdp'],
178
                        'db_fields' => '*');
185
                        'db_fields' => '*');
179
    // L'authentification courrante
186
    // L'authentification courrante
180
    $GLOBALS['_GEN_commun']['pear_auth'] = new Auth('DB', $GLOBALS['_PAPYRUS_']['auth']['param_bdd'], 'GEN_afficherInfoIdentification', 1);
187
    $GLOBALS['_GEN_commun']['pear_auth'] = new Auth('DB', $GLOBALS['_PAPYRUS_']['auth']['param_bdd'], 'GEN_afficherInfoIdentification', 1);
181
    
188
 
182
} else if ($auth_courante['gsa_ce_type_auth'] == 2) {
189
} else if ($auth_courante['gsa_ce_type_auth'] == 2) {
183
    // Authentification via LDAP
190
    // Authentification via LDAP
184
    $GLOBALS['_PAPYRUS_']['auth']['param_ldap'] = array (   'host' => $auth_courante['gsal_serveur'],
191
    $GLOBALS['_PAPYRUS_']['auth']['param_ldap'] = array (   'host' => $auth_courante['gsal_serveur'],
185
                            'port' => $auth_courante['gsal_port'],
192
                            'port' => $auth_courante['gsal_port'],
186
                            'basedn' => $auth_courante['gsal_base_dn'],
193
                            'basedn' => $auth_courante['gsal_base_dn'],