@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | return sql_fetsel( |
| 21 | 21 | '*', |
| 22 | 22 | 'spip_auteurs', |
| 23 | - ['id_auteur=' . (int) $id_auteur, "statut<>'5poubelle'", "pass<>''", "login<>''"] |
|
| 23 | + ['id_auteur='.(int) $id_auteur, "statut<>'5poubelle'", "pass<>''", "login<>''"] |
|
| 24 | 24 | ); |
| 25 | 25 | } elseif ($jeton) { |
| 26 | 26 | include_spip('action/inscrire_auteur'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if ($auteur) { |
| 60 | 60 | $valeurs['id_auteur'] = $id_auteur; // a toutes fins utiles pour le formulaire |
| 61 | 61 | if ($jeton) { |
| 62 | - $valeurs['_hidden'] = '<input type="hidden" name="p" value="' . $jeton . '" />'; |
|
| 62 | + $valeurs['_hidden'] = '<input type="hidden" name="p" value="'.$jeton.'" />'; |
|
| 63 | 63 | } |
| 64 | 64 | } else { |
| 65 | 65 | $valeurs['message_erreur'] = _T('pass_erreur_code_inconnu'); |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | 'id_auteur', |
| 151 | 151 | 'spip_auteurs', |
| 152 | 152 | [ |
| 153 | - '(email=' . sql_quote($row['email']) . ' or login=' . sql_quote($row['email']) . ')', |
|
| 154 | - 'id_auteur != ' . $id_auteur |
|
| 153 | + '(email='.sql_quote($row['email']).' or login='.sql_quote($row['email']).')', |
|
| 154 | + 'id_auteur != '.$id_auteur |
|
| 155 | 155 | ], |
| 156 | 156 | '', |
| 157 | 157 | '', |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | else { |
| 165 | 165 | $identifiant = $row['login']; |
| 166 | 166 | } |
| 167 | - $res['message_ok'] = '<b>' . _T('pass_nouveau_enregistre') . '</b>' . |
|
| 168 | - '<br />' . _T('pass_rappel_login', ['login' => $identifiant]); |
|
| 167 | + $res['message_ok'] = '<b>'._T('pass_nouveau_enregistre').'</b>'. |
|
| 168 | + '<br />'._T('pass_rappel_login', ['login' => $identifiant]); |
|
| 169 | 169 | |
| 170 | 170 | include_spip('inc/auth'); |
| 171 | 171 | $auth = auth_identifier_login($row['login'], $oubli); |
| 172 | 172 | if (!is_array($auth)) { |
| 173 | - spip_log('Erreur identification ' . $row['login'] . " après changement de mot de passe: $auth", _LOG_ERREUR); |
|
| 173 | + spip_log('Erreur identification '.$row['login']." après changement de mot de passe: $auth", _LOG_ERREUR); |
|
| 174 | 174 | } |
| 175 | 175 | elseif ($auth['id_auteur'] == $id_auteur) { |
| 176 | 176 | auth_loger($auth); |
@@ -171,8 +171,7 @@ |
||
| 171 | 171 | $auth = auth_identifier_login($row['login'], $oubli); |
| 172 | 172 | if (!is_array($auth)) { |
| 173 | 173 | spip_log('Erreur identification ' . $row['login'] . " après changement de mot de passe: $auth", _LOG_ERREUR); |
| 174 | - } |
|
| 175 | - elseif ($auth['id_auteur'] == $id_auteur) { |
|
| 174 | + } elseif ($auth['id_auteur'] == $id_auteur) { |
|
| 176 | 175 | auth_loger($auth); |
| 177 | 176 | } |
| 178 | 177 | } |
@@ -10,31 +10,31 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('base/abstract_sql'); |
| 17 | 17 | |
| 18 | 18 | function retrouve_auteur($id_auteur, $jeton = '') { |
| 19 | - if ($id_auteur = (int) $id_auteur) { |
|
| 20 | - return sql_fetsel( |
|
| 21 | - '*', |
|
| 22 | - 'spip_auteurs', |
|
| 23 | - ['id_auteur=' . (int) $id_auteur, "statut<>'5poubelle'", "pass<>''", "login<>''"] |
|
| 24 | - ); |
|
| 25 | - } elseif ($jeton) { |
|
| 26 | - include_spip('action/inscrire_auteur'); |
|
| 27 | - if ( |
|
| 28 | - ($auteur = auteur_verifier_jeton($jeton)) |
|
| 29 | - && $auteur['statut'] != '5poubelle' |
|
| 30 | - && $auteur['pass'] != '' |
|
| 31 | - && $auteur['login'] != '' |
|
| 32 | - ) { |
|
| 33 | - return $auteur; |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - return false; |
|
| 19 | + if ($id_auteur = (int) $id_auteur) { |
|
| 20 | + return sql_fetsel( |
|
| 21 | + '*', |
|
| 22 | + 'spip_auteurs', |
|
| 23 | + ['id_auteur=' . (int) $id_auteur, "statut<>'5poubelle'", "pass<>''", "login<>''"] |
|
| 24 | + ); |
|
| 25 | + } elseif ($jeton) { |
|
| 26 | + include_spip('action/inscrire_auteur'); |
|
| 27 | + if ( |
|
| 28 | + ($auteur = auteur_verifier_jeton($jeton)) |
|
| 29 | + && $auteur['statut'] != '5poubelle' |
|
| 30 | + && $auteur['pass'] != '' |
|
| 31 | + && $auteur['login'] != '' |
|
| 32 | + ) { |
|
| 33 | + return $auteur; |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + return false; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // chargement des valeurs par defaut des champs du formulaire |
@@ -49,30 +49,30 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function formulaires_mot_de_passe_charger_dist($id_auteur = null, $jeton = null) { |
| 51 | 51 | |
| 52 | - $valeurs = []; |
|
| 53 | - // compatibilite anciens appels du formulaire |
|
| 54 | - if (is_null($jeton)) { |
|
| 55 | - $jeton = _request('p'); |
|
| 56 | - } |
|
| 57 | - $auteur = retrouve_auteur($id_auteur, $jeton); |
|
| 58 | - |
|
| 59 | - if ($auteur) { |
|
| 60 | - $valeurs['id_auteur'] = $id_auteur; // a toutes fins utiles pour le formulaire |
|
| 61 | - if ($jeton) { |
|
| 62 | - $valeurs['_hidden'] = '<input type="hidden" name="p" value="' . $jeton . '" />'; |
|
| 63 | - } |
|
| 64 | - } else { |
|
| 65 | - $valeurs['message_erreur'] = _T('pass_erreur_code_inconnu'); |
|
| 66 | - $valeurs['editable'] = false; // pas de saisie |
|
| 67 | - } |
|
| 68 | - $valeurs['oubli'] = ''; |
|
| 69 | - // le champ login n'est pas utilise, mais il est destine aux navigateurs smarts |
|
| 70 | - // qui veulent remplir le formulaire avec login/mot de passe |
|
| 71 | - // et qui sinon remplissent le champ nobot (autocomplete=off n'est pas une option, certains navigateurs l'ignorant) |
|
| 72 | - $valeurs['login'] = ''; |
|
| 73 | - $valeurs['nobot'] = ''; |
|
| 74 | - |
|
| 75 | - return $valeurs; |
|
| 52 | + $valeurs = []; |
|
| 53 | + // compatibilite anciens appels du formulaire |
|
| 54 | + if (is_null($jeton)) { |
|
| 55 | + $jeton = _request('p'); |
|
| 56 | + } |
|
| 57 | + $auteur = retrouve_auteur($id_auteur, $jeton); |
|
| 58 | + |
|
| 59 | + if ($auteur) { |
|
| 60 | + $valeurs['id_auteur'] = $id_auteur; // a toutes fins utiles pour le formulaire |
|
| 61 | + if ($jeton) { |
|
| 62 | + $valeurs['_hidden'] = '<input type="hidden" name="p" value="' . $jeton . '" />'; |
|
| 63 | + } |
|
| 64 | + } else { |
|
| 65 | + $valeurs['message_erreur'] = _T('pass_erreur_code_inconnu'); |
|
| 66 | + $valeurs['editable'] = false; // pas de saisie |
|
| 67 | + } |
|
| 68 | + $valeurs['oubli'] = ''; |
|
| 69 | + // le champ login n'est pas utilise, mais il est destine aux navigateurs smarts |
|
| 70 | + // qui veulent remplir le formulaire avec login/mot de passe |
|
| 71 | + // et qui sinon remplissent le champ nobot (autocomplete=off n'est pas une option, certains navigateurs l'ignorant) |
|
| 72 | + $valeurs['login'] = ''; |
|
| 73 | + $valeurs['nobot'] = ''; |
|
| 74 | + |
|
| 75 | + return $valeurs; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -83,36 +83,36 @@ discard block |
||
| 83 | 83 | * @param int $id_auteur |
| 84 | 84 | */ |
| 85 | 85 | function formulaires_mot_de_passe_verifier_dist($id_auteur = null, $jeton = null) { |
| 86 | - $erreurs = []; |
|
| 87 | - if (!_request('oubli')) { |
|
| 88 | - $erreurs['oubli'] = _T('info_obligatoire'); |
|
| 89 | - } else { |
|
| 90 | - if (strlen((string) ($p = _request('oubli'))) < _PASS_LONGUEUR_MINI) { |
|
| 91 | - $erreurs['oubli'] = _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]); |
|
| 92 | - } else { |
|
| 93 | - if (!is_null($c = _request('oubli_confirm'))) { |
|
| 94 | - if (!$c) { |
|
| 95 | - $erreurs['oubli_confirm'] = _T('info_obligatoire'); |
|
| 96 | - } elseif ($c !== $p) { |
|
| 97 | - $erreurs['oubli'] = _T('info_passes_identiques'); |
|
| 98 | - } |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - if (isset($erreurs['oubli'])) { |
|
| 103 | - set_request('oubli'); |
|
| 104 | - set_request('oubli_confirm'); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - if (_request('nobot')) { |
|
| 108 | - $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici'); |
|
| 109 | - } |
|
| 110 | - // precaution |
|
| 111 | - if (_request('login')) { |
|
| 112 | - set_request('login'); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - return $erreurs; |
|
| 86 | + $erreurs = []; |
|
| 87 | + if (!_request('oubli')) { |
|
| 88 | + $erreurs['oubli'] = _T('info_obligatoire'); |
|
| 89 | + } else { |
|
| 90 | + if (strlen((string) ($p = _request('oubli'))) < _PASS_LONGUEUR_MINI) { |
|
| 91 | + $erreurs['oubli'] = _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]); |
|
| 92 | + } else { |
|
| 93 | + if (!is_null($c = _request('oubli_confirm'))) { |
|
| 94 | + if (!$c) { |
|
| 95 | + $erreurs['oubli_confirm'] = _T('info_obligatoire'); |
|
| 96 | + } elseif ($c !== $p) { |
|
| 97 | + $erreurs['oubli'] = _T('info_passes_identiques'); |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + if (isset($erreurs['oubli'])) { |
|
| 103 | + set_request('oubli'); |
|
| 104 | + set_request('oubli_confirm'); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + if (_request('nobot')) { |
|
| 108 | + $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici'); |
|
| 109 | + } |
|
| 110 | + // precaution |
|
| 111 | + if (_request('login')) { |
|
| 112 | + set_request('login'); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + return $erreurs; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -122,61 +122,61 @@ discard block |
||
| 122 | 122 | * @param int $id_auteur |
| 123 | 123 | */ |
| 124 | 124 | function formulaires_mot_de_passe_traiter_dist($id_auteur = null, $jeton = null) { |
| 125 | - $res = ['message_ok' => '']; |
|
| 126 | - refuser_traiter_formulaire_ajax(); // puisqu'on va loger l'auteur a la volee (c'est bonus) |
|
| 127 | - |
|
| 128 | - // compatibilite anciens appels du formulaire |
|
| 129 | - if (is_null($jeton)) { |
|
| 130 | - $jeton = _request('p'); |
|
| 131 | - } |
|
| 132 | - $row = retrouve_auteur($id_auteur, $jeton); |
|
| 133 | - |
|
| 134 | - if ( |
|
| 135 | - $row |
|
| 136 | - && ($id_auteur = $row['id_auteur']) |
|
| 137 | - && ($oubli = _request('oubli')) |
|
| 138 | - ) { |
|
| 139 | - include_spip('action/editer_auteur'); |
|
| 140 | - include_spip('action/inscrire_auteur'); |
|
| 141 | - if ($err = auteur_modifier($id_auteur, ['pass' => $oubli])) { |
|
| 142 | - $res = ['message_erreur' => $err]; |
|
| 143 | - } else { |
|
| 144 | - auteur_effacer_jeton($id_auteur); |
|
| 145 | - |
|
| 146 | - // Par défaut, on rappelle de s'identifier avec son email s'il existe |
|
| 147 | - // et qu'il n'est PAS utilisé par quelqu'un d'autre |
|
| 148 | - if ( |
|
| 149 | - $row['email'] && !sql_fetsel( |
|
| 150 | - 'id_auteur', |
|
| 151 | - 'spip_auteurs', |
|
| 152 | - [ |
|
| 153 | - '(email=' . sql_quote($row['email']) . ' or login=' . sql_quote($row['email']) . ')', |
|
| 154 | - 'id_auteur != ' . $id_auteur |
|
| 155 | - ], |
|
| 156 | - '', |
|
| 157 | - '', |
|
| 158 | - '0,1' |
|
| 159 | - ) |
|
| 160 | - ) { |
|
| 161 | - $identifiant = $row['email']; |
|
| 162 | - } |
|
| 163 | - // Sinon on dit d'utiliser le login |
|
| 164 | - else { |
|
| 165 | - $identifiant = $row['login']; |
|
| 166 | - } |
|
| 167 | - $res['message_ok'] = '<b>' . _T('pass_nouveau_enregistre') . '</b>' . |
|
| 168 | - '<br />' . _T('pass_rappel_login', ['login' => $identifiant]); |
|
| 169 | - |
|
| 170 | - include_spip('inc/auth'); |
|
| 171 | - $auth = auth_identifier_login($row['login'], $oubli); |
|
| 172 | - if (!is_array($auth)) { |
|
| 173 | - spip_log('Erreur identification ' . $row['login'] . " après changement de mot de passe: $auth", _LOG_ERREUR); |
|
| 174 | - } |
|
| 175 | - elseif ($auth['id_auteur'] == $id_auteur) { |
|
| 176 | - auth_loger($auth); |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - return $res; |
|
| 125 | + $res = ['message_ok' => '']; |
|
| 126 | + refuser_traiter_formulaire_ajax(); // puisqu'on va loger l'auteur a la volee (c'est bonus) |
|
| 127 | + |
|
| 128 | + // compatibilite anciens appels du formulaire |
|
| 129 | + if (is_null($jeton)) { |
|
| 130 | + $jeton = _request('p'); |
|
| 131 | + } |
|
| 132 | + $row = retrouve_auteur($id_auteur, $jeton); |
|
| 133 | + |
|
| 134 | + if ( |
|
| 135 | + $row |
|
| 136 | + && ($id_auteur = $row['id_auteur']) |
|
| 137 | + && ($oubli = _request('oubli')) |
|
| 138 | + ) { |
|
| 139 | + include_spip('action/editer_auteur'); |
|
| 140 | + include_spip('action/inscrire_auteur'); |
|
| 141 | + if ($err = auteur_modifier($id_auteur, ['pass' => $oubli])) { |
|
| 142 | + $res = ['message_erreur' => $err]; |
|
| 143 | + } else { |
|
| 144 | + auteur_effacer_jeton($id_auteur); |
|
| 145 | + |
|
| 146 | + // Par défaut, on rappelle de s'identifier avec son email s'il existe |
|
| 147 | + // et qu'il n'est PAS utilisé par quelqu'un d'autre |
|
| 148 | + if ( |
|
| 149 | + $row['email'] && !sql_fetsel( |
|
| 150 | + 'id_auteur', |
|
| 151 | + 'spip_auteurs', |
|
| 152 | + [ |
|
| 153 | + '(email=' . sql_quote($row['email']) . ' or login=' . sql_quote($row['email']) . ')', |
|
| 154 | + 'id_auteur != ' . $id_auteur |
|
| 155 | + ], |
|
| 156 | + '', |
|
| 157 | + '', |
|
| 158 | + '0,1' |
|
| 159 | + ) |
|
| 160 | + ) { |
|
| 161 | + $identifiant = $row['email']; |
|
| 162 | + } |
|
| 163 | + // Sinon on dit d'utiliser le login |
|
| 164 | + else { |
|
| 165 | + $identifiant = $row['login']; |
|
| 166 | + } |
|
| 167 | + $res['message_ok'] = '<b>' . _T('pass_nouveau_enregistre') . '</b>' . |
|
| 168 | + '<br />' . _T('pass_rappel_login', ['login' => $identifiant]); |
|
| 169 | + |
|
| 170 | + include_spip('inc/auth'); |
|
| 171 | + $auth = auth_identifier_login($row['login'], $oubli); |
|
| 172 | + if (!is_array($auth)) { |
|
| 173 | + spip_log('Erreur identification ' . $row['login'] . " après changement de mot de passe: $auth", _LOG_ERREUR); |
|
| 174 | + } |
|
| 175 | + elseif ($auth['id_auteur'] == $id_auteur) { |
|
| 176 | + auth_loger($auth); |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + return $res; |
|
| 182 | 182 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $row = sql_fetsel( |
| 109 | 109 | 'statut, id_auteur, login, email', |
| 110 | 110 | 'spip_auteurs', |
| 111 | - 'email=' . sql_quote($declaration['email']) |
|
| 111 | + 'email='.sql_quote($declaration['email']) |
|
| 112 | 112 | ) |
| 113 | 113 | ) { |
| 114 | 114 | if ($row['statut'] == '5poubelle' && empty($declaration['pass'])) { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | - spip_log($row['id_auteur'] . ' veut se resinscrire'); |
|
| 127 | + spip_log($row['id_auteur'].' veut se resinscrire'); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -39,26 +39,26 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | function formulaires_inscription_charger_dist($mode = '', $options = [], $retour = '') { |
| 41 | 41 | |
| 42 | - $id = ($options['id'] ?? 0); |
|
| 43 | - |
|
| 44 | - // fournir le mode de la config ou tester si l'argument du formulaire est un mode accepte par celle-ci |
|
| 45 | - // pas de formulaire si le mode est interdit |
|
| 46 | - include_spip('inc/autoriser'); |
|
| 47 | - if (!autoriser('inscrireauteur', $mode, $id)) { |
|
| 48 | - return false; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - // pas de formulaire si on a déjà une session avec un statut égal ou meilleur au mode |
|
| 52 | - if (isset($GLOBALS['visiteur_session']['statut']) && $GLOBALS['visiteur_session']['statut'] <= $mode) { |
|
| 53 | - return false; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - return [ |
|
| 57 | - 'nom_inscription' => '', |
|
| 58 | - 'mail_inscription' => '', |
|
| 59 | - 'id' => $id, |
|
| 60 | - '_mode' => $mode |
|
| 61 | - ]; |
|
| 42 | + $id = ($options['id'] ?? 0); |
|
| 43 | + |
|
| 44 | + // fournir le mode de la config ou tester si l'argument du formulaire est un mode accepte par celle-ci |
|
| 45 | + // pas de formulaire si le mode est interdit |
|
| 46 | + include_spip('inc/autoriser'); |
|
| 47 | + if (!autoriser('inscrireauteur', $mode, $id)) { |
|
| 48 | + return false; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + // pas de formulaire si on a déjà une session avec un statut égal ou meilleur au mode |
|
| 52 | + if (isset($GLOBALS['visiteur_session']['statut']) && $GLOBALS['visiteur_session']['statut'] <= $mode) { |
|
| 53 | + return false; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + return [ |
|
| 57 | + 'nom_inscription' => '', |
|
| 58 | + 'mail_inscription' => '', |
|
| 59 | + 'id' => $id, |
|
| 60 | + '_mode' => $mode |
|
| 61 | + ]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
@@ -71,65 +71,65 @@ discard block |
||
| 71 | 71 | * @return array |
| 72 | 72 | */ |
| 73 | 73 | function formulaires_inscription_verifier_dist($mode = '', $options = [], $retour = '') { |
| 74 | - set_request('_upgrade_auteur'); // securite |
|
| 75 | - include_spip('inc/filtres'); |
|
| 76 | - $erreurs = []; |
|
| 77 | - |
|
| 78 | - $id = ($options['id'] ?? 0); |
|
| 79 | - |
|
| 80 | - include_spip('inc/autoriser'); |
|
| 81 | - if (!autoriser('inscrireauteur', $mode, $id) || strlen((string) _request('nobot')) > 0) { |
|
| 82 | - $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici'); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - if (!$nom = _request('nom_inscription')) { |
|
| 86 | - $erreurs['nom_inscription'] = _T('info_obligatoire'); |
|
| 87 | - } elseif (!nom_acceptable(_request('nom_inscription'))) { |
|
| 88 | - $erreurs['nom_inscription'] = _T('ecrire:info_nom_pas_conforme'); |
|
| 89 | - } |
|
| 90 | - if (!$mail = (string) _request('mail_inscription')) { |
|
| 91 | - $erreurs['mail_inscription'] = _T('info_obligatoire'); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - // compatibilite avec anciennes fonction surchargeables |
|
| 95 | - // plus de definition par defaut |
|
| 96 | - if ($erreurs === []) { |
|
| 97 | - include_spip('action/inscrire_auteur'); |
|
| 98 | - $f = function_exists('test_inscription') ? 'test_inscription' : 'test_inscription_dist'; |
|
| 99 | - $declaration = $f($mode, $mail, $nom, $options); |
|
| 100 | - if (is_string($declaration)) { |
|
| 101 | - $k = (str_contains($declaration, 'mail')) ? |
|
| 102 | - 'mail_inscription' : 'nom_inscription'; |
|
| 103 | - $erreurs[$k] = _T($declaration); |
|
| 104 | - } else { |
|
| 105 | - include_spip('base/abstract_sql'); |
|
| 106 | - |
|
| 107 | - if ( |
|
| 108 | - $row = sql_fetsel( |
|
| 109 | - 'statut, id_auteur, login, email', |
|
| 110 | - 'spip_auteurs', |
|
| 111 | - 'email=' . sql_quote($declaration['email']) |
|
| 112 | - ) |
|
| 113 | - ) { |
|
| 114 | - if ($row['statut'] == '5poubelle' && empty($declaration['pass'])) { |
|
| 115 | - // irrecuperable |
|
| 116 | - $erreurs['message_erreur'] = _T('form_forum_access_refuse'); |
|
| 117 | - } else { |
|
| 118 | - if ($row['statut'] != 'nouveau' && empty($declaration['pass'])) { |
|
| 119 | - if ((int) $row['statut'] > (int) $mode) { |
|
| 120 | - set_request('_upgrade_auteur', $row['id_auteur']); |
|
| 121 | - } else { |
|
| 122 | - // deja inscrit |
|
| 123 | - $erreurs['message_erreur'] = _T('form_forum_email_deja_enregistre'); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - spip_log($row['id_auteur'] . ' veut se resinscrire'); |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - return $erreurs; |
|
| 74 | + set_request('_upgrade_auteur'); // securite |
|
| 75 | + include_spip('inc/filtres'); |
|
| 76 | + $erreurs = []; |
|
| 77 | + |
|
| 78 | + $id = ($options['id'] ?? 0); |
|
| 79 | + |
|
| 80 | + include_spip('inc/autoriser'); |
|
| 81 | + if (!autoriser('inscrireauteur', $mode, $id) || strlen((string) _request('nobot')) > 0) { |
|
| 82 | + $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici'); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + if (!$nom = _request('nom_inscription')) { |
|
| 86 | + $erreurs['nom_inscription'] = _T('info_obligatoire'); |
|
| 87 | + } elseif (!nom_acceptable(_request('nom_inscription'))) { |
|
| 88 | + $erreurs['nom_inscription'] = _T('ecrire:info_nom_pas_conforme'); |
|
| 89 | + } |
|
| 90 | + if (!$mail = (string) _request('mail_inscription')) { |
|
| 91 | + $erreurs['mail_inscription'] = _T('info_obligatoire'); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + // compatibilite avec anciennes fonction surchargeables |
|
| 95 | + // plus de definition par defaut |
|
| 96 | + if ($erreurs === []) { |
|
| 97 | + include_spip('action/inscrire_auteur'); |
|
| 98 | + $f = function_exists('test_inscription') ? 'test_inscription' : 'test_inscription_dist'; |
|
| 99 | + $declaration = $f($mode, $mail, $nom, $options); |
|
| 100 | + if (is_string($declaration)) { |
|
| 101 | + $k = (str_contains($declaration, 'mail')) ? |
|
| 102 | + 'mail_inscription' : 'nom_inscription'; |
|
| 103 | + $erreurs[$k] = _T($declaration); |
|
| 104 | + } else { |
|
| 105 | + include_spip('base/abstract_sql'); |
|
| 106 | + |
|
| 107 | + if ( |
|
| 108 | + $row = sql_fetsel( |
|
| 109 | + 'statut, id_auteur, login, email', |
|
| 110 | + 'spip_auteurs', |
|
| 111 | + 'email=' . sql_quote($declaration['email']) |
|
| 112 | + ) |
|
| 113 | + ) { |
|
| 114 | + if ($row['statut'] == '5poubelle' && empty($declaration['pass'])) { |
|
| 115 | + // irrecuperable |
|
| 116 | + $erreurs['message_erreur'] = _T('form_forum_access_refuse'); |
|
| 117 | + } else { |
|
| 118 | + if ($row['statut'] != 'nouveau' && empty($declaration['pass'])) { |
|
| 119 | + if ((int) $row['statut'] > (int) $mode) { |
|
| 120 | + set_request('_upgrade_auteur', $row['id_auteur']); |
|
| 121 | + } else { |
|
| 122 | + // deja inscrit |
|
| 123 | + $erreurs['message_erreur'] = _T('form_forum_email_deja_enregistre'); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + spip_log($row['id_auteur'] . ' veut se resinscrire'); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + return $erreurs; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -140,51 +140,51 @@ discard block |
||
| 140 | 140 | * @return array |
| 141 | 141 | */ |
| 142 | 142 | function formulaires_inscription_traiter_dist($mode = '', array $options = [], $retour = '') { |
| 143 | - if ($retour) { |
|
| 144 | - refuser_traiter_formulaire_ajax(); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - include_spip('inc/filtres'); |
|
| 148 | - include_spip('inc/autoriser'); |
|
| 149 | - |
|
| 150 | - $id = ($options['id'] ?? 0); |
|
| 151 | - |
|
| 152 | - if (!autoriser('inscrireauteur', $mode, $id)) { |
|
| 153 | - $desc = 'rien a faire ici'; |
|
| 154 | - } else { |
|
| 155 | - if ($id_auteur = _request('_upgrade_auteur')) { |
|
| 156 | - include_spip('action/editer_auteur'); |
|
| 157 | - autoriser_exception('modifier', 'auteur', $id_auteur); |
|
| 158 | - autoriser_exception('instituer', 'auteur', $id_auteur); |
|
| 159 | - auteur_modifier($id_auteur, ['statut' => $mode]); |
|
| 160 | - autoriser_exception('modifier', 'auteur', $id_auteur, false); |
|
| 161 | - autoriser_exception('instituer', 'auteur', $id_auteur, false); |
|
| 162 | - |
|
| 163 | - return ['message_ok' => _T('form_forum_email_deja_enregistre'), 'id_auteur' => $id_auteur]; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - $nom = _request('nom_inscription'); |
|
| 167 | - $mail_complet = _request('mail_inscription'); |
|
| 168 | - |
|
| 169 | - $inscrire_auteur = charger_fonction('inscrire_auteur', 'action'); |
|
| 170 | - $desc = $inscrire_auteur($mode, $mail_complet, $nom, $options); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // erreur ? |
|
| 174 | - if (is_string($desc)) { |
|
| 175 | - return ['message_erreur' => $desc]; |
|
| 176 | - } // OK |
|
| 177 | - else { |
|
| 178 | - $retours = [ |
|
| 179 | - 'message_ok' => _T('form_forum_identifiant_mail'), |
|
| 180 | - 'id_auteur' => $desc['id_auteur'] |
|
| 181 | - ]; |
|
| 182 | - |
|
| 183 | - // Si on demande à rediriger juste après validation du formulaire |
|
| 184 | - if ($retour) { |
|
| 185 | - $retours['redirect'] = $retour; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - return $retours; |
|
| 189 | - } |
|
| 143 | + if ($retour) { |
|
| 144 | + refuser_traiter_formulaire_ajax(); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + include_spip('inc/filtres'); |
|
| 148 | + include_spip('inc/autoriser'); |
|
| 149 | + |
|
| 150 | + $id = ($options['id'] ?? 0); |
|
| 151 | + |
|
| 152 | + if (!autoriser('inscrireauteur', $mode, $id)) { |
|
| 153 | + $desc = 'rien a faire ici'; |
|
| 154 | + } else { |
|
| 155 | + if ($id_auteur = _request('_upgrade_auteur')) { |
|
| 156 | + include_spip('action/editer_auteur'); |
|
| 157 | + autoriser_exception('modifier', 'auteur', $id_auteur); |
|
| 158 | + autoriser_exception('instituer', 'auteur', $id_auteur); |
|
| 159 | + auteur_modifier($id_auteur, ['statut' => $mode]); |
|
| 160 | + autoriser_exception('modifier', 'auteur', $id_auteur, false); |
|
| 161 | + autoriser_exception('instituer', 'auteur', $id_auteur, false); |
|
| 162 | + |
|
| 163 | + return ['message_ok' => _T('form_forum_email_deja_enregistre'), 'id_auteur' => $id_auteur]; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + $nom = _request('nom_inscription'); |
|
| 167 | + $mail_complet = _request('mail_inscription'); |
|
| 168 | + |
|
| 169 | + $inscrire_auteur = charger_fonction('inscrire_auteur', 'action'); |
|
| 170 | + $desc = $inscrire_auteur($mode, $mail_complet, $nom, $options); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // erreur ? |
|
| 174 | + if (is_string($desc)) { |
|
| 175 | + return ['message_erreur' => $desc]; |
|
| 176 | + } // OK |
|
| 177 | + else { |
|
| 178 | + $retours = [ |
|
| 179 | + 'message_ok' => _T('form_forum_identifiant_mail'), |
|
| 180 | + 'id_auteur' => $desc['id_auteur'] |
|
| 181 | + ]; |
|
| 182 | + |
|
| 183 | + // Si on demande à rediriger juste après validation du formulaire |
|
| 184 | + if ($retour) { |
|
| 185 | + $retours['redirect'] = $retour; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + return $retours; |
|
| 189 | + } |
|
| 190 | 190 | } |
@@ -10,98 +10,98 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // chargement des valeurs par defaut des champs du formulaire |
| 17 | 17 | function formulaires_oubli_charger_dist() { |
| 18 | - return ['oubli' => '', 'nobot' => '']; |
|
| 18 | + return ['oubli' => '', 'nobot' => '']; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // https://code.spip.net/@message_oubli |
| 22 | 22 | function message_oubli($email, $param) { |
| 23 | - $r = formulaires_oubli_mail($email); |
|
| 24 | - |
|
| 25 | - if (is_array($r) && $r[1] && $r[1]['statut'] !== '5poubelle' && $r[1]['pass'] !== '') { |
|
| 26 | - include_spip('inc/texte'); # pour corriger_typo |
|
| 27 | - |
|
| 28 | - include_spip('action/inscrire_auteur'); |
|
| 29 | - $cookie = auteur_attribuer_jeton($r[1]['id_auteur']); |
|
| 30 | - |
|
| 31 | - // l'url_reset doit etre une URL de confiance, on force donc un url_absolue sur adresse_site |
|
| 32 | - include_spip('inc/filtres'); |
|
| 33 | - $msg = recuperer_fond( |
|
| 34 | - 'modeles/mail_oubli', |
|
| 35 | - [ |
|
| 36 | - 'url_reset' => url_absolue( |
|
| 37 | - generer_url_public('spip_pass', "$param=$cookie"), |
|
| 38 | - $GLOBALS['meta']['adresse_site'] . '/' |
|
| 39 | - ) |
|
| 40 | - ] |
|
| 41 | - ); |
|
| 42 | - include_spip('inc/notifications'); |
|
| 43 | - notifications_envoyer_mails($email, $msg); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - return _T('pass_recevoir_mail'); |
|
| 23 | + $r = formulaires_oubli_mail($email); |
|
| 24 | + |
|
| 25 | + if (is_array($r) && $r[1] && $r[1]['statut'] !== '5poubelle' && $r[1]['pass'] !== '') { |
|
| 26 | + include_spip('inc/texte'); # pour corriger_typo |
|
| 27 | + |
|
| 28 | + include_spip('action/inscrire_auteur'); |
|
| 29 | + $cookie = auteur_attribuer_jeton($r[1]['id_auteur']); |
|
| 30 | + |
|
| 31 | + // l'url_reset doit etre une URL de confiance, on force donc un url_absolue sur adresse_site |
|
| 32 | + include_spip('inc/filtres'); |
|
| 33 | + $msg = recuperer_fond( |
|
| 34 | + 'modeles/mail_oubli', |
|
| 35 | + [ |
|
| 36 | + 'url_reset' => url_absolue( |
|
| 37 | + generer_url_public('spip_pass', "$param=$cookie"), |
|
| 38 | + $GLOBALS['meta']['adresse_site'] . '/' |
|
| 39 | + ) |
|
| 40 | + ] |
|
| 41 | + ); |
|
| 42 | + include_spip('inc/notifications'); |
|
| 43 | + notifications_envoyer_mails($email, $msg); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return _T('pass_recevoir_mail'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // la saisie a ete validee, on peut agir |
| 50 | 50 | function formulaires_oubli_traiter_dist() { |
| 51 | 51 | |
| 52 | - $message = message_oubli(_request('oubli'), 'p'); |
|
| 52 | + $message = message_oubli(_request('oubli'), 'p'); |
|
| 53 | 53 | |
| 54 | - return ['message_ok' => $message]; |
|
| 54 | + return ['message_ok' => $message]; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | // fonction qu'on peut redefinir pour filtrer les adresses mail |
| 59 | 59 | // https://code.spip.net/@test_oubli |
| 60 | 60 | function test_oubli_dist($email) { |
| 61 | - include_spip('inc/filtres'); # pour email_valide() |
|
| 62 | - if (!email_valide($email)) { |
|
| 63 | - return _T('pass_erreur_non_valide', ['email_oubli' => spip_htmlspecialchars($email)]); |
|
| 64 | - } |
|
| 61 | + include_spip('inc/filtres'); # pour email_valide() |
|
| 62 | + if (!email_valide($email)) { |
|
| 63 | + return _T('pass_erreur_non_valide', ['email_oubli' => spip_htmlspecialchars($email)]); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - return ['mail' => $email]; |
|
| 66 | + return ['mail' => $email]; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | function formulaires_oubli_verifier_dist() { |
| 70 | - $erreurs = []; |
|
| 70 | + $erreurs = []; |
|
| 71 | 71 | |
| 72 | - $email = (string) _request('oubli'); |
|
| 72 | + $email = (string) _request('oubli'); |
|
| 73 | 73 | |
| 74 | - $r = formulaires_oubli_mail($email); |
|
| 74 | + $r = formulaires_oubli_mail($email); |
|
| 75 | 75 | |
| 76 | - if (!is_array($r)) { |
|
| 77 | - $erreurs['oubli'] = $r; |
|
| 78 | - } else { |
|
| 79 | - if (!$r[1]) { |
|
| 80 | - spip_log("demande de reinitialisation de mot de passe pour $email non enregistre sur le site", 'oubli'); |
|
| 81 | - } elseif ($r[1]['statut'] == '5poubelle' || $r[1]['pass'] == '') { |
|
| 82 | - spip_log("demande de reinitialisation de mot de passe pour $email sans acces (poubelle ou pass vide)", 'oubli'); |
|
| 83 | - } |
|
| 84 | - } |
|
| 76 | + if (!is_array($r)) { |
|
| 77 | + $erreurs['oubli'] = $r; |
|
| 78 | + } else { |
|
| 79 | + if (!$r[1]) { |
|
| 80 | + spip_log("demande de reinitialisation de mot de passe pour $email non enregistre sur le site", 'oubli'); |
|
| 81 | + } elseif ($r[1]['statut'] == '5poubelle' || $r[1]['pass'] == '') { |
|
| 82 | + spip_log("demande de reinitialisation de mot de passe pour $email sans acces (poubelle ou pass vide)", 'oubli'); |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - if (_request('nobot')) { |
|
| 87 | - $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici'); |
|
| 88 | - } |
|
| 86 | + if (_request('nobot')) { |
|
| 87 | + $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici'); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - return $erreurs; |
|
| 90 | + return $erreurs; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | function formulaires_oubli_mail($email) { |
| 94 | - $f = function_exists('test_oubli') ? 'test_oubli' : 'test_oubli_dist'; |
|
| 95 | - $declaration = $f($email); |
|
| 96 | - |
|
| 97 | - if (!is_array($declaration)) { |
|
| 98 | - return $declaration; |
|
| 99 | - } else { |
|
| 100 | - include_spip('base/abstract_sql'); |
|
| 101 | - |
|
| 102 | - return [ |
|
| 103 | - $declaration, |
|
| 104 | - sql_fetsel('id_auteur,statut,pass', 'spip_auteurs', "login<>'' AND email =" . sql_quote($declaration['mail'])) |
|
| 105 | - ]; |
|
| 106 | - } |
|
| 94 | + $f = function_exists('test_oubli') ? 'test_oubli' : 'test_oubli_dist'; |
|
| 95 | + $declaration = $f($email); |
|
| 96 | + |
|
| 97 | + if (!is_array($declaration)) { |
|
| 98 | + return $declaration; |
|
| 99 | + } else { |
|
| 100 | + include_spip('base/abstract_sql'); |
|
| 101 | + |
|
| 102 | + return [ |
|
| 103 | + $declaration, |
|
| 104 | + sql_fetsel('id_auteur,statut,pass', 'spip_auteurs', "login<>'' AND email =" . sql_quote($declaration['mail'])) |
|
| 105 | + ]; |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | [ |
| 36 | 36 | 'url_reset' => url_absolue( |
| 37 | 37 | generer_url_public('spip_pass', "$param=$cookie"), |
| 38 | - $GLOBALS['meta']['adresse_site'] . '/' |
|
| 38 | + $GLOBALS['meta']['adresse_site'].'/' |
|
| 39 | 39 | ) |
| 40 | 40 | ] |
| 41 | 41 | ); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | return [ |
| 103 | 103 | $declaration, |
| 104 | - sql_fetsel('id_auteur,statut,pass', 'spip_auteurs', "login<>'' AND email =" . sql_quote($declaration['mail'])) |
|
| 104 | + sql_fetsel('id_auteur,statut,pass', 'spip_auteurs', "login<>'' AND email =".sql_quote($declaration['mail'])) |
|
| 105 | 105 | ]; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | return false; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . (int) $id_article); |
|
| 23 | + $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article='.(int) $id_article); |
|
| 24 | 24 | if (!$row['id_article']) { |
| 25 | 25 | return false; |
| 26 | 26 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | function formulaires_rediriger_article_verifier_dist($id_article, $retour = '') { |
| 48 | 48 | $erreurs = []; |
| 49 | 49 | |
| 50 | - if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) { |
|
| 50 | + if (($redirection = _request('redirection')) == $id_article || $redirection == 'art'.$id_article) { |
|
| 51 | 51 | $erreurs['redirection'] = _T('info_redirection_boucle'); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : ''; |
| 68 | 68 | |
| 69 | 69 | return [ |
| 70 | - 'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js, |
|
| 70 | + 'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')).$js, |
|
| 71 | 71 | 'editable' => true |
| 72 | 72 | ]; |
| 73 | 73 | } |
@@ -10,64 +10,64 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function formulaires_rediriger_article_charger_dist($id_article, $retour = '') { |
| 17 | 17 | |
| 18 | - include_spip('inc/autoriser'); |
|
| 19 | - if (!autoriser('modifier', 'article', $id_article)) { |
|
| 20 | - return false; |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . (int) $id_article); |
|
| 24 | - if (!$row['id_article']) { |
|
| 25 | - return false; |
|
| 26 | - } |
|
| 27 | - include_spip('inc/lien'); |
|
| 28 | - $redirection = virtuel_redirige($row['virtuel']); |
|
| 29 | - |
|
| 30 | - if ( |
|
| 31 | - !$redirection |
|
| 32 | - && $GLOBALS['meta']['articles_redirection'] != 'oui' |
|
| 33 | - ) { |
|
| 34 | - return false; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - include_spip('inc/texte'); |
|
| 39 | - |
|
| 40 | - return [ |
|
| 41 | - 'redirection' => $redirection, |
|
| 42 | - 'id' => $id_article, |
|
| 43 | - '_afficher_url' => ($redirection ? propre("[->$redirection]") : ''), |
|
| 44 | - ]; |
|
| 18 | + include_spip('inc/autoriser'); |
|
| 19 | + if (!autoriser('modifier', 'article', $id_article)) { |
|
| 20 | + return false; |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . (int) $id_article); |
|
| 24 | + if (!$row['id_article']) { |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 27 | + include_spip('inc/lien'); |
|
| 28 | + $redirection = virtuel_redirige($row['virtuel']); |
|
| 29 | + |
|
| 30 | + if ( |
|
| 31 | + !$redirection |
|
| 32 | + && $GLOBALS['meta']['articles_redirection'] != 'oui' |
|
| 33 | + ) { |
|
| 34 | + return false; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + include_spip('inc/texte'); |
|
| 39 | + |
|
| 40 | + return [ |
|
| 41 | + 'redirection' => $redirection, |
|
| 42 | + 'id' => $id_article, |
|
| 43 | + '_afficher_url' => ($redirection ? propre("[->$redirection]") : ''), |
|
| 44 | + ]; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | function formulaires_rediriger_article_verifier_dist($id_article, $retour = '') { |
| 48 | - $erreurs = []; |
|
| 48 | + $erreurs = []; |
|
| 49 | 49 | |
| 50 | - if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) { |
|
| 51 | - $erreurs['redirection'] = _T('info_redirection_boucle'); |
|
| 52 | - } |
|
| 50 | + if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) { |
|
| 51 | + $erreurs['redirection'] = _T('info_redirection_boucle'); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - return $erreurs; |
|
| 54 | + return $erreurs; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | function formulaires_rediriger_article_traiter_dist($id_article, $retour = '') { |
| 58 | 58 | |
| 59 | - $url = preg_replace(',^\s*https?://$,i', '', rtrim((string) _request('redirection'))); |
|
| 60 | - if ($url) { |
|
| 61 | - $url = corriger_caracteres($url); |
|
| 62 | - } |
|
| 59 | + $url = preg_replace(',^\s*https?://$,i', '', rtrim((string) _request('redirection'))); |
|
| 60 | + if ($url) { |
|
| 61 | + $url = corriger_caracteres($url); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - include_spip('action/editer_article'); |
|
| 65 | - article_modifier($id_article, ['virtuel' => $url]); |
|
| 64 | + include_spip('action/editer_article'); |
|
| 65 | + article_modifier($id_article, ['virtuel' => $url]); |
|
| 66 | 66 | |
| 67 | - $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : ''; |
|
| 67 | + $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : ''; |
|
| 68 | 68 | |
| 69 | - return [ |
|
| 70 | - 'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js, |
|
| 71 | - 'editable' => true |
|
| 72 | - ]; |
|
| 69 | + return [ |
|
| 70 | + 'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js, |
|
| 71 | + 'editable' => true |
|
| 72 | + ]; |
|
| 73 | 73 | } |
@@ -10,65 +10,65 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function formulaires_configurer_articles_charger_dist() { |
| 17 | - $valeurs = []; |
|
| 18 | - foreach ( |
|
| 19 | - [ |
|
| 20 | - 'articles_surtitre', |
|
| 21 | - 'articles_soustitre', |
|
| 22 | - 'articles_descriptif', |
|
| 23 | - 'articles_chapeau', |
|
| 24 | - 'articles_texte', |
|
| 25 | - 'articles_ps', |
|
| 26 | - 'articles_redac', |
|
| 27 | - 'articles_urlref', |
|
| 28 | - 'post_dates', |
|
| 29 | - 'articles_redirection', |
|
| 30 | - ] as $m |
|
| 31 | - ) { |
|
| 32 | - $valeurs[$m] = $GLOBALS['meta'][$m]; |
|
| 33 | - } |
|
| 17 | + $valeurs = []; |
|
| 18 | + foreach ( |
|
| 19 | + [ |
|
| 20 | + 'articles_surtitre', |
|
| 21 | + 'articles_soustitre', |
|
| 22 | + 'articles_descriptif', |
|
| 23 | + 'articles_chapeau', |
|
| 24 | + 'articles_texte', |
|
| 25 | + 'articles_ps', |
|
| 26 | + 'articles_redac', |
|
| 27 | + 'articles_urlref', |
|
| 28 | + 'post_dates', |
|
| 29 | + 'articles_redirection', |
|
| 30 | + ] as $m |
|
| 31 | + ) { |
|
| 32 | + $valeurs[$m] = $GLOBALS['meta'][$m]; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - return $valeurs; |
|
| 35 | + return $valeurs; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | function formulaires_configurer_articles_traiter_dist() { |
| 40 | - $res = ['editable' => true]; |
|
| 41 | - $purger_skel = false; |
|
| 42 | - // Purger les squelettes si un changement de meta les affecte |
|
| 43 | - if (($i = _request('post_dates')) && $i != $GLOBALS['meta']['post_dates']) { |
|
| 44 | - $purger_skel = true; |
|
| 45 | - } |
|
| 40 | + $res = ['editable' => true]; |
|
| 41 | + $purger_skel = false; |
|
| 42 | + // Purger les squelettes si un changement de meta les affecte |
|
| 43 | + if (($i = _request('post_dates')) && $i != $GLOBALS['meta']['post_dates']) { |
|
| 44 | + $purger_skel = true; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - foreach ( |
|
| 48 | - [ |
|
| 49 | - 'articles_surtitre', |
|
| 50 | - 'articles_soustitre', |
|
| 51 | - 'articles_descriptif', |
|
| 52 | - 'articles_chapeau', |
|
| 53 | - 'articles_texte', |
|
| 54 | - 'articles_ps', |
|
| 55 | - 'articles_redac', |
|
| 56 | - 'articles_urlref', |
|
| 57 | - 'post_dates', |
|
| 58 | - 'articles_redirection', |
|
| 59 | - ] as $m |
|
| 60 | - ) { |
|
| 61 | - if (!is_null($v = _request($m))) { |
|
| 62 | - ecrire_meta($m, $v == 'oui' ? 'oui' : 'non'); |
|
| 63 | - } |
|
| 64 | - } |
|
| 47 | + foreach ( |
|
| 48 | + [ |
|
| 49 | + 'articles_surtitre', |
|
| 50 | + 'articles_soustitre', |
|
| 51 | + 'articles_descriptif', |
|
| 52 | + 'articles_chapeau', |
|
| 53 | + 'articles_texte', |
|
| 54 | + 'articles_ps', |
|
| 55 | + 'articles_redac', |
|
| 56 | + 'articles_urlref', |
|
| 57 | + 'post_dates', |
|
| 58 | + 'articles_redirection', |
|
| 59 | + ] as $m |
|
| 60 | + ) { |
|
| 61 | + if (!is_null($v = _request($m))) { |
|
| 62 | + ecrire_meta($m, $v == 'oui' ? 'oui' : 'non'); |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - if ($purger_skel) { |
|
| 67 | - include_spip('inc/invalideur'); |
|
| 68 | - purger_repertoire(_DIR_SKELS); |
|
| 69 | - } |
|
| 66 | + if ($purger_skel) { |
|
| 67 | + include_spip('inc/invalideur'); |
|
| 68 | + purger_repertoire(_DIR_SKELS); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $res['message_ok'] = _T('config_info_enregistree'); |
|
| 71 | + $res['message_ok'] = _T('config_info_enregistree'); |
|
| 72 | 72 | |
| 73 | - return $res; |
|
| 73 | + return $res; |
|
| 74 | 74 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package SPIP\Core\Fonctions |
| 16 | 16 | **/ |
| 17 | 17 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -28,29 +28,29 @@ discard block |
||
| 28 | 28 | * @param bool $left |
| 29 | 29 | */ |
| 30 | 30 | function critere_compteur_articles_filtres_dist($idb, &$boucles, $crit, $left = false) { |
| 31 | - $boucle = &$boucles[$idb]; |
|
| 31 | + $boucle = &$boucles[$idb]; |
|
| 32 | 32 | |
| 33 | - $_statut = calculer_liste($crit->param[0], [], $boucles, $boucle->id_parent); |
|
| 33 | + $_statut = calculer_liste($crit->param[0], [], $boucles, $boucle->id_parent); |
|
| 34 | 34 | |
| 35 | - $not = ''; |
|
| 36 | - if ($crit->not) { |
|
| 37 | - $not = ", 'NOT'"; |
|
| 38 | - } |
|
| 39 | - $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 40 | - $boucle->from_type['LAA'] = 'left'; |
|
| 41 | - $boucle->join['LAA'] = ["'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"]; |
|
| 35 | + $not = ''; |
|
| 36 | + if ($crit->not) { |
|
| 37 | + $not = ", 'NOT'"; |
|
| 38 | + } |
|
| 39 | + $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 40 | + $boucle->from_type['LAA'] = 'left'; |
|
| 41 | + $boucle->join['LAA'] = ["'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"]; |
|
| 42 | 42 | |
| 43 | - $boucle->from['articles'] = 'spip_articles'; |
|
| 44 | - $boucle->from_type['articles'] = 'left'; |
|
| 45 | - $boucle->join['articles'] = [ |
|
| 46 | - "'LAA'", |
|
| 47 | - "'id_article'", |
|
| 48 | - "'id_objet'", |
|
| 49 | - "'(articles.statut IS NULL OR '.sql_in_quote('articles.statut',[$_statut]$not).')'" |
|
| 50 | - ]; |
|
| 43 | + $boucle->from['articles'] = 'spip_articles'; |
|
| 44 | + $boucle->from_type['articles'] = 'left'; |
|
| 45 | + $boucle->join['articles'] = [ |
|
| 46 | + "'LAA'", |
|
| 47 | + "'id_article'", |
|
| 48 | + "'id_objet'", |
|
| 49 | + "'(articles.statut IS NULL OR '.sql_in_quote('articles.statut',[$_statut]$not).')'" |
|
| 50 | + ]; |
|
| 51 | 51 | |
| 52 | - $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 53 | - $boucle->group[] = 'auteurs.id_auteur'; |
|
| 52 | + $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 53 | + $boucle->group[] = 'auteurs.id_auteur'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Pile complétée par le code à générer |
| 69 | 69 | */ |
| 70 | 70 | function balise_COMPTEUR_ARTICLES_dist($p) { |
| 71 | - return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 71 | + return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
@@ -84,37 +84,37 @@ discard block |
||
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | 86 | function afficher_initiale($url, $initiale, $compteur, $debut, $pas) { |
| 87 | - static $memo = null; |
|
| 88 | - static $res = []; |
|
| 89 | - $out = ''; |
|
| 90 | - if (!$memo || !$initiale && !$url || $initiale !== $memo['initiale']) { |
|
| 91 | - $newcompt = (int) (floor(($compteur - 1) / $pas) * $pas); |
|
| 92 | - // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 93 | - if (!$initiale && !$url && !$memo['compteur']) { |
|
| 94 | - $memo = null; |
|
| 95 | - } |
|
| 96 | - if ($memo) { |
|
| 97 | - $on = ($memo['compteur'] <= $debut && ($newcompt > $debut || $newcompt == $debut && $newcompt == $memo['compteur'])); |
|
| 98 | - $res[] = "<li class='pagination-item'>" . lien_ou_expose($memo['url'], $memo['initiale'], $on ? 'span.pagination-item-label' : '', 'pagination-item-label lien_pagination') . '</li>'; |
|
| 99 | - } |
|
| 100 | - if ($initiale) { |
|
| 101 | - $memo = [ |
|
| 102 | - 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 103 | - 'initiale' => $initiale, |
|
| 104 | - 'url' => parametre_url($url, 'i', $initiale), |
|
| 105 | - 'compteur' => $newcompt |
|
| 106 | - ]; |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - if (!$initiale && !$url) { |
|
| 110 | - if ((is_countable($res) ? count($res) : 0) > 1) { |
|
| 111 | - $out = "<ul class='pagination-items'>" . implode(' ', $res) . '</ul>'; |
|
| 112 | - } |
|
| 113 | - $memo = null; |
|
| 114 | - $res = []; |
|
| 115 | - } |
|
| 87 | + static $memo = null; |
|
| 88 | + static $res = []; |
|
| 89 | + $out = ''; |
|
| 90 | + if (!$memo || !$initiale && !$url || $initiale !== $memo['initiale']) { |
|
| 91 | + $newcompt = (int) (floor(($compteur - 1) / $pas) * $pas); |
|
| 92 | + // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 93 | + if (!$initiale && !$url && !$memo['compteur']) { |
|
| 94 | + $memo = null; |
|
| 95 | + } |
|
| 96 | + if ($memo) { |
|
| 97 | + $on = ($memo['compteur'] <= $debut && ($newcompt > $debut || $newcompt == $debut && $newcompt == $memo['compteur'])); |
|
| 98 | + $res[] = "<li class='pagination-item'>" . lien_ou_expose($memo['url'], $memo['initiale'], $on ? 'span.pagination-item-label' : '', 'pagination-item-label lien_pagination') . '</li>'; |
|
| 99 | + } |
|
| 100 | + if ($initiale) { |
|
| 101 | + $memo = [ |
|
| 102 | + 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 103 | + 'initiale' => $initiale, |
|
| 104 | + 'url' => parametre_url($url, 'i', $initiale), |
|
| 105 | + 'compteur' => $newcompt |
|
| 106 | + ]; |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + if (!$initiale && !$url) { |
|
| 110 | + if ((is_countable($res) ? count($res) : 0) > 1) { |
|
| 111 | + $out = "<ul class='pagination-items'>" . implode(' ', $res) . '</ul>'; |
|
| 112 | + } |
|
| 113 | + $memo = null; |
|
| 114 | + $res = []; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - return $out; |
|
| 117 | + return $out; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -133,24 +133,24 @@ discard block |
||
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | 135 | function auteur_lien_messagerie($id_auteur, $en_ligne, $statut, $imessage, $email = '') { |
| 136 | - static $time = null; |
|
| 137 | - if (!in_array($statut, ['0minirezo', '1comite'])) { |
|
| 138 | - return ''; |
|
| 139 | - } |
|
| 136 | + static $time = null; |
|
| 137 | + if (!in_array($statut, ['0minirezo', '1comite'])) { |
|
| 138 | + return ''; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - if (is_null($time)) { |
|
| 142 | - $time = time(); |
|
| 143 | - } |
|
| 144 | - $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 141 | + if (is_null($time)) { |
|
| 142 | + $time = time(); |
|
| 143 | + } |
|
| 144 | + $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 145 | 145 | |
| 146 | - if ( |
|
| 147 | - $imessage != 'non' && !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 148 | - && $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 149 | - ) { |
|
| 150 | - return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 151 | - } elseif (strlen($email) && autoriser('voir', 'auteur', $id_auteur)) { |
|
| 152 | - return 'mailto:' . $email; |
|
| 153 | - } else { |
|
| 154 | - return ''; |
|
| 155 | - } |
|
| 146 | + if ( |
|
| 147 | + $imessage != 'non' && !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 148 | + && $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 149 | + ) { |
|
| 150 | + return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 151 | + } elseif (strlen($email) && autoriser('voir', 'auteur', $id_auteur)) { |
|
| 152 | + return 'mailto:' . $email; |
|
| 153 | + } else { |
|
| 154 | + return ''; |
|
| 155 | + } |
|
| 156 | 156 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | if ($memo) { |
| 97 | 97 | $on = ($memo['compteur'] <= $debut && ($newcompt > $debut || $newcompt == $debut && $newcompt == $memo['compteur'])); |
| 98 | - $res[] = "<li class='pagination-item'>" . lien_ou_expose($memo['url'], $memo['initiale'], $on ? 'span.pagination-item-label' : '', 'pagination-item-label lien_pagination') . '</li>'; |
|
| 98 | + $res[] = "<li class='pagination-item'>".lien_ou_expose($memo['url'], $memo['initiale'], $on ? 'span.pagination-item-label' : '', 'pagination-item-label lien_pagination').'</li>'; |
|
| 99 | 99 | } |
| 100 | 100 | if ($initiale) { |
| 101 | 101 | $memo = [ |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | if (!$initiale && !$url) { |
| 110 | 110 | if ((is_countable($res) ? count($res) : 0) > 1) { |
| 111 | - $out = "<ul class='pagination-items'>" . implode(' ', $res) . '</ul>'; |
|
| 111 | + $out = "<ul class='pagination-items'>".implode(' ', $res).'</ul>'; |
|
| 112 | 112 | } |
| 113 | 113 | $memo = null; |
| 114 | 114 | $res = []; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ) { |
| 150 | 150 | return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
| 151 | 151 | } elseif (strlen($email) && autoriser('voir', 'auteur', $id_auteur)) { |
| 152 | - return 'mailto:' . $email; |
|
| 152 | + return 'mailto:'.$email; |
|
| 153 | 153 | } else { |
| 154 | 154 | return ''; |
| 155 | 155 | } |
@@ -10,24 +10,24 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function lister_traductions($id_trad, $objet) { |
| 17 | - $table_objet_sql = table_objet_sql($objet); |
|
| 18 | - $primary = id_table_objet($objet); |
|
| 17 | + $table_objet_sql = table_objet_sql($objet); |
|
| 18 | + $primary = id_table_objet($objet); |
|
| 19 | 19 | |
| 20 | - $select = "$primary as id,lang"; |
|
| 21 | - $where = 'id_trad=' . (int) $id_trad; |
|
| 22 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 23 | - $desc = $trouver_table($table_objet_sql); |
|
| 24 | - if (isset($desc['field']['statut'])) { |
|
| 25 | - $select .= ',statut'; |
|
| 26 | - $where .= ' AND statut!=' . sql_quote('poubelle'); |
|
| 27 | - } |
|
| 20 | + $select = "$primary as id,lang"; |
|
| 21 | + $where = 'id_trad=' . (int) $id_trad; |
|
| 22 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 23 | + $desc = $trouver_table($table_objet_sql); |
|
| 24 | + if (isset($desc['field']['statut'])) { |
|
| 25 | + $select .= ',statut'; |
|
| 26 | + $where .= ' AND statut!=' . sql_quote('poubelle'); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - $rows = sql_allfetsel($select, $table_objet_sql, $where); |
|
| 30 | - lang_select(); |
|
| 29 | + $rows = sql_allfetsel($select, $table_objet_sql, $where); |
|
| 30 | + lang_select(); |
|
| 31 | 31 | |
| 32 | - return $rows; |
|
| 32 | + return $rows; |
|
| 33 | 33 | } |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | $primary = id_table_objet($objet); |
| 19 | 19 | |
| 20 | 20 | $select = "$primary as id,lang"; |
| 21 | - $where = 'id_trad=' . (int) $id_trad; |
|
| 21 | + $where = 'id_trad='.(int) $id_trad; |
|
| 22 | 22 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 23 | 23 | $desc = $trouver_table($table_objet_sql); |
| 24 | 24 | if (isset($desc['field']['statut'])) { |
| 25 | 25 | $select .= ',statut'; |
| 26 | - $where .= ' AND statut!=' . sql_quote('poubelle'); |
|
| 26 | + $where .= ' AND statut!='.sql_quote('poubelle'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $rows = sql_allfetsel($select, $table_objet_sql, $where); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function deplacement_restreint($objet, $statut) { |
| 25 | 25 | |
| 26 | - return match ($objet) { |
|
| 27 | - 'rubrique' => !$GLOBALS['connect_toutes_rubriques'], |
|
| 28 | - 'article', 'site', 'syndic', 'breve' => $statut == 'publie', |
|
| 29 | - default => $statut ? $statut == 'publie' : false, |
|
| 30 | - }; |
|
| 26 | + return match ($objet) { |
|
| 27 | + 'rubrique' => !$GLOBALS['connect_toutes_rubriques'], |
|
| 28 | + 'article', 'site', 'syndic', 'breve' => $statut == 'publie', |
|
| 29 | + default => $statut ? $statut == 'publie' : false, |
|
| 30 | + }; |
|
| 31 | 31 | } |
@@ -10,77 +10,77 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function install_etape_ldap3_dist() { |
| 17 | - $info = []; |
|
| 18 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 19 | - $login_ldap = _request('login_ldap'); |
|
| 20 | - $pass_ldap = _request('pass_ldap'); |
|
| 21 | - $port_ldap = _request('port_ldap'); |
|
| 17 | + $info = []; |
|
| 18 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 19 | + $login_ldap = _request('login_ldap'); |
|
| 20 | + $pass_ldap = _request('pass_ldap'); |
|
| 21 | + $port_ldap = _request('port_ldap'); |
|
| 22 | 22 | |
| 23 | - $base_ldap_text = defined('_INSTALL_BASE_LDAP') |
|
| 24 | - ? _INSTALL_BASE_LDAP |
|
| 25 | - : 'ou=users, dc=mon-domaine, dc=com'; |
|
| 23 | + $base_ldap_text = defined('_INSTALL_BASE_LDAP') |
|
| 24 | + ? _INSTALL_BASE_LDAP |
|
| 25 | + : 'ou=users, dc=mon-domaine, dc=com'; |
|
| 26 | 26 | |
| 27 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 28 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 27 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 28 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 29 | 29 | |
| 30 | - echo info_etape( |
|
| 31 | - _T('info_chemin_acces_1'), |
|
| 32 | - info_progression_etape(3, 'etape_ldap', 'install/') |
|
| 33 | - ), |
|
| 34 | - _T('info_chemin_acces_2'); |
|
| 30 | + echo info_etape( |
|
| 31 | + _T('info_chemin_acces_1'), |
|
| 32 | + info_progression_etape(3, 'etape_ldap', 'install/') |
|
| 33 | + ), |
|
| 34 | + _T('info_chemin_acces_2'); |
|
| 35 | 35 | |
| 36 | - $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); |
|
| 37 | - if ($ldap_link) { |
|
| 38 | - @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); |
|
| 39 | - $result = @ldap_read($ldap_link, '', 'objectclass=*', ['namingContexts']); |
|
| 40 | - $info = @ldap_get_entries($ldap_link, $result); |
|
| 41 | - @ldap_close($ldap_link); |
|
| 42 | - } |
|
| 36 | + $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); |
|
| 37 | + if ($ldap_link) { |
|
| 38 | + @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); |
|
| 39 | + $result = @ldap_read($ldap_link, '', 'objectclass=*', ['namingContexts']); |
|
| 40 | + $info = @ldap_get_entries($ldap_link, $result); |
|
| 41 | + @ldap_close($ldap_link); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - $checked = false; |
|
| 45 | - $res = ''; |
|
| 46 | - if (is_array($info) && $info['count'] > 0) { |
|
| 47 | - $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 48 | - $res .= '<ul>'; |
|
| 49 | - $n = 0; |
|
| 50 | - for ($i = 0; $i < $info['count']; $i++) { |
|
| 51 | - $names = $info[$i]['namingcontexts']; |
|
| 52 | - if (is_array($names)) { |
|
| 53 | - for ($j = 0; $j < $names['count']; $j++) { |
|
| 54 | - $n++; |
|
| 55 | - $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 56 | - if (!$checked) { |
|
| 57 | - $res .= ' checked="checked"'; |
|
| 58 | - $checked = true; |
|
| 59 | - } |
|
| 60 | - $res .= ' />'; |
|
| 61 | - $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - $res .= '</ul>'; |
|
| 66 | - $res .= _T('info_ou') . ' '; |
|
| 67 | - } |
|
| 68 | - $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
|
| 69 | - if (!$checked) { |
|
| 70 | - $res .= ' checked="checked"'; |
|
| 71 | - $checked = true; |
|
| 72 | - } |
|
| 44 | + $checked = false; |
|
| 45 | + $res = ''; |
|
| 46 | + if (is_array($info) && $info['count'] > 0) { |
|
| 47 | + $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 48 | + $res .= '<ul>'; |
|
| 49 | + $n = 0; |
|
| 50 | + for ($i = 0; $i < $info['count']; $i++) { |
|
| 51 | + $names = $info[$i]['namingcontexts']; |
|
| 52 | + if (is_array($names)) { |
|
| 53 | + for ($j = 0; $j < $names['count']; $j++) { |
|
| 54 | + $n++; |
|
| 55 | + $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 56 | + if (!$checked) { |
|
| 57 | + $res .= ' checked="checked"'; |
|
| 58 | + $checked = true; |
|
| 59 | + } |
|
| 60 | + $res .= ' />'; |
|
| 61 | + $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + $res .= '</ul>'; |
|
| 66 | + $res .= _T('info_ou') . ' '; |
|
| 67 | + } |
|
| 68 | + $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
|
| 69 | + if (!$checked) { |
|
| 70 | + $res .= ' checked="checked"'; |
|
| 71 | + $checked = true; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - $res .= ' />' |
|
| 75 | - . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 76 | - . "\n<fieldset>" |
|
| 77 | - . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
|
| 78 | - . "\n</fieldset>" |
|
| 79 | - . "\n<input type='hidden' name='etape' value='ldap4' />" |
|
| 80 | - . install_propager(['adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap']) |
|
| 81 | - . bouton_suivant(); |
|
| 74 | + $res .= ' />' |
|
| 75 | + . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 76 | + . "\n<fieldset>" |
|
| 77 | + . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
|
| 78 | + . "\n</fieldset>" |
|
| 79 | + . "\n<input type='hidden' name='etape' value='ldap4' />" |
|
| 80 | + . install_propager(['adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap']) |
|
| 81 | + . bouton_suivant(); |
|
| 82 | 82 | |
| 83 | - echo generer_form_ecrire('install', $res); |
|
| 83 | + echo generer_form_ecrire('install', $res); |
|
| 84 | 84 | |
| 85 | - echo $minipage->installFinPage(); |
|
| 85 | + echo $minipage->installFinPage(); |
|
| 86 | 86 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $checked = false; |
| 45 | 45 | $res = ''; |
| 46 | 46 | if (is_array($info) && $info['count'] > 0) { |
| 47 | - $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 47 | + $res .= '<p>'._T('info_selection_chemin_acces').'</p>'; |
|
| 48 | 48 | $res .= '<ul>'; |
| 49 | 49 | $n = 0; |
| 50 | 50 | for ($i = 0; $i < $info['count']; $i++) { |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | if (is_array($names)) { |
| 53 | 53 | for ($j = 0; $j < $names['count']; $j++) { |
| 54 | 54 | $n++; |
| 55 | - $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 55 | + $res .= '<li><input name="base_ldap" value="'.spip_htmlspecialchars($names[$j])."\" type='radio' id='tab$n'"; |
|
| 56 | 56 | if (!$checked) { |
| 57 | 57 | $res .= ' checked="checked"'; |
| 58 | 58 | $checked = true; |
| 59 | 59 | } |
| 60 | 60 | $res .= ' />'; |
| 61 | - $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 61 | + $res .= "<label for='tab$n'>".spip_htmlspecialchars($names[$j])."</label></li>\n"; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | $res .= '</ul>'; |
| 66 | - $res .= _T('info_ou') . ' '; |
|
| 66 | + $res .= _T('info_ou').' '; |
|
| 67 | 67 | } |
| 68 | 68 | $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
| 69 | 69 | if (!$checked) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $res .= ' />' |
| 75 | - . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 75 | + . "\n<label for='manuel'>"._T('entree_chemin_acces').'</label> ' |
|
| 76 | 76 | . "\n<fieldset>" |
| 77 | 77 | . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
| 78 | 78 | . "\n</fieldset>" |