@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $id_rubrique, |
| 151 | 151 | [ |
| 152 | 152 | 'data' => $set, |
| 153 | - 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 153 | + 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique').' '._T('info_numero_abbreviation').$id_rubrique] |
|
| 154 | 154 | ], |
| 155 | 155 | $c |
| 156 | 156 | ) |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | ) |
| 255 | 255 | ) { |
| 256 | 256 | if ($s['statut'] != 'prepa') { |
| 257 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 257 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a ".$GLOBALS['visiteur_session']['id_auteur'].' '.$GLOBALS['visiteur_session']['statut']); |
|
| 258 | 258 | } |
| 259 | 259 | } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
| 260 | 260 | $statut_ancien = $s['statut']; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package SPIP\Core\Rubriques\Edition |
| 16 | 16 | */ |
| 17 | 17 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | include_spip('inc/rubriques'); |
@@ -37,34 +37,34 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function action_editer_rubrique_dist($arg = null) { |
| 39 | 39 | |
| 40 | - if (is_null($arg)) { |
|
| 41 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | - $arg = $securiser_action(); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (!$id_rubrique = (int) $arg) { |
|
| 46 | - if ($arg != 'oui') { |
|
| 47 | - include_spip('inc/headers'); |
|
| 48 | - redirige_url_ecrire(); |
|
| 49 | - } |
|
| 50 | - $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $err = rubrique_modifier($id_rubrique); |
|
| 54 | - |
|
| 55 | - if (_request('redirect')) { |
|
| 56 | - $redirect = parametre_url( |
|
| 57 | - urldecode((string) _request('redirect')), |
|
| 58 | - 'id_rubrique', |
|
| 59 | - $id_rubrique, |
|
| 60 | - '&' |
|
| 61 | - ); |
|
| 62 | - |
|
| 63 | - include_spip('inc/headers'); |
|
| 64 | - redirige_par_entete($redirect); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - return [$id_rubrique, $err]; |
|
| 40 | + if (is_null($arg)) { |
|
| 41 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | + $arg = $securiser_action(); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (!$id_rubrique = (int) $arg) { |
|
| 46 | + if ($arg != 'oui') { |
|
| 47 | + include_spip('inc/headers'); |
|
| 48 | + redirige_url_ecrire(); |
|
| 49 | + } |
|
| 50 | + $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $err = rubrique_modifier($id_rubrique); |
|
| 54 | + |
|
| 55 | + if (_request('redirect')) { |
|
| 56 | + $redirect = parametre_url( |
|
| 57 | + urldecode((string) _request('redirect')), |
|
| 58 | + 'id_rubrique', |
|
| 59 | + $id_rubrique, |
|
| 60 | + '&' |
|
| 61 | + ); |
|
| 62 | + |
|
| 63 | + include_spip('inc/headers'); |
|
| 64 | + redirige_par_entete($redirect); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + return [$id_rubrique, $err]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -79,64 +79,64 @@ discard block |
||
| 79 | 79 | * Identifiant de la rubrique crée |
| 80 | 80 | */ |
| 81 | 81 | function rubrique_inserer($id_parent, $set = null) { |
| 82 | - $champs = [ |
|
| 83 | - 'titre' => _T('item_nouvelle_rubrique'), |
|
| 84 | - 'id_parent' => (int) $id_parent, |
|
| 85 | - 'statut' => 'prepa' |
|
| 86 | - ]; |
|
| 87 | - |
|
| 88 | - if ($set) { |
|
| 89 | - $champs = array_merge($champs, $set); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - // Envoyer aux plugins |
|
| 93 | - $champs = pipeline( |
|
| 94 | - 'pre_insertion', |
|
| 95 | - [ |
|
| 96 | - 'args' => [ |
|
| 97 | - 'table' => 'spip_rubriques', |
|
| 98 | - ], |
|
| 99 | - 'data' => $champs |
|
| 100 | - ] |
|
| 101 | - ); |
|
| 102 | - |
|
| 103 | - $id_rubrique = sql_insertq('spip_rubriques', $champs); |
|
| 104 | - pipeline( |
|
| 105 | - 'post_insertion', |
|
| 106 | - [ |
|
| 107 | - 'args' => [ |
|
| 108 | - 'table' => 'spip_rubriques', |
|
| 109 | - 'id_objet' => $id_rubrique |
|
| 110 | - ], |
|
| 111 | - 'data' => $champs |
|
| 112 | - ] |
|
| 113 | - ); |
|
| 114 | - propager_les_secteurs(); |
|
| 115 | - calculer_langues_rubriques(); |
|
| 116 | - |
|
| 117 | - // Appeler une notification |
|
| 118 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 119 | - $notifications( |
|
| 120 | - 'rubrique_inserer', |
|
| 121 | - $id_rubrique, |
|
| 122 | - [ |
|
| 123 | - 'id_parent' => $id_parent, |
|
| 124 | - 'champs' => $champs, |
|
| 125 | - ] |
|
| 126 | - ); |
|
| 127 | - $notifications( |
|
| 128 | - 'objet_inserer', |
|
| 129 | - $id_rubrique, |
|
| 130 | - [ |
|
| 131 | - 'objet' => 'rubrique', |
|
| 132 | - 'id_objet' => $id_rubrique, |
|
| 133 | - 'id_parent' => $id_parent, |
|
| 134 | - 'champs' => $champs, |
|
| 135 | - ] |
|
| 136 | - ); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - return $id_rubrique; |
|
| 82 | + $champs = [ |
|
| 83 | + 'titre' => _T('item_nouvelle_rubrique'), |
|
| 84 | + 'id_parent' => (int) $id_parent, |
|
| 85 | + 'statut' => 'prepa' |
|
| 86 | + ]; |
|
| 87 | + |
|
| 88 | + if ($set) { |
|
| 89 | + $champs = array_merge($champs, $set); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + // Envoyer aux plugins |
|
| 93 | + $champs = pipeline( |
|
| 94 | + 'pre_insertion', |
|
| 95 | + [ |
|
| 96 | + 'args' => [ |
|
| 97 | + 'table' => 'spip_rubriques', |
|
| 98 | + ], |
|
| 99 | + 'data' => $champs |
|
| 100 | + ] |
|
| 101 | + ); |
|
| 102 | + |
|
| 103 | + $id_rubrique = sql_insertq('spip_rubriques', $champs); |
|
| 104 | + pipeline( |
|
| 105 | + 'post_insertion', |
|
| 106 | + [ |
|
| 107 | + 'args' => [ |
|
| 108 | + 'table' => 'spip_rubriques', |
|
| 109 | + 'id_objet' => $id_rubrique |
|
| 110 | + ], |
|
| 111 | + 'data' => $champs |
|
| 112 | + ] |
|
| 113 | + ); |
|
| 114 | + propager_les_secteurs(); |
|
| 115 | + calculer_langues_rubriques(); |
|
| 116 | + |
|
| 117 | + // Appeler une notification |
|
| 118 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 119 | + $notifications( |
|
| 120 | + 'rubrique_inserer', |
|
| 121 | + $id_rubrique, |
|
| 122 | + [ |
|
| 123 | + 'id_parent' => $id_parent, |
|
| 124 | + 'champs' => $champs, |
|
| 125 | + ] |
|
| 126 | + ); |
|
| 127 | + $notifications( |
|
| 128 | + 'objet_inserer', |
|
| 129 | + $id_rubrique, |
|
| 130 | + [ |
|
| 131 | + 'objet' => 'rubrique', |
|
| 132 | + 'id_objet' => $id_rubrique, |
|
| 133 | + 'id_parent' => $id_parent, |
|
| 134 | + 'champs' => $champs, |
|
| 135 | + ] |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + return $id_rubrique; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -152,46 +152,46 @@ discard block |
||
| 152 | 152 | * - chaîne : texte d'un message d'erreur |
| 153 | 153 | */ |
| 154 | 154 | function rubrique_modifier($id_rubrique, $set = null) { |
| 155 | - include_spip('inc/autoriser'); |
|
| 156 | - include_spip('inc/filtres'); |
|
| 157 | - |
|
| 158 | - include_spip('inc/modifier'); |
|
| 159 | - $c = collecter_requests( |
|
| 160 | - // include list |
|
| 161 | - objet_info('rubrique', 'champs_editables'), |
|
| 162 | - // exclude list |
|
| 163 | - ['id_parent', 'confirme_deplace'], |
|
| 164 | - // donnees eventuellement fournies |
|
| 165 | - $set |
|
| 166 | - ); |
|
| 167 | - |
|
| 168 | - if ( |
|
| 169 | - $err = objet_modifier_champs( |
|
| 170 | - 'rubrique', |
|
| 171 | - $id_rubrique, |
|
| 172 | - [ |
|
| 173 | - 'data' => $set, |
|
| 174 | - 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 175 | - ], |
|
| 176 | - $c |
|
| 177 | - ) |
|
| 178 | - ) { |
|
| 179 | - return $err; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set); |
|
| 183 | - // Deplacer la rubrique |
|
| 184 | - if (isset($c['id_parent'])) { |
|
| 185 | - $err = rubrique_instituer($id_rubrique, $c); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - // invalider les caches marques de cette rubrique |
|
| 189 | - include_spip('inc/invalideur'); |
|
| 190 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 191 | - // et celui de menu_rubriques |
|
| 192 | - effacer_meta('date_calcul_rubriques'); |
|
| 193 | - |
|
| 194 | - return $err; |
|
| 155 | + include_spip('inc/autoriser'); |
|
| 156 | + include_spip('inc/filtres'); |
|
| 157 | + |
|
| 158 | + include_spip('inc/modifier'); |
|
| 159 | + $c = collecter_requests( |
|
| 160 | + // include list |
|
| 161 | + objet_info('rubrique', 'champs_editables'), |
|
| 162 | + // exclude list |
|
| 163 | + ['id_parent', 'confirme_deplace'], |
|
| 164 | + // donnees eventuellement fournies |
|
| 165 | + $set |
|
| 166 | + ); |
|
| 167 | + |
|
| 168 | + if ( |
|
| 169 | + $err = objet_modifier_champs( |
|
| 170 | + 'rubrique', |
|
| 171 | + $id_rubrique, |
|
| 172 | + [ |
|
| 173 | + 'data' => $set, |
|
| 174 | + 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 175 | + ], |
|
| 176 | + $c |
|
| 177 | + ) |
|
| 178 | + ) { |
|
| 179 | + return $err; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set); |
|
| 183 | + // Deplacer la rubrique |
|
| 184 | + if (isset($c['id_parent'])) { |
|
| 185 | + $err = rubrique_instituer($id_rubrique, $c); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + // invalider les caches marques de cette rubrique |
|
| 189 | + include_spip('inc/invalideur'); |
|
| 190 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 191 | + // et celui de menu_rubriques |
|
| 192 | + effacer_meta('date_calcul_rubriques'); |
|
| 193 | + |
|
| 194 | + return $err; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -214,29 +214,29 @@ discard block |
||
| 214 | 214 | * false si la confirmation du déplacement n'est pas présente |
| 215 | 215 | */ |
| 216 | 216 | function editer_rubrique_breves($id_rubrique, $id_parent, $c = []) { |
| 217 | - if (!sql_table_exists('spip_breves')) { |
|
| 218 | - return true; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 222 | - return true; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') { |
|
| 226 | - return false; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - if ( |
|
| 230 | - $id_secteur = sql_getfetsel( |
|
| 231 | - 'id_secteur', |
|
| 232 | - 'spip_rubriques', |
|
| 233 | - "id_rubrique=$id_parent" |
|
| 234 | - ) |
|
| 235 | - ) { |
|
| 236 | - sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique"); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - return true; |
|
| 217 | + if (!sql_table_exists('spip_breves')) { |
|
| 218 | + return true; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 222 | + return true; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') { |
|
| 226 | + return false; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + if ( |
|
| 230 | + $id_secteur = sql_getfetsel( |
|
| 231 | + 'id_secteur', |
|
| 232 | + 'spip_rubriques', |
|
| 233 | + "id_rubrique=$id_parent" |
|
| 234 | + ) |
|
| 235 | + ) { |
|
| 236 | + sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique"); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + return true; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -258,72 +258,72 @@ discard block |
||
| 258 | 258 | * Chaîne : texte du message d'erreur |
| 259 | 259 | */ |
| 260 | 260 | function rubrique_instituer($id_rubrique, $c) { |
| 261 | - // traitement de la rubrique parente |
|
| 262 | - // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 263 | - // qu'on n'administre pas. |
|
| 264 | - |
|
| 265 | - if (null !== ($id_parent = $c['id_parent'])) { |
|
| 266 | - $id_parent = (int) $id_parent; |
|
| 267 | - $filles = calcul_branche_in($id_rubrique); |
|
| 268 | - if (str_contains(",$id_parent,", (string) ",$filles,")) { |
|
| 269 | - spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 270 | - } else { |
|
| 271 | - $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 272 | - $old_parent = $s['id_parent']; |
|
| 273 | - |
|
| 274 | - if ( |
|
| 275 | - !($id_parent != $old_parent |
|
| 276 | - && autoriser('publierdans', 'rubrique', $id_parent) |
|
| 277 | - && autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 278 | - && autoriser('publierdans', 'rubrique', $old_parent) |
|
| 279 | - ) |
|
| 280 | - ) { |
|
| 281 | - if ($s['statut'] != 'prepa') { |
|
| 282 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 283 | - } |
|
| 284 | - } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 285 | - $statut_ancien = $s['statut']; |
|
| 286 | - sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique"); |
|
| 287 | - |
|
| 288 | - |
|
| 289 | - propager_les_secteurs(); |
|
| 290 | - |
|
| 291 | - // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 292 | - if ($statut_ancien == 'publie') { |
|
| 293 | - calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]); |
|
| 294 | - } |
|
| 295 | - // Creation ou deplacement d'une rubrique non publiee |
|
| 296 | - // invalider le cache de leur menu |
|
| 297 | - elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 298 | - effacer_meta('date_calcul_rubriques'); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - calculer_langues_rubriques(); |
|
| 302 | - |
|
| 303 | - // Appeler une notification |
|
| 304 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 305 | - $notifications( |
|
| 306 | - 'rubrique_instituer', |
|
| 307 | - $id_rubrique, |
|
| 308 | - [ |
|
| 309 | - 'statut_ancien' => $statut_ancien, |
|
| 310 | - 'id_parent_ancien' => $old_parent, |
|
| 311 | - ] |
|
| 312 | - ); |
|
| 313 | - $notifications( |
|
| 314 | - 'objet_instituer', |
|
| 315 | - $id_rubrique, |
|
| 316 | - [ |
|
| 317 | - 'objet' => 'rubrique', |
|
| 318 | - 'id_objet' => $id_rubrique, |
|
| 319 | - 'statut_ancien' => $statut_ancien, |
|
| 320 | - 'id_parent_ancien' => $old_parent, |
|
| 321 | - ] |
|
| 322 | - ); |
|
| 323 | - } |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - return ''; // pas d'erreur |
|
| 261 | + // traitement de la rubrique parente |
|
| 262 | + // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 263 | + // qu'on n'administre pas. |
|
| 264 | + |
|
| 265 | + if (null !== ($id_parent = $c['id_parent'])) { |
|
| 266 | + $id_parent = (int) $id_parent; |
|
| 267 | + $filles = calcul_branche_in($id_rubrique); |
|
| 268 | + if (str_contains(",$id_parent,", (string) ",$filles,")) { |
|
| 269 | + spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 270 | + } else { |
|
| 271 | + $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 272 | + $old_parent = $s['id_parent']; |
|
| 273 | + |
|
| 274 | + if ( |
|
| 275 | + !($id_parent != $old_parent |
|
| 276 | + && autoriser('publierdans', 'rubrique', $id_parent) |
|
| 277 | + && autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 278 | + && autoriser('publierdans', 'rubrique', $old_parent) |
|
| 279 | + ) |
|
| 280 | + ) { |
|
| 281 | + if ($s['statut'] != 'prepa') { |
|
| 282 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 283 | + } |
|
| 284 | + } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 285 | + $statut_ancien = $s['statut']; |
|
| 286 | + sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique"); |
|
| 287 | + |
|
| 288 | + |
|
| 289 | + propager_les_secteurs(); |
|
| 290 | + |
|
| 291 | + // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 292 | + if ($statut_ancien == 'publie') { |
|
| 293 | + calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]); |
|
| 294 | + } |
|
| 295 | + // Creation ou deplacement d'une rubrique non publiee |
|
| 296 | + // invalider le cache de leur menu |
|
| 297 | + elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 298 | + effacer_meta('date_calcul_rubriques'); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + calculer_langues_rubriques(); |
|
| 302 | + |
|
| 303 | + // Appeler une notification |
|
| 304 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 305 | + $notifications( |
|
| 306 | + 'rubrique_instituer', |
|
| 307 | + $id_rubrique, |
|
| 308 | + [ |
|
| 309 | + 'statut_ancien' => $statut_ancien, |
|
| 310 | + 'id_parent_ancien' => $old_parent, |
|
| 311 | + ] |
|
| 312 | + ); |
|
| 313 | + $notifications( |
|
| 314 | + 'objet_instituer', |
|
| 315 | + $id_rubrique, |
|
| 316 | + [ |
|
| 317 | + 'objet' => 'rubrique', |
|
| 318 | + 'id_objet' => $id_rubrique, |
|
| 319 | + 'statut_ancien' => $statut_ancien, |
|
| 320 | + 'id_parent_ancien' => $old_parent, |
|
| 321 | + ] |
|
| 322 | + ); |
|
| 323 | + } |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + return ''; // pas d'erreur |
|
| 329 | 329 | } |
@@ -312,8 +312,7 @@ |
||
| 312 | 312 | ecrire_meta($casier, $serialized_store, null, $table); |
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | - } |
|
| 316 | - else { |
|
| 315 | + } else { |
|
| 317 | 316 | ecrire_meta($casier, $store, null, $table); |
| 318 | 317 | } |
| 319 | 318 | } |
@@ -303,9 +303,9 @@ |
||
| 303 | 303 | // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine |
| 304 | 304 | // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4) |
| 305 | 305 | if ($has_planes) { |
| 306 | - $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier)); |
|
| 306 | + $check_store = sql_getfetsel('valeur', 'spip_'.$table, 'nom='.sql_quote($casier)); |
|
| 307 | 307 | if ($check_store !== $serialized_store) { |
| 308 | - array_walk_recursive($store, function (&$value, $key) { |
|
| 308 | + array_walk_recursive($store, function(&$value, $key) { |
|
| 309 | 309 | if (is_string($value)) { |
| 310 | 310 | $value = utf8_noplanes($value); |
| 311 | 311 | } |
@@ -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 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | 29 | function inc_config_dist() { |
| 30 | - actualise_metas(liste_metas()); |
|
| 30 | + actualise_metas(liste_metas()); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -44,32 +44,32 @@ discard block |
||
| 44 | 44 | * Liste (table, casier, sous_casier) |
| 45 | 45 | */ |
| 46 | 46 | function expliquer_config($cfg) { |
| 47 | - // par defaut, sur la table des meta |
|
| 48 | - $table = 'meta'; |
|
| 49 | - $casier = null; |
|
| 50 | - $sous_casier = []; |
|
| 51 | - $cfg = explode('/', $cfg); |
|
| 52 | - |
|
| 53 | - // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide '' |
|
| 54 | - if (!reset($cfg) && count($cfg) > 1) { |
|
| 55 | - array_shift($cfg); |
|
| 56 | - $table = array_shift($cfg); |
|
| 57 | - if (!isset($GLOBALS[$table])) { |
|
| 58 | - lire_metas($table); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // si on a demande #CONFIG{/meta,'',0} |
|
| 63 | - // pas sur un appel vide '' |
|
| 64 | - if (count($cfg) && '' !== ($c = array_shift($cfg))) { |
|
| 65 | - $casier = $c; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - if ($cfg !== []) { |
|
| 69 | - $sous_casier = $cfg; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - return [$table, $casier, $sous_casier]; |
|
| 47 | + // par defaut, sur la table des meta |
|
| 48 | + $table = 'meta'; |
|
| 49 | + $casier = null; |
|
| 50 | + $sous_casier = []; |
|
| 51 | + $cfg = explode('/', $cfg); |
|
| 52 | + |
|
| 53 | + // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide '' |
|
| 54 | + if (!reset($cfg) && count($cfg) > 1) { |
|
| 55 | + array_shift($cfg); |
|
| 56 | + $table = array_shift($cfg); |
|
| 57 | + if (!isset($GLOBALS[$table])) { |
|
| 58 | + lire_metas($table); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // si on a demande #CONFIG{/meta,'',0} |
|
| 63 | + // pas sur un appel vide '' |
|
| 64 | + if (count($cfg) && '' !== ($c = array_shift($cfg))) { |
|
| 65 | + $casier = $c; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + if ($cfg !== []) { |
|
| 69 | + $sous_casier = $cfg; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + return [$table, $casier, $sous_casier]; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -97,63 +97,63 @@ discard block |
||
| 97 | 97 | * Contenu de la configuration obtenue |
| 98 | 98 | */ |
| 99 | 99 | function lire_config($cfg = '', mixed $def = null, $unserialize = true) { |
| 100 | - // lire le stockage sous la forme /table/valeur |
|
| 101 | - // ou valeur qui est en fait implicitement /meta/valeur |
|
| 102 | - // ou casier/valeur qui est en fait implicitement /meta/casier/valeur |
|
| 103 | - |
|
| 104 | - // traiter en priorite le cas simple et frequent |
|
| 105 | - // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni : |
|
| 106 | - if ($cfg && strpbrk($cfg, '/:') === false) { |
|
| 107 | - return isset($GLOBALS['meta'][$cfg]) |
|
| 108 | - ? (!$unserialize |
|
| 109 | - // ne pas essayer de deserialiser autre chose qu'une chaine |
|
| 110 | - || !is_string($GLOBALS['meta'][$cfg]) |
|
| 111 | - // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee |
|
| 112 | - || !str_contains($GLOBALS['meta'][$cfg], ':') |
|
| 113 | - || ($t = @unserialize($GLOBALS['meta'][$cfg])) === false ? $GLOBALS['meta'][$cfg] : $t) |
|
| 114 | - : $def; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // Brancher sur methodes externes si besoin |
|
| 118 | - if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 119 | - $methode = substr($cfg, 0, $p); |
|
| 120 | - $lire_config = charger_fonction($methode, 'lire_config'); |
|
| 121 | - |
|
| 122 | - return $lire_config(substr($cfg, $p + 2), $def, $unserialize); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 126 | - |
|
| 127 | - if (!isset($GLOBALS[$table])) { |
|
| 128 | - return $def; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $r = $GLOBALS[$table]; |
|
| 132 | - |
|
| 133 | - // si on a demande #CONFIG{/meta,'',0} |
|
| 134 | - if (!$casier) { |
|
| 135 | - return $unserialize ? $r : serialize($r); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - // casier principal : |
|
| 139 | - // le deserializer si demande |
|
| 140 | - // ou si on a besoin |
|
| 141 | - // d'un sous casier |
|
| 142 | - $r = $r[$casier] ?? null; |
|
| 143 | - if (($unserialize || (is_countable($sous_casier) ? count($sous_casier) : 0)) && $r && is_string($r)) { |
|
| 144 | - $r = (($t = @unserialize($r)) === false ? $r : $t); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // aller chercher le sous_casier |
|
| 148 | - while (!is_null($r) && ($casier = array_shift($sous_casier))) { |
|
| 149 | - $r = $r[$casier] ?? null; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if (is_null($r)) { |
|
| 153 | - return $def; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - return $r; |
|
| 100 | + // lire le stockage sous la forme /table/valeur |
|
| 101 | + // ou valeur qui est en fait implicitement /meta/valeur |
|
| 102 | + // ou casier/valeur qui est en fait implicitement /meta/casier/valeur |
|
| 103 | + |
|
| 104 | + // traiter en priorite le cas simple et frequent |
|
| 105 | + // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni : |
|
| 106 | + if ($cfg && strpbrk($cfg, '/:') === false) { |
|
| 107 | + return isset($GLOBALS['meta'][$cfg]) |
|
| 108 | + ? (!$unserialize |
|
| 109 | + // ne pas essayer de deserialiser autre chose qu'une chaine |
|
| 110 | + || !is_string($GLOBALS['meta'][$cfg]) |
|
| 111 | + // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee |
|
| 112 | + || !str_contains($GLOBALS['meta'][$cfg], ':') |
|
| 113 | + || ($t = @unserialize($GLOBALS['meta'][$cfg])) === false ? $GLOBALS['meta'][$cfg] : $t) |
|
| 114 | + : $def; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // Brancher sur methodes externes si besoin |
|
| 118 | + if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 119 | + $methode = substr($cfg, 0, $p); |
|
| 120 | + $lire_config = charger_fonction($methode, 'lire_config'); |
|
| 121 | + |
|
| 122 | + return $lire_config(substr($cfg, $p + 2), $def, $unserialize); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 126 | + |
|
| 127 | + if (!isset($GLOBALS[$table])) { |
|
| 128 | + return $def; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $r = $GLOBALS[$table]; |
|
| 132 | + |
|
| 133 | + // si on a demande #CONFIG{/meta,'',0} |
|
| 134 | + if (!$casier) { |
|
| 135 | + return $unserialize ? $r : serialize($r); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + // casier principal : |
|
| 139 | + // le deserializer si demande |
|
| 140 | + // ou si on a besoin |
|
| 141 | + // d'un sous casier |
|
| 142 | + $r = $r[$casier] ?? null; |
|
| 143 | + if (($unserialize || (is_countable($sous_casier) ? count($sous_casier) : 0)) && $r && is_string($r)) { |
|
| 144 | + $r = (($t = @unserialize($r)) === false ? $r : $t); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // aller chercher le sous_casier |
|
| 148 | + while (!is_null($r) && ($casier = array_shift($sous_casier))) { |
|
| 149 | + $r = $r[$casier] ?? null; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if (is_null($r)) { |
|
| 153 | + return $def; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + return $r; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return mixed |
| 167 | 167 | */ |
| 168 | 168 | function lire_config_metapack_dist($cfg = '', mixed $def = null, $unserialize = true) { |
| 169 | - return lire_config($cfg, $def, $unserialize); |
|
| 169 | + return lire_config($cfg, $def, $unserialize); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
@@ -177,144 +177,144 @@ discard block |
||
| 177 | 177 | * @return bool |
| 178 | 178 | */ |
| 179 | 179 | function ecrire_config($cfg, mixed $store) { |
| 180 | - // Brancher sur methodes externes si besoin |
|
| 181 | - if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 182 | - $methode = substr($cfg, 0, $p); |
|
| 183 | - $ecrire_config = charger_fonction($methode, 'ecrire_config'); |
|
| 184 | - |
|
| 185 | - return $ecrire_config(substr($cfg, $p + 2), $store); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 189 | - // il faut au moins un casier pour ecrire |
|
| 190 | - if (!$casier) { |
|
| 191 | - return false; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - // trouvons ou creons le pointeur sur le casier |
|
| 195 | - $st = $GLOBALS[$table][$casier] ?? null; |
|
| 196 | - if (!is_array($st) && ($sous_casier || is_array($store))) { |
|
| 197 | - if ($st === null) { |
|
| 198 | - // ne rien creer si c'est une demande d'effacement |
|
| 199 | - if ($store === null) { |
|
| 200 | - return false; |
|
| 201 | - } |
|
| 202 | - $st = []; |
|
| 203 | - } else { |
|
| 204 | - $st = unserialize($st); |
|
| 205 | - if ($st === false) { |
|
| 206 | - // ne rien creer si c'est une demande d'effacement |
|
| 207 | - if ($store === null) { |
|
| 208 | - return false; |
|
| 209 | - } |
|
| 210 | - $st = []; |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $has_planes = false; |
|
| 216 | - // si on a affaire a un sous caiser |
|
| 217 | - // il faut ecrire au bon endroit sans perdre les autres sous casier freres |
|
| 218 | - if ($c = $sous_casier) { |
|
| 219 | - $sc = &$st; |
|
| 220 | - $pointeurs = []; |
|
| 221 | - while ((is_countable($c) ? count($c) : 0) && ($cc = array_shift($c))) { |
|
| 222 | - // creer l'entree si elle n'existe pas |
|
| 223 | - if (!isset($sc[$cc])) { |
|
| 224 | - // si on essaye d'effacer une config qui n'existe pas |
|
| 225 | - // ne rien creer mais sortir |
|
| 226 | - if (is_null($store)) { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - $sc[$cc] = []; |
|
| 230 | - } |
|
| 231 | - $pointeurs[$cc] = &$sc; |
|
| 232 | - $sc = &$sc[$cc]; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // si c'est une demande d'effacement |
|
| 236 | - if (is_null($store)) { |
|
| 237 | - $c = $sous_casier; |
|
| 238 | - $sous = array_pop($c); |
|
| 239 | - // effacer, et remonter pour effacer les parents vides |
|
| 240 | - do { |
|
| 241 | - unset($pointeurs[$sous][$sous]); |
|
| 242 | - } while (($sous = array_pop($c)) && !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0)); |
|
| 243 | - |
|
| 244 | - // si on a vide tous les sous casiers, |
|
| 245 | - // et que le casier est vide |
|
| 246 | - // vider aussi la meta |
|
| 247 | - if (!$sous && !(is_countable($st) ? count($st) : 0)) { |
|
| 248 | - $st = null; |
|
| 249 | - } |
|
| 250 | - } // dans tous les autres cas, on ecrase |
|
| 251 | - else { |
|
| 252 | - if ( |
|
| 253 | - defined('_MYSQL_NOPLANES') |
|
| 254 | - && _MYSQL_NOPLANES |
|
| 255 | - && !empty($GLOBALS['meta']['charset_sql_connexion']) |
|
| 256 | - && $GLOBALS['meta']['charset_sql_connexion'] == 'utf8' |
|
| 257 | - ) { |
|
| 258 | - // detecter si la valeur qu'on veut ecrire a des planes |
|
| 259 | - // @see utf8_noplanes |
|
| 260 | - $serialized_store = (is_string($store) ? $store : serialize($store)); |
|
| 261 | - // un preg_match rapide pour voir si ca vaut le coup de lancer utf8_noplanes |
|
| 262 | - if (preg_match(',[\xF0-\xF4],ms', $serialized_store)) { |
|
| 263 | - if (!function_exists('utf8_noplanes')) { |
|
| 264 | - include_spip('inc/charsets'); |
|
| 265 | - } |
|
| 266 | - if ($serialized_store !== utf8_noplanes($serialized_store)) { |
|
| 267 | - $has_planes = true; |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - $sc = $store; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - // Maintenant que $st est modifiee |
|
| 276 | - // reprenons la comme valeur a stocker dans le casier principal |
|
| 277 | - $store = $st; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - if (is_null($store)) { |
|
| 281 | - if (is_null($st) && !$sous_casier) { |
|
| 282 | - return false; |
|
| 283 | - } // la config n'existait deja pas ! |
|
| 284 | - effacer_meta($casier, $table); |
|
| 285 | - supprimer_table_meta($table); // supprimons la table (si elle est bien vide) |
|
| 286 | - } // les meta ne peuvent etre que des chaines : il faut serializer le reste |
|
| 287 | - else { |
|
| 288 | - if (!isset($GLOBALS[$table])) { |
|
| 289 | - installer_table_meta($table); |
|
| 290 | - } |
|
| 291 | - // si ce n'est pas une chaine |
|
| 292 | - // il faut serializer |
|
| 293 | - if (!is_string($store)) { |
|
| 294 | - $serialized_store = serialize($store); |
|
| 295 | - ecrire_meta($casier, $serialized_store, null, $table); |
|
| 296 | - // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine |
|
| 297 | - // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4) |
|
| 298 | - if ($has_planes) { |
|
| 299 | - $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier)); |
|
| 300 | - if ($check_store !== $serialized_store) { |
|
| 301 | - array_walk_recursive($store, function (&$value, $key) { |
|
| 302 | - if (is_string($value)) { |
|
| 303 | - $value = utf8_noplanes($value); |
|
| 304 | - } |
|
| 305 | - }); |
|
| 306 | - $serialized_store = serialize($store); |
|
| 307 | - ecrire_meta($casier, $serialized_store, null, $table); |
|
| 308 | - } |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - else { |
|
| 312 | - ecrire_meta($casier, $store, null, $table); |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - // verifier que lire_config($cfg)==$store ? |
|
| 317 | - return true; |
|
| 180 | + // Brancher sur methodes externes si besoin |
|
| 181 | + if ($cfg && ($p = strpos($cfg, '::'))) { |
|
| 182 | + $methode = substr($cfg, 0, $p); |
|
| 183 | + $ecrire_config = charger_fonction($methode, 'ecrire_config'); |
|
| 184 | + |
|
| 185 | + return $ecrire_config(substr($cfg, $p + 2), $store); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + [$table, $casier, $sous_casier] = expliquer_config($cfg); |
|
| 189 | + // il faut au moins un casier pour ecrire |
|
| 190 | + if (!$casier) { |
|
| 191 | + return false; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + // trouvons ou creons le pointeur sur le casier |
|
| 195 | + $st = $GLOBALS[$table][$casier] ?? null; |
|
| 196 | + if (!is_array($st) && ($sous_casier || is_array($store))) { |
|
| 197 | + if ($st === null) { |
|
| 198 | + // ne rien creer si c'est une demande d'effacement |
|
| 199 | + if ($store === null) { |
|
| 200 | + return false; |
|
| 201 | + } |
|
| 202 | + $st = []; |
|
| 203 | + } else { |
|
| 204 | + $st = unserialize($st); |
|
| 205 | + if ($st === false) { |
|
| 206 | + // ne rien creer si c'est une demande d'effacement |
|
| 207 | + if ($store === null) { |
|
| 208 | + return false; |
|
| 209 | + } |
|
| 210 | + $st = []; |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $has_planes = false; |
|
| 216 | + // si on a affaire a un sous caiser |
|
| 217 | + // il faut ecrire au bon endroit sans perdre les autres sous casier freres |
|
| 218 | + if ($c = $sous_casier) { |
|
| 219 | + $sc = &$st; |
|
| 220 | + $pointeurs = []; |
|
| 221 | + while ((is_countable($c) ? count($c) : 0) && ($cc = array_shift($c))) { |
|
| 222 | + // creer l'entree si elle n'existe pas |
|
| 223 | + if (!isset($sc[$cc])) { |
|
| 224 | + // si on essaye d'effacer une config qui n'existe pas |
|
| 225 | + // ne rien creer mais sortir |
|
| 226 | + if (is_null($store)) { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + $sc[$cc] = []; |
|
| 230 | + } |
|
| 231 | + $pointeurs[$cc] = &$sc; |
|
| 232 | + $sc = &$sc[$cc]; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // si c'est une demande d'effacement |
|
| 236 | + if (is_null($store)) { |
|
| 237 | + $c = $sous_casier; |
|
| 238 | + $sous = array_pop($c); |
|
| 239 | + // effacer, et remonter pour effacer les parents vides |
|
| 240 | + do { |
|
| 241 | + unset($pointeurs[$sous][$sous]); |
|
| 242 | + } while (($sous = array_pop($c)) && !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0)); |
|
| 243 | + |
|
| 244 | + // si on a vide tous les sous casiers, |
|
| 245 | + // et que le casier est vide |
|
| 246 | + // vider aussi la meta |
|
| 247 | + if (!$sous && !(is_countable($st) ? count($st) : 0)) { |
|
| 248 | + $st = null; |
|
| 249 | + } |
|
| 250 | + } // dans tous les autres cas, on ecrase |
|
| 251 | + else { |
|
| 252 | + if ( |
|
| 253 | + defined('_MYSQL_NOPLANES') |
|
| 254 | + && _MYSQL_NOPLANES |
|
| 255 | + && !empty($GLOBALS['meta']['charset_sql_connexion']) |
|
| 256 | + && $GLOBALS['meta']['charset_sql_connexion'] == 'utf8' |
|
| 257 | + ) { |
|
| 258 | + // detecter si la valeur qu'on veut ecrire a des planes |
|
| 259 | + // @see utf8_noplanes |
|
| 260 | + $serialized_store = (is_string($store) ? $store : serialize($store)); |
|
| 261 | + // un preg_match rapide pour voir si ca vaut le coup de lancer utf8_noplanes |
|
| 262 | + if (preg_match(',[\xF0-\xF4],ms', $serialized_store)) { |
|
| 263 | + if (!function_exists('utf8_noplanes')) { |
|
| 264 | + include_spip('inc/charsets'); |
|
| 265 | + } |
|
| 266 | + if ($serialized_store !== utf8_noplanes($serialized_store)) { |
|
| 267 | + $has_planes = true; |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + $sc = $store; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + // Maintenant que $st est modifiee |
|
| 276 | + // reprenons la comme valeur a stocker dans le casier principal |
|
| 277 | + $store = $st; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + if (is_null($store)) { |
|
| 281 | + if (is_null($st) && !$sous_casier) { |
|
| 282 | + return false; |
|
| 283 | + } // la config n'existait deja pas ! |
|
| 284 | + effacer_meta($casier, $table); |
|
| 285 | + supprimer_table_meta($table); // supprimons la table (si elle est bien vide) |
|
| 286 | + } // les meta ne peuvent etre que des chaines : il faut serializer le reste |
|
| 287 | + else { |
|
| 288 | + if (!isset($GLOBALS[$table])) { |
|
| 289 | + installer_table_meta($table); |
|
| 290 | + } |
|
| 291 | + // si ce n'est pas une chaine |
|
| 292 | + // il faut serializer |
|
| 293 | + if (!is_string($store)) { |
|
| 294 | + $serialized_store = serialize($store); |
|
| 295 | + ecrire_meta($casier, $serialized_store, null, $table); |
|
| 296 | + // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine |
|
| 297 | + // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4) |
|
| 298 | + if ($has_planes) { |
|
| 299 | + $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier)); |
|
| 300 | + if ($check_store !== $serialized_store) { |
|
| 301 | + array_walk_recursive($store, function (&$value, $key) { |
|
| 302 | + if (is_string($value)) { |
|
| 303 | + $value = utf8_noplanes($value); |
|
| 304 | + } |
|
| 305 | + }); |
|
| 306 | + $serialized_store = serialize($store); |
|
| 307 | + ecrire_meta($casier, $serialized_store, null, $table); |
|
| 308 | + } |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + else { |
|
| 312 | + ecrire_meta($casier, $store, null, $table); |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + // verifier que lire_config($cfg)==$store ? |
|
| 317 | + return true; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
@@ -327,14 +327,14 @@ discard block |
||
| 327 | 327 | * @return bool |
| 328 | 328 | */ |
| 329 | 329 | function ecrire_config_metapack_dist($cfg, mixed $store) { |
| 330 | - // cas particulier en metapack:: |
|
| 331 | - // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre |
|
| 332 | - // intacte en sortie ... |
|
| 333 | - if (is_string($store) && strpos($store, ':') && unserialize($store)) { |
|
| 334 | - $store = serialize($store); |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - return ecrire_config($cfg, $store); |
|
| 330 | + // cas particulier en metapack:: |
|
| 331 | + // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre |
|
| 332 | + // intacte en sortie ... |
|
| 333 | + if (is_string($store) && strpos($store, ':') && unserialize($store)) { |
|
| 334 | + $store = serialize($store); |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + return ecrire_config($cfg, $store); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -344,9 +344,9 @@ discard block |
||
| 344 | 344 | * @return bool |
| 345 | 345 | */ |
| 346 | 346 | function effacer_config($cfg) { |
| 347 | - ecrire_config($cfg, null); |
|
| 347 | + ecrire_config($cfg, null); |
|
| 348 | 348 | |
| 349 | - return true; |
|
| 349 | + return true; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
@@ -363,58 +363,58 @@ discard block |
||
| 363 | 363 | * Couples nom de la `meta` => valeur par défaut |
| 364 | 364 | */ |
| 365 | 365 | function liste_metas() { |
| 366 | - return pipeline('configurer_liste_metas', [ |
|
| 367 | - 'nom_site' => _T('info_mon_site_spip'), |
|
| 368 | - 'slogan_site' => '', |
|
| 369 | - 'adresse_site' => preg_replace(',/$,', '', (string) url_de_base()), |
|
| 370 | - 'descriptif_site' => '', |
|
| 371 | - 'activer_logos' => 'oui', |
|
| 372 | - 'activer_logos_survol' => 'non', |
|
| 373 | - 'articles_surtitre' => 'non', |
|
| 374 | - 'articles_soustitre' => 'non', |
|
| 375 | - 'articles_descriptif' => 'non', |
|
| 376 | - 'articles_chapeau' => 'non', |
|
| 377 | - 'articles_texte' => 'oui', |
|
| 378 | - 'articles_ps' => 'non', |
|
| 379 | - 'articles_redac' => 'non', |
|
| 380 | - 'post_dates' => 'non', |
|
| 381 | - 'articles_urlref' => 'non', |
|
| 382 | - 'articles_redirection' => 'non', |
|
| 383 | - 'creer_preview' => 'non', |
|
| 384 | - 'taille_preview' => 150, |
|
| 385 | - 'articles_modif' => 'non', |
|
| 386 | - |
|
| 387 | - 'rubriques_descriptif' => 'non', |
|
| 388 | - 'rubriques_texte' => 'oui', |
|
| 389 | - |
|
| 390 | - 'accepter_inscriptions' => 'non', |
|
| 391 | - 'accepter_visiteurs' => 'non', |
|
| 392 | - 'prevenir_auteurs' => 'non', |
|
| 393 | - 'suivi_edito' => 'non', |
|
| 394 | - 'adresse_suivi' => '', |
|
| 395 | - 'adresse_suivi_inscription' => '', |
|
| 396 | - 'adresse_neuf' => '', |
|
| 397 | - 'jours_neuf' => '', |
|
| 398 | - 'quoi_de_neuf' => 'non', |
|
| 399 | - 'preview' => ',0minirezo,1comite,', |
|
| 400 | - |
|
| 401 | - 'syndication_integrale' => 'oui', |
|
| 402 | - 'charset' => _DEFAULT_CHARSET, |
|
| 403 | - 'dir_img' => substr((string) _DIR_IMG, strlen(_DIR_RACINE)), |
|
| 404 | - |
|
| 405 | - 'multi_rubriques' => 'non', |
|
| 406 | - 'multi_secteurs' => 'non', |
|
| 407 | - 'gerer_trad' => 'non', |
|
| 408 | - 'langues_multilingue' => '', |
|
| 409 | - |
|
| 410 | - 'version_html_max' => 'html4', |
|
| 411 | - |
|
| 412 | - 'type_urls' => 'page', |
|
| 413 | - |
|
| 414 | - 'email_envoi' => '', |
|
| 415 | - 'email_webmaster' => '', |
|
| 416 | - 'auto_compress_http' => 'non', |
|
| 417 | - ]); |
|
| 366 | + return pipeline('configurer_liste_metas', [ |
|
| 367 | + 'nom_site' => _T('info_mon_site_spip'), |
|
| 368 | + 'slogan_site' => '', |
|
| 369 | + 'adresse_site' => preg_replace(',/$,', '', (string) url_de_base()), |
|
| 370 | + 'descriptif_site' => '', |
|
| 371 | + 'activer_logos' => 'oui', |
|
| 372 | + 'activer_logos_survol' => 'non', |
|
| 373 | + 'articles_surtitre' => 'non', |
|
| 374 | + 'articles_soustitre' => 'non', |
|
| 375 | + 'articles_descriptif' => 'non', |
|
| 376 | + 'articles_chapeau' => 'non', |
|
| 377 | + 'articles_texte' => 'oui', |
|
| 378 | + 'articles_ps' => 'non', |
|
| 379 | + 'articles_redac' => 'non', |
|
| 380 | + 'post_dates' => 'non', |
|
| 381 | + 'articles_urlref' => 'non', |
|
| 382 | + 'articles_redirection' => 'non', |
|
| 383 | + 'creer_preview' => 'non', |
|
| 384 | + 'taille_preview' => 150, |
|
| 385 | + 'articles_modif' => 'non', |
|
| 386 | + |
|
| 387 | + 'rubriques_descriptif' => 'non', |
|
| 388 | + 'rubriques_texte' => 'oui', |
|
| 389 | + |
|
| 390 | + 'accepter_inscriptions' => 'non', |
|
| 391 | + 'accepter_visiteurs' => 'non', |
|
| 392 | + 'prevenir_auteurs' => 'non', |
|
| 393 | + 'suivi_edito' => 'non', |
|
| 394 | + 'adresse_suivi' => '', |
|
| 395 | + 'adresse_suivi_inscription' => '', |
|
| 396 | + 'adresse_neuf' => '', |
|
| 397 | + 'jours_neuf' => '', |
|
| 398 | + 'quoi_de_neuf' => 'non', |
|
| 399 | + 'preview' => ',0minirezo,1comite,', |
|
| 400 | + |
|
| 401 | + 'syndication_integrale' => 'oui', |
|
| 402 | + 'charset' => _DEFAULT_CHARSET, |
|
| 403 | + 'dir_img' => substr((string) _DIR_IMG, strlen(_DIR_RACINE)), |
|
| 404 | + |
|
| 405 | + 'multi_rubriques' => 'non', |
|
| 406 | + 'multi_secteurs' => 'non', |
|
| 407 | + 'gerer_trad' => 'non', |
|
| 408 | + 'langues_multilingue' => '', |
|
| 409 | + |
|
| 410 | + 'version_html_max' => 'html4', |
|
| 411 | + |
|
| 412 | + 'type_urls' => 'page', |
|
| 413 | + |
|
| 414 | + 'email_envoi' => '', |
|
| 415 | + 'email_webmaster' => '', |
|
| 416 | + 'auto_compress_http' => 'non', |
|
| 417 | + ]); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -425,43 +425,43 @@ discard block |
||
| 425 | 425 | * @return void |
| 426 | 426 | */ |
| 427 | 427 | function actualise_metas($liste_meta) { |
| 428 | - $meta_serveur = |
|
| 429 | - [ |
|
| 430 | - 'version_installee', |
|
| 431 | - 'adresse_site', |
|
| 432 | - 'alea_ephemere_ancien', |
|
| 433 | - 'alea_ephemere', |
|
| 434 | - 'alea_ephemere_date', |
|
| 435 | - 'langue_site', |
|
| 436 | - 'langues_proposees', |
|
| 437 | - 'date_calcul_rubriques', |
|
| 438 | - 'derniere_modif', |
|
| 439 | - 'optimiser_table', |
|
| 440 | - 'drapeau_edition', |
|
| 441 | - 'creer_preview', |
|
| 442 | - 'taille_preview', |
|
| 443 | - 'creer_htpasswd', |
|
| 444 | - 'creer_htaccess', |
|
| 445 | - 'gd_formats_read', |
|
| 446 | - 'gd_formats', |
|
| 447 | - 'netpbm_formats', |
|
| 448 | - 'formats_graphiques', |
|
| 449 | - 'image_process', |
|
| 450 | - 'plugin_header', |
|
| 451 | - 'plugin' |
|
| 452 | - ]; |
|
| 453 | - // verifier le impt=non |
|
| 454 | - sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur)); |
|
| 455 | - |
|
| 456 | - foreach ($liste_meta as $nom => $valeur) { |
|
| 457 | - if (empty($GLOBALS['meta'][$nom])) { |
|
| 458 | - ecrire_meta($nom, $valeur); |
|
| 459 | - } |
|
| 460 | - } |
|
| 461 | - |
|
| 462 | - include_spip('inc/rubriques'); |
|
| 463 | - $langues = calculer_langues_utilisees(); |
|
| 464 | - ecrire_meta('langues_utilisees', $langues); |
|
| 428 | + $meta_serveur = |
|
| 429 | + [ |
|
| 430 | + 'version_installee', |
|
| 431 | + 'adresse_site', |
|
| 432 | + 'alea_ephemere_ancien', |
|
| 433 | + 'alea_ephemere', |
|
| 434 | + 'alea_ephemere_date', |
|
| 435 | + 'langue_site', |
|
| 436 | + 'langues_proposees', |
|
| 437 | + 'date_calcul_rubriques', |
|
| 438 | + 'derniere_modif', |
|
| 439 | + 'optimiser_table', |
|
| 440 | + 'drapeau_edition', |
|
| 441 | + 'creer_preview', |
|
| 442 | + 'taille_preview', |
|
| 443 | + 'creer_htpasswd', |
|
| 444 | + 'creer_htaccess', |
|
| 445 | + 'gd_formats_read', |
|
| 446 | + 'gd_formats', |
|
| 447 | + 'netpbm_formats', |
|
| 448 | + 'formats_graphiques', |
|
| 449 | + 'image_process', |
|
| 450 | + 'plugin_header', |
|
| 451 | + 'plugin' |
|
| 452 | + ]; |
|
| 453 | + // verifier le impt=non |
|
| 454 | + sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur)); |
|
| 455 | + |
|
| 456 | + foreach ($liste_meta as $nom => $valeur) { |
|
| 457 | + if (empty($GLOBALS['meta'][$nom])) { |
|
| 458 | + ecrire_meta($nom, $valeur); |
|
| 459 | + } |
|
| 460 | + } |
|
| 461 | + |
|
| 462 | + include_spip('inc/rubriques'); |
|
| 463 | + $langues = calculer_langues_utilisees(); |
|
| 464 | + ecrire_meta('langues_utilisees', $langues); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | |
@@ -483,18 +483,18 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | function appliquer_modifs_config($purger_skel = false) { |
| 485 | 485 | |
| 486 | - foreach (liste_metas() as $i => $v) { |
|
| 487 | - if (($x = _request($i)) !== null) { |
|
| 488 | - ecrire_meta($i, $x); |
|
| 489 | - } elseif (!isset($GLOBALS['meta'][$i])) { |
|
| 490 | - ecrire_meta($i, $v); |
|
| 491 | - } |
|
| 492 | - } |
|
| 493 | - |
|
| 494 | - if ($purger_skel) { |
|
| 495 | - include_spip('inc/invalideur'); |
|
| 496 | - purger_repertoire(_DIR_SKELS); |
|
| 497 | - } |
|
| 486 | + foreach (liste_metas() as $i => $v) { |
|
| 487 | + if (($x = _request($i)) !== null) { |
|
| 488 | + ecrire_meta($i, $x); |
|
| 489 | + } elseif (!isset($GLOBALS['meta'][$i])) { |
|
| 490 | + ecrire_meta($i, $v); |
|
| 491 | + } |
|
| 492 | + } |
|
| 493 | + |
|
| 494 | + if ($purger_skel) { |
|
| 495 | + include_spip('inc/invalideur'); |
|
| 496 | + purger_repertoire(_DIR_SKELS); |
|
| 497 | + } |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -505,21 +505,21 @@ discard block |
||
| 505 | 505 | * @return string |
| 506 | 506 | */ |
| 507 | 507 | function appliquer_adresse_site($adresse_site) { |
| 508 | - if ($adresse_site !== null) { |
|
| 509 | - if (!strlen($adresse_site)) { |
|
| 510 | - $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1; |
|
| 511 | - $adresse_site = url_de_base(); |
|
| 512 | - } |
|
| 513 | - $adresse_site = preg_replace(',/?\s*$,', '', (string) $adresse_site); |
|
| 508 | + if ($adresse_site !== null) { |
|
| 509 | + if (!strlen($adresse_site)) { |
|
| 510 | + $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1; |
|
| 511 | + $adresse_site = url_de_base(); |
|
| 512 | + } |
|
| 513 | + $adresse_site = preg_replace(',/?\s*$,', '', (string) $adresse_site); |
|
| 514 | 514 | |
| 515 | - if (!tester_url_absolue($adresse_site)) { |
|
| 516 | - $adresse_site = "http://$adresse_site"; |
|
| 517 | - } |
|
| 515 | + if (!tester_url_absolue($adresse_site)) { |
|
| 516 | + $adresse_site = "http://$adresse_site"; |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | - $adresse_site = entites_html($adresse_site); |
|
| 519 | + $adresse_site = entites_html($adresse_site); |
|
| 520 | 520 | |
| 521 | - ecrire_meta('adresse_site', $adresse_site); |
|
| 522 | - } |
|
| 521 | + ecrire_meta('adresse_site', $adresse_site); |
|
| 522 | + } |
|
| 523 | 523 | |
| 524 | - return $adresse_site; |
|
| 524 | + return $adresse_site; |
|
| 525 | 525 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $titre = '[' |
| 91 | 91 | . $nom_site_spip |
| 92 | 92 | . ']' |
| 93 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | + . ($titre ? ' '.textebrut(typo($titre)) : ''); |
|
| 94 | 94 | |
| 95 | 95 | return _DOCTYPE_ECRIRE |
| 96 | 96 | . html_lang_attributes() |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 134 | 134 | |
| 135 | 135 | $res = pipeline('body_prive', "<body class='" |
| 136 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | + . init_body_class().' '._request('exec')."'" |
|
| 137 | 137 | . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
| 138 | 138 | . '>'); |
| 139 | 139 | |
@@ -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 | /** |
@@ -42,25 +42,25 @@ discard block |
||
| 42 | 42 | * @return string Code HTML |
| 43 | 43 | **/ |
| 44 | 44 | function inc_commencer_page_dist( |
| 45 | - $titre = '', |
|
| 46 | - $rubrique = 'accueil', |
|
| 47 | - $sous_rubrique = 'accueil', |
|
| 48 | - $id_rubrique = '', |
|
| 49 | - $menu = true, |
|
| 50 | - $minipres = false, |
|
| 51 | - $alertes = true |
|
| 45 | + $titre = '', |
|
| 46 | + $rubrique = 'accueil', |
|
| 47 | + $sous_rubrique = 'accueil', |
|
| 48 | + $id_rubrique = '', |
|
| 49 | + $menu = true, |
|
| 50 | + $minipres = false, |
|
| 51 | + $alertes = true |
|
| 52 | 52 | ) { |
| 53 | 53 | |
| 54 | - include_spip('inc/headers'); |
|
| 54 | + include_spip('inc/headers'); |
|
| 55 | 55 | |
| 56 | - http_no_cache(); |
|
| 56 | + http_no_cache(); |
|
| 57 | 57 | |
| 58 | - return init_entete($titre, $id_rubrique, $minipres) |
|
| 59 | - . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 60 | - . "<div id='page'>" |
|
| 61 | - . auteurs_recemment_connectes($GLOBALS['connect_id_auteur']) |
|
| 62 | - . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '') |
|
| 63 | - . '<div class="largeur">'; |
|
| 58 | + return init_entete($titre, $id_rubrique, $minipres) |
|
| 59 | + . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 60 | + . "<div id='page'>" |
|
| 61 | + . auteurs_recemment_connectes($GLOBALS['connect_id_auteur']) |
|
| 62 | + . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '') |
|
| 63 | + . '<div class="largeur">'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | * Entête du fichier HTML avec le DOCTYPE |
| 82 | 82 | */ |
| 83 | 83 | function init_entete($titre = '', $dummy = 0, $minipres = false) { |
| 84 | - include_spip('inc/texte'); |
|
| 85 | - if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) { |
|
| 86 | - $nom_site_spip = _T('info_mon_site_spip'); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $titre = '[' |
|
| 90 | - . $nom_site_spip |
|
| 91 | - . ']' |
|
| 92 | - . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | - |
|
| 94 | - return _DOCTYPE_ECRIRE |
|
| 95 | - . html_lang_attributes() |
|
| 96 | - . "<head>\n" |
|
| 97 | - . init_head($titre, $dummy, $minipres) |
|
| 98 | - . "</head>\n"; |
|
| 84 | + include_spip('inc/texte'); |
|
| 85 | + if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) { |
|
| 86 | + $nom_site_spip = _T('info_mon_site_spip'); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $titre = '[' |
|
| 90 | + . $nom_site_spip |
|
| 91 | + . ']' |
|
| 92 | + . ($titre ? ' ' . textebrut(typo($titre)) : ''); |
|
| 93 | + |
|
| 94 | + return _DOCTYPE_ECRIRE |
|
| 95 | + . html_lang_attributes() |
|
| 96 | + . "<head>\n" |
|
| 97 | + . init_head($titre, $dummy, $minipres) |
|
| 98 | + . "</head>\n"; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | 111 | function init_head($titre = '', $dummy = 0, $minipres = false) { |
| 112 | - return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']); |
|
| 112 | + return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -131,20 +131,20 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
| 133 | 133 | |
| 134 | - $res = pipeline('body_prive', "<body class='" |
|
| 135 | - . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | - . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
|
| 137 | - . '>'); |
|
| 134 | + $res = pipeline('body_prive', "<body class='" |
|
| 135 | + . init_body_class() . ' ' . _request('exec') . "'" |
|
| 136 | + . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '') |
|
| 137 | + . '>'); |
|
| 138 | 138 | |
| 139 | - if (!$menu) { |
|
| 140 | - return $res; |
|
| 141 | - } |
|
| 139 | + if (!$menu) { |
|
| 140 | + return $res; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | - $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 144 | + $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 145 | 145 | |
| 146 | - return $res |
|
| 147 | - . $bandeau(); |
|
| 146 | + return $res |
|
| 147 | + . $bandeau(); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -156,23 +156,23 @@ discard block |
||
| 156 | 156 | * @return string Classes CSS (séparées par des espaces) |
| 157 | 157 | */ |
| 158 | 158 | function init_body_class() { |
| 159 | - $display_modes = [ |
|
| 160 | - 0 => 'icones_img_texte' // défaut. |
|
| 161 | - /*init*/, |
|
| 162 | - 1 => 'icones_texte', |
|
| 163 | - 2 => 'icones_img_texte', |
|
| 164 | - 3 => 'icones_img' |
|
| 165 | - ]; |
|
| 159 | + $display_modes = [ |
|
| 160 | + 0 => 'icones_img_texte' // défaut. |
|
| 161 | + /*init*/, |
|
| 162 | + 1 => 'icones_texte', |
|
| 163 | + 2 => 'icones_img_texte', |
|
| 164 | + 3 => 'icones_img' |
|
| 165 | + ]; |
|
| 166 | 166 | |
| 167 | - $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 167 | + $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 168 | 168 | |
| 169 | - $display_mode = $display_modes[(int) ($prefs['display'] ?? 0)] ?? $display_modes[0]; |
|
| 170 | - $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones'; |
|
| 169 | + $display_mode = $display_modes[(int) ($prefs['display'] ?? 0)] ?? $display_modes[0]; |
|
| 170 | + $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones'; |
|
| 171 | 171 | |
| 172 | - $couleur = (int) ($prefs['couleur'] ?? 2); |
|
| 172 | + $couleur = (int) ($prefs['couleur'] ?? 2); |
|
| 173 | 173 | |
| 174 | - $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode"; |
|
| 175 | - return spip_sanitize_classname($classes); |
|
| 174 | + $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode"; |
|
| 175 | + return spip_sanitize_classname($classes); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
@@ -183,5 +183,5 @@ discard block |
||
| 183 | 183 | * @return string |
| 184 | 184 | */ |
| 185 | 185 | function auteurs_recemment_connectes($id_auteur) { |
| 186 | - return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 186 | + return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 187 | 187 | } |
@@ -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 | ); |
@@ -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(); |
@@ -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((string) $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((string) $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((string) $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((string) $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((string) $c['raw']) . '|@'; |
|
| 118 | + $rempl = $this->markId.base64_encode((string) $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("'", '"', (string) inserer_attribut($trad, 'lang', $l)); |
|
| 113 | - } |
|
| 114 | - if (lang_dir($l) !== lang_dir($lang)) { |
|
| 115 | - $trad = str_replace("'", '"', (string) inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 116 | - } |
|
| 117 | - if (!$echappe_span) { |
|
| 118 | - $trad = echappe_retour($trad, 'idiome'); |
|
| 119 | - } |
|
| 120 | - $texte = substr_replace($texte, (string) $trad, $idiome['pos'] + $offset_pos, $idiome['length']); |
|
| 121 | - $offset_pos += strlen((string) $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("'", '"', (string) inserer_attribut($trad, 'lang', $l)); |
|
| 113 | + } |
|
| 114 | + if (lang_dir($l) !== lang_dir($lang)) { |
|
| 115 | + $trad = str_replace("'", '"', (string) inserer_attribut($trad, 'dir', lang_dir($l))); |
|
| 116 | + } |
|
| 117 | + if (!$echappe_span) { |
|
| 118 | + $trad = echappe_retour($trad, 'idiome'); |
|
| 119 | + } |
|
| 120 | + $texte = substr_replace($texte, (string) $trad, $idiome['pos'] + $offset_pos, $idiome['length']); |
|
| 121 | + $offset_pos += strlen((string) $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', ' ', (string) $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('"', '"', (string) $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, (string) $rempl, $m['pos'] + $offset_pos, $m['length']); |
|
| 203 | - $offset_pos += strlen((string) $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((string) $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', ' ', (string) $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('"', '"', (string) $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, (string) $rempl, $m['pos'] + $offset_pos, $m['length']); |
|
| 203 | + $offset_pos += strlen((string) $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((string) $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 | } |