@@ -11,89 +11,89 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function install_etape_ldap2_dist() { |
| 18 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 19 | - |
|
| 20 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 21 | - |
|
| 22 | - $port_ldap = _request('port_ldap'); |
|
| 23 | - |
|
| 24 | - $tls_ldap = _request('tls_ldap'); |
|
| 25 | - |
|
| 26 | - $protocole_ldap = _request('protocole_ldap'); |
|
| 27 | - |
|
| 28 | - $login_ldap = _request('login_ldap'); |
|
| 29 | - |
|
| 30 | - $pass_ldap = _request('pass_ldap'); |
|
| 31 | - |
|
| 32 | - $port_ldap = intval($port_ldap); |
|
| 33 | - |
|
| 34 | - $tls = false; |
|
| 35 | - |
|
| 36 | - if ($tls_ldap == 'oui') { |
|
| 37 | - if ($port_ldap == 636) { |
|
| 38 | - $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 39 | - } else { |
|
| 40 | - $tls = true; |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - else { |
|
| 44 | - $tls_ldap == 'non'; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - // Verifions que l'adresse demandee est valide |
|
| 48 | - $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: ''; |
|
| 49 | - |
|
| 50 | - $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 51 | - $erreur = "ldap_connect(".spip_htmlspecialchars($adresse_ldap).", ".spip_htmlspecialchars($port_ldap).")"; |
|
| 52 | - |
|
| 53 | - if ($ldap_link) { |
|
| 54 | - if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 55 | - $protocole_ldap = 2; |
|
| 56 | - ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 57 | - } |
|
| 58 | - if ($tls === true) { |
|
| 59 | - if (!ldap_start_tls($ldap_link)) { |
|
| 60 | - $erreur = "ldap_start_tls(".spip_htmlspecialchars($ldap_link) |
|
| 61 | - ." ".spip_htmlspecialchars($adresse_ldap) |
|
| 62 | - .", ".spip_htmlspecialchars($port_ldap).")"; |
|
| 63 | - $ldap_link = false; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - if ($ldap_link) { |
|
| 67 | - $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 68 | - $erreur = "ldap_bind('".spip_htmlspecialchars($ldap_link) |
|
| 69 | - ."', '".spip_htmlspecialchars($login_ldap) |
|
| 70 | - ."', '".spip_htmlspecialchars($pass_ldap) |
|
| 71 | - ."'): ".spip_htmlspecialchars($adresse_ldap) |
|
| 72 | - .", ".spip_htmlspecialchars($port_ldap); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - if ($ldap_link) { |
|
| 77 | - echo info_etape( |
|
| 78 | - _T('titre_connexion_ldap'), |
|
| 79 | - info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 80 | - ), _T('info_connexion_ldap_ok'); |
|
| 81 | - echo generer_form_ecrire('install', ( |
|
| 82 | - "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 83 | - . "\n<input type='hidden' name='adresse_ldap' value=\"".spip_htmlspecialchars($adresse_ldap)."\" />" |
|
| 84 | - . "\n<input type='hidden' name='port_ldap' value=\"".spip_htmlspecialchars($port_ldap)."\" />" |
|
| 85 | - . "\n<input type='hidden' name='login_ldap' value=\"".spip_htmlspecialchars($login_ldap)."\" />" |
|
| 86 | - . "\n<input type='hidden' name='pass_ldap' value=\"".spip_htmlspecialchars($pass_ldap)."\" />" |
|
| 87 | - . "\n<input type='hidden' name='protocole_ldap' value=\"".spip_htmlspecialchars($protocole_ldap)."\" />" |
|
| 88 | - . "\n<input type='hidden' name='tls_ldap' value=\"".spip_htmlspecialchars($tls_ldap)."\" />" |
|
| 89 | - . bouton_suivant())); |
|
| 90 | - } else { |
|
| 91 | - echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 92 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 93 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 94 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 95 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - echo install_fin_html(); |
|
| 18 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 19 | + |
|
| 20 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 21 | + |
|
| 22 | + $port_ldap = _request('port_ldap'); |
|
| 23 | + |
|
| 24 | + $tls_ldap = _request('tls_ldap'); |
|
| 25 | + |
|
| 26 | + $protocole_ldap = _request('protocole_ldap'); |
|
| 27 | + |
|
| 28 | + $login_ldap = _request('login_ldap'); |
|
| 29 | + |
|
| 30 | + $pass_ldap = _request('pass_ldap'); |
|
| 31 | + |
|
| 32 | + $port_ldap = intval($port_ldap); |
|
| 33 | + |
|
| 34 | + $tls = false; |
|
| 35 | + |
|
| 36 | + if ($tls_ldap == 'oui') { |
|
| 37 | + if ($port_ldap == 636) { |
|
| 38 | + $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 39 | + } else { |
|
| 40 | + $tls = true; |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + else { |
|
| 44 | + $tls_ldap == 'non'; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + // Verifions que l'adresse demandee est valide |
|
| 48 | + $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: ''; |
|
| 49 | + |
|
| 50 | + $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 51 | + $erreur = "ldap_connect(".spip_htmlspecialchars($adresse_ldap).", ".spip_htmlspecialchars($port_ldap).")"; |
|
| 52 | + |
|
| 53 | + if ($ldap_link) { |
|
| 54 | + if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 55 | + $protocole_ldap = 2; |
|
| 56 | + ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 57 | + } |
|
| 58 | + if ($tls === true) { |
|
| 59 | + if (!ldap_start_tls($ldap_link)) { |
|
| 60 | + $erreur = "ldap_start_tls(".spip_htmlspecialchars($ldap_link) |
|
| 61 | + ." ".spip_htmlspecialchars($adresse_ldap) |
|
| 62 | + .", ".spip_htmlspecialchars($port_ldap).")"; |
|
| 63 | + $ldap_link = false; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + if ($ldap_link) { |
|
| 67 | + $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 68 | + $erreur = "ldap_bind('".spip_htmlspecialchars($ldap_link) |
|
| 69 | + ."', '".spip_htmlspecialchars($login_ldap) |
|
| 70 | + ."', '".spip_htmlspecialchars($pass_ldap) |
|
| 71 | + ."'): ".spip_htmlspecialchars($adresse_ldap) |
|
| 72 | + .", ".spip_htmlspecialchars($port_ldap); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + if ($ldap_link) { |
|
| 77 | + echo info_etape( |
|
| 78 | + _T('titre_connexion_ldap'), |
|
| 79 | + info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 80 | + ), _T('info_connexion_ldap_ok'); |
|
| 81 | + echo generer_form_ecrire('install', ( |
|
| 82 | + "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 83 | + . "\n<input type='hidden' name='adresse_ldap' value=\"".spip_htmlspecialchars($adresse_ldap)."\" />" |
|
| 84 | + . "\n<input type='hidden' name='port_ldap' value=\"".spip_htmlspecialchars($port_ldap)."\" />" |
|
| 85 | + . "\n<input type='hidden' name='login_ldap' value=\"".spip_htmlspecialchars($login_ldap)."\" />" |
|
| 86 | + . "\n<input type='hidden' name='pass_ldap' value=\"".spip_htmlspecialchars($pass_ldap)."\" />" |
|
| 87 | + . "\n<input type='hidden' name='protocole_ldap' value=\"".spip_htmlspecialchars($protocole_ldap)."\" />" |
|
| 88 | + . "\n<input type='hidden' name='tls_ldap' value=\"".spip_htmlspecialchars($tls_ldap)."\" />" |
|
| 89 | + . bouton_suivant())); |
|
| 90 | + } else { |
|
| 91 | + echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 92 | + "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 93 | + '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 94 | + "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 95 | + '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + echo install_fin_html(); |
|
| 99 | 99 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | echo info_etape( |
| 78 | 78 | _T('titre_connexion_ldap'), |
| 79 | 79 | info_progression_etape(2, 'etape_ldap', 'install/') |
| 80 | - ), _T('info_connexion_ldap_ok'); |
|
| 80 | + ), _T('info_connexion_ldap_ok'); |
|
| 81 | 81 | echo generer_form_ecrire('install', ( |
| 82 | 82 | "\n<input type='hidden' name='etape' value='ldap3' />" |
| 83 | 83 | . "\n<input type='hidden' name='adresse_ldap' value=\"".spip_htmlspecialchars($adresse_ldap)."\" />" |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | . bouton_suivant())); |
| 90 | 90 | } else { |
| 91 | 91 | echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
| 92 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 93 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 94 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 95 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 92 | + "<div class='error'><p>"._T('avis_connexion_ldap_echec_1').'</p>', |
|
| 93 | + '<p>'._T('avis_connexion_ldap_echec_2'). |
|
| 94 | + "<br />\n"._T('avis_connexion_ldap_echec_3'). |
|
| 95 | + '<br /><br />'.$erreur.'<b> ?</b></p></div>'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | echo install_fin_html(); |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | } else { |
| 40 | 40 | $tls = true; |
| 41 | 41 | } |
| 42 | - } |
|
| 43 | - else { |
|
| 42 | + } else { |
|
| 44 | 43 | $tls_ldap == 'non'; |
| 45 | 44 | } |
| 46 | 45 | |