Completed
Push — master ( 0528ed...3f7b24 )
by cam
01:54
created
ecrire/action/logout.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/cookie');
@@ -33,70 +33,70 @@  discard block
 block discarded – undo
33 33
  *
34 34
  */
35 35
 function action_logout_dist() {
36
-	$logout = _request('logout');
37
-	$url = securiser_redirect_action(_request('url'));
38
-	// cas particulier, logout dans l'espace public
39
-	if ($logout == 'public' && !$url) {
40
-		$url = url_de_base();
41
-	}
36
+    $logout = _request('logout');
37
+    $url = securiser_redirect_action(_request('url'));
38
+    // cas particulier, logout dans l'espace public
39
+    if ($logout == 'public' && !$url) {
40
+        $url = url_de_base();
41
+    }
42 42
 
43
-	// seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
44
-	if (
45
-		isset($GLOBALS['visiteur_session']['id_auteur'])
46
-		&& is_numeric($GLOBALS['visiteur_session']['id_auteur'])
47
-		&& isset($GLOBALS['visiteur_session']['statut'])
48
-	) {
49
-		// il faut un jeton pour fermer la session (eviter les CSRF)
50
-		if (
51
-			!($jeton = _request('jeton'))
52
-			|| !verifier_jeton_logout($jeton, $GLOBALS['visiteur_session'])
53
-		) {
54
-			$jeton = generer_jeton_logout($GLOBALS['visiteur_session']);
55
-			$action = generer_url_action('logout', "jeton=$jeton");
56
-			$action = parametre_url($action, 'logout', _request('logout'));
57
-			$action = parametre_url($action, 'url', _request('url'));
58
-			include_spip('inc/minipres');
59
-			include_spip('inc/filtres');
60
-			$texte = bouton_action(_T('spip:icone_deconnecter'), $action);
61
-			$texte = "<div class='boutons'>$texte</div>";
62
-			$texte .= '<script type="text/javascript">document.write("<style>body{visibility:hidden;}</style>");window.document.forms[0].submit();</script>';
63
-			$res = minipres(_T('spip:icone_deconnecter'), $texte, ['all_inline' => true]);
64
-			echo $res;
43
+    // seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
44
+    if (
45
+        isset($GLOBALS['visiteur_session']['id_auteur'])
46
+        && is_numeric($GLOBALS['visiteur_session']['id_auteur'])
47
+        && isset($GLOBALS['visiteur_session']['statut'])
48
+    ) {
49
+        // il faut un jeton pour fermer la session (eviter les CSRF)
50
+        if (
51
+            !($jeton = _request('jeton'))
52
+            || !verifier_jeton_logout($jeton, $GLOBALS['visiteur_session'])
53
+        ) {
54
+            $jeton = generer_jeton_logout($GLOBALS['visiteur_session']);
55
+            $action = generer_url_action('logout', "jeton=$jeton");
56
+            $action = parametre_url($action, 'logout', _request('logout'));
57
+            $action = parametre_url($action, 'url', _request('url'));
58
+            include_spip('inc/minipres');
59
+            include_spip('inc/filtres');
60
+            $texte = bouton_action(_T('spip:icone_deconnecter'), $action);
61
+            $texte = "<div class='boutons'>$texte</div>";
62
+            $texte .= '<script type="text/javascript">document.write("<style>body{visibility:hidden;}</style>");window.document.forms[0].submit();</script>';
63
+            $res = minipres(_T('spip:icone_deconnecter'), $texte, ['all_inline' => true]);
64
+            echo $res;
65 65
 
66
-			return;
67
-		}
66
+            return;
67
+        }
68 68
 
69
-		include_spip('inc/auth');
70
-		auth_trace($GLOBALS['visiteur_session'], '0000-00-00 00:00:00');
71
-		// le logout explicite vaut destruction de toutes les sessions
72
-		if (isset($_COOKIE['spip_session'])) {
73
-			$session = charger_fonction('session', 'inc');
74
-			$session($GLOBALS['visiteur_session']['id_auteur']);
75
-			effacer_cookie_session();
76
-		}
77
-		// si authentification http, et que la personne est loge,
78
-		// pour se deconnecter, il faut proposer un nouveau formulaire de connexion http
79
-		if (
80
-			isset($_SERVER['PHP_AUTH_USER'])
81
-			&& !$GLOBALS['ignore_auth_http']
82
-			&& $GLOBALS['auth_can_disconnect']
83
-		) {
84
-			ask_php_auth(
85
-				_T('login_deconnexion_ok'),
86
-				_T('login_verifiez_navigateur'),
87
-				_T('login_retour_public'),
88
-				'redirect=' . _DIR_RESTREINT_ABS,
89
-				_T('login_test_navigateur'),
90
-				true
91
-			);
92
-		}
93
-	}
69
+        include_spip('inc/auth');
70
+        auth_trace($GLOBALS['visiteur_session'], '0000-00-00 00:00:00');
71
+        // le logout explicite vaut destruction de toutes les sessions
72
+        if (isset($_COOKIE['spip_session'])) {
73
+            $session = charger_fonction('session', 'inc');
74
+            $session($GLOBALS['visiteur_session']['id_auteur']);
75
+            effacer_cookie_session();
76
+        }
77
+        // si authentification http, et que la personne est loge,
78
+        // pour se deconnecter, il faut proposer un nouveau formulaire de connexion http
79
+        if (
80
+            isset($_SERVER['PHP_AUTH_USER'])
81
+            && !$GLOBALS['ignore_auth_http']
82
+            && $GLOBALS['auth_can_disconnect']
83
+        ) {
84
+            ask_php_auth(
85
+                _T('login_deconnexion_ok'),
86
+                _T('login_verifiez_navigateur'),
87
+                _T('login_retour_public'),
88
+                'redirect=' . _DIR_RESTREINT_ABS,
89
+                _T('login_test_navigateur'),
90
+                true
91
+            );
92
+        }
93
+    }
94 94
 
95
-	// Rediriger en contrant le cache navigateur (Safari3)
96
-	include_spip('inc/headers');
97
-	redirige_par_entete($url
98
-		? parametre_url($url, 'var_hasard', uniqid(random_int(0, mt_getrandmax())), '&')
99
-		: generer_url_public('login'));
95
+    // Rediriger en contrant le cache navigateur (Safari3)
96
+    include_spip('inc/headers');
97
+    redirige_par_entete($url
98
+        ? parametre_url($url, 'var_hasard', uniqid(random_int(0, mt_getrandmax())), '&')
99
+        : generer_url_public('login'));
100 100
 }
101 101
 
102 102
 /**
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
  * @return string
108 108
  */
109 109
 function generer_jeton_logout($session, $alea = null) {
110
-	if (is_null($alea)) {
111
-		include_spip('inc/acces');
112
-		$alea = charger_aleas();
113
-	}
110
+    if (is_null($alea)) {
111
+        include_spip('inc/acces');
112
+        $alea = charger_aleas();
113
+    }
114 114
 
115
-	return md5($session['date_session']
116
-		. $session['id_auteur']
117
-		. $session['statut']
118
-		. $alea);
115
+    return md5($session['date_session']
116
+        . $session['id_auteur']
117
+        . $session['statut']
118
+        . $alea);
119 119
 }
120 120
 
121 121
 /**
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
  * @return bool
130 130
  */
131 131
 function verifier_jeton_logout($jeton, $session) {
132
-	if (generer_jeton_logout($session) === $jeton) {
133
-		return true;
134
-	}
135
-	return generer_jeton_logout($session, $GLOBALS['meta']['alea_ephemere_ancien']) === $jeton;
132
+    if (generer_jeton_logout($session) === $jeton) {
133
+        return true;
134
+    }
135
+    return generer_jeton_logout($session, $GLOBALS['meta']['alea_ephemere_ancien']) === $jeton;
136 136
 }
Please login to merge, or discard this patch.
ecrire/install/etape_4.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -12,70 +12,70 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 include_spip('inc/headers');
19 19
 
20 20
 function install_etape_4_dist() {
21 21
 
22
-	// creer le repertoire cache, qui sert partout !
23
-	if (!@file_exists(_DIR_CACHE)) {
24
-		$rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE);
25
-		$rep = sous_repertoire(_DIR_TMP, $rep, true, true);
26
-	}
27
-
28
-	$minipage = new Installation();
29
-	echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
30
-
31
-	echo info_progression_etape(4, 'etape_', 'install/');
32
-
33
-	echo "<div class='success'><b>"
34
-		. _T('info_derniere_etape')
35
-		. '</b><p>'
36
-		. _T('info_utilisation_spip')
37
-		. '</p></div>';
38
-
39
-
40
-	echo '<p>'
41
-		. _T(
42
-			'plugin_info_plugins_dist_1',
43
-			['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>']
44
-		)
45
-		. '</p>';
46
-
47
-	// installer les extensions
48
-	include_spip('inc/plugin');
49
-	$afficher = charger_fonction('afficher_liste', 'plugins');
50
-	echo $afficher(
51
-		self(),
52
-		liste_plugin_files(_DIR_PLUGINS_DIST),
53
-		[],
54
-		[],
55
-		_DIR_PLUGINS_DIST,
56
-		'afficher_nom_plugin'
57
-	);
58
-
59
-	// si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape
60
-	// car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour)
61
-	// au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin
62
-	// et procede alors a l'installation
63
-	if (
64
-		!isset($GLOBALS['meta']['version_installee'])
65
-		|| $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee']))
66
-	) {
67
-		plugin_installes_meta();
68
-	}
69
-
70
-	// mettre a jour si necessaire l'adresse du site
71
-	// securite si on arrive plus a se loger
72
-	include_spip('inc/config');
73
-	appliquer_adresse_site('');
74
-
75
-	// aller a la derniere etape qui clos l'install et redirige
76
-	$suite = "\n<input type='hidden' name='etape' value='fin' />"
77
-		. bouton_suivant(_T('login_espace_prive'));
78
-
79
-	echo generer_form_ecrire('install', $suite);
80
-	echo $minipage->installFinPage();
22
+    // creer le repertoire cache, qui sert partout !
23
+    if (!@file_exists(_DIR_CACHE)) {
24
+        $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE);
25
+        $rep = sous_repertoire(_DIR_TMP, $rep, true, true);
26
+    }
27
+
28
+    $minipage = new Installation();
29
+    echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
30
+
31
+    echo info_progression_etape(4, 'etape_', 'install/');
32
+
33
+    echo "<div class='success'><b>"
34
+        . _T('info_derniere_etape')
35
+        . '</b><p>'
36
+        . _T('info_utilisation_spip')
37
+        . '</p></div>';
38
+
39
+
40
+    echo '<p>'
41
+        . _T(
42
+            'plugin_info_plugins_dist_1',
43
+            ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>']
44
+        )
45
+        . '</p>';
46
+
47
+    // installer les extensions
48
+    include_spip('inc/plugin');
49
+    $afficher = charger_fonction('afficher_liste', 'plugins');
50
+    echo $afficher(
51
+        self(),
52
+        liste_plugin_files(_DIR_PLUGINS_DIST),
53
+        [],
54
+        [],
55
+        _DIR_PLUGINS_DIST,
56
+        'afficher_nom_plugin'
57
+    );
58
+
59
+    // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape
60
+    // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour)
61
+    // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin
62
+    // et procede alors a l'installation
63
+    if (
64
+        !isset($GLOBALS['meta']['version_installee'])
65
+        || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee']))
66
+    ) {
67
+        plugin_installes_meta();
68
+    }
69
+
70
+    // mettre a jour si necessaire l'adresse du site
71
+    // securite si on arrive plus a se loger
72
+    include_spip('inc/config');
73
+    appliquer_adresse_site('');
74
+
75
+    // aller a la derniere etape qui clos l'install et redirige
76
+    $suite = "\n<input type='hidden' name='etape' value='fin' />"
77
+        . bouton_suivant(_T('login_espace_prive'));
78
+
79
+    echo generer_form_ecrire('install', $suite);
80
+    echo $minipage->installFinPage();
81 81
 }
Please login to merge, or discard this patch.
ecrire/install/etape_ldap2.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -12,88 +12,88 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 function install_etape_ldap2_dist() {
19
-	$minipage = new Installation();
20
-	echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
21
-
22
-	$adresse_ldap = _request('adresse_ldap');
23
-
24
-	$port_ldap = _request('port_ldap');
25
-
26
-	$tls_ldap = _request('tls_ldap');
27
-
28
-	$protocole_ldap = _request('protocole_ldap');
29
-
30
-	$login_ldap = _request('login_ldap');
31
-
32
-	$pass_ldap = _request('pass_ldap');
33
-
34
-	$port_ldap = (int) $port_ldap;
35
-
36
-	$tls = false;
37
-
38
-	if ($tls_ldap == 'oui') {
39
-		if ($port_ldap == 636) {
40
-			$adresse_ldap = "ldaps://$adresse_ldap";
41
-		} else {
42
-			$tls = true;
43
-		}
44
-	}
45
-	else {
46
-		$tls_ldap == 'non';
47
-	}
48
-
49
-	// Verifions que l'adresse demandee est valide
50
-	$adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: '';
51
-
52
-	$ldap_link = ldap_connect($adresse_ldap, $port_ldap);
53
-	$erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')';
54
-
55
-	if ($ldap_link) {
56
-		if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) {
57
-			$protocole_ldap = 2;
58
-			ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap);
59
-		}
60
-		if ($tls && !ldap_start_tls($ldap_link)) {
61
-			$erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link)
62
-				. ' ' . spip_htmlspecialchars($adresse_ldap)
63
-				. ', ' . spip_htmlspecialchars($port_ldap) . ')';
64
-			$ldap_link = false;
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 $minipage->installFinPage();
19
+    $minipage = new Installation();
20
+    echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
21
+
22
+    $adresse_ldap = _request('adresse_ldap');
23
+
24
+    $port_ldap = _request('port_ldap');
25
+
26
+    $tls_ldap = _request('tls_ldap');
27
+
28
+    $protocole_ldap = _request('protocole_ldap');
29
+
30
+    $login_ldap = _request('login_ldap');
31
+
32
+    $pass_ldap = _request('pass_ldap');
33
+
34
+    $port_ldap = (int) $port_ldap;
35
+
36
+    $tls = false;
37
+
38
+    if ($tls_ldap == 'oui') {
39
+        if ($port_ldap == 636) {
40
+            $adresse_ldap = "ldaps://$adresse_ldap";
41
+        } else {
42
+            $tls = true;
43
+        }
44
+    }
45
+    else {
46
+        $tls_ldap == 'non';
47
+    }
48
+
49
+    // Verifions que l'adresse demandee est valide
50
+    $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: '';
51
+
52
+    $ldap_link = ldap_connect($adresse_ldap, $port_ldap);
53
+    $erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')';
54
+
55
+    if ($ldap_link) {
56
+        if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) {
57
+            $protocole_ldap = 2;
58
+            ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap);
59
+        }
60
+        if ($tls && !ldap_start_tls($ldap_link)) {
61
+            $erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link)
62
+                . ' ' . spip_htmlspecialchars($adresse_ldap)
63
+                . ', ' . spip_htmlspecialchars($port_ldap) . ')';
64
+            $ldap_link = false;
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 $minipage->installFinPage();
99 99
 }
Please login to merge, or discard this patch.
ecrire/install/etape_1.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 /**
@@ -36,45 +36,45 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function install_etape_1_dist() {
38 38
 
39
-	$minipage = new Installation();
40
-	echo $minipage->installDebutPage();
39
+    $minipage = new Installation();
40
+    echo $minipage->installDebutPage();
41 41
 
42
-	// stopper en cas de grosse incompatibilite de l'hebergement
43
-	tester_compatibilite_hebergement();
42
+    // stopper en cas de grosse incompatibilite de l'hebergement
43
+    tester_compatibilite_hebergement();
44 44
 
45
-	// Recuperer les anciennes donnees pour plus de facilite (si presentes)
46
-	$s = @is_readable(_FILE_CONNECT_TMP) ? analyse_fichier_connection(_FILE_CONNECT_TMP) : '';
45
+    // Recuperer les anciennes donnees pour plus de facilite (si presentes)
46
+    $s = @is_readable(_FILE_CONNECT_TMP) ? analyse_fichier_connection(_FILE_CONNECT_TMP) : '';
47 47
 
48
-	[$adresse_db, $login_db] = $s ?: ['localhost', ''];
48
+    [$adresse_db, $login_db] = $s ?: ['localhost', ''];
49 49
 
50
-	$chmod = (isset($_GET['chmod']) && preg_match(',^\d+$,', (string) $_GET['chmod'])) ?
51
-		sprintf('%04o', $_GET['chmod']) : '0777';
50
+    $chmod = (isset($_GET['chmod']) && preg_match(',^\d+$,', (string) $_GET['chmod'])) ?
51
+        sprintf('%04o', $_GET['chmod']) : '0777';
52 52
 
53
-	if (@is_readable(_FILE_CHMOD_TMP)) {
54
-		$s = @implode('', @file(_FILE_CHMOD_TMP));
55
-		if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) {
56
-			$chmod = $regs[1];
57
-		}
58
-	}
53
+    if (@is_readable(_FILE_CHMOD_TMP)) {
54
+        $s = @implode('', @file(_FILE_CHMOD_TMP));
55
+        if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) {
56
+            $chmod = $regs[1];
57
+        }
58
+    }
59 59
 
60 60
 
61
-	$db = [$adresse_db, _T('entree_base_donnee_2')];
62
-	$login = [$login_db, _T('entree_login_connexion_2')];
63
-	$pass = ['', _T('entree_mot_passe_2')];
61
+    $db = [$adresse_db, _T('entree_base_donnee_2')];
62
+    $login = [$login_db, _T('entree_login_connexion_2')];
63
+    $pass = ['', _T('entree_mot_passe_2')];
64 64
 
65
-	$predef = [
66
-		defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '',
67
-		defined('_INSTALL_HOST_DB'),
68
-		defined('_INSTALL_USER_DB'),
69
-		defined('_INSTALL_PASS_DB')
70
-	];
65
+    $predef = [
66
+        defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '',
67
+        defined('_INSTALL_HOST_DB'),
68
+        defined('_INSTALL_USER_DB'),
69
+        defined('_INSTALL_PASS_DB')
70
+    ];
71 71
 
72 72
 
73
-	echo info_progression_etape(1, 'etape_', 'install/');
73
+    echo info_progression_etape(1, 'etape_', 'install/');
74 74
 
75
-	// ces deux chaines de langues doivent etre reecrites
75
+    // ces deux chaines de langues doivent etre reecrites
76 76
 #	echo info_etape(_T('info_connexion_mysql'), _T('texte_connexion_mysql').aide ("install1", true));
77
-	echo info_etape(_T('info_connexion_base_donnee'));
78
-	echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2);
79
-	echo $minipage->installFinPage();
77
+    echo info_etape(_T('info_connexion_base_donnee'));
78
+    echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2);
79
+    echo $minipage->installFinPage();
80 80
 }
Please login to merge, or discard this patch.
ecrire/install/etape_ldap5.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -12,85 +12,85 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 include_spip('inc/headers');
18 18
 include_spip('auth/ldap');
19 19
 
20 20
 function install_etape_ldap5_dist() {
21
-	etape_ldap5_save();
22
-	etape_ldap5_suite();
21
+    etape_ldap5_save();
22
+    etape_ldap5_suite();
23 23
 }
24 24
 
25 25
 function etape_ldap5_save() {
26
-	$conn = null;
27
-	if (!@file_exists(_FILE_CONNECT_TMP)) {
28
-		redirige_url_ecrire('install');
29
-	}
30
-
31
-	ecrire_meta('ldap_statut_import', _request('statut_ldap'));
32
-
33
-	lire_fichier(_FILE_CONNECT_TMP, $conn);
34
-
35
-	if ($p = strpos((string) $conn, "'');")) {
36
-		ecrire_fichier(
37
-			_FILE_CONNECT_TMP,
38
-			substr((string) $conn, 0, $p + 1)
39
-			. _FILE_LDAP
40
-			. substr((string) $conn, $p + 1)
41
-		);
42
-	}
43
-
44
-	$adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\");
45
-	$login_ldap = addcslashes((string) _request('login_ldap'), "'\\");
46
-	$pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\");
47
-	$port_ldap = addcslashes((string) _request('port_ldap'), "'\\");
48
-	$tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\");
49
-	$protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\");
50
-	$base_ldap = addcslashes((string) _request('base_ldap'), "'\\");
51
-	$base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\");
52
-
53
-	$conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n"
54
-		. "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n"
55
-		. "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n"
56
-		. (($tls_ldap != 'oui') ? '' :
57
-			"@ldap_start_tls(\$GLOBALS['ldap_link']);\n")
58
-		. "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n";
59
-
60
-	$champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [];
61
-	$res = '';
62
-	foreach (array_keys($champs) as $champ) {
63
-		$nom = 'ldap_' . $champ;
64
-		$val = trim((string) _request($nom));
65
-		if (preg_match('/^\w*$/', $val)) {
66
-			if ($val) {
67
-				$val = _q($val);
68
-			}
69
-		} else {
70
-			$val = 'array(' . _q(preg_split('/\W+/', $val)) . ')';
71
-		};
72
-		if ($val) {
73
-			$res .= "'$champ' => " . $val . ',';
74
-		}
75
-	}
76
-	$conn .= "\$GLOBALS['ldap_champs'] = array($res);\n";
77
-
78
-	install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn);
26
+    $conn = null;
27
+    if (!@file_exists(_FILE_CONNECT_TMP)) {
28
+        redirige_url_ecrire('install');
29
+    }
30
+
31
+    ecrire_meta('ldap_statut_import', _request('statut_ldap'));
32
+
33
+    lire_fichier(_FILE_CONNECT_TMP, $conn);
34
+
35
+    if ($p = strpos((string) $conn, "'');")) {
36
+        ecrire_fichier(
37
+            _FILE_CONNECT_TMP,
38
+            substr((string) $conn, 0, $p + 1)
39
+            . _FILE_LDAP
40
+            . substr((string) $conn, $p + 1)
41
+        );
42
+    }
43
+
44
+    $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\");
45
+    $login_ldap = addcslashes((string) _request('login_ldap'), "'\\");
46
+    $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\");
47
+    $port_ldap = addcslashes((string) _request('port_ldap'), "'\\");
48
+    $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\");
49
+    $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\");
50
+    $base_ldap = addcslashes((string) _request('base_ldap'), "'\\");
51
+    $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\");
52
+
53
+    $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n"
54
+        . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n"
55
+        . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n"
56
+        . (($tls_ldap != 'oui') ? '' :
57
+            "@ldap_start_tls(\$GLOBALS['ldap_link']);\n")
58
+        . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n";
59
+
60
+    $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [];
61
+    $res = '';
62
+    foreach (array_keys($champs) as $champ) {
63
+        $nom = 'ldap_' . $champ;
64
+        $val = trim((string) _request($nom));
65
+        if (preg_match('/^\w*$/', $val)) {
66
+            if ($val) {
67
+                $val = _q($val);
68
+            }
69
+        } else {
70
+            $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')';
71
+        };
72
+        if ($val) {
73
+            $res .= "'$champ' => " . $val . ',';
74
+        }
75
+    }
76
+    $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n";
77
+
78
+    install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn);
79 79
 }
80 80
 
81 81
 function etape_ldap5_suite() {
82
-	$minipage = new Installation();
83
-	echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
82
+    $minipage = new Installation();
83
+    echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
84 84
 
85
-	echo info_etape(
86
-		_T('info_ldap_ok'),
87
-		info_progression_etape(5, 'etape_ldap', 'install/')
88
-	);
85
+    echo info_etape(
86
+        _T('info_ldap_ok'),
87
+        info_progression_etape(5, 'etape_ldap', 'install/')
88
+    );
89 89
 
90
-	echo generer_form_ecrire('install', (
91
-		"<input type='hidden' name='etape' value='3' />" .
92
-		"<input type='hidden' name='ldap_present' value='true' />"
93
-		. bouton_suivant()));
90
+    echo generer_form_ecrire('install', (
91
+        "<input type='hidden' name='etape' value='3' />" .
92
+        "<input type='hidden' name='ldap_present' value='true' />"
93
+        . bouton_suivant()));
94 94
 
95
-	echo $minipage->installFinPage();
95
+    echo $minipage->installFinPage();
96 96
 }
Please login to merge, or discard this patch.
ecrire/install/etape_ldap1.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -12,89 +12,89 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 function install_etape_ldap1_dist() {
19
-	$adresse_ldap = defined('_INSTALL_HOST_LDAP')
20
-		? _INSTALL_HOST_LDAP
21
-		: 'localhost';
19
+    $adresse_ldap = defined('_INSTALL_HOST_LDAP')
20
+        ? _INSTALL_HOST_LDAP
21
+        : 'localhost';
22 22
 
23
-	$port_ldap = defined('_INSTALL_PORT_LDAP')
24
-		? _INSTALL_PORT_LDAP
25
-		: 389;
23
+    $port_ldap = defined('_INSTALL_PORT_LDAP')
24
+        ? _INSTALL_PORT_LDAP
25
+        : 389;
26 26
 
27
-	$tls_ldap = defined('_INSTALL_TLS_LDAP')
28
-		? _INSTALL_TLS_LDAP
29
-		: 'non';
27
+    $tls_ldap = defined('_INSTALL_TLS_LDAP')
28
+        ? _INSTALL_TLS_LDAP
29
+        : 'non';
30 30
 
31
-	$protocole_ldap = defined('_INSTALL_PROTOCOLE_LDAP')
32
-		? _INSTALL_PROTOCOLE_LDAP
33
-		: 3; // on essaie 2 en cas d'echec
31
+    $protocole_ldap = defined('_INSTALL_PROTOCOLE_LDAP')
32
+        ? _INSTALL_PROTOCOLE_LDAP
33
+        : 3; // on essaie 2 en cas d'echec
34 34
 
35
-	$login_ldap = defined('_INSTALL_USER_LDAP')
36
-		? _INSTALL_USER_LDAP
37
-		: '';
35
+    $login_ldap = defined('_INSTALL_USER_LDAP')
36
+        ? _INSTALL_USER_LDAP
37
+        : '';
38 38
 
39
-	$pass_ldap = defined('_INSTALL_PASS_LDAP')
40
-		? _INSTALL_PASS_LDAP
41
-		: '';
39
+    $pass_ldap = defined('_INSTALL_PASS_LDAP')
40
+        ? _INSTALL_PASS_LDAP
41
+        : '';
42 42
 
43
-	$minipage = new Installation();
44
-	echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
43
+    $minipage = new Installation();
44
+    echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
45 45
 
46
-	echo info_etape(
47
-		_T('titre_connexion_ldap'),
48
-		info_progression_etape(1, 'etape_ldap', 'install/')
49
-	);
46
+    echo info_etape(
47
+        _T('titre_connexion_ldap'),
48
+        info_progression_etape(1, 'etape_ldap', 'install/')
49
+    );
50 50
 
51
-	echo generer_form_ecrire('install', (
52
-		"\n<input type='hidden' name='etape' value='ldap2' />"
53
-		. fieldset(
54
-			_T('entree_adresse_annuaire'),
55
-			[
56
-				'adresse_ldap' => [
57
-					'label' => _T('texte_adresse_annuaire_1'),
58
-					'valeur' => $adresse_ldap
59
-				],
60
-				'port_ldap' => [
61
-					'label' => _T('entree_port_annuaire') . '<br />' . _T('texte_port_annuaire'),
62
-					'valeur' => $port_ldap
63
-				],
64
-				'tls_ldap' => [
65
-					'label' => '<b>' . _T('tls_ldap') . '</b>',
66
-					'valeur' => $tls_ldap,
67
-					'alternatives' => [
68
-						'non' => _T('item_non'),
69
-						'oui' => _T('item_oui')
70
-					]
71
-				],
72
-				'protocole_ldap' => [
73
-					'label' => _T('protocole_ldap'),
74
-					'valeur' => $protocole_ldap,
75
-					'alternatives' => [
76
-						'3' => '3',
77
-						'2' => '2'
78
-					]
79
-				]
80
-			]
81
-		)
51
+    echo generer_form_ecrire('install', (
52
+        "\n<input type='hidden' name='etape' value='ldap2' />"
53
+        . fieldset(
54
+            _T('entree_adresse_annuaire'),
55
+            [
56
+                'adresse_ldap' => [
57
+                    'label' => _T('texte_adresse_annuaire_1'),
58
+                    'valeur' => $adresse_ldap
59
+                ],
60
+                'port_ldap' => [
61
+                    'label' => _T('entree_port_annuaire') . '<br />' . _T('texte_port_annuaire'),
62
+                    'valeur' => $port_ldap
63
+                ],
64
+                'tls_ldap' => [
65
+                    'label' => '<b>' . _T('tls_ldap') . '</b>',
66
+                    'valeur' => $tls_ldap,
67
+                    'alternatives' => [
68
+                        'non' => _T('item_non'),
69
+                        'oui' => _T('item_oui')
70
+                    ]
71
+                ],
72
+                'protocole_ldap' => [
73
+                    'label' => _T('protocole_ldap'),
74
+                    'valeur' => $protocole_ldap,
75
+                    'alternatives' => [
76
+                        '3' => '3',
77
+                        '2' => '2'
78
+                    ]
79
+                ]
80
+            ]
81
+        )
82 82
 
83
-		. "\n<p>" . _T('texte_acces_ldap_anonyme_1') . '</p>'
84
-		. fieldset(
85
-			_T('connexion_ldap'),
86
-			[
87
-				'login_ldap' => [
88
-					'label' => _T('texte_login_ldap_1'),
89
-					'valeur' => $login_ldap
90
-				],
91
-				'pass_ldap' => [
92
-					'label' => _T('entree_passe_ldap'),
93
-					'valeur' => $pass_ldap
94
-				]
95
-			]
96
-		)
97
-		. bouton_suivant()));
83
+        . "\n<p>" . _T('texte_acces_ldap_anonyme_1') . '</p>'
84
+        . fieldset(
85
+            _T('connexion_ldap'),
86
+            [
87
+                'login_ldap' => [
88
+                    'label' => _T('texte_login_ldap_1'),
89
+                    'valeur' => $login_ldap
90
+                ],
91
+                'pass_ldap' => [
92
+                    'label' => _T('entree_passe_ldap'),
93
+                    'valeur' => $pass_ldap
94
+                ]
95
+            ]
96
+        )
97
+        . bouton_suivant()));
98 98
 
99
-	echo $minipage->installFinPage();
99
+    echo $minipage->installFinPage();
100 100
 }
Please login to merge, or discard this patch.
ecrire/install/etape_.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
  * @uses info_copyright()
28 28
  **/
29 29
 function install_etape__dist() {
30
-	utiliser_langue_visiteur();
31
-	$menu_langues = menu_langues('var_lang_ecrire');
32
-	if (!$menu_langues) {
33
-		redirige_url_ecrire('install', 'etape=chmod');
34
-	} else {
35
-		include_spip('inc/presentation'); // pour info_copyright
30
+    utiliser_langue_visiteur();
31
+    $menu_langues = menu_langues('var_lang_ecrire');
32
+    if (!$menu_langues) {
33
+        redirige_url_ecrire('install', 'etape=chmod');
34
+    } else {
35
+        include_spip('inc/presentation'); // pour info_copyright
36 36
 
37
-		$res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" .
38
-			"<p class='small'>" . info_copyright() . "</p></div>\n" .
39
-			'<p>' . _T('install_select_langue') . '</p>' .
40
-			'<div>' . $menu_langues . "</div>\n" .
41
-			generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant());
37
+        $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" .
38
+            "<p class='small'>" . info_copyright() . "</p></div>\n" .
39
+            '<p>' . _T('install_select_langue') . '</p>' .
40
+            '<div>' . $menu_langues . "</div>\n" .
41
+            generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant());
42 42
 
43
-		$minipage = new Installation();
44
-		echo $minipage->page($res);
45
-	}
43
+        $minipage = new Installation();
44
+        echo $minipage->page($res);
45
+    }
46 46
 }
Please login to merge, or discard this patch.
ecrire/install/etape_ldap4.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -12,96 +12,96 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 include_spip('auth/ldap');
19 19
 
20 20
 function install_etape_ldap4_dist() {
21
-	$adresse_ldap = _request('adresse_ldap');
22
-	$login_ldap = _request('login_ldap');
23
-	$pass_ldap = _request('pass_ldap');
24
-	$port_ldap = _request('port_ldap');
25
-	$base_ldap = _request('base_ldap');
26
-	$base_ldap_text = _request('base_ldap_text');
27
-	if (!$base_ldap) {
28
-		$base_ldap = $base_ldap_text;
29
-	}
30
-
31
-	$minipage = new Installation();
32
-	echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
33
-
34
-	$ldap_link = ldap_connect($adresse_ldap, $port_ldap);
35
-	@ldap_bind($ldap_link, $login_ldap, $pass_ldap);
36
-
37
-	// Essayer de verifier le chemin fourni
38
-	$r = @ldap_compare($ldap_link, $base_ldap, 'objectClass', '');
39
-	$fail = (ldap_errno($ldap_link) == 32);
40
-
41
-	if ($fail) {
42
-		echo info_etape(_T('info_chemin_acces_annuaire')),
43
-		info_progression_etape(3, 'etape_ldap', 'install/', true),
44
-			"<div class='error'><p><b>" . _T('avis_operation_echec') . '</b></p><p>' . _T('avis_chemin_invalide_1'),
45
-			' (<tt>' . spip_htmlspecialchars($base_ldap) . '</tt>) ' . _T('avis_chemin_invalide_2') . '</p></div>';
46
-	} else {
47
-		info_etape(_T('info_reglage_ldap'));
48
-		echo info_progression_etape(4, 'etape_ldap', 'install/');
49
-
50
-		$statuts = liste_statuts_ldap();
51
-		$statut_ldap = defined('_INSTALL_STATUT_LDAP')
52
-			? _INSTALL_STATUT_LDAP
53
-			: $GLOBALS['liste_des_statuts']['info_redacteurs'];
54
-
55
-
56
-		$res = install_propager(['adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap'])
57
-			. "<input type='hidden' name='etape' value='ldap5' />"
58
-			. "<input type='hidden' name='base_ldap' value='" . spip_htmlentities($base_ldap) . "' />"
59
-			. fieldset(
60
-				_T('info_statut_utilisateurs_1'),
61
-				[
62
-					'statut_ldap' => [
63
-						'label' => _T('info_statut_utilisateurs_2') . '<br />',
64
-						'valeur' => $statut_ldap,
65
-						'alternatives' => $statuts
66
-					]
67
-				]
68
-			)
69
-			. install_ldap_correspondances()
70
-			. bouton_suivant();
71
-
72
-		echo generer_form_ecrire('install', $res);
73
-	}
74
-
75
-	echo $minipage->installFinPage();
21
+    $adresse_ldap = _request('adresse_ldap');
22
+    $login_ldap = _request('login_ldap');
23
+    $pass_ldap = _request('pass_ldap');
24
+    $port_ldap = _request('port_ldap');
25
+    $base_ldap = _request('base_ldap');
26
+    $base_ldap_text = _request('base_ldap_text');
27
+    if (!$base_ldap) {
28
+        $base_ldap = $base_ldap_text;
29
+    }
30
+
31
+    $minipage = new Installation();
32
+    echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
33
+
34
+    $ldap_link = ldap_connect($adresse_ldap, $port_ldap);
35
+    @ldap_bind($ldap_link, $login_ldap, $pass_ldap);
36
+
37
+    // Essayer de verifier le chemin fourni
38
+    $r = @ldap_compare($ldap_link, $base_ldap, 'objectClass', '');
39
+    $fail = (ldap_errno($ldap_link) == 32);
40
+
41
+    if ($fail) {
42
+        echo info_etape(_T('info_chemin_acces_annuaire')),
43
+        info_progression_etape(3, 'etape_ldap', 'install/', true),
44
+            "<div class='error'><p><b>" . _T('avis_operation_echec') . '</b></p><p>' . _T('avis_chemin_invalide_1'),
45
+            ' (<tt>' . spip_htmlspecialchars($base_ldap) . '</tt>) ' . _T('avis_chemin_invalide_2') . '</p></div>';
46
+    } else {
47
+        info_etape(_T('info_reglage_ldap'));
48
+        echo info_progression_etape(4, 'etape_ldap', 'install/');
49
+
50
+        $statuts = liste_statuts_ldap();
51
+        $statut_ldap = defined('_INSTALL_STATUT_LDAP')
52
+            ? _INSTALL_STATUT_LDAP
53
+            : $GLOBALS['liste_des_statuts']['info_redacteurs'];
54
+
55
+
56
+        $res = install_propager(['adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap'])
57
+            . "<input type='hidden' name='etape' value='ldap5' />"
58
+            . "<input type='hidden' name='base_ldap' value='" . spip_htmlentities($base_ldap) . "' />"
59
+            . fieldset(
60
+                _T('info_statut_utilisateurs_1'),
61
+                [
62
+                    'statut_ldap' => [
63
+                        'label' => _T('info_statut_utilisateurs_2') . '<br />',
64
+                        'valeur' => $statut_ldap,
65
+                        'alternatives' => $statuts
66
+                    ]
67
+                ]
68
+            )
69
+            . install_ldap_correspondances()
70
+            . bouton_suivant();
71
+
72
+        echo generer_form_ecrire('install', $res);
73
+    }
74
+
75
+    echo $minipage->installFinPage();
76 76
 }
77 77
 
78 78
 function liste_statuts_ldap() {
79
-	$recom = [
80
-		'info_administrateurs' => ('<b>' . _T('info_administrateur_1') . '</b> ' . _T('info_administrateur_2') . '<br />'),
81
-		'info_redacteurs' => ('<b>' . _T('info_redacteur_1') . '</b> ' . _T('info_redacteur_2') . '<br />'),
82
-		'info_visiteurs' => ('<b>' . _T('info_visiteur_1') . '</b> ' . _T('info_visiteur_2') . '<br />')
83
-	];
84
-
85
-	$res = [];
86
-	foreach ($GLOBALS['liste_des_statuts'] as $k => $v) {
87
-		if (isset($recom[$k])) {
88
-			$res[$v] = $recom[$k];
89
-		}
90
-	}
91
-
92
-	return $res;
79
+    $recom = [
80
+        'info_administrateurs' => ('<b>' . _T('info_administrateur_1') . '</b> ' . _T('info_administrateur_2') . '<br />'),
81
+        'info_redacteurs' => ('<b>' . _T('info_redacteur_1') . '</b> ' . _T('info_redacteur_2') . '<br />'),
82
+        'info_visiteurs' => ('<b>' . _T('info_visiteur_1') . '</b> ' . _T('info_visiteur_2') . '<br />')
83
+    ];
84
+
85
+    $res = [];
86
+    foreach ($GLOBALS['liste_des_statuts'] as $k => $v) {
87
+        if (isset($recom[$k])) {
88
+            $res[$v] = $recom[$k];
89
+        }
90
+    }
91
+
92
+    return $res;
93 93
 }
94 94
 
95 95
 function install_ldap_correspondances() {
96
-	$champs = [];
97
-	foreach (is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [] as $champ => $v) {
98
-		$nom = 'ldap_' . $champ;
99
-		$val = is_array($v) ? implode(',', $v) : (string) $v;
100
-		$champs[$nom] = [
101
-			'label' => _T('ldap_correspondance', ['champ' => "<tt>$champ</tt>"]) . '<br />',
102
-			'valeur' => $val
103
-		];
104
-	}
105
-
106
-	return $champs ? fieldset(_T('ldap_correspondance_1'), $champs, '', _T('ldap_correspondance_2') . '<br /><br />') : '';
96
+    $champs = [];
97
+    foreach (is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [] as $champ => $v) {
98
+        $nom = 'ldap_' . $champ;
99
+        $val = is_array($v) ? implode(',', $v) : (string) $v;
100
+        $champs[$nom] = [
101
+            'label' => _T('ldap_correspondance', ['champ' => "<tt>$champ</tt>"]) . '<br />',
102
+            'valeur' => $val
103
+        ];
104
+    }
105
+
106
+    return $champs ? fieldset(_T('ldap_correspondance_1'), $champs, '', _T('ldap_correspondance_2') . '<br /><br />') : '';
107 107
 }
Please login to merge, or discard this patch.
ecrire/install/etape_2.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -12,167 +12,167 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 include_spip('base/abstract_sql');
19 19
 
20 20
 function install_etape_2_dist() {
21
-	$adresse_db = defined('_INSTALL_HOST_DB')
22
-		? _INSTALL_HOST_DB
23
-		: _request('adresse_db');
21
+    $adresse_db = defined('_INSTALL_HOST_DB')
22
+        ? _INSTALL_HOST_DB
23
+        : _request('adresse_db');
24 24
 
25
-	if (preg_match(',(.*):(.*),', (string) $adresse_db, $r)) {
26
-		[, $adresse_db, $port] = $r;
27
-	} else {
28
-		$port = '';
29
-	}
25
+    if (preg_match(',(.*):(.*),', (string) $adresse_db, $r)) {
26
+        [, $adresse_db, $port] = $r;
27
+    } else {
28
+        $port = '';
29
+    }
30 30
 
31
-	$login_db = defined('_INSTALL_USER_DB')
32
-		? _INSTALL_USER_DB
33
-		: _request('login_db');
31
+    $login_db = defined('_INSTALL_USER_DB')
32
+        ? _INSTALL_USER_DB
33
+        : _request('login_db');
34 34
 
35
-	$pass_db = defined('_INSTALL_PASS_DB')
36
-		? _INSTALL_PASS_DB
37
-		: _request('pass_db');
35
+    $pass_db = defined('_INSTALL_PASS_DB')
36
+        ? _INSTALL_PASS_DB
37
+        : _request('pass_db');
38 38
 
39
-	$server_db = defined('_INSTALL_SERVER_DB')
40
-		? _INSTALL_SERVER_DB
41
-		: _request('server_db');
39
+    $server_db = defined('_INSTALL_SERVER_DB')
40
+        ? _INSTALL_SERVER_DB
41
+        : _request('server_db');
42 42
 
43
-	$name_db = defined('_INSTALL_NAME_DB')
44
-		? _INSTALL_NAME_DB
45
-		: '';
43
+    $name_db = defined('_INSTALL_NAME_DB')
44
+        ? _INSTALL_NAME_DB
45
+        : '';
46 46
 
47
-	$chmod = _request('chmod');
47
+    $chmod = _request('chmod');
48 48
 
49
-	$link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db);
50
-	$GLOBALS['connexions'][$server_db] = $link;
49
+    $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db);
50
+    $GLOBALS['connexions'][$server_db] = $link;
51 51
 
52
-	$GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
53
-		= $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
52
+    $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
53
+        = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
54 54
 
55
-	$minipage = new Installation();
56
-	echo $minipage->installDebutPage();
55
+    $minipage = new Installation();
56
+    echo $minipage->installDebutPage();
57 57
 
58 58
 
59 59
 // prenons toutes les dispositions possibles pour que rien ne s'affiche !
60 60
 
61
-	/*
61
+    /*
62 62
 	 * /!\ sqlite3/PDO : erreur sur join(', ', $link)
63 63
 	 * L'objet PDO ne peut pas etre transformee en chaine
64 64
 	 * Un echo $link ne fonctionne pas non plus
65 65
 	 * Il faut utiliser par exemple print_r($link)
66 66
 	 */
67
-	//echo "\n<!--\n", join(', ', $link), " $login_db ";
68
-	$db_connect = 0; // revoirfunction_exists($ferrno) ? $ferrno() : 0;
69
-	//echo join(', ', $GLOBALS['connexions'][$server_db]);
70
-	//echo "\n-->\n";
67
+    //echo "\n<!--\n", join(', ', $link), " $login_db ";
68
+    $db_connect = 0; // revoirfunction_exists($ferrno) ? $ferrno() : 0;
69
+    //echo join(', ', $GLOBALS['connexions'][$server_db]);
70
+    //echo "\n-->\n";
71 71
 
72
-	if (($db_connect == '0') && $link) {
73
-		echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>';
74
-		echo info_progression_etape(2, 'etape_', 'install/');
72
+    if (($db_connect == '0') && $link) {
73
+        echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>';
74
+        echo info_progression_etape(2, 'etape_', 'install/');
75 75
 
76
-		echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true));
76
+        echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true));
77 77
 
78
-		echo "\n", '<!-- ', sql_version($server_db), ' -->';
79
-		[$checked, $res] = install_etape_2_bases($login_db, $server_db);
78
+        echo "\n", '<!-- ', sql_version($server_db), ' -->';
79
+        [$checked, $res] = install_etape_2_bases($login_db, $server_db);
80 80
 
81
-		$hidden = (defined('_SPIP_CHMOD')
82
-				? ''
83
-				: ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />"))
84
-			. predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db);
81
+        $hidden = (defined('_SPIP_CHMOD')
82
+                ? ''
83
+                : ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />"))
84
+            . predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db);
85 85
 
86
-		echo install_etape_2_form($hidden, $checked, $res, 3);
87
-	} else {
88
-		echo info_progression_etape(1, 'etape_', 'install/', true);
86
+        echo install_etape_2_form($hidden, $checked, $res, 3);
87
+    } else {
88
+        echo info_progression_etape(1, 'etape_', 'install/', true);
89 89
 
90
-		echo "<div class='error'>";
91
-		echo info_etape(_T('info_connexion_base'));
92
-		echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>';
93
-		echo '<p>' . _T('avis_connexion_echec_2') . '</p>';
90
+        echo "<div class='error'>";
91
+        echo info_etape(_T('info_connexion_base'));
92
+        echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>';
93
+        echo '<p>' . _T('avis_connexion_echec_2') . '</p>';
94 94
 
95
-		echo "<p style='font-size: small;'>",
96
-		_T('avis_connexion_echec_3'),
97
-		'</p></div>';
98
-	}
95
+        echo "<p style='font-size: small;'>",
96
+        _T('avis_connexion_echec_3'),
97
+        '</p></div>';
98
+    }
99 99
 
100
-	echo $minipage->installFinPage();
100
+    echo $minipage->installFinPage();
101 101
 }
102 102
 
103 103
 // Liste les bases accessibles,
104 104
 // avec une heuristique pour preselectionner la plus probable
105 105
 
106 106
 function install_etape_2_bases($login_db, $server_db) {
107
-	$res = install_etape_liste_bases($server_db, $login_db);
108
-	if ($res) {
109
-		[$checked, $bases] = $res;
110
-
111
-		return [
112
-			$checked,
113
-			"<label for='choix_db'><b>"
114
-			. _T('texte_choix_base_2')
115
-			. '</b><br />'
116
-			. _T('texte_choix_base_3')
117
-			. '</label>'
118
-			. "<ul>\n<li>"
119
-			. implode("</li>\n<li>", $bases)
120
-			. "</li>\n</ul><p>"
121
-			. _T('info_ou')
122
-			. ' '
123
-		];
124
-	}
125
-	$res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b>
107
+    $res = install_etape_liste_bases($server_db, $login_db);
108
+    if ($res) {
109
+        [$checked, $bases] = $res;
110
+
111
+        return [
112
+            $checked,
113
+            "<label for='choix_db'><b>"
114
+            . _T('texte_choix_base_2')
115
+            . '</b><br />'
116
+            . _T('texte_choix_base_3')
117
+            . '</label>'
118
+            . "<ul>\n<li>"
119
+            . implode("</li>\n<li>", $bases)
120
+            . "</li>\n</ul><p>"
121
+            . _T('info_ou')
122
+            . ' '
123
+        ];
124
+    }
125
+    $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b>
126 126
 		' . _T('avis_lecture_noms_bases_2') . '<p>';
127 127
 
128
-	$checked = false;
129
-	if ($login_db) {
130
-		// Si un login comporte un point, le nom de la base est plus
131
-		// probablement le login sans le point -- testons pour savoir
132
-		$test_base = $login_db;
133
-		$ok = sql_selectdb($test_base, $server_db);
134
-		$test_base2 = str_replace('.', '_', (string) $test_base);
135
-		if (sql_selectdb($test_base2, $server_db)) {
136
-			$test_base = $test_base2;
137
-			$ok = true;
138
-		}
139
-
140
-		if ($ok) {
141
-			$res .= _T('avis_lecture_noms_bases_3')
142
-				. '<ul>'
143
-				. '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />"
144
-				. "<label for='stand'>" . $test_base . "</label></li>\n"
145
-				. '</ul>'
146
-				. '<p>' . _T('info_ou') . ' ';
147
-			$checked = true;
148
-		}
149
-	}
150
-
151
-	return [$checked, $res];
128
+    $checked = false;
129
+    if ($login_db) {
130
+        // Si un login comporte un point, le nom de la base est plus
131
+        // probablement le login sans le point -- testons pour savoir
132
+        $test_base = $login_db;
133
+        $ok = sql_selectdb($test_base, $server_db);
134
+        $test_base2 = str_replace('.', '_', (string) $test_base);
135
+        if (sql_selectdb($test_base2, $server_db)) {
136
+            $test_base = $test_base2;
137
+            $ok = true;
138
+        }
139
+
140
+        if ($ok) {
141
+            $res .= _T('avis_lecture_noms_bases_3')
142
+                . '<ul>'
143
+                . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />"
144
+                . "<label for='stand'>" . $test_base . "</label></li>\n"
145
+                . '</ul>'
146
+                . '<p>' . _T('info_ou') . ' ';
147
+            $checked = true;
148
+        }
149
+    }
150
+
151
+    return [$checked, $res];
152 152
 }
153 153
 
154 154
 function install_etape_2_form($hidden, $checked, $res, $etape) {
155
-	return generer_form_ecrire('install', (
156
-		"\n<input type='hidden' name='etape' value='$etape' />"
157
-		. $hidden
158
-		. (defined('_INSTALL_NAME_DB')
159
-			? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>'
160
-			: "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n"
161
-			. $res
162
-			. "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'"
163
-			. ($checked ? '' : " checked='checked'")
164
-			. " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>"
165
-			. "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n"
166
-		)
167
-
168
-		. ((defined('_INSTALL_TABLE_PREFIX') || $GLOBALS['table_prefix'] != 'spip')
169
-			? '<h3>' . _T('install_table_prefix_hebergeur') . '  <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>'
170
-			: '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n"
171
-			. "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>'
172
-			. "\n<input type='text' id='tprefix' name='tprefix' class='text' value='"
173
-			. 'spip' # valeur par defaut
174
-			. "' size='20' /></p></fieldset>"
175
-		)
176
-
177
-		. bouton_suivant()));
155
+    return generer_form_ecrire('install', (
156
+        "\n<input type='hidden' name='etape' value='$etape' />"
157
+        . $hidden
158
+        . (defined('_INSTALL_NAME_DB')
159
+            ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>'
160
+            : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n"
161
+            . $res
162
+            . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'"
163
+            . ($checked ? '' : " checked='checked'")
164
+            . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>"
165
+            . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n"
166
+        )
167
+
168
+        . ((defined('_INSTALL_TABLE_PREFIX') || $GLOBALS['table_prefix'] != 'spip')
169
+            ? '<h3>' . _T('install_table_prefix_hebergeur') . '  <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>'
170
+            : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n"
171
+            . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>'
172
+            . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='"
173
+            . 'spip' # valeur par defaut
174
+            . "' size='20' /></p></fieldset>"
175
+        )
176
+
177
+        . bouton_suivant()));
178 178
 }
Please login to merge, or discard this patch.