@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('iterateur/data'); |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | * Description de la boucle complétée des champs |
| 40 | 40 | */ |
| 41 | 41 | function iterateur_POUR_dist($b) { |
| 42 | - $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 43 | - $b->show = [ |
|
| 44 | - 'field' => [ |
|
| 45 | - 'cle' => 'STRING', |
|
| 46 | - 'valeur' => 'STRING', |
|
| 47 | - ] |
|
| 48 | - ]; |
|
| 42 | + $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 43 | + $b->show = [ |
|
| 44 | + 'field' => [ |
|
| 45 | + 'cle' => 'STRING', |
|
| 46 | + 'valeur' => 'STRING', |
|
| 47 | + ] |
|
| 48 | + ]; |
|
| 49 | 49 | |
| 50 | - return $b; |
|
| 50 | + return $b; |
|
| 51 | 51 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('iterateur/data'); |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * Description de la boucle complétée des champs |
| 36 | 36 | */ |
| 37 | 37 | function iterateur_CONDITION_dist($b) { |
| 38 | - $b->iterateur = 'CONDITION'; # designe la classe d'iterateur |
|
| 39 | - $b->show = [ |
|
| 40 | - 'field' => [] |
|
| 41 | - ]; |
|
| 38 | + $b->iterateur = 'CONDITION'; # designe la classe d'iterateur |
|
| 39 | + $b->show = [ |
|
| 40 | + 'field' => [] |
|
| 41 | + ]; |
|
| 42 | 42 | |
| 43 | - return $b; |
|
| 43 | + return $b; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | * La boucle condition n'a toujours qu'un seul élément. |
| 50 | 50 | */ |
| 51 | 51 | class IterateurCONDITION extends IterateurData { |
| 52 | - /** |
|
| 53 | - * Obtenir les données de la boucle CONDITION |
|
| 54 | - * |
|
| 55 | - * @param array $command |
|
| 56 | - **/ |
|
| 57 | - protected function select($command) { |
|
| 58 | - $this->tableau = [0 => 1]; |
|
| 59 | - } |
|
| 52 | + /** |
|
| 53 | + * Obtenir les données de la boucle CONDITION |
|
| 54 | + * |
|
| 55 | + * @param array $command |
|
| 56 | + **/ |
|
| 57 | + protected function select($command) { |
|
| 58 | + $this->tableau = [0 => 1]; |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | 'valeur' => $adresse_ldap |
| 59 | 59 | ], |
| 60 | 60 | 'port_ldap' => [ |
| 61 | - 'label' => _T('entree_port_annuaire') . '<br />' . _T('texte_port_annuaire'), |
|
| 61 | + 'label' => _T('entree_port_annuaire').'<br />'._T('texte_port_annuaire'), |
|
| 62 | 62 | 'valeur' => $port_ldap |
| 63 | 63 | ], |
| 64 | 64 | 'tls_ldap' => [ |
| 65 | - 'label' => '<b>' . _T('tls_ldap') . '</b>', |
|
| 65 | + 'label' => '<b>'._T('tls_ldap').'</b>', |
|
| 66 | 66 | 'valeur' => $tls_ldap, |
| 67 | 67 | 'alternatives' => [ |
| 68 | 68 | 'non' => _T('item_non'), |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ] |
| 81 | 81 | ) |
| 82 | 82 | |
| 83 | - . "\n<p>" . _T('texte_acces_ldap_anonyme_1') . '</p>' |
|
| 83 | + . "\n<p>"._T('texte_acces_ldap_anonyme_1').'</p>' |
|
| 84 | 84 | . fieldset( |
| 85 | 85 | _T('connexion_ldap'), |
| 86 | 86 | [ |
@@ -11,88 +11,88 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function install_etape_ldap1_dist() { |
| 18 | - $adresse_ldap = defined('_INSTALL_HOST_LDAP') |
|
| 19 | - ? _INSTALL_HOST_LDAP |
|
| 20 | - : 'localhost'; |
|
| 18 | + $adresse_ldap = defined('_INSTALL_HOST_LDAP') |
|
| 19 | + ? _INSTALL_HOST_LDAP |
|
| 20 | + : 'localhost'; |
|
| 21 | 21 | |
| 22 | - $port_ldap = defined('_INSTALL_PORT_LDAP') |
|
| 23 | - ? _INSTALL_PORT_LDAP |
|
| 24 | - : 389; |
|
| 22 | + $port_ldap = defined('_INSTALL_PORT_LDAP') |
|
| 23 | + ? _INSTALL_PORT_LDAP |
|
| 24 | + : 389; |
|
| 25 | 25 | |
| 26 | - $tls_ldap = defined('_INSTALL_TLS_LDAP') |
|
| 27 | - ? _INSTALL_TLS_LDAP |
|
| 28 | - : 'non'; |
|
| 26 | + $tls_ldap = defined('_INSTALL_TLS_LDAP') |
|
| 27 | + ? _INSTALL_TLS_LDAP |
|
| 28 | + : 'non'; |
|
| 29 | 29 | |
| 30 | - $protocole_ldap = defined('_INSTALL_PROTOCOLE_LDAP') |
|
| 31 | - ? _INSTALL_PROTOCOLE_LDAP |
|
| 32 | - : 3; // on essaie 2 en cas d'echec |
|
| 30 | + $protocole_ldap = defined('_INSTALL_PROTOCOLE_LDAP') |
|
| 31 | + ? _INSTALL_PROTOCOLE_LDAP |
|
| 32 | + : 3; // on essaie 2 en cas d'echec |
|
| 33 | 33 | |
| 34 | - $login_ldap = defined('_INSTALL_USER_LDAP') |
|
| 35 | - ? _INSTALL_USER_LDAP |
|
| 36 | - : ''; |
|
| 34 | + $login_ldap = defined('_INSTALL_USER_LDAP') |
|
| 35 | + ? _INSTALL_USER_LDAP |
|
| 36 | + : ''; |
|
| 37 | 37 | |
| 38 | - $pass_ldap = defined('_INSTALL_PASS_LDAP') |
|
| 39 | - ? _INSTALL_PASS_LDAP |
|
| 40 | - : ''; |
|
| 38 | + $pass_ldap = defined('_INSTALL_PASS_LDAP') |
|
| 39 | + ? _INSTALL_PASS_LDAP |
|
| 40 | + : ''; |
|
| 41 | 41 | |
| 42 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 42 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 43 | 43 | |
| 44 | - echo info_etape( |
|
| 45 | - _T('titre_connexion_ldap'), |
|
| 46 | - info_progression_etape(1, 'etape_ldap', 'install/') |
|
| 47 | - ); |
|
| 44 | + echo info_etape( |
|
| 45 | + _T('titre_connexion_ldap'), |
|
| 46 | + info_progression_etape(1, 'etape_ldap', 'install/') |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | - echo generer_form_ecrire('install', ( |
|
| 50 | - "\n<input type='hidden' name='etape' value='ldap2' />" |
|
| 51 | - . fieldset( |
|
| 52 | - _T('entree_adresse_annuaire'), |
|
| 53 | - [ |
|
| 54 | - 'adresse_ldap' => [ |
|
| 55 | - 'label' => _T('texte_adresse_annuaire_1'), |
|
| 56 | - 'valeur' => $adresse_ldap |
|
| 57 | - ], |
|
| 58 | - 'port_ldap' => [ |
|
| 59 | - 'label' => _T('entree_port_annuaire') . '<br />' . _T('texte_port_annuaire'), |
|
| 60 | - 'valeur' => $port_ldap |
|
| 61 | - ], |
|
| 62 | - 'tls_ldap' => [ |
|
| 63 | - 'label' => '<b>' . _T('tls_ldap') . '</b>', |
|
| 64 | - 'valeur' => $tls_ldap, |
|
| 65 | - 'alternatives' => [ |
|
| 66 | - 'non' => _T('item_non'), |
|
| 67 | - 'oui' => _T('item_oui') |
|
| 68 | - ] |
|
| 69 | - ], |
|
| 70 | - 'protocole_ldap' => [ |
|
| 71 | - 'label' => _T('protocole_ldap'), |
|
| 72 | - 'valeur' => $protocole_ldap, |
|
| 73 | - 'alternatives' => [ |
|
| 74 | - '3' => '3', |
|
| 75 | - '2' => '2' |
|
| 76 | - ] |
|
| 77 | - ] |
|
| 78 | - ] |
|
| 79 | - ) |
|
| 49 | + echo generer_form_ecrire('install', ( |
|
| 50 | + "\n<input type='hidden' name='etape' value='ldap2' />" |
|
| 51 | + . fieldset( |
|
| 52 | + _T('entree_adresse_annuaire'), |
|
| 53 | + [ |
|
| 54 | + 'adresse_ldap' => [ |
|
| 55 | + 'label' => _T('texte_adresse_annuaire_1'), |
|
| 56 | + 'valeur' => $adresse_ldap |
|
| 57 | + ], |
|
| 58 | + 'port_ldap' => [ |
|
| 59 | + 'label' => _T('entree_port_annuaire') . '<br />' . _T('texte_port_annuaire'), |
|
| 60 | + 'valeur' => $port_ldap |
|
| 61 | + ], |
|
| 62 | + 'tls_ldap' => [ |
|
| 63 | + 'label' => '<b>' . _T('tls_ldap') . '</b>', |
|
| 64 | + 'valeur' => $tls_ldap, |
|
| 65 | + 'alternatives' => [ |
|
| 66 | + 'non' => _T('item_non'), |
|
| 67 | + 'oui' => _T('item_oui') |
|
| 68 | + ] |
|
| 69 | + ], |
|
| 70 | + 'protocole_ldap' => [ |
|
| 71 | + 'label' => _T('protocole_ldap'), |
|
| 72 | + 'valeur' => $protocole_ldap, |
|
| 73 | + 'alternatives' => [ |
|
| 74 | + '3' => '3', |
|
| 75 | + '2' => '2' |
|
| 76 | + ] |
|
| 77 | + ] |
|
| 78 | + ] |
|
| 79 | + ) |
|
| 80 | 80 | |
| 81 | - . "\n<p>" . _T('texte_acces_ldap_anonyme_1') . '</p>' |
|
| 82 | - . fieldset( |
|
| 83 | - _T('connexion_ldap'), |
|
| 84 | - [ |
|
| 85 | - 'login_ldap' => [ |
|
| 86 | - 'label' => _T('texte_login_ldap_1'), |
|
| 87 | - 'valeur' => $login_ldap |
|
| 88 | - ], |
|
| 89 | - 'pass_ldap' => [ |
|
| 90 | - 'label' => _T('entree_passe_ldap'), |
|
| 91 | - 'valeur' => $pass_ldap |
|
| 92 | - ] |
|
| 93 | - ] |
|
| 94 | - ) |
|
| 95 | - . bouton_suivant())); |
|
| 81 | + . "\n<p>" . _T('texte_acces_ldap_anonyme_1') . '</p>' |
|
| 82 | + . fieldset( |
|
| 83 | + _T('connexion_ldap'), |
|
| 84 | + [ |
|
| 85 | + 'login_ldap' => [ |
|
| 86 | + 'label' => _T('texte_login_ldap_1'), |
|
| 87 | + 'valeur' => $login_ldap |
|
| 88 | + ], |
|
| 89 | + 'pass_ldap' => [ |
|
| 90 | + 'label' => _T('entree_passe_ldap'), |
|
| 91 | + 'valeur' => $pass_ldap |
|
| 92 | + ] |
|
| 93 | + ] |
|
| 94 | + ) |
|
| 95 | + . bouton_suivant())); |
|
| 96 | 96 | |
| 97 | - echo install_fin_html(); |
|
| 97 | + echo install_fin_html(); |
|
| 98 | 98 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $test_dir .= '/'; |
| 82 | 82 | } |
| 83 | 83 | if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
| 84 | - $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 84 | + $GLOBALS['test_dirs'][] = _DIR_RACINE.$test_dir; |
|
| 85 | 85 | } |
| 86 | 86 | } else { |
| 87 | 87 | if (!_FILE_CONNECT) { |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
| 97 | 97 | $test = test_ecrire($my_dir); |
| 98 | 98 | if (!$test) { |
| 99 | - $m = preg_replace(',^' . _DIR_RACINE . ',', '', $my_dir); |
|
| 99 | + $m = preg_replace(',^'._DIR_RACINE.',', '', $my_dir); |
|
| 100 | 100 | if (@file_exists($my_dir)) { |
| 101 | - $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 101 | + $bad_dirs['<li>'.$m.'</li>'] = 1; |
|
| 102 | 102 | } else { |
| 103 | - $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 103 | + $absent_dirs['<li>'.$m.'</li>'] = 1; |
|
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | 106 | $chmod = max($chmod, $test); |
@@ -110,21 +110,21 @@ discard block |
||
| 110 | 110 | if ($bad_dirs or $absent_dirs) { |
| 111 | 111 | if (!_FILE_CONNECT) { |
| 112 | 112 | $titre = _T('dirs_preliminaire'); |
| 113 | - $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 113 | + $continuer = ' '._T('dirs_commencer').'.'; |
|
| 114 | 114 | } else { |
| 115 | 115 | $titre = _T('dirs_probleme_droits'); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
| 119 | - $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 119 | + $res = "<div align='right'>".menu_langues('var_lang_ecrire')."</div>\n"; |
|
| 120 | 120 | |
| 121 | 121 | if ($bad_dirs) { |
| 122 | 122 | $res .= |
| 123 | 123 | _T( |
| 124 | 124 | 'dirs_repertoires_suivants', |
| 125 | 125 | ['bad_dirs' => join("\n", array_keys($bad_dirs))] |
| 126 | - ) . |
|
| 127 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 126 | + ). |
|
| 127 | + '<b>'._T('login_recharger').'</b>.'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if ($absent_dirs) { |
@@ -132,22 +132,21 @@ discard block |
||
| 132 | 132 | _T( |
| 133 | 133 | 'dirs_repertoires_absents', |
| 134 | 134 | ['bad_dirs' => join("\n", array_keys($absent_dirs))] |
| 135 | - ) . |
|
| 136 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 135 | + ). |
|
| 136 | + '<b>'._T('login_recharger').'</b>.'; |
|
| 137 | 137 | } |
| 138 | - $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 138 | + $res = '<p>'.$continuer.$res.aider('install0', true).'</p>'; |
|
| 139 | 139 | |
| 140 | 140 | $t = _T('login_recharger'); |
| 141 | - $t = (!$test_dir ? '' : |
|
| 142 | - "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />") |
|
| 141 | + $t = (!$test_dir ? '' : "<input type='hidden' name='test_dir' value='".spip_htmlspecialchars($test_dir, ENT_QUOTES)."' />") |
|
| 143 | 142 | . "<input type='hidden' name='etape' value='chmod' />" |
| 144 | - . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 143 | + . "<div style='text-align: right'><input type='submit' value='".attribut_html($t)."' /></div>"; |
|
| 145 | 144 | |
| 146 | - echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 145 | + echo minipres($titre, $res.generer_form_ecrire('install', $t)); |
|
| 147 | 146 | } else { |
| 148 | 147 | $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
| 149 | 148 | if (!$deja) { |
| 150 | - redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 149 | + redirige_url_ecrire('install', 'etape=1&chmod='.$chmod); |
|
| 151 | 150 | } else { |
| 152 | 151 | redirige_url_ecrire(); |
| 153 | 152 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if (defined('_TEST_DIRS')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | define('_TEST_DIRS', '1'); |
| 21 | 21 | |
@@ -26,42 +26,42 @@ discard block |
||
| 26 | 26 | // Tente d'ecrire |
| 27 | 27 | // |
| 28 | 28 | function test_ecrire($my_dir) { |
| 29 | - static $chmod = 0; |
|
| 30 | - |
|
| 31 | - $ok = false; |
|
| 32 | - $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; |
|
| 33 | - $self = basename($script); |
|
| 34 | - $uid = @fileowner('.'); |
|
| 35 | - $uid2 = @fileowner($self); |
|
| 36 | - $gid = @filegroup('.'); |
|
| 37 | - $gid2 = @filegroup($self); |
|
| 38 | - $perms = @fileperms($self); |
|
| 39 | - |
|
| 40 | - // Comparer l'appartenance d'un fichier cree par PHP |
|
| 41 | - // avec celle du script et du repertoire courant |
|
| 42 | - if (!$chmod) { |
|
| 43 | - @rmdir('test'); |
|
| 44 | - spip_unlink('test'); // effacer au cas ou |
|
| 45 | - @touch('test'); |
|
| 46 | - if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) { |
|
| 47 | - $chmod = 0700; |
|
| 48 | - } else { |
|
| 49 | - if ($gid > 0 && $gid == $gid2 && @filegroup('test') == $gid) { |
|
| 50 | - $chmod = 0770; |
|
| 51 | - } else { |
|
| 52 | - $chmod = 0777; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - // Appliquer de plus les droits d'acces du script |
|
| 56 | - if ($perms > 0) { |
|
| 57 | - $perms = ($perms & 0777) | (($perms & 0444) >> 2); |
|
| 58 | - $chmod |= $perms; |
|
| 59 | - } |
|
| 60 | - spip_unlink('test'); |
|
| 61 | - } |
|
| 62 | - $ok = is_dir($my_dir) && is_writable($my_dir); |
|
| 63 | - |
|
| 64 | - return $ok ? $chmod : false; |
|
| 29 | + static $chmod = 0; |
|
| 30 | + |
|
| 31 | + $ok = false; |
|
| 32 | + $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; |
|
| 33 | + $self = basename($script); |
|
| 34 | + $uid = @fileowner('.'); |
|
| 35 | + $uid2 = @fileowner($self); |
|
| 36 | + $gid = @filegroup('.'); |
|
| 37 | + $gid2 = @filegroup($self); |
|
| 38 | + $perms = @fileperms($self); |
|
| 39 | + |
|
| 40 | + // Comparer l'appartenance d'un fichier cree par PHP |
|
| 41 | + // avec celle du script et du repertoire courant |
|
| 42 | + if (!$chmod) { |
|
| 43 | + @rmdir('test'); |
|
| 44 | + spip_unlink('test'); // effacer au cas ou |
|
| 45 | + @touch('test'); |
|
| 46 | + if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) { |
|
| 47 | + $chmod = 0700; |
|
| 48 | + } else { |
|
| 49 | + if ($gid > 0 && $gid == $gid2 && @filegroup('test') == $gid) { |
|
| 50 | + $chmod = 0770; |
|
| 51 | + } else { |
|
| 52 | + $chmod = 0777; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + // Appliquer de plus les droits d'acces du script |
|
| 56 | + if ($perms > 0) { |
|
| 57 | + $perms = ($perms & 0777) | (($perms & 0444) >> 2); |
|
| 58 | + $chmod |= $perms; |
|
| 59 | + } |
|
| 60 | + spip_unlink('test'); |
|
| 61 | + } |
|
| 62 | + $ok = is_dir($my_dir) && is_writable($my_dir); |
|
| 63 | + |
|
| 64 | + return $ok ? $chmod : false; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // |
@@ -71,84 +71,84 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | function install_etape_chmod_dist() { |
| 73 | 73 | |
| 74 | - $continuer = null; |
|
| 75 | - $test_dir = _request('test_dir'); |
|
| 76 | - $chmod = 0; |
|
| 77 | - |
|
| 78 | - if ($test_dir) { |
|
| 79 | - if (substr($test_dir, -1) !== '/') { |
|
| 80 | - $test_dir .= '/'; |
|
| 81 | - } |
|
| 82 | - if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
|
| 83 | - $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 84 | - } |
|
| 85 | - } else { |
|
| 86 | - if (!_FILE_CONNECT) { |
|
| 87 | - $GLOBALS['test_dirs'][] = _DIR_CONNECT; |
|
| 88 | - $GLOBALS['test_dirs'][] = _DIR_CHMOD; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - $bad_dirs = []; |
|
| 93 | - $absent_dirs = []; |
|
| 94 | - |
|
| 95 | - foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
|
| 96 | - $test = test_ecrire($my_dir); |
|
| 97 | - if (!$test) { |
|
| 98 | - $m = preg_replace(',^' . _DIR_RACINE . ',', '', $my_dir); |
|
| 99 | - if (@file_exists($my_dir)) { |
|
| 100 | - $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 101 | - } else { |
|
| 102 | - $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 103 | - } |
|
| 104 | - } else { |
|
| 105 | - $chmod = max($chmod, $test); |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - if ($bad_dirs or $absent_dirs) { |
|
| 110 | - if (!_FILE_CONNECT) { |
|
| 111 | - $titre = _T('dirs_preliminaire'); |
|
| 112 | - $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 113 | - } else { |
|
| 114 | - $titre = _T('dirs_probleme_droits'); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 119 | - |
|
| 120 | - if ($bad_dirs) { |
|
| 121 | - $res .= |
|
| 122 | - _T( |
|
| 123 | - 'dirs_repertoires_suivants', |
|
| 124 | - ['bad_dirs' => join("\n", array_keys($bad_dirs))] |
|
| 125 | - ) . |
|
| 126 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - if ($absent_dirs) { |
|
| 130 | - $res .= |
|
| 131 | - _T( |
|
| 132 | - 'dirs_repertoires_absents', |
|
| 133 | - ['bad_dirs' => join("\n", array_keys($absent_dirs))] |
|
| 134 | - ) . |
|
| 135 | - '<b>' . _T('login_recharger') . '</b>.'; |
|
| 136 | - } |
|
| 137 | - $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 138 | - |
|
| 139 | - $t = _T('login_recharger'); |
|
| 140 | - $t = (!$test_dir ? '' : |
|
| 141 | - "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />") |
|
| 142 | - . "<input type='hidden' name='etape' value='chmod' />" |
|
| 143 | - . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 144 | - |
|
| 145 | - echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 146 | - } else { |
|
| 147 | - $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
|
| 148 | - if (!$deja) { |
|
| 149 | - redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 150 | - } else { |
|
| 151 | - redirige_url_ecrire(); |
|
| 152 | - } |
|
| 153 | - } |
|
| 74 | + $continuer = null; |
|
| 75 | + $test_dir = _request('test_dir'); |
|
| 76 | + $chmod = 0; |
|
| 77 | + |
|
| 78 | + if ($test_dir) { |
|
| 79 | + if (substr($test_dir, -1) !== '/') { |
|
| 80 | + $test_dir .= '/'; |
|
| 81 | + } |
|
| 82 | + if (!in_array($test_dir, $GLOBALS['test_dirs'])) { |
|
| 83 | + $GLOBALS['test_dirs'][] = _DIR_RACINE . $test_dir; |
|
| 84 | + } |
|
| 85 | + } else { |
|
| 86 | + if (!_FILE_CONNECT) { |
|
| 87 | + $GLOBALS['test_dirs'][] = _DIR_CONNECT; |
|
| 88 | + $GLOBALS['test_dirs'][] = _DIR_CHMOD; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + $bad_dirs = []; |
|
| 93 | + $absent_dirs = []; |
|
| 94 | + |
|
| 95 | + foreach ($GLOBALS['test_dirs'] as $i => $my_dir) { |
|
| 96 | + $test = test_ecrire($my_dir); |
|
| 97 | + if (!$test) { |
|
| 98 | + $m = preg_replace(',^' . _DIR_RACINE . ',', '', $my_dir); |
|
| 99 | + if (@file_exists($my_dir)) { |
|
| 100 | + $bad_dirs['<li>' . $m . '</li>'] = 1; |
|
| 101 | + } else { |
|
| 102 | + $absent_dirs['<li>' . $m . '</li>'] = 1; |
|
| 103 | + } |
|
| 104 | + } else { |
|
| 105 | + $chmod = max($chmod, $test); |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + if ($bad_dirs or $absent_dirs) { |
|
| 110 | + if (!_FILE_CONNECT) { |
|
| 111 | + $titre = _T('dirs_preliminaire'); |
|
| 112 | + $continuer = ' ' . _T('dirs_commencer') . '.'; |
|
| 113 | + } else { |
|
| 114 | + $titre = _T('dirs_probleme_droits'); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + $res = "<div align='right'>" . menu_langues('var_lang_ecrire') . "</div>\n"; |
|
| 119 | + |
|
| 120 | + if ($bad_dirs) { |
|
| 121 | + $res .= |
|
| 122 | + _T( |
|
| 123 | + 'dirs_repertoires_suivants', |
|
| 124 | + ['bad_dirs' => join("\n", array_keys($bad_dirs))] |
|
| 125 | + ) . |
|
| 126 | + '<b>' . _T('login_recharger') . '</b>.'; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + if ($absent_dirs) { |
|
| 130 | + $res .= |
|
| 131 | + _T( |
|
| 132 | + 'dirs_repertoires_absents', |
|
| 133 | + ['bad_dirs' => join("\n", array_keys($absent_dirs))] |
|
| 134 | + ) . |
|
| 135 | + '<b>' . _T('login_recharger') . '</b>.'; |
|
| 136 | + } |
|
| 137 | + $res = '<p>' . $continuer . $res . aider('install0', true) . '</p>'; |
|
| 138 | + |
|
| 139 | + $t = _T('login_recharger'); |
|
| 140 | + $t = (!$test_dir ? '' : |
|
| 141 | + "<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />") |
|
| 142 | + . "<input type='hidden' name='etape' value='chmod' />" |
|
| 143 | + . "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>"; |
|
| 144 | + |
|
| 145 | + echo minipres($titre, $res . generer_form_ecrire('install', $t)); |
|
| 146 | + } else { |
|
| 147 | + $deja = (_FILE_CONNECT and analyse_fichier_connection(_FILE_CONNECT)); |
|
| 148 | + if (!$deja) { |
|
| 149 | + redirige_url_ecrire('install', 'etape=1&chmod=' . $chmod); |
|
| 150 | + } else { |
|
| 151 | + redirige_url_ecrire(); |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | 154 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // creer le repertoire cache, qui sert partout ! |
| 46 | 46 | // deja fait en etape 4 en principe, on garde au cas ou |
| 47 | 47 | if (!@file_exists(_DIR_CACHE)) { |
| 48 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 48 | + $rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE); |
|
| 49 | 49 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | if ($msg) { |
| 56 | 56 | $cible = _T('public:accueil_site'); |
| 57 | 57 | $cible = generer_form_ecrire('accueil', '', '', $cible); |
| 58 | - echo minipres('AUTO', $msg . $cible); |
|
| 58 | + echo minipres('AUTO', $msg.$cible); |
|
| 59 | 59 | // ok, deboucher dans l'espace prive |
| 60 | 60 | } else { |
| 61 | 61 | redirige_url_ecrire('accueil'); |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | $averti = _T( |
| 76 | 76 | 'htaccess_a_simuler', |
| 77 | 77 | [ |
| 78 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | + 'htaccess' => '<tt>'._ACCESS_FILE_NAME.'</tt>', |
|
| 79 | 79 | 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
| 80 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | + 'document_root' => '<tt>'.$_SERVER['DOCUMENT_ROOT'].'</tt>' |
|
| 81 | 81 | ] |
| 82 | 82 | ); |
| 83 | 83 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
@@ -20,65 +20,65 @@ discard block |
||
| 20 | 20 | // Mise en place des fichiers de configuration si ce n'est fait |
| 21 | 21 | |
| 22 | 22 | function install_etape_fin_dist() { |
| 23 | - ecrire_acces(); |
|
| 23 | + ecrire_acces(); |
|
| 24 | 24 | |
| 25 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CHMOD_TMP); |
|
| 26 | - if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 27 | - if (!@rename(_FILE_CHMOD_TMP, $f)) { |
|
| 28 | - if (@copy(_FILE_CHMOD_TMP, $f)) { |
|
| 29 | - spip_unlink(_FILE_CHMOD_TMP); |
|
| 30 | - } |
|
| 31 | - } |
|
| 32 | - } |
|
| 25 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CHMOD_TMP); |
|
| 26 | + if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 27 | + if (!@rename(_FILE_CHMOD_TMP, $f)) { |
|
| 28 | + if (@copy(_FILE_CHMOD_TMP, $f)) { |
|
| 29 | + spip_unlink(_FILE_CHMOD_TMP); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CONNECT_TMP); |
|
| 35 | - if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 36 | - spip_log("renomme $f"); |
|
| 37 | - if (!@rename(_FILE_CONNECT_TMP, $f)) { |
|
| 38 | - if (@copy(_FILE_CONNECT_TMP, $f)) { |
|
| 39 | - @spip_unlink(_FILE_CONNECT_TMP); |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - } |
|
| 34 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CONNECT_TMP); |
|
| 35 | + if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 36 | + spip_log("renomme $f"); |
|
| 37 | + if (!@rename(_FILE_CONNECT_TMP, $f)) { |
|
| 38 | + if (@copy(_FILE_CONNECT_TMP, $f)) { |
|
| 39 | + @spip_unlink(_FILE_CONNECT_TMP); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - // creer le repertoire cache, qui sert partout ! |
|
| 45 | - // deja fait en etape 4 en principe, on garde au cas ou |
|
| 46 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 47 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 48 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 49 | - } |
|
| 44 | + // creer le repertoire cache, qui sert partout ! |
|
| 45 | + // deja fait en etape 4 en principe, on garde au cas ou |
|
| 46 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 47 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 48 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - // Verifier la securite des htaccess |
|
| 52 | - // Si elle ne fonctionne pas, prevenir |
|
| 53 | - $msg = install_verifier_htaccess(); |
|
| 54 | - if ($msg) { |
|
| 55 | - $cible = _T('public:accueil_site'); |
|
| 56 | - $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 57 | - echo minipres('AUTO', $msg . $cible); |
|
| 58 | - // ok, deboucher dans l'espace prive |
|
| 59 | - } else { |
|
| 60 | - redirige_url_ecrire('accueil'); |
|
| 61 | - } |
|
| 51 | + // Verifier la securite des htaccess |
|
| 52 | + // Si elle ne fonctionne pas, prevenir |
|
| 53 | + $msg = install_verifier_htaccess(); |
|
| 54 | + if ($msg) { |
|
| 55 | + $cible = _T('public:accueil_site'); |
|
| 56 | + $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 57 | + echo minipres('AUTO', $msg . $cible); |
|
| 58 | + // ok, deboucher dans l'espace prive |
|
| 59 | + } else { |
|
| 60 | + redirige_url_ecrire('accueil'); |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | function install_verifier_htaccess() { |
| 65 | - if ( |
|
| 66 | - verifier_htaccess(_DIR_TMP, true) |
|
| 67 | - and verifier_htaccess(_DIR_CONNECT, true) |
|
| 68 | - ) { |
|
| 69 | - return ''; |
|
| 70 | - } |
|
| 65 | + if ( |
|
| 66 | + verifier_htaccess(_DIR_TMP, true) |
|
| 67 | + and verifier_htaccess(_DIR_CONNECT, true) |
|
| 68 | + ) { |
|
| 69 | + return ''; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $titre = _T('htaccess_inoperant'); |
|
| 72 | + $titre = _T('htaccess_inoperant'); |
|
| 73 | 73 | |
| 74 | - $averti = _T( |
|
| 75 | - 'htaccess_a_simuler', |
|
| 76 | - [ |
|
| 77 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | - 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 79 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | - ] |
|
| 81 | - ); |
|
| 74 | + $averti = _T( |
|
| 75 | + 'htaccess_a_simuler', |
|
| 76 | + [ |
|
| 77 | + 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | + 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 79 | + 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | + ] |
|
| 81 | + ); |
|
| 82 | 82 | |
| 83 | - return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 83 | + return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 84 | 84 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // creer le repertoire cache, qui sert partout ! |
| 23 | 23 | if (!@file_exists(_DIR_CACHE)) { |
| 24 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 24 | + $rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE); |
|
| 25 | 25 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | echo '<p>' |
| 40 | 40 | . _T( |
| 41 | 41 | 'plugin_info_plugins_dist_1', |
| 42 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | + ['plugins_dist' => '<tt>'.joli_repertoire(_DIR_PLUGINS_DIST).'</tt>'] |
|
| 43 | 43 | ) |
| 44 | 44 | . '</p>'; |
| 45 | 45 | |
@@ -11,69 +11,69 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
| 18 | 18 | |
| 19 | 19 | function install_etape_4_dist() { |
| 20 | 20 | |
| 21 | - // creer le repertoire cache, qui sert partout ! |
|
| 22 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 23 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 24 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 25 | - } |
|
| 21 | + // creer le repertoire cache, qui sert partout ! |
|
| 22 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 23 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 24 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 29 | - echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 28 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 29 | + echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 30 | 30 | |
| 31 | - echo "<div class='success'><b>" |
|
| 32 | - . _T('info_derniere_etape') |
|
| 33 | - . '</b><p>' |
|
| 34 | - . _T('info_utilisation_spip') |
|
| 35 | - . '</p></div>'; |
|
| 31 | + echo "<div class='success'><b>" |
|
| 32 | + . _T('info_derniere_etape') |
|
| 33 | + . '</b><p>' |
|
| 34 | + . _T('info_utilisation_spip') |
|
| 35 | + . '</p></div>'; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - echo '<p>' |
|
| 39 | - . _T( |
|
| 40 | - 'plugin_info_plugins_dist_1', |
|
| 41 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | - ) |
|
| 43 | - . '</p>'; |
|
| 38 | + echo '<p>' |
|
| 39 | + . _T( |
|
| 40 | + 'plugin_info_plugins_dist_1', |
|
| 41 | + ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | + ) |
|
| 43 | + . '</p>'; |
|
| 44 | 44 | |
| 45 | - // installer les extensions |
|
| 46 | - include_spip('inc/plugin'); |
|
| 47 | - $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 48 | - echo $afficher( |
|
| 49 | - self(), |
|
| 50 | - liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 51 | - [], |
|
| 52 | - [], |
|
| 53 | - _DIR_PLUGINS_DIST, |
|
| 54 | - 'afficher_nom_plugin' |
|
| 55 | - ); |
|
| 45 | + // installer les extensions |
|
| 46 | + include_spip('inc/plugin'); |
|
| 47 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 48 | + echo $afficher( |
|
| 49 | + self(), |
|
| 50 | + liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 51 | + [], |
|
| 52 | + [], |
|
| 53 | + _DIR_PLUGINS_DIST, |
|
| 54 | + 'afficher_nom_plugin' |
|
| 55 | + ); |
|
| 56 | 56 | |
| 57 | - // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 58 | - // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 59 | - // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 60 | - // et procede alors a l'installation |
|
| 61 | - if ( |
|
| 62 | - !isset($GLOBALS['meta']['version_installee']) |
|
| 63 | - or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 64 | - ) { |
|
| 65 | - plugin_installes_meta(); |
|
| 66 | - } |
|
| 57 | + // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 58 | + // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 59 | + // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 60 | + // et procede alors a l'installation |
|
| 61 | + if ( |
|
| 62 | + !isset($GLOBALS['meta']['version_installee']) |
|
| 63 | + or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 64 | + ) { |
|
| 65 | + plugin_installes_meta(); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - // mettre a jour si necessaire l'adresse du site |
|
| 69 | - // securite si on arrive plus a se loger |
|
| 70 | - include_spip('inc/config'); |
|
| 71 | - appliquer_adresse_site(''); |
|
| 68 | + // mettre a jour si necessaire l'adresse du site |
|
| 69 | + // securite si on arrive plus a se loger |
|
| 70 | + include_spip('inc/config'); |
|
| 71 | + appliquer_adresse_site(''); |
|
| 72 | 72 | |
| 73 | - // aller a la derniere etape qui clos l'install et redirige |
|
| 74 | - $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 75 | - . bouton_suivant(_T('login_espace_prive')); |
|
| 73 | + // aller a la derniere etape qui clos l'install et redirige |
|
| 74 | + $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 75 | + . bouton_suivant(_T('login_espace_prive')); |
|
| 76 | 76 | |
| 77 | - echo generer_form_ecrire('install', $suite); |
|
| 78 | - echo install_fin_html(); |
|
| 77 | + echo generer_form_ecrire('install', $suite); |
|
| 78 | + echo install_fin_html(); |
|
| 79 | 79 | } |
@@ -52,29 +52,28 @@ discard block |
||
| 52 | 52 | $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
| 53 | 53 | . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
| 54 | 54 | . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
| 55 | - . (($tls_ldap != 'oui') ? '' : |
|
| 56 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 55 | + . (($tls_ldap != 'oui') ? '' : "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | 56 | . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
| 58 | 57 | |
| 59 | 58 | $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
| 60 | 59 | $res = ''; |
| 61 | 60 | foreach ($champs as $champ => $v) { |
| 62 | - $nom = 'ldap_' . $champ; |
|
| 61 | + $nom = 'ldap_'.$champ; |
|
| 63 | 62 | $val = trim(_request($nom)); |
| 64 | 63 | if (preg_match('/^\w*$/', $val)) { |
| 65 | 64 | if ($val) { |
| 66 | 65 | $val = _q($val); |
| 67 | 66 | } |
| 68 | 67 | } else { |
| 69 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 68 | + $val = 'array('._q(preg_split('/\W+/', $val)).')'; |
|
| 70 | 69 | }; |
| 71 | 70 | if ($val) { |
| 72 | - $res .= "'$champ' => " . $val . ','; |
|
| 71 | + $res .= "'$champ' => ".$val.','; |
|
| 73 | 72 | } |
| 74 | 73 | } |
| 75 | 74 | $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
| 76 | 75 | |
| 77 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 76 | + install_fichier_connexion(_DIR_CONNECT._FILE_LDAP, $conn); |
|
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | function etape_ldap5_suite() { |
@@ -87,7 +86,7 @@ discard block |
||
| 87 | 86 | ); |
| 88 | 87 | |
| 89 | 88 | echo generer_form_ecrire('install', ( |
| 90 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 89 | + "<input type='hidden' name='etape' value='3' />". |
|
| 91 | 90 | "<input type='hidden' name='ldap_present' value='true' />" |
| 92 | 91 | . bouton_suivant())); |
| 93 | 92 | |
@@ -11,84 +11,84 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | include_spip('auth/ldap'); |
| 18 | 18 | |
| 19 | 19 | function install_etape_ldap5_dist() { |
| 20 | - etape_ldap5_save(); |
|
| 21 | - etape_ldap5_suite(); |
|
| 20 | + etape_ldap5_save(); |
|
| 21 | + etape_ldap5_suite(); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | function etape_ldap5_save() { |
| 25 | - $conn = null; |
|
| 26 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 27 | - redirige_url_ecrire('install'); |
|
| 28 | - } |
|
| 25 | + $conn = null; |
|
| 26 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 27 | + redirige_url_ecrire('install'); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 30 | + ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 31 | 31 | |
| 32 | - lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 32 | + lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 33 | 33 | |
| 34 | - if ($p = strpos($conn, "'');")) { |
|
| 35 | - ecrire_fichier( |
|
| 36 | - _FILE_CONNECT_TMP, |
|
| 37 | - substr($conn, 0, $p + 1) |
|
| 38 | - . _FILE_LDAP |
|
| 39 | - . substr($conn, $p + 1) |
|
| 40 | - ); |
|
| 41 | - } |
|
| 34 | + if ($p = strpos($conn, "'');")) { |
|
| 35 | + ecrire_fichier( |
|
| 36 | + _FILE_CONNECT_TMP, |
|
| 37 | + substr($conn, 0, $p + 1) |
|
| 38 | + . _FILE_LDAP |
|
| 39 | + . substr($conn, $p + 1) |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\"); |
|
| 44 | - $login_ldap = addcslashes(_request('login_ldap'), "'\\"); |
|
| 45 | - $pass_ldap = addcslashes(_request('pass_ldap'), "'\\"); |
|
| 46 | - $port_ldap = addcslashes(_request('port_ldap'), "'\\"); |
|
| 47 | - $tls_ldap = addcslashes(_request('tls_ldap'), "'\\"); |
|
| 48 | - $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\"); |
|
| 49 | - $base_ldap = addcslashes(_request('base_ldap'), "'\\"); |
|
| 50 | - $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\"); |
|
| 43 | + $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\"); |
|
| 44 | + $login_ldap = addcslashes(_request('login_ldap'), "'\\"); |
|
| 45 | + $pass_ldap = addcslashes(_request('pass_ldap'), "'\\"); |
|
| 46 | + $port_ldap = addcslashes(_request('port_ldap'), "'\\"); |
|
| 47 | + $tls_ldap = addcslashes(_request('tls_ldap'), "'\\"); |
|
| 48 | + $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\"); |
|
| 49 | + $base_ldap = addcslashes(_request('base_ldap'), "'\\"); |
|
| 50 | + $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\"); |
|
| 51 | 51 | |
| 52 | - $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 53 | - . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 54 | - . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 55 | - . (($tls_ldap != 'oui') ? '' : |
|
| 56 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | - . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 52 | + $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 53 | + . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 54 | + . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 55 | + . (($tls_ldap != 'oui') ? '' : |
|
| 56 | + "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | + . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 58 | 58 | |
| 59 | - $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 60 | - $res = ''; |
|
| 61 | - foreach ($champs as $champ => $v) { |
|
| 62 | - $nom = 'ldap_' . $champ; |
|
| 63 | - $val = trim(_request($nom)); |
|
| 64 | - if (preg_match('/^\w*$/', $val)) { |
|
| 65 | - if ($val) { |
|
| 66 | - $val = _q($val); |
|
| 67 | - } |
|
| 68 | - } else { |
|
| 69 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 70 | - }; |
|
| 71 | - if ($val) { |
|
| 72 | - $res .= "'$champ' => " . $val . ','; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 59 | + $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 60 | + $res = ''; |
|
| 61 | + foreach ($champs as $champ => $v) { |
|
| 62 | + $nom = 'ldap_' . $champ; |
|
| 63 | + $val = trim(_request($nom)); |
|
| 64 | + if (preg_match('/^\w*$/', $val)) { |
|
| 65 | + if ($val) { |
|
| 66 | + $val = _q($val); |
|
| 67 | + } |
|
| 68 | + } else { |
|
| 69 | + $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 70 | + }; |
|
| 71 | + if ($val) { |
|
| 72 | + $res .= "'$champ' => " . $val . ','; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 76 | 76 | |
| 77 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 77 | + install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | function etape_ldap5_suite() { |
| 81 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 81 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 82 | 82 | |
| 83 | - echo info_etape( |
|
| 84 | - _T('info_ldap_ok'), |
|
| 85 | - info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 86 | - ); |
|
| 83 | + echo info_etape( |
|
| 84 | + _T('info_ldap_ok'), |
|
| 85 | + info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 86 | + ); |
|
| 87 | 87 | |
| 88 | - echo generer_form_ecrire('install', ( |
|
| 89 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 90 | - "<input type='hidden' name='ldap_present' value='true' />" |
|
| 91 | - . bouton_suivant())); |
|
| 88 | + echo generer_form_ecrire('install', ( |
|
| 89 | + "<input type='hidden' name='etape' value='3' />" . |
|
| 90 | + "<input type='hidden' name='ldap_present' value='true' />" |
|
| 91 | + . bouton_suivant())); |
|
| 92 | 92 | |
| 93 | - echo install_fin_html(); |
|
| 93 | + echo install_fin_html(); |
|
| 94 | 94 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -35,18 +35,18 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function genie_maintenance_dist($t) { |
| 37 | 37 | |
| 38 | - // (re)mettre .htaccess avec deny from all |
|
| 39 | - // dans les deux repertoires dits inaccessibles par http |
|
| 40 | - include_spip('inc/acces'); |
|
| 41 | - verifier_htaccess(_DIR_ETC); |
|
| 42 | - verifier_htaccess(_DIR_TMP); |
|
| 38 | + // (re)mettre .htaccess avec deny from all |
|
| 39 | + // dans les deux repertoires dits inaccessibles par http |
|
| 40 | + include_spip('inc/acces'); |
|
| 41 | + verifier_htaccess(_DIR_ETC); |
|
| 42 | + verifier_htaccess(_DIR_TMP); |
|
| 43 | 43 | |
| 44 | - // Verifier qu'aucune table n'est crashee |
|
| 45 | - if (!_request('reinstall')) { |
|
| 46 | - verifier_crash_tables(); |
|
| 47 | - } |
|
| 44 | + // Verifier qu'aucune table n'est crashee |
|
| 45 | + if (!_request('reinstall')) { |
|
| 46 | + verifier_crash_tables(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - return 1; |
|
| 49 | + return 1; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -63,33 +63,33 @@ discard block |
||
| 63 | 63 | * des tables qui ont crashé. |
| 64 | 64 | */ |
| 65 | 65 | function verifier_crash_tables() { |
| 66 | - if (spip_connect()) { |
|
| 67 | - include_spip('base/serial'); |
|
| 68 | - include_spip('base/auxiliaires'); |
|
| 69 | - $crash = []; |
|
| 70 | - foreach (['tables_principales', 'tables_auxiliaires'] as $com) { |
|
| 71 | - foreach ($GLOBALS[$com] as $table => $desc) { |
|
| 72 | - if ( |
|
| 73 | - !sql_select('*', $table, '', '', '', 1) |
|
| 74 | - and !defined('spip_interdire_cache') |
|
| 75 | - ) { # cas "LOST CONNECTION" |
|
| 76 | - $crash[] = $table; |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - #$crash[] = 'test'; |
|
| 81 | - if ($crash) { |
|
| 82 | - ecrire_meta('message_crash_tables', serialize($crash)); |
|
| 83 | - spip_log('crash des tables', 'err'); |
|
| 84 | - spip_log($crash, 'err'); |
|
| 85 | - } else { |
|
| 86 | - effacer_meta('message_crash_tables'); |
|
| 87 | - } |
|
| 66 | + if (spip_connect()) { |
|
| 67 | + include_spip('base/serial'); |
|
| 68 | + include_spip('base/auxiliaires'); |
|
| 69 | + $crash = []; |
|
| 70 | + foreach (['tables_principales', 'tables_auxiliaires'] as $com) { |
|
| 71 | + foreach ($GLOBALS[$com] as $table => $desc) { |
|
| 72 | + if ( |
|
| 73 | + !sql_select('*', $table, '', '', '', 1) |
|
| 74 | + and !defined('spip_interdire_cache') |
|
| 75 | + ) { # cas "LOST CONNECTION" |
|
| 76 | + $crash[] = $table; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + #$crash[] = 'test'; |
|
| 81 | + if ($crash) { |
|
| 82 | + ecrire_meta('message_crash_tables', serialize($crash)); |
|
| 83 | + spip_log('crash des tables', 'err'); |
|
| 84 | + spip_log($crash, 'err'); |
|
| 85 | + } else { |
|
| 86 | + effacer_meta('message_crash_tables'); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return $crash; |
|
| 90 | - } |
|
| 89 | + return $crash; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return false; |
|
| 92 | + return false; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | 107 | function message_crash_tables() { |
| 108 | - if ($crash = verifier_crash_tables()) { |
|
| 109 | - return |
|
| 110 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 111 | - . ' <tt>' . join(', ', $crash) . '</tt><br />' |
|
| 112 | - . generer_form_ecrire( |
|
| 113 | - 'base_repair', |
|
| 114 | - _T('texte_crash_base'), |
|
| 115 | - '', |
|
| 116 | - _T('bouton_tenter_recuperation') |
|
| 117 | - ); |
|
| 118 | - } |
|
| 108 | + if ($crash = verifier_crash_tables()) { |
|
| 109 | + return |
|
| 110 | + '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 111 | + . ' <tt>' . join(', ', $crash) . '</tt><br />' |
|
| 112 | + . generer_form_ecrire( |
|
| 113 | + 'base_repair', |
|
| 114 | + _T('texte_crash_base'), |
|
| 115 | + '', |
|
| 116 | + _T('bouton_tenter_recuperation') |
|
| 117 | + ); |
|
| 118 | + } |
|
| 119 | 119 | } |
@@ -107,8 +107,8 @@ |
||
| 107 | 107 | function message_crash_tables() { |
| 108 | 108 | if ($crash = verifier_crash_tables()) { |
| 109 | 109 | return |
| 110 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 111 | - . ' <tt>' . join(', ', $crash) . '</tt><br />' |
|
| 110 | + '<strong>'._T('texte_recuperer_base').'</strong><br />' |
|
| 111 | + . ' <tt>'.join(', ', $crash).'</tt><br />' |
|
| 112 | 112 | . generer_form_ecrire( |
| 113 | 113 | 'base_repair', |
| 114 | 114 | _T('texte_crash_base'), |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @package SPIP\Core\Drapeaux\Edition |
| 31 | 31 | **/ |
| 32 | 32 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 33 | - return; |
|
| 33 | + return; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
@@ -45,46 +45,46 @@ discard block |
||
| 45 | 45 | * `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()` |
| 46 | 46 | **/ |
| 47 | 47 | function lire_tableau_edition() { |
| 48 | - $edition = @unserialize($GLOBALS['meta']['drapeau_edition']); |
|
| 49 | - if (!$edition) { |
|
| 50 | - return []; |
|
| 51 | - } |
|
| 52 | - $changed = false; |
|
| 48 | + $edition = @unserialize($GLOBALS['meta']['drapeau_edition']); |
|
| 49 | + if (!$edition) { |
|
| 50 | + return []; |
|
| 51 | + } |
|
| 52 | + $changed = false; |
|
| 53 | 53 | |
| 54 | - $bon_pour_le_service = time() - 3600; |
|
| 55 | - // parcourir le tableau et virer les vieux |
|
| 56 | - foreach ($edition as $objet => $data) { |
|
| 57 | - if (!is_array($data)) { |
|
| 58 | - unset($edition[$objet]); |
|
| 59 | - } // vieille version |
|
| 60 | - else { |
|
| 61 | - foreach ($data as $id => $tab) { |
|
| 62 | - if (!is_array($tab)) { |
|
| 63 | - unset($edition[$objet][$tab]); |
|
| 64 | - } // vieille version |
|
| 65 | - else { |
|
| 66 | - foreach ($tab as $n => $duo) { |
|
| 67 | - if (current($duo) < $bon_pour_le_service) { |
|
| 68 | - unset($edition[$objet][$id][$n]); |
|
| 69 | - $changed = true; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - if (!$edition[$objet][$id]) { |
|
| 74 | - unset($edition[$objet][$id]); |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - if (!$edition[$objet]) { |
|
| 79 | - unset($edition[$objet]); |
|
| 80 | - } |
|
| 81 | - } |
|
| 54 | + $bon_pour_le_service = time() - 3600; |
|
| 55 | + // parcourir le tableau et virer les vieux |
|
| 56 | + foreach ($edition as $objet => $data) { |
|
| 57 | + if (!is_array($data)) { |
|
| 58 | + unset($edition[$objet]); |
|
| 59 | + } // vieille version |
|
| 60 | + else { |
|
| 61 | + foreach ($data as $id => $tab) { |
|
| 62 | + if (!is_array($tab)) { |
|
| 63 | + unset($edition[$objet][$tab]); |
|
| 64 | + } // vieille version |
|
| 65 | + else { |
|
| 66 | + foreach ($tab as $n => $duo) { |
|
| 67 | + if (current($duo) < $bon_pour_le_service) { |
|
| 68 | + unset($edition[$objet][$id][$n]); |
|
| 69 | + $changed = true; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + if (!$edition[$objet][$id]) { |
|
| 74 | + unset($edition[$objet][$id]); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + if (!$edition[$objet]) { |
|
| 79 | + unset($edition[$objet]); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - if ($changed) { |
|
| 84 | - ecrire_tableau_edition($edition); |
|
| 85 | - } |
|
| 83 | + if ($changed) { |
|
| 84 | + ecrire_tableau_edition($edition); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - return $edition; |
|
| 87 | + return $edition; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()` |
| 98 | 98 | **/ |
| 99 | 99 | function ecrire_tableau_edition($edition) { |
| 100 | - ecrire_meta('drapeau_edition', serialize($edition)); |
|
| 100 | + ecrire_meta('drapeau_edition', serialize($edition)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -117,24 +117,24 @@ discard block |
||
| 117 | 117 | * Type d'objet édité |
| 118 | 118 | */ |
| 119 | 119 | function signale_edition($id, $auteur, $type = 'article') { |
| 120 | - include_spip('base/objets'); |
|
| 121 | - include_spip('inc/filtres'); |
|
| 122 | - if (objet_info($type, 'editable') !== 'oui') { |
|
| 123 | - return; |
|
| 124 | - } |
|
| 120 | + include_spip('base/objets'); |
|
| 121 | + include_spip('inc/filtres'); |
|
| 122 | + if (objet_info($type, 'editable') !== 'oui') { |
|
| 123 | + return; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - $edition = lire_tableau_edition(); |
|
| 127 | - if (isset($auteur['id_auteur']) and $id_a = $auteur['id_auteur']) { |
|
| 128 | - $nom = $auteur['nom']; |
|
| 129 | - } else { |
|
| 130 | - $nom = $id_a = $GLOBALS['ip']; |
|
| 131 | - } |
|
| 126 | + $edition = lire_tableau_edition(); |
|
| 127 | + if (isset($auteur['id_auteur']) and $id_a = $auteur['id_auteur']) { |
|
| 128 | + $nom = $auteur['nom']; |
|
| 129 | + } else { |
|
| 130 | + $nom = $id_a = $GLOBALS['ip']; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) { |
|
| 134 | - $edition[$type][$id] = []; |
|
| 135 | - } |
|
| 136 | - $edition[$type][$id][$id_a][$nom] = time(); |
|
| 137 | - ecrire_tableau_edition($edition); |
|
| 133 | + if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) { |
|
| 134 | + $edition[$type][$id] = []; |
|
| 135 | + } |
|
| 136 | + $edition[$type][$id][$id_a][$nom] = time(); |
|
| 137 | + ecrire_tableau_edition($edition); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | function qui_edite($id, $type = 'article') { |
| 153 | 153 | |
| 154 | - $edition = lire_tableau_edition(); |
|
| 154 | + $edition = lire_tableau_edition(); |
|
| 155 | 155 | |
| 156 | - return empty($edition[$type][$id]) ? [] : $edition[$type][$id]; |
|
| 156 | + return empty($edition[$type][$id]) ? [] : $edition[$type][$id]; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -167,22 +167,22 @@ discard block |
||
| 167 | 167 | * Liste de tableaux `['nom_auteur_modif' => x|y|z, 'date_diff' => n]` |
| 168 | 168 | */ |
| 169 | 169 | function mention_qui_edite($id, $type = 'article') { |
| 170 | - $modif = qui_edite($id, $type); |
|
| 171 | - unset($modif[$GLOBALS['visiteur_session']['id_auteur']]); |
|
| 170 | + $modif = qui_edite($id, $type); |
|
| 171 | + unset($modif[$GLOBALS['visiteur_session']['id_auteur']]); |
|
| 172 | 172 | |
| 173 | - if ($modif) { |
|
| 174 | - $quand = 0; |
|
| 175 | - foreach ($modif as $duo) { |
|
| 176 | - $auteurs[] = typo(key($duo)); |
|
| 177 | - $quand = max($quand, current($duo)); |
|
| 178 | - } |
|
| 173 | + if ($modif) { |
|
| 174 | + $quand = 0; |
|
| 175 | + foreach ($modif as $duo) { |
|
| 176 | + $auteurs[] = typo(key($duo)); |
|
| 177 | + $quand = max($quand, current($duo)); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - // format lie a la chaine de langue 'avis_article_modifie' |
|
| 181 | - return [ |
|
| 182 | - 'nom_auteur_modif' => join(' | ', $auteurs), |
|
| 183 | - 'date_diff' => ceil((time() - $quand) / 60) |
|
| 184 | - ]; |
|
| 185 | - } |
|
| 180 | + // format lie a la chaine de langue 'avis_article_modifie' |
|
| 181 | + return [ |
|
| 182 | + 'nom_auteur_modif' => join(' | ', $auteurs), |
|
| 183 | + 'date_diff' => ceil((time() - $quand) / 60) |
|
| 184 | + ]; |
|
| 185 | + } |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -196,25 +196,25 @@ discard block |
||
| 196 | 196 | * Liste de tableaux `['objet' => x, 'id_objet' => n]` |
| 197 | 197 | */ |
| 198 | 198 | function liste_drapeau_edition($id_auteur) { |
| 199 | - $edition = lire_tableau_edition(); |
|
| 200 | - $objets_ouverts = []; |
|
| 199 | + $edition = lire_tableau_edition(); |
|
| 200 | + $objets_ouverts = []; |
|
| 201 | 201 | |
| 202 | - foreach ($edition as $objet => $data) { |
|
| 203 | - foreach ($data as $id => $auteurs) { |
|
| 204 | - if ( |
|
| 205 | - isset($auteurs[$id_auteur]) |
|
| 206 | - and is_array($auteurs[$id_auteur]) // precaution |
|
| 207 | - and (array_pop($auteurs[$id_auteur]) > time() - 3600) |
|
| 208 | - ) { |
|
| 209 | - $objets_ouverts[] = [ |
|
| 210 | - 'objet' => $objet, |
|
| 211 | - 'id_objet' => $id, |
|
| 212 | - ]; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - } |
|
| 202 | + foreach ($edition as $objet => $data) { |
|
| 203 | + foreach ($data as $id => $auteurs) { |
|
| 204 | + if ( |
|
| 205 | + isset($auteurs[$id_auteur]) |
|
| 206 | + and is_array($auteurs[$id_auteur]) // precaution |
|
| 207 | + and (array_pop($auteurs[$id_auteur]) > time() - 3600) |
|
| 208 | + ) { |
|
| 209 | + $objets_ouverts[] = [ |
|
| 210 | + 'objet' => $objet, |
|
| 211 | + 'id_objet' => $id, |
|
| 212 | + ]; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - return $objets_ouverts; |
|
| 217 | + return $objets_ouverts; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -227,15 +227,15 @@ discard block |
||
| 227 | 227 | * @return void |
| 228 | 228 | */ |
| 229 | 229 | function debloquer_tous($id_auteur) { |
| 230 | - $edition = lire_tableau_edition(); |
|
| 231 | - foreach ($edition as $objet => $data) { |
|
| 232 | - foreach ($data as $id => $auteurs) { |
|
| 233 | - if (isset($auteurs[$id_auteur])) { |
|
| 234 | - unset($edition[$objet][$id][$id_auteur]); |
|
| 235 | - ecrire_tableau_edition($edition); |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - } |
|
| 230 | + $edition = lire_tableau_edition(); |
|
| 231 | + foreach ($edition as $objet => $data) { |
|
| 232 | + foreach ($data as $id => $auteurs) { |
|
| 233 | + if (isset($auteurs[$id_auteur])) { |
|
| 234 | + unset($edition[$objet][$id][$id_auteur]); |
|
| 235 | + ecrire_tableau_edition($edition); |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -253,19 +253,19 @@ discard block |
||
| 253 | 253 | * @return void |
| 254 | 254 | */ |
| 255 | 255 | function debloquer_edition($id_auteur, $id_objet, $type = 'article') { |
| 256 | - $edition = lire_tableau_edition(); |
|
| 256 | + $edition = lire_tableau_edition(); |
|
| 257 | 257 | |
| 258 | - foreach ($edition as $objet => $data) { |
|
| 259 | - if ($objet == $type) { |
|
| 260 | - foreach ($data as $id => $auteurs) { |
|
| 261 | - if ( |
|
| 262 | - $id == $id_objet |
|
| 263 | - and isset($auteurs[$id_auteur]) |
|
| 264 | - ) { |
|
| 265 | - unset($edition[$objet][$id][$id_auteur]); |
|
| 266 | - ecrire_tableau_edition($edition); |
|
| 267 | - } |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 258 | + foreach ($edition as $objet => $data) { |
|
| 259 | + if ($objet == $type) { |
|
| 260 | + foreach ($data as $id => $auteurs) { |
|
| 261 | + if ( |
|
| 262 | + $id == $id_objet |
|
| 263 | + and isset($auteurs[$id_auteur]) |
|
| 264 | + ) { |
|
| 265 | + unset($edition[$objet][$id][$id_auteur]); |
|
| 266 | + ecrire_tableau_edition($edition); |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | 271 | } |