diff --git a/ecrire/inc/admin.php b/ecrire/inc/admin.php index 9119ffe3969b1482e4573cfe76e5a9e0da8c553d..f99c5e394e2335d61887e683cee9229663babbb3 100644 --- a/ecrire/inc/admin.php +++ b/ecrire/inc/admin.php @@ -54,7 +54,7 @@ function debut_admin($script, $action, $commentaire='') { )), ('<br />' . _T('info_creer_repertoire_2', array('repertoire' => joli_repertoire($dir))) - . bouton_suivant(_T('bouton_recharger_page')))) + . bouton_suivant(_T('recharger_page')))) . "</form>"; minipres(_T('info_action', array('action' => $action)), diff --git a/ecrire/inc/minipres.php b/ecrire/inc/minipres.php index ac487f02b2db49827b0abd5b44a6c73474e3f655..e9c9e466e8c768d9fb210849652e068e818aa90e 100644 --- a/ecrire/inc/minipres.php +++ b/ecrire/inc/minipres.php @@ -102,16 +102,26 @@ function fieldset($legend, $champs = array(), $horchamps='') { $type = $contenu['hidden'] ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text'); $class = $contenu['hidden'] ? '' : "class='formo' size='40' "; $fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n"; - $fieldset .= "<input ".$class."type='".$type."' name='".$nom."'\nvalue='".$contenu['valeur']."' />\n"; + if(is_array($contenu['alternatives'])) { + foreach($contenu['alternatives'] as $valeur => $label) { + $fieldset .= "<input type='radio' name='".$nom . + "'\nvalue='".$valeur."' ".($valeur==$contenu['valeur']?"checked='checked'":'')."/>\n"; + $fieldset .= "<label for='".$valeur."'>".$label."</label>\n"; + } + $fieldset .= "<br />\n"; + } + else { + $fieldset .= "<input ".$class."type='".$type."' name='".$nom."'\nvalue='".$contenu['valeur']."' />\n"; + } } $fieldset .= "$horchamps</fieldset>\n"; return $fieldset; } // http://doc.spip.org/@bouton_suivant -function bouton_suivant($code = 'bouton_suivant') { - return "\n<span class='suivant'><input id='suivant' type='submit' class='fondl'\nvalue=\"" . - _T($code) . +function bouton_suivant($code = 'suivant') { + return "\n<span class='suivant'><input id='".$code."' type='submit' class='fondl'\nvalue=\"" . + _T("bouton_".$code) . " >>\" /></span>\n"; } diff --git a/ecrire/install/etape_5.php b/ecrire/install/etape_5.php index 2e48ac93556d607f6e81ec7eb05d0cf9186ac6e6..719a281335c771fe72f4ea174e12328b15ddc6a6 100644 --- a/ecrire/install/etape_5.php +++ b/ecrire/install/etape_5.php @@ -81,7 +81,7 @@ function install_etape_5_dist() 'valeur' => 'ldap1', 'hidden' => true )), - bouton_suivant('bouton_acces_ldap') + bouton_suivant('acces_ldap') ); echo "</form>\n"; } diff --git a/ecrire/install/etape_ldap1.php b/ecrire/install/etape_ldap1.php index e77a2510a1cd7cba5fa10797271f38f4bd4e977d..a1d4a32f9b7767c3665efb6a58def03f01f6f1f2 100644 --- a/ecrire/install/etape_ldap1.php +++ b/ecrire/install/etape_ldap1.php @@ -29,57 +29,58 @@ function install_etape_ldap1_dist() } install_debut_html(); - echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"; - echo _T('titre_connexion_ldap'); - echo "</FONT><br />"; + echo info_etape(_T('titre_connexion_ldap'), _T('entree_informations_connexion_ldap')); - echo _T('entree_informations_connexion_ldap'); echo generer_url_post_ecrire('install'); - echo "<p><INPUT TYPE='hidden' NAME='etape' VALUE='ldap2'>"; - - echo "<fieldset><label><B>"; - echo _T('entree_adresse_annuaire'); - echo "</B><BR />\n</label>"; - echo _T('texte_adresse_annuaire_1'); - echo "<BR />\n<INPUT TYPE='text' NAME='adresse_ldap' CLASS='formo' VALUE=\"$adresse_ldap\" SIZE='20'></p>"; - - echo "<p><label><B>"; - echo _T('entree_port_annuaire'); - echo "</B><BR />\n</label>"; - echo _T('texte_port_annuaire'); - echo "<BR />\n<INPUT TYPE='text' NAME='port_ldap' CLASS='formo' VALUE=\"$port_ldap\" SIZE='20' /></p>"; - - echo "<p><label><B>"; - echo _L('Transport Layer Security' ); - echo "</B></label>"; - echo ' '; - echo "<INPUT TYPE='radio' NAME='tls_ldap' value='non' checked='checked' />"; - echo _T('item_non'); - echo ' '; - echo "<INPUT TYPE='radio' NAME='tls_ldap' value='oui'/>"; - echo _T('item_oui'); - echo '</p>'; - - echo "<p><label><B>"._T('version')."</B></label>"; - echo ' '; - echo "<INPUT TYPE='text' NAME='protocole_ldap' CLASS='formo' VALUE=\"$protocole_ldap\" SIZE='5' />"; - - echo "</fieldset>"; - - echo "<p><fieldset>"; - echo _T('texte_acces_ldap_anonyme_1')." "; - echo "<label><B>"._T('entree_login_ldap')."</B><BR />\n</label>"; - echo _T('texte_login_ldap_1')."<br />\n"; - echo "<INPUT TYPE='text' NAME='login_ldap' CLASS='formo' VALUE=\"\" SIZE='40'><P>"; - - echo "<label><B>"._T('entree_passe_ldap')."</B><BR />\n</label>"; - echo "<INPUT TYPE='password' NAME='pass_ldap' CLASS='formo' VALUE=\"\" SIZE='40'></fieldset>"; - - echo "<p><DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; - - echo "</FORM>"; + echo "<input type='hidden' name='etape' value='ldap2' />"; + + echo fieldset(_T('entree_adresse_annuaire'), + array( + 'adresse_ldap' => array( + 'label' => _T('texte_adresse_annuaire_1'), + 'valeur' => $adresse_ldap + ), + 'port_ldap' => array( + 'label' => _T('entree_port_annuaire').'<br />'._T('texte_port_annuaire'), + 'valeur' => $port_ldap + ), + 'tls_ldap' => array( + 'label' => '<b>'._L('Transport Layer Security :').'</b>', + 'valeur' => 'non', + 'alternatives' => array( + 'non' => _T('item_non'), + 'oui' => _T('item_oui') + ) + ), + 'protocole_ldap' => array( + 'label' => _L('Version du protocole :'), + 'valeur' => $protocole_ldap, + 'alternatives' => array( + '3' => '3', + '2' => '2' + ) + ) + ) + ); + + echo '<p>'._T('texte_acces_ldap_anonyme_1').'</p>'; + echo fieldset(_L('Connexion:'), + array( + 'login_ldap' => array( + 'label' => _T('texte_login_ldap_1'), + 'valeur' => '' + ), + 'pass_ldap' => array( + 'label' => _T('entree_passe_ldap'), + 'vaelur' => '' + ) + ) + ); + + echo bouton_suivant(); + echo "</form>"; install_fin_html(); } -?> +?> \ No newline at end of file diff --git a/ecrire/install/etape_ldap2.php b/ecrire/install/etape_ldap2.php index 00208de272967d38b9b0ea36d41445a2c2cd993c..7ecac7fb2a4198042e58c1105997b4f91c264b39 100644 --- a/ecrire/install/etape_ldap2.php +++ b/ecrire/install/etape_ldap2.php @@ -16,54 +16,51 @@ function install_etape_ldap2_dist() { global $adresse_ldap, $login_ldap, $pass_ldap, $port_ldap, $tls_ldap, $protocole_ldap, $spip_lang_right; - install_debut_html(); - - echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('titre_connexion_ldap')."</FONT>"; - - echo "<P>"; + install_debut_html('AUTO', ' onLoad="document.getElementById(\'suivant\').focus();return false;"'); $port_ldap = intval($port_ldap); - $ldap_link = ldap_connect($adresse_ldap, $port_ldap); + $ldap_link = @ldap_connect($adresse_ldap, $port_ldap); $erreur = "ldap_connect($adresse_ldap, $port_ldap)"; - if ($ldap_link) { - - if ( !ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap) ) { + if ($ldap_link) { + if ( !@ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap) ) { $protocole_ldap = 2 ; - ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); + @ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); } if ($tls_ldap == 'oui') { - if (!ldap_start_tls($ldap_link)) { + if (!@ldap_start_tls($ldap_link)) { $erreur = "ldap_start_tls($ldap_link) $adresse_ldap, $port_ldap"; $ldap_link = false; } } - if ($ldap_link) { - $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); + if ($ldap_link) { + $ldap_link = @ldap_bind($ldap_link, $login_ldap, $pass_ldap); $erreur = "ldap_bind('$ldap_link', '$login_ldap', '$pass_ldap'): $adresse_ldap, $port_ldap"; } } if ($ldap_link) { - echo "<B>"._T('info_connexion_ldap_ok'); + echo info_etape(_T('titre_connexion_ldap'),_T('info_connexion_ldap_ok')); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap3'>"; - echo "<INPUT TYPE='hidden' NAME='adresse_ldap' VALUE=\"$adresse_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='port_ldap' VALUE=\"$port_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='login_ldap' VALUE=\"$login_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='pass_ldap' VALUE=\"$pass_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='protocole_ldap' VALUE=\"$protocole_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='tls_ldap' VALUE=\"$tls_ldap\">"; + echo "<input type='hidden' name='etape' value='ldap3' />"; + echo "<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />"; + echo "<input type='hidden' name='port_ldap' value=\"$port_ldap\" />"; + echo "<input type='hidden' name='login_ldap' value=\"$login_ldap\" />"; + echo "<input type='hidden' name='pass_ldap' value=\"$pass_ldap\" />"; + echo "<input type='hidden' name='protocole_ldap' value=\"$protocole_ldap\" />"; + echo "<input type='hidden' name='tls_ldap' value=\"$tls_ldap\" />"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; - echo "</FORM>"; + echo bouton_suivant(); + echo "</form>"; } else { - echo "<B>"._T('avis_connexion_ldap_echec_1')."</B>"; - echo "<P>"._T('avis_connexion_ldap_echec_2'); - echo "<br />\n"._T('avis_connexion_ldap_echec_3'); - echo '<br /><br />', $erreur, '<b> ?</b>'; + echo info_etape(_T('titre_connexion_ldap'), + _T('avis_connexion_ldap_echec_1'). + "<p>"._T('avis_connexion_ldap_echec_2'). + "<br />\n"._T('avis_connexion_ldap_echec_3') . + '<br /><br />'. $erreur. '<b> ?</b></p>' + ); } install_fin_html(); diff --git a/ecrire/install/etape_ldap3.php b/ecrire/install/etape_ldap3.php index 61c6a56506bd654bdf7fe25cc0e9c30896f4f4cf..e880642325861f1f528cfa1f7d852cd4506c3ad8 100644 --- a/ecrire/install/etape_ldap3.php +++ b/ecrire/install/etape_ldap3.php @@ -18,9 +18,7 @@ function install_etape_ldap3_dist() install_debut_html(); - echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_chemin_acces_1')."</FONT>"; - - echo "<P>"._T('info_chemin_acces_2'); + echo info_etape(_T('info_chemin_acces_1'),_T('info_chemin_acces_2')); $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); @@ -29,51 +27,52 @@ function install_etape_ldap3_dist() $info = @ldap_get_entries($ldap_link, $result); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap4'>"; - echo "<INPUT TYPE='hidden' NAME='adresse_ldap' VALUE=\"$adresse_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='port_ldap' VALUE=\"$port_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='login_ldap' VALUE=\"$login_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='pass_ldap' VALUE=\"$pass_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='protocole_ldap' VALUE=\"$protocole_ldap\">"; - echo "<INPUT TYPE='hidden' NAME='tls_ldap' VALUE=\"$tls_ldap\">"; + echo "<input type='hidden' name='etape' value='ldap4' />"; + echo "<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />"; + echo "<input type='hidden' name='port_ldap' value=\"$port_ldap\" />"; + echo "<input type='hidden' name='login_ldap' value=\"$login_ldap\" />"; + echo "<input type='hidden' name='pass_ldap' value=\"$pass_ldap\" />"; + echo "<input type='hidden' name='protocole_ldap' value=\"$protocole_ldap\" />"; + echo "<input type='hidden' name='tls_ldap' value=\"$tls_ldap\" />"; echo "<fieldset>"; $checked = false; if (is_array($info) AND $info["count"] > 0) { - echo "<P>"._T('info_selection_chemin_acces'); - echo "<UL>"; + echo "<p>"._T('info_selection_chemin_acces')."</p>"; + echo "<ul>"; $n = 0; for ($i = 0; $i < $info["count"]; $i++) { $names = $info[$i]["namingcontexts"]; if (is_array($names)) { for ($j = 0; $j < $names["count"]; $j++) { $n++; - echo "<INPUT NAME=\"base_ldap\" VALUE=\"".htmlspecialchars($names[$j])."\" TYPE='Radio' id='tab$n'"; + echo "<li><input name=\"base_ldap\" value=\"".htmlspecialchars($names[$j])."\" type='radio' id='tab$n'"; if (!$checked) { - echo " CHECKED"; + echo " checked=\"checked\""; $checked = true; } - echo ">"; - echo "<label for='tab$n'>".htmlspecialchars($names[$j])."</label><BR />\n\n"; + echo " />"; + echo "<label for='tab$n'>".htmlspecialchars($names[$j])."</label></li>\n"; } } } - echo "</UL>"; + echo "</ul>"; echo _T('info_ou')." "; } - echo "<INPUT NAME=\"base_ldap\" VALUE=\"\" TYPE='Radio' id='manuel'"; + echo "<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; if (!$checked) { - echo " CHECKED"; + echo " checked=\"checked\""; $checked = true; } - echo ">"; + echo " />"; echo "<label for='manuel'>"._T('entree_chemin_acces')."</label> "; - echo "<INPUT TYPE='text' NAME='base_ldap_text' CLASS='formo' VALUE=\"ou=users, dc=mon-domaine, dc=com\" SIZE='40'></fieldset><P>"; + echo "<input type='text' name='base_ldap_text' class='formo' value=\"ou=users, dc=mon-domaine, dc=com\" size='40' />"; + echo "</fieldset>"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; - echo "</FORM>"; + echo bouton_suivant(); + echo "</form>"; install_fin_html(); } diff --git a/ecrire/install/etape_ldap4.php b/ecrire/install/etape_ldap4.php index 0a8066cdf8eefe8a7ff801c78e77a13b18f15e68..4a848851d5c39d7e1c33f7d8e720f43be697863c 100644 --- a/ecrire/install/etape_ldap4.php +++ b/ecrire/install/etape_ldap4.php @@ -27,15 +27,12 @@ function install_etape_ldap4_dist() $fail = (ldap_errno($ldap_link) == 32); if ($fail) { - echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_chemin_acces_annuaire')."</FONT>"; - echo "<P>"; - - echo "<B>"._T('avis_operation_echec')."</B> "._T('avis_chemin_invalide_1')." (<tt>".htmlspecialchars($base_ldap); - echo "</tt>) "._T('avis_chemin_invalide_2'); + info_etape(_T('info_chemin_acces_annuaire'), + "<B>"._T('avis_operation_echec')."</B> "._T('avis_chemin_invalide_1')." (<tt>".htmlspecialchars($base_ldap)."</tt>) "._T('avis_chemin_invalide_2') + ); } else { - echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_reglage_ldap')."</FONT>"; - echo "<P>"; + info_etape(_T('info_reglage_ldap')); lire_fichier(_FILE_CONNECT_INS . _FILE_TMP . '.php', $conn); if ($p = strpos($conn, '?'.'>')) @@ -58,20 +55,24 @@ function install_etape_ldap4_dist() ecrire_fichier(_FILE_CONNECT_INS . _FILE_TMP . '.php', $conn); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap5'>"; - echo "<fieldset><label><B>"._T('info_statut_utilisateurs_1')."</B></label><BR />\n"; - echo _T('info_statut_utilisateurs_2')." "; - echo "<p>"; - echo "<INPUT TYPE='Radio' NAME='statut_ldap' VALUE=\"6forum\" id='visit'>"; - echo "<label for='visit'><b>"._T('info_visiteur_1')."</b></label> "._T('info_visiteur_2')."<br />\n"; - echo "<INPUT TYPE='Radio' NAME='statut_ldap' VALUE=\"1comite\" id='redac' CHECKED>"; - echo "<label for='redac'><b>"._T('info_redacteur_1')."</b></label> "._T('info_redacteur_2')."<br />\n"; - echo "<INPUT TYPE='Radio' NAME='statut_ldap' VALUE=\"0minirezo\" id='admin'>"; - echo "<label for='admin'><b>"._T('info_administrateur_1')."</b></label> "._T('info_administrateur_2')."<br />\n"; - - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; + echo "<input type='hidden' name='etape' value='ldap5' />"; + + echo fieldset(_T('info_statut_utilisateurs_1'), + array( + '$statut_ldap' => array( + 'label' => _T('info_statut_utilisateurs_2').'<br />', + 'valeur' => '1comite', + 'alternatives' => array( + '6forum' => "<b>"._T('info_visiteur_1')."</b> "._T('info_visiteur_2')."<br />", + '1comite' => "<b>"._T('info_redacteur_1')."</b> "._T('info_redacteur_2')."<br />", + '0minirezo' => "<b>"._T('info_administrateur_1')."</b> "._T('info_administrateur_2')."<br />" + ) + ) + ) + ); - echo "</FORM>"; + echo bouton_suivant(); + echo "</form>"; } install_fin_html(); diff --git a/ecrire/install/etape_ldap5.php b/ecrire/install/etape_ldap5.php index a1fa7940fb03536b625a305667ec5248b0fd3383..9b1a6350e1854d5bf344a7691662fc2d6d6b6881 100644 --- a/ecrire/install/etape_ldap5.php +++ b/ecrire/install/etape_ldap5.php @@ -18,7 +18,7 @@ function install_etape_ldap5_dist() { global $spip_lang_right, $statut_ldap; - install_debut_html(); + install_debut_html('AUTO', ' onLoad="document.getElementById(\'suivant\').focus();return false;"'); // simuler ecrire_meta/s pour pouvoir sauver le statut // car _FILE_CONNECT est defa a False a ce moment. @@ -31,15 +31,13 @@ function install_etape_ldap5_dist() spip_query("REPLACE spip_meta (nom, valeur) VALUES ('ldap_statut_import', " . _q($statut_ldap) . " )"); @unlink(_FILE_META); - echo "<B>"._T('info_ldap_ok')."</B>"; - echo "<P>"._T('info_terminer_installation'); + echo info_etape(_T('info_ldap_ok'), _T('info_terminer_installation')); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='5'>"; + echo "<input type='hidden' name='etape' value='5' />"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; - - echo "</FORM>"; + echo bouton_suivant(); + echo "</form>"; } -?> +?> \ No newline at end of file