@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | function changer_langue($lang, $liste_langues = null) { |
| 41 | 41 | |
| 42 | 42 | if (is_null($liste_langues)) { |
| 43 | - $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | + $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '').','.($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 44 | 44 | } else { |
| 45 | 45 | if (is_array($liste_langues)) { |
| 46 | 46 | $liste_langues = implode(',', $liste_langues); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | + $liste_langues = ','.$liste_langues.','; |
|
| 50 | 50 | |
| 51 | 51 | // Si la langue demandee n'existe pas, on essaie d'autres variantes |
| 52 | 52 | // Exemple : 'pt-br' => 'pt_br' => 'pt' |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | foreach ($langues as $l) { |
| 194 | 194 | $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
| 195 | - $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | + $ret .= "<option value='$l'$selected>[".$l.'] '.traduire_nom_langue($l)."</option>\n"; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (!test_espace_prive()) { |
@@ -210,23 +210,21 @@ discard block |
||
| 210 | 210 | $base, |
| 211 | 211 | $cible, |
| 212 | 212 | (select_langues($nom_select, $change, $ret) |
| 213 | - . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | + . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='"._T('bouton_changer')."' /></div></noscript>"), |
|
| 214 | 214 | " method='post'" |
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | function select_langues($nom_select, $change, $options, $label = '') { |
| 219 | 219 | static $cpt = 0; |
| 220 | - $id = 'menu_langues' . $cpt++; |
|
| 220 | + $id = 'menu_langues'.$cpt++; |
|
| 221 | 221 | |
| 222 | 222 | return |
| 223 | - "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | + "<label for='$id'>".($label ?: _T('info_langues')).'</label> '. |
|
| 224 | 224 | "<select name='$nom_select' id='$id' " |
| 225 | 225 | . ((!test_espace_prive()) ? |
| 226 | - ("class='forml menu_langues'") : |
|
| 227 | - (($nom_select == 'var_lang_ecrire') ? |
|
| 228 | - ("class='lang_ecrire'") : |
|
| 229 | - "class='fondl'")) |
|
| 226 | + ("class='forml menu_langues'") : (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | + ("class='lang_ecrire'") : "class='fondl'")) |
|
| 230 | 228 | . $change |
| 231 | 229 | . ">\n" |
| 232 | 230 | . $options |
@@ -352,7 +350,7 @@ discard block |
||
| 352 | 350 | and (!isset($GLOBALS['spip_lang']) |
| 353 | 351 | or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
| 354 | 352 | ) { |
| 355 | - return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 353 | + return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues); //@:install |
|
| 356 | 354 | } |
| 357 | 355 | // en theorie là, la globale est définie, sinon c'est un problème. |
| 358 | 356 | if (!isset($GLOBALS['spip_lang'])) { |
@@ -455,7 +453,7 @@ discard block |
||
| 455 | 453 | if (!isset($GLOBALS['meta']['langue_site'])) { |
| 456 | 454 | // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
| 457 | 455 | $GLOBALS['meta']['langue_site'] = $tout = |
| 458 | - (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 456 | + (!$all_langs or (strpos(','._LANGUE_PAR_DEFAUT.',', (string) ",$all_langs,") !== false)) |
|
| 459 | 457 | ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
| 460 | 458 | ecrire_meta('langue_site', $tout); |
| 461 | 459 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package SPIP\Core\Langue |
| 16 | 16 | **/ |
| 17 | 17 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -38,35 +38,35 @@ discard block |
||
| 38 | 38 | **/ |
| 39 | 39 | function changer_langue($lang, $liste_langues = null) { |
| 40 | 40 | |
| 41 | - if (is_null($liste_langues)) { |
|
| 42 | - $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | - } else { |
|
| 44 | - if (is_array($liste_langues)) { |
|
| 45 | - $liste_langues = implode(',', $liste_langues); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | - |
|
| 50 | - // Si la langue demandee n'existe pas, on essaie d'autres variantes |
|
| 51 | - // Exemple : 'pt-br' => 'pt_br' => 'pt' |
|
| 52 | - $lang = str_replace('-', '_', trim($lang)); |
|
| 53 | - if (!$lang) { |
|
| 54 | - return false; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if ( |
|
| 58 | - strpos($liste_langues, (string) ",$lang,") !== false |
|
| 59 | - or ($lang = preg_replace(',_.*,', '', $lang) |
|
| 60 | - and str_contains($liste_langues, (string) ",$lang,")) |
|
| 61 | - ) { |
|
| 62 | - $GLOBALS['spip_lang_rtl'] = lang_dir($lang, '', '_rtl'); |
|
| 63 | - $GLOBALS['spip_lang_right'] = $GLOBALS['spip_lang_rtl'] ? 'left' : 'right'; |
|
| 64 | - $GLOBALS['spip_lang_left'] = $GLOBALS['spip_lang_rtl'] ? 'right' : 'left'; |
|
| 65 | - |
|
| 66 | - return $GLOBALS['spip_lang'] = $lang; |
|
| 67 | - } else { |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 41 | + if (is_null($liste_langues)) { |
|
| 42 | + $liste_langues = ($GLOBALS['meta']['langues_proposees'] ?? '') . ',' . ($GLOBALS['meta']['langues_multilingue'] ?? ''); |
|
| 43 | + } else { |
|
| 44 | + if (is_array($liste_langues)) { |
|
| 45 | + $liste_langues = implode(',', $liste_langues); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + $liste_langues = ',' . $liste_langues . ','; |
|
| 49 | + |
|
| 50 | + // Si la langue demandee n'existe pas, on essaie d'autres variantes |
|
| 51 | + // Exemple : 'pt-br' => 'pt_br' => 'pt' |
|
| 52 | + $lang = str_replace('-', '_', trim($lang)); |
|
| 53 | + if (!$lang) { |
|
| 54 | + return false; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if ( |
|
| 58 | + strpos($liste_langues, (string) ",$lang,") !== false |
|
| 59 | + or ($lang = preg_replace(',_.*,', '', $lang) |
|
| 60 | + and str_contains($liste_langues, (string) ",$lang,")) |
|
| 61 | + ) { |
|
| 62 | + $GLOBALS['spip_lang_rtl'] = lang_dir($lang, '', '_rtl'); |
|
| 63 | + $GLOBALS['spip_lang_right'] = $GLOBALS['spip_lang_rtl'] ? 'left' : 'right'; |
|
| 64 | + $GLOBALS['spip_lang_left'] = $GLOBALS['spip_lang_rtl'] ? 'right' : 'left'; |
|
| 65 | + |
|
| 66 | + return $GLOBALS['spip_lang'] = $lang; |
|
| 67 | + } else { |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | // par exemple le francais pour l'espagnol, l'anglais pour l'allemand, etc. |
| 80 | 80 | |
| 81 | 81 | function choisir_traduction($trads, $lang = '') { |
| 82 | - $k = approcher_langue($trads, $lang); |
|
| 82 | + $k = approcher_langue($trads, $lang); |
|
| 83 | 83 | |
| 84 | - return $k ? $trads[$k] : array_shift($trads); |
|
| 84 | + return $k ? $trads[$k] : array_shift($trads); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // retourne son 2e argument si c'est un index du premier |
@@ -89,21 +89,21 @@ discard block |
||
| 89 | 89 | // la langue X etant consideree comme une approche de X_Y |
| 90 | 90 | function approcher_langue($trads, $lang = '') { |
| 91 | 91 | |
| 92 | - if (!$lang) { |
|
| 93 | - $lang = $GLOBALS['spip_lang']; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if (isset($trads[$lang])) { |
|
| 97 | - return $lang; |
|
| 98 | - } // cas des langues xx_yy |
|
| 99 | - else { |
|
| 100 | - $r = explode('_', $lang); |
|
| 101 | - if (isset($trads[$r[0]])) { |
|
| 102 | - return $r[0]; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return ''; |
|
| 92 | + if (!$lang) { |
|
| 93 | + $lang = $GLOBALS['spip_lang']; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if (isset($trads[$lang])) { |
|
| 97 | + return $lang; |
|
| 98 | + } // cas des langues xx_yy |
|
| 99 | + else { |
|
| 100 | + $r = explode('_', $lang); |
|
| 101 | + if (isset($trads[$r[0]])) { |
|
| 102 | + return $r[0]; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return ''; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | * Nom de la langue, sinon son code. |
| 119 | 119 | **/ |
| 120 | 120 | function traduire_nom_langue($lang) { |
| 121 | - include_spip('inc/lang_liste'); |
|
| 122 | - include_spip('inc/charsets'); |
|
| 121 | + include_spip('inc/lang_liste'); |
|
| 122 | + include_spip('inc/charsets'); |
|
| 123 | 123 | |
| 124 | - return html2unicode($GLOBALS['codes_langues'][$lang] ?? $lang); |
|
| 124 | + return html2unicode($GLOBALS['codes_langues'][$lang] ?? $lang); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | // hebreu a priori), 'droitier' sinon. |
| 135 | 135 | // C'est utilise par #LANG_DIR, #LANG_LEFT, #LANG_RIGHT. |
| 136 | 136 | function lang_dir($lang = '', $droitier = 'ltr', $gaucher = 'rtl') { |
| 137 | - static $lang_rtl = ['ar', 'fa', 'ku', 'prs', 'ps', 'ur', 'he', 'heb', 'hbo', 'yi']; |
|
| 137 | + static $lang_rtl = ['ar', 'fa', 'ku', 'prs', 'ps', 'ur', 'he', 'heb', 'hbo', 'yi']; |
|
| 138 | 138 | |
| 139 | - return in_array(($lang ?: $GLOBALS['spip_lang']), $lang_rtl) ? |
|
| 140 | - $gaucher : $droitier; |
|
| 139 | + return in_array(($lang ?: $GLOBALS['spip_lang']), $lang_rtl) ? |
|
| 140 | + $gaucher : $droitier; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // typo francaise ou anglaise ? |
@@ -146,29 +146,29 @@ discard block |
||
| 146 | 146 | // sinon determiner la typo en fonction de la langue courante |
| 147 | 147 | |
| 148 | 148 | function lang_typo($lang = '') { |
| 149 | - if (!$lang) { |
|
| 150 | - $lang = $GLOBALS['lang_objet'] ?? $GLOBALS['spip_lang']; |
|
| 151 | - } |
|
| 152 | - if ( |
|
| 153 | - $lang == 'eo' |
|
| 154 | - or $lang == 'fr' |
|
| 155 | - or strncmp($lang, 'fr_', 3) == 0 |
|
| 156 | - or $lang == 'cpf' |
|
| 157 | - ) { |
|
| 158 | - return 'fr'; |
|
| 159 | - } else { |
|
| 160 | - return 'en'; |
|
| 161 | - } |
|
| 149 | + if (!$lang) { |
|
| 150 | + $lang = $GLOBALS['lang_objet'] ?? $GLOBALS['spip_lang']; |
|
| 151 | + } |
|
| 152 | + if ( |
|
| 153 | + $lang == 'eo' |
|
| 154 | + or $lang == 'fr' |
|
| 155 | + or strncmp($lang, 'fr_', 3) == 0 |
|
| 156 | + or $lang == 'cpf' |
|
| 157 | + ) { |
|
| 158 | + return 'fr'; |
|
| 159 | + } else { |
|
| 160 | + return 'en'; |
|
| 161 | + } |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // gestion de la globale $lang_objet pour que les textes soient affiches |
| 165 | 165 | // avec les memes typo et direction dans l'espace prive que dans le public |
| 166 | 166 | function changer_typo($lang = '') { |
| 167 | - if ($lang) { |
|
| 168 | - $GLOBALS['lang_objet'] = $lang; |
|
| 169 | - } else { |
|
| 170 | - unset($GLOBALS['lang_objet']); |
|
| 171 | - } |
|
| 167 | + if ($lang) { |
|
| 168 | + $GLOBALS['lang_objet'] = $lang; |
|
| 169 | + } else { |
|
| 170 | + unset($GLOBALS['lang_objet']); |
|
| 171 | + } |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // |
@@ -178,58 +178,58 @@ discard block |
||
| 178 | 178 | // pour 'changer_lang' (langue de l'article, espace prive), c'est en Ajax |
| 179 | 179 | // |
| 180 | 180 | function menu_langues($nom_select, $default = '') { |
| 181 | - include_spip('inc/actions'); |
|
| 182 | - |
|
| 183 | - $langues = liste_options_langues($nom_select); |
|
| 184 | - $ret = ''; |
|
| 185 | - if (!count($langues)) { |
|
| 186 | - return ''; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - if (!$default) { |
|
| 190 | - $default = $GLOBALS['spip_lang']; |
|
| 191 | - } |
|
| 192 | - foreach ($langues as $l) { |
|
| 193 | - $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
|
| 194 | - $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - if (!test_espace_prive()) { |
|
| 198 | - $cible = self(); |
|
| 199 | - $base = ''; |
|
| 200 | - } else { |
|
| 201 | - $cible = self(); |
|
| 202 | - $base = spip_connect() ? 'base' : ''; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - $change = ' onchange="this.parentNode.parentNode.submit()"'; |
|
| 206 | - |
|
| 207 | - return generer_action_auteur( |
|
| 208 | - 'converser', |
|
| 209 | - $base, |
|
| 210 | - $cible, |
|
| 211 | - (select_langues($nom_select, $change, $ret) |
|
| 212 | - . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | - " method='post'" |
|
| 214 | - ); |
|
| 181 | + include_spip('inc/actions'); |
|
| 182 | + |
|
| 183 | + $langues = liste_options_langues($nom_select); |
|
| 184 | + $ret = ''; |
|
| 185 | + if (!count($langues)) { |
|
| 186 | + return ''; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + if (!$default) { |
|
| 190 | + $default = $GLOBALS['spip_lang']; |
|
| 191 | + } |
|
| 192 | + foreach ($langues as $l) { |
|
| 193 | + $selected = ($l == $default) ? ' selected=\'selected\'' : ''; |
|
| 194 | + $ret .= "<option value='$l'$selected>[" . $l . '] ' . traduire_nom_langue($l) . "</option>\n"; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + if (!test_espace_prive()) { |
|
| 198 | + $cible = self(); |
|
| 199 | + $base = ''; |
|
| 200 | + } else { |
|
| 201 | + $cible = self(); |
|
| 202 | + $base = spip_connect() ? 'base' : ''; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + $change = ' onchange="this.parentNode.parentNode.submit()"'; |
|
| 206 | + |
|
| 207 | + return generer_action_auteur( |
|
| 208 | + 'converser', |
|
| 209 | + $base, |
|
| 210 | + $cible, |
|
| 211 | + (select_langues($nom_select, $change, $ret) |
|
| 212 | + . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"), |
|
| 213 | + " method='post'" |
|
| 214 | + ); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | function select_langues($nom_select, $change, $options, $label = '') { |
| 218 | - static $cpt = 0; |
|
| 219 | - $id = 'menu_langues' . $cpt++; |
|
| 220 | - |
|
| 221 | - return |
|
| 222 | - "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | - "<select name='$nom_select' id='$id' " |
|
| 224 | - . ((!test_espace_prive()) ? |
|
| 225 | - ("class='forml menu_langues'") : |
|
| 226 | - (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | - ("class='lang_ecrire'") : |
|
| 228 | - "class='fondl'")) |
|
| 229 | - . $change |
|
| 230 | - . ">\n" |
|
| 231 | - . $options |
|
| 232 | - . '</select>'; |
|
| 218 | + static $cpt = 0; |
|
| 219 | + $id = 'menu_langues' . $cpt++; |
|
| 220 | + |
|
| 221 | + return |
|
| 222 | + "<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' . |
|
| 223 | + "<select name='$nom_select' id='$id' " |
|
| 224 | + . ((!test_espace_prive()) ? |
|
| 225 | + ("class='forml menu_langues'") : |
|
| 226 | + (($nom_select == 'var_lang_ecrire') ? |
|
| 227 | + ("class='lang_ecrire'") : |
|
| 228 | + "class='fondl'")) |
|
| 229 | + . $change |
|
| 230 | + . ">\n" |
|
| 231 | + . $options |
|
| 232 | + . '</select>'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -251,34 +251,34 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | function liste_options_langues($nom_select) { |
| 253 | 253 | |
| 254 | - switch ($nom_select) { |
|
| 255 | - # #MENU_LANG |
|
| 256 | - case 'var_lang': |
|
| 257 | - # menu de changement de la langue d'un article |
|
| 258 | - # les langues selectionnees dans la configuration "multilinguisme" |
|
| 259 | - case 'changer_lang': |
|
| 260 | - $langues = explode(',', $GLOBALS['meta']['langues_multilingue']); |
|
| 261 | - break; |
|
| 262 | - # menu de l'interface (privee, installation et panneau de login) |
|
| 263 | - # les langues presentes sous forme de fichiers de langue |
|
| 264 | - # on force la relecture du repertoire des langues pour etre synchrone. |
|
| 265 | - case 'var_lang_ecrire': |
|
| 266 | - default: |
|
| 267 | - $GLOBALS['meta']['langues_proposees'] = ''; |
|
| 268 | - init_langues(); |
|
| 269 | - $langues = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 270 | - break; |
|
| 254 | + switch ($nom_select) { |
|
| 255 | + # #MENU_LANG |
|
| 256 | + case 'var_lang': |
|
| 257 | + # menu de changement de la langue d'un article |
|
| 258 | + # les langues selectionnees dans la configuration "multilinguisme" |
|
| 259 | + case 'changer_lang': |
|
| 260 | + $langues = explode(',', $GLOBALS['meta']['langues_multilingue']); |
|
| 261 | + break; |
|
| 262 | + # menu de l'interface (privee, installation et panneau de login) |
|
| 263 | + # les langues presentes sous forme de fichiers de langue |
|
| 264 | + # on force la relecture du repertoire des langues pour etre synchrone. |
|
| 265 | + case 'var_lang_ecrire': |
|
| 266 | + default: |
|
| 267 | + $GLOBALS['meta']['langues_proposees'] = ''; |
|
| 268 | + init_langues(); |
|
| 269 | + $langues = explode(',', $GLOBALS['meta']['langues_proposees']); |
|
| 270 | + break; |
|
| 271 | 271 | |
| 272 | 272 | # dernier choix possible : toutes les langues = langues_proposees |
| 273 | 273 | # + langues_multilingues ; mais, ne sert pas |
| 274 | 274 | # $langues = explode(',', $GLOBALS['all_langs']); |
| 275 | - } |
|
| 276 | - if (count($langues) <= 1) { |
|
| 277 | - return []; |
|
| 278 | - } |
|
| 279 | - sort($langues); |
|
| 275 | + } |
|
| 276 | + if (count($langues) <= 1) { |
|
| 277 | + return []; |
|
| 278 | + } |
|
| 279 | + sort($langues); |
|
| 280 | 280 | |
| 281 | - return $langues; |
|
| 281 | + return $langues; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
@@ -293,39 +293,39 @@ discard block |
||
| 293 | 293 | **/ |
| 294 | 294 | function verifier_lang_url() { |
| 295 | 295 | |
| 296 | - // quelle langue est demandee ? |
|
| 297 | - $lang_demandee = (test_espace_prive() ? $GLOBALS['spip_lang'] : $GLOBALS['meta']['langue_site']); |
|
| 298 | - if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 299 | - $lang_demandee = $_COOKIE['spip_lang_ecrire']; |
|
| 300 | - } |
|
| 301 | - if (!test_espace_prive() and isset($_COOKIE['spip_lang'])) { |
|
| 302 | - $lang_demandee = $_COOKIE['spip_lang']; |
|
| 303 | - } |
|
| 304 | - if (isset($_GET['lang'])) { |
|
| 305 | - $lang_demandee = $_GET['lang']; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - // Renvoyer si besoin (et si la langue demandee existe) |
|
| 309 | - if ( |
|
| 310 | - $GLOBALS['spip_lang'] != $lang_demandee |
|
| 311 | - and changer_langue($lang_demandee) |
|
| 312 | - and $lang_demandee != @$_GET['lang'] |
|
| 313 | - ) { |
|
| 314 | - $destination = parametre_url(self(), 'lang', $lang_demandee, '&'); |
|
| 315 | - // ici on a besoin des var_truc |
|
| 316 | - foreach ($_GET as $var => $val) { |
|
| 317 | - if (!strncmp('var_', $var, 4)) { |
|
| 318 | - $destination = parametre_url($destination, $var, $val, '&'); |
|
| 319 | - } |
|
| 320 | - } |
|
| 321 | - include_spip('inc/headers'); |
|
| 322 | - redirige_par_entete($destination); |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - // Subtilite : si la langue demandee par cookie est la bonne |
|
| 326 | - // alors on fait comme si $lang etait passee dans l'URL |
|
| 327 | - // (pour criteres {lang}). |
|
| 328 | - $GLOBALS['lang'] = $_GET['lang'] = $GLOBALS['spip_lang']; |
|
| 296 | + // quelle langue est demandee ? |
|
| 297 | + $lang_demandee = (test_espace_prive() ? $GLOBALS['spip_lang'] : $GLOBALS['meta']['langue_site']); |
|
| 298 | + if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 299 | + $lang_demandee = $_COOKIE['spip_lang_ecrire']; |
|
| 300 | + } |
|
| 301 | + if (!test_espace_prive() and isset($_COOKIE['spip_lang'])) { |
|
| 302 | + $lang_demandee = $_COOKIE['spip_lang']; |
|
| 303 | + } |
|
| 304 | + if (isset($_GET['lang'])) { |
|
| 305 | + $lang_demandee = $_GET['lang']; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + // Renvoyer si besoin (et si la langue demandee existe) |
|
| 309 | + if ( |
|
| 310 | + $GLOBALS['spip_lang'] != $lang_demandee |
|
| 311 | + and changer_langue($lang_demandee) |
|
| 312 | + and $lang_demandee != @$_GET['lang'] |
|
| 313 | + ) { |
|
| 314 | + $destination = parametre_url(self(), 'lang', $lang_demandee, '&'); |
|
| 315 | + // ici on a besoin des var_truc |
|
| 316 | + foreach ($_GET as $var => $val) { |
|
| 317 | + if (!strncmp('var_', $var, 4)) { |
|
| 318 | + $destination = parametre_url($destination, $var, $val, '&'); |
|
| 319 | + } |
|
| 320 | + } |
|
| 321 | + include_spip('inc/headers'); |
|
| 322 | + redirige_par_entete($destination); |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + // Subtilite : si la langue demandee par cookie est la bonne |
|
| 326 | + // alors on fait comme si $lang etait passee dans l'URL |
|
| 327 | + // (pour criteres {lang}). |
|
| 328 | + $GLOBALS['lang'] = $_GET['lang'] = $GLOBALS['spip_lang']; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | |
@@ -343,22 +343,22 @@ discard block |
||
| 343 | 343 | * La langue sélectionnée |
| 344 | 344 | **/ |
| 345 | 345 | function utiliser_langue_site($liste_langues = null) { |
| 346 | - // s'il existe une langue du site (en gros tout le temps en théorie) |
|
| 347 | - if ( |
|
| 348 | - isset($GLOBALS['meta']['langue_site']) |
|
| 349 | - // et si spip_langue est pas encore définie (ce que va faire changer_langue()) |
|
| 350 | - // ou qu'elle n'est pas identique à la langue du site |
|
| 351 | - and (!isset($GLOBALS['spip_lang']) |
|
| 352 | - or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
|
| 353 | - ) { |
|
| 354 | - return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 355 | - } |
|
| 356 | - // en theorie là, la globale est définie, sinon c'est un problème. |
|
| 357 | - if (!isset($GLOBALS['spip_lang'])) { |
|
| 358 | - spip_log('La globale spip_lang est indéfinie dans utiliser_langue_site() !', _LOG_ERREUR); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - return $GLOBALS['spip_lang']; |
|
| 346 | + // s'il existe une langue du site (en gros tout le temps en théorie) |
|
| 347 | + if ( |
|
| 348 | + isset($GLOBALS['meta']['langue_site']) |
|
| 349 | + // et si spip_langue est pas encore définie (ce que va faire changer_langue()) |
|
| 350 | + // ou qu'elle n'est pas identique à la langue du site |
|
| 351 | + and (!isset($GLOBALS['spip_lang']) |
|
| 352 | + or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']) |
|
| 353 | + ) { |
|
| 354 | + return changer_langue($GLOBALS['meta']['langue_site'], $liste_langues);//@:install |
|
| 355 | + } |
|
| 356 | + // en theorie là, la globale est définie, sinon c'est un problème. |
|
| 357 | + if (!isset($GLOBALS['spip_lang'])) { |
|
| 358 | + spip_log('La globale spip_lang est indéfinie dans utiliser_langue_site() !', _LOG_ERREUR); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + return $GLOBALS['spip_lang']; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -377,35 +377,35 @@ discard block |
||
| 377 | 377 | **/ |
| 378 | 378 | function utiliser_langue_visiteur($liste_langues = null) { |
| 379 | 379 | |
| 380 | - // si on est dans l'espace public et pas de $liste_langues : se limiter a la config langues_multilingue si définie |
|
| 381 | - if (is_null($liste_langues) and !test_espace_prive() and !empty($GLOBALS['meta']['langues_multilingue'])) { |
|
| 382 | - $liste_langues = $GLOBALS['meta']['langues_multilingue']; |
|
| 383 | - } |
|
| 384 | - |
|
| 385 | - $l = (!test_espace_prive() ? 'spip_lang' : 'spip_lang_ecrire'); |
|
| 386 | - if (isset($_COOKIE[$l])) { |
|
| 387 | - if (changer_langue($l = $_COOKIE[$l], $liste_langues)) { |
|
| 388 | - return $l; |
|
| 389 | - } |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - if (isset($GLOBALS['visiteur_session']['lang'])) { |
|
| 393 | - if (changer_langue($l = $GLOBALS['visiteur_session']['lang'], $liste_langues)) { |
|
| 394 | - return $l; |
|
| 395 | - } |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 399 | - foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $s) { |
|
| 400 | - if (preg_match('#^([a-z]{2,3})(-[a-z]{2,3})?(;q=[0-9.]+)?$#i', trim($s), $r)) { |
|
| 401 | - if (changer_langue($l = strtolower($r[1]), $liste_langues)) { |
|
| 402 | - return $l; |
|
| 403 | - } |
|
| 404 | - } |
|
| 405 | - } |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - return utiliser_langue_site($liste_langues); |
|
| 380 | + // si on est dans l'espace public et pas de $liste_langues : se limiter a la config langues_multilingue si définie |
|
| 381 | + if (is_null($liste_langues) and !test_espace_prive() and !empty($GLOBALS['meta']['langues_multilingue'])) { |
|
| 382 | + $liste_langues = $GLOBALS['meta']['langues_multilingue']; |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + $l = (!test_espace_prive() ? 'spip_lang' : 'spip_lang_ecrire'); |
|
| 386 | + if (isset($_COOKIE[$l])) { |
|
| 387 | + if (changer_langue($l = $_COOKIE[$l], $liste_langues)) { |
|
| 388 | + return $l; |
|
| 389 | + } |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + if (isset($GLOBALS['visiteur_session']['lang'])) { |
|
| 393 | + if (changer_langue($l = $GLOBALS['visiteur_session']['lang'], $liste_langues)) { |
|
| 394 | + return $l; |
|
| 395 | + } |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 399 | + foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $s) { |
|
| 400 | + if (preg_match('#^([a-z]{2,3})(-[a-z]{2,3})?(;q=[0-9.]+)?$#i', trim($s), $r)) { |
|
| 401 | + if (changer_langue($l = strtolower($r[1]), $liste_langues)) { |
|
| 402 | + return $l; |
|
| 403 | + } |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + return utiliser_langue_site($liste_langues); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | * @return int |
| 416 | 416 | */ |
| 417 | 417 | function match_langue($chaine) { |
| 418 | - return preg_match('/^[a-z]{2,3}(_[a-z]{2,3}){0,2}$/', $chaine); |
|
| 418 | + return preg_match('/^[a-z]{2,3}(_[a-z]{2,3}){0,2}$/', $chaine); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
@@ -433,36 +433,36 @@ discard block |
||
| 433 | 433 | **/ |
| 434 | 434 | function init_langues() { |
| 435 | 435 | |
| 436 | - // liste des langues dans les meta, sauf a l'install |
|
| 437 | - $all_langs = $GLOBALS['meta']['langues_proposees'] ?? ''; |
|
| 438 | - |
|
| 439 | - $tout = []; |
|
| 440 | - if (!$all_langs) { |
|
| 441 | - // trouver tous les modules lang/spip_xx.php |
|
| 442 | - $modules = find_all_in_path('lang/', '/spip_([a-z_]+)\.php$'); |
|
| 443 | - foreach ($modules as $name => $path) { |
|
| 444 | - if (preg_match(',^spip_([a-z_]+)\.php$,', $name, $regs)) { |
|
| 445 | - if (match_langue($regs[1])) { |
|
| 446 | - $tout[] = $regs[1]; |
|
| 447 | - } |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - sort($tout); |
|
| 451 | - $tout = join(',', $tout); |
|
| 452 | - // Si les langues n'ont pas change, ne rien faire |
|
| 453 | - if ($tout != $all_langs) { |
|
| 454 | - $GLOBALS['meta']['langues_proposees'] = $tout; |
|
| 455 | - include_spip('inc/meta'); |
|
| 456 | - ecrire_meta('langues_proposees', $tout); |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - if (!isset($GLOBALS['meta']['langue_site'])) { |
|
| 460 | - // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
|
| 461 | - $GLOBALS['meta']['langue_site'] = $tout = |
|
| 462 | - (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 463 | - ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
|
| 464 | - ecrire_meta('langue_site', $tout); |
|
| 465 | - } |
|
| 436 | + // liste des langues dans les meta, sauf a l'install |
|
| 437 | + $all_langs = $GLOBALS['meta']['langues_proposees'] ?? ''; |
|
| 438 | + |
|
| 439 | + $tout = []; |
|
| 440 | + if (!$all_langs) { |
|
| 441 | + // trouver tous les modules lang/spip_xx.php |
|
| 442 | + $modules = find_all_in_path('lang/', '/spip_([a-z_]+)\.php$'); |
|
| 443 | + foreach ($modules as $name => $path) { |
|
| 444 | + if (preg_match(',^spip_([a-z_]+)\.php$,', $name, $regs)) { |
|
| 445 | + if (match_langue($regs[1])) { |
|
| 446 | + $tout[] = $regs[1]; |
|
| 447 | + } |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + sort($tout); |
|
| 451 | + $tout = join(',', $tout); |
|
| 452 | + // Si les langues n'ont pas change, ne rien faire |
|
| 453 | + if ($tout != $all_langs) { |
|
| 454 | + $GLOBALS['meta']['langues_proposees'] = $tout; |
|
| 455 | + include_spip('inc/meta'); |
|
| 456 | + ecrire_meta('langues_proposees', $tout); |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + if (!isset($GLOBALS['meta']['langue_site'])) { |
|
| 460 | + // Initialisation : le francais si dispo, sinon la premiere langue trouvee |
|
| 461 | + $GLOBALS['meta']['langue_site'] = $tout = |
|
| 462 | + (!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false)) |
|
| 463 | + ? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ',')); |
|
| 464 | + ecrire_meta('langue_site', $tout); |
|
| 465 | + } |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | * Code html de la balise <html> |
| 477 | 477 | **/ |
| 478 | 478 | function html_lang_attributes() { |
| 479 | - $lang = $GLOBALS['spip_lang']; |
|
| 480 | - $dir = lang_dir($lang); |
|
| 479 | + $lang = $GLOBALS['spip_lang']; |
|
| 480 | + $dir = lang_dir($lang); |
|
| 481 | 481 | |
| 482 | - return "<html class='$dir $lang no-js' xmlns='http://www.w3.org/1999/xhtml' lang='$lang' dir='$dir'>\n"; |
|
| 482 | + return "<html class='$dir $lang no-js' xmlns='http://www.w3.org/1999/xhtml' lang='$lang' dir='$dir'>\n"; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @return string |
| 494 | 494 | */ |
| 495 | 495 | function aide_lang_dir($spip_lang, $spip_lang_rtl) { |
| 496 | - return ($spip_lang <> 'he') ? $spip_lang_rtl : ''; |
|
| 496 | + return ($spip_lang <> 'he') ? $spip_lang_rtl : ''; |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | |
@@ -4,211 +4,211 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'activer_plugin' => 'Plugin uk naktayaña |
|
| 12 | + // A |
|
| 13 | + 'activer_plugin' => 'Plugin uk naktayaña |
|
| 14 | 14 | ', |
| 15 | - 'aide_non_disponible' => 'Aka yanapa naktatxa janiw aka arunx wakitakiti.', |
|
| 16 | - 'auteur' => 'Qillqiri:', |
|
| 17 | - 'avis_acces_interdit' => 'Mantawx jark’ata.', |
|
| 18 | - 'avis_article_modifie' => 'Amuyam @nom_auteur_modif@ aka qillqatax irnaqataw @date_diff@ ninkharata.', |
|
| 19 | - 'avis_aucun_resultat' => 'Janiw askichat utjkiti. |
|
| 15 | + 'aide_non_disponible' => 'Aka yanapa naktatxa janiw aka arunx wakitakiti.', |
|
| 16 | + 'auteur' => 'Qillqiri:', |
|
| 17 | + 'avis_acces_interdit' => 'Mantawx jark’ata.', |
|
| 18 | + 'avis_article_modifie' => 'Amuyam @nom_auteur_modif@ aka qillqatax irnaqataw @date_diff@ ninkharata.', |
|
| 19 | + 'avis_aucun_resultat' => 'Janiw askichat utjkiti. |
|
| 20 | 20 | ', |
| 21 | - 'avis_chemin_invalide_1' => 'Thakhix ajllita', |
|
| 22 | - 'avis_chemin_invalide_2' => 'Jan jamakiw iyaw satakiti. Nayrt’ir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.', |
|
| 23 | - 'avis_connexion_echec_1' => 'Chinuwix jalanuqirirux janiw walt’kiti MySQL.', |
|
| 24 | - 'avis_connexion_echec_2' => 'Arkir laphi uñnaqar kutt’am ukatsti jikit yatiyawinaka mayamp uñjam.', |
|
| 25 | - 'avis_connexion_echec_3' => '<b>Amuyam:</b> Walja jalanuqirinakana, munasiwa <b>mayiña</b> mantawitx naktata yatqalltawiru MySQL janir apnaqasa. Janitix chinusiñ puyrktaxa mayampi uñjam lartax ukja.', |
|
| 26 | - 'avis_connexion_ldap_echec_1' => 'Jalanuqirirux chinuwi ukaxa LDAP janiw walt’kiti.', |
|
| 27 | - 'avis_connexion_ldap_echec_2' => 'Nayrir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.', |
|
| 28 | - 'avis_connexion_ldap_echec_3' => 'Mayakipawjam, askichir ukax jan apnaqamti LDAP apnaqirinak apayaniñataki.', |
|
| 29 | - 'avis_deplacement_rubrique' => '¡AMUYAM! Aka t’aqan utjiwa @contient_breves@ breve@scb@. Janitix yäqtaxa, iyaw sat casilla uk naktayam.', |
|
| 30 | - 'avis_erreur_connexion_mysql' => 'Chinuw pantjata MySQL', |
|
| 31 | - 'avis_espace_interdit' => '<b>Ch’usawx jark’ata</b> <div>SPIP ukax uchantataxiwa</div>', |
|
| 32 | - 'avis_lecture_noms_bases_1' => 'Uchantat pirwa yatiyawinakatxa uchantir prugramaxa janiw liykiti.', |
|
| 33 | - 'avis_lecture_noms_bases_3' => 'Payir lurawinxa, inas mä pirwa apnaqiri sutimampi apnaqasispa:', |
|
| 34 | - 'avis_non_acces_page' => 'Aka laphi uñnaqarux janiw mantañaniktati.', |
|
| 35 | - 'avis_operation_echec' => 'Lurawix janiw walt’kiti.', |
|
| 36 | - 'avis_operation_impossible' => 'Lurawix janipuni', |
|
| 37 | - 'avis_suppression_base' => '¡AMUYAM, apaqat yatiyawinakax janiw askichaskaspati!', |
|
| 21 | + 'avis_chemin_invalide_1' => 'Thakhix ajllita', |
|
| 22 | + 'avis_chemin_invalide_2' => 'Jan jamakiw iyaw satakiti. Nayrt’ir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.', |
|
| 23 | + 'avis_connexion_echec_1' => 'Chinuwix jalanuqirirux janiw walt’kiti MySQL.', |
|
| 24 | + 'avis_connexion_echec_2' => 'Arkir laphi uñnaqar kutt’am ukatsti jikit yatiyawinaka mayamp uñjam.', |
|
| 25 | + 'avis_connexion_echec_3' => '<b>Amuyam:</b> Walja jalanuqirinakana, munasiwa <b>mayiña</b> mantawitx naktata yatqalltawiru MySQL janir apnaqasa. Janitix chinusiñ puyrktaxa mayampi uñjam lartax ukja.', |
|
| 26 | + 'avis_connexion_ldap_echec_1' => 'Jalanuqirirux chinuwi ukaxa LDAP janiw walt’kiti.', |
|
| 27 | + 'avis_connexion_ldap_echec_2' => 'Nayrir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.', |
|
| 28 | + 'avis_connexion_ldap_echec_3' => 'Mayakipawjam, askichir ukax jan apnaqamti LDAP apnaqirinak apayaniñataki.', |
|
| 29 | + 'avis_deplacement_rubrique' => '¡AMUYAM! Aka t’aqan utjiwa @contient_breves@ breve@scb@. Janitix yäqtaxa, iyaw sat casilla uk naktayam.', |
|
| 30 | + 'avis_erreur_connexion_mysql' => 'Chinuw pantjata MySQL', |
|
| 31 | + 'avis_espace_interdit' => '<b>Ch’usawx jark’ata</b> <div>SPIP ukax uchantataxiwa</div>', |
|
| 32 | + 'avis_lecture_noms_bases_1' => 'Uchantat pirwa yatiyawinakatxa uchantir prugramaxa janiw liykiti.', |
|
| 33 | + 'avis_lecture_noms_bases_3' => 'Payir lurawinxa, inas mä pirwa apnaqiri sutimampi apnaqasispa:', |
|
| 34 | + 'avis_non_acces_page' => 'Aka laphi uñnaqarux janiw mantañaniktati.', |
|
| 35 | + 'avis_operation_echec' => 'Lurawix janiw walt’kiti.', |
|
| 36 | + 'avis_operation_impossible' => 'Lurawix janipuni', |
|
| 37 | + 'avis_suppression_base' => '¡AMUYAM, apaqat yatiyawinakax janiw askichaskaspati!', |
|
| 38 | 38 | |
| 39 | - // B |
|
| 40 | - 'bouton_acces_ldap' => 'Mä mantaw yapaña LDAP', |
|
| 41 | - 'bouton_ajouter' => 'Yapaña', |
|
| 42 | - 'bouton_annuler' => 'Jiwt’ayaña', |
|
| 43 | - 'bouton_demande_publication' => 'Aka qillqat yatiyañ mayiña', |
|
| 44 | - 'bouton_desactive_tout' => 'Taqpach jiwt’ayaña', |
|
| 45 | - 'bouton_effacer_tout' => '¡Taqpach chhaqhayaña!', |
|
| 46 | - 'bouton_envoyer_message' => 'Qhananchat yatiyaw: apayaña', |
|
| 47 | - 'bouton_modifier' => 'Mayjachaña', |
|
| 48 | - 'bouton_radio_afficher' => 'Uñachayaña', |
|
| 49 | - 'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Chint’at tanta qillqirinakan uñstaña', |
|
| 50 | - 'bouton_radio_envoi_annonces_adresse' => 'Yatiyawinak utjawir apayaña:', |
|
| 51 | - 'bouton_radio_envoi_liste_nouveautes' => 'Machaq tanta yatiyawinak apayaña', |
|
| 52 | - 'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Tanta qillqirinakan jan uñstaña', |
|
| 53 | - 'bouton_radio_non_envoi_annonces_editoriales' => 'Yatiyawinak qhanstat jan apayaña', |
|
| 54 | - 'bouton_redirection' => 'Irpxatawi', |
|
| 55 | - 'bouton_relancer_installation' => 'Mayamp uchantaw yatiyaña', |
|
| 56 | - 'bouton_suivant' => 'Jutiri', |
|
| 57 | - 'bouton_tenter_recuperation' => 'Askichañ yant’aña', |
|
| 58 | - 'bouton_test_proxy' => 'proxy uk yant’aña', |
|
| 59 | - 'bouton_vider_cache' => 'caché uk ch’usachaña', |
|
| 39 | + // B |
|
| 40 | + 'bouton_acces_ldap' => 'Mä mantaw yapaña LDAP', |
|
| 41 | + 'bouton_ajouter' => 'Yapaña', |
|
| 42 | + 'bouton_annuler' => 'Jiwt’ayaña', |
|
| 43 | + 'bouton_demande_publication' => 'Aka qillqat yatiyañ mayiña', |
|
| 44 | + 'bouton_desactive_tout' => 'Taqpach jiwt’ayaña', |
|
| 45 | + 'bouton_effacer_tout' => '¡Taqpach chhaqhayaña!', |
|
| 46 | + 'bouton_envoyer_message' => 'Qhananchat yatiyaw: apayaña', |
|
| 47 | + 'bouton_modifier' => 'Mayjachaña', |
|
| 48 | + 'bouton_radio_afficher' => 'Uñachayaña', |
|
| 49 | + 'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Chint’at tanta qillqirinakan uñstaña', |
|
| 50 | + 'bouton_radio_envoi_annonces_adresse' => 'Yatiyawinak utjawir apayaña:', |
|
| 51 | + 'bouton_radio_envoi_liste_nouveautes' => 'Machaq tanta yatiyawinak apayaña', |
|
| 52 | + 'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Tanta qillqirinakan jan uñstaña', |
|
| 53 | + 'bouton_radio_non_envoi_annonces_editoriales' => 'Yatiyawinak qhanstat jan apayaña', |
|
| 54 | + 'bouton_redirection' => 'Irpxatawi', |
|
| 55 | + 'bouton_relancer_installation' => 'Mayamp uchantaw yatiyaña', |
|
| 56 | + 'bouton_suivant' => 'Jutiri', |
|
| 57 | + 'bouton_tenter_recuperation' => 'Askichañ yant’aña', |
|
| 58 | + 'bouton_test_proxy' => 'proxy uk yant’aña', |
|
| 59 | + 'bouton_vider_cache' => 'caché uk ch’usachaña', |
|
| 60 | 60 | |
| 61 | - // C |
|
| 62 | - 'cache_modifiable_webmestre' => 'Aka amuykipawix mayxt’ataspaw webmistress qamawit ukata.', |
|
| 61 | + // C |
|
| 62 | + 'cache_modifiable_webmestre' => 'Aka amuykipawix mayxt’ataspaw webmistress qamawit ukata.', |
|
| 63 | 63 | |
| 64 | - // D |
|
| 65 | - 'date_mot_heures' => 'urasa |
|
| 64 | + // D |
|
| 65 | + 'date_mot_heures' => 'urasa |
|
| 66 | 66 | ', |
| 67 | 67 | |
| 68 | - // E |
|
| 69 | - 'email' => 'aruskipayiri', |
|
| 70 | - 'email_2' => 'aruskipayiri: |
|
| 68 | + // E |
|
| 69 | + 'email' => 'aruskipayiri', |
|
| 70 | + 'email_2' => 'aruskipayiri: |
|
| 71 | 71 | ', |
| 72 | - 'entree_adresse_annuaire' => 'Marpachat utjawi', |
|
| 73 | - 'entree_adresse_email' => 'Aruskipayirima', |
|
| 74 | - 'entree_base_donnee_1' => 'Pirwat yatiyawinakaxa utjawi', |
|
| 75 | - 'entree_biographie' => 'Mä juk’a jakawipat qillqa, juk’a arunakampi...', |
|
| 76 | - 'entree_chemin_acces' => '<b>Mantaña</b> mantañ thakhixa:', |
|
| 77 | - 'entree_cle_pgp' => 'Impt’atama PGP', |
|
| 78 | - 'entree_contenu_rubrique' => '(T’aqan utjawipa, qawqha arunakampi)', |
|
| 79 | - 'entree_identifiants_connexion' => 'Chinuw uñacht’ayirinakama...', |
|
| 80 | - 'entree_informations_connexion_ldap' => 'Aka phuqañ laphina yatiyawinak conexión ukata jach’a q’ipimaru LDAP. Uka yatiyawinakxa yatiyanitamwa apnaqir apnaqawita jan ukjax red ukata', |
|
| 81 | - 'entree_infos_perso' => '¿Khititasa?', |
|
| 82 | - 'entree_interieur_rubrique' => 'T’aqata maqhana...', |
|
| 83 | - 'entree_liens_sites' => '<b>Chinu jach’a sawu </b>(aytata, qamaw tumpañataki, ...)', |
|
| 84 | - 'entree_login' => 'Sutichatama', |
|
| 85 | - 'entree_login_connexion_1' => 'Chinu uñacht’ayirima', |
|
| 86 | - 'entree_mot_passe' => 'Imt’awima', |
|
| 87 | - 'entree_mot_passe_1' => 'Chinu imt’awima', |
|
| 88 | - 'entree_mot_passe_2' => '(Awisax FTP imt’atamar ukankiwa ukatsti awisax ch’usak jayti)', |
|
| 89 | - 'entree_nom_fichier' => 'K’ipit sutipa uk uchantaña @texte_compresse@:', |
|
| 90 | - 'entree_nom_pseudo' => 'Sutima jan ukax sutinchama', |
|
| 91 | - 'entree_nom_pseudo_1' => 'Sutima jan ukax sutinchama', |
|
| 92 | - 'entree_nom_site' => 'Qamawiman sutipa', |
|
| 93 | - 'entree_nouveau_passe' => 'Machaq imt’awima', |
|
| 94 | - 'entree_passe_ldap' => 'Imt’awima', |
|
| 95 | - 'entree_port_annuaire' => 'Marpachat thakhin jakhu', |
|
| 96 | - 'entree_signature' => 'Iyawsa', |
|
| 97 | - 'entree_titre_obligatoire' => '<b>Sutinchata</b> [Obligatorio]<br />', |
|
| 98 | - 'entree_url' => 'Utjawi(URL) qamawimata', |
|
| 99 | - 'erreur_plugin_fichier_absent' => 'Jan utjaw q’ipi |
|
| 72 | + 'entree_adresse_annuaire' => 'Marpachat utjawi', |
|
| 73 | + 'entree_adresse_email' => 'Aruskipayirima', |
|
| 74 | + 'entree_base_donnee_1' => 'Pirwat yatiyawinakaxa utjawi', |
|
| 75 | + 'entree_biographie' => 'Mä juk’a jakawipat qillqa, juk’a arunakampi...', |
|
| 76 | + 'entree_chemin_acces' => '<b>Mantaña</b> mantañ thakhixa:', |
|
| 77 | + 'entree_cle_pgp' => 'Impt’atama PGP', |
|
| 78 | + 'entree_contenu_rubrique' => '(T’aqan utjawipa, qawqha arunakampi)', |
|
| 79 | + 'entree_identifiants_connexion' => 'Chinuw uñacht’ayirinakama...', |
|
| 80 | + 'entree_informations_connexion_ldap' => 'Aka phuqañ laphina yatiyawinak conexión ukata jach’a q’ipimaru LDAP. Uka yatiyawinakxa yatiyanitamwa apnaqir apnaqawita jan ukjax red ukata', |
|
| 81 | + 'entree_infos_perso' => '¿Khititasa?', |
|
| 82 | + 'entree_interieur_rubrique' => 'T’aqata maqhana...', |
|
| 83 | + 'entree_liens_sites' => '<b>Chinu jach’a sawu </b>(aytata, qamaw tumpañataki, ...)', |
|
| 84 | + 'entree_login' => 'Sutichatama', |
|
| 85 | + 'entree_login_connexion_1' => 'Chinu uñacht’ayirima', |
|
| 86 | + 'entree_mot_passe' => 'Imt’awima', |
|
| 87 | + 'entree_mot_passe_1' => 'Chinu imt’awima', |
|
| 88 | + 'entree_mot_passe_2' => '(Awisax FTP imt’atamar ukankiwa ukatsti awisax ch’usak jayti)', |
|
| 89 | + 'entree_nom_fichier' => 'K’ipit sutipa uk uchantaña @texte_compresse@:', |
|
| 90 | + 'entree_nom_pseudo' => 'Sutima jan ukax sutinchama', |
|
| 91 | + 'entree_nom_pseudo_1' => 'Sutima jan ukax sutinchama', |
|
| 92 | + 'entree_nom_site' => 'Qamawiman sutipa', |
|
| 93 | + 'entree_nouveau_passe' => 'Machaq imt’awima', |
|
| 94 | + 'entree_passe_ldap' => 'Imt’awima', |
|
| 95 | + 'entree_port_annuaire' => 'Marpachat thakhin jakhu', |
|
| 96 | + 'entree_signature' => 'Iyawsa', |
|
| 97 | + 'entree_titre_obligatoire' => '<b>Sutinchata</b> [Obligatorio]<br />', |
|
| 98 | + 'entree_url' => 'Utjawi(URL) qamawimata', |
|
| 99 | + 'erreur_plugin_fichier_absent' => 'Jan utjaw q’ipi |
|
| 100 | 100 | ', |
| 101 | - 'erreur_plugin_fichier_def_absent' => 'Qhanstayat q’ipix janiw utjkiti', |
|
| 102 | - 'erreur_plugin_nom_fonction_interdit' => 'Lurt’awit sutix jark’ata', |
|
| 103 | - 'erreur_plugin_nom_manquant' => 'Jan utjawi plugin ukan sutipa', |
|
| 104 | - 'erreur_plugin_prefix_manquant' => 'Sutinakat ch’usawj pluguin ukat jan qhanstata', |
|
| 105 | - 'erreur_plugin_tag_plugin_absent' => 'Janiw utjkiti <plugin> qhanstayawin q’ipita', |
|
| 106 | - 'erreur_plugin_version_manquant' => 'Pluguin ukat uñjata jan utjkiti', |
|
| 101 | + 'erreur_plugin_fichier_def_absent' => 'Qhanstayat q’ipix janiw utjkiti', |
|
| 102 | + 'erreur_plugin_nom_fonction_interdit' => 'Lurt’awit sutix jark’ata', |
|
| 103 | + 'erreur_plugin_nom_manquant' => 'Jan utjawi plugin ukan sutipa', |
|
| 104 | + 'erreur_plugin_prefix_manquant' => 'Sutinakat ch’usawj pluguin ukat jan qhanstata', |
|
| 105 | + 'erreur_plugin_tag_plugin_absent' => 'Janiw utjkiti <plugin> qhanstayawin q’ipita', |
|
| 106 | + 'erreur_plugin_version_manquant' => 'Pluguin ukat uñjata jan utjkiti', |
|
| 107 | 107 | |
| 108 | - // I |
|
| 109 | - 'ical_info1' => 'Aka qamawinxa kunayman lurawinak chinusiñataki utji qamaw utjawipampi', |
|
| 110 | - 'ical_info2' => 'Aka taqpach lurawinakxat juk’amp yatxatañatakix, yatxatañatakix jan pächasimti <a href="@spipnet@">illqanakawi</a>.', # MODIF |
|
| 111 | - 'ical_info_calendrier' => 'Pä pachachimpuw utjtam. Mayirix qamawit mä laphi uñnaqawa kunanti taqpach yatiyat qillqatank yatiyi: jumakiw uñjtax uka mä suti imt’awi ukata, ukatxa mayjt’ayasmaw kuna pachtix munktax ukja imt’awim mayjt’ayasa.', |
|
| 112 | - 'ical_methode_http' => 'Apaqaña', |
|
| 113 | - 'ical_methode_webcal' => 'Kikipawi (webcal://)', # MODIF |
|
| 114 | - 'ical_texte_prive' => 'Aka sapa maynit pacha chimpuxa, aka qamawit jark’ata lurawinak yatiytam (lurawinaka ukatsti sapa maynit aytatanaka, qillqatanaka ukatsti jisk’aptat amtanaka...)', |
|
| 115 | - 'ical_texte_public' => 'Aka pacha chimpux uñchukiytam qamawit lurawinaka (qillqatanak ukatsti jisk’aptatanak yatiyata).', |
|
| 116 | - 'ical_texte_rss' => 'Machaq yatiyawinak aka qamawitxa apxasismaw kawkir q’ipinak liyt’irimpi XML/RSS (Rich Site Summary) utt’ayataru. Ukhamaraki SPIP ukax liyt’aspaw machaq yatiyat yatiyawinaka yaqha qamawinakana kawkinti turkakipaw utt’ayatampi lurapxi (apxasit qamawinaka). ', |
|
| 117 | - 'ical_titre_js' => 'Javascript', |
|
| 118 | - 'ical_titre_mailing' => 'Aruskipayirit tanta', |
|
| 119 | - 'ical_titre_rss' => 'Apxasit q’ipinaka', |
|
| 120 | - 'icone_activer_cookie' => '“Cookie” uk naktayaña yatiyawinakata', |
|
| 121 | - 'icone_admin_plugin' => 'Pluguin ukanakat apnaqawi', |
|
| 122 | - 'icone_afficher_auteurs' => 'Qillqirinaka uñachayaña', |
|
| 123 | - 'icone_afficher_visiteurs' => 'Tumpirinaka uñachayaña', |
|
| 124 | - 'icone_arret_discussion' => 'Aka aruskipawin jan mayamp arst’añati', |
|
| 125 | - 'icone_calendrier' => 'Pachachimpu', |
|
| 126 | - 'icone_creer_auteur' => 'Mä machaq qillqiri uñstayaña ukatsti aka qillqatar mayacht’aña', |
|
| 127 | - 'icone_creer_rubrique_2' => 'Mä machaq t’aqa uñstayaña', |
|
| 128 | - 'icone_modifier_article' => 'Aka qillqata mayjt’ayaña', |
|
| 129 | - 'icone_modifier_rubrique' => 'Aka t’aqa mayjt’ayaña', |
|
| 130 | - 'icone_retour' => 'Kutiña', |
|
| 131 | - 'icone_retour_article' => 'Qillqatar kutiña', |
|
| 132 | - 'icone_supprimer_cookie' => '\\"Cookie\\" uk apaqaña yatiyawinakata ', |
|
| 133 | - 'icone_supprimer_rubrique' => 'Aka t’aqa a paqayaña', |
|
| 134 | - 'icone_supprimer_signature' => 'Aka iyawsa apaqaña', |
|
| 135 | - 'icone_valider_signature' => 'Aka iyaws iyaw saña', |
|
| 136 | - 'image_administrer_rubrique' => 'Aka t’aqa apnaqasmawa', |
|
| 137 | - 'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF |
|
| 138 | - 'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF |
|
| 139 | - 'info_1_article' => '1 qillqata', |
|
| 140 | - 'info_administrateur' => 'Apnaqiri', |
|
| 141 | - 'info_administrateur_1' => 'Apnaqiri', |
|
| 142 | - 'info_administrateur_2' => 'Qamawita (<i>amuyump luram</i>)', |
|
| 143 | - 'info_administrateur_site_02' => 'Aka chinunx limt’am', |
|
| 144 | - 'info_administrateurs' => 'Apnaqirinaka', |
|
| 145 | - 'info_administrer_rubrique' => 'Aka t’aqxa apnaqasmawa', |
|
| 146 | - 'info_adresse' => 'utjawiru:', |
|
| 147 | - 'info_adresse_url' => 'Utjawi (URL) jach’a qamaw utata', |
|
| 148 | - 'info_aide_en_ligne' => 'SPIP naktatat yanapa', |
|
| 149 | - 'info_ajouter_rubrique' => 'Apnaqañatakix yaqha t’aqa yapaña', |
|
| 150 | - 'info_annonce_nouveautes' => 'Machaq yatiyawinaka yatiyaña', |
|
| 151 | - 'info_article' => 'qillqata |
|
| 108 | + // I |
|
| 109 | + 'ical_info1' => 'Aka qamawinxa kunayman lurawinak chinusiñataki utji qamaw utjawipampi', |
|
| 110 | + 'ical_info2' => 'Aka taqpach lurawinakxat juk’amp yatxatañatakix, yatxatañatakix jan pächasimti <a href="@spipnet@">illqanakawi</a>.', # MODIF |
|
| 111 | + 'ical_info_calendrier' => 'Pä pachachimpuw utjtam. Mayirix qamawit mä laphi uñnaqawa kunanti taqpach yatiyat qillqatank yatiyi: jumakiw uñjtax uka mä suti imt’awi ukata, ukatxa mayjt’ayasmaw kuna pachtix munktax ukja imt’awim mayjt’ayasa.', |
|
| 112 | + 'ical_methode_http' => 'Apaqaña', |
|
| 113 | + 'ical_methode_webcal' => 'Kikipawi (webcal://)', # MODIF |
|
| 114 | + 'ical_texte_prive' => 'Aka sapa maynit pacha chimpuxa, aka qamawit jark’ata lurawinak yatiytam (lurawinaka ukatsti sapa maynit aytatanaka, qillqatanaka ukatsti jisk’aptat amtanaka...)', |
|
| 115 | + 'ical_texte_public' => 'Aka pacha chimpux uñchukiytam qamawit lurawinaka (qillqatanak ukatsti jisk’aptatanak yatiyata).', |
|
| 116 | + 'ical_texte_rss' => 'Machaq yatiyawinak aka qamawitxa apxasismaw kawkir q’ipinak liyt’irimpi XML/RSS (Rich Site Summary) utt’ayataru. Ukhamaraki SPIP ukax liyt’aspaw machaq yatiyat yatiyawinaka yaqha qamawinakana kawkinti turkakipaw utt’ayatampi lurapxi (apxasit qamawinaka). ', |
|
| 117 | + 'ical_titre_js' => 'Javascript', |
|
| 118 | + 'ical_titre_mailing' => 'Aruskipayirit tanta', |
|
| 119 | + 'ical_titre_rss' => 'Apxasit q’ipinaka', |
|
| 120 | + 'icone_activer_cookie' => '“Cookie” uk naktayaña yatiyawinakata', |
|
| 121 | + 'icone_admin_plugin' => 'Pluguin ukanakat apnaqawi', |
|
| 122 | + 'icone_afficher_auteurs' => 'Qillqirinaka uñachayaña', |
|
| 123 | + 'icone_afficher_visiteurs' => 'Tumpirinaka uñachayaña', |
|
| 124 | + 'icone_arret_discussion' => 'Aka aruskipawin jan mayamp arst’añati', |
|
| 125 | + 'icone_calendrier' => 'Pachachimpu', |
|
| 126 | + 'icone_creer_auteur' => 'Mä machaq qillqiri uñstayaña ukatsti aka qillqatar mayacht’aña', |
|
| 127 | + 'icone_creer_rubrique_2' => 'Mä machaq t’aqa uñstayaña', |
|
| 128 | + 'icone_modifier_article' => 'Aka qillqata mayjt’ayaña', |
|
| 129 | + 'icone_modifier_rubrique' => 'Aka t’aqa mayjt’ayaña', |
|
| 130 | + 'icone_retour' => 'Kutiña', |
|
| 131 | + 'icone_retour_article' => 'Qillqatar kutiña', |
|
| 132 | + 'icone_supprimer_cookie' => '\\"Cookie\\" uk apaqaña yatiyawinakata ', |
|
| 133 | + 'icone_supprimer_rubrique' => 'Aka t’aqa a paqayaña', |
|
| 134 | + 'icone_supprimer_signature' => 'Aka iyawsa apaqaña', |
|
| 135 | + 'icone_valider_signature' => 'Aka iyaws iyaw saña', |
|
| 136 | + 'image_administrer_rubrique' => 'Aka t’aqa apnaqasmawa', |
|
| 137 | + 'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF |
|
| 138 | + 'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF |
|
| 139 | + 'info_1_article' => '1 qillqata', |
|
| 140 | + 'info_administrateur' => 'Apnaqiri', |
|
| 141 | + 'info_administrateur_1' => 'Apnaqiri', |
|
| 142 | + 'info_administrateur_2' => 'Qamawita (<i>amuyump luram</i>)', |
|
| 143 | + 'info_administrateur_site_02' => 'Aka chinunx limt’am', |
|
| 144 | + 'info_administrateurs' => 'Apnaqirinaka', |
|
| 145 | + 'info_administrer_rubrique' => 'Aka t’aqxa apnaqasmawa', |
|
| 146 | + 'info_adresse' => 'utjawiru:', |
|
| 147 | + 'info_adresse_url' => 'Utjawi (URL) jach’a qamaw utata', |
|
| 148 | + 'info_aide_en_ligne' => 'SPIP naktatat yanapa', |
|
| 149 | + 'info_ajouter_rubrique' => 'Apnaqañatakix yaqha t’aqa yapaña', |
|
| 150 | + 'info_annonce_nouveautes' => 'Machaq yatiyawinaka yatiyaña', |
|
| 151 | + 'info_article' => 'qillqata |
|
| 152 | 152 | ', |
| 153 | - 'info_article_2' => 'qillqatanaka', |
|
| 154 | - 'info_article_a_paraitre' => 'Qillqatanak jutir urumpi yatiyataru', |
|
| 155 | - 'info_articles_02' => 'qillqatanaka', |
|
| 156 | - 'info_articles_2' => 'Qillqatanaka', |
|
| 157 | - 'info_articles_auteur' => 'Aka qillqirit qillqatanaka', |
|
| 158 | - 'info_articles_trouves' => 'Qillqatanak jikita', |
|
| 159 | - 'info_attente_validation' => 'Qillqatanakax iyaw sañataki suyaski', |
|
| 160 | - 'info_aujourdhui' => 'jichhüru:', |
|
| 161 | - 'info_auteur_gere_toutes_rubriques_2' => 'Je gère <b>toutes les rubriques</b>', # MODIF |
|
| 162 | - 'info_auteurs' => 'Qillqirinaka', |
|
| 163 | - 'info_auteurs_par_tri' => 'Qillqirinaka@partri@', |
|
| 164 | - 'info_auteurs_trouves' => 'Qillqirinaka jikita', |
|
| 165 | - 'info_authentification_externe' => 'Anqax chiqpach siriwi', |
|
| 166 | - 'info_avertissement' => 'Amuyam', |
|
| 167 | - 'info_base_installee' => 'Ch’akha ch’akha pirwa yatiyawinakamatxa uchantataxiwa', |
|
| 168 | - 'info_chapeau' => 'Qalltawi', |
|
| 169 | - 'info_chapeau_2' => 'Qalltawi:', |
|
| 170 | - 'info_chemin_acces_1' => 'Ajlliñatakiwa: <b></b>mantañ thakhita jach’a q’ipina</b>', |
|
| 171 | - 'info_chemin_acces_annuaire' => 'Ajllañatakiwa: <b>Mantañ thakhi jach’a q’ipina</b>', |
|
| 172 | - 'info_choix_base' => 'Kimsir sarawi:', |
|
| 173 | - 'info_classement_1' => '° ukjaru @liste@', |
|
| 174 | - 'info_classement_2' => '° ukjaru @liste@ |
|
| 153 | + 'info_article_2' => 'qillqatanaka', |
|
| 154 | + 'info_article_a_paraitre' => 'Qillqatanak jutir urumpi yatiyataru', |
|
| 155 | + 'info_articles_02' => 'qillqatanaka', |
|
| 156 | + 'info_articles_2' => 'Qillqatanaka', |
|
| 157 | + 'info_articles_auteur' => 'Aka qillqirit qillqatanaka', |
|
| 158 | + 'info_articles_trouves' => 'Qillqatanak jikita', |
|
| 159 | + 'info_attente_validation' => 'Qillqatanakax iyaw sañataki suyaski', |
|
| 160 | + 'info_aujourdhui' => 'jichhüru:', |
|
| 161 | + 'info_auteur_gere_toutes_rubriques_2' => 'Je gère <b>toutes les rubriques</b>', # MODIF |
|
| 162 | + 'info_auteurs' => 'Qillqirinaka', |
|
| 163 | + 'info_auteurs_par_tri' => 'Qillqirinaka@partri@', |
|
| 164 | + 'info_auteurs_trouves' => 'Qillqirinaka jikita', |
|
| 165 | + 'info_authentification_externe' => 'Anqax chiqpach siriwi', |
|
| 166 | + 'info_avertissement' => 'Amuyam', |
|
| 167 | + 'info_base_installee' => 'Ch’akha ch’akha pirwa yatiyawinakamatxa uchantataxiwa', |
|
| 168 | + 'info_chapeau' => 'Qalltawi', |
|
| 169 | + 'info_chapeau_2' => 'Qalltawi:', |
|
| 170 | + 'info_chemin_acces_1' => 'Ajlliñatakiwa: <b></b>mantañ thakhita jach’a q’ipina</b>', |
|
| 171 | + 'info_chemin_acces_annuaire' => 'Ajllañatakiwa: <b>Mantañ thakhi jach’a q’ipina</b>', |
|
| 172 | + 'info_choix_base' => 'Kimsir sarawi:', |
|
| 173 | + 'info_classement_1' => '° ukjaru @liste@', |
|
| 174 | + 'info_classement_2' => '° ukjaru @liste@ |
|
| 175 | 175 | ', |
| 176 | - 'info_code_acces' => '¡Mantañ chimpunakam jan armasimti!', |
|
| 177 | - 'info_config_suivi_explication' => 'Tanta aruskipayiriru aka qamawitxa qillqayasismaw. Aruskipayiritxa qillqatanakat yatiyawinak qatuqata ukatsti jisk’aptat amtatanak yatiyatawiru.', |
|
| 178 | - 'info_confirmer_passe' => 'Machaq imt’aw iyaw saña: ', |
|
| 179 | - 'info_connexion_base' => 'Payir sarawi: <b>chinuñ yant’awi base ukaru</b>', |
|
| 180 | - 'info_connexion_ldap_ok' => 'LDAP chinuwix lurt’xiwa.</b><p> jutir sarawir sarantasmawa.</p>', # MODIF |
|
| 181 | - 'info_connexion_mysql' => 'Mayir sarawi: <b> MySQL chinuwima</b>', |
|
| 182 | - 'info_connexion_ok' => 'Chinuwix lurt’xiwa.', |
|
| 183 | - 'info_contact' => 'Jikxatata', |
|
| 184 | - 'info_contenu_articles' => 'Qillqatanakat utjawi', |
|
| 185 | - 'info_creation_paragraphe' => ' (Tanta amuyunak uñstayañatakix, ch’usa siqinak jaytam)', # MODIF |
|
| 186 | - 'info_creation_rubrique' => 'Janir qillqatanak qillt’asinxa, <br /> mä t’aqa uñstayañama.<br />', |
|
| 187 | - 'info_creation_tables' => 'Pusir sarawi: <b>base ukat uyu uyunakat uñstayawi</b> ', |
|
| 188 | - 'info_creer_base' => '<b>uñstayaña</b> mä machaq yatiyawinak pirwa: ', |
|
| 189 | - 'info_dans_rubrique' => 'T’aqanxa...', |
|
| 190 | - 'info_date_publication_anterieure' => 'Nayrt’ir uru aka qillqawita', |
|
| 191 | - 'info_date_referencement' => 'APXASIW URU AKA QAMAWITA:', |
|
| 192 | - 'info_derniere_etape' => 'Qhipa sarawi: ¡tukuytanwa!', |
|
| 193 | - 'info_descriptif' => 'Uñt’ayawi:', |
|
| 194 | - 'info_discussion_cours' => 'Amuyt’awinakax lurasiskiw', |
|
| 195 | - 'info_ecrire_article' => 'Janir qillqatanak qillqasinxa, mä t’aqa uñstayañamawa.', |
|
| 196 | - 'info_email_envoi' => 'Apaw aruskipayirit utjawipa (ajlliñatakiwa)', |
|
| 197 | - 'info_email_webmestre' => 'Aruskipayirit utjawipa webmaster ukata (ajlliñatakiwa)', # MODIF |
|
| 198 | - 'info_envoi_email_automatique' => 'Aruskipayirinakat justup apayawi', |
|
| 199 | - 'info_envoyer_maintenant' => 'Jichhaki apayaña', |
|
| 200 | - 'info_etape_suivante' => 'Arkir sarawir sarantaña', |
|
| 201 | - 'info_etape_suivante_1' => 'Arkir sarawir sarantasmawa', |
|
| 202 | - 'info_etape_suivante_2' => 'Arkir sarawir sarantasmawa', |
|
| 203 | - 'info_exportation_base' => 'base ukax apsusispaw @archive@ uka tuqiru', |
|
| 204 | - 'info_facilite_suivi_activite' => 'Qillqa lurawit uñch’ukiw jasachañatakix, SPIP ukax aruskipayirit apayaspa, mä tanta qillqirinakar ukhama yatiyatawinakataki yatiyawinaka ukatak mayiwinaka, ukhamarak qillqatanakat iyaw sawi.', # MODIF |
|
| 205 | - 'info_fichiers_authent' => 'Chiqpach sirit q’ipinaka «.htpasswd» ', |
|
| 206 | - 'info_forums_abo_invites' => 'Qamawimax aruskipañawinakaniw qullqimp qillqatanakatakikiwa; Aka jach’a uta qamawinxa tumpirinakaru qillqayasiñataki jawthapiyi.', |
|
| 207 | - 'info_gauche_auteurs' => 'Akanxa taqpach qamawit qillqirinakaw uñsti. Kunjamaskis ukxa jisk’a saltan kulurapampiw uñacht’ayi (apnaqiri = ch’uxña, qillqiri = q’illu).', |
|
| 208 | - 'info_gauche_auteurs_exterieurs' => 'Anqajankir qillqirinakax, qamawir jan mantañaniwa, mä laram jisk’a saltampiw uñacht’ayataski; mä wayaqamp chhaqayatakis.', # MODIF |
|
| 209 | - 'info_gauche_messagerie' => 'Yatiyawirix yatiyasiwa, amtayirinak uñstyaña yatiyaw tantaru kuns apaniñapataki jan ukjax yatiyawinak yatiyaña ( apnaqir qutu ukar mayachatakis ukjax) |
|
| 176 | + 'info_code_acces' => '¡Mantañ chimpunakam jan armasimti!', |
|
| 177 | + 'info_config_suivi_explication' => 'Tanta aruskipayiriru aka qamawitxa qillqayasismaw. Aruskipayiritxa qillqatanakat yatiyawinak qatuqata ukatsti jisk’aptat amtatanak yatiyatawiru.', |
|
| 178 | + 'info_confirmer_passe' => 'Machaq imt’aw iyaw saña: ', |
|
| 179 | + 'info_connexion_base' => 'Payir sarawi: <b>chinuñ yant’awi base ukaru</b>', |
|
| 180 | + 'info_connexion_ldap_ok' => 'LDAP chinuwix lurt’xiwa.</b><p> jutir sarawir sarantasmawa.</p>', # MODIF |
|
| 181 | + 'info_connexion_mysql' => 'Mayir sarawi: <b> MySQL chinuwima</b>', |
|
| 182 | + 'info_connexion_ok' => 'Chinuwix lurt’xiwa.', |
|
| 183 | + 'info_contact' => 'Jikxatata', |
|
| 184 | + 'info_contenu_articles' => 'Qillqatanakat utjawi', |
|
| 185 | + 'info_creation_paragraphe' => ' (Tanta amuyunak uñstayañatakix, ch’usa siqinak jaytam)', # MODIF |
|
| 186 | + 'info_creation_rubrique' => 'Janir qillqatanak qillt’asinxa, <br /> mä t’aqa uñstayañama.<br />', |
|
| 187 | + 'info_creation_tables' => 'Pusir sarawi: <b>base ukat uyu uyunakat uñstayawi</b> ', |
|
| 188 | + 'info_creer_base' => '<b>uñstayaña</b> mä machaq yatiyawinak pirwa: ', |
|
| 189 | + 'info_dans_rubrique' => 'T’aqanxa...', |
|
| 190 | + 'info_date_publication_anterieure' => 'Nayrt’ir uru aka qillqawita', |
|
| 191 | + 'info_date_referencement' => 'APXASIW URU AKA QAMAWITA:', |
|
| 192 | + 'info_derniere_etape' => 'Qhipa sarawi: ¡tukuytanwa!', |
|
| 193 | + 'info_descriptif' => 'Uñt’ayawi:', |
|
| 194 | + 'info_discussion_cours' => 'Amuyt’awinakax lurasiskiw', |
|
| 195 | + 'info_ecrire_article' => 'Janir qillqatanak qillqasinxa, mä t’aqa uñstayañamawa.', |
|
| 196 | + 'info_email_envoi' => 'Apaw aruskipayirit utjawipa (ajlliñatakiwa)', |
|
| 197 | + 'info_email_webmestre' => 'Aruskipayirit utjawipa webmaster ukata (ajlliñatakiwa)', # MODIF |
|
| 198 | + 'info_envoi_email_automatique' => 'Aruskipayirinakat justup apayawi', |
|
| 199 | + 'info_envoyer_maintenant' => 'Jichhaki apayaña', |
|
| 200 | + 'info_etape_suivante' => 'Arkir sarawir sarantaña', |
|
| 201 | + 'info_etape_suivante_1' => 'Arkir sarawir sarantasmawa', |
|
| 202 | + 'info_etape_suivante_2' => 'Arkir sarawir sarantasmawa', |
|
| 203 | + 'info_exportation_base' => 'base ukax apsusispaw @archive@ uka tuqiru', |
|
| 204 | + 'info_facilite_suivi_activite' => 'Qillqa lurawit uñch’ukiw jasachañatakix, SPIP ukax aruskipayirit apayaspa, mä tanta qillqirinakar ukhama yatiyatawinakataki yatiyawinaka ukatak mayiwinaka, ukhamarak qillqatanakat iyaw sawi.', # MODIF |
|
| 205 | + 'info_fichiers_authent' => 'Chiqpach sirit q’ipinaka «.htpasswd» ', |
|
| 206 | + 'info_forums_abo_invites' => 'Qamawimax aruskipañawinakaniw qullqimp qillqatanakatakikiwa; Aka jach’a uta qamawinxa tumpirinakaru qillqayasiñataki jawthapiyi.', |
|
| 207 | + 'info_gauche_auteurs' => 'Akanxa taqpach qamawit qillqirinakaw uñsti. Kunjamaskis ukxa jisk’a saltan kulurapampiw uñacht’ayi (apnaqiri = ch’uxña, qillqiri = q’illu).', |
|
| 208 | + 'info_gauche_auteurs_exterieurs' => 'Anqajankir qillqirinakax, qamawir jan mantañaniwa, mä laram jisk’a saltampiw uñacht’ayataski; mä wayaqamp chhaqayatakis.', # MODIF |
|
| 209 | + 'info_gauche_messagerie' => 'Yatiyawirix yatiyasiwa, amtayirinak uñstyaña yatiyaw tantaru kuns apaniñapataki jan ukjax yatiyawinak yatiyaña ( apnaqir qutu ukar mayachatakis ukjax) |
|
| 210 | 210 | ', |
| 211 | - 'info_gauche_statistiques_referers' => 'Aka Web qamawix tantanak uñicht’ayi <i>referers</i>, qamawinakan chinunak utjkis ukhamarak juman qamawimar apapxi, masurutakiki ukhamarak jichhurutakiki; aka tantaxa sapa pä tunka urasanaka ch’usaru uskuña.', |
|
| 212 | - 'info_gauche_visiteurs_enregistres' => 'Akanxa jach’a qamaw utan qillqatanakakiw jikxatasi (aruskipañawinak qillqayasiyampi)', |
|
| 213 | - 'info_identification_publique' => 'Uñacht’ayawima...' |
|
| 211 | + 'info_gauche_statistiques_referers' => 'Aka Web qamawix tantanak uñicht’ayi <i>referers</i>, qamawinakan chinunak utjkis ukhamarak juman qamawimar apapxi, masurutakiki ukhamarak jichhurutakiki; aka tantaxa sapa pä tunka urasanaka ch’usaru uskuña.', |
|
| 212 | + 'info_gauche_visiteurs_enregistres' => 'Akanxa jach’a qamaw utan qillqatanakakiw jikxatasi (aruskipañawinak qillqayasiyampi)', |
|
| 213 | + 'info_identification_publique' => 'Uñacht’ayawima...' |
|
| 214 | 214 | ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | -define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS'); |
|
| 114 | +define('_EXTRAIRE_LIEN', ',^\s*(?:'._PROTOCOLES_STD.'):?/?/?\s*$,iS'); |
|
| 115 | 115 | |
| 116 | 116 | function traiter_lien_explicite($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) { |
| 117 | 117 | if (preg_match(_EXTRAIRE_LIEN, $ref)) { |
@@ -127,19 +127,19 @@ discard block |
||
| 127 | 127 | $lien_court = charger_fonction('lien_court', 'inc'); |
| 128 | 128 | $texte = $lien_court($texte); |
| 129 | 129 | if ($echappe_typo) { |
| 130 | - $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 130 | + $texte = '<html>'.quote_amp($texte).'</html>'; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // petites corrections d'URL |
| 135 | 135 | if (preg_match('/^www\.[^@]+$/S', $lien)) { |
| 136 | - $lien = 'http://' . $lien; |
|
| 136 | + $lien = 'http://'.$lien; |
|
| 137 | 137 | } else { |
| 138 | 138 | if (strpos($lien, '@') && email_valide($lien)) { |
| 139 | 139 | if (!$texte) { |
| 140 | 140 | $texte = $lien; |
| 141 | 141 | } |
| 142 | - $lien = 'mailto:' . $lien; |
|
| 142 | + $lien = 'mailto:'.$lien; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, string $connect = '') { |
| 158 | - if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 158 | + if (function_exists($f = 'glossaire_'.$ancre)) { |
|
| 159 | 159 | $url = $f($texte, $id); |
| 160 | 160 | } else { |
| 161 | 161 | $url = glossaire_std($texte); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - [$type, , $id, , $args, , $ancre] = array_pad($match, 7, null); |
|
| 191 | + [$type,, $id,, $args,, $ancre] = array_pad($match, 7, null); |
|
| 192 | 192 | |
| 193 | 193 | # attention dans le cas des sites le lien doit pointer non pas sur |
| 194 | 194 | # la page locale du site, mais directement sur le site lui-meme |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (!@$r['titre']) { |
| 227 | - $r['titre'] = _T($type) . " $id"; |
|
| 227 | + $r['titre'] = _T($type)." $id"; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if ($pour == 'titre') { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | and $mime = sql_getfetsel( |
| 240 | 240 | 'mime_type', |
| 241 | 241 | 'spip_types_documents', |
| 242 | - 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 242 | + 'extension IN ('.sql_get_select('extension', 'spip_documents', 'id_document='.sql_quote($id)).')', |
|
| 243 | 243 | '', |
| 244 | 244 | '', |
| 245 | 245 | '', |
@@ -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('base/abstract_sql'); |
@@ -37,42 +37,42 @@ discard block |
||
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | 39 | function inc_lien_dist( |
| 40 | - $lien, |
|
| 41 | - $texte = '', |
|
| 42 | - $class = '', |
|
| 43 | - $title = '', |
|
| 44 | - $hlang = '', |
|
| 45 | - $rel = '', |
|
| 46 | - string $connect = '', |
|
| 47 | - $env = [] |
|
| 40 | + $lien, |
|
| 41 | + $texte = '', |
|
| 42 | + $class = '', |
|
| 43 | + $title = '', |
|
| 44 | + $hlang = '', |
|
| 45 | + $rel = '', |
|
| 46 | + string $connect = '', |
|
| 47 | + $env = [] |
|
| 48 | 48 | ) { |
| 49 | - return $lien; |
|
| 49 | + return $lien; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | function expanser_liens($t, string $connect = '', $env = []) { |
| 53 | 53 | |
| 54 | - $t = pipeline('pre_liens', $t); |
|
| 54 | + $t = pipeline('pre_liens', $t); |
|
| 55 | 55 | |
| 56 | - // on passe a traiter_modeles la liste des liens reperes pour lui permettre |
|
| 57 | - // de remettre le texte d'origine dans les parametres du modele |
|
| 58 | - $t = traiter_modeles($t, false, false, $connect); |
|
| 56 | + // on passe a traiter_modeles la liste des liens reperes pour lui permettre |
|
| 57 | + // de remettre le texte d'origine dans les parametres du modele |
|
| 58 | + $t = traiter_modeles($t, false, false, $connect); |
|
| 59 | 59 | |
| 60 | - return $t; |
|
| 60 | + return $t; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Meme analyse mais pour eliminer les liens |
| 64 | 64 | // et ne laisser que leur titre, a expliciter si ce n'est fait |
| 65 | 65 | function nettoyer_raccourcis_typo($texte, string $connect = '') { |
| 66 | - return $texte; |
|
| 66 | + return $texte; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Repere dans la partie texte d'un raccourci [texte->...] |
| 70 | 70 | // la langue et la bulle eventuelles |
| 71 | 71 | function traiter_raccourci_lien_atts($texte) { |
| 72 | - $bulle = ''; |
|
| 73 | - $hlang = ''; |
|
| 72 | + $bulle = ''; |
|
| 73 | + $hlang = ''; |
|
| 74 | 74 | |
| 75 | - return [trim($texte), $bulle, $hlang]; |
|
| 75 | + return [trim($texte), $bulle, $hlang]; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | define('_RACCOURCI_CHAPO', '/^(\W*)(\W*)(\w*\d+([?#].*)?)$/'); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | 90 | function virtuel_redirige($virtuel, $url = false) { |
| 91 | - return $virtuel; |
|
| 91 | + return $virtuel; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Cherche un lien du type [->raccourci 123] |
@@ -101,62 +101,62 @@ discard block |
||
| 101 | 101 | // 'url': seulement U (i.e. generer_url_RACCOURCI) |
| 102 | 102 | |
| 103 | 103 | function calculer_url($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) { |
| 104 | - $r = traiter_lien_implicite($ref, $texte, $pour, $connect); |
|
| 104 | + $r = traiter_lien_implicite($ref, $texte, $pour, $connect); |
|
| 105 | 105 | |
| 106 | - return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
|
| 106 | + return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS'); |
| 110 | 110 | |
| 111 | 111 | function traiter_lien_explicite($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) { |
| 112 | - if (preg_match(_EXTRAIRE_LIEN, $ref)) { |
|
| 113 | - return ($pour != 'tout') ? '' : ['', '', '', '']; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $lien = entites_html(trim($ref)); |
|
| 117 | - |
|
| 118 | - // Liens explicites |
|
| 119 | - if (!$texte) { |
|
| 120 | - $texte = str_replace('"', '', $lien); |
|
| 121 | - // evite l'affichage de trops longues urls. |
|
| 122 | - $lien_court = charger_fonction('lien_court', 'inc'); |
|
| 123 | - $texte = $lien_court($texte); |
|
| 124 | - if ($echappe_typo) { |
|
| 125 | - $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - // petites corrections d'URL |
|
| 130 | - if (preg_match('/^www\.[^@]+$/S', $lien)) { |
|
| 131 | - $lien = 'http://' . $lien; |
|
| 132 | - } else { |
|
| 133 | - if (strpos($lien, '@') && email_valide($lien)) { |
|
| 134 | - if (!$texte) { |
|
| 135 | - $texte = $lien; |
|
| 136 | - } |
|
| 137 | - $lien = 'mailto:' . $lien; |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - if ($pour == 'url') { |
|
| 142 | - return $lien; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - if ($pour == 'titre') { |
|
| 146 | - return $texte; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return ['url' => $lien, 'titre' => $texte]; |
|
| 112 | + if (preg_match(_EXTRAIRE_LIEN, $ref)) { |
|
| 113 | + return ($pour != 'tout') ? '' : ['', '', '', '']; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $lien = entites_html(trim($ref)); |
|
| 117 | + |
|
| 118 | + // Liens explicites |
|
| 119 | + if (!$texte) { |
|
| 120 | + $texte = str_replace('"', '', $lien); |
|
| 121 | + // evite l'affichage de trops longues urls. |
|
| 122 | + $lien_court = charger_fonction('lien_court', 'inc'); |
|
| 123 | + $texte = $lien_court($texte); |
|
| 124 | + if ($echappe_typo) { |
|
| 125 | + $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + // petites corrections d'URL |
|
| 130 | + if (preg_match('/^www\.[^@]+$/S', $lien)) { |
|
| 131 | + $lien = 'http://' . $lien; |
|
| 132 | + } else { |
|
| 133 | + if (strpos($lien, '@') && email_valide($lien)) { |
|
| 134 | + if (!$texte) { |
|
| 135 | + $texte = $lien; |
|
| 136 | + } |
|
| 137 | + $lien = 'mailto:' . $lien; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + if ($pour == 'url') { |
|
| 142 | + return $lien; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + if ($pour == 'titre') { |
|
| 146 | + return $texte; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return ['url' => $lien, 'titre' => $texte]; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, string $connect = '') { |
| 153 | - if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 154 | - $url = $f($texte, $id); |
|
| 155 | - } else { |
|
| 156 | - $url = glossaire_std($texte); |
|
| 157 | - } |
|
| 153 | + if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 154 | + $url = $f($texte, $id); |
|
| 155 | + } else { |
|
| 156 | + $url = glossaire_std($texte); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - return $url; |
|
| 159 | + return $url; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -178,74 +178,74 @@ discard block |
||
| 178 | 178 | * @return array|bool|string |
| 179 | 179 | */ |
| 180 | 180 | function traiter_lien_implicite($ref, $texte = '', $pour = 'url', $connect = '') { |
| 181 | - $cible = $GLOBALS['lien_implicite_cible_public'] ?? null; |
|
| 182 | - if (!($match = typer_raccourci($ref))) { |
|
| 183 | - return false; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - [$type, , $id, , $args, , $ancre] = array_pad($match, 7, null); |
|
| 187 | - |
|
| 188 | - # attention dans le cas des sites le lien doit pointer non pas sur |
|
| 189 | - # la page locale du site, mais directement sur le site lui-meme |
|
| 190 | - $url = ''; |
|
| 191 | - if ($f = charger_fonction("implicite_$type", 'liens', true)) { |
|
| 192 | - $url = $f($texte, $id, $type, $args, $ancre, $connect); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - if (!$url) { |
|
| 196 | - $url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? ''); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - if (!$url) { |
|
| 200 | - return false; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - if (is_array($url)) { |
|
| 204 | - [$type, $id] = array_pad($url, 2, null); |
|
| 205 | - $url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? ''); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - if ($pour === 'url') { |
|
| 209 | - return $url; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - $r = traiter_raccourci_titre($id, $type, $connect); |
|
| 213 | - if ($r) { |
|
| 214 | - $r['class'] = ($type == 'site') ? 'spip_out' : 'spip_in'; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - if ($texte = trim($texte)) { |
|
| 218 | - $r['titre'] = $texte; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - if (!@$r['titre']) { |
|
| 222 | - $r['titre'] = _T($type) . " $id"; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - if ($pour == 'titre') { |
|
| 226 | - return $r['titre']; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - $r['url'] = $url; |
|
| 230 | - |
|
| 231 | - // dans le cas d'un lien vers un doc, ajouter le type='mime/type' |
|
| 232 | - if ( |
|
| 233 | - $type == 'document' |
|
| 234 | - and $mime = sql_getfetsel( |
|
| 235 | - 'mime_type', |
|
| 236 | - 'spip_types_documents', |
|
| 237 | - 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 238 | - '', |
|
| 239 | - '', |
|
| 240 | - '', |
|
| 241 | - '', |
|
| 242 | - $connect |
|
| 243 | - ) |
|
| 244 | - ) { |
|
| 245 | - $r['mime'] = $mime; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - return $r; |
|
| 181 | + $cible = $GLOBALS['lien_implicite_cible_public'] ?? null; |
|
| 182 | + if (!($match = typer_raccourci($ref))) { |
|
| 183 | + return false; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + [$type, , $id, , $args, , $ancre] = array_pad($match, 7, null); |
|
| 187 | + |
|
| 188 | + # attention dans le cas des sites le lien doit pointer non pas sur |
|
| 189 | + # la page locale du site, mais directement sur le site lui-meme |
|
| 190 | + $url = ''; |
|
| 191 | + if ($f = charger_fonction("implicite_$type", 'liens', true)) { |
|
| 192 | + $url = $f($texte, $id, $type, $args, $ancre, $connect); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + if (!$url) { |
|
| 196 | + $url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? ''); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + if (!$url) { |
|
| 200 | + return false; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if (is_array($url)) { |
|
| 204 | + [$type, $id] = array_pad($url, 2, null); |
|
| 205 | + $url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? ''); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + if ($pour === 'url') { |
|
| 209 | + return $url; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + $r = traiter_raccourci_titre($id, $type, $connect); |
|
| 213 | + if ($r) { |
|
| 214 | + $r['class'] = ($type == 'site') ? 'spip_out' : 'spip_in'; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + if ($texte = trim($texte)) { |
|
| 218 | + $r['titre'] = $texte; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + if (!@$r['titre']) { |
|
| 222 | + $r['titre'] = _T($type) . " $id"; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + if ($pour == 'titre') { |
|
| 226 | + return $r['titre']; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + $r['url'] = $url; |
|
| 230 | + |
|
| 231 | + // dans le cas d'un lien vers un doc, ajouter le type='mime/type' |
|
| 232 | + if ( |
|
| 233 | + $type == 'document' |
|
| 234 | + and $mime = sql_getfetsel( |
|
| 235 | + 'mime_type', |
|
| 236 | + 'spip_types_documents', |
|
| 237 | + 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 238 | + '', |
|
| 239 | + '', |
|
| 240 | + '', |
|
| 241 | + '', |
|
| 242 | + $connect |
|
| 243 | + ) |
|
| 244 | + ) { |
|
| 245 | + $r['mime'] = $mime; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + return $r; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // analyse des raccourcis issus de [TITRE->RACCOURCInnn] et connexes |
@@ -253,43 +253,43 @@ discard block |
||
| 253 | 253 | define('_RACCOURCI_URL', '/^\s*(\w*?)\s*(\d+)(\?(.*?))?(#([^\s]*))?\s*$/S'); |
| 254 | 254 | |
| 255 | 255 | function typer_raccourci($lien) { |
| 256 | - if (!preg_match(_RACCOURCI_URL, $lien, $match)) { |
|
| 257 | - return []; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - $f = $match[1]; |
|
| 261 | - // valeur par defaut et alias historiques |
|
| 262 | - if (!$f) { |
|
| 263 | - $f = 'article'; |
|
| 264 | - } else { |
|
| 265 | - if ($f == 'art') { |
|
| 266 | - $f = 'article'; |
|
| 267 | - } else { |
|
| 268 | - if ($f == 'br') { |
|
| 269 | - $f = 'breve'; |
|
| 270 | - } else { |
|
| 271 | - if ($f == 'rub') { |
|
| 272 | - $f = 'rubrique'; |
|
| 273 | - } else { |
|
| 274 | - if ($f == 'aut') { |
|
| 275 | - $f = 'auteur'; |
|
| 276 | - } else { |
|
| 277 | - if ($f == 'doc' or $f == 'im' or $f == 'img' or $f == 'image' or $f == 'emb') { |
|
| 278 | - $f = 'document'; |
|
| 279 | - } else { |
|
| 280 | - if (preg_match('/^br..?ve$/S', $f)) { |
|
| 281 | - $f = 'breve'; # accents :( |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - $match[0] = $f; |
|
| 291 | - |
|
| 292 | - return $match; |
|
| 256 | + if (!preg_match(_RACCOURCI_URL, $lien, $match)) { |
|
| 257 | + return []; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + $f = $match[1]; |
|
| 261 | + // valeur par defaut et alias historiques |
|
| 262 | + if (!$f) { |
|
| 263 | + $f = 'article'; |
|
| 264 | + } else { |
|
| 265 | + if ($f == 'art') { |
|
| 266 | + $f = 'article'; |
|
| 267 | + } else { |
|
| 268 | + if ($f == 'br') { |
|
| 269 | + $f = 'breve'; |
|
| 270 | + } else { |
|
| 271 | + if ($f == 'rub') { |
|
| 272 | + $f = 'rubrique'; |
|
| 273 | + } else { |
|
| 274 | + if ($f == 'aut') { |
|
| 275 | + $f = 'auteur'; |
|
| 276 | + } else { |
|
| 277 | + if ($f == 'doc' or $f == 'im' or $f == 'img' or $f == 'image' or $f == 'emb') { |
|
| 278 | + $f = 'document'; |
|
| 279 | + } else { |
|
| 280 | + if (preg_match('/^br..?ve$/S', $f)) { |
|
| 281 | + $f = 'breve'; # accents :( |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + $match[0] = $f; |
|
| 291 | + |
|
| 292 | + return $match; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -304,44 +304,44 @@ discard block |
||
| 304 | 304 | * } |
| 305 | 305 | **/ |
| 306 | 306 | function traiter_raccourci_titre($id, $type, $connect = null) { |
| 307 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 308 | - $desc = $trouver_table(table_objet($type)); |
|
| 307 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 308 | + $desc = $trouver_table(table_objet($type)); |
|
| 309 | 309 | |
| 310 | - if (!($desc and $s = $desc['titre'])) { |
|
| 311 | - return []; |
|
| 312 | - } |
|
| 310 | + if (!($desc and $s = $desc['titre'])) { |
|
| 311 | + return []; |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - $_id = $desc['key']['PRIMARY KEY']; |
|
| 315 | - $r = sql_fetsel($s, $desc['table'], "$_id=$id", '', '', '', '', $connect); |
|
| 314 | + $_id = $desc['key']['PRIMARY KEY']; |
|
| 315 | + $r = sql_fetsel($s, $desc['table'], "$_id=$id", '', '', '', '', $connect); |
|
| 316 | 316 | |
| 317 | - if (!$r) { |
|
| 318 | - return []; |
|
| 319 | - } |
|
| 317 | + if (!$r) { |
|
| 318 | + return []; |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $r['titre'] = supprimer_numero($r['titre']); |
|
| 321 | + $r['titre'] = supprimer_numero($r['titre']); |
|
| 322 | 322 | |
| 323 | - if (!$r['titre'] and !empty($r['surnom'])) { |
|
| 324 | - $r['titre'] = $r['surnom']; |
|
| 325 | - } |
|
| 323 | + if (!$r['titre'] and !empty($r['surnom'])) { |
|
| 324 | + $r['titre'] = $r['surnom']; |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - if (!isset($r['lang'])) { |
|
| 328 | - $r['lang'] = ''; |
|
| 329 | - } |
|
| 327 | + if (!isset($r['lang'])) { |
|
| 328 | + $r['lang'] = ''; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - return $r; |
|
| 331 | + return $r; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // |
| 335 | 335 | // Raccourcis ancre [#ancre<-] |
| 336 | 336 | // |
| 337 | 337 | function traiter_raccourci_ancre($letexte) { |
| 338 | - return $letexte; |
|
| 338 | + return $letexte; |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | function traiter_raccourci_glossaire($texte) { |
| 342 | - return $texte; |
|
| 342 | + return $texte; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | function glossaire_std($terme) { |
| 346 | - return $terme; |
|
| 346 | + return $terme; |
|
| 347 | 347 | } |
@@ -813,9 +813,9 @@ |
||
| 813 | 813 | if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
| 814 | 814 | define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
| 815 | 815 | } |
| 816 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 816 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')'; |
|
| 817 | 817 | $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
| 818 | - $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 818 | + $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml('._TRAITEMENT_TYPO_SANS_NUMERO.')'; |
|
| 819 | 819 | $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
| 820 | 820 | $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
| 821 | 821 | $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
@@ -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 | |
@@ -48,90 +48,90 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function declarer_interfaces() { |
| 50 | 50 | |
| 51 | - $GLOBALS['table_des_tables']['articles'] = 'articles'; |
|
| 52 | - $GLOBALS['table_des_tables']['auteurs'] = 'auteurs'; |
|
| 53 | - $GLOBALS['table_des_tables']['rubriques'] = 'rubriques'; |
|
| 54 | - $GLOBALS['table_des_tables']['hierarchie'] = 'rubriques'; |
|
| 55 | - |
|
| 56 | - // definition des statuts de publication |
|
| 57 | - $GLOBALS['table_statut'] = []; |
|
| 58 | - |
|
| 59 | - // |
|
| 60 | - // tableau des tables de jointures |
|
| 61 | - // Ex: gestion du critere {id_mot} dans la boucle(ARTICLES) |
|
| 62 | - $GLOBALS['tables_jointures'] = []; |
|
| 63 | - $GLOBALS['tables_jointures']['spip_jobs'][] = 'jobs_liens'; |
|
| 64 | - |
|
| 65 | - // $GLOBALS['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre'); // pour exemple |
|
| 66 | - $GLOBALS['exceptions_des_jointures']['profondeur'] = ['spip_rubriques', 'profondeur']; |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - if (!defined('_TRAITEMENT_TYPO')) { |
|
| 70 | - define('_TRAITEMENT_TYPO', 'typo(%s, "TYPO", $connect, $Pile[0])'); |
|
| 71 | - } |
|
| 72 | - if (!defined('_TRAITEMENT_RACCOURCIS')) { |
|
| 73 | - define('_TRAITEMENT_RACCOURCIS', 'propre(%s, $connect, $Pile[0])'); |
|
| 74 | - } |
|
| 75 | - if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
|
| 76 | - define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
|
| 77 | - } |
|
| 78 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 79 | - $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
|
| 80 | - $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 81 | - $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
|
| 82 | - $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
|
| 83 | - $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
|
| 84 | - $GLOBALS['table_des_traitements']['DATE_MODIF'][] = 'normaliser_date(%s)'; |
|
| 85 | - $GLOBALS['table_des_traitements']['DATE_NOUVEAUTES'][] = 'normaliser_date(%s)'; |
|
| 86 | - $GLOBALS['table_des_traitements']['DESCRIPTIF'][] = _TRAITEMENT_RACCOURCIS; |
|
| 87 | - $GLOBALS['table_des_traitements']['INTRODUCTION'][] = _TRAITEMENT_RACCOURCIS; |
|
| 88 | - $GLOBALS['table_des_traitements']['NOM_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 89 | - $GLOBALS['table_des_traitements']['NOM'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 90 | - $GLOBALS['table_des_traitements']['AUTEUR'][] = _TRAITEMENT_TYPO; |
|
| 91 | - $GLOBALS['table_des_traitements']['PS'][] = _TRAITEMENT_RACCOURCIS; |
|
| 92 | - $GLOBALS['table_des_traitements']['SOURCE'][] = _TRAITEMENT_TYPO; |
|
| 93 | - $GLOBALS['table_des_traitements']['SOUSTITRE'][] = _TRAITEMENT_TYPO; |
|
| 94 | - $GLOBALS['table_des_traitements']['SURTITRE'][] = _TRAITEMENT_TYPO; |
|
| 95 | - $GLOBALS['table_des_traitements']['TAGS'][] = '%s'; |
|
| 96 | - $GLOBALS['table_des_traitements']['TEXTE'][] = _TRAITEMENT_RACCOURCIS; |
|
| 97 | - $GLOBALS['table_des_traitements']['TITRE'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 98 | - $GLOBALS['table_des_traitements']['TYPE'][] = _TRAITEMENT_TYPO; |
|
| 99 | - $GLOBALS['table_des_traitements']['DESCRIPTIF_SITE_SPIP'][] = _TRAITEMENT_RACCOURCIS; |
|
| 100 | - $GLOBALS['table_des_traitements']['SLOGAN_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 101 | - $GLOBALS['table_des_traitements']['ENV'][] = 'entites_html(%s,true)'; |
|
| 102 | - |
|
| 103 | - // valeur par defaut pour les balises non listees ci-dessus |
|
| 104 | - $GLOBALS['table_des_traitements']['*'][] = false; // pas de traitement, mais permet au compilo de trouver la declaration suivante |
|
| 105 | - // toujours securiser les DATA |
|
| 106 | - $GLOBALS['table_des_traitements']['*']['DATA'] = 'safehtml(%s)'; |
|
| 107 | - // expliciter pour VALEUR qui est un champ calcule et ne sera pas protege par le catch-all * |
|
| 108 | - $GLOBALS['table_des_traitements']['VALEUR']['DATA'] = 'safehtml(%s)'; |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - // gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales |
|
| 112 | - $interfaces = pipeline( |
|
| 113 | - 'declarer_tables_interfaces', |
|
| 114 | - [ |
|
| 115 | - 'table_des_tables' => $GLOBALS['table_des_tables'], |
|
| 116 | - 'exceptions_des_tables' => $GLOBALS['exceptions_des_tables'], |
|
| 117 | - 'table_date' => $GLOBALS['table_date'], |
|
| 118 | - 'table_titre' => $GLOBALS['table_titre'], |
|
| 119 | - 'tables_jointures' => $GLOBALS['tables_jointures'], |
|
| 120 | - 'exceptions_des_jointures' => $GLOBALS['exceptions_des_jointures'], |
|
| 121 | - 'table_des_traitements' => $GLOBALS['table_des_traitements'], |
|
| 122 | - 'table_statut' => $GLOBALS['table_statut'], |
|
| 123 | - ] |
|
| 124 | - ); |
|
| 125 | - if ($interfaces) { |
|
| 126 | - $GLOBALS['table_des_tables'] = $interfaces['table_des_tables']; |
|
| 127 | - $GLOBALS['exceptions_des_tables'] = $interfaces['exceptions_des_tables']; |
|
| 128 | - $GLOBALS['table_date'] = $interfaces['table_date']; |
|
| 129 | - $GLOBALS['table_titre'] = $interfaces['table_titre']; |
|
| 130 | - $GLOBALS['tables_jointures'] = $interfaces['tables_jointures']; |
|
| 131 | - $GLOBALS['exceptions_des_jointures'] = $interfaces['exceptions_des_jointures']; |
|
| 132 | - $GLOBALS['table_des_traitements'] = $interfaces['table_des_traitements']; |
|
| 133 | - $GLOBALS['table_statut'] = $interfaces['table_statut']; |
|
| 134 | - } |
|
| 51 | + $GLOBALS['table_des_tables']['articles'] = 'articles'; |
|
| 52 | + $GLOBALS['table_des_tables']['auteurs'] = 'auteurs'; |
|
| 53 | + $GLOBALS['table_des_tables']['rubriques'] = 'rubriques'; |
|
| 54 | + $GLOBALS['table_des_tables']['hierarchie'] = 'rubriques'; |
|
| 55 | + |
|
| 56 | + // definition des statuts de publication |
|
| 57 | + $GLOBALS['table_statut'] = []; |
|
| 58 | + |
|
| 59 | + // |
|
| 60 | + // tableau des tables de jointures |
|
| 61 | + // Ex: gestion du critere {id_mot} dans la boucle(ARTICLES) |
|
| 62 | + $GLOBALS['tables_jointures'] = []; |
|
| 63 | + $GLOBALS['tables_jointures']['spip_jobs'][] = 'jobs_liens'; |
|
| 64 | + |
|
| 65 | + // $GLOBALS['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre'); // pour exemple |
|
| 66 | + $GLOBALS['exceptions_des_jointures']['profondeur'] = ['spip_rubriques', 'profondeur']; |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + if (!defined('_TRAITEMENT_TYPO')) { |
|
| 70 | + define('_TRAITEMENT_TYPO', 'typo(%s, "TYPO", $connect, $Pile[0])'); |
|
| 71 | + } |
|
| 72 | + if (!defined('_TRAITEMENT_RACCOURCIS')) { |
|
| 73 | + define('_TRAITEMENT_RACCOURCIS', 'propre(%s, $connect, $Pile[0])'); |
|
| 74 | + } |
|
| 75 | + if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
|
| 76 | + define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
|
| 77 | + } |
|
| 78 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 79 | + $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
|
| 80 | + $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 81 | + $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
|
| 82 | + $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
|
| 83 | + $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
|
| 84 | + $GLOBALS['table_des_traitements']['DATE_MODIF'][] = 'normaliser_date(%s)'; |
|
| 85 | + $GLOBALS['table_des_traitements']['DATE_NOUVEAUTES'][] = 'normaliser_date(%s)'; |
|
| 86 | + $GLOBALS['table_des_traitements']['DESCRIPTIF'][] = _TRAITEMENT_RACCOURCIS; |
|
| 87 | + $GLOBALS['table_des_traitements']['INTRODUCTION'][] = _TRAITEMENT_RACCOURCIS; |
|
| 88 | + $GLOBALS['table_des_traitements']['NOM_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 89 | + $GLOBALS['table_des_traitements']['NOM'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 90 | + $GLOBALS['table_des_traitements']['AUTEUR'][] = _TRAITEMENT_TYPO; |
|
| 91 | + $GLOBALS['table_des_traitements']['PS'][] = _TRAITEMENT_RACCOURCIS; |
|
| 92 | + $GLOBALS['table_des_traitements']['SOURCE'][] = _TRAITEMENT_TYPO; |
|
| 93 | + $GLOBALS['table_des_traitements']['SOUSTITRE'][] = _TRAITEMENT_TYPO; |
|
| 94 | + $GLOBALS['table_des_traitements']['SURTITRE'][] = _TRAITEMENT_TYPO; |
|
| 95 | + $GLOBALS['table_des_traitements']['TAGS'][] = '%s'; |
|
| 96 | + $GLOBALS['table_des_traitements']['TEXTE'][] = _TRAITEMENT_RACCOURCIS; |
|
| 97 | + $GLOBALS['table_des_traitements']['TITRE'][] = _TRAITEMENT_TYPO_SANS_NUMERO; |
|
| 98 | + $GLOBALS['table_des_traitements']['TYPE'][] = _TRAITEMENT_TYPO; |
|
| 99 | + $GLOBALS['table_des_traitements']['DESCRIPTIF_SITE_SPIP'][] = _TRAITEMENT_RACCOURCIS; |
|
| 100 | + $GLOBALS['table_des_traitements']['SLOGAN_SITE_SPIP'][] = _TRAITEMENT_TYPO; |
|
| 101 | + $GLOBALS['table_des_traitements']['ENV'][] = 'entites_html(%s,true)'; |
|
| 102 | + |
|
| 103 | + // valeur par defaut pour les balises non listees ci-dessus |
|
| 104 | + $GLOBALS['table_des_traitements']['*'][] = false; // pas de traitement, mais permet au compilo de trouver la declaration suivante |
|
| 105 | + // toujours securiser les DATA |
|
| 106 | + $GLOBALS['table_des_traitements']['*']['DATA'] = 'safehtml(%s)'; |
|
| 107 | + // expliciter pour VALEUR qui est un champ calcule et ne sera pas protege par le catch-all * |
|
| 108 | + $GLOBALS['table_des_traitements']['VALEUR']['DATA'] = 'safehtml(%s)'; |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + // gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales |
|
| 112 | + $interfaces = pipeline( |
|
| 113 | + 'declarer_tables_interfaces', |
|
| 114 | + [ |
|
| 115 | + 'table_des_tables' => $GLOBALS['table_des_tables'], |
|
| 116 | + 'exceptions_des_tables' => $GLOBALS['exceptions_des_tables'], |
|
| 117 | + 'table_date' => $GLOBALS['table_date'], |
|
| 118 | + 'table_titre' => $GLOBALS['table_titre'], |
|
| 119 | + 'tables_jointures' => $GLOBALS['tables_jointures'], |
|
| 120 | + 'exceptions_des_jointures' => $GLOBALS['exceptions_des_jointures'], |
|
| 121 | + 'table_des_traitements' => $GLOBALS['table_des_traitements'], |
|
| 122 | + 'table_statut' => $GLOBALS['table_statut'], |
|
| 123 | + ] |
|
| 124 | + ); |
|
| 125 | + if ($interfaces) { |
|
| 126 | + $GLOBALS['table_des_tables'] = $interfaces['table_des_tables']; |
|
| 127 | + $GLOBALS['exceptions_des_tables'] = $interfaces['exceptions_des_tables']; |
|
| 128 | + $GLOBALS['table_date'] = $interfaces['table_date']; |
|
| 129 | + $GLOBALS['table_titre'] = $interfaces['table_titre']; |
|
| 130 | + $GLOBALS['tables_jointures'] = $interfaces['tables_jointures']; |
|
| 131 | + $GLOBALS['exceptions_des_jointures'] = $interfaces['exceptions_des_jointures']; |
|
| 132 | + $GLOBALS['table_des_traitements'] = $interfaces['table_des_traitements']; |
|
| 133 | + $GLOBALS['table_statut'] = $interfaces['table_statut']; |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | declarer_interfaces(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $n = intval(sql_errno()); |
| 62 | - spip_log("Erreur base de donnees $n " . sql_error()); |
|
| 62 | + spip_log("Erreur base de donnees $n ".sql_error()); |
|
| 63 | 63 | |
| 64 | 64 | return $n ?: 1; |
| 65 | 65 | } |
@@ -110,19 +110,19 @@ discard block |
||
| 110 | 110 | // erreur SQL a afficher |
| 111 | 111 | $raison = minipres( |
| 112 | 112 | _T('info_travaux_titre'), |
| 113 | - _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>' |
|
| 113 | + _T('titre_probleme_technique').'<p><tt>'.sql_errno().' '.sql_error().'</tt></p>' |
|
| 114 | 114 | ); |
| 115 | 115 | } elseif (@$raison['statut']) { |
| 116 | 116 | // un simple visiteur n'a pas acces a l'espace prive |
| 117 | - spip_log('connexion refusee a ' . @$raison['id_auteur']); |
|
| 117 | + spip_log('connexion refusee a '.@$raison['id_auteur']); |
|
| 118 | 118 | $est_connecte = (!empty($GLOBALS['visiteur_session']['login']) and !empty($GLOBALS['visiteur_session']['statut'])); // idem test balise #URL_LOGOUT |
| 119 | 119 | $raison = minipres( |
| 120 | 120 | _T('avis_erreur_connexion'), |
| 121 | 121 | _T('avis_erreur_visiteur') |
| 122 | 122 | // Lien vers le site public |
| 123 | - . '<br /><a href="' . url_de_base() . '">' . _T('login_retour_public') . '</a>' |
|
| 123 | + . '<br /><a href="'.url_de_base().'">'._T('login_retour_public').'</a>' |
|
| 124 | 124 | // Si la personne est connectée, lien de déconnexion ramenant vers la page de login |
| 125 | - . ($est_connecte ? ' | <a href="' . generer_url_public('', 'action=logout&logout=prive') . '">' . _T('icone_deconnecter') . '</a>' : '') |
|
| 125 | + . ($est_connecte ? ' | <a href="'.generer_url_public('', 'action=logout&logout=prive').'">'._T('icone_deconnecter').'</a>' : '') |
|
| 126 | 126 | ); |
| 127 | 127 | } else { |
| 128 | 128 | // auteur en fin de droits ... |
@@ -212,8 +212,7 @@ discard block |
||
| 212 | 212 | $where = (is_numeric($id_auteur) |
| 213 | 213 | /*AND $id_auteur>0*/ // reprise lors des restaurations |
| 214 | 214 | ) ? |
| 215 | - "id_auteur=$id_auteur" : |
|
| 216 | - (!strlen($GLOBALS['connect_login']) ? '' : 'login=' . sql_quote($GLOBALS['connect_login'], '', 'text')); |
|
| 215 | + "id_auteur=$id_auteur" : (!strlen($GLOBALS['connect_login']) ? '' : 'login='.sql_quote($GLOBALS['connect_login'], '', 'text')); |
|
| 217 | 216 | |
| 218 | 217 | if (!$where) { |
| 219 | 218 | return ''; |
@@ -255,7 +254,7 @@ discard block |
||
| 255 | 254 | $GLOBALS['connect_login'] = $row['login']; |
| 256 | 255 | $GLOBALS['connect_statut'] = $row['statut']; |
| 257 | 256 | |
| 258 | - $GLOBALS['visiteur_session'] = array_merge((array)$GLOBALS['visiteur_session'], $row); |
|
| 257 | + $GLOBALS['visiteur_session'] = array_merge((array) $GLOBALS['visiteur_session'], $row); |
|
| 259 | 258 | |
| 260 | 259 | // au cas ou : ne pas memoriser les champs sensibles |
| 261 | 260 | unset($GLOBALS['visiteur_session']['pass']); |
@@ -327,7 +326,7 @@ discard block |
||
| 327 | 326 | * @return string |
| 328 | 327 | */ |
| 329 | 328 | function auth_a_loger() { |
| 330 | - $redirect = generer_url_public('login', 'url=' . rawurlencode(self('&', true)), true); |
|
| 329 | + $redirect = generer_url_public('login', 'url='.rawurlencode(self('&', true)), true); |
|
| 331 | 330 | |
| 332 | 331 | // un echec au "bonjour" (login initial) quand le statut est |
| 333 | 332 | // inconnu signale sans doute un probleme de cookies |
@@ -363,7 +362,7 @@ discard block |
||
| 363 | 362 | $date ??= date('Y-m-d H:i:s'); |
| 364 | 363 | |
| 365 | 364 | if (abs(strtotime($date) - $connect_quand) >= 60) { |
| 366 | - sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur=' . intval($row['id_auteur'])); |
|
| 365 | + sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur='.intval($row['id_auteur'])); |
|
| 367 | 366 | $row['en_ligne'] = $date; |
| 368 | 367 | } |
| 369 | 368 | |
@@ -472,7 +471,7 @@ discard block |
||
| 472 | 471 | if ( |
| 473 | 472 | !$login |
| 474 | 473 | or !$login_base = auth_retrouver_login($login, $serveur) |
| 475 | - or !$row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur) |
|
| 474 | + or !$row = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur) |
|
| 476 | 475 | ) { |
| 477 | 476 | // generer de fausses infos, mais credibles, pour eviter une attaque |
| 478 | 477 | // https://core.spip.net/issues/1758 + https://core.spip.net/issues/3691 |
@@ -582,7 +581,7 @@ discard block |
||
| 582 | 581 | sql_updateq( |
| 583 | 582 | 'spip_auteurs', |
| 584 | 583 | ['prefs' => serialize($p)], |
| 585 | - 'id_auteur=' . intval($auteur['id_auteur']) |
|
| 584 | + 'id_auteur='.intval($auteur['id_auteur']) |
|
| 586 | 585 | ); |
| 587 | 586 | |
| 588 | 587 | // bloquer ici le visiteur qui tente d'abuser de ses droits |
@@ -746,7 +745,7 @@ discard block |
||
| 746 | 745 | return false; |
| 747 | 746 | } |
| 748 | 747 | |
| 749 | - $row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 748 | + $row = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 750 | 749 | |
| 751 | 750 | if (!$row) { |
| 752 | 751 | if ( |
@@ -802,11 +801,11 @@ discard block |
||
| 802 | 801 | $retour = $retour ?: _T('icone_retour'); |
| 803 | 802 | $corps .= "<p>$raison</p>[<a href='$public'>$retour</a>] "; |
| 804 | 803 | if ($url) { |
| 805 | - $corps .= "[<a href='" . generer_url_action('cookie', "essai_auth_http=oui&$url") . "'>$re</a>]"; |
|
| 804 | + $corps .= "[<a href='".generer_url_action('cookie', "essai_auth_http=oui&$url")."'>$re</a>]"; |
|
| 806 | 805 | } |
| 807 | 806 | |
| 808 | 807 | if ($lien) { |
| 809 | - $corps .= " [<a href='$ecrire'>" . _T('login_espace_prive') . '</a>]'; |
|
| 808 | + $corps .= " [<a href='$ecrire'>"._T('login_espace_prive').'</a>]'; |
|
| 810 | 809 | } |
| 811 | 810 | include_spip('inc/minipres'); |
| 812 | 811 | echo minipres($pb, $corps); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | **/ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('base/abstract_sql'); |
@@ -34,33 +34,33 @@ discard block |
||
| 34 | 34 | * - une chaîne vide si autorisation à pénétrer dans l'espace privé. |
| 35 | 35 | */ |
| 36 | 36 | function inc_auth_dist() { |
| 37 | - $row = auth_mode(); |
|
| 37 | + $row = auth_mode(); |
|
| 38 | 38 | |
| 39 | - if ($row) { |
|
| 40 | - return auth_init_droits($row); |
|
| 41 | - } |
|
| 39 | + if ($row) { |
|
| 40 | + return auth_init_droits($row); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - if (!$GLOBALS['connect_login']) { |
|
| 44 | - return auth_a_loger(); |
|
| 45 | - } |
|
| 43 | + if (!$GLOBALS['connect_login']) { |
|
| 44 | + return auth_a_loger(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - // Cas ou l'auteur a ete identifie mais on n'a pas d'info sur lui |
|
| 48 | - // C'est soit parce que la base est inutilisable, |
|
| 49 | - // soit parce que la table des auteurs a changee (restauration etc) |
|
| 50 | - // Pas la peine d'insister. |
|
| 51 | - // Renvoyer le nom fautif et une URL de remise a zero |
|
| 47 | + // Cas ou l'auteur a ete identifie mais on n'a pas d'info sur lui |
|
| 48 | + // C'est soit parce que la base est inutilisable, |
|
| 49 | + // soit parce que la table des auteurs a changee (restauration etc) |
|
| 50 | + // Pas la peine d'insister. |
|
| 51 | + // Renvoyer le nom fautif et une URL de remise a zero |
|
| 52 | 52 | |
| 53 | - if (spip_connect()) { |
|
| 54 | - return [ |
|
| 55 | - 'login' => $GLOBALS['connect_login'], |
|
| 56 | - 'site' => generer_url_public('', 'action=logout&logout=prive') |
|
| 57 | - ]; |
|
| 58 | - } |
|
| 53 | + if (spip_connect()) { |
|
| 54 | + return [ |
|
| 55 | + 'login' => $GLOBALS['connect_login'], |
|
| 56 | + 'site' => generer_url_public('', 'action=logout&logout=prive') |
|
| 57 | + ]; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - $n = intval(sql_errno()); |
|
| 61 | - spip_log("Erreur base de donnees $n " . sql_error()); |
|
| 60 | + $n = intval(sql_errno()); |
|
| 61 | + spip_log("Erreur base de donnees $n " . sql_error()); |
|
| 62 | 62 | |
| 63 | - return $n ?: 1; |
|
| 63 | + return $n ?: 1; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,22 +70,22 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | function auth_controler_password_auteur_connecte(#[\SensitiveParameter] string $password): bool { |
| 72 | 72 | |
| 73 | - if ( |
|
| 74 | - empty($GLOBALS['visiteur_session']['id_auteur']) |
|
| 75 | - or empty($GLOBALS['visiteur_session']['login']) |
|
| 76 | - ) { |
|
| 77 | - return false; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - $auth = auth_identifier_login($GLOBALS['visiteur_session']['login'], $password, '', true); |
|
| 81 | - if ( |
|
| 82 | - is_array($auth) |
|
| 83 | - and $auth['id_auteur'] == $GLOBALS['visiteur_session']['id_auteur'] |
|
| 84 | - ) { |
|
| 85 | - return true; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - return false; |
|
| 73 | + if ( |
|
| 74 | + empty($GLOBALS['visiteur_session']['id_auteur']) |
|
| 75 | + or empty($GLOBALS['visiteur_session']['login']) |
|
| 76 | + ) { |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + $auth = auth_identifier_login($GLOBALS['visiteur_session']['login'], $password, '', true); |
|
| 81 | + if ( |
|
| 82 | + is_array($auth) |
|
| 83 | + and $auth['id_auteur'] == $GLOBALS['visiteur_session']['id_auteur'] |
|
| 84 | + ) { |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + return false; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -97,47 +97,47 @@ discard block |
||
| 97 | 97 | * @return array|string |
| 98 | 98 | */ |
| 99 | 99 | function auth_echec($raison) { |
| 100 | - include_spip('inc/minipres'); |
|
| 101 | - include_spip('inc/headers'); |
|
| 102 | - // pas authentifie. Pourquoi ? |
|
| 103 | - if (is_string($raison)) { |
|
| 104 | - // redirection vers une page d'authentification |
|
| 105 | - // on ne revient pas de cette fonction |
|
| 106 | - // sauf si pb de header |
|
| 107 | - $raison = redirige_formulaire($raison); |
|
| 108 | - } elseif (is_int($raison)) { |
|
| 109 | - // erreur SQL a afficher |
|
| 110 | - $raison = minipres( |
|
| 111 | - _T('info_travaux_titre'), |
|
| 112 | - _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>' |
|
| 113 | - ); |
|
| 114 | - } elseif (@$raison['statut']) { |
|
| 115 | - // un simple visiteur n'a pas acces a l'espace prive |
|
| 116 | - spip_log('connexion refusee a ' . @$raison['id_auteur']); |
|
| 117 | - $est_connecte = (!empty($GLOBALS['visiteur_session']['login']) and !empty($GLOBALS['visiteur_session']['statut'])); // idem test balise #URL_LOGOUT |
|
| 118 | - $raison = minipres( |
|
| 119 | - _T('avis_erreur_connexion'), |
|
| 120 | - _T('avis_erreur_visiteur') |
|
| 121 | - // Lien vers le site public |
|
| 122 | - . '<br /><a href="' . url_de_base() . '">' . _T('login_retour_public') . '</a>' |
|
| 123 | - // Si la personne est connectée, lien de déconnexion ramenant vers la page de login |
|
| 124 | - . ($est_connecte ? ' | <a href="' . generer_url_public('', 'action=logout&logout=prive') . '">' . _T('icone_deconnecter') . '</a>' : '') |
|
| 125 | - ); |
|
| 126 | - } else { |
|
| 127 | - // auteur en fin de droits ... |
|
| 128 | - $h = $raison['site']; |
|
| 129 | - $raison = minipres( |
|
| 130 | - _T('avis_erreur_connexion'), |
|
| 131 | - '<br /><br /><p>' |
|
| 132 | - . _T('texte_inc_auth_1', ['auth_login' => $raison['login']]) |
|
| 133 | - . " <a href='$h'>" |
|
| 134 | - . _T('texte_inc_auth_2') |
|
| 135 | - . '</a>' |
|
| 136 | - . _T('texte_inc_auth_3') |
|
| 137 | - ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - return $raison; |
|
| 100 | + include_spip('inc/minipres'); |
|
| 101 | + include_spip('inc/headers'); |
|
| 102 | + // pas authentifie. Pourquoi ? |
|
| 103 | + if (is_string($raison)) { |
|
| 104 | + // redirection vers une page d'authentification |
|
| 105 | + // on ne revient pas de cette fonction |
|
| 106 | + // sauf si pb de header |
|
| 107 | + $raison = redirige_formulaire($raison); |
|
| 108 | + } elseif (is_int($raison)) { |
|
| 109 | + // erreur SQL a afficher |
|
| 110 | + $raison = minipres( |
|
| 111 | + _T('info_travaux_titre'), |
|
| 112 | + _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>' |
|
| 113 | + ); |
|
| 114 | + } elseif (@$raison['statut']) { |
|
| 115 | + // un simple visiteur n'a pas acces a l'espace prive |
|
| 116 | + spip_log('connexion refusee a ' . @$raison['id_auteur']); |
|
| 117 | + $est_connecte = (!empty($GLOBALS['visiteur_session']['login']) and !empty($GLOBALS['visiteur_session']['statut'])); // idem test balise #URL_LOGOUT |
|
| 118 | + $raison = minipres( |
|
| 119 | + _T('avis_erreur_connexion'), |
|
| 120 | + _T('avis_erreur_visiteur') |
|
| 121 | + // Lien vers le site public |
|
| 122 | + . '<br /><a href="' . url_de_base() . '">' . _T('login_retour_public') . '</a>' |
|
| 123 | + // Si la personne est connectée, lien de déconnexion ramenant vers la page de login |
|
| 124 | + . ($est_connecte ? ' | <a href="' . generer_url_public('', 'action=logout&logout=prive') . '">' . _T('icone_deconnecter') . '</a>' : '') |
|
| 125 | + ); |
|
| 126 | + } else { |
|
| 127 | + // auteur en fin de droits ... |
|
| 128 | + $h = $raison['site']; |
|
| 129 | + $raison = minipres( |
|
| 130 | + _T('avis_erreur_connexion'), |
|
| 131 | + '<br /><br /><p>' |
|
| 132 | + . _T('texte_inc_auth_1', ['auth_login' => $raison['login']]) |
|
| 133 | + . " <a href='$h'>" |
|
| 134 | + . _T('texte_inc_auth_2') |
|
| 135 | + . '</a>' |
|
| 136 | + . _T('texte_inc_auth_3') |
|
| 137 | + ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + return $raison; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -147,81 +147,81 @@ discard block |
||
| 147 | 147 | * @return array|bool|string |
| 148 | 148 | */ |
| 149 | 149 | function auth_mode() { |
| 150 | - // |
|
| 151 | - // Initialiser variables (eviter hacks par URL) |
|
| 152 | - // |
|
| 153 | - $GLOBALS['connect_login'] = ''; |
|
| 154 | - $id_auteur = null; |
|
| 155 | - $GLOBALS['auth_can_disconnect'] = false; |
|
| 156 | - |
|
| 157 | - // |
|
| 158 | - // Recuperer les donnees d'identification |
|
| 159 | - // |
|
| 160 | - include_spip('inc/session'); |
|
| 161 | - // Session valide en cours ? |
|
| 162 | - if (isset($_COOKIE['spip_session'])) { |
|
| 163 | - $session = charger_fonction('session', 'inc'); |
|
| 164 | - if ( |
|
| 165 | - $id_auteur = $session() |
|
| 166 | - or $id_auteur === 0 // reprise sur restauration |
|
| 167 | - ) { |
|
| 168 | - $GLOBALS['auth_can_disconnect'] = true; |
|
| 169 | - $GLOBALS['connect_login'] = session_get('login'); |
|
| 170 | - } else { |
|
| 171 | - unset($_COOKIE['spip_session']); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - // Essayer auth http si significatif |
|
| 176 | - // (ignorer les login d'intranet independants de spip) |
|
| 177 | - if (!$GLOBALS['ignore_auth_http']) { |
|
| 178 | - if ( |
|
| 179 | - (isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW']) |
|
| 180 | - and $r = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) |
|
| 181 | - or |
|
| 182 | - // Si auth http differtente de basic, PHP_AUTH_PW |
|
| 183 | - // est indisponible mais tentons quand meme pour |
|
| 184 | - // autocreation via LDAP |
|
| 185 | - (isset($_SERVER['REMOTE_USER']) |
|
| 186 | - and $r = lire_php_auth($_SERVER['PHP_AUTH_USER'] = $_SERVER['REMOTE_USER'], '')) |
|
| 187 | - ) { |
|
| 188 | - if (!$id_auteur) { |
|
| 189 | - $_SERVER['PHP_AUTH_PW'] = ''; |
|
| 190 | - $GLOBALS['auth_can_disconnect'] = true; |
|
| 191 | - $GLOBALS['visiteur_session'] = $r; |
|
| 192 | - $GLOBALS['connect_login'] = session_get('login'); |
|
| 193 | - $id_auteur = $r['id_auteur']; |
|
| 194 | - } else { |
|
| 195 | - // cas de la session en plus de PHP_AUTH |
|
| 196 | - /* if ($id_auteur != $r['id_auteur']){ |
|
| 150 | + // |
|
| 151 | + // Initialiser variables (eviter hacks par URL) |
|
| 152 | + // |
|
| 153 | + $GLOBALS['connect_login'] = ''; |
|
| 154 | + $id_auteur = null; |
|
| 155 | + $GLOBALS['auth_can_disconnect'] = false; |
|
| 156 | + |
|
| 157 | + // |
|
| 158 | + // Recuperer les donnees d'identification |
|
| 159 | + // |
|
| 160 | + include_spip('inc/session'); |
|
| 161 | + // Session valide en cours ? |
|
| 162 | + if (isset($_COOKIE['spip_session'])) { |
|
| 163 | + $session = charger_fonction('session', 'inc'); |
|
| 164 | + if ( |
|
| 165 | + $id_auteur = $session() |
|
| 166 | + or $id_auteur === 0 // reprise sur restauration |
|
| 167 | + ) { |
|
| 168 | + $GLOBALS['auth_can_disconnect'] = true; |
|
| 169 | + $GLOBALS['connect_login'] = session_get('login'); |
|
| 170 | + } else { |
|
| 171 | + unset($_COOKIE['spip_session']); |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + // Essayer auth http si significatif |
|
| 176 | + // (ignorer les login d'intranet independants de spip) |
|
| 177 | + if (!$GLOBALS['ignore_auth_http']) { |
|
| 178 | + if ( |
|
| 179 | + (isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW']) |
|
| 180 | + and $r = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) |
|
| 181 | + or |
|
| 182 | + // Si auth http differtente de basic, PHP_AUTH_PW |
|
| 183 | + // est indisponible mais tentons quand meme pour |
|
| 184 | + // autocreation via LDAP |
|
| 185 | + (isset($_SERVER['REMOTE_USER']) |
|
| 186 | + and $r = lire_php_auth($_SERVER['PHP_AUTH_USER'] = $_SERVER['REMOTE_USER'], '')) |
|
| 187 | + ) { |
|
| 188 | + if (!$id_auteur) { |
|
| 189 | + $_SERVER['PHP_AUTH_PW'] = ''; |
|
| 190 | + $GLOBALS['auth_can_disconnect'] = true; |
|
| 191 | + $GLOBALS['visiteur_session'] = $r; |
|
| 192 | + $GLOBALS['connect_login'] = session_get('login'); |
|
| 193 | + $id_auteur = $r['id_auteur']; |
|
| 194 | + } else { |
|
| 195 | + // cas de la session en plus de PHP_AUTH |
|
| 196 | + /* if ($id_auteur != $r['id_auteur']){ |
|
| 197 | 197 | spip_log("vol de session $id_auteur" . join(', ', $r)); |
| 198 | 198 | unset($_COOKIE['spip_session']); |
| 199 | 199 | $id_auteur = ''; |
| 200 | 200 | } */ |
| 201 | - } |
|
| 202 | - } else { |
|
| 203 | - // Authentification .htaccess old style, car .htaccess semble |
|
| 204 | - // souvent definir *aussi* PHP_AUTH_USER et PHP_AUTH_PW |
|
| 205 | - if (isset($_SERVER['REMOTE_USER'])) { |
|
| 206 | - $GLOBALS['connect_login'] = $_SERVER['REMOTE_USER']; |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - $where = (is_numeric($id_auteur) |
|
| 212 | - /*AND $id_auteur>0*/ // reprise lors des restaurations |
|
| 213 | - ) ? |
|
| 214 | - "id_auteur=$id_auteur" : |
|
| 215 | - (!strlen($GLOBALS['connect_login']) ? '' : 'login=' . sql_quote($GLOBALS['connect_login'], '', 'text')); |
|
| 216 | - |
|
| 217 | - if (!$where) { |
|
| 218 | - return ''; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - // Trouver les autres infos dans la table auteurs. |
|
| 222 | - // le champ 'quand' est utilise par l'agenda |
|
| 223 | - |
|
| 224 | - return sql_fetsel('*, en_ligne AS quand', 'spip_auteurs', "$where AND statut!='5poubelle'"); |
|
| 201 | + } |
|
| 202 | + } else { |
|
| 203 | + // Authentification .htaccess old style, car .htaccess semble |
|
| 204 | + // souvent definir *aussi* PHP_AUTH_USER et PHP_AUTH_PW |
|
| 205 | + if (isset($_SERVER['REMOTE_USER'])) { |
|
| 206 | + $GLOBALS['connect_login'] = $_SERVER['REMOTE_USER']; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + $where = (is_numeric($id_auteur) |
|
| 212 | + /*AND $id_auteur>0*/ // reprise lors des restaurations |
|
| 213 | + ) ? |
|
| 214 | + "id_auteur=$id_auteur" : |
|
| 215 | + (!strlen($GLOBALS['connect_login']) ? '' : 'login=' . sql_quote($GLOBALS['connect_login'], '', 'text')); |
|
| 216 | + |
|
| 217 | + if (!$where) { |
|
| 218 | + return ''; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + // Trouver les autres infos dans la table auteurs. |
|
| 222 | + // le champ 'quand' est utilise par l'agenda |
|
| 223 | + |
|
| 224 | + return sql_fetsel('*, en_ligne AS quand', 'spip_auteurs', "$where AND statut!='5poubelle'"); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -239,85 +239,85 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | function auth_init_droits($row) { |
| 241 | 241 | |
| 242 | - include_spip('inc/autoriser'); |
|
| 243 | - if (!autoriser('loger', '', 0, $row)) { |
|
| 244 | - return false; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - |
|
| 248 | - if ($row['statut'] == 'nouveau') { |
|
| 249 | - include_spip('action/inscrire_auteur'); |
|
| 250 | - $row = confirmer_statut_inscription($row); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - $GLOBALS['connect_id_auteur'] = $row['id_auteur']; |
|
| 254 | - $GLOBALS['connect_login'] = $row['login']; |
|
| 255 | - $GLOBALS['connect_statut'] = $row['statut']; |
|
| 256 | - |
|
| 257 | - $GLOBALS['visiteur_session'] = array_merge((array)$GLOBALS['visiteur_session'], $row); |
|
| 258 | - |
|
| 259 | - // au cas ou : ne pas memoriser les champs sensibles |
|
| 260 | - unset($GLOBALS['visiteur_session']['pass']); |
|
| 261 | - unset($GLOBALS['visiteur_session']['htpass']); |
|
| 262 | - unset($GLOBALS['visiteur_session']['alea_actuel']); |
|
| 263 | - unset($GLOBALS['visiteur_session']['alea_futur']); |
|
| 264 | - unset($GLOBALS['visiteur_session']['ldap_password']); |
|
| 265 | - |
|
| 266 | - // creer la session au besoin |
|
| 267 | - if (!isset($_COOKIE['spip_session'])) { |
|
| 268 | - $session = charger_fonction('session', 'inc'); |
|
| 269 | - $spip_session = $session($row); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - // reinjecter les preferences_auteur apres le reset de spip_session |
|
| 273 | - // car utilisees au retour par auth_loger() |
|
| 274 | - $r = @unserialize($row['prefs']); |
|
| 275 | - $GLOBALS['visiteur_session']['prefs'] = ($r ?: []); |
|
| 276 | - // si prefs pas definies, les definir par defaut |
|
| 277 | - if (!isset($GLOBALS['visiteur_session']['prefs']['couleur'])) { |
|
| 278 | - $GLOBALS['visiteur_session']['prefs']['couleur'] = 2; |
|
| 279 | - $GLOBALS['visiteur_session']['prefs']['display'] = 2; |
|
| 280 | - $GLOBALS['visiteur_session']['prefs']['display_navigation'] = 'navigation_avec_icones'; |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - $GLOBALS['visiteur_session'] = pipeline( |
|
| 284 | - 'preparer_visiteur_session', |
|
| 285 | - ['args' => ['row' => $row], |
|
| 286 | - 'data' => $GLOBALS['visiteur_session']] |
|
| 287 | - ); |
|
| 288 | - |
|
| 289 | - // Etablir les droits selon le codage attendu |
|
| 290 | - // dans ecrire/index.php ecrire/prive.php |
|
| 291 | - |
|
| 292 | - // Pas autorise a acceder a ecrire ? renvoyer le tableau |
|
| 293 | - // A noter : le premier appel a autoriser() a le bon gout |
|
| 294 | - // d'initialiser $GLOBALS['visiteur_session']['restreint'], |
|
| 295 | - // qui ne figure pas dans le fichier de session |
|
| 296 | - |
|
| 297 | - if (!autoriser('ecrire')) { |
|
| 298 | - return $row; |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - // autoriser('ecrire') ne laisse passer que les Admin et les Redac |
|
| 302 | - |
|
| 303 | - auth_trace($row); |
|
| 304 | - |
|
| 305 | - // Administrateurs |
|
| 306 | - if (in_array($GLOBALS['connect_statut'], explode(',', _STATUT_AUTEUR_RUBRIQUE))) { |
|
| 307 | - if ( |
|
| 308 | - isset($GLOBALS['visiteur_session']['restreint']) |
|
| 309 | - and is_array($GLOBALS['visiteur_session']['restreint']) |
|
| 310 | - ) { |
|
| 311 | - $GLOBALS['connect_id_rubrique'] = $GLOBALS['visiteur_session']['restreint']; |
|
| 312 | - } |
|
| 313 | - if ($GLOBALS['connect_statut'] == '0minirezo') { |
|
| 314 | - $GLOBALS['connect_toutes_rubriques'] = !$GLOBALS['connect_id_rubrique']; |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - // Pour les redacteurs, inc_version a fait l'initialisation minimale |
|
| 319 | - |
|
| 320 | - return ''; // i.e. pas de pb. |
|
| 242 | + include_spip('inc/autoriser'); |
|
| 243 | + if (!autoriser('loger', '', 0, $row)) { |
|
| 244 | + return false; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + |
|
| 248 | + if ($row['statut'] == 'nouveau') { |
|
| 249 | + include_spip('action/inscrire_auteur'); |
|
| 250 | + $row = confirmer_statut_inscription($row); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + $GLOBALS['connect_id_auteur'] = $row['id_auteur']; |
|
| 254 | + $GLOBALS['connect_login'] = $row['login']; |
|
| 255 | + $GLOBALS['connect_statut'] = $row['statut']; |
|
| 256 | + |
|
| 257 | + $GLOBALS['visiteur_session'] = array_merge((array)$GLOBALS['visiteur_session'], $row); |
|
| 258 | + |
|
| 259 | + // au cas ou : ne pas memoriser les champs sensibles |
|
| 260 | + unset($GLOBALS['visiteur_session']['pass']); |
|
| 261 | + unset($GLOBALS['visiteur_session']['htpass']); |
|
| 262 | + unset($GLOBALS['visiteur_session']['alea_actuel']); |
|
| 263 | + unset($GLOBALS['visiteur_session']['alea_futur']); |
|
| 264 | + unset($GLOBALS['visiteur_session']['ldap_password']); |
|
| 265 | + |
|
| 266 | + // creer la session au besoin |
|
| 267 | + if (!isset($_COOKIE['spip_session'])) { |
|
| 268 | + $session = charger_fonction('session', 'inc'); |
|
| 269 | + $spip_session = $session($row); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + // reinjecter les preferences_auteur apres le reset de spip_session |
|
| 273 | + // car utilisees au retour par auth_loger() |
|
| 274 | + $r = @unserialize($row['prefs']); |
|
| 275 | + $GLOBALS['visiteur_session']['prefs'] = ($r ?: []); |
|
| 276 | + // si prefs pas definies, les definir par defaut |
|
| 277 | + if (!isset($GLOBALS['visiteur_session']['prefs']['couleur'])) { |
|
| 278 | + $GLOBALS['visiteur_session']['prefs']['couleur'] = 2; |
|
| 279 | + $GLOBALS['visiteur_session']['prefs']['display'] = 2; |
|
| 280 | + $GLOBALS['visiteur_session']['prefs']['display_navigation'] = 'navigation_avec_icones'; |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + $GLOBALS['visiteur_session'] = pipeline( |
|
| 284 | + 'preparer_visiteur_session', |
|
| 285 | + ['args' => ['row' => $row], |
|
| 286 | + 'data' => $GLOBALS['visiteur_session']] |
|
| 287 | + ); |
|
| 288 | + |
|
| 289 | + // Etablir les droits selon le codage attendu |
|
| 290 | + // dans ecrire/index.php ecrire/prive.php |
|
| 291 | + |
|
| 292 | + // Pas autorise a acceder a ecrire ? renvoyer le tableau |
|
| 293 | + // A noter : le premier appel a autoriser() a le bon gout |
|
| 294 | + // d'initialiser $GLOBALS['visiteur_session']['restreint'], |
|
| 295 | + // qui ne figure pas dans le fichier de session |
|
| 296 | + |
|
| 297 | + if (!autoriser('ecrire')) { |
|
| 298 | + return $row; |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + // autoriser('ecrire') ne laisse passer que les Admin et les Redac |
|
| 302 | + |
|
| 303 | + auth_trace($row); |
|
| 304 | + |
|
| 305 | + // Administrateurs |
|
| 306 | + if (in_array($GLOBALS['connect_statut'], explode(',', _STATUT_AUTEUR_RUBRIQUE))) { |
|
| 307 | + if ( |
|
| 308 | + isset($GLOBALS['visiteur_session']['restreint']) |
|
| 309 | + and is_array($GLOBALS['visiteur_session']['restreint']) |
|
| 310 | + ) { |
|
| 311 | + $GLOBALS['connect_id_rubrique'] = $GLOBALS['visiteur_session']['restreint']; |
|
| 312 | + } |
|
| 313 | + if ($GLOBALS['connect_statut'] == '0minirezo') { |
|
| 314 | + $GLOBALS['connect_toutes_rubriques'] = !$GLOBALS['connect_id_rubrique']; |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + // Pour les redacteurs, inc_version a fait l'initialisation minimale |
|
| 319 | + |
|
| 320 | + return ''; // i.e. pas de pb. |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -326,23 +326,23 @@ discard block |
||
| 326 | 326 | * @return string |
| 327 | 327 | */ |
| 328 | 328 | function auth_a_loger() { |
| 329 | - $redirect = generer_url_public('login', 'url=' . rawurlencode(self('&', true)), true); |
|
| 330 | - |
|
| 331 | - // un echec au "bonjour" (login initial) quand le statut est |
|
| 332 | - // inconnu signale sans doute un probleme de cookies |
|
| 333 | - if (isset($_GET['bonjour'])) { |
|
| 334 | - $redirect = parametre_url( |
|
| 335 | - $redirect, |
|
| 336 | - 'var_erreur', |
|
| 337 | - (!isset($GLOBALS['visiteur_session']['statut']) |
|
| 338 | - ? 'cookie' |
|
| 339 | - : 'statut' |
|
| 340 | - ), |
|
| 341 | - '&' |
|
| 342 | - ); |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - return $redirect; |
|
| 329 | + $redirect = generer_url_public('login', 'url=' . rawurlencode(self('&', true)), true); |
|
| 330 | + |
|
| 331 | + // un echec au "bonjour" (login initial) quand le statut est |
|
| 332 | + // inconnu signale sans doute un probleme de cookies |
|
| 333 | + if (isset($_GET['bonjour'])) { |
|
| 334 | + $redirect = parametre_url( |
|
| 335 | + $redirect, |
|
| 336 | + 'var_erreur', |
|
| 337 | + (!isset($GLOBALS['visiteur_session']['statut']) |
|
| 338 | + ? 'cookie' |
|
| 339 | + : 'statut' |
|
| 340 | + ), |
|
| 341 | + '&' |
|
| 342 | + ); |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + return $redirect; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -354,19 +354,19 @@ discard block |
||
| 354 | 354 | * @param null|string $date |
| 355 | 355 | */ |
| 356 | 356 | function auth_trace($row, $date = null) { |
| 357 | - // Indiquer la connexion. A la minute pres ca suffit. |
|
| 358 | - if (!is_numeric($connect_quand = $row['quand'] ?? '')) { |
|
| 359 | - $connect_quand = strtotime($connect_quand); |
|
| 360 | - } |
|
| 357 | + // Indiquer la connexion. A la minute pres ca suffit. |
|
| 358 | + if (!is_numeric($connect_quand = $row['quand'] ?? '')) { |
|
| 359 | + $connect_quand = strtotime($connect_quand); |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - $date ??= date('Y-m-d H:i:s'); |
|
| 362 | + $date ??= date('Y-m-d H:i:s'); |
|
| 363 | 363 | |
| 364 | - if (abs(strtotime($date) - $connect_quand) >= 60) { |
|
| 365 | - sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur=' . intval($row['id_auteur'])); |
|
| 366 | - $row['en_ligne'] = $date; |
|
| 367 | - } |
|
| 364 | + if (abs(strtotime($date) - $connect_quand) >= 60) { |
|
| 365 | + sql_updateq('spip_auteurs', ['en_ligne' => $date], 'id_auteur=' . intval($row['id_auteur'])); |
|
| 366 | + $row['en_ligne'] = $date; |
|
| 367 | + } |
|
| 368 | 368 | |
| 369 | - pipeline('trig_auth_trace', ['args' => ['row' => $row, 'date' => $date]]); |
|
| 369 | + pipeline('trig_auth_trace', ['args' => ['row' => $row, 'date' => $date]]); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | |
@@ -392,28 +392,28 @@ discard block |
||
| 392 | 392 | * @return mixed |
| 393 | 393 | */ |
| 394 | 394 | function auth_administrer($fonction, $args, $defaut = false) { |
| 395 | - $auth_methode = array_shift($args); |
|
| 396 | - $auth_methode = $auth_methode ?: 'spip'; // valeur par defaut au cas ou |
|
| 397 | - if ( |
|
| 398 | - $auth = charger_fonction($auth_methode, 'auth', true) |
|
| 399 | - and function_exists($f = "auth_{$auth_methode}_$fonction") |
|
| 400 | - ) { |
|
| 401 | - $res = $f(...$args); |
|
| 402 | - } else { |
|
| 403 | - $res = $defaut; |
|
| 404 | - } |
|
| 405 | - $res = pipeline( |
|
| 406 | - 'auth_administrer', |
|
| 407 | - [ |
|
| 408 | - 'args' => [ |
|
| 409 | - 'fonction' => $fonction, |
|
| 410 | - 'methode' => $auth_methode, |
|
| 411 | - 'args' => $args |
|
| 412 | - ], |
|
| 413 | - 'data' => $res |
|
| 414 | - ] |
|
| 415 | - ); |
|
| 416 | - return $res; |
|
| 395 | + $auth_methode = array_shift($args); |
|
| 396 | + $auth_methode = $auth_methode ?: 'spip'; // valeur par defaut au cas ou |
|
| 397 | + if ( |
|
| 398 | + $auth = charger_fonction($auth_methode, 'auth', true) |
|
| 399 | + and function_exists($f = "auth_{$auth_methode}_$fonction") |
|
| 400 | + ) { |
|
| 401 | + $res = $f(...$args); |
|
| 402 | + } else { |
|
| 403 | + $res = $defaut; |
|
| 404 | + } |
|
| 405 | + $res = pipeline( |
|
| 406 | + 'auth_administrer', |
|
| 407 | + [ |
|
| 408 | + 'args' => [ |
|
| 409 | + 'fonction' => $fonction, |
|
| 410 | + 'methode' => $auth_methode, |
|
| 411 | + 'args' => $args |
|
| 412 | + ], |
|
| 413 | + 'data' => $res |
|
| 414 | + ] |
|
| 415 | + ); |
|
| 416 | + return $res; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /** |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | * @return array |
| 424 | 424 | */ |
| 425 | 425 | function auth_formulaire_login($flux) { |
| 426 | - foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 427 | - $flux = auth_administrer('formulaire_login', [$methode, $flux], $flux); |
|
| 428 | - } |
|
| 426 | + foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 427 | + $flux = auth_administrer('formulaire_login', [$methode, $flux], $flux); |
|
| 428 | + } |
|
| 429 | 429 | |
| 430 | - return $flux; |
|
| 430 | + return $flux; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | |
@@ -441,19 +441,19 @@ discard block |
||
| 441 | 441 | * @return string/bool |
| 442 | 442 | */ |
| 443 | 443 | function auth_retrouver_login($login, $serveur = '') { |
| 444 | - if (!spip_connect($serveur)) { |
|
| 445 | - include_spip('inc/minipres'); |
|
| 446 | - echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique')); |
|
| 447 | - exit; |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 451 | - if ($auteur = auth_administrer('retrouver_login', [$methode, $login, $serveur])) { |
|
| 452 | - return $auteur; |
|
| 453 | - } |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - return false; |
|
| 444 | + if (!spip_connect($serveur)) { |
|
| 445 | + include_spip('inc/minipres'); |
|
| 446 | + echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique')); |
|
| 447 | + exit; |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 451 | + if ($auteur = auth_administrer('retrouver_login', [$methode, $login, $serveur])) { |
|
| 452 | + return $auteur; |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + return false; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -468,34 +468,34 @@ discard block |
||
| 468 | 468 | * @return array |
| 469 | 469 | */ |
| 470 | 470 | function auth_informer_login($login, $serveur = '') { |
| 471 | - if ( |
|
| 472 | - !$login |
|
| 473 | - or !$login_base = auth_retrouver_login($login, $serveur) |
|
| 474 | - or !$row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur) |
|
| 475 | - ) { |
|
| 476 | - // generer de fausses infos, mais credibles, pour eviter une attaque |
|
| 477 | - // https://core.spip.net/issues/1758 + https://core.spip.net/issues/3691 |
|
| 478 | - |
|
| 479 | - $row = [ |
|
| 480 | - 'login' => $login, |
|
| 481 | - 'cnx' => '0', |
|
| 482 | - 'logo' => '', |
|
| 483 | - ]; |
|
| 484 | - |
|
| 485 | - return $row; |
|
| 486 | - } |
|
| 487 | - |
|
| 488 | - $prefs = @unserialize($row['prefs']); |
|
| 489 | - $infos = [ |
|
| 490 | - 'id_auteur' => $row['id_auteur'], |
|
| 491 | - 'login' => $row['login'], |
|
| 492 | - 'cnx' => (isset($prefs['cnx']) and $prefs['cnx'] === 'perma') ? '1' : '0', |
|
| 493 | - 'logo' => recuperer_fond('formulaires/inc-logo_auteur', $row), |
|
| 494 | - ]; |
|
| 495 | - |
|
| 496 | - verifier_visiteur(); |
|
| 497 | - |
|
| 498 | - return auth_administrer('informer_login', [$row['source'], $infos, $row, $serveur], $infos); |
|
| 471 | + if ( |
|
| 472 | + !$login |
|
| 473 | + or !$login_base = auth_retrouver_login($login, $serveur) |
|
| 474 | + or !$row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur) |
|
| 475 | + ) { |
|
| 476 | + // generer de fausses infos, mais credibles, pour eviter une attaque |
|
| 477 | + // https://core.spip.net/issues/1758 + https://core.spip.net/issues/3691 |
|
| 478 | + |
|
| 479 | + $row = [ |
|
| 480 | + 'login' => $login, |
|
| 481 | + 'cnx' => '0', |
|
| 482 | + 'logo' => '', |
|
| 483 | + ]; |
|
| 484 | + |
|
| 485 | + return $row; |
|
| 486 | + } |
|
| 487 | + |
|
| 488 | + $prefs = @unserialize($row['prefs']); |
|
| 489 | + $infos = [ |
|
| 490 | + 'id_auteur' => $row['id_auteur'], |
|
| 491 | + 'login' => $row['login'], |
|
| 492 | + 'cnx' => (isset($prefs['cnx']) and $prefs['cnx'] === 'perma') ? '1' : '0', |
|
| 493 | + 'logo' => recuperer_fond('formulaires/inc-logo_auteur', $row), |
|
| 494 | + ]; |
|
| 495 | + |
|
| 496 | + verifier_visiteur(); |
|
| 497 | + |
|
| 498 | + return auth_administrer('informer_login', [$row['source'], $infos, $row, $serveur], $infos); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | |
@@ -509,21 +509,21 @@ discard block |
||
| 509 | 509 | * @return mixed |
| 510 | 510 | */ |
| 511 | 511 | function auth_identifier_login($login, #[\SensitiveParameter] $password, $serveur = '', bool $phpauth = false) { |
| 512 | - $erreur = ''; |
|
| 513 | - foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 514 | - if ($auth = charger_fonction($methode, 'auth', true)) { |
|
| 515 | - $auteur = $auth($login, $password, $serveur, $phpauth); |
|
| 516 | - if (is_array($auteur) and count($auteur)) { |
|
| 517 | - spip_log("connexion de $login par methode $methode"); |
|
| 518 | - $auteur['auth'] = $methode; |
|
| 519 | - return $auteur; |
|
| 520 | - } elseif (is_string($auteur)) { |
|
| 521 | - $erreur .= "$auteur "; |
|
| 522 | - } |
|
| 523 | - } |
|
| 524 | - } |
|
| 525 | - |
|
| 526 | - return $erreur; |
|
| 512 | + $erreur = ''; |
|
| 513 | + foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 514 | + if ($auth = charger_fonction($methode, 'auth', true)) { |
|
| 515 | + $auteur = $auth($login, $password, $serveur, $phpauth); |
|
| 516 | + if (is_array($auteur) and count($auteur)) { |
|
| 517 | + spip_log("connexion de $login par methode $methode"); |
|
| 518 | + $auteur['auth'] = $methode; |
|
| 519 | + return $auteur; |
|
| 520 | + } elseif (is_string($auteur)) { |
|
| 521 | + $erreur .= "$auteur "; |
|
| 522 | + } |
|
| 523 | + } |
|
| 524 | + } |
|
| 525 | + |
|
| 526 | + return $erreur; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -537,8 +537,8 @@ discard block |
||
| 537 | 537 | * @return string |
| 538 | 538 | */ |
| 539 | 539 | function auth_url_retour_login($auth_methode, $login, $redirect = '', $serveur = '') { |
| 540 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 541 | - return $securiser_action('auth', "$auth_methode/$login", $redirect, true); |
|
| 540 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 541 | + return $securiser_action('auth', "$auth_methode/$login", $redirect, true); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | /** |
@@ -552,9 +552,9 @@ discard block |
||
| 552 | 552 | * @return mixed |
| 553 | 553 | */ |
| 554 | 554 | function auth_terminer_identifier_login($auth_methode, $login, $serveur = '') { |
| 555 | - $args = func_get_args(); |
|
| 556 | - $auteur = auth_administrer('terminer_identifier_login', $args); |
|
| 557 | - return $auteur; |
|
| 555 | + $args = func_get_args(); |
|
| 556 | + $auteur = auth_administrer('terminer_identifier_login', $args); |
|
| 557 | + return $auteur; |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /** |
@@ -564,29 +564,29 @@ discard block |
||
| 564 | 564 | * @return bool |
| 565 | 565 | */ |
| 566 | 566 | function auth_loger($auteur) { |
| 567 | - if (!is_array($auteur) or !count($auteur)) { |
|
| 568 | - return false; |
|
| 569 | - } |
|
| 570 | - |
|
| 571 | - // initialiser et poser le cookie de session |
|
| 572 | - unset($_COOKIE['spip_session']); |
|
| 573 | - if (auth_init_droits($auteur) === false) { |
|
| 574 | - return false; |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - // initialiser les prefs |
|
| 578 | - $p = $GLOBALS['visiteur_session']['prefs']; |
|
| 579 | - $p['cnx'] = (isset($auteur['cookie']) and $auteur['cookie'] == 'oui') ? 'perma' : ''; |
|
| 580 | - |
|
| 581 | - sql_updateq( |
|
| 582 | - 'spip_auteurs', |
|
| 583 | - ['prefs' => serialize($p)], |
|
| 584 | - 'id_auteur=' . intval($auteur['id_auteur']) |
|
| 585 | - ); |
|
| 586 | - |
|
| 587 | - // bloquer ici le visiteur qui tente d'abuser de ses droits |
|
| 588 | - verifier_visiteur(); |
|
| 589 | - return true; |
|
| 567 | + if (!is_array($auteur) or !count($auteur)) { |
|
| 568 | + return false; |
|
| 569 | + } |
|
| 570 | + |
|
| 571 | + // initialiser et poser le cookie de session |
|
| 572 | + unset($_COOKIE['spip_session']); |
|
| 573 | + if (auth_init_droits($auteur) === false) { |
|
| 574 | + return false; |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + // initialiser les prefs |
|
| 578 | + $p = $GLOBALS['visiteur_session']['prefs']; |
|
| 579 | + $p['cnx'] = (isset($auteur['cookie']) and $auteur['cookie'] == 'oui') ? 'perma' : ''; |
|
| 580 | + |
|
| 581 | + sql_updateq( |
|
| 582 | + 'spip_auteurs', |
|
| 583 | + ['prefs' => serialize($p)], |
|
| 584 | + 'id_auteur=' . intval($auteur['id_auteur']) |
|
| 585 | + ); |
|
| 586 | + |
|
| 587 | + // bloquer ici le visiteur qui tente d'abuser de ses droits |
|
| 588 | + verifier_visiteur(); |
|
| 589 | + return true; |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | /** |
@@ -596,8 +596,8 @@ discard block |
||
| 596 | 596 | * return void |
| 597 | 597 | **/ |
| 598 | 598 | function auth_deloger() { |
| 599 | - $logout = charger_fonction('logout', 'action'); |
|
| 600 | - $logout(); |
|
| 599 | + $logout = charger_fonction('logout', 'action'); |
|
| 600 | + $logout(); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | /** |
@@ -611,8 +611,8 @@ discard block |
||
| 611 | 611 | * @return bool |
| 612 | 612 | */ |
| 613 | 613 | function auth_autoriser_modifier_login($auth_methode, $serveur = '') { |
| 614 | - $args = func_get_args(); |
|
| 615 | - return auth_administrer('autoriser_modifier_login', $args); |
|
| 614 | + $args = func_get_args(); |
|
| 615 | + return auth_administrer('autoriser_modifier_login', $args); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | /** |
@@ -627,8 +627,8 @@ discard block |
||
| 627 | 627 | * message d'erreur ou chaine vide si pas d'erreur |
| 628 | 628 | */ |
| 629 | 629 | function auth_verifier_login($auth_methode, $new_login, $id_auteur = 0, $serveur = '') { |
| 630 | - $args = func_get_args(); |
|
| 631 | - return auth_administrer('verifier_login', $args, ''); |
|
| 630 | + $args = func_get_args(); |
|
| 631 | + return auth_administrer('verifier_login', $args, ''); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | /** |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | * @return bool |
| 642 | 642 | */ |
| 643 | 643 | function auth_modifier_login($auth_methode, $new_login, $id_auteur, $serveur = '') { |
| 644 | - $args = func_get_args(); |
|
| 645 | - return auth_administrer('modifier_login', $args); |
|
| 644 | + $args = func_get_args(); |
|
| 645 | + return auth_administrer('modifier_login', $args); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -657,8 +657,8 @@ discard block |
||
| 657 | 657 | * succès ou échec |
| 658 | 658 | */ |
| 659 | 659 | function auth_autoriser_modifier_pass($auth_methode, $serveur = '') { |
| 660 | - $args = func_get_args(); |
|
| 661 | - return auth_administrer('autoriser_modifier_pass', $args); |
|
| 660 | + $args = func_get_args(); |
|
| 661 | + return auth_administrer('autoriser_modifier_pass', $args); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /** |
@@ -674,8 +674,8 @@ discard block |
||
| 674 | 674 | * message d'erreur ou chaine vide si pas d'erreur |
| 675 | 675 | */ |
| 676 | 676 | function auth_verifier_pass($auth_methode, $login, #[\SensitiveParameter] $new_pass, $id_auteur = 0, $serveur = '') { |
| 677 | - $args = func_get_args(); |
|
| 678 | - return auth_administrer('verifier_pass', $args, ''); |
|
| 677 | + $args = func_get_args(); |
|
| 678 | + return auth_administrer('verifier_pass', $args, ''); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /** |
@@ -691,8 +691,8 @@ discard block |
||
| 691 | 691 | * succes ou echec |
| 692 | 692 | */ |
| 693 | 693 | function auth_modifier_pass($auth_methode, $login, #[\SensitiveParameter] $new_pass, $id_auteur, $serveur = '') { |
| 694 | - $args = func_get_args(); |
|
| 695 | - return auth_administrer('modifier_pass', $args); |
|
| 694 | + $args = func_get_args(); |
|
| 695 | + return auth_administrer('modifier_pass', $args); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /** |
@@ -708,24 +708,24 @@ discard block |
||
| 708 | 708 | * @return void |
| 709 | 709 | */ |
| 710 | 710 | function auth_synchroniser_distant( |
| 711 | - $auth_methode = true, |
|
| 712 | - $id_auteur = 0, |
|
| 713 | - $champs = [], |
|
| 714 | - $options = [], |
|
| 715 | - $serveur = '' |
|
| 711 | + $auth_methode = true, |
|
| 712 | + $id_auteur = 0, |
|
| 713 | + $champs = [], |
|
| 714 | + $options = [], |
|
| 715 | + $serveur = '' |
|
| 716 | 716 | ) { |
| 717 | - $args = func_get_args(); |
|
| 718 | - if ($auth_methode === true or (isset($options['all']) and $options['all'] == true)) { |
|
| 719 | - $options['all'] = true; // ajouter une option all=>true pour chaque auth |
|
| 720 | - $args = [true, $id_auteur, $champs, $options, $serveur]; |
|
| 721 | - foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 722 | - array_shift($args); |
|
| 723 | - array_unshift($args, $methode); |
|
| 724 | - auth_administrer('synchroniser_distant', $args); |
|
| 725 | - } |
|
| 726 | - } else { |
|
| 727 | - auth_administrer('synchroniser_distant', $args); |
|
| 728 | - } |
|
| 717 | + $args = func_get_args(); |
|
| 718 | + if ($auth_methode === true or (isset($options['all']) and $options['all'] == true)) { |
|
| 719 | + $options['all'] = true; // ajouter une option all=>true pour chaque auth |
|
| 720 | + $args = [true, $id_auteur, $champs, $options, $serveur]; |
|
| 721 | + foreach ($GLOBALS['liste_des_authentifications'] as $methode) { |
|
| 722 | + array_shift($args); |
|
| 723 | + array_unshift($args, $methode); |
|
| 724 | + auth_administrer('synchroniser_distant', $args); |
|
| 725 | + } |
|
| 726 | + } else { |
|
| 727 | + auth_administrer('synchroniser_distant', $args); |
|
| 728 | + } |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | |
@@ -738,46 +738,46 @@ discard block |
||
| 738 | 738 | * @return array|bool |
| 739 | 739 | */ |
| 740 | 740 | function lire_php_auth($login, #[\SensitiveParameter] $pw, $serveur = '') { |
| 741 | - if ( |
|
| 742 | - !$login |
|
| 743 | - or !$login_base = auth_retrouver_login($login, $serveur) |
|
| 744 | - ) { |
|
| 745 | - return false; |
|
| 746 | - } |
|
| 747 | - |
|
| 748 | - $row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 749 | - |
|
| 750 | - if (!$row) { |
|
| 751 | - if ( |
|
| 752 | - include_spip('inc/auth') |
|
| 753 | - and auth_ldap_connect($serveur) |
|
| 754 | - and $auth_ldap = charger_fonction('ldap', 'auth', true) |
|
| 755 | - ) { |
|
| 756 | - return $auth_ldap($login_base, $pw, $serveur, true); |
|
| 757 | - } |
|
| 758 | - |
|
| 759 | - return false; |
|
| 760 | - } |
|
| 761 | - |
|
| 762 | - // si pas de source definie |
|
| 763 | - // ou auth/xxx introuvable, utiliser 'spip' ou autre et avec le login passé par PHP_AUTH_USER |
|
| 764 | - if ( |
|
| 765 | - !$auth_methode = $row['source'] |
|
| 766 | - or !$auth = charger_fonction($auth_methode, 'auth', true) |
|
| 767 | - ) { |
|
| 768 | - $auth = charger_fonction('spip', 'auth', true); |
|
| 769 | - } |
|
| 770 | - |
|
| 771 | - $auteur = ''; |
|
| 772 | - if ($auth) { |
|
| 773 | - $auteur = $auth($login, $pw, $serveur, true); |
|
| 774 | - } |
|
| 775 | - // verifier que ce n'est pas un message d'erreur |
|
| 776 | - if (is_array($auteur) and count($auteur)) { |
|
| 777 | - return $auteur; |
|
| 778 | - } |
|
| 779 | - |
|
| 780 | - return false; |
|
| 741 | + if ( |
|
| 742 | + !$login |
|
| 743 | + or !$login_base = auth_retrouver_login($login, $serveur) |
|
| 744 | + ) { |
|
| 745 | + return false; |
|
| 746 | + } |
|
| 747 | + |
|
| 748 | + $row = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login_base, $serveur, 'text'), '', '', '', '', $serveur); |
|
| 749 | + |
|
| 750 | + if (!$row) { |
|
| 751 | + if ( |
|
| 752 | + include_spip('inc/auth') |
|
| 753 | + and auth_ldap_connect($serveur) |
|
| 754 | + and $auth_ldap = charger_fonction('ldap', 'auth', true) |
|
| 755 | + ) { |
|
| 756 | + return $auth_ldap($login_base, $pw, $serveur, true); |
|
| 757 | + } |
|
| 758 | + |
|
| 759 | + return false; |
|
| 760 | + } |
|
| 761 | + |
|
| 762 | + // si pas de source definie |
|
| 763 | + // ou auth/xxx introuvable, utiliser 'spip' ou autre et avec le login passé par PHP_AUTH_USER |
|
| 764 | + if ( |
|
| 765 | + !$auth_methode = $row['source'] |
|
| 766 | + or !$auth = charger_fonction($auth_methode, 'auth', true) |
|
| 767 | + ) { |
|
| 768 | + $auth = charger_fonction('spip', 'auth', true); |
|
| 769 | + } |
|
| 770 | + |
|
| 771 | + $auteur = ''; |
|
| 772 | + if ($auth) { |
|
| 773 | + $auteur = $auth($login, $pw, $serveur, true); |
|
| 774 | + } |
|
| 775 | + // verifier que ce n'est pas un message d'erreur |
|
| 776 | + if (is_array($auteur) and count($auteur)) { |
|
| 777 | + return $auteur; |
|
| 778 | + } |
|
| 779 | + |
|
| 780 | + return false; |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | /** |
@@ -793,21 +793,21 @@ discard block |
||
| 793 | 793 | * @param string $lien |
| 794 | 794 | */ |
| 795 | 795 | function ask_php_auth($pb, $raison, $retour = '', $url = '', $re = '', $lien = '') { |
| 796 | - @Header('WWW-Authenticate: Basic realm="espace prive"'); |
|
| 797 | - @Header('HTTP/1.0 401 Unauthorized'); |
|
| 798 | - $corps = ''; |
|
| 799 | - $public = generer_url_public(); |
|
| 800 | - $ecrire = generer_url_ecrire(); |
|
| 801 | - $retour = $retour ?: _T('icone_retour'); |
|
| 802 | - $corps .= "<p>$raison</p>[<a href='$public'>$retour</a>] "; |
|
| 803 | - if ($url) { |
|
| 804 | - $corps .= "[<a href='" . generer_url_action('cookie', "essai_auth_http=oui&$url") . "'>$re</a>]"; |
|
| 805 | - } |
|
| 806 | - |
|
| 807 | - if ($lien) { |
|
| 808 | - $corps .= " [<a href='$ecrire'>" . _T('login_espace_prive') . '</a>]'; |
|
| 809 | - } |
|
| 810 | - include_spip('inc/minipres'); |
|
| 811 | - echo minipres($pb, $corps); |
|
| 812 | - exit; |
|
| 796 | + @Header('WWW-Authenticate: Basic realm="espace prive"'); |
|
| 797 | + @Header('HTTP/1.0 401 Unauthorized'); |
|
| 798 | + $corps = ''; |
|
| 799 | + $public = generer_url_public(); |
|
| 800 | + $ecrire = generer_url_ecrire(); |
|
| 801 | + $retour = $retour ?: _T('icone_retour'); |
|
| 802 | + $corps .= "<p>$raison</p>[<a href='$public'>$retour</a>] "; |
|
| 803 | + if ($url) { |
|
| 804 | + $corps .= "[<a href='" . generer_url_action('cookie', "essai_auth_http=oui&$url") . "'>$re</a>]"; |
|
| 805 | + } |
|
| 806 | + |
|
| 807 | + if ($lien) { |
|
| 808 | + $corps .= " [<a href='$ecrire'>" . _T('login_espace_prive') . '</a>]'; |
|
| 809 | + } |
|
| 810 | + include_spip('inc/minipres'); |
|
| 811 | + echo minipres($pb, $corps); |
|
| 812 | + exit; |
|
| 813 | 813 | } |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | * @package SPIP\Core\SQL\Upgrade |
| 20 | 20 | **/ |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][2021_02_18_00] = [ |
| 26 | - ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | - ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 26 | + ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | + ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | $GLOBALS['maj'][2022_02_23_02] = [ |
| 31 | - ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL" ], |
|
| 32 | - ['sql_delete', 'spip_meta', "nom='secret_du_site'" ], |
|
| 31 | + ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL" ], |
|
| 32 | + ['sql_delete', 'spip_meta', "nom='secret_du_site'" ], |
|
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | 35 | $GLOBALS['maj'][2022_02_23_03] = [ |
| 36 | - ['maj2021_supprimer_toutes_sessions_si_aucun_backup_cles'], |
|
| 36 | + ['maj2021_supprimer_toutes_sessions_si_aucun_backup_cles'], |
|
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | * - les autres auteurs vont tous regénérer un mot de passe plus sécure au premier login |
| 45 | 45 | **/ |
| 46 | 46 | function maj2021_supprimer_toutes_sessions_si_aucun_backup_cles() { |
| 47 | - if (!sql_countsel('spip_auteurs', "webmestre='oui' AND backup_cles!=''")) { |
|
| 48 | - spip_log('supprimer sessions auteur', 'maj'); |
|
| 49 | - if ($dir = opendir(_DIR_SESSIONS)) { |
|
| 50 | - while (($f = readdir($dir)) !== false) { |
|
| 51 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 52 | - if (time() >= _TIME_OUT) { |
|
| 53 | - return; |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - } |
|
| 47 | + if (!sql_countsel('spip_auteurs', "webmestre='oui' AND backup_cles!=''")) { |
|
| 48 | + spip_log('supprimer sessions auteur', 'maj'); |
|
| 49 | + if ($dir = opendir(_DIR_SESSIONS)) { |
|
| 50 | + while (($f = readdir($dir)) !== false) { |
|
| 51 | + spip_unlink(_DIR_SESSIONS . $f); |
|
| 52 | + if (time() >= _TIME_OUT) { |
|
| 53 | + return; |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][2021_02_18_00] = [ |
| 26 | - ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | - ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 26 | + ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL"], |
|
| 27 | + ['sql_updateq', 'spip_auteurs', ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL"], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | $GLOBALS['maj'][2022_02_23_02] = [ |
| 31 | - ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL" ], |
|
| 32 | - ['sql_delete', 'spip_meta', "nom='secret_du_site'" ], |
|
| 31 | + ['sql_alter', "TABLE spip_auteurs ADD backup_cles mediumtext DEFAULT '' NOT NULL"], |
|
| 32 | + ['sql_delete', 'spip_meta', "nom='secret_du_site'"], |
|
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | 35 | $GLOBALS['maj'][2022_02_23_03] = [ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | spip_log('supprimer sessions auteur', 'maj'); |
| 49 | 49 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 50 | 50 | while (($f = readdir($dir)) !== false) { |
| 51 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 51 | + spip_unlink(_DIR_SESSIONS.$f); |
|
| 52 | 52 | if (time() >= _TIME_OUT) { |
| 53 | 53 | return; |
| 54 | 54 | } |
@@ -154,8 +154,7 @@ |
||
| 154 | 154 | if ($c = base64_decode($base64, true)) { |
| 155 | 155 | $texte = substr_replace($texte, $c, $p, $end + 2 - $p); |
| 156 | 156 | $pos = $p + strlen($c); |
| 157 | - } |
|
| 158 | - else { |
|
| 157 | + } else { |
|
| 159 | 158 | $pos = $end; |
| 160 | 159 | } |
| 161 | 160 | } |
@@ -12,144 +12,144 @@ |
||
| 12 | 12 | namespace Spip\Texte\Collecteur; |
| 13 | 13 | |
| 14 | 14 | abstract class AbstractCollecteur { |
| 15 | - protected static string $markPrefix = 'COLLECT'; |
|
| 16 | - protected string $markId; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Collecteur générique des occurences d'une preg dans un texte avec leurs positions et longueur |
|
| 20 | - * @param string $texte |
|
| 21 | - * texte à analyser pour la collecte |
|
| 22 | - * @param string $if_chars |
|
| 23 | - * caractere(s) à tester avant de tenter la preg |
|
| 24 | - * @param string $start_with |
|
| 25 | - * caractere(s) par lesquels commencent l'expression recherchée (permet de démarrer la preg à la prochaine occurence de cette chaine) |
|
| 26 | - * @param string $preg |
|
| 27 | - * preg utilisée pour la collecte |
|
| 28 | - * @param int $max_items |
|
| 29 | - * pour limiter le nombre de preg collectée (pour la detection simple de présence par exemple) |
|
| 30 | - * @return array |
|
| 31 | - */ |
|
| 32 | - protected static function collecteur(string $texte, string $if_chars, string $start_with, string $preg, int $max_items = 0): array { |
|
| 33 | - |
|
| 34 | - $collection = []; |
|
| 35 | - $pos = 0; |
|
| 36 | - while ( |
|
| 37 | - (!$if_chars || str_contains($texte, $if_chars)) |
|
| 38 | - && ($next = ($start_with ? strpos($texte, $start_with, $pos) : $pos)) !== false |
|
| 39 | - && preg_match($preg, $texte, $r, PREG_OFFSET_CAPTURE, $next) |
|
| 40 | - ) { |
|
| 41 | - $found_pos = $r[0][1]; |
|
| 42 | - $found_length = strlen($r[0][0]); |
|
| 43 | - $match = [ |
|
| 44 | - 'raw' => $r[0][0], |
|
| 45 | - 'match' => array_column($r, 0), |
|
| 46 | - 'pos' => $found_pos, |
|
| 47 | - 'length' => $found_length |
|
| 48 | - ]; |
|
| 49 | - |
|
| 50 | - $collection[] = $match; |
|
| 51 | - |
|
| 52 | - if ($max_items && count($collection) === $max_items) { |
|
| 53 | - break; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - $pos = $match['pos'] + $match['length']; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - return $collection; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Sanitizer une collection d'occurences |
|
| 64 | - */ |
|
| 65 | - protected function sanitizer_collection(array $collection, string $sanitize_callback): array { |
|
| 66 | - foreach ($collection as &$c) { |
|
| 67 | - $c['raw'] = $sanitize_callback($c['raw']); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - return $collection; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @return array |
|
| 75 | - */ |
|
| 76 | - public function collecter(string $texte, array $options = []): array { |
|
| 77 | - return []; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - public function detecter($texte): bool { |
|
| 81 | - if (!empty($this->markId) && str_contains($texte, $this->markId)) { |
|
| 82 | - return true; |
|
| 83 | - } |
|
| 84 | - return !empty($this->collecter($texte, ['detecter_presence' => true])); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Echapper les occurences de la collecte par un texte neutre du point de vue HTML |
|
| 89 | - * |
|
| 90 | - * @see retablir() |
|
| 91 | - * @param string $texte |
|
| 92 | - * @param array $options |
|
| 93 | - * string $sanitize_callback |
|
| 94 | - * @return array |
|
| 95 | - * texte, marqueur utilise pour echapper les modeles |
|
| 96 | - */ |
|
| 97 | - public function echapper(string $texte, array $options = []): string { |
|
| 98 | - if (!function_exists('creer_uniqid')) { |
|
| 99 | - include_spip('inc/acces'); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - $collection = $this->collecter($texte, $options); |
|
| 103 | - if (!empty($options['sanitize_callback']) && is_callable($options['sanitize_callback'])) { |
|
| 104 | - $collection = $this->sanitizer_collection($collection, $options['sanitize_callback']); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - if ($collection !== []) { |
|
| 108 | - if (empty($this->markId)) { |
|
| 109 | - // generer un marqueur qui n'existe pas dans le texte |
|
| 110 | - do { |
|
| 111 | - $this->markId = substr(md5(uniqid(static::class, 1)), 0, 7); |
|
| 112 | - $this->markId = '@|' . static::$markPrefix . $this->markId . '|'; |
|
| 113 | - } while (str_contains($texte, $this->markId)); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $offset_pos = 0; |
|
| 117 | - foreach ($collection as $c) { |
|
| 118 | - $rempl = $this->markId . base64_encode($c['raw']) . '|@'; |
|
| 119 | - $texte = substr_replace($texte, $rempl, $c['pos'] + $offset_pos, $c['length']); |
|
| 120 | - $offset_pos += strlen($rempl) - $c['length']; |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - return $texte; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Retablir les occurences échappées précédemment |
|
| 130 | - * |
|
| 131 | - * @see echapper() |
|
| 132 | - */ |
|
| 133 | - function retablir(string $texte): string { |
|
| 134 | - |
|
| 135 | - if (!empty($this->markId)) { |
|
| 136 | - $lm = strlen($this->markId); |
|
| 137 | - $pos = 0; |
|
| 138 | - while ( |
|
| 139 | - ($p = strpos($texte, $this->markId, $pos)) !== false |
|
| 140 | - && ($end = strpos($texte, '|@', $p + $lm)) |
|
| 141 | - ) { |
|
| 142 | - $base64 = substr($texte, $p + $lm, $end - ($p + $lm)); |
|
| 143 | - if ($c = base64_decode($base64, true)) { |
|
| 144 | - $texte = substr_replace($texte, $c, $p, $end + 2 - $p); |
|
| 145 | - $pos = $p + strlen($c); |
|
| 146 | - } |
|
| 147 | - else { |
|
| 148 | - $pos = $end; |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - return $texte; |
|
| 154 | - } |
|
| 15 | + protected static string $markPrefix = 'COLLECT'; |
|
| 16 | + protected string $markId; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Collecteur générique des occurences d'une preg dans un texte avec leurs positions et longueur |
|
| 20 | + * @param string $texte |
|
| 21 | + * texte à analyser pour la collecte |
|
| 22 | + * @param string $if_chars |
|
| 23 | + * caractere(s) à tester avant de tenter la preg |
|
| 24 | + * @param string $start_with |
|
| 25 | + * caractere(s) par lesquels commencent l'expression recherchée (permet de démarrer la preg à la prochaine occurence de cette chaine) |
|
| 26 | + * @param string $preg |
|
| 27 | + * preg utilisée pour la collecte |
|
| 28 | + * @param int $max_items |
|
| 29 | + * pour limiter le nombre de preg collectée (pour la detection simple de présence par exemple) |
|
| 30 | + * @return array |
|
| 31 | + */ |
|
| 32 | + protected static function collecteur(string $texte, string $if_chars, string $start_with, string $preg, int $max_items = 0): array { |
|
| 33 | + |
|
| 34 | + $collection = []; |
|
| 35 | + $pos = 0; |
|
| 36 | + while ( |
|
| 37 | + (!$if_chars || str_contains($texte, $if_chars)) |
|
| 38 | + && ($next = ($start_with ? strpos($texte, $start_with, $pos) : $pos)) !== false |
|
| 39 | + && preg_match($preg, $texte, $r, PREG_OFFSET_CAPTURE, $next) |
|
| 40 | + ) { |
|
| 41 | + $found_pos = $r[0][1]; |
|
| 42 | + $found_length = strlen($r[0][0]); |
|
| 43 | + $match = [ |
|
| 44 | + 'raw' => $r[0][0], |
|
| 45 | + 'match' => array_column($r, 0), |
|
| 46 | + 'pos' => $found_pos, |
|
| 47 | + 'length' => $found_length |
|
| 48 | + ]; |
|
| 49 | + |
|
| 50 | + $collection[] = $match; |
|
| 51 | + |
|
| 52 | + if ($max_items && count($collection) === $max_items) { |
|
| 53 | + break; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + $pos = $match['pos'] + $match['length']; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + return $collection; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Sanitizer une collection d'occurences |
|
| 64 | + */ |
|
| 65 | + protected function sanitizer_collection(array $collection, string $sanitize_callback): array { |
|
| 66 | + foreach ($collection as &$c) { |
|
| 67 | + $c['raw'] = $sanitize_callback($c['raw']); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + return $collection; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @return array |
|
| 75 | + */ |
|
| 76 | + public function collecter(string $texte, array $options = []): array { |
|
| 77 | + return []; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + public function detecter($texte): bool { |
|
| 81 | + if (!empty($this->markId) && str_contains($texte, $this->markId)) { |
|
| 82 | + return true; |
|
| 83 | + } |
|
| 84 | + return !empty($this->collecter($texte, ['detecter_presence' => true])); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Echapper les occurences de la collecte par un texte neutre du point de vue HTML |
|
| 89 | + * |
|
| 90 | + * @see retablir() |
|
| 91 | + * @param string $texte |
|
| 92 | + * @param array $options |
|
| 93 | + * string $sanitize_callback |
|
| 94 | + * @return array |
|
| 95 | + * texte, marqueur utilise pour echapper les modeles |
|
| 96 | + */ |
|
| 97 | + public function echapper(string $texte, array $options = []): string { |
|
| 98 | + if (!function_exists('creer_uniqid')) { |
|
| 99 | + include_spip('inc/acces'); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + $collection = $this->collecter($texte, $options); |
|
| 103 | + if (!empty($options['sanitize_callback']) && is_callable($options['sanitize_callback'])) { |
|
| 104 | + $collection = $this->sanitizer_collection($collection, $options['sanitize_callback']); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + if ($collection !== []) { |
|
| 108 | + if (empty($this->markId)) { |
|
| 109 | + // generer un marqueur qui n'existe pas dans le texte |
|
| 110 | + do { |
|
| 111 | + $this->markId = substr(md5(uniqid(static::class, 1)), 0, 7); |
|
| 112 | + $this->markId = '@|' . static::$markPrefix . $this->markId . '|'; |
|
| 113 | + } while (str_contains($texte, $this->markId)); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $offset_pos = 0; |
|
| 117 | + foreach ($collection as $c) { |
|
| 118 | + $rempl = $this->markId . base64_encode($c['raw']) . '|@'; |
|
| 119 | + $texte = substr_replace($texte, $rempl, $c['pos'] + $offset_pos, $c['length']); |
|
| 120 | + $offset_pos += strlen($rempl) - $c['length']; |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + return $texte; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Retablir les occurences échappées précédemment |
|
| 130 | + * |
|
| 131 | + * @see echapper() |
|
| 132 | + */ |
|
| 133 | + function retablir(string $texte): string { |
|
| 134 | + |
|
| 135 | + if (!empty($this->markId)) { |
|
| 136 | + $lm = strlen($this->markId); |
|
| 137 | + $pos = 0; |
|
| 138 | + while ( |
|
| 139 | + ($p = strpos($texte, $this->markId, $pos)) !== false |
|
| 140 | + && ($end = strpos($texte, '|@', $p + $lm)) |
|
| 141 | + ) { |
|
| 142 | + $base64 = substr($texte, $p + $lm, $end - ($p + $lm)); |
|
| 143 | + if ($c = base64_decode($base64, true)) { |
|
| 144 | + $texte = substr_replace($texte, $c, $p, $end + 2 - $p); |
|
| 145 | + $pos = $p + strlen($c); |
|
| 146 | + } |
|
| 147 | + else { |
|
| 148 | + $pos = $end; |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + return $texte; |
|
| 154 | + } |
|
| 155 | 155 | } |
@@ -109,13 +109,13 @@ |
||
| 109 | 109 | // generer un marqueur qui n'existe pas dans le texte |
| 110 | 110 | do { |
| 111 | 111 | $this->markId = substr(md5(uniqid(static::class, 1)), 0, 7); |
| 112 | - $this->markId = '@|' . static::$markPrefix . $this->markId . '|'; |
|
| 112 | + $this->markId = '@|'.static::$markPrefix.$this->markId.'|'; |
|
| 113 | 113 | } while (str_contains($texte, $this->markId)); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $offset_pos = 0; |
| 117 | 117 | foreach ($collection as $c) { |
| 118 | - $rempl = $this->markId . base64_encode($c['raw']) . '|@'; |
|
| 118 | + $rempl = $this->markId.base64_encode($c['raw']).'|@'; |
|
| 119 | 119 | $texte = substr_replace($texte, $rempl, $c['pos'] + $offset_pos, $c['length']); |
| 120 | 120 | $offset_pos += strlen($rempl) - $c['length']; |
| 121 | 121 | } |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | $offset_pos = 0; |
| 108 | 108 | foreach ($idiomes as $idiome) { |
| 109 | 109 | |
| 110 | - $cle = ($idiome['module'] ? $idiome['module'] . ':' : '') . $idiome['chaine']; |
|
| 110 | + $cle = ($idiome['module'] ? $idiome['module'].':' : '').$idiome['chaine']; |
|
| 111 | 111 | $desc = $traduire($cle, $lang, true); |
| 112 | 112 | $l = $desc->langue; |
| 113 | 113 | |
@@ -21,109 +21,109 @@ |
||
| 21 | 21 | * Ne pas mettre de span@lang=fr si on est déjà en fr. |
| 22 | 22 | */ |
| 23 | 23 | class Idiomes extends AbstractCollecteur { |
| 24 | - protected static string $markPrefix = 'IDIOME'; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * La preg pour découper et collecter les modèles |
|
| 28 | - * @var string |
|
| 29 | - */ |
|
| 30 | - protected string $preg_idiome; |
|
| 31 | - |
|
| 32 | - public function __construct(?string $preg = null) { |
|
| 33 | - |
|
| 34 | - $this->preg_idiome = ($preg ?: '@<:(?:([a-z0-9_]+):)?([a-z0-9_]+):>@isS'); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * Sanitizer une collection d'occurences d'idiomes : on ne fait rien |
|
| 39 | - * |
|
| 40 | - * @param array $collection |
|
| 41 | - * @param string $sanitize_callback |
|
| 42 | - * @return array |
|
| 43 | - */ |
|
| 44 | - protected function sanitizer_collection(array $collection, string $sanitize_callback): array { |
|
| 45 | - |
|
| 46 | - return $collection; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @param string $texte |
|
| 52 | - * @param array $options |
|
| 53 | - * bool $collecter_liens |
|
| 54 | - * @return array |
|
| 55 | - */ |
|
| 56 | - public function collecter(string $texte, array $options = []): array { |
|
| 57 | - if (!$texte) { |
|
| 58 | - return []; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - // collecter les matchs de la preg |
|
| 62 | - $idiomes = static::collecteur($texte, '', '<:', $this->preg_idiome, empty($options['detecter_presence']) ? 0 : 1); |
|
| 63 | - |
|
| 64 | - // si on veut seulement detecter la présence, on peut retourner tel quel |
|
| 65 | - if (empty($options['detecter_presence'])) { |
|
| 66 | - $pos_prev = 0; |
|
| 67 | - foreach ($idiomes as $k => &$idiome) { |
|
| 68 | - $idiome['module'] = $idiome['match'][1]; |
|
| 69 | - $idiome['chaine'] = $idiome['match'][2]; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - return $idiomes; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Traiter les idiomes d'un texte |
|
| 78 | - * |
|
| 79 | - * @uses inc_traduire_dist() |
|
| 80 | - * @uses code_echappement() |
|
| 81 | - * @uses echappe_retour() |
|
| 82 | - * |
|
| 83 | - * @param string $texte |
|
| 84 | - * @param array $options |
|
| 85 | - * ?string $lang |
|
| 86 | - * ?bool echappe_span |
|
| 87 | - * @return string |
|
| 88 | - */ |
|
| 89 | - public function traiter(string $texte, array $options) { |
|
| 90 | - static $traduire; |
|
| 91 | - if ($texte) { |
|
| 92 | - $idiomes = $this->collecter($texte); |
|
| 93 | - if ($idiomes !== []) { |
|
| 94 | - $lang = $options['lang'] ?? $GLOBALS['spip_lang']; |
|
| 95 | - $echappe_span = $options['echappe_span'] ?? false; |
|
| 96 | - |
|
| 97 | - if (is_null($traduire)) { |
|
| 98 | - $traduire = charger_fonction('traduire', 'inc'); |
|
| 99 | - include_spip('inc/lang'); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - $offset_pos = 0; |
|
| 103 | - foreach ($idiomes as $idiome) { |
|
| 104 | - $cle = ($idiome['module'] ? $idiome['module'] . ':' : '') . $idiome['chaine']; |
|
| 105 | - $desc = $traduire($cle, $lang, true); |
|
| 106 | - $l = $desc->langue; |
|
| 107 | - |
|
| 108 | - // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
|
| 109 | - if (strlen($desc->texte ?? '')) { |
|
| 110 | - $trad = code_echappement($desc->texte, 'idiome', false); |
|
| 111 | - if ($l !== $lang) { |
|
| 112 | - $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
|
| 113 | - } |
|
| 114 | - if (lang_dir($l) !== lang_dir($lang)) { |
|
| 115 | - $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 116 | - } |
|
| 117 | - if (!$echappe_span) { |
|
| 118 | - $trad = echappe_retour($trad, 'idiome'); |
|
| 119 | - } |
|
| 120 | - $texte = substr_replace($texte, $trad, $idiome['pos'] + $offset_pos, $idiome['length']); |
|
| 121 | - $offset_pos += strlen($trad) - $idiome['length']; |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - return $texte; |
|
| 128 | - } |
|
| 24 | + protected static string $markPrefix = 'IDIOME'; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * La preg pour découper et collecter les modèles |
|
| 28 | + * @var string |
|
| 29 | + */ |
|
| 30 | + protected string $preg_idiome; |
|
| 31 | + |
|
| 32 | + public function __construct(?string $preg = null) { |
|
| 33 | + |
|
| 34 | + $this->preg_idiome = ($preg ?: '@<:(?:([a-z0-9_]+):)?([a-z0-9_]+):>@isS'); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * Sanitizer une collection d'occurences d'idiomes : on ne fait rien |
|
| 39 | + * |
|
| 40 | + * @param array $collection |
|
| 41 | + * @param string $sanitize_callback |
|
| 42 | + * @return array |
|
| 43 | + */ |
|
| 44 | + protected function sanitizer_collection(array $collection, string $sanitize_callback): array { |
|
| 45 | + |
|
| 46 | + return $collection; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param string $texte |
|
| 52 | + * @param array $options |
|
| 53 | + * bool $collecter_liens |
|
| 54 | + * @return array |
|
| 55 | + */ |
|
| 56 | + public function collecter(string $texte, array $options = []): array { |
|
| 57 | + if (!$texte) { |
|
| 58 | + return []; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + // collecter les matchs de la preg |
|
| 62 | + $idiomes = static::collecteur($texte, '', '<:', $this->preg_idiome, empty($options['detecter_presence']) ? 0 : 1); |
|
| 63 | + |
|
| 64 | + // si on veut seulement detecter la présence, on peut retourner tel quel |
|
| 65 | + if (empty($options['detecter_presence'])) { |
|
| 66 | + $pos_prev = 0; |
|
| 67 | + foreach ($idiomes as $k => &$idiome) { |
|
| 68 | + $idiome['module'] = $idiome['match'][1]; |
|
| 69 | + $idiome['chaine'] = $idiome['match'][2]; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + return $idiomes; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Traiter les idiomes d'un texte |
|
| 78 | + * |
|
| 79 | + * @uses inc_traduire_dist() |
|
| 80 | + * @uses code_echappement() |
|
| 81 | + * @uses echappe_retour() |
|
| 82 | + * |
|
| 83 | + * @param string $texte |
|
| 84 | + * @param array $options |
|
| 85 | + * ?string $lang |
|
| 86 | + * ?bool echappe_span |
|
| 87 | + * @return string |
|
| 88 | + */ |
|
| 89 | + public function traiter(string $texte, array $options) { |
|
| 90 | + static $traduire; |
|
| 91 | + if ($texte) { |
|
| 92 | + $idiomes = $this->collecter($texte); |
|
| 93 | + if ($idiomes !== []) { |
|
| 94 | + $lang = $options['lang'] ?? $GLOBALS['spip_lang']; |
|
| 95 | + $echappe_span = $options['echappe_span'] ?? false; |
|
| 96 | + |
|
| 97 | + if (is_null($traduire)) { |
|
| 98 | + $traduire = charger_fonction('traduire', 'inc'); |
|
| 99 | + include_spip('inc/lang'); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + $offset_pos = 0; |
|
| 103 | + foreach ($idiomes as $idiome) { |
|
| 104 | + $cle = ($idiome['module'] ? $idiome['module'] . ':' : '') . $idiome['chaine']; |
|
| 105 | + $desc = $traduire($cle, $lang, true); |
|
| 106 | + $l = $desc->langue; |
|
| 107 | + |
|
| 108 | + // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
|
| 109 | + if (strlen($desc->texte ?? '')) { |
|
| 110 | + $trad = code_echappement($desc->texte, 'idiome', false); |
|
| 111 | + if ($l !== $lang) { |
|
| 112 | + $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
|
| 113 | + } |
|
| 114 | + if (lang_dir($l) !== lang_dir($lang)) { |
|
| 115 | + $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 116 | + } |
|
| 117 | + if (!$echappe_span) { |
|
| 118 | + $trad = echappe_retour($trad, 'idiome'); |
|
| 119 | + } |
|
| 120 | + $texte = substr_replace($texte, $trad, $idiome['pos'] + $offset_pos, $idiome['length']); |
|
| 121 | + $offset_pos += strlen($trad) - $idiome['length']; |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + return $texte; |
|
| 128 | + } |
|
| 129 | 129 | } |
@@ -32,11 +32,10 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function __construct(?string $preg = null) { |
| 34 | 34 | |
| 35 | - $this->preg_modele = ($preg ?: |
|
| 36 | - '@<([a-z_-]{3,})' # <modele |
|
| 35 | + $this->preg_modele = ($preg ?: '@<([a-z_-]{3,})' # <modele |
|
| 37 | 36 | . '\s*([0-9]*)\s*' # id |
| 38 | 37 | . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
| 39 | - . '\s*/?' . '>@isS' # fin du modele > |
|
| 38 | + . '\s*/?'.'>@isS' # fin du modele > |
|
| 40 | 39 | ); |
| 41 | 40 | } |
| 42 | 41 | |
@@ -20,203 +20,203 @@ |
||
| 20 | 20 | * mais on renvoie les params (pour l'indexation par le moteur de recherche) |
| 21 | 21 | */ |
| 22 | 22 | class Modeles extends AbstractCollecteur { |
| 23 | - protected static string $markPrefix = 'MODELE'; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * La preg pour découper et collecter les modèles |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - protected string $preg_modele; |
|
| 30 | - |
|
| 31 | - public function __construct(?string $preg = null) { |
|
| 32 | - |
|
| 33 | - $this->preg_modele = ($preg ?: |
|
| 34 | - '@<([a-z_-]{3,})' # <modele |
|
| 35 | - . '\s*([0-9]*)\s*' # id |
|
| 36 | - . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
|
| 37 | - . '\s*/?' . '>@isS' # fin du modele > |
|
| 38 | - ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Sanitizer une collection d'occurences de modèle : on ne fait rien |
|
| 43 | - * |
|
| 44 | - * @param array $collection |
|
| 45 | - * @param string $sanitize_callback |
|
| 46 | - * @return array |
|
| 47 | - */ |
|
| 48 | - protected function sanitizer_collection(array $collection, string $sanitize_callback): array { |
|
| 49 | - |
|
| 50 | - return $collection; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @param string $texte |
|
| 55 | - * @param array $options |
|
| 56 | - * bool $collecter_liens |
|
| 57 | - * @return array |
|
| 58 | - */ |
|
| 59 | - public function collecter(string $texte, array $options = []): array { |
|
| 60 | - if (!$texte) { |
|
| 61 | - return []; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // collecter les matchs de la preg |
|
| 65 | - $modeles = static::collecteur($texte, '', '<', $this->preg_modele); |
|
| 66 | - |
|
| 67 | - $pos_prev = 0; |
|
| 68 | - foreach ($modeles as $k => &$modele) { |
|
| 69 | - $pos = $modele['pos']; |
|
| 70 | - $modele['type'] = $modele['match'][1]; |
|
| 71 | - $modele['id'] = $modele['match'][2] ?? ''; |
|
| 72 | - $modele['params'] = $modele['match'][3] ?? ''; |
|
| 73 | - |
|
| 74 | - $longueur = $modele['length']; |
|
| 75 | - $end = $pos + $longueur; |
|
| 76 | - |
|
| 77 | - // il faut avoir un id ou des params commençant par un | sinon c'est une simple balise html |
|
| 78 | - if (empty($modele['id']) && empty($modele['params'])) { |
|
| 79 | - unset($modeles[$k]); |
|
| 80 | - continue; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - // si on veut seulement detecter la présence, on peut retourner tel quel |
|
| 84 | - if (!empty($options['detecter_presence'])) { |
|
| 85 | - break; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $modele['lien'] = false; |
|
| 89 | - if ( |
|
| 90 | - !empty($options['collecter_liens']) |
|
| 91 | - && ($pos_fermeture_lien = stripos($texte, '</a>', $end)) |
|
| 92 | - && !strlen(trim(substr($texte, $end, $pos_fermeture_lien - $end))) |
|
| 93 | - ) { |
|
| 94 | - $pos_lien_ouvrant = stripos($texte, '<a', $pos_prev); |
|
| 95 | - if ( |
|
| 96 | - $pos_lien_ouvrant !== false |
|
| 97 | - && $pos_lien_ouvrant < $pos |
|
| 98 | - && preg_match('/<a\s[^<>]*>\s*$/i', substr($texte, $pos_prev, $pos - $pos_prev), $r) |
|
| 99 | - ) { |
|
| 100 | - $modele['lien'] = [ |
|
| 101 | - 'href' => extraire_attribut($r[0], 'href'), |
|
| 102 | - 'class' => extraire_attribut($r[0], 'class'), |
|
| 103 | - 'mime' => extraire_attribut($r[0], 'type'), |
|
| 104 | - 'title' => extraire_attribut($r[0], 'title'), |
|
| 105 | - 'hreflang' => extraire_attribut($r[0], 'hreflang') |
|
| 106 | - ]; |
|
| 107 | - $n = strlen($r[0]); |
|
| 108 | - $pos -= $n; |
|
| 109 | - $longueur = $pos_fermeture_lien - $pos + 4; |
|
| 110 | - $end = $pos + $longueur; |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - $modele['pos'] = $pos; |
|
| 116 | - $modele['length'] = $longueur; |
|
| 117 | - $pos_prev = $end; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - return $modeles; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Traiter les modeles d'un texte |
|
| 125 | - * @param string $texte |
|
| 126 | - * @param array $options |
|
| 127 | - * bool|array $doublons |
|
| 128 | - * string $echap |
|
| 129 | - * ?Spip\Texte\CollecteurLiens $collecteurLiens |
|
| 130 | - * ?array $env |
|
| 131 | - * ?string $connect |
|
| 132 | - * @return string |
|
| 133 | - */ |
|
| 134 | - public function traiter(string $texte, array $options) { |
|
| 135 | - if ($texte) { |
|
| 136 | - $doublons = $options['doublons'] ?? false; |
|
| 137 | - $echap = $options['echap'] ?? ''; |
|
| 138 | - $collecteurLiens = $options['collecteurLiens'] ?? null; |
|
| 139 | - $env = $options['env'] ?? []; |
|
| 140 | - $connect = $options['connect'] ?? ''; |
|
| 141 | - |
|
| 142 | - // preserver la compatibilite : true = recherche des documents |
|
| 143 | - if ($doublons === true) { |
|
| 144 | - $doublons = ['documents' => ['doc', 'emb', 'img']]; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - $modeles = $this->collecter($texte, ['collecter_liens' => true]); |
|
| 148 | - if ($modeles !== []) { |
|
| 149 | - include_spip('public/assembler'); |
|
| 150 | - $wrap_embed_html = charger_fonction('wrap_embed_html', 'inc', true); |
|
| 151 | - |
|
| 152 | - $offset_pos = 0; |
|
| 153 | - foreach ($modeles as $m) { |
|
| 154 | - // calculer le modele |
|
| 155 | - # hack indexation |
|
| 156 | - if ($doublons) { |
|
| 157 | - $texte .= preg_replace(',[|][^|=]*,s', ' ', $m['params']); |
|
| 158 | - } # version normale |
|
| 159 | - else { |
|
| 160 | - // si un tableau de liens a ete passe, reinjecter le contenu d'origine |
|
| 161 | - // dans les parametres, plutot que les liens echappes |
|
| 162 | - $params = $m['params']; |
|
| 163 | - if (!is_null($collecteurLiens)) { |
|
| 164 | - $params = $collecteurLiens->retablir($params); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - $modele = inclure_modele($m['type'], $m['id'], $params, $m['lien'], $connect ?? '', $env); |
|
| 168 | - |
|
| 169 | - // en cas d'echec, |
|
| 170 | - // si l'objet demande a une url, |
|
| 171 | - // creer un petit encadre vers elle |
|
| 172 | - if ($modele === false) { |
|
| 173 | - $modele = $m['raw']; |
|
| 174 | - |
|
| 175 | - if (!is_null($collecteurLiens)) { |
|
| 176 | - $modele = $collecteurLiens->retablir($modele); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - $contexte = array_merge($env, ['id' => $m['id'], 'type' => $m['type'], 'modele' => $modele]); |
|
| 180 | - |
|
| 181 | - if (!empty($m['lien'])) { |
|
| 182 | - # un eventuel guillemet (") sera reechappe par #ENV |
|
| 183 | - $contexte['lien'] = str_replace('"', '"', $m['lien']['href']); |
|
| 184 | - $contexte['lien_class'] = $m['lien']['class']; |
|
| 185 | - $contexte['lien_mime'] = $m['lien']['mime']; |
|
| 186 | - $contexte['lien_title'] = $m['lien']['title']; |
|
| 187 | - $contexte['lien_hreflang'] = $m['lien']['hreflang']; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - $modele = recuperer_fond('modeles/dist', $contexte, [], $connect ?? ''); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - // le remplacer dans le texte |
|
| 194 | - if ($modele !== false) { |
|
| 195 | - $modele = protege_js_modeles($modele); |
|
| 196 | - |
|
| 197 | - if ($wrap_embed_html) { |
|
| 198 | - $modele = $wrap_embed_html($m['raw'], $modele); |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - $rempl = code_echappement($modele, $echap); |
|
| 202 | - $texte = substr_replace($texte, $rempl, $m['pos'] + $offset_pos, $m['length']); |
|
| 203 | - $offset_pos += strlen($rempl) - $m['length']; |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - // hack pour tout l'espace prive |
|
| 208 | - if ((test_espace_prive() || $doublons) && !empty($m['id'])) { |
|
| 209 | - $type = strtolower($m['type']); |
|
| 210 | - foreach ($doublons ?: ['documents' => ['doc', 'emb', 'img']] as $quoi => $type_modeles) { |
|
| 211 | - if (in_array($type, $type_modeles)) { |
|
| 212 | - $GLOBALS["doublons_{$quoi}_inclus"][] = $m['id']; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - return $texte; |
|
| 221 | - } |
|
| 23 | + protected static string $markPrefix = 'MODELE'; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * La preg pour découper et collecter les modèles |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + protected string $preg_modele; |
|
| 30 | + |
|
| 31 | + public function __construct(?string $preg = null) { |
|
| 32 | + |
|
| 33 | + $this->preg_modele = ($preg ?: |
|
| 34 | + '@<([a-z_-]{3,})' # <modele |
|
| 35 | + . '\s*([0-9]*)\s*' # id |
|
| 36 | + . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
|
| 37 | + . '\s*/?' . '>@isS' # fin du modele > |
|
| 38 | + ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Sanitizer une collection d'occurences de modèle : on ne fait rien |
|
| 43 | + * |
|
| 44 | + * @param array $collection |
|
| 45 | + * @param string $sanitize_callback |
|
| 46 | + * @return array |
|
| 47 | + */ |
|
| 48 | + protected function sanitizer_collection(array $collection, string $sanitize_callback): array { |
|
| 49 | + |
|
| 50 | + return $collection; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @param string $texte |
|
| 55 | + * @param array $options |
|
| 56 | + * bool $collecter_liens |
|
| 57 | + * @return array |
|
| 58 | + */ |
|
| 59 | + public function collecter(string $texte, array $options = []): array { |
|
| 60 | + if (!$texte) { |
|
| 61 | + return []; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // collecter les matchs de la preg |
|
| 65 | + $modeles = static::collecteur($texte, '', '<', $this->preg_modele); |
|
| 66 | + |
|
| 67 | + $pos_prev = 0; |
|
| 68 | + foreach ($modeles as $k => &$modele) { |
|
| 69 | + $pos = $modele['pos']; |
|
| 70 | + $modele['type'] = $modele['match'][1]; |
|
| 71 | + $modele['id'] = $modele['match'][2] ?? ''; |
|
| 72 | + $modele['params'] = $modele['match'][3] ?? ''; |
|
| 73 | + |
|
| 74 | + $longueur = $modele['length']; |
|
| 75 | + $end = $pos + $longueur; |
|
| 76 | + |
|
| 77 | + // il faut avoir un id ou des params commençant par un | sinon c'est une simple balise html |
|
| 78 | + if (empty($modele['id']) && empty($modele['params'])) { |
|
| 79 | + unset($modeles[$k]); |
|
| 80 | + continue; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + // si on veut seulement detecter la présence, on peut retourner tel quel |
|
| 84 | + if (!empty($options['detecter_presence'])) { |
|
| 85 | + break; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $modele['lien'] = false; |
|
| 89 | + if ( |
|
| 90 | + !empty($options['collecter_liens']) |
|
| 91 | + && ($pos_fermeture_lien = stripos($texte, '</a>', $end)) |
|
| 92 | + && !strlen(trim(substr($texte, $end, $pos_fermeture_lien - $end))) |
|
| 93 | + ) { |
|
| 94 | + $pos_lien_ouvrant = stripos($texte, '<a', $pos_prev); |
|
| 95 | + if ( |
|
| 96 | + $pos_lien_ouvrant !== false |
|
| 97 | + && $pos_lien_ouvrant < $pos |
|
| 98 | + && preg_match('/<a\s[^<>]*>\s*$/i', substr($texte, $pos_prev, $pos - $pos_prev), $r) |
|
| 99 | + ) { |
|
| 100 | + $modele['lien'] = [ |
|
| 101 | + 'href' => extraire_attribut($r[0], 'href'), |
|
| 102 | + 'class' => extraire_attribut($r[0], 'class'), |
|
| 103 | + 'mime' => extraire_attribut($r[0], 'type'), |
|
| 104 | + 'title' => extraire_attribut($r[0], 'title'), |
|
| 105 | + 'hreflang' => extraire_attribut($r[0], 'hreflang') |
|
| 106 | + ]; |
|
| 107 | + $n = strlen($r[0]); |
|
| 108 | + $pos -= $n; |
|
| 109 | + $longueur = $pos_fermeture_lien - $pos + 4; |
|
| 110 | + $end = $pos + $longueur; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + $modele['pos'] = $pos; |
|
| 116 | + $modele['length'] = $longueur; |
|
| 117 | + $pos_prev = $end; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + return $modeles; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Traiter les modeles d'un texte |
|
| 125 | + * @param string $texte |
|
| 126 | + * @param array $options |
|
| 127 | + * bool|array $doublons |
|
| 128 | + * string $echap |
|
| 129 | + * ?Spip\Texte\CollecteurLiens $collecteurLiens |
|
| 130 | + * ?array $env |
|
| 131 | + * ?string $connect |
|
| 132 | + * @return string |
|
| 133 | + */ |
|
| 134 | + public function traiter(string $texte, array $options) { |
|
| 135 | + if ($texte) { |
|
| 136 | + $doublons = $options['doublons'] ?? false; |
|
| 137 | + $echap = $options['echap'] ?? ''; |
|
| 138 | + $collecteurLiens = $options['collecteurLiens'] ?? null; |
|
| 139 | + $env = $options['env'] ?? []; |
|
| 140 | + $connect = $options['connect'] ?? ''; |
|
| 141 | + |
|
| 142 | + // preserver la compatibilite : true = recherche des documents |
|
| 143 | + if ($doublons === true) { |
|
| 144 | + $doublons = ['documents' => ['doc', 'emb', 'img']]; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + $modeles = $this->collecter($texte, ['collecter_liens' => true]); |
|
| 148 | + if ($modeles !== []) { |
|
| 149 | + include_spip('public/assembler'); |
|
| 150 | + $wrap_embed_html = charger_fonction('wrap_embed_html', 'inc', true); |
|
| 151 | + |
|
| 152 | + $offset_pos = 0; |
|
| 153 | + foreach ($modeles as $m) { |
|
| 154 | + // calculer le modele |
|
| 155 | + # hack indexation |
|
| 156 | + if ($doublons) { |
|
| 157 | + $texte .= preg_replace(',[|][^|=]*,s', ' ', $m['params']); |
|
| 158 | + } # version normale |
|
| 159 | + else { |
|
| 160 | + // si un tableau de liens a ete passe, reinjecter le contenu d'origine |
|
| 161 | + // dans les parametres, plutot que les liens echappes |
|
| 162 | + $params = $m['params']; |
|
| 163 | + if (!is_null($collecteurLiens)) { |
|
| 164 | + $params = $collecteurLiens->retablir($params); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + $modele = inclure_modele($m['type'], $m['id'], $params, $m['lien'], $connect ?? '', $env); |
|
| 168 | + |
|
| 169 | + // en cas d'echec, |
|
| 170 | + // si l'objet demande a une url, |
|
| 171 | + // creer un petit encadre vers elle |
|
| 172 | + if ($modele === false) { |
|
| 173 | + $modele = $m['raw']; |
|
| 174 | + |
|
| 175 | + if (!is_null($collecteurLiens)) { |
|
| 176 | + $modele = $collecteurLiens->retablir($modele); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + $contexte = array_merge($env, ['id' => $m['id'], 'type' => $m['type'], 'modele' => $modele]); |
|
| 180 | + |
|
| 181 | + if (!empty($m['lien'])) { |
|
| 182 | + # un eventuel guillemet (") sera reechappe par #ENV |
|
| 183 | + $contexte['lien'] = str_replace('"', '"', $m['lien']['href']); |
|
| 184 | + $contexte['lien_class'] = $m['lien']['class']; |
|
| 185 | + $contexte['lien_mime'] = $m['lien']['mime']; |
|
| 186 | + $contexte['lien_title'] = $m['lien']['title']; |
|
| 187 | + $contexte['lien_hreflang'] = $m['lien']['hreflang']; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + $modele = recuperer_fond('modeles/dist', $contexte, [], $connect ?? ''); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + // le remplacer dans le texte |
|
| 194 | + if ($modele !== false) { |
|
| 195 | + $modele = protege_js_modeles($modele); |
|
| 196 | + |
|
| 197 | + if ($wrap_embed_html) { |
|
| 198 | + $modele = $wrap_embed_html($m['raw'], $modele); |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + $rempl = code_echappement($modele, $echap); |
|
| 202 | + $texte = substr_replace($texte, $rempl, $m['pos'] + $offset_pos, $m['length']); |
|
| 203 | + $offset_pos += strlen($rempl) - $m['length']; |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + // hack pour tout l'espace prive |
|
| 208 | + if ((test_espace_prive() || $doublons) && !empty($m['id'])) { |
|
| 209 | + $type = strtolower($m['type']); |
|
| 210 | + foreach ($doublons ?: ['documents' => ['doc', 'emb', 'img']] as $quoi => $type_modeles) { |
|
| 211 | + if (in_array($type, $type_modeles)) { |
|
| 212 | + $GLOBALS["doublons_{$quoi}_inclus"][] = $m['id']; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + return $texte; |
|
| 221 | + } |
|
| 222 | 222 | } |