@@ -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,71 +48,71 @@ discard block |
||
| 48 | 48 | * Nom de la fonction, ou false. |
| 49 | 49 | */ |
| 50 | 50 | function charger_fonction($nom, $dossier = 'exec', $continue = false) { |
| 51 | - static $echecs = []; |
|
| 52 | - |
|
| 53 | - if (strlen($dossier) and substr($dossier, -1) != '/') { |
|
| 54 | - $dossier .= '/'; |
|
| 55 | - } |
|
| 56 | - $f = str_replace('/', '_', $dossier) . $nom; |
|
| 57 | - |
|
| 58 | - if (function_exists($f)) { |
|
| 59 | - return $f; |
|
| 60 | - } |
|
| 61 | - if (function_exists($g = $f . '_dist')) { |
|
| 62 | - return $g; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - if (isset($echecs[$f])) { |
|
| 66 | - return $echecs[$f]; |
|
| 67 | - } |
|
| 68 | - // Sinon charger le fichier de declaration si plausible |
|
| 69 | - |
|
| 70 | - if (!preg_match(',^\w+$,', $f)) { |
|
| 71 | - if ($continue) { |
|
| 72 | - return false; |
|
| 73 | - } //appel interne, on passe |
|
| 74 | - include_spip('inc/minipres'); |
|
| 75 | - echo minipres(); |
|
| 76 | - exit; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - // passer en minuscules (cf les balises de formulaires) |
|
| 80 | - // et inclure le fichier |
|
| 81 | - if ( |
|
| 82 | - !$inc = include_spip($dossier . ($d = strtolower($nom))) |
|
| 83 | - // si le fichier truc/machin/nom.php n'existe pas, |
|
| 84 | - // la fonction peut etre definie dans truc/machin.php qui regroupe plusieurs petites fonctions |
|
| 85 | - and strlen(dirname($dossier)) and dirname($dossier) != '.' |
|
| 86 | - ) { |
|
| 87 | - include_spip(substr($dossier, 0, -1)); |
|
| 88 | - } |
|
| 89 | - if (function_exists($f)) { |
|
| 90 | - return $f; |
|
| 91 | - } |
|
| 92 | - if (function_exists($g)) { |
|
| 93 | - return $g; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if ($continue) { |
|
| 97 | - return $echecs[$f] = false; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // Echec : message d'erreur |
|
| 101 | - spip_log("fonction $nom ($f ou $g) indisponible" . |
|
| 102 | - ($inc ? '' : " (fichier $d absent de $dossier)")); |
|
| 103 | - |
|
| 104 | - include_spip('inc/minipres'); |
|
| 105 | - echo minipres( |
|
| 106 | - _T('forum_titre_erreur'), |
|
| 107 | - $inc ? |
|
| 108 | - _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($f) . '</code>']) |
|
| 109 | - . '<br />' |
|
| 110 | - . _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($g) . '</code>']) |
|
| 111 | - : |
|
| 112 | - _T('fichier_introuvable', ['fichier' => '<code>' . spip_htmlentities($d) . '</code>']), |
|
| 113 | - ['all_inline' => true,'status' => 404] |
|
| 114 | - ); |
|
| 115 | - exit; |
|
| 51 | + static $echecs = []; |
|
| 52 | + |
|
| 53 | + if (strlen($dossier) and substr($dossier, -1) != '/') { |
|
| 54 | + $dossier .= '/'; |
|
| 55 | + } |
|
| 56 | + $f = str_replace('/', '_', $dossier) . $nom; |
|
| 57 | + |
|
| 58 | + if (function_exists($f)) { |
|
| 59 | + return $f; |
|
| 60 | + } |
|
| 61 | + if (function_exists($g = $f . '_dist')) { |
|
| 62 | + return $g; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + if (isset($echecs[$f])) { |
|
| 66 | + return $echecs[$f]; |
|
| 67 | + } |
|
| 68 | + // Sinon charger le fichier de declaration si plausible |
|
| 69 | + |
|
| 70 | + if (!preg_match(',^\w+$,', $f)) { |
|
| 71 | + if ($continue) { |
|
| 72 | + return false; |
|
| 73 | + } //appel interne, on passe |
|
| 74 | + include_spip('inc/minipres'); |
|
| 75 | + echo minipres(); |
|
| 76 | + exit; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + // passer en minuscules (cf les balises de formulaires) |
|
| 80 | + // et inclure le fichier |
|
| 81 | + if ( |
|
| 82 | + !$inc = include_spip($dossier . ($d = strtolower($nom))) |
|
| 83 | + // si le fichier truc/machin/nom.php n'existe pas, |
|
| 84 | + // la fonction peut etre definie dans truc/machin.php qui regroupe plusieurs petites fonctions |
|
| 85 | + and strlen(dirname($dossier)) and dirname($dossier) != '.' |
|
| 86 | + ) { |
|
| 87 | + include_spip(substr($dossier, 0, -1)); |
|
| 88 | + } |
|
| 89 | + if (function_exists($f)) { |
|
| 90 | + return $f; |
|
| 91 | + } |
|
| 92 | + if (function_exists($g)) { |
|
| 93 | + return $g; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if ($continue) { |
|
| 97 | + return $echecs[$f] = false; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // Echec : message d'erreur |
|
| 101 | + spip_log("fonction $nom ($f ou $g) indisponible" . |
|
| 102 | + ($inc ? '' : " (fichier $d absent de $dossier)")); |
|
| 103 | + |
|
| 104 | + include_spip('inc/minipres'); |
|
| 105 | + echo minipres( |
|
| 106 | + _T('forum_titre_erreur'), |
|
| 107 | + $inc ? |
|
| 108 | + _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($f) . '</code>']) |
|
| 109 | + . '<br />' |
|
| 110 | + . _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($g) . '</code>']) |
|
| 111 | + : |
|
| 112 | + _T('fichier_introuvable', ['fichier' => '<code>' . spip_htmlentities($d) . '</code>']), |
|
| 113 | + ['all_inline' => true,'status' => 404] |
|
| 114 | + ); |
|
| 115 | + exit; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -122,17 +122,17 @@ discard block |
||
| 122 | 122 | * @return bool |
| 123 | 123 | */ |
| 124 | 124 | function include_once_check($file) { |
| 125 | - if (file_exists($file)) { |
|
| 126 | - include_once $file; |
|
| 125 | + if (file_exists($file)) { |
|
| 126 | + include_once $file; |
|
| 127 | 127 | |
| 128 | - return true; |
|
| 129 | - } |
|
| 130 | - $crash = (isset($GLOBALS['meta']['message_crash_plugins']) ? unserialize($GLOBALS['meta']['message_crash_plugins']) : ''); |
|
| 131 | - $crash = ($crash ?: []); |
|
| 132 | - $crash[$file] = true; |
|
| 133 | - ecrire_meta('message_crash_plugins', serialize($crash)); |
|
| 128 | + return true; |
|
| 129 | + } |
|
| 130 | + $crash = (isset($GLOBALS['meta']['message_crash_plugins']) ? unserialize($GLOBALS['meta']['message_crash_plugins']) : ''); |
|
| 131 | + $crash = ($crash ?: []); |
|
| 132 | + $crash[$file] = true; |
|
| 133 | + ecrire_meta('message_crash_plugins', serialize($crash)); |
|
| 134 | 134 | |
| 135 | - return false; |
|
| 135 | + return false; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * - string : chemin du fichier trouvé |
| 157 | 157 | **/ |
| 158 | 158 | function include_spip($f, $include = true) { |
| 159 | - return find_in_path($f . '.php', '', $include); |
|
| 159 | + return find_in_path($f . '.php', '', $include); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * - string : chemin du fichier trouvé |
| 177 | 177 | **/ |
| 178 | 178 | function require_spip($f) { |
| 179 | - return find_in_path($f . '.php', '', 'required'); |
|
| 179 | + return find_in_path($f . '.php', '', 'required'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -185,27 +185,27 @@ discard block |
||
| 185 | 185 | * quand on a besoin dans le PHP de filtres/fonctions qui y sont definis |
| 186 | 186 | */ |
| 187 | 187 | function include_fichiers_fonctions() { |
| 188 | - static $done = false; |
|
| 189 | - if (!$done) { |
|
| 190 | - include_spip('inc/lang'); |
|
| 191 | - |
|
| 192 | - // NB: mes_fonctions peut initialiser $dossier_squelettes (old-style) |
|
| 193 | - // donc il faut l'inclure "en globals" |
|
| 194 | - if ($f = find_in_path('mes_fonctions.php')) { |
|
| 195 | - global $dossier_squelettes; |
|
| 196 | - include_once(_ROOT_CWD . $f); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - if (@is_readable(_CACHE_PLUGINS_FCT)) { |
|
| 200 | - // chargement optimise precompile |
|
| 201 | - include_once(_CACHE_PLUGINS_FCT); |
|
| 202 | - } |
|
| 203 | - if (test_espace_prive()) { |
|
| 204 | - include_spip('inc/filtres_ecrire'); |
|
| 205 | - } |
|
| 206 | - include_spip('public/fonctions'); // charger les fichiers fonctions associes aux criteres, balises.. |
|
| 207 | - $done = true; |
|
| 208 | - } |
|
| 188 | + static $done = false; |
|
| 189 | + if (!$done) { |
|
| 190 | + include_spip('inc/lang'); |
|
| 191 | + |
|
| 192 | + // NB: mes_fonctions peut initialiser $dossier_squelettes (old-style) |
|
| 193 | + // donc il faut l'inclure "en globals" |
|
| 194 | + if ($f = find_in_path('mes_fonctions.php')) { |
|
| 195 | + global $dossier_squelettes; |
|
| 196 | + include_once(_ROOT_CWD . $f); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + if (@is_readable(_CACHE_PLUGINS_FCT)) { |
|
| 200 | + // chargement optimise precompile |
|
| 201 | + include_once(_CACHE_PLUGINS_FCT); |
|
| 202 | + } |
|
| 203 | + if (test_espace_prive()) { |
|
| 204 | + include_spip('inc/filtres_ecrire'); |
|
| 205 | + } |
|
| 206 | + include_spip('public/fonctions'); // charger les fichiers fonctions associes aux criteres, balises.. |
|
| 207 | + $done = true; |
|
| 208 | + } |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -231,23 +231,23 @@ discard block |
||
| 231 | 231 | * Les paramètres du pipeline modifiés |
| 232 | 232 | **/ |
| 233 | 233 | function minipipe($fonc, &$val) { |
| 234 | - // fonction |
|
| 235 | - if (function_exists($fonc)) { |
|
| 236 | - $val = $fonc($val); |
|
| 237 | - } // Class::Methode |
|
| 238 | - else { |
|
| 239 | - if ( |
|
| 240 | - preg_match('/^(\w*)::(\w*)$/S', $fonc, $regs) |
|
| 241 | - and $methode = [$regs[1], $regs[2]] |
|
| 242 | - and is_callable($methode) |
|
| 243 | - ) { |
|
| 244 | - $val = $methode($val); |
|
| 245 | - } else { |
|
| 246 | - spip_log("Erreur - '$fonc' non definie !"); |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - return $val; |
|
| 234 | + // fonction |
|
| 235 | + if (function_exists($fonc)) { |
|
| 236 | + $val = $fonc($val); |
|
| 237 | + } // Class::Methode |
|
| 238 | + else { |
|
| 239 | + if ( |
|
| 240 | + preg_match('/^(\w*)::(\w*)$/S', $fonc, $regs) |
|
| 241 | + and $methode = [$regs[1], $regs[2]] |
|
| 242 | + and is_callable($methode) |
|
| 243 | + ) { |
|
| 244 | + $val = $methode($val); |
|
| 245 | + } else { |
|
| 246 | + spip_log("Erreur - '$fonc' non definie !"); |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + return $val; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -278,46 +278,46 @@ discard block |
||
| 278 | 278 | * Résultat |
| 279 | 279 | */ |
| 280 | 280 | function pipeline($action, $val = null) { |
| 281 | - static $charger; |
|
| 282 | - |
|
| 283 | - // chargement initial des fonctions mises en cache, ou generation du cache |
|
| 284 | - if (!$charger) { |
|
| 285 | - if (!($ok = @is_readable($charger = _CACHE_PIPELINES))) { |
|
| 286 | - include_spip('inc/plugin'); |
|
| 287 | - // generer les fichiers php precompiles |
|
| 288 | - // de chargement des plugins et des pipelines |
|
| 289 | - actualise_plugins_actifs(); |
|
| 290 | - if (!($ok = @is_readable($charger))) { |
|
| 291 | - spip_log("fichier $charger pas cree"); |
|
| 292 | - } |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - if ($ok) { |
|
| 296 | - include_once $charger; |
|
| 297 | - } |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - // appliquer notre fonction si elle existe |
|
| 301 | - $fonc = 'execute_pipeline_' . strtolower($action); |
|
| 302 | - if (function_exists($fonc)) { |
|
| 303 | - $val = $fonc($val); |
|
| 304 | - } // plantage ? |
|
| 305 | - else { |
|
| 306 | - spip_log("fonction $fonc absente : pipeline desactive", _LOG_ERREUR); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - // si le flux est une table avec 2 cle args&data |
|
| 310 | - // on ne ressort du pipe que les donnees dans 'data' |
|
| 311 | - // array_key_exists pour php 4.1.0 |
|
| 312 | - if ( |
|
| 313 | - is_array($val) |
|
| 314 | - and count($val) == 2 |
|
| 315 | - and (array_key_exists('data', $val)) |
|
| 316 | - ) { |
|
| 317 | - $val = $val['data']; |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - return $val; |
|
| 281 | + static $charger; |
|
| 282 | + |
|
| 283 | + // chargement initial des fonctions mises en cache, ou generation du cache |
|
| 284 | + if (!$charger) { |
|
| 285 | + if (!($ok = @is_readable($charger = _CACHE_PIPELINES))) { |
|
| 286 | + include_spip('inc/plugin'); |
|
| 287 | + // generer les fichiers php precompiles |
|
| 288 | + // de chargement des plugins et des pipelines |
|
| 289 | + actualise_plugins_actifs(); |
|
| 290 | + if (!($ok = @is_readable($charger))) { |
|
| 291 | + spip_log("fichier $charger pas cree"); |
|
| 292 | + } |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + if ($ok) { |
|
| 296 | + include_once $charger; |
|
| 297 | + } |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + // appliquer notre fonction si elle existe |
|
| 301 | + $fonc = 'execute_pipeline_' . strtolower($action); |
|
| 302 | + if (function_exists($fonc)) { |
|
| 303 | + $val = $fonc($val); |
|
| 304 | + } // plantage ? |
|
| 305 | + else { |
|
| 306 | + spip_log("fonction $fonc absente : pipeline desactive", _LOG_ERREUR); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + // si le flux est une table avec 2 cle args&data |
|
| 310 | + // on ne ressort du pipe que les donnees dans 'data' |
|
| 311 | + // array_key_exists pour php 4.1.0 |
|
| 312 | + if ( |
|
| 313 | + is_array($val) |
|
| 314 | + and count($val) == 2 |
|
| 315 | + and (array_key_exists('data', $val)) |
|
| 316 | + ) { |
|
| 317 | + $val = $val['data']; |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + return $val; |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -361,38 +361,38 @@ discard block |
||
| 361 | 361 | * paramètre est planté pour cause de compatibilité ascendante. |
| 362 | 362 | */ |
| 363 | 363 | function spip_log($message = null, $name = null) { |
| 364 | - static $pre = []; |
|
| 365 | - static $log; |
|
| 366 | - preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string)$name, $regs); |
|
| 367 | - if (!isset($regs[1]) or !$logname = $regs[1]) { |
|
| 368 | - $logname = null; |
|
| 369 | - } |
|
| 370 | - if (!isset($regs[2])) { |
|
| 371 | - $niveau = _LOG_INFO; |
|
| 372 | - } |
|
| 373 | - else { |
|
| 374 | - $niveau = intval($regs[2]); |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - if ($niveau <= (defined('_LOG_FILTRE_GRAVITE') ? _LOG_FILTRE_GRAVITE : _LOG_INFO_IMPORTANTE)) { |
|
| 378 | - if (!$pre) { |
|
| 379 | - $pre = [ |
|
| 380 | - _LOG_HS => 'HS:', |
|
| 381 | - _LOG_ALERTE_ROUGE => 'ALERTE:', |
|
| 382 | - _LOG_CRITIQUE => 'CRITIQUE:', |
|
| 383 | - _LOG_ERREUR => 'ERREUR:', |
|
| 384 | - _LOG_AVERTISSEMENT => 'WARNING:', |
|
| 385 | - _LOG_INFO_IMPORTANTE => '!INFO:', |
|
| 386 | - _LOG_INFO => 'info:', |
|
| 387 | - _LOG_DEBUG => 'debug:' |
|
| 388 | - ]; |
|
| 389 | - $log = charger_fonction('log', 'inc'); |
|
| 390 | - } |
|
| 391 | - if (!is_string($message)) { |
|
| 392 | - $message = print_r($message, true); |
|
| 393 | - } |
|
| 394 | - $log($pre[$niveau] . ' ' . $message, $logname); |
|
| 395 | - } |
|
| 364 | + static $pre = []; |
|
| 365 | + static $log; |
|
| 366 | + preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string)$name, $regs); |
|
| 367 | + if (!isset($regs[1]) or !$logname = $regs[1]) { |
|
| 368 | + $logname = null; |
|
| 369 | + } |
|
| 370 | + if (!isset($regs[2])) { |
|
| 371 | + $niveau = _LOG_INFO; |
|
| 372 | + } |
|
| 373 | + else { |
|
| 374 | + $niveau = intval($regs[2]); |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + if ($niveau <= (defined('_LOG_FILTRE_GRAVITE') ? _LOG_FILTRE_GRAVITE : _LOG_INFO_IMPORTANTE)) { |
|
| 378 | + if (!$pre) { |
|
| 379 | + $pre = [ |
|
| 380 | + _LOG_HS => 'HS:', |
|
| 381 | + _LOG_ALERTE_ROUGE => 'ALERTE:', |
|
| 382 | + _LOG_CRITIQUE => 'CRITIQUE:', |
|
| 383 | + _LOG_ERREUR => 'ERREUR:', |
|
| 384 | + _LOG_AVERTISSEMENT => 'WARNING:', |
|
| 385 | + _LOG_INFO_IMPORTANTE => '!INFO:', |
|
| 386 | + _LOG_INFO => 'info:', |
|
| 387 | + _LOG_DEBUG => 'debug:' |
|
| 388 | + ]; |
|
| 389 | + $log = charger_fonction('log', 'inc'); |
|
| 390 | + } |
|
| 391 | + if (!is_string($message)) { |
|
| 392 | + $message = print_r($message, true); |
|
| 393 | + } |
|
| 394 | + $log($pre[$niveau] . ' ' . $message, $logname); |
|
| 395 | + } |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -403,8 +403,8 @@ discard block |
||
| 403 | 403 | * @param array $opt Tableau d'options |
| 404 | 404 | **/ |
| 405 | 405 | function journal($phrase, $opt = []) { |
| 406 | - $journal = charger_fonction('journal', 'inc'); |
|
| 407 | - $journal($phrase, $opt); |
|
| 406 | + $journal = charger_fonction('journal', 'inc'); |
|
| 407 | + $journal($phrase, $opt); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | |
@@ -423,37 +423,37 @@ discard block |
||
| 423 | 423 | **/ |
| 424 | 424 | function _request($var, $c = false) { |
| 425 | 425 | |
| 426 | - if (is_array($c)) { |
|
| 427 | - return $c[$var] ?? null; |
|
| 428 | - } |
|
| 429 | - |
|
| 430 | - if (isset($_GET[$var])) { |
|
| 431 | - $a = $_GET[$var]; |
|
| 432 | - } elseif (isset($_POST[$var])) { |
|
| 433 | - $a = $_POST[$var]; |
|
| 434 | - } else { |
|
| 435 | - return null; |
|
| 436 | - } |
|
| 437 | - |
|
| 438 | - // Si on est en ajax et en POST tout a ete encode |
|
| 439 | - // via encodeURIComponent, il faut donc repasser |
|
| 440 | - // dans le charset local... |
|
| 441 | - if ( |
|
| 442 | - defined('_AJAX') |
|
| 443 | - and _AJAX |
|
| 444 | - and isset($GLOBALS['meta']['charset']) |
|
| 445 | - and $GLOBALS['meta']['charset'] != 'utf-8' |
|
| 446 | - and is_string($a) |
|
| 447 | - // check rapide mais pas fiable |
|
| 448 | - and preg_match(',[\x80-\xFF],', $a) |
|
| 449 | - // check fiable |
|
| 450 | - and include_spip('inc/charsets') |
|
| 451 | - and is_utf8($a) |
|
| 452 | - ) { |
|
| 453 | - return importer_charset($a, 'utf-8'); |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - return $a; |
|
| 426 | + if (is_array($c)) { |
|
| 427 | + return $c[$var] ?? null; |
|
| 428 | + } |
|
| 429 | + |
|
| 430 | + if (isset($_GET[$var])) { |
|
| 431 | + $a = $_GET[$var]; |
|
| 432 | + } elseif (isset($_POST[$var])) { |
|
| 433 | + $a = $_POST[$var]; |
|
| 434 | + } else { |
|
| 435 | + return null; |
|
| 436 | + } |
|
| 437 | + |
|
| 438 | + // Si on est en ajax et en POST tout a ete encode |
|
| 439 | + // via encodeURIComponent, il faut donc repasser |
|
| 440 | + // dans le charset local... |
|
| 441 | + if ( |
|
| 442 | + defined('_AJAX') |
|
| 443 | + and _AJAX |
|
| 444 | + and isset($GLOBALS['meta']['charset']) |
|
| 445 | + and $GLOBALS['meta']['charset'] != 'utf-8' |
|
| 446 | + and is_string($a) |
|
| 447 | + // check rapide mais pas fiable |
|
| 448 | + and preg_match(',[\x80-\xFF],', $a) |
|
| 449 | + // check fiable |
|
| 450 | + and include_spip('inc/charsets') |
|
| 451 | + and is_utf8($a) |
|
| 452 | + ) { |
|
| 453 | + return importer_charset($a, 'utf-8'); |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + return $a; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | |
@@ -471,22 +471,22 @@ discard block |
||
| 471 | 471 | * - false sinon |
| 472 | 472 | **/ |
| 473 | 473 | function set_request($var, $val = null, $c = false) { |
| 474 | - if (is_array($c)) { |
|
| 475 | - unset($c[$var]); |
|
| 476 | - if ($val !== null) { |
|
| 477 | - $c[$var] = $val; |
|
| 478 | - } |
|
| 474 | + if (is_array($c)) { |
|
| 475 | + unset($c[$var]); |
|
| 476 | + if ($val !== null) { |
|
| 477 | + $c[$var] = $val; |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | - return $c; |
|
| 481 | - } |
|
| 480 | + return $c; |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | - unset($_GET[$var]); |
|
| 484 | - unset($_POST[$var]); |
|
| 485 | - if ($val !== null) { |
|
| 486 | - $_GET[$var] = $val; |
|
| 487 | - } |
|
| 483 | + unset($_GET[$var]); |
|
| 484 | + unset($_POST[$var]); |
|
| 485 | + if ($val !== null) { |
|
| 486 | + $_GET[$var] = $val; |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | - return false; # n'affecte pas $c |
|
| 489 | + return false; # n'affecte pas $c |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -506,25 +506,25 @@ discard block |
||
| 506 | 506 | * @return array|mixed|string |
| 507 | 507 | */ |
| 508 | 508 | function spip_sanitize_from_request($value, $key, $sanitize_function = 'entites_html') { |
| 509 | - if (is_array($value)) { |
|
| 510 | - if ($key == '*') { |
|
| 511 | - $key = array_keys($value); |
|
| 512 | - } |
|
| 513 | - if (!is_array($key)) { |
|
| 514 | - $key = [$key]; |
|
| 515 | - } |
|
| 516 | - foreach ($key as $k) { |
|
| 517 | - if (!empty($value[$k])) { |
|
| 518 | - $value[$k] = spip_sanitize_from_request($value[$k], $k, $sanitize_function); |
|
| 519 | - } |
|
| 520 | - } |
|
| 521 | - return $value; |
|
| 522 | - } |
|
| 523 | - // si la valeur vient des GET ou POST on la sanitize |
|
| 524 | - if (!empty($value) and $value == _request($key)) { |
|
| 525 | - $value = $sanitize_function($value); |
|
| 526 | - } |
|
| 527 | - return $value; |
|
| 509 | + if (is_array($value)) { |
|
| 510 | + if ($key == '*') { |
|
| 511 | + $key = array_keys($value); |
|
| 512 | + } |
|
| 513 | + if (!is_array($key)) { |
|
| 514 | + $key = [$key]; |
|
| 515 | + } |
|
| 516 | + foreach ($key as $k) { |
|
| 517 | + if (!empty($value[$k])) { |
|
| 518 | + $value[$k] = spip_sanitize_from_request($value[$k], $k, $sanitize_function); |
|
| 519 | + } |
|
| 520 | + } |
|
| 521 | + return $value; |
|
| 522 | + } |
|
| 523 | + // si la valeur vient des GET ou POST on la sanitize |
|
| 524 | + if (!empty($value) and $value == _request($key)) { |
|
| 525 | + $value = $sanitize_function($value); |
|
| 526 | + } |
|
| 527 | + return $value; |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | /** |
@@ -532,23 +532,22 @@ discard block |
||
| 532 | 532 | * |
| 533 | 533 | * On est sur le web, on exclut certains protocoles, |
| 534 | 534 | * notamment 'file://', 'php://' et d'autres… |
| 535 | - |
|
| 536 | 535 | * @param string $url |
| 537 | 536 | * @return bool |
| 538 | 537 | */ |
| 539 | 538 | function tester_url_absolue($url) { |
| 540 | - $url = trim($url ?? ''); |
|
| 541 | - if ($url && preg_match(';^([a-z]{3,7}:)?//;Uims', $url, $m)) { |
|
| 542 | - if ( |
|
| 543 | - isset($m[1]) |
|
| 544 | - and $p = strtolower(rtrim($m[1], ':')) |
|
| 545 | - and in_array($p, ['file', 'php', 'zlib', 'glob', 'phar', 'ssh2', 'rar', 'ogg', 'expect', 'zip']) |
|
| 546 | - ) { |
|
| 547 | - return false; |
|
| 548 | - } |
|
| 549 | - return true; |
|
| 550 | - } |
|
| 551 | - return false; |
|
| 539 | + $url = trim($url ?? ''); |
|
| 540 | + if ($url && preg_match(';^([a-z]{3,7}:)?//;Uims', $url, $m)) { |
|
| 541 | + if ( |
|
| 542 | + isset($m[1]) |
|
| 543 | + and $p = strtolower(rtrim($m[1], ':')) |
|
| 544 | + and in_array($p, ['file', 'php', 'zlib', 'glob', 'phar', 'ssh2', 'rar', 'ogg', 'expect', 'zip']) |
|
| 545 | + ) { |
|
| 546 | + return false; |
|
| 547 | + } |
|
| 548 | + return true; |
|
| 549 | + } |
|
| 550 | + return false; |
|
| 552 | 551 | } |
| 553 | 552 | |
| 554 | 553 | /** |
@@ -570,100 +569,100 @@ discard block |
||
| 570 | 569 | * @return string URL |
| 571 | 570 | */ |
| 572 | 571 | function parametre_url($url, $c, $v = null, $sep = '&') { |
| 573 | - // requete erronnee : plusieurs variable dans $c et aucun $v |
|
| 574 | - if (strpos($c, '|') !== false and is_null($v)) { |
|
| 575 | - return null; |
|
| 576 | - } |
|
| 577 | - |
|
| 578 | - // lever l'#ancre |
|
| 579 | - if (preg_match(',^([^#]*)(#.*)$,', $url, $r)) { |
|
| 580 | - $url = $r[1]; |
|
| 581 | - $ancre = $r[2]; |
|
| 582 | - } else { |
|
| 583 | - $ancre = ''; |
|
| 584 | - } |
|
| 585 | - |
|
| 586 | - // eclater |
|
| 587 | - $url = preg_split(',[?]|&|&,', $url); |
|
| 588 | - |
|
| 589 | - // recuperer la base |
|
| 590 | - $a = array_shift($url); |
|
| 591 | - if (!$a) { |
|
| 592 | - $a = './'; |
|
| 593 | - } |
|
| 594 | - |
|
| 595 | - // preparer la regexp de maniere securisee |
|
| 596 | - $regexp = explode('|', $c); |
|
| 597 | - foreach ($regexp as $r => $e) { |
|
| 598 | - $regexp[$r] = str_replace('[]', '\[\]', preg_replace(',[^\w\d\[\]-],', '', $e)); |
|
| 599 | - } |
|
| 600 | - $regexp = ',^(' . implode('|', $regexp) . '[[]?[]]?)(=.*)?$,'; |
|
| 601 | - $ajouts = array_flip(explode('|', $c)); |
|
| 602 | - $u = is_array($v) ? $v : rawurlencode((string) $v); |
|
| 603 | - $testv = (is_array($v) ? count($v) : strlen((string) $v)); |
|
| 604 | - $v_read = null; |
|
| 605 | - // lire les variables et agir |
|
| 606 | - foreach ($url as $n => $val) { |
|
| 607 | - if (preg_match($regexp, urldecode($val), $r)) { |
|
| 608 | - $r = array_pad($r, 3, null); |
|
| 609 | - if ($v === null) { |
|
| 610 | - // c'est un tableau, on memorise les valeurs |
|
| 611 | - if (substr($r[1], -2) == '[]') { |
|
| 612 | - if (!$v_read) { |
|
| 613 | - $v_read = []; |
|
| 614 | - } |
|
| 615 | - $v_read[] = $r[2] ? substr($r[2], 1) : ''; |
|
| 616 | - } // c'est un scalaire, on retourne direct |
|
| 617 | - else { |
|
| 618 | - return $r[2] ? substr($r[2], 1) : ''; |
|
| 619 | - } |
|
| 620 | - } // suppression |
|
| 621 | - elseif (!$testv) { |
|
| 622 | - unset($url[$n]); |
|
| 623 | - } |
|
| 624 | - // Ajout. Pour une variable, remplacer au meme endroit, |
|
| 625 | - // pour un tableau ce sera fait dans la prochaine boucle |
|
| 626 | - elseif (substr($r[1], -2) != '[]') { |
|
| 627 | - $url[$n] = $r[1] . '=' . $u; |
|
| 628 | - unset($ajouts[$r[1]]); |
|
| 629 | - } |
|
| 630 | - // Pour les tableaux on laisse tomber les valeurs de |
|
| 631 | - // départ, on remplira à l'étape suivante |
|
| 632 | - else { |
|
| 633 | - unset($url[$n]); |
|
| 634 | - } |
|
| 635 | - } |
|
| 636 | - } |
|
| 637 | - |
|
| 638 | - // traiter les parametres pas encore trouves |
|
| 639 | - if ( |
|
| 640 | - $v === null |
|
| 641 | - and $args = func_get_args() |
|
| 642 | - and count($args) == 2 |
|
| 643 | - ) { |
|
| 644 | - return $v_read; // rien trouve ou un tableau |
|
| 645 | - } elseif ($testv) { |
|
| 646 | - foreach ($ajouts as $k => $n) { |
|
| 647 | - if (!is_array($v)) { |
|
| 648 | - $url[] = $k . '=' . $u; |
|
| 649 | - } else { |
|
| 650 | - $id = (substr($k, -2) == '[]') ? $k : ($k . '[]'); |
|
| 651 | - foreach ($v as $w) { |
|
| 652 | - $url[] = $id . '=' . (is_array($w) ? 'Array' : rawurlencode($w)); |
|
| 653 | - } |
|
| 654 | - } |
|
| 655 | - } |
|
| 656 | - } |
|
| 657 | - |
|
| 658 | - // eliminer les vides |
|
| 659 | - $url = array_filter($url); |
|
| 660 | - |
|
| 661 | - // recomposer l'adresse |
|
| 662 | - if ($url) { |
|
| 663 | - $a .= '?' . join($sep, $url); |
|
| 664 | - } |
|
| 665 | - |
|
| 666 | - return $a . $ancre; |
|
| 572 | + // requete erronnee : plusieurs variable dans $c et aucun $v |
|
| 573 | + if (strpos($c, '|') !== false and is_null($v)) { |
|
| 574 | + return null; |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + // lever l'#ancre |
|
| 578 | + if (preg_match(',^([^#]*)(#.*)$,', $url, $r)) { |
|
| 579 | + $url = $r[1]; |
|
| 580 | + $ancre = $r[2]; |
|
| 581 | + } else { |
|
| 582 | + $ancre = ''; |
|
| 583 | + } |
|
| 584 | + |
|
| 585 | + // eclater |
|
| 586 | + $url = preg_split(',[?]|&|&,', $url); |
|
| 587 | + |
|
| 588 | + // recuperer la base |
|
| 589 | + $a = array_shift($url); |
|
| 590 | + if (!$a) { |
|
| 591 | + $a = './'; |
|
| 592 | + } |
|
| 593 | + |
|
| 594 | + // preparer la regexp de maniere securisee |
|
| 595 | + $regexp = explode('|', $c); |
|
| 596 | + foreach ($regexp as $r => $e) { |
|
| 597 | + $regexp[$r] = str_replace('[]', '\[\]', preg_replace(',[^\w\d\[\]-],', '', $e)); |
|
| 598 | + } |
|
| 599 | + $regexp = ',^(' . implode('|', $regexp) . '[[]?[]]?)(=.*)?$,'; |
|
| 600 | + $ajouts = array_flip(explode('|', $c)); |
|
| 601 | + $u = is_array($v) ? $v : rawurlencode((string) $v); |
|
| 602 | + $testv = (is_array($v) ? count($v) : strlen((string) $v)); |
|
| 603 | + $v_read = null; |
|
| 604 | + // lire les variables et agir |
|
| 605 | + foreach ($url as $n => $val) { |
|
| 606 | + if (preg_match($regexp, urldecode($val), $r)) { |
|
| 607 | + $r = array_pad($r, 3, null); |
|
| 608 | + if ($v === null) { |
|
| 609 | + // c'est un tableau, on memorise les valeurs |
|
| 610 | + if (substr($r[1], -2) == '[]') { |
|
| 611 | + if (!$v_read) { |
|
| 612 | + $v_read = []; |
|
| 613 | + } |
|
| 614 | + $v_read[] = $r[2] ? substr($r[2], 1) : ''; |
|
| 615 | + } // c'est un scalaire, on retourne direct |
|
| 616 | + else { |
|
| 617 | + return $r[2] ? substr($r[2], 1) : ''; |
|
| 618 | + } |
|
| 619 | + } // suppression |
|
| 620 | + elseif (!$testv) { |
|
| 621 | + unset($url[$n]); |
|
| 622 | + } |
|
| 623 | + // Ajout. Pour une variable, remplacer au meme endroit, |
|
| 624 | + // pour un tableau ce sera fait dans la prochaine boucle |
|
| 625 | + elseif (substr($r[1], -2) != '[]') { |
|
| 626 | + $url[$n] = $r[1] . '=' . $u; |
|
| 627 | + unset($ajouts[$r[1]]); |
|
| 628 | + } |
|
| 629 | + // Pour les tableaux on laisse tomber les valeurs de |
|
| 630 | + // départ, on remplira à l'étape suivante |
|
| 631 | + else { |
|
| 632 | + unset($url[$n]); |
|
| 633 | + } |
|
| 634 | + } |
|
| 635 | + } |
|
| 636 | + |
|
| 637 | + // traiter les parametres pas encore trouves |
|
| 638 | + if ( |
|
| 639 | + $v === null |
|
| 640 | + and $args = func_get_args() |
|
| 641 | + and count($args) == 2 |
|
| 642 | + ) { |
|
| 643 | + return $v_read; // rien trouve ou un tableau |
|
| 644 | + } elseif ($testv) { |
|
| 645 | + foreach ($ajouts as $k => $n) { |
|
| 646 | + if (!is_array($v)) { |
|
| 647 | + $url[] = $k . '=' . $u; |
|
| 648 | + } else { |
|
| 649 | + $id = (substr($k, -2) == '[]') ? $k : ($k . '[]'); |
|
| 650 | + foreach ($v as $w) { |
|
| 651 | + $url[] = $id . '=' . (is_array($w) ? 'Array' : rawurlencode($w)); |
|
| 652 | + } |
|
| 653 | + } |
|
| 654 | + } |
|
| 655 | + } |
|
| 656 | + |
|
| 657 | + // eliminer les vides |
|
| 658 | + $url = array_filter($url); |
|
| 659 | + |
|
| 660 | + // recomposer l'adresse |
|
| 661 | + if ($url) { |
|
| 662 | + $a .= '?' . join($sep, $url); |
|
| 663 | + } |
|
| 664 | + |
|
| 665 | + return $a . $ancre; |
|
| 667 | 666 | } |
| 668 | 667 | |
| 669 | 668 | /** |
@@ -678,22 +677,22 @@ discard block |
||
| 678 | 677 | * @uses translitteration() |
| 679 | 678 | */ |
| 680 | 679 | function ancre_url(string $url, ?string $ancre = ''): string { |
| 681 | - $ancre ??= ''; |
|
| 682 | - // lever l'#ancre |
|
| 683 | - if (preg_match(',^([^#]*)(#.*)$,', $url, $r)) { |
|
| 684 | - $url = $r[1]; |
|
| 685 | - } |
|
| 686 | - if (preg_match('/[^-_a-zA-Z0-9]+/S', $ancre)) { |
|
| 687 | - if (!function_exists('translitteration')) { |
|
| 688 | - include_spip('inc/charsets'); |
|
| 689 | - } |
|
| 690 | - $ancre = preg_replace( |
|
| 691 | - ['/^[^-_a-zA-Z0-9]+/', '/[^-_a-zA-Z0-9]/'], |
|
| 692 | - ['', '-'], |
|
| 693 | - translitteration($ancre) |
|
| 694 | - ); |
|
| 695 | - } |
|
| 696 | - return $url . (strlen($ancre) ? '#' . $ancre : ''); |
|
| 680 | + $ancre ??= ''; |
|
| 681 | + // lever l'#ancre |
|
| 682 | + if (preg_match(',^([^#]*)(#.*)$,', $url, $r)) { |
|
| 683 | + $url = $r[1]; |
|
| 684 | + } |
|
| 685 | + if (preg_match('/[^-_a-zA-Z0-9]+/S', $ancre)) { |
|
| 686 | + if (!function_exists('translitteration')) { |
|
| 687 | + include_spip('inc/charsets'); |
|
| 688 | + } |
|
| 689 | + $ancre = preg_replace( |
|
| 690 | + ['/^[^-_a-zA-Z0-9]+/', '/[^-_a-zA-Z0-9]/'], |
|
| 691 | + ['', '-'], |
|
| 692 | + translitteration($ancre) |
|
| 693 | + ); |
|
| 694 | + } |
|
| 695 | + return $url . (strlen($ancre) ? '#' . $ancre : ''); |
|
| 697 | 696 | } |
| 698 | 697 | |
| 699 | 698 | /** |
@@ -703,16 +702,16 @@ discard block |
||
| 703 | 702 | * @return string |
| 704 | 703 | */ |
| 705 | 704 | function nettoyer_uri($reset = null) { |
| 706 | - static $done = false; |
|
| 707 | - static $propre = ''; |
|
| 708 | - if (!is_null($reset)) { |
|
| 709 | - return $propre = $reset; |
|
| 710 | - } |
|
| 711 | - if ($done) { |
|
| 712 | - return $propre; |
|
| 713 | - } |
|
| 714 | - $done = true; |
|
| 715 | - return $propre = nettoyer_uri_var($GLOBALS['REQUEST_URI']); |
|
| 705 | + static $done = false; |
|
| 706 | + static $propre = ''; |
|
| 707 | + if (!is_null($reset)) { |
|
| 708 | + return $propre = $reset; |
|
| 709 | + } |
|
| 710 | + if ($done) { |
|
| 711 | + return $propre; |
|
| 712 | + } |
|
| 713 | + $done = true; |
|
| 714 | + return $propre = nettoyer_uri_var($GLOBALS['REQUEST_URI']); |
|
| 716 | 715 | } |
| 717 | 716 | |
| 718 | 717 | /** |
@@ -724,16 +723,16 @@ discard block |
||
| 724 | 723 | * @return string |
| 725 | 724 | */ |
| 726 | 725 | function nettoyer_uri_var($request_uri) { |
| 727 | - $uri1 = $request_uri; |
|
| 728 | - do { |
|
| 729 | - $uri = $uri1; |
|
| 730 | - $uri1 = preg_replace( |
|
| 731 | - ',([?&])(var_[^=&]*|PHPSESSID|fbclid|utm_[^=&]*)=[^&]*(&|$),i', |
|
| 732 | - '\1', |
|
| 733 | - $uri |
|
| 734 | - ); |
|
| 735 | - } while ($uri <> $uri1); |
|
| 736 | - return preg_replace(',[?&]$,', '', $uri1); |
|
| 726 | + $uri1 = $request_uri; |
|
| 727 | + do { |
|
| 728 | + $uri = $uri1; |
|
| 729 | + $uri1 = preg_replace( |
|
| 730 | + ',([?&])(var_[^=&]*|PHPSESSID|fbclid|utm_[^=&]*)=[^&]*(&|$),i', |
|
| 731 | + '\1', |
|
| 732 | + $uri |
|
| 733 | + ); |
|
| 734 | + } while ($uri <> $uri1); |
|
| 735 | + return preg_replace(',[?&]$,', '', $uri1); |
|
| 737 | 736 | } |
| 738 | 737 | |
| 739 | 738 | |
@@ -747,48 +746,48 @@ discard block |
||
| 747 | 746 | * URL vers soi-même |
| 748 | 747 | **/ |
| 749 | 748 | function self($amp = '&', $root = false) { |
| 750 | - $url = nettoyer_uri(); |
|
| 751 | - if ( |
|
| 752 | - !$root |
|
| 753 | - and ( |
|
| 754 | - // si pas de profondeur on peut tronquer |
|
| 755 | - $GLOBALS['profondeur_url'] < (_DIR_RESTREINT ? 1 : 2) |
|
| 756 | - // sinon c'est OK si _SET_HTML_BASE a ete force a false |
|
| 757 | - or (defined('_SET_HTML_BASE') and !_SET_HTML_BASE)) |
|
| 758 | - ) { |
|
| 759 | - $url = preg_replace(',^[^?]*/,', '', $url); |
|
| 760 | - } |
|
| 761 | - // ajouter le cas echeant les variables _POST['id_...'] |
|
| 762 | - foreach ($_POST as $v => $c) { |
|
| 763 | - if (substr($v, 0, 3) == 'id_') { |
|
| 764 | - $url = parametre_url($url, $v, $c, '&'); |
|
| 765 | - } |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - // supprimer les variables sans interet |
|
| 769 | - if (test_espace_prive()) { |
|
| 770 | - $url = preg_replace(',([?&])(' |
|
| 771 | - . 'lang|show_docs|' |
|
| 772 | - . 'changer_lang|var_lang|action)=[^&]*,i', '\1', $url); |
|
| 773 | - $url = preg_replace(',([?&])[&]+,', '\1', $url); |
|
| 774 | - $url = preg_replace(',[&]$,', '\1', $url); |
|
| 775 | - } |
|
| 776 | - |
|
| 777 | - // eviter les hacks |
|
| 778 | - include_spip('inc/filtres_mini'); |
|
| 779 | - $url = spip_htmlspecialchars($url); |
|
| 780 | - |
|
| 781 | - $url = str_replace(["'", '"', '<', '[', ']', ':'], ['%27', '%22', '%3C', '%5B', '%5D', '%3A'], $url); |
|
| 782 | - |
|
| 783 | - // & ? |
|
| 784 | - if ($amp != '&') { |
|
| 785 | - $url = str_replace('&', $amp, $url); |
|
| 786 | - } |
|
| 787 | - |
|
| 788 | - // Si ca demarre par ? ou vide, donner './' |
|
| 789 | - $url = preg_replace(',^([?].*)?$,', './\1', $url); |
|
| 790 | - |
|
| 791 | - return $url; |
|
| 749 | + $url = nettoyer_uri(); |
|
| 750 | + if ( |
|
| 751 | + !$root |
|
| 752 | + and ( |
|
| 753 | + // si pas de profondeur on peut tronquer |
|
| 754 | + $GLOBALS['profondeur_url'] < (_DIR_RESTREINT ? 1 : 2) |
|
| 755 | + // sinon c'est OK si _SET_HTML_BASE a ete force a false |
|
| 756 | + or (defined('_SET_HTML_BASE') and !_SET_HTML_BASE)) |
|
| 757 | + ) { |
|
| 758 | + $url = preg_replace(',^[^?]*/,', '', $url); |
|
| 759 | + } |
|
| 760 | + // ajouter le cas echeant les variables _POST['id_...'] |
|
| 761 | + foreach ($_POST as $v => $c) { |
|
| 762 | + if (substr($v, 0, 3) == 'id_') { |
|
| 763 | + $url = parametre_url($url, $v, $c, '&'); |
|
| 764 | + } |
|
| 765 | + } |
|
| 766 | + |
|
| 767 | + // supprimer les variables sans interet |
|
| 768 | + if (test_espace_prive()) { |
|
| 769 | + $url = preg_replace(',([?&])(' |
|
| 770 | + . 'lang|show_docs|' |
|
| 771 | + . 'changer_lang|var_lang|action)=[^&]*,i', '\1', $url); |
|
| 772 | + $url = preg_replace(',([?&])[&]+,', '\1', $url); |
|
| 773 | + $url = preg_replace(',[&]$,', '\1', $url); |
|
| 774 | + } |
|
| 775 | + |
|
| 776 | + // eviter les hacks |
|
| 777 | + include_spip('inc/filtres_mini'); |
|
| 778 | + $url = spip_htmlspecialchars($url); |
|
| 779 | + |
|
| 780 | + $url = str_replace(["'", '"', '<', '[', ']', ':'], ['%27', '%22', '%3C', '%5B', '%5D', '%3A'], $url); |
|
| 781 | + |
|
| 782 | + // & ? |
|
| 783 | + if ($amp != '&') { |
|
| 784 | + $url = str_replace('&', $amp, $url); |
|
| 785 | + } |
|
| 786 | + |
|
| 787 | + // Si ca demarre par ? ou vide, donner './' |
|
| 788 | + $url = preg_replace(',^([?].*)?$,', './\1', $url); |
|
| 789 | + |
|
| 790 | + return $url; |
|
| 792 | 791 | } |
| 793 | 792 | |
| 794 | 793 | |
@@ -799,7 +798,7 @@ discard block |
||
| 799 | 798 | * true si c'est le cas, false sinon. |
| 800 | 799 | */ |
| 801 | 800 | function test_espace_prive() { |
| 802 | - return defined('_ESPACE_PRIVE') ? _ESPACE_PRIVE : false; |
|
| 801 | + return defined('_ESPACE_PRIVE') ? _ESPACE_PRIVE : false; |
|
| 803 | 802 | } |
| 804 | 803 | |
| 805 | 804 | /** |
@@ -809,7 +808,7 @@ discard block |
||
| 809 | 808 | * @return bool |
| 810 | 809 | */ |
| 811 | 810 | function test_plugin_actif($plugin) { |
| 812 | - return ($plugin and defined('_DIR_PLUGIN_' . strtoupper($plugin))) ? true : false; |
|
| 811 | + return ($plugin and defined('_DIR_PLUGIN_' . strtoupper($plugin))) ? true : false; |
|
| 813 | 812 | } |
| 814 | 813 | |
| 815 | 814 | /** |
@@ -840,52 +839,52 @@ discard block |
||
| 840 | 839 | * texte |
| 841 | 840 | */ |
| 842 | 841 | function _T($texte, $args = [], $options = []) { |
| 843 | - static $traduire = false; |
|
| 844 | - $o = ['class' => '', 'force' => true, 'sanitize' => true]; |
|
| 845 | - if ($options) { |
|
| 846 | - // support de l'ancien argument $class |
|
| 847 | - if (is_string($options)) { |
|
| 848 | - $options = ['class' => $options]; |
|
| 849 | - } |
|
| 850 | - $o = array_merge($o, $options); |
|
| 851 | - } |
|
| 852 | - |
|
| 853 | - if (!$traduire) { |
|
| 854 | - $traduire = charger_fonction('traduire', 'inc'); |
|
| 855 | - include_spip('inc/lang'); |
|
| 856 | - } |
|
| 857 | - |
|
| 858 | - // On peut passer explicitement la langue dans le tableau |
|
| 859 | - // On utilise le même nom de variable que la globale |
|
| 860 | - if (isset($args['spip_lang'])) { |
|
| 861 | - $lang = $args['spip_lang']; |
|
| 862 | - // On l'enleve pour ne pas le passer au remplacement |
|
| 863 | - unset($args['spip_lang']); |
|
| 864 | - } // Sinon on prend la langue du contexte |
|
| 865 | - else { |
|
| 866 | - $lang = $GLOBALS['spip_lang']; |
|
| 867 | - } |
|
| 868 | - $text = $traduire($texte, $lang); |
|
| 869 | - |
|
| 870 | - if ($text === null || !strlen($text)) { |
|
| 871 | - if (!$o['force']) { |
|
| 872 | - return ''; |
|
| 873 | - } |
|
| 874 | - |
|
| 875 | - $text = $texte; |
|
| 876 | - |
|
| 877 | - // pour les chaines non traduites, assurer un service minimum |
|
| 878 | - if (!$GLOBALS['test_i18n'] and (_request('var_mode') != 'traduction')) { |
|
| 879 | - $n = strpos($text, ':'); |
|
| 880 | - if ($n !== false) { |
|
| 881 | - $text = substr($text, $n + 1); |
|
| 882 | - } |
|
| 883 | - $text = str_replace('_', ' ', $text); |
|
| 884 | - } |
|
| 885 | - $o['class'] = null; |
|
| 886 | - } |
|
| 887 | - |
|
| 888 | - return _L($text, $args, $o); |
|
| 842 | + static $traduire = false; |
|
| 843 | + $o = ['class' => '', 'force' => true, 'sanitize' => true]; |
|
| 844 | + if ($options) { |
|
| 845 | + // support de l'ancien argument $class |
|
| 846 | + if (is_string($options)) { |
|
| 847 | + $options = ['class' => $options]; |
|
| 848 | + } |
|
| 849 | + $o = array_merge($o, $options); |
|
| 850 | + } |
|
| 851 | + |
|
| 852 | + if (!$traduire) { |
|
| 853 | + $traduire = charger_fonction('traduire', 'inc'); |
|
| 854 | + include_spip('inc/lang'); |
|
| 855 | + } |
|
| 856 | + |
|
| 857 | + // On peut passer explicitement la langue dans le tableau |
|
| 858 | + // On utilise le même nom de variable que la globale |
|
| 859 | + if (isset($args['spip_lang'])) { |
|
| 860 | + $lang = $args['spip_lang']; |
|
| 861 | + // On l'enleve pour ne pas le passer au remplacement |
|
| 862 | + unset($args['spip_lang']); |
|
| 863 | + } // Sinon on prend la langue du contexte |
|
| 864 | + else { |
|
| 865 | + $lang = $GLOBALS['spip_lang']; |
|
| 866 | + } |
|
| 867 | + $text = $traduire($texte, $lang); |
|
| 868 | + |
|
| 869 | + if ($text === null || !strlen($text)) { |
|
| 870 | + if (!$o['force']) { |
|
| 871 | + return ''; |
|
| 872 | + } |
|
| 873 | + |
|
| 874 | + $text = $texte; |
|
| 875 | + |
|
| 876 | + // pour les chaines non traduites, assurer un service minimum |
|
| 877 | + if (!$GLOBALS['test_i18n'] and (_request('var_mode') != 'traduction')) { |
|
| 878 | + $n = strpos($text, ':'); |
|
| 879 | + if ($n !== false) { |
|
| 880 | + $text = substr($text, $n + 1); |
|
| 881 | + } |
|
| 882 | + $text = str_replace('_', ' ', $text); |
|
| 883 | + } |
|
| 884 | + $o['class'] = null; |
|
| 885 | + } |
|
| 886 | + |
|
| 887 | + return _L($text, $args, $o); |
|
| 889 | 888 | } |
| 890 | 889 | |
| 891 | 890 | |
@@ -912,53 +911,53 @@ discard block |
||
| 912 | 911 | * texte |
| 913 | 912 | */ |
| 914 | 913 | function _L($text, $args = [], $options = []) { |
| 915 | - $f = $text; |
|
| 916 | - $defaut_options = [ |
|
| 917 | - 'class' => null, |
|
| 918 | - 'sanitize' => true, |
|
| 919 | - ]; |
|
| 920 | - // support de l'ancien argument $class |
|
| 921 | - if ($options and is_string($options)) { |
|
| 922 | - $options = ['class' => $options]; |
|
| 923 | - } |
|
| 924 | - if (is_array($options)) { |
|
| 925 | - $options += $defaut_options; |
|
| 926 | - } else { |
|
| 927 | - $options = $defaut_options; |
|
| 928 | - } |
|
| 929 | - |
|
| 930 | - if (is_array($args) and count($args)) { |
|
| 931 | - if (!function_exists('interdire_scripts')) { |
|
| 932 | - include_spip('inc/texte'); |
|
| 933 | - } |
|
| 934 | - if (!function_exists('echapper_html_suspect')) { |
|
| 935 | - include_spip('inc/texte_mini'); |
|
| 936 | - } |
|
| 937 | - foreach ($args as $name => $value) { |
|
| 938 | - if (strpos($text, (string) "@$name@") !== false) { |
|
| 939 | - if ($options['sanitize']) { |
|
| 940 | - $value = echapper_html_suspect($value); |
|
| 941 | - $value = interdire_scripts($value, -1); |
|
| 942 | - } |
|
| 943 | - if (!empty($options['class'])) { |
|
| 944 | - $value = "<span class='" . $options['class'] . "'>$value</span>"; |
|
| 945 | - } |
|
| 946 | - $text = str_replace("@$name@", $value, $text); |
|
| 947 | - unset($args[$name]); |
|
| 948 | - } |
|
| 949 | - } |
|
| 950 | - // Si des variables n'ont pas ete inserees, le signaler |
|
| 951 | - // (chaines de langues pas a jour) |
|
| 952 | - if ($args) { |
|
| 953 | - spip_log("$f: variables inutilisees " . join(', ', array_keys($args)), _LOG_DEBUG); |
|
| 954 | - } |
|
| 955 | - } |
|
| 956 | - |
|
| 957 | - if (($GLOBALS['test_i18n'] or (_request('var_mode') == 'traduction')) and is_null($options['class'])) { |
|
| 958 | - return "<span class='debug-traduction-erreur'>$text</span>"; |
|
| 959 | - } else { |
|
| 960 | - return $text; |
|
| 961 | - } |
|
| 914 | + $f = $text; |
|
| 915 | + $defaut_options = [ |
|
| 916 | + 'class' => null, |
|
| 917 | + 'sanitize' => true, |
|
| 918 | + ]; |
|
| 919 | + // support de l'ancien argument $class |
|
| 920 | + if ($options and is_string($options)) { |
|
| 921 | + $options = ['class' => $options]; |
|
| 922 | + } |
|
| 923 | + if (is_array($options)) { |
|
| 924 | + $options += $defaut_options; |
|
| 925 | + } else { |
|
| 926 | + $options = $defaut_options; |
|
| 927 | + } |
|
| 928 | + |
|
| 929 | + if (is_array($args) and count($args)) { |
|
| 930 | + if (!function_exists('interdire_scripts')) { |
|
| 931 | + include_spip('inc/texte'); |
|
| 932 | + } |
|
| 933 | + if (!function_exists('echapper_html_suspect')) { |
|
| 934 | + include_spip('inc/texte_mini'); |
|
| 935 | + } |
|
| 936 | + foreach ($args as $name => $value) { |
|
| 937 | + if (strpos($text, (string) "@$name@") !== false) { |
|
| 938 | + if ($options['sanitize']) { |
|
| 939 | + $value = echapper_html_suspect($value); |
|
| 940 | + $value = interdire_scripts($value, -1); |
|
| 941 | + } |
|
| 942 | + if (!empty($options['class'])) { |
|
| 943 | + $value = "<span class='" . $options['class'] . "'>$value</span>"; |
|
| 944 | + } |
|
| 945 | + $text = str_replace("@$name@", $value, $text); |
|
| 946 | + unset($args[$name]); |
|
| 947 | + } |
|
| 948 | + } |
|
| 949 | + // Si des variables n'ont pas ete inserees, le signaler |
|
| 950 | + // (chaines de langues pas a jour) |
|
| 951 | + if ($args) { |
|
| 952 | + spip_log("$f: variables inutilisees " . join(', ', array_keys($args)), _LOG_DEBUG); |
|
| 953 | + } |
|
| 954 | + } |
|
| 955 | + |
|
| 956 | + if (($GLOBALS['test_i18n'] or (_request('var_mode') == 'traduction')) and is_null($options['class'])) { |
|
| 957 | + return "<span class='debug-traduction-erreur'>$text</span>"; |
|
| 958 | + } else { |
|
| 959 | + return $text; |
|
| 960 | + } |
|
| 962 | 961 | } |
| 963 | 962 | |
| 964 | 963 | |
@@ -972,13 +971,13 @@ discard block |
||
| 972 | 971 | * @return string |
| 973 | 972 | */ |
| 974 | 973 | function joli_repertoire($rep) { |
| 975 | - $a = substr($rep, 0, 1); |
|
| 976 | - if ($a <> '.' and $a <> '/') { |
|
| 977 | - $rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS) . $rep; |
|
| 978 | - } |
|
| 979 | - $rep = preg_replace(',(^\.\.\/),', '', $rep); |
|
| 974 | + $a = substr($rep, 0, 1); |
|
| 975 | + if ($a <> '.' and $a <> '/') { |
|
| 976 | + $rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS) . $rep; |
|
| 977 | + } |
|
| 978 | + $rep = preg_replace(',(^\.\.\/),', '', $rep); |
|
| 980 | 979 | |
| 981 | - return $rep; |
|
| 980 | + return $rep; |
|
| 982 | 981 | } |
| 983 | 982 | |
| 984 | 983 | |
@@ -1003,54 +1002,54 @@ discard block |
||
| 1003 | 1002 | * @return float|int|string|void |
| 1004 | 1003 | */ |
| 1005 | 1004 | function spip_timer($t = 'rien', $raw = false) { |
| 1006 | - static $time; |
|
| 1007 | - $a = time(); |
|
| 1008 | - $b = microtime(); |
|
| 1009 | - // microtime peut contenir les microsecondes et le temps |
|
| 1010 | - $b = explode(' ', $b); |
|
| 1011 | - if (count($b) == 2) { |
|
| 1012 | - $a = end($b); |
|
| 1013 | - } // plus precis ! |
|
| 1014 | - $b = reset($b); |
|
| 1015 | - if (!isset($time[$t])) { |
|
| 1016 | - $time[$t] = $a + $b; |
|
| 1017 | - } else { |
|
| 1018 | - $p = ($a + $b - $time[$t]) * 1000; |
|
| 1019 | - unset($time[$t]); |
|
| 1005 | + static $time; |
|
| 1006 | + $a = time(); |
|
| 1007 | + $b = microtime(); |
|
| 1008 | + // microtime peut contenir les microsecondes et le temps |
|
| 1009 | + $b = explode(' ', $b); |
|
| 1010 | + if (count($b) == 2) { |
|
| 1011 | + $a = end($b); |
|
| 1012 | + } // plus precis ! |
|
| 1013 | + $b = reset($b); |
|
| 1014 | + if (!isset($time[$t])) { |
|
| 1015 | + $time[$t] = $a + $b; |
|
| 1016 | + } else { |
|
| 1017 | + $p = ($a + $b - $time[$t]) * 1000; |
|
| 1018 | + unset($time[$t]); |
|
| 1020 | 1019 | # echo "'$p'";exit; |
| 1021 | - if ($raw) { |
|
| 1022 | - return $p; |
|
| 1023 | - } |
|
| 1024 | - if ($p < 1000) { |
|
| 1025 | - $s = ''; |
|
| 1026 | - } else { |
|
| 1027 | - $s = sprintf('%d ', $x = floor($p / 1000)); |
|
| 1028 | - $p -= ($x * 1000); |
|
| 1029 | - } |
|
| 1020 | + if ($raw) { |
|
| 1021 | + return $p; |
|
| 1022 | + } |
|
| 1023 | + if ($p < 1000) { |
|
| 1024 | + $s = ''; |
|
| 1025 | + } else { |
|
| 1026 | + $s = sprintf('%d ', $x = floor($p / 1000)); |
|
| 1027 | + $p -= ($x * 1000); |
|
| 1028 | + } |
|
| 1030 | 1029 | |
| 1031 | - return $s . sprintf($s ? '%07.3f ms' : '%.3f ms', $p); |
|
| 1032 | - } |
|
| 1030 | + return $s . sprintf($s ? '%07.3f ms' : '%.3f ms', $p); |
|
| 1031 | + } |
|
| 1033 | 1032 | } |
| 1034 | 1033 | |
| 1035 | 1034 | |
| 1036 | 1035 | // Renvoie False si un fichier n'est pas plus vieux que $duree secondes, |
| 1037 | 1036 | // sinon renvoie True et le date sauf si ca n'est pas souhaite |
| 1038 | 1037 | function spip_touch($fichier, $duree = 0, $touch = true) { |
| 1039 | - if ($duree) { |
|
| 1040 | - clearstatcache(); |
|
| 1041 | - if ((@$f = filemtime($fichier)) and ($f >= time() - $duree)) { |
|
| 1042 | - return false; |
|
| 1043 | - } |
|
| 1044 | - } |
|
| 1045 | - if ($touch !== false) { |
|
| 1046 | - if (!@touch($fichier)) { |
|
| 1047 | - spip_unlink($fichier); |
|
| 1048 | - @touch($fichier); |
|
| 1049 | - }; |
|
| 1050 | - @chmod($fichier, _SPIP_CHMOD & ~0111); |
|
| 1051 | - } |
|
| 1038 | + if ($duree) { |
|
| 1039 | + clearstatcache(); |
|
| 1040 | + if ((@$f = filemtime($fichier)) and ($f >= time() - $duree)) { |
|
| 1041 | + return false; |
|
| 1042 | + } |
|
| 1043 | + } |
|
| 1044 | + if ($touch !== false) { |
|
| 1045 | + if (!@touch($fichier)) { |
|
| 1046 | + spip_unlink($fichier); |
|
| 1047 | + @touch($fichier); |
|
| 1048 | + }; |
|
| 1049 | + @chmod($fichier, _SPIP_CHMOD & ~0111); |
|
| 1050 | + } |
|
| 1052 | 1051 | |
| 1053 | - return true; |
|
| 1052 | + return true; |
|
| 1054 | 1053 | } |
| 1055 | 1054 | |
| 1056 | 1055 | |
@@ -1061,11 +1060,11 @@ discard block |
||
| 1061 | 1060 | * @uses cron() |
| 1062 | 1061 | **/ |
| 1063 | 1062 | function action_cron() { |
| 1064 | - include_spip('inc/headers'); |
|
| 1065 | - http_response_code(204); // No Content |
|
| 1066 | - header('Connection: close'); |
|
| 1067 | - define('_DIRECT_CRON_FORCE', true); |
|
| 1068 | - cron(); |
|
| 1063 | + include_spip('inc/headers'); |
|
| 1064 | + http_response_code(204); // No Content |
|
| 1065 | + header('Connection: close'); |
|
| 1066 | + define('_DIRECT_CRON_FORCE', true); |
|
| 1067 | + cron(); |
|
| 1069 | 1068 | } |
| 1070 | 1069 | |
| 1071 | 1070 | /** |
@@ -1081,26 +1080,26 @@ discard block |
||
| 1081 | 1080 | * True si la tache a pu être effectuée |
| 1082 | 1081 | */ |
| 1083 | 1082 | function cron($taches = [], $taches_old = []) { |
| 1084 | - // si pas en mode cron force, laisser tomber. |
|
| 1085 | - if (!defined('_DIRECT_CRON_FORCE')) { |
|
| 1086 | - return false; |
|
| 1087 | - } |
|
| 1088 | - if (!is_array($taches)) { |
|
| 1089 | - $taches = $taches_old; |
|
| 1090 | - } // compat anciens appels |
|
| 1091 | - // si taches a inserer en base et base inaccessible, laisser tomber |
|
| 1092 | - // sinon on ne verifie pas la connexion tout de suite, car si ca se trouve |
|
| 1093 | - // queue_sleep_time_to_next_job() dira qu'il n'y a rien a faire |
|
| 1094 | - // et on evite d'ouvrir une connexion pour rien (utilisation de _DIRECT_CRON_FORCE dans mes_options.php) |
|
| 1095 | - if ($taches and count($taches) and !spip_connect()) { |
|
| 1096 | - return false; |
|
| 1097 | - } |
|
| 1098 | - spip_log('cron !', 'jq' . _LOG_DEBUG); |
|
| 1099 | - if ($genie = charger_fonction('genie', 'inc', true)) { |
|
| 1100 | - return $genie($taches); |
|
| 1101 | - } |
|
| 1102 | - |
|
| 1103 | - return false; |
|
| 1083 | + // si pas en mode cron force, laisser tomber. |
|
| 1084 | + if (!defined('_DIRECT_CRON_FORCE')) { |
|
| 1085 | + return false; |
|
| 1086 | + } |
|
| 1087 | + if (!is_array($taches)) { |
|
| 1088 | + $taches = $taches_old; |
|
| 1089 | + } // compat anciens appels |
|
| 1090 | + // si taches a inserer en base et base inaccessible, laisser tomber |
|
| 1091 | + // sinon on ne verifie pas la connexion tout de suite, car si ca se trouve |
|
| 1092 | + // queue_sleep_time_to_next_job() dira qu'il n'y a rien a faire |
|
| 1093 | + // et on evite d'ouvrir une connexion pour rien (utilisation de _DIRECT_CRON_FORCE dans mes_options.php) |
|
| 1094 | + if ($taches and count($taches) and !spip_connect()) { |
|
| 1095 | + return false; |
|
| 1096 | + } |
|
| 1097 | + spip_log('cron !', 'jq' . _LOG_DEBUG); |
|
| 1098 | + if ($genie = charger_fonction('genie', 'inc', true)) { |
|
| 1099 | + return $genie($taches); |
|
| 1100 | + } |
|
| 1101 | + |
|
| 1102 | + return false; |
|
| 1104 | 1103 | } |
| 1105 | 1104 | |
| 1106 | 1105 | /** |
@@ -1132,17 +1131,17 @@ discard block |
||
| 1132 | 1131 | * Le numéro de travail ajouté ou `0` si aucun travail n’a été ajouté. |
| 1133 | 1132 | */ |
| 1134 | 1133 | function job_queue_add( |
| 1135 | - $function, |
|
| 1136 | - $description, |
|
| 1137 | - $arguments = [], |
|
| 1138 | - $file = '', |
|
| 1139 | - $no_duplicate = false, |
|
| 1140 | - $time = 0, |
|
| 1141 | - $priority = 0 |
|
| 1134 | + $function, |
|
| 1135 | + $description, |
|
| 1136 | + $arguments = [], |
|
| 1137 | + $file = '', |
|
| 1138 | + $no_duplicate = false, |
|
| 1139 | + $time = 0, |
|
| 1140 | + $priority = 0 |
|
| 1142 | 1141 | ) { |
| 1143 | - include_spip('inc/queue'); |
|
| 1142 | + include_spip('inc/queue'); |
|
| 1144 | 1143 | |
| 1145 | - return queue_add_job($function, $description, $arguments, $file, $no_duplicate, $time, $priority); |
|
| 1144 | + return queue_add_job($function, $description, $arguments, $file, $no_duplicate, $time, $priority); |
|
| 1146 | 1145 | } |
| 1147 | 1146 | |
| 1148 | 1147 | /** |
@@ -1153,9 +1152,9 @@ discard block |
||
| 1153 | 1152 | * @return bool |
| 1154 | 1153 | */ |
| 1155 | 1154 | function job_queue_remove($id_job) { |
| 1156 | - include_spip('inc/queue'); |
|
| 1155 | + include_spip('inc/queue'); |
|
| 1157 | 1156 | |
| 1158 | - return queue_remove_job($id_job); |
|
| 1157 | + return queue_remove_job($id_job); |
|
| 1159 | 1158 | } |
| 1160 | 1159 | |
| 1161 | 1160 | /** |
@@ -1168,9 +1167,9 @@ discard block |
||
| 1168 | 1167 | * or an array of simple array to link multiples objet in one time |
| 1169 | 1168 | */ |
| 1170 | 1169 | function job_queue_link($id_job, $objets) { |
| 1171 | - include_spip('inc/queue'); |
|
| 1170 | + include_spip('inc/queue'); |
|
| 1172 | 1171 | |
| 1173 | - return queue_link_job($id_job, $objets); |
|
| 1172 | + return queue_link_job($id_job, $objets); |
|
| 1174 | 1173 | } |
| 1175 | 1174 | |
| 1176 | 1175 | |
@@ -1190,36 +1189,36 @@ discard block |
||
| 1190 | 1189 | * - `null` si la queue n'est pas encore initialisée |
| 1191 | 1190 | */ |
| 1192 | 1191 | function queue_sleep_time_to_next_job($force = null) { |
| 1193 | - static $queue_next_job_time = -1; |
|
| 1194 | - if ($force === true) { |
|
| 1195 | - $queue_next_job_time = -1; |
|
| 1196 | - } elseif ($force) { |
|
| 1197 | - $queue_next_job_time = $force; |
|
| 1198 | - } |
|
| 1199 | - |
|
| 1200 | - if ($queue_next_job_time == -1) { |
|
| 1201 | - if (!defined('_JQ_NEXT_JOB_TIME_FILENAME')) { |
|
| 1202 | - define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP . 'job_queue_next.txt'); |
|
| 1203 | - } |
|
| 1204 | - // utiliser un cache memoire si dispo |
|
| 1205 | - if (function_exists('cache_get') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) { |
|
| 1206 | - $queue_next_job_time = cache_get(_JQ_NEXT_JOB_TIME_FILENAME); |
|
| 1207 | - } else { |
|
| 1208 | - $queue_next_job_time = null; |
|
| 1209 | - if (lire_fichier(_JQ_NEXT_JOB_TIME_FILENAME, $contenu)) { |
|
| 1210 | - $queue_next_job_time = intval($contenu); |
|
| 1211 | - } |
|
| 1212 | - } |
|
| 1213 | - } |
|
| 1214 | - |
|
| 1215 | - if (is_null($queue_next_job_time)) { |
|
| 1216 | - return null; |
|
| 1217 | - } |
|
| 1218 | - if (!$_SERVER['REQUEST_TIME']) { |
|
| 1219 | - $_SERVER['REQUEST_TIME'] = time(); |
|
| 1220 | - } |
|
| 1221 | - |
|
| 1222 | - return $queue_next_job_time - $_SERVER['REQUEST_TIME']; |
|
| 1192 | + static $queue_next_job_time = -1; |
|
| 1193 | + if ($force === true) { |
|
| 1194 | + $queue_next_job_time = -1; |
|
| 1195 | + } elseif ($force) { |
|
| 1196 | + $queue_next_job_time = $force; |
|
| 1197 | + } |
|
| 1198 | + |
|
| 1199 | + if ($queue_next_job_time == -1) { |
|
| 1200 | + if (!defined('_JQ_NEXT_JOB_TIME_FILENAME')) { |
|
| 1201 | + define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP . 'job_queue_next.txt'); |
|
| 1202 | + } |
|
| 1203 | + // utiliser un cache memoire si dispo |
|
| 1204 | + if (function_exists('cache_get') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) { |
|
| 1205 | + $queue_next_job_time = cache_get(_JQ_NEXT_JOB_TIME_FILENAME); |
|
| 1206 | + } else { |
|
| 1207 | + $queue_next_job_time = null; |
|
| 1208 | + if (lire_fichier(_JQ_NEXT_JOB_TIME_FILENAME, $contenu)) { |
|
| 1209 | + $queue_next_job_time = intval($contenu); |
|
| 1210 | + } |
|
| 1211 | + } |
|
| 1212 | + } |
|
| 1213 | + |
|
| 1214 | + if (is_null($queue_next_job_time)) { |
|
| 1215 | + return null; |
|
| 1216 | + } |
|
| 1217 | + if (!$_SERVER['REQUEST_TIME']) { |
|
| 1218 | + $_SERVER['REQUEST_TIME'] = time(); |
|
| 1219 | + } |
|
| 1220 | + |
|
| 1221 | + return $queue_next_job_time - $_SERVER['REQUEST_TIME']; |
|
| 1223 | 1222 | } |
| 1224 | 1223 | |
| 1225 | 1224 | |
@@ -1231,11 +1230,11 @@ discard block |
||
| 1231 | 1230 | * @return string |
| 1232 | 1231 | */ |
| 1233 | 1232 | function quote_amp($u) { |
| 1234 | - return preg_replace( |
|
| 1235 | - '/&(?![a-z]{0,4}\w{2,3};|#x?[0-9a-f]{2,6};)/i', |
|
| 1236 | - '&', |
|
| 1237 | - $u |
|
| 1238 | - ); |
|
| 1233 | + return preg_replace( |
|
| 1234 | + '/&(?![a-z]{0,4}\w{2,3};|#x?[0-9a-f]{2,6};)/i', |
|
| 1235 | + '&', |
|
| 1236 | + $u |
|
| 1237 | + ); |
|
| 1239 | 1238 | } |
| 1240 | 1239 | |
| 1241 | 1240 | |
@@ -1258,27 +1257,27 @@ discard block |
||
| 1258 | 1257 | * Balise HTML `<script>` et son contenu |
| 1259 | 1258 | **/ |
| 1260 | 1259 | function http_script($script, $src = '', $noscript = '') { |
| 1261 | - static $done = []; |
|
| 1260 | + static $done = []; |
|
| 1262 | 1261 | |
| 1263 | - if ($src && !isset($done[$src])) { |
|
| 1264 | - $done[$src] = true; |
|
| 1265 | - $src = find_in_path($src, _JAVASCRIPT); |
|
| 1266 | - $src = " src='$src'"; |
|
| 1267 | - } else { |
|
| 1268 | - $src = ''; |
|
| 1269 | - } |
|
| 1270 | - if ($script) { |
|
| 1271 | - $script = ("/*<![CDATA[*/\n" . |
|
| 1272 | - preg_replace(',</([^>]*)>,', '<\/\1>', $script) . |
|
| 1273 | - '/*]]>*/'); |
|
| 1274 | - } |
|
| 1275 | - if ($noscript) { |
|
| 1276 | - $noscript = "<noscript>\n\t$noscript\n</noscript>\n"; |
|
| 1277 | - } |
|
| 1262 | + if ($src && !isset($done[$src])) { |
|
| 1263 | + $done[$src] = true; |
|
| 1264 | + $src = find_in_path($src, _JAVASCRIPT); |
|
| 1265 | + $src = " src='$src'"; |
|
| 1266 | + } else { |
|
| 1267 | + $src = ''; |
|
| 1268 | + } |
|
| 1269 | + if ($script) { |
|
| 1270 | + $script = ("/*<![CDATA[*/\n" . |
|
| 1271 | + preg_replace(',</([^>]*)>,', '<\/\1>', $script) . |
|
| 1272 | + '/*]]>*/'); |
|
| 1273 | + } |
|
| 1274 | + if ($noscript) { |
|
| 1275 | + $noscript = "<noscript>\n\t$noscript\n</noscript>\n"; |
|
| 1276 | + } |
|
| 1278 | 1277 | |
| 1279 | - return ($src or $script or $noscript) |
|
| 1280 | - ? "<script type='text/javascript'$src>$script</script>$noscript" |
|
| 1281 | - : ''; |
|
| 1278 | + return ($src or $script or $noscript) |
|
| 1279 | + ? "<script type='text/javascript'$src>$script</script>$noscript" |
|
| 1280 | + : ''; |
|
| 1282 | 1281 | } |
| 1283 | 1282 | |
| 1284 | 1283 | |
@@ -1313,7 +1312,7 @@ discard block |
||
| 1313 | 1312 | * texte échappé |
| 1314 | 1313 | **/ |
| 1315 | 1314 | function texte_script(string $texte): string { |
| 1316 | - return str_replace('\'', '\\\'', str_replace('\\', '\\\\', $texte)); |
|
| 1315 | + return str_replace('\'', '\\\'', str_replace('\\', '\\\\', $texte)); |
|
| 1317 | 1316 | } |
| 1318 | 1317 | |
| 1319 | 1318 | |
@@ -1350,68 +1349,68 @@ discard block |
||
| 1350 | 1349 | * Liste des chemins, par ordre de priorité. |
| 1351 | 1350 | **/ |
| 1352 | 1351 | function _chemin($dir_path = null) { |
| 1353 | - static $path_base = null; |
|
| 1354 | - static $path_full = null; |
|
| 1355 | - if ($path_base == null) { |
|
| 1356 | - // Chemin standard depuis l'espace public |
|
| 1357 | - $path = defined('_SPIP_PATH') ? _SPIP_PATH : |
|
| 1358 | - _DIR_RACINE . ':' . |
|
| 1359 | - _DIR_RACINE . 'squelettes-dist/:' . |
|
| 1360 | - _DIR_RACINE . 'prive/:' . |
|
| 1361 | - _DIR_RESTREINT; |
|
| 1362 | - // Ajouter squelettes/ |
|
| 1363 | - if (@is_dir(_DIR_RACINE . 'squelettes')) { |
|
| 1364 | - $path = _DIR_RACINE . 'squelettes/:' . $path; |
|
| 1365 | - } |
|
| 1366 | - foreach (explode(':', $path) as $dir) { |
|
| 1367 | - if (strlen($dir) and substr($dir, -1) != '/') { |
|
| 1368 | - $dir .= '/'; |
|
| 1369 | - } |
|
| 1370 | - $path_base[] = $dir; |
|
| 1371 | - } |
|
| 1372 | - $path_full = $path_base; |
|
| 1373 | - // Et le(s) dossier(s) des squelettes nommes |
|
| 1374 | - if (strlen($GLOBALS['dossier_squelettes'])) { |
|
| 1375 | - foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) { |
|
| 1376 | - array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/'); |
|
| 1377 | - } |
|
| 1378 | - } |
|
| 1379 | - $GLOBALS['path_sig'] = md5(serialize($path_full)); |
|
| 1380 | - } |
|
| 1381 | - if ($dir_path === null) { |
|
| 1382 | - return $path_full; |
|
| 1383 | - } |
|
| 1384 | - |
|
| 1385 | - if (is_array($dir_path) or strlen($dir_path)) { |
|
| 1386 | - $tete = ''; |
|
| 1387 | - if (reset($path_base) == _DIR_RACINE . 'squelettes/') { |
|
| 1388 | - $tete = array_shift($path_base); |
|
| 1389 | - } |
|
| 1390 | - $dirs = (is_array($dir_path) ? $dir_path : explode(':', $dir_path)); |
|
| 1391 | - $dirs = array_reverse($dirs); |
|
| 1392 | - foreach ($dirs as $dir_path) { |
|
| 1393 | - if (substr($dir_path, -1) != '/') { |
|
| 1394 | - $dir_path .= '/'; |
|
| 1395 | - } |
|
| 1396 | - if (!in_array($dir_path, $path_base)) { |
|
| 1397 | - array_unshift($path_base, $dir_path); |
|
| 1398 | - } |
|
| 1399 | - } |
|
| 1400 | - if (strlen($tete)) { |
|
| 1401 | - array_unshift($path_base, $tete); |
|
| 1402 | - } |
|
| 1403 | - } |
|
| 1404 | - $path_full = $path_base; |
|
| 1405 | - // Et le(s) dossier(s) des squelettes nommes |
|
| 1406 | - if (strlen($GLOBALS['dossier_squelettes'])) { |
|
| 1407 | - foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) { |
|
| 1408 | - array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE) . $d . '/'); |
|
| 1409 | - } |
|
| 1410 | - } |
|
| 1411 | - |
|
| 1412 | - $GLOBALS['path_sig'] = md5(serialize($path_full)); |
|
| 1413 | - |
|
| 1414 | - return $path_full; |
|
| 1352 | + static $path_base = null; |
|
| 1353 | + static $path_full = null; |
|
| 1354 | + if ($path_base == null) { |
|
| 1355 | + // Chemin standard depuis l'espace public |
|
| 1356 | + $path = defined('_SPIP_PATH') ? _SPIP_PATH : |
|
| 1357 | + _DIR_RACINE . ':' . |
|
| 1358 | + _DIR_RACINE . 'squelettes-dist/:' . |
|
| 1359 | + _DIR_RACINE . 'prive/:' . |
|
| 1360 | + _DIR_RESTREINT; |
|
| 1361 | + // Ajouter squelettes/ |
|
| 1362 | + if (@is_dir(_DIR_RACINE . 'squelettes')) { |
|
| 1363 | + $path = _DIR_RACINE . 'squelettes/:' . $path; |
|
| 1364 | + } |
|
| 1365 | + foreach (explode(':', $path) as $dir) { |
|
| 1366 | + if (strlen($dir) and substr($dir, -1) != '/') { |
|
| 1367 | + $dir .= '/'; |
|
| 1368 | + } |
|
| 1369 | + $path_base[] = $dir; |
|
| 1370 | + } |
|
| 1371 | + $path_full = $path_base; |
|
| 1372 | + // Et le(s) dossier(s) des squelettes nommes |
|
| 1373 | + if (strlen($GLOBALS['dossier_squelettes'])) { |
|
| 1374 | + foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) { |
|
| 1375 | + array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/'); |
|
| 1376 | + } |
|
| 1377 | + } |
|
| 1378 | + $GLOBALS['path_sig'] = md5(serialize($path_full)); |
|
| 1379 | + } |
|
| 1380 | + if ($dir_path === null) { |
|
| 1381 | + return $path_full; |
|
| 1382 | + } |
|
| 1383 | + |
|
| 1384 | + if (is_array($dir_path) or strlen($dir_path)) { |
|
| 1385 | + $tete = ''; |
|
| 1386 | + if (reset($path_base) == _DIR_RACINE . 'squelettes/') { |
|
| 1387 | + $tete = array_shift($path_base); |
|
| 1388 | + } |
|
| 1389 | + $dirs = (is_array($dir_path) ? $dir_path : explode(':', $dir_path)); |
|
| 1390 | + $dirs = array_reverse($dirs); |
|
| 1391 | + foreach ($dirs as $dir_path) { |
|
| 1392 | + if (substr($dir_path, -1) != '/') { |
|
| 1393 | + $dir_path .= '/'; |
|
| 1394 | + } |
|
| 1395 | + if (!in_array($dir_path, $path_base)) { |
|
| 1396 | + array_unshift($path_base, $dir_path); |
|
| 1397 | + } |
|
| 1398 | + } |
|
| 1399 | + if (strlen($tete)) { |
|
| 1400 | + array_unshift($path_base, $tete); |
|
| 1401 | + } |
|
| 1402 | + } |
|
| 1403 | + $path_full = $path_base; |
|
| 1404 | + // Et le(s) dossier(s) des squelettes nommes |
|
| 1405 | + if (strlen($GLOBALS['dossier_squelettes'])) { |
|
| 1406 | + foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) { |
|
| 1407 | + array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE) . $d . '/'); |
|
| 1408 | + } |
|
| 1409 | + } |
|
| 1410 | + |
|
| 1411 | + $GLOBALS['path_sig'] = md5(serialize($path_full)); |
|
| 1412 | + |
|
| 1413 | + return $path_full; |
|
| 1415 | 1414 | } |
| 1416 | 1415 | |
| 1417 | 1416 | /** |
@@ -1424,17 +1423,17 @@ discard block |
||
| 1424 | 1423 | * @return array Liste de chemins |
| 1425 | 1424 | **/ |
| 1426 | 1425 | function creer_chemin() { |
| 1427 | - $path_a = _chemin(); |
|
| 1428 | - static $c = ''; |
|
| 1426 | + $path_a = _chemin(); |
|
| 1427 | + static $c = ''; |
|
| 1429 | 1428 | |
| 1430 | - // on calcule le chemin si le dossier skel a change |
|
| 1431 | - if ($c != $GLOBALS['dossier_squelettes']) { |
|
| 1432 | - // assurer le non plantage lors de la montee de version : |
|
| 1433 | - $c = $GLOBALS['dossier_squelettes']; |
|
| 1434 | - $path_a = _chemin(''); // forcer un recalcul du chemin |
|
| 1435 | - } |
|
| 1429 | + // on calcule le chemin si le dossier skel a change |
|
| 1430 | + if ($c != $GLOBALS['dossier_squelettes']) { |
|
| 1431 | + // assurer le non plantage lors de la montee de version : |
|
| 1432 | + $c = $GLOBALS['dossier_squelettes']; |
|
| 1433 | + $path_a = _chemin(''); // forcer un recalcul du chemin |
|
| 1434 | + } |
|
| 1436 | 1435 | |
| 1437 | - return $path_a; |
|
| 1436 | + return $path_a; |
|
| 1438 | 1437 | } |
| 1439 | 1438 | |
| 1440 | 1439 | |
@@ -1446,61 +1445,61 @@ discard block |
||
| 1446 | 1445 | * @return string[] Nom des thèmes. |
| 1447 | 1446 | */ |
| 1448 | 1447 | function lister_themes_prives(): array { |
| 1449 | - static $themes = null; |
|
| 1450 | - if (is_null($themes)) { |
|
| 1451 | - // si pas encore definie |
|
| 1452 | - if (!defined('_SPIP_THEME_PRIVE')) { |
|
| 1453 | - define('_SPIP_THEME_PRIVE', 'spip'); |
|
| 1454 | - } |
|
| 1455 | - $themes = [_SPIP_THEME_PRIVE]; |
|
| 1456 | - // Lors d'une installation neuve, prefs n'est pas definie ; sinon, c'est un tableau sérialisé |
|
| 1457 | - // FIXME: Aussitôt après une demande d'inscription, $prefs vaut une chaine statut_tmp; |
|
| 1458 | - $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 1459 | - if (is_string($prefs) and (stripos($prefs, 'a:') === 0)) { |
|
| 1460 | - $prefs = unserialize($prefs); |
|
| 1461 | - } else { |
|
| 1462 | - $prefs = []; |
|
| 1463 | - } |
|
| 1464 | - |
|
| 1465 | - $theme = $prefs['theme'] ?? $GLOBALS['theme_prive_defaut'] ?? null; |
|
| 1466 | - if ($theme and $theme !== _SPIP_THEME_PRIVE) { |
|
| 1467 | - // placer le theme choisi en tete |
|
| 1468 | - array_unshift($themes, $theme); |
|
| 1469 | - } |
|
| 1470 | - } |
|
| 1471 | - |
|
| 1472 | - return $themes; |
|
| 1448 | + static $themes = null; |
|
| 1449 | + if (is_null($themes)) { |
|
| 1450 | + // si pas encore definie |
|
| 1451 | + if (!defined('_SPIP_THEME_PRIVE')) { |
|
| 1452 | + define('_SPIP_THEME_PRIVE', 'spip'); |
|
| 1453 | + } |
|
| 1454 | + $themes = [_SPIP_THEME_PRIVE]; |
|
| 1455 | + // Lors d'une installation neuve, prefs n'est pas definie ; sinon, c'est un tableau sérialisé |
|
| 1456 | + // FIXME: Aussitôt après une demande d'inscription, $prefs vaut une chaine statut_tmp; |
|
| 1457 | + $prefs = $GLOBALS['visiteur_session']['prefs'] ?? []; |
|
| 1458 | + if (is_string($prefs) and (stripos($prefs, 'a:') === 0)) { |
|
| 1459 | + $prefs = unserialize($prefs); |
|
| 1460 | + } else { |
|
| 1461 | + $prefs = []; |
|
| 1462 | + } |
|
| 1463 | + |
|
| 1464 | + $theme = $prefs['theme'] ?? $GLOBALS['theme_prive_defaut'] ?? null; |
|
| 1465 | + if ($theme and $theme !== _SPIP_THEME_PRIVE) { |
|
| 1466 | + // placer le theme choisi en tete |
|
| 1467 | + array_unshift($themes, $theme); |
|
| 1468 | + } |
|
| 1469 | + } |
|
| 1470 | + |
|
| 1471 | + return $themes; |
|
| 1473 | 1472 | } |
| 1474 | 1473 | |
| 1475 | 1474 | function find_in_theme($file, $subdir = '', $include = false) { |
| 1476 | - static $themefiles = []; |
|
| 1477 | - if (isset($themefiles["$subdir$file"])) { |
|
| 1478 | - return $themefiles["$subdir$file"]; |
|
| 1479 | - } |
|
| 1480 | - // on peut fournir une icone generique -xx.svg qui fera le job dans toutes les tailles, et qui est prioritaire sur le png |
|
| 1481 | - // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
|
| 1482 | - if ( |
|
| 1483 | - preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m) |
|
| 1484 | - and $file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg' |
|
| 1485 | - and $f = find_in_theme("$file_svg_generique") |
|
| 1486 | - ) { |
|
| 1487 | - if ($fsize = substr($f, 0, -6) . $m[1] . '.svg' and file_exists($fsize)) { |
|
| 1488 | - return $themefiles["$subdir$file"] = $fsize; |
|
| 1489 | - } |
|
| 1490 | - else { |
|
| 1491 | - return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px'; |
|
| 1492 | - } |
|
| 1493 | - } |
|
| 1494 | - |
|
| 1495 | - $themes = lister_themes_prives(); |
|
| 1496 | - foreach ($themes as $theme) { |
|
| 1497 | - if ($f = find_in_path($file, "prive/themes/$theme/$subdir", $include)) { |
|
| 1498 | - return $themefiles["$subdir$file"] = $f; |
|
| 1499 | - } |
|
| 1500 | - } |
|
| 1501 | - spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme'); |
|
| 1502 | - |
|
| 1503 | - return $themefiles["$subdir$file"] = ''; |
|
| 1475 | + static $themefiles = []; |
|
| 1476 | + if (isset($themefiles["$subdir$file"])) { |
|
| 1477 | + return $themefiles["$subdir$file"]; |
|
| 1478 | + } |
|
| 1479 | + // on peut fournir une icone generique -xx.svg qui fera le job dans toutes les tailles, et qui est prioritaire sur le png |
|
| 1480 | + // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
|
| 1481 | + if ( |
|
| 1482 | + preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m) |
|
| 1483 | + and $file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg' |
|
| 1484 | + and $f = find_in_theme("$file_svg_generique") |
|
| 1485 | + ) { |
|
| 1486 | + if ($fsize = substr($f, 0, -6) . $m[1] . '.svg' and file_exists($fsize)) { |
|
| 1487 | + return $themefiles["$subdir$file"] = $fsize; |
|
| 1488 | + } |
|
| 1489 | + else { |
|
| 1490 | + return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px'; |
|
| 1491 | + } |
|
| 1492 | + } |
|
| 1493 | + |
|
| 1494 | + $themes = lister_themes_prives(); |
|
| 1495 | + foreach ($themes as $theme) { |
|
| 1496 | + if ($f = find_in_path($file, "prive/themes/$theme/$subdir", $include)) { |
|
| 1497 | + return $themefiles["$subdir$file"] = $f; |
|
| 1498 | + } |
|
| 1499 | + } |
|
| 1500 | + spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme'); |
|
| 1501 | + |
|
| 1502 | + return $themefiles["$subdir$file"] = ''; |
|
| 1504 | 1503 | } |
| 1505 | 1504 | |
| 1506 | 1505 | |
@@ -1524,31 +1523,31 @@ discard block |
||
| 1524 | 1523 | * sinon chaîne vide. |
| 1525 | 1524 | **/ |
| 1526 | 1525 | function chemin_image($icone) { |
| 1527 | - static $icone_renommer; |
|
| 1528 | - if ($p = strpos($icone, '?')) { |
|
| 1529 | - $icone = substr($icone, 0, $p); |
|
| 1530 | - } |
|
| 1531 | - // gerer le cas d'un double appel en evitant de refaire le travail inutilement |
|
| 1532 | - if (strpos($icone, '/') !== false and file_exists($icone)) { |
|
| 1533 | - return $icone; |
|
| 1534 | - } |
|
| 1535 | - |
|
| 1536 | - // si c'est un nom d'image complet (article-24.png) essayer de le renvoyer direct |
|
| 1537 | - if (preg_match(',[.](png|gif|jpg|webp|svg)$,', $icone) and $f = find_in_theme("images/$icone")) { |
|
| 1538 | - return $f; |
|
| 1539 | - } |
|
| 1540 | - // sinon passer par le module de renommage |
|
| 1541 | - if (is_null($icone_renommer)) { |
|
| 1542 | - $icone_renommer = charger_fonction('icone_renommer', 'inc', true); |
|
| 1543 | - } |
|
| 1544 | - if ($icone_renommer) { |
|
| 1545 | - [$icone, $fonction] = $icone_renommer($icone, ''); |
|
| 1546 | - if (file_exists($icone)) { |
|
| 1547 | - return $icone; |
|
| 1548 | - } |
|
| 1549 | - } |
|
| 1550 | - |
|
| 1551 | - return find_in_path($icone, _NOM_IMG_PACK); |
|
| 1526 | + static $icone_renommer; |
|
| 1527 | + if ($p = strpos($icone, '?')) { |
|
| 1528 | + $icone = substr($icone, 0, $p); |
|
| 1529 | + } |
|
| 1530 | + // gerer le cas d'un double appel en evitant de refaire le travail inutilement |
|
| 1531 | + if (strpos($icone, '/') !== false and file_exists($icone)) { |
|
| 1532 | + return $icone; |
|
| 1533 | + } |
|
| 1534 | + |
|
| 1535 | + // si c'est un nom d'image complet (article-24.png) essayer de le renvoyer direct |
|
| 1536 | + if (preg_match(',[.](png|gif|jpg|webp|svg)$,', $icone) and $f = find_in_theme("images/$icone")) { |
|
| 1537 | + return $f; |
|
| 1538 | + } |
|
| 1539 | + // sinon passer par le module de renommage |
|
| 1540 | + if (is_null($icone_renommer)) { |
|
| 1541 | + $icone_renommer = charger_fonction('icone_renommer', 'inc', true); |
|
| 1542 | + } |
|
| 1543 | + if ($icone_renommer) { |
|
| 1544 | + [$icone, $fonction] = $icone_renommer($icone, ''); |
|
| 1545 | + if (file_exists($icone)) { |
|
| 1546 | + return $icone; |
|
| 1547 | + } |
|
| 1548 | + } |
|
| 1549 | + |
|
| 1550 | + return find_in_path($icone, _NOM_IMG_PACK); |
|
| 1552 | 1551 | } |
| 1553 | 1552 | |
| 1554 | 1553 | // |
@@ -1586,128 +1585,128 @@ discard block |
||
| 1586 | 1585 | * - false : fichier introuvable |
| 1587 | 1586 | **/ |
| 1588 | 1587 | function find_in_path($file, $dirname = '', $include = false) { |
| 1589 | - static $dirs = []; |
|
| 1590 | - static $inc = []; # cf https://git.spip.net/spip/spip/commit/42e4e028e38c839121efaee84308d08aee307eec |
|
| 1591 | - static $c = ''; |
|
| 1592 | - |
|
| 1593 | - if (!$file and !strlen($file)) { |
|
| 1594 | - return false; |
|
| 1595 | - } |
|
| 1596 | - |
|
| 1597 | - // on calcule le chemin si le dossier skel a change |
|
| 1598 | - if ($c != $GLOBALS['dossier_squelettes']) { |
|
| 1599 | - // assurer le non plantage lors de la montee de version : |
|
| 1600 | - $c = $GLOBALS['dossier_squelettes']; |
|
| 1601 | - creer_chemin(); // forcer un recalcul du chemin et la mise a jour de path_sig |
|
| 1602 | - } |
|
| 1603 | - |
|
| 1604 | - if (isset($GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file])) { |
|
| 1605 | - if (!$GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]) { |
|
| 1606 | - return false; |
|
| 1607 | - } |
|
| 1608 | - if ($include and !isset($inc[$dirname][$file])) { |
|
| 1609 | - include_once _ROOT_CWD . $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
|
| 1610 | - $inc[$dirname][$file] = $inc[''][$dirname . $file] = true; |
|
| 1611 | - } |
|
| 1612 | - |
|
| 1613 | - return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
|
| 1614 | - } |
|
| 1615 | - |
|
| 1616 | - $a = strrpos($file, '/'); |
|
| 1617 | - if ($a !== false) { |
|
| 1618 | - $dirname .= substr($file, 0, ++$a); |
|
| 1619 | - $file = substr($file, $a); |
|
| 1620 | - } |
|
| 1621 | - |
|
| 1622 | - foreach (creer_chemin() as $dir) { |
|
| 1623 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 1624 | - $dirs[$a] = (is_dir(_ROOT_CWD . $a) || !$a); |
|
| 1625 | - } |
|
| 1626 | - if ($dirs[$a]) { |
|
| 1627 | - if (file_exists(_ROOT_CWD . ($a .= $file))) { |
|
| 1628 | - if ($include and !isset($inc[$dirname][$file])) { |
|
| 1629 | - include_once _ROOT_CWD . $a; |
|
| 1630 | - $inc[$dirname][$file] = $inc[''][$dirname . $file] = true; |
|
| 1631 | - } |
|
| 1632 | - if (!defined('_SAUVER_CHEMIN')) { |
|
| 1633 | - // si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher |
|
| 1634 | - if (is_null($GLOBALS['path_files'])) { |
|
| 1635 | - return $a; |
|
| 1636 | - } |
|
| 1637 | - define('_SAUVER_CHEMIN', true); |
|
| 1638 | - } |
|
| 1639 | - |
|
| 1640 | - return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = $a; |
|
| 1641 | - } |
|
| 1642 | - } |
|
| 1643 | - } |
|
| 1644 | - |
|
| 1645 | - if ($include) { |
|
| 1646 | - spip_log("include_spip $dirname$file non trouve"); |
|
| 1647 | - if ($include === 'required') { |
|
| 1648 | - echo '<pre>', |
|
| 1649 | - '<strong>Erreur Fatale</strong><br />'; |
|
| 1650 | - if (function_exists('debug_print_backtrace')) { |
|
| 1651 | - debug_print_backtrace(); |
|
| 1652 | - } |
|
| 1653 | - echo '</pre>'; |
|
| 1654 | - die("Erreur interne: ne peut inclure $dirname$file"); |
|
| 1655 | - } |
|
| 1656 | - } |
|
| 1657 | - |
|
| 1658 | - if (!defined('_SAUVER_CHEMIN')) { |
|
| 1659 | - // si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher |
|
| 1660 | - if (is_null($GLOBALS['path_files'])) { |
|
| 1661 | - return false; |
|
| 1662 | - } |
|
| 1663 | - define('_SAUVER_CHEMIN', true); |
|
| 1664 | - } |
|
| 1665 | - |
|
| 1666 | - return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = false; |
|
| 1588 | + static $dirs = []; |
|
| 1589 | + static $inc = []; # cf https://git.spip.net/spip/spip/commit/42e4e028e38c839121efaee84308d08aee307eec |
|
| 1590 | + static $c = ''; |
|
| 1591 | + |
|
| 1592 | + if (!$file and !strlen($file)) { |
|
| 1593 | + return false; |
|
| 1594 | + } |
|
| 1595 | + |
|
| 1596 | + // on calcule le chemin si le dossier skel a change |
|
| 1597 | + if ($c != $GLOBALS['dossier_squelettes']) { |
|
| 1598 | + // assurer le non plantage lors de la montee de version : |
|
| 1599 | + $c = $GLOBALS['dossier_squelettes']; |
|
| 1600 | + creer_chemin(); // forcer un recalcul du chemin et la mise a jour de path_sig |
|
| 1601 | + } |
|
| 1602 | + |
|
| 1603 | + if (isset($GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file])) { |
|
| 1604 | + if (!$GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]) { |
|
| 1605 | + return false; |
|
| 1606 | + } |
|
| 1607 | + if ($include and !isset($inc[$dirname][$file])) { |
|
| 1608 | + include_once _ROOT_CWD . $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
|
| 1609 | + $inc[$dirname][$file] = $inc[''][$dirname . $file] = true; |
|
| 1610 | + } |
|
| 1611 | + |
|
| 1612 | + return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file]; |
|
| 1613 | + } |
|
| 1614 | + |
|
| 1615 | + $a = strrpos($file, '/'); |
|
| 1616 | + if ($a !== false) { |
|
| 1617 | + $dirname .= substr($file, 0, ++$a); |
|
| 1618 | + $file = substr($file, $a); |
|
| 1619 | + } |
|
| 1620 | + |
|
| 1621 | + foreach (creer_chemin() as $dir) { |
|
| 1622 | + if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 1623 | + $dirs[$a] = (is_dir(_ROOT_CWD . $a) || !$a); |
|
| 1624 | + } |
|
| 1625 | + if ($dirs[$a]) { |
|
| 1626 | + if (file_exists(_ROOT_CWD . ($a .= $file))) { |
|
| 1627 | + if ($include and !isset($inc[$dirname][$file])) { |
|
| 1628 | + include_once _ROOT_CWD . $a; |
|
| 1629 | + $inc[$dirname][$file] = $inc[''][$dirname . $file] = true; |
|
| 1630 | + } |
|
| 1631 | + if (!defined('_SAUVER_CHEMIN')) { |
|
| 1632 | + // si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher |
|
| 1633 | + if (is_null($GLOBALS['path_files'])) { |
|
| 1634 | + return $a; |
|
| 1635 | + } |
|
| 1636 | + define('_SAUVER_CHEMIN', true); |
|
| 1637 | + } |
|
| 1638 | + |
|
| 1639 | + return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = $a; |
|
| 1640 | + } |
|
| 1641 | + } |
|
| 1642 | + } |
|
| 1643 | + |
|
| 1644 | + if ($include) { |
|
| 1645 | + spip_log("include_spip $dirname$file non trouve"); |
|
| 1646 | + if ($include === 'required') { |
|
| 1647 | + echo '<pre>', |
|
| 1648 | + '<strong>Erreur Fatale</strong><br />'; |
|
| 1649 | + if (function_exists('debug_print_backtrace')) { |
|
| 1650 | + debug_print_backtrace(); |
|
| 1651 | + } |
|
| 1652 | + echo '</pre>'; |
|
| 1653 | + die("Erreur interne: ne peut inclure $dirname$file"); |
|
| 1654 | + } |
|
| 1655 | + } |
|
| 1656 | + |
|
| 1657 | + if (!defined('_SAUVER_CHEMIN')) { |
|
| 1658 | + // si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher |
|
| 1659 | + if (is_null($GLOBALS['path_files'])) { |
|
| 1660 | + return false; |
|
| 1661 | + } |
|
| 1662 | + define('_SAUVER_CHEMIN', true); |
|
| 1663 | + } |
|
| 1664 | + |
|
| 1665 | + return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = false; |
|
| 1667 | 1666 | } |
| 1668 | 1667 | |
| 1669 | 1668 | function clear_path_cache() { |
| 1670 | - $GLOBALS['path_files'] = []; |
|
| 1671 | - spip_unlink(_CACHE_CHEMIN); |
|
| 1669 | + $GLOBALS['path_files'] = []; |
|
| 1670 | + spip_unlink(_CACHE_CHEMIN); |
|
| 1672 | 1671 | } |
| 1673 | 1672 | |
| 1674 | 1673 | function load_path_cache() { |
| 1675 | - // charger le path des plugins |
|
| 1676 | - if (@is_readable(_CACHE_PLUGINS_PATH)) { |
|
| 1677 | - include_once(_CACHE_PLUGINS_PATH); |
|
| 1678 | - } |
|
| 1679 | - $GLOBALS['path_files'] = []; |
|
| 1680 | - // si le visiteur est admin, |
|
| 1681 | - // on ne recharge pas le cache pour forcer sa mise a jour |
|
| 1682 | - if ( |
|
| 1683 | - // la session n'est pas encore chargee a ce moment, on ne peut donc pas s'y fier |
|
| 1684 | - //AND (!isset($GLOBALS['visiteur_session']['statut']) OR $GLOBALS['visiteur_session']['statut']!='0minirezo') |
|
| 1685 | - // utiliser le cookie est un pis aller qui marche 'en general' |
|
| 1686 | - // on blinde par un second test au moment de la lecture de la session |
|
| 1687 | - // !isset($_COOKIE[$GLOBALS['cookie_prefix'].'_admin']) |
|
| 1688 | - // et en ignorant ce cache en cas de recalcul explicite |
|
| 1689 | - !_request('var_mode') |
|
| 1690 | - ) { |
|
| 1691 | - // on essaye de lire directement sans verrou pour aller plus vite |
|
| 1692 | - if ($contenu = spip_file_get_contents(_CACHE_CHEMIN)) { |
|
| 1693 | - // mais si semble corrompu on relit avec un verrou |
|
| 1694 | - if (!$GLOBALS['path_files'] = unserialize($contenu)) { |
|
| 1695 | - lire_fichier(_CACHE_CHEMIN, $contenu); |
|
| 1696 | - if (!$GLOBALS['path_files'] = unserialize($contenu)) { |
|
| 1697 | - $GLOBALS['path_files'] = []; |
|
| 1698 | - } |
|
| 1699 | - } |
|
| 1700 | - } |
|
| 1701 | - } |
|
| 1674 | + // charger le path des plugins |
|
| 1675 | + if (@is_readable(_CACHE_PLUGINS_PATH)) { |
|
| 1676 | + include_once(_CACHE_PLUGINS_PATH); |
|
| 1677 | + } |
|
| 1678 | + $GLOBALS['path_files'] = []; |
|
| 1679 | + // si le visiteur est admin, |
|
| 1680 | + // on ne recharge pas le cache pour forcer sa mise a jour |
|
| 1681 | + if ( |
|
| 1682 | + // la session n'est pas encore chargee a ce moment, on ne peut donc pas s'y fier |
|
| 1683 | + //AND (!isset($GLOBALS['visiteur_session']['statut']) OR $GLOBALS['visiteur_session']['statut']!='0minirezo') |
|
| 1684 | + // utiliser le cookie est un pis aller qui marche 'en general' |
|
| 1685 | + // on blinde par un second test au moment de la lecture de la session |
|
| 1686 | + // !isset($_COOKIE[$GLOBALS['cookie_prefix'].'_admin']) |
|
| 1687 | + // et en ignorant ce cache en cas de recalcul explicite |
|
| 1688 | + !_request('var_mode') |
|
| 1689 | + ) { |
|
| 1690 | + // on essaye de lire directement sans verrou pour aller plus vite |
|
| 1691 | + if ($contenu = spip_file_get_contents(_CACHE_CHEMIN)) { |
|
| 1692 | + // mais si semble corrompu on relit avec un verrou |
|
| 1693 | + if (!$GLOBALS['path_files'] = unserialize($contenu)) { |
|
| 1694 | + lire_fichier(_CACHE_CHEMIN, $contenu); |
|
| 1695 | + if (!$GLOBALS['path_files'] = unserialize($contenu)) { |
|
| 1696 | + $GLOBALS['path_files'] = []; |
|
| 1697 | + } |
|
| 1698 | + } |
|
| 1699 | + } |
|
| 1700 | + } |
|
| 1702 | 1701 | } |
| 1703 | 1702 | |
| 1704 | 1703 | function save_path_cache() { |
| 1705 | - if ( |
|
| 1706 | - defined('_SAUVER_CHEMIN') |
|
| 1707 | - and _SAUVER_CHEMIN |
|
| 1708 | - ) { |
|
| 1709 | - ecrire_fichier(_CACHE_CHEMIN, serialize($GLOBALS['path_files'])); |
|
| 1710 | - } |
|
| 1704 | + if ( |
|
| 1705 | + defined('_SAUVER_CHEMIN') |
|
| 1706 | + and _SAUVER_CHEMIN |
|
| 1707 | + ) { |
|
| 1708 | + ecrire_fichier(_CACHE_CHEMIN, serialize($GLOBALS['path_files'])); |
|
| 1709 | + } |
|
| 1711 | 1710 | } |
| 1712 | 1711 | |
| 1713 | 1712 | |
@@ -1727,33 +1726,33 @@ discard block |
||
| 1727 | 1726 | * @return array |
| 1728 | 1727 | */ |
| 1729 | 1728 | function find_all_in_path($dir, $pattern, $recurs = false) { |
| 1730 | - $liste_fichiers = []; |
|
| 1731 | - $maxfiles = 10000; |
|
| 1732 | - |
|
| 1733 | - // cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue |
|
| 1734 | - // on a pas encore inclus flock.php |
|
| 1735 | - if (!function_exists('preg_files')) { |
|
| 1736 | - include_once _ROOT_RESTREINT . 'inc/flock.php'; |
|
| 1737 | - } |
|
| 1738 | - |
|
| 1739 | - // Parcourir le chemin |
|
| 1740 | - foreach (creer_chemin() as $d) { |
|
| 1741 | - $f = $d . $dir; |
|
| 1742 | - if (@is_dir($f)) { |
|
| 1743 | - $liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs); |
|
| 1744 | - foreach ($liste as $chemin) { |
|
| 1745 | - $nom = basename($chemin); |
|
| 1746 | - // ne prendre que les fichiers pas deja trouves |
|
| 1747 | - // car find_in_path prend le premier qu'il trouve, |
|
| 1748 | - // les autres sont donc masques |
|
| 1749 | - if (!isset($liste_fichiers[$nom])) { |
|
| 1750 | - $liste_fichiers[$nom] = $chemin; |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1753 | - } |
|
| 1754 | - } |
|
| 1755 | - |
|
| 1756 | - return $liste_fichiers; |
|
| 1729 | + $liste_fichiers = []; |
|
| 1730 | + $maxfiles = 10000; |
|
| 1731 | + |
|
| 1732 | + // cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue |
|
| 1733 | + // on a pas encore inclus flock.php |
|
| 1734 | + if (!function_exists('preg_files')) { |
|
| 1735 | + include_once _ROOT_RESTREINT . 'inc/flock.php'; |
|
| 1736 | + } |
|
| 1737 | + |
|
| 1738 | + // Parcourir le chemin |
|
| 1739 | + foreach (creer_chemin() as $d) { |
|
| 1740 | + $f = $d . $dir; |
|
| 1741 | + if (@is_dir($f)) { |
|
| 1742 | + $liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs); |
|
| 1743 | + foreach ($liste as $chemin) { |
|
| 1744 | + $nom = basename($chemin); |
|
| 1745 | + // ne prendre que les fichiers pas deja trouves |
|
| 1746 | + // car find_in_path prend le premier qu'il trouve, |
|
| 1747 | + // les autres sont donc masques |
|
| 1748 | + if (!isset($liste_fichiers[$nom])) { |
|
| 1749 | + $liste_fichiers[$nom] = $chemin; |
|
| 1750 | + } |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | + } |
|
| 1754 | + |
|
| 1755 | + return $liste_fichiers; |
|
| 1757 | 1756 | } |
| 1758 | 1757 | |
| 1759 | 1758 | /** |
@@ -1765,17 +1764,17 @@ discard block |
||
| 1765 | 1764 | * @return bool |
| 1766 | 1765 | */ |
| 1767 | 1766 | function autoriser_sans_cookie($nom, $strict = false) { |
| 1768 | - static $autsanscookie = ['install', 'base_repair']; |
|
| 1767 | + static $autsanscookie = ['install', 'base_repair']; |
|
| 1769 | 1768 | |
| 1770 | - if (in_array($nom, $autsanscookie)) { |
|
| 1771 | - if (test_espace_prive()) { |
|
| 1772 | - include_spip('base/connect_sql'); |
|
| 1773 | - if (!$strict or !spip_connect()) { |
|
| 1774 | - return true; |
|
| 1775 | - } |
|
| 1776 | - } |
|
| 1777 | - } |
|
| 1778 | - return false; |
|
| 1769 | + if (in_array($nom, $autsanscookie)) { |
|
| 1770 | + if (test_espace_prive()) { |
|
| 1771 | + include_spip('base/connect_sql'); |
|
| 1772 | + if (!$strict or !spip_connect()) { |
|
| 1773 | + return true; |
|
| 1774 | + } |
|
| 1775 | + } |
|
| 1776 | + } |
|
| 1777 | + return false; |
|
| 1779 | 1778 | } |
| 1780 | 1779 | |
| 1781 | 1780 | /** |
@@ -1785,60 +1784,60 @@ discard block |
||
| 1785 | 1784 | * @return string |
| 1786 | 1785 | */ |
| 1787 | 1786 | function charger_fonction_url(string $quoi, string $type = '') { |
| 1788 | - if ($type === 'defaut') { |
|
| 1789 | - $objet = objet_type($quoi); |
|
| 1790 | - if ( |
|
| 1791 | - $f = charger_fonction('generer_' . $objet . '_url', 'urls', true) |
|
| 1792 | - // deprecated |
|
| 1793 | - or $f = charger_fonction('generer_url_' . $objet, 'urls', true) |
|
| 1794 | - ) { |
|
| 1795 | - return $f; |
|
| 1796 | - } |
|
| 1797 | - return ''; |
|
| 1798 | - } |
|
| 1799 | - |
|
| 1800 | - $url_type = $type; |
|
| 1801 | - if (!$url_type) { |
|
| 1802 | - $url_type = $GLOBALS['type_urls'] ?? $GLOBALS['meta']['type_urls'] ?? 'page'; // sinon type "page" par défaut |
|
| 1803 | - } |
|
| 1804 | - |
|
| 1805 | - // inclure le module d'url |
|
| 1806 | - include_spip('urls/' . $url_type); |
|
| 1807 | - |
|
| 1808 | - switch ($quoi) { |
|
| 1809 | - case 'page': |
|
| 1810 | - if ( |
|
| 1811 | - function_exists($f = "urls_{$url_type}_generer_url_page") |
|
| 1812 | - or function_exists($f .= '_dist') |
|
| 1813 | - // ou une fonction custom utilisateur independante du type d'url |
|
| 1814 | - or function_exists($f = 'generer_url_page') |
|
| 1815 | - or function_exists($f .= '_dist') |
|
| 1816 | - ) { |
|
| 1817 | - return $f; |
|
| 1818 | - } |
|
| 1819 | - // pas de compat ancienne version ici, c'est une nouvelle feature |
|
| 1820 | - return ''; |
|
| 1821 | - case 'objet': |
|
| 1822 | - case 'decoder': |
|
| 1823 | - default: |
|
| 1824 | - $fquoi = ($quoi === 'objet' ? 'generer_url_objet' : 'decoder_url'); |
|
| 1825 | - if ( |
|
| 1826 | - function_exists($f = "urls_{$url_type}_{$fquoi}") |
|
| 1827 | - or function_exists($f .= '_dist') |
|
| 1828 | - ) { |
|
| 1829 | - return $f; |
|
| 1830 | - } |
|
| 1831 | - // est-ce qu'on a une ancienne fonction urls_xxx_dist() ? |
|
| 1832 | - // c'est un ancien module d'url, on appelle l'ancienne fonction qui fait tout |
|
| 1833 | - if ($f = charger_fonction($url_type, 'urls', true)) { |
|
| 1834 | - return $f; |
|
| 1835 | - } |
|
| 1836 | - // sinon on se rabat sur les urls page si ce n'est pas un type demande explicitement |
|
| 1837 | - if (!$type and $url_type !== 'page') { |
|
| 1838 | - return charger_fonction_url($quoi, 'page'); |
|
| 1839 | - } |
|
| 1840 | - return ''; |
|
| 1841 | - } |
|
| 1787 | + if ($type === 'defaut') { |
|
| 1788 | + $objet = objet_type($quoi); |
|
| 1789 | + if ( |
|
| 1790 | + $f = charger_fonction('generer_' . $objet . '_url', 'urls', true) |
|
| 1791 | + // deprecated |
|
| 1792 | + or $f = charger_fonction('generer_url_' . $objet, 'urls', true) |
|
| 1793 | + ) { |
|
| 1794 | + return $f; |
|
| 1795 | + } |
|
| 1796 | + return ''; |
|
| 1797 | + } |
|
| 1798 | + |
|
| 1799 | + $url_type = $type; |
|
| 1800 | + if (!$url_type) { |
|
| 1801 | + $url_type = $GLOBALS['type_urls'] ?? $GLOBALS['meta']['type_urls'] ?? 'page'; // sinon type "page" par défaut |
|
| 1802 | + } |
|
| 1803 | + |
|
| 1804 | + // inclure le module d'url |
|
| 1805 | + include_spip('urls/' . $url_type); |
|
| 1806 | + |
|
| 1807 | + switch ($quoi) { |
|
| 1808 | + case 'page': |
|
| 1809 | + if ( |
|
| 1810 | + function_exists($f = "urls_{$url_type}_generer_url_page") |
|
| 1811 | + or function_exists($f .= '_dist') |
|
| 1812 | + // ou une fonction custom utilisateur independante du type d'url |
|
| 1813 | + or function_exists($f = 'generer_url_page') |
|
| 1814 | + or function_exists($f .= '_dist') |
|
| 1815 | + ) { |
|
| 1816 | + return $f; |
|
| 1817 | + } |
|
| 1818 | + // pas de compat ancienne version ici, c'est une nouvelle feature |
|
| 1819 | + return ''; |
|
| 1820 | + case 'objet': |
|
| 1821 | + case 'decoder': |
|
| 1822 | + default: |
|
| 1823 | + $fquoi = ($quoi === 'objet' ? 'generer_url_objet' : 'decoder_url'); |
|
| 1824 | + if ( |
|
| 1825 | + function_exists($f = "urls_{$url_type}_{$fquoi}") |
|
| 1826 | + or function_exists($f .= '_dist') |
|
| 1827 | + ) { |
|
| 1828 | + return $f; |
|
| 1829 | + } |
|
| 1830 | + // est-ce qu'on a une ancienne fonction urls_xxx_dist() ? |
|
| 1831 | + // c'est un ancien module d'url, on appelle l'ancienne fonction qui fait tout |
|
| 1832 | + if ($f = charger_fonction($url_type, 'urls', true)) { |
|
| 1833 | + return $f; |
|
| 1834 | + } |
|
| 1835 | + // sinon on se rabat sur les urls page si ce n'est pas un type demande explicitement |
|
| 1836 | + if (!$type and $url_type !== 'page') { |
|
| 1837 | + return charger_fonction_url($quoi, 'page'); |
|
| 1838 | + } |
|
| 1839 | + return ''; |
|
| 1840 | + } |
|
| 1842 | 1841 | } |
| 1843 | 1842 | |
| 1844 | 1843 | |
@@ -1864,48 +1863,48 @@ discard block |
||
| 1864 | 1863 | * url codee ou fonction de decodage |
| 1865 | 1864 | */ |
| 1866 | 1865 | function generer_objet_url($id, string $entite, string $args = '', string $ancre = '', ?bool $public = null, string $type = '', string $connect = ''): string { |
| 1867 | - if ($public === null) { |
|
| 1868 | - $public = !test_espace_prive(); |
|
| 1869 | - } |
|
| 1870 | - $id = intval($id); |
|
| 1871 | - $entite = objet_type($entite); // cas particulier d'appels sur objet/id_objet... |
|
| 1872 | - |
|
| 1873 | - if (!$public) { |
|
| 1874 | - if (!$entite) { |
|
| 1875 | - return ''; |
|
| 1876 | - } |
|
| 1877 | - if (!function_exists('generer_objet_url_ecrire')) { |
|
| 1878 | - include_spip('inc/urls'); |
|
| 1879 | - } |
|
| 1880 | - $res = generer_objet_url_ecrire($id, $entite, $args, $ancre, false, $connect); |
|
| 1881 | - } else { |
|
| 1882 | - $f = charger_fonction_url('objet', $type ?? ''); |
|
| 1883 | - |
|
| 1884 | - // @deprecated si $entite='', on veut la fonction de passage URL ==> id |
|
| 1885 | - // @see charger_fonction_url |
|
| 1886 | - if (!$entite) { |
|
| 1887 | - return $f; |
|
| 1888 | - } |
|
| 1889 | - |
|
| 1890 | - // mais d'abord il faut tester le cas des urls sur une |
|
| 1891 | - // base distante |
|
| 1892 | - if ( |
|
| 1893 | - $connect |
|
| 1894 | - and $g = charger_fonction('connect', 'urls', true) |
|
| 1895 | - ) { |
|
| 1896 | - $f = $g; |
|
| 1897 | - } |
|
| 1898 | - |
|
| 1899 | - $res = $f(intval($id), $entite, $args ?: '', $ancre ?: '', $connect); |
|
| 1900 | - } |
|
| 1901 | - if ($res) { |
|
| 1902 | - return $res; |
|
| 1903 | - } |
|
| 1904 | - |
|
| 1905 | - // On a ete gentil mais la .... |
|
| 1906 | - spip_log("generer_objet_url: entite $entite ($f) inconnue $type $public $connect", _LOG_ERREUR); |
|
| 1907 | - |
|
| 1908 | - return ''; |
|
| 1866 | + if ($public === null) { |
|
| 1867 | + $public = !test_espace_prive(); |
|
| 1868 | + } |
|
| 1869 | + $id = intval($id); |
|
| 1870 | + $entite = objet_type($entite); // cas particulier d'appels sur objet/id_objet... |
|
| 1871 | + |
|
| 1872 | + if (!$public) { |
|
| 1873 | + if (!$entite) { |
|
| 1874 | + return ''; |
|
| 1875 | + } |
|
| 1876 | + if (!function_exists('generer_objet_url_ecrire')) { |
|
| 1877 | + include_spip('inc/urls'); |
|
| 1878 | + } |
|
| 1879 | + $res = generer_objet_url_ecrire($id, $entite, $args, $ancre, false, $connect); |
|
| 1880 | + } else { |
|
| 1881 | + $f = charger_fonction_url('objet', $type ?? ''); |
|
| 1882 | + |
|
| 1883 | + // @deprecated si $entite='', on veut la fonction de passage URL ==> id |
|
| 1884 | + // @see charger_fonction_url |
|
| 1885 | + if (!$entite) { |
|
| 1886 | + return $f; |
|
| 1887 | + } |
|
| 1888 | + |
|
| 1889 | + // mais d'abord il faut tester le cas des urls sur une |
|
| 1890 | + // base distante |
|
| 1891 | + if ( |
|
| 1892 | + $connect |
|
| 1893 | + and $g = charger_fonction('connect', 'urls', true) |
|
| 1894 | + ) { |
|
| 1895 | + $f = $g; |
|
| 1896 | + } |
|
| 1897 | + |
|
| 1898 | + $res = $f(intval($id), $entite, $args ?: '', $ancre ?: '', $connect); |
|
| 1899 | + } |
|
| 1900 | + if ($res) { |
|
| 1901 | + return $res; |
|
| 1902 | + } |
|
| 1903 | + |
|
| 1904 | + // On a ete gentil mais la .... |
|
| 1905 | + spip_log("generer_objet_url: entite $entite ($f) inconnue $type $public $connect", _LOG_ERREUR); |
|
| 1906 | + |
|
| 1907 | + return ''; |
|
| 1909 | 1908 | } |
| 1910 | 1909 | |
| 1911 | 1910 | /** |
@@ -1913,10 +1912,10 @@ discard block |
||
| 1913 | 1912 | * @see generer_objet_url |
| 1914 | 1913 | */ |
| 1915 | 1914 | function generer_url_entite($id = 0, $entite = '', $args = '', $ancre = '', $public = null, $type = null) { |
| 1916 | - if ($public and is_string($public)) { |
|
| 1917 | - return generer_objet_url(intval($id), $entite, $args ?: '', $ancre ?: '', true, $type ?? '', $public); |
|
| 1918 | - } |
|
| 1919 | - return generer_objet_url(intval($id), $entite, $args ?: '', $ancre ?: '', $public, $type ?? ''); |
|
| 1915 | + if ($public and is_string($public)) { |
|
| 1916 | + return generer_objet_url(intval($id), $entite, $args ?: '', $ancre ?: '', true, $type ?? '', $public); |
|
| 1917 | + } |
|
| 1918 | + return generer_objet_url(intval($id), $entite, $args ?: '', $ancre ?: '', $public, $type ?? ''); |
|
| 1920 | 1919 | } |
| 1921 | 1920 | |
| 1922 | 1921 | /** |
@@ -1928,19 +1927,19 @@ discard block |
||
| 1928 | 1927 | * @return string |
| 1929 | 1928 | */ |
| 1930 | 1929 | function generer_objet_url_ecrire_edit($id, string $entite, string $args = '', string $ancre = ''): string { |
| 1931 | - $id = intval($id); |
|
| 1932 | - $exec = objet_info($entite, 'url_edit'); |
|
| 1933 | - $url = generer_url_ecrire($exec, $args); |
|
| 1934 | - if (intval($id)) { |
|
| 1935 | - $url = parametre_url($url, id_table_objet($entite), $id); |
|
| 1936 | - } else { |
|
| 1937 | - $url = parametre_url($url, 'new', 'oui'); |
|
| 1938 | - } |
|
| 1939 | - if ($ancre) { |
|
| 1940 | - $url = ancre_url($url, $ancre); |
|
| 1941 | - } |
|
| 1930 | + $id = intval($id); |
|
| 1931 | + $exec = objet_info($entite, 'url_edit'); |
|
| 1932 | + $url = generer_url_ecrire($exec, $args); |
|
| 1933 | + if (intval($id)) { |
|
| 1934 | + $url = parametre_url($url, id_table_objet($entite), $id); |
|
| 1935 | + } else { |
|
| 1936 | + $url = parametre_url($url, 'new', 'oui'); |
|
| 1937 | + } |
|
| 1938 | + if ($ancre) { |
|
| 1939 | + $url = ancre_url($url, $ancre); |
|
| 1940 | + } |
|
| 1942 | 1941 | |
| 1943 | - return $url; |
|
| 1942 | + return $url; |
|
| 1944 | 1943 | } |
| 1945 | 1944 | |
| 1946 | 1945 | /** |
@@ -1948,18 +1947,18 @@ discard block |
||
| 1948 | 1947 | * @see generer_objet_url_ecrire_edit |
| 1949 | 1948 | */ |
| 1950 | 1949 | function generer_url_ecrire_entite_edit($id, $entite, $args = '', $ancre = '') { |
| 1951 | - return generer_objet_url_ecrire_edit(intval($id), $entite, $args, $ancre); |
|
| 1950 | + return generer_objet_url_ecrire_edit(intval($id), $entite, $args, $ancre); |
|
| 1952 | 1951 | } |
| 1953 | 1952 | |
| 1954 | 1953 | |
| 1955 | 1954 | function urls_connect_dist($i, &$entite, $args = '', $ancre = '', $public = null) { |
| 1956 | - include_spip('base/connect_sql'); |
|
| 1957 | - $id_type = id_table_objet($entite, $public); |
|
| 1955 | + include_spip('base/connect_sql'); |
|
| 1956 | + $id_type = id_table_objet($entite, $public); |
|
| 1958 | 1957 | |
| 1959 | - return _DIR_RACINE . get_spip_script('./') |
|
| 1960 | - . '?' . _SPIP_PAGE . "=$entite&$id_type=$i&connect=$public" |
|
| 1961 | - . (!$args ? '' : "&$args") |
|
| 1962 | - . (!$ancre ? '' : "#$ancre"); |
|
| 1958 | + return _DIR_RACINE . get_spip_script('./') |
|
| 1959 | + . '?' . _SPIP_PAGE . "=$entite&$id_type=$i&connect=$public" |
|
| 1960 | + . (!$args ? '' : "&$args") |
|
| 1961 | + . (!$ancre ? '' : "#$ancre"); |
|
| 1963 | 1962 | } |
| 1964 | 1963 | |
| 1965 | 1964 | |
@@ -1970,18 +1969,18 @@ discard block |
||
| 1970 | 1969 | * @return string |
| 1971 | 1970 | */ |
| 1972 | 1971 | function urlencode_1738($url) { |
| 1973 | - if (preg_match(',[^\x00-\x7E],sS', $url)) { |
|
| 1974 | - $uri = ''; |
|
| 1975 | - for ($i = 0; $i < strlen($url); $i++) { |
|
| 1976 | - if (ord($a = $url[$i]) > 127) { |
|
| 1977 | - $a = rawurlencode($a); |
|
| 1978 | - } |
|
| 1979 | - $uri .= $a; |
|
| 1980 | - } |
|
| 1981 | - $url = $uri; |
|
| 1982 | - } |
|
| 1972 | + if (preg_match(',[^\x00-\x7E],sS', $url)) { |
|
| 1973 | + $uri = ''; |
|
| 1974 | + for ($i = 0; $i < strlen($url); $i++) { |
|
| 1975 | + if (ord($a = $url[$i]) > 127) { |
|
| 1976 | + $a = rawurlencode($a); |
|
| 1977 | + } |
|
| 1978 | + $uri .= $a; |
|
| 1979 | + } |
|
| 1980 | + $url = $uri; |
|
| 1981 | + } |
|
| 1983 | 1982 | |
| 1984 | - return quote_amp($url); |
|
| 1983 | + return quote_amp($url); |
|
| 1985 | 1984 | } |
| 1986 | 1985 | |
| 1987 | 1986 | /** |
@@ -1997,14 +1996,14 @@ discard block |
||
| 1997 | 1996 | * @return string |
| 1998 | 1997 | */ |
| 1999 | 1998 | function generer_objet_url_absolue($id = 0, string $entite = '', string $args = '', string $ancre = '', ?bool $public = null, string $type = '', string $connect = ''): string { |
| 2000 | - $id = intval($id); |
|
| 2001 | - $h = generer_objet_url($id, $entite, $args, $ancre, $public, $type, $connect); |
|
| 2002 | - if (!preg_match(',^\w+:,', $h)) { |
|
| 2003 | - include_spip('inc/filtres_mini'); |
|
| 2004 | - $h = url_absolue($h); |
|
| 2005 | - } |
|
| 1999 | + $id = intval($id); |
|
| 2000 | + $h = generer_objet_url($id, $entite, $args, $ancre, $public, $type, $connect); |
|
| 2001 | + if (!preg_match(',^\w+:,', $h)) { |
|
| 2002 | + include_spip('inc/filtres_mini'); |
|
| 2003 | + $h = url_absolue($h); |
|
| 2004 | + } |
|
| 2006 | 2005 | |
| 2007 | - return $h; |
|
| 2006 | + return $h; |
|
| 2008 | 2007 | } |
| 2009 | 2008 | |
| 2010 | 2009 | /** |
@@ -2012,7 +2011,7 @@ discard block |
||
| 2012 | 2011 | * @see generer_objet_url_absolue |
| 2013 | 2012 | */ |
| 2014 | 2013 | function generer_url_entite_absolue($id = 0, $entite = '', $args = '', $ancre = '', $connect = null) { |
| 2015 | - return generer_objet_url_absolue(intval($id), $entite, $args, $ancre, true, '', $connect ?? ''); |
|
| 2014 | + return generer_objet_url_absolue(intval($id), $entite, $args, $ancre, true, '', $connect ?? ''); |
|
| 2016 | 2015 | } |
| 2017 | 2016 | |
| 2018 | 2017 | |
@@ -2028,11 +2027,11 @@ discard block |
||
| 2028 | 2027 | * true si la valeur est considérée active ; false sinon. |
| 2029 | 2028 | **/ |
| 2030 | 2029 | function test_valeur_serveur($truc) { |
| 2031 | - if (!$truc) { |
|
| 2032 | - return false; |
|
| 2033 | - } |
|
| 2030 | + if (!$truc) { |
|
| 2031 | + return false; |
|
| 2032 | + } |
|
| 2034 | 2033 | |
| 2035 | - return (strtolower($truc) !== 'off'); |
|
| 2034 | + return (strtolower($truc) !== 'off'); |
|
| 2036 | 2035 | } |
| 2037 | 2036 | |
| 2038 | 2037 | // |
@@ -2060,89 +2059,89 @@ discard block |
||
| 2060 | 2059 | */ |
| 2061 | 2060 | function url_de_base($profondeur = null) { |
| 2062 | 2061 | |
| 2063 | - static $url = []; |
|
| 2064 | - if (is_array($profondeur)) { |
|
| 2065 | - return $url = $profondeur; |
|
| 2066 | - } |
|
| 2067 | - if ($profondeur === false) { |
|
| 2068 | - return $url; |
|
| 2069 | - } |
|
| 2070 | - |
|
| 2071 | - if (is_null($profondeur)) { |
|
| 2072 | - $profondeur = $GLOBALS['profondeur_url'] ?? (_DIR_RESTREINT ? 0 : 1); |
|
| 2073 | - } |
|
| 2074 | - |
|
| 2075 | - if (isset($url[$profondeur])) { |
|
| 2076 | - return $url[$profondeur]; |
|
| 2077 | - } |
|
| 2078 | - |
|
| 2079 | - $http = 'http'; |
|
| 2080 | - |
|
| 2081 | - if ( |
|
| 2082 | - isset($_SERVER['SCRIPT_URI']) |
|
| 2083 | - and substr($_SERVER['SCRIPT_URI'], 0, 5) == 'https' |
|
| 2084 | - ) { |
|
| 2085 | - $http = 'https'; |
|
| 2086 | - } elseif ( |
|
| 2087 | - isset($_SERVER['HTTPS']) |
|
| 2088 | - and test_valeur_serveur($_SERVER['HTTPS']) |
|
| 2089 | - ) { |
|
| 2090 | - $http = 'https'; |
|
| 2091 | - } |
|
| 2092 | - |
|
| 2093 | - // note : HTTP_HOST contient le :port si necessaire |
|
| 2094 | - if ($host = $_SERVER['HTTP_HOST'] ?? null) { |
|
| 2095 | - // Filtrer $host pour proteger d'attaques d'entete HTTP |
|
| 2096 | - $host = (filter_var($host, FILTER_SANITIZE_URL) ?: null); |
|
| 2097 | - } |
|
| 2098 | - |
|
| 2099 | - // si on n'a pas trouvé d'hôte du tout, en dernier recours on utilise adresse_site comme fallback |
|
| 2100 | - if (is_null($host) and isset($GLOBALS['meta']['adresse_site'])) { |
|
| 2101 | - $host = $GLOBALS['meta']['adresse_site']; |
|
| 2102 | - if ($scheme = parse_url($host, PHP_URL_SCHEME)) { |
|
| 2103 | - $http = $scheme; |
|
| 2104 | - $host = str_replace("{$scheme}://", '', $host); |
|
| 2105 | - } |
|
| 2106 | - } |
|
| 2107 | - if ( |
|
| 2108 | - isset($_SERVER['SERVER_PORT']) |
|
| 2109 | - and $port = $_SERVER['SERVER_PORT'] |
|
| 2110 | - and strpos($host, ':') == false |
|
| 2111 | - ) { |
|
| 2112 | - if (!defined('_PORT_HTTP_STANDARD')) { |
|
| 2113 | - define('_PORT_HTTP_STANDARD', '80'); |
|
| 2114 | - } |
|
| 2115 | - if (!defined('_PORT_HTTPS_STANDARD')) { |
|
| 2116 | - define('_PORT_HTTPS_STANDARD', '443'); |
|
| 2117 | - } |
|
| 2118 | - if ($http == 'http' and !in_array($port, explode(',', _PORT_HTTP_STANDARD))) { |
|
| 2119 | - $host .= ":$port"; |
|
| 2120 | - } |
|
| 2121 | - if ($http == 'https' and !in_array($port, explode(',', _PORT_HTTPS_STANDARD))) { |
|
| 2122 | - $host .= ":$port"; |
|
| 2123 | - } |
|
| 2124 | - } |
|
| 2125 | - |
|
| 2126 | - if (!$GLOBALS['REQUEST_URI']) { |
|
| 2127 | - if (isset($_SERVER['REQUEST_URI'])) { |
|
| 2128 | - $GLOBALS['REQUEST_URI'] = $_SERVER['REQUEST_URI']; |
|
| 2129 | - } else { |
|
| 2130 | - $GLOBALS['REQUEST_URI'] = (php_sapi_name() !== 'cli') ? $_SERVER['PHP_SELF'] : ''; |
|
| 2131 | - if ( |
|
| 2132 | - !empty($_SERVER['QUERY_STRING']) |
|
| 2133 | - and !strpos($_SERVER['REQUEST_URI'], '?') |
|
| 2134 | - ) { |
|
| 2135 | - $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 2136 | - } |
|
| 2137 | - } |
|
| 2138 | - } |
|
| 2139 | - |
|
| 2140 | - // Et nettoyer l'url |
|
| 2141 | - $GLOBALS['REQUEST_URI'] = (filter_var($GLOBALS['REQUEST_URI'], FILTER_SANITIZE_URL) ?: ''); |
|
| 2142 | - |
|
| 2143 | - $url[$profondeur] = url_de_($http, $host, $GLOBALS['REQUEST_URI'], $profondeur); |
|
| 2144 | - |
|
| 2145 | - return $url[$profondeur]; |
|
| 2062 | + static $url = []; |
|
| 2063 | + if (is_array($profondeur)) { |
|
| 2064 | + return $url = $profondeur; |
|
| 2065 | + } |
|
| 2066 | + if ($profondeur === false) { |
|
| 2067 | + return $url; |
|
| 2068 | + } |
|
| 2069 | + |
|
| 2070 | + if (is_null($profondeur)) { |
|
| 2071 | + $profondeur = $GLOBALS['profondeur_url'] ?? (_DIR_RESTREINT ? 0 : 1); |
|
| 2072 | + } |
|
| 2073 | + |
|
| 2074 | + if (isset($url[$profondeur])) { |
|
| 2075 | + return $url[$profondeur]; |
|
| 2076 | + } |
|
| 2077 | + |
|
| 2078 | + $http = 'http'; |
|
| 2079 | + |
|
| 2080 | + if ( |
|
| 2081 | + isset($_SERVER['SCRIPT_URI']) |
|
| 2082 | + and substr($_SERVER['SCRIPT_URI'], 0, 5) == 'https' |
|
| 2083 | + ) { |
|
| 2084 | + $http = 'https'; |
|
| 2085 | + } elseif ( |
|
| 2086 | + isset($_SERVER['HTTPS']) |
|
| 2087 | + and test_valeur_serveur($_SERVER['HTTPS']) |
|
| 2088 | + ) { |
|
| 2089 | + $http = 'https'; |
|
| 2090 | + } |
|
| 2091 | + |
|
| 2092 | + // note : HTTP_HOST contient le :port si necessaire |
|
| 2093 | + if ($host = $_SERVER['HTTP_HOST'] ?? null) { |
|
| 2094 | + // Filtrer $host pour proteger d'attaques d'entete HTTP |
|
| 2095 | + $host = (filter_var($host, FILTER_SANITIZE_URL) ?: null); |
|
| 2096 | + } |
|
| 2097 | + |
|
| 2098 | + // si on n'a pas trouvé d'hôte du tout, en dernier recours on utilise adresse_site comme fallback |
|
| 2099 | + if (is_null($host) and isset($GLOBALS['meta']['adresse_site'])) { |
|
| 2100 | + $host = $GLOBALS['meta']['adresse_site']; |
|
| 2101 | + if ($scheme = parse_url($host, PHP_URL_SCHEME)) { |
|
| 2102 | + $http = $scheme; |
|
| 2103 | + $host = str_replace("{$scheme}://", '', $host); |
|
| 2104 | + } |
|
| 2105 | + } |
|
| 2106 | + if ( |
|
| 2107 | + isset($_SERVER['SERVER_PORT']) |
|
| 2108 | + and $port = $_SERVER['SERVER_PORT'] |
|
| 2109 | + and strpos($host, ':') == false |
|
| 2110 | + ) { |
|
| 2111 | + if (!defined('_PORT_HTTP_STANDARD')) { |
|
| 2112 | + define('_PORT_HTTP_STANDARD', '80'); |
|
| 2113 | + } |
|
| 2114 | + if (!defined('_PORT_HTTPS_STANDARD')) { |
|
| 2115 | + define('_PORT_HTTPS_STANDARD', '443'); |
|
| 2116 | + } |
|
| 2117 | + if ($http == 'http' and !in_array($port, explode(',', _PORT_HTTP_STANDARD))) { |
|
| 2118 | + $host .= ":$port"; |
|
| 2119 | + } |
|
| 2120 | + if ($http == 'https' and !in_array($port, explode(',', _PORT_HTTPS_STANDARD))) { |
|
| 2121 | + $host .= ":$port"; |
|
| 2122 | + } |
|
| 2123 | + } |
|
| 2124 | + |
|
| 2125 | + if (!$GLOBALS['REQUEST_URI']) { |
|
| 2126 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
| 2127 | + $GLOBALS['REQUEST_URI'] = $_SERVER['REQUEST_URI']; |
|
| 2128 | + } else { |
|
| 2129 | + $GLOBALS['REQUEST_URI'] = (php_sapi_name() !== 'cli') ? $_SERVER['PHP_SELF'] : ''; |
|
| 2130 | + if ( |
|
| 2131 | + !empty($_SERVER['QUERY_STRING']) |
|
| 2132 | + and !strpos($_SERVER['REQUEST_URI'], '?') |
|
| 2133 | + ) { |
|
| 2134 | + $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 2135 | + } |
|
| 2136 | + } |
|
| 2137 | + } |
|
| 2138 | + |
|
| 2139 | + // Et nettoyer l'url |
|
| 2140 | + $GLOBALS['REQUEST_URI'] = (filter_var($GLOBALS['REQUEST_URI'], FILTER_SANITIZE_URL) ?: ''); |
|
| 2141 | + |
|
| 2142 | + $url[$profondeur] = url_de_($http, $host, $GLOBALS['REQUEST_URI'], $profondeur); |
|
| 2143 | + |
|
| 2144 | + return $url[$profondeur]; |
|
| 2146 | 2145 | } |
| 2147 | 2146 | |
| 2148 | 2147 | /** |
@@ -2155,26 +2154,26 @@ discard block |
||
| 2155 | 2154 | * @return string |
| 2156 | 2155 | */ |
| 2157 | 2156 | function url_de_($http, $host, $request, $prof = 0) { |
| 2158 | - $prof = max($prof, 0); |
|
| 2157 | + $prof = max($prof, 0); |
|
| 2159 | 2158 | |
| 2160 | - $myself = ltrim($request, '/'); |
|
| 2161 | - # supprimer la chaine de GET |
|
| 2162 | - [$myself] = explode('?', $myself); |
|
| 2163 | - // vieux mode HTTP qui envoie après le nom de la methode l'URL compléte |
|
| 2164 | - // protocole, "://", nom du serveur avant le path dans _SERVER["REQUEST_URI"] |
|
| 2165 | - if (strpos($myself, '://') !== false) { |
|
| 2166 | - $myself = explode('://', $myself); |
|
| 2167 | - array_shift($myself); |
|
| 2168 | - $myself = implode('://', $myself); |
|
| 2169 | - $myself = explode('/', $myself); |
|
| 2170 | - array_shift($myself); |
|
| 2171 | - $myself = implode('/', $myself); |
|
| 2172 | - } |
|
| 2173 | - $url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)) . '/'; |
|
| 2159 | + $myself = ltrim($request, '/'); |
|
| 2160 | + # supprimer la chaine de GET |
|
| 2161 | + [$myself] = explode('?', $myself); |
|
| 2162 | + // vieux mode HTTP qui envoie après le nom de la methode l'URL compléte |
|
| 2163 | + // protocole, "://", nom du serveur avant le path dans _SERVER["REQUEST_URI"] |
|
| 2164 | + if (strpos($myself, '://') !== false) { |
|
| 2165 | + $myself = explode('://', $myself); |
|
| 2166 | + array_shift($myself); |
|
| 2167 | + $myself = implode('://', $myself); |
|
| 2168 | + $myself = explode('/', $myself); |
|
| 2169 | + array_shift($myself); |
|
| 2170 | + $myself = implode('/', $myself); |
|
| 2171 | + } |
|
| 2172 | + $url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)) . '/'; |
|
| 2174 | 2173 | |
| 2175 | - $url = $http . '://' . rtrim($host, '/') . '/' . ltrim($url, '/'); |
|
| 2174 | + $url = $http . '://' . rtrim($host, '/') . '/' . ltrim($url, '/'); |
|
| 2176 | 2175 | |
| 2177 | - return $url; |
|
| 2176 | + return $url; |
|
| 2178 | 2177 | } |
| 2179 | 2178 | |
| 2180 | 2179 | |
@@ -2209,26 +2208,26 @@ discard block |
||
| 2209 | 2208 | * @return string URL |
| 2210 | 2209 | **/ |
| 2211 | 2210 | function generer_url_ecrire(?string $script = '', $args = '', $no_entities = false, $rel = false) { |
| 2212 | - $script ??= ''; |
|
| 2213 | - if (!$rel) { |
|
| 2214 | - $rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT; |
|
| 2215 | - } else { |
|
| 2216 | - if (!is_string($rel)) { |
|
| 2217 | - $rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT; |
|
| 2218 | - } |
|
| 2219 | - } |
|
| 2220 | - |
|
| 2221 | - [$script, $ancre] = array_pad(explode('#', $script), 2, null); |
|
| 2222 | - if ($script and ($script <> 'accueil' or $rel)) { |
|
| 2223 | - $args = "?exec=$script" . (!$args ? '' : "&$args"); |
|
| 2224 | - } elseif ($args) { |
|
| 2225 | - $args = "?$args"; |
|
| 2226 | - } |
|
| 2227 | - if ($ancre) { |
|
| 2228 | - $args .= "#$ancre"; |
|
| 2229 | - } |
|
| 2230 | - |
|
| 2231 | - return $rel . ($no_entities ? $args : str_replace('&', '&', $args)); |
|
| 2211 | + $script ??= ''; |
|
| 2212 | + if (!$rel) { |
|
| 2213 | + $rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT; |
|
| 2214 | + } else { |
|
| 2215 | + if (!is_string($rel)) { |
|
| 2216 | + $rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT; |
|
| 2217 | + } |
|
| 2218 | + } |
|
| 2219 | + |
|
| 2220 | + [$script, $ancre] = array_pad(explode('#', $script), 2, null); |
|
| 2221 | + if ($script and ($script <> 'accueil' or $rel)) { |
|
| 2222 | + $args = "?exec=$script" . (!$args ? '' : "&$args"); |
|
| 2223 | + } elseif ($args) { |
|
| 2224 | + $args = "?$args"; |
|
| 2225 | + } |
|
| 2226 | + if ($ancre) { |
|
| 2227 | + $args .= "#$ancre"; |
|
| 2228 | + } |
|
| 2229 | + |
|
| 2230 | + return $rel . ($no_entities ? $args : str_replace('&', '&', $args)); |
|
| 2232 | 2231 | } |
| 2233 | 2232 | |
| 2234 | 2233 | // |
@@ -2250,15 +2249,15 @@ discard block |
||
| 2250 | 2249 | * Nom du fichier (constante _SPIP_SCRIPT), sinon nom par défaut |
| 2251 | 2250 | **/ |
| 2252 | 2251 | function get_spip_script($default = '') { |
| 2253 | - if (!defined('_SPIP_SCRIPT')) { |
|
| 2254 | - return 'spip.php'; |
|
| 2255 | - } |
|
| 2256 | - # cas define('_SPIP_SCRIPT', ''); |
|
| 2257 | - if (_SPIP_SCRIPT) { |
|
| 2258 | - return _SPIP_SCRIPT; |
|
| 2259 | - } else { |
|
| 2260 | - return $default; |
|
| 2261 | - } |
|
| 2252 | + if (!defined('_SPIP_SCRIPT')) { |
|
| 2253 | + return 'spip.php'; |
|
| 2254 | + } |
|
| 2255 | + # cas define('_SPIP_SCRIPT', ''); |
|
| 2256 | + if (_SPIP_SCRIPT) { |
|
| 2257 | + return _SPIP_SCRIPT; |
|
| 2258 | + } else { |
|
| 2259 | + return $default; |
|
| 2260 | + } |
|
| 2262 | 2261 | } |
| 2263 | 2262 | |
| 2264 | 2263 | /** |
@@ -2287,45 +2286,45 @@ discard block |
||
| 2287 | 2286 | * @return string URL |
| 2288 | 2287 | **/ |
| 2289 | 2288 | function generer_url_public($script = '', $args = '', $no_entities = false, $rel = true, $action = '') { |
| 2290 | - // si le script est une action (spip_pass, spip_inscription), |
|
| 2291 | - // standardiser vers la nouvelle API |
|
| 2292 | - |
|
| 2293 | - if (is_array($args)) { |
|
| 2294 | - $args = http_build_query($args); |
|
| 2295 | - } |
|
| 2296 | - |
|
| 2297 | - $url = ''; |
|
| 2298 | - if ($f = charger_fonction_url('page')) { |
|
| 2299 | - $url = $f($script, $args); |
|
| 2300 | - if ($url and !$rel) { |
|
| 2301 | - include_spip('inc/filtres_mini'); |
|
| 2302 | - $url = url_absolue($url); |
|
| 2303 | - } |
|
| 2304 | - } |
|
| 2305 | - if (!$url) { |
|
| 2306 | - if (!$action) { |
|
| 2307 | - $action = get_spip_script(); |
|
| 2308 | - } |
|
| 2309 | - if ($script) { |
|
| 2310 | - $action = parametre_url($action, _SPIP_PAGE, $script, '&'); |
|
| 2311 | - } |
|
| 2312 | - if ($args) { |
|
| 2313 | - $action .= (strpos($action, '?') !== false ? '&' : '?') . $args; |
|
| 2314 | - } |
|
| 2315 | - // ne pas generer une url avec /./?page= en cas d'url absolue et de _SPIP_SCRIPT vide |
|
| 2316 | - $url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/') . preg_replace(',^/[.]/,', '/', "/$action")); |
|
| 2317 | - } |
|
| 2318 | - |
|
| 2319 | - if (!$no_entities) { |
|
| 2320 | - $url = quote_amp($url); |
|
| 2321 | - } |
|
| 2322 | - |
|
| 2323 | - return $url; |
|
| 2289 | + // si le script est une action (spip_pass, spip_inscription), |
|
| 2290 | + // standardiser vers la nouvelle API |
|
| 2291 | + |
|
| 2292 | + if (is_array($args)) { |
|
| 2293 | + $args = http_build_query($args); |
|
| 2294 | + } |
|
| 2295 | + |
|
| 2296 | + $url = ''; |
|
| 2297 | + if ($f = charger_fonction_url('page')) { |
|
| 2298 | + $url = $f($script, $args); |
|
| 2299 | + if ($url and !$rel) { |
|
| 2300 | + include_spip('inc/filtres_mini'); |
|
| 2301 | + $url = url_absolue($url); |
|
| 2302 | + } |
|
| 2303 | + } |
|
| 2304 | + if (!$url) { |
|
| 2305 | + if (!$action) { |
|
| 2306 | + $action = get_spip_script(); |
|
| 2307 | + } |
|
| 2308 | + if ($script) { |
|
| 2309 | + $action = parametre_url($action, _SPIP_PAGE, $script, '&'); |
|
| 2310 | + } |
|
| 2311 | + if ($args) { |
|
| 2312 | + $action .= (strpos($action, '?') !== false ? '&' : '?') . $args; |
|
| 2313 | + } |
|
| 2314 | + // ne pas generer une url avec /./?page= en cas d'url absolue et de _SPIP_SCRIPT vide |
|
| 2315 | + $url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/') . preg_replace(',^/[.]/,', '/', "/$action")); |
|
| 2316 | + } |
|
| 2317 | + |
|
| 2318 | + if (!$no_entities) { |
|
| 2319 | + $url = quote_amp($url); |
|
| 2320 | + } |
|
| 2321 | + |
|
| 2322 | + return $url; |
|
| 2324 | 2323 | } |
| 2325 | 2324 | |
| 2326 | 2325 | function generer_url_prive($script, $args = '', $no_entities = false) { |
| 2327 | 2326 | |
| 2328 | - return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS . 'prive.php'); |
|
| 2327 | + return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS . 'prive.php'); |
|
| 2329 | 2328 | } |
| 2330 | 2329 | |
| 2331 | 2330 | // Pour les formulaires en methode POST, |
@@ -2350,19 +2349,19 @@ discard block |
||
| 2350 | 2349 | **/ |
| 2351 | 2350 | function generer_form_ecrire($script, $corps, $atts = '', $submit = '') { |
| 2352 | 2351 | |
| 2353 | - $script1 = explode('&', $script); |
|
| 2354 | - $script1 = reset($script1); |
|
| 2352 | + $script1 = explode('&', $script); |
|
| 2353 | + $script1 = reset($script1); |
|
| 2355 | 2354 | |
| 2356 | - return "<form action='" |
|
| 2357 | - . ($script ? generer_url_ecrire($script) : '') |
|
| 2358 | - . "' " |
|
| 2359 | - . ($atts ?: " method='post'") |
|
| 2360 | - . "><div>\n" |
|
| 2361 | - . "<input type='hidden' name='exec' value='$script1' />" |
|
| 2362 | - . $corps |
|
| 2363 | - . (!$submit ? '' : |
|
| 2364 | - ("<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><input class='fondo submit btn' type='submit' value=\"" . entites_html($submit) . '" /></div>')) |
|
| 2365 | - . "</div></form>\n"; |
|
| 2355 | + return "<form action='" |
|
| 2356 | + . ($script ? generer_url_ecrire($script) : '') |
|
| 2357 | + . "' " |
|
| 2358 | + . ($atts ?: " method='post'") |
|
| 2359 | + . "><div>\n" |
|
| 2360 | + . "<input type='hidden' name='exec' value='$script1' />" |
|
| 2361 | + . $corps |
|
| 2362 | + . (!$submit ? '' : |
|
| 2363 | + ("<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><input class='fondo submit btn' type='submit' value=\"" . entites_html($submit) . '" /></div>')) |
|
| 2364 | + . "</div></form>\n"; |
|
| 2366 | 2365 | } |
| 2367 | 2366 | |
| 2368 | 2367 | /** |
@@ -2379,22 +2378,22 @@ discard block |
||
| 2379 | 2378 | * @return string |
| 2380 | 2379 | */ |
| 2381 | 2380 | function generer_form_action($script, $corps, $atts = '', $public = false) { |
| 2382 | - // si l'on est dans l'espace prive, on garde dans l'url |
|
| 2383 | - // l'exec a l'origine de l'action, qui permet de savoir si il est necessaire |
|
| 2384 | - // ou non de proceder a l'authentification (cas typique de l'install par exemple) |
|
| 2385 | - $h = (_DIR_RACINE and !$public) |
|
| 2386 | - ? generer_url_ecrire(_request('exec')) |
|
| 2387 | - : generer_url_public(); |
|
| 2381 | + // si l'on est dans l'espace prive, on garde dans l'url |
|
| 2382 | + // l'exec a l'origine de l'action, qui permet de savoir si il est necessaire |
|
| 2383 | + // ou non de proceder a l'authentification (cas typique de l'install par exemple) |
|
| 2384 | + $h = (_DIR_RACINE and !$public) |
|
| 2385 | + ? generer_url_ecrire(_request('exec')) |
|
| 2386 | + : generer_url_public(); |
|
| 2388 | 2387 | |
| 2389 | - return "\n<form action='" . |
|
| 2390 | - $h . |
|
| 2391 | - "'" . |
|
| 2392 | - $atts . |
|
| 2393 | - ">\n" . |
|
| 2394 | - '<div>' . |
|
| 2395 | - "\n<input type='hidden' name='action' value='$script' />" . |
|
| 2396 | - $corps . |
|
| 2397 | - '</div></form>'; |
|
| 2388 | + return "\n<form action='" . |
|
| 2389 | + $h . |
|
| 2390 | + "'" . |
|
| 2391 | + $atts . |
|
| 2392 | + ">\n" . |
|
| 2393 | + '<div>' . |
|
| 2394 | + "\n<input type='hidden' name='action' value='$script' />" . |
|
| 2395 | + $corps . |
|
| 2396 | + '</div></form>'; |
|
| 2398 | 2397 | } |
| 2399 | 2398 | |
| 2400 | 2399 | /** |
@@ -2413,22 +2412,22 @@ discard block |
||
| 2413 | 2412 | * URL |
| 2414 | 2413 | */ |
| 2415 | 2414 | function generer_url_action($script, $args = '', $no_entities = false, $public = false) { |
| 2416 | - // si l'on est dans l'espace prive, on garde dans l'url |
|
| 2417 | - // l'exec a l'origine de l'action, qui permet de savoir si il est necessaire |
|
| 2418 | - // ou non de proceder a l'authentification (cas typique de l'install par exemple) |
|
| 2419 | - $url = (_DIR_RACINE and !$public) |
|
| 2420 | - ? generer_url_ecrire(_request('exec')) |
|
| 2421 | - : generer_url_public('', '', false, false); |
|
| 2422 | - $url = parametre_url($url, 'action', $script); |
|
| 2423 | - if ($args) { |
|
| 2424 | - $url .= quote_amp('&' . $args); |
|
| 2425 | - } |
|
| 2415 | + // si l'on est dans l'espace prive, on garde dans l'url |
|
| 2416 | + // l'exec a l'origine de l'action, qui permet de savoir si il est necessaire |
|
| 2417 | + // ou non de proceder a l'authentification (cas typique de l'install par exemple) |
|
| 2418 | + $url = (_DIR_RACINE and !$public) |
|
| 2419 | + ? generer_url_ecrire(_request('exec')) |
|
| 2420 | + : generer_url_public('', '', false, false); |
|
| 2421 | + $url = parametre_url($url, 'action', $script); |
|
| 2422 | + if ($args) { |
|
| 2423 | + $url .= quote_amp('&' . $args); |
|
| 2424 | + } |
|
| 2426 | 2425 | |
| 2427 | - if ($no_entities) { |
|
| 2428 | - $url = str_replace('&', '&', $url); |
|
| 2429 | - } |
|
| 2426 | + if ($no_entities) { |
|
| 2427 | + $url = str_replace('&', '&', $url); |
|
| 2428 | + } |
|
| 2430 | 2429 | |
| 2431 | - return $url; |
|
| 2430 | + return $url; |
|
| 2432 | 2431 | } |
| 2433 | 2432 | |
| 2434 | 2433 | |
@@ -2447,23 +2446,23 @@ discard block |
||
| 2447 | 2446 | * URL |
| 2448 | 2447 | */ |
| 2449 | 2448 | function generer_url_api(string $script, string $path, string $args, bool $no_entities = false, ?bool $public = null) { |
| 2450 | - if (is_null($public)) { |
|
| 2451 | - $public = (_DIR_RACINE ? false : ''); |
|
| 2452 | - } |
|
| 2453 | - if (substr($script, -4) !== '.api') { |
|
| 2454 | - $script .= '.api'; |
|
| 2455 | - } |
|
| 2456 | - $url = |
|
| 2457 | - (($public ? _DIR_RACINE : _DIR_RESTREINT) ?: './') |
|
| 2458 | - . $script . '/' |
|
| 2459 | - . ($path ? trim($path, '/') : '') |
|
| 2460 | - . ($args ? '?' . quote_amp($args) : ''); |
|
| 2449 | + if (is_null($public)) { |
|
| 2450 | + $public = (_DIR_RACINE ? false : ''); |
|
| 2451 | + } |
|
| 2452 | + if (substr($script, -4) !== '.api') { |
|
| 2453 | + $script .= '.api'; |
|
| 2454 | + } |
|
| 2455 | + $url = |
|
| 2456 | + (($public ? _DIR_RACINE : _DIR_RESTREINT) ?: './') |
|
| 2457 | + . $script . '/' |
|
| 2458 | + . ($path ? trim($path, '/') : '') |
|
| 2459 | + . ($args ? '?' . quote_amp($args) : ''); |
|
| 2461 | 2460 | |
| 2462 | - if ($no_entities) { |
|
| 2463 | - $url = str_replace('&', '&', $url); |
|
| 2464 | - } |
|
| 2461 | + if ($no_entities) { |
|
| 2462 | + $url = str_replace('&', '&', $url); |
|
| 2463 | + } |
|
| 2465 | 2464 | |
| 2466 | - return $url; |
|
| 2465 | + return $url; |
|
| 2467 | 2466 | } |
| 2468 | 2467 | |
| 2469 | 2468 | |
@@ -2476,8 +2475,8 @@ discard block |
||
| 2476 | 2475 | * @param string $ta Répertoire temporaire accessible |
| 2477 | 2476 | */ |
| 2478 | 2477 | function spip_initialisation($pi = null, $pa = null, $ti = null, $ta = null) { |
| 2479 | - spip_initialisation_core($pi, $pa, $ti, $ta); |
|
| 2480 | - spip_initialisation_suite(); |
|
| 2478 | + spip_initialisation_core($pi, $pa, $ti, $ta); |
|
| 2479 | + spip_initialisation_suite(); |
|
| 2481 | 2480 | } |
| 2482 | 2481 | |
| 2483 | 2482 | /** |
@@ -2497,315 +2496,315 @@ discard block |
||
| 2497 | 2496 | * @param string $ta Répertoire temporaire accessible |
| 2498 | 2497 | */ |
| 2499 | 2498 | function spip_initialisation_core($pi = null, $pa = null, $ti = null, $ta = null) { |
| 2500 | - static $too_late = 0; |
|
| 2501 | - if ($too_late++) { |
|
| 2502 | - return; |
|
| 2503 | - } |
|
| 2504 | - |
|
| 2505 | - // Declaration des repertoires |
|
| 2506 | - |
|
| 2507 | - // le nom du repertoire plugins/ activables/desactivables |
|
| 2508 | - if (!defined('_DIR_PLUGINS')) { |
|
| 2509 | - define('_DIR_PLUGINS', _DIR_RACINE . 'plugins/'); |
|
| 2510 | - } |
|
| 2511 | - |
|
| 2512 | - // le nom du repertoire des extensions/ permanentes du core, toujours actives |
|
| 2513 | - if (!defined('_DIR_PLUGINS_DIST')) { |
|
| 2514 | - define('_DIR_PLUGINS_DIST', _DIR_RACINE . 'plugins-dist/'); |
|
| 2515 | - } |
|
| 2516 | - |
|
| 2517 | - // le nom du repertoire des librairies |
|
| 2518 | - if (!defined('_DIR_LIB')) { |
|
| 2519 | - define('_DIR_LIB', _DIR_RACINE . 'lib/'); |
|
| 2520 | - } |
|
| 2521 | - |
|
| 2522 | - // répertoire des libs via Composer |
|
| 2523 | - if (!defined('_DIR_VENDOR')) { |
|
| 2524 | - define('_DIR_VENDOR', _DIR_RACINE . 'vendor/'); |
|
| 2525 | - } |
|
| 2526 | - |
|
| 2527 | - if (!defined('_DIR_IMG')) { |
|
| 2528 | - define('_DIR_IMG', $pa); |
|
| 2529 | - } |
|
| 2530 | - if (!defined('_DIR_LOGOS')) { |
|
| 2531 | - define('_DIR_LOGOS', $pa); |
|
| 2532 | - } |
|
| 2533 | - if (!defined('_DIR_IMG_ICONES')) { |
|
| 2534 | - define('_DIR_IMG_ICONES', _DIR_LOGOS . 'icones/'); |
|
| 2535 | - } |
|
| 2536 | - |
|
| 2537 | - if (!defined('_DIR_DUMP')) { |
|
| 2538 | - define('_DIR_DUMP', $ti . 'dump/'); |
|
| 2539 | - } |
|
| 2540 | - if (!defined('_DIR_SESSIONS')) { |
|
| 2541 | - define('_DIR_SESSIONS', $ti . 'sessions/'); |
|
| 2542 | - } |
|
| 2543 | - if (!defined('_DIR_TRANSFERT')) { |
|
| 2544 | - define('_DIR_TRANSFERT', $ti . 'upload/'); |
|
| 2545 | - } |
|
| 2546 | - if (!defined('_DIR_CACHE')) { |
|
| 2547 | - define('_DIR_CACHE', $ti . 'cache/'); |
|
| 2548 | - } |
|
| 2549 | - if (!defined('_DIR_CACHE_XML')) { |
|
| 2550 | - define('_DIR_CACHE_XML', _DIR_CACHE . 'xml/'); |
|
| 2551 | - } |
|
| 2552 | - if (!defined('_DIR_SKELS')) { |
|
| 2553 | - define('_DIR_SKELS', _DIR_CACHE . 'skel/'); |
|
| 2554 | - } |
|
| 2555 | - if (!defined('_DIR_AIDE')) { |
|
| 2556 | - define('_DIR_AIDE', _DIR_CACHE . 'aide/'); |
|
| 2557 | - } |
|
| 2558 | - if (!defined('_DIR_TMP')) { |
|
| 2559 | - define('_DIR_TMP', $ti); |
|
| 2560 | - } |
|
| 2561 | - |
|
| 2562 | - if (!defined('_DIR_VAR')) { |
|
| 2563 | - define('_DIR_VAR', $ta); |
|
| 2564 | - } |
|
| 2565 | - |
|
| 2566 | - if (!defined('_DIR_ETC')) { |
|
| 2567 | - define('_DIR_ETC', $pi); |
|
| 2568 | - } |
|
| 2569 | - if (!defined('_DIR_CONNECT')) { |
|
| 2570 | - define('_DIR_CONNECT', $pi); |
|
| 2571 | - } |
|
| 2572 | - if (!defined('_DIR_CHMOD')) { |
|
| 2573 | - define('_DIR_CHMOD', $pi); |
|
| 2574 | - } |
|
| 2575 | - |
|
| 2576 | - if (!isset($GLOBALS['test_dirs'])) { |
|
| 2577 | - // Pas $pi car il est bon de le mettre hors ecriture apres intstall |
|
| 2578 | - // il sera rajoute automatiquement si besoin a l'etape 2 de l'install |
|
| 2579 | - $GLOBALS['test_dirs'] = [$pa, $ti, $ta]; |
|
| 2580 | - } |
|
| 2581 | - |
|
| 2582 | - // Declaration des fichiers |
|
| 2583 | - |
|
| 2584 | - if (!defined('_CACHE_PLUGINS_PATH')) { |
|
| 2585 | - define('_CACHE_PLUGINS_PATH', _DIR_CACHE . 'charger_plugins_chemins.php'); |
|
| 2586 | - } |
|
| 2587 | - if (!defined('_CACHE_PLUGINS_OPT')) { |
|
| 2588 | - define('_CACHE_PLUGINS_OPT', _DIR_CACHE . 'charger_plugins_options.php'); |
|
| 2589 | - } |
|
| 2590 | - if (!defined('_CACHE_PLUGINS_FCT')) { |
|
| 2591 | - define('_CACHE_PLUGINS_FCT', _DIR_CACHE . 'charger_plugins_fonctions.php'); |
|
| 2592 | - } |
|
| 2593 | - if (!defined('_CACHE_PIPELINES')) { |
|
| 2594 | - define('_CACHE_PIPELINES', _DIR_CACHE . 'charger_pipelines.php'); |
|
| 2595 | - } |
|
| 2596 | - if (!defined('_CACHE_CHEMIN')) { |
|
| 2597 | - define('_CACHE_CHEMIN', _DIR_CACHE . 'chemin.txt'); |
|
| 2598 | - } |
|
| 2599 | - |
|
| 2600 | - # attention .php obligatoire pour ecrire_fichier_securise |
|
| 2601 | - if (!defined('_FILE_META')) { |
|
| 2602 | - define('_FILE_META', $ti . 'meta_cache.php'); |
|
| 2603 | - } |
|
| 2604 | - if (!defined('_DIR_LOG')) { |
|
| 2605 | - define('_DIR_LOG', _DIR_TMP . 'log/'); |
|
| 2606 | - } |
|
| 2607 | - if (!defined('_FILE_LOG')) { |
|
| 2608 | - define('_FILE_LOG', 'spip'); |
|
| 2609 | - } |
|
| 2610 | - if (!defined('_FILE_LOG_SUFFIX')) { |
|
| 2611 | - define('_FILE_LOG_SUFFIX', '.log'); |
|
| 2612 | - } |
|
| 2613 | - |
|
| 2614 | - // Le fichier de connexion a la base de donnees |
|
| 2615 | - // tient compte des anciennes versions (inc_connect...) |
|
| 2616 | - if (!defined('_FILE_CONNECT_INS')) { |
|
| 2617 | - define('_FILE_CONNECT_INS', 'connect'); |
|
| 2618 | - } |
|
| 2619 | - if (!defined('_FILE_CONNECT')) { |
|
| 2620 | - define( |
|
| 2621 | - '_FILE_CONNECT', |
|
| 2622 | - (@is_readable($f = _DIR_CONNECT . _FILE_CONNECT_INS . '.php') ? $f |
|
| 2623 | - : (@is_readable($f = _DIR_RESTREINT . 'inc_connect.php') ? $f |
|
| 2624 | - : false)) |
|
| 2625 | - ); |
|
| 2626 | - } |
|
| 2627 | - |
|
| 2628 | - // Le fichier de reglages des droits |
|
| 2629 | - if (!defined('_FILE_CHMOD_INS')) { |
|
| 2630 | - define('_FILE_CHMOD_INS', 'chmod'); |
|
| 2631 | - } |
|
| 2632 | - if (!defined('_FILE_CHMOD')) { |
|
| 2633 | - define( |
|
| 2634 | - '_FILE_CHMOD', |
|
| 2635 | - (@is_readable($f = _DIR_CHMOD . _FILE_CHMOD_INS . '.php') ? $f |
|
| 2636 | - : false) |
|
| 2637 | - ); |
|
| 2638 | - } |
|
| 2639 | - |
|
| 2640 | - if (!defined('_FILE_LDAP')) { |
|
| 2641 | - define('_FILE_LDAP', 'ldap.php'); |
|
| 2642 | - } |
|
| 2643 | - |
|
| 2644 | - if (!defined('_FILE_TMP_SUFFIX')) { |
|
| 2645 | - define('_FILE_TMP_SUFFIX', '.tmp.php'); |
|
| 2646 | - } |
|
| 2647 | - if (!defined('_FILE_CONNECT_TMP')) { |
|
| 2648 | - define('_FILE_CONNECT_TMP', _DIR_CONNECT . _FILE_CONNECT_INS . _FILE_TMP_SUFFIX); |
|
| 2649 | - } |
|
| 2650 | - if (!defined('_FILE_CHMOD_TMP')) { |
|
| 2651 | - define('_FILE_CHMOD_TMP', _DIR_CHMOD . _FILE_CHMOD_INS . _FILE_TMP_SUFFIX); |
|
| 2652 | - } |
|
| 2653 | - |
|
| 2654 | - // Definition des droits d'acces en ecriture |
|
| 2655 | - if (!defined('_SPIP_CHMOD') and _FILE_CHMOD) { |
|
| 2656 | - include_once _FILE_CHMOD; |
|
| 2657 | - } |
|
| 2658 | - |
|
| 2659 | - // Se mefier des fichiers mal remplis! |
|
| 2660 | - if (!defined('_SPIP_CHMOD')) { |
|
| 2661 | - define('_SPIP_CHMOD', 0777); |
|
| 2662 | - } |
|
| 2663 | - |
|
| 2664 | - if (!defined('_DEFAULT_CHARSET')) { |
|
| 2665 | - /** Le charset par défaut lors de l'installation */ |
|
| 2666 | - define('_DEFAULT_CHARSET', 'utf-8'); |
|
| 2667 | - } |
|
| 2668 | - if (!defined('_ROOT_PLUGINS')) { |
|
| 2669 | - define('_ROOT_PLUGINS', _ROOT_RACINE . 'plugins/'); |
|
| 2670 | - } |
|
| 2671 | - if (!defined('_ROOT_PLUGINS_DIST')) { |
|
| 2672 | - define('_ROOT_PLUGINS_DIST', _ROOT_RACINE . 'plugins-dist/'); |
|
| 2673 | - } |
|
| 2674 | - if (!defined('_ROOT_PLUGINS_SUPPL') && defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) { |
|
| 2675 | - define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE . str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL)); |
|
| 2676 | - } |
|
| 2677 | - |
|
| 2678 | - // La taille des Log |
|
| 2679 | - if (!defined('_MAX_LOG')) { |
|
| 2680 | - define('_MAX_LOG', 100); |
|
| 2681 | - } |
|
| 2682 | - |
|
| 2683 | - // Sommes-nous dans l'empire du Mal ? |
|
| 2684 | - // (ou sous le signe du Pingouin, ascendant GNU ?) |
|
| 2685 | - if (isset($_SERVER['SERVER_SOFTWARE']) and str_contains($_SERVER['SERVER_SOFTWARE'], '(Win')) { |
|
| 2686 | - if (!defined('_OS_SERVEUR')) { |
|
| 2687 | - define('_OS_SERVEUR', 'windows'); |
|
| 2688 | - } |
|
| 2689 | - if (!defined('_SPIP_LOCK_MODE')) { |
|
| 2690 | - define('_SPIP_LOCK_MODE', 1); |
|
| 2691 | - } // utiliser le flock php |
|
| 2692 | - } else { |
|
| 2693 | - if (!defined('_OS_SERVEUR')) { |
|
| 2694 | - define('_OS_SERVEUR', ''); |
|
| 2695 | - } |
|
| 2696 | - if (!defined('_SPIP_LOCK_MODE')) { |
|
| 2697 | - define('_SPIP_LOCK_MODE', 1); |
|
| 2698 | - } // utiliser le flock php |
|
| 2699 | - #if (!defined('_SPIP_LOCK_MODE')) define('_SPIP_LOCK_MODE',2); // utiliser le nfslock de spip mais link() est tres souvent interdite |
|
| 2700 | - } |
|
| 2701 | - |
|
| 2702 | - // Langue par defaut |
|
| 2703 | - if (!defined('_LANGUE_PAR_DEFAUT')) { |
|
| 2704 | - define('_LANGUE_PAR_DEFAUT', 'fr'); |
|
| 2705 | - } |
|
| 2706 | - |
|
| 2707 | - // |
|
| 2708 | - // Module de lecture/ecriture/suppression de fichiers utilisant flock() |
|
| 2709 | - // (non surchargeable en l'etat ; attention si on utilise include_spip() |
|
| 2710 | - // pour le rendre surchargeable, on va provoquer un reecriture |
|
| 2711 | - // systematique du noyau ou une baisse de perfs => a etudier) |
|
| 2712 | - include_once _ROOT_RESTREINT . 'inc/flock.php'; |
|
| 2713 | - |
|
| 2714 | - // charger tout de suite le path et son cache |
|
| 2715 | - load_path_cache(); |
|
| 2716 | - |
|
| 2717 | - // *********** traiter les variables ************ |
|
| 2718 | - |
|
| 2719 | - // |
|
| 2720 | - // Securite |
|
| 2721 | - // |
|
| 2722 | - |
|
| 2723 | - // Ne pas se faire manger par un bug php qui accepte ?GLOBALS[truc]=toto |
|
| 2724 | - if (isset($_REQUEST['GLOBALS'])) { |
|
| 2725 | - die(); |
|
| 2726 | - } |
|
| 2727 | - // nettoyer les magic quotes \' et les caracteres nuls %00 |
|
| 2728 | - spip_desinfecte($_GET); |
|
| 2729 | - spip_desinfecte($_POST); |
|
| 2730 | - spip_desinfecte($_COOKIE); |
|
| 2731 | - spip_desinfecte($_REQUEST); |
|
| 2732 | - |
|
| 2733 | - // appliquer le cookie_prefix |
|
| 2734 | - if ($GLOBALS['cookie_prefix'] != 'spip') { |
|
| 2735 | - include_spip('inc/cookie'); |
|
| 2736 | - recuperer_cookies_spip($GLOBALS['cookie_prefix']); |
|
| 2737 | - } |
|
| 2738 | - |
|
| 2739 | - // Compatibilite avec serveurs ne fournissant pas $REQUEST_URI |
|
| 2740 | - if (isset($_SERVER['REQUEST_URI'])) { |
|
| 2741 | - $GLOBALS['REQUEST_URI'] = $_SERVER['REQUEST_URI']; |
|
| 2742 | - } else { |
|
| 2743 | - $GLOBALS['REQUEST_URI'] = (php_sapi_name() !== 'cli') ? $_SERVER['PHP_SELF'] : ''; |
|
| 2744 | - if ( |
|
| 2745 | - !empty($_SERVER['QUERY_STRING']) |
|
| 2746 | - and !strpos($_SERVER['REQUEST_URI'], '?') |
|
| 2747 | - ) { |
|
| 2748 | - $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 2749 | - } |
|
| 2750 | - } |
|
| 2751 | - |
|
| 2752 | - // Duree de validite de l'alea pour les cookies et ce qui s'ensuit. |
|
| 2753 | - if (!defined('_RENOUVELLE_ALEA')) { |
|
| 2754 | - define('_RENOUVELLE_ALEA', 12 * 3600); |
|
| 2755 | - } |
|
| 2756 | - if (!defined('_DUREE_COOKIE_ADMIN')) { |
|
| 2757 | - define('_DUREE_COOKIE_ADMIN', 14 * 24 * 3600); |
|
| 2758 | - } |
|
| 2759 | - |
|
| 2760 | - // charger les meta si possible et renouveller l'alea au besoin |
|
| 2761 | - // charge aussi effacer_meta et ecrire_meta |
|
| 2762 | - $inc_meta = charger_fonction('meta', 'inc'); |
|
| 2763 | - $inc_meta(); |
|
| 2764 | - |
|
| 2765 | - // nombre de repertoires depuis la racine |
|
| 2766 | - // on compare a l'adresse de spip.php : $_SERVER["SCRIPT_NAME"] |
|
| 2767 | - // ou a defaut celle donnee en meta ; (mais si celle-ci est fausse |
|
| 2768 | - // le calcul est faux) |
|
| 2769 | - if (!_DIR_RESTREINT) { |
|
| 2770 | - $GLOBALS['profondeur_url'] = 1; |
|
| 2771 | - } else { |
|
| 2772 | - $uri = isset($_SERVER['REQUEST_URI']) ? explode('?', $_SERVER['REQUEST_URI']) : ''; |
|
| 2773 | - $uri_ref = $_SERVER['SCRIPT_NAME']; |
|
| 2774 | - if ( |
|
| 2775 | - !$uri_ref |
|
| 2776 | - // si on est appele avec un autre ti, on est sans doute en mutu |
|
| 2777 | - // si jamais c'est de la mutu avec sous rep, on est perdu si on se fie |
|
| 2778 | - // a spip.php qui est a la racine du spip, et vue qu'on sait pas se reperer |
|
| 2779 | - // s'en remettre a l'adresse du site. alea jacta est. |
|
| 2780 | - or $ti !== _NOM_TEMPORAIRES_INACCESSIBLES |
|
| 2781 | - ) { |
|
| 2782 | - if (isset($GLOBALS['meta']['adresse_site'])) { |
|
| 2783 | - $uri_ref = parse_url($GLOBALS['meta']['adresse_site']); |
|
| 2784 | - $uri_ref = ($uri_ref['path'] ?? '') . '/'; |
|
| 2785 | - } else { |
|
| 2786 | - $uri_ref = ''; |
|
| 2787 | - } |
|
| 2788 | - } |
|
| 2789 | - if (!$uri or !$uri_ref) { |
|
| 2790 | - $GLOBALS['profondeur_url'] = 0; |
|
| 2791 | - } else { |
|
| 2792 | - $GLOBALS['profondeur_url'] = max( |
|
| 2793 | - 0, |
|
| 2794 | - substr_count($uri[0], '/') |
|
| 2795 | - - substr_count($uri_ref, '/') |
|
| 2796 | - ); |
|
| 2797 | - } |
|
| 2798 | - } |
|
| 2799 | - // s'il y a un cookie ou PHP_AUTH, initialiser visiteur_session |
|
| 2800 | - if (_FILE_CONNECT) { |
|
| 2801 | - if ( |
|
| 2802 | - verifier_visiteur() == '0minirezo' |
|
| 2803 | - // si c'est un admin sans cookie admin, il faut ignorer le cache chemin ! |
|
| 2804 | - and !isset($_COOKIE['spip_admin']) |
|
| 2805 | - ) { |
|
| 2806 | - clear_path_cache(); |
|
| 2807 | - } |
|
| 2808 | - } |
|
| 2499 | + static $too_late = 0; |
|
| 2500 | + if ($too_late++) { |
|
| 2501 | + return; |
|
| 2502 | + } |
|
| 2503 | + |
|
| 2504 | + // Declaration des repertoires |
|
| 2505 | + |
|
| 2506 | + // le nom du repertoire plugins/ activables/desactivables |
|
| 2507 | + if (!defined('_DIR_PLUGINS')) { |
|
| 2508 | + define('_DIR_PLUGINS', _DIR_RACINE . 'plugins/'); |
|
| 2509 | + } |
|
| 2510 | + |
|
| 2511 | + // le nom du repertoire des extensions/ permanentes du core, toujours actives |
|
| 2512 | + if (!defined('_DIR_PLUGINS_DIST')) { |
|
| 2513 | + define('_DIR_PLUGINS_DIST', _DIR_RACINE . 'plugins-dist/'); |
|
| 2514 | + } |
|
| 2515 | + |
|
| 2516 | + // le nom du repertoire des librairies |
|
| 2517 | + if (!defined('_DIR_LIB')) { |
|
| 2518 | + define('_DIR_LIB', _DIR_RACINE . 'lib/'); |
|
| 2519 | + } |
|
| 2520 | + |
|
| 2521 | + // répertoire des libs via Composer |
|
| 2522 | + if (!defined('_DIR_VENDOR')) { |
|
| 2523 | + define('_DIR_VENDOR', _DIR_RACINE . 'vendor/'); |
|
| 2524 | + } |
|
| 2525 | + |
|
| 2526 | + if (!defined('_DIR_IMG')) { |
|
| 2527 | + define('_DIR_IMG', $pa); |
|
| 2528 | + } |
|
| 2529 | + if (!defined('_DIR_LOGOS')) { |
|
| 2530 | + define('_DIR_LOGOS', $pa); |
|
| 2531 | + } |
|
| 2532 | + if (!defined('_DIR_IMG_ICONES')) { |
|
| 2533 | + define('_DIR_IMG_ICONES', _DIR_LOGOS . 'icones/'); |
|
| 2534 | + } |
|
| 2535 | + |
|
| 2536 | + if (!defined('_DIR_DUMP')) { |
|
| 2537 | + define('_DIR_DUMP', $ti . 'dump/'); |
|
| 2538 | + } |
|
| 2539 | + if (!defined('_DIR_SESSIONS')) { |
|
| 2540 | + define('_DIR_SESSIONS', $ti . 'sessions/'); |
|
| 2541 | + } |
|
| 2542 | + if (!defined('_DIR_TRANSFERT')) { |
|
| 2543 | + define('_DIR_TRANSFERT', $ti . 'upload/'); |
|
| 2544 | + } |
|
| 2545 | + if (!defined('_DIR_CACHE')) { |
|
| 2546 | + define('_DIR_CACHE', $ti . 'cache/'); |
|
| 2547 | + } |
|
| 2548 | + if (!defined('_DIR_CACHE_XML')) { |
|
| 2549 | + define('_DIR_CACHE_XML', _DIR_CACHE . 'xml/'); |
|
| 2550 | + } |
|
| 2551 | + if (!defined('_DIR_SKELS')) { |
|
| 2552 | + define('_DIR_SKELS', _DIR_CACHE . 'skel/'); |
|
| 2553 | + } |
|
| 2554 | + if (!defined('_DIR_AIDE')) { |
|
| 2555 | + define('_DIR_AIDE', _DIR_CACHE . 'aide/'); |
|
| 2556 | + } |
|
| 2557 | + if (!defined('_DIR_TMP')) { |
|
| 2558 | + define('_DIR_TMP', $ti); |
|
| 2559 | + } |
|
| 2560 | + |
|
| 2561 | + if (!defined('_DIR_VAR')) { |
|
| 2562 | + define('_DIR_VAR', $ta); |
|
| 2563 | + } |
|
| 2564 | + |
|
| 2565 | + if (!defined('_DIR_ETC')) { |
|
| 2566 | + define('_DIR_ETC', $pi); |
|
| 2567 | + } |
|
| 2568 | + if (!defined('_DIR_CONNECT')) { |
|
| 2569 | + define('_DIR_CONNECT', $pi); |
|
| 2570 | + } |
|
| 2571 | + if (!defined('_DIR_CHMOD')) { |
|
| 2572 | + define('_DIR_CHMOD', $pi); |
|
| 2573 | + } |
|
| 2574 | + |
|
| 2575 | + if (!isset($GLOBALS['test_dirs'])) { |
|
| 2576 | + // Pas $pi car il est bon de le mettre hors ecriture apres intstall |
|
| 2577 | + // il sera rajoute automatiquement si besoin a l'etape 2 de l'install |
|
| 2578 | + $GLOBALS['test_dirs'] = [$pa, $ti, $ta]; |
|
| 2579 | + } |
|
| 2580 | + |
|
| 2581 | + // Declaration des fichiers |
|
| 2582 | + |
|
| 2583 | + if (!defined('_CACHE_PLUGINS_PATH')) { |
|
| 2584 | + define('_CACHE_PLUGINS_PATH', _DIR_CACHE . 'charger_plugins_chemins.php'); |
|
| 2585 | + } |
|
| 2586 | + if (!defined('_CACHE_PLUGINS_OPT')) { |
|
| 2587 | + define('_CACHE_PLUGINS_OPT', _DIR_CACHE . 'charger_plugins_options.php'); |
|
| 2588 | + } |
|
| 2589 | + if (!defined('_CACHE_PLUGINS_FCT')) { |
|
| 2590 | + define('_CACHE_PLUGINS_FCT', _DIR_CACHE . 'charger_plugins_fonctions.php'); |
|
| 2591 | + } |
|
| 2592 | + if (!defined('_CACHE_PIPELINES')) { |
|
| 2593 | + define('_CACHE_PIPELINES', _DIR_CACHE . 'charger_pipelines.php'); |
|
| 2594 | + } |
|
| 2595 | + if (!defined('_CACHE_CHEMIN')) { |
|
| 2596 | + define('_CACHE_CHEMIN', _DIR_CACHE . 'chemin.txt'); |
|
| 2597 | + } |
|
| 2598 | + |
|
| 2599 | + # attention .php obligatoire pour ecrire_fichier_securise |
|
| 2600 | + if (!defined('_FILE_META')) { |
|
| 2601 | + define('_FILE_META', $ti . 'meta_cache.php'); |
|
| 2602 | + } |
|
| 2603 | + if (!defined('_DIR_LOG')) { |
|
| 2604 | + define('_DIR_LOG', _DIR_TMP . 'log/'); |
|
| 2605 | + } |
|
| 2606 | + if (!defined('_FILE_LOG')) { |
|
| 2607 | + define('_FILE_LOG', 'spip'); |
|
| 2608 | + } |
|
| 2609 | + if (!defined('_FILE_LOG_SUFFIX')) { |
|
| 2610 | + define('_FILE_LOG_SUFFIX', '.log'); |
|
| 2611 | + } |
|
| 2612 | + |
|
| 2613 | + // Le fichier de connexion a la base de donnees |
|
| 2614 | + // tient compte des anciennes versions (inc_connect...) |
|
| 2615 | + if (!defined('_FILE_CONNECT_INS')) { |
|
| 2616 | + define('_FILE_CONNECT_INS', 'connect'); |
|
| 2617 | + } |
|
| 2618 | + if (!defined('_FILE_CONNECT')) { |
|
| 2619 | + define( |
|
| 2620 | + '_FILE_CONNECT', |
|
| 2621 | + (@is_readable($f = _DIR_CONNECT . _FILE_CONNECT_INS . '.php') ? $f |
|
| 2622 | + : (@is_readable($f = _DIR_RESTREINT . 'inc_connect.php') ? $f |
|
| 2623 | + : false)) |
|
| 2624 | + ); |
|
| 2625 | + } |
|
| 2626 | + |
|
| 2627 | + // Le fichier de reglages des droits |
|
| 2628 | + if (!defined('_FILE_CHMOD_INS')) { |
|
| 2629 | + define('_FILE_CHMOD_INS', 'chmod'); |
|
| 2630 | + } |
|
| 2631 | + if (!defined('_FILE_CHMOD')) { |
|
| 2632 | + define( |
|
| 2633 | + '_FILE_CHMOD', |
|
| 2634 | + (@is_readable($f = _DIR_CHMOD . _FILE_CHMOD_INS . '.php') ? $f |
|
| 2635 | + : false) |
|
| 2636 | + ); |
|
| 2637 | + } |
|
| 2638 | + |
|
| 2639 | + if (!defined('_FILE_LDAP')) { |
|
| 2640 | + define('_FILE_LDAP', 'ldap.php'); |
|
| 2641 | + } |
|
| 2642 | + |
|
| 2643 | + if (!defined('_FILE_TMP_SUFFIX')) { |
|
| 2644 | + define('_FILE_TMP_SUFFIX', '.tmp.php'); |
|
| 2645 | + } |
|
| 2646 | + if (!defined('_FILE_CONNECT_TMP')) { |
|
| 2647 | + define('_FILE_CONNECT_TMP', _DIR_CONNECT . _FILE_CONNECT_INS . _FILE_TMP_SUFFIX); |
|
| 2648 | + } |
|
| 2649 | + if (!defined('_FILE_CHMOD_TMP')) { |
|
| 2650 | + define('_FILE_CHMOD_TMP', _DIR_CHMOD . _FILE_CHMOD_INS . _FILE_TMP_SUFFIX); |
|
| 2651 | + } |
|
| 2652 | + |
|
| 2653 | + // Definition des droits d'acces en ecriture |
|
| 2654 | + if (!defined('_SPIP_CHMOD') and _FILE_CHMOD) { |
|
| 2655 | + include_once _FILE_CHMOD; |
|
| 2656 | + } |
|
| 2657 | + |
|
| 2658 | + // Se mefier des fichiers mal remplis! |
|
| 2659 | + if (!defined('_SPIP_CHMOD')) { |
|
| 2660 | + define('_SPIP_CHMOD', 0777); |
|
| 2661 | + } |
|
| 2662 | + |
|
| 2663 | + if (!defined('_DEFAULT_CHARSET')) { |
|
| 2664 | + /** Le charset par défaut lors de l'installation */ |
|
| 2665 | + define('_DEFAULT_CHARSET', 'utf-8'); |
|
| 2666 | + } |
|
| 2667 | + if (!defined('_ROOT_PLUGINS')) { |
|
| 2668 | + define('_ROOT_PLUGINS', _ROOT_RACINE . 'plugins/'); |
|
| 2669 | + } |
|
| 2670 | + if (!defined('_ROOT_PLUGINS_DIST')) { |
|
| 2671 | + define('_ROOT_PLUGINS_DIST', _ROOT_RACINE . 'plugins-dist/'); |
|
| 2672 | + } |
|
| 2673 | + if (!defined('_ROOT_PLUGINS_SUPPL') && defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) { |
|
| 2674 | + define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE . str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL)); |
|
| 2675 | + } |
|
| 2676 | + |
|
| 2677 | + // La taille des Log |
|
| 2678 | + if (!defined('_MAX_LOG')) { |
|
| 2679 | + define('_MAX_LOG', 100); |
|
| 2680 | + } |
|
| 2681 | + |
|
| 2682 | + // Sommes-nous dans l'empire du Mal ? |
|
| 2683 | + // (ou sous le signe du Pingouin, ascendant GNU ?) |
|
| 2684 | + if (isset($_SERVER['SERVER_SOFTWARE']) and str_contains($_SERVER['SERVER_SOFTWARE'], '(Win')) { |
|
| 2685 | + if (!defined('_OS_SERVEUR')) { |
|
| 2686 | + define('_OS_SERVEUR', 'windows'); |
|
| 2687 | + } |
|
| 2688 | + if (!defined('_SPIP_LOCK_MODE')) { |
|
| 2689 | + define('_SPIP_LOCK_MODE', 1); |
|
| 2690 | + } // utiliser le flock php |
|
| 2691 | + } else { |
|
| 2692 | + if (!defined('_OS_SERVEUR')) { |
|
| 2693 | + define('_OS_SERVEUR', ''); |
|
| 2694 | + } |
|
| 2695 | + if (!defined('_SPIP_LOCK_MODE')) { |
|
| 2696 | + define('_SPIP_LOCK_MODE', 1); |
|
| 2697 | + } // utiliser le flock php |
|
| 2698 | + #if (!defined('_SPIP_LOCK_MODE')) define('_SPIP_LOCK_MODE',2); // utiliser le nfslock de spip mais link() est tres souvent interdite |
|
| 2699 | + } |
|
| 2700 | + |
|
| 2701 | + // Langue par defaut |
|
| 2702 | + if (!defined('_LANGUE_PAR_DEFAUT')) { |
|
| 2703 | + define('_LANGUE_PAR_DEFAUT', 'fr'); |
|
| 2704 | + } |
|
| 2705 | + |
|
| 2706 | + // |
|
| 2707 | + // Module de lecture/ecriture/suppression de fichiers utilisant flock() |
|
| 2708 | + // (non surchargeable en l'etat ; attention si on utilise include_spip() |
|
| 2709 | + // pour le rendre surchargeable, on va provoquer un reecriture |
|
| 2710 | + // systematique du noyau ou une baisse de perfs => a etudier) |
|
| 2711 | + include_once _ROOT_RESTREINT . 'inc/flock.php'; |
|
| 2712 | + |
|
| 2713 | + // charger tout de suite le path et son cache |
|
| 2714 | + load_path_cache(); |
|
| 2715 | + |
|
| 2716 | + // *********** traiter les variables ************ |
|
| 2717 | + |
|
| 2718 | + // |
|
| 2719 | + // Securite |
|
| 2720 | + // |
|
| 2721 | + |
|
| 2722 | + // Ne pas se faire manger par un bug php qui accepte ?GLOBALS[truc]=toto |
|
| 2723 | + if (isset($_REQUEST['GLOBALS'])) { |
|
| 2724 | + die(); |
|
| 2725 | + } |
|
| 2726 | + // nettoyer les magic quotes \' et les caracteres nuls %00 |
|
| 2727 | + spip_desinfecte($_GET); |
|
| 2728 | + spip_desinfecte($_POST); |
|
| 2729 | + spip_desinfecte($_COOKIE); |
|
| 2730 | + spip_desinfecte($_REQUEST); |
|
| 2731 | + |
|
| 2732 | + // appliquer le cookie_prefix |
|
| 2733 | + if ($GLOBALS['cookie_prefix'] != 'spip') { |
|
| 2734 | + include_spip('inc/cookie'); |
|
| 2735 | + recuperer_cookies_spip($GLOBALS['cookie_prefix']); |
|
| 2736 | + } |
|
| 2737 | + |
|
| 2738 | + // Compatibilite avec serveurs ne fournissant pas $REQUEST_URI |
|
| 2739 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
| 2740 | + $GLOBALS['REQUEST_URI'] = $_SERVER['REQUEST_URI']; |
|
| 2741 | + } else { |
|
| 2742 | + $GLOBALS['REQUEST_URI'] = (php_sapi_name() !== 'cli') ? $_SERVER['PHP_SELF'] : ''; |
|
| 2743 | + if ( |
|
| 2744 | + !empty($_SERVER['QUERY_STRING']) |
|
| 2745 | + and !strpos($_SERVER['REQUEST_URI'], '?') |
|
| 2746 | + ) { |
|
| 2747 | + $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
| 2748 | + } |
|
| 2749 | + } |
|
| 2750 | + |
|
| 2751 | + // Duree de validite de l'alea pour les cookies et ce qui s'ensuit. |
|
| 2752 | + if (!defined('_RENOUVELLE_ALEA')) { |
|
| 2753 | + define('_RENOUVELLE_ALEA', 12 * 3600); |
|
| 2754 | + } |
|
| 2755 | + if (!defined('_DUREE_COOKIE_ADMIN')) { |
|
| 2756 | + define('_DUREE_COOKIE_ADMIN', 14 * 24 * 3600); |
|
| 2757 | + } |
|
| 2758 | + |
|
| 2759 | + // charger les meta si possible et renouveller l'alea au besoin |
|
| 2760 | + // charge aussi effacer_meta et ecrire_meta |
|
| 2761 | + $inc_meta = charger_fonction('meta', 'inc'); |
|
| 2762 | + $inc_meta(); |
|
| 2763 | + |
|
| 2764 | + // nombre de repertoires depuis la racine |
|
| 2765 | + // on compare a l'adresse de spip.php : $_SERVER["SCRIPT_NAME"] |
|
| 2766 | + // ou a defaut celle donnee en meta ; (mais si celle-ci est fausse |
|
| 2767 | + // le calcul est faux) |
|
| 2768 | + if (!_DIR_RESTREINT) { |
|
| 2769 | + $GLOBALS['profondeur_url'] = 1; |
|
| 2770 | + } else { |
|
| 2771 | + $uri = isset($_SERVER['REQUEST_URI']) ? explode('?', $_SERVER['REQUEST_URI']) : ''; |
|
| 2772 | + $uri_ref = $_SERVER['SCRIPT_NAME']; |
|
| 2773 | + if ( |
|
| 2774 | + !$uri_ref |
|
| 2775 | + // si on est appele avec un autre ti, on est sans doute en mutu |
|
| 2776 | + // si jamais c'est de la mutu avec sous rep, on est perdu si on se fie |
|
| 2777 | + // a spip.php qui est a la racine du spip, et vue qu'on sait pas se reperer |
|
| 2778 | + // s'en remettre a l'adresse du site. alea jacta est. |
|
| 2779 | + or $ti !== _NOM_TEMPORAIRES_INACCESSIBLES |
|
| 2780 | + ) { |
|
| 2781 | + if (isset($GLOBALS['meta']['adresse_site'])) { |
|
| 2782 | + $uri_ref = parse_url($GLOBALS['meta']['adresse_site']); |
|
| 2783 | + $uri_ref = ($uri_ref['path'] ?? '') . '/'; |
|
| 2784 | + } else { |
|
| 2785 | + $uri_ref = ''; |
|
| 2786 | + } |
|
| 2787 | + } |
|
| 2788 | + if (!$uri or !$uri_ref) { |
|
| 2789 | + $GLOBALS['profondeur_url'] = 0; |
|
| 2790 | + } else { |
|
| 2791 | + $GLOBALS['profondeur_url'] = max( |
|
| 2792 | + 0, |
|
| 2793 | + substr_count($uri[0], '/') |
|
| 2794 | + - substr_count($uri_ref, '/') |
|
| 2795 | + ); |
|
| 2796 | + } |
|
| 2797 | + } |
|
| 2798 | + // s'il y a un cookie ou PHP_AUTH, initialiser visiteur_session |
|
| 2799 | + if (_FILE_CONNECT) { |
|
| 2800 | + if ( |
|
| 2801 | + verifier_visiteur() == '0minirezo' |
|
| 2802 | + // si c'est un admin sans cookie admin, il faut ignorer le cache chemin ! |
|
| 2803 | + and !isset($_COOKIE['spip_admin']) |
|
| 2804 | + ) { |
|
| 2805 | + clear_path_cache(); |
|
| 2806 | + } |
|
| 2807 | + } |
|
| 2809 | 2808 | } |
| 2810 | 2809 | |
| 2811 | 2810 | /** |
@@ -2814,157 +2813,157 @@ discard block |
||
| 2814 | 2813 | * |
| 2815 | 2814 | */ |
| 2816 | 2815 | function spip_initialisation_suite() { |
| 2817 | - static $too_late = 0; |
|
| 2818 | - if ($too_late++) { |
|
| 2819 | - return; |
|
| 2820 | - } |
|
| 2821 | - |
|
| 2822 | - // taille mini des login |
|
| 2823 | - if (!defined('_LOGIN_TROP_COURT')) { |
|
| 2824 | - define('_LOGIN_TROP_COURT', 4); |
|
| 2825 | - } |
|
| 2826 | - |
|
| 2827 | - // la taille maxi des logos (0 : pas de limite) (pas de define par defaut, ce n'est pas utile) |
|
| 2828 | - #if (!defined('_LOGO_MAX_SIZE')) define('_LOGO_MAX_SIZE', 0); # poids en ko |
|
| 2829 | - #if (!defined('_LOGO_MAX_WIDTH')) define('_LOGO_MAX_WIDTH', 0); # largeur en pixels |
|
| 2830 | - #if (!defined('_LOGO_MAX_HEIGHT')) define('_LOGO_MAX_HEIGHT', 0); # hauteur en pixels |
|
| 2831 | - |
|
| 2832 | - // la taille maxi des images (0 : pas de limite) (pas de define par defaut, ce n'est pas utile) |
|
| 2833 | - #if (!defined('_DOC_MAX_SIZE')) define('_DOC_MAX_SIZE', 0); # poids en ko |
|
| 2834 | - #if (!defined('_IMG_MAX_SIZE')) define('_IMG_MAX_SIZE', 0); # poids en ko |
|
| 2835 | - #if (!defined('_IMG_MAX_WIDTH')) define('_IMG_MAX_WIDTH', 0); # largeur en pixels |
|
| 2836 | - #if (!defined('_IMG_MAX_HEIGHT')) define('_IMG_MAX_HEIGHT', 0); # hauteur en pixels |
|
| 2837 | - |
|
| 2838 | - if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 2839 | - define('_PASS_LONGUEUR_MINI', 6); |
|
| 2840 | - } |
|
| 2841 | - |
|
| 2842 | - // largeur maximale des images dans l'administration |
|
| 2843 | - if (!defined('_IMG_ADMIN_MAX_WIDTH')) { |
|
| 2844 | - define('_IMG_ADMIN_MAX_WIDTH', 768); |
|
| 2845 | - } |
|
| 2846 | - |
|
| 2847 | - // Qualite des images calculees automatiquement. C'est un nombre entre 0 et 100, meme pour imagick (on ramene a 0..1 par la suite) |
|
| 2848 | - if (!defined('_IMG_QUALITE')) { |
|
| 2849 | - define('_IMG_QUALITE', 85); |
|
| 2850 | - } # valeur par defaut |
|
| 2851 | - if (!defined('_IMG_GD_QUALITE')) { |
|
| 2852 | - define('_IMG_GD_QUALITE', _IMG_QUALITE); |
|
| 2853 | - } # surcharge pour la lib GD |
|
| 2854 | - if (!defined('_IMG_CONVERT_QUALITE')) { |
|
| 2855 | - define('_IMG_CONVERT_QUALITE', _IMG_QUALITE); |
|
| 2856 | - } # surcharge pour imagick en ligne de commande |
|
| 2857 | - // Historiquement la valeur pour imagick semble differente. Si ca n'est pas necessaire, il serait preferable de garder _IMG_QUALITE |
|
| 2858 | - if (!defined('_IMG_IMAGICK_QUALITE')) { |
|
| 2859 | - define('_IMG_IMAGICK_QUALITE', 75); |
|
| 2860 | - } # surcharge pour imagick en PHP |
|
| 2861 | - |
|
| 2862 | - if (!defined('_COPIE_LOCALE_MAX_SIZE')) { |
|
| 2863 | - define('_COPIE_LOCALE_MAX_SIZE', 33_554_432); |
|
| 2864 | - } // poids en octet |
|
| 2865 | - |
|
| 2866 | - // qq chaines standard |
|
| 2867 | - if (!defined('_ACCESS_FILE_NAME')) { |
|
| 2868 | - define('_ACCESS_FILE_NAME', '.htaccess'); |
|
| 2869 | - } |
|
| 2870 | - if (!defined('_AUTH_USER_FILE')) { |
|
| 2871 | - define('_AUTH_USER_FILE', '.htpasswd'); |
|
| 2872 | - } |
|
| 2873 | - if (!defined('_SPIP_DUMP')) { |
|
| 2874 | - define('_SPIP_DUMP', 'dump@nom_site@@[email protected]'); |
|
| 2875 | - } |
|
| 2876 | - if (!defined('_CACHE_RUBRIQUES')) { |
|
| 2877 | - /** Fichier cache pour le navigateur de rubrique du bandeau */ |
|
| 2878 | - define('_CACHE_RUBRIQUES', _DIR_TMP . 'menu-rubriques-cache.txt'); |
|
| 2879 | - } |
|
| 2880 | - if (!defined('_CACHE_RUBRIQUES_MAX')) { |
|
| 2881 | - /** Nombre maxi de rubriques enfants affichées pour chaque rubrique du navigateur de rubrique du bandeau */ |
|
| 2882 | - define('_CACHE_RUBRIQUES_MAX', 500); |
|
| 2883 | - } |
|
| 2884 | - |
|
| 2885 | - if (!defined('_CACHE_CONTEXTES_AJAX_SUR_LONGUEUR')) { |
|
| 2886 | - /** |
|
| 2887 | - * Basculer les contextes ajax en fichier si la longueur d’url est trop grande |
|
| 2888 | - * @var int Nombre de caractères */ |
|
| 2889 | - define('_CACHE_CONTEXTES_AJAX_SUR_LONGUEUR', 2000); |
|
| 2890 | - } |
|
| 2891 | - |
|
| 2892 | - if (!defined('_EXTENSION_SQUELETTES')) { |
|
| 2893 | - define('_EXTENSION_SQUELETTES', 'html'); |
|
| 2894 | - } |
|
| 2895 | - |
|
| 2896 | - if (!defined('_DOCTYPE_ECRIRE')) { |
|
| 2897 | - /** Définit le doctype de l’espace privé */ |
|
| 2898 | - define('_DOCTYPE_ECRIRE', "<!DOCTYPE html>\n"); |
|
| 2899 | - } |
|
| 2900 | - if (!defined('_DOCTYPE_AIDE')) { |
|
| 2901 | - /** Définit le doctype de l’aide en ligne */ |
|
| 2902 | - define( |
|
| 2903 | - '_DOCTYPE_AIDE', |
|
| 2904 | - "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd'>" |
|
| 2905 | - ); |
|
| 2906 | - } |
|
| 2907 | - |
|
| 2908 | - if (!defined('_SPIP_SCRIPT')) { |
|
| 2909 | - /** L'adresse de base du site ; on peut mettre '' si la racine est gerée par |
|
| 2910 | - * le script de l'espace public, alias index.php */ |
|
| 2911 | - define('_SPIP_SCRIPT', 'spip.php'); |
|
| 2912 | - } |
|
| 2913 | - if (!defined('_SPIP_PAGE')) { |
|
| 2914 | - /** Argument page, personalisable en cas de conflit avec un autre script */ |
|
| 2915 | - define('_SPIP_PAGE', 'page'); |
|
| 2916 | - } |
|
| 2917 | - |
|
| 2918 | - // le script de l'espace prive |
|
| 2919 | - // Mettre a "index.php" si DirectoryIndex ne le fait pas ou pb connexes: |
|
| 2920 | - // les anciens IIS n'acceptent pas les POST sur ecrire/ (#419) |
|
| 2921 | - // meme pb sur thttpd cf. https://forum.spip.net/fr_184153.html |
|
| 2922 | - if (!defined('_SPIP_ECRIRE_SCRIPT')) { |
|
| 2923 | - if (!empty($_SERVER['SERVER_SOFTWARE']) and preg_match(',IIS|thttpd,', $_SERVER['SERVER_SOFTWARE'])) { |
|
| 2924 | - define('_SPIP_ECRIRE_SCRIPT', 'index.php'); |
|
| 2925 | - } else { |
|
| 2926 | - define('_SPIP_ECRIRE_SCRIPT', ''); |
|
| 2927 | - } |
|
| 2928 | - } |
|
| 2929 | - |
|
| 2930 | - |
|
| 2931 | - if (!defined('_SPIP_AJAX')) { |
|
| 2932 | - define('_SPIP_AJAX', ((!isset($_COOKIE['spip_accepte_ajax'])) |
|
| 2933 | - ? 1 |
|
| 2934 | - : (($_COOKIE['spip_accepte_ajax'] != -1) ? 1 : 0))); |
|
| 2935 | - } |
|
| 2936 | - |
|
| 2937 | - // La requete est-elle en ajax ? |
|
| 2938 | - if (!defined('_AJAX')) { |
|
| 2939 | - define( |
|
| 2940 | - '_AJAX', |
|
| 2941 | - (isset($_SERVER['HTTP_X_REQUESTED_WITH']) # ajax jQuery |
|
| 2942 | - or !empty($_REQUEST['var_ajax_redir']) # redirection 302 apres ajax jQuery |
|
| 2943 | - or !empty($_REQUEST['var_ajaxcharset']) # compat ascendante pour plugins |
|
| 2944 | - or !empty($_REQUEST['var_ajax']) # forms ajax & inclure ajax de spip |
|
| 2945 | - ) |
|
| 2946 | - and empty($_REQUEST['var_noajax']) # horrible exception, car c'est pas parce que la requete est ajax jquery qu'il faut tuer tous les formulaires ajax qu'elle contient |
|
| 2947 | - ); |
|
| 2948 | - } |
|
| 2949 | - |
|
| 2950 | - # nombre de pixels maxi pour calcul de la vignette avec gd |
|
| 2951 | - # au dela de 5500000 on considere que php n'est pas limite en memoire pour cette operation |
|
| 2952 | - # les configurations limitees en memoire ont un seuil plutot vers 1MPixel |
|
| 2953 | - if (!defined('_IMG_GD_MAX_PIXELS')) { |
|
| 2954 | - define( |
|
| 2955 | - '_IMG_GD_MAX_PIXELS', |
|
| 2956 | - (isset($GLOBALS['meta']['max_taille_vignettes']) and $GLOBALS['meta']['max_taille_vignettes']) |
|
| 2957 | - ? $GLOBALS['meta']['max_taille_vignettes'] |
|
| 2958 | - : 0 |
|
| 2959 | - ); |
|
| 2960 | - } |
|
| 2961 | - |
|
| 2962 | - // Protocoles a normaliser dans les chaines de langues |
|
| 2963 | - if (!defined('_PROTOCOLES_STD')) { |
|
| 2964 | - define('_PROTOCOLES_STD', 'http|https|ftp|mailto|webcal'); |
|
| 2965 | - } |
|
| 2966 | - |
|
| 2967 | - init_var_mode(); |
|
| 2816 | + static $too_late = 0; |
|
| 2817 | + if ($too_late++) { |
|
| 2818 | + return; |
|
| 2819 | + } |
|
| 2820 | + |
|
| 2821 | + // taille mini des login |
|
| 2822 | + if (!defined('_LOGIN_TROP_COURT')) { |
|
| 2823 | + define('_LOGIN_TROP_COURT', 4); |
|
| 2824 | + } |
|
| 2825 | + |
|
| 2826 | + // la taille maxi des logos (0 : pas de limite) (pas de define par defaut, ce n'est pas utile) |
|
| 2827 | + #if (!defined('_LOGO_MAX_SIZE')) define('_LOGO_MAX_SIZE', 0); # poids en ko |
|
| 2828 | + #if (!defined('_LOGO_MAX_WIDTH')) define('_LOGO_MAX_WIDTH', 0); # largeur en pixels |
|
| 2829 | + #if (!defined('_LOGO_MAX_HEIGHT')) define('_LOGO_MAX_HEIGHT', 0); # hauteur en pixels |
|
| 2830 | + |
|
| 2831 | + // la taille maxi des images (0 : pas de limite) (pas de define par defaut, ce n'est pas utile) |
|
| 2832 | + #if (!defined('_DOC_MAX_SIZE')) define('_DOC_MAX_SIZE', 0); # poids en ko |
|
| 2833 | + #if (!defined('_IMG_MAX_SIZE')) define('_IMG_MAX_SIZE', 0); # poids en ko |
|
| 2834 | + #if (!defined('_IMG_MAX_WIDTH')) define('_IMG_MAX_WIDTH', 0); # largeur en pixels |
|
| 2835 | + #if (!defined('_IMG_MAX_HEIGHT')) define('_IMG_MAX_HEIGHT', 0); # hauteur en pixels |
|
| 2836 | + |
|
| 2837 | + if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 2838 | + define('_PASS_LONGUEUR_MINI', 6); |
|
| 2839 | + } |
|
| 2840 | + |
|
| 2841 | + // largeur maximale des images dans l'administration |
|
| 2842 | + if (!defined('_IMG_ADMIN_MAX_WIDTH')) { |
|
| 2843 | + define('_IMG_ADMIN_MAX_WIDTH', 768); |
|
| 2844 | + } |
|
| 2845 | + |
|
| 2846 | + // Qualite des images calculees automatiquement. C'est un nombre entre 0 et 100, meme pour imagick (on ramene a 0..1 par la suite) |
|
| 2847 | + if (!defined('_IMG_QUALITE')) { |
|
| 2848 | + define('_IMG_QUALITE', 85); |
|
| 2849 | + } # valeur par defaut |
|
| 2850 | + if (!defined('_IMG_GD_QUALITE')) { |
|
| 2851 | + define('_IMG_GD_QUALITE', _IMG_QUALITE); |
|
| 2852 | + } # surcharge pour la lib GD |
|
| 2853 | + if (!defined('_IMG_CONVERT_QUALITE')) { |
|
| 2854 | + define('_IMG_CONVERT_QUALITE', _IMG_QUALITE); |
|
| 2855 | + } # surcharge pour imagick en ligne de commande |
|
| 2856 | + // Historiquement la valeur pour imagick semble differente. Si ca n'est pas necessaire, il serait preferable de garder _IMG_QUALITE |
|
| 2857 | + if (!defined('_IMG_IMAGICK_QUALITE')) { |
|
| 2858 | + define('_IMG_IMAGICK_QUALITE', 75); |
|
| 2859 | + } # surcharge pour imagick en PHP |
|
| 2860 | + |
|
| 2861 | + if (!defined('_COPIE_LOCALE_MAX_SIZE')) { |
|
| 2862 | + define('_COPIE_LOCALE_MAX_SIZE', 33_554_432); |
|
| 2863 | + } // poids en octet |
|
| 2864 | + |
|
| 2865 | + // qq chaines standard |
|
| 2866 | + if (!defined('_ACCESS_FILE_NAME')) { |
|
| 2867 | + define('_ACCESS_FILE_NAME', '.htaccess'); |
|
| 2868 | + } |
|
| 2869 | + if (!defined('_AUTH_USER_FILE')) { |
|
| 2870 | + define('_AUTH_USER_FILE', '.htpasswd'); |
|
| 2871 | + } |
|
| 2872 | + if (!defined('_SPIP_DUMP')) { |
|
| 2873 | + define('_SPIP_DUMP', 'dump@nom_site@@[email protected]'); |
|
| 2874 | + } |
|
| 2875 | + if (!defined('_CACHE_RUBRIQUES')) { |
|
| 2876 | + /** Fichier cache pour le navigateur de rubrique du bandeau */ |
|
| 2877 | + define('_CACHE_RUBRIQUES', _DIR_TMP . 'menu-rubriques-cache.txt'); |
|
| 2878 | + } |
|
| 2879 | + if (!defined('_CACHE_RUBRIQUES_MAX')) { |
|
| 2880 | + /** Nombre maxi de rubriques enfants affichées pour chaque rubrique du navigateur de rubrique du bandeau */ |
|
| 2881 | + define('_CACHE_RUBRIQUES_MAX', 500); |
|
| 2882 | + } |
|
| 2883 | + |
|
| 2884 | + if (!defined('_CACHE_CONTEXTES_AJAX_SUR_LONGUEUR')) { |
|
| 2885 | + /** |
|
| 2886 | + * Basculer les contextes ajax en fichier si la longueur d’url est trop grande |
|
| 2887 | + * @var int Nombre de caractères */ |
|
| 2888 | + define('_CACHE_CONTEXTES_AJAX_SUR_LONGUEUR', 2000); |
|
| 2889 | + } |
|
| 2890 | + |
|
| 2891 | + if (!defined('_EXTENSION_SQUELETTES')) { |
|
| 2892 | + define('_EXTENSION_SQUELETTES', 'html'); |
|
| 2893 | + } |
|
| 2894 | + |
|
| 2895 | + if (!defined('_DOCTYPE_ECRIRE')) { |
|
| 2896 | + /** Définit le doctype de l’espace privé */ |
|
| 2897 | + define('_DOCTYPE_ECRIRE', "<!DOCTYPE html>\n"); |
|
| 2898 | + } |
|
| 2899 | + if (!defined('_DOCTYPE_AIDE')) { |
|
| 2900 | + /** Définit le doctype de l’aide en ligne */ |
|
| 2901 | + define( |
|
| 2902 | + '_DOCTYPE_AIDE', |
|
| 2903 | + "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd'>" |
|
| 2904 | + ); |
|
| 2905 | + } |
|
| 2906 | + |
|
| 2907 | + if (!defined('_SPIP_SCRIPT')) { |
|
| 2908 | + /** L'adresse de base du site ; on peut mettre '' si la racine est gerée par |
|
| 2909 | + * le script de l'espace public, alias index.php */ |
|
| 2910 | + define('_SPIP_SCRIPT', 'spip.php'); |
|
| 2911 | + } |
|
| 2912 | + if (!defined('_SPIP_PAGE')) { |
|
| 2913 | + /** Argument page, personalisable en cas de conflit avec un autre script */ |
|
| 2914 | + define('_SPIP_PAGE', 'page'); |
|
| 2915 | + } |
|
| 2916 | + |
|
| 2917 | + // le script de l'espace prive |
|
| 2918 | + // Mettre a "index.php" si DirectoryIndex ne le fait pas ou pb connexes: |
|
| 2919 | + // les anciens IIS n'acceptent pas les POST sur ecrire/ (#419) |
|
| 2920 | + // meme pb sur thttpd cf. https://forum.spip.net/fr_184153.html |
|
| 2921 | + if (!defined('_SPIP_ECRIRE_SCRIPT')) { |
|
| 2922 | + if (!empty($_SERVER['SERVER_SOFTWARE']) and preg_match(',IIS|thttpd,', $_SERVER['SERVER_SOFTWARE'])) { |
|
| 2923 | + define('_SPIP_ECRIRE_SCRIPT', 'index.php'); |
|
| 2924 | + } else { |
|
| 2925 | + define('_SPIP_ECRIRE_SCRIPT', ''); |
|
| 2926 | + } |
|
| 2927 | + } |
|
| 2928 | + |
|
| 2929 | + |
|
| 2930 | + if (!defined('_SPIP_AJAX')) { |
|
| 2931 | + define('_SPIP_AJAX', ((!isset($_COOKIE['spip_accepte_ajax'])) |
|
| 2932 | + ? 1 |
|
| 2933 | + : (($_COOKIE['spip_accepte_ajax'] != -1) ? 1 : 0))); |
|
| 2934 | + } |
|
| 2935 | + |
|
| 2936 | + // La requete est-elle en ajax ? |
|
| 2937 | + if (!defined('_AJAX')) { |
|
| 2938 | + define( |
|
| 2939 | + '_AJAX', |
|
| 2940 | + (isset($_SERVER['HTTP_X_REQUESTED_WITH']) # ajax jQuery |
|
| 2941 | + or !empty($_REQUEST['var_ajax_redir']) # redirection 302 apres ajax jQuery |
|
| 2942 | + or !empty($_REQUEST['var_ajaxcharset']) # compat ascendante pour plugins |
|
| 2943 | + or !empty($_REQUEST['var_ajax']) # forms ajax & inclure ajax de spip |
|
| 2944 | + ) |
|
| 2945 | + and empty($_REQUEST['var_noajax']) # horrible exception, car c'est pas parce que la requete est ajax jquery qu'il faut tuer tous les formulaires ajax qu'elle contient |
|
| 2946 | + ); |
|
| 2947 | + } |
|
| 2948 | + |
|
| 2949 | + # nombre de pixels maxi pour calcul de la vignette avec gd |
|
| 2950 | + # au dela de 5500000 on considere que php n'est pas limite en memoire pour cette operation |
|
| 2951 | + # les configurations limitees en memoire ont un seuil plutot vers 1MPixel |
|
| 2952 | + if (!defined('_IMG_GD_MAX_PIXELS')) { |
|
| 2953 | + define( |
|
| 2954 | + '_IMG_GD_MAX_PIXELS', |
|
| 2955 | + (isset($GLOBALS['meta']['max_taille_vignettes']) and $GLOBALS['meta']['max_taille_vignettes']) |
|
| 2956 | + ? $GLOBALS['meta']['max_taille_vignettes'] |
|
| 2957 | + : 0 |
|
| 2958 | + ); |
|
| 2959 | + } |
|
| 2960 | + |
|
| 2961 | + // Protocoles a normaliser dans les chaines de langues |
|
| 2962 | + if (!defined('_PROTOCOLES_STD')) { |
|
| 2963 | + define('_PROTOCOLES_STD', 'http|https|ftp|mailto|webcal'); |
|
| 2964 | + } |
|
| 2965 | + |
|
| 2966 | + init_var_mode(); |
|
| 2968 | 2967 | } |
| 2969 | 2968 | |
| 2970 | 2969 | /** |
@@ -2998,136 +2997,136 @@ discard block |
||
| 2998 | 2997 | * ` var_mode` (calcul ou recalcul). |
| 2999 | 2998 | */ |
| 3000 | 2999 | function init_var_mode() { |
| 3001 | - static $done = false; |
|
| 3002 | - if (!$done) { |
|
| 3003 | - if (isset($_GET['var_mode'])) { |
|
| 3004 | - $var_mode = explode(',', $_GET['var_mode']); |
|
| 3005 | - // tout le monde peut calcul/recalcul |
|
| 3006 | - if (!defined('_VAR_MODE')) { |
|
| 3007 | - if (in_array('recalcul', $var_mode)) { |
|
| 3008 | - define('_VAR_MODE', 'recalcul'); |
|
| 3009 | - } elseif (in_array('calcul', $var_mode)) { |
|
| 3010 | - define('_VAR_MODE', 'calcul'); |
|
| 3011 | - } |
|
| 3012 | - } |
|
| 3013 | - $var_mode = array_diff($var_mode, ['calcul', 'recalcul']); |
|
| 3014 | - if ($var_mode) { |
|
| 3015 | - include_spip('inc/autoriser'); |
|
| 3016 | - // autoriser preview si preview seulement, et sinon autoriser debug |
|
| 3017 | - if ( |
|
| 3018 | - autoriser( |
|
| 3019 | - ($_GET['var_mode'] == 'preview') |
|
| 3020 | - ? 'previsualiser' |
|
| 3021 | - : 'debug' |
|
| 3022 | - ) |
|
| 3023 | - ) { |
|
| 3024 | - if (in_array('traduction', $var_mode)) { |
|
| 3025 | - // forcer le calcul pour passer dans traduire |
|
| 3026 | - if (!defined('_VAR_MODE')) { |
|
| 3027 | - define('_VAR_MODE', 'calcul'); |
|
| 3028 | - } |
|
| 3029 | - // et ne pas enregistrer de cache pour ne pas trainer les surlignages sur d'autres pages |
|
| 3030 | - if (!defined('_VAR_NOCACHE')) { |
|
| 3031 | - define('_VAR_NOCACHE', true); |
|
| 3032 | - } |
|
| 3033 | - $var_mode = array_diff($var_mode, ['traduction']); |
|
| 3034 | - } |
|
| 3035 | - if (in_array('preview', $var_mode)) { |
|
| 3036 | - // basculer sur les criteres de preview dans les boucles |
|
| 3037 | - if (!defined('_VAR_PREVIEW')) { |
|
| 3038 | - define('_VAR_PREVIEW', true); |
|
| 3039 | - } |
|
| 3040 | - // forcer le calcul |
|
| 3041 | - if (!defined('_VAR_MODE')) { |
|
| 3042 | - define('_VAR_MODE', 'calcul'); |
|
| 3043 | - } |
|
| 3044 | - // et ne pas enregistrer de cache |
|
| 3045 | - if (!defined('_VAR_NOCACHE')) { |
|
| 3046 | - define('_VAR_NOCACHE', true); |
|
| 3047 | - } |
|
| 3048 | - $var_mode = array_diff($var_mode, ['preview']); |
|
| 3049 | - } |
|
| 3050 | - if (in_array('inclure', $var_mode)) { |
|
| 3051 | - // forcer le compilo et ignorer les caches existants |
|
| 3052 | - if (!defined('_VAR_MODE')) { |
|
| 3053 | - define('_VAR_MODE', 'calcul'); |
|
| 3054 | - } |
|
| 3055 | - if (!defined('_VAR_INCLURE')) { |
|
| 3056 | - define('_VAR_INCLURE', true); |
|
| 3057 | - } |
|
| 3058 | - // et ne pas enregistrer de cache |
|
| 3059 | - if (!defined('_VAR_NOCACHE')) { |
|
| 3060 | - define('_VAR_NOCACHE', true); |
|
| 3061 | - } |
|
| 3062 | - $var_mode = array_diff($var_mode, ['inclure']); |
|
| 3063 | - } |
|
| 3064 | - if (in_array('urls', $var_mode)) { |
|
| 3065 | - // forcer le compilo et ignorer les caches existants |
|
| 3066 | - if (!defined('_VAR_MODE')) { |
|
| 3067 | - define('_VAR_MODE', 'calcul'); |
|
| 3068 | - } |
|
| 3069 | - if (!defined('_VAR_URLS')) { |
|
| 3070 | - define('_VAR_URLS', true); |
|
| 3071 | - } |
|
| 3072 | - $var_mode = array_diff($var_mode, ['urls']); |
|
| 3073 | - } |
|
| 3074 | - if (in_array('images', $var_mode)) { |
|
| 3075 | - // forcer le compilo et ignorer les caches existants |
|
| 3076 | - if (!defined('_VAR_MODE')) { |
|
| 3077 | - define('_VAR_MODE', 'calcul'); |
|
| 3078 | - } |
|
| 3079 | - // indiquer qu'on doit recalculer les images |
|
| 3080 | - if (!defined('_VAR_IMAGES')) { |
|
| 3081 | - define('_VAR_IMAGES', true); |
|
| 3082 | - } |
|
| 3083 | - $var_mode = array_diff($var_mode, ['images']); |
|
| 3084 | - } |
|
| 3085 | - if (in_array('debug', $var_mode)) { |
|
| 3086 | - if (!defined('_VAR_MODE')) { |
|
| 3087 | - define('_VAR_MODE', 'debug'); |
|
| 3088 | - } |
|
| 3089 | - // et ne pas enregistrer de cache |
|
| 3090 | - if (!defined('_VAR_NOCACHE')) { |
|
| 3091 | - define('_VAR_NOCACHE', true); |
|
| 3092 | - } |
|
| 3093 | - $var_mode = array_diff($var_mode, ['debug']); |
|
| 3094 | - } |
|
| 3095 | - if (count($var_mode) and !defined('_VAR_MODE')) { |
|
| 3096 | - define('_VAR_MODE', reset($var_mode)); |
|
| 3097 | - } |
|
| 3098 | - if (isset($GLOBALS['visiteur_session']['nom'])) { |
|
| 3099 | - spip_log($GLOBALS['visiteur_session']['nom'] |
|
| 3100 | - . ' ' . _VAR_MODE); |
|
| 3101 | - } |
|
| 3102 | - } // pas autorise ? |
|
| 3103 | - else { |
|
| 3104 | - // si on n'est pas connecte on se redirige, si on est pas en cli et pas deja en train de se loger |
|
| 3105 | - if ( |
|
| 3106 | - !$GLOBALS['visiteur_session'] |
|
| 3107 | - and !empty($_SERVER['HTTP_HOST']) |
|
| 3108 | - and !empty($_SERVER['REQUEST_METHOD']) |
|
| 3109 | - and $_SERVER['REQUEST_METHOD'] === 'GET' |
|
| 3110 | - ) { |
|
| 3111 | - $self = self('&', true); |
|
| 3112 | - if (strpos($self, 'page=login') === false) { |
|
| 3113 | - include_spip('inc/headers'); |
|
| 3114 | - $redirect = parametre_url(self('&', true), 'var_mode', $_GET['var_mode'], '&'); |
|
| 3115 | - redirige_par_entete(generer_url_public('login', 'url=' . rawurlencode($redirect), true)); |
|
| 3116 | - } |
|
| 3117 | - } |
|
| 3118 | - // sinon tant pis |
|
| 3119 | - } |
|
| 3120 | - } |
|
| 3121 | - } |
|
| 3122 | - if (!defined('_VAR_MODE')) { |
|
| 3123 | - /** |
|
| 3124 | - * Indique le mode de calcul ou d'affichage de la page. |
|
| 3125 | - * @see init_var_mode() |
|
| 3126 | - */ |
|
| 3127 | - define('_VAR_MODE', false); |
|
| 3128 | - } |
|
| 3129 | - $done = true; |
|
| 3130 | - } |
|
| 3000 | + static $done = false; |
|
| 3001 | + if (!$done) { |
|
| 3002 | + if (isset($_GET['var_mode'])) { |
|
| 3003 | + $var_mode = explode(',', $_GET['var_mode']); |
|
| 3004 | + // tout le monde peut calcul/recalcul |
|
| 3005 | + if (!defined('_VAR_MODE')) { |
|
| 3006 | + if (in_array('recalcul', $var_mode)) { |
|
| 3007 | + define('_VAR_MODE', 'recalcul'); |
|
| 3008 | + } elseif (in_array('calcul', $var_mode)) { |
|
| 3009 | + define('_VAR_MODE', 'calcul'); |
|
| 3010 | + } |
|
| 3011 | + } |
|
| 3012 | + $var_mode = array_diff($var_mode, ['calcul', 'recalcul']); |
|
| 3013 | + if ($var_mode) { |
|
| 3014 | + include_spip('inc/autoriser'); |
|
| 3015 | + // autoriser preview si preview seulement, et sinon autoriser debug |
|
| 3016 | + if ( |
|
| 3017 | + autoriser( |
|
| 3018 | + ($_GET['var_mode'] == 'preview') |
|
| 3019 | + ? 'previsualiser' |
|
| 3020 | + : 'debug' |
|
| 3021 | + ) |
|
| 3022 | + ) { |
|
| 3023 | + if (in_array('traduction', $var_mode)) { |
|
| 3024 | + // forcer le calcul pour passer dans traduire |
|
| 3025 | + if (!defined('_VAR_MODE')) { |
|
| 3026 | + define('_VAR_MODE', 'calcul'); |
|
| 3027 | + } |
|
| 3028 | + // et ne pas enregistrer de cache pour ne pas trainer les surlignages sur d'autres pages |
|
| 3029 | + if (!defined('_VAR_NOCACHE')) { |
|
| 3030 | + define('_VAR_NOCACHE', true); |
|
| 3031 | + } |
|
| 3032 | + $var_mode = array_diff($var_mode, ['traduction']); |
|
| 3033 | + } |
|
| 3034 | + if (in_array('preview', $var_mode)) { |
|
| 3035 | + // basculer sur les criteres de preview dans les boucles |
|
| 3036 | + if (!defined('_VAR_PREVIEW')) { |
|
| 3037 | + define('_VAR_PREVIEW', true); |
|
| 3038 | + } |
|
| 3039 | + // forcer le calcul |
|
| 3040 | + if (!defined('_VAR_MODE')) { |
|
| 3041 | + define('_VAR_MODE', 'calcul'); |
|
| 3042 | + } |
|
| 3043 | + // et ne pas enregistrer de cache |
|
| 3044 | + if (!defined('_VAR_NOCACHE')) { |
|
| 3045 | + define('_VAR_NOCACHE', true); |
|
| 3046 | + } |
|
| 3047 | + $var_mode = array_diff($var_mode, ['preview']); |
|
| 3048 | + } |
|
| 3049 | + if (in_array('inclure', $var_mode)) { |
|
| 3050 | + // forcer le compilo et ignorer les caches existants |
|
| 3051 | + if (!defined('_VAR_MODE')) { |
|
| 3052 | + define('_VAR_MODE', 'calcul'); |
|
| 3053 | + } |
|
| 3054 | + if (!defined('_VAR_INCLURE')) { |
|
| 3055 | + define('_VAR_INCLURE', true); |
|
| 3056 | + } |
|
| 3057 | + // et ne pas enregistrer de cache |
|
| 3058 | + if (!defined('_VAR_NOCACHE')) { |
|
| 3059 | + define('_VAR_NOCACHE', true); |
|
| 3060 | + } |
|
| 3061 | + $var_mode = array_diff($var_mode, ['inclure']); |
|
| 3062 | + } |
|
| 3063 | + if (in_array('urls', $var_mode)) { |
|
| 3064 | + // forcer le compilo et ignorer les caches existants |
|
| 3065 | + if (!defined('_VAR_MODE')) { |
|
| 3066 | + define('_VAR_MODE', 'calcul'); |
|
| 3067 | + } |
|
| 3068 | + if (!defined('_VAR_URLS')) { |
|
| 3069 | + define('_VAR_URLS', true); |
|
| 3070 | + } |
|
| 3071 | + $var_mode = array_diff($var_mode, ['urls']); |
|
| 3072 | + } |
|
| 3073 | + if (in_array('images', $var_mode)) { |
|
| 3074 | + // forcer le compilo et ignorer les caches existants |
|
| 3075 | + if (!defined('_VAR_MODE')) { |
|
| 3076 | + define('_VAR_MODE', 'calcul'); |
|
| 3077 | + } |
|
| 3078 | + // indiquer qu'on doit recalculer les images |
|
| 3079 | + if (!defined('_VAR_IMAGES')) { |
|
| 3080 | + define('_VAR_IMAGES', true); |
|
| 3081 | + } |
|
| 3082 | + $var_mode = array_diff($var_mode, ['images']); |
|
| 3083 | + } |
|
| 3084 | + if (in_array('debug', $var_mode)) { |
|
| 3085 | + if (!defined('_VAR_MODE')) { |
|
| 3086 | + define('_VAR_MODE', 'debug'); |
|
| 3087 | + } |
|
| 3088 | + // et ne pas enregistrer de cache |
|
| 3089 | + if (!defined('_VAR_NOCACHE')) { |
|
| 3090 | + define('_VAR_NOCACHE', true); |
|
| 3091 | + } |
|
| 3092 | + $var_mode = array_diff($var_mode, ['debug']); |
|
| 3093 | + } |
|
| 3094 | + if (count($var_mode) and !defined('_VAR_MODE')) { |
|
| 3095 | + define('_VAR_MODE', reset($var_mode)); |
|
| 3096 | + } |
|
| 3097 | + if (isset($GLOBALS['visiteur_session']['nom'])) { |
|
| 3098 | + spip_log($GLOBALS['visiteur_session']['nom'] |
|
| 3099 | + . ' ' . _VAR_MODE); |
|
| 3100 | + } |
|
| 3101 | + } // pas autorise ? |
|
| 3102 | + else { |
|
| 3103 | + // si on n'est pas connecte on se redirige, si on est pas en cli et pas deja en train de se loger |
|
| 3104 | + if ( |
|
| 3105 | + !$GLOBALS['visiteur_session'] |
|
| 3106 | + and !empty($_SERVER['HTTP_HOST']) |
|
| 3107 | + and !empty($_SERVER['REQUEST_METHOD']) |
|
| 3108 | + and $_SERVER['REQUEST_METHOD'] === 'GET' |
|
| 3109 | + ) { |
|
| 3110 | + $self = self('&', true); |
|
| 3111 | + if (strpos($self, 'page=login') === false) { |
|
| 3112 | + include_spip('inc/headers'); |
|
| 3113 | + $redirect = parametre_url(self('&', true), 'var_mode', $_GET['var_mode'], '&'); |
|
| 3114 | + redirige_par_entete(generer_url_public('login', 'url=' . rawurlencode($redirect), true)); |
|
| 3115 | + } |
|
| 3116 | + } |
|
| 3117 | + // sinon tant pis |
|
| 3118 | + } |
|
| 3119 | + } |
|
| 3120 | + } |
|
| 3121 | + if (!defined('_VAR_MODE')) { |
|
| 3122 | + /** |
|
| 3123 | + * Indique le mode de calcul ou d'affichage de la page. |
|
| 3124 | + * @see init_var_mode() |
|
| 3125 | + */ |
|
| 3126 | + define('_VAR_MODE', false); |
|
| 3127 | + } |
|
| 3128 | + $done = true; |
|
| 3129 | + } |
|
| 3131 | 3130 | } |
| 3132 | 3131 | |
| 3133 | 3132 | /** |
@@ -3139,16 +3138,16 @@ discard block |
||
| 3139 | 3138 | * @param bool $deep = true : appliquer récursivement |
| 3140 | 3139 | **/ |
| 3141 | 3140 | function spip_desinfecte(&$t, $deep = true) { |
| 3142 | - foreach ($t as $key => $val) { |
|
| 3143 | - if (is_string($t[$key])) { |
|
| 3144 | - $t[$key] = str_replace(chr(0), '-', $t[$key]); |
|
| 3145 | - } // traiter aussi les "texte_plus" de article_edit |
|
| 3146 | - else { |
|
| 3147 | - if ($deep and is_array($t[$key]) and $key !== 'GLOBALS') { |
|
| 3148 | - spip_desinfecte($t[$key], $deep); |
|
| 3149 | - } |
|
| 3150 | - } |
|
| 3151 | - } |
|
| 3141 | + foreach ($t as $key => $val) { |
|
| 3142 | + if (is_string($t[$key])) { |
|
| 3143 | + $t[$key] = str_replace(chr(0), '-', $t[$key]); |
|
| 3144 | + } // traiter aussi les "texte_plus" de article_edit |
|
| 3145 | + else { |
|
| 3146 | + if ($deep and is_array($t[$key]) and $key !== 'GLOBALS') { |
|
| 3147 | + spip_desinfecte($t[$key], $deep); |
|
| 3148 | + } |
|
| 3149 | + } |
|
| 3150 | + } |
|
| 3152 | 3151 | } |
| 3153 | 3152 | |
| 3154 | 3153 | /** |
@@ -3161,64 +3160,64 @@ discard block |
||
| 3161 | 3160 | * @return string|0|false |
| 3162 | 3161 | **/ |
| 3163 | 3162 | function verifier_visiteur() { |
| 3164 | - @spip_initialisation_core( |
|
| 3165 | - (_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES), |
|
| 3166 | - (_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES), |
|
| 3167 | - (_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES), |
|
| 3168 | - (_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES) |
|
| 3169 | - ); |
|
| 3170 | - |
|
| 3171 | - // Demarrer une session NON AUTHENTIFIEE si on donne son nom |
|
| 3172 | - // dans un formulaire sans login (ex: #FORMULAIRE_FORUM) |
|
| 3173 | - // Attention on separe bien session_nom et nom, pour eviter |
|
| 3174 | - // les melanges entre donnees SQL et variables plus aleatoires |
|
| 3175 | - $variables_session = ['session_nom', 'session_email']; |
|
| 3176 | - foreach ($variables_session as $var) { |
|
| 3177 | - if (_request($var) !== null) { |
|
| 3178 | - $init = true; |
|
| 3179 | - break; |
|
| 3180 | - } |
|
| 3181 | - } |
|
| 3182 | - if (isset($init)) { |
|
| 3183 | - #@spip_initialisation_suite(); |
|
| 3184 | - $session = charger_fonction('session', 'inc'); |
|
| 3185 | - $session(); |
|
| 3186 | - include_spip('inc/texte'); |
|
| 3187 | - foreach ($variables_session as $var) { |
|
| 3188 | - if (($a = _request($var)) !== null) { |
|
| 3189 | - $GLOBALS['visiteur_session'][$var] = safehtml($a); |
|
| 3190 | - } |
|
| 3191 | - } |
|
| 3192 | - if (!isset($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 3193 | - $GLOBALS['visiteur_session']['id_auteur'] = 0; |
|
| 3194 | - } |
|
| 3195 | - $session($GLOBALS['visiteur_session']); |
|
| 3196 | - |
|
| 3197 | - return 0; |
|
| 3198 | - } |
|
| 3199 | - |
|
| 3200 | - $h = (isset($_SERVER['PHP_AUTH_USER']) and !$GLOBALS['ignore_auth_http']); |
|
| 3201 | - if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'] . '_session'])) { |
|
| 3202 | - $session = charger_fonction('session', 'inc'); |
|
| 3203 | - if ($session()) { |
|
| 3204 | - return $GLOBALS['visiteur_session']['statut']; |
|
| 3205 | - } |
|
| 3206 | - if ($h and isset($_SERVER['PHP_AUTH_PW'])) { |
|
| 3207 | - include_spip('inc/auth'); |
|
| 3208 | - $h = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); |
|
| 3209 | - } |
|
| 3210 | - if ($h) { |
|
| 3211 | - $GLOBALS['visiteur_session'] = $h; |
|
| 3212 | - |
|
| 3213 | - return $GLOBALS['visiteur_session']['statut']; |
|
| 3214 | - } |
|
| 3215 | - } |
|
| 3216 | - |
|
| 3217 | - // au moins son navigateur nous dit la langue preferee de cet inconnu |
|
| 3218 | - include_spip('inc/lang'); |
|
| 3219 | - utiliser_langue_visiteur(); |
|
| 3220 | - |
|
| 3221 | - return false; |
|
| 3163 | + @spip_initialisation_core( |
|
| 3164 | + (_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES), |
|
| 3165 | + (_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES), |
|
| 3166 | + (_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES), |
|
| 3167 | + (_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES) |
|
| 3168 | + ); |
|
| 3169 | + |
|
| 3170 | + // Demarrer une session NON AUTHENTIFIEE si on donne son nom |
|
| 3171 | + // dans un formulaire sans login (ex: #FORMULAIRE_FORUM) |
|
| 3172 | + // Attention on separe bien session_nom et nom, pour eviter |
|
| 3173 | + // les melanges entre donnees SQL et variables plus aleatoires |
|
| 3174 | + $variables_session = ['session_nom', 'session_email']; |
|
| 3175 | + foreach ($variables_session as $var) { |
|
| 3176 | + if (_request($var) !== null) { |
|
| 3177 | + $init = true; |
|
| 3178 | + break; |
|
| 3179 | + } |
|
| 3180 | + } |
|
| 3181 | + if (isset($init)) { |
|
| 3182 | + #@spip_initialisation_suite(); |
|
| 3183 | + $session = charger_fonction('session', 'inc'); |
|
| 3184 | + $session(); |
|
| 3185 | + include_spip('inc/texte'); |
|
| 3186 | + foreach ($variables_session as $var) { |
|
| 3187 | + if (($a = _request($var)) !== null) { |
|
| 3188 | + $GLOBALS['visiteur_session'][$var] = safehtml($a); |
|
| 3189 | + } |
|
| 3190 | + } |
|
| 3191 | + if (!isset($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 3192 | + $GLOBALS['visiteur_session']['id_auteur'] = 0; |
|
| 3193 | + } |
|
| 3194 | + $session($GLOBALS['visiteur_session']); |
|
| 3195 | + |
|
| 3196 | + return 0; |
|
| 3197 | + } |
|
| 3198 | + |
|
| 3199 | + $h = (isset($_SERVER['PHP_AUTH_USER']) and !$GLOBALS['ignore_auth_http']); |
|
| 3200 | + if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'] . '_session'])) { |
|
| 3201 | + $session = charger_fonction('session', 'inc'); |
|
| 3202 | + if ($session()) { |
|
| 3203 | + return $GLOBALS['visiteur_session']['statut']; |
|
| 3204 | + } |
|
| 3205 | + if ($h and isset($_SERVER['PHP_AUTH_PW'])) { |
|
| 3206 | + include_spip('inc/auth'); |
|
| 3207 | + $h = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); |
|
| 3208 | + } |
|
| 3209 | + if ($h) { |
|
| 3210 | + $GLOBALS['visiteur_session'] = $h; |
|
| 3211 | + |
|
| 3212 | + return $GLOBALS['visiteur_session']['statut']; |
|
| 3213 | + } |
|
| 3214 | + } |
|
| 3215 | + |
|
| 3216 | + // au moins son navigateur nous dit la langue preferee de cet inconnu |
|
| 3217 | + include_spip('inc/lang'); |
|
| 3218 | + utiliser_langue_visiteur(); |
|
| 3219 | + |
|
| 3220 | + return false; |
|
| 3222 | 3221 | } |
| 3223 | 3222 | |
| 3224 | 3223 | |
@@ -3241,21 +3240,21 @@ discard block |
||
| 3241 | 3240 | * - string Langue utilisée. |
| 3242 | 3241 | **/ |
| 3243 | 3242 | function lang_select($lang = null) { |
| 3244 | - static $pile_langues = []; |
|
| 3245 | - if (!function_exists('changer_langue')) { |
|
| 3246 | - include_spip('inc/lang'); |
|
| 3247 | - } |
|
| 3248 | - if ($lang === null) { |
|
| 3249 | - $lang = array_pop($pile_langues); |
|
| 3250 | - } else { |
|
| 3251 | - array_push($pile_langues, $GLOBALS['spip_lang']); |
|
| 3252 | - } |
|
| 3253 | - if (isset($GLOBALS['spip_lang']) and $lang == $GLOBALS['spip_lang']) { |
|
| 3254 | - return $lang; |
|
| 3255 | - } |
|
| 3256 | - changer_langue($lang); |
|
| 3243 | + static $pile_langues = []; |
|
| 3244 | + if (!function_exists('changer_langue')) { |
|
| 3245 | + include_spip('inc/lang'); |
|
| 3246 | + } |
|
| 3247 | + if ($lang === null) { |
|
| 3248 | + $lang = array_pop($pile_langues); |
|
| 3249 | + } else { |
|
| 3250 | + array_push($pile_langues, $GLOBALS['spip_lang']); |
|
| 3251 | + } |
|
| 3252 | + if (isset($GLOBALS['spip_lang']) and $lang == $GLOBALS['spip_lang']) { |
|
| 3253 | + return $lang; |
|
| 3254 | + } |
|
| 3255 | + changer_langue($lang); |
|
| 3257 | 3256 | |
| 3258 | - return $lang; |
|
| 3257 | + return $lang; |
|
| 3259 | 3258 | } |
| 3260 | 3259 | |
| 3261 | 3260 | /** |
@@ -3272,20 +3271,20 @@ discard block |
||
| 3272 | 3271 | * Identifiant de la session |
| 3273 | 3272 | **/ |
| 3274 | 3273 | function spip_session($force = false) { |
| 3275 | - static $session; |
|
| 3276 | - if ($force or !isset($session)) { |
|
| 3277 | - $s = pipeline( |
|
| 3278 | - 'definir_session', |
|
| 3279 | - $GLOBALS['visiteur_session'] |
|
| 3280 | - ? serialize($GLOBALS['visiteur_session']) |
|
| 3281 | - . '_' . @$_COOKIE['spip_session'] |
|
| 3282 | - : '' |
|
| 3283 | - ); |
|
| 3284 | - $session = $s ? substr(md5($s), 0, 8) : ''; |
|
| 3285 | - } |
|
| 3274 | + static $session; |
|
| 3275 | + if ($force or !isset($session)) { |
|
| 3276 | + $s = pipeline( |
|
| 3277 | + 'definir_session', |
|
| 3278 | + $GLOBALS['visiteur_session'] |
|
| 3279 | + ? serialize($GLOBALS['visiteur_session']) |
|
| 3280 | + . '_' . @$_COOKIE['spip_session'] |
|
| 3281 | + : '' |
|
| 3282 | + ); |
|
| 3283 | + $session = $s ? substr(md5($s), 0, 8) : ''; |
|
| 3284 | + } |
|
| 3286 | 3285 | |
| 3287 | - #spip_log('session: '.$session); |
|
| 3288 | - return $session; |
|
| 3286 | + #spip_log('session: '.$session); |
|
| 3287 | + return $session; |
|
| 3289 | 3288 | } |
| 3290 | 3289 | |
| 3291 | 3290 | |
@@ -3304,9 +3303,9 @@ discard block |
||
| 3304 | 3303 | * Lien sur une icone d'aide |
| 3305 | 3304 | **/ |
| 3306 | 3305 | function aider($aide = '', $distante = false) { |
| 3307 | - $aider = charger_fonction('aide', 'inc', true); |
|
| 3306 | + $aider = charger_fonction('aide', 'inc', true); |
|
| 3308 | 3307 | |
| 3309 | - return $aider ? $aider($aide, '', [], $distante) : ''; |
|
| 3308 | + return $aider ? $aider($aide, '', [], $distante) : ''; |
|
| 3310 | 3309 | } |
| 3311 | 3310 | |
| 3312 | 3311 | /** |
@@ -3316,35 +3315,35 @@ discard block |
||
| 3316 | 3315 | */ |
| 3317 | 3316 | function exec_info_dist() { |
| 3318 | 3317 | |
| 3319 | - include_spip('inc/autoriser'); |
|
| 3320 | - if (autoriser('phpinfos')) { |
|
| 3321 | - $cookies_masques = ['spip_session', 'PHPSESSID']; |
|
| 3322 | - $cookies_backup = []; |
|
| 3323 | - $server_backup = ['HTTP_COOKIE' => $_SERVER['HTTP_COOKIE'] ?? []]; |
|
| 3324 | - $env_backup = ['HTTP_COOKIE' => $_ENV['HTTP_COOKIE'] ?? []]; |
|
| 3325 | - $mask = '******************************'; |
|
| 3326 | - foreach ($cookies_masques as $k) { |
|
| 3327 | - if (!empty($_COOKIE[$k])) { |
|
| 3328 | - $cookies_backup[$k] = $_COOKIE[$k]; |
|
| 3329 | - $_SERVER['HTTP_COOKIE'] = str_replace("$k=" . $_COOKIE[$k], "$k=$mask", $_SERVER['HTTP_COOKIE'] ?? []); |
|
| 3330 | - $_ENV['HTTP_COOKIE'] = str_replace("$k=" . $_COOKIE[$k], "$k=$mask", $_ENV['HTTP_COOKIE'] ?? []); |
|
| 3331 | - $_COOKIE[$k] = $mask; |
|
| 3332 | - } |
|
| 3333 | - } |
|
| 3334 | - phpinfo(); |
|
| 3335 | - foreach ($cookies_backup as $k => $v) { |
|
| 3336 | - $_COOKIE[$k] = $v; |
|
| 3337 | - } |
|
| 3338 | - foreach ($server_backup as $k => $v) { |
|
| 3339 | - $_SERVER[$k] = $v; |
|
| 3340 | - } |
|
| 3341 | - foreach ($env_backup as $k => $v) { |
|
| 3342 | - $_ENV[$k] = $v; |
|
| 3343 | - } |
|
| 3344 | - } else { |
|
| 3345 | - include_spip('inc/filtres'); |
|
| 3346 | - sinon_interdire_acces(); |
|
| 3347 | - } |
|
| 3318 | + include_spip('inc/autoriser'); |
|
| 3319 | + if (autoriser('phpinfos')) { |
|
| 3320 | + $cookies_masques = ['spip_session', 'PHPSESSID']; |
|
| 3321 | + $cookies_backup = []; |
|
| 3322 | + $server_backup = ['HTTP_COOKIE' => $_SERVER['HTTP_COOKIE'] ?? []]; |
|
| 3323 | + $env_backup = ['HTTP_COOKIE' => $_ENV['HTTP_COOKIE'] ?? []]; |
|
| 3324 | + $mask = '******************************'; |
|
| 3325 | + foreach ($cookies_masques as $k) { |
|
| 3326 | + if (!empty($_COOKIE[$k])) { |
|
| 3327 | + $cookies_backup[$k] = $_COOKIE[$k]; |
|
| 3328 | + $_SERVER['HTTP_COOKIE'] = str_replace("$k=" . $_COOKIE[$k], "$k=$mask", $_SERVER['HTTP_COOKIE'] ?? []); |
|
| 3329 | + $_ENV['HTTP_COOKIE'] = str_replace("$k=" . $_COOKIE[$k], "$k=$mask", $_ENV['HTTP_COOKIE'] ?? []); |
|
| 3330 | + $_COOKIE[$k] = $mask; |
|
| 3331 | + } |
|
| 3332 | + } |
|
| 3333 | + phpinfo(); |
|
| 3334 | + foreach ($cookies_backup as $k => $v) { |
|
| 3335 | + $_COOKIE[$k] = $v; |
|
| 3336 | + } |
|
| 3337 | + foreach ($server_backup as $k => $v) { |
|
| 3338 | + $_SERVER[$k] = $v; |
|
| 3339 | + } |
|
| 3340 | + foreach ($env_backup as $k => $v) { |
|
| 3341 | + $_ENV[$k] = $v; |
|
| 3342 | + } |
|
| 3343 | + } else { |
|
| 3344 | + include_spip('inc/filtres'); |
|
| 3345 | + sinon_interdire_acces(); |
|
| 3346 | + } |
|
| 3348 | 3347 | } |
| 3349 | 3348 | |
| 3350 | 3349 | /** |
@@ -3364,13 +3363,13 @@ discard block |
||
| 3364 | 3363 | * - string si $message à false. |
| 3365 | 3364 | **/ |
| 3366 | 3365 | function erreur_squelette($message = '', $lieu = '') { |
| 3367 | - $debusquer = charger_fonction('debusquer', 'public'); |
|
| 3368 | - if (is_array($lieu)) { |
|
| 3369 | - include_spip('public/compiler'); |
|
| 3370 | - $lieu = reconstruire_contexte_compil($lieu); |
|
| 3371 | - } |
|
| 3366 | + $debusquer = charger_fonction('debusquer', 'public'); |
|
| 3367 | + if (is_array($lieu)) { |
|
| 3368 | + include_spip('public/compiler'); |
|
| 3369 | + $lieu = reconstruire_contexte_compil($lieu); |
|
| 3370 | + } |
|
| 3372 | 3371 | |
| 3373 | - return $debusquer($message, $lieu); |
|
| 3372 | + return $debusquer($message, $lieu); |
|
| 3374 | 3373 | } |
| 3375 | 3374 | |
| 3376 | 3375 | /** |
@@ -3407,108 +3406,108 @@ discard block |
||
| 3407 | 3406 | * - ou tableau d'information sur le squelette. |
| 3408 | 3407 | */ |
| 3409 | 3408 | function recuperer_fond($fond, $contexte = [], $options = [], string $connect = '') { |
| 3410 | - if (!function_exists('evaluer_fond')) { |
|
| 3411 | - include_spip('public/assembler'); |
|
| 3412 | - } |
|
| 3413 | - // assurer la compat avec l'ancienne syntaxe |
|
| 3414 | - // (trim etait le 3eme argument, par defaut a true) |
|
| 3415 | - if (!is_array($options)) { |
|
| 3416 | - $options = ['trim' => $options]; |
|
| 3417 | - } |
|
| 3418 | - if (!isset($options['trim'])) { |
|
| 3419 | - $options['trim'] = true; |
|
| 3420 | - } |
|
| 3421 | - |
|
| 3422 | - if (isset($contexte['connect'])) { |
|
| 3423 | - $connect = $contexte['connect']; |
|
| 3424 | - unset($contexte['connect']); |
|
| 3425 | - } |
|
| 3426 | - |
|
| 3427 | - $texte = ''; |
|
| 3428 | - $pages = []; |
|
| 3429 | - $lang_select = ''; |
|
| 3430 | - if (!isset($options['etoile']) or !$options['etoile']) { |
|
| 3431 | - // Si on a inclus sans fixer le critere de lang, on prend la langue courante |
|
| 3432 | - if (!isset($contexte['lang'])) { |
|
| 3433 | - $contexte['lang'] = $GLOBALS['spip_lang']; |
|
| 3434 | - } |
|
| 3435 | - |
|
| 3436 | - if ($contexte['lang'] != $GLOBALS['meta']['langue_site']) { |
|
| 3437 | - $lang_select = lang_select($contexte['lang']); |
|
| 3438 | - } |
|
| 3439 | - } |
|
| 3440 | - |
|
| 3441 | - if (!isset($GLOBALS['_INC_PUBLIC'])) { |
|
| 3442 | - $GLOBALS['_INC_PUBLIC'] = 0; |
|
| 3443 | - } |
|
| 3444 | - |
|
| 3445 | - $GLOBALS['_INC_PUBLIC']++; |
|
| 3446 | - |
|
| 3447 | - // fix #4235 |
|
| 3448 | - $cache_utilise_session_appelant = ($GLOBALS['cache_utilise_session'] ?? null); |
|
| 3449 | - |
|
| 3450 | - |
|
| 3451 | - foreach (is_array($fond) ? $fond : [$fond] as $f) { |
|
| 3452 | - unset($GLOBALS['cache_utilise_session']); // fix #4235 |
|
| 3453 | - |
|
| 3454 | - $page = evaluer_fond($f, $contexte, $connect); |
|
| 3455 | - if ($page === '') { |
|
| 3456 | - $c = $options['compil'] ?? ''; |
|
| 3457 | - $a = ['fichier' => $f]; |
|
| 3458 | - $erreur = _T('info_erreur_squelette2', $a); // squelette introuvable |
|
| 3459 | - erreur_squelette($erreur, $c); |
|
| 3460 | - // eviter des erreurs strictes ensuite sur $page['cle'] en PHP >= 5.4 |
|
| 3461 | - $page = ['texte' => '', 'erreur' => $erreur]; |
|
| 3462 | - } |
|
| 3463 | - |
|
| 3464 | - $page = pipeline('recuperer_fond', [ |
|
| 3465 | - 'args' => ['fond' => $f, 'contexte' => $contexte, 'options' => $options, 'connect' => $connect], |
|
| 3466 | - 'data' => $page |
|
| 3467 | - ]); |
|
| 3468 | - if (isset($options['ajax']) and $options['ajax']) { |
|
| 3469 | - if (!function_exists('encoder_contexte_ajax')) { |
|
| 3470 | - include_spip('inc/filtres'); |
|
| 3471 | - } |
|
| 3472 | - $page['texte'] = encoder_contexte_ajax( |
|
| 3473 | - array_merge( |
|
| 3474 | - $contexte, |
|
| 3475 | - ['fond' => $f], |
|
| 3476 | - ($connect ? ['connect' => $connect] : []) |
|
| 3477 | - ), |
|
| 3478 | - '', |
|
| 3479 | - $page['texte'], |
|
| 3480 | - $options['ajax'] |
|
| 3481 | - ); |
|
| 3482 | - } |
|
| 3483 | - |
|
| 3484 | - if (isset($options['raw']) and $options['raw']) { |
|
| 3485 | - $pages[] = $page; |
|
| 3486 | - } else { |
|
| 3487 | - $texte .= $options['trim'] ? rtrim($page['texte'] ?? '') : $page['texte']; |
|
| 3488 | - } |
|
| 3489 | - |
|
| 3490 | - // contamination de la session appelante, pour les inclusions statiques |
|
| 3491 | - if (isset($page['invalideurs']['session'])) { |
|
| 3492 | - $cache_utilise_session_appelant = $page['invalideurs']['session']; |
|
| 3493 | - } |
|
| 3494 | - } |
|
| 3495 | - |
|
| 3496 | - // restaurer le sessionnement du contexte appelant, |
|
| 3497 | - // éventuellement contaminé si on vient de récupérer une inclusion statique sessionnée |
|
| 3498 | - if (isset($cache_utilise_session_appelant)) { |
|
| 3499 | - $GLOBALS['cache_utilise_session'] = $cache_utilise_session_appelant; |
|
| 3500 | - } |
|
| 3501 | - |
|
| 3502 | - $GLOBALS['_INC_PUBLIC']--; |
|
| 3503 | - |
|
| 3504 | - if ($lang_select) { |
|
| 3505 | - lang_select(); |
|
| 3506 | - } |
|
| 3507 | - if (isset($options['raw']) and $options['raw']) { |
|
| 3508 | - return is_array($fond) ? $pages : reset($pages); |
|
| 3509 | - } else { |
|
| 3510 | - return $options['trim'] ? ltrim($texte) : $texte; |
|
| 3511 | - } |
|
| 3409 | + if (!function_exists('evaluer_fond')) { |
|
| 3410 | + include_spip('public/assembler'); |
|
| 3411 | + } |
|
| 3412 | + // assurer la compat avec l'ancienne syntaxe |
|
| 3413 | + // (trim etait le 3eme argument, par defaut a true) |
|
| 3414 | + if (!is_array($options)) { |
|
| 3415 | + $options = ['trim' => $options]; |
|
| 3416 | + } |
|
| 3417 | + if (!isset($options['trim'])) { |
|
| 3418 | + $options['trim'] = true; |
|
| 3419 | + } |
|
| 3420 | + |
|
| 3421 | + if (isset($contexte['connect'])) { |
|
| 3422 | + $connect = $contexte['connect']; |
|
| 3423 | + unset($contexte['connect']); |
|
| 3424 | + } |
|
| 3425 | + |
|
| 3426 | + $texte = ''; |
|
| 3427 | + $pages = []; |
|
| 3428 | + $lang_select = ''; |
|
| 3429 | + if (!isset($options['etoile']) or !$options['etoile']) { |
|
| 3430 | + // Si on a inclus sans fixer le critere de lang, on prend la langue courante |
|
| 3431 | + if (!isset($contexte['lang'])) { |
|
| 3432 | + $contexte['lang'] = $GLOBALS['spip_lang']; |
|
| 3433 | + } |
|
| 3434 | + |
|
| 3435 | + if ($contexte['lang'] != $GLOBALS['meta']['langue_site']) { |
|
| 3436 | + $lang_select = lang_select($contexte['lang']); |
|
| 3437 | + } |
|
| 3438 | + } |
|
| 3439 | + |
|
| 3440 | + if (!isset($GLOBALS['_INC_PUBLIC'])) { |
|
| 3441 | + $GLOBALS['_INC_PUBLIC'] = 0; |
|
| 3442 | + } |
|
| 3443 | + |
|
| 3444 | + $GLOBALS['_INC_PUBLIC']++; |
|
| 3445 | + |
|
| 3446 | + // fix #4235 |
|
| 3447 | + $cache_utilise_session_appelant = ($GLOBALS['cache_utilise_session'] ?? null); |
|
| 3448 | + |
|
| 3449 | + |
|
| 3450 | + foreach (is_array($fond) ? $fond : [$fond] as $f) { |
|
| 3451 | + unset($GLOBALS['cache_utilise_session']); // fix #4235 |
|
| 3452 | + |
|
| 3453 | + $page = evaluer_fond($f, $contexte, $connect); |
|
| 3454 | + if ($page === '') { |
|
| 3455 | + $c = $options['compil'] ?? ''; |
|
| 3456 | + $a = ['fichier' => $f]; |
|
| 3457 | + $erreur = _T('info_erreur_squelette2', $a); // squelette introuvable |
|
| 3458 | + erreur_squelette($erreur, $c); |
|
| 3459 | + // eviter des erreurs strictes ensuite sur $page['cle'] en PHP >= 5.4 |
|
| 3460 | + $page = ['texte' => '', 'erreur' => $erreur]; |
|
| 3461 | + } |
|
| 3462 | + |
|
| 3463 | + $page = pipeline('recuperer_fond', [ |
|
| 3464 | + 'args' => ['fond' => $f, 'contexte' => $contexte, 'options' => $options, 'connect' => $connect], |
|
| 3465 | + 'data' => $page |
|
| 3466 | + ]); |
|
| 3467 | + if (isset($options['ajax']) and $options['ajax']) { |
|
| 3468 | + if (!function_exists('encoder_contexte_ajax')) { |
|
| 3469 | + include_spip('inc/filtres'); |
|
| 3470 | + } |
|
| 3471 | + $page['texte'] = encoder_contexte_ajax( |
|
| 3472 | + array_merge( |
|
| 3473 | + $contexte, |
|
| 3474 | + ['fond' => $f], |
|
| 3475 | + ($connect ? ['connect' => $connect] : []) |
|
| 3476 | + ), |
|
| 3477 | + '', |
|
| 3478 | + $page['texte'], |
|
| 3479 | + $options['ajax'] |
|
| 3480 | + ); |
|
| 3481 | + } |
|
| 3482 | + |
|
| 3483 | + if (isset($options['raw']) and $options['raw']) { |
|
| 3484 | + $pages[] = $page; |
|
| 3485 | + } else { |
|
| 3486 | + $texte .= $options['trim'] ? rtrim($page['texte'] ?? '') : $page['texte']; |
|
| 3487 | + } |
|
| 3488 | + |
|
| 3489 | + // contamination de la session appelante, pour les inclusions statiques |
|
| 3490 | + if (isset($page['invalideurs']['session'])) { |
|
| 3491 | + $cache_utilise_session_appelant = $page['invalideurs']['session']; |
|
| 3492 | + } |
|
| 3493 | + } |
|
| 3494 | + |
|
| 3495 | + // restaurer le sessionnement du contexte appelant, |
|
| 3496 | + // éventuellement contaminé si on vient de récupérer une inclusion statique sessionnée |
|
| 3497 | + if (isset($cache_utilise_session_appelant)) { |
|
| 3498 | + $GLOBALS['cache_utilise_session'] = $cache_utilise_session_appelant; |
|
| 3499 | + } |
|
| 3500 | + |
|
| 3501 | + $GLOBALS['_INC_PUBLIC']--; |
|
| 3502 | + |
|
| 3503 | + if ($lang_select) { |
|
| 3504 | + lang_select(); |
|
| 3505 | + } |
|
| 3506 | + if (isset($options['raw']) and $options['raw']) { |
|
| 3507 | + return is_array($fond) ? $pages : reset($pages); |
|
| 3508 | + } else { |
|
| 3509 | + return $options['trim'] ? ltrim($texte) : $texte; |
|
| 3510 | + } |
|
| 3512 | 3511 | } |
| 3513 | 3512 | |
| 3514 | 3513 | /** |
@@ -3518,7 +3517,7 @@ discard block |
||
| 3518 | 3517 | * @return string |
| 3519 | 3518 | */ |
| 3520 | 3519 | function trouve_modele($nom) { |
| 3521 | - return trouver_fond($nom, 'modeles/'); |
|
| 3520 | + return trouver_fond($nom, 'modeles/'); |
|
| 3522 | 3521 | } |
| 3523 | 3522 | |
| 3524 | 3523 | /** |
@@ -3534,21 +3533,21 @@ discard block |
||
| 3534 | 3533 | * @return array|string |
| 3535 | 3534 | */ |
| 3536 | 3535 | function trouver_fond($nom, $dir = '', $pathinfo = false) { |
| 3537 | - $f = find_in_path($nom . '.' . _EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/') . '/' : ''); |
|
| 3538 | - if (!$pathinfo) { |
|
| 3539 | - return $f; |
|
| 3540 | - } |
|
| 3541 | - // renvoyer un tableau detaille si $pathinfo==true |
|
| 3542 | - $p = pathinfo($f); |
|
| 3543 | - if (!isset($p['extension']) or !$p['extension']) { |
|
| 3544 | - $p['extension'] = _EXTENSION_SQUELETTES; |
|
| 3545 | - } |
|
| 3546 | - if (!isset($p['extension']) or !$p['filename']) { |
|
| 3547 | - $p['filename'] = ($p['basename'] ? substr($p['basename'], 0, -strlen($p['extension']) - 1) : ''); |
|
| 3548 | - } |
|
| 3549 | - $p['fond'] = ($f ? substr($f, 0, -strlen($p['extension']) - 1) : ''); |
|
| 3536 | + $f = find_in_path($nom . '.' . _EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/') . '/' : ''); |
|
| 3537 | + if (!$pathinfo) { |
|
| 3538 | + return $f; |
|
| 3539 | + } |
|
| 3540 | + // renvoyer un tableau detaille si $pathinfo==true |
|
| 3541 | + $p = pathinfo($f); |
|
| 3542 | + if (!isset($p['extension']) or !$p['extension']) { |
|
| 3543 | + $p['extension'] = _EXTENSION_SQUELETTES; |
|
| 3544 | + } |
|
| 3545 | + if (!isset($p['extension']) or !$p['filename']) { |
|
| 3546 | + $p['filename'] = ($p['basename'] ? substr($p['basename'], 0, -strlen($p['extension']) - 1) : ''); |
|
| 3547 | + } |
|
| 3548 | + $p['fond'] = ($f ? substr($f, 0, -strlen($p['extension']) - 1) : ''); |
|
| 3550 | 3549 | |
| 3551 | - return $p; |
|
| 3550 | + return $p; |
|
| 3552 | 3551 | } |
| 3553 | 3552 | |
| 3554 | 3553 | /** |
@@ -3568,21 +3567,21 @@ discard block |
||
| 3568 | 3567 | * Nom de l'exec, sinon chaîne vide. |
| 3569 | 3568 | **/ |
| 3570 | 3569 | function tester_url_ecrire($nom) { |
| 3571 | - static $exec = []; |
|
| 3572 | - if (isset($exec[$nom])) { |
|
| 3573 | - return $exec[$nom]; |
|
| 3574 | - } |
|
| 3575 | - // tester si c'est une page en squelette |
|
| 3576 | - if (trouver_fond($nom, 'prive/squelettes/contenu/')) { |
|
| 3577 | - return $exec[$nom] = 'fond'; |
|
| 3578 | - } // echafaudage d'un fond ! |
|
| 3579 | - elseif (include_spip('public/styliser_par_z') and z_echafaudable($nom)) { |
|
| 3580 | - return $exec[$nom] = 'fond'; |
|
| 3581 | - } |
|
| 3582 | - // attention, il ne faut pas inclure l'exec ici |
|
| 3583 | - // car sinon #URL_ECRIRE provoque des inclusions |
|
| 3584 | - // et des define intrusifs potentiels |
|
| 3585 | - return $exec[$nom] = ((find_in_path("{$nom}.php", 'exec/') or charger_fonction($nom, 'exec', true)) ? $nom : ''); |
|
| 3570 | + static $exec = []; |
|
| 3571 | + if (isset($exec[$nom])) { |
|
| 3572 | + return $exec[$nom]; |
|
| 3573 | + } |
|
| 3574 | + // tester si c'est une page en squelette |
|
| 3575 | + if (trouver_fond($nom, 'prive/squelettes/contenu/')) { |
|
| 3576 | + return $exec[$nom] = 'fond'; |
|
| 3577 | + } // echafaudage d'un fond ! |
|
| 3578 | + elseif (include_spip('public/styliser_par_z') and z_echafaudable($nom)) { |
|
| 3579 | + return $exec[$nom] = 'fond'; |
|
| 3580 | + } |
|
| 3581 | + // attention, il ne faut pas inclure l'exec ici |
|
| 3582 | + // car sinon #URL_ECRIRE provoque des inclusions |
|
| 3583 | + // et des define intrusifs potentiels |
|
| 3584 | + return $exec[$nom] = ((find_in_path("{$nom}.php", 'exec/') or charger_fonction($nom, 'exec', true)) ? $nom : ''); |
|
| 3586 | 3585 | } |
| 3587 | 3586 | |
| 3588 | 3587 | /** |
@@ -3592,8 +3591,8 @@ discard block |
||
| 3592 | 3591 | * true si la constante _VERSION_HTML n'est pas définie ou égale à html5 |
| 3593 | 3592 | **/ |
| 3594 | 3593 | function html5_permis() { |
| 3595 | - return (!defined('_VERSION_HTML') |
|
| 3596 | - or _VERSION_HTML !== 'html4'); |
|
| 3594 | + return (!defined('_VERSION_HTML') |
|
| 3595 | + or _VERSION_HTML !== 'html4'); |
|
| 3597 | 3596 | } |
| 3598 | 3597 | |
| 3599 | 3598 | /** |
@@ -3603,30 +3602,30 @@ discard block |
||
| 3603 | 3602 | * @return array |
| 3604 | 3603 | */ |
| 3605 | 3604 | function formats_image_acceptables($gd = null, $svg_allowed = true) { |
| 3606 | - $formats = null; |
|
| 3607 | - if (!is_null($gd)) { |
|
| 3608 | - $config = ($gd ? 'gd_formats' : 'formats_graphiques'); |
|
| 3609 | - if (isset($GLOBALS['meta'][$config])) { |
|
| 3610 | - $formats = $GLOBALS['meta'][$config]; |
|
| 3611 | - $formats = explode(',', $formats); |
|
| 3612 | - $formats = array_filter($formats); |
|
| 3613 | - $formats = array_map('trim', $formats); |
|
| 3614 | - } |
|
| 3615 | - } |
|
| 3616 | - if (is_null($formats)) { |
|
| 3617 | - include_spip('inc/filtres_images_lib_mini'); |
|
| 3618 | - $formats = _image_extensions_acceptees_en_entree(); |
|
| 3619 | - } |
|
| 3620 | - |
|
| 3621 | - if ($svg_allowed) { |
|
| 3622 | - if (!in_array('svg', $formats)) { |
|
| 3623 | - $formats[] = 'svg'; |
|
| 3624 | - } |
|
| 3625 | - } |
|
| 3626 | - else { |
|
| 3627 | - $formats = array_diff($formats, ['svg']); |
|
| 3628 | - } |
|
| 3629 | - return $formats; |
|
| 3605 | + $formats = null; |
|
| 3606 | + if (!is_null($gd)) { |
|
| 3607 | + $config = ($gd ? 'gd_formats' : 'formats_graphiques'); |
|
| 3608 | + if (isset($GLOBALS['meta'][$config])) { |
|
| 3609 | + $formats = $GLOBALS['meta'][$config]; |
|
| 3610 | + $formats = explode(',', $formats); |
|
| 3611 | + $formats = array_filter($formats); |
|
| 3612 | + $formats = array_map('trim', $formats); |
|
| 3613 | + } |
|
| 3614 | + } |
|
| 3615 | + if (is_null($formats)) { |
|
| 3616 | + include_spip('inc/filtres_images_lib_mini'); |
|
| 3617 | + $formats = _image_extensions_acceptees_en_entree(); |
|
| 3618 | + } |
|
| 3619 | + |
|
| 3620 | + if ($svg_allowed) { |
|
| 3621 | + if (!in_array('svg', $formats)) { |
|
| 3622 | + $formats[] = 'svg'; |
|
| 3623 | + } |
|
| 3624 | + } |
|
| 3625 | + else { |
|
| 3626 | + $formats = array_diff($formats, ['svg']); |
|
| 3627 | + } |
|
| 3628 | + return $formats; |
|
| 3630 | 3629 | } |
| 3631 | 3630 | |
| 3632 | 3631 | /** |
@@ -3635,20 +3634,20 @@ discard block |
||
| 3635 | 3634 | * @return array|bool |
| 3636 | 3635 | */ |
| 3637 | 3636 | function spip_getimagesize($fichier) { |
| 3638 | - if (!$imagesize = @getimagesize($fichier)) { |
|
| 3639 | - include_spip('inc/svg'); |
|
| 3640 | - if ($attrs = svg_lire_attributs($fichier)) { |
|
| 3641 | - [$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs); |
|
| 3642 | - $imagesize = [ |
|
| 3643 | - $width, |
|
| 3644 | - $height, |
|
| 3645 | - IMAGETYPE_SVG, |
|
| 3646 | - "width=\"{$width}\" height=\"{$height}\"", |
|
| 3647 | - 'mime' => 'image/svg+xml' |
|
| 3648 | - ]; |
|
| 3649 | - } |
|
| 3650 | - } |
|
| 3651 | - return $imagesize; |
|
| 3637 | + if (!$imagesize = @getimagesize($fichier)) { |
|
| 3638 | + include_spip('inc/svg'); |
|
| 3639 | + if ($attrs = svg_lire_attributs($fichier)) { |
|
| 3640 | + [$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs); |
|
| 3641 | + $imagesize = [ |
|
| 3642 | + $width, |
|
| 3643 | + $height, |
|
| 3644 | + IMAGETYPE_SVG, |
|
| 3645 | + "width=\"{$width}\" height=\"{$height}\"", |
|
| 3646 | + 'mime' => 'image/svg+xml' |
|
| 3647 | + ]; |
|
| 3648 | + } |
|
| 3649 | + } |
|
| 3650 | + return $imagesize; |
|
| 3652 | 3651 | } |
| 3653 | 3652 | |
| 3654 | 3653 | /** |
@@ -3662,19 +3661,19 @@ discard block |
||
| 3662 | 3661 | * @param string $statut |
| 3663 | 3662 | */ |
| 3664 | 3663 | function avertir_auteurs($nom, $message, $statut = '') { |
| 3665 | - $alertes = $GLOBALS['meta']['message_alertes_auteurs']; |
|
| 3666 | - if ( |
|
| 3667 | - !$alertes |
|
| 3668 | - or !is_array($alertes = unserialize($alertes)) |
|
| 3669 | - ) { |
|
| 3670 | - $alertes = []; |
|
| 3671 | - } |
|
| 3664 | + $alertes = $GLOBALS['meta']['message_alertes_auteurs']; |
|
| 3665 | + if ( |
|
| 3666 | + !$alertes |
|
| 3667 | + or !is_array($alertes = unserialize($alertes)) |
|
| 3668 | + ) { |
|
| 3669 | + $alertes = []; |
|
| 3670 | + } |
|
| 3672 | 3671 | |
| 3673 | - if (!isset($alertes[$statut])) { |
|
| 3674 | - $alertes[$statut] = []; |
|
| 3675 | - } |
|
| 3676 | - $alertes[$statut][$nom] = $message; |
|
| 3677 | - ecrire_meta('message_alertes_auteurs', serialize($alertes)); |
|
| 3672 | + if (!isset($alertes[$statut])) { |
|
| 3673 | + $alertes[$statut] = []; |
|
| 3674 | + } |
|
| 3675 | + $alertes[$statut][$nom] = $message; |
|
| 3676 | + ecrire_meta('message_alertes_auteurs', serialize($alertes)); |
|
| 3678 | 3677 | } |
| 3679 | 3678 | |
| 3680 | 3679 | /** |
@@ -3688,10 +3687,10 @@ discard block |
||
| 3688 | 3687 | * @return string|string[] |
| 3689 | 3688 | */ |
| 3690 | 3689 | function spip_sanitize_classname($classes) { |
| 3691 | - if (is_array($classes)) { |
|
| 3692 | - return array_map('spip_sanitize_classname', $classes); |
|
| 3693 | - } |
|
| 3694 | - return preg_replace('/[^ 0-9a-z_\-+@]/i', '', $classes); |
|
| 3690 | + if (is_array($classes)) { |
|
| 3691 | + return array_map('spip_sanitize_classname', $classes); |
|
| 3692 | + } |
|
| 3693 | + return preg_replace('/[^ 0-9a-z_\-+@]/i', '', $classes); |
|
| 3695 | 3694 | } |
| 3696 | 3695 | |
| 3697 | 3696 | |
@@ -3716,32 +3715,32 @@ discard block |
||
| 3716 | 3715 | * Avec operateur : bool. |
| 3717 | 3716 | **/ |
| 3718 | 3717 | function spip_version_compare($v1, $v2, $op = null) { |
| 3719 | - $v1 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v1)); |
|
| 3720 | - $v2 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v2)); |
|
| 3721 | - $v1 = str_replace('rc', 'RC', $v1); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 3722 | - $v2 = str_replace('rc', 'RC', $v2); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 3723 | - |
|
| 3724 | - $v1 = explode('.', $v1); |
|
| 3725 | - $v2 = explode('.', $v2); |
|
| 3726 | - // $v1 est toujours une version, donc sans etoile |
|
| 3727 | - while (count($v1) < count($v2)) { |
|
| 3728 | - $v1[] = '0'; |
|
| 3729 | - } |
|
| 3730 | - |
|
| 3731 | - // $v2 peut etre une borne, donc accepte l'etoile |
|
| 3732 | - $etoile = false; |
|
| 3733 | - foreach ($v1 as $k => $v) { |
|
| 3734 | - if (!isset($v2[$k])) { |
|
| 3735 | - $v2[] = ($etoile and (is_numeric($v) or $v == 'pl' or $v == 'p')) ? $v : '0'; |
|
| 3736 | - } else { |
|
| 3737 | - if ($v2[$k] == '*') { |
|
| 3738 | - $etoile = true; |
|
| 3739 | - $v2[$k] = $v; |
|
| 3740 | - } |
|
| 3741 | - } |
|
| 3742 | - } |
|
| 3743 | - $v1 = implode('.', $v1); |
|
| 3744 | - $v2 = implode('.', $v2); |
|
| 3745 | - |
|
| 3746 | - return $op ? version_compare($v1, $v2, $op) : version_compare($v1, $v2); |
|
| 3718 | + $v1 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v1)); |
|
| 3719 | + $v2 = strtolower(preg_replace(',([0-9])[\s.-]?(dev|alpha|a|beta|b|rc|pl|p),i', '\\1.\\2', $v2)); |
|
| 3720 | + $v1 = str_replace('rc', 'RC', $v1); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 3721 | + $v2 = str_replace('rc', 'RC', $v2); // certaines versions de PHP ne comprennent RC qu'en majuscule |
|
| 3722 | + |
|
| 3723 | + $v1 = explode('.', $v1); |
|
| 3724 | + $v2 = explode('.', $v2); |
|
| 3725 | + // $v1 est toujours une version, donc sans etoile |
|
| 3726 | + while (count($v1) < count($v2)) { |
|
| 3727 | + $v1[] = '0'; |
|
| 3728 | + } |
|
| 3729 | + |
|
| 3730 | + // $v2 peut etre une borne, donc accepte l'etoile |
|
| 3731 | + $etoile = false; |
|
| 3732 | + foreach ($v1 as $k => $v) { |
|
| 3733 | + if (!isset($v2[$k])) { |
|
| 3734 | + $v2[] = ($etoile and (is_numeric($v) or $v == 'pl' or $v == 'p')) ? $v : '0'; |
|
| 3735 | + } else { |
|
| 3736 | + if ($v2[$k] == '*') { |
|
| 3737 | + $etoile = true; |
|
| 3738 | + $v2[$k] = $v; |
|
| 3739 | + } |
|
| 3740 | + } |
|
| 3741 | + } |
|
| 3742 | + $v1 = implode('.', $v1); |
|
| 3743 | + $v2 = implode('.', $v2); |
|
| 3744 | + |
|
| 3745 | + return $op ? version_compare($v1, $v2, $op) : version_compare($v1, $v2); |
|
| 3747 | 3746 | } |
@@ -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 | /** |
@@ -39,36 +39,36 @@ discard block |
||
| 39 | 39 | * Liste (identifiant de l'article, texte d'erreur éventuel) |
| 40 | 40 | */ |
| 41 | 41 | function action_editer_article_dist($arg = null) { |
| 42 | - include_spip('inc/autoriser'); |
|
| 43 | - $err = ''; |
|
| 44 | - if (is_null($arg)) { |
|
| 45 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 46 | - $arg = $securiser_action(); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - // si id_article n'est pas un nombre, c'est une creation |
|
| 50 | - // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 51 | - if (!$id_article = intval($arg)) { |
|
| 52 | - $id_parent = _request('id_parent'); |
|
| 53 | - if (!$id_parent) { |
|
| 54 | - $err = _L("creation interdite d'un article sans rubrique"); |
|
| 55 | - } elseif (!autoriser('creerarticledans', 'rubrique', $id_parent)) { |
|
| 56 | - $err = _T('info_creerdansrubrique_non_autorise'); |
|
| 57 | - } else { |
|
| 58 | - $id_article = article_inserer($id_parent); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // Enregistre l'envoi dans la BD |
|
| 63 | - if ($id_article > 0) { |
|
| 64 | - $err = article_modifier($id_article); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if ($err) { |
|
| 68 | - spip_log("echec editeur article: $err", _LOG_ERREUR); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - return [$id_article, $err]; |
|
| 42 | + include_spip('inc/autoriser'); |
|
| 43 | + $err = ''; |
|
| 44 | + if (is_null($arg)) { |
|
| 45 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 46 | + $arg = $securiser_action(); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + // si id_article n'est pas un nombre, c'est une creation |
|
| 50 | + // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 51 | + if (!$id_article = intval($arg)) { |
|
| 52 | + $id_parent = _request('id_parent'); |
|
| 53 | + if (!$id_parent) { |
|
| 54 | + $err = _L("creation interdite d'un article sans rubrique"); |
|
| 55 | + } elseif (!autoriser('creerarticledans', 'rubrique', $id_parent)) { |
|
| 56 | + $err = _T('info_creerdansrubrique_non_autorise'); |
|
| 57 | + } else { |
|
| 58 | + $id_article = article_inserer($id_parent); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // Enregistre l'envoi dans la BD |
|
| 63 | + if ($id_article > 0) { |
|
| 64 | + $err = article_modifier($id_article); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if ($err) { |
|
| 68 | + spip_log("echec editeur article: $err", _LOG_ERREUR); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + return [$id_article, $err]; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -90,50 +90,50 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function article_modifier($id_article, $set = null) { |
| 92 | 92 | |
| 93 | - // unifier $texte en cas de texte trop long |
|
| 94 | - trop_longs_articles(); |
|
| 95 | - |
|
| 96 | - include_spip('inc/modifier'); |
|
| 97 | - include_spip('inc/filtres'); |
|
| 98 | - $c = collecter_requests( |
|
| 99 | - // include list |
|
| 100 | - objet_info('article', 'champs_editables'), |
|
| 101 | - // exclude list |
|
| 102 | - ['date', 'statut', 'id_parent'], |
|
| 103 | - // donnees eventuellement fournies |
|
| 104 | - $set |
|
| 105 | - ); |
|
| 106 | - |
|
| 107 | - // Si l'article est publie, invalider les caches et demander sa reindexation |
|
| 108 | - $t = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 109 | - $invalideur = $indexation = false; |
|
| 110 | - if ($t == 'publie') { |
|
| 111 | - $invalideur = "id='article/$id_article'"; |
|
| 112 | - $indexation = true; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - if ( |
|
| 116 | - $err = objet_modifier_champs( |
|
| 117 | - 'article', |
|
| 118 | - $id_article, |
|
| 119 | - [ |
|
| 120 | - 'data' => $set, |
|
| 121 | - 'nonvide' => ['titre' => _T('info_nouvel_article') . ' ' . _T('info_numero_abbreviation') . $id_article], |
|
| 122 | - 'invalideur' => $invalideur, |
|
| 123 | - 'indexation' => $indexation, |
|
| 124 | - 'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 125 | - ], |
|
| 126 | - $c |
|
| 127 | - ) |
|
| 128 | - ) { |
|
| 129 | - return $err; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - // Modification de statut, changement de rubrique ? |
|
| 133 | - $c = collecter_requests(['date', 'statut', 'id_parent'], [], $set); |
|
| 134 | - $err = article_instituer($id_article, $c); |
|
| 135 | - |
|
| 136 | - return $err; |
|
| 93 | + // unifier $texte en cas de texte trop long |
|
| 94 | + trop_longs_articles(); |
|
| 95 | + |
|
| 96 | + include_spip('inc/modifier'); |
|
| 97 | + include_spip('inc/filtres'); |
|
| 98 | + $c = collecter_requests( |
|
| 99 | + // include list |
|
| 100 | + objet_info('article', 'champs_editables'), |
|
| 101 | + // exclude list |
|
| 102 | + ['date', 'statut', 'id_parent'], |
|
| 103 | + // donnees eventuellement fournies |
|
| 104 | + $set |
|
| 105 | + ); |
|
| 106 | + |
|
| 107 | + // Si l'article est publie, invalider les caches et demander sa reindexation |
|
| 108 | + $t = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 109 | + $invalideur = $indexation = false; |
|
| 110 | + if ($t == 'publie') { |
|
| 111 | + $invalideur = "id='article/$id_article'"; |
|
| 112 | + $indexation = true; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + if ( |
|
| 116 | + $err = objet_modifier_champs( |
|
| 117 | + 'article', |
|
| 118 | + $id_article, |
|
| 119 | + [ |
|
| 120 | + 'data' => $set, |
|
| 121 | + 'nonvide' => ['titre' => _T('info_nouvel_article') . ' ' . _T('info_numero_abbreviation') . $id_article], |
|
| 122 | + 'invalideur' => $invalideur, |
|
| 123 | + 'indexation' => $indexation, |
|
| 124 | + 'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 125 | + ], |
|
| 126 | + $c |
|
| 127 | + ) |
|
| 128 | + ) { |
|
| 129 | + return $err; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + // Modification de statut, changement de rubrique ? |
|
| 133 | + $c = collecter_requests(['date', 'statut', 'id_parent'], [], $set); |
|
| 134 | + $err = article_instituer($id_article, $c); |
|
| 135 | + |
|
| 136 | + return $err; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -169,120 +169,120 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function article_inserer($id_rubrique, $set = null) { |
| 171 | 171 | |
| 172 | - // Si id_rubrique vaut 0 ou n'est pas definie, creer l'article |
|
| 173 | - // dans la premiere rubrique racine |
|
| 174 | - if (!$id_rubrique = intval($id_rubrique)) { |
|
| 175 | - $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 176 | - $id_rubrique = $row['id_rubrique']; |
|
| 177 | - } else { |
|
| 178 | - $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - // eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue |
|
| 182 | - // cas de id_rubrique = -1 par exemple avec plugin "pages" |
|
| 183 | - $id_secteur = $row['id_secteur'] ?? 0; |
|
| 184 | - $lang_rub = $row['lang'] ?? ''; |
|
| 185 | - |
|
| 186 | - $lang = ''; |
|
| 187 | - $choisie = 'non'; |
|
| 188 | - // La langue a la creation : si les liens de traduction sont autorises |
|
| 189 | - // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 190 | - // ou a defaut celle de la rubrique |
|
| 191 | - // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 192 | - if ( |
|
| 193 | - !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 194 | - 'spip_articles', |
|
| 195 | - explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 196 | - ) |
|
| 197 | - ) { |
|
| 198 | - lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 199 | - if ( |
|
| 200 | - in_array( |
|
| 201 | - $GLOBALS['spip_lang'], |
|
| 202 | - explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 203 | - ) |
|
| 204 | - ) { |
|
| 205 | - $lang = $GLOBALS['spip_lang']; |
|
| 206 | - $choisie = 'oui'; |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - if (!$lang) { |
|
| 211 | - $choisie = 'non'; |
|
| 212 | - $lang = $lang_rub ?: $GLOBALS['meta']['langue_site']; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $champs = [ |
|
| 216 | - 'id_rubrique' => $id_rubrique, |
|
| 217 | - 'id_secteur' => $id_secteur, |
|
| 218 | - 'statut' => 'prepa', |
|
| 219 | - 'date' => date('Y-m-d H:i:s'), |
|
| 220 | - 'lang' => $lang, |
|
| 221 | - 'langue_choisie' => $choisie |
|
| 222 | - ]; |
|
| 223 | - |
|
| 224 | - if ($set) { |
|
| 225 | - $champs = array_merge($champs, $set); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // Envoyer aux plugins |
|
| 229 | - $champs = pipeline( |
|
| 230 | - 'pre_insertion', |
|
| 231 | - [ |
|
| 232 | - 'args' => [ |
|
| 233 | - 'table' => 'spip_articles', |
|
| 234 | - ], |
|
| 235 | - 'data' => $champs |
|
| 236 | - ] |
|
| 237 | - ); |
|
| 238 | - |
|
| 239 | - $id_article = sql_insertq('spip_articles', $champs); |
|
| 240 | - |
|
| 241 | - // controler si le serveur n'a pas renvoye une erreur |
|
| 242 | - if ($id_article > 0) { |
|
| 243 | - $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 244 | - $GLOBALS['visiteur_session']['id_auteur'] |
|
| 245 | - : _request('id_auteur')); |
|
| 246 | - if ($id_auteur) { |
|
| 247 | - include_spip('action/editer_auteur'); |
|
| 248 | - auteur_associer($id_auteur, ['article' => $id_article]); |
|
| 249 | - } |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - pipeline( |
|
| 253 | - 'post_insertion', |
|
| 254 | - [ |
|
| 255 | - 'args' => [ |
|
| 256 | - 'table' => 'spip_articles', |
|
| 257 | - 'id_objet' => $id_article |
|
| 258 | - ], |
|
| 259 | - 'data' => $champs |
|
| 260 | - ] |
|
| 261 | - ); |
|
| 172 | + // Si id_rubrique vaut 0 ou n'est pas definie, creer l'article |
|
| 173 | + // dans la premiere rubrique racine |
|
| 174 | + if (!$id_rubrique = intval($id_rubrique)) { |
|
| 175 | + $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 176 | + $id_rubrique = $row['id_rubrique']; |
|
| 177 | + } else { |
|
| 178 | + $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + // eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue |
|
| 182 | + // cas de id_rubrique = -1 par exemple avec plugin "pages" |
|
| 183 | + $id_secteur = $row['id_secteur'] ?? 0; |
|
| 184 | + $lang_rub = $row['lang'] ?? ''; |
|
| 185 | + |
|
| 186 | + $lang = ''; |
|
| 187 | + $choisie = 'non'; |
|
| 188 | + // La langue a la creation : si les liens de traduction sont autorises |
|
| 189 | + // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 190 | + // ou a defaut celle de la rubrique |
|
| 191 | + // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 192 | + if ( |
|
| 193 | + !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 194 | + 'spip_articles', |
|
| 195 | + explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 196 | + ) |
|
| 197 | + ) { |
|
| 198 | + lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 199 | + if ( |
|
| 200 | + in_array( |
|
| 201 | + $GLOBALS['spip_lang'], |
|
| 202 | + explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 203 | + ) |
|
| 204 | + ) { |
|
| 205 | + $lang = $GLOBALS['spip_lang']; |
|
| 206 | + $choisie = 'oui'; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + if (!$lang) { |
|
| 211 | + $choisie = 'non'; |
|
| 212 | + $lang = $lang_rub ?: $GLOBALS['meta']['langue_site']; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $champs = [ |
|
| 216 | + 'id_rubrique' => $id_rubrique, |
|
| 217 | + 'id_secteur' => $id_secteur, |
|
| 218 | + 'statut' => 'prepa', |
|
| 219 | + 'date' => date('Y-m-d H:i:s'), |
|
| 220 | + 'lang' => $lang, |
|
| 221 | + 'langue_choisie' => $choisie |
|
| 222 | + ]; |
|
| 223 | + |
|
| 224 | + if ($set) { |
|
| 225 | + $champs = array_merge($champs, $set); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // Envoyer aux plugins |
|
| 229 | + $champs = pipeline( |
|
| 230 | + 'pre_insertion', |
|
| 231 | + [ |
|
| 232 | + 'args' => [ |
|
| 233 | + 'table' => 'spip_articles', |
|
| 234 | + ], |
|
| 235 | + 'data' => $champs |
|
| 236 | + ] |
|
| 237 | + ); |
|
| 238 | + |
|
| 239 | + $id_article = sql_insertq('spip_articles', $champs); |
|
| 240 | + |
|
| 241 | + // controler si le serveur n'a pas renvoye une erreur |
|
| 242 | + if ($id_article > 0) { |
|
| 243 | + $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 244 | + $GLOBALS['visiteur_session']['id_auteur'] |
|
| 245 | + : _request('id_auteur')); |
|
| 246 | + if ($id_auteur) { |
|
| 247 | + include_spip('action/editer_auteur'); |
|
| 248 | + auteur_associer($id_auteur, ['article' => $id_article]); |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + pipeline( |
|
| 253 | + 'post_insertion', |
|
| 254 | + [ |
|
| 255 | + 'args' => [ |
|
| 256 | + 'table' => 'spip_articles', |
|
| 257 | + 'id_objet' => $id_article |
|
| 258 | + ], |
|
| 259 | + 'data' => $champs |
|
| 260 | + ] |
|
| 261 | + ); |
|
| 262 | 262 | |
| 263 | - // Appeler une notification |
|
| 264 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 265 | - $notifications( |
|
| 266 | - 'article_inserer', |
|
| 267 | - $id_article, |
|
| 268 | - [ |
|
| 269 | - 'id_parent' => $id_rubrique, |
|
| 270 | - 'champs' => $champs, |
|
| 271 | - ] |
|
| 272 | - ); |
|
| 273 | - $notifications( |
|
| 274 | - 'objet_inserer', |
|
| 275 | - $id_article, |
|
| 276 | - [ |
|
| 277 | - 'objet' => 'article', |
|
| 278 | - 'id_objet' => $id_article, |
|
| 279 | - 'id_parent' => $id_rubrique, |
|
| 280 | - 'champs' => $champs, |
|
| 281 | - ] |
|
| 282 | - ); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - return $id_article; |
|
| 263 | + // Appeler une notification |
|
| 264 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 265 | + $notifications( |
|
| 266 | + 'article_inserer', |
|
| 267 | + $id_article, |
|
| 268 | + [ |
|
| 269 | + 'id_parent' => $id_rubrique, |
|
| 270 | + 'champs' => $champs, |
|
| 271 | + ] |
|
| 272 | + ); |
|
| 273 | + $notifications( |
|
| 274 | + 'objet_inserer', |
|
| 275 | + $id_article, |
|
| 276 | + [ |
|
| 277 | + 'objet' => 'article', |
|
| 278 | + 'id_objet' => $id_article, |
|
| 279 | + 'id_parent' => $id_rubrique, |
|
| 280 | + 'champs' => $champs, |
|
| 281 | + ] |
|
| 282 | + ); |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + return $id_article; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -310,153 +310,153 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | function article_instituer($id_article, $c, $calcul_rub = true) { |
| 312 | 312 | |
| 313 | - include_spip('inc/autoriser'); |
|
| 314 | - include_spip('inc/rubriques'); |
|
| 315 | - include_spip('inc/modifier'); |
|
| 316 | - |
|
| 317 | - $row = sql_fetsel('statut, date, id_rubrique', 'spip_articles', "id_article=$id_article"); |
|
| 318 | - $id_rubrique = $row['id_rubrique']; |
|
| 319 | - $statut_ancien = $statut = $row['statut']; |
|
| 320 | - $date_ancienne = $date = $row['date']; |
|
| 321 | - $champs = []; |
|
| 322 | - |
|
| 323 | - $d = $c['date'] ?? null; |
|
| 324 | - $s = $c['statut'] ?? $statut; |
|
| 325 | - |
|
| 326 | - // cf autorisations dans inc/instituer_article |
|
| 327 | - if ($s != $statut or ($d and $d != $date)) { |
|
| 328 | - if (autoriser('publierdans', 'rubrique', $id_rubrique)) { |
|
| 329 | - $statut = $champs['statut'] = $s; |
|
| 330 | - } elseif (autoriser('modifier', 'article', $id_article) and $s != 'publie') { |
|
| 331 | - $statut = $champs['statut'] = $s; |
|
| 332 | - } else { |
|
| 333 | - spip_log("editer_article $id_article refus " . join(' ', $c)); |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - // En cas de publication, fixer la date a "maintenant" |
|
| 337 | - // sauf si $c commande autre chose |
|
| 338 | - // ou si l'article est deja date dans le futur |
|
| 339 | - // En cas de proposition d'un article (mais pas depublication), idem |
|
| 340 | - if ( |
|
| 341 | - $champs['statut'] == 'publie' |
|
| 342 | - or ($champs['statut'] == 'prop' and ($d or !in_array($statut_ancien, ['publie', 'prop']))) |
|
| 343 | - ) { |
|
| 344 | - if ($d or strtotime($d = $date) > time()) { |
|
| 345 | - $champs['date'] = $date = $d; |
|
| 346 | - } else { |
|
| 347 | - $champs['date'] = $date = date('Y-m-d H:i:s'); |
|
| 348 | - } |
|
| 349 | - } |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - // Verifier que la rubrique demandee existe et est differente |
|
| 353 | - // de la rubrique actuelle |
|
| 354 | - if ( |
|
| 355 | - isset($c['id_parent']) |
|
| 356 | - and $id_parent = $c['id_parent'] |
|
| 357 | - and $id_parent != $id_rubrique |
|
| 358 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 359 | - ) { |
|
| 360 | - $champs['id_rubrique'] = $id_parent; |
|
| 361 | - |
|
| 362 | - // si l'article etait publie |
|
| 363 | - // et que le demandeur n'est pas admin de la rubrique de destination |
|
| 364 | - // repasser l'article en statut 'propose'. |
|
| 365 | - if ( |
|
| 366 | - $statut == 'publie' |
|
| 367 | - and !autoriser('publierdans', 'rubrique', $id_parent) |
|
| 368 | - ) { |
|
| 369 | - $champs['statut'] = 'prop'; |
|
| 370 | - } |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - // Envoyer aux plugins |
|
| 374 | - $champs = pipeline( |
|
| 375 | - 'pre_edition', |
|
| 376 | - [ |
|
| 377 | - 'args' => [ |
|
| 378 | - 'table' => 'spip_articles', |
|
| 379 | - 'id_objet' => $id_article, |
|
| 380 | - 'action' => 'instituer', |
|
| 381 | - 'statut_ancien' => $statut_ancien, |
|
| 382 | - 'date_ancienne' => $date_ancienne, |
|
| 383 | - ], |
|
| 384 | - 'data' => $champs |
|
| 385 | - ] |
|
| 386 | - ); |
|
| 387 | - |
|
| 388 | - if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 389 | - return ''; |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - // Envoyer les modifs. |
|
| 393 | - editer_article_heritage($id_article, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 394 | - |
|
| 395 | - // Invalider les caches |
|
| 396 | - include_spip('inc/invalideur'); |
|
| 397 | - suivre_invalideur("id='article/$id_article'"); |
|
| 398 | - |
|
| 399 | - if ($date) { |
|
| 400 | - $t = strtotime($date); |
|
| 401 | - $p = @$GLOBALS['meta']['date_prochain_postdate']; |
|
| 402 | - if ($t > time() and (!$p or ($t < $p))) { |
|
| 403 | - ecrire_meta('date_prochain_postdate', $t); |
|
| 404 | - } |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - // Pipeline |
|
| 408 | - pipeline( |
|
| 409 | - 'post_edition', |
|
| 410 | - [ |
|
| 411 | - 'args' => [ |
|
| 412 | - 'table' => 'spip_articles', |
|
| 413 | - 'id_objet' => $id_article, |
|
| 414 | - 'action' => 'instituer', |
|
| 415 | - 'statut_ancien' => $statut_ancien, |
|
| 416 | - 'date_ancienne' => $date_ancienne, |
|
| 417 | - ], |
|
| 418 | - 'data' => $champs |
|
| 419 | - ] |
|
| 420 | - ); |
|
| 421 | - |
|
| 422 | - // Notifications |
|
| 423 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 424 | - $notifications( |
|
| 425 | - 'article_instituer', |
|
| 426 | - $id_article, |
|
| 427 | - [ |
|
| 428 | - 'statut' => $statut, |
|
| 429 | - 'statut_ancien' => $statut_ancien, |
|
| 430 | - 'date' => $date, |
|
| 431 | - 'date_ancienne' => $date_ancienne, |
|
| 432 | - 'id_parent_ancien' => $id_rubrique, |
|
| 433 | - 'champs' => $champs, |
|
| 434 | - ] |
|
| 435 | - ); |
|
| 436 | - $notifications( |
|
| 437 | - 'objet_instituer', |
|
| 438 | - $id_article, |
|
| 439 | - [ |
|
| 440 | - 'objet' => 'article', |
|
| 441 | - 'id_objet' => $id_article, |
|
| 442 | - 'statut' => $statut, |
|
| 443 | - 'statut_ancien' => $statut_ancien, |
|
| 444 | - 'date' => $date, |
|
| 445 | - 'date_ancienne' => $date_ancienne, |
|
| 446 | - 'id_parent_ancien' => $id_rubrique, |
|
| 447 | - 'champs' => $champs, |
|
| 448 | - ] |
|
| 449 | - ); |
|
| 313 | + include_spip('inc/autoriser'); |
|
| 314 | + include_spip('inc/rubriques'); |
|
| 315 | + include_spip('inc/modifier'); |
|
| 316 | + |
|
| 317 | + $row = sql_fetsel('statut, date, id_rubrique', 'spip_articles', "id_article=$id_article"); |
|
| 318 | + $id_rubrique = $row['id_rubrique']; |
|
| 319 | + $statut_ancien = $statut = $row['statut']; |
|
| 320 | + $date_ancienne = $date = $row['date']; |
|
| 321 | + $champs = []; |
|
| 322 | + |
|
| 323 | + $d = $c['date'] ?? null; |
|
| 324 | + $s = $c['statut'] ?? $statut; |
|
| 325 | + |
|
| 326 | + // cf autorisations dans inc/instituer_article |
|
| 327 | + if ($s != $statut or ($d and $d != $date)) { |
|
| 328 | + if (autoriser('publierdans', 'rubrique', $id_rubrique)) { |
|
| 329 | + $statut = $champs['statut'] = $s; |
|
| 330 | + } elseif (autoriser('modifier', 'article', $id_article) and $s != 'publie') { |
|
| 331 | + $statut = $champs['statut'] = $s; |
|
| 332 | + } else { |
|
| 333 | + spip_log("editer_article $id_article refus " . join(' ', $c)); |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + // En cas de publication, fixer la date a "maintenant" |
|
| 337 | + // sauf si $c commande autre chose |
|
| 338 | + // ou si l'article est deja date dans le futur |
|
| 339 | + // En cas de proposition d'un article (mais pas depublication), idem |
|
| 340 | + if ( |
|
| 341 | + $champs['statut'] == 'publie' |
|
| 342 | + or ($champs['statut'] == 'prop' and ($d or !in_array($statut_ancien, ['publie', 'prop']))) |
|
| 343 | + ) { |
|
| 344 | + if ($d or strtotime($d = $date) > time()) { |
|
| 345 | + $champs['date'] = $date = $d; |
|
| 346 | + } else { |
|
| 347 | + $champs['date'] = $date = date('Y-m-d H:i:s'); |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + // Verifier que la rubrique demandee existe et est differente |
|
| 353 | + // de la rubrique actuelle |
|
| 354 | + if ( |
|
| 355 | + isset($c['id_parent']) |
|
| 356 | + and $id_parent = $c['id_parent'] |
|
| 357 | + and $id_parent != $id_rubrique |
|
| 358 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 359 | + ) { |
|
| 360 | + $champs['id_rubrique'] = $id_parent; |
|
| 361 | + |
|
| 362 | + // si l'article etait publie |
|
| 363 | + // et que le demandeur n'est pas admin de la rubrique de destination |
|
| 364 | + // repasser l'article en statut 'propose'. |
|
| 365 | + if ( |
|
| 366 | + $statut == 'publie' |
|
| 367 | + and !autoriser('publierdans', 'rubrique', $id_parent) |
|
| 368 | + ) { |
|
| 369 | + $champs['statut'] = 'prop'; |
|
| 370 | + } |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + // Envoyer aux plugins |
|
| 374 | + $champs = pipeline( |
|
| 375 | + 'pre_edition', |
|
| 376 | + [ |
|
| 377 | + 'args' => [ |
|
| 378 | + 'table' => 'spip_articles', |
|
| 379 | + 'id_objet' => $id_article, |
|
| 380 | + 'action' => 'instituer', |
|
| 381 | + 'statut_ancien' => $statut_ancien, |
|
| 382 | + 'date_ancienne' => $date_ancienne, |
|
| 383 | + ], |
|
| 384 | + 'data' => $champs |
|
| 385 | + ] |
|
| 386 | + ); |
|
| 387 | + |
|
| 388 | + if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 389 | + return ''; |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + // Envoyer les modifs. |
|
| 393 | + editer_article_heritage($id_article, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 394 | + |
|
| 395 | + // Invalider les caches |
|
| 396 | + include_spip('inc/invalideur'); |
|
| 397 | + suivre_invalideur("id='article/$id_article'"); |
|
| 398 | + |
|
| 399 | + if ($date) { |
|
| 400 | + $t = strtotime($date); |
|
| 401 | + $p = @$GLOBALS['meta']['date_prochain_postdate']; |
|
| 402 | + if ($t > time() and (!$p or ($t < $p))) { |
|
| 403 | + ecrire_meta('date_prochain_postdate', $t); |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + // Pipeline |
|
| 408 | + pipeline( |
|
| 409 | + 'post_edition', |
|
| 410 | + [ |
|
| 411 | + 'args' => [ |
|
| 412 | + 'table' => 'spip_articles', |
|
| 413 | + 'id_objet' => $id_article, |
|
| 414 | + 'action' => 'instituer', |
|
| 415 | + 'statut_ancien' => $statut_ancien, |
|
| 416 | + 'date_ancienne' => $date_ancienne, |
|
| 417 | + ], |
|
| 418 | + 'data' => $champs |
|
| 419 | + ] |
|
| 420 | + ); |
|
| 421 | + |
|
| 422 | + // Notifications |
|
| 423 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 424 | + $notifications( |
|
| 425 | + 'article_instituer', |
|
| 426 | + $id_article, |
|
| 427 | + [ |
|
| 428 | + 'statut' => $statut, |
|
| 429 | + 'statut_ancien' => $statut_ancien, |
|
| 430 | + 'date' => $date, |
|
| 431 | + 'date_ancienne' => $date_ancienne, |
|
| 432 | + 'id_parent_ancien' => $id_rubrique, |
|
| 433 | + 'champs' => $champs, |
|
| 434 | + ] |
|
| 435 | + ); |
|
| 436 | + $notifications( |
|
| 437 | + 'objet_instituer', |
|
| 438 | + $id_article, |
|
| 439 | + [ |
|
| 440 | + 'objet' => 'article', |
|
| 441 | + 'id_objet' => $id_article, |
|
| 442 | + 'statut' => $statut, |
|
| 443 | + 'statut_ancien' => $statut_ancien, |
|
| 444 | + 'date' => $date, |
|
| 445 | + 'date_ancienne' => $date_ancienne, |
|
| 446 | + 'id_parent_ancien' => $id_rubrique, |
|
| 447 | + 'champs' => $champs, |
|
| 448 | + ] |
|
| 449 | + ); |
|
| 450 | 450 | |
| 451 | - // Rétro-compat |
|
| 452 | - $notifications( |
|
| 453 | - 'instituerarticle', |
|
| 454 | - $id_article, |
|
| 455 | - ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 456 | - ); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - return ''; // pas d'erreur |
|
| 451 | + // Rétro-compat |
|
| 452 | + $notifications( |
|
| 453 | + 'instituerarticle', |
|
| 454 | + $id_article, |
|
| 455 | + ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 456 | + ); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + return ''; // pas d'erreur |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -481,37 +481,37 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | function editer_article_heritage($id_article, $id_rubrique, $statut, $champs, $cond = true) { |
| 483 | 483 | |
| 484 | - // Si on deplace l'article |
|
| 485 | - // changer aussi son secteur et sa langue (si heritee) |
|
| 486 | - if (isset($champs['id_rubrique'])) { |
|
| 487 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 488 | - |
|
| 489 | - $langue = $row_rub['lang']; |
|
| 490 | - $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 491 | - if ( |
|
| 492 | - sql_fetsel( |
|
| 493 | - '1', |
|
| 494 | - 'spip_articles', |
|
| 495 | - 'id_article=' . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 496 | - ) |
|
| 497 | - ) { |
|
| 498 | - $champs['lang'] = $langue; |
|
| 499 | - } |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - if (!$champs) { |
|
| 503 | - return; |
|
| 504 | - } |
|
| 505 | - |
|
| 506 | - sql_updateq('spip_articles', $champs, 'id_article=' . intval($id_article)); |
|
| 507 | - |
|
| 508 | - // Changer le statut des rubriques concernees |
|
| 509 | - |
|
| 510 | - if ($cond) { |
|
| 511 | - include_spip('inc/rubriques'); |
|
| 512 | - $postdate = ($GLOBALS['meta']['post_dates'] == 'non' and isset($champs['date']) and (strtotime($champs['date']) < time())) ? $champs['date'] : false; |
|
| 513 | - calculer_rubriques_if($id_rubrique, $champs, ['statut_ancien' => $statut], $postdate); |
|
| 514 | - } |
|
| 484 | + // Si on deplace l'article |
|
| 485 | + // changer aussi son secteur et sa langue (si heritee) |
|
| 486 | + if (isset($champs['id_rubrique'])) { |
|
| 487 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 488 | + |
|
| 489 | + $langue = $row_rub['lang']; |
|
| 490 | + $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 491 | + if ( |
|
| 492 | + sql_fetsel( |
|
| 493 | + '1', |
|
| 494 | + 'spip_articles', |
|
| 495 | + 'id_article=' . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 496 | + ) |
|
| 497 | + ) { |
|
| 498 | + $champs['lang'] = $langue; |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + if (!$champs) { |
|
| 503 | + return; |
|
| 504 | + } |
|
| 505 | + |
|
| 506 | + sql_updateq('spip_articles', $champs, 'id_article=' . intval($id_article)); |
|
| 507 | + |
|
| 508 | + // Changer le statut des rubriques concernees |
|
| 509 | + |
|
| 510 | + if ($cond) { |
|
| 511 | + include_spip('inc/rubriques'); |
|
| 512 | + $postdate = ($GLOBALS['meta']['post_dates'] == 'non' and isset($champs['date']) and (strtotime($champs['date']) < time())) ? $champs['date'] : false; |
|
| 513 | + calculer_rubriques_if($id_rubrique, $champs, ['statut_ancien' => $statut], $postdate); |
|
| 514 | + } |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -520,10 +520,10 @@ discard block |
||
| 520 | 520 | * @return void |
| 521 | 521 | */ |
| 522 | 522 | function trop_longs_articles() { |
| 523 | - if (is_array($plus = _request('texte_plus'))) { |
|
| 524 | - foreach ($plus as $n => $t) { |
|
| 525 | - $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", '', $t); |
|
| 526 | - } |
|
| 527 | - set_request('texte', join('', $plus) . _request('texte')); |
|
| 528 | - } |
|
| 523 | + if (is_array($plus = _request('texte_plus'))) { |
|
| 524 | + foreach ($plus as $n => $t) { |
|
| 525 | + $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", '', $t); |
|
| 526 | + } |
|
| 527 | + set_request('texte', join('', $plus) . _request('texte')); |
|
| 528 | + } |
|
| 529 | 529 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Rubriques\Edition |
| 17 | 17 | */ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/rubriques'); |
@@ -38,34 +38,34 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | function action_editer_rubrique_dist($arg = null) { |
| 40 | 40 | |
| 41 | - if (is_null($arg)) { |
|
| 42 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 43 | - $arg = $securiser_action(); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - if (!$id_rubrique = intval($arg)) { |
|
| 47 | - if ($arg != 'oui') { |
|
| 48 | - include_spip('inc/headers'); |
|
| 49 | - redirige_url_ecrire(); |
|
| 50 | - } |
|
| 51 | - $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - $err = rubrique_modifier($id_rubrique); |
|
| 55 | - |
|
| 56 | - if (_request('redirect')) { |
|
| 57 | - $redirect = parametre_url( |
|
| 58 | - urldecode(_request('redirect')), |
|
| 59 | - 'id_rubrique', |
|
| 60 | - $id_rubrique, |
|
| 61 | - '&' |
|
| 62 | - ); |
|
| 63 | - |
|
| 64 | - include_spip('inc/headers'); |
|
| 65 | - redirige_par_entete($redirect); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - return [$id_rubrique, $err]; |
|
| 41 | + if (is_null($arg)) { |
|
| 42 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 43 | + $arg = $securiser_action(); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + if (!$id_rubrique = intval($arg)) { |
|
| 47 | + if ($arg != 'oui') { |
|
| 48 | + include_spip('inc/headers'); |
|
| 49 | + redirige_url_ecrire(); |
|
| 50 | + } |
|
| 51 | + $id_rubrique = rubrique_inserer(_request('id_parent')); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + $err = rubrique_modifier($id_rubrique); |
|
| 55 | + |
|
| 56 | + if (_request('redirect')) { |
|
| 57 | + $redirect = parametre_url( |
|
| 58 | + urldecode(_request('redirect')), |
|
| 59 | + 'id_rubrique', |
|
| 60 | + $id_rubrique, |
|
| 61 | + '&' |
|
| 62 | + ); |
|
| 63 | + |
|
| 64 | + include_spip('inc/headers'); |
|
| 65 | + redirige_par_entete($redirect); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + return [$id_rubrique, $err]; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -80,64 +80,64 @@ discard block |
||
| 80 | 80 | * Identifiant de la rubrique crée |
| 81 | 81 | */ |
| 82 | 82 | function rubrique_inserer($id_parent, $set = null) { |
| 83 | - $champs = [ |
|
| 84 | - 'titre' => _T('item_nouvelle_rubrique'), |
|
| 85 | - 'id_parent' => intval($id_parent), |
|
| 86 | - 'statut' => 'prepa' |
|
| 87 | - ]; |
|
| 88 | - |
|
| 89 | - if ($set) { |
|
| 90 | - $champs = array_merge($champs, $set); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - // Envoyer aux plugins |
|
| 94 | - $champs = pipeline( |
|
| 95 | - 'pre_insertion', |
|
| 96 | - [ |
|
| 97 | - 'args' => [ |
|
| 98 | - 'table' => 'spip_rubriques', |
|
| 99 | - ], |
|
| 100 | - 'data' => $champs |
|
| 101 | - ] |
|
| 102 | - ); |
|
| 103 | - |
|
| 104 | - $id_rubrique = sql_insertq('spip_rubriques', $champs); |
|
| 105 | - pipeline( |
|
| 106 | - 'post_insertion', |
|
| 107 | - [ |
|
| 108 | - 'args' => [ |
|
| 109 | - 'table' => 'spip_rubriques', |
|
| 110 | - 'id_objet' => $id_rubrique |
|
| 111 | - ], |
|
| 112 | - 'data' => $champs |
|
| 113 | - ] |
|
| 114 | - ); |
|
| 115 | - propager_les_secteurs(); |
|
| 116 | - calculer_langues_rubriques(); |
|
| 117 | - |
|
| 118 | - // Appeler une notification |
|
| 119 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 120 | - $notifications( |
|
| 121 | - 'rubrique_inserer', |
|
| 122 | - $id_rubrique, |
|
| 123 | - [ |
|
| 124 | - 'id_parent' => $id_parent, |
|
| 125 | - 'champs' => $champs, |
|
| 126 | - ] |
|
| 127 | - ); |
|
| 128 | - $notifications( |
|
| 129 | - 'objet_inserer', |
|
| 130 | - $id_rubrique, |
|
| 131 | - [ |
|
| 132 | - 'objet' => 'rubrique', |
|
| 133 | - 'id_objet' => $id_rubrique, |
|
| 134 | - 'id_parent' => $id_parent, |
|
| 135 | - 'champs' => $champs, |
|
| 136 | - ] |
|
| 137 | - ); |
|
| 138 | - } |
|
| 83 | + $champs = [ |
|
| 84 | + 'titre' => _T('item_nouvelle_rubrique'), |
|
| 85 | + 'id_parent' => intval($id_parent), |
|
| 86 | + 'statut' => 'prepa' |
|
| 87 | + ]; |
|
| 88 | + |
|
| 89 | + if ($set) { |
|
| 90 | + $champs = array_merge($champs, $set); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + // Envoyer aux plugins |
|
| 94 | + $champs = pipeline( |
|
| 95 | + 'pre_insertion', |
|
| 96 | + [ |
|
| 97 | + 'args' => [ |
|
| 98 | + 'table' => 'spip_rubriques', |
|
| 99 | + ], |
|
| 100 | + 'data' => $champs |
|
| 101 | + ] |
|
| 102 | + ); |
|
| 103 | + |
|
| 104 | + $id_rubrique = sql_insertq('spip_rubriques', $champs); |
|
| 105 | + pipeline( |
|
| 106 | + 'post_insertion', |
|
| 107 | + [ |
|
| 108 | + 'args' => [ |
|
| 109 | + 'table' => 'spip_rubriques', |
|
| 110 | + 'id_objet' => $id_rubrique |
|
| 111 | + ], |
|
| 112 | + 'data' => $champs |
|
| 113 | + ] |
|
| 114 | + ); |
|
| 115 | + propager_les_secteurs(); |
|
| 116 | + calculer_langues_rubriques(); |
|
| 117 | + |
|
| 118 | + // Appeler une notification |
|
| 119 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 120 | + $notifications( |
|
| 121 | + 'rubrique_inserer', |
|
| 122 | + $id_rubrique, |
|
| 123 | + [ |
|
| 124 | + 'id_parent' => $id_parent, |
|
| 125 | + 'champs' => $champs, |
|
| 126 | + ] |
|
| 127 | + ); |
|
| 128 | + $notifications( |
|
| 129 | + 'objet_inserer', |
|
| 130 | + $id_rubrique, |
|
| 131 | + [ |
|
| 132 | + 'objet' => 'rubrique', |
|
| 133 | + 'id_objet' => $id_rubrique, |
|
| 134 | + 'id_parent' => $id_parent, |
|
| 135 | + 'champs' => $champs, |
|
| 136 | + ] |
|
| 137 | + ); |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - return $id_rubrique; |
|
| 140 | + return $id_rubrique; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -153,46 +153,46 @@ discard block |
||
| 153 | 153 | * - chaîne : texte d'un message d'erreur |
| 154 | 154 | */ |
| 155 | 155 | function rubrique_modifier($id_rubrique, $set = null) { |
| 156 | - include_spip('inc/autoriser'); |
|
| 157 | - include_spip('inc/filtres'); |
|
| 158 | - |
|
| 159 | - include_spip('inc/modifier'); |
|
| 160 | - $c = collecter_requests( |
|
| 161 | - // include list |
|
| 162 | - objet_info('rubrique', 'champs_editables'), |
|
| 163 | - // exclude list |
|
| 164 | - ['id_parent', 'confirme_deplace'], |
|
| 165 | - // donnees eventuellement fournies |
|
| 166 | - $set |
|
| 167 | - ); |
|
| 168 | - |
|
| 169 | - if ( |
|
| 170 | - $err = objet_modifier_champs( |
|
| 171 | - 'rubrique', |
|
| 172 | - $id_rubrique, |
|
| 173 | - [ |
|
| 174 | - 'data' => $set, |
|
| 175 | - 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 176 | - ], |
|
| 177 | - $c |
|
| 178 | - ) |
|
| 179 | - ) { |
|
| 180 | - return $err; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set); |
|
| 184 | - // Deplacer la rubrique |
|
| 185 | - if (isset($c['id_parent'])) { |
|
| 186 | - $err = rubrique_instituer($id_rubrique, $c); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - // invalider les caches marques de cette rubrique |
|
| 190 | - include_spip('inc/invalideur'); |
|
| 191 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 192 | - // et celui de menu_rubriques |
|
| 193 | - effacer_meta('date_calcul_rubriques'); |
|
| 194 | - |
|
| 195 | - return $err; |
|
| 156 | + include_spip('inc/autoriser'); |
|
| 157 | + include_spip('inc/filtres'); |
|
| 158 | + |
|
| 159 | + include_spip('inc/modifier'); |
|
| 160 | + $c = collecter_requests( |
|
| 161 | + // include list |
|
| 162 | + objet_info('rubrique', 'champs_editables'), |
|
| 163 | + // exclude list |
|
| 164 | + ['id_parent', 'confirme_deplace'], |
|
| 165 | + // donnees eventuellement fournies |
|
| 166 | + $set |
|
| 167 | + ); |
|
| 168 | + |
|
| 169 | + if ( |
|
| 170 | + $err = objet_modifier_champs( |
|
| 171 | + 'rubrique', |
|
| 172 | + $id_rubrique, |
|
| 173 | + [ |
|
| 174 | + 'data' => $set, |
|
| 175 | + 'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique] |
|
| 176 | + ], |
|
| 177 | + $c |
|
| 178 | + ) |
|
| 179 | + ) { |
|
| 180 | + return $err; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set); |
|
| 184 | + // Deplacer la rubrique |
|
| 185 | + if (isset($c['id_parent'])) { |
|
| 186 | + $err = rubrique_instituer($id_rubrique, $c); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + // invalider les caches marques de cette rubrique |
|
| 190 | + include_spip('inc/invalideur'); |
|
| 191 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 192 | + // et celui de menu_rubriques |
|
| 193 | + effacer_meta('date_calcul_rubriques'); |
|
| 194 | + |
|
| 195 | + return $err; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -215,29 +215,29 @@ discard block |
||
| 215 | 215 | * false si la confirmation du déplacement n'est pas présente |
| 216 | 216 | */ |
| 217 | 217 | function editer_rubrique_breves($id_rubrique, $id_parent, $c = []) { |
| 218 | - if (!sql_table_exists('spip_breves')) { |
|
| 219 | - return true; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 223 | - return true; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - if (empty($c['confirme_deplace']) or $c['confirme_deplace'] != 'oui') { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - if ( |
|
| 231 | - $id_secteur = sql_getfetsel( |
|
| 232 | - 'id_secteur', |
|
| 233 | - 'spip_rubriques', |
|
| 234 | - "id_rubrique=$id_parent" |
|
| 235 | - ) |
|
| 236 | - ) { |
|
| 237 | - sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique"); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - return true; |
|
| 218 | + if (!sql_table_exists('spip_breves')) { |
|
| 219 | + return true; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) { |
|
| 223 | + return true; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + if (empty($c['confirme_deplace']) or $c['confirme_deplace'] != 'oui') { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + if ( |
|
| 231 | + $id_secteur = sql_getfetsel( |
|
| 232 | + 'id_secteur', |
|
| 233 | + 'spip_rubriques', |
|
| 234 | + "id_rubrique=$id_parent" |
|
| 235 | + ) |
|
| 236 | + ) { |
|
| 237 | + sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique"); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + return true; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
@@ -259,72 +259,72 @@ discard block |
||
| 259 | 259 | * Chaîne : texte du message d'erreur |
| 260 | 260 | */ |
| 261 | 261 | function rubrique_instituer($id_rubrique, $c) { |
| 262 | - // traitement de la rubrique parente |
|
| 263 | - // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 264 | - // qu'on n'administre pas. |
|
| 265 | - |
|
| 266 | - if (null !== ($id_parent = $c['id_parent'])) { |
|
| 267 | - $id_parent = intval($id_parent); |
|
| 268 | - $filles = calcul_branche_in($id_rubrique); |
|
| 269 | - if (strpos(",$id_parent,", (string) ",$filles,") !== false) { |
|
| 270 | - spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 271 | - } else { |
|
| 272 | - $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 273 | - $old_parent = $s['id_parent']; |
|
| 274 | - |
|
| 275 | - if ( |
|
| 276 | - !($id_parent != $old_parent |
|
| 277 | - and autoriser('publierdans', 'rubrique', $id_parent) |
|
| 278 | - and autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 279 | - and autoriser('publierdans', 'rubrique', $old_parent) |
|
| 280 | - ) |
|
| 281 | - ) { |
|
| 282 | - if ($s['statut'] != 'prepa') { |
|
| 283 | - spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 284 | - } |
|
| 285 | - } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 286 | - $statut_ancien = $s['statut']; |
|
| 287 | - sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique"); |
|
| 288 | - |
|
| 289 | - |
|
| 290 | - propager_les_secteurs(); |
|
| 291 | - |
|
| 292 | - // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 293 | - if ($statut_ancien == 'publie') { |
|
| 294 | - calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]); |
|
| 295 | - } |
|
| 296 | - // Creation ou deplacement d'une rubrique non publiee |
|
| 297 | - // invalider le cache de leur menu |
|
| 298 | - elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 299 | - effacer_meta('date_calcul_rubriques'); |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - calculer_langues_rubriques(); |
|
| 262 | + // traitement de la rubrique parente |
|
| 263 | + // interdiction de deplacer vers ou a partir d'une rubrique |
|
| 264 | + // qu'on n'administre pas. |
|
| 265 | + |
|
| 266 | + if (null !== ($id_parent = $c['id_parent'])) { |
|
| 267 | + $id_parent = intval($id_parent); |
|
| 268 | + $filles = calcul_branche_in($id_rubrique); |
|
| 269 | + if (strpos(",$id_parent,", (string) ",$filles,") !== false) { |
|
| 270 | + spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent"); |
|
| 271 | + } else { |
|
| 272 | + $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 273 | + $old_parent = $s['id_parent']; |
|
| 274 | + |
|
| 275 | + if ( |
|
| 276 | + !($id_parent != $old_parent |
|
| 277 | + and autoriser('publierdans', 'rubrique', $id_parent) |
|
| 278 | + and autoriser('creerrubriquedans', 'rubrique', $id_parent) |
|
| 279 | + and autoriser('publierdans', 'rubrique', $old_parent) |
|
| 280 | + ) |
|
| 281 | + ) { |
|
| 282 | + if ($s['statut'] != 'prepa') { |
|
| 283 | + spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']); |
|
| 284 | + } |
|
| 285 | + } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) { |
|
| 286 | + $statut_ancien = $s['statut']; |
|
| 287 | + sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique"); |
|
| 288 | + |
|
| 289 | + |
|
| 290 | + propager_les_secteurs(); |
|
| 291 | + |
|
| 292 | + // Deplacement d'une rubrique publiee ==> chgt general de leur statut |
|
| 293 | + if ($statut_ancien == 'publie') { |
|
| 294 | + calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]); |
|
| 295 | + } |
|
| 296 | + // Creation ou deplacement d'une rubrique non publiee |
|
| 297 | + // invalider le cache de leur menu |
|
| 298 | + elseif (!$statut_ancien || $old_parent != $id_parent) { |
|
| 299 | + effacer_meta('date_calcul_rubriques'); |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + calculer_langues_rubriques(); |
|
| 303 | 303 | |
| 304 | - // Appeler une notification |
|
| 305 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 306 | - $notifications( |
|
| 307 | - 'rubrique_instituer', |
|
| 308 | - $id_rubrique, |
|
| 309 | - [ |
|
| 310 | - 'statut_ancien' => $statut_ancien, |
|
| 311 | - 'id_parent_ancien' => $old_parent, |
|
| 312 | - ] |
|
| 313 | - ); |
|
| 314 | - $notifications( |
|
| 315 | - 'objet_instituer', |
|
| 316 | - $id_rubrique, |
|
| 317 | - [ |
|
| 318 | - 'objet' => 'rubrique', |
|
| 319 | - 'id_objet' => $id_rubrique, |
|
| 320 | - 'statut_ancien' => $statut_ancien, |
|
| 321 | - 'id_parent_ancien' => $old_parent, |
|
| 322 | - ] |
|
| 323 | - ); |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - return ''; // pas d'erreur |
|
| 304 | + // Appeler une notification |
|
| 305 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 306 | + $notifications( |
|
| 307 | + 'rubrique_instituer', |
|
| 308 | + $id_rubrique, |
|
| 309 | + [ |
|
| 310 | + 'statut_ancien' => $statut_ancien, |
|
| 311 | + 'id_parent_ancien' => $old_parent, |
|
| 312 | + ] |
|
| 313 | + ); |
|
| 314 | + $notifications( |
|
| 315 | + 'objet_instituer', |
|
| 316 | + $id_rubrique, |
|
| 317 | + [ |
|
| 318 | + 'objet' => 'rubrique', |
|
| 319 | + 'id_objet' => $id_rubrique, |
|
| 320 | + 'statut_ancien' => $statut_ancien, |
|
| 321 | + 'id_parent_ancien' => $old_parent, |
|
| 322 | + ] |
|
| 323 | + ); |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + return ''; // pas d'erreur |
|
| 330 | 330 | } |
@@ -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 | /** |
@@ -37,41 +37,41 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function action_editer_auteur_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 | - |
|
| 46 | - // si id_auteur n'est pas un nombre, c'est une creation |
|
| 47 | - if (!$id_auteur = intval($arg)) { |
|
| 48 | - if (($id_auteur = auteur_inserer()) > 0) { |
|
| 49 | - # cf. GROS HACK |
|
| 50 | - # recuperer l'eventuel logo charge avant la creation |
|
| 51 | - # ils ont un id = 0-id_auteur de la session |
|
| 52 | - $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
|
| 53 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 54 | - foreach (['on', 'off'] as $type) { |
|
| 55 | - if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) { |
|
| 56 | - if ($logo = reset($logo)) { |
|
| 57 | - rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // Enregistre l'envoi dans la BD |
|
| 65 | - $err = ''; |
|
| 66 | - if ($id_auteur > 0) { |
|
| 67 | - $err = auteur_modifier($id_auteur); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if ($err) { |
|
| 71 | - spip_log("echec editeur auteur: $err", _LOG_ERREUR); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - return [$id_auteur, $err]; |
|
| 40 | + if (is_null($arg)) { |
|
| 41 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | + $arg = $securiser_action(); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + // si id_auteur n'est pas un nombre, c'est une creation |
|
| 47 | + if (!$id_auteur = intval($arg)) { |
|
| 48 | + if (($id_auteur = auteur_inserer()) > 0) { |
|
| 49 | + # cf. GROS HACK |
|
| 50 | + # recuperer l'eventuel logo charge avant la creation |
|
| 51 | + # ils ont un id = 0-id_auteur de la session |
|
| 52 | + $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
|
| 53 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 54 | + foreach (['on', 'off'] as $type) { |
|
| 55 | + if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) { |
|
| 56 | + if ($logo = reset($logo)) { |
|
| 57 | + rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // Enregistre l'envoi dans la BD |
|
| 65 | + $err = ''; |
|
| 66 | + if ($id_auteur > 0) { |
|
| 67 | + $err = auteur_modifier($id_auteur); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if ($err) { |
|
| 71 | + spip_log("echec editeur auteur: $err", _LOG_ERREUR); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + return [$id_auteur, $err]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -88,64 +88,64 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | function auteur_inserer($source = null, $set = null) { |
| 90 | 90 | |
| 91 | - // Ce qu'on va demander comme modifications |
|
| 92 | - $champs = []; |
|
| 93 | - $champs['source'] = $source ?: 'spip'; |
|
| 94 | - |
|
| 95 | - $champs['login'] = ''; |
|
| 96 | - $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 97 | - $champs['webmestre'] = 'non'; |
|
| 98 | - if (empty($champs['imessage'])) { |
|
| 99 | - $champs['imessage'] = 'oui'; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ($set) { |
|
| 103 | - $champs = array_merge($champs, $set); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // Envoyer aux plugins |
|
| 107 | - $champs = pipeline( |
|
| 108 | - 'pre_insertion', |
|
| 109 | - [ |
|
| 110 | - 'args' => [ |
|
| 111 | - 'table' => 'spip_auteurs', |
|
| 112 | - ], |
|
| 113 | - 'data' => $champs |
|
| 114 | - ] |
|
| 115 | - ); |
|
| 116 | - $id_auteur = sql_insertq('spip_auteurs', $champs); |
|
| 117 | - pipeline( |
|
| 118 | - 'post_insertion', |
|
| 119 | - [ |
|
| 120 | - 'args' => [ |
|
| 121 | - 'table' => 'spip_auteurs', |
|
| 122 | - 'id_objet' => $id_auteur |
|
| 123 | - ], |
|
| 124 | - 'data' => $champs |
|
| 125 | - ] |
|
| 126 | - ); |
|
| 91 | + // Ce qu'on va demander comme modifications |
|
| 92 | + $champs = []; |
|
| 93 | + $champs['source'] = $source ?: 'spip'; |
|
| 94 | + |
|
| 95 | + $champs['login'] = ''; |
|
| 96 | + $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 97 | + $champs['webmestre'] = 'non'; |
|
| 98 | + if (empty($champs['imessage'])) { |
|
| 99 | + $champs['imessage'] = 'oui'; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ($set) { |
|
| 103 | + $champs = array_merge($champs, $set); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // Envoyer aux plugins |
|
| 107 | + $champs = pipeline( |
|
| 108 | + 'pre_insertion', |
|
| 109 | + [ |
|
| 110 | + 'args' => [ |
|
| 111 | + 'table' => 'spip_auteurs', |
|
| 112 | + ], |
|
| 113 | + 'data' => $champs |
|
| 114 | + ] |
|
| 115 | + ); |
|
| 116 | + $id_auteur = sql_insertq('spip_auteurs', $champs); |
|
| 117 | + pipeline( |
|
| 118 | + 'post_insertion', |
|
| 119 | + [ |
|
| 120 | + 'args' => [ |
|
| 121 | + 'table' => 'spip_auteurs', |
|
| 122 | + 'id_objet' => $id_auteur |
|
| 123 | + ], |
|
| 124 | + 'data' => $champs |
|
| 125 | + ] |
|
| 126 | + ); |
|
| 127 | 127 | |
| 128 | - // Appeler une notification |
|
| 129 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 130 | - $notifications( |
|
| 131 | - 'auteur_inserer', |
|
| 132 | - $id_auteur, |
|
| 133 | - [ |
|
| 134 | - 'champs' => $champs, |
|
| 135 | - ] |
|
| 136 | - ); |
|
| 137 | - $notifications( |
|
| 138 | - 'objet_inserer', |
|
| 139 | - $id_auteur, |
|
| 140 | - [ |
|
| 141 | - 'objet' => 'auteur', |
|
| 142 | - 'id_objet' => $id_auteur, |
|
| 143 | - 'champs' => $champs, |
|
| 144 | - ] |
|
| 145 | - ); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - return $id_auteur; |
|
| 128 | + // Appeler une notification |
|
| 129 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 130 | + $notifications( |
|
| 131 | + 'auteur_inserer', |
|
| 132 | + $id_auteur, |
|
| 133 | + [ |
|
| 134 | + 'champs' => $champs, |
|
| 135 | + ] |
|
| 136 | + ); |
|
| 137 | + $notifications( |
|
| 138 | + 'objet_inserer', |
|
| 139 | + $id_auteur, |
|
| 140 | + [ |
|
| 141 | + 'objet' => 'auteur', |
|
| 142 | + 'id_objet' => $id_auteur, |
|
| 143 | + 'champs' => $champs, |
|
| 144 | + ] |
|
| 145 | + ); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + return $id_auteur; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -170,70 +170,70 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function auteur_modifier($id_auteur, $set = null, $force_update = false) { |
| 172 | 172 | |
| 173 | - include_spip('inc/modifier'); |
|
| 174 | - include_spip('inc/filtres'); |
|
| 175 | - $c = collecter_requests( |
|
| 176 | - // include list |
|
| 177 | - objet_info('auteur', 'champs_editables'), |
|
| 178 | - // exclude list |
|
| 179 | - $force_update ? [] : ['webmestre', 'pass', 'login'], |
|
| 180 | - // donnees eventuellement fournies |
|
| 181 | - $set |
|
| 182 | - ); |
|
| 183 | - |
|
| 184 | - if ( |
|
| 185 | - $err = objet_modifier_champs( |
|
| 186 | - 'auteur', |
|
| 187 | - $id_auteur, |
|
| 188 | - [ |
|
| 189 | - 'data' => $set, |
|
| 190 | - 'nonvide' => ['nom' => _T('ecrire:item_nouvel_auteur')] |
|
| 191 | - ], |
|
| 192 | - $c |
|
| 193 | - ) |
|
| 194 | - ) { |
|
| 195 | - return $err; |
|
| 196 | - } |
|
| 197 | - $session = $c; |
|
| 198 | - |
|
| 199 | - $err = ''; |
|
| 200 | - if (!$force_update) { |
|
| 201 | - // Modification de statut, changement de rubrique ? |
|
| 202 | - $c = collecter_requests( |
|
| 203 | - // include list |
|
| 204 | - [ |
|
| 205 | - 'statut', |
|
| 206 | - 'new_login', |
|
| 207 | - 'new_pass', |
|
| 208 | - 'login', |
|
| 209 | - 'pass', |
|
| 210 | - 'webmestre', |
|
| 211 | - 'restreintes', |
|
| 212 | - 'id_parent' |
|
| 213 | - ], |
|
| 214 | - // exclude list |
|
| 215 | - [], |
|
| 216 | - // donnees eventuellement fournies |
|
| 217 | - $set |
|
| 218 | - ); |
|
| 219 | - if (isset($c['new_login']) and !isset($c['login'])) { |
|
| 220 | - $c['login'] = $c['new_login']; |
|
| 221 | - } |
|
| 222 | - if (isset($c['new_pass']) and !isset($c['pass'])) { |
|
| 223 | - $c['pass'] = $c['new_pass']; |
|
| 224 | - } |
|
| 225 | - $err = auteur_instituer($id_auteur, $c); |
|
| 226 | - $session = array_merge($session, $c); |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - // .. mettre a jour les sessions de cet auteur |
|
| 230 | - include_spip('inc/session'); |
|
| 231 | - $session['id_auteur'] = $id_auteur; |
|
| 232 | - unset($session['new_login']); |
|
| 233 | - unset($session['new_pass']); |
|
| 234 | - actualiser_sessions($session); |
|
| 235 | - |
|
| 236 | - return $err; |
|
| 173 | + include_spip('inc/modifier'); |
|
| 174 | + include_spip('inc/filtres'); |
|
| 175 | + $c = collecter_requests( |
|
| 176 | + // include list |
|
| 177 | + objet_info('auteur', 'champs_editables'), |
|
| 178 | + // exclude list |
|
| 179 | + $force_update ? [] : ['webmestre', 'pass', 'login'], |
|
| 180 | + // donnees eventuellement fournies |
|
| 181 | + $set |
|
| 182 | + ); |
|
| 183 | + |
|
| 184 | + if ( |
|
| 185 | + $err = objet_modifier_champs( |
|
| 186 | + 'auteur', |
|
| 187 | + $id_auteur, |
|
| 188 | + [ |
|
| 189 | + 'data' => $set, |
|
| 190 | + 'nonvide' => ['nom' => _T('ecrire:item_nouvel_auteur')] |
|
| 191 | + ], |
|
| 192 | + $c |
|
| 193 | + ) |
|
| 194 | + ) { |
|
| 195 | + return $err; |
|
| 196 | + } |
|
| 197 | + $session = $c; |
|
| 198 | + |
|
| 199 | + $err = ''; |
|
| 200 | + if (!$force_update) { |
|
| 201 | + // Modification de statut, changement de rubrique ? |
|
| 202 | + $c = collecter_requests( |
|
| 203 | + // include list |
|
| 204 | + [ |
|
| 205 | + 'statut', |
|
| 206 | + 'new_login', |
|
| 207 | + 'new_pass', |
|
| 208 | + 'login', |
|
| 209 | + 'pass', |
|
| 210 | + 'webmestre', |
|
| 211 | + 'restreintes', |
|
| 212 | + 'id_parent' |
|
| 213 | + ], |
|
| 214 | + // exclude list |
|
| 215 | + [], |
|
| 216 | + // donnees eventuellement fournies |
|
| 217 | + $set |
|
| 218 | + ); |
|
| 219 | + if (isset($c['new_login']) and !isset($c['login'])) { |
|
| 220 | + $c['login'] = $c['new_login']; |
|
| 221 | + } |
|
| 222 | + if (isset($c['new_pass']) and !isset($c['pass'])) { |
|
| 223 | + $c['pass'] = $c['new_pass']; |
|
| 224 | + } |
|
| 225 | + $err = auteur_instituer($id_auteur, $c); |
|
| 226 | + $session = array_merge($session, $c); |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + // .. mettre a jour les sessions de cet auteur |
|
| 230 | + include_spip('inc/session'); |
|
| 231 | + $session['id_auteur'] = $id_auteur; |
|
| 232 | + unset($session['new_login']); |
|
| 233 | + unset($session['new_pass']); |
|
| 234 | + actualiser_sessions($session); |
|
| 235 | + |
|
| 236 | + return $err; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | * @return string |
| 255 | 255 | */ |
| 256 | 256 | function auteur_associer($id_auteur, $objets, $qualif = null) { |
| 257 | - include_spip('action/editer_liens'); |
|
| 257 | + include_spip('action/editer_liens'); |
|
| 258 | 258 | |
| 259 | - return objet_associer(['auteur' => $id_auteur], $objets, $qualif); |
|
| 259 | + return objet_associer(['auteur' => $id_auteur], $objets, $qualif); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | * @return string |
| 276 | 276 | */ |
| 277 | 277 | function auteur_dissocier($id_auteur, $objets) { |
| 278 | - include_spip('action/editer_liens'); |
|
| 278 | + include_spip('action/editer_liens'); |
|
| 279 | 279 | |
| 280 | - return objet_dissocier(['auteur' => $id_auteur], $objets); |
|
| 280 | + return objet_dissocier(['auteur' => $id_auteur], $objets); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | * @return bool|int |
| 299 | 299 | */ |
| 300 | 300 | function auteur_qualifier($id_auteur, $objets, $qualif) { |
| 301 | - include_spip('action/editer_liens'); |
|
| 301 | + include_spip('action/editer_liens'); |
|
| 302 | 302 | |
| 303 | - return objet_qualifier_liens(['auteur' => $id_auteur], $objets, $qualif); |
|
| 303 | + return objet_qualifier_liens(['auteur' => $id_auteur], $objets, $qualif); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | |
@@ -319,160 +319,160 @@ discard block |
||
| 319 | 319 | * @return bool|string |
| 320 | 320 | */ |
| 321 | 321 | function auteur_instituer($id_auteur, $c, $force_webmestre = false) { |
| 322 | - if (!$id_auteur = intval($id_auteur)) { |
|
| 323 | - return false; |
|
| 324 | - } |
|
| 325 | - $erreurs = []; // contiendra les differentes erreurs a traduire par _T() |
|
| 326 | - $champs = []; |
|
| 327 | - |
|
| 328 | - // les memoriser pour les faire passer dans le pipeline pre_edition |
|
| 329 | - if (isset($c['login']) and strlen($c['login'])) { |
|
| 330 | - $champs['login'] = $c['login']; |
|
| 331 | - } |
|
| 332 | - if (isset($c['pass']) and strlen($c['pass'])) { |
|
| 333 | - $champs['pass'] = $c['pass']; |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 337 | - |
|
| 338 | - if ( |
|
| 339 | - isset($c['statut']) |
|
| 340 | - and (autoriser('modifier', 'auteur', $id_auteur, null, ['statut' => $c['statut']])) |
|
| 341 | - ) { |
|
| 342 | - $statut = $champs['statut'] = $c['statut']; |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - // Restreindre avant de declarer l'auteur |
|
| 346 | - // (section critique sur les droits) |
|
| 347 | - if (isset($c['id_parent']) and $c['id_parent']) { |
|
| 348 | - if (is_array($c['restreintes'])) { |
|
| 349 | - $c['restreintes'][] = $c['id_parent']; |
|
| 350 | - } else { |
|
| 351 | - $c['restreintes'] = [$c['id_parent']]; |
|
| 352 | - } |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - if ( |
|
| 356 | - isset($c['webmestre']) |
|
| 357 | - and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, ['webmestre' => '?'])) |
|
| 358 | - ) { |
|
| 359 | - $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non'; |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - // si statut change et n'est pas 0minirezo, on force webmestre a non |
|
| 363 | - if (isset($c['statut']) and $c['statut'] !== '0minirezo') { |
|
| 364 | - $champs['webmestre'] = $c['webmestre'] = 'non'; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - // Envoyer aux plugins |
|
| 368 | - $champs = pipeline( |
|
| 369 | - 'pre_edition', |
|
| 370 | - [ |
|
| 371 | - 'args' => [ |
|
| 372 | - 'table' => 'spip_auteurs', |
|
| 373 | - 'id_objet' => $id_auteur, |
|
| 374 | - 'action' => 'instituer', |
|
| 375 | - 'statut_ancien' => $statut_ancien, |
|
| 376 | - ], |
|
| 377 | - 'data' => $champs |
|
| 378 | - ] |
|
| 379 | - ); |
|
| 380 | - |
|
| 381 | - if ( |
|
| 382 | - isset($c['restreintes']) and is_array($c['restreintes']) |
|
| 383 | - and autoriser('modifier', 'auteur', $id_auteur, null, ['restreint' => $c['restreintes']]) |
|
| 384 | - ) { |
|
| 385 | - $rubriques = array_map('intval', $c['restreintes']); |
|
| 386 | - $rubriques = array_unique($rubriques); |
|
| 387 | - $rubriques = array_diff($rubriques, [0]); |
|
| 388 | - auteur_dissocier($id_auteur, ['rubrique' => '*']); |
|
| 389 | - auteur_associer($id_auteur, ['rubrique' => $rubriques]); |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - $flag_ecrire_acces = false; |
|
| 393 | - // commencer par traiter les cas particuliers des logins et pass |
|
| 394 | - // avant les autres ecritures en base |
|
| 395 | - if (isset($champs['login']) or isset($champs['pass'])) { |
|
| 396 | - $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 397 | - include_spip('inc/auth'); |
|
| 398 | - if (isset($champs['login']) and strlen($champs['login'])) { |
|
| 399 | - if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
|
| 400 | - $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
|
| 401 | - } |
|
| 402 | - } |
|
| 403 | - if (isset($champs['pass']) and strlen($champs['pass'])) { |
|
| 404 | - $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 405 | - if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 406 | - $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 407 | - } |
|
| 408 | - } |
|
| 409 | - unset($champs['login']); |
|
| 410 | - unset($champs['pass']); |
|
| 411 | - $flag_ecrire_acces = true; |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 415 | - return implode(' ', array_map('_T', $erreurs)); |
|
| 416 | - } |
|
| 417 | - sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 418 | - |
|
| 419 | - // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
|
| 420 | - if ( |
|
| 421 | - $flag_ecrire_acces |
|
| 422 | - or isset($champs['statut']) |
|
| 423 | - ) { |
|
| 424 | - include_spip('inc/acces'); |
|
| 425 | - ecrire_acces(); |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - // Invalider les caches |
|
| 429 | - include_spip('inc/invalideur'); |
|
| 430 | - suivre_invalideur("id='auteur/$id_auteur'"); |
|
| 431 | - |
|
| 432 | - // Pipeline |
|
| 433 | - pipeline( |
|
| 434 | - 'post_edition', |
|
| 435 | - [ |
|
| 436 | - 'args' => [ |
|
| 437 | - 'table' => 'spip_auteurs', |
|
| 438 | - 'id_objet' => $id_auteur, |
|
| 439 | - 'action' => 'instituer', |
|
| 440 | - 'statut_ancien' => $statut_ancien, |
|
| 441 | - ], |
|
| 442 | - 'data' => $champs |
|
| 443 | - ] |
|
| 444 | - ); |
|
| 445 | - |
|
| 446 | - // Notifications |
|
| 447 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 448 | - $notifications( |
|
| 449 | - 'auteur_instituer', |
|
| 450 | - $id_auteur, |
|
| 451 | - [ |
|
| 452 | - 'statut' => $statut, |
|
| 453 | - 'statut_ancien' => $statut_ancien, |
|
| 454 | - 'champs' => $champs, |
|
| 455 | - ] |
|
| 456 | - ); |
|
| 457 | - $notifications( |
|
| 458 | - 'objet_instituer', |
|
| 459 | - $id_auteur, |
|
| 460 | - [ |
|
| 461 | - 'objet' => 'auteur', |
|
| 462 | - 'id_objet' => $id_auteur, |
|
| 463 | - 'statut' => $statut, |
|
| 464 | - 'statut_ancien' => $statut_ancien, |
|
| 465 | - 'champs' => $champs, |
|
| 466 | - ] |
|
| 467 | - ); |
|
| 322 | + if (!$id_auteur = intval($id_auteur)) { |
|
| 323 | + return false; |
|
| 324 | + } |
|
| 325 | + $erreurs = []; // contiendra les differentes erreurs a traduire par _T() |
|
| 326 | + $champs = []; |
|
| 327 | + |
|
| 328 | + // les memoriser pour les faire passer dans le pipeline pre_edition |
|
| 329 | + if (isset($c['login']) and strlen($c['login'])) { |
|
| 330 | + $champs['login'] = $c['login']; |
|
| 331 | + } |
|
| 332 | + if (isset($c['pass']) and strlen($c['pass'])) { |
|
| 333 | + $champs['pass'] = $c['pass']; |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 337 | + |
|
| 338 | + if ( |
|
| 339 | + isset($c['statut']) |
|
| 340 | + and (autoriser('modifier', 'auteur', $id_auteur, null, ['statut' => $c['statut']])) |
|
| 341 | + ) { |
|
| 342 | + $statut = $champs['statut'] = $c['statut']; |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + // Restreindre avant de declarer l'auteur |
|
| 346 | + // (section critique sur les droits) |
|
| 347 | + if (isset($c['id_parent']) and $c['id_parent']) { |
|
| 348 | + if (is_array($c['restreintes'])) { |
|
| 349 | + $c['restreintes'][] = $c['id_parent']; |
|
| 350 | + } else { |
|
| 351 | + $c['restreintes'] = [$c['id_parent']]; |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + if ( |
|
| 356 | + isset($c['webmestre']) |
|
| 357 | + and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, ['webmestre' => '?'])) |
|
| 358 | + ) { |
|
| 359 | + $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non'; |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + // si statut change et n'est pas 0minirezo, on force webmestre a non |
|
| 363 | + if (isset($c['statut']) and $c['statut'] !== '0minirezo') { |
|
| 364 | + $champs['webmestre'] = $c['webmestre'] = 'non'; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + // Envoyer aux plugins |
|
| 368 | + $champs = pipeline( |
|
| 369 | + 'pre_edition', |
|
| 370 | + [ |
|
| 371 | + 'args' => [ |
|
| 372 | + 'table' => 'spip_auteurs', |
|
| 373 | + 'id_objet' => $id_auteur, |
|
| 374 | + 'action' => 'instituer', |
|
| 375 | + 'statut_ancien' => $statut_ancien, |
|
| 376 | + ], |
|
| 377 | + 'data' => $champs |
|
| 378 | + ] |
|
| 379 | + ); |
|
| 380 | + |
|
| 381 | + if ( |
|
| 382 | + isset($c['restreintes']) and is_array($c['restreintes']) |
|
| 383 | + and autoriser('modifier', 'auteur', $id_auteur, null, ['restreint' => $c['restreintes']]) |
|
| 384 | + ) { |
|
| 385 | + $rubriques = array_map('intval', $c['restreintes']); |
|
| 386 | + $rubriques = array_unique($rubriques); |
|
| 387 | + $rubriques = array_diff($rubriques, [0]); |
|
| 388 | + auteur_dissocier($id_auteur, ['rubrique' => '*']); |
|
| 389 | + auteur_associer($id_auteur, ['rubrique' => $rubriques]); |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + $flag_ecrire_acces = false; |
|
| 393 | + // commencer par traiter les cas particuliers des logins et pass |
|
| 394 | + // avant les autres ecritures en base |
|
| 395 | + if (isset($champs['login']) or isset($champs['pass'])) { |
|
| 396 | + $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 397 | + include_spip('inc/auth'); |
|
| 398 | + if (isset($champs['login']) and strlen($champs['login'])) { |
|
| 399 | + if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
|
| 400 | + $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
|
| 401 | + } |
|
| 402 | + } |
|
| 403 | + if (isset($champs['pass']) and strlen($champs['pass'])) { |
|
| 404 | + $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 405 | + if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 406 | + $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | + unset($champs['login']); |
|
| 410 | + unset($champs['pass']); |
|
| 411 | + $flag_ecrire_acces = true; |
|
| 412 | + } |
|
| 413 | + |
|
| 414 | + if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 415 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 416 | + } |
|
| 417 | + sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 418 | + |
|
| 419 | + // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
|
| 420 | + if ( |
|
| 421 | + $flag_ecrire_acces |
|
| 422 | + or isset($champs['statut']) |
|
| 423 | + ) { |
|
| 424 | + include_spip('inc/acces'); |
|
| 425 | + ecrire_acces(); |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + // Invalider les caches |
|
| 429 | + include_spip('inc/invalideur'); |
|
| 430 | + suivre_invalideur("id='auteur/$id_auteur'"); |
|
| 431 | + |
|
| 432 | + // Pipeline |
|
| 433 | + pipeline( |
|
| 434 | + 'post_edition', |
|
| 435 | + [ |
|
| 436 | + 'args' => [ |
|
| 437 | + 'table' => 'spip_auteurs', |
|
| 438 | + 'id_objet' => $id_auteur, |
|
| 439 | + 'action' => 'instituer', |
|
| 440 | + 'statut_ancien' => $statut_ancien, |
|
| 441 | + ], |
|
| 442 | + 'data' => $champs |
|
| 443 | + ] |
|
| 444 | + ); |
|
| 445 | + |
|
| 446 | + // Notifications |
|
| 447 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 448 | + $notifications( |
|
| 449 | + 'auteur_instituer', |
|
| 450 | + $id_auteur, |
|
| 451 | + [ |
|
| 452 | + 'statut' => $statut, |
|
| 453 | + 'statut_ancien' => $statut_ancien, |
|
| 454 | + 'champs' => $champs, |
|
| 455 | + ] |
|
| 456 | + ); |
|
| 457 | + $notifications( |
|
| 458 | + 'objet_instituer', |
|
| 459 | + $id_auteur, |
|
| 460 | + [ |
|
| 461 | + 'objet' => 'auteur', |
|
| 462 | + 'id_objet' => $id_auteur, |
|
| 463 | + 'statut' => $statut, |
|
| 464 | + 'statut_ancien' => $statut_ancien, |
|
| 465 | + 'champs' => $champs, |
|
| 466 | + ] |
|
| 467 | + ); |
|
| 468 | 468 | |
| 469 | - // Rétro-compat |
|
| 470 | - $notifications( |
|
| 471 | - 'instituerauteur', |
|
| 472 | - $id_auteur, |
|
| 473 | - ['statut' => $statut, 'statut_ancien' => $statut_ancien] |
|
| 474 | - ); |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - return implode(' ', array_map('_T', $erreurs)); |
|
| 469 | + // Rétro-compat |
|
| 470 | + $notifications( |
|
| 471 | + 'instituerauteur', |
|
| 472 | + $id_auteur, |
|
| 473 | + ['statut' => $statut, 'statut_ancien' => $statut_ancien] |
|
| 474 | + ); |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 478 | 478 | } |
@@ -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 | /** |
@@ -33,36 +33,36 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function action_editer_objet_dist($id = null, $objet = null, $set = null) { |
| 35 | 35 | |
| 36 | - // appel direct depuis une url avec arg = "objet/id" |
|
| 37 | - if (is_null($id) or is_null($objet)) { |
|
| 38 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | - $arg = $securiser_action(); |
|
| 40 | - [$objet, $id] = array_pad(explode('/', $arg, 2), 2, null); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - // appel incorrect ou depuis une url erronnée interdit |
|
| 44 | - if (is_null($id) or is_null($objet)) { |
|
| 45 | - include_spip('inc/minipres'); |
|
| 46 | - echo minipres(_T('info_acces_interdit')); |
|
| 47 | - die(); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - // si id n'est pas un nombre, c'est une creation |
|
| 51 | - // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 52 | - if (!$id = intval($id)) { |
|
| 53 | - // on ne sait pas si un parent existe mais on essaye |
|
| 54 | - $id_parent = _request('id_parent'); |
|
| 55 | - $id = objet_inserer($objet, $id_parent); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (!($id = intval($id)) > 0) { |
|
| 59 | - return [$id, _L('echec enregistrement en base')]; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // Enregistre l'envoi dans la BD |
|
| 63 | - $err = objet_modifier($objet, $id, $set); |
|
| 64 | - |
|
| 65 | - return [$id, $err]; |
|
| 36 | + // appel direct depuis une url avec arg = "objet/id" |
|
| 37 | + if (is_null($id) or is_null($objet)) { |
|
| 38 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | + $arg = $securiser_action(); |
|
| 40 | + [$objet, $id] = array_pad(explode('/', $arg, 2), 2, null); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + // appel incorrect ou depuis une url erronnée interdit |
|
| 44 | + if (is_null($id) or is_null($objet)) { |
|
| 45 | + include_spip('inc/minipres'); |
|
| 46 | + echo minipres(_T('info_acces_interdit')); |
|
| 47 | + die(); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + // si id n'est pas un nombre, c'est une creation |
|
| 51 | + // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 52 | + if (!$id = intval($id)) { |
|
| 53 | + // on ne sait pas si un parent existe mais on essaye |
|
| 54 | + $id_parent = _request('id_parent'); |
|
| 55 | + $id = objet_inserer($objet, $id_parent); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (!($id = intval($id)) > 0) { |
|
| 59 | + return [$id, _L('echec enregistrement en base')]; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // Enregistre l'envoi dans la BD |
|
| 63 | + $err = objet_modifier($objet, $id, $set); |
|
| 64 | + |
|
| 65 | + return [$id, $err]; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -75,85 +75,85 @@ discard block |
||
| 75 | 75 | * @return mixed|string |
| 76 | 76 | */ |
| 77 | 77 | function objet_modifier($objet, $id, $set = null) { |
| 78 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 79 | - spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 80 | - $objet = $t; |
|
| 81 | - } |
|
| 82 | - if ( |
|
| 83 | - include_spip('action/editer_' . $objet) |
|
| 84 | - and function_exists($modifier = $objet . '_modifier') |
|
| 85 | - ) { |
|
| 86 | - return $modifier($id, $set); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $table_sql = table_objet_sql($objet); |
|
| 90 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 91 | - $desc = $trouver_table($table_sql); |
|
| 92 | - if (!$desc or !isset($desc['field'])) { |
|
| 93 | - spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR); |
|
| 94 | - |
|
| 95 | - return _L("Erreur objet $objet inconnu"); |
|
| 96 | - } |
|
| 97 | - include_spip('inc/modifier'); |
|
| 98 | - |
|
| 99 | - $champ_date = ''; |
|
| 100 | - if (isset($desc['date']) and $desc['date']) { |
|
| 101 | - $champ_date = $desc['date']; |
|
| 102 | - } elseif (isset($desc['field']['date'])) { |
|
| 103 | - $champ_date = 'date'; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $include_list = array_keys($desc['field']); |
|
| 107 | - // on ne traite pas la cle primaire par defaut, notamment car |
|
| 108 | - // sur une creation, id_x vaut 'oui', et serait enregistre en id_x=0 dans la base |
|
| 109 | - $include_list = array_diff($include_list, [$desc['key']['PRIMARY KEY']]); |
|
| 110 | - |
|
| 111 | - if (isset($desc['champs_editables']) and is_array($desc['champs_editables'])) { |
|
| 112 | - $include_list = $desc['champs_editables']; |
|
| 113 | - } |
|
| 114 | - $c = collecter_requests( |
|
| 115 | - // include list |
|
| 116 | - $include_list, |
|
| 117 | - // exclude list |
|
| 118 | - [$champ_date, 'statut', 'id_parent', 'id_secteur'], |
|
| 119 | - // donnees eventuellement fournies |
|
| 120 | - $set |
|
| 121 | - ); |
|
| 122 | - |
|
| 123 | - // Si l'objet est publie, invalider les caches et demander sa reindexation |
|
| 124 | - if (objet_test_si_publie($objet, $id)) { |
|
| 125 | - $invalideur = "id='$objet/$id'"; |
|
| 126 | - $indexation = true; |
|
| 127 | - } else { |
|
| 128 | - $invalideur = ''; |
|
| 129 | - $indexation = false; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - if ( |
|
| 133 | - $err = objet_modifier_champs( |
|
| 134 | - $objet, |
|
| 135 | - $id, |
|
| 136 | - [ |
|
| 137 | - 'data' => $set, |
|
| 138 | - 'nonvide' => '', |
|
| 139 | - 'invalideur' => $invalideur, |
|
| 140 | - 'indexation' => $indexation, |
|
| 141 | - // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 142 | - 'date_modif' => (isset($desc['field']['date_modif']) ? 'date_modif' : '') |
|
| 143 | - ], |
|
| 144 | - $c |
|
| 145 | - ) |
|
| 146 | - ) { |
|
| 147 | - return $err; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - // Modification de statut, changement de rubrique ? |
|
| 151 | - // FIXME: Ici lorsqu'un $set est passé, la fonction collecter_requests() retourne tout |
|
| 152 | - // le tableau $set hors liste d’exclusion, mais du coup on a possiblement des champs en trop. |
|
| 153 | - $c = collecter_requests([$champ_date, 'statut', 'id_parent'], [], $set); |
|
| 154 | - $err = objet_instituer($objet, $id, $c); |
|
| 155 | - |
|
| 156 | - return $err; |
|
| 78 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 79 | + spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 80 | + $objet = $t; |
|
| 81 | + } |
|
| 82 | + if ( |
|
| 83 | + include_spip('action/editer_' . $objet) |
|
| 84 | + and function_exists($modifier = $objet . '_modifier') |
|
| 85 | + ) { |
|
| 86 | + return $modifier($id, $set); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $table_sql = table_objet_sql($objet); |
|
| 90 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 91 | + $desc = $trouver_table($table_sql); |
|
| 92 | + if (!$desc or !isset($desc['field'])) { |
|
| 93 | + spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR); |
|
| 94 | + |
|
| 95 | + return _L("Erreur objet $objet inconnu"); |
|
| 96 | + } |
|
| 97 | + include_spip('inc/modifier'); |
|
| 98 | + |
|
| 99 | + $champ_date = ''; |
|
| 100 | + if (isset($desc['date']) and $desc['date']) { |
|
| 101 | + $champ_date = $desc['date']; |
|
| 102 | + } elseif (isset($desc['field']['date'])) { |
|
| 103 | + $champ_date = 'date'; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $include_list = array_keys($desc['field']); |
|
| 107 | + // on ne traite pas la cle primaire par defaut, notamment car |
|
| 108 | + // sur une creation, id_x vaut 'oui', et serait enregistre en id_x=0 dans la base |
|
| 109 | + $include_list = array_diff($include_list, [$desc['key']['PRIMARY KEY']]); |
|
| 110 | + |
|
| 111 | + if (isset($desc['champs_editables']) and is_array($desc['champs_editables'])) { |
|
| 112 | + $include_list = $desc['champs_editables']; |
|
| 113 | + } |
|
| 114 | + $c = collecter_requests( |
|
| 115 | + // include list |
|
| 116 | + $include_list, |
|
| 117 | + // exclude list |
|
| 118 | + [$champ_date, 'statut', 'id_parent', 'id_secteur'], |
|
| 119 | + // donnees eventuellement fournies |
|
| 120 | + $set |
|
| 121 | + ); |
|
| 122 | + |
|
| 123 | + // Si l'objet est publie, invalider les caches et demander sa reindexation |
|
| 124 | + if (objet_test_si_publie($objet, $id)) { |
|
| 125 | + $invalideur = "id='$objet/$id'"; |
|
| 126 | + $indexation = true; |
|
| 127 | + } else { |
|
| 128 | + $invalideur = ''; |
|
| 129 | + $indexation = false; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + if ( |
|
| 133 | + $err = objet_modifier_champs( |
|
| 134 | + $objet, |
|
| 135 | + $id, |
|
| 136 | + [ |
|
| 137 | + 'data' => $set, |
|
| 138 | + 'nonvide' => '', |
|
| 139 | + 'invalideur' => $invalideur, |
|
| 140 | + 'indexation' => $indexation, |
|
| 141 | + // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 142 | + 'date_modif' => (isset($desc['field']['date_modif']) ? 'date_modif' : '') |
|
| 143 | + ], |
|
| 144 | + $c |
|
| 145 | + ) |
|
| 146 | + ) { |
|
| 147 | + return $err; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + // Modification de statut, changement de rubrique ? |
|
| 151 | + // FIXME: Ici lorsqu'un $set est passé, la fonction collecter_requests() retourne tout |
|
| 152 | + // le tableau $set hors liste d’exclusion, mais du coup on a possiblement des champs en trop. |
|
| 153 | + $c = collecter_requests([$champ_date, 'statut', 'id_parent'], [], $set); |
|
| 154 | + $err = objet_instituer($objet, $id, $c); |
|
| 155 | + |
|
| 156 | + return $err; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -168,157 +168,157 @@ discard block |
||
| 168 | 168 | * @return bool|int |
| 169 | 169 | */ |
| 170 | 170 | function objet_inserer($objet, $id_parent = null, $set = null) { |
| 171 | - $d = null; |
|
| 172 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 173 | - spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 174 | - $objet = $t; |
|
| 175 | - } |
|
| 176 | - if ( |
|
| 177 | - include_spip('action/editer_' . $objet) |
|
| 178 | - and function_exists($inserer = $objet . '_inserer') |
|
| 179 | - ) { |
|
| 180 | - return $inserer($id_parent, $set); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $table_sql = table_objet_sql($objet); |
|
| 184 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 185 | - $desc = $trouver_table($table_sql); |
|
| 186 | - if (!$desc or !isset($desc['field'])) { |
|
| 187 | - return 0; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - $lang_rub = ''; |
|
| 191 | - $champs = []; |
|
| 192 | - if (isset($desc['field']['id_rubrique'])) { |
|
| 193 | - // Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet |
|
| 194 | - // dans la premiere rubrique racine |
|
| 195 | - if (!$id_rubrique = intval($id_parent)) { |
|
| 196 | - $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 197 | - $id_rubrique = $row['id_rubrique']; |
|
| 198 | - } else { |
|
| 199 | - $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - $champs['id_rubrique'] = $id_rubrique; |
|
| 203 | - if (isset($desc['field']['id_secteur'])) { |
|
| 204 | - $champs['id_secteur'] = $row['id_secteur']; |
|
| 205 | - } |
|
| 206 | - $lang_rub = $row['lang']; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - // La langue a la creation : si les liens de traduction sont autorises |
|
| 210 | - // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 211 | - // ou a defaut celle de la rubrique |
|
| 212 | - // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 213 | - if ( |
|
| 214 | - isset($desc['field']['lang']) and !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 215 | - $table_sql, |
|
| 216 | - explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 217 | - ) |
|
| 218 | - ) { |
|
| 219 | - lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 220 | - if ( |
|
| 221 | - in_array( |
|
| 222 | - $GLOBALS['spip_lang'], |
|
| 223 | - explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 224 | - ) |
|
| 225 | - ) { |
|
| 226 | - $champs['lang'] = $GLOBALS['spip_lang']; |
|
| 227 | - if (isset($desc['field']['langue_choisie'])) { |
|
| 228 | - $champs['langue_choisie'] = 'oui'; |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - } elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 232 | - $champs['lang'] = ($lang_rub ?: $GLOBALS['meta']['langue_site']); |
|
| 233 | - $champs['langue_choisie'] = 'non'; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - if (isset($desc['field']['statut'])) { |
|
| 237 | - if (isset($desc['statut_textes_instituer'])) { |
|
| 238 | - $cles_statut = array_keys($desc['statut_textes_instituer']); |
|
| 239 | - $champs['statut'] = reset($cles_statut); |
|
| 240 | - } else { |
|
| 241 | - $champs['statut'] = 'prepa'; |
|
| 242 | - } |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - |
|
| 246 | - if ((isset($desc['date']) and $d = $desc['date']) or isset($desc['field'][$d = 'date'])) { |
|
| 247 | - $champs[$d] = date('Y-m-d H:i:s'); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - if ($set) { |
|
| 251 | - $champs = array_merge($champs, $set); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - // Envoyer aux plugins |
|
| 255 | - $champs = pipeline( |
|
| 256 | - 'pre_insertion', |
|
| 257 | - [ |
|
| 258 | - 'args' => [ |
|
| 259 | - 'table' => $table_sql, |
|
| 260 | - 'id_parent' => $id_parent, |
|
| 261 | - ], |
|
| 262 | - 'data' => $champs |
|
| 263 | - ] |
|
| 264 | - ); |
|
| 265 | - |
|
| 266 | - $id = sql_insertq($table_sql, $champs); |
|
| 267 | - |
|
| 268 | - if ($id) { |
|
| 269 | - // controler si le serveur n'a pas renvoye une erreur |
|
| 270 | - // et associer l'auteur sinon |
|
| 271 | - // si la table n'a pas deja un champ id_auteur |
|
| 272 | - // et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association) |
|
| 273 | - if ( |
|
| 274 | - $id > 0 |
|
| 275 | - and !isset($desc['field']['id_auteur']) |
|
| 276 | - ) { |
|
| 277 | - $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 278 | - $GLOBALS['visiteur_session']['id_auteur'] |
|
| 279 | - : _request('id_auteur')); |
|
| 280 | - if ($id_auteur) { |
|
| 281 | - include_spip('action/editer_auteur'); |
|
| 282 | - auteur_associer($id_auteur, [$objet => $id]); |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - pipeline( |
|
| 287 | - 'post_insertion', |
|
| 288 | - [ |
|
| 289 | - 'args' => [ |
|
| 290 | - 'table' => $table_sql, |
|
| 291 | - 'id_parent' => $id_parent, |
|
| 292 | - 'id_objet' => $id, |
|
| 293 | - ], |
|
| 294 | - 'data' => $champs |
|
| 295 | - ] |
|
| 296 | - ); |
|
| 297 | - } |
|
| 171 | + $d = null; |
|
| 172 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 173 | + spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 174 | + $objet = $t; |
|
| 175 | + } |
|
| 176 | + if ( |
|
| 177 | + include_spip('action/editer_' . $objet) |
|
| 178 | + and function_exists($inserer = $objet . '_inserer') |
|
| 179 | + ) { |
|
| 180 | + return $inserer($id_parent, $set); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $table_sql = table_objet_sql($objet); |
|
| 184 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 185 | + $desc = $trouver_table($table_sql); |
|
| 186 | + if (!$desc or !isset($desc['field'])) { |
|
| 187 | + return 0; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + $lang_rub = ''; |
|
| 191 | + $champs = []; |
|
| 192 | + if (isset($desc['field']['id_rubrique'])) { |
|
| 193 | + // Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet |
|
| 194 | + // dans la premiere rubrique racine |
|
| 195 | + if (!$id_rubrique = intval($id_parent)) { |
|
| 196 | + $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 197 | + $id_rubrique = $row['id_rubrique']; |
|
| 198 | + } else { |
|
| 199 | + $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + $champs['id_rubrique'] = $id_rubrique; |
|
| 203 | + if (isset($desc['field']['id_secteur'])) { |
|
| 204 | + $champs['id_secteur'] = $row['id_secteur']; |
|
| 205 | + } |
|
| 206 | + $lang_rub = $row['lang']; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + // La langue a la creation : si les liens de traduction sont autorises |
|
| 210 | + // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 211 | + // ou a defaut celle de la rubrique |
|
| 212 | + // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 213 | + if ( |
|
| 214 | + isset($desc['field']['lang']) and !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 215 | + $table_sql, |
|
| 216 | + explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 217 | + ) |
|
| 218 | + ) { |
|
| 219 | + lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 220 | + if ( |
|
| 221 | + in_array( |
|
| 222 | + $GLOBALS['spip_lang'], |
|
| 223 | + explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 224 | + ) |
|
| 225 | + ) { |
|
| 226 | + $champs['lang'] = $GLOBALS['spip_lang']; |
|
| 227 | + if (isset($desc['field']['langue_choisie'])) { |
|
| 228 | + $champs['langue_choisie'] = 'oui'; |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + } elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 232 | + $champs['lang'] = ($lang_rub ?: $GLOBALS['meta']['langue_site']); |
|
| 233 | + $champs['langue_choisie'] = 'non'; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + if (isset($desc['field']['statut'])) { |
|
| 237 | + if (isset($desc['statut_textes_instituer'])) { |
|
| 238 | + $cles_statut = array_keys($desc['statut_textes_instituer']); |
|
| 239 | + $champs['statut'] = reset($cles_statut); |
|
| 240 | + } else { |
|
| 241 | + $champs['statut'] = 'prepa'; |
|
| 242 | + } |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + |
|
| 246 | + if ((isset($desc['date']) and $d = $desc['date']) or isset($desc['field'][$d = 'date'])) { |
|
| 247 | + $champs[$d] = date('Y-m-d H:i:s'); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + if ($set) { |
|
| 251 | + $champs = array_merge($champs, $set); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + // Envoyer aux plugins |
|
| 255 | + $champs = pipeline( |
|
| 256 | + 'pre_insertion', |
|
| 257 | + [ |
|
| 258 | + 'args' => [ |
|
| 259 | + 'table' => $table_sql, |
|
| 260 | + 'id_parent' => $id_parent, |
|
| 261 | + ], |
|
| 262 | + 'data' => $champs |
|
| 263 | + ] |
|
| 264 | + ); |
|
| 265 | + |
|
| 266 | + $id = sql_insertq($table_sql, $champs); |
|
| 267 | + |
|
| 268 | + if ($id) { |
|
| 269 | + // controler si le serveur n'a pas renvoye une erreur |
|
| 270 | + // et associer l'auteur sinon |
|
| 271 | + // si la table n'a pas deja un champ id_auteur |
|
| 272 | + // et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association) |
|
| 273 | + if ( |
|
| 274 | + $id > 0 |
|
| 275 | + and !isset($desc['field']['id_auteur']) |
|
| 276 | + ) { |
|
| 277 | + $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 278 | + $GLOBALS['visiteur_session']['id_auteur'] |
|
| 279 | + : _request('id_auteur')); |
|
| 280 | + if ($id_auteur) { |
|
| 281 | + include_spip('action/editer_auteur'); |
|
| 282 | + auteur_associer($id_auteur, [$objet => $id]); |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + pipeline( |
|
| 287 | + 'post_insertion', |
|
| 288 | + [ |
|
| 289 | + 'args' => [ |
|
| 290 | + 'table' => $table_sql, |
|
| 291 | + 'id_parent' => $id_parent, |
|
| 292 | + 'id_objet' => $id, |
|
| 293 | + ], |
|
| 294 | + 'data' => $champs |
|
| 295 | + ] |
|
| 296 | + ); |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - // Appeler une notification |
|
| 300 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 301 | - $notifications( |
|
| 302 | - "{$objet}_inserer", |
|
| 303 | - $id, |
|
| 304 | - [ |
|
| 305 | - 'id_parent' => $id_parent, |
|
| 306 | - 'champs' => $champs, |
|
| 307 | - ] |
|
| 308 | - ); |
|
| 309 | - $notifications( |
|
| 310 | - 'objet_inserer', |
|
| 311 | - $id, |
|
| 312 | - [ |
|
| 313 | - 'objet' => $objet, |
|
| 314 | - 'id_objet' => $id, |
|
| 315 | - 'id_parent' => $id_parent, |
|
| 316 | - 'champs' => $champs, |
|
| 317 | - ] |
|
| 318 | - ); |
|
| 319 | - } |
|
| 320 | - |
|
| 321 | - return $id; |
|
| 299 | + // Appeler une notification |
|
| 300 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 301 | + $notifications( |
|
| 302 | + "{$objet}_inserer", |
|
| 303 | + $id, |
|
| 304 | + [ |
|
| 305 | + 'id_parent' => $id_parent, |
|
| 306 | + 'champs' => $champs, |
|
| 307 | + ] |
|
| 308 | + ); |
|
| 309 | + $notifications( |
|
| 310 | + 'objet_inserer', |
|
| 311 | + $id, |
|
| 312 | + [ |
|
| 313 | + 'objet' => $objet, |
|
| 314 | + 'id_objet' => $id, |
|
| 315 | + 'id_parent' => $id_parent, |
|
| 316 | + 'champs' => $champs, |
|
| 317 | + ] |
|
| 318 | + ); |
|
| 319 | + } |
|
| 320 | + |
|
| 321 | + return $id; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
@@ -335,138 +335,138 @@ discard block |
||
| 335 | 335 | * @return string |
| 336 | 336 | */ |
| 337 | 337 | function objet_instituer($objet, $id, $c, $calcul_rub = true) { |
| 338 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 339 | - spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 340 | - $objet = $t; |
|
| 341 | - } |
|
| 342 | - if ( |
|
| 343 | - include_spip('action/editer_' . $objet) |
|
| 344 | - and function_exists($instituer = $objet . '_instituer') |
|
| 345 | - ) { |
|
| 346 | - return $instituer($id, $c, $calcul_rub); |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - $table_sql = table_objet_sql($objet); |
|
| 350 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 351 | - $desc = $trouver_table($table_sql); |
|
| 352 | - if (!$desc or !isset($desc['field'])) { |
|
| 353 | - return _L("Impossible d'instituer $objet : non connu en base"); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - include_spip('inc/autoriser'); |
|
| 357 | - include_spip('inc/rubriques'); |
|
| 358 | - include_spip('inc/modifier'); |
|
| 359 | - |
|
| 360 | - $sel = []; |
|
| 361 | - $sel[] = (isset($desc['field']['statut']) ? 'statut' : "'' as statut"); |
|
| 362 | - |
|
| 363 | - $champ_date = ''; |
|
| 364 | - if (isset($desc['date']) and $desc['date']) { |
|
| 365 | - $champ_date = $desc['date']; |
|
| 366 | - } elseif (isset($desc['field']['date'])) { |
|
| 367 | - $champ_date = 'date'; |
|
| 368 | - } |
|
| 369 | - |
|
| 370 | - $sel[] = ($champ_date ? "$champ_date as date" : "'' as date"); |
|
| 371 | - $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique'); |
|
| 372 | - |
|
| 373 | - $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id)); |
|
| 374 | - |
|
| 375 | - $id_rubrique = $row['id_rubrique']; |
|
| 376 | - $statut_ancien = $statut = $row['statut']; |
|
| 377 | - $date_ancienne = $date = $row['date']; |
|
| 378 | - $champs = []; |
|
| 379 | - |
|
| 380 | - $d = ($date and isset($c[$champ_date])) ? $c[$champ_date] : null; |
|
| 381 | - $s = (isset($desc['field']['statut']) and isset($c['statut'])) ? $c['statut'] : $statut; |
|
| 382 | - |
|
| 383 | - // cf autorisations dans inc/instituer_objet |
|
| 384 | - if ($s != $statut or ($d and $d != $date)) { |
|
| 385 | - if ( |
|
| 386 | - $id_rubrique ? |
|
| 387 | - autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 388 | - : |
|
| 389 | - autoriser('instituer', $objet, $id, null, ['statut' => $s]) |
|
| 390 | - ) { |
|
| 391 | - $statut = $champs['statut'] = $s; |
|
| 392 | - } else { |
|
| 393 | - if ($s != 'publie' and autoriser('modifier', $objet, $id)) { |
|
| 394 | - $statut = $champs['statut'] = $s; |
|
| 395 | - } else { |
|
| 396 | - spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 397 | - } |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - // En cas de publication, fixer la date a "maintenant" |
|
| 401 | - // sauf si $c commande autre chose |
|
| 402 | - // ou si l'objet est deja date dans le futur |
|
| 403 | - // En cas de proposition d'un objet (mais pas depublication), idem |
|
| 404 | - if ($champ_date) { |
|
| 405 | - if ( |
|
| 406 | - $champs['statut'] == 'publie' |
|
| 407 | - or ($champs['statut'] == 'prop' and !in_array($statut_ancien, ['publie', 'prop'])) |
|
| 408 | - or $d |
|
| 409 | - ) { |
|
| 410 | - if ($d or strtotime($d = $date) > time()) { |
|
| 411 | - $champs[$champ_date] = $date = $d; |
|
| 412 | - } else { |
|
| 413 | - $champs[$champ_date] = $date = date('Y-m-d H:i:s'); |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - // Verifier que la rubrique demandee existe et est differente |
|
| 420 | - // de la rubrique actuelle |
|
| 421 | - if ( |
|
| 422 | - $id_rubrique |
|
| 423 | - and isset($c['id_parent']) |
|
| 424 | - and $id_parent = $c['id_parent'] |
|
| 425 | - and $id_parent != $id_rubrique |
|
| 426 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 427 | - ) { |
|
| 428 | - $champs['id_rubrique'] = $id_parent; |
|
| 429 | - |
|
| 430 | - // si l'objet etait publie |
|
| 431 | - // et que le demandeur n'est pas admin de la rubrique |
|
| 432 | - // repasser l'objet en statut 'propose'. |
|
| 433 | - if ( |
|
| 434 | - $statut == 'publie' |
|
| 435 | - and !autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 436 | - ) { |
|
| 437 | - $champs['statut'] = 'prop'; |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - |
|
| 442 | - // Envoyer aux plugins |
|
| 443 | - $champs = pipeline( |
|
| 444 | - 'pre_edition', |
|
| 445 | - [ |
|
| 446 | - 'args' => [ |
|
| 447 | - 'table' => $table_sql, |
|
| 448 | - 'id_objet' => $id, |
|
| 449 | - 'action' => 'instituer', |
|
| 450 | - 'statut_ancien' => $statut_ancien, |
|
| 451 | - 'date_ancienne' => $date_ancienne, |
|
| 452 | - 'id_parent_ancien' => $id_rubrique, |
|
| 453 | - ], |
|
| 454 | - 'data' => $champs |
|
| 455 | - ] |
|
| 456 | - ); |
|
| 457 | - |
|
| 458 | - if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 459 | - return ''; |
|
| 460 | - } |
|
| 461 | - |
|
| 462 | - // Envoyer les modifs. |
|
| 463 | - objet_editer_heritage($objet, $id, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 464 | - |
|
| 465 | - // Invalider les caches |
|
| 466 | - include_spip('inc/invalideur'); |
|
| 467 | - suivre_invalideur("id='$objet/$id'"); |
|
| 468 | - |
|
| 469 | - /* |
|
| 338 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 339 | + spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 340 | + $objet = $t; |
|
| 341 | + } |
|
| 342 | + if ( |
|
| 343 | + include_spip('action/editer_' . $objet) |
|
| 344 | + and function_exists($instituer = $objet . '_instituer') |
|
| 345 | + ) { |
|
| 346 | + return $instituer($id, $c, $calcul_rub); |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + $table_sql = table_objet_sql($objet); |
|
| 350 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 351 | + $desc = $trouver_table($table_sql); |
|
| 352 | + if (!$desc or !isset($desc['field'])) { |
|
| 353 | + return _L("Impossible d'instituer $objet : non connu en base"); |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + include_spip('inc/autoriser'); |
|
| 357 | + include_spip('inc/rubriques'); |
|
| 358 | + include_spip('inc/modifier'); |
|
| 359 | + |
|
| 360 | + $sel = []; |
|
| 361 | + $sel[] = (isset($desc['field']['statut']) ? 'statut' : "'' as statut"); |
|
| 362 | + |
|
| 363 | + $champ_date = ''; |
|
| 364 | + if (isset($desc['date']) and $desc['date']) { |
|
| 365 | + $champ_date = $desc['date']; |
|
| 366 | + } elseif (isset($desc['field']['date'])) { |
|
| 367 | + $champ_date = 'date'; |
|
| 368 | + } |
|
| 369 | + |
|
| 370 | + $sel[] = ($champ_date ? "$champ_date as date" : "'' as date"); |
|
| 371 | + $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique'); |
|
| 372 | + |
|
| 373 | + $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id)); |
|
| 374 | + |
|
| 375 | + $id_rubrique = $row['id_rubrique']; |
|
| 376 | + $statut_ancien = $statut = $row['statut']; |
|
| 377 | + $date_ancienne = $date = $row['date']; |
|
| 378 | + $champs = []; |
|
| 379 | + |
|
| 380 | + $d = ($date and isset($c[$champ_date])) ? $c[$champ_date] : null; |
|
| 381 | + $s = (isset($desc['field']['statut']) and isset($c['statut'])) ? $c['statut'] : $statut; |
|
| 382 | + |
|
| 383 | + // cf autorisations dans inc/instituer_objet |
|
| 384 | + if ($s != $statut or ($d and $d != $date)) { |
|
| 385 | + if ( |
|
| 386 | + $id_rubrique ? |
|
| 387 | + autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 388 | + : |
|
| 389 | + autoriser('instituer', $objet, $id, null, ['statut' => $s]) |
|
| 390 | + ) { |
|
| 391 | + $statut = $champs['statut'] = $s; |
|
| 392 | + } else { |
|
| 393 | + if ($s != 'publie' and autoriser('modifier', $objet, $id)) { |
|
| 394 | + $statut = $champs['statut'] = $s; |
|
| 395 | + } else { |
|
| 396 | + spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 397 | + } |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + // En cas de publication, fixer la date a "maintenant" |
|
| 401 | + // sauf si $c commande autre chose |
|
| 402 | + // ou si l'objet est deja date dans le futur |
|
| 403 | + // En cas de proposition d'un objet (mais pas depublication), idem |
|
| 404 | + if ($champ_date) { |
|
| 405 | + if ( |
|
| 406 | + $champs['statut'] == 'publie' |
|
| 407 | + or ($champs['statut'] == 'prop' and !in_array($statut_ancien, ['publie', 'prop'])) |
|
| 408 | + or $d |
|
| 409 | + ) { |
|
| 410 | + if ($d or strtotime($d = $date) > time()) { |
|
| 411 | + $champs[$champ_date] = $date = $d; |
|
| 412 | + } else { |
|
| 413 | + $champs[$champ_date] = $date = date('Y-m-d H:i:s'); |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + // Verifier que la rubrique demandee existe et est differente |
|
| 420 | + // de la rubrique actuelle |
|
| 421 | + if ( |
|
| 422 | + $id_rubrique |
|
| 423 | + and isset($c['id_parent']) |
|
| 424 | + and $id_parent = $c['id_parent'] |
|
| 425 | + and $id_parent != $id_rubrique |
|
| 426 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 427 | + ) { |
|
| 428 | + $champs['id_rubrique'] = $id_parent; |
|
| 429 | + |
|
| 430 | + // si l'objet etait publie |
|
| 431 | + // et que le demandeur n'est pas admin de la rubrique |
|
| 432 | + // repasser l'objet en statut 'propose'. |
|
| 433 | + if ( |
|
| 434 | + $statut == 'publie' |
|
| 435 | + and !autoriser('publierdans', 'rubrique', $id_rubrique) |
|
| 436 | + ) { |
|
| 437 | + $champs['statut'] = 'prop'; |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + |
|
| 442 | + // Envoyer aux plugins |
|
| 443 | + $champs = pipeline( |
|
| 444 | + 'pre_edition', |
|
| 445 | + [ |
|
| 446 | + 'args' => [ |
|
| 447 | + 'table' => $table_sql, |
|
| 448 | + 'id_objet' => $id, |
|
| 449 | + 'action' => 'instituer', |
|
| 450 | + 'statut_ancien' => $statut_ancien, |
|
| 451 | + 'date_ancienne' => $date_ancienne, |
|
| 452 | + 'id_parent_ancien' => $id_rubrique, |
|
| 453 | + ], |
|
| 454 | + 'data' => $champs |
|
| 455 | + ] |
|
| 456 | + ); |
|
| 457 | + |
|
| 458 | + if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 459 | + return ''; |
|
| 460 | + } |
|
| 461 | + |
|
| 462 | + // Envoyer les modifs. |
|
| 463 | + objet_editer_heritage($objet, $id, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 464 | + |
|
| 465 | + // Invalider les caches |
|
| 466 | + include_spip('inc/invalideur'); |
|
| 467 | + suivre_invalideur("id='$objet/$id'"); |
|
| 468 | + |
|
| 469 | + /* |
|
| 470 | 470 | if ($date) { |
| 471 | 471 | $t = strtotime($date); |
| 472 | 472 | $p = @$GLOBALS['meta']['date_prochain_postdate']; |
@@ -475,60 +475,60 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | }*/ |
| 477 | 477 | |
| 478 | - // Pipeline |
|
| 479 | - pipeline( |
|
| 480 | - 'post_edition', |
|
| 481 | - [ |
|
| 482 | - 'args' => [ |
|
| 483 | - 'table' => $table_sql, |
|
| 484 | - 'id_objet' => $id, |
|
| 485 | - 'action' => 'instituer', |
|
| 486 | - 'statut_ancien' => $statut_ancien, |
|
| 487 | - 'date_ancienne' => $date_ancienne, |
|
| 488 | - 'id_parent_ancien' => $id_rubrique, |
|
| 489 | - ], |
|
| 490 | - 'data' => $champs |
|
| 491 | - ] |
|
| 492 | - ); |
|
| 493 | - |
|
| 494 | - // Notifications |
|
| 495 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 496 | - $notifications( |
|
| 497 | - "{$objet}_instituer", |
|
| 498 | - $id, |
|
| 499 | - [ |
|
| 500 | - 'statut' => $statut, |
|
| 501 | - 'statut_ancien' => $statut_ancien, |
|
| 502 | - 'date' => $date, |
|
| 503 | - 'date_ancienne' => $date_ancienne, |
|
| 504 | - 'id_parent_ancien' => $id_rubrique, |
|
| 505 | - 'champs' => $champs, |
|
| 506 | - ] |
|
| 507 | - ); |
|
| 508 | - $notifications( |
|
| 509 | - 'objet_instituer', |
|
| 510 | - $id, |
|
| 511 | - [ |
|
| 512 | - 'objet' => $objet, |
|
| 513 | - 'id_objet' => $id, |
|
| 514 | - 'statut' => $statut, |
|
| 515 | - 'statut_ancien' => $statut_ancien, |
|
| 516 | - 'date' => $date, |
|
| 517 | - 'date_ancienne' => $date_ancienne, |
|
| 518 | - 'id_parent_ancien' => $id_rubrique, |
|
| 519 | - 'champs' => $champs, |
|
| 520 | - ] |
|
| 521 | - ); |
|
| 478 | + // Pipeline |
|
| 479 | + pipeline( |
|
| 480 | + 'post_edition', |
|
| 481 | + [ |
|
| 482 | + 'args' => [ |
|
| 483 | + 'table' => $table_sql, |
|
| 484 | + 'id_objet' => $id, |
|
| 485 | + 'action' => 'instituer', |
|
| 486 | + 'statut_ancien' => $statut_ancien, |
|
| 487 | + 'date_ancienne' => $date_ancienne, |
|
| 488 | + 'id_parent_ancien' => $id_rubrique, |
|
| 489 | + ], |
|
| 490 | + 'data' => $champs |
|
| 491 | + ] |
|
| 492 | + ); |
|
| 493 | + |
|
| 494 | + // Notifications |
|
| 495 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 496 | + $notifications( |
|
| 497 | + "{$objet}_instituer", |
|
| 498 | + $id, |
|
| 499 | + [ |
|
| 500 | + 'statut' => $statut, |
|
| 501 | + 'statut_ancien' => $statut_ancien, |
|
| 502 | + 'date' => $date, |
|
| 503 | + 'date_ancienne' => $date_ancienne, |
|
| 504 | + 'id_parent_ancien' => $id_rubrique, |
|
| 505 | + 'champs' => $champs, |
|
| 506 | + ] |
|
| 507 | + ); |
|
| 508 | + $notifications( |
|
| 509 | + 'objet_instituer', |
|
| 510 | + $id, |
|
| 511 | + [ |
|
| 512 | + 'objet' => $objet, |
|
| 513 | + 'id_objet' => $id, |
|
| 514 | + 'statut' => $statut, |
|
| 515 | + 'statut_ancien' => $statut_ancien, |
|
| 516 | + 'date' => $date, |
|
| 517 | + 'date_ancienne' => $date_ancienne, |
|
| 518 | + 'id_parent_ancien' => $id_rubrique, |
|
| 519 | + 'champs' => $champs, |
|
| 520 | + ] |
|
| 521 | + ); |
|
| 522 | 522 | |
| 523 | - // Rétro-compat |
|
| 524 | - $notifications( |
|
| 525 | - "instituer$objet", |
|
| 526 | - $id, |
|
| 527 | - ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 528 | - ); |
|
| 529 | - } |
|
| 530 | - |
|
| 531 | - return ''; // pas d'erreur |
|
| 523 | + // Rétro-compat |
|
| 524 | + $notifications( |
|
| 525 | + "instituer$objet", |
|
| 526 | + $id, |
|
| 527 | + ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 528 | + ); |
|
| 529 | + } |
|
| 530 | + |
|
| 531 | + return ''; // pas d'erreur |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | /** |
@@ -543,51 +543,51 @@ discard block |
||
| 543 | 543 | * @return void |
| 544 | 544 | */ |
| 545 | 545 | function objet_editer_heritage($objet, $id, $id_rubrique, $statut, $champs, $cond = true) { |
| 546 | - $table_sql = table_objet_sql($objet); |
|
| 547 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 548 | - $desc = $trouver_table($table_sql); |
|
| 549 | - |
|
| 550 | - // Si on deplace l'objet |
|
| 551 | - // changer aussi son secteur et sa langue (si heritee) |
|
| 552 | - if (isset($champs['id_rubrique'])) { |
|
| 553 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 554 | - $langue = $row_rub['lang']; |
|
| 555 | - |
|
| 556 | - if (isset($desc['field']['id_secteur'])) { |
|
| 557 | - $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 558 | - } |
|
| 559 | - |
|
| 560 | - if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 561 | - if ( |
|
| 562 | - sql_fetsel( |
|
| 563 | - '1', |
|
| 564 | - $table_sql, |
|
| 565 | - id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 566 | - ) |
|
| 567 | - ) { |
|
| 568 | - $champs['lang'] = $langue; |
|
| 569 | - } |
|
| 570 | - } |
|
| 571 | - } |
|
| 572 | - |
|
| 573 | - if (!$champs) { |
|
| 574 | - return; |
|
| 575 | - } |
|
| 576 | - sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id)); |
|
| 577 | - |
|
| 578 | - // Changer le statut des rubriques concernees |
|
| 579 | - if ($cond) { |
|
| 580 | - include_spip('inc/rubriques'); |
|
| 581 | - //$postdate = ($GLOBALS['meta']["post_dates"] == "non" AND isset($champs['date']) AND (strtotime($champs['date']) < time()))?$champs['date']:false; |
|
| 582 | - $postdate = false; |
|
| 583 | - // On rajoute les infos de l'objet |
|
| 584 | - $infos = [ |
|
| 585 | - 'objet' => $objet, |
|
| 586 | - 'id_objet' => $id, |
|
| 587 | - 'statut_ancien' => $statut, |
|
| 588 | - ]; |
|
| 589 | - calculer_rubriques_if($id_rubrique, $champs, $infos, $postdate); |
|
| 590 | - } |
|
| 546 | + $table_sql = table_objet_sql($objet); |
|
| 547 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 548 | + $desc = $trouver_table($table_sql); |
|
| 549 | + |
|
| 550 | + // Si on deplace l'objet |
|
| 551 | + // changer aussi son secteur et sa langue (si heritee) |
|
| 552 | + if (isset($champs['id_rubrique'])) { |
|
| 553 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 554 | + $langue = $row_rub['lang']; |
|
| 555 | + |
|
| 556 | + if (isset($desc['field']['id_secteur'])) { |
|
| 557 | + $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 558 | + } |
|
| 559 | + |
|
| 560 | + if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) { |
|
| 561 | + if ( |
|
| 562 | + sql_fetsel( |
|
| 563 | + '1', |
|
| 564 | + $table_sql, |
|
| 565 | + id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 566 | + ) |
|
| 567 | + ) { |
|
| 568 | + $champs['lang'] = $langue; |
|
| 569 | + } |
|
| 570 | + } |
|
| 571 | + } |
|
| 572 | + |
|
| 573 | + if (!$champs) { |
|
| 574 | + return; |
|
| 575 | + } |
|
| 576 | + sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id)); |
|
| 577 | + |
|
| 578 | + // Changer le statut des rubriques concernees |
|
| 579 | + if ($cond) { |
|
| 580 | + include_spip('inc/rubriques'); |
|
| 581 | + //$postdate = ($GLOBALS['meta']["post_dates"] == "non" AND isset($champs['date']) AND (strtotime($champs['date']) < time()))?$champs['date']:false; |
|
| 582 | + $postdate = false; |
|
| 583 | + // On rajoute les infos de l'objet |
|
| 584 | + $infos = [ |
|
| 585 | + 'objet' => $objet, |
|
| 586 | + 'id_objet' => $id, |
|
| 587 | + 'statut_ancien' => $statut, |
|
| 588 | + ]; |
|
| 589 | + calculer_rubriques_if($id_rubrique, $champs, $infos, $postdate); |
|
| 590 | + } |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | |
@@ -616,75 +616,75 @@ discard block |
||
| 616 | 616 | * string|int : valeur du champ demande pour l'objet demande |
| 617 | 617 | */ |
| 618 | 618 | function objet_lire($objet, $valeur_id, $options = []) { |
| 619 | - if (($t = objet_type($objet)) !== $objet) { |
|
| 620 | - spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 621 | - $objet = $t; |
|
| 622 | - } |
|
| 623 | - |
|
| 624 | - // tableau du cache des descriptions et des id d'objet (au sens id_xxx). |
|
| 625 | - // Les tableaux sont toujours indexés par le trio [objet][cle][valeur_cle] |
|
| 626 | - static $descriptions = []; |
|
| 627 | - |
|
| 628 | - // On détermine le nom du champ id de la table. |
|
| 629 | - include_spip('base/objets'); |
|
| 630 | - $primary = id_table_objet($objet); |
|
| 631 | - |
|
| 632 | - // On détermine l'id à utiliser. |
|
| 633 | - $champ_id = (!empty($options['champ_id']) ? $options['champ_id'] : $primary); |
|
| 634 | - |
|
| 635 | - // Si l'objet n'a pas encore été stocké, il faut récupérer sa description complète. |
|
| 636 | - if ( |
|
| 637 | - !isset($descriptions[$objet][$champ_id][$valeur_id]) |
|
| 638 | - or (isset($options['force']) and $options['force']) |
|
| 639 | - ) { |
|
| 640 | - // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet. |
|
| 641 | - if ( |
|
| 642 | - include_spip('action/editer_' . $objet) |
|
| 643 | - and function_exists($lire = "{$objet}_lire_champs") |
|
| 644 | - ) { |
|
| 645 | - $valeurs = $lire($objet, $valeur_id, $champ_id); |
|
| 646 | - } else { |
|
| 647 | - // On récupère la table SQL à partir du type d'objet. |
|
| 648 | - $table = table_objet_sql($objet); |
|
| 649 | - |
|
| 650 | - // La condition est appliquée sur le champ désigné par l'utilisateur. |
|
| 651 | - $where = [ |
|
| 652 | - $champ_id . '=' . sql_quote($valeur_id) |
|
| 653 | - ]; |
|
| 654 | - |
|
| 655 | - // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide. |
|
| 656 | - $valeurs = sql_fetsel('*', $table, $where); |
|
| 657 | - } |
|
| 658 | - |
|
| 659 | - if (!$valeurs) { |
|
| 660 | - $valeurs = false; |
|
| 661 | - } |
|
| 662 | - |
|
| 663 | - $descriptions[$objet][$champ_id][$valeur_id] = $valeurs; |
|
| 664 | - |
|
| 665 | - if ($champ_id !== $primary and isset($valeurs[$primary])) { |
|
| 666 | - $descriptions[$objet][$primary][$valeurs[$primary]] = $valeurs; |
|
| 667 | - $descriptions[$objet][$champ_id][$valeur_id] = &$descriptions[$objet][$primary][$valeurs[$primary]]; |
|
| 668 | - } |
|
| 669 | - } |
|
| 670 | - |
|
| 671 | - $retour = $descriptions[$objet][$champ_id][$valeur_id]; |
|
| 672 | - |
|
| 673 | - // On ne retourne maintenant que les champs demandés. |
|
| 674 | - // - on détermine les informations à renvoyer. |
|
| 675 | - if ($retour and !empty($options['champs'])) { |
|
| 676 | - $champs = $options['champs']; |
|
| 677 | - // Extraction des seules informations demandées. |
|
| 678 | - // -- si on demande une information unique on renvoie la valeur simple, sinon on renvoie un tableau. |
|
| 679 | - // -- si une information n'est pas un champ valide elle n'est pas renvoyée sans renvoyer d'erreur. |
|
| 680 | - if (is_array($champs)) { |
|
| 681 | - // Tableau des informations valides |
|
| 682 | - $retour = array_intersect_key($retour, array_flip($champs)); |
|
| 683 | - } else { |
|
| 684 | - // Valeur unique demandée. |
|
| 685 | - $retour = ($retour[$champs] ?? false); |
|
| 686 | - } |
|
| 687 | - } |
|
| 688 | - |
|
| 689 | - return $retour; |
|
| 619 | + if (($t = objet_type($objet)) !== $objet) { |
|
| 620 | + spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE); |
|
| 621 | + $objet = $t; |
|
| 622 | + } |
|
| 623 | + |
|
| 624 | + // tableau du cache des descriptions et des id d'objet (au sens id_xxx). |
|
| 625 | + // Les tableaux sont toujours indexés par le trio [objet][cle][valeur_cle] |
|
| 626 | + static $descriptions = []; |
|
| 627 | + |
|
| 628 | + // On détermine le nom du champ id de la table. |
|
| 629 | + include_spip('base/objets'); |
|
| 630 | + $primary = id_table_objet($objet); |
|
| 631 | + |
|
| 632 | + // On détermine l'id à utiliser. |
|
| 633 | + $champ_id = (!empty($options['champ_id']) ? $options['champ_id'] : $primary); |
|
| 634 | + |
|
| 635 | + // Si l'objet n'a pas encore été stocké, il faut récupérer sa description complète. |
|
| 636 | + if ( |
|
| 637 | + !isset($descriptions[$objet][$champ_id][$valeur_id]) |
|
| 638 | + or (isset($options['force']) and $options['force']) |
|
| 639 | + ) { |
|
| 640 | + // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet. |
|
| 641 | + if ( |
|
| 642 | + include_spip('action/editer_' . $objet) |
|
| 643 | + and function_exists($lire = "{$objet}_lire_champs") |
|
| 644 | + ) { |
|
| 645 | + $valeurs = $lire($objet, $valeur_id, $champ_id); |
|
| 646 | + } else { |
|
| 647 | + // On récupère la table SQL à partir du type d'objet. |
|
| 648 | + $table = table_objet_sql($objet); |
|
| 649 | + |
|
| 650 | + // La condition est appliquée sur le champ désigné par l'utilisateur. |
|
| 651 | + $where = [ |
|
| 652 | + $champ_id . '=' . sql_quote($valeur_id) |
|
| 653 | + ]; |
|
| 654 | + |
|
| 655 | + // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide. |
|
| 656 | + $valeurs = sql_fetsel('*', $table, $where); |
|
| 657 | + } |
|
| 658 | + |
|
| 659 | + if (!$valeurs) { |
|
| 660 | + $valeurs = false; |
|
| 661 | + } |
|
| 662 | + |
|
| 663 | + $descriptions[$objet][$champ_id][$valeur_id] = $valeurs; |
|
| 664 | + |
|
| 665 | + if ($champ_id !== $primary and isset($valeurs[$primary])) { |
|
| 666 | + $descriptions[$objet][$primary][$valeurs[$primary]] = $valeurs; |
|
| 667 | + $descriptions[$objet][$champ_id][$valeur_id] = &$descriptions[$objet][$primary][$valeurs[$primary]]; |
|
| 668 | + } |
|
| 669 | + } |
|
| 670 | + |
|
| 671 | + $retour = $descriptions[$objet][$champ_id][$valeur_id]; |
|
| 672 | + |
|
| 673 | + // On ne retourne maintenant que les champs demandés. |
|
| 674 | + // - on détermine les informations à renvoyer. |
|
| 675 | + if ($retour and !empty($options['champs'])) { |
|
| 676 | + $champs = $options['champs']; |
|
| 677 | + // Extraction des seules informations demandées. |
|
| 678 | + // -- si on demande une information unique on renvoie la valeur simple, sinon on renvoie un tableau. |
|
| 679 | + // -- si une information n'est pas un champ valide elle n'est pas renvoyée sans renvoyer d'erreur. |
|
| 680 | + if (is_array($champs)) { |
|
| 681 | + // Tableau des informations valides |
|
| 682 | + $retour = array_intersect_key($retour, array_flip($champs)); |
|
| 683 | + } else { |
|
| 684 | + // Valeur unique demandée. |
|
| 685 | + $retour = ($retour[$champs] ?? false); |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | + |
|
| 689 | + return $retour; |
|
| 690 | 690 | } |
@@ -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 | /** |
@@ -39,28 +39,28 @@ discard block |
||
| 39 | 39 | * Tableau des champs et valeurs collectées |
| 40 | 40 | */ |
| 41 | 41 | function collecter_requests($include_list, $exclude_list = [], $set = null, $tous = false) { |
| 42 | - $c = $set; |
|
| 43 | - if (!$c) { |
|
| 44 | - $c = []; |
|
| 45 | - foreach ($include_list as $champ) { |
|
| 46 | - // on ne collecte que les champs reellement envoyes par defaut. |
|
| 47 | - // le cas d'un envoi de valeur NULL peut du coup poser probleme. |
|
| 48 | - $val = _request($champ); |
|
| 49 | - if ($tous or $val !== null) { |
|
| 50 | - $c[$champ] = $val; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - // on ajoute toujours la lang en saisie possible |
|
| 54 | - // meme si pas prevu au depart pour l'objet concerne |
|
| 55 | - if ($l = _request('changer_lang')) { |
|
| 56 | - $c['lang'] = $l; |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - foreach ($exclude_list as $champ) { |
|
| 60 | - unset($c[$champ]); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - return $c; |
|
| 42 | + $c = $set; |
|
| 43 | + if (!$c) { |
|
| 44 | + $c = []; |
|
| 45 | + foreach ($include_list as $champ) { |
|
| 46 | + // on ne collecte que les champs reellement envoyes par defaut. |
|
| 47 | + // le cas d'un envoi de valeur NULL peut du coup poser probleme. |
|
| 48 | + $val = _request($champ); |
|
| 49 | + if ($tous or $val !== null) { |
|
| 50 | + $c[$champ] = $val; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + // on ajoute toujours la lang en saisie possible |
|
| 54 | + // meme si pas prevu au depart pour l'objet concerne |
|
| 55 | + if ($l = _request('changer_lang')) { |
|
| 56 | + $c['lang'] = $l; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + foreach ($exclude_list as $champ) { |
|
| 60 | + unset($c[$champ]); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + return $c; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -97,262 +97,262 @@ discard block |
||
| 97 | 97 | * - chaîne : texte d'un message d'erreur |
| 98 | 98 | */ |
| 99 | 99 | function objet_modifier_champs($objet, $id_objet, $options, $c = null, $serveur = '') { |
| 100 | - if (!$id_objet = intval($id_objet)) { |
|
| 101 | - spip_log('Erreur $id_objet non defini', 'warn'); |
|
| 102 | - |
|
| 103 | - return _T('erreur_technique_enregistrement_impossible'); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - include_spip('inc/filtres'); |
|
| 107 | - |
|
| 108 | - $table_objet = table_objet($objet, $serveur); |
|
| 109 | - $spip_table_objet = table_objet_sql($objet, $serveur); |
|
| 110 | - $id_table_objet = id_table_objet($objet, $serveur); |
|
| 111 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 112 | - $desc = $trouver_table($spip_table_objet, $serveur); |
|
| 113 | - |
|
| 114 | - // Appels incomplets (sans $c) |
|
| 115 | - if (!is_array($c)) { |
|
| 116 | - spip_log('erreur appel objet_modifier_champs(' . $objet . '), manque $c'); |
|
| 117 | - |
|
| 118 | - return _T('erreur_technique_enregistrement_impossible'); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - // Securite : certaines variables ne sont jamais acceptees ici |
|
| 122 | - // car elles ne relevent pas de autoriser(xxx, modifier) ; |
|
| 123 | - // il faut passer par instituer_XX() |
|
| 124 | - // TODO: faut-il passer ces variables interdites |
|
| 125 | - // dans un fichier de description separe ? |
|
| 126 | - unset($c['statut']); |
|
| 127 | - unset($c['id_parent']); |
|
| 128 | - unset($c['id_rubrique']); |
|
| 129 | - unset($c['id_secteur']); |
|
| 130 | - |
|
| 131 | - // Gerer les champs non vides |
|
| 132 | - if (isset($options['nonvide']) and is_array($options['nonvide'])) { |
|
| 133 | - foreach ($options['nonvide'] as $champ => $sinon) { |
|
| 134 | - if (isset($c[$champ]) and $c[$champ] === '') { |
|
| 135 | - $c[$champ] = $sinon; |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - // N'accepter que les champs qui existent dans la table |
|
| 141 | - $champs = array_intersect_key($c, $desc['field']); |
|
| 142 | - // et dont la valeur n'est pas null |
|
| 143 | - $champs = array_filter($champs, static function ($var) { |
|
| 144 | - return $var !== null; |
|
| 145 | - }); |
|
| 146 | - // TODO: ici aussi on peut valider les contenus |
|
| 147 | - // en fonction du type |
|
| 148 | - |
|
| 149 | - // Nettoyer les valeurs |
|
| 150 | - $champs = array_map('corriger_caracteres', $champs); |
|
| 151 | - |
|
| 152 | - // On récupère l'état avant toute modification |
|
| 153 | - $row = sql_fetsel('*', $spip_table_objet, $id_table_objet . '=' . $id_objet); |
|
| 154 | - |
|
| 155 | - // Envoyer aux plugins |
|
| 156 | - $champs = pipeline( |
|
| 157 | - 'pre_edition', |
|
| 158 | - [ |
|
| 159 | - 'args' => [ |
|
| 160 | - 'table' => $spip_table_objet, // compatibilite |
|
| 161 | - 'table_objet' => $table_objet, |
|
| 162 | - 'spip_table_objet' => $spip_table_objet, |
|
| 163 | - 'desc' => $desc, |
|
| 164 | - 'type' => $objet, |
|
| 165 | - 'id_objet' => $id_objet, |
|
| 166 | - 'data' => $options['data'] ?? null, |
|
| 167 | - 'champs' => $options['champs'] ?? [], // [doc] c'est quoi ? |
|
| 168 | - 'champs_anciens' => $row, // état du contenu avant modif |
|
| 169 | - 'serveur' => $serveur, |
|
| 170 | - 'action' => $options['action'] ?? 'modifier' |
|
| 171 | - ], |
|
| 172 | - 'data' => $champs |
|
| 173 | - ] |
|
| 174 | - ); |
|
| 175 | - |
|
| 176 | - if (!$champs) { |
|
| 177 | - return false; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - |
|
| 181 | - // marquer le fait que l'objet est travaille par toto a telle date |
|
| 182 | - include_spip('inc/config'); |
|
| 183 | - if (lire_config('articles_modif', 'non') !== 'non') { |
|
| 184 | - include_spip('inc/drapeau_edition'); |
|
| 185 | - signale_edition($id_objet, $GLOBALS['visiteur_session'], $objet); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - // Verifier si les mises a jour sont pertinentes, datees, en conflit etc |
|
| 189 | - include_spip('inc/editer'); |
|
| 190 | - if (!isset($options['data']) or is_null($options['data'])) { |
|
| 191 | - $options['data'] = &$_POST; |
|
| 192 | - } |
|
| 193 | - $conflits = controler_md5($champs, $options['data'], $objet, $id_objet, $serveur); |
|
| 194 | - // cas hypothetique : normalement inc/editer verifie en amont le conflit edition |
|
| 195 | - // et gere l'interface |
|
| 196 | - // ici on ne renvoie donc qu'un messsage d'erreur, au cas ou on y arrive quand meme |
|
| 197 | - if ($conflits) { |
|
| 198 | - return _T('titre_conflit_edition'); |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - if ($champs) { |
|
| 202 | - // cas particulier de la langue : passer par instituer_langue_objet |
|
| 203 | - if (isset($champs['lang'])) { |
|
| 204 | - if ($changer_lang = $champs['lang']) { |
|
| 205 | - $id_rubrique = 0; |
|
| 206 | - if (isset($desc['field']['id_rubrique'])) { |
|
| 207 | - $parent = ($objet == 'rubrique') ? 'id_parent' : 'id_rubrique'; |
|
| 208 | - $id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=" . intval($id_objet)); |
|
| 209 | - } |
|
| 210 | - $instituer_langue_objet = charger_fonction('instituer_langue_objet', 'action'); |
|
| 211 | - $champs['lang'] = $instituer_langue_objet($objet, $id_objet, $id_rubrique, $changer_lang, $serveur); |
|
| 212 | - } |
|
| 213 | - // on laisse 'lang' dans $champs, |
|
| 214 | - // ca permet de passer dans le pipeline post_edition et de journaliser |
|
| 215 | - // et ca ne gene pas qu'on refasse un sql_updateq dessus apres l'avoir |
|
| 216 | - // deja pris en compte |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // la modif peut avoir lieu |
|
| 220 | - |
|
| 221 | - // faut-il ajouter date_modif ? |
|
| 222 | - if ( |
|
| 223 | - !empty($options['date_modif']) |
|
| 224 | - and !isset($champs[$options['date_modif']]) |
|
| 225 | - ) { |
|
| 226 | - $champs[$options['date_modif']] = date('Y-m-d H:i:s'); |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - // allez on commit la modif |
|
| 230 | - sql_updateq($spip_table_objet, $champs, "$id_table_objet=" . intval($id_objet), [], $serveur); |
|
| 231 | - |
|
| 232 | - // on verifie si elle est bien passee |
|
| 233 | - $moof = sql_fetsel( |
|
| 234 | - array_keys($champs), |
|
| 235 | - $spip_table_objet, |
|
| 236 | - "$id_table_objet=" . intval($id_objet), |
|
| 237 | - [], |
|
| 238 | - [], |
|
| 239 | - '', |
|
| 240 | - [], |
|
| 241 | - $serveur |
|
| 242 | - ); |
|
| 243 | - // si difference entre les champs, reperer les champs mal enregistres |
|
| 244 | - if ($moof != $champs) { |
|
| 245 | - $liste = []; |
|
| 246 | - foreach ($moof as $k => $v) { |
|
| 247 | - if ( |
|
| 248 | - $v !== $champs[$k] |
|
| 249 | - // ne pas alerter si le champ est numerique est que les valeurs sont equivalentes |
|
| 250 | - and (!is_numeric($v) or intval($v) !== intval($champs[$k])) |
|
| 251 | - // ne pas alerter si le champ est date, qu'on a envoye une valeur vide et qu'on recupere une date nulle |
|
| 252 | - and (strlen($champs[$k]) or !in_array($v, ['0000-00-00 00:00:00', '0000-00-00'])) |
|
| 253 | - ) { |
|
| 254 | - $liste[] = $k; |
|
| 255 | - $conflits[$k]['post'] = $champs[$k]; |
|
| 256 | - $conflits[$k]['save'] = $v; |
|
| 257 | - |
|
| 258 | - // cas specifique MySQL+emoji : si l'un est la |
|
| 259 | - // conversion utf8_noplanes de l'autre alors c'est OK |
|
| 260 | - if (defined('_MYSQL_NOPLANES') && _MYSQL_NOPLANES) { |
|
| 261 | - include_spip('inc/charsets'); |
|
| 262 | - if ($v == utf8_noplanes($champs[$k])) { |
|
| 263 | - array_pop($liste); |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - } |
|
| 267 | - } |
|
| 268 | - // si un champ n'a pas ete correctement enregistre, loger et retourner une erreur |
|
| 269 | - // c'est un cas exceptionnel |
|
| 270 | - if (count($liste)) { |
|
| 271 | - spip_log( |
|
| 272 | - "Erreur enregistrement en base $objet/$id_objet champs :" . var_export($conflits, true), |
|
| 273 | - 'modifier.' . _LOG_CRITIQUE |
|
| 274 | - ); |
|
| 275 | - |
|
| 276 | - return _T( |
|
| 277 | - 'erreur_technique_enregistrement_champs', |
|
| 278 | - ['champs' => "<i>'" . implode("'</i>,<i>'", $liste) . "'</i>"] |
|
| 279 | - ); |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - // Invalider les caches |
|
| 284 | - if (isset($options['invalideur']) and $options['invalideur']) { |
|
| 285 | - include_spip('inc/invalideur'); |
|
| 286 | - if (is_array($options['invalideur'])) { |
|
| 287 | - array_map('suivre_invalideur', $options['invalideur']); |
|
| 288 | - } else { |
|
| 289 | - suivre_invalideur($options['invalideur']); |
|
| 290 | - } |
|
| 291 | - } |
|
| 292 | - |
|
| 293 | - // Notifications, gestion des revisions... |
|
| 294 | - // en standard, appelle |nouvelle_revision ci-dessous |
|
| 295 | - pipeline( |
|
| 296 | - 'post_edition', |
|
| 297 | - [ |
|
| 298 | - 'args' => [ |
|
| 299 | - 'table' => $spip_table_objet, |
|
| 300 | - 'table_objet' => $table_objet, |
|
| 301 | - 'spip_table_objet' => $spip_table_objet, |
|
| 302 | - 'desc' => $desc, |
|
| 303 | - 'type' => $objet, |
|
| 304 | - 'id_objet' => $id_objet, |
|
| 305 | - 'champs' => $options['champs'] ?? [], // [doc] kesako ? |
|
| 306 | - 'champs_anciens' => $row, // état du contenu avant modif |
|
| 307 | - 'serveur' => $serveur, |
|
| 308 | - 'action' => $options['action'] ?? 'modifier' |
|
| 309 | - ], |
|
| 310 | - 'data' => $champs |
|
| 311 | - ] |
|
| 312 | - ); |
|
| 313 | - } |
|
| 100 | + if (!$id_objet = intval($id_objet)) { |
|
| 101 | + spip_log('Erreur $id_objet non defini', 'warn'); |
|
| 102 | + |
|
| 103 | + return _T('erreur_technique_enregistrement_impossible'); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + include_spip('inc/filtres'); |
|
| 107 | + |
|
| 108 | + $table_objet = table_objet($objet, $serveur); |
|
| 109 | + $spip_table_objet = table_objet_sql($objet, $serveur); |
|
| 110 | + $id_table_objet = id_table_objet($objet, $serveur); |
|
| 111 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 112 | + $desc = $trouver_table($spip_table_objet, $serveur); |
|
| 113 | + |
|
| 114 | + // Appels incomplets (sans $c) |
|
| 115 | + if (!is_array($c)) { |
|
| 116 | + spip_log('erreur appel objet_modifier_champs(' . $objet . '), manque $c'); |
|
| 117 | + |
|
| 118 | + return _T('erreur_technique_enregistrement_impossible'); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + // Securite : certaines variables ne sont jamais acceptees ici |
|
| 122 | + // car elles ne relevent pas de autoriser(xxx, modifier) ; |
|
| 123 | + // il faut passer par instituer_XX() |
|
| 124 | + // TODO: faut-il passer ces variables interdites |
|
| 125 | + // dans un fichier de description separe ? |
|
| 126 | + unset($c['statut']); |
|
| 127 | + unset($c['id_parent']); |
|
| 128 | + unset($c['id_rubrique']); |
|
| 129 | + unset($c['id_secteur']); |
|
| 130 | + |
|
| 131 | + // Gerer les champs non vides |
|
| 132 | + if (isset($options['nonvide']) and is_array($options['nonvide'])) { |
|
| 133 | + foreach ($options['nonvide'] as $champ => $sinon) { |
|
| 134 | + if (isset($c[$champ]) and $c[$champ] === '') { |
|
| 135 | + $c[$champ] = $sinon; |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + // N'accepter que les champs qui existent dans la table |
|
| 141 | + $champs = array_intersect_key($c, $desc['field']); |
|
| 142 | + // et dont la valeur n'est pas null |
|
| 143 | + $champs = array_filter($champs, static function ($var) { |
|
| 144 | + return $var !== null; |
|
| 145 | + }); |
|
| 146 | + // TODO: ici aussi on peut valider les contenus |
|
| 147 | + // en fonction du type |
|
| 148 | + |
|
| 149 | + // Nettoyer les valeurs |
|
| 150 | + $champs = array_map('corriger_caracteres', $champs); |
|
| 151 | + |
|
| 152 | + // On récupère l'état avant toute modification |
|
| 153 | + $row = sql_fetsel('*', $spip_table_objet, $id_table_objet . '=' . $id_objet); |
|
| 154 | + |
|
| 155 | + // Envoyer aux plugins |
|
| 156 | + $champs = pipeline( |
|
| 157 | + 'pre_edition', |
|
| 158 | + [ |
|
| 159 | + 'args' => [ |
|
| 160 | + 'table' => $spip_table_objet, // compatibilite |
|
| 161 | + 'table_objet' => $table_objet, |
|
| 162 | + 'spip_table_objet' => $spip_table_objet, |
|
| 163 | + 'desc' => $desc, |
|
| 164 | + 'type' => $objet, |
|
| 165 | + 'id_objet' => $id_objet, |
|
| 166 | + 'data' => $options['data'] ?? null, |
|
| 167 | + 'champs' => $options['champs'] ?? [], // [doc] c'est quoi ? |
|
| 168 | + 'champs_anciens' => $row, // état du contenu avant modif |
|
| 169 | + 'serveur' => $serveur, |
|
| 170 | + 'action' => $options['action'] ?? 'modifier' |
|
| 171 | + ], |
|
| 172 | + 'data' => $champs |
|
| 173 | + ] |
|
| 174 | + ); |
|
| 175 | + |
|
| 176 | + if (!$champs) { |
|
| 177 | + return false; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + |
|
| 181 | + // marquer le fait que l'objet est travaille par toto a telle date |
|
| 182 | + include_spip('inc/config'); |
|
| 183 | + if (lire_config('articles_modif', 'non') !== 'non') { |
|
| 184 | + include_spip('inc/drapeau_edition'); |
|
| 185 | + signale_edition($id_objet, $GLOBALS['visiteur_session'], $objet); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + // Verifier si les mises a jour sont pertinentes, datees, en conflit etc |
|
| 189 | + include_spip('inc/editer'); |
|
| 190 | + if (!isset($options['data']) or is_null($options['data'])) { |
|
| 191 | + $options['data'] = &$_POST; |
|
| 192 | + } |
|
| 193 | + $conflits = controler_md5($champs, $options['data'], $objet, $id_objet, $serveur); |
|
| 194 | + // cas hypothetique : normalement inc/editer verifie en amont le conflit edition |
|
| 195 | + // et gere l'interface |
|
| 196 | + // ici on ne renvoie donc qu'un messsage d'erreur, au cas ou on y arrive quand meme |
|
| 197 | + if ($conflits) { |
|
| 198 | + return _T('titre_conflit_edition'); |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + if ($champs) { |
|
| 202 | + // cas particulier de la langue : passer par instituer_langue_objet |
|
| 203 | + if (isset($champs['lang'])) { |
|
| 204 | + if ($changer_lang = $champs['lang']) { |
|
| 205 | + $id_rubrique = 0; |
|
| 206 | + if (isset($desc['field']['id_rubrique'])) { |
|
| 207 | + $parent = ($objet == 'rubrique') ? 'id_parent' : 'id_rubrique'; |
|
| 208 | + $id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=" . intval($id_objet)); |
|
| 209 | + } |
|
| 210 | + $instituer_langue_objet = charger_fonction('instituer_langue_objet', 'action'); |
|
| 211 | + $champs['lang'] = $instituer_langue_objet($objet, $id_objet, $id_rubrique, $changer_lang, $serveur); |
|
| 212 | + } |
|
| 213 | + // on laisse 'lang' dans $champs, |
|
| 214 | + // ca permet de passer dans le pipeline post_edition et de journaliser |
|
| 215 | + // et ca ne gene pas qu'on refasse un sql_updateq dessus apres l'avoir |
|
| 216 | + // deja pris en compte |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // la modif peut avoir lieu |
|
| 220 | + |
|
| 221 | + // faut-il ajouter date_modif ? |
|
| 222 | + if ( |
|
| 223 | + !empty($options['date_modif']) |
|
| 224 | + and !isset($champs[$options['date_modif']]) |
|
| 225 | + ) { |
|
| 226 | + $champs[$options['date_modif']] = date('Y-m-d H:i:s'); |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + // allez on commit la modif |
|
| 230 | + sql_updateq($spip_table_objet, $champs, "$id_table_objet=" . intval($id_objet), [], $serveur); |
|
| 231 | + |
|
| 232 | + // on verifie si elle est bien passee |
|
| 233 | + $moof = sql_fetsel( |
|
| 234 | + array_keys($champs), |
|
| 235 | + $spip_table_objet, |
|
| 236 | + "$id_table_objet=" . intval($id_objet), |
|
| 237 | + [], |
|
| 238 | + [], |
|
| 239 | + '', |
|
| 240 | + [], |
|
| 241 | + $serveur |
|
| 242 | + ); |
|
| 243 | + // si difference entre les champs, reperer les champs mal enregistres |
|
| 244 | + if ($moof != $champs) { |
|
| 245 | + $liste = []; |
|
| 246 | + foreach ($moof as $k => $v) { |
|
| 247 | + if ( |
|
| 248 | + $v !== $champs[$k] |
|
| 249 | + // ne pas alerter si le champ est numerique est que les valeurs sont equivalentes |
|
| 250 | + and (!is_numeric($v) or intval($v) !== intval($champs[$k])) |
|
| 251 | + // ne pas alerter si le champ est date, qu'on a envoye une valeur vide et qu'on recupere une date nulle |
|
| 252 | + and (strlen($champs[$k]) or !in_array($v, ['0000-00-00 00:00:00', '0000-00-00'])) |
|
| 253 | + ) { |
|
| 254 | + $liste[] = $k; |
|
| 255 | + $conflits[$k]['post'] = $champs[$k]; |
|
| 256 | + $conflits[$k]['save'] = $v; |
|
| 257 | + |
|
| 258 | + // cas specifique MySQL+emoji : si l'un est la |
|
| 259 | + // conversion utf8_noplanes de l'autre alors c'est OK |
|
| 260 | + if (defined('_MYSQL_NOPLANES') && _MYSQL_NOPLANES) { |
|
| 261 | + include_spip('inc/charsets'); |
|
| 262 | + if ($v == utf8_noplanes($champs[$k])) { |
|
| 263 | + array_pop($liste); |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | + // si un champ n'a pas ete correctement enregistre, loger et retourner une erreur |
|
| 269 | + // c'est un cas exceptionnel |
|
| 270 | + if (count($liste)) { |
|
| 271 | + spip_log( |
|
| 272 | + "Erreur enregistrement en base $objet/$id_objet champs :" . var_export($conflits, true), |
|
| 273 | + 'modifier.' . _LOG_CRITIQUE |
|
| 274 | + ); |
|
| 275 | + |
|
| 276 | + return _T( |
|
| 277 | + 'erreur_technique_enregistrement_champs', |
|
| 278 | + ['champs' => "<i>'" . implode("'</i>,<i>'", $liste) . "'</i>"] |
|
| 279 | + ); |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + // Invalider les caches |
|
| 284 | + if (isset($options['invalideur']) and $options['invalideur']) { |
|
| 285 | + include_spip('inc/invalideur'); |
|
| 286 | + if (is_array($options['invalideur'])) { |
|
| 287 | + array_map('suivre_invalideur', $options['invalideur']); |
|
| 288 | + } else { |
|
| 289 | + suivre_invalideur($options['invalideur']); |
|
| 290 | + } |
|
| 291 | + } |
|
| 292 | + |
|
| 293 | + // Notifications, gestion des revisions... |
|
| 294 | + // en standard, appelle |nouvelle_revision ci-dessous |
|
| 295 | + pipeline( |
|
| 296 | + 'post_edition', |
|
| 297 | + [ |
|
| 298 | + 'args' => [ |
|
| 299 | + 'table' => $spip_table_objet, |
|
| 300 | + 'table_objet' => $table_objet, |
|
| 301 | + 'spip_table_objet' => $spip_table_objet, |
|
| 302 | + 'desc' => $desc, |
|
| 303 | + 'type' => $objet, |
|
| 304 | + 'id_objet' => $id_objet, |
|
| 305 | + 'champs' => $options['champs'] ?? [], // [doc] kesako ? |
|
| 306 | + 'champs_anciens' => $row, // état du contenu avant modif |
|
| 307 | + 'serveur' => $serveur, |
|
| 308 | + 'action' => $options['action'] ?? 'modifier' |
|
| 309 | + ], |
|
| 310 | + 'data' => $champs |
|
| 311 | + ] |
|
| 312 | + ); |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - // Appeler une notification |
|
| 316 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 317 | - $notifications( |
|
| 318 | - "{$objet}_modifier", |
|
| 319 | - $id_objet, |
|
| 320 | - [ |
|
| 321 | - 'champs' => $champs, |
|
| 322 | - ] |
|
| 323 | - ); |
|
| 324 | - $notifications( |
|
| 325 | - 'objet_modifier', |
|
| 326 | - $id_objet, |
|
| 327 | - [ |
|
| 328 | - 'objet' => $objet, |
|
| 329 | - 'id_objet' => $id_objet, |
|
| 330 | - 'champs' => $champs, |
|
| 331 | - ] |
|
| 332 | - ); |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - // journaliser l'affaire |
|
| 336 | - // message a affiner :-) |
|
| 337 | - include_spip('inc/filtres_mini'); |
|
| 338 | - $qui = ''; |
|
| 339 | - if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 340 | - $qui .= ' #id_auteur:' . $GLOBALS['visiteur_session']['id_auteur'] . '#'; |
|
| 341 | - } |
|
| 342 | - if (!empty($GLOBALS['visiteur_session']['nom'])) { |
|
| 343 | - $qui .= ' #nom:' . $GLOBALS['visiteur_session']['nom'] . '#'; |
|
| 344 | - } |
|
| 345 | - if ($qui == '') { |
|
| 346 | - $qui = '#ip:' . $GLOBALS['ip'] . '#'; |
|
| 347 | - } |
|
| 348 | - journal(_L($qui . ' a édité ' . $objet . ' ' . $id_objet . ' (' . join( |
|
| 349 | - '+', |
|
| 350 | - array_diff(array_keys($champs), ['date_modif']) |
|
| 351 | - ) . ')'), [ |
|
| 352 | - 'faire' => 'modifier', |
|
| 353 | - 'quoi' => $objet, |
|
| 354 | - 'id' => $id_objet |
|
| 355 | - ]); |
|
| 356 | - |
|
| 357 | - return ''; |
|
| 315 | + // Appeler une notification |
|
| 316 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 317 | + $notifications( |
|
| 318 | + "{$objet}_modifier", |
|
| 319 | + $id_objet, |
|
| 320 | + [ |
|
| 321 | + 'champs' => $champs, |
|
| 322 | + ] |
|
| 323 | + ); |
|
| 324 | + $notifications( |
|
| 325 | + 'objet_modifier', |
|
| 326 | + $id_objet, |
|
| 327 | + [ |
|
| 328 | + 'objet' => $objet, |
|
| 329 | + 'id_objet' => $id_objet, |
|
| 330 | + 'champs' => $champs, |
|
| 331 | + ] |
|
| 332 | + ); |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + // journaliser l'affaire |
|
| 336 | + // message a affiner :-) |
|
| 337 | + include_spip('inc/filtres_mini'); |
|
| 338 | + $qui = ''; |
|
| 339 | + if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 340 | + $qui .= ' #id_auteur:' . $GLOBALS['visiteur_session']['id_auteur'] . '#'; |
|
| 341 | + } |
|
| 342 | + if (!empty($GLOBALS['visiteur_session']['nom'])) { |
|
| 343 | + $qui .= ' #nom:' . $GLOBALS['visiteur_session']['nom'] . '#'; |
|
| 344 | + } |
|
| 345 | + if ($qui == '') { |
|
| 346 | + $qui = '#ip:' . $GLOBALS['ip'] . '#'; |
|
| 347 | + } |
|
| 348 | + journal(_L($qui . ' a édité ' . $objet . ' ' . $id_objet . ' (' . join( |
|
| 349 | + '+', |
|
| 350 | + array_diff(array_keys($champs), ['date_modif']) |
|
| 351 | + ) . ')'), [ |
|
| 352 | + 'faire' => 'modifier', |
|
| 353 | + 'quoi' => $objet, |
|
| 354 | + 'id' => $id_objet |
|
| 355 | + ]); |
|
| 356 | + |
|
| 357 | + return ''; |
|
| 358 | 358 | } |
@@ -4,248 +4,248 @@ discard block |
||
| 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 | - 'access_interface_graphique' => 'Retour à l’interface graphique complète', |
|
| 14 | - 'access_mode_texte' => 'Afficher l’interface textuelle simplifiée', |
|
| 15 | - 'admin_debug' => 'debug', |
|
| 16 | - 'admin_modifier_article' => 'Modifier cet article', |
|
| 17 | - 'admin_modifier_auteur' => 'Modifier cet auteur', |
|
| 18 | - 'admin_modifier_breve' => 'Modifier cette brève', |
|
| 19 | - 'admin_modifier_mot' => 'Modifier ce mot-clé', |
|
| 20 | - 'admin_modifier_rubrique' => 'Modifier cette rubrique', |
|
| 21 | - 'admin_recalculer' => 'Recalculer cette page', |
|
| 22 | - 'afficher_calendrier' => 'Afficher le calendrier', |
|
| 23 | - 'afficher_trad' => 'afficher les traductions', |
|
| 24 | - 'alerte_maj_impossible' => '<b>Alerte !</b> La mise à jour de la base SQL vers la version @version@ est impossible, peut-être à cause d’un problème de droit de modification sur la base de données. Contacte ton hébergeur.', |
|
| 25 | - 'alerte_modif_info_concourante' => 'ATTENTION : Cette information a été modifiée par ailleurs. La valeur actuelle est :', |
|
| 26 | - 'analyse_xml' => 'Analyse XML', |
|
| 27 | - 'annuler' => 'Annuler', |
|
| 28 | - 'antispam_champ_vide' => 'Laisse ce champ vide :', |
|
| 29 | - 'articles_recents' => 'Articles les plus récents', |
|
| 30 | - 'attention_champ_mini_nb_caractères' => 'Attention ! @nb@ caractères au minimum', |
|
| 31 | - 'avis_1_erreur_saisie' => 'Il y a 1 erreur dans dans ta saisie, vérifie les informations.', |
|
| 32 | - 'avis_archive_incorrect' => 'le fichier archive n’est pas un fichier SPIP', |
|
| 33 | - 'avis_archive_invalide' => 'le fichier archive n’est pas valide', |
|
| 34 | - 'avis_attention' => 'ATTENTION !', |
|
| 35 | - 'avis_champ_incorrect_type_objet' => 'Nom de champ incorrect @name@ pour objet de type @type@', |
|
| 36 | - 'avis_colonne_inexistante' => 'La colonne @col@ n’existe pas', |
|
| 37 | - 'avis_erreur' => 'Erreur : voir ci-dessous', |
|
| 38 | - 'avis_erreur_connexion' => 'Erreur de connexion', |
|
| 39 | - 'avis_erreur_cookie' => 'problème de cookie', |
|
| 40 | - 'avis_erreur_fonction_contexte' => 'Erreur de programmation. Cette fonction ne doit pas être appelée dans ce contexte.', |
|
| 41 | - 'avis_erreur_mysql' => 'Erreur SQL', |
|
| 42 | - 'avis_erreur_sauvegarde' => 'Erreur dans la sauvegarde (@type@ @id_objet@) !', |
|
| 43 | - 'avis_erreur_visiteur' => 'Problème d’accès à l’espace privé', |
|
| 44 | - 'avis_nb_erreurs_saisie' => 'Il y a @nb@ erreurs dans ta saisie, vérifie les informations.', |
|
| 12 | + // A |
|
| 13 | + 'access_interface_graphique' => 'Retour à l’interface graphique complète', |
|
| 14 | + 'access_mode_texte' => 'Afficher l’interface textuelle simplifiée', |
|
| 15 | + 'admin_debug' => 'debug', |
|
| 16 | + 'admin_modifier_article' => 'Modifier cet article', |
|
| 17 | + 'admin_modifier_auteur' => 'Modifier cet auteur', |
|
| 18 | + 'admin_modifier_breve' => 'Modifier cette brève', |
|
| 19 | + 'admin_modifier_mot' => 'Modifier ce mot-clé', |
|
| 20 | + 'admin_modifier_rubrique' => 'Modifier cette rubrique', |
|
| 21 | + 'admin_recalculer' => 'Recalculer cette page', |
|
| 22 | + 'afficher_calendrier' => 'Afficher le calendrier', |
|
| 23 | + 'afficher_trad' => 'afficher les traductions', |
|
| 24 | + 'alerte_maj_impossible' => '<b>Alerte !</b> La mise à jour de la base SQL vers la version @version@ est impossible, peut-être à cause d’un problème de droit de modification sur la base de données. Contacte ton hébergeur.', |
|
| 25 | + 'alerte_modif_info_concourante' => 'ATTENTION : Cette information a été modifiée par ailleurs. La valeur actuelle est :', |
|
| 26 | + 'analyse_xml' => 'Analyse XML', |
|
| 27 | + 'annuler' => 'Annuler', |
|
| 28 | + 'antispam_champ_vide' => 'Laisse ce champ vide :', |
|
| 29 | + 'articles_recents' => 'Articles les plus récents', |
|
| 30 | + 'attention_champ_mini_nb_caractères' => 'Attention ! @nb@ caractères au minimum', |
|
| 31 | + 'avis_1_erreur_saisie' => 'Il y a 1 erreur dans dans ta saisie, vérifie les informations.', |
|
| 32 | + 'avis_archive_incorrect' => 'le fichier archive n’est pas un fichier SPIP', |
|
| 33 | + 'avis_archive_invalide' => 'le fichier archive n’est pas valide', |
|
| 34 | + 'avis_attention' => 'ATTENTION !', |
|
| 35 | + 'avis_champ_incorrect_type_objet' => 'Nom de champ incorrect @name@ pour objet de type @type@', |
|
| 36 | + 'avis_colonne_inexistante' => 'La colonne @col@ n’existe pas', |
|
| 37 | + 'avis_erreur' => 'Erreur : voir ci-dessous', |
|
| 38 | + 'avis_erreur_connexion' => 'Erreur de connexion', |
|
| 39 | + 'avis_erreur_cookie' => 'problème de cookie', |
|
| 40 | + 'avis_erreur_fonction_contexte' => 'Erreur de programmation. Cette fonction ne doit pas être appelée dans ce contexte.', |
|
| 41 | + 'avis_erreur_mysql' => 'Erreur SQL', |
|
| 42 | + 'avis_erreur_sauvegarde' => 'Erreur dans la sauvegarde (@type@ @id_objet@) !', |
|
| 43 | + 'avis_erreur_visiteur' => 'Problème d’accès à l’espace privé', |
|
| 44 | + 'avis_nb_erreurs_saisie' => 'Il y a @nb@ erreurs dans ta saisie, vérifie les informations.', |
|
| 45 | 45 | |
| 46 | - // B |
|
| 47 | - 'barre_a_accent_grave' => 'Insérer un A accent grave majuscule', |
|
| 48 | - 'barre_aide' => 'Utilise les raccourcis typographiques pour enrichir ta mise en page', |
|
| 49 | - 'barre_e_accent_aigu' => 'Insérer un E accent aigu majuscule', |
|
| 50 | - 'barre_eo' => 'Insérer un E dans l’O', |
|
| 51 | - 'barre_eo_maj' => 'Insérer un E dans l’O majuscule', |
|
| 52 | - 'barre_euro' => 'Insérer le symbole ?', |
|
| 53 | - 'barre_gras' => 'Mettre en {{gras}}', |
|
| 54 | - 'barre_guillemets' => 'Entourer de « guillemets français »', |
|
| 55 | - 'barre_guillemets_simples' => 'Entourer de ?guillemets de second niveau ?', |
|
| 56 | - 'barre_intertitre' => 'Transformer en {{{intertitre}}}', |
|
| 57 | - 'barre_italic' => 'Mettre en {italique}', |
|
| 58 | - 'barre_lien' => 'Transformer en [lien hypertexte->http://...]', |
|
| 59 | - 'barre_lien_input' => 'Indiquer l’adresse de ton lien (tu peux indiquer une adresse Web sous la forme http://www.monsite/com ou simplement indiquer le numéro d’un article de ce site.', |
|
| 60 | - 'barre_note' => 'Transformer en [[Note de bas de page]]', |
|
| 61 | - 'barre_paragraphe' => 'Crée un paragraphe', |
|
| 62 | - 'barre_quote' => '<quote>Citer un message</quote>', |
|
| 63 | - 'bouton_changer' => 'Changer', |
|
| 64 | - 'bouton_chercher' => 'Chercher', |
|
| 65 | - 'bouton_choisir' => 'Choisir', |
|
| 66 | - 'bouton_deplacer' => 'Déplacer', |
|
| 67 | - 'bouton_download' => 'Télécharger', |
|
| 68 | - 'bouton_enregistrer' => 'Enregistrer', |
|
| 69 | - 'bouton_radio_desactiver_messagerie_interne' => 'Désactiver la messagerie interne', |
|
| 70 | - 'bouton_radio_envoi_annonces' => 'Envoyer les annonces éditoriales', |
|
| 71 | - 'bouton_radio_non_envoi_annonces' => 'Ne pas envoyer d’annonces', |
|
| 72 | - 'bouton_radio_non_envoi_liste_nouveautes' => 'Ne pas envoyer la liste des nouveautés', |
|
| 73 | - 'bouton_recharger_page' => 'recharger cette page', |
|
| 74 | - 'bouton_telecharger' => 'Télécharger', |
|
| 75 | - 'bouton_upload' => 'Téléverser', |
|
| 76 | - 'bouton_valider' => 'Valider', |
|
| 46 | + // B |
|
| 47 | + 'barre_a_accent_grave' => 'Insérer un A accent grave majuscule', |
|
| 48 | + 'barre_aide' => 'Utilise les raccourcis typographiques pour enrichir ta mise en page', |
|
| 49 | + 'barre_e_accent_aigu' => 'Insérer un E accent aigu majuscule', |
|
| 50 | + 'barre_eo' => 'Insérer un E dans l’O', |
|
| 51 | + 'barre_eo_maj' => 'Insérer un E dans l’O majuscule', |
|
| 52 | + 'barre_euro' => 'Insérer le symbole ?', |
|
| 53 | + 'barre_gras' => 'Mettre en {{gras}}', |
|
| 54 | + 'barre_guillemets' => 'Entourer de « guillemets français »', |
|
| 55 | + 'barre_guillemets_simples' => 'Entourer de ?guillemets de second niveau ?', |
|
| 56 | + 'barre_intertitre' => 'Transformer en {{{intertitre}}}', |
|
| 57 | + 'barre_italic' => 'Mettre en {italique}', |
|
| 58 | + 'barre_lien' => 'Transformer en [lien hypertexte->http://...]', |
|
| 59 | + 'barre_lien_input' => 'Indiquer l’adresse de ton lien (tu peux indiquer une adresse Web sous la forme http://www.monsite/com ou simplement indiquer le numéro d’un article de ce site.', |
|
| 60 | + 'barre_note' => 'Transformer en [[Note de bas de page]]', |
|
| 61 | + 'barre_paragraphe' => 'Crée un paragraphe', |
|
| 62 | + 'barre_quote' => '<quote>Citer un message</quote>', |
|
| 63 | + 'bouton_changer' => 'Changer', |
|
| 64 | + 'bouton_chercher' => 'Chercher', |
|
| 65 | + 'bouton_choisir' => 'Choisir', |
|
| 66 | + 'bouton_deplacer' => 'Déplacer', |
|
| 67 | + 'bouton_download' => 'Télécharger', |
|
| 68 | + 'bouton_enregistrer' => 'Enregistrer', |
|
| 69 | + 'bouton_radio_desactiver_messagerie_interne' => 'Désactiver la messagerie interne', |
|
| 70 | + 'bouton_radio_envoi_annonces' => 'Envoyer les annonces éditoriales', |
|
| 71 | + 'bouton_radio_non_envoi_annonces' => 'Ne pas envoyer d’annonces', |
|
| 72 | + 'bouton_radio_non_envoi_liste_nouveautes' => 'Ne pas envoyer la liste des nouveautés', |
|
| 73 | + 'bouton_recharger_page' => 'recharger cette page', |
|
| 74 | + 'bouton_telecharger' => 'Télécharger', |
|
| 75 | + 'bouton_upload' => 'Téléverser', |
|
| 76 | + 'bouton_valider' => 'Valider', |
|
| 77 | 77 | |
| 78 | - // C |
|
| 79 | - 'cal_apresmidi' => 'après-midi', |
|
| 80 | - 'cal_jour_entier' => 'jour entier', |
|
| 81 | - 'cal_matin' => 'matin', |
|
| 82 | - 'cal_par_jour' => 'calendrier par jour', |
|
| 83 | - 'cal_par_mois' => 'calendrier par mois', |
|
| 84 | - 'cal_par_semaine' => 'calendrier par semaine', |
|
| 85 | - 'choix_couleur_interface' => 'couleur ', |
|
| 86 | - 'choix_interface' => 'choix de l’interface', |
|
| 87 | - 'colonne' => 'Colonne', |
|
| 88 | - 'confirm_changer_statut' => 'Attention, tu as demandé à changer le statut de cet élément. Souhaites-tu continuer ?', |
|
| 89 | - 'correcte' => 'correcte', |
|
| 78 | + // C |
|
| 79 | + 'cal_apresmidi' => 'après-midi', |
|
| 80 | + 'cal_jour_entier' => 'jour entier', |
|
| 81 | + 'cal_matin' => 'matin', |
|
| 82 | + 'cal_par_jour' => 'calendrier par jour', |
|
| 83 | + 'cal_par_mois' => 'calendrier par mois', |
|
| 84 | + 'cal_par_semaine' => 'calendrier par semaine', |
|
| 85 | + 'choix_couleur_interface' => 'couleur ', |
|
| 86 | + 'choix_interface' => 'choix de l’interface', |
|
| 87 | + 'colonne' => 'Colonne', |
|
| 88 | + 'confirm_changer_statut' => 'Attention, tu as demandé à changer le statut de cet élément. Souhaites-tu continuer ?', |
|
| 89 | + 'correcte' => 'correcte', |
|
| 90 | 90 | |
| 91 | - // D |
|
| 92 | - 'date_aujourdhui' => 'aujourd’hui', |
|
| 93 | - 'date_avant_jc' => 'av. J.C.', |
|
| 94 | - 'date_dans' => 'dans @delai@', |
|
| 95 | - 'date_de_mois_1' => '@j@ @nommois@', |
|
| 96 | - 'date_de_mois_10' => '@j@ @nommois@', |
|
| 97 | - 'date_de_mois_11' => '@j@ @nommois@', |
|
| 98 | - 'date_de_mois_12' => '@j@ @nommois@', |
|
| 99 | - 'date_de_mois_2' => '@j@ @nommois@', |
|
| 100 | - 'date_de_mois_3' => '@j@ @nommois@', |
|
| 101 | - 'date_de_mois_4' => '@j@ @nommois@', |
|
| 102 | - 'date_de_mois_5' => '@j@ @nommois@', |
|
| 103 | - 'date_de_mois_6' => '@j@ @nommois@', |
|
| 104 | - 'date_de_mois_7' => '@j@ @nommois@', |
|
| 105 | - 'date_de_mois_8' => '@j@ @nommois@', |
|
| 106 | - 'date_de_mois_9' => '@j@ @nommois@', |
|
| 107 | - 'date_demain' => 'demain', |
|
| 108 | - 'date_fmt_heures_minutes' => '@h@h@m@min', |
|
| 109 | - 'date_fmt_heures_minutes_court' => '@h@h@m@', |
|
| 110 | - 'date_fmt_jour' => '@nomjour@ @jour@', |
|
| 111 | - 'date_fmt_jour_heure' => '@jour@ à @heure@', |
|
| 112 | - 'date_fmt_jour_heure_debut_fin' => 'le @jour@ de @heure_debut@ à @heure_fin@', |
|
| 113 | - 'date_fmt_jour_heure_debut_fin_abbr' => 'le @dtstart@@jour@ de @heure_debut@@dtabbr@ à @dtstart@@heure_fin@@dtend@', |
|
| 114 | - 'date_fmt_jour_mois' => '@jour@ @nommois@', |
|
| 115 | - 'date_fmt_jour_mois_annee' => '@jour@ @nommois@ @annee@', |
|
| 116 | - 'date_fmt_mois_annee' => '@nommois@ @annee@', |
|
| 117 | - 'date_fmt_nomjour' => '@nomjour@ @date@', |
|
| 118 | - 'date_fmt_nomjour_date' => 'le @nomjour@ @date@', |
|
| 119 | - 'date_fmt_periode' => 'Du @date_debut@ au @date_fin@', |
|
| 120 | - 'date_fmt_periode_abbr' => 'Du @dtart@@date_debut@@dtabbr@ au @dtend@@date_fin@@dtabbr@', |
|
| 121 | - 'date_fmt_periode_from' => 'Du', |
|
| 122 | - 'date_fmt_periode_to' => 'au', |
|
| 123 | - 'date_fmt_saison_annee' => '@saison@ @annee@', |
|
| 124 | - 'date_heures' => 'heures', |
|
| 125 | - 'date_hier' => 'hier', |
|
| 126 | - 'date_il_y_a' => 'il y a @delai@', |
|
| 127 | - 'date_jnum1' => '1er', |
|
| 128 | - 'date_jnum10' => '10', |
|
| 129 | - 'date_jnum11' => '11', |
|
| 130 | - 'date_jnum12' => '12', |
|
| 131 | - 'date_jnum13' => '13', |
|
| 132 | - 'date_jnum14' => '14', |
|
| 133 | - 'date_jnum15' => '15', |
|
| 134 | - 'date_jnum16' => '16', |
|
| 135 | - 'date_jnum17' => '17', |
|
| 136 | - 'date_jnum18' => '18', |
|
| 137 | - 'date_jnum19' => '19', |
|
| 138 | - 'date_jnum2' => '2', |
|
| 139 | - 'date_jnum20' => '20', |
|
| 140 | - 'date_jnum21' => '21', |
|
| 141 | - 'date_jnum22' => '22', |
|
| 142 | - 'date_jnum23' => '23', |
|
| 143 | - 'date_jnum24' => '24', |
|
| 144 | - 'date_jnum25' => '25', |
|
| 145 | - 'date_jnum26' => '26', |
|
| 146 | - 'date_jnum27' => '27', |
|
| 147 | - 'date_jnum28' => '28', |
|
| 148 | - 'date_jnum29' => '29', |
|
| 149 | - 'date_jnum3' => '3', |
|
| 150 | - 'date_jnum30' => '30', |
|
| 151 | - 'date_jnum31' => '31', |
|
| 152 | - 'date_jnum4' => '4', |
|
| 153 | - 'date_jnum5' => '5', |
|
| 154 | - 'date_jnum6' => '6', |
|
| 155 | - 'date_jnum7' => '7', |
|
| 156 | - 'date_jnum8' => '8', |
|
| 157 | - 'date_jnum9' => '9', |
|
| 158 | - 'date_jour_1' => 'dimanche', |
|
| 159 | - 'date_jour_1_abbr' => 'dim.', |
|
| 160 | - 'date_jour_1_initiale' => 'd.', |
|
| 161 | - 'date_jour_2' => 'lundi', |
|
| 162 | - 'date_jour_2_abbr' => 'lun.', |
|
| 163 | - 'date_jour_2_initiale' => 'l.', |
|
| 164 | - 'date_jour_3' => 'mardi', |
|
| 165 | - 'date_jour_3_abbr' => 'mar.', |
|
| 166 | - 'date_jour_3_initiale' => 'm.', |
|
| 167 | - 'date_jour_4' => 'mercredi', |
|
| 168 | - 'date_jour_4_abbr' => 'mer.', |
|
| 169 | - 'date_jour_4_initiale' => 'm.', |
|
| 170 | - 'date_jour_5' => 'jeudi', |
|
| 171 | - 'date_jour_5_abbr' => 'jeu.', |
|
| 172 | - 'date_jour_5_initiale' => 'j.', |
|
| 173 | - 'date_jour_6' => 'vendredi', |
|
| 174 | - 'date_jour_6_abbr' => 'ven.', |
|
| 175 | - 'date_jour_6_initiale' => 'v.', |
|
| 176 | - 'date_jour_7' => 'samedi', |
|
| 177 | - 'date_jour_7_abbr' => 'sam.', |
|
| 178 | - 'date_jour_7_initiale' => 's.', |
|
| 179 | - 'date_jours' => 'jours', |
|
| 180 | - 'date_minutes' => 'minutes', |
|
| 181 | - 'date_mois' => 'mois', |
|
| 182 | - 'date_mois_1' => 'janvier', |
|
| 183 | - 'date_mois_10' => 'octobre', |
|
| 184 | - 'date_mois_10_abbr' => 'oct.', |
|
| 185 | - 'date_mois_11' => 'novembre', |
|
| 186 | - 'date_mois_11_abbr' => 'nov.', |
|
| 187 | - 'date_mois_12' => 'décembre', |
|
| 188 | - 'date_mois_12_abbr' => 'déc.', |
|
| 189 | - 'date_mois_1_abbr' => 'janv.', |
|
| 190 | - 'date_mois_2' => 'février', |
|
| 191 | - 'date_mois_2_abbr' => 'févr.', |
|
| 192 | - 'date_mois_3' => 'mars', |
|
| 193 | - 'date_mois_3_abbr' => 'mars', |
|
| 194 | - 'date_mois_4' => 'avril', |
|
| 195 | - 'date_mois_4_abbr' => 'avr.', |
|
| 196 | - 'date_mois_5' => 'mai', |
|
| 197 | - 'date_mois_5_abbr' => 'mai', |
|
| 198 | - 'date_mois_6' => 'juin', |
|
| 199 | - 'date_mois_6_abbr' => 'juin', |
|
| 200 | - 'date_mois_7' => 'juillet', |
|
| 201 | - 'date_mois_7_abbr' => 'juil.', |
|
| 202 | - 'date_mois_8' => 'août', |
|
| 203 | - 'date_mois_8_abbr' => 'août', |
|
| 204 | - 'date_mois_9' => 'septembre', |
|
| 205 | - 'date_mois_9_abbr' => 'sept.', |
|
| 206 | - 'date_saison_1' => 'hiver', |
|
| 207 | - 'date_saison_2' => 'printemps', |
|
| 208 | - 'date_saison_3' => 'été', |
|
| 209 | - 'date_saison_4' => 'automne', |
|
| 210 | - 'date_secondes' => 'secondes', |
|
| 211 | - 'date_semaines' => 'semaines', |
|
| 212 | - 'date_un_mois' => 'mois', |
|
| 213 | - 'date_une_heure' => 'heure', |
|
| 214 | - 'date_une_minute' => 'minute', |
|
| 215 | - 'date_une_seconde' => 'seconde', |
|
| 216 | - 'date_une_semaine' => 'semaine', |
|
| 217 | - 'dirs_commencer' => ' afin de commencer réellement l’installation', |
|
| 218 | - 'dirs_preliminaire' => 'Préliminaire : <b>Régler les droits d’accès</b>', |
|
| 219 | - 'dirs_probleme_droits' => 'Problème de droits d’accès', |
|
| 220 | - 'dirs_repertoires_absents' => '<p><b>Les répertoires suivants n’ont pas été trouvés :</b></p><ul>@bad_dirs@.</ul> |
|
| 91 | + // D |
|
| 92 | + 'date_aujourdhui' => 'aujourd’hui', |
|
| 93 | + 'date_avant_jc' => 'av. J.C.', |
|
| 94 | + 'date_dans' => 'dans @delai@', |
|
| 95 | + 'date_de_mois_1' => '@j@ @nommois@', |
|
| 96 | + 'date_de_mois_10' => '@j@ @nommois@', |
|
| 97 | + 'date_de_mois_11' => '@j@ @nommois@', |
|
| 98 | + 'date_de_mois_12' => '@j@ @nommois@', |
|
| 99 | + 'date_de_mois_2' => '@j@ @nommois@', |
|
| 100 | + 'date_de_mois_3' => '@j@ @nommois@', |
|
| 101 | + 'date_de_mois_4' => '@j@ @nommois@', |
|
| 102 | + 'date_de_mois_5' => '@j@ @nommois@', |
|
| 103 | + 'date_de_mois_6' => '@j@ @nommois@', |
|
| 104 | + 'date_de_mois_7' => '@j@ @nommois@', |
|
| 105 | + 'date_de_mois_8' => '@j@ @nommois@', |
|
| 106 | + 'date_de_mois_9' => '@j@ @nommois@', |
|
| 107 | + 'date_demain' => 'demain', |
|
| 108 | + 'date_fmt_heures_minutes' => '@h@h@m@min', |
|
| 109 | + 'date_fmt_heures_minutes_court' => '@h@h@m@', |
|
| 110 | + 'date_fmt_jour' => '@nomjour@ @jour@', |
|
| 111 | + 'date_fmt_jour_heure' => '@jour@ à @heure@', |
|
| 112 | + 'date_fmt_jour_heure_debut_fin' => 'le @jour@ de @heure_debut@ à @heure_fin@', |
|
| 113 | + 'date_fmt_jour_heure_debut_fin_abbr' => 'le @dtstart@@jour@ de @heure_debut@@dtabbr@ à @dtstart@@heure_fin@@dtend@', |
|
| 114 | + 'date_fmt_jour_mois' => '@jour@ @nommois@', |
|
| 115 | + 'date_fmt_jour_mois_annee' => '@jour@ @nommois@ @annee@', |
|
| 116 | + 'date_fmt_mois_annee' => '@nommois@ @annee@', |
|
| 117 | + 'date_fmt_nomjour' => '@nomjour@ @date@', |
|
| 118 | + 'date_fmt_nomjour_date' => 'le @nomjour@ @date@', |
|
| 119 | + 'date_fmt_periode' => 'Du @date_debut@ au @date_fin@', |
|
| 120 | + 'date_fmt_periode_abbr' => 'Du @dtart@@date_debut@@dtabbr@ au @dtend@@date_fin@@dtabbr@', |
|
| 121 | + 'date_fmt_periode_from' => 'Du', |
|
| 122 | + 'date_fmt_periode_to' => 'au', |
|
| 123 | + 'date_fmt_saison_annee' => '@saison@ @annee@', |
|
| 124 | + 'date_heures' => 'heures', |
|
| 125 | + 'date_hier' => 'hier', |
|
| 126 | + 'date_il_y_a' => 'il y a @delai@', |
|
| 127 | + 'date_jnum1' => '1er', |
|
| 128 | + 'date_jnum10' => '10', |
|
| 129 | + 'date_jnum11' => '11', |
|
| 130 | + 'date_jnum12' => '12', |
|
| 131 | + 'date_jnum13' => '13', |
|
| 132 | + 'date_jnum14' => '14', |
|
| 133 | + 'date_jnum15' => '15', |
|
| 134 | + 'date_jnum16' => '16', |
|
| 135 | + 'date_jnum17' => '17', |
|
| 136 | + 'date_jnum18' => '18', |
|
| 137 | + 'date_jnum19' => '19', |
|
| 138 | + 'date_jnum2' => '2', |
|
| 139 | + 'date_jnum20' => '20', |
|
| 140 | + 'date_jnum21' => '21', |
|
| 141 | + 'date_jnum22' => '22', |
|
| 142 | + 'date_jnum23' => '23', |
|
| 143 | + 'date_jnum24' => '24', |
|
| 144 | + 'date_jnum25' => '25', |
|
| 145 | + 'date_jnum26' => '26', |
|
| 146 | + 'date_jnum27' => '27', |
|
| 147 | + 'date_jnum28' => '28', |
|
| 148 | + 'date_jnum29' => '29', |
|
| 149 | + 'date_jnum3' => '3', |
|
| 150 | + 'date_jnum30' => '30', |
|
| 151 | + 'date_jnum31' => '31', |
|
| 152 | + 'date_jnum4' => '4', |
|
| 153 | + 'date_jnum5' => '5', |
|
| 154 | + 'date_jnum6' => '6', |
|
| 155 | + 'date_jnum7' => '7', |
|
| 156 | + 'date_jnum8' => '8', |
|
| 157 | + 'date_jnum9' => '9', |
|
| 158 | + 'date_jour_1' => 'dimanche', |
|
| 159 | + 'date_jour_1_abbr' => 'dim.', |
|
| 160 | + 'date_jour_1_initiale' => 'd.', |
|
| 161 | + 'date_jour_2' => 'lundi', |
|
| 162 | + 'date_jour_2_abbr' => 'lun.', |
|
| 163 | + 'date_jour_2_initiale' => 'l.', |
|
| 164 | + 'date_jour_3' => 'mardi', |
|
| 165 | + 'date_jour_3_abbr' => 'mar.', |
|
| 166 | + 'date_jour_3_initiale' => 'm.', |
|
| 167 | + 'date_jour_4' => 'mercredi', |
|
| 168 | + 'date_jour_4_abbr' => 'mer.', |
|
| 169 | + 'date_jour_4_initiale' => 'm.', |
|
| 170 | + 'date_jour_5' => 'jeudi', |
|
| 171 | + 'date_jour_5_abbr' => 'jeu.', |
|
| 172 | + 'date_jour_5_initiale' => 'j.', |
|
| 173 | + 'date_jour_6' => 'vendredi', |
|
| 174 | + 'date_jour_6_abbr' => 'ven.', |
|
| 175 | + 'date_jour_6_initiale' => 'v.', |
|
| 176 | + 'date_jour_7' => 'samedi', |
|
| 177 | + 'date_jour_7_abbr' => 'sam.', |
|
| 178 | + 'date_jour_7_initiale' => 's.', |
|
| 179 | + 'date_jours' => 'jours', |
|
| 180 | + 'date_minutes' => 'minutes', |
|
| 181 | + 'date_mois' => 'mois', |
|
| 182 | + 'date_mois_1' => 'janvier', |
|
| 183 | + 'date_mois_10' => 'octobre', |
|
| 184 | + 'date_mois_10_abbr' => 'oct.', |
|
| 185 | + 'date_mois_11' => 'novembre', |
|
| 186 | + 'date_mois_11_abbr' => 'nov.', |
|
| 187 | + 'date_mois_12' => 'décembre', |
|
| 188 | + 'date_mois_12_abbr' => 'déc.', |
|
| 189 | + 'date_mois_1_abbr' => 'janv.', |
|
| 190 | + 'date_mois_2' => 'février', |
|
| 191 | + 'date_mois_2_abbr' => 'févr.', |
|
| 192 | + 'date_mois_3' => 'mars', |
|
| 193 | + 'date_mois_3_abbr' => 'mars', |
|
| 194 | + 'date_mois_4' => 'avril', |
|
| 195 | + 'date_mois_4_abbr' => 'avr.', |
|
| 196 | + 'date_mois_5' => 'mai', |
|
| 197 | + 'date_mois_5_abbr' => 'mai', |
|
| 198 | + 'date_mois_6' => 'juin', |
|
| 199 | + 'date_mois_6_abbr' => 'juin', |
|
| 200 | + 'date_mois_7' => 'juillet', |
|
| 201 | + 'date_mois_7_abbr' => 'juil.', |
|
| 202 | + 'date_mois_8' => 'août', |
|
| 203 | + 'date_mois_8_abbr' => 'août', |
|
| 204 | + 'date_mois_9' => 'septembre', |
|
| 205 | + 'date_mois_9_abbr' => 'sept.', |
|
| 206 | + 'date_saison_1' => 'hiver', |
|
| 207 | + 'date_saison_2' => 'printemps', |
|
| 208 | + 'date_saison_3' => 'été', |
|
| 209 | + 'date_saison_4' => 'automne', |
|
| 210 | + 'date_secondes' => 'secondes', |
|
| 211 | + 'date_semaines' => 'semaines', |
|
| 212 | + 'date_un_mois' => 'mois', |
|
| 213 | + 'date_une_heure' => 'heure', |
|
| 214 | + 'date_une_minute' => 'minute', |
|
| 215 | + 'date_une_seconde' => 'seconde', |
|
| 216 | + 'date_une_semaine' => 'semaine', |
|
| 217 | + 'dirs_commencer' => ' afin de commencer réellement l’installation', |
|
| 218 | + 'dirs_preliminaire' => 'Préliminaire : <b>Régler les droits d’accès</b>', |
|
| 219 | + 'dirs_probleme_droits' => 'Problème de droits d’accès', |
|
| 220 | + 'dirs_repertoires_absents' => '<p><b>Les répertoires suivants n’ont pas été trouvés :</b></p><ul>@bad_dirs@.</ul> |
|
| 221 | 221 | <p>Il est probable que cela soit dû à un problème de mauvaise mise en majuscules ou minuscules. |
| 222 | 222 | Vérifie que les minuscules et majuscules de ces répertoires concordent bien avec ce qui est affiché |
| 223 | 223 | ci-dessus ; si ce n’est pas le cas, renomme les répertoires avec ton logiciel FTP de façon à corriger l’erreur.</p> |
| 224 | 224 | <p>Une fois cette manipulation effectuée, tu pourras ', |
| 225 | - 'dirs_repertoires_suivants' => '<p><b>Les répertoires suivants ne sont pas accessibles en écriture :</b></p> <ul>@bad_dirs@</ul> |
|
| 225 | + 'dirs_repertoires_suivants' => '<p><b>Les répertoires suivants ne sont pas accessibles en écriture :</b></p> <ul>@bad_dirs@</ul> |
|
| 226 | 226 | <p>Pour y remédier, utilise ton client FTP afin de régler les droits d’accès de chacun |
| 227 | 227 | de ces répertoires. La procédure est expliquée en détail dans le guide d’installation.</p> |
| 228 | 228 | <p>Une fois cette manipulation effectuée, tu pourras ', |
| 229 | - 'double_occurrence' => 'Double occurrence de @balise@', |
|
| 229 | + 'double_occurrence' => 'Double occurrence de @balise@', |
|
| 230 | 230 | |
| 231 | - // E |
|
| 232 | - 'en_cours' => 'en cours', |
|
| 233 | - 'envoi_via_le_site' => 'Envoi via le site', |
|
| 234 | - 'erreur' => 'Erreur', |
|
| 235 | - 'erreur_balise_non_fermee' => 'dernière balise non refermée :', |
|
| 236 | - 'erreur_technique_ajaxform' => 'Ooops. Une erreur innatendue a empêché de soumettre le formulaire. Tu peux essayer à nouveau.', |
|
| 237 | - 'erreur_technique_enregistrement_champs' => 'Une erreur technique a empêché l’enregistrement correct du champ @champs@.', |
|
| 238 | - 'erreur_technique_enregistrement_impossible' => 'Une erreur technique a empêché l’enregistrement.', |
|
| 239 | - 'erreur_texte' => 'erreur(s)', |
|
| 240 | - 'etape' => 'Étape', |
|
| 231 | + // E |
|
| 232 | + 'en_cours' => 'en cours', |
|
| 233 | + 'envoi_via_le_site' => 'Envoi via le site', |
|
| 234 | + 'erreur' => 'Erreur', |
|
| 235 | + 'erreur_balise_non_fermee' => 'dernière balise non refermée :', |
|
| 236 | + 'erreur_technique_ajaxform' => 'Ooops. Une erreur innatendue a empêché de soumettre le formulaire. Tu peux essayer à nouveau.', |
|
| 237 | + 'erreur_technique_enregistrement_champs' => 'Une erreur technique a empêché l’enregistrement correct du champ @champs@.', |
|
| 238 | + 'erreur_technique_enregistrement_impossible' => 'Une erreur technique a empêché l’enregistrement.', |
|
| 239 | + 'erreur_texte' => 'erreur(s)', |
|
| 240 | + 'etape' => 'Étape', |
|
| 241 | 241 | |
| 242 | - // F |
|
| 243 | - 'fichier_introuvable' => 'Fichier @fichier@ introuvable.', |
|
| 244 | - 'fonction_introuvable' => 'Fonction @fonction@() introuvable.', |
|
| 245 | - 'form_auteur_confirmation' => 'Confirme ton adresse email', |
|
| 246 | - 'form_auteur_email_modifie' => 'Ton adresse email a été modifiée.', |
|
| 247 | - 'form_auteur_envoi_mail_confirmation' => 'Un courrier électronique de confirmation vient d’être envoyé à @email@. Visite l’adresse Web mentionnée dans ce courrier pour valider ton adresse mail.', |
|
| 248 | - 'form_auteur_mail_confirmation' => 'Salut, |
|
| 242 | + // F |
|
| 243 | + 'fichier_introuvable' => 'Fichier @fichier@ introuvable.', |
|
| 244 | + 'fonction_introuvable' => 'Fonction @fonction@() introuvable.', |
|
| 245 | + 'form_auteur_confirmation' => 'Confirme ton adresse email', |
|
| 246 | + 'form_auteur_email_modifie' => 'Ton adresse email a été modifiée.', |
|
| 247 | + 'form_auteur_envoi_mail_confirmation' => 'Un courrier électronique de confirmation vient d’être envoyé à @email@. Visite l’adresse Web mentionnée dans ce courrier pour valider ton adresse mail.', |
|
| 248 | + 'form_auteur_mail_confirmation' => 'Salut, |
|
| 249 | 249 | |
| 250 | 250 | Tu as demandé à changer ton adresse email. |
| 251 | 251 | Pour confirmer ta nouvelle adresse, il suffit de te connecter à |
@@ -254,346 +254,346 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | @url@ |
| 256 | 256 | ', |
| 257 | - 'form_deja_inscrit' => 'Tu es déjà inscrit.', |
|
| 258 | - 'form_email_non_valide' => 'Ton adresse email n’est pas valide.', |
|
| 259 | - 'form_forum_access_refuse' => 'Tu n’as plus accès à ce site.', |
|
| 260 | - 'form_forum_bonjour' => 'Salut @nom@,', |
|
| 261 | - 'form_forum_confirmer_email' => 'Pour confirmer ton adresse email, va à cette adresse : @url_confirm@', |
|
| 262 | - 'form_forum_email_deja_enregistre' => 'Cette adresse email est déjà enregistrée, tu peux donc utiliser ton mot de passe habituel.', |
|
| 263 | - 'form_forum_identifiant_mail' => 'Ton nouvel identifiant vient de t’être envoyé par email.', |
|
| 264 | - 'form_forum_identifiants' => 'Identifiants personnels', |
|
| 265 | - 'form_forum_indiquer_nom_email' => 'Indique ici ton nom et ton adresse email. Ton identifiant personnel te parviendra rapidement, par courrier électronique.', |
|
| 266 | - 'form_forum_login' => 'login :', |
|
| 267 | - 'form_forum_message_auto' => '(ceci est un message automatique)', |
|
| 268 | - 'form_forum_pass' => 'mot de passe :', |
|
| 269 | - 'form_forum_probleme_mail' => 'Problème de mail : l’identifiant ne peut pas être envoyé.', |
|
| 270 | - 'form_forum_voici1' => 'Voici tes identifiants pour pouvoir participer à la vie du site "@nom_site_spip@" (@adresse_site@) :', |
|
| 271 | - 'form_forum_voici2' => 'Voici tes identifiants pour proposer des articles sur |
|
| 257 | + 'form_deja_inscrit' => 'Tu es déjà inscrit.', |
|
| 258 | + 'form_email_non_valide' => 'Ton adresse email n’est pas valide.', |
|
| 259 | + 'form_forum_access_refuse' => 'Tu n’as plus accès à ce site.', |
|
| 260 | + 'form_forum_bonjour' => 'Salut @nom@,', |
|
| 261 | + 'form_forum_confirmer_email' => 'Pour confirmer ton adresse email, va à cette adresse : @url_confirm@', |
|
| 262 | + 'form_forum_email_deja_enregistre' => 'Cette adresse email est déjà enregistrée, tu peux donc utiliser ton mot de passe habituel.', |
|
| 263 | + 'form_forum_identifiant_mail' => 'Ton nouvel identifiant vient de t’être envoyé par email.', |
|
| 264 | + 'form_forum_identifiants' => 'Identifiants personnels', |
|
| 265 | + 'form_forum_indiquer_nom_email' => 'Indique ici ton nom et ton adresse email. Ton identifiant personnel te parviendra rapidement, par courrier électronique.', |
|
| 266 | + 'form_forum_login' => 'login :', |
|
| 267 | + 'form_forum_message_auto' => '(ceci est un message automatique)', |
|
| 268 | + 'form_forum_pass' => 'mot de passe :', |
|
| 269 | + 'form_forum_probleme_mail' => 'Problème de mail : l’identifiant ne peut pas être envoyé.', |
|
| 270 | + 'form_forum_voici1' => 'Voici tes identifiants pour pouvoir participer à la vie du site "@nom_site_spip@" (@adresse_site@) :', |
|
| 271 | + 'form_forum_voici2' => 'Voici tes identifiants pour proposer des articles sur |
|
| 272 | 272 | le site "@nom_site_spip@" (@adresse_login@) :', |
| 273 | - 'form_indiquer_email' => 'Indique ton adresse email.', |
|
| 274 | - 'form_indiquer_nom' => 'Indique ton nom.', |
|
| 275 | - 'form_indiquer_nom_site' => 'Indique le nom de ton site.', |
|
| 276 | - 'form_pet_deja_enregistre' => 'Ce site est déjà enregistré', |
|
| 277 | - 'form_pet_signature_pasprise' => 'Ta signature n’est pas prise en compte.', |
|
| 278 | - 'form_prop_confirmer_envoi' => 'Confirmer l’envoi', |
|
| 279 | - 'form_prop_description' => 'Description/commentaire', |
|
| 280 | - 'form_prop_enregistre' => 'Ta proposition est enregistrée, elle apparaîtra en ligne après validation par les responsables de ce site.', |
|
| 281 | - 'form_prop_envoyer' => 'Envoyer un message', |
|
| 282 | - 'form_prop_indiquer_email' => 'Indiquer une adresse email valide', |
|
| 283 | - 'form_prop_indiquer_nom_site' => 'Indiquer le nom du site.', |
|
| 284 | - 'form_prop_indiquer_sujet' => 'Indiquer un sujet', |
|
| 285 | - 'form_prop_message_envoye' => 'Message envoyé', |
|
| 286 | - 'form_prop_non_enregistre' => 'Ta proposition n’a pas été enregistrée.', |
|
| 287 | - 'form_prop_sujet' => 'Sujet', |
|
| 288 | - 'form_prop_url_site' => 'Adresse URL du site', |
|
| 289 | - 'format_date_attendu' => 'Saisir une date au format jj/mm/aaaa.', |
|
| 290 | - 'format_date_incorrecte' => 'La date ou son format est incorrect', |
|
| 291 | - 'format_heure_attendu' => 'Saisir une heure au format hh:mm.', |
|
| 292 | - 'format_heure_incorrecte' => 'L’heure ou son format est incorrect', |
|
| 293 | - 'forum_non_inscrit' => 'Tu n’es pas inscrit, ou l’adresse ou le mot de passe sont erronés.', |
|
| 294 | - 'forum_par_auteur' => 'par @auteur@', |
|
| 295 | - 'forum_titre_erreur' => 'Erreur...', |
|
| 273 | + 'form_indiquer_email' => 'Indique ton adresse email.', |
|
| 274 | + 'form_indiquer_nom' => 'Indique ton nom.', |
|
| 275 | + 'form_indiquer_nom_site' => 'Indique le nom de ton site.', |
|
| 276 | + 'form_pet_deja_enregistre' => 'Ce site est déjà enregistré', |
|
| 277 | + 'form_pet_signature_pasprise' => 'Ta signature n’est pas prise en compte.', |
|
| 278 | + 'form_prop_confirmer_envoi' => 'Confirmer l’envoi', |
|
| 279 | + 'form_prop_description' => 'Description/commentaire', |
|
| 280 | + 'form_prop_enregistre' => 'Ta proposition est enregistrée, elle apparaîtra en ligne après validation par les responsables de ce site.', |
|
| 281 | + 'form_prop_envoyer' => 'Envoyer un message', |
|
| 282 | + 'form_prop_indiquer_email' => 'Indiquer une adresse email valide', |
|
| 283 | + 'form_prop_indiquer_nom_site' => 'Indiquer le nom du site.', |
|
| 284 | + 'form_prop_indiquer_sujet' => 'Indiquer un sujet', |
|
| 285 | + 'form_prop_message_envoye' => 'Message envoyé', |
|
| 286 | + 'form_prop_non_enregistre' => 'Ta proposition n’a pas été enregistrée.', |
|
| 287 | + 'form_prop_sujet' => 'Sujet', |
|
| 288 | + 'form_prop_url_site' => 'Adresse URL du site', |
|
| 289 | + 'format_date_attendu' => 'Saisir une date au format jj/mm/aaaa.', |
|
| 290 | + 'format_date_incorrecte' => 'La date ou son format est incorrect', |
|
| 291 | + 'format_heure_attendu' => 'Saisir une heure au format hh:mm.', |
|
| 292 | + 'format_heure_incorrecte' => 'L’heure ou son format est incorrect', |
|
| 293 | + 'forum_non_inscrit' => 'Tu n’es pas inscrit, ou l’adresse ou le mot de passe sont erronés.', |
|
| 294 | + 'forum_par_auteur' => 'par @auteur@', |
|
| 295 | + 'forum_titre_erreur' => 'Erreur...', |
|
| 296 | 296 | |
| 297 | - // I |
|
| 298 | - 'ical_texte_rss_articles' => 'Le fichier « backend » des articles de ce site se trouve à l’adresse :', |
|
| 299 | - 'ical_texte_rss_articles2' => 'Tu peux également obtenir des fichiers « backend » pour les articles de chaque rubrique du site :', |
|
| 300 | - 'ical_texte_rss_breves' => 'Il existe de plus un fichier contenant les brèves du site. En précisant un numéro de rubrique, tu obtiendras uniquement les brèves de cette rubrique.', |
|
| 301 | - 'icone_a_suivre' => 'À suivre', |
|
| 302 | - 'icone_admin_site' => 'Administration du site', |
|
| 303 | - 'icone_agenda' => 'Agenda', |
|
| 304 | - 'icone_aide_ligne' => 'Aide', |
|
| 305 | - 'icone_articles' => 'Articles', |
|
| 306 | - 'icone_auteurs' => 'Auteurs', |
|
| 307 | - 'icone_brouteur' => 'Navigation rapide', |
|
| 308 | - 'icone_configuration_site' => 'Configuration', |
|
| 309 | - 'icone_configurer_site' => 'Configurer ton site', |
|
| 310 | - 'icone_creer_nouvel_auteur' => 'Créer un nouvel auteur', |
|
| 311 | - 'icone_creer_rubrique' => 'Créer une rubrique', |
|
| 312 | - 'icone_creer_sous_rubrique' => 'Créer une sous-rubrique', |
|
| 313 | - 'icone_deconnecter' => 'Se déconnecter', |
|
| 314 | - 'icone_discussions' => 'Discussions', |
|
| 315 | - 'icone_doc_rubrique' => 'Documents des rubriques', |
|
| 316 | - 'icone_ecrire_article' => 'Écrire un nouvel article', |
|
| 317 | - 'icone_edition_site' => 'Édition', |
|
| 318 | - 'icone_gestion_langues' => 'Gestion des langues', |
|
| 319 | - 'icone_informations_personnelles' => 'Informations personnelles', |
|
| 320 | - 'icone_interface_complet' => 'interface complète', |
|
| 321 | - 'icone_interface_simple' => 'Interface simplifiée', |
|
| 322 | - 'icone_maintenance_site' => 'Maintenance du site', |
|
| 323 | - 'icone_messagerie_personnelle' => 'Messagerie personnelle', |
|
| 324 | - 'icone_repartition_debut' => 'Afficher la répartition depuis le début', |
|
| 325 | - 'icone_rubriques' => 'Rubriques', |
|
| 326 | - 'icone_sauver_site' => 'Sauvegarde du site', |
|
| 327 | - 'icone_site_entier' => 'Tout le site', |
|
| 328 | - 'icone_sites_references' => 'Sites référencés', |
|
| 329 | - 'icone_statistiques' => 'Statistiques du site', |
|
| 330 | - 'icone_suivi_activite' => 'Suivre la vie du site', |
|
| 331 | - 'icone_suivi_actualite' => 'Évolution du site', |
|
| 332 | - 'icone_suivi_pettions' => 'Suivre/gérer les pétitions', |
|
| 333 | - 'icone_suivi_revisions' => 'Modifications des articles', |
|
| 334 | - 'icone_supprimer_document' => 'Supprimer ce document', |
|
| 335 | - 'icone_supprimer_image' => 'Supprimer cette image', |
|
| 336 | - 'icone_tous_articles' => 'Tous tes articles', |
|
| 337 | - 'icone_tous_auteur' => 'Tous les auteurs', |
|
| 338 | - 'icone_tous_visiteur' => 'Tous les visiteurs', |
|
| 339 | - 'icone_visiter_site' => 'Voir le site public', |
|
| 340 | - 'icone_voir_en_ligne' => 'Voir en ligne', |
|
| 341 | - 'img_indisponible' => 'image indisponible', |
|
| 342 | - 'impossible' => 'impossible', |
|
| 343 | - 'info_a_suivre' => 'À SUIVRE »', |
|
| 344 | - 'info_acces_interdit' => 'Accès interdit', |
|
| 345 | - 'info_acces_refuse' => 'Accès refusé', |
|
| 346 | - 'info_action' => 'Action : @action@', |
|
| 347 | - 'info_administrer_rubriques' => 'Tu peux administrer cette rubrique et ses sous-rubriques', |
|
| 348 | - 'info_adresse_non_indiquee' => 'Tu n’as pas indiqué d’adresse à tester !', |
|
| 349 | - 'info_aide' => 'AIDE :', |
|
| 350 | - 'info_ajouter_mot' => 'Ajouter ce mot', |
|
| 351 | - 'info_annonce' => 'ANNONCE', |
|
| 352 | - 'info_annonces_generales' => 'Annonces générales :', |
|
| 353 | - 'info_article_propose' => 'Article proposé', |
|
| 354 | - 'info_article_publie' => 'Article publié', |
|
| 355 | - 'info_article_redaction' => 'Article en cours de rédaction', |
|
| 356 | - 'info_article_refuse' => 'Article refusé', |
|
| 357 | - 'info_article_supprime' => 'Article supprimé', |
|
| 358 | - 'info_articles' => 'Articles', |
|
| 359 | - 'info_articles_a_valider' => 'Les articles à valider', |
|
| 360 | - 'info_articles_nb' => '@nb@ articles', |
|
| 361 | - 'info_articles_proposes' => 'Articles proposés', |
|
| 362 | - 'info_articles_un' => '1 article', |
|
| 363 | - 'info_auteurs_nombre' => 'auteur(s) :', |
|
| 364 | - 'info_authentification_ftp' => 'Authentification (par FTP).', |
|
| 365 | - 'info_breves_2' => 'brèves', |
|
| 366 | - 'info_breves_nb' => '@nb@ brèves', |
|
| 367 | - 'info_breves_un' => '1 brève', |
|
| 368 | - 'info_connexion_refusee' => 'Connexion refusée', |
|
| 369 | - 'info_contact_developpeur' => 'Contacte un développeur.', |
|
| 370 | - 'info_contenance' => 'Ce site contient :', |
|
| 371 | - 'info_contribution' => 'contributions', |
|
| 372 | - 'info_copyright' => '@spip@ est un logiciel libre distribué @lien_gpl@.', |
|
| 373 | - 'info_copyright_doc' => 'Pour plus d’informations, voir le site <a href="@spipnet@">@spipnet_affiche@</a>.', |
|
| 374 | - 'info_copyright_gpl' => 'sous licence GPL', |
|
| 375 | - 'info_cours_edition' => 'En cours de modification', |
|
| 376 | - 'info_creer_repertoire' => 'Crée un fichier ou un répertoire nommé :', |
|
| 377 | - 'info_creer_repertoire_2' => 'à l’intérieur du sous-répertoire <b>@repertoire@</b>, puis :', |
|
| 378 | - 'info_creer_vignette' => 'création automatique de la vignette', |
|
| 379 | - 'info_creerdansrubrique_non_autorise' => 'Tu n’as pas de droits suffisants pour créer un contenu dans cette rubrique', |
|
| 380 | - 'info_deplier' => 'Déplier', |
|
| 381 | - 'info_descriptif_nombre' => 'descriptif(s) :', |
|
| 382 | - 'info_description' => 'Description :', |
|
| 383 | - 'info_description_2' => 'Description :', |
|
| 384 | - 'info_dimension' => 'Dimensions :', |
|
| 385 | - 'info_documents_nb' => '@nb@ documents', |
|
| 386 | - 'info_documents_un' => '1 document', |
|
| 387 | - 'info_ecire_message_prive' => 'Écrire un message privé', |
|
| 388 | - 'info_email_invalide' => 'Adresse email invalide.', |
|
| 389 | - 'info_en_cours_validation' => 'Tes articles en cours de rédaction', |
|
| 390 | - 'info_en_ligne' => 'Actuellement en ligne :', |
|
| 391 | - 'info_envoyer_message_prive' => 'Envoyer un message privé à cet auteur', |
|
| 392 | - 'info_erreur_requete' => 'Erreur dans la requête :', |
|
| 393 | - 'info_erreur_squelette2' => 'Aucun squelette <b>@fichier@</b> n’est disponible...', |
|
| 394 | - 'info_erreur_systeme' => 'Erreur système (errno @errsys@)', |
|
| 395 | - 'info_erreur_systeme2' => 'Le disque dur est peut-être plein, ou la base de données endommagée.<br /> |
|
| 297 | + // I |
|
| 298 | + 'ical_texte_rss_articles' => 'Le fichier « backend » des articles de ce site se trouve à l’adresse :', |
|
| 299 | + 'ical_texte_rss_articles2' => 'Tu peux également obtenir des fichiers « backend » pour les articles de chaque rubrique du site :', |
|
| 300 | + 'ical_texte_rss_breves' => 'Il existe de plus un fichier contenant les brèves du site. En précisant un numéro de rubrique, tu obtiendras uniquement les brèves de cette rubrique.', |
|
| 301 | + 'icone_a_suivre' => 'À suivre', |
|
| 302 | + 'icone_admin_site' => 'Administration du site', |
|
| 303 | + 'icone_agenda' => 'Agenda', |
|
| 304 | + 'icone_aide_ligne' => 'Aide', |
|
| 305 | + 'icone_articles' => 'Articles', |
|
| 306 | + 'icone_auteurs' => 'Auteurs', |
|
| 307 | + 'icone_brouteur' => 'Navigation rapide', |
|
| 308 | + 'icone_configuration_site' => 'Configuration', |
|
| 309 | + 'icone_configurer_site' => 'Configurer ton site', |
|
| 310 | + 'icone_creer_nouvel_auteur' => 'Créer un nouvel auteur', |
|
| 311 | + 'icone_creer_rubrique' => 'Créer une rubrique', |
|
| 312 | + 'icone_creer_sous_rubrique' => 'Créer une sous-rubrique', |
|
| 313 | + 'icone_deconnecter' => 'Se déconnecter', |
|
| 314 | + 'icone_discussions' => 'Discussions', |
|
| 315 | + 'icone_doc_rubrique' => 'Documents des rubriques', |
|
| 316 | + 'icone_ecrire_article' => 'Écrire un nouvel article', |
|
| 317 | + 'icone_edition_site' => 'Édition', |
|
| 318 | + 'icone_gestion_langues' => 'Gestion des langues', |
|
| 319 | + 'icone_informations_personnelles' => 'Informations personnelles', |
|
| 320 | + 'icone_interface_complet' => 'interface complète', |
|
| 321 | + 'icone_interface_simple' => 'Interface simplifiée', |
|
| 322 | + 'icone_maintenance_site' => 'Maintenance du site', |
|
| 323 | + 'icone_messagerie_personnelle' => 'Messagerie personnelle', |
|
| 324 | + 'icone_repartition_debut' => 'Afficher la répartition depuis le début', |
|
| 325 | + 'icone_rubriques' => 'Rubriques', |
|
| 326 | + 'icone_sauver_site' => 'Sauvegarde du site', |
|
| 327 | + 'icone_site_entier' => 'Tout le site', |
|
| 328 | + 'icone_sites_references' => 'Sites référencés', |
|
| 329 | + 'icone_statistiques' => 'Statistiques du site', |
|
| 330 | + 'icone_suivi_activite' => 'Suivre la vie du site', |
|
| 331 | + 'icone_suivi_actualite' => 'Évolution du site', |
|
| 332 | + 'icone_suivi_pettions' => 'Suivre/gérer les pétitions', |
|
| 333 | + 'icone_suivi_revisions' => 'Modifications des articles', |
|
| 334 | + 'icone_supprimer_document' => 'Supprimer ce document', |
|
| 335 | + 'icone_supprimer_image' => 'Supprimer cette image', |
|
| 336 | + 'icone_tous_articles' => 'Tous tes articles', |
|
| 337 | + 'icone_tous_auteur' => 'Tous les auteurs', |
|
| 338 | + 'icone_tous_visiteur' => 'Tous les visiteurs', |
|
| 339 | + 'icone_visiter_site' => 'Voir le site public', |
|
| 340 | + 'icone_voir_en_ligne' => 'Voir en ligne', |
|
| 341 | + 'img_indisponible' => 'image indisponible', |
|
| 342 | + 'impossible' => 'impossible', |
|
| 343 | + 'info_a_suivre' => 'À SUIVRE »', |
|
| 344 | + 'info_acces_interdit' => 'Accès interdit', |
|
| 345 | + 'info_acces_refuse' => 'Accès refusé', |
|
| 346 | + 'info_action' => 'Action : @action@', |
|
| 347 | + 'info_administrer_rubriques' => 'Tu peux administrer cette rubrique et ses sous-rubriques', |
|
| 348 | + 'info_adresse_non_indiquee' => 'Tu n’as pas indiqué d’adresse à tester !', |
|
| 349 | + 'info_aide' => 'AIDE :', |
|
| 350 | + 'info_ajouter_mot' => 'Ajouter ce mot', |
|
| 351 | + 'info_annonce' => 'ANNONCE', |
|
| 352 | + 'info_annonces_generales' => 'Annonces générales :', |
|
| 353 | + 'info_article_propose' => 'Article proposé', |
|
| 354 | + 'info_article_publie' => 'Article publié', |
|
| 355 | + 'info_article_redaction' => 'Article en cours de rédaction', |
|
| 356 | + 'info_article_refuse' => 'Article refusé', |
|
| 357 | + 'info_article_supprime' => 'Article supprimé', |
|
| 358 | + 'info_articles' => 'Articles', |
|
| 359 | + 'info_articles_a_valider' => 'Les articles à valider', |
|
| 360 | + 'info_articles_nb' => '@nb@ articles', |
|
| 361 | + 'info_articles_proposes' => 'Articles proposés', |
|
| 362 | + 'info_articles_un' => '1 article', |
|
| 363 | + 'info_auteurs_nombre' => 'auteur(s) :', |
|
| 364 | + 'info_authentification_ftp' => 'Authentification (par FTP).', |
|
| 365 | + 'info_breves_2' => 'brèves', |
|
| 366 | + 'info_breves_nb' => '@nb@ brèves', |
|
| 367 | + 'info_breves_un' => '1 brève', |
|
| 368 | + 'info_connexion_refusee' => 'Connexion refusée', |
|
| 369 | + 'info_contact_developpeur' => 'Contacte un développeur.', |
|
| 370 | + 'info_contenance' => 'Ce site contient :', |
|
| 371 | + 'info_contribution' => 'contributions', |
|
| 372 | + 'info_copyright' => '@spip@ est un logiciel libre distribué @lien_gpl@.', |
|
| 373 | + 'info_copyright_doc' => 'Pour plus d’informations, voir le site <a href="@spipnet@">@spipnet_affiche@</a>.', |
|
| 374 | + 'info_copyright_gpl' => 'sous licence GPL', |
|
| 375 | + 'info_cours_edition' => 'En cours de modification', |
|
| 376 | + 'info_creer_repertoire' => 'Crée un fichier ou un répertoire nommé :', |
|
| 377 | + 'info_creer_repertoire_2' => 'à l’intérieur du sous-répertoire <b>@repertoire@</b>, puis :', |
|
| 378 | + 'info_creer_vignette' => 'création automatique de la vignette', |
|
| 379 | + 'info_creerdansrubrique_non_autorise' => 'Tu n’as pas de droits suffisants pour créer un contenu dans cette rubrique', |
|
| 380 | + 'info_deplier' => 'Déplier', |
|
| 381 | + 'info_descriptif_nombre' => 'descriptif(s) :', |
|
| 382 | + 'info_description' => 'Description :', |
|
| 383 | + 'info_description_2' => 'Description :', |
|
| 384 | + 'info_dimension' => 'Dimensions :', |
|
| 385 | + 'info_documents_nb' => '@nb@ documents', |
|
| 386 | + 'info_documents_un' => '1 document', |
|
| 387 | + 'info_ecire_message_prive' => 'Écrire un message privé', |
|
| 388 | + 'info_email_invalide' => 'Adresse email invalide.', |
|
| 389 | + 'info_en_cours_validation' => 'Tes articles en cours de rédaction', |
|
| 390 | + 'info_en_ligne' => 'Actuellement en ligne :', |
|
| 391 | + 'info_envoyer_message_prive' => 'Envoyer un message privé à cet auteur', |
|
| 392 | + 'info_erreur_requete' => 'Erreur dans la requête :', |
|
| 393 | + 'info_erreur_squelette2' => 'Aucun squelette <b>@fichier@</b> n’est disponible...', |
|
| 394 | + 'info_erreur_systeme' => 'Erreur système (errno @errsys@)', |
|
| 395 | + 'info_erreur_systeme2' => 'Le disque dur est peut-être plein, ou la base de données endommagée.<br /> |
|
| 396 | 396 | <span style="color:red;">Essaie de <a href=\'@script@\'>réparer la base</a>, ou contacte ton hébergeur.</span>', |
| 397 | - 'info_fini' => 'C’est fini !', |
|
| 398 | - 'info_format_image' => 'Formats d’images pouvant être utilisées pour créer des vignettes : @gd_formats@.', |
|
| 399 | - 'info_format_non_defini' => 'format non défini', |
|
| 400 | - 'info_grand_ecran' => 'Grand écran', |
|
| 401 | - 'info_image_aide' => 'AIDE', |
|
| 402 | - 'info_image_process_titre' => 'Comment faire de nouveaux signets', |
|
| 403 | - 'info_impossible_lire_page' => '<b>Erreur !</b> Impossible de lire la page <tt><html>@test_proxy@</html></tt> à travers le proxy ', |
|
| 404 | - 'info_installation_systeme_publication' => 'Installation du système de publication...', |
|
| 405 | - 'info_installer_documents' => 'Tu peux installer automatiquement tous les documents contenus dans le dossier @upload@.', |
|
| 406 | - 'info_installer_ftp' => 'En tant qu’administrateur, tu peux installer (par FTP) des fichiers dans le dossier @upload@ pour ensuite les sélectionner directement ici.', |
|
| 407 | - 'info_installer_images' => 'Tu peux installer des images aux formats JPEG, GIF et PNG.', |
|
| 408 | - 'info_installer_images_dossier' => 'Installer des images dans le dossier @upload@ pour pouvoir les sélectionner ici.', |
|
| 409 | - 'info_interface_complete' => 'interface complète', |
|
| 410 | - 'info_interface_simple' => 'Interface simplifiée', |
|
| 411 | - 'info_joindre_document_article' => 'Tu peux joindre à cet article des documents de type', |
|
| 412 | - 'info_joindre_document_rubrique' => 'Tu peux ajouter dans cette rubrique des documents de type', |
|
| 413 | - 'info_joindre_documents_article' => 'Tu peux joindre à ton article des documents de type :', |
|
| 414 | - 'info_l_article' => 'l’article', |
|
| 415 | - 'info_la_breve' => 'la brève', |
|
| 416 | - 'info_la_rubrique' => 'la rubrique', |
|
| 417 | - 'info_langue_principale' => 'Langue principale du site', |
|
| 418 | - 'info_largeur_vignette' => '@largeur_vignette@ × @hauteur_vignette@ pixels', |
|
| 419 | - 'info_les_auteurs_1' => 'par @les_auteurs@', |
|
| 420 | - 'info_logo_format_interdit' => 'Seuls les logos aux formats @formats@ sont autorisés.', |
|
| 421 | - 'info_logo_max_poids' => 'Les logos doivent obligatoirement faire moins de @maxi@ (ce fichier fait @actuel@).', |
|
| 422 | - 'info_mail_fournisseur' => '[email protected]', |
|
| 423 | - 'info_message_2' => 'MESSAGE', |
|
| 424 | - 'info_message_supprime' => 'MESSAGE SUPPRIMÉ', |
|
| 425 | - 'info_messages_nb' => '@nb@ messages', |
|
| 426 | - 'info_messages_un' => '1 message', |
|
| 427 | - 'info_mise_en_ligne' => 'Date de mise en ligne :', |
|
| 428 | - 'info_modification_parametres_securite' => 'modifications des paramètres de sécurité', |
|
| 429 | - 'info_mois_courant' => 'Dans le courant du mois :', |
|
| 430 | - 'info_mot_cle_ajoute' => 'Le mot-clé suivant a été ajouté à', |
|
| 431 | - 'info_multi_herit' => 'Langue par défaut', |
|
| 432 | - 'info_multi_langues_soulignees' => 'Les <u>langues soulignées</u> bénéficient d’une traduction totale ou partielle des textes de l’interface. Si tu sélectionnes ces langues, de nombreux éléments du site public (dates, formulaires) seront automatiquement traduits. Pour les langues non soulignées, ces éléments apparaîtront dans la langue principale du site.', |
|
| 433 | - 'info_multilinguisme' => 'Multilinguisme', |
|
| 434 | - 'info_nom_non_utilisateurs_connectes' => 'Ton nom n’apparaît pas dans la liste des utilisateurs connectés.', |
|
| 435 | - 'info_nom_utilisateurs_connectes' => 'Ton nom apparaît dans la liste des utilisateurs connectés.', |
|
| 436 | - 'info_nombre_en_ligne' => 'Actuellement en ligne :', |
|
| 437 | - 'info_non_resultat' => 'Aucun résultat pour "@cherche_mot@"', |
|
| 438 | - 'info_non_utilisation_messagerie' => 'Tu n’utilise pas la messagerie interne de ce site.', |
|
| 439 | - 'info_nouveau_message' => 'TU AS UN NOUVEAU MESSAGE', |
|
| 440 | - 'info_nouveaux_messages' => 'TU AS @total_messages@ NOUVEAUX MESSAGES', |
|
| 441 | - 'info_numero_abbreviation' => 'N° ', |
|
| 442 | - 'info_obligatoire' => 'Cette information est obligatoire', |
|
| 443 | - 'info_page_actuelle' => 'Page actuelle', |
|
| 444 | - 'info_pense_bete' => 'PENSE-BÊTE', |
|
| 445 | - 'info_petit_ecran' => 'Petit écran', |
|
| 446 | - 'info_petition_close' => 'Pétition close', |
|
| 447 | - 'info_pixels' => 'pixels', |
|
| 448 | - 'info_plusieurs_mots_trouves' => 'Plusieurs mots-clés trouvés pour "@cherche_mot@" :', |
|
| 449 | - 'info_portfolio_automatique' => 'Portfolio automatique :', |
|
| 450 | - 'info_premier_resultat' => '[@debut_limit@ premiers résultats sur @total@]', |
|
| 451 | - 'info_premier_resultat_sur' => '[@debut_limit@ premiers résultats sur @total@]', |
|
| 452 | - 'info_propose_1' => '[@nom_site_spip@] Propose : @titre@', |
|
| 453 | - 'info_propose_2' => 'Article proposé |
|
| 397 | + 'info_fini' => 'C’est fini !', |
|
| 398 | + 'info_format_image' => 'Formats d’images pouvant être utilisées pour créer des vignettes : @gd_formats@.', |
|
| 399 | + 'info_format_non_defini' => 'format non défini', |
|
| 400 | + 'info_grand_ecran' => 'Grand écran', |
|
| 401 | + 'info_image_aide' => 'AIDE', |
|
| 402 | + 'info_image_process_titre' => 'Comment faire de nouveaux signets', |
|
| 403 | + 'info_impossible_lire_page' => '<b>Erreur !</b> Impossible de lire la page <tt><html>@test_proxy@</html></tt> à travers le proxy ', |
|
| 404 | + 'info_installation_systeme_publication' => 'Installation du système de publication...', |
|
| 405 | + 'info_installer_documents' => 'Tu peux installer automatiquement tous les documents contenus dans le dossier @upload@.', |
|
| 406 | + 'info_installer_ftp' => 'En tant qu’administrateur, tu peux installer (par FTP) des fichiers dans le dossier @upload@ pour ensuite les sélectionner directement ici.', |
|
| 407 | + 'info_installer_images' => 'Tu peux installer des images aux formats JPEG, GIF et PNG.', |
|
| 408 | + 'info_installer_images_dossier' => 'Installer des images dans le dossier @upload@ pour pouvoir les sélectionner ici.', |
|
| 409 | + 'info_interface_complete' => 'interface complète', |
|
| 410 | + 'info_interface_simple' => 'Interface simplifiée', |
|
| 411 | + 'info_joindre_document_article' => 'Tu peux joindre à cet article des documents de type', |
|
| 412 | + 'info_joindre_document_rubrique' => 'Tu peux ajouter dans cette rubrique des documents de type', |
|
| 413 | + 'info_joindre_documents_article' => 'Tu peux joindre à ton article des documents de type :', |
|
| 414 | + 'info_l_article' => 'l’article', |
|
| 415 | + 'info_la_breve' => 'la brève', |
|
| 416 | + 'info_la_rubrique' => 'la rubrique', |
|
| 417 | + 'info_langue_principale' => 'Langue principale du site', |
|
| 418 | + 'info_largeur_vignette' => '@largeur_vignette@ × @hauteur_vignette@ pixels', |
|
| 419 | + 'info_les_auteurs_1' => 'par @les_auteurs@', |
|
| 420 | + 'info_logo_format_interdit' => 'Seuls les logos aux formats @formats@ sont autorisés.', |
|
| 421 | + 'info_logo_max_poids' => 'Les logos doivent obligatoirement faire moins de @maxi@ (ce fichier fait @actuel@).', |
|
| 422 | + 'info_mail_fournisseur' => '[email protected]', |
|
| 423 | + 'info_message_2' => 'MESSAGE', |
|
| 424 | + 'info_message_supprime' => 'MESSAGE SUPPRIMÉ', |
|
| 425 | + 'info_messages_nb' => '@nb@ messages', |
|
| 426 | + 'info_messages_un' => '1 message', |
|
| 427 | + 'info_mise_en_ligne' => 'Date de mise en ligne :', |
|
| 428 | + 'info_modification_parametres_securite' => 'modifications des paramètres de sécurité', |
|
| 429 | + 'info_mois_courant' => 'Dans le courant du mois :', |
|
| 430 | + 'info_mot_cle_ajoute' => 'Le mot-clé suivant a été ajouté à', |
|
| 431 | + 'info_multi_herit' => 'Langue par défaut', |
|
| 432 | + 'info_multi_langues_soulignees' => 'Les <u>langues soulignées</u> bénéficient d’une traduction totale ou partielle des textes de l’interface. Si tu sélectionnes ces langues, de nombreux éléments du site public (dates, formulaires) seront automatiquement traduits. Pour les langues non soulignées, ces éléments apparaîtront dans la langue principale du site.', |
|
| 433 | + 'info_multilinguisme' => 'Multilinguisme', |
|
| 434 | + 'info_nom_non_utilisateurs_connectes' => 'Ton nom n’apparaît pas dans la liste des utilisateurs connectés.', |
|
| 435 | + 'info_nom_utilisateurs_connectes' => 'Ton nom apparaît dans la liste des utilisateurs connectés.', |
|
| 436 | + 'info_nombre_en_ligne' => 'Actuellement en ligne :', |
|
| 437 | + 'info_non_resultat' => 'Aucun résultat pour "@cherche_mot@"', |
|
| 438 | + 'info_non_utilisation_messagerie' => 'Tu n’utilise pas la messagerie interne de ce site.', |
|
| 439 | + 'info_nouveau_message' => 'TU AS UN NOUVEAU MESSAGE', |
|
| 440 | + 'info_nouveaux_messages' => 'TU AS @total_messages@ NOUVEAUX MESSAGES', |
|
| 441 | + 'info_numero_abbreviation' => 'N° ', |
|
| 442 | + 'info_obligatoire' => 'Cette information est obligatoire', |
|
| 443 | + 'info_page_actuelle' => 'Page actuelle', |
|
| 444 | + 'info_pense_bete' => 'PENSE-BÊTE', |
|
| 445 | + 'info_petit_ecran' => 'Petit écran', |
|
| 446 | + 'info_petition_close' => 'Pétition close', |
|
| 447 | + 'info_pixels' => 'pixels', |
|
| 448 | + 'info_plusieurs_mots_trouves' => 'Plusieurs mots-clés trouvés pour "@cherche_mot@" :', |
|
| 449 | + 'info_portfolio_automatique' => 'Portfolio automatique :', |
|
| 450 | + 'info_premier_resultat' => '[@debut_limit@ premiers résultats sur @total@]', |
|
| 451 | + 'info_premier_resultat_sur' => '[@debut_limit@ premiers résultats sur @total@]', |
|
| 452 | + 'info_propose_1' => '[@nom_site_spip@] Propose : @titre@', |
|
| 453 | + 'info_propose_2' => 'Article proposé |
|
| 454 | 454 | ---------------', |
| 455 | - 'info_propose_3' => 'L’article "@titre@" est proposé à la publication.', |
|
| 456 | - 'info_propose_4' => 'Tu es invité à venir le consulter et à donner ton opinion', |
|
| 457 | - 'info_propose_5' => 'dans le forum qui lui est attaché. Il est disponible à l’adresse :', |
|
| 458 | - 'info_publie_01' => 'L’article "@titre@" a été validé par @connect_nom@.', |
|
| 459 | - 'info_publie_1' => '[@nom_site_spip@] PUBLIE : @titre@', |
|
| 460 | - 'info_publie_2' => 'Article publié |
|
| 455 | + 'info_propose_3' => 'L’article "@titre@" est proposé à la publication.', |
|
| 456 | + 'info_propose_4' => 'Tu es invité à venir le consulter et à donner ton opinion', |
|
| 457 | + 'info_propose_5' => 'dans le forum qui lui est attaché. Il est disponible à l’adresse :', |
|
| 458 | + 'info_publie_01' => 'L’article "@titre@" a été validé par @connect_nom@.', |
|
| 459 | + 'info_publie_1' => '[@nom_site_spip@] PUBLIE : @titre@', |
|
| 460 | + 'info_publie_2' => 'Article publié |
|
| 461 | 461 | --------------', |
| 462 | - 'info_rechercher' => 'Rechercher', |
|
| 463 | - 'info_rechercher_02' => 'Rechercher :', |
|
| 464 | - 'info_remplacer_vignette' => 'Remplacer la vignette par défaut par un logo personnalisé :', |
|
| 465 | - 'info_rubriques_nb' => '@nb@ rubriques', |
|
| 466 | - 'info_rubriques_un' => '1 rubrique', |
|
| 467 | - 'info_sans_titre_2' => 'sans titre', |
|
| 468 | - 'info_selectionner_fichier' => 'Tu peux sélectionner un fichier du dossier @upload@', |
|
| 469 | - 'info_selectionner_fichier_2' => 'Sélectionner un fichier :', |
|
| 470 | - 'info_sites_nb' => '@nb@ sites', |
|
| 471 | - 'info_sites_un' => '1 site', |
|
| 472 | - 'info_supprimer_vignette' => 'supprimer la vignette', |
|
| 473 | - 'info_symbole_bleu' => 'Le symbole <b>bleu</b> indique un <b>pense-bête</b> : c’est-à-dire un message à ton usage personnel.', |
|
| 474 | - 'info_symbole_jaune' => 'Le symbole <b>jaune</b> indique une <b>annonce à tous les rédacteurs</b> : modifiable par tous les administrateurs, et visible par tous les rédacteurs.', |
|
| 475 | - 'info_symbole_vert' => 'Le symbole <b>vert</b> indique les <b>messages échangés avec d’autres utilisateurs</b> du site.', |
|
| 476 | - 'info_telecharger_nouveau_logo' => 'Télécharger un nouveau logo :', |
|
| 477 | - 'info_telecharger_ordinateur' => 'Télécharger depuis ton ordinateur :', |
|
| 478 | - 'info_tous_resultats_enregistres' => '[tous les résultats sont enregistrés]', |
|
| 479 | - 'info_tout_afficher' => 'Tout afficher', |
|
| 480 | - 'info_travaux_texte' => 'Ce site n’est pas encore configuré. Reviens plus tard...', |
|
| 481 | - 'info_travaux_titre' => 'Site en travaux', |
|
| 482 | - 'info_trop_resultat' => 'Trop de résultats pour "@cherche_mot@" ; affine la recherche.', |
|
| 483 | - 'info_utilisation_messagerie_interne' => 'Tu utilises la messagerie interne de ce site.', |
|
| 484 | - 'info_valider_lien' => 'valider ce lien', |
|
| 485 | - 'info_verifier_image' => ', vérifie que tes images ont été transférées correctement.', |
|
| 486 | - 'info_vignette_defaut' => 'Vignette par défaut', |
|
| 487 | - 'info_vignette_personnalisee' => 'Vignette personnalisée', |
|
| 488 | - 'info_visite' => 'visite :', |
|
| 489 | - 'info_vos_rendez_vous' => 'Tes rendez-vous à venir', |
|
| 490 | - 'infos_vos_pense_bete' => 'Tes pense-bêtes', |
|
| 462 | + 'info_rechercher' => 'Rechercher', |
|
| 463 | + 'info_rechercher_02' => 'Rechercher :', |
|
| 464 | + 'info_remplacer_vignette' => 'Remplacer la vignette par défaut par un logo personnalisé :', |
|
| 465 | + 'info_rubriques_nb' => '@nb@ rubriques', |
|
| 466 | + 'info_rubriques_un' => '1 rubrique', |
|
| 467 | + 'info_sans_titre_2' => 'sans titre', |
|
| 468 | + 'info_selectionner_fichier' => 'Tu peux sélectionner un fichier du dossier @upload@', |
|
| 469 | + 'info_selectionner_fichier_2' => 'Sélectionner un fichier :', |
|
| 470 | + 'info_sites_nb' => '@nb@ sites', |
|
| 471 | + 'info_sites_un' => '1 site', |
|
| 472 | + 'info_supprimer_vignette' => 'supprimer la vignette', |
|
| 473 | + 'info_symbole_bleu' => 'Le symbole <b>bleu</b> indique un <b>pense-bête</b> : c’est-à-dire un message à ton usage personnel.', |
|
| 474 | + 'info_symbole_jaune' => 'Le symbole <b>jaune</b> indique une <b>annonce à tous les rédacteurs</b> : modifiable par tous les administrateurs, et visible par tous les rédacteurs.', |
|
| 475 | + 'info_symbole_vert' => 'Le symbole <b>vert</b> indique les <b>messages échangés avec d’autres utilisateurs</b> du site.', |
|
| 476 | + 'info_telecharger_nouveau_logo' => 'Télécharger un nouveau logo :', |
|
| 477 | + 'info_telecharger_ordinateur' => 'Télécharger depuis ton ordinateur :', |
|
| 478 | + 'info_tous_resultats_enregistres' => '[tous les résultats sont enregistrés]', |
|
| 479 | + 'info_tout_afficher' => 'Tout afficher', |
|
| 480 | + 'info_travaux_texte' => 'Ce site n’est pas encore configuré. Reviens plus tard...', |
|
| 481 | + 'info_travaux_titre' => 'Site en travaux', |
|
| 482 | + 'info_trop_resultat' => 'Trop de résultats pour "@cherche_mot@" ; affine la recherche.', |
|
| 483 | + 'info_utilisation_messagerie_interne' => 'Tu utilises la messagerie interne de ce site.', |
|
| 484 | + 'info_valider_lien' => 'valider ce lien', |
|
| 485 | + 'info_verifier_image' => ', vérifie que tes images ont été transférées correctement.', |
|
| 486 | + 'info_vignette_defaut' => 'Vignette par défaut', |
|
| 487 | + 'info_vignette_personnalisee' => 'Vignette personnalisée', |
|
| 488 | + 'info_visite' => 'visite :', |
|
| 489 | + 'info_vos_rendez_vous' => 'Tes rendez-vous à venir', |
|
| 490 | + 'infos_vos_pense_bete' => 'Tes pense-bêtes', |
|
| 491 | 491 | |
| 492 | - // L |
|
| 493 | - 'label_ajout_id_rapide' => 'Ajout rapide', |
|
| 494 | - 'label_poids_fichier' => 'Taille', |
|
| 495 | - 'label_ponctuer' => '@label@ :', |
|
| 496 | - 'lien_afficher_icones_seuls' => 'Afficher uniquement les icones', |
|
| 497 | - 'lien_afficher_texte_icones' => 'Afficher les icones et le texte', |
|
| 498 | - 'lien_afficher_texte_seul' => 'Afficher uniquement le texte', |
|
| 499 | - 'lien_aller_a_la_derniere_page' => 'Aller à la dernière page', |
|
| 500 | - 'lien_aller_a_la_page_nb' => 'Aller à la page @nb@', |
|
| 501 | - 'lien_aller_a_la_page_precedente' => 'Aller à la page précédente', |
|
| 502 | - 'lien_aller_a_la_page_suivante' => 'Aller à la page suivante', |
|
| 503 | - 'lien_aller_a_la_premiere_page' => 'Aller à la première page', |
|
| 504 | - 'lien_liberer' => 'libérer', |
|
| 505 | - 'lien_liberer_tous' => 'Tout libérer', |
|
| 506 | - 'lien_nouvea_pense_bete' => 'NOUVEAU PENSE-BÊTE', |
|
| 507 | - 'lien_nouveau_message' => 'NOUVEAU MESSAGE', |
|
| 508 | - 'lien_nouvelle_annonce' => 'NOUVELLE ANNONCE', |
|
| 509 | - 'lien_petitions' => 'PÉTITION', |
|
| 510 | - 'lien_popularite' => 'popularité : @popularite@%', |
|
| 511 | - 'lien_racine_site' => 'RACINE DU SITE', |
|
| 512 | - 'lien_reessayer' => 'réessayer', |
|
| 513 | - 'lien_repondre_message' => 'Répondre à ce message', |
|
| 514 | - 'lien_supprimer' => 'supprimer', |
|
| 515 | - 'lien_tout_afficher' => 'Tout afficher', |
|
| 516 | - 'lien_visite_site' => 'visiter ce site', |
|
| 517 | - 'lien_visites' => '@visites@ visites', |
|
| 518 | - 'lien_voir_auteur' => 'Voir cet auteur', |
|
| 519 | - 'ligne' => 'Ligne', |
|
| 520 | - 'login' => 'Connexion', |
|
| 521 | - 'login_acces_prive' => 'accès à l’espace privé', |
|
| 522 | - 'login_autre_identifiant' => 'se connecter sous un autre identifiant', |
|
| 523 | - 'login_cookie_accepte' => 'Régle ton navigateur pour qu’il les accepte (au moins pour ce site).', |
|
| 524 | - 'login_cookie_oblige' => 'Pour t’identifier de façon sûre sur ce site, tu dois accepter les cookies.', |
|
| 525 | - 'login_deconnexion_ok' => 'Déconnexion effectuée.', |
|
| 526 | - 'login_erreur_pass' => 'Erreur de mot de passe.', |
|
| 527 | - 'login_espace_prive' => 'espace privé', |
|
| 528 | - 'login_identifiant_inconnu' => 'L’identifiant « @login@ » est inconnu.', |
|
| 529 | - 'login_login' => 'Login :', |
|
| 530 | - 'login_login2' => 'Login ou adresse email@circ@ :', |
|
| 531 | - 'login_login_pass_incorrect' => '(Login ou mot de passe incorrect.)', |
|
| 532 | - 'login_motpasseoublie' => 'mot de passe oublié ?', |
|
| 533 | - 'login_non_securise' => 'Attention, ce formulaire n’est pas sécurisé. |
|
| 492 | + // L |
|
| 493 | + 'label_ajout_id_rapide' => 'Ajout rapide', |
|
| 494 | + 'label_poids_fichier' => 'Taille', |
|
| 495 | + 'label_ponctuer' => '@label@ :', |
|
| 496 | + 'lien_afficher_icones_seuls' => 'Afficher uniquement les icones', |
|
| 497 | + 'lien_afficher_texte_icones' => 'Afficher les icones et le texte', |
|
| 498 | + 'lien_afficher_texte_seul' => 'Afficher uniquement le texte', |
|
| 499 | + 'lien_aller_a_la_derniere_page' => 'Aller à la dernière page', |
|
| 500 | + 'lien_aller_a_la_page_nb' => 'Aller à la page @nb@', |
|
| 501 | + 'lien_aller_a_la_page_precedente' => 'Aller à la page précédente', |
|
| 502 | + 'lien_aller_a_la_page_suivante' => 'Aller à la page suivante', |
|
| 503 | + 'lien_aller_a_la_premiere_page' => 'Aller à la première page', |
|
| 504 | + 'lien_liberer' => 'libérer', |
|
| 505 | + 'lien_liberer_tous' => 'Tout libérer', |
|
| 506 | + 'lien_nouvea_pense_bete' => 'NOUVEAU PENSE-BÊTE', |
|
| 507 | + 'lien_nouveau_message' => 'NOUVEAU MESSAGE', |
|
| 508 | + 'lien_nouvelle_annonce' => 'NOUVELLE ANNONCE', |
|
| 509 | + 'lien_petitions' => 'PÉTITION', |
|
| 510 | + 'lien_popularite' => 'popularité : @popularite@%', |
|
| 511 | + 'lien_racine_site' => 'RACINE DU SITE', |
|
| 512 | + 'lien_reessayer' => 'réessayer', |
|
| 513 | + 'lien_repondre_message' => 'Répondre à ce message', |
|
| 514 | + 'lien_supprimer' => 'supprimer', |
|
| 515 | + 'lien_tout_afficher' => 'Tout afficher', |
|
| 516 | + 'lien_visite_site' => 'visiter ce site', |
|
| 517 | + 'lien_visites' => '@visites@ visites', |
|
| 518 | + 'lien_voir_auteur' => 'Voir cet auteur', |
|
| 519 | + 'ligne' => 'Ligne', |
|
| 520 | + 'login' => 'Connexion', |
|
| 521 | + 'login_acces_prive' => 'accès à l’espace privé', |
|
| 522 | + 'login_autre_identifiant' => 'se connecter sous un autre identifiant', |
|
| 523 | + 'login_cookie_accepte' => 'Régle ton navigateur pour qu’il les accepte (au moins pour ce site).', |
|
| 524 | + 'login_cookie_oblige' => 'Pour t’identifier de façon sûre sur ce site, tu dois accepter les cookies.', |
|
| 525 | + 'login_deconnexion_ok' => 'Déconnexion effectuée.', |
|
| 526 | + 'login_erreur_pass' => 'Erreur de mot de passe.', |
|
| 527 | + 'login_espace_prive' => 'espace privé', |
|
| 528 | + 'login_identifiant_inconnu' => 'L’identifiant « @login@ » est inconnu.', |
|
| 529 | + 'login_login' => 'Login :', |
|
| 530 | + 'login_login2' => 'Login ou adresse email@circ@ :', |
|
| 531 | + 'login_login_pass_incorrect' => '(Login ou mot de passe incorrect.)', |
|
| 532 | + 'login_motpasseoublie' => 'mot de passe oublié ?', |
|
| 533 | + 'login_non_securise' => 'Attention, ce formulaire n’est pas sécurisé. |
|
| 534 | 534 | Si tu ne veux pas que ton mot de passe puisse être |
| 535 | 535 | intercepté sur le réseau, active Javascript |
| 536 | 536 | dans ton navigateur et', |
| 537 | - 'login_nouvelle_tentative' => 'Nouvelle tentative', |
|
| 538 | - 'login_par_ici' => 'Tu es enregistré... par ici...', |
|
| 539 | - 'login_pass2' => 'Mot de passe :', |
|
| 540 | - 'login_preferez_refuser' => '<b>Si tu préfére refuser les cookies</b>, une autre méthode de connexion (moins sécurisée) est à ta disposition :', |
|
| 541 | - 'login_recharger' => 'recharger cette page', |
|
| 542 | - 'login_rester_identifie' => 'Se souvenir de moi', |
|
| 543 | - 'login_retour_public' => 'Retour au site public', |
|
| 544 | - 'login_retour_site' => 'Retour au site public', |
|
| 545 | - 'login_retoursitepublic' => 'retour au site public', |
|
| 546 | - 'login_sans_cookie' => 'Identification sans cookie', |
|
| 547 | - 'login_securise' => 'Login sécurisé', |
|
| 548 | - 'login_sinscrire' => 'S’inscrire', |
|
| 549 | - 'login_test_navigateur' => 'test navigateur/reconnexion', |
|
| 550 | - 'login_verifiez_navigateur' => '(Vérifie toutefois que ton navigateur n’a pas mémorisé ton mot de passe...)', |
|
| 537 | + 'login_nouvelle_tentative' => 'Nouvelle tentative', |
|
| 538 | + 'login_par_ici' => 'Tu es enregistré... par ici...', |
|
| 539 | + 'login_pass2' => 'Mot de passe :', |
|
| 540 | + 'login_preferez_refuser' => '<b>Si tu préfére refuser les cookies</b>, une autre méthode de connexion (moins sécurisée) est à ta disposition :', |
|
| 541 | + 'login_recharger' => 'recharger cette page', |
|
| 542 | + 'login_rester_identifie' => 'Se souvenir de moi', |
|
| 543 | + 'login_retour_public' => 'Retour au site public', |
|
| 544 | + 'login_retour_site' => 'Retour au site public', |
|
| 545 | + 'login_retoursitepublic' => 'retour au site public', |
|
| 546 | + 'login_sans_cookie' => 'Identification sans cookie', |
|
| 547 | + 'login_securise' => 'Login sécurisé', |
|
| 548 | + 'login_sinscrire' => 'S’inscrire', |
|
| 549 | + 'login_test_navigateur' => 'test navigateur/reconnexion', |
|
| 550 | + 'login_verifiez_navigateur' => '(Vérifie toutefois que ton navigateur n’a pas mémorisé ton mot de passe...)', |
|
| 551 | 551 | |
| 552 | - // M |
|
| 553 | - 'masquer_colonne' => 'Masquer cette colonne', |
|
| 554 | - 'masquer_trad' => 'masquer les traductions', |
|
| 555 | - 'message_nouveaux_identifiants_echec' => 'Impossible de générer de nouveaux identifiants.', |
|
| 556 | - 'message_nouveaux_identifiants_echec_envoi' => 'Les nouveaux identifiants de connexion n’ont pas pu être envoyés.', |
|
| 557 | - 'message_nouveaux_identifiants_ok' => 'Les nouveaux identifiants de connexion ont été envoyés à @email@.', |
|
| 558 | - 'module_fichiers_langues' => 'Fichiers de langue', |
|
| 552 | + // M |
|
| 553 | + 'masquer_colonne' => 'Masquer cette colonne', |
|
| 554 | + 'masquer_trad' => 'masquer les traductions', |
|
| 555 | + 'message_nouveaux_identifiants_echec' => 'Impossible de générer de nouveaux identifiants.', |
|
| 556 | + 'message_nouveaux_identifiants_echec_envoi' => 'Les nouveaux identifiants de connexion n’ont pas pu être envoyés.', |
|
| 557 | + 'message_nouveaux_identifiants_ok' => 'Les nouveaux identifiants de connexion ont été envoyés à @email@.', |
|
| 558 | + 'module_fichiers_langues' => 'Fichiers de langue', |
|
| 559 | 559 | |
| 560 | - // N |
|
| 561 | - 'navigateur_pas_redirige' => 'Si votre navigateur n’est pas redirigé, cliquez ici pour continuer.', |
|
| 562 | - 'numero' => 'Numéro', |
|
| 560 | + // N |
|
| 561 | + 'navigateur_pas_redirige' => 'Si votre navigateur n’est pas redirigé, cliquez ici pour continuer.', |
|
| 562 | + 'numero' => 'Numéro', |
|
| 563 | 563 | |
| 564 | - // O |
|
| 565 | - 'occurence' => 'Occurence', |
|
| 566 | - 'onglet_affacer_base' => 'Effacer la base', |
|
| 567 | - 'onglet_auteur' => 'L’auteur', |
|
| 568 | - 'onglet_contenu_site' => 'Contenu du site', |
|
| 569 | - 'onglet_evolution_visite_mod' => 'Évolution', |
|
| 570 | - 'onglet_fonctions_avances' => 'Fonctions avancées', |
|
| 571 | - 'onglet_informations_personnelles' => 'Informations personnelles', |
|
| 572 | - 'onglet_interactivite' => 'Interactivité', |
|
| 573 | - 'onglet_messagerie' => 'Messagerie', |
|
| 574 | - 'onglet_repartition_rubrique' => 'Répartition par rubriques', |
|
| 575 | - 'onglet_save_restaur_base' => 'Sauvegarder/restaurer la base', |
|
| 576 | - 'onglet_vider_cache' => 'Vider le cache', |
|
| 564 | + // O |
|
| 565 | + 'occurence' => 'Occurence', |
|
| 566 | + 'onglet_affacer_base' => 'Effacer la base', |
|
| 567 | + 'onglet_auteur' => 'L’auteur', |
|
| 568 | + 'onglet_contenu_site' => 'Contenu du site', |
|
| 569 | + 'onglet_evolution_visite_mod' => 'Évolution', |
|
| 570 | + 'onglet_fonctions_avances' => 'Fonctions avancées', |
|
| 571 | + 'onglet_informations_personnelles' => 'Informations personnelles', |
|
| 572 | + 'onglet_interactivite' => 'Interactivité', |
|
| 573 | + 'onglet_messagerie' => 'Messagerie', |
|
| 574 | + 'onglet_repartition_rubrique' => 'Répartition par rubriques', |
|
| 575 | + 'onglet_save_restaur_base' => 'Sauvegarder/restaurer la base', |
|
| 576 | + 'onglet_vider_cache' => 'Vider le cache', |
|
| 577 | 577 | |
| 578 | - // P |
|
| 579 | - 'pass_choix_pass' => 'Choisis ton nouveau mot de passe :', |
|
| 580 | - 'pass_erreur' => 'Erreur', |
|
| 581 | - 'pass_erreur_acces_refuse' => '<b>Erreur :</b> tu n’as plus accès à ce site.', |
|
| 582 | - 'pass_erreur_code_inconnu' => '<b>Erreur :</b> ce code ne correspond à aucun des visiteurs ayant accès à ce site.', |
|
| 583 | - 'pass_erreur_non_enregistre' => '<b>Erreur :</b> l’adresse <tt>@email_oubli@</tt> n’est pas enregistrée sur ce site.', |
|
| 584 | - 'pass_erreur_non_valide' => '<b>Erreur :</b> cet email <tt>@email_oubli@</tt> n’est pas valide !', |
|
| 585 | - 'pass_erreur_probleme_technique' => '<b>Erreur :</b> à cause d’un problème technique, l’email ne peut pas être envoyé.', |
|
| 586 | - 'pass_espace_prive_bla' => 'L’espace privé de ce site est ouvert aux |
|
| 578 | + // P |
|
| 579 | + 'pass_choix_pass' => 'Choisis ton nouveau mot de passe :', |
|
| 580 | + 'pass_erreur' => 'Erreur', |
|
| 581 | + 'pass_erreur_acces_refuse' => '<b>Erreur :</b> tu n’as plus accès à ce site.', |
|
| 582 | + 'pass_erreur_code_inconnu' => '<b>Erreur :</b> ce code ne correspond à aucun des visiteurs ayant accès à ce site.', |
|
| 583 | + 'pass_erreur_non_enregistre' => '<b>Erreur :</b> l’adresse <tt>@email_oubli@</tt> n’est pas enregistrée sur ce site.', |
|
| 584 | + 'pass_erreur_non_valide' => '<b>Erreur :</b> cet email <tt>@email_oubli@</tt> n’est pas valide !', |
|
| 585 | + 'pass_erreur_probleme_technique' => '<b>Erreur :</b> à cause d’un problème technique, l’email ne peut pas être envoyé.', |
|
| 586 | + 'pass_espace_prive_bla' => 'L’espace privé de ce site est ouvert aux |
|
| 587 | 587 | visiteurs, après inscription. Une fois enregistré, |
| 588 | 588 | tu pourras consulter les articles en cours de rédaction, |
| 589 | 589 | proposer des articles et participer à tous les forums.', |
| 590 | - 'pass_forum_bla' => 'Tu as demandé à intervenir sur un forum |
|
| 590 | + 'pass_forum_bla' => 'Tu as demandé à intervenir sur un forum |
|
| 591 | 591 | réservé aux visiteurs enregistrés.', |
| 592 | - 'pass_indiquez_cidessous' => 'Indique ci-dessous l’adresse email sous laquelle tu |
|
| 592 | + 'pass_indiquez_cidessous' => 'Indique ci-dessous l’adresse email sous laquelle tu |
|
| 593 | 593 | t’es précédemment enregistré. Tu |
| 594 | 594 | recevras un email t’indiquant la marche à suivre pour |
| 595 | 595 | récupérer ton accès.', |
| 596 | - 'pass_mail_passcookie' => '(ceci est un message automatique) |
|
| 596 | + 'pass_mail_passcookie' => '(ceci est un message automatique) |
|
| 597 | 597 | Pour retrouver ton accès au site |
| 598 | 598 | @nom_site_spip@ (@adresse_site@) |
| 599 | 599 | Rends toi à l’adresse suivante : |
@@ -604,150 +604,150 @@ discard block |
||
| 604 | 604 | et te reconnecter au site. |
| 605 | 605 | |
| 606 | 606 | ', |
| 607 | - 'pass_mot_oublie' => 'Mot de passe oublié', |
|
| 608 | - 'pass_nouveau_enregistre' => 'Ton nouveau mot de passe a été enregistré.', |
|
| 609 | - 'pass_nouveau_pass' => 'Nouveau mot de passe', |
|
| 610 | - 'pass_ok' => 'OK', |
|
| 611 | - 'pass_oubli_mot' => 'Oubli du mot de passe', |
|
| 612 | - 'pass_procedure_changer' => 'Pour changer ton mot de passe, merci d’indiquer l’adresse email associée à ton compte.', |
|
| 613 | - 'pass_quitter_fenetre' => 'Quitter cette fenêtre', |
|
| 614 | - 'pass_rappel_login' => 'Rappel : ton identifiant (login) est « @login@ ».', |
|
| 615 | - 'pass_recevoir_mail' => 'Un lien de réinitialisation de ton mot de passe t’a été envoyé sur ton adresse email (si celle-ci est valide).', |
|
| 616 | - 'pass_retour_public' => 'Retour sur le site public', |
|
| 617 | - 'pass_rien_a_faire_ici' => 'Rien à faire ici.', |
|
| 618 | - 'pass_vousinscrire' => 'T’inscrire sur ce site', |
|
| 619 | - 'precedent' => 'précédent', |
|
| 620 | - 'previsualisation' => 'Prévisualisation', |
|
| 621 | - 'previsualiser' => 'Prévisualiser', |
|
| 607 | + 'pass_mot_oublie' => 'Mot de passe oublié', |
|
| 608 | + 'pass_nouveau_enregistre' => 'Ton nouveau mot de passe a été enregistré.', |
|
| 609 | + 'pass_nouveau_pass' => 'Nouveau mot de passe', |
|
| 610 | + 'pass_ok' => 'OK', |
|
| 611 | + 'pass_oubli_mot' => 'Oubli du mot de passe', |
|
| 612 | + 'pass_procedure_changer' => 'Pour changer ton mot de passe, merci d’indiquer l’adresse email associée à ton compte.', |
|
| 613 | + 'pass_quitter_fenetre' => 'Quitter cette fenêtre', |
|
| 614 | + 'pass_rappel_login' => 'Rappel : ton identifiant (login) est « @login@ ».', |
|
| 615 | + 'pass_recevoir_mail' => 'Un lien de réinitialisation de ton mot de passe t’a été envoyé sur ton adresse email (si celle-ci est valide).', |
|
| 616 | + 'pass_retour_public' => 'Retour sur le site public', |
|
| 617 | + 'pass_rien_a_faire_ici' => 'Rien à faire ici.', |
|
| 618 | + 'pass_vousinscrire' => 'T’inscrire sur ce site', |
|
| 619 | + 'precedent' => 'précédent', |
|
| 620 | + 'previsualisation' => 'Prévisualisation', |
|
| 621 | + 'previsualiser' => 'Prévisualiser', |
|
| 622 | 622 | |
| 623 | - // R |
|
| 624 | - 'retour' => 'Retour', |
|
| 623 | + // R |
|
| 624 | + 'retour' => 'Retour', |
|
| 625 | 625 | |
| 626 | - // S |
|
| 627 | - 'spip_conforme_dtd' => 'SPIP considère ce document comme conforme à son DOCTYPE :', |
|
| 628 | - 'squelette' => 'squelette', |
|
| 629 | - 'squelette_inclus_ligne' => 'squelette inclus, ligne', |
|
| 630 | - 'squelette_ligne' => 'squelette, ligne', |
|
| 631 | - 'stats_visites_et_popularite' => '@visites@ visites ; popularité : @popularite@', |
|
| 632 | - 'suivant' => 'suivant', |
|
| 626 | + // S |
|
| 627 | + 'spip_conforme_dtd' => 'SPIP considère ce document comme conforme à son DOCTYPE :', |
|
| 628 | + 'squelette' => 'squelette', |
|
| 629 | + 'squelette_inclus_ligne' => 'squelette inclus, ligne', |
|
| 630 | + 'squelette_ligne' => 'squelette, ligne', |
|
| 631 | + 'stats_visites_et_popularite' => '@visites@ visites ; popularité : @popularite@', |
|
| 632 | + 'suivant' => 'suivant', |
|
| 633 | 633 | |
| 634 | - // T |
|
| 635 | - 'taille_go' => '@taille@ Go', |
|
| 636 | - 'taille_go_bi' => '@taille@ Gio', |
|
| 637 | - 'taille_ko' => '@taille@ ko', |
|
| 638 | - 'taille_ko_bi' => '@taille@ kio', |
|
| 639 | - 'taille_mo' => '@taille@ Mo', |
|
| 640 | - 'taille_mo_bi' => '@taille@ Mio', |
|
| 641 | - 'taille_octets' => '@taille@ octets', |
|
| 642 | - 'taille_octets_bi' => '@taille@ octets', |
|
| 643 | - 'texte_actualite_site_1' => 'Quand tu seras familiarisé(e) avec l’interface, tu pourras cliquer sur « ', |
|
| 644 | - 'texte_actualite_site_2' => 'interface complète', |
|
| 645 | - 'texte_actualite_site_3' => ' » pour ouvrir plus de possibilités.', |
|
| 646 | - 'texte_creation_automatique_vignette' => 'La création automatique de vignettes de prévisualisation est activée sur ce site. Si tu installe à partir de ce formulaire des images au(x) format(s) @gd_formats@, elles seront accompagnées d’une vignette d’une taille maximale de @taille_preview@ pixels.', |
|
| 647 | - 'texte_documents_associes' => 'Les documents suivants sont associés à l’article, |
|
| 634 | + // T |
|
| 635 | + 'taille_go' => '@taille@ Go', |
|
| 636 | + 'taille_go_bi' => '@taille@ Gio', |
|
| 637 | + 'taille_ko' => '@taille@ ko', |
|
| 638 | + 'taille_ko_bi' => '@taille@ kio', |
|
| 639 | + 'taille_mo' => '@taille@ Mo', |
|
| 640 | + 'taille_mo_bi' => '@taille@ Mio', |
|
| 641 | + 'taille_octets' => '@taille@ octets', |
|
| 642 | + 'taille_octets_bi' => '@taille@ octets', |
|
| 643 | + 'texte_actualite_site_1' => 'Quand tu seras familiarisé(e) avec l’interface, tu pourras cliquer sur « ', |
|
| 644 | + 'texte_actualite_site_2' => 'interface complète', |
|
| 645 | + 'texte_actualite_site_3' => ' » pour ouvrir plus de possibilités.', |
|
| 646 | + 'texte_creation_automatique_vignette' => 'La création automatique de vignettes de prévisualisation est activée sur ce site. Si tu installe à partir de ce formulaire des images au(x) format(s) @gd_formats@, elles seront accompagnées d’une vignette d’une taille maximale de @taille_preview@ pixels.', |
|
| 647 | + 'texte_documents_associes' => 'Les documents suivants sont associés à l’article, |
|
| 648 | 648 | mais ils n’y ont pas été directement |
| 649 | 649 | insérés. Selon la mise en page du site public, |
| 650 | 650 | ils pourront apparaître sous forme de documents joints.', |
| 651 | - 'texte_erreur_mise_niveau_base' => 'Erreur de base de données lors de la mise à niveau. |
|
| 651 | + 'texte_erreur_mise_niveau_base' => 'Erreur de base de données lors de la mise à niveau. |
|
| 652 | 652 | L’image <b>@fichier@</b> n’est pas passée (article @id_article@). |
| 653 | 653 | Note bien cette référence, réessaye la mise à |
| 654 | 654 | niveau, et enfin vérifie que les images apparaissent |
| 655 | 655 | toujours dans les articles.', |
| 656 | - 'texte_erreur_visiteur' => 'Tu as tenté d’accéder à l’espace privé avec un login qui ne le permet pas.', |
|
| 657 | - 'texte_inc_auth_1' => 'Tu es identifié sous le |
|
| 656 | + 'texte_erreur_visiteur' => 'Tu as tenté d’accéder à l’espace privé avec un login qui ne le permet pas.', |
|
| 657 | + 'texte_inc_auth_1' => 'Tu es identifié sous le |
|
| 658 | 658 | login <b>@auth_login@</b>, mais celui-ci n’existe pas/plus dans la base. |
| 659 | 659 | Essaye de te', |
| 660 | - 'texte_inc_auth_2' => 'reconnecter', |
|
| 661 | - 'texte_inc_auth_3' => ', après avoir éventuellement quitté puis |
|
| 660 | + 'texte_inc_auth_2' => 'reconnecter', |
|
| 661 | + 'texte_inc_auth_3' => ', après avoir éventuellement quitté puis |
|
| 662 | 662 | redémarré ton navigateur.', |
| 663 | - 'texte_inc_config' => 'Les modifications effectuées dans ces pages influent notablement sur le |
|
| 663 | + 'texte_inc_config' => 'Les modifications effectuées dans ces pages influent notablement sur le |
|
| 664 | 664 | fonctionnement de ton site. Nous te recommandons de ne pas y intervenir tant que tu n’es pas |
| 665 | 665 | familier du fonctionnement du système SPIP. <br /><br /><b>Plus |
| 666 | 666 | généralement, il est fortement conseillé |
| 667 | 667 | de laisser la charge de ces pages au webmestre principal de ton site.</b>', |
| 668 | - 'texte_inc_meta_1' => 'Le système a rencontré une erreur lors de l’écriture du fichier <code>@fichier@</code>. En tant qu’administrateur du site,', |
|
| 669 | - 'texte_inc_meta_2' => 'vérifie les droits d’ecriture', |
|
| 670 | - 'texte_inc_meta_3' => 'sur le répertoire <code>@repertoire@</code>.', |
|
| 671 | - 'texte_statut_en_cours_redaction' => 'en cours de rédaction', |
|
| 672 | - 'texte_statut_poubelle' => 'à la poubelle', |
|
| 673 | - 'texte_statut_propose_evaluation' => 'proposé à l’évaluation', |
|
| 674 | - 'texte_statut_publie' => 'publié en ligne', |
|
| 675 | - 'texte_statut_refuse' => 'refusé', |
|
| 676 | - 'titre_ajouter_mot_cle' => 'AJOUTER UN MOT-CLÉ :', |
|
| 677 | - 'titre_cadre_raccourcis' => 'RACCOURCIS :', |
|
| 678 | - 'titre_changer_couleur_interface' => 'Changer la couleur de l’interface', |
|
| 679 | - 'titre_image_admin_article' => 'Tu peux administrer cet article', |
|
| 680 | - 'titre_image_administrateur' => 'Administrateur', |
|
| 681 | - 'titre_image_aide' => 'De l’aide sur cet élément', |
|
| 682 | - 'titre_image_auteur_supprime' => 'Auteur supprimé', |
|
| 683 | - 'titre_image_redacteur' => 'Rédacteur sans accès', |
|
| 684 | - 'titre_image_redacteur_02' => 'Rédacteur', |
|
| 685 | - 'titre_image_selecteur' => 'Afficher la liste', |
|
| 686 | - 'titre_image_visiteur' => 'Visiteur', |
|
| 687 | - 'titre_joindre_document' => 'JOINDRE UN DOCUMENT', |
|
| 688 | - 'titre_mots_cles' => 'MOTS-CLÉS', |
|
| 689 | - 'titre_probleme_technique' => 'Attention : un problème technique (serveur SQL) empêche l’accès à cette partie du site. Merci de ta compréhension.', |
|
| 690 | - 'titre_publier_document' => 'PUBLIER UN DOCUMENT DANS CETTE RUBRIQUE', |
|
| 691 | - 'titre_signatures_attente' => 'Signatures en attente de validation', |
|
| 692 | - 'titre_signatures_confirmees' => 'Signatures confirmées', |
|
| 693 | - 'titre_statistiques' => 'Statistiques du site', |
|
| 694 | - 'titre_titre_document' => 'Titre du document :', |
|
| 695 | - 'todo' => 'à venir', |
|
| 696 | - 'trad_definir_reference' => 'Choisir "@titre@" comme référence des traductions', |
|
| 697 | - 'trad_reference' => '(référence des traductions)', |
|
| 668 | + 'texte_inc_meta_1' => 'Le système a rencontré une erreur lors de l’écriture du fichier <code>@fichier@</code>. En tant qu’administrateur du site,', |
|
| 669 | + 'texte_inc_meta_2' => 'vérifie les droits d’ecriture', |
|
| 670 | + 'texte_inc_meta_3' => 'sur le répertoire <code>@repertoire@</code>.', |
|
| 671 | + 'texte_statut_en_cours_redaction' => 'en cours de rédaction', |
|
| 672 | + 'texte_statut_poubelle' => 'à la poubelle', |
|
| 673 | + 'texte_statut_propose_evaluation' => 'proposé à l’évaluation', |
|
| 674 | + 'texte_statut_publie' => 'publié en ligne', |
|
| 675 | + 'texte_statut_refuse' => 'refusé', |
|
| 676 | + 'titre_ajouter_mot_cle' => 'AJOUTER UN MOT-CLÉ :', |
|
| 677 | + 'titre_cadre_raccourcis' => 'RACCOURCIS :', |
|
| 678 | + 'titre_changer_couleur_interface' => 'Changer la couleur de l’interface', |
|
| 679 | + 'titre_image_admin_article' => 'Tu peux administrer cet article', |
|
| 680 | + 'titre_image_administrateur' => 'Administrateur', |
|
| 681 | + 'titre_image_aide' => 'De l’aide sur cet élément', |
|
| 682 | + 'titre_image_auteur_supprime' => 'Auteur supprimé', |
|
| 683 | + 'titre_image_redacteur' => 'Rédacteur sans accès', |
|
| 684 | + 'titre_image_redacteur_02' => 'Rédacteur', |
|
| 685 | + 'titre_image_selecteur' => 'Afficher la liste', |
|
| 686 | + 'titre_image_visiteur' => 'Visiteur', |
|
| 687 | + 'titre_joindre_document' => 'JOINDRE UN DOCUMENT', |
|
| 688 | + 'titre_mots_cles' => 'MOTS-CLÉS', |
|
| 689 | + 'titre_probleme_technique' => 'Attention : un problème technique (serveur SQL) empêche l’accès à cette partie du site. Merci de ta compréhension.', |
|
| 690 | + 'titre_publier_document' => 'PUBLIER UN DOCUMENT DANS CETTE RUBRIQUE', |
|
| 691 | + 'titre_signatures_attente' => 'Signatures en attente de validation', |
|
| 692 | + 'titre_signatures_confirmees' => 'Signatures confirmées', |
|
| 693 | + 'titre_statistiques' => 'Statistiques du site', |
|
| 694 | + 'titre_titre_document' => 'Titre du document :', |
|
| 695 | + 'todo' => 'à venir', |
|
| 696 | + 'trad_definir_reference' => 'Choisir "@titre@" comme référence des traductions', |
|
| 697 | + 'trad_reference' => '(référence des traductions)', |
|
| 698 | 698 | |
| 699 | - // U |
|
| 700 | - 'upload_limit' => 'Ce fichier est trop gros pour le serveur ; la taille maximum autorisée en <i>upload</i> est de @max@.', |
|
| 699 | + // U |
|
| 700 | + 'upload_limit' => 'Ce fichier est trop gros pour le serveur ; la taille maximum autorisée en <i>upload</i> est de @max@.', |
|
| 701 | 701 | |
| 702 | - // Z |
|
| 703 | - 'zbug_balise_b_aval' => ' : balise B en aval', |
|
| 704 | - 'zbug_balise_inexistante' => 'Balise @balise@ mal déclarée pour @from@', |
|
| 705 | - 'zbug_balise_sans_argument' => 'Argument manquant dans la balise @balise@', |
|
| 706 | - 'zbug_boucle' => 'boucle', |
|
| 707 | - 'zbug_boucle_recursive_undef' => 'boucle récursive non définie', |
|
| 708 | - 'zbug_calcul' => 'calcul', |
|
| 709 | - 'zbug_champ_hors_boucle' => 'Champ @champ@ hors boucle', |
|
| 710 | - 'zbug_champ_hors_critere' => 'Champ @champ@ hors critère @critere@', |
|
| 711 | - 'zbug_champ_hors_motif' => 'Champ @champ@ hors d’un contexte @motif@', |
|
| 712 | - 'zbug_code' => 'code', |
|
| 713 | - 'zbug_critere_inconnu' => 'critère inconnu @critere@', |
|
| 714 | - 'zbug_critere_sur_table_sans_cle_primaire' => '{@critere@} sur une table sans clef primaire atomique', |
|
| 715 | - 'zbug_distant_interdit' => 'externe interdit', |
|
| 716 | - 'zbug_doublon_table_sans_cle_primaire' => 'doublons sur une table sans clef primaire atomique', |
|
| 717 | - 'zbug_doublon_table_sans_index' => 'doublons sur une table sans index', |
|
| 718 | - 'zbug_erreur_boucle_double' => 'BOUCLE@id@ : double définition', |
|
| 719 | - 'zbug_erreur_boucle_fermant' => 'BOUCLE@id@ : tag fermant manquant', |
|
| 720 | - 'zbug_erreur_boucle_syntaxe' => 'Syntaxe boucle incorrecte', |
|
| 721 | - 'zbug_erreur_compilation' => 'Erreur de compilation', |
|
| 722 | - 'zbug_erreur_execution_page' => 'erreur d’exécution de la page', |
|
| 723 | - 'zbug_erreur_filtre' => 'Erreur : filtre <b>« @filtre@ »</b> non défini', |
|
| 724 | - 'zbug_erreur_filtre_nbarg_min' => 'Filtre @filtre@ : il manque @nb@ argument(s)', |
|
| 725 | - 'zbug_erreur_meme_parent' => '{meme_parent} ne s’applique qu’aux boucles (FORUMS) ou (RUBRIQUES)', |
|
| 726 | - 'zbug_erreur_squelette' => 'Erreur(s) dans le squelette', |
|
| 727 | - 'zbug_hors_compilation' => 'Hors Compilation', |
|
| 728 | - 'zbug_info_erreur_squelette' => 'Erreur sur le site', |
|
| 729 | - 'zbug_inversion_ordre_inexistant' => 'inversion d’un ordre inexistant', |
|
| 730 | - 'zbug_pagination_sans_critere' => '#PAGINATION sans critère {pagination} ou employé dans une boucle récursive', |
|
| 731 | - 'zbug_parametres_inclus_incorrects' => 'Paramètre d’inclusion incorrect : @param@', |
|
| 732 | - 'zbug_profile' => 'Temps de calcul : @time@', |
|
| 733 | - 'zbug_resultat' => 'résultat', |
|
| 734 | - 'zbug_serveur_indefini' => 'serveur SQL indéfini', |
|
| 735 | - 'zbug_statistiques' => 'Statistiques des requêtes SQL classées par durée', |
|
| 736 | - 'zbug_table_inconnue' => 'Table SQL « @table@ » inconnue', |
|
| 737 | - 'zxml_connus_attributs' => 'attributs connus', |
|
| 738 | - 'zxml_de' => 'de', |
|
| 739 | - 'zxml_inconnu_attribut' => 'attribut inconnu', |
|
| 740 | - 'zxml_inconnu_balise' => 'balise inconnue', |
|
| 741 | - 'zxml_inconnu_entite' => 'entité inconnue', |
|
| 742 | - 'zxml_inconnu_id' => 'ID inconnu', |
|
| 743 | - 'zxml_mais_de' => 'mais de', |
|
| 744 | - 'zxml_non_conforme' => 'n’est pas conforme au motif', |
|
| 745 | - 'zxml_non_fils' => 'n’est pas un fils de', |
|
| 746 | - 'zxml_nonvide_balise' => 'balise non vide', |
|
| 747 | - 'zxml_obligatoire_attribut' => 'attribut obligatoire mais absent dans', |
|
| 748 | - 'zxml_succession_fils_incorrecte' => 'succession des fils incorrecte', |
|
| 749 | - 'zxml_survoler' => 'survoler pour voir les corrects', |
|
| 750 | - 'zxml_valeur_attribut' => 'valeur de l’attribut', |
|
| 751 | - 'zxml_vide_balise' => 'balise vide', |
|
| 752 | - 'zxml_vu' => 'vu auparavant' |
|
| 702 | + // Z |
|
| 703 | + 'zbug_balise_b_aval' => ' : balise B en aval', |
|
| 704 | + 'zbug_balise_inexistante' => 'Balise @balise@ mal déclarée pour @from@', |
|
| 705 | + 'zbug_balise_sans_argument' => 'Argument manquant dans la balise @balise@', |
|
| 706 | + 'zbug_boucle' => 'boucle', |
|
| 707 | + 'zbug_boucle_recursive_undef' => 'boucle récursive non définie', |
|
| 708 | + 'zbug_calcul' => 'calcul', |
|
| 709 | + 'zbug_champ_hors_boucle' => 'Champ @champ@ hors boucle', |
|
| 710 | + 'zbug_champ_hors_critere' => 'Champ @champ@ hors critère @critere@', |
|
| 711 | + 'zbug_champ_hors_motif' => 'Champ @champ@ hors d’un contexte @motif@', |
|
| 712 | + 'zbug_code' => 'code', |
|
| 713 | + 'zbug_critere_inconnu' => 'critère inconnu @critere@', |
|
| 714 | + 'zbug_critere_sur_table_sans_cle_primaire' => '{@critere@} sur une table sans clef primaire atomique', |
|
| 715 | + 'zbug_distant_interdit' => 'externe interdit', |
|
| 716 | + 'zbug_doublon_table_sans_cle_primaire' => 'doublons sur une table sans clef primaire atomique', |
|
| 717 | + 'zbug_doublon_table_sans_index' => 'doublons sur une table sans index', |
|
| 718 | + 'zbug_erreur_boucle_double' => 'BOUCLE@id@ : double définition', |
|
| 719 | + 'zbug_erreur_boucle_fermant' => 'BOUCLE@id@ : tag fermant manquant', |
|
| 720 | + 'zbug_erreur_boucle_syntaxe' => 'Syntaxe boucle incorrecte', |
|
| 721 | + 'zbug_erreur_compilation' => 'Erreur de compilation', |
|
| 722 | + 'zbug_erreur_execution_page' => 'erreur d’exécution de la page', |
|
| 723 | + 'zbug_erreur_filtre' => 'Erreur : filtre <b>« @filtre@ »</b> non défini', |
|
| 724 | + 'zbug_erreur_filtre_nbarg_min' => 'Filtre @filtre@ : il manque @nb@ argument(s)', |
|
| 725 | + 'zbug_erreur_meme_parent' => '{meme_parent} ne s’applique qu’aux boucles (FORUMS) ou (RUBRIQUES)', |
|
| 726 | + 'zbug_erreur_squelette' => 'Erreur(s) dans le squelette', |
|
| 727 | + 'zbug_hors_compilation' => 'Hors Compilation', |
|
| 728 | + 'zbug_info_erreur_squelette' => 'Erreur sur le site', |
|
| 729 | + 'zbug_inversion_ordre_inexistant' => 'inversion d’un ordre inexistant', |
|
| 730 | + 'zbug_pagination_sans_critere' => '#PAGINATION sans critère {pagination} ou employé dans une boucle récursive', |
|
| 731 | + 'zbug_parametres_inclus_incorrects' => 'Paramètre d’inclusion incorrect : @param@', |
|
| 732 | + 'zbug_profile' => 'Temps de calcul : @time@', |
|
| 733 | + 'zbug_resultat' => 'résultat', |
|
| 734 | + 'zbug_serveur_indefini' => 'serveur SQL indéfini', |
|
| 735 | + 'zbug_statistiques' => 'Statistiques des requêtes SQL classées par durée', |
|
| 736 | + 'zbug_table_inconnue' => 'Table SQL « @table@ » inconnue', |
|
| 737 | + 'zxml_connus_attributs' => 'attributs connus', |
|
| 738 | + 'zxml_de' => 'de', |
|
| 739 | + 'zxml_inconnu_attribut' => 'attribut inconnu', |
|
| 740 | + 'zxml_inconnu_balise' => 'balise inconnue', |
|
| 741 | + 'zxml_inconnu_entite' => 'entité inconnue', |
|
| 742 | + 'zxml_inconnu_id' => 'ID inconnu', |
|
| 743 | + 'zxml_mais_de' => 'mais de', |
|
| 744 | + 'zxml_non_conforme' => 'n’est pas conforme au motif', |
|
| 745 | + 'zxml_non_fils' => 'n’est pas un fils de', |
|
| 746 | + 'zxml_nonvide_balise' => 'balise non vide', |
|
| 747 | + 'zxml_obligatoire_attribut' => 'attribut obligatoire mais absent dans', |
|
| 748 | + 'zxml_succession_fils_incorrecte' => 'succession des fils incorrecte', |
|
| 749 | + 'zxml_survoler' => 'survoler pour voir les corrects', |
|
| 750 | + 'zxml_valeur_attribut' => 'valeur de l’attribut', |
|
| 751 | + 'zxml_vide_balise' => 'balise vide', |
|
| 752 | + 'zxml_vu' => 'vu auparavant' |
|
| 753 | 753 | ); |
@@ -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 | /** |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | function set_spip_doc(?string $fichier): string { |
| 33 | - if ($fichier and strpos($fichier, (string) _DIR_IMG) === 0) { |
|
| 34 | - return substr($fichier, strlen(_DIR_IMG)); |
|
| 35 | - } else { |
|
| 36 | - // ex: fichier distant |
|
| 37 | - return $fichier ?? ''; |
|
| 38 | - } |
|
| 33 | + if ($fichier and strpos($fichier, (string) _DIR_IMG) === 0) { |
|
| 34 | + return substr($fichier, strlen(_DIR_IMG)); |
|
| 35 | + } else { |
|
| 36 | + // ex: fichier distant |
|
| 37 | + return $fichier ?? ''; |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -47,26 +47,26 @@ discard block |
||
| 47 | 47 | * @return bool|string |
| 48 | 48 | */ |
| 49 | 49 | function get_spip_doc(?string $fichier) { |
| 50 | - if ($fichier === null) { |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - // fichier distant |
|
| 55 | - if (tester_url_absolue($fichier)) { |
|
| 56 | - return $fichier; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - // gestion d'erreurs, fichier='' |
|
| 60 | - if (!strlen($fichier)) { |
|
| 61 | - return false; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if (strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) !== 0) { |
|
| 65 | - $fichier = _DIR_IMG . $fichier; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - // fichier normal |
|
| 69 | - return $fichier; |
|
| 50 | + if ($fichier === null) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + // fichier distant |
|
| 55 | + if (tester_url_absolue($fichier)) { |
|
| 56 | + return $fichier; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + // gestion d'erreurs, fichier='' |
|
| 60 | + if (!strlen($fichier)) { |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + if (strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) !== 0) { |
|
| 65 | + $fichier = _DIR_IMG . $fichier; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + // fichier normal |
|
| 69 | + return $fichier; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -80,26 +80,26 @@ discard block |
||
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | 82 | function creer_repertoire_documents($ext) { |
| 83 | - $rep = sous_repertoire(_DIR_IMG, $ext); |
|
| 84 | - |
|
| 85 | - if (!$ext or !$rep) { |
|
| 86 | - spip_log("creer_repertoire_documents '$rep' interdit"); |
|
| 87 | - exit; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // Cette variable de configuration peut etre posee par un plugin |
|
| 91 | - // par exemple acces_restreint |
|
| 92 | - // sauf pour logo/ utilise pour stocker les logoon et logooff |
|
| 93 | - if ( |
|
| 94 | - isset($GLOBALS['meta']['creer_htaccess']) |
|
| 95 | - and $GLOBALS['meta']['creer_htaccess'] == 'oui' |
|
| 96 | - and $ext !== 'logo' |
|
| 97 | - ) { |
|
| 98 | - include_spip('inc/acces'); |
|
| 99 | - verifier_htaccess($rep); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - return $rep; |
|
| 83 | + $rep = sous_repertoire(_DIR_IMG, $ext); |
|
| 84 | + |
|
| 85 | + if (!$ext or !$rep) { |
|
| 86 | + spip_log("creer_repertoire_documents '$rep' interdit"); |
|
| 87 | + exit; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // Cette variable de configuration peut etre posee par un plugin |
|
| 91 | + // par exemple acces_restreint |
|
| 92 | + // sauf pour logo/ utilise pour stocker les logoon et logooff |
|
| 93 | + if ( |
|
| 94 | + isset($GLOBALS['meta']['creer_htaccess']) |
|
| 95 | + and $GLOBALS['meta']['creer_htaccess'] == 'oui' |
|
| 96 | + and $ext !== 'logo' |
|
| 97 | + ) { |
|
| 98 | + include_spip('inc/acces'); |
|
| 99 | + verifier_htaccess($rep); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + return $rep; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -108,22 +108,22 @@ discard block |
||
| 108 | 108 | * @param string $nom |
| 109 | 109 | */ |
| 110 | 110 | function effacer_repertoire_temporaire($nom) { |
| 111 | - if ($d = opendir($nom)) { |
|
| 112 | - while (($f = readdir($d)) !== false) { |
|
| 113 | - if (is_file("$nom/$f")) { |
|
| 114 | - spip_unlink("$nom/$f"); |
|
| 115 | - } else { |
|
| 116 | - if ( |
|
| 117 | - $f <> '.' and $f <> '..' |
|
| 118 | - and is_dir("$nom/$f") |
|
| 119 | - ) { |
|
| 120 | - effacer_repertoire_temporaire("$nom/$f"); |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - closedir($d); |
|
| 126 | - @rmdir($nom); |
|
| 111 | + if ($d = opendir($nom)) { |
|
| 112 | + while (($f = readdir($d)) !== false) { |
|
| 113 | + if (is_file("$nom/$f")) { |
|
| 114 | + spip_unlink("$nom/$f"); |
|
| 115 | + } else { |
|
| 116 | + if ( |
|
| 117 | + $f <> '.' and $f <> '..' |
|
| 118 | + and is_dir("$nom/$f") |
|
| 119 | + ) { |
|
| 120 | + effacer_repertoire_temporaire("$nom/$f"); |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + closedir($d); |
|
| 126 | + @rmdir($nom); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // |
@@ -140,45 +140,45 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | function copier_document($ext, $orig, $source, $subdir = null) { |
| 142 | 142 | |
| 143 | - $orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc |
|
| 144 | - $dir = creer_repertoire_documents($subdir ?: $ext); |
|
| 145 | - |
|
| 146 | - $dest = preg_replace('/<[^>]*>/', '', basename($orig)); |
|
| 147 | - $dest = preg_replace('/\.([^.]+)$/', '', $dest); |
|
| 148 | - $dest = translitteration($dest); |
|
| 149 | - $dest = preg_replace('/[^.=\w-]+/', '_', $dest); |
|
| 150 | - |
|
| 151 | - // ne pas accepter de noms de la forme -r90.jpg qui sont reserves |
|
| 152 | - // pour les images transformees par rotation (action/documenter) |
|
| 153 | - $dest = preg_replace(',-r(90|180|270)$,', '', $dest); |
|
| 154 | - |
|
| 155 | - while (preg_match(',\.(\w+)$,', $dest, $m)) { |
|
| 156 | - if ( |
|
| 157 | - !function_exists('verifier_upload_autorise') |
|
| 158 | - or !$r = verifier_upload_autorise($dest) |
|
| 159 | - or (!empty($r['autozip'])) |
|
| 160 | - ) { |
|
| 161 | - $dest = substr($dest, 0, -strlen($m[0])) . '_' . $m[1]; |
|
| 162 | - break; |
|
| 163 | - } |
|
| 164 | - else { |
|
| 165 | - $dest = substr($dest, 0, -strlen($m[0])); |
|
| 166 | - $ext = $m[1] . '.' . $ext; |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - // Si le document "source" est deja au bon endroit, ne rien faire |
|
| 171 | - if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 172 | - return $source; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - // sinon tourner jusqu'a trouver un numero correct |
|
| 176 | - $n = 0; |
|
| 177 | - while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 178 | - ; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - return deplacer_fichier_upload($source, $newFile); |
|
| 143 | + $orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc |
|
| 144 | + $dir = creer_repertoire_documents($subdir ?: $ext); |
|
| 145 | + |
|
| 146 | + $dest = preg_replace('/<[^>]*>/', '', basename($orig)); |
|
| 147 | + $dest = preg_replace('/\.([^.]+)$/', '', $dest); |
|
| 148 | + $dest = translitteration($dest); |
|
| 149 | + $dest = preg_replace('/[^.=\w-]+/', '_', $dest); |
|
| 150 | + |
|
| 151 | + // ne pas accepter de noms de la forme -r90.jpg qui sont reserves |
|
| 152 | + // pour les images transformees par rotation (action/documenter) |
|
| 153 | + $dest = preg_replace(',-r(90|180|270)$,', '', $dest); |
|
| 154 | + |
|
| 155 | + while (preg_match(',\.(\w+)$,', $dest, $m)) { |
|
| 156 | + if ( |
|
| 157 | + !function_exists('verifier_upload_autorise') |
|
| 158 | + or !$r = verifier_upload_autorise($dest) |
|
| 159 | + or (!empty($r['autozip'])) |
|
| 160 | + ) { |
|
| 161 | + $dest = substr($dest, 0, -strlen($m[0])) . '_' . $m[1]; |
|
| 162 | + break; |
|
| 163 | + } |
|
| 164 | + else { |
|
| 165 | + $dest = substr($dest, 0, -strlen($m[0])); |
|
| 166 | + $ext = $m[1] . '.' . $ext; |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + // Si le document "source" est deja au bon endroit, ne rien faire |
|
| 171 | + if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 172 | + return $source; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + // sinon tourner jusqu'a trouver un numero correct |
|
| 176 | + $n = 0; |
|
| 177 | + while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 178 | + ; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + return deplacer_fichier_upload($source, $newFile); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -193,28 +193,28 @@ discard block |
||
| 193 | 193 | * @return bool|string |
| 194 | 194 | */ |
| 195 | 195 | function determine_upload($type = '') { |
| 196 | - if (!function_exists('autoriser')) { |
|
| 197 | - include_spip('inc/autoriser'); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - if ( |
|
| 201 | - !autoriser('chargerftp') |
|
| 202 | - or $type == 'logos' |
|
| 203 | - ) { # on ne le permet pas pour les logos |
|
| 204 | - return false; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - $repertoire = _DIR_TRANSFERT; |
|
| 208 | - if (!@is_dir($repertoire)) { |
|
| 209 | - $repertoire = str_replace(_DIR_TMP, '', $repertoire); |
|
| 210 | - $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - if (!$GLOBALS['visiteur_session']['restreint']) { |
|
| 214 | - return $repertoire; |
|
| 215 | - } else { |
|
| 216 | - return sous_repertoire($repertoire, $GLOBALS['visiteur_session']['login']); |
|
| 217 | - } |
|
| 196 | + if (!function_exists('autoriser')) { |
|
| 197 | + include_spip('inc/autoriser'); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + if ( |
|
| 201 | + !autoriser('chargerftp') |
|
| 202 | + or $type == 'logos' |
|
| 203 | + ) { # on ne le permet pas pour les logos |
|
| 204 | + return false; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + $repertoire = _DIR_TRANSFERT; |
|
| 208 | + if (!@is_dir($repertoire)) { |
|
| 209 | + $repertoire = str_replace(_DIR_TMP, '', $repertoire); |
|
| 210 | + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + if (!$GLOBALS['visiteur_session']['restreint']) { |
|
| 214 | + return $repertoire; |
|
| 215 | + } else { |
|
| 216 | + return sous_repertoire($repertoire, $GLOBALS['visiteur_session']['login']); |
|
| 217 | + } |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -233,35 +233,35 @@ discard block |
||
| 233 | 233 | * @return bool|mixed|string |
| 234 | 234 | */ |
| 235 | 235 | function deplacer_fichier_upload($source, $dest, $move = false) { |
| 236 | - // Securite |
|
| 237 | - if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
|
| 238 | - $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 239 | - } else { |
|
| 240 | - $dest = preg_replace(',\.\.+,', '.', $dest); |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - if ($move) { |
|
| 244 | - $ok = @rename($source, $dest); |
|
| 245 | - } else { |
|
| 246 | - $ok = @copy($source, $dest); |
|
| 247 | - } |
|
| 248 | - if (!$ok) { |
|
| 249 | - $ok = @move_uploaded_file($source, $dest); |
|
| 250 | - } |
|
| 251 | - if ($ok) { |
|
| 252 | - @chmod($dest, _SPIP_CHMOD & ~0111); |
|
| 253 | - } else { |
|
| 254 | - $f = @fopen($dest, 'w'); |
|
| 255 | - if ($f) { |
|
| 256 | - fclose($f); |
|
| 257 | - } else { |
|
| 258 | - include_spip('inc/flock'); |
|
| 259 | - raler_fichier($dest); |
|
| 260 | - } |
|
| 261 | - spip_unlink($dest); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - return $ok ? $dest : false; |
|
| 236 | + // Securite |
|
| 237 | + if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
|
| 238 | + $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 239 | + } else { |
|
| 240 | + $dest = preg_replace(',\.\.+,', '.', $dest); |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + if ($move) { |
|
| 244 | + $ok = @rename($source, $dest); |
|
| 245 | + } else { |
|
| 246 | + $ok = @copy($source, $dest); |
|
| 247 | + } |
|
| 248 | + if (!$ok) { |
|
| 249 | + $ok = @move_uploaded_file($source, $dest); |
|
| 250 | + } |
|
| 251 | + if ($ok) { |
|
| 252 | + @chmod($dest, _SPIP_CHMOD & ~0111); |
|
| 253 | + } else { |
|
| 254 | + $f = @fopen($dest, 'w'); |
|
| 255 | + if ($f) { |
|
| 256 | + fclose($f); |
|
| 257 | + } else { |
|
| 258 | + include_spip('inc/flock'); |
|
| 259 | + raler_fichier($dest); |
|
| 260 | + } |
|
| 261 | + spip_unlink($dest); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + return $ok ? $dest : false; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
@@ -285,60 +285,60 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | function check_upload_error($error, $msg = '', $return = false) { |
| 287 | 287 | |
| 288 | - if (!$error) { |
|
| 289 | - return false; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - spip_log("Erreur upload $error -- cf. http://php.net/manual/fr/features.file-upload.errors.php"); |
|
| 293 | - |
|
| 294 | - switch ($error) { |
|
| 295 | - case 4: /* UPLOAD_ERR_NO_FILE */ |
|
| 296 | - return true; |
|
| 297 | - |
|
| 298 | - # on peut affiner les differents messages d'erreur |
|
| 299 | - case 1: /* UPLOAD_ERR_INI_SIZE */ |
|
| 300 | - $msg = _T( |
|
| 301 | - 'upload_limit', |
|
| 302 | - ['max' => ini_get('upload_max_filesize')] |
|
| 303 | - ); |
|
| 304 | - break; |
|
| 305 | - case 2: /* UPLOAD_ERR_FORM_SIZE */ |
|
| 306 | - $msg = _T( |
|
| 307 | - 'upload_limit', |
|
| 308 | - ['max' => ini_get('upload_max_filesize')] |
|
| 309 | - ); |
|
| 310 | - break; |
|
| 311 | - case 3: /* UPLOAD_ERR_PARTIAL */ |
|
| 312 | - $msg = _T( |
|
| 313 | - 'upload_limit', |
|
| 314 | - ['max' => ini_get('upload_max_filesize')] |
|
| 315 | - ); |
|
| 316 | - break; |
|
| 317 | - |
|
| 318 | - default: /* autre */ |
|
| 319 | - if (!$msg) { |
|
| 320 | - $msg = _T('pass_erreur') . ' ' . $error |
|
| 321 | - . '<br />' . propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 322 | - } |
|
| 323 | - break; |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - spip_log("erreur upload $error"); |
|
| 327 | - if ($return) { |
|
| 328 | - return $msg; |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - if (_request('iframe') == 'iframe') { |
|
| 332 | - echo "<div class='upload_answer upload_error'>$msg</div>"; |
|
| 333 | - exit; |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - include_spip('inc/minipres'); |
|
| 337 | - echo minipres( |
|
| 338 | - $msg, |
|
| 339 | - "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . '</button></a></div>' |
|
| 340 | - ); |
|
| 341 | - exit; |
|
| 288 | + if (!$error) { |
|
| 289 | + return false; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + spip_log("Erreur upload $error -- cf. http://php.net/manual/fr/features.file-upload.errors.php"); |
|
| 293 | + |
|
| 294 | + switch ($error) { |
|
| 295 | + case 4: /* UPLOAD_ERR_NO_FILE */ |
|
| 296 | + return true; |
|
| 297 | + |
|
| 298 | + # on peut affiner les differents messages d'erreur |
|
| 299 | + case 1: /* UPLOAD_ERR_INI_SIZE */ |
|
| 300 | + $msg = _T( |
|
| 301 | + 'upload_limit', |
|
| 302 | + ['max' => ini_get('upload_max_filesize')] |
|
| 303 | + ); |
|
| 304 | + break; |
|
| 305 | + case 2: /* UPLOAD_ERR_FORM_SIZE */ |
|
| 306 | + $msg = _T( |
|
| 307 | + 'upload_limit', |
|
| 308 | + ['max' => ini_get('upload_max_filesize')] |
|
| 309 | + ); |
|
| 310 | + break; |
|
| 311 | + case 3: /* UPLOAD_ERR_PARTIAL */ |
|
| 312 | + $msg = _T( |
|
| 313 | + 'upload_limit', |
|
| 314 | + ['max' => ini_get('upload_max_filesize')] |
|
| 315 | + ); |
|
| 316 | + break; |
|
| 317 | + |
|
| 318 | + default: /* autre */ |
|
| 319 | + if (!$msg) { |
|
| 320 | + $msg = _T('pass_erreur') . ' ' . $error |
|
| 321 | + . '<br />' . propre('[->http://php.net/manual/fr/features.file-upload.errors.php]'); |
|
| 322 | + } |
|
| 323 | + break; |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + spip_log("erreur upload $error"); |
|
| 327 | + if ($return) { |
|
| 328 | + return $msg; |
|
| 329 | + } |
|
| 330 | + |
|
| 331 | + if (_request('iframe') == 'iframe') { |
|
| 332 | + echo "<div class='upload_answer upload_error'>$msg</div>"; |
|
| 333 | + exit; |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + include_spip('inc/minipres'); |
|
| 337 | + echo minipres( |
|
| 338 | + $msg, |
|
| 339 | + "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . '</button></a></div>' |
|
| 340 | + ); |
|
| 341 | + exit; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -355,24 +355,24 @@ discard block |
||
| 355 | 355 | * @return string |
| 356 | 356 | */ |
| 357 | 357 | function corriger_extension($ext) { |
| 358 | - $ext = preg_replace(',[^a-z0-9],i', '', $ext); |
|
| 359 | - switch ($ext) { |
|
| 360 | - case 'htm': |
|
| 361 | - $ext = 'html'; |
|
| 362 | - break; |
|
| 363 | - case 'jpeg': |
|
| 364 | - $ext = 'jpg'; |
|
| 365 | - break; |
|
| 366 | - case 'tiff': |
|
| 367 | - $ext = 'tif'; |
|
| 368 | - break; |
|
| 369 | - case 'aif': |
|
| 370 | - $ext = 'aiff'; |
|
| 371 | - break; |
|
| 372 | - case 'mpeg': |
|
| 373 | - $ext = 'mpg'; |
|
| 374 | - break; |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - return $ext; |
|
| 358 | + $ext = preg_replace(',[^a-z0-9],i', '', $ext); |
|
| 359 | + switch ($ext) { |
|
| 360 | + case 'htm': |
|
| 361 | + $ext = 'html'; |
|
| 362 | + break; |
|
| 363 | + case 'jpeg': |
|
| 364 | + $ext = 'jpg'; |
|
| 365 | + break; |
|
| 366 | + case 'tiff': |
|
| 367 | + $ext = 'tif'; |
|
| 368 | + break; |
|
| 369 | + case 'aif': |
|
| 370 | + $ext = 'aiff'; |
|
| 371 | + break; |
|
| 372 | + case 'mpeg': |
|
| 373 | + $ext = 'mpg'; |
|
| 374 | + break; |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + return $ext; |
|
| 378 | 378 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('base/abstract_sql'); |
@@ -35,26 +35,26 @@ discard block |
||
| 35 | 35 | **/ |
| 36 | 36 | function genie_optimiser_dist($t) { |
| 37 | 37 | |
| 38 | - optimiser_base_une_table(); |
|
| 39 | - optimiser_base(); |
|
| 40 | - optimiser_caches_contextes(); |
|
| 38 | + optimiser_base_une_table(); |
|
| 39 | + optimiser_base(); |
|
| 40 | + optimiser_caches_contextes(); |
|
| 41 | 41 | |
| 42 | - // la date souhaitee pour le tour suivant = apres-demain a 4h du mat ; |
|
| 43 | - // sachant qu'on a un delai de 48h, on renvoie aujourd'hui a 4h du mat |
|
| 44 | - // avec une periode de flou entre 2h et 6h pour ne pas saturer un hebergeur |
|
| 45 | - // qui aurait beaucoup de sites SPIP |
|
| 46 | - return -(mktime(2, 0, 0) + random_int(0, 3600 * 4)); |
|
| 42 | + // la date souhaitee pour le tour suivant = apres-demain a 4h du mat ; |
|
| 43 | + // sachant qu'on a un delai de 48h, on renvoie aujourd'hui a 4h du mat |
|
| 44 | + // avec une periode de flou entre 2h et 6h pour ne pas saturer un hebergeur |
|
| 45 | + // qui aurait beaucoup de sites SPIP |
|
| 46 | + return -(mktime(2, 0, 0) + random_int(0, 3600 * 4)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Vider les contextes ajax de plus de 48h |
| 51 | 51 | */ |
| 52 | 52 | function optimiser_caches_contextes() { |
| 53 | - sous_repertoire(_DIR_CACHE, 'contextes'); |
|
| 54 | - if (is_dir($d = _DIR_CACHE . 'contextes')) { |
|
| 55 | - include_spip('inc/invalideur'); |
|
| 56 | - purger_repertoire($d, ['mtime' => time() - 48 * 3600, 'limit' => 10000]); |
|
| 57 | - } |
|
| 53 | + sous_repertoire(_DIR_CACHE, 'contextes'); |
|
| 54 | + if (is_dir($d = _DIR_CACHE . 'contextes')) { |
|
| 55 | + include_spip('inc/invalideur'); |
|
| 56 | + purger_repertoire($d, ['mtime' => time() - 48 * 3600, 'limit' => 10000]); |
|
| 57 | + } |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return void |
| 70 | 70 | **/ |
| 71 | 71 | function optimiser_base($attente = 86400) { |
| 72 | - optimiser_base_disparus($attente); |
|
| 72 | + optimiser_base_disparus($attente); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -86,28 +86,28 @@ discard block |
||
| 86 | 86 | **/ |
| 87 | 87 | function optimiser_base_une_table() { |
| 88 | 88 | |
| 89 | - $tables = []; |
|
| 90 | - $result = sql_showbase(); |
|
| 91 | - |
|
| 92 | - // on n'optimise qu'une seule table a chaque fois, |
|
| 93 | - // pour ne pas vautrer le systeme |
|
| 94 | - // lire http://dev.mysql.com/doc/refman/5.0/fr/optimize-table.html |
|
| 95 | - while ($row = sql_fetch($result)) { |
|
| 96 | - $tables[] = array_shift($row); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - spip_log('optimiser_base_une_table ' . json_encode($tables, JSON_THROW_ON_ERROR), 'genie' . _LOG_DEBUG); |
|
| 100 | - if ($tables) { |
|
| 101 | - $table_op = intval(lire_config('optimiser_table', 0) + 1) % sizeof($tables); |
|
| 102 | - ecrire_config('optimiser_table', $table_op); |
|
| 103 | - $q = $tables[$table_op]; |
|
| 104 | - spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie' . _LOG_DEBUG); |
|
| 105 | - if (sql_optimize($q)) { |
|
| 106 | - spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie' . _LOG_DEBUG); |
|
| 107 | - } else { |
|
| 108 | - spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie' . _LOG_DEBUG); |
|
| 109 | - } |
|
| 110 | - } |
|
| 89 | + $tables = []; |
|
| 90 | + $result = sql_showbase(); |
|
| 91 | + |
|
| 92 | + // on n'optimise qu'une seule table a chaque fois, |
|
| 93 | + // pour ne pas vautrer le systeme |
|
| 94 | + // lire http://dev.mysql.com/doc/refman/5.0/fr/optimize-table.html |
|
| 95 | + while ($row = sql_fetch($result)) { |
|
| 96 | + $tables[] = array_shift($row); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + spip_log('optimiser_base_une_table ' . json_encode($tables, JSON_THROW_ON_ERROR), 'genie' . _LOG_DEBUG); |
|
| 100 | + if ($tables) { |
|
| 101 | + $table_op = intval(lire_config('optimiser_table', 0) + 1) % sizeof($tables); |
|
| 102 | + ecrire_config('optimiser_table', $table_op); |
|
| 103 | + $q = $tables[$table_op]; |
|
| 104 | + spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie' . _LOG_DEBUG); |
|
| 105 | + if (sql_optimize($q)) { |
|
| 106 | + spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie' . _LOG_DEBUG); |
|
| 107 | + } else { |
|
| 108 | + spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie' . _LOG_DEBUG); |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -133,18 +133,18 @@ discard block |
||
| 133 | 133 | * Nombre de suppressions |
| 134 | 134 | **/ |
| 135 | 135 | function optimiser_sansref($table, $id, $sel, $and = '') { |
| 136 | - $in = []; |
|
| 137 | - while ($row = sql_fetch($sel)) { |
|
| 138 | - $in[$row['id']] = true; |
|
| 139 | - } |
|
| 140 | - sql_free($sel); |
|
| 141 | - |
|
| 142 | - if ($in) { |
|
| 143 | - sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : '')); |
|
| 144 | - spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie' . _LOG_DEBUG); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - return count($in); |
|
| 136 | + $in = []; |
|
| 137 | + while ($row = sql_fetch($sel)) { |
|
| 138 | + $in[$row['id']] = true; |
|
| 139 | + } |
|
| 140 | + sql_free($sel); |
|
| 141 | + |
|
| 142 | + if ($in) { |
|
| 143 | + sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : '')); |
|
| 144 | + spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie' . _LOG_DEBUG); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + return count($in); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -166,81 +166,81 @@ discard block |
||
| 166 | 166 | **/ |
| 167 | 167 | function optimiser_base_disparus($attente = 86400) { |
| 168 | 168 | |
| 169 | - # format = 20060610110141, si on veut forcer une optimisation tout de suite |
|
| 170 | - $mydate = date('Y-m-d H:i:s', time() - $attente); |
|
| 171 | - $mydate_quote = sql_quote($mydate); |
|
| 169 | + # format = 20060610110141, si on veut forcer une optimisation tout de suite |
|
| 170 | + $mydate = date('Y-m-d H:i:s', time() - $attente); |
|
| 171 | + $mydate_quote = sql_quote($mydate); |
|
| 172 | 172 | |
| 173 | - $n = 0; |
|
| 173 | + $n = 0; |
|
| 174 | 174 | |
| 175 | - // |
|
| 176 | - // Rubriques |
|
| 177 | - // |
|
| 175 | + // |
|
| 176 | + // Rubriques |
|
| 177 | + // |
|
| 178 | 178 | |
| 179 | - # les articles qui sont dans une id_rubrique inexistante |
|
| 180 | - # attention on controle id_rubrique>0 pour ne pas tuer les articles |
|
| 181 | - # specialement affectes a une rubrique non-existante (plugin, |
|
| 182 | - # cf. https://core.spip.net/issues/1549 ) |
|
| 183 | - $res = sql_select( |
|
| 184 | - 'A.id_article AS id', |
|
| 185 | - 'spip_articles AS A |
|
| 179 | + # les articles qui sont dans une id_rubrique inexistante |
|
| 180 | + # attention on controle id_rubrique>0 pour ne pas tuer les articles |
|
| 181 | + # specialement affectes a une rubrique non-existante (plugin, |
|
| 182 | + # cf. https://core.spip.net/issues/1549 ) |
|
| 183 | + $res = sql_select( |
|
| 184 | + 'A.id_article AS id', |
|
| 185 | + 'spip_articles AS A |
|
| 186 | 186 | LEFT JOIN spip_rubriques AS R |
| 187 | 187 | ON A.id_rubrique=R.id_rubrique', |
| 188 | - "A.id_rubrique > 0 |
|
| 188 | + "A.id_rubrique > 0 |
|
| 189 | 189 | AND R.id_rubrique IS NULL |
| 190 | 190 | AND A.maj < $mydate_quote" |
| 191 | - ); |
|
| 191 | + ); |
|
| 192 | 192 | |
| 193 | - $n += optimiser_sansref('spip_articles', 'id_article', $res); |
|
| 193 | + $n += optimiser_sansref('spip_articles', 'id_article', $res); |
|
| 194 | 194 | |
| 195 | - // les articles a la poubelle |
|
| 196 | - sql_delete('spip_articles', "statut='poubelle' AND maj < $mydate_quote"); |
|
| 195 | + // les articles a la poubelle |
|
| 196 | + sql_delete('spip_articles', "statut='poubelle' AND maj < $mydate_quote"); |
|
| 197 | 197 | |
| 198 | - // |
|
| 199 | - // Auteurs |
|
| 200 | - // |
|
| 198 | + // |
|
| 199 | + // Auteurs |
|
| 200 | + // |
|
| 201 | 201 | |
| 202 | - include_spip('action/editer_liens'); |
|
| 203 | - // optimiser les liens de tous les auteurs vers des objets effaces |
|
| 204 | - // et depuis des auteurs effaces |
|
| 205 | - $n += objet_optimiser_liens(['auteur' => '*'], '*'); |
|
| 202 | + include_spip('action/editer_liens'); |
|
| 203 | + // optimiser les liens de tous les auteurs vers des objets effaces |
|
| 204 | + // et depuis des auteurs effaces |
|
| 205 | + $n += objet_optimiser_liens(['auteur' => '*'], '*'); |
|
| 206 | 206 | |
| 207 | - # effacer les auteurs poubelle qui ne sont lies a rien |
|
| 208 | - $res = sql_select( |
|
| 209 | - 'A.id_auteur AS id', |
|
| 210 | - 'spip_auteurs AS A |
|
| 207 | + # effacer les auteurs poubelle qui ne sont lies a rien |
|
| 208 | + $res = sql_select( |
|
| 209 | + 'A.id_auteur AS id', |
|
| 210 | + 'spip_auteurs AS A |
|
| 211 | 211 | LEFT JOIN spip_auteurs_liens AS L |
| 212 | 212 | ON L.id_auteur=A.id_auteur', |
| 213 | - "L.id_auteur IS NULL |
|
| 213 | + "L.id_auteur IS NULL |
|
| 214 | 214 | AND A.statut='5poubelle' AND A.maj < $mydate_quote" |
| 215 | - ); |
|
| 216 | - |
|
| 217 | - $n += optimiser_sansref('spip_auteurs', 'id_auteur', $res); |
|
| 218 | - |
|
| 219 | - # supprimer les auteurs 'nouveau' qui n'ont jamais donne suite |
|
| 220 | - # au mail de confirmation (45 jours pour repondre, ca devrait suffire) |
|
| 221 | - if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) { |
|
| 222 | - define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600); |
|
| 223 | - } |
|
| 224 | - sql_delete('spip_auteurs', "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU)))); |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Permet aux plugins de compléter l'optimisation suite aux éléments disparus |
|
| 228 | - * |
|
| 229 | - * L'index 'data' est un entier indiquant le nombre d'optimisations |
|
| 230 | - * qui ont été réalisées (par exemple le nombre de suppressions faites) |
|
| 231 | - * et qui doit être incrémenté par les fonctions |
|
| 232 | - * utilisant ce pipeline si elles suppriment des éléments. |
|
| 233 | - * |
|
| 234 | - * @pipeline_appel optimiser_base_disparus |
|
| 235 | - */ |
|
| 236 | - $n = pipeline('optimiser_base_disparus', [ |
|
| 237 | - 'args' => [ |
|
| 238 | - 'attente' => $attente, |
|
| 239 | - 'date' => $mydate |
|
| 240 | - ], |
|
| 241 | - 'data' => $n |
|
| 242 | - ]); |
|
| 243 | - |
|
| 244 | - |
|
| 245 | - spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie' . _LOG_DEBUG); |
|
| 215 | + ); |
|
| 216 | + |
|
| 217 | + $n += optimiser_sansref('spip_auteurs', 'id_auteur', $res); |
|
| 218 | + |
|
| 219 | + # supprimer les auteurs 'nouveau' qui n'ont jamais donne suite |
|
| 220 | + # au mail de confirmation (45 jours pour repondre, ca devrait suffire) |
|
| 221 | + if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) { |
|
| 222 | + define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600); |
|
| 223 | + } |
|
| 224 | + sql_delete('spip_auteurs', "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU)))); |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Permet aux plugins de compléter l'optimisation suite aux éléments disparus |
|
| 228 | + * |
|
| 229 | + * L'index 'data' est un entier indiquant le nombre d'optimisations |
|
| 230 | + * qui ont été réalisées (par exemple le nombre de suppressions faites) |
|
| 231 | + * et qui doit être incrémenté par les fonctions |
|
| 232 | + * utilisant ce pipeline si elles suppriment des éléments. |
|
| 233 | + * |
|
| 234 | + * @pipeline_appel optimiser_base_disparus |
|
| 235 | + */ |
|
| 236 | + $n = pipeline('optimiser_base_disparus', [ |
|
| 237 | + 'args' => [ |
|
| 238 | + 'attente' => $attente, |
|
| 239 | + 'date' => $mydate |
|
| 240 | + ], |
|
| 241 | + 'data' => $n |
|
| 242 | + ]); |
|
| 243 | + |
|
| 244 | + |
|
| 245 | + spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie' . _LOG_DEBUG); |
|
| 246 | 246 | } |